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