@workglow/tasks 0.0.121 → 0.0.123
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.js +1049 -266
- package/dist/browser.js.map +60 -55
- package/dist/bun.js +1069 -269
- package/dist/bun.js.map +60 -55
- package/dist/common.d.ts +3 -1
- package/dist/common.d.ts.map +1 -1
- package/dist/node.js +1069 -269
- package/dist/node.js.map +60 -55
- package/dist/task/ArrayTask.d.ts +2 -11
- package/dist/task/ArrayTask.d.ts.map +1 -1
- package/dist/task/DateFormatTask.d.ts +1 -1
- package/dist/task/DateFormatTask.d.ts.map +1 -1
- package/dist/task/DebugLogTask.d.ts +4 -2
- package/dist/task/DebugLogTask.d.ts.map +1 -1
- package/dist/task/DelayTask.d.ts +4 -2
- package/dist/task/DelayTask.d.ts.map +1 -1
- package/dist/task/FetchUrlTask.d.ts +24 -2
- package/dist/task/FetchUrlTask.d.ts.map +1 -1
- package/dist/task/FileLoaderTask.d.ts +11 -8
- package/dist/task/FileLoaderTask.d.ts.map +1 -1
- package/dist/task/FileLoaderTask.server.d.ts +10 -7
- package/dist/task/FileLoaderTask.server.d.ts.map +1 -1
- package/dist/task/InputTask.d.ts +1 -2
- package/dist/task/InputTask.d.ts.map +1 -1
- package/dist/task/JavaScriptTask.d.ts +14 -11
- package/dist/task/JavaScriptTask.d.ts.map +1 -1
- package/dist/task/JsonPathTask.d.ts +1 -1
- package/dist/task/JsonPathTask.d.ts.map +1 -1
- package/dist/task/JsonTask.d.ts +4 -2
- package/dist/task/JsonTask.d.ts.map +1 -1
- package/dist/task/LambdaTask.d.ts +3 -3
- package/dist/task/LambdaTask.d.ts.map +1 -1
- package/dist/task/MergeTask.d.ts +4 -2
- package/dist/task/MergeTask.d.ts.map +1 -1
- package/dist/task/OutputTask.d.ts +1 -2
- package/dist/task/OutputTask.d.ts.map +1 -1
- package/dist/task/RegexTask.d.ts +1 -1
- package/dist/task/RegexTask.d.ts.map +1 -1
- package/dist/task/SplitTask.d.ts +4 -2
- package/dist/task/SplitTask.d.ts.map +1 -1
- package/dist/task/TemplateTask.d.ts +1 -1
- package/dist/task/TemplateTask.d.ts.map +1 -1
- package/dist/task/adaptive.d.ts.map +1 -1
- package/dist/task/mcp/McpListTask.d.ts +246 -561
- package/dist/task/mcp/McpListTask.d.ts.map +1 -1
- package/dist/task/mcp/McpPromptGetTask.d.ts +85 -495
- package/dist/task/mcp/McpPromptGetTask.d.ts.map +1 -1
- package/dist/task/mcp/McpResourceReadTask.d.ts +20 -495
- package/dist/task/mcp/McpResourceReadTask.d.ts.map +1 -1
- package/dist/task/mcp/McpSearchTask.d.ts +111 -0
- package/dist/task/mcp/McpSearchTask.d.ts.map +1 -0
- package/dist/task/mcp/McpToolCallTask.d.ts +5 -498
- package/dist/task/mcp/McpToolCallTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarAbsTask.d.ts +1 -1
- package/dist/task/scalar/ScalarAbsTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarAddTask.d.ts +1 -1
- package/dist/task/scalar/ScalarAddTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarCeilTask.d.ts +1 -1
- package/dist/task/scalar/ScalarCeilTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarDivideTask.d.ts +1 -1
- package/dist/task/scalar/ScalarDivideTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarFloorTask.d.ts +1 -1
- package/dist/task/scalar/ScalarFloorTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarMaxTask.d.ts +1 -1
- package/dist/task/scalar/ScalarMaxTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarMinTask.d.ts +1 -1
- package/dist/task/scalar/ScalarMinTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarMultiplyTask.d.ts +1 -1
- package/dist/task/scalar/ScalarMultiplyTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarRoundTask.d.ts +1 -1
- package/dist/task/scalar/ScalarRoundTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarSubtractTask.d.ts +1 -1
- package/dist/task/scalar/ScalarSubtractTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarSumTask.d.ts +1 -1
- package/dist/task/scalar/ScalarSumTask.d.ts.map +1 -1
- package/dist/task/scalar/ScalarTruncTask.d.ts +1 -1
- package/dist/task/scalar/ScalarTruncTask.d.ts.map +1 -1
- package/dist/task/scalar/sumPrecise.d.ts.map +1 -1
- package/dist/task/string/StringConcatTask.d.ts +1 -1
- package/dist/task/string/StringConcatTask.d.ts.map +1 -1
- package/dist/task/string/StringIncludesTask.d.ts +1 -1
- package/dist/task/string/StringIncludesTask.d.ts.map +1 -1
- package/dist/task/string/StringJoinTask.d.ts +1 -1
- package/dist/task/string/StringJoinTask.d.ts.map +1 -1
- package/dist/task/string/StringLengthTask.d.ts +1 -1
- package/dist/task/string/StringLengthTask.d.ts.map +1 -1
- package/dist/task/string/StringLowerCaseTask.d.ts +1 -1
- package/dist/task/string/StringLowerCaseTask.d.ts.map +1 -1
- package/dist/task/string/StringReplaceTask.d.ts +1 -1
- package/dist/task/string/StringReplaceTask.d.ts.map +1 -1
- package/dist/task/string/StringSliceTask.d.ts +1 -1
- package/dist/task/string/StringSliceTask.d.ts.map +1 -1
- package/dist/task/string/StringTemplateTask.d.ts +1 -1
- package/dist/task/string/StringTemplateTask.d.ts.map +1 -1
- package/dist/task/string/StringTrimTask.d.ts +1 -1
- package/dist/task/string/StringTrimTask.d.ts.map +1 -1
- package/dist/task/string/StringUpperCaseTask.d.ts +1 -1
- package/dist/task/string/StringUpperCaseTask.d.ts.map +1 -1
- package/dist/task/vector/VectorDistanceTask.d.ts +1 -1
- package/dist/task/vector/VectorDistanceTask.d.ts.map +1 -1
- package/dist/task/vector/VectorDivideTask.d.ts +1 -1
- package/dist/task/vector/VectorDivideTask.d.ts.map +1 -1
- package/dist/task/vector/VectorDotProductTask.d.ts +1 -1
- package/dist/task/vector/VectorDotProductTask.d.ts.map +1 -1
- package/dist/task/vector/VectorMultiplyTask.d.ts +1 -1
- package/dist/task/vector/VectorMultiplyTask.d.ts.map +1 -1
- package/dist/task/vector/VectorNormalizeTask.d.ts +1 -1
- package/dist/task/vector/VectorNormalizeTask.d.ts.map +1 -1
- package/dist/task/vector/VectorScaleTask.d.ts +1 -1
- package/dist/task/vector/VectorScaleTask.d.ts.map +1 -1
- package/dist/task/vector/VectorSubtractTask.d.ts +1 -1
- package/dist/task/vector/VectorSubtractTask.d.ts.map +1 -1
- package/dist/task/vector/VectorSumTask.d.ts +1 -1
- package/dist/task/vector/VectorSumTask.d.ts.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/util/McpAuthProvider.d.ts +70 -0
- package/dist/util/McpAuthProvider.d.ts.map +1 -0
- package/dist/util/McpAuthTypes.d.ts +218 -0
- package/dist/util/McpAuthTypes.d.ts.map +1 -0
- package/dist/util/McpClientUtil.browser.d.ts +101 -0
- package/dist/util/McpClientUtil.browser.d.ts.map +1 -0
- package/dist/util/McpClientUtil.node.d.ts +122 -0
- package/dist/util/McpClientUtil.node.d.ts.map +1 -0
- package/dist/util/McpTaskDeps.d.ts +40 -0
- package/dist/util/McpTaskDeps.d.ts.map +1 -0
- package/dist/util/acorn.d.ts +3 -12
- package/dist/util/acorn.d.ts.map +1 -1
- package/dist/util/interpreter.d.ts +11 -486
- package/dist/util/interpreter.d.ts.map +1 -1
- package/package.json +21 -16
package/dist/node.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
3
3
|
|
|
4
|
-
// src/node.ts
|
|
5
|
-
import { TaskRegistry as TaskRegistry2 } from "@workglow/task-graph";
|
|
6
|
-
|
|
7
4
|
// src/task/adaptive.ts
|
|
8
5
|
import { CreateAdaptiveWorkflow, Workflow as Workflow10 } from "@workglow/task-graph";
|
|
9
6
|
|
|
@@ -270,7 +267,7 @@ import { CreateWorkflow as CreateWorkflow6, Task as Task6, Workflow as Workflow6
|
|
|
270
267
|
import {
|
|
271
268
|
createTypedArrayFrom,
|
|
272
269
|
TypedArraySchema
|
|
273
|
-
} from "@workglow/util";
|
|
270
|
+
} from "@workglow/util/schema";
|
|
274
271
|
var inputSchema6 = {
|
|
275
272
|
type: "object",
|
|
276
273
|
properties: {
|
|
@@ -338,7 +335,7 @@ import { CreateWorkflow as CreateWorkflow7, Task as Task7, Workflow as Workflow7
|
|
|
338
335
|
import {
|
|
339
336
|
createTypedArrayFrom as createTypedArrayFrom2,
|
|
340
337
|
TypedArraySchema as TypedArraySchema2
|
|
341
|
-
} from "@workglow/util";
|
|
338
|
+
} from "@workglow/util/schema";
|
|
342
339
|
var inputSchema7 = {
|
|
343
340
|
type: "object",
|
|
344
341
|
properties: {
|
|
@@ -400,7 +397,7 @@ import { CreateWorkflow as CreateWorkflow8, Task as Task8, Workflow as Workflow8
|
|
|
400
397
|
import {
|
|
401
398
|
createTypedArrayFrom as createTypedArrayFrom3,
|
|
402
399
|
TypedArraySchema as TypedArraySchema3
|
|
403
|
-
} from "@workglow/util";
|
|
400
|
+
} from "@workglow/util/schema";
|
|
404
401
|
var inputSchema8 = {
|
|
405
402
|
type: "object",
|
|
406
403
|
properties: {
|
|
@@ -468,7 +465,7 @@ import { CreateWorkflow as CreateWorkflow9, Task as Task9, Workflow as Workflow9
|
|
|
468
465
|
import {
|
|
469
466
|
createTypedArrayFrom as createTypedArrayFrom4,
|
|
470
467
|
TypedArraySchema as TypedArraySchema4
|
|
471
|
-
} from "@workglow/util";
|
|
468
|
+
} from "@workglow/util/schema";
|
|
472
469
|
var inputSchema9 = {
|
|
473
470
|
type: "object",
|
|
474
471
|
properties: {
|
|
@@ -533,23 +530,23 @@ Workflow10.prototype.divide = CreateAdaptiveWorkflow(ScalarDivideTask, VectorDiv
|
|
|
533
530
|
Workflow10.prototype.sum = CreateAdaptiveWorkflow(ScalarSumTask, VectorSumTask);
|
|
534
531
|
|
|
535
532
|
// src/task/ArrayTask.ts
|
|
536
|
-
import {
|
|
537
|
-
uuid4
|
|
538
|
-
} from "@workglow/util";
|
|
533
|
+
import { uuid4 } from "@workglow/util";
|
|
539
534
|
import {
|
|
540
535
|
GraphAsTask,
|
|
541
536
|
GraphAsTaskRunner,
|
|
542
537
|
PROPERTY_ARRAY,
|
|
543
538
|
TaskGraph
|
|
544
539
|
} from "@workglow/task-graph";
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
540
|
+
function TypeReplicateArray(type, annotations = {}) {
|
|
541
|
+
return {
|
|
542
|
+
oneOf: [type, { type: "array", items: type }],
|
|
543
|
+
title: type.title,
|
|
544
|
+
description: type.description,
|
|
545
|
+
...type.format ? { format: type.format } : {},
|
|
546
|
+
...annotations,
|
|
547
|
+
"x-replicate": true
|
|
548
|
+
};
|
|
549
|
+
}
|
|
553
550
|
|
|
554
551
|
class ArrayTask extends GraphAsTask {
|
|
555
552
|
static type = "ArrayTask";
|
|
@@ -1152,9 +1149,6 @@ class InputTask extends Task12 {
|
|
|
1152
1149
|
outputSchema() {
|
|
1153
1150
|
return this.config?.outputSchema ?? this.constructor.outputSchema();
|
|
1154
1151
|
}
|
|
1155
|
-
async execute(input) {
|
|
1156
|
-
return input;
|
|
1157
|
-
}
|
|
1158
1152
|
async executeReactive(input) {
|
|
1159
1153
|
return input;
|
|
1160
1154
|
}
|
|
@@ -5978,9 +5972,6 @@ class OutputTask extends Task16 {
|
|
|
5978
5972
|
outputSchema() {
|
|
5979
5973
|
return this.config?.outputSchema ?? this.constructor.outputSchema();
|
|
5980
5974
|
}
|
|
5981
|
-
async execute(input2) {
|
|
5982
|
-
return input2;
|
|
5983
|
-
}
|
|
5984
5975
|
async executeReactive(input2) {
|
|
5985
5976
|
return input2;
|
|
5986
5977
|
}
|
|
@@ -6372,26 +6363,22 @@ class TemplateTask extends Task21 {
|
|
|
6372
6363
|
Workflow24.prototype.template = CreateWorkflow23(TemplateTask);
|
|
6373
6364
|
// src/task/mcp/McpListTask.ts
|
|
6374
6365
|
import { CreateWorkflow as CreateWorkflow24, Task as Task22, Workflow as Workflow25 } from "@workglow/task-graph";
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6366
|
+
|
|
6367
|
+
// src/util/McpTaskDeps.ts
|
|
6368
|
+
import { createServiceToken, globalServiceRegistry } from "@workglow/util";
|
|
6369
|
+
var MCP_TASK_DEPS = createServiceToken("@workglow/tasks/mcp");
|
|
6370
|
+
function registerMcpTaskDeps(deps) {
|
|
6371
|
+
globalServiceRegistry.registerInstance(MCP_TASK_DEPS, deps);
|
|
6372
|
+
}
|
|
6373
|
+
function getMcpTaskDeps() {
|
|
6374
|
+
if (!globalServiceRegistry.has(MCP_TASK_DEPS)) {
|
|
6375
|
+
throw new Error("MCP task dependencies not registered. Import @workglow/tasks from a platform entry (browser, node, or bun) before using MCP tasks.");
|
|
6376
|
+
}
|
|
6377
|
+
return globalServiceRegistry.get(MCP_TASK_DEPS);
|
|
6378
|
+
}
|
|
6379
|
+
|
|
6380
|
+
// src/task/mcp/McpListTask.ts
|
|
6379
6381
|
var mcpListTypes = ["tools", "resources", "prompts"];
|
|
6380
|
-
var inputSchema22 = {
|
|
6381
|
-
type: "object",
|
|
6382
|
-
properties: {
|
|
6383
|
-
...mcpServerConfigSchema.properties,
|
|
6384
|
-
list_type: {
|
|
6385
|
-
type: "string",
|
|
6386
|
-
enum: mcpListTypes,
|
|
6387
|
-
title: "List Type",
|
|
6388
|
-
description: "The type of items to list from the MCP server"
|
|
6389
|
-
}
|
|
6390
|
-
},
|
|
6391
|
-
required: ["transport", "list_type"],
|
|
6392
|
-
allOf: mcpServerConfigSchema.allOf,
|
|
6393
|
-
additionalProperties: false
|
|
6394
|
-
};
|
|
6395
6382
|
var iconSchema = {
|
|
6396
6383
|
type: "object",
|
|
6397
6384
|
properties: {
|
|
@@ -6555,7 +6542,22 @@ class McpListTask extends Task22 {
|
|
|
6555
6542
|
static cacheable = false;
|
|
6556
6543
|
static hasDynamicSchemas = true;
|
|
6557
6544
|
static inputSchema() {
|
|
6558
|
-
|
|
6545
|
+
const { mcpServerConfigSchema } = getMcpTaskDeps();
|
|
6546
|
+
return {
|
|
6547
|
+
type: "object",
|
|
6548
|
+
properties: {
|
|
6549
|
+
...mcpServerConfigSchema.properties,
|
|
6550
|
+
list_type: {
|
|
6551
|
+
type: "string",
|
|
6552
|
+
enum: mcpListTypes,
|
|
6553
|
+
title: "List Type",
|
|
6554
|
+
description: "The type of items to list from the MCP server"
|
|
6555
|
+
}
|
|
6556
|
+
},
|
|
6557
|
+
required: ["transport", "list_type"],
|
|
6558
|
+
allOf: mcpServerConfigSchema.allOf,
|
|
6559
|
+
additionalProperties: false
|
|
6560
|
+
};
|
|
6559
6561
|
}
|
|
6560
6562
|
static outputSchema() {
|
|
6561
6563
|
return outputSchemaAll;
|
|
@@ -6589,9 +6591,11 @@ class McpListTask extends Task22 {
|
|
|
6589
6591
|
}
|
|
6590
6592
|
}
|
|
6591
6593
|
async execute(input2, context) {
|
|
6594
|
+
const { mcpClientFactory } = getMcpTaskDeps();
|
|
6592
6595
|
const { client } = await mcpClientFactory.create(input2, context.signal);
|
|
6596
|
+
const listType = input2.list_type;
|
|
6593
6597
|
try {
|
|
6594
|
-
switch (
|
|
6598
|
+
switch (listType) {
|
|
6595
6599
|
case "tools": {
|
|
6596
6600
|
const result = await client.listTools();
|
|
6597
6601
|
return { tools: result.tools };
|
|
@@ -6605,7 +6609,7 @@ class McpListTask extends Task22 {
|
|
|
6605
6609
|
return { prompts: result.prompts };
|
|
6606
6610
|
}
|
|
6607
6611
|
default:
|
|
6608
|
-
throw new Error(`Unsupported list type: ${
|
|
6612
|
+
throw new Error(`Unsupported list type: ${String(listType)}`);
|
|
6609
6613
|
}
|
|
6610
6614
|
} finally {
|
|
6611
6615
|
await client.close();
|
|
@@ -6623,29 +6627,6 @@ import {
|
|
|
6623
6627
|
TaskConfigSchema as TaskConfigSchema5,
|
|
6624
6628
|
Workflow as Workflow26
|
|
6625
6629
|
} from "@workglow/task-graph";
|
|
6626
|
-
import {
|
|
6627
|
-
mcpClientFactory as mcpClientFactory2,
|
|
6628
|
-
mcpServerConfigSchema as mcpServerConfigSchema2
|
|
6629
|
-
} from "@workglow/util";
|
|
6630
|
-
var configSchema2 = {
|
|
6631
|
-
type: "object",
|
|
6632
|
-
properties: {
|
|
6633
|
-
...TaskConfigSchema5["properties"],
|
|
6634
|
-
...mcpServerConfigSchema2.properties,
|
|
6635
|
-
prompt_name: {
|
|
6636
|
-
type: "string",
|
|
6637
|
-
title: "Prompt Name",
|
|
6638
|
-
description: "The name of the prompt to get",
|
|
6639
|
-
format: "string:mcp-promptname"
|
|
6640
|
-
}
|
|
6641
|
-
},
|
|
6642
|
-
required: ["transport", "prompt_name"],
|
|
6643
|
-
if: { properties: { transport: { const: "stdio" } }, required: ["transport"] },
|
|
6644
|
-
then: { required: ["command"] },
|
|
6645
|
-
else: { required: ["server_url"] },
|
|
6646
|
-
allOf: mcpServerConfigSchema2.allOf,
|
|
6647
|
-
additionalProperties: false
|
|
6648
|
-
};
|
|
6649
6630
|
var annotationsSchema = {
|
|
6650
6631
|
type: "object",
|
|
6651
6632
|
properties: {
|
|
@@ -6794,7 +6775,26 @@ class McpPromptGetTask extends Task23 {
|
|
|
6794
6775
|
return fallbackOutputSchema;
|
|
6795
6776
|
}
|
|
6796
6777
|
static configSchema() {
|
|
6797
|
-
|
|
6778
|
+
const { mcpServerConfigSchema } = getMcpTaskDeps();
|
|
6779
|
+
return {
|
|
6780
|
+
type: "object",
|
|
6781
|
+
properties: {
|
|
6782
|
+
...TaskConfigSchema5["properties"],
|
|
6783
|
+
...mcpServerConfigSchema.properties,
|
|
6784
|
+
prompt_name: {
|
|
6785
|
+
type: "string",
|
|
6786
|
+
title: "Prompt Name",
|
|
6787
|
+
description: "The name of the prompt to get",
|
|
6788
|
+
format: "string:mcp-promptname"
|
|
6789
|
+
}
|
|
6790
|
+
},
|
|
6791
|
+
required: ["transport", "prompt_name"],
|
|
6792
|
+
if: { properties: { transport: { const: "stdio" } }, required: ["transport"] },
|
|
6793
|
+
then: { required: ["command"] },
|
|
6794
|
+
else: { required: ["server_url"] },
|
|
6795
|
+
allOf: mcpServerConfigSchema.allOf,
|
|
6796
|
+
additionalProperties: false
|
|
6797
|
+
};
|
|
6798
6798
|
}
|
|
6799
6799
|
inputSchema() {
|
|
6800
6800
|
return this.config?.inputSchema ?? fallbackInputSchema;
|
|
@@ -6845,10 +6845,11 @@ class McpPromptGetTask extends Task23 {
|
|
|
6845
6845
|
}
|
|
6846
6846
|
async execute(input2, context) {
|
|
6847
6847
|
await this.discoverSchemas(context.signal);
|
|
6848
|
-
const {
|
|
6848
|
+
const { mcpClientFactory } = getMcpTaskDeps();
|
|
6849
|
+
const { client } = await mcpClientFactory.create(this.config, context.signal);
|
|
6849
6850
|
try {
|
|
6850
6851
|
const result = await client.getPrompt({
|
|
6851
|
-
name: this.config.prompt_name,
|
|
6852
|
+
name: String(this.config.prompt_name ?? ""),
|
|
6852
6853
|
arguments: input2
|
|
6853
6854
|
});
|
|
6854
6855
|
return {
|
|
@@ -6871,29 +6872,6 @@ import {
|
|
|
6871
6872
|
TaskConfigSchema as TaskConfigSchema6,
|
|
6872
6873
|
Workflow as Workflow27
|
|
6873
6874
|
} from "@workglow/task-graph";
|
|
6874
|
-
import {
|
|
6875
|
-
mcpClientFactory as mcpClientFactory3,
|
|
6876
|
-
mcpServerConfigSchema as mcpServerConfigSchema3
|
|
6877
|
-
} from "@workglow/util";
|
|
6878
|
-
var configSchema3 = {
|
|
6879
|
-
type: "object",
|
|
6880
|
-
properties: {
|
|
6881
|
-
...TaskConfigSchema6["properties"],
|
|
6882
|
-
...mcpServerConfigSchema3.properties,
|
|
6883
|
-
resource_uri: {
|
|
6884
|
-
type: "string",
|
|
6885
|
-
title: "Resource URI",
|
|
6886
|
-
description: "The URI of the resource to read",
|
|
6887
|
-
format: "string:uri:mcp-resourceuri"
|
|
6888
|
-
}
|
|
6889
|
-
},
|
|
6890
|
-
required: ["transport", "resource_uri"],
|
|
6891
|
-
if: { properties: { transport: { const: "stdio" } }, required: ["transport"] },
|
|
6892
|
-
then: { required: ["command"] },
|
|
6893
|
-
else: { required: ["server_url"] },
|
|
6894
|
-
allOf: mcpServerConfigSchema3.allOf,
|
|
6895
|
-
additionalProperties: false
|
|
6896
|
-
};
|
|
6897
6875
|
var contentItemSchema = {
|
|
6898
6876
|
anyOf: [
|
|
6899
6877
|
{
|
|
@@ -6920,7 +6898,7 @@ var contentItemSchema = {
|
|
|
6920
6898
|
}
|
|
6921
6899
|
]
|
|
6922
6900
|
};
|
|
6923
|
-
var
|
|
6901
|
+
var inputSchema22 = {
|
|
6924
6902
|
type: "object",
|
|
6925
6903
|
properties: {},
|
|
6926
6904
|
additionalProperties: false
|
|
@@ -6947,18 +6925,40 @@ class McpResourceReadTask extends Task24 {
|
|
|
6947
6925
|
static cacheable = false;
|
|
6948
6926
|
static customizable = true;
|
|
6949
6927
|
static inputSchema() {
|
|
6950
|
-
return
|
|
6928
|
+
return inputSchema22;
|
|
6951
6929
|
}
|
|
6952
6930
|
static outputSchema() {
|
|
6953
6931
|
return outputSchema22;
|
|
6954
6932
|
}
|
|
6955
6933
|
static configSchema() {
|
|
6956
|
-
|
|
6934
|
+
const { mcpServerConfigSchema } = getMcpTaskDeps();
|
|
6935
|
+
return {
|
|
6936
|
+
type: "object",
|
|
6937
|
+
properties: {
|
|
6938
|
+
...TaskConfigSchema6["properties"],
|
|
6939
|
+
...mcpServerConfigSchema.properties,
|
|
6940
|
+
resource_uri: {
|
|
6941
|
+
type: "string",
|
|
6942
|
+
title: "Resource URI",
|
|
6943
|
+
description: "The URI of the resource to read",
|
|
6944
|
+
format: "string:uri:mcp-resourceuri"
|
|
6945
|
+
}
|
|
6946
|
+
},
|
|
6947
|
+
required: ["transport", "resource_uri"],
|
|
6948
|
+
if: { properties: { transport: { const: "stdio" } }, required: ["transport"] },
|
|
6949
|
+
then: { required: ["command"] },
|
|
6950
|
+
else: { required: ["server_url"] },
|
|
6951
|
+
allOf: mcpServerConfigSchema.allOf,
|
|
6952
|
+
additionalProperties: false
|
|
6953
|
+
};
|
|
6957
6954
|
}
|
|
6958
6955
|
async execute(_input, context) {
|
|
6959
|
-
const {
|
|
6956
|
+
const { mcpClientFactory } = getMcpTaskDeps();
|
|
6957
|
+
const { client } = await mcpClientFactory.create(this.config, context.signal);
|
|
6960
6958
|
try {
|
|
6961
|
-
const result = await client.readResource({
|
|
6959
|
+
const result = await client.readResource({
|
|
6960
|
+
uri: String(this.config.resource_uri ?? "")
|
|
6961
|
+
});
|
|
6962
6962
|
return { contents: result.contents };
|
|
6963
6963
|
} finally {
|
|
6964
6964
|
await client.close();
|
|
@@ -6969,36 +6969,174 @@ var mcpResourceRead = async (config) => {
|
|
|
6969
6969
|
return new McpResourceReadTask({}, config).run({});
|
|
6970
6970
|
};
|
|
6971
6971
|
Workflow27.prototype.mcpResourceRead = CreateWorkflow26(McpResourceReadTask);
|
|
6972
|
-
// src/task/mcp/
|
|
6973
|
-
import {
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
TaskConfigSchema as TaskConfigSchema7,
|
|
6977
|
-
Workflow as Workflow28
|
|
6978
|
-
} from "@workglow/task-graph";
|
|
6979
|
-
import {
|
|
6980
|
-
mcpClientFactory as mcpClientFactory4,
|
|
6981
|
-
mcpServerConfigSchema as mcpServerConfigSchema4
|
|
6982
|
-
} from "@workglow/util";
|
|
6983
|
-
var configSchema4 = {
|
|
6972
|
+
// src/task/mcp/McpSearchTask.ts
|
|
6973
|
+
import { CreateWorkflow as CreateWorkflow27, Task as Task25, Workflow as Workflow28 } from "@workglow/task-graph";
|
|
6974
|
+
var MCP_REGISTRY_BASE = "https://registry.modelcontextprotocol.io/v0.1";
|
|
6975
|
+
var McpSearchInputSchema = {
|
|
6984
6976
|
type: "object",
|
|
6985
6977
|
properties: {
|
|
6986
|
-
|
|
6987
|
-
...mcpServerConfigSchema4.properties,
|
|
6988
|
-
tool_name: {
|
|
6978
|
+
query: {
|
|
6989
6979
|
type: "string",
|
|
6990
|
-
title: "
|
|
6991
|
-
description: "
|
|
6992
|
-
format: "string:mcp-toolname"
|
|
6980
|
+
title: "Query",
|
|
6981
|
+
description: "Search query for the MCP registry"
|
|
6993
6982
|
}
|
|
6994
6983
|
},
|
|
6995
|
-
required: ["
|
|
6996
|
-
if: { properties: { transport: { const: "stdio" } }, required: ["transport"] },
|
|
6997
|
-
then: { required: ["command"] },
|
|
6998
|
-
else: { required: ["server_url"] },
|
|
6999
|
-
allOf: mcpServerConfigSchema4.allOf,
|
|
6984
|
+
required: ["query"],
|
|
7000
6985
|
additionalProperties: false
|
|
7001
6986
|
};
|
|
6987
|
+
var McpSearchOutputSchema = {
|
|
6988
|
+
type: "object",
|
|
6989
|
+
properties: {
|
|
6990
|
+
results: {
|
|
6991
|
+
type: "array",
|
|
6992
|
+
items: {
|
|
6993
|
+
type: "object",
|
|
6994
|
+
properties: {
|
|
6995
|
+
id: { type: "string" },
|
|
6996
|
+
label: { type: "string" },
|
|
6997
|
+
description: { type: "string" },
|
|
6998
|
+
config: { type: "object", additionalProperties: true }
|
|
6999
|
+
},
|
|
7000
|
+
required: ["id", "label", "description", "config"],
|
|
7001
|
+
additionalProperties: false
|
|
7002
|
+
}
|
|
7003
|
+
}
|
|
7004
|
+
},
|
|
7005
|
+
required: ["results"],
|
|
7006
|
+
additionalProperties: false
|
|
7007
|
+
};
|
|
7008
|
+
function mapMcpRegistryResult(server) {
|
|
7009
|
+
const name = server.name.split("/").pop() ?? server.name;
|
|
7010
|
+
if (server.remotes && server.remotes.length > 0) {
|
|
7011
|
+
const remote = server.remotes[0];
|
|
7012
|
+
return {
|
|
7013
|
+
name,
|
|
7014
|
+
transport: remote.type,
|
|
7015
|
+
server_url: remote.url
|
|
7016
|
+
};
|
|
7017
|
+
}
|
|
7018
|
+
const pkg = server.packages?.[0];
|
|
7019
|
+
if (!pkg)
|
|
7020
|
+
return { name };
|
|
7021
|
+
let command;
|
|
7022
|
+
let args;
|
|
7023
|
+
switch (pkg.registryType) {
|
|
7024
|
+
case "npm":
|
|
7025
|
+
command = "npx";
|
|
7026
|
+
args = ["-y", pkg.identifier];
|
|
7027
|
+
break;
|
|
7028
|
+
case "pypi":
|
|
7029
|
+
command = "uvx";
|
|
7030
|
+
args = [pkg.identifier];
|
|
7031
|
+
break;
|
|
7032
|
+
case "oci":
|
|
7033
|
+
command = "docker";
|
|
7034
|
+
args = ["run", "-i", "--rm", pkg.identifier];
|
|
7035
|
+
break;
|
|
7036
|
+
default:
|
|
7037
|
+
command = pkg.identifier;
|
|
7038
|
+
args = [];
|
|
7039
|
+
}
|
|
7040
|
+
if (pkg.runtimeArguments) {
|
|
7041
|
+
for (const arg of pkg.runtimeArguments) {
|
|
7042
|
+
if (arg.name)
|
|
7043
|
+
args.push(arg.name);
|
|
7044
|
+
if (arg.value)
|
|
7045
|
+
args.push(arg.value);
|
|
7046
|
+
}
|
|
7047
|
+
}
|
|
7048
|
+
const result = {
|
|
7049
|
+
name,
|
|
7050
|
+
transport: "stdio",
|
|
7051
|
+
command,
|
|
7052
|
+
args
|
|
7053
|
+
};
|
|
7054
|
+
if (pkg.environmentVariables && pkg.environmentVariables.length > 0) {
|
|
7055
|
+
const env = {};
|
|
7056
|
+
for (const envVar of pkg.environmentVariables) {
|
|
7057
|
+
env[envVar.name] = "";
|
|
7058
|
+
}
|
|
7059
|
+
result.env = env;
|
|
7060
|
+
}
|
|
7061
|
+
return result;
|
|
7062
|
+
}
|
|
7063
|
+
function mapRegistryServersToResults(servers) {
|
|
7064
|
+
return (servers ?? []).map((entry) => {
|
|
7065
|
+
const s = entry.server;
|
|
7066
|
+
const pkg = s.packages?.[0];
|
|
7067
|
+
const remote = s.remotes?.[0];
|
|
7068
|
+
const badges = [pkg?.registryType, pkg?.transport?.type ?? remote?.type].filter(Boolean).join(" | ");
|
|
7069
|
+
return {
|
|
7070
|
+
id: `${s.name}:${s.version}`,
|
|
7071
|
+
label: `${s.title ?? s.name}${badges ? ` ${badges}` : ""}`,
|
|
7072
|
+
description: s.description,
|
|
7073
|
+
config: mapMcpRegistryResult(s)
|
|
7074
|
+
};
|
|
7075
|
+
});
|
|
7076
|
+
}
|
|
7077
|
+
async function searchMcpRegistryPage(query, options2) {
|
|
7078
|
+
const params = new URLSearchParams({
|
|
7079
|
+
search: query,
|
|
7080
|
+
limit: "100",
|
|
7081
|
+
version: "latest"
|
|
7082
|
+
});
|
|
7083
|
+
if (options2?.cursor) {
|
|
7084
|
+
params.set("cursor", options2.cursor);
|
|
7085
|
+
}
|
|
7086
|
+
const res = await fetch(`${MCP_REGISTRY_BASE}/servers?${params}`, {
|
|
7087
|
+
signal: options2?.signal
|
|
7088
|
+
});
|
|
7089
|
+
if (!res.ok) {
|
|
7090
|
+
let detail = `Registry returned ${res.status}`;
|
|
7091
|
+
try {
|
|
7092
|
+
const errBody = await res.json();
|
|
7093
|
+
if (typeof errBody.detail === "string") {
|
|
7094
|
+
detail = `${detail}: ${errBody.detail}`;
|
|
7095
|
+
} else if (Array.isArray(errBody.errors) && errBody.errors.length > 0) {
|
|
7096
|
+
detail = `${detail}: ${errBody.errors.map((e) => e.message).filter(Boolean).join("; ")}`;
|
|
7097
|
+
}
|
|
7098
|
+
} catch {}
|
|
7099
|
+
throw new Error(detail);
|
|
7100
|
+
}
|
|
7101
|
+
const data = await res.json();
|
|
7102
|
+
return {
|
|
7103
|
+
results: mapRegistryServersToResults(data.servers),
|
|
7104
|
+
nextCursor: data.metadata?.nextCursor
|
|
7105
|
+
};
|
|
7106
|
+
}
|
|
7107
|
+
async function searchMcpRegistry(query, signal) {
|
|
7108
|
+
const page = await searchMcpRegistryPage(query, { signal });
|
|
7109
|
+
return page.results;
|
|
7110
|
+
}
|
|
7111
|
+
|
|
7112
|
+
class McpSearchTask extends Task25 {
|
|
7113
|
+
static type = "McpSearchTask";
|
|
7114
|
+
static category = "MCP";
|
|
7115
|
+
static title = "MCP Search";
|
|
7116
|
+
static description = "Search the MCP server registry for servers matching a query";
|
|
7117
|
+
static cacheable = false;
|
|
7118
|
+
static inputSchema() {
|
|
7119
|
+
return McpSearchInputSchema;
|
|
7120
|
+
}
|
|
7121
|
+
static outputSchema() {
|
|
7122
|
+
return McpSearchOutputSchema;
|
|
7123
|
+
}
|
|
7124
|
+
async execute(input2, context) {
|
|
7125
|
+
const results = await searchMcpRegistry(input2.query, context.signal);
|
|
7126
|
+
return { results };
|
|
7127
|
+
}
|
|
7128
|
+
}
|
|
7129
|
+
var mcpSearch = (input2, config) => {
|
|
7130
|
+
return new McpSearchTask({}, config).run(input2);
|
|
7131
|
+
};
|
|
7132
|
+
Workflow28.prototype.mcpSearch = CreateWorkflow27(McpSearchTask);
|
|
7133
|
+
// src/task/mcp/McpToolCallTask.ts
|
|
7134
|
+
import {
|
|
7135
|
+
CreateWorkflow as CreateWorkflow28,
|
|
7136
|
+
Task as Task26,
|
|
7137
|
+
TaskConfigSchema as TaskConfigSchema7,
|
|
7138
|
+
Workflow as Workflow29
|
|
7139
|
+
} from "@workglow/task-graph";
|
|
7002
7140
|
var annotationsSchema2 = {
|
|
7003
7141
|
type: "object",
|
|
7004
7142
|
properties: {
|
|
@@ -7124,7 +7262,7 @@ var fallbackInputSchema2 = {
|
|
|
7124
7262
|
additionalProperties: true
|
|
7125
7263
|
};
|
|
7126
7264
|
|
|
7127
|
-
class McpToolCallTask extends
|
|
7265
|
+
class McpToolCallTask extends Task26 {
|
|
7128
7266
|
static type = "McpToolCallTask";
|
|
7129
7267
|
static category = "MCP";
|
|
7130
7268
|
static title = "MCP Call Tool";
|
|
@@ -7139,7 +7277,26 @@ class McpToolCallTask extends Task25 {
|
|
|
7139
7277
|
return fallbackOutputSchema2;
|
|
7140
7278
|
}
|
|
7141
7279
|
static configSchema() {
|
|
7142
|
-
|
|
7280
|
+
const { mcpServerConfigSchema } = getMcpTaskDeps();
|
|
7281
|
+
return {
|
|
7282
|
+
type: "object",
|
|
7283
|
+
properties: {
|
|
7284
|
+
...TaskConfigSchema7["properties"],
|
|
7285
|
+
...mcpServerConfigSchema.properties,
|
|
7286
|
+
tool_name: {
|
|
7287
|
+
type: "string",
|
|
7288
|
+
title: "Tool Name",
|
|
7289
|
+
description: "The name of the tool to call",
|
|
7290
|
+
format: "string:mcp-toolname"
|
|
7291
|
+
}
|
|
7292
|
+
},
|
|
7293
|
+
required: ["transport", "tool_name"],
|
|
7294
|
+
if: { properties: { transport: { const: "stdio" } }, required: ["transport"] },
|
|
7295
|
+
then: { required: ["command"] },
|
|
7296
|
+
else: { required: ["server_url"] },
|
|
7297
|
+
allOf: mcpServerConfigSchema.allOf,
|
|
7298
|
+
additionalProperties: false
|
|
7299
|
+
};
|
|
7143
7300
|
}
|
|
7144
7301
|
inputSchema() {
|
|
7145
7302
|
return this.config?.inputSchema ?? fallbackInputSchema2;
|
|
@@ -7181,10 +7338,11 @@ class McpToolCallTask extends Task25 {
|
|
|
7181
7338
|
}
|
|
7182
7339
|
async execute(input2, context) {
|
|
7183
7340
|
await this.discoverSchemas(context.signal);
|
|
7184
|
-
const {
|
|
7341
|
+
const { mcpClientFactory } = getMcpTaskDeps();
|
|
7342
|
+
const { client } = await mcpClientFactory.create(this.config, context.signal);
|
|
7185
7343
|
try {
|
|
7186
7344
|
const result = await client.callTool({
|
|
7187
|
-
name: this.config.tool_name,
|
|
7345
|
+
name: String(this.config.tool_name ?? ""),
|
|
7188
7346
|
arguments: input2
|
|
7189
7347
|
});
|
|
7190
7348
|
if (!("content" in result) || !Array.isArray(result.content)) {
|
|
@@ -7223,14 +7381,14 @@ class McpToolCallTask extends Task25 {
|
|
|
7223
7381
|
var mcpToolCall = async (input2, config) => {
|
|
7224
7382
|
return new McpToolCallTask({}, config).run(input2);
|
|
7225
7383
|
};
|
|
7226
|
-
|
|
7384
|
+
Workflow29.prototype.mcpToolCall = CreateWorkflow28(McpToolCallTask);
|
|
7227
7385
|
// src/task/string/StringConcatTask.ts
|
|
7228
7386
|
import {
|
|
7229
|
-
CreateWorkflow as
|
|
7230
|
-
Task as
|
|
7231
|
-
Workflow as
|
|
7387
|
+
CreateWorkflow as CreateWorkflow29,
|
|
7388
|
+
Task as Task27,
|
|
7389
|
+
Workflow as Workflow30
|
|
7232
7390
|
} from "@workglow/task-graph";
|
|
7233
|
-
var
|
|
7391
|
+
var inputSchema23 = {
|
|
7234
7392
|
type: "object",
|
|
7235
7393
|
properties: {},
|
|
7236
7394
|
additionalProperties: { type: "string" }
|
|
@@ -7248,13 +7406,13 @@ var outputSchema23 = {
|
|
|
7248
7406
|
additionalProperties: false
|
|
7249
7407
|
};
|
|
7250
7408
|
|
|
7251
|
-
class StringConcatTask extends
|
|
7409
|
+
class StringConcatTask extends Task27 {
|
|
7252
7410
|
static type = "StringConcatTask";
|
|
7253
7411
|
static category = "String";
|
|
7254
7412
|
static title = "Concat";
|
|
7255
7413
|
static description = "Concatenates all input strings";
|
|
7256
7414
|
static inputSchema() {
|
|
7257
|
-
return
|
|
7415
|
+
return inputSchema23;
|
|
7258
7416
|
}
|
|
7259
7417
|
static outputSchema() {
|
|
7260
7418
|
return outputSchema23;
|
|
@@ -7263,14 +7421,14 @@ class StringConcatTask extends Task26 {
|
|
|
7263
7421
|
return { result: Object.values(input2).join("") };
|
|
7264
7422
|
}
|
|
7265
7423
|
}
|
|
7266
|
-
|
|
7424
|
+
Workflow30.prototype.stringConcat = CreateWorkflow29(StringConcatTask);
|
|
7267
7425
|
// src/task/string/StringIncludesTask.ts
|
|
7268
7426
|
import {
|
|
7269
|
-
CreateWorkflow as
|
|
7270
|
-
Task as
|
|
7271
|
-
Workflow as
|
|
7427
|
+
CreateWorkflow as CreateWorkflow30,
|
|
7428
|
+
Task as Task28,
|
|
7429
|
+
Workflow as Workflow31
|
|
7272
7430
|
} from "@workglow/task-graph";
|
|
7273
|
-
var
|
|
7431
|
+
var inputSchema24 = {
|
|
7274
7432
|
type: "object",
|
|
7275
7433
|
properties: {
|
|
7276
7434
|
value: {
|
|
@@ -7300,13 +7458,13 @@ var outputSchema24 = {
|
|
|
7300
7458
|
additionalProperties: false
|
|
7301
7459
|
};
|
|
7302
7460
|
|
|
7303
|
-
class StringIncludesTask extends
|
|
7461
|
+
class StringIncludesTask extends Task28 {
|
|
7304
7462
|
static type = "StringIncludesTask";
|
|
7305
7463
|
static category = "String";
|
|
7306
7464
|
static title = "Includes";
|
|
7307
7465
|
static description = "Checks if a string contains a substring";
|
|
7308
7466
|
static inputSchema() {
|
|
7309
|
-
return
|
|
7467
|
+
return inputSchema24;
|
|
7310
7468
|
}
|
|
7311
7469
|
static outputSchema() {
|
|
7312
7470
|
return outputSchema24;
|
|
@@ -7315,14 +7473,14 @@ class StringIncludesTask extends Task27 {
|
|
|
7315
7473
|
return { result: input2.value.includes(input2.search) };
|
|
7316
7474
|
}
|
|
7317
7475
|
}
|
|
7318
|
-
|
|
7476
|
+
Workflow31.prototype.stringIncludes = CreateWorkflow30(StringIncludesTask);
|
|
7319
7477
|
// src/task/string/StringJoinTask.ts
|
|
7320
7478
|
import {
|
|
7321
|
-
CreateWorkflow as
|
|
7322
|
-
Task as
|
|
7323
|
-
Workflow as
|
|
7479
|
+
CreateWorkflow as CreateWorkflow31,
|
|
7480
|
+
Task as Task29,
|
|
7481
|
+
Workflow as Workflow32
|
|
7324
7482
|
} from "@workglow/task-graph";
|
|
7325
|
-
var
|
|
7483
|
+
var inputSchema25 = {
|
|
7326
7484
|
type: "object",
|
|
7327
7485
|
properties: {
|
|
7328
7486
|
values: {
|
|
@@ -7354,13 +7512,13 @@ var outputSchema25 = {
|
|
|
7354
7512
|
additionalProperties: false
|
|
7355
7513
|
};
|
|
7356
7514
|
|
|
7357
|
-
class StringJoinTask extends
|
|
7515
|
+
class StringJoinTask extends Task29 {
|
|
7358
7516
|
static type = "StringJoinTask";
|
|
7359
7517
|
static category = "String";
|
|
7360
7518
|
static title = "Join";
|
|
7361
7519
|
static description = "Joins an array of strings with a separator";
|
|
7362
7520
|
static inputSchema() {
|
|
7363
|
-
return
|
|
7521
|
+
return inputSchema25;
|
|
7364
7522
|
}
|
|
7365
7523
|
static outputSchema() {
|
|
7366
7524
|
return outputSchema25;
|
|
@@ -7370,14 +7528,14 @@ class StringJoinTask extends Task28 {
|
|
|
7370
7528
|
return { result: input2.values.join(separator) };
|
|
7371
7529
|
}
|
|
7372
7530
|
}
|
|
7373
|
-
|
|
7531
|
+
Workflow32.prototype.stringJoin = CreateWorkflow31(StringJoinTask);
|
|
7374
7532
|
// src/task/string/StringLengthTask.ts
|
|
7375
7533
|
import {
|
|
7376
|
-
CreateWorkflow as
|
|
7377
|
-
Task as
|
|
7378
|
-
Workflow as
|
|
7534
|
+
CreateWorkflow as CreateWorkflow32,
|
|
7535
|
+
Task as Task30,
|
|
7536
|
+
Workflow as Workflow33
|
|
7379
7537
|
} from "@workglow/task-graph";
|
|
7380
|
-
var
|
|
7538
|
+
var inputSchema26 = {
|
|
7381
7539
|
type: "object",
|
|
7382
7540
|
properties: {
|
|
7383
7541
|
value: {
|
|
@@ -7402,13 +7560,13 @@ var outputSchema26 = {
|
|
|
7402
7560
|
additionalProperties: false
|
|
7403
7561
|
};
|
|
7404
7562
|
|
|
7405
|
-
class StringLengthTask extends
|
|
7563
|
+
class StringLengthTask extends Task30 {
|
|
7406
7564
|
static type = "StringLengthTask";
|
|
7407
7565
|
static category = "String";
|
|
7408
7566
|
static title = "Length";
|
|
7409
7567
|
static description = "Returns the length of a string";
|
|
7410
7568
|
static inputSchema() {
|
|
7411
|
-
return
|
|
7569
|
+
return inputSchema26;
|
|
7412
7570
|
}
|
|
7413
7571
|
static outputSchema() {
|
|
7414
7572
|
return outputSchema26;
|
|
@@ -7417,14 +7575,14 @@ class StringLengthTask extends Task29 {
|
|
|
7417
7575
|
return { result: input2.value.length };
|
|
7418
7576
|
}
|
|
7419
7577
|
}
|
|
7420
|
-
|
|
7578
|
+
Workflow33.prototype.stringLength = CreateWorkflow32(StringLengthTask);
|
|
7421
7579
|
// src/task/string/StringLowerCaseTask.ts
|
|
7422
7580
|
import {
|
|
7423
|
-
CreateWorkflow as
|
|
7424
|
-
Task as
|
|
7425
|
-
Workflow as
|
|
7581
|
+
CreateWorkflow as CreateWorkflow33,
|
|
7582
|
+
Task as Task31,
|
|
7583
|
+
Workflow as Workflow34
|
|
7426
7584
|
} from "@workglow/task-graph";
|
|
7427
|
-
var
|
|
7585
|
+
var inputSchema27 = {
|
|
7428
7586
|
type: "object",
|
|
7429
7587
|
properties: {
|
|
7430
7588
|
value: {
|
|
@@ -7449,13 +7607,13 @@ var outputSchema27 = {
|
|
|
7449
7607
|
additionalProperties: false
|
|
7450
7608
|
};
|
|
7451
7609
|
|
|
7452
|
-
class StringLowerCaseTask extends
|
|
7610
|
+
class StringLowerCaseTask extends Task31 {
|
|
7453
7611
|
static type = "StringLowerCaseTask";
|
|
7454
7612
|
static category = "String";
|
|
7455
7613
|
static title = "Lower Case";
|
|
7456
7614
|
static description = "Converts a string to lower case";
|
|
7457
7615
|
static inputSchema() {
|
|
7458
|
-
return
|
|
7616
|
+
return inputSchema27;
|
|
7459
7617
|
}
|
|
7460
7618
|
static outputSchema() {
|
|
7461
7619
|
return outputSchema27;
|
|
@@ -7464,14 +7622,14 @@ class StringLowerCaseTask extends Task30 {
|
|
|
7464
7622
|
return { result: input2.value.toLowerCase() };
|
|
7465
7623
|
}
|
|
7466
7624
|
}
|
|
7467
|
-
|
|
7625
|
+
Workflow34.prototype.stringLowerCase = CreateWorkflow33(StringLowerCaseTask);
|
|
7468
7626
|
// src/task/string/StringReplaceTask.ts
|
|
7469
7627
|
import {
|
|
7470
|
-
CreateWorkflow as
|
|
7471
|
-
Task as
|
|
7472
|
-
Workflow as
|
|
7628
|
+
CreateWorkflow as CreateWorkflow34,
|
|
7629
|
+
Task as Task32,
|
|
7630
|
+
Workflow as Workflow35
|
|
7473
7631
|
} from "@workglow/task-graph";
|
|
7474
|
-
var
|
|
7632
|
+
var inputSchema28 = {
|
|
7475
7633
|
type: "object",
|
|
7476
7634
|
properties: {
|
|
7477
7635
|
value: {
|
|
@@ -7506,13 +7664,13 @@ var outputSchema28 = {
|
|
|
7506
7664
|
additionalProperties: false
|
|
7507
7665
|
};
|
|
7508
7666
|
|
|
7509
|
-
class StringReplaceTask extends
|
|
7667
|
+
class StringReplaceTask extends Task32 {
|
|
7510
7668
|
static type = "StringReplaceTask";
|
|
7511
7669
|
static category = "String";
|
|
7512
7670
|
static title = "Replace";
|
|
7513
7671
|
static description = "Replaces all occurrences of a substring";
|
|
7514
7672
|
static inputSchema() {
|
|
7515
|
-
return
|
|
7673
|
+
return inputSchema28;
|
|
7516
7674
|
}
|
|
7517
7675
|
static outputSchema() {
|
|
7518
7676
|
return outputSchema28;
|
|
@@ -7521,14 +7679,14 @@ class StringReplaceTask extends Task31 {
|
|
|
7521
7679
|
return { result: input2.value.replaceAll(input2.search, input2.replace) };
|
|
7522
7680
|
}
|
|
7523
7681
|
}
|
|
7524
|
-
|
|
7682
|
+
Workflow35.prototype.stringReplace = CreateWorkflow34(StringReplaceTask);
|
|
7525
7683
|
// src/task/string/StringSliceTask.ts
|
|
7526
7684
|
import {
|
|
7527
|
-
CreateWorkflow as
|
|
7528
|
-
Task as
|
|
7529
|
-
Workflow as
|
|
7685
|
+
CreateWorkflow as CreateWorkflow35,
|
|
7686
|
+
Task as Task33,
|
|
7687
|
+
Workflow as Workflow36
|
|
7530
7688
|
} from "@workglow/task-graph";
|
|
7531
|
-
var
|
|
7689
|
+
var inputSchema29 = {
|
|
7532
7690
|
type: "object",
|
|
7533
7691
|
properties: {
|
|
7534
7692
|
value: {
|
|
@@ -7563,13 +7721,13 @@ var outputSchema29 = {
|
|
|
7563
7721
|
additionalProperties: false
|
|
7564
7722
|
};
|
|
7565
7723
|
|
|
7566
|
-
class StringSliceTask extends
|
|
7724
|
+
class StringSliceTask extends Task33 {
|
|
7567
7725
|
static type = "StringSliceTask";
|
|
7568
7726
|
static category = "String";
|
|
7569
7727
|
static title = "Slice";
|
|
7570
7728
|
static description = "Extracts a substring by start and optional end index";
|
|
7571
7729
|
static inputSchema() {
|
|
7572
|
-
return
|
|
7730
|
+
return inputSchema29;
|
|
7573
7731
|
}
|
|
7574
7732
|
static outputSchema() {
|
|
7575
7733
|
return outputSchema29;
|
|
@@ -7578,14 +7736,14 @@ class StringSliceTask extends Task32 {
|
|
|
7578
7736
|
return { result: input2.value.slice(input2.start, input2.end) };
|
|
7579
7737
|
}
|
|
7580
7738
|
}
|
|
7581
|
-
|
|
7739
|
+
Workflow36.prototype.stringSlice = CreateWorkflow35(StringSliceTask);
|
|
7582
7740
|
// src/task/string/StringTemplateTask.ts
|
|
7583
7741
|
import {
|
|
7584
|
-
CreateWorkflow as
|
|
7585
|
-
Task as
|
|
7586
|
-
Workflow as
|
|
7742
|
+
CreateWorkflow as CreateWorkflow36,
|
|
7743
|
+
Task as Task34,
|
|
7744
|
+
Workflow as Workflow37
|
|
7587
7745
|
} from "@workglow/task-graph";
|
|
7588
|
-
var
|
|
7746
|
+
var inputSchema30 = {
|
|
7589
7747
|
type: "object",
|
|
7590
7748
|
properties: {
|
|
7591
7749
|
template: {
|
|
@@ -7616,13 +7774,13 @@ var outputSchema30 = {
|
|
|
7616
7774
|
additionalProperties: false
|
|
7617
7775
|
};
|
|
7618
7776
|
|
|
7619
|
-
class StringTemplateTask extends
|
|
7777
|
+
class StringTemplateTask extends Task34 {
|
|
7620
7778
|
static type = "StringTemplateTask";
|
|
7621
7779
|
static category = "String";
|
|
7622
7780
|
static title = "Template";
|
|
7623
7781
|
static description = "Replaces {{key}} placeholders in a template string with values";
|
|
7624
7782
|
static inputSchema() {
|
|
7625
|
-
return
|
|
7783
|
+
return inputSchema30;
|
|
7626
7784
|
}
|
|
7627
7785
|
static outputSchema() {
|
|
7628
7786
|
return outputSchema30;
|
|
@@ -7635,14 +7793,14 @@ class StringTemplateTask extends Task33 {
|
|
|
7635
7793
|
return { result };
|
|
7636
7794
|
}
|
|
7637
7795
|
}
|
|
7638
|
-
|
|
7796
|
+
Workflow37.prototype.stringTemplate = CreateWorkflow36(StringTemplateTask);
|
|
7639
7797
|
// src/task/string/StringTrimTask.ts
|
|
7640
7798
|
import {
|
|
7641
|
-
CreateWorkflow as
|
|
7642
|
-
Task as
|
|
7643
|
-
Workflow as
|
|
7799
|
+
CreateWorkflow as CreateWorkflow37,
|
|
7800
|
+
Task as Task35,
|
|
7801
|
+
Workflow as Workflow38
|
|
7644
7802
|
} from "@workglow/task-graph";
|
|
7645
|
-
var
|
|
7803
|
+
var inputSchema31 = {
|
|
7646
7804
|
type: "object",
|
|
7647
7805
|
properties: {
|
|
7648
7806
|
value: {
|
|
@@ -7667,13 +7825,13 @@ var outputSchema31 = {
|
|
|
7667
7825
|
additionalProperties: false
|
|
7668
7826
|
};
|
|
7669
7827
|
|
|
7670
|
-
class StringTrimTask extends
|
|
7828
|
+
class StringTrimTask extends Task35 {
|
|
7671
7829
|
static type = "StringTrimTask";
|
|
7672
7830
|
static category = "String";
|
|
7673
7831
|
static title = "Trim";
|
|
7674
7832
|
static description = "Removes leading and trailing whitespace from a string";
|
|
7675
7833
|
static inputSchema() {
|
|
7676
|
-
return
|
|
7834
|
+
return inputSchema31;
|
|
7677
7835
|
}
|
|
7678
7836
|
static outputSchema() {
|
|
7679
7837
|
return outputSchema31;
|
|
@@ -7682,14 +7840,14 @@ class StringTrimTask extends Task34 {
|
|
|
7682
7840
|
return { result: input2.value.trim() };
|
|
7683
7841
|
}
|
|
7684
7842
|
}
|
|
7685
|
-
|
|
7843
|
+
Workflow38.prototype.stringTrim = CreateWorkflow37(StringTrimTask);
|
|
7686
7844
|
// src/task/string/StringUpperCaseTask.ts
|
|
7687
7845
|
import {
|
|
7688
|
-
CreateWorkflow as
|
|
7689
|
-
Task as
|
|
7690
|
-
Workflow as
|
|
7846
|
+
CreateWorkflow as CreateWorkflow38,
|
|
7847
|
+
Task as Task36,
|
|
7848
|
+
Workflow as Workflow39
|
|
7691
7849
|
} from "@workglow/task-graph";
|
|
7692
|
-
var
|
|
7850
|
+
var inputSchema32 = {
|
|
7693
7851
|
type: "object",
|
|
7694
7852
|
properties: {
|
|
7695
7853
|
value: {
|
|
@@ -7714,13 +7872,13 @@ var outputSchema32 = {
|
|
|
7714
7872
|
additionalProperties: false
|
|
7715
7873
|
};
|
|
7716
7874
|
|
|
7717
|
-
class StringUpperCaseTask extends
|
|
7875
|
+
class StringUpperCaseTask extends Task36 {
|
|
7718
7876
|
static type = "StringUpperCaseTask";
|
|
7719
7877
|
static category = "String";
|
|
7720
7878
|
static title = "Upper Case";
|
|
7721
7879
|
static description = "Converts a string to upper case";
|
|
7722
7880
|
static inputSchema() {
|
|
7723
|
-
return
|
|
7881
|
+
return inputSchema32;
|
|
7724
7882
|
}
|
|
7725
7883
|
static outputSchema() {
|
|
7726
7884
|
return outputSchema32;
|
|
@@ -7729,10 +7887,10 @@ class StringUpperCaseTask extends Task35 {
|
|
|
7729
7887
|
return { result: input2.value.toUpperCase() };
|
|
7730
7888
|
}
|
|
7731
7889
|
}
|
|
7732
|
-
|
|
7890
|
+
Workflow39.prototype.stringUpperCase = CreateWorkflow38(StringUpperCaseTask);
|
|
7733
7891
|
// src/task/scalar/ScalarAbsTask.ts
|
|
7734
|
-
import { CreateWorkflow as
|
|
7735
|
-
var
|
|
7892
|
+
import { CreateWorkflow as CreateWorkflow39, Task as Task37, Workflow as Workflow40 } from "@workglow/task-graph";
|
|
7893
|
+
var inputSchema33 = {
|
|
7736
7894
|
type: "object",
|
|
7737
7895
|
properties: {
|
|
7738
7896
|
value: {
|
|
@@ -7757,13 +7915,13 @@ var outputSchema33 = {
|
|
|
7757
7915
|
additionalProperties: false
|
|
7758
7916
|
};
|
|
7759
7917
|
|
|
7760
|
-
class ScalarAbsTask extends
|
|
7918
|
+
class ScalarAbsTask extends Task37 {
|
|
7761
7919
|
static type = "ScalarAbsTask";
|
|
7762
7920
|
static category = "Math";
|
|
7763
7921
|
static title = "Abs";
|
|
7764
7922
|
static description = "Returns the absolute value of a number";
|
|
7765
7923
|
static inputSchema() {
|
|
7766
|
-
return
|
|
7924
|
+
return inputSchema33;
|
|
7767
7925
|
}
|
|
7768
7926
|
static outputSchema() {
|
|
7769
7927
|
return outputSchema33;
|
|
@@ -7772,10 +7930,10 @@ class ScalarAbsTask extends Task36 {
|
|
|
7772
7930
|
return { result: Math.abs(input2.value) };
|
|
7773
7931
|
}
|
|
7774
7932
|
}
|
|
7775
|
-
|
|
7933
|
+
Workflow40.prototype.scalarAbs = CreateWorkflow39(ScalarAbsTask);
|
|
7776
7934
|
// src/task/scalar/ScalarCeilTask.ts
|
|
7777
|
-
import { CreateWorkflow as
|
|
7778
|
-
var
|
|
7935
|
+
import { CreateWorkflow as CreateWorkflow40, Task as Task38, Workflow as Workflow41 } from "@workglow/task-graph";
|
|
7936
|
+
var inputSchema34 = {
|
|
7779
7937
|
type: "object",
|
|
7780
7938
|
properties: {
|
|
7781
7939
|
value: {
|
|
@@ -7800,13 +7958,13 @@ var outputSchema34 = {
|
|
|
7800
7958
|
additionalProperties: false
|
|
7801
7959
|
};
|
|
7802
7960
|
|
|
7803
|
-
class ScalarCeilTask extends
|
|
7961
|
+
class ScalarCeilTask extends Task38 {
|
|
7804
7962
|
static type = "ScalarCeilTask";
|
|
7805
7963
|
static category = "Math";
|
|
7806
7964
|
static title = "Ceil";
|
|
7807
7965
|
static description = "Returns the smallest integer greater than or equal to a number";
|
|
7808
7966
|
static inputSchema() {
|
|
7809
|
-
return
|
|
7967
|
+
return inputSchema34;
|
|
7810
7968
|
}
|
|
7811
7969
|
static outputSchema() {
|
|
7812
7970
|
return outputSchema34;
|
|
@@ -7815,10 +7973,10 @@ class ScalarCeilTask extends Task37 {
|
|
|
7815
7973
|
return { result: Math.ceil(input2.value) };
|
|
7816
7974
|
}
|
|
7817
7975
|
}
|
|
7818
|
-
|
|
7976
|
+
Workflow41.prototype.scalarCeil = CreateWorkflow40(ScalarCeilTask);
|
|
7819
7977
|
// src/task/scalar/ScalarFloorTask.ts
|
|
7820
|
-
import { CreateWorkflow as
|
|
7821
|
-
var
|
|
7978
|
+
import { CreateWorkflow as CreateWorkflow41, Task as Task39, Workflow as Workflow42 } from "@workglow/task-graph";
|
|
7979
|
+
var inputSchema35 = {
|
|
7822
7980
|
type: "object",
|
|
7823
7981
|
properties: {
|
|
7824
7982
|
value: {
|
|
@@ -7843,13 +8001,13 @@ var outputSchema35 = {
|
|
|
7843
8001
|
additionalProperties: false
|
|
7844
8002
|
};
|
|
7845
8003
|
|
|
7846
|
-
class ScalarFloorTask extends
|
|
8004
|
+
class ScalarFloorTask extends Task39 {
|
|
7847
8005
|
static type = "ScalarFloorTask";
|
|
7848
8006
|
static category = "Math";
|
|
7849
8007
|
static title = "Floor";
|
|
7850
8008
|
static description = "Returns the largest integer less than or equal to a number";
|
|
7851
8009
|
static inputSchema() {
|
|
7852
|
-
return
|
|
8010
|
+
return inputSchema35;
|
|
7853
8011
|
}
|
|
7854
8012
|
static outputSchema() {
|
|
7855
8013
|
return outputSchema35;
|
|
@@ -7858,10 +8016,10 @@ class ScalarFloorTask extends Task38 {
|
|
|
7858
8016
|
return { result: Math.floor(input2.value) };
|
|
7859
8017
|
}
|
|
7860
8018
|
}
|
|
7861
|
-
|
|
8019
|
+
Workflow42.prototype.scalarFloor = CreateWorkflow41(ScalarFloorTask);
|
|
7862
8020
|
// src/task/scalar/ScalarMaxTask.ts
|
|
7863
|
-
import { CreateWorkflow as
|
|
7864
|
-
var
|
|
8021
|
+
import { CreateWorkflow as CreateWorkflow42, Task as Task40, Workflow as Workflow43 } from "@workglow/task-graph";
|
|
8022
|
+
var inputSchema36 = {
|
|
7865
8023
|
type: "object",
|
|
7866
8024
|
properties: {
|
|
7867
8025
|
values: {
|
|
@@ -7887,13 +8045,13 @@ var outputSchema36 = {
|
|
|
7887
8045
|
additionalProperties: false
|
|
7888
8046
|
};
|
|
7889
8047
|
|
|
7890
|
-
class ScalarMaxTask extends
|
|
8048
|
+
class ScalarMaxTask extends Task40 {
|
|
7891
8049
|
static type = "ScalarMaxTask";
|
|
7892
8050
|
static category = "Math";
|
|
7893
8051
|
static title = "Max";
|
|
7894
8052
|
static description = "Returns the largest of the given numbers";
|
|
7895
8053
|
static inputSchema() {
|
|
7896
|
-
return
|
|
8054
|
+
return inputSchema36;
|
|
7897
8055
|
}
|
|
7898
8056
|
static outputSchema() {
|
|
7899
8057
|
return outputSchema36;
|
|
@@ -7902,10 +8060,10 @@ class ScalarMaxTask extends Task39 {
|
|
|
7902
8060
|
return { result: Math.max(...input2.values) };
|
|
7903
8061
|
}
|
|
7904
8062
|
}
|
|
7905
|
-
|
|
8063
|
+
Workflow43.prototype.scalarMax = CreateWorkflow42(ScalarMaxTask);
|
|
7906
8064
|
// src/task/scalar/ScalarMinTask.ts
|
|
7907
|
-
import { CreateWorkflow as
|
|
7908
|
-
var
|
|
8065
|
+
import { CreateWorkflow as CreateWorkflow43, Task as Task41, Workflow as Workflow44 } from "@workglow/task-graph";
|
|
8066
|
+
var inputSchema37 = {
|
|
7909
8067
|
type: "object",
|
|
7910
8068
|
properties: {
|
|
7911
8069
|
values: {
|
|
@@ -7931,13 +8089,13 @@ var outputSchema37 = {
|
|
|
7931
8089
|
additionalProperties: false
|
|
7932
8090
|
};
|
|
7933
8091
|
|
|
7934
|
-
class ScalarMinTask extends
|
|
8092
|
+
class ScalarMinTask extends Task41 {
|
|
7935
8093
|
static type = "ScalarMinTask";
|
|
7936
8094
|
static category = "Math";
|
|
7937
8095
|
static title = "Min";
|
|
7938
8096
|
static description = "Returns the smallest of the given numbers";
|
|
7939
8097
|
static inputSchema() {
|
|
7940
|
-
return
|
|
8098
|
+
return inputSchema37;
|
|
7941
8099
|
}
|
|
7942
8100
|
static outputSchema() {
|
|
7943
8101
|
return outputSchema37;
|
|
@@ -7946,10 +8104,10 @@ class ScalarMinTask extends Task40 {
|
|
|
7946
8104
|
return { result: Math.min(...input2.values) };
|
|
7947
8105
|
}
|
|
7948
8106
|
}
|
|
7949
|
-
|
|
8107
|
+
Workflow44.prototype.scalarMin = CreateWorkflow43(ScalarMinTask);
|
|
7950
8108
|
// src/task/scalar/ScalarRoundTask.ts
|
|
7951
|
-
import { CreateWorkflow as
|
|
7952
|
-
var
|
|
8109
|
+
import { CreateWorkflow as CreateWorkflow44, Task as Task42, Workflow as Workflow45 } from "@workglow/task-graph";
|
|
8110
|
+
var inputSchema38 = {
|
|
7953
8111
|
type: "object",
|
|
7954
8112
|
properties: {
|
|
7955
8113
|
value: {
|
|
@@ -7974,13 +8132,13 @@ var outputSchema38 = {
|
|
|
7974
8132
|
additionalProperties: false
|
|
7975
8133
|
};
|
|
7976
8134
|
|
|
7977
|
-
class ScalarRoundTask extends
|
|
8135
|
+
class ScalarRoundTask extends Task42 {
|
|
7978
8136
|
static type = "ScalarRoundTask";
|
|
7979
8137
|
static category = "Math";
|
|
7980
8138
|
static title = "Round";
|
|
7981
8139
|
static description = "Returns the value of a number rounded to the nearest integer";
|
|
7982
8140
|
static inputSchema() {
|
|
7983
|
-
return
|
|
8141
|
+
return inputSchema38;
|
|
7984
8142
|
}
|
|
7985
8143
|
static outputSchema() {
|
|
7986
8144
|
return outputSchema38;
|
|
@@ -7989,10 +8147,10 @@ class ScalarRoundTask extends Task41 {
|
|
|
7989
8147
|
return { result: Math.round(input2.value) };
|
|
7990
8148
|
}
|
|
7991
8149
|
}
|
|
7992
|
-
|
|
8150
|
+
Workflow45.prototype.scalarRound = CreateWorkflow44(ScalarRoundTask);
|
|
7993
8151
|
// src/task/scalar/ScalarTruncTask.ts
|
|
7994
|
-
import { CreateWorkflow as
|
|
7995
|
-
var
|
|
8152
|
+
import { CreateWorkflow as CreateWorkflow45, Task as Task43, Workflow as Workflow46 } from "@workglow/task-graph";
|
|
8153
|
+
var inputSchema39 = {
|
|
7996
8154
|
type: "object",
|
|
7997
8155
|
properties: {
|
|
7998
8156
|
value: {
|
|
@@ -8017,13 +8175,13 @@ var outputSchema39 = {
|
|
|
8017
8175
|
additionalProperties: false
|
|
8018
8176
|
};
|
|
8019
8177
|
|
|
8020
|
-
class ScalarTruncTask extends
|
|
8178
|
+
class ScalarTruncTask extends Task43 {
|
|
8021
8179
|
static type = "ScalarTruncTask";
|
|
8022
8180
|
static category = "Math";
|
|
8023
8181
|
static title = "Truncate";
|
|
8024
8182
|
static description = "Returns the integer part of a number by removing fractional digits";
|
|
8025
8183
|
static inputSchema() {
|
|
8026
|
-
return
|
|
8184
|
+
return inputSchema39;
|
|
8027
8185
|
}
|
|
8028
8186
|
static outputSchema() {
|
|
8029
8187
|
return outputSchema39;
|
|
@@ -8032,13 +8190,13 @@ class ScalarTruncTask extends Task42 {
|
|
|
8032
8190
|
return { result: Math.trunc(input2.value) };
|
|
8033
8191
|
}
|
|
8034
8192
|
}
|
|
8035
|
-
|
|
8193
|
+
Workflow46.prototype.scalarTrunc = CreateWorkflow45(ScalarTruncTask);
|
|
8036
8194
|
// src/task/vector/VectorDistanceTask.ts
|
|
8037
|
-
import { CreateWorkflow as
|
|
8195
|
+
import { CreateWorkflow as CreateWorkflow46, Task as Task44, Workflow as Workflow47 } from "@workglow/task-graph";
|
|
8038
8196
|
import {
|
|
8039
8197
|
TypedArraySchema as TypedArraySchema5
|
|
8040
|
-
} from "@workglow/util";
|
|
8041
|
-
var
|
|
8198
|
+
} from "@workglow/util/schema";
|
|
8199
|
+
var inputSchema40 = {
|
|
8042
8200
|
type: "object",
|
|
8043
8201
|
properties: {
|
|
8044
8202
|
vectors: {
|
|
@@ -8067,13 +8225,13 @@ var outputSchema40 = {
|
|
|
8067
8225
|
additionalProperties: false
|
|
8068
8226
|
};
|
|
8069
8227
|
|
|
8070
|
-
class VectorDistanceTask extends
|
|
8228
|
+
class VectorDistanceTask extends Task44 {
|
|
8071
8229
|
static type = "VectorDistanceTask";
|
|
8072
8230
|
static category = "Vector";
|
|
8073
8231
|
static title = "Distance";
|
|
8074
8232
|
static description = "Returns the Euclidean distance between the first two vectors";
|
|
8075
8233
|
static inputSchema() {
|
|
8076
|
-
return
|
|
8234
|
+
return inputSchema40;
|
|
8077
8235
|
}
|
|
8078
8236
|
static outputSchema() {
|
|
8079
8237
|
return outputSchema40;
|
|
@@ -8094,13 +8252,13 @@ class VectorDistanceTask extends Task43 {
|
|
|
8094
8252
|
return { result: Math.sqrt(sumPrecise(diffs)) };
|
|
8095
8253
|
}
|
|
8096
8254
|
}
|
|
8097
|
-
|
|
8255
|
+
Workflow47.prototype.vectorDistance = CreateWorkflow46(VectorDistanceTask);
|
|
8098
8256
|
// src/task/vector/VectorDotProductTask.ts
|
|
8099
|
-
import { CreateWorkflow as
|
|
8257
|
+
import { CreateWorkflow as CreateWorkflow47, Task as Task45, Workflow as Workflow48 } from "@workglow/task-graph";
|
|
8100
8258
|
import {
|
|
8101
8259
|
TypedArraySchema as TypedArraySchema6
|
|
8102
|
-
} from "@workglow/util";
|
|
8103
|
-
var
|
|
8260
|
+
} from "@workglow/util/schema";
|
|
8261
|
+
var inputSchema41 = {
|
|
8104
8262
|
type: "object",
|
|
8105
8263
|
properties: {
|
|
8106
8264
|
vectors: {
|
|
@@ -8129,13 +8287,13 @@ var outputSchema41 = {
|
|
|
8129
8287
|
additionalProperties: false
|
|
8130
8288
|
};
|
|
8131
8289
|
|
|
8132
|
-
class VectorDotProductTask extends
|
|
8290
|
+
class VectorDotProductTask extends Task45 {
|
|
8133
8291
|
static type = "VectorDotProductTask";
|
|
8134
8292
|
static category = "Vector";
|
|
8135
8293
|
static title = "Dot Product";
|
|
8136
8294
|
static description = "Returns the dot (inner) product of the first two vectors";
|
|
8137
8295
|
static inputSchema() {
|
|
8138
|
-
return
|
|
8296
|
+
return inputSchema41;
|
|
8139
8297
|
}
|
|
8140
8298
|
static outputSchema() {
|
|
8141
8299
|
return outputSchema41;
|
|
@@ -8153,14 +8311,14 @@ class VectorDotProductTask extends Task44 {
|
|
|
8153
8311
|
return { result: sumPrecise(products) };
|
|
8154
8312
|
}
|
|
8155
8313
|
}
|
|
8156
|
-
|
|
8314
|
+
Workflow48.prototype.vectorDotProduct = CreateWorkflow47(VectorDotProductTask);
|
|
8157
8315
|
// src/task/vector/VectorNormalizeTask.ts
|
|
8158
|
-
import { CreateWorkflow as
|
|
8316
|
+
import { CreateWorkflow as CreateWorkflow48, Task as Task46, Workflow as Workflow49 } from "@workglow/task-graph";
|
|
8159
8317
|
import {
|
|
8160
8318
|
TypedArraySchema as TypedArraySchema7,
|
|
8161
8319
|
normalize
|
|
8162
|
-
} from "@workglow/util";
|
|
8163
|
-
var
|
|
8320
|
+
} from "@workglow/util/schema";
|
|
8321
|
+
var inputSchema42 = {
|
|
8164
8322
|
type: "object",
|
|
8165
8323
|
properties: {
|
|
8166
8324
|
vector: TypedArraySchema7({
|
|
@@ -8183,13 +8341,13 @@ var outputSchema42 = {
|
|
|
8183
8341
|
additionalProperties: false
|
|
8184
8342
|
};
|
|
8185
8343
|
|
|
8186
|
-
class VectorNormalizeTask extends
|
|
8344
|
+
class VectorNormalizeTask extends Task46 {
|
|
8187
8345
|
static type = "VectorNormalizeTask";
|
|
8188
8346
|
static category = "Vector";
|
|
8189
8347
|
static title = "Normalize";
|
|
8190
8348
|
static description = "Returns the L2-normalized (unit length) vector";
|
|
8191
8349
|
static inputSchema() {
|
|
8192
|
-
return
|
|
8350
|
+
return inputSchema42;
|
|
8193
8351
|
}
|
|
8194
8352
|
static outputSchema() {
|
|
8195
8353
|
return outputSchema42;
|
|
@@ -8198,14 +8356,14 @@ class VectorNormalizeTask extends Task45 {
|
|
|
8198
8356
|
return { result: normalize(input2.vector) };
|
|
8199
8357
|
}
|
|
8200
8358
|
}
|
|
8201
|
-
|
|
8359
|
+
Workflow49.prototype.vectorNormalize = CreateWorkflow48(VectorNormalizeTask);
|
|
8202
8360
|
// src/task/vector/VectorScaleTask.ts
|
|
8203
|
-
import { CreateWorkflow as
|
|
8361
|
+
import { CreateWorkflow as CreateWorkflow49, Task as Task47, Workflow as Workflow50 } from "@workglow/task-graph";
|
|
8204
8362
|
import {
|
|
8205
8363
|
createTypedArrayFrom as createTypedArrayFrom5,
|
|
8206
8364
|
TypedArraySchema as TypedArraySchema8
|
|
8207
|
-
} from "@workglow/util";
|
|
8208
|
-
var
|
|
8365
|
+
} from "@workglow/util/schema";
|
|
8366
|
+
var inputSchema43 = {
|
|
8209
8367
|
type: "object",
|
|
8210
8368
|
properties: {
|
|
8211
8369
|
vector: TypedArraySchema8({
|
|
@@ -8233,13 +8391,13 @@ var outputSchema43 = {
|
|
|
8233
8391
|
additionalProperties: false
|
|
8234
8392
|
};
|
|
8235
8393
|
|
|
8236
|
-
class VectorScaleTask extends
|
|
8394
|
+
class VectorScaleTask extends Task47 {
|
|
8237
8395
|
static type = "VectorScaleTask";
|
|
8238
8396
|
static category = "Vector";
|
|
8239
8397
|
static title = "Scale";
|
|
8240
8398
|
static description = "Multiplies each element of a vector by a scalar";
|
|
8241
8399
|
static inputSchema() {
|
|
8242
|
-
return
|
|
8400
|
+
return inputSchema43;
|
|
8243
8401
|
}
|
|
8244
8402
|
static outputSchema() {
|
|
8245
8403
|
return outputSchema43;
|
|
@@ -8250,7 +8408,7 @@ class VectorScaleTask extends Task46 {
|
|
|
8250
8408
|
return { result: createTypedArrayFrom5([vector], values) };
|
|
8251
8409
|
}
|
|
8252
8410
|
}
|
|
8253
|
-
|
|
8411
|
+
Workflow50.prototype.vectorScale = CreateWorkflow49(VectorScaleTask);
|
|
8254
8412
|
|
|
8255
8413
|
// src/common.ts
|
|
8256
8414
|
import { TaskRegistry } from "@workglow/task-graph";
|
|
@@ -8289,6 +8447,7 @@ var registerCommonTasks = () => {
|
|
|
8289
8447
|
McpToolCallTask,
|
|
8290
8448
|
McpResourceReadTask,
|
|
8291
8449
|
McpPromptGetTask,
|
|
8450
|
+
McpSearchTask,
|
|
8292
8451
|
McpListTask,
|
|
8293
8452
|
StringConcatTask,
|
|
8294
8453
|
StringIncludesTask,
|
|
@@ -8308,24 +8467,645 @@ var registerCommonTasks = () => {
|
|
|
8308
8467
|
tasks.map(TaskRegistry.registerTask);
|
|
8309
8468
|
return tasks;
|
|
8310
8469
|
};
|
|
8470
|
+
// src/util/McpAuthTypes.ts
|
|
8471
|
+
var mcpAuthTypes = [
|
|
8472
|
+
"none",
|
|
8473
|
+
"bearer",
|
|
8474
|
+
"client_credentials",
|
|
8475
|
+
"private_key_jwt",
|
|
8476
|
+
"static_private_key_jwt",
|
|
8477
|
+
"authorization_code"
|
|
8478
|
+
];
|
|
8479
|
+
var mcpAuthConfigSchema = {
|
|
8480
|
+
properties: {
|
|
8481
|
+
auth_type: {
|
|
8482
|
+
type: "string",
|
|
8483
|
+
enum: mcpAuthTypes,
|
|
8484
|
+
title: "Auth Type",
|
|
8485
|
+
description: "Authentication method for connecting to the MCP server",
|
|
8486
|
+
default: "none"
|
|
8487
|
+
},
|
|
8488
|
+
auth_token: {
|
|
8489
|
+
type: "string",
|
|
8490
|
+
format: "credential",
|
|
8491
|
+
title: "Bearer Token",
|
|
8492
|
+
description: "Static bearer token or API key (for bearer auth)"
|
|
8493
|
+
},
|
|
8494
|
+
auth_client_id: {
|
|
8495
|
+
type: "string",
|
|
8496
|
+
title: "Client ID",
|
|
8497
|
+
description: "OAuth client ID (for OAuth auth types)"
|
|
8498
|
+
},
|
|
8499
|
+
auth_client_secret: {
|
|
8500
|
+
type: "string",
|
|
8501
|
+
format: "credential",
|
|
8502
|
+
title: "Client Secret",
|
|
8503
|
+
description: "OAuth client secret (for client_credentials auth)"
|
|
8504
|
+
},
|
|
8505
|
+
auth_private_key: {
|
|
8506
|
+
type: "string",
|
|
8507
|
+
format: "credential",
|
|
8508
|
+
title: "Private Key",
|
|
8509
|
+
description: "PEM or JWK private key (for private_key_jwt auth)"
|
|
8510
|
+
},
|
|
8511
|
+
auth_algorithm: {
|
|
8512
|
+
type: "string",
|
|
8513
|
+
title: "Algorithm",
|
|
8514
|
+
description: "JWT signing algorithm, e.g. RS256, ES256 (for private_key_jwt auth)"
|
|
8515
|
+
},
|
|
8516
|
+
auth_jwt_bearer_assertion: {
|
|
8517
|
+
type: "string",
|
|
8518
|
+
format: "credential",
|
|
8519
|
+
title: "JWT Assertion",
|
|
8520
|
+
description: "Pre-built JWT assertion (for static_private_key_jwt auth)"
|
|
8521
|
+
},
|
|
8522
|
+
auth_redirect_url: {
|
|
8523
|
+
type: "string",
|
|
8524
|
+
format: "uri",
|
|
8525
|
+
title: "Redirect URL",
|
|
8526
|
+
description: "OAuth redirect URL (for authorization_code auth)"
|
|
8527
|
+
},
|
|
8528
|
+
auth_scope: {
|
|
8529
|
+
type: "string",
|
|
8530
|
+
title: "Scope",
|
|
8531
|
+
description: "OAuth scope (space-separated)"
|
|
8532
|
+
},
|
|
8533
|
+
auth_client_name: {
|
|
8534
|
+
type: "string",
|
|
8535
|
+
title: "Client Name",
|
|
8536
|
+
description: "Optional OAuth client display name"
|
|
8537
|
+
},
|
|
8538
|
+
auth_jwt_lifetime_seconds: {
|
|
8539
|
+
type: "number",
|
|
8540
|
+
title: "JWT Lifetime",
|
|
8541
|
+
description: "JWT lifetime in seconds (default: 300)",
|
|
8542
|
+
minimum: 1
|
|
8543
|
+
}
|
|
8544
|
+
},
|
|
8545
|
+
allOf: [
|
|
8546
|
+
{
|
|
8547
|
+
if: { properties: { auth_type: { const: "bearer" } }, required: ["auth_type"] },
|
|
8548
|
+
then: {
|
|
8549
|
+
required: ["auth_token"],
|
|
8550
|
+
properties: { auth_token: true }
|
|
8551
|
+
}
|
|
8552
|
+
},
|
|
8553
|
+
{
|
|
8554
|
+
if: {
|
|
8555
|
+
properties: { auth_type: { const: "client_credentials" } },
|
|
8556
|
+
required: ["auth_type"]
|
|
8557
|
+
},
|
|
8558
|
+
then: {
|
|
8559
|
+
required: ["auth_client_id", "auth_client_secret"],
|
|
8560
|
+
properties: {
|
|
8561
|
+
auth_client_id: true,
|
|
8562
|
+
auth_client_secret: true,
|
|
8563
|
+
auth_client_name: true,
|
|
8564
|
+
auth_scope: true
|
|
8565
|
+
}
|
|
8566
|
+
}
|
|
8567
|
+
},
|
|
8568
|
+
{
|
|
8569
|
+
if: { properties: { auth_type: { const: "private_key_jwt" } }, required: ["auth_type"] },
|
|
8570
|
+
then: {
|
|
8571
|
+
required: ["auth_client_id", "auth_private_key", "auth_algorithm"],
|
|
8572
|
+
properties: {
|
|
8573
|
+
auth_client_id: true,
|
|
8574
|
+
auth_private_key: true,
|
|
8575
|
+
auth_algorithm: true,
|
|
8576
|
+
auth_client_name: true,
|
|
8577
|
+
auth_jwt_lifetime_seconds: true,
|
|
8578
|
+
auth_scope: true
|
|
8579
|
+
}
|
|
8580
|
+
}
|
|
8581
|
+
},
|
|
8582
|
+
{
|
|
8583
|
+
if: {
|
|
8584
|
+
properties: { auth_type: { const: "static_private_key_jwt" } },
|
|
8585
|
+
required: ["auth_type"]
|
|
8586
|
+
},
|
|
8587
|
+
then: {
|
|
8588
|
+
required: ["auth_client_id", "auth_jwt_bearer_assertion"],
|
|
8589
|
+
properties: {
|
|
8590
|
+
auth_client_id: true,
|
|
8591
|
+
auth_jwt_bearer_assertion: true,
|
|
8592
|
+
auth_client_name: true,
|
|
8593
|
+
auth_scope: true
|
|
8594
|
+
}
|
|
8595
|
+
}
|
|
8596
|
+
},
|
|
8597
|
+
{
|
|
8598
|
+
if: { properties: { auth_type: { const: "authorization_code" } }, required: ["auth_type"] },
|
|
8599
|
+
then: {
|
|
8600
|
+
required: ["auth_client_id", "auth_redirect_url"],
|
|
8601
|
+
properties: {
|
|
8602
|
+
auth_client_id: true,
|
|
8603
|
+
auth_client_secret: true,
|
|
8604
|
+
auth_redirect_url: true,
|
|
8605
|
+
auth_scope: true
|
|
8606
|
+
}
|
|
8607
|
+
}
|
|
8608
|
+
}
|
|
8609
|
+
]
|
|
8610
|
+
};
|
|
8611
|
+
function isMcpAuthType(value) {
|
|
8612
|
+
return typeof value === "string" && mcpAuthTypes.includes(value);
|
|
8613
|
+
}
|
|
8614
|
+
function asNonEmptyString(value) {
|
|
8615
|
+
if (typeof value !== "string")
|
|
8616
|
+
return;
|
|
8617
|
+
const trimmed = value.trim();
|
|
8618
|
+
return trimmed === "" ? undefined : trimmed;
|
|
8619
|
+
}
|
|
8620
|
+
function asNumber(value) {
|
|
8621
|
+
return typeof value === "number" ? value : undefined;
|
|
8622
|
+
}
|
|
8623
|
+
function buildAuthConfig(flat) {
|
|
8624
|
+
const rawAuthType = flat.auth_type;
|
|
8625
|
+
if (!isMcpAuthType(rawAuthType) || rawAuthType === "none") {
|
|
8626
|
+
return;
|
|
8627
|
+
}
|
|
8628
|
+
const authType = rawAuthType;
|
|
8629
|
+
switch (authType) {
|
|
8630
|
+
case "bearer": {
|
|
8631
|
+
const token = asNonEmptyString(flat.auth_token);
|
|
8632
|
+
if (!token)
|
|
8633
|
+
return;
|
|
8634
|
+
return { type: "bearer", token };
|
|
8635
|
+
}
|
|
8636
|
+
case "client_credentials": {
|
|
8637
|
+
const client_id = asNonEmptyString(flat.auth_client_id);
|
|
8638
|
+
const client_secret = asNonEmptyString(flat.auth_client_secret);
|
|
8639
|
+
if (!client_id || !client_secret)
|
|
8640
|
+
return;
|
|
8641
|
+
return {
|
|
8642
|
+
type: "client_credentials",
|
|
8643
|
+
client_id,
|
|
8644
|
+
client_secret,
|
|
8645
|
+
client_name: asNonEmptyString(flat.auth_client_name),
|
|
8646
|
+
scope: asNonEmptyString(flat.auth_scope)
|
|
8647
|
+
};
|
|
8648
|
+
}
|
|
8649
|
+
case "private_key_jwt": {
|
|
8650
|
+
const client_id = asNonEmptyString(flat.auth_client_id);
|
|
8651
|
+
const private_key = asNonEmptyString(flat.auth_private_key);
|
|
8652
|
+
const algorithm = asNonEmptyString(flat.auth_algorithm);
|
|
8653
|
+
if (!client_id || !private_key || !algorithm)
|
|
8654
|
+
return;
|
|
8655
|
+
return {
|
|
8656
|
+
type: "private_key_jwt",
|
|
8657
|
+
client_id,
|
|
8658
|
+
private_key,
|
|
8659
|
+
algorithm,
|
|
8660
|
+
client_name: asNonEmptyString(flat.auth_client_name),
|
|
8661
|
+
jwt_lifetime_seconds: asNumber(flat.auth_jwt_lifetime_seconds),
|
|
8662
|
+
scope: asNonEmptyString(flat.auth_scope)
|
|
8663
|
+
};
|
|
8664
|
+
}
|
|
8665
|
+
case "static_private_key_jwt": {
|
|
8666
|
+
const client_id = asNonEmptyString(flat.auth_client_id);
|
|
8667
|
+
const jwt_bearer_assertion = asNonEmptyString(flat.auth_jwt_bearer_assertion);
|
|
8668
|
+
if (!client_id || !jwt_bearer_assertion)
|
|
8669
|
+
return;
|
|
8670
|
+
return {
|
|
8671
|
+
type: "static_private_key_jwt",
|
|
8672
|
+
client_id,
|
|
8673
|
+
jwt_bearer_assertion,
|
|
8674
|
+
client_name: asNonEmptyString(flat.auth_client_name),
|
|
8675
|
+
scope: asNonEmptyString(flat.auth_scope)
|
|
8676
|
+
};
|
|
8677
|
+
}
|
|
8678
|
+
case "authorization_code": {
|
|
8679
|
+
const client_id = asNonEmptyString(flat.auth_client_id);
|
|
8680
|
+
const redirect_url = asNonEmptyString(flat.auth_redirect_url);
|
|
8681
|
+
if (!client_id || !redirect_url)
|
|
8682
|
+
return;
|
|
8683
|
+
return {
|
|
8684
|
+
type: "authorization_code",
|
|
8685
|
+
client_id,
|
|
8686
|
+
client_secret: asNonEmptyString(flat.auth_client_secret),
|
|
8687
|
+
redirect_url,
|
|
8688
|
+
scope: asNonEmptyString(flat.auth_scope)
|
|
8689
|
+
};
|
|
8690
|
+
}
|
|
8691
|
+
default:
|
|
8692
|
+
return;
|
|
8693
|
+
}
|
|
8694
|
+
}
|
|
8695
|
+
// src/util/McpAuthProvider.ts
|
|
8696
|
+
import {
|
|
8697
|
+
ClientCredentialsProvider,
|
|
8698
|
+
PrivateKeyJwtProvider,
|
|
8699
|
+
StaticPrivateKeyJwtProvider,
|
|
8700
|
+
createPrivateKeyJwtAuth
|
|
8701
|
+
} from "@modelcontextprotocol/sdk/client/auth-extensions.js";
|
|
8702
|
+
import { UnauthorizedError } from "@modelcontextprotocol/sdk/client/auth.js";
|
|
8703
|
+
import { getGlobalCredentialStore } from "@workglow/util";
|
|
8704
|
+
function normalizeServerUrl(serverUrl) {
|
|
8705
|
+
try {
|
|
8706
|
+
const u = new URL(serverUrl);
|
|
8707
|
+
return u.origin + u.pathname.replace(/\/+$/, "");
|
|
8708
|
+
} catch {
|
|
8709
|
+
return serverUrl;
|
|
8710
|
+
}
|
|
8711
|
+
}
|
|
8712
|
+
function storeKey(serverUrl, suffix) {
|
|
8713
|
+
return `mcp:oauth:${normalizeServerUrl(serverUrl)}:${suffix}`;
|
|
8714
|
+
}
|
|
8311
8715
|
|
|
8716
|
+
class CredentialStoreOAuthProvider {
|
|
8717
|
+
store;
|
|
8718
|
+
serverUrl;
|
|
8719
|
+
_clientMetadata;
|
|
8720
|
+
_redirectUrl;
|
|
8721
|
+
_initialClientInfo;
|
|
8722
|
+
prepareTokenRequest;
|
|
8723
|
+
addClientAuthentication;
|
|
8724
|
+
constructor(options2) {
|
|
8725
|
+
this.store = options2.store;
|
|
8726
|
+
this.serverUrl = options2.serverUrl;
|
|
8727
|
+
this._clientMetadata = options2.clientMetadata;
|
|
8728
|
+
this._redirectUrl = options2.redirectUrl;
|
|
8729
|
+
this._initialClientInfo = options2.initialClientInfo;
|
|
8730
|
+
if (options2.prepareTokenRequest) {
|
|
8731
|
+
this.prepareTokenRequest = options2.prepareTokenRequest;
|
|
8732
|
+
}
|
|
8733
|
+
if (options2.addClientAuthentication) {
|
|
8734
|
+
this.addClientAuthentication = options2.addClientAuthentication;
|
|
8735
|
+
}
|
|
8736
|
+
}
|
|
8737
|
+
get redirectUrl() {
|
|
8738
|
+
return this._redirectUrl;
|
|
8739
|
+
}
|
|
8740
|
+
get clientMetadata() {
|
|
8741
|
+
return this._clientMetadata;
|
|
8742
|
+
}
|
|
8743
|
+
async clientInformation() {
|
|
8744
|
+
const raw = await this.store.get(storeKey(this.serverUrl, "client_info"));
|
|
8745
|
+
if (!raw)
|
|
8746
|
+
return this._initialClientInfo;
|
|
8747
|
+
return JSON.parse(raw);
|
|
8748
|
+
}
|
|
8749
|
+
async saveClientInformation(info) {
|
|
8750
|
+
await this.store.put(storeKey(this.serverUrl, "client_info"), JSON.stringify(info));
|
|
8751
|
+
}
|
|
8752
|
+
async tokens() {
|
|
8753
|
+
const raw = await this.store.get(storeKey(this.serverUrl, "tokens"));
|
|
8754
|
+
if (!raw)
|
|
8755
|
+
return;
|
|
8756
|
+
return JSON.parse(raw);
|
|
8757
|
+
}
|
|
8758
|
+
async saveTokens(tokens) {
|
|
8759
|
+
const expiresAt = tokens.expires_in != null ? new Date(Date.now() + tokens.expires_in * 1000) : undefined;
|
|
8760
|
+
await this.store.put(storeKey(this.serverUrl, "tokens"), JSON.stringify(tokens), {
|
|
8761
|
+
expiresAt
|
|
8762
|
+
});
|
|
8763
|
+
}
|
|
8764
|
+
async redirectToAuthorization(authorizationUrl) {
|
|
8765
|
+
throw new Error(`MCP OAuth authorization required. ` + `Open this URL to authorize: ${authorizationUrl.toString()}`);
|
|
8766
|
+
}
|
|
8767
|
+
async saveCodeVerifier(codeVerifier) {
|
|
8768
|
+
await this.store.put(storeKey(this.serverUrl, "code_verifier"), codeVerifier);
|
|
8769
|
+
}
|
|
8770
|
+
async codeVerifier() {
|
|
8771
|
+
const v = await this.store.get(storeKey(this.serverUrl, "code_verifier"));
|
|
8772
|
+
if (!v)
|
|
8773
|
+
throw new Error("No code verifier saved for this session");
|
|
8774
|
+
return v;
|
|
8775
|
+
}
|
|
8776
|
+
async saveDiscoveryState(state) {
|
|
8777
|
+
await this.store.put(storeKey(this.serverUrl, "discovery"), JSON.stringify(state));
|
|
8778
|
+
}
|
|
8779
|
+
async discoveryState() {
|
|
8780
|
+
const raw = await this.store.get(storeKey(this.serverUrl, "discovery"));
|
|
8781
|
+
if (!raw)
|
|
8782
|
+
return;
|
|
8783
|
+
return JSON.parse(raw);
|
|
8784
|
+
}
|
|
8785
|
+
async invalidateCredentials(scope) {
|
|
8786
|
+
const deleteKey = async (suffix) => {
|
|
8787
|
+
await this.store.delete(storeKey(this.serverUrl, suffix));
|
|
8788
|
+
};
|
|
8789
|
+
switch (scope) {
|
|
8790
|
+
case "all":
|
|
8791
|
+
await deleteKey("tokens");
|
|
8792
|
+
await deleteKey("client_info");
|
|
8793
|
+
await deleteKey("code_verifier");
|
|
8794
|
+
await deleteKey("discovery");
|
|
8795
|
+
break;
|
|
8796
|
+
case "client":
|
|
8797
|
+
await deleteKey("client_info");
|
|
8798
|
+
break;
|
|
8799
|
+
case "tokens":
|
|
8800
|
+
await deleteKey("tokens");
|
|
8801
|
+
break;
|
|
8802
|
+
case "verifier":
|
|
8803
|
+
await deleteKey("code_verifier");
|
|
8804
|
+
break;
|
|
8805
|
+
case "discovery":
|
|
8806
|
+
await deleteKey("discovery");
|
|
8807
|
+
break;
|
|
8808
|
+
}
|
|
8809
|
+
}
|
|
8810
|
+
}
|
|
8811
|
+
function createAuthProvider(auth, serverUrl, credentialStore) {
|
|
8812
|
+
switch (auth.type) {
|
|
8813
|
+
case "none":
|
|
8814
|
+
case "bearer":
|
|
8815
|
+
return;
|
|
8816
|
+
case "client_credentials": {
|
|
8817
|
+
if (!credentialStore) {
|
|
8818
|
+
return new ClientCredentialsProvider({
|
|
8819
|
+
clientId: auth.client_id,
|
|
8820
|
+
clientSecret: auth.client_secret,
|
|
8821
|
+
clientName: auth.client_name,
|
|
8822
|
+
scope: auth.scope
|
|
8823
|
+
});
|
|
8824
|
+
}
|
|
8825
|
+
const prepareTokenRequest = (scope) => {
|
|
8826
|
+
const params = new URLSearchParams({ grant_type: "client_credentials" });
|
|
8827
|
+
const effectiveScope = scope ?? auth.scope;
|
|
8828
|
+
if (effectiveScope)
|
|
8829
|
+
params.set("scope", effectiveScope);
|
|
8830
|
+
return params;
|
|
8831
|
+
};
|
|
8832
|
+
return new CredentialStoreOAuthProvider({
|
|
8833
|
+
store: credentialStore,
|
|
8834
|
+
serverUrl,
|
|
8835
|
+
clientMetadata: {
|
|
8836
|
+
redirect_uris: [],
|
|
8837
|
+
grant_types: ["client_credentials"],
|
|
8838
|
+
token_endpoint_auth_method: "client_secret_basic",
|
|
8839
|
+
client_name: auth.client_name
|
|
8840
|
+
},
|
|
8841
|
+
initialClientInfo: {
|
|
8842
|
+
client_id: auth.client_id,
|
|
8843
|
+
client_secret: auth.client_secret
|
|
8844
|
+
},
|
|
8845
|
+
prepareTokenRequest
|
|
8846
|
+
});
|
|
8847
|
+
}
|
|
8848
|
+
case "private_key_jwt": {
|
|
8849
|
+
if (!credentialStore) {
|
|
8850
|
+
return new PrivateKeyJwtProvider({
|
|
8851
|
+
clientId: auth.client_id,
|
|
8852
|
+
privateKey: auth.private_key,
|
|
8853
|
+
algorithm: auth.algorithm,
|
|
8854
|
+
clientName: auth.client_name,
|
|
8855
|
+
jwtLifetimeSeconds: auth.jwt_lifetime_seconds,
|
|
8856
|
+
scope: auth.scope
|
|
8857
|
+
});
|
|
8858
|
+
}
|
|
8859
|
+
const addClientAuth = createPrivateKeyJwtAuth({
|
|
8860
|
+
issuer: auth.client_id,
|
|
8861
|
+
subject: auth.client_id,
|
|
8862
|
+
privateKey: auth.private_key,
|
|
8863
|
+
alg: auth.algorithm,
|
|
8864
|
+
lifetimeSeconds: auth.jwt_lifetime_seconds
|
|
8865
|
+
});
|
|
8866
|
+
const prepareTokenRequest = (scope) => {
|
|
8867
|
+
const params = new URLSearchParams({ grant_type: "client_credentials" });
|
|
8868
|
+
const effectiveScope = scope ?? auth.scope;
|
|
8869
|
+
if (effectiveScope)
|
|
8870
|
+
params.set("scope", effectiveScope);
|
|
8871
|
+
return params;
|
|
8872
|
+
};
|
|
8873
|
+
return new CredentialStoreOAuthProvider({
|
|
8874
|
+
store: credentialStore,
|
|
8875
|
+
serverUrl,
|
|
8876
|
+
clientMetadata: {
|
|
8877
|
+
redirect_uris: [],
|
|
8878
|
+
grant_types: ["client_credentials"],
|
|
8879
|
+
token_endpoint_auth_method: "private_key_jwt",
|
|
8880
|
+
client_name: auth.client_name
|
|
8881
|
+
},
|
|
8882
|
+
initialClientInfo: { client_id: auth.client_id },
|
|
8883
|
+
prepareTokenRequest,
|
|
8884
|
+
addClientAuthentication: addClientAuth
|
|
8885
|
+
});
|
|
8886
|
+
}
|
|
8887
|
+
case "static_private_key_jwt": {
|
|
8888
|
+
if (!credentialStore) {
|
|
8889
|
+
return new StaticPrivateKeyJwtProvider({
|
|
8890
|
+
clientId: auth.client_id,
|
|
8891
|
+
jwtBearerAssertion: auth.jwt_bearer_assertion,
|
|
8892
|
+
clientName: auth.client_name,
|
|
8893
|
+
scope: auth.scope
|
|
8894
|
+
});
|
|
8895
|
+
}
|
|
8896
|
+
const assertion = auth.jwt_bearer_assertion;
|
|
8897
|
+
const addClientAuth = (_headers, params) => {
|
|
8898
|
+
params.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer");
|
|
8899
|
+
params.set("client_assertion", assertion);
|
|
8900
|
+
};
|
|
8901
|
+
const prepareTokenRequest = (scope) => {
|
|
8902
|
+
const params = new URLSearchParams({ grant_type: "client_credentials" });
|
|
8903
|
+
const effectiveScope = scope ?? auth.scope;
|
|
8904
|
+
if (effectiveScope)
|
|
8905
|
+
params.set("scope", effectiveScope);
|
|
8906
|
+
return params;
|
|
8907
|
+
};
|
|
8908
|
+
return new CredentialStoreOAuthProvider({
|
|
8909
|
+
store: credentialStore,
|
|
8910
|
+
serverUrl,
|
|
8911
|
+
clientMetadata: {
|
|
8912
|
+
redirect_uris: [],
|
|
8913
|
+
grant_types: ["client_credentials"],
|
|
8914
|
+
token_endpoint_auth_method: "private_key_jwt",
|
|
8915
|
+
client_name: auth.client_name
|
|
8916
|
+
},
|
|
8917
|
+
initialClientInfo: { client_id: auth.client_id },
|
|
8918
|
+
prepareTokenRequest,
|
|
8919
|
+
addClientAuthentication: addClientAuth
|
|
8920
|
+
});
|
|
8921
|
+
}
|
|
8922
|
+
case "authorization_code": {
|
|
8923
|
+
if (!credentialStore) {
|
|
8924
|
+
throw new Error("authorization_code auth requires a credential store for token persistence");
|
|
8925
|
+
}
|
|
8926
|
+
return new CredentialStoreOAuthProvider({
|
|
8927
|
+
store: credentialStore,
|
|
8928
|
+
serverUrl,
|
|
8929
|
+
clientMetadata: {
|
|
8930
|
+
redirect_uris: [auth.redirect_url],
|
|
8931
|
+
grant_types: ["authorization_code", "refresh_token"],
|
|
8932
|
+
token_endpoint_auth_method: auth.client_secret ? "client_secret_basic" : "none",
|
|
8933
|
+
scope: auth.scope
|
|
8934
|
+
},
|
|
8935
|
+
initialClientInfo: {
|
|
8936
|
+
client_id: auth.client_id,
|
|
8937
|
+
...auth.client_secret ? { client_secret: auth.client_secret } : {}
|
|
8938
|
+
},
|
|
8939
|
+
redirectUrl: auth.redirect_url
|
|
8940
|
+
});
|
|
8941
|
+
}
|
|
8942
|
+
default:
|
|
8943
|
+
return;
|
|
8944
|
+
}
|
|
8945
|
+
}
|
|
8946
|
+
async function resolveAuthSecrets(auth, credentialStore) {
|
|
8947
|
+
if (auth.type === "none")
|
|
8948
|
+
return auth;
|
|
8949
|
+
const store = credentialStore ?? getGlobalCredentialStore();
|
|
8950
|
+
async function resolve(value) {
|
|
8951
|
+
if (!value)
|
|
8952
|
+
return value;
|
|
8953
|
+
const resolved = await store.get(value);
|
|
8954
|
+
return resolved ?? value;
|
|
8955
|
+
}
|
|
8956
|
+
switch (auth.type) {
|
|
8957
|
+
case "bearer":
|
|
8958
|
+
return { ...auth, token: await resolve(auth.token) ?? auth.token };
|
|
8959
|
+
case "client_credentials":
|
|
8960
|
+
return {
|
|
8961
|
+
...auth,
|
|
8962
|
+
client_secret: await resolve(auth.client_secret) ?? auth.client_secret
|
|
8963
|
+
};
|
|
8964
|
+
case "private_key_jwt":
|
|
8965
|
+
return {
|
|
8966
|
+
...auth,
|
|
8967
|
+
private_key: await resolve(auth.private_key) ?? auth.private_key
|
|
8968
|
+
};
|
|
8969
|
+
case "static_private_key_jwt":
|
|
8970
|
+
return {
|
|
8971
|
+
...auth,
|
|
8972
|
+
jwt_bearer_assertion: await resolve(auth.jwt_bearer_assertion) ?? auth.jwt_bearer_assertion
|
|
8973
|
+
};
|
|
8974
|
+
case "authorization_code":
|
|
8975
|
+
return {
|
|
8976
|
+
...auth,
|
|
8977
|
+
client_secret: await resolve(auth.client_secret)
|
|
8978
|
+
};
|
|
8979
|
+
default:
|
|
8980
|
+
return auth;
|
|
8981
|
+
}
|
|
8982
|
+
}
|
|
8983
|
+
// src/util/McpClientUtil.node.ts
|
|
8984
|
+
import { Client } from "@modelcontextprotocol/sdk/client";
|
|
8985
|
+
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
8986
|
+
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
8987
|
+
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
8988
|
+
import { getGlobalCredentialStore as getGlobalCredentialStore2, getLogger } from "@workglow/util";
|
|
8989
|
+
var mcpTransportTypes = ["stdio", "sse", "streamable-http"];
|
|
8990
|
+
var mcpServerConfigSchema = {
|
|
8991
|
+
properties: {
|
|
8992
|
+
transport: {
|
|
8993
|
+
type: "string",
|
|
8994
|
+
enum: mcpTransportTypes,
|
|
8995
|
+
title: "Transport",
|
|
8996
|
+
description: "The transport type to use for connecting to the MCP server"
|
|
8997
|
+
},
|
|
8998
|
+
server_url: {
|
|
8999
|
+
type: "string",
|
|
9000
|
+
format: "string:uri",
|
|
9001
|
+
title: "Server URL",
|
|
9002
|
+
description: "The URL of the MCP server (for sse and streamable-http transports)"
|
|
9003
|
+
},
|
|
9004
|
+
command: {
|
|
9005
|
+
type: "string",
|
|
9006
|
+
title: "Command",
|
|
9007
|
+
description: "The command to run (for stdio transport)"
|
|
9008
|
+
},
|
|
9009
|
+
args: {
|
|
9010
|
+
type: "array",
|
|
9011
|
+
items: { type: "string" },
|
|
9012
|
+
title: "Arguments",
|
|
9013
|
+
description: "Command arguments (for stdio transport)"
|
|
9014
|
+
},
|
|
9015
|
+
env: {
|
|
9016
|
+
type: "object",
|
|
9017
|
+
additionalProperties: { type: "string" },
|
|
9018
|
+
title: "Environment",
|
|
9019
|
+
description: "Environment variables (for stdio transport)"
|
|
9020
|
+
},
|
|
9021
|
+
...mcpAuthConfigSchema.properties
|
|
9022
|
+
},
|
|
9023
|
+
allOf: [
|
|
9024
|
+
{
|
|
9025
|
+
if: { properties: { transport: { const: "stdio" } }, required: ["transport"] },
|
|
9026
|
+
then: { required: ["command"] }
|
|
9027
|
+
},
|
|
9028
|
+
{
|
|
9029
|
+
if: { properties: { transport: { const: "sse" } }, required: ["transport"] },
|
|
9030
|
+
then: { required: ["server_url"] }
|
|
9031
|
+
},
|
|
9032
|
+
{
|
|
9033
|
+
if: {
|
|
9034
|
+
properties: { transport: { const: "streamable-http" } },
|
|
9035
|
+
required: ["transport"]
|
|
9036
|
+
},
|
|
9037
|
+
then: { required: ["server_url"] }
|
|
9038
|
+
},
|
|
9039
|
+
...mcpAuthConfigSchema.allOf
|
|
9040
|
+
]
|
|
9041
|
+
};
|
|
9042
|
+
async function createMcpClient(config, signal) {
|
|
9043
|
+
let transport;
|
|
9044
|
+
let auth = config.auth ?? buildAuthConfig({ ...config });
|
|
9045
|
+
if (auth && auth.type !== "none") {
|
|
9046
|
+
auth = await resolveAuthSecrets(auth, getGlobalCredentialStore2());
|
|
9047
|
+
}
|
|
9048
|
+
const authProvider = config.authProvider ?? (auth && auth.type !== "none" && auth.type !== "bearer" ? createAuthProvider(auth, config.server_url ?? "", getGlobalCredentialStore2()) : undefined);
|
|
9049
|
+
const headers = {
|
|
9050
|
+
...auth?.type === "bearer" ? { Authorization: `Bearer ${auth.token}` } : {}
|
|
9051
|
+
};
|
|
9052
|
+
switch (config.transport) {
|
|
9053
|
+
case "stdio":
|
|
9054
|
+
if (auth && auth.type !== "none") {
|
|
9055
|
+
getLogger().warn("MCP auth is not supported for stdio transport; auth config ignored. " + "Use env vars to pass credentials to stdio servers.");
|
|
9056
|
+
}
|
|
9057
|
+
transport = new StdioClientTransport({
|
|
9058
|
+
command: config.command,
|
|
9059
|
+
args: config.args,
|
|
9060
|
+
env: config.env
|
|
9061
|
+
});
|
|
9062
|
+
break;
|
|
9063
|
+
case "sse": {
|
|
9064
|
+
transport = new SSEClientTransport(new URL(config.server_url), {
|
|
9065
|
+
authProvider,
|
|
9066
|
+
requestInit: { headers }
|
|
9067
|
+
});
|
|
9068
|
+
break;
|
|
9069
|
+
}
|
|
9070
|
+
case "streamable-http": {
|
|
9071
|
+
transport = new StreamableHTTPClientTransport(new URL(config.server_url), {
|
|
9072
|
+
authProvider,
|
|
9073
|
+
requestInit: { headers }
|
|
9074
|
+
});
|
|
9075
|
+
break;
|
|
9076
|
+
}
|
|
9077
|
+
default:
|
|
9078
|
+
throw new Error(`Unsupported transport type: ${config.transport}`);
|
|
9079
|
+
}
|
|
9080
|
+
const client = new Client({ name: "workglow-mcp-client", version: "1.0.0" });
|
|
9081
|
+
if (signal) {
|
|
9082
|
+
signal.addEventListener("abort", () => {
|
|
9083
|
+
client.close().catch(() => {});
|
|
9084
|
+
}, { once: true });
|
|
9085
|
+
}
|
|
9086
|
+
await client.connect(transport);
|
|
9087
|
+
return { client, transport };
|
|
9088
|
+
}
|
|
9089
|
+
var mcpClientFactory = {
|
|
9090
|
+
create: createMcpClient
|
|
9091
|
+
};
|
|
8312
9092
|
// src/task/FileLoaderTask.server.ts
|
|
8313
9093
|
import {
|
|
8314
|
-
CreateWorkflow as
|
|
9094
|
+
CreateWorkflow as CreateWorkflow51,
|
|
8315
9095
|
TaskAbortedError as TaskAbortedError3,
|
|
8316
|
-
Workflow as
|
|
9096
|
+
Workflow as Workflow52
|
|
8317
9097
|
} from "@workglow/task-graph";
|
|
8318
9098
|
import { readFile } from "node:fs/promises";
|
|
8319
9099
|
|
|
8320
9100
|
// src/task/FileLoaderTask.ts
|
|
8321
9101
|
import {
|
|
8322
|
-
CreateWorkflow as
|
|
8323
|
-
Task as
|
|
9102
|
+
CreateWorkflow as CreateWorkflow50,
|
|
9103
|
+
Task as Task48,
|
|
8324
9104
|
TaskAbortedError as TaskAbortedError2,
|
|
8325
|
-
Workflow as
|
|
9105
|
+
Workflow as Workflow51
|
|
8326
9106
|
} from "@workglow/task-graph";
|
|
8327
9107
|
import Papa from "papaparse";
|
|
8328
|
-
var
|
|
9108
|
+
var inputSchema44 = {
|
|
8329
9109
|
type: "object",
|
|
8330
9110
|
properties: {
|
|
8331
9111
|
url: {
|
|
@@ -8396,14 +9176,14 @@ var outputSchema44 = {
|
|
|
8396
9176
|
additionalProperties: false
|
|
8397
9177
|
};
|
|
8398
9178
|
|
|
8399
|
-
class FileLoaderTask extends
|
|
9179
|
+
class FileLoaderTask extends Task48 {
|
|
8400
9180
|
static type = "FileLoaderTask";
|
|
8401
9181
|
static category = "Document";
|
|
8402
9182
|
static title = "File Loader";
|
|
8403
9183
|
static description = "Load documents from URLs (http://, https://)";
|
|
8404
9184
|
static cacheable = true;
|
|
8405
9185
|
static inputSchema() {
|
|
8406
|
-
return
|
|
9186
|
+
return inputSchema44;
|
|
8407
9187
|
}
|
|
8408
9188
|
static outputSchema() {
|
|
8409
9189
|
return outputSchema44;
|
|
@@ -8759,7 +9539,7 @@ class FileLoaderTask extends Task47 {
|
|
|
8759
9539
|
});
|
|
8760
9540
|
}
|
|
8761
9541
|
}
|
|
8762
|
-
|
|
9542
|
+
Workflow51.prototype.fileLoader = CreateWorkflow50(FileLoaderTask);
|
|
8763
9543
|
|
|
8764
9544
|
// src/task/FileLoaderTask.server.ts
|
|
8765
9545
|
class FileLoaderTask2 extends FileLoaderTask {
|
|
@@ -8948,9 +9728,10 @@ class FileLoaderTask2 extends FileLoaderTask {
|
|
|
8948
9728
|
var fileLoader = (input2, config) => {
|
|
8949
9729
|
return new FileLoaderTask2({}, config).run(input2);
|
|
8950
9730
|
};
|
|
8951
|
-
|
|
8952
|
-
|
|
9731
|
+
Workflow52.prototype.fileLoader = CreateWorkflow51(FileLoaderTask2);
|
|
8953
9732
|
// src/node.ts
|
|
9733
|
+
import { TaskRegistry as TaskRegistry2 } from "@workglow/task-graph";
|
|
9734
|
+
registerMcpTaskDeps({ mcpClientFactory, mcpServerConfigSchema });
|
|
8954
9735
|
var registerCommonTasks2 = () => {
|
|
8955
9736
|
const tasks = registerCommonTasks();
|
|
8956
9737
|
TaskRegistry2.registerTask(FileLoaderTask2);
|
|
@@ -8958,21 +9739,36 @@ var registerCommonTasks2 = () => {
|
|
|
8958
9739
|
};
|
|
8959
9740
|
export {
|
|
8960
9741
|
split,
|
|
9742
|
+
searchMcpRegistryPage,
|
|
9743
|
+
searchMcpRegistry,
|
|
9744
|
+
resolveAuthSecrets,
|
|
9745
|
+
registerMcpTaskDeps,
|
|
8961
9746
|
registerCommonTasks2 as registerCommonTasks,
|
|
8962
9747
|
process,
|
|
8963
9748
|
merge,
|
|
9749
|
+
mcpTransportTypes,
|
|
8964
9750
|
mcpToolCall,
|
|
9751
|
+
mcpServerConfigSchema,
|
|
9752
|
+
mcpSearch,
|
|
8965
9753
|
mcpResourceRead,
|
|
8966
9754
|
mcpPromptGet,
|
|
8967
9755
|
mcpList,
|
|
9756
|
+
mcpClientFactory,
|
|
9757
|
+
mcpAuthTypes,
|
|
9758
|
+
mcpAuthConfigSchema,
|
|
9759
|
+
mapMcpRegistryResult,
|
|
8968
9760
|
lambdaTaskConfigSchema,
|
|
8969
9761
|
lambda,
|
|
8970
9762
|
json,
|
|
8971
9763
|
javaScript,
|
|
9764
|
+
getMcpTaskDeps,
|
|
8972
9765
|
fileLoader,
|
|
8973
9766
|
fetchUrl,
|
|
8974
9767
|
delay,
|
|
8975
9768
|
debugLog,
|
|
9769
|
+
createMcpClient,
|
|
9770
|
+
createAuthProvider,
|
|
9771
|
+
buildAuthConfig,
|
|
8976
9772
|
VectorSumTask,
|
|
8977
9773
|
VectorSubtractTask,
|
|
8978
9774
|
VectorScaleTask,
|
|
@@ -8981,6 +9777,7 @@ export {
|
|
|
8981
9777
|
VectorDotProductTask,
|
|
8982
9778
|
VectorDivideTask,
|
|
8983
9779
|
VectorDistanceTask,
|
|
9780
|
+
UnauthorizedError,
|
|
8984
9781
|
TypeReplicateArray,
|
|
8985
9782
|
TemplateTask,
|
|
8986
9783
|
StringUpperCaseTask,
|
|
@@ -9010,9 +9807,11 @@ export {
|
|
|
9010
9807
|
OutputTask,
|
|
9011
9808
|
MergeTask,
|
|
9012
9809
|
McpToolCallTask,
|
|
9810
|
+
McpSearchTask,
|
|
9013
9811
|
McpResourceReadTask,
|
|
9014
9812
|
McpPromptGetTask,
|
|
9015
9813
|
McpListTask,
|
|
9814
|
+
MCP_TASK_DEPS,
|
|
9016
9815
|
LambdaTask,
|
|
9017
9816
|
JsonTask,
|
|
9018
9817
|
JsonPathTask,
|
|
@@ -9024,7 +9823,8 @@ export {
|
|
|
9024
9823
|
DelayTask,
|
|
9025
9824
|
DebugLogTask,
|
|
9026
9825
|
DateFormatTask,
|
|
9826
|
+
CredentialStoreOAuthProvider,
|
|
9027
9827
|
ArrayTask
|
|
9028
9828
|
};
|
|
9029
9829
|
|
|
9030
|
-
//# debugId=
|
|
9830
|
+
//# debugId=3771E252974488EC64756E2164756E21
|