@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/browser.js
CHANGED
|
@@ -6,9 +6,6 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
6
6
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
// src/browser.ts
|
|
10
|
-
import { TaskRegistry as TaskRegistry2 } from "@workglow/task-graph";
|
|
11
|
-
|
|
12
9
|
// src/task/adaptive.ts
|
|
13
10
|
import { CreateAdaptiveWorkflow, Workflow as Workflow10 } from "@workglow/task-graph";
|
|
14
11
|
|
|
@@ -275,7 +272,7 @@ import { CreateWorkflow as CreateWorkflow6, Task as Task6, Workflow as Workflow6
|
|
|
275
272
|
import {
|
|
276
273
|
createTypedArrayFrom,
|
|
277
274
|
TypedArraySchema
|
|
278
|
-
} from "@workglow/util";
|
|
275
|
+
} from "@workglow/util/schema";
|
|
279
276
|
var inputSchema6 = {
|
|
280
277
|
type: "object",
|
|
281
278
|
properties: {
|
|
@@ -343,7 +340,7 @@ import { CreateWorkflow as CreateWorkflow7, Task as Task7, Workflow as Workflow7
|
|
|
343
340
|
import {
|
|
344
341
|
createTypedArrayFrom as createTypedArrayFrom2,
|
|
345
342
|
TypedArraySchema as TypedArraySchema2
|
|
346
|
-
} from "@workglow/util";
|
|
343
|
+
} from "@workglow/util/schema";
|
|
347
344
|
var inputSchema7 = {
|
|
348
345
|
type: "object",
|
|
349
346
|
properties: {
|
|
@@ -405,7 +402,7 @@ import { CreateWorkflow as CreateWorkflow8, Task as Task8, Workflow as Workflow8
|
|
|
405
402
|
import {
|
|
406
403
|
createTypedArrayFrom as createTypedArrayFrom3,
|
|
407
404
|
TypedArraySchema as TypedArraySchema3
|
|
408
|
-
} from "@workglow/util";
|
|
405
|
+
} from "@workglow/util/schema";
|
|
409
406
|
var inputSchema8 = {
|
|
410
407
|
type: "object",
|
|
411
408
|
properties: {
|
|
@@ -473,7 +470,7 @@ import { CreateWorkflow as CreateWorkflow9, Task as Task9, Workflow as Workflow9
|
|
|
473
470
|
import {
|
|
474
471
|
createTypedArrayFrom as createTypedArrayFrom4,
|
|
475
472
|
TypedArraySchema as TypedArraySchema4
|
|
476
|
-
} from "@workglow/util";
|
|
473
|
+
} from "@workglow/util/schema";
|
|
477
474
|
var inputSchema9 = {
|
|
478
475
|
type: "object",
|
|
479
476
|
properties: {
|
|
@@ -538,23 +535,23 @@ Workflow10.prototype.divide = CreateAdaptiveWorkflow(ScalarDivideTask, VectorDiv
|
|
|
538
535
|
Workflow10.prototype.sum = CreateAdaptiveWorkflow(ScalarSumTask, VectorSumTask);
|
|
539
536
|
|
|
540
537
|
// src/task/ArrayTask.ts
|
|
541
|
-
import {
|
|
542
|
-
uuid4
|
|
543
|
-
} from "@workglow/util";
|
|
538
|
+
import { uuid4 } from "@workglow/util";
|
|
544
539
|
import {
|
|
545
540
|
GraphAsTask,
|
|
546
541
|
GraphAsTaskRunner,
|
|
547
542
|
PROPERTY_ARRAY,
|
|
548
543
|
TaskGraph
|
|
549
544
|
} from "@workglow/task-graph";
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
545
|
+
function TypeReplicateArray(type, annotations = {}) {
|
|
546
|
+
return {
|
|
547
|
+
oneOf: [type, { type: "array", items: type }],
|
|
548
|
+
title: type.title,
|
|
549
|
+
description: type.description,
|
|
550
|
+
...type.format ? { format: type.format } : {},
|
|
551
|
+
...annotations,
|
|
552
|
+
"x-replicate": true
|
|
553
|
+
};
|
|
554
|
+
}
|
|
558
555
|
|
|
559
556
|
class ArrayTask extends GraphAsTask {
|
|
560
557
|
static type = "ArrayTask";
|
|
@@ -1157,9 +1154,6 @@ class InputTask extends Task12 {
|
|
|
1157
1154
|
outputSchema() {
|
|
1158
1155
|
return this.config?.outputSchema ?? this.constructor.outputSchema();
|
|
1159
1156
|
}
|
|
1160
|
-
async execute(input) {
|
|
1161
|
-
return input;
|
|
1162
|
-
}
|
|
1163
1157
|
async executeReactive(input) {
|
|
1164
1158
|
return input;
|
|
1165
1159
|
}
|
|
@@ -5983,9 +5977,6 @@ class OutputTask extends Task16 {
|
|
|
5983
5977
|
outputSchema() {
|
|
5984
5978
|
return this.config?.outputSchema ?? this.constructor.outputSchema();
|
|
5985
5979
|
}
|
|
5986
|
-
async execute(input2) {
|
|
5987
|
-
return input2;
|
|
5988
|
-
}
|
|
5989
5980
|
async executeReactive(input2) {
|
|
5990
5981
|
return input2;
|
|
5991
5982
|
}
|
|
@@ -6377,26 +6368,22 @@ class TemplateTask extends Task21 {
|
|
|
6377
6368
|
Workflow24.prototype.template = CreateWorkflow23(TemplateTask);
|
|
6378
6369
|
// src/task/mcp/McpListTask.ts
|
|
6379
6370
|
import { CreateWorkflow as CreateWorkflow24, Task as Task22, Workflow as Workflow25 } from "@workglow/task-graph";
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6371
|
+
|
|
6372
|
+
// src/util/McpTaskDeps.ts
|
|
6373
|
+
import { createServiceToken, globalServiceRegistry } from "@workglow/util";
|
|
6374
|
+
var MCP_TASK_DEPS = createServiceToken("@workglow/tasks/mcp");
|
|
6375
|
+
function registerMcpTaskDeps(deps) {
|
|
6376
|
+
globalServiceRegistry.registerInstance(MCP_TASK_DEPS, deps);
|
|
6377
|
+
}
|
|
6378
|
+
function getMcpTaskDeps() {
|
|
6379
|
+
if (!globalServiceRegistry.has(MCP_TASK_DEPS)) {
|
|
6380
|
+
throw new Error("MCP task dependencies not registered. Import @workglow/tasks from a platform entry (browser, node, or bun) before using MCP tasks.");
|
|
6381
|
+
}
|
|
6382
|
+
return globalServiceRegistry.get(MCP_TASK_DEPS);
|
|
6383
|
+
}
|
|
6384
|
+
|
|
6385
|
+
// src/task/mcp/McpListTask.ts
|
|
6384
6386
|
var mcpListTypes = ["tools", "resources", "prompts"];
|
|
6385
|
-
var inputSchema22 = {
|
|
6386
|
-
type: "object",
|
|
6387
|
-
properties: {
|
|
6388
|
-
...mcpServerConfigSchema.properties,
|
|
6389
|
-
list_type: {
|
|
6390
|
-
type: "string",
|
|
6391
|
-
enum: mcpListTypes,
|
|
6392
|
-
title: "List Type",
|
|
6393
|
-
description: "The type of items to list from the MCP server"
|
|
6394
|
-
}
|
|
6395
|
-
},
|
|
6396
|
-
required: ["transport", "list_type"],
|
|
6397
|
-
allOf: mcpServerConfigSchema.allOf,
|
|
6398
|
-
additionalProperties: false
|
|
6399
|
-
};
|
|
6400
6387
|
var iconSchema = {
|
|
6401
6388
|
type: "object",
|
|
6402
6389
|
properties: {
|
|
@@ -6560,7 +6547,22 @@ class McpListTask extends Task22 {
|
|
|
6560
6547
|
static cacheable = false;
|
|
6561
6548
|
static hasDynamicSchemas = true;
|
|
6562
6549
|
static inputSchema() {
|
|
6563
|
-
|
|
6550
|
+
const { mcpServerConfigSchema } = getMcpTaskDeps();
|
|
6551
|
+
return {
|
|
6552
|
+
type: "object",
|
|
6553
|
+
properties: {
|
|
6554
|
+
...mcpServerConfigSchema.properties,
|
|
6555
|
+
list_type: {
|
|
6556
|
+
type: "string",
|
|
6557
|
+
enum: mcpListTypes,
|
|
6558
|
+
title: "List Type",
|
|
6559
|
+
description: "The type of items to list from the MCP server"
|
|
6560
|
+
}
|
|
6561
|
+
},
|
|
6562
|
+
required: ["transport", "list_type"],
|
|
6563
|
+
allOf: mcpServerConfigSchema.allOf,
|
|
6564
|
+
additionalProperties: false
|
|
6565
|
+
};
|
|
6564
6566
|
}
|
|
6565
6567
|
static outputSchema() {
|
|
6566
6568
|
return outputSchemaAll;
|
|
@@ -6594,9 +6596,11 @@ class McpListTask extends Task22 {
|
|
|
6594
6596
|
}
|
|
6595
6597
|
}
|
|
6596
6598
|
async execute(input2, context) {
|
|
6599
|
+
const { mcpClientFactory } = getMcpTaskDeps();
|
|
6597
6600
|
const { client } = await mcpClientFactory.create(input2, context.signal);
|
|
6601
|
+
const listType = input2.list_type;
|
|
6598
6602
|
try {
|
|
6599
|
-
switch (
|
|
6603
|
+
switch (listType) {
|
|
6600
6604
|
case "tools": {
|
|
6601
6605
|
const result = await client.listTools();
|
|
6602
6606
|
return { tools: result.tools };
|
|
@@ -6610,7 +6614,7 @@ class McpListTask extends Task22 {
|
|
|
6610
6614
|
return { prompts: result.prompts };
|
|
6611
6615
|
}
|
|
6612
6616
|
default:
|
|
6613
|
-
throw new Error(`Unsupported list type: ${
|
|
6617
|
+
throw new Error(`Unsupported list type: ${String(listType)}`);
|
|
6614
6618
|
}
|
|
6615
6619
|
} finally {
|
|
6616
6620
|
await client.close();
|
|
@@ -6628,29 +6632,6 @@ import {
|
|
|
6628
6632
|
TaskConfigSchema as TaskConfigSchema5,
|
|
6629
6633
|
Workflow as Workflow26
|
|
6630
6634
|
} from "@workglow/task-graph";
|
|
6631
|
-
import {
|
|
6632
|
-
mcpClientFactory as mcpClientFactory2,
|
|
6633
|
-
mcpServerConfigSchema as mcpServerConfigSchema2
|
|
6634
|
-
} from "@workglow/util";
|
|
6635
|
-
var configSchema2 = {
|
|
6636
|
-
type: "object",
|
|
6637
|
-
properties: {
|
|
6638
|
-
...TaskConfigSchema5["properties"],
|
|
6639
|
-
...mcpServerConfigSchema2.properties,
|
|
6640
|
-
prompt_name: {
|
|
6641
|
-
type: "string",
|
|
6642
|
-
title: "Prompt Name",
|
|
6643
|
-
description: "The name of the prompt to get",
|
|
6644
|
-
format: "string:mcp-promptname"
|
|
6645
|
-
}
|
|
6646
|
-
},
|
|
6647
|
-
required: ["transport", "prompt_name"],
|
|
6648
|
-
if: { properties: { transport: { const: "stdio" } }, required: ["transport"] },
|
|
6649
|
-
then: { required: ["command"] },
|
|
6650
|
-
else: { required: ["server_url"] },
|
|
6651
|
-
allOf: mcpServerConfigSchema2.allOf,
|
|
6652
|
-
additionalProperties: false
|
|
6653
|
-
};
|
|
6654
6635
|
var annotationsSchema = {
|
|
6655
6636
|
type: "object",
|
|
6656
6637
|
properties: {
|
|
@@ -6799,7 +6780,26 @@ class McpPromptGetTask extends Task23 {
|
|
|
6799
6780
|
return fallbackOutputSchema;
|
|
6800
6781
|
}
|
|
6801
6782
|
static configSchema() {
|
|
6802
|
-
|
|
6783
|
+
const { mcpServerConfigSchema } = getMcpTaskDeps();
|
|
6784
|
+
return {
|
|
6785
|
+
type: "object",
|
|
6786
|
+
properties: {
|
|
6787
|
+
...TaskConfigSchema5["properties"],
|
|
6788
|
+
...mcpServerConfigSchema.properties,
|
|
6789
|
+
prompt_name: {
|
|
6790
|
+
type: "string",
|
|
6791
|
+
title: "Prompt Name",
|
|
6792
|
+
description: "The name of the prompt to get",
|
|
6793
|
+
format: "string:mcp-promptname"
|
|
6794
|
+
}
|
|
6795
|
+
},
|
|
6796
|
+
required: ["transport", "prompt_name"],
|
|
6797
|
+
if: { properties: { transport: { const: "stdio" } }, required: ["transport"] },
|
|
6798
|
+
then: { required: ["command"] },
|
|
6799
|
+
else: { required: ["server_url"] },
|
|
6800
|
+
allOf: mcpServerConfigSchema.allOf,
|
|
6801
|
+
additionalProperties: false
|
|
6802
|
+
};
|
|
6803
6803
|
}
|
|
6804
6804
|
inputSchema() {
|
|
6805
6805
|
return this.config?.inputSchema ?? fallbackInputSchema;
|
|
@@ -6850,10 +6850,11 @@ class McpPromptGetTask extends Task23 {
|
|
|
6850
6850
|
}
|
|
6851
6851
|
async execute(input2, context) {
|
|
6852
6852
|
await this.discoverSchemas(context.signal);
|
|
6853
|
-
const {
|
|
6853
|
+
const { mcpClientFactory } = getMcpTaskDeps();
|
|
6854
|
+
const { client } = await mcpClientFactory.create(this.config, context.signal);
|
|
6854
6855
|
try {
|
|
6855
6856
|
const result = await client.getPrompt({
|
|
6856
|
-
name: this.config.prompt_name,
|
|
6857
|
+
name: String(this.config.prompt_name ?? ""),
|
|
6857
6858
|
arguments: input2
|
|
6858
6859
|
});
|
|
6859
6860
|
return {
|
|
@@ -6876,29 +6877,6 @@ import {
|
|
|
6876
6877
|
TaskConfigSchema as TaskConfigSchema6,
|
|
6877
6878
|
Workflow as Workflow27
|
|
6878
6879
|
} from "@workglow/task-graph";
|
|
6879
|
-
import {
|
|
6880
|
-
mcpClientFactory as mcpClientFactory3,
|
|
6881
|
-
mcpServerConfigSchema as mcpServerConfigSchema3
|
|
6882
|
-
} from "@workglow/util";
|
|
6883
|
-
var configSchema3 = {
|
|
6884
|
-
type: "object",
|
|
6885
|
-
properties: {
|
|
6886
|
-
...TaskConfigSchema6["properties"],
|
|
6887
|
-
...mcpServerConfigSchema3.properties,
|
|
6888
|
-
resource_uri: {
|
|
6889
|
-
type: "string",
|
|
6890
|
-
title: "Resource URI",
|
|
6891
|
-
description: "The URI of the resource to read",
|
|
6892
|
-
format: "string:uri:mcp-resourceuri"
|
|
6893
|
-
}
|
|
6894
|
-
},
|
|
6895
|
-
required: ["transport", "resource_uri"],
|
|
6896
|
-
if: { properties: { transport: { const: "stdio" } }, required: ["transport"] },
|
|
6897
|
-
then: { required: ["command"] },
|
|
6898
|
-
else: { required: ["server_url"] },
|
|
6899
|
-
allOf: mcpServerConfigSchema3.allOf,
|
|
6900
|
-
additionalProperties: false
|
|
6901
|
-
};
|
|
6902
6880
|
var contentItemSchema = {
|
|
6903
6881
|
anyOf: [
|
|
6904
6882
|
{
|
|
@@ -6925,7 +6903,7 @@ var contentItemSchema = {
|
|
|
6925
6903
|
}
|
|
6926
6904
|
]
|
|
6927
6905
|
};
|
|
6928
|
-
var
|
|
6906
|
+
var inputSchema22 = {
|
|
6929
6907
|
type: "object",
|
|
6930
6908
|
properties: {},
|
|
6931
6909
|
additionalProperties: false
|
|
@@ -6952,18 +6930,40 @@ class McpResourceReadTask extends Task24 {
|
|
|
6952
6930
|
static cacheable = false;
|
|
6953
6931
|
static customizable = true;
|
|
6954
6932
|
static inputSchema() {
|
|
6955
|
-
return
|
|
6933
|
+
return inputSchema22;
|
|
6956
6934
|
}
|
|
6957
6935
|
static outputSchema() {
|
|
6958
6936
|
return outputSchema22;
|
|
6959
6937
|
}
|
|
6960
6938
|
static configSchema() {
|
|
6961
|
-
|
|
6939
|
+
const { mcpServerConfigSchema } = getMcpTaskDeps();
|
|
6940
|
+
return {
|
|
6941
|
+
type: "object",
|
|
6942
|
+
properties: {
|
|
6943
|
+
...TaskConfigSchema6["properties"],
|
|
6944
|
+
...mcpServerConfigSchema.properties,
|
|
6945
|
+
resource_uri: {
|
|
6946
|
+
type: "string",
|
|
6947
|
+
title: "Resource URI",
|
|
6948
|
+
description: "The URI of the resource to read",
|
|
6949
|
+
format: "string:uri:mcp-resourceuri"
|
|
6950
|
+
}
|
|
6951
|
+
},
|
|
6952
|
+
required: ["transport", "resource_uri"],
|
|
6953
|
+
if: { properties: { transport: { const: "stdio" } }, required: ["transport"] },
|
|
6954
|
+
then: { required: ["command"] },
|
|
6955
|
+
else: { required: ["server_url"] },
|
|
6956
|
+
allOf: mcpServerConfigSchema.allOf,
|
|
6957
|
+
additionalProperties: false
|
|
6958
|
+
};
|
|
6962
6959
|
}
|
|
6963
6960
|
async execute(_input, context) {
|
|
6964
|
-
const {
|
|
6961
|
+
const { mcpClientFactory } = getMcpTaskDeps();
|
|
6962
|
+
const { client } = await mcpClientFactory.create(this.config, context.signal);
|
|
6965
6963
|
try {
|
|
6966
|
-
const result = await client.readResource({
|
|
6964
|
+
const result = await client.readResource({
|
|
6965
|
+
uri: String(this.config.resource_uri ?? "")
|
|
6966
|
+
});
|
|
6967
6967
|
return { contents: result.contents };
|
|
6968
6968
|
} finally {
|
|
6969
6969
|
await client.close();
|
|
@@ -6974,36 +6974,174 @@ var mcpResourceRead = async (config) => {
|
|
|
6974
6974
|
return new McpResourceReadTask({}, config).run({});
|
|
6975
6975
|
};
|
|
6976
6976
|
Workflow27.prototype.mcpResourceRead = CreateWorkflow26(McpResourceReadTask);
|
|
6977
|
-
// src/task/mcp/
|
|
6978
|
-
import {
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
TaskConfigSchema as TaskConfigSchema7,
|
|
6982
|
-
Workflow as Workflow28
|
|
6983
|
-
} from "@workglow/task-graph";
|
|
6984
|
-
import {
|
|
6985
|
-
mcpClientFactory as mcpClientFactory4,
|
|
6986
|
-
mcpServerConfigSchema as mcpServerConfigSchema4
|
|
6987
|
-
} from "@workglow/util";
|
|
6988
|
-
var configSchema4 = {
|
|
6977
|
+
// src/task/mcp/McpSearchTask.ts
|
|
6978
|
+
import { CreateWorkflow as CreateWorkflow27, Task as Task25, Workflow as Workflow28 } from "@workglow/task-graph";
|
|
6979
|
+
var MCP_REGISTRY_BASE = "https://registry.modelcontextprotocol.io/v0.1";
|
|
6980
|
+
var McpSearchInputSchema = {
|
|
6989
6981
|
type: "object",
|
|
6990
6982
|
properties: {
|
|
6991
|
-
|
|
6992
|
-
...mcpServerConfigSchema4.properties,
|
|
6993
|
-
tool_name: {
|
|
6983
|
+
query: {
|
|
6994
6984
|
type: "string",
|
|
6995
|
-
title: "
|
|
6996
|
-
description: "
|
|
6997
|
-
|
|
6985
|
+
title: "Query",
|
|
6986
|
+
description: "Search query for the MCP registry"
|
|
6987
|
+
}
|
|
6988
|
+
},
|
|
6989
|
+
required: ["query"],
|
|
6990
|
+
additionalProperties: false
|
|
6991
|
+
};
|
|
6992
|
+
var McpSearchOutputSchema = {
|
|
6993
|
+
type: "object",
|
|
6994
|
+
properties: {
|
|
6995
|
+
results: {
|
|
6996
|
+
type: "array",
|
|
6997
|
+
items: {
|
|
6998
|
+
type: "object",
|
|
6999
|
+
properties: {
|
|
7000
|
+
id: { type: "string" },
|
|
7001
|
+
label: { type: "string" },
|
|
7002
|
+
description: { type: "string" },
|
|
7003
|
+
config: { type: "object", additionalProperties: true }
|
|
7004
|
+
},
|
|
7005
|
+
required: ["id", "label", "description", "config"],
|
|
7006
|
+
additionalProperties: false
|
|
7007
|
+
}
|
|
6998
7008
|
}
|
|
6999
7009
|
},
|
|
7000
|
-
required: ["
|
|
7001
|
-
if: { properties: { transport: { const: "stdio" } }, required: ["transport"] },
|
|
7002
|
-
then: { required: ["command"] },
|
|
7003
|
-
else: { required: ["server_url"] },
|
|
7004
|
-
allOf: mcpServerConfigSchema4.allOf,
|
|
7010
|
+
required: ["results"],
|
|
7005
7011
|
additionalProperties: false
|
|
7006
7012
|
};
|
|
7013
|
+
function mapMcpRegistryResult(server) {
|
|
7014
|
+
const name = server.name.split("/").pop() ?? server.name;
|
|
7015
|
+
if (server.remotes && server.remotes.length > 0) {
|
|
7016
|
+
const remote = server.remotes[0];
|
|
7017
|
+
return {
|
|
7018
|
+
name,
|
|
7019
|
+
transport: remote.type,
|
|
7020
|
+
server_url: remote.url
|
|
7021
|
+
};
|
|
7022
|
+
}
|
|
7023
|
+
const pkg = server.packages?.[0];
|
|
7024
|
+
if (!pkg)
|
|
7025
|
+
return { name };
|
|
7026
|
+
let command;
|
|
7027
|
+
let args;
|
|
7028
|
+
switch (pkg.registryType) {
|
|
7029
|
+
case "npm":
|
|
7030
|
+
command = "npx";
|
|
7031
|
+
args = ["-y", pkg.identifier];
|
|
7032
|
+
break;
|
|
7033
|
+
case "pypi":
|
|
7034
|
+
command = "uvx";
|
|
7035
|
+
args = [pkg.identifier];
|
|
7036
|
+
break;
|
|
7037
|
+
case "oci":
|
|
7038
|
+
command = "docker";
|
|
7039
|
+
args = ["run", "-i", "--rm", pkg.identifier];
|
|
7040
|
+
break;
|
|
7041
|
+
default:
|
|
7042
|
+
command = pkg.identifier;
|
|
7043
|
+
args = [];
|
|
7044
|
+
}
|
|
7045
|
+
if (pkg.runtimeArguments) {
|
|
7046
|
+
for (const arg of pkg.runtimeArguments) {
|
|
7047
|
+
if (arg.name)
|
|
7048
|
+
args.push(arg.name);
|
|
7049
|
+
if (arg.value)
|
|
7050
|
+
args.push(arg.value);
|
|
7051
|
+
}
|
|
7052
|
+
}
|
|
7053
|
+
const result = {
|
|
7054
|
+
name,
|
|
7055
|
+
transport: "stdio",
|
|
7056
|
+
command,
|
|
7057
|
+
args
|
|
7058
|
+
};
|
|
7059
|
+
if (pkg.environmentVariables && pkg.environmentVariables.length > 0) {
|
|
7060
|
+
const env = {};
|
|
7061
|
+
for (const envVar of pkg.environmentVariables) {
|
|
7062
|
+
env[envVar.name] = "";
|
|
7063
|
+
}
|
|
7064
|
+
result.env = env;
|
|
7065
|
+
}
|
|
7066
|
+
return result;
|
|
7067
|
+
}
|
|
7068
|
+
function mapRegistryServersToResults(servers) {
|
|
7069
|
+
return (servers ?? []).map((entry) => {
|
|
7070
|
+
const s = entry.server;
|
|
7071
|
+
const pkg = s.packages?.[0];
|
|
7072
|
+
const remote = s.remotes?.[0];
|
|
7073
|
+
const badges = [pkg?.registryType, pkg?.transport?.type ?? remote?.type].filter(Boolean).join(" | ");
|
|
7074
|
+
return {
|
|
7075
|
+
id: `${s.name}:${s.version}`,
|
|
7076
|
+
label: `${s.title ?? s.name}${badges ? ` ${badges}` : ""}`,
|
|
7077
|
+
description: s.description,
|
|
7078
|
+
config: mapMcpRegistryResult(s)
|
|
7079
|
+
};
|
|
7080
|
+
});
|
|
7081
|
+
}
|
|
7082
|
+
async function searchMcpRegistryPage(query, options2) {
|
|
7083
|
+
const params = new URLSearchParams({
|
|
7084
|
+
search: query,
|
|
7085
|
+
limit: "100",
|
|
7086
|
+
version: "latest"
|
|
7087
|
+
});
|
|
7088
|
+
if (options2?.cursor) {
|
|
7089
|
+
params.set("cursor", options2.cursor);
|
|
7090
|
+
}
|
|
7091
|
+
const res = await fetch(`${MCP_REGISTRY_BASE}/servers?${params}`, {
|
|
7092
|
+
signal: options2?.signal
|
|
7093
|
+
});
|
|
7094
|
+
if (!res.ok) {
|
|
7095
|
+
let detail = `Registry returned ${res.status}`;
|
|
7096
|
+
try {
|
|
7097
|
+
const errBody = await res.json();
|
|
7098
|
+
if (typeof errBody.detail === "string") {
|
|
7099
|
+
detail = `${detail}: ${errBody.detail}`;
|
|
7100
|
+
} else if (Array.isArray(errBody.errors) && errBody.errors.length > 0) {
|
|
7101
|
+
detail = `${detail}: ${errBody.errors.map((e) => e.message).filter(Boolean).join("; ")}`;
|
|
7102
|
+
}
|
|
7103
|
+
} catch {}
|
|
7104
|
+
throw new Error(detail);
|
|
7105
|
+
}
|
|
7106
|
+
const data = await res.json();
|
|
7107
|
+
return {
|
|
7108
|
+
results: mapRegistryServersToResults(data.servers),
|
|
7109
|
+
nextCursor: data.metadata?.nextCursor
|
|
7110
|
+
};
|
|
7111
|
+
}
|
|
7112
|
+
async function searchMcpRegistry(query, signal) {
|
|
7113
|
+
const page = await searchMcpRegistryPage(query, { signal });
|
|
7114
|
+
return page.results;
|
|
7115
|
+
}
|
|
7116
|
+
|
|
7117
|
+
class McpSearchTask extends Task25 {
|
|
7118
|
+
static type = "McpSearchTask";
|
|
7119
|
+
static category = "MCP";
|
|
7120
|
+
static title = "MCP Search";
|
|
7121
|
+
static description = "Search the MCP server registry for servers matching a query";
|
|
7122
|
+
static cacheable = false;
|
|
7123
|
+
static inputSchema() {
|
|
7124
|
+
return McpSearchInputSchema;
|
|
7125
|
+
}
|
|
7126
|
+
static outputSchema() {
|
|
7127
|
+
return McpSearchOutputSchema;
|
|
7128
|
+
}
|
|
7129
|
+
async execute(input2, context) {
|
|
7130
|
+
const results = await searchMcpRegistry(input2.query, context.signal);
|
|
7131
|
+
return { results };
|
|
7132
|
+
}
|
|
7133
|
+
}
|
|
7134
|
+
var mcpSearch = (input2, config) => {
|
|
7135
|
+
return new McpSearchTask({}, config).run(input2);
|
|
7136
|
+
};
|
|
7137
|
+
Workflow28.prototype.mcpSearch = CreateWorkflow27(McpSearchTask);
|
|
7138
|
+
// src/task/mcp/McpToolCallTask.ts
|
|
7139
|
+
import {
|
|
7140
|
+
CreateWorkflow as CreateWorkflow28,
|
|
7141
|
+
Task as Task26,
|
|
7142
|
+
TaskConfigSchema as TaskConfigSchema7,
|
|
7143
|
+
Workflow as Workflow29
|
|
7144
|
+
} from "@workglow/task-graph";
|
|
7007
7145
|
var annotationsSchema2 = {
|
|
7008
7146
|
type: "object",
|
|
7009
7147
|
properties: {
|
|
@@ -7129,7 +7267,7 @@ var fallbackInputSchema2 = {
|
|
|
7129
7267
|
additionalProperties: true
|
|
7130
7268
|
};
|
|
7131
7269
|
|
|
7132
|
-
class McpToolCallTask extends
|
|
7270
|
+
class McpToolCallTask extends Task26 {
|
|
7133
7271
|
static type = "McpToolCallTask";
|
|
7134
7272
|
static category = "MCP";
|
|
7135
7273
|
static title = "MCP Call Tool";
|
|
@@ -7144,7 +7282,26 @@ class McpToolCallTask extends Task25 {
|
|
|
7144
7282
|
return fallbackOutputSchema2;
|
|
7145
7283
|
}
|
|
7146
7284
|
static configSchema() {
|
|
7147
|
-
|
|
7285
|
+
const { mcpServerConfigSchema } = getMcpTaskDeps();
|
|
7286
|
+
return {
|
|
7287
|
+
type: "object",
|
|
7288
|
+
properties: {
|
|
7289
|
+
...TaskConfigSchema7["properties"],
|
|
7290
|
+
...mcpServerConfigSchema.properties,
|
|
7291
|
+
tool_name: {
|
|
7292
|
+
type: "string",
|
|
7293
|
+
title: "Tool Name",
|
|
7294
|
+
description: "The name of the tool to call",
|
|
7295
|
+
format: "string:mcp-toolname"
|
|
7296
|
+
}
|
|
7297
|
+
},
|
|
7298
|
+
required: ["transport", "tool_name"],
|
|
7299
|
+
if: { properties: { transport: { const: "stdio" } }, required: ["transport"] },
|
|
7300
|
+
then: { required: ["command"] },
|
|
7301
|
+
else: { required: ["server_url"] },
|
|
7302
|
+
allOf: mcpServerConfigSchema.allOf,
|
|
7303
|
+
additionalProperties: false
|
|
7304
|
+
};
|
|
7148
7305
|
}
|
|
7149
7306
|
inputSchema() {
|
|
7150
7307
|
return this.config?.inputSchema ?? fallbackInputSchema2;
|
|
@@ -7186,10 +7343,11 @@ class McpToolCallTask extends Task25 {
|
|
|
7186
7343
|
}
|
|
7187
7344
|
async execute(input2, context) {
|
|
7188
7345
|
await this.discoverSchemas(context.signal);
|
|
7189
|
-
const {
|
|
7346
|
+
const { mcpClientFactory } = getMcpTaskDeps();
|
|
7347
|
+
const { client } = await mcpClientFactory.create(this.config, context.signal);
|
|
7190
7348
|
try {
|
|
7191
7349
|
const result = await client.callTool({
|
|
7192
|
-
name: this.config.tool_name,
|
|
7350
|
+
name: String(this.config.tool_name ?? ""),
|
|
7193
7351
|
arguments: input2
|
|
7194
7352
|
});
|
|
7195
7353
|
if (!("content" in result) || !Array.isArray(result.content)) {
|
|
@@ -7228,14 +7386,14 @@ class McpToolCallTask extends Task25 {
|
|
|
7228
7386
|
var mcpToolCall = async (input2, config) => {
|
|
7229
7387
|
return new McpToolCallTask({}, config).run(input2);
|
|
7230
7388
|
};
|
|
7231
|
-
|
|
7389
|
+
Workflow29.prototype.mcpToolCall = CreateWorkflow28(McpToolCallTask);
|
|
7232
7390
|
// src/task/string/StringConcatTask.ts
|
|
7233
7391
|
import {
|
|
7234
|
-
CreateWorkflow as
|
|
7235
|
-
Task as
|
|
7236
|
-
Workflow as
|
|
7392
|
+
CreateWorkflow as CreateWorkflow29,
|
|
7393
|
+
Task as Task27,
|
|
7394
|
+
Workflow as Workflow30
|
|
7237
7395
|
} from "@workglow/task-graph";
|
|
7238
|
-
var
|
|
7396
|
+
var inputSchema23 = {
|
|
7239
7397
|
type: "object",
|
|
7240
7398
|
properties: {},
|
|
7241
7399
|
additionalProperties: { type: "string" }
|
|
@@ -7253,13 +7411,13 @@ var outputSchema23 = {
|
|
|
7253
7411
|
additionalProperties: false
|
|
7254
7412
|
};
|
|
7255
7413
|
|
|
7256
|
-
class StringConcatTask extends
|
|
7414
|
+
class StringConcatTask extends Task27 {
|
|
7257
7415
|
static type = "StringConcatTask";
|
|
7258
7416
|
static category = "String";
|
|
7259
7417
|
static title = "Concat";
|
|
7260
7418
|
static description = "Concatenates all input strings";
|
|
7261
7419
|
static inputSchema() {
|
|
7262
|
-
return
|
|
7420
|
+
return inputSchema23;
|
|
7263
7421
|
}
|
|
7264
7422
|
static outputSchema() {
|
|
7265
7423
|
return outputSchema23;
|
|
@@ -7268,14 +7426,14 @@ class StringConcatTask extends Task26 {
|
|
|
7268
7426
|
return { result: Object.values(input2).join("") };
|
|
7269
7427
|
}
|
|
7270
7428
|
}
|
|
7271
|
-
|
|
7429
|
+
Workflow30.prototype.stringConcat = CreateWorkflow29(StringConcatTask);
|
|
7272
7430
|
// src/task/string/StringIncludesTask.ts
|
|
7273
7431
|
import {
|
|
7274
|
-
CreateWorkflow as
|
|
7275
|
-
Task as
|
|
7276
|
-
Workflow as
|
|
7432
|
+
CreateWorkflow as CreateWorkflow30,
|
|
7433
|
+
Task as Task28,
|
|
7434
|
+
Workflow as Workflow31
|
|
7277
7435
|
} from "@workglow/task-graph";
|
|
7278
|
-
var
|
|
7436
|
+
var inputSchema24 = {
|
|
7279
7437
|
type: "object",
|
|
7280
7438
|
properties: {
|
|
7281
7439
|
value: {
|
|
@@ -7305,13 +7463,13 @@ var outputSchema24 = {
|
|
|
7305
7463
|
additionalProperties: false
|
|
7306
7464
|
};
|
|
7307
7465
|
|
|
7308
|
-
class StringIncludesTask extends
|
|
7466
|
+
class StringIncludesTask extends Task28 {
|
|
7309
7467
|
static type = "StringIncludesTask";
|
|
7310
7468
|
static category = "String";
|
|
7311
7469
|
static title = "Includes";
|
|
7312
7470
|
static description = "Checks if a string contains a substring";
|
|
7313
7471
|
static inputSchema() {
|
|
7314
|
-
return
|
|
7472
|
+
return inputSchema24;
|
|
7315
7473
|
}
|
|
7316
7474
|
static outputSchema() {
|
|
7317
7475
|
return outputSchema24;
|
|
@@ -7320,14 +7478,14 @@ class StringIncludesTask extends Task27 {
|
|
|
7320
7478
|
return { result: input2.value.includes(input2.search) };
|
|
7321
7479
|
}
|
|
7322
7480
|
}
|
|
7323
|
-
|
|
7481
|
+
Workflow31.prototype.stringIncludes = CreateWorkflow30(StringIncludesTask);
|
|
7324
7482
|
// src/task/string/StringJoinTask.ts
|
|
7325
7483
|
import {
|
|
7326
|
-
CreateWorkflow as
|
|
7327
|
-
Task as
|
|
7328
|
-
Workflow as
|
|
7484
|
+
CreateWorkflow as CreateWorkflow31,
|
|
7485
|
+
Task as Task29,
|
|
7486
|
+
Workflow as Workflow32
|
|
7329
7487
|
} from "@workglow/task-graph";
|
|
7330
|
-
var
|
|
7488
|
+
var inputSchema25 = {
|
|
7331
7489
|
type: "object",
|
|
7332
7490
|
properties: {
|
|
7333
7491
|
values: {
|
|
@@ -7359,13 +7517,13 @@ var outputSchema25 = {
|
|
|
7359
7517
|
additionalProperties: false
|
|
7360
7518
|
};
|
|
7361
7519
|
|
|
7362
|
-
class StringJoinTask extends
|
|
7520
|
+
class StringJoinTask extends Task29 {
|
|
7363
7521
|
static type = "StringJoinTask";
|
|
7364
7522
|
static category = "String";
|
|
7365
7523
|
static title = "Join";
|
|
7366
7524
|
static description = "Joins an array of strings with a separator";
|
|
7367
7525
|
static inputSchema() {
|
|
7368
|
-
return
|
|
7526
|
+
return inputSchema25;
|
|
7369
7527
|
}
|
|
7370
7528
|
static outputSchema() {
|
|
7371
7529
|
return outputSchema25;
|
|
@@ -7375,14 +7533,14 @@ class StringJoinTask extends Task28 {
|
|
|
7375
7533
|
return { result: input2.values.join(separator) };
|
|
7376
7534
|
}
|
|
7377
7535
|
}
|
|
7378
|
-
|
|
7536
|
+
Workflow32.prototype.stringJoin = CreateWorkflow31(StringJoinTask);
|
|
7379
7537
|
// src/task/string/StringLengthTask.ts
|
|
7380
7538
|
import {
|
|
7381
|
-
CreateWorkflow as
|
|
7382
|
-
Task as
|
|
7383
|
-
Workflow as
|
|
7539
|
+
CreateWorkflow as CreateWorkflow32,
|
|
7540
|
+
Task as Task30,
|
|
7541
|
+
Workflow as Workflow33
|
|
7384
7542
|
} from "@workglow/task-graph";
|
|
7385
|
-
var
|
|
7543
|
+
var inputSchema26 = {
|
|
7386
7544
|
type: "object",
|
|
7387
7545
|
properties: {
|
|
7388
7546
|
value: {
|
|
@@ -7407,13 +7565,13 @@ var outputSchema26 = {
|
|
|
7407
7565
|
additionalProperties: false
|
|
7408
7566
|
};
|
|
7409
7567
|
|
|
7410
|
-
class StringLengthTask extends
|
|
7568
|
+
class StringLengthTask extends Task30 {
|
|
7411
7569
|
static type = "StringLengthTask";
|
|
7412
7570
|
static category = "String";
|
|
7413
7571
|
static title = "Length";
|
|
7414
7572
|
static description = "Returns the length of a string";
|
|
7415
7573
|
static inputSchema() {
|
|
7416
|
-
return
|
|
7574
|
+
return inputSchema26;
|
|
7417
7575
|
}
|
|
7418
7576
|
static outputSchema() {
|
|
7419
7577
|
return outputSchema26;
|
|
@@ -7422,14 +7580,14 @@ class StringLengthTask extends Task29 {
|
|
|
7422
7580
|
return { result: input2.value.length };
|
|
7423
7581
|
}
|
|
7424
7582
|
}
|
|
7425
|
-
|
|
7583
|
+
Workflow33.prototype.stringLength = CreateWorkflow32(StringLengthTask);
|
|
7426
7584
|
// src/task/string/StringLowerCaseTask.ts
|
|
7427
7585
|
import {
|
|
7428
|
-
CreateWorkflow as
|
|
7429
|
-
Task as
|
|
7430
|
-
Workflow as
|
|
7586
|
+
CreateWorkflow as CreateWorkflow33,
|
|
7587
|
+
Task as Task31,
|
|
7588
|
+
Workflow as Workflow34
|
|
7431
7589
|
} from "@workglow/task-graph";
|
|
7432
|
-
var
|
|
7590
|
+
var inputSchema27 = {
|
|
7433
7591
|
type: "object",
|
|
7434
7592
|
properties: {
|
|
7435
7593
|
value: {
|
|
@@ -7454,13 +7612,13 @@ var outputSchema27 = {
|
|
|
7454
7612
|
additionalProperties: false
|
|
7455
7613
|
};
|
|
7456
7614
|
|
|
7457
|
-
class StringLowerCaseTask extends
|
|
7615
|
+
class StringLowerCaseTask extends Task31 {
|
|
7458
7616
|
static type = "StringLowerCaseTask";
|
|
7459
7617
|
static category = "String";
|
|
7460
7618
|
static title = "Lower Case";
|
|
7461
7619
|
static description = "Converts a string to lower case";
|
|
7462
7620
|
static inputSchema() {
|
|
7463
|
-
return
|
|
7621
|
+
return inputSchema27;
|
|
7464
7622
|
}
|
|
7465
7623
|
static outputSchema() {
|
|
7466
7624
|
return outputSchema27;
|
|
@@ -7469,14 +7627,14 @@ class StringLowerCaseTask extends Task30 {
|
|
|
7469
7627
|
return { result: input2.value.toLowerCase() };
|
|
7470
7628
|
}
|
|
7471
7629
|
}
|
|
7472
|
-
|
|
7630
|
+
Workflow34.prototype.stringLowerCase = CreateWorkflow33(StringLowerCaseTask);
|
|
7473
7631
|
// src/task/string/StringReplaceTask.ts
|
|
7474
7632
|
import {
|
|
7475
|
-
CreateWorkflow as
|
|
7476
|
-
Task as
|
|
7477
|
-
Workflow as
|
|
7633
|
+
CreateWorkflow as CreateWorkflow34,
|
|
7634
|
+
Task as Task32,
|
|
7635
|
+
Workflow as Workflow35
|
|
7478
7636
|
} from "@workglow/task-graph";
|
|
7479
|
-
var
|
|
7637
|
+
var inputSchema28 = {
|
|
7480
7638
|
type: "object",
|
|
7481
7639
|
properties: {
|
|
7482
7640
|
value: {
|
|
@@ -7511,13 +7669,13 @@ var outputSchema28 = {
|
|
|
7511
7669
|
additionalProperties: false
|
|
7512
7670
|
};
|
|
7513
7671
|
|
|
7514
|
-
class StringReplaceTask extends
|
|
7672
|
+
class StringReplaceTask extends Task32 {
|
|
7515
7673
|
static type = "StringReplaceTask";
|
|
7516
7674
|
static category = "String";
|
|
7517
7675
|
static title = "Replace";
|
|
7518
7676
|
static description = "Replaces all occurrences of a substring";
|
|
7519
7677
|
static inputSchema() {
|
|
7520
|
-
return
|
|
7678
|
+
return inputSchema28;
|
|
7521
7679
|
}
|
|
7522
7680
|
static outputSchema() {
|
|
7523
7681
|
return outputSchema28;
|
|
@@ -7526,14 +7684,14 @@ class StringReplaceTask extends Task31 {
|
|
|
7526
7684
|
return { result: input2.value.replaceAll(input2.search, input2.replace) };
|
|
7527
7685
|
}
|
|
7528
7686
|
}
|
|
7529
|
-
|
|
7687
|
+
Workflow35.prototype.stringReplace = CreateWorkflow34(StringReplaceTask);
|
|
7530
7688
|
// src/task/string/StringSliceTask.ts
|
|
7531
7689
|
import {
|
|
7532
|
-
CreateWorkflow as
|
|
7533
|
-
Task as
|
|
7534
|
-
Workflow as
|
|
7690
|
+
CreateWorkflow as CreateWorkflow35,
|
|
7691
|
+
Task as Task33,
|
|
7692
|
+
Workflow as Workflow36
|
|
7535
7693
|
} from "@workglow/task-graph";
|
|
7536
|
-
var
|
|
7694
|
+
var inputSchema29 = {
|
|
7537
7695
|
type: "object",
|
|
7538
7696
|
properties: {
|
|
7539
7697
|
value: {
|
|
@@ -7568,13 +7726,13 @@ var outputSchema29 = {
|
|
|
7568
7726
|
additionalProperties: false
|
|
7569
7727
|
};
|
|
7570
7728
|
|
|
7571
|
-
class StringSliceTask extends
|
|
7729
|
+
class StringSliceTask extends Task33 {
|
|
7572
7730
|
static type = "StringSliceTask";
|
|
7573
7731
|
static category = "String";
|
|
7574
7732
|
static title = "Slice";
|
|
7575
7733
|
static description = "Extracts a substring by start and optional end index";
|
|
7576
7734
|
static inputSchema() {
|
|
7577
|
-
return
|
|
7735
|
+
return inputSchema29;
|
|
7578
7736
|
}
|
|
7579
7737
|
static outputSchema() {
|
|
7580
7738
|
return outputSchema29;
|
|
@@ -7583,14 +7741,14 @@ class StringSliceTask extends Task32 {
|
|
|
7583
7741
|
return { result: input2.value.slice(input2.start, input2.end) };
|
|
7584
7742
|
}
|
|
7585
7743
|
}
|
|
7586
|
-
|
|
7744
|
+
Workflow36.prototype.stringSlice = CreateWorkflow35(StringSliceTask);
|
|
7587
7745
|
// src/task/string/StringTemplateTask.ts
|
|
7588
7746
|
import {
|
|
7589
|
-
CreateWorkflow as
|
|
7590
|
-
Task as
|
|
7591
|
-
Workflow as
|
|
7747
|
+
CreateWorkflow as CreateWorkflow36,
|
|
7748
|
+
Task as Task34,
|
|
7749
|
+
Workflow as Workflow37
|
|
7592
7750
|
} from "@workglow/task-graph";
|
|
7593
|
-
var
|
|
7751
|
+
var inputSchema30 = {
|
|
7594
7752
|
type: "object",
|
|
7595
7753
|
properties: {
|
|
7596
7754
|
template: {
|
|
@@ -7621,13 +7779,13 @@ var outputSchema30 = {
|
|
|
7621
7779
|
additionalProperties: false
|
|
7622
7780
|
};
|
|
7623
7781
|
|
|
7624
|
-
class StringTemplateTask extends
|
|
7782
|
+
class StringTemplateTask extends Task34 {
|
|
7625
7783
|
static type = "StringTemplateTask";
|
|
7626
7784
|
static category = "String";
|
|
7627
7785
|
static title = "Template";
|
|
7628
7786
|
static description = "Replaces {{key}} placeholders in a template string with values";
|
|
7629
7787
|
static inputSchema() {
|
|
7630
|
-
return
|
|
7788
|
+
return inputSchema30;
|
|
7631
7789
|
}
|
|
7632
7790
|
static outputSchema() {
|
|
7633
7791
|
return outputSchema30;
|
|
@@ -7640,14 +7798,14 @@ class StringTemplateTask extends Task33 {
|
|
|
7640
7798
|
return { result };
|
|
7641
7799
|
}
|
|
7642
7800
|
}
|
|
7643
|
-
|
|
7801
|
+
Workflow37.prototype.stringTemplate = CreateWorkflow36(StringTemplateTask);
|
|
7644
7802
|
// src/task/string/StringTrimTask.ts
|
|
7645
7803
|
import {
|
|
7646
|
-
CreateWorkflow as
|
|
7647
|
-
Task as
|
|
7648
|
-
Workflow as
|
|
7804
|
+
CreateWorkflow as CreateWorkflow37,
|
|
7805
|
+
Task as Task35,
|
|
7806
|
+
Workflow as Workflow38
|
|
7649
7807
|
} from "@workglow/task-graph";
|
|
7650
|
-
var
|
|
7808
|
+
var inputSchema31 = {
|
|
7651
7809
|
type: "object",
|
|
7652
7810
|
properties: {
|
|
7653
7811
|
value: {
|
|
@@ -7672,13 +7830,13 @@ var outputSchema31 = {
|
|
|
7672
7830
|
additionalProperties: false
|
|
7673
7831
|
};
|
|
7674
7832
|
|
|
7675
|
-
class StringTrimTask extends
|
|
7833
|
+
class StringTrimTask extends Task35 {
|
|
7676
7834
|
static type = "StringTrimTask";
|
|
7677
7835
|
static category = "String";
|
|
7678
7836
|
static title = "Trim";
|
|
7679
7837
|
static description = "Removes leading and trailing whitespace from a string";
|
|
7680
7838
|
static inputSchema() {
|
|
7681
|
-
return
|
|
7839
|
+
return inputSchema31;
|
|
7682
7840
|
}
|
|
7683
7841
|
static outputSchema() {
|
|
7684
7842
|
return outputSchema31;
|
|
@@ -7687,14 +7845,14 @@ class StringTrimTask extends Task34 {
|
|
|
7687
7845
|
return { result: input2.value.trim() };
|
|
7688
7846
|
}
|
|
7689
7847
|
}
|
|
7690
|
-
|
|
7848
|
+
Workflow38.prototype.stringTrim = CreateWorkflow37(StringTrimTask);
|
|
7691
7849
|
// src/task/string/StringUpperCaseTask.ts
|
|
7692
7850
|
import {
|
|
7693
|
-
CreateWorkflow as
|
|
7694
|
-
Task as
|
|
7695
|
-
Workflow as
|
|
7851
|
+
CreateWorkflow as CreateWorkflow38,
|
|
7852
|
+
Task as Task36,
|
|
7853
|
+
Workflow as Workflow39
|
|
7696
7854
|
} from "@workglow/task-graph";
|
|
7697
|
-
var
|
|
7855
|
+
var inputSchema32 = {
|
|
7698
7856
|
type: "object",
|
|
7699
7857
|
properties: {
|
|
7700
7858
|
value: {
|
|
@@ -7719,13 +7877,13 @@ var outputSchema32 = {
|
|
|
7719
7877
|
additionalProperties: false
|
|
7720
7878
|
};
|
|
7721
7879
|
|
|
7722
|
-
class StringUpperCaseTask extends
|
|
7880
|
+
class StringUpperCaseTask extends Task36 {
|
|
7723
7881
|
static type = "StringUpperCaseTask";
|
|
7724
7882
|
static category = "String";
|
|
7725
7883
|
static title = "Upper Case";
|
|
7726
7884
|
static description = "Converts a string to upper case";
|
|
7727
7885
|
static inputSchema() {
|
|
7728
|
-
return
|
|
7886
|
+
return inputSchema32;
|
|
7729
7887
|
}
|
|
7730
7888
|
static outputSchema() {
|
|
7731
7889
|
return outputSchema32;
|
|
@@ -7734,10 +7892,10 @@ class StringUpperCaseTask extends Task35 {
|
|
|
7734
7892
|
return { result: input2.value.toUpperCase() };
|
|
7735
7893
|
}
|
|
7736
7894
|
}
|
|
7737
|
-
|
|
7895
|
+
Workflow39.prototype.stringUpperCase = CreateWorkflow38(StringUpperCaseTask);
|
|
7738
7896
|
// src/task/scalar/ScalarAbsTask.ts
|
|
7739
|
-
import { CreateWorkflow as
|
|
7740
|
-
var
|
|
7897
|
+
import { CreateWorkflow as CreateWorkflow39, Task as Task37, Workflow as Workflow40 } from "@workglow/task-graph";
|
|
7898
|
+
var inputSchema33 = {
|
|
7741
7899
|
type: "object",
|
|
7742
7900
|
properties: {
|
|
7743
7901
|
value: {
|
|
@@ -7762,13 +7920,13 @@ var outputSchema33 = {
|
|
|
7762
7920
|
additionalProperties: false
|
|
7763
7921
|
};
|
|
7764
7922
|
|
|
7765
|
-
class ScalarAbsTask extends
|
|
7923
|
+
class ScalarAbsTask extends Task37 {
|
|
7766
7924
|
static type = "ScalarAbsTask";
|
|
7767
7925
|
static category = "Math";
|
|
7768
7926
|
static title = "Abs";
|
|
7769
7927
|
static description = "Returns the absolute value of a number";
|
|
7770
7928
|
static inputSchema() {
|
|
7771
|
-
return
|
|
7929
|
+
return inputSchema33;
|
|
7772
7930
|
}
|
|
7773
7931
|
static outputSchema() {
|
|
7774
7932
|
return outputSchema33;
|
|
@@ -7777,10 +7935,10 @@ class ScalarAbsTask extends Task36 {
|
|
|
7777
7935
|
return { result: Math.abs(input2.value) };
|
|
7778
7936
|
}
|
|
7779
7937
|
}
|
|
7780
|
-
|
|
7938
|
+
Workflow40.prototype.scalarAbs = CreateWorkflow39(ScalarAbsTask);
|
|
7781
7939
|
// src/task/scalar/ScalarCeilTask.ts
|
|
7782
|
-
import { CreateWorkflow as
|
|
7783
|
-
var
|
|
7940
|
+
import { CreateWorkflow as CreateWorkflow40, Task as Task38, Workflow as Workflow41 } from "@workglow/task-graph";
|
|
7941
|
+
var inputSchema34 = {
|
|
7784
7942
|
type: "object",
|
|
7785
7943
|
properties: {
|
|
7786
7944
|
value: {
|
|
@@ -7805,13 +7963,13 @@ var outputSchema34 = {
|
|
|
7805
7963
|
additionalProperties: false
|
|
7806
7964
|
};
|
|
7807
7965
|
|
|
7808
|
-
class ScalarCeilTask extends
|
|
7966
|
+
class ScalarCeilTask extends Task38 {
|
|
7809
7967
|
static type = "ScalarCeilTask";
|
|
7810
7968
|
static category = "Math";
|
|
7811
7969
|
static title = "Ceil";
|
|
7812
7970
|
static description = "Returns the smallest integer greater than or equal to a number";
|
|
7813
7971
|
static inputSchema() {
|
|
7814
|
-
return
|
|
7972
|
+
return inputSchema34;
|
|
7815
7973
|
}
|
|
7816
7974
|
static outputSchema() {
|
|
7817
7975
|
return outputSchema34;
|
|
@@ -7820,10 +7978,10 @@ class ScalarCeilTask extends Task37 {
|
|
|
7820
7978
|
return { result: Math.ceil(input2.value) };
|
|
7821
7979
|
}
|
|
7822
7980
|
}
|
|
7823
|
-
|
|
7981
|
+
Workflow41.prototype.scalarCeil = CreateWorkflow40(ScalarCeilTask);
|
|
7824
7982
|
// src/task/scalar/ScalarFloorTask.ts
|
|
7825
|
-
import { CreateWorkflow as
|
|
7826
|
-
var
|
|
7983
|
+
import { CreateWorkflow as CreateWorkflow41, Task as Task39, Workflow as Workflow42 } from "@workglow/task-graph";
|
|
7984
|
+
var inputSchema35 = {
|
|
7827
7985
|
type: "object",
|
|
7828
7986
|
properties: {
|
|
7829
7987
|
value: {
|
|
@@ -7848,13 +8006,13 @@ var outputSchema35 = {
|
|
|
7848
8006
|
additionalProperties: false
|
|
7849
8007
|
};
|
|
7850
8008
|
|
|
7851
|
-
class ScalarFloorTask extends
|
|
8009
|
+
class ScalarFloorTask extends Task39 {
|
|
7852
8010
|
static type = "ScalarFloorTask";
|
|
7853
8011
|
static category = "Math";
|
|
7854
8012
|
static title = "Floor";
|
|
7855
8013
|
static description = "Returns the largest integer less than or equal to a number";
|
|
7856
8014
|
static inputSchema() {
|
|
7857
|
-
return
|
|
8015
|
+
return inputSchema35;
|
|
7858
8016
|
}
|
|
7859
8017
|
static outputSchema() {
|
|
7860
8018
|
return outputSchema35;
|
|
@@ -7863,10 +8021,10 @@ class ScalarFloorTask extends Task38 {
|
|
|
7863
8021
|
return { result: Math.floor(input2.value) };
|
|
7864
8022
|
}
|
|
7865
8023
|
}
|
|
7866
|
-
|
|
8024
|
+
Workflow42.prototype.scalarFloor = CreateWorkflow41(ScalarFloorTask);
|
|
7867
8025
|
// src/task/scalar/ScalarMaxTask.ts
|
|
7868
|
-
import { CreateWorkflow as
|
|
7869
|
-
var
|
|
8026
|
+
import { CreateWorkflow as CreateWorkflow42, Task as Task40, Workflow as Workflow43 } from "@workglow/task-graph";
|
|
8027
|
+
var inputSchema36 = {
|
|
7870
8028
|
type: "object",
|
|
7871
8029
|
properties: {
|
|
7872
8030
|
values: {
|
|
@@ -7892,13 +8050,13 @@ var outputSchema36 = {
|
|
|
7892
8050
|
additionalProperties: false
|
|
7893
8051
|
};
|
|
7894
8052
|
|
|
7895
|
-
class ScalarMaxTask extends
|
|
8053
|
+
class ScalarMaxTask extends Task40 {
|
|
7896
8054
|
static type = "ScalarMaxTask";
|
|
7897
8055
|
static category = "Math";
|
|
7898
8056
|
static title = "Max";
|
|
7899
8057
|
static description = "Returns the largest of the given numbers";
|
|
7900
8058
|
static inputSchema() {
|
|
7901
|
-
return
|
|
8059
|
+
return inputSchema36;
|
|
7902
8060
|
}
|
|
7903
8061
|
static outputSchema() {
|
|
7904
8062
|
return outputSchema36;
|
|
@@ -7907,10 +8065,10 @@ class ScalarMaxTask extends Task39 {
|
|
|
7907
8065
|
return { result: Math.max(...input2.values) };
|
|
7908
8066
|
}
|
|
7909
8067
|
}
|
|
7910
|
-
|
|
8068
|
+
Workflow43.prototype.scalarMax = CreateWorkflow42(ScalarMaxTask);
|
|
7911
8069
|
// src/task/scalar/ScalarMinTask.ts
|
|
7912
|
-
import { CreateWorkflow as
|
|
7913
|
-
var
|
|
8070
|
+
import { CreateWorkflow as CreateWorkflow43, Task as Task41, Workflow as Workflow44 } from "@workglow/task-graph";
|
|
8071
|
+
var inputSchema37 = {
|
|
7914
8072
|
type: "object",
|
|
7915
8073
|
properties: {
|
|
7916
8074
|
values: {
|
|
@@ -7936,13 +8094,13 @@ var outputSchema37 = {
|
|
|
7936
8094
|
additionalProperties: false
|
|
7937
8095
|
};
|
|
7938
8096
|
|
|
7939
|
-
class ScalarMinTask extends
|
|
8097
|
+
class ScalarMinTask extends Task41 {
|
|
7940
8098
|
static type = "ScalarMinTask";
|
|
7941
8099
|
static category = "Math";
|
|
7942
8100
|
static title = "Min";
|
|
7943
8101
|
static description = "Returns the smallest of the given numbers";
|
|
7944
8102
|
static inputSchema() {
|
|
7945
|
-
return
|
|
8103
|
+
return inputSchema37;
|
|
7946
8104
|
}
|
|
7947
8105
|
static outputSchema() {
|
|
7948
8106
|
return outputSchema37;
|
|
@@ -7951,10 +8109,10 @@ class ScalarMinTask extends Task40 {
|
|
|
7951
8109
|
return { result: Math.min(...input2.values) };
|
|
7952
8110
|
}
|
|
7953
8111
|
}
|
|
7954
|
-
|
|
8112
|
+
Workflow44.prototype.scalarMin = CreateWorkflow43(ScalarMinTask);
|
|
7955
8113
|
// src/task/scalar/ScalarRoundTask.ts
|
|
7956
|
-
import { CreateWorkflow as
|
|
7957
|
-
var
|
|
8114
|
+
import { CreateWorkflow as CreateWorkflow44, Task as Task42, Workflow as Workflow45 } from "@workglow/task-graph";
|
|
8115
|
+
var inputSchema38 = {
|
|
7958
8116
|
type: "object",
|
|
7959
8117
|
properties: {
|
|
7960
8118
|
value: {
|
|
@@ -7979,13 +8137,13 @@ var outputSchema38 = {
|
|
|
7979
8137
|
additionalProperties: false
|
|
7980
8138
|
};
|
|
7981
8139
|
|
|
7982
|
-
class ScalarRoundTask extends
|
|
8140
|
+
class ScalarRoundTask extends Task42 {
|
|
7983
8141
|
static type = "ScalarRoundTask";
|
|
7984
8142
|
static category = "Math";
|
|
7985
8143
|
static title = "Round";
|
|
7986
8144
|
static description = "Returns the value of a number rounded to the nearest integer";
|
|
7987
8145
|
static inputSchema() {
|
|
7988
|
-
return
|
|
8146
|
+
return inputSchema38;
|
|
7989
8147
|
}
|
|
7990
8148
|
static outputSchema() {
|
|
7991
8149
|
return outputSchema38;
|
|
@@ -7994,10 +8152,10 @@ class ScalarRoundTask extends Task41 {
|
|
|
7994
8152
|
return { result: Math.round(input2.value) };
|
|
7995
8153
|
}
|
|
7996
8154
|
}
|
|
7997
|
-
|
|
8155
|
+
Workflow45.prototype.scalarRound = CreateWorkflow44(ScalarRoundTask);
|
|
7998
8156
|
// src/task/scalar/ScalarTruncTask.ts
|
|
7999
|
-
import { CreateWorkflow as
|
|
8000
|
-
var
|
|
8157
|
+
import { CreateWorkflow as CreateWorkflow45, Task as Task43, Workflow as Workflow46 } from "@workglow/task-graph";
|
|
8158
|
+
var inputSchema39 = {
|
|
8001
8159
|
type: "object",
|
|
8002
8160
|
properties: {
|
|
8003
8161
|
value: {
|
|
@@ -8022,13 +8180,13 @@ var outputSchema39 = {
|
|
|
8022
8180
|
additionalProperties: false
|
|
8023
8181
|
};
|
|
8024
8182
|
|
|
8025
|
-
class ScalarTruncTask extends
|
|
8183
|
+
class ScalarTruncTask extends Task43 {
|
|
8026
8184
|
static type = "ScalarTruncTask";
|
|
8027
8185
|
static category = "Math";
|
|
8028
8186
|
static title = "Truncate";
|
|
8029
8187
|
static description = "Returns the integer part of a number by removing fractional digits";
|
|
8030
8188
|
static inputSchema() {
|
|
8031
|
-
return
|
|
8189
|
+
return inputSchema39;
|
|
8032
8190
|
}
|
|
8033
8191
|
static outputSchema() {
|
|
8034
8192
|
return outputSchema39;
|
|
@@ -8037,13 +8195,13 @@ class ScalarTruncTask extends Task42 {
|
|
|
8037
8195
|
return { result: Math.trunc(input2.value) };
|
|
8038
8196
|
}
|
|
8039
8197
|
}
|
|
8040
|
-
|
|
8198
|
+
Workflow46.prototype.scalarTrunc = CreateWorkflow45(ScalarTruncTask);
|
|
8041
8199
|
// src/task/vector/VectorDistanceTask.ts
|
|
8042
|
-
import { CreateWorkflow as
|
|
8200
|
+
import { CreateWorkflow as CreateWorkflow46, Task as Task44, Workflow as Workflow47 } from "@workglow/task-graph";
|
|
8043
8201
|
import {
|
|
8044
8202
|
TypedArraySchema as TypedArraySchema5
|
|
8045
|
-
} from "@workglow/util";
|
|
8046
|
-
var
|
|
8203
|
+
} from "@workglow/util/schema";
|
|
8204
|
+
var inputSchema40 = {
|
|
8047
8205
|
type: "object",
|
|
8048
8206
|
properties: {
|
|
8049
8207
|
vectors: {
|
|
@@ -8072,13 +8230,13 @@ var outputSchema40 = {
|
|
|
8072
8230
|
additionalProperties: false
|
|
8073
8231
|
};
|
|
8074
8232
|
|
|
8075
|
-
class VectorDistanceTask extends
|
|
8233
|
+
class VectorDistanceTask extends Task44 {
|
|
8076
8234
|
static type = "VectorDistanceTask";
|
|
8077
8235
|
static category = "Vector";
|
|
8078
8236
|
static title = "Distance";
|
|
8079
8237
|
static description = "Returns the Euclidean distance between the first two vectors";
|
|
8080
8238
|
static inputSchema() {
|
|
8081
|
-
return
|
|
8239
|
+
return inputSchema40;
|
|
8082
8240
|
}
|
|
8083
8241
|
static outputSchema() {
|
|
8084
8242
|
return outputSchema40;
|
|
@@ -8099,13 +8257,13 @@ class VectorDistanceTask extends Task43 {
|
|
|
8099
8257
|
return { result: Math.sqrt(sumPrecise(diffs)) };
|
|
8100
8258
|
}
|
|
8101
8259
|
}
|
|
8102
|
-
|
|
8260
|
+
Workflow47.prototype.vectorDistance = CreateWorkflow46(VectorDistanceTask);
|
|
8103
8261
|
// src/task/vector/VectorDotProductTask.ts
|
|
8104
|
-
import { CreateWorkflow as
|
|
8262
|
+
import { CreateWorkflow as CreateWorkflow47, Task as Task45, Workflow as Workflow48 } from "@workglow/task-graph";
|
|
8105
8263
|
import {
|
|
8106
8264
|
TypedArraySchema as TypedArraySchema6
|
|
8107
|
-
} from "@workglow/util";
|
|
8108
|
-
var
|
|
8265
|
+
} from "@workglow/util/schema";
|
|
8266
|
+
var inputSchema41 = {
|
|
8109
8267
|
type: "object",
|
|
8110
8268
|
properties: {
|
|
8111
8269
|
vectors: {
|
|
@@ -8134,13 +8292,13 @@ var outputSchema41 = {
|
|
|
8134
8292
|
additionalProperties: false
|
|
8135
8293
|
};
|
|
8136
8294
|
|
|
8137
|
-
class VectorDotProductTask extends
|
|
8295
|
+
class VectorDotProductTask extends Task45 {
|
|
8138
8296
|
static type = "VectorDotProductTask";
|
|
8139
8297
|
static category = "Vector";
|
|
8140
8298
|
static title = "Dot Product";
|
|
8141
8299
|
static description = "Returns the dot (inner) product of the first two vectors";
|
|
8142
8300
|
static inputSchema() {
|
|
8143
|
-
return
|
|
8301
|
+
return inputSchema41;
|
|
8144
8302
|
}
|
|
8145
8303
|
static outputSchema() {
|
|
8146
8304
|
return outputSchema41;
|
|
@@ -8158,14 +8316,14 @@ class VectorDotProductTask extends Task44 {
|
|
|
8158
8316
|
return { result: sumPrecise(products) };
|
|
8159
8317
|
}
|
|
8160
8318
|
}
|
|
8161
|
-
|
|
8319
|
+
Workflow48.prototype.vectorDotProduct = CreateWorkflow47(VectorDotProductTask);
|
|
8162
8320
|
// src/task/vector/VectorNormalizeTask.ts
|
|
8163
|
-
import { CreateWorkflow as
|
|
8321
|
+
import { CreateWorkflow as CreateWorkflow48, Task as Task46, Workflow as Workflow49 } from "@workglow/task-graph";
|
|
8164
8322
|
import {
|
|
8165
8323
|
TypedArraySchema as TypedArraySchema7,
|
|
8166
8324
|
normalize
|
|
8167
|
-
} from "@workglow/util";
|
|
8168
|
-
var
|
|
8325
|
+
} from "@workglow/util/schema";
|
|
8326
|
+
var inputSchema42 = {
|
|
8169
8327
|
type: "object",
|
|
8170
8328
|
properties: {
|
|
8171
8329
|
vector: TypedArraySchema7({
|
|
@@ -8188,13 +8346,13 @@ var outputSchema42 = {
|
|
|
8188
8346
|
additionalProperties: false
|
|
8189
8347
|
};
|
|
8190
8348
|
|
|
8191
|
-
class VectorNormalizeTask extends
|
|
8349
|
+
class VectorNormalizeTask extends Task46 {
|
|
8192
8350
|
static type = "VectorNormalizeTask";
|
|
8193
8351
|
static category = "Vector";
|
|
8194
8352
|
static title = "Normalize";
|
|
8195
8353
|
static description = "Returns the L2-normalized (unit length) vector";
|
|
8196
8354
|
static inputSchema() {
|
|
8197
|
-
return
|
|
8355
|
+
return inputSchema42;
|
|
8198
8356
|
}
|
|
8199
8357
|
static outputSchema() {
|
|
8200
8358
|
return outputSchema42;
|
|
@@ -8203,14 +8361,14 @@ class VectorNormalizeTask extends Task45 {
|
|
|
8203
8361
|
return { result: normalize(input2.vector) };
|
|
8204
8362
|
}
|
|
8205
8363
|
}
|
|
8206
|
-
|
|
8364
|
+
Workflow49.prototype.vectorNormalize = CreateWorkflow48(VectorNormalizeTask);
|
|
8207
8365
|
// src/task/vector/VectorScaleTask.ts
|
|
8208
|
-
import { CreateWorkflow as
|
|
8366
|
+
import { CreateWorkflow as CreateWorkflow49, Task as Task47, Workflow as Workflow50 } from "@workglow/task-graph";
|
|
8209
8367
|
import {
|
|
8210
8368
|
createTypedArrayFrom as createTypedArrayFrom5,
|
|
8211
8369
|
TypedArraySchema as TypedArraySchema8
|
|
8212
|
-
} from "@workglow/util";
|
|
8213
|
-
var
|
|
8370
|
+
} from "@workglow/util/schema";
|
|
8371
|
+
var inputSchema43 = {
|
|
8214
8372
|
type: "object",
|
|
8215
8373
|
properties: {
|
|
8216
8374
|
vector: TypedArraySchema8({
|
|
@@ -8238,13 +8396,13 @@ var outputSchema43 = {
|
|
|
8238
8396
|
additionalProperties: false
|
|
8239
8397
|
};
|
|
8240
8398
|
|
|
8241
|
-
class VectorScaleTask extends
|
|
8399
|
+
class VectorScaleTask extends Task47 {
|
|
8242
8400
|
static type = "VectorScaleTask";
|
|
8243
8401
|
static category = "Vector";
|
|
8244
8402
|
static title = "Scale";
|
|
8245
8403
|
static description = "Multiplies each element of a vector by a scalar";
|
|
8246
8404
|
static inputSchema() {
|
|
8247
|
-
return
|
|
8405
|
+
return inputSchema43;
|
|
8248
8406
|
}
|
|
8249
8407
|
static outputSchema() {
|
|
8250
8408
|
return outputSchema43;
|
|
@@ -8255,7 +8413,7 @@ class VectorScaleTask extends Task46 {
|
|
|
8255
8413
|
return { result: createTypedArrayFrom5([vector], values) };
|
|
8256
8414
|
}
|
|
8257
8415
|
}
|
|
8258
|
-
|
|
8416
|
+
Workflow50.prototype.vectorScale = CreateWorkflow49(VectorScaleTask);
|
|
8259
8417
|
|
|
8260
8418
|
// src/common.ts
|
|
8261
8419
|
import { TaskRegistry } from "@workglow/task-graph";
|
|
@@ -8294,6 +8452,7 @@ var registerCommonTasks = () => {
|
|
|
8294
8452
|
McpToolCallTask,
|
|
8295
8453
|
McpResourceReadTask,
|
|
8296
8454
|
McpPromptGetTask,
|
|
8455
|
+
McpSearchTask,
|
|
8297
8456
|
McpListTask,
|
|
8298
8457
|
StringConcatTask,
|
|
8299
8458
|
StringIncludesTask,
|
|
@@ -8313,16 +8472,620 @@ var registerCommonTasks = () => {
|
|
|
8313
8472
|
tasks.map(TaskRegistry.registerTask);
|
|
8314
8473
|
return tasks;
|
|
8315
8474
|
};
|
|
8475
|
+
// src/util/McpAuthTypes.ts
|
|
8476
|
+
var mcpAuthTypes = [
|
|
8477
|
+
"none",
|
|
8478
|
+
"bearer",
|
|
8479
|
+
"client_credentials",
|
|
8480
|
+
"private_key_jwt",
|
|
8481
|
+
"static_private_key_jwt",
|
|
8482
|
+
"authorization_code"
|
|
8483
|
+
];
|
|
8484
|
+
var mcpAuthConfigSchema = {
|
|
8485
|
+
properties: {
|
|
8486
|
+
auth_type: {
|
|
8487
|
+
type: "string",
|
|
8488
|
+
enum: mcpAuthTypes,
|
|
8489
|
+
title: "Auth Type",
|
|
8490
|
+
description: "Authentication method for connecting to the MCP server",
|
|
8491
|
+
default: "none"
|
|
8492
|
+
},
|
|
8493
|
+
auth_token: {
|
|
8494
|
+
type: "string",
|
|
8495
|
+
format: "credential",
|
|
8496
|
+
title: "Bearer Token",
|
|
8497
|
+
description: "Static bearer token or API key (for bearer auth)"
|
|
8498
|
+
},
|
|
8499
|
+
auth_client_id: {
|
|
8500
|
+
type: "string",
|
|
8501
|
+
title: "Client ID",
|
|
8502
|
+
description: "OAuth client ID (for OAuth auth types)"
|
|
8503
|
+
},
|
|
8504
|
+
auth_client_secret: {
|
|
8505
|
+
type: "string",
|
|
8506
|
+
format: "credential",
|
|
8507
|
+
title: "Client Secret",
|
|
8508
|
+
description: "OAuth client secret (for client_credentials auth)"
|
|
8509
|
+
},
|
|
8510
|
+
auth_private_key: {
|
|
8511
|
+
type: "string",
|
|
8512
|
+
format: "credential",
|
|
8513
|
+
title: "Private Key",
|
|
8514
|
+
description: "PEM or JWK private key (for private_key_jwt auth)"
|
|
8515
|
+
},
|
|
8516
|
+
auth_algorithm: {
|
|
8517
|
+
type: "string",
|
|
8518
|
+
title: "Algorithm",
|
|
8519
|
+
description: "JWT signing algorithm, e.g. RS256, ES256 (for private_key_jwt auth)"
|
|
8520
|
+
},
|
|
8521
|
+
auth_jwt_bearer_assertion: {
|
|
8522
|
+
type: "string",
|
|
8523
|
+
format: "credential",
|
|
8524
|
+
title: "JWT Assertion",
|
|
8525
|
+
description: "Pre-built JWT assertion (for static_private_key_jwt auth)"
|
|
8526
|
+
},
|
|
8527
|
+
auth_redirect_url: {
|
|
8528
|
+
type: "string",
|
|
8529
|
+
format: "uri",
|
|
8530
|
+
title: "Redirect URL",
|
|
8531
|
+
description: "OAuth redirect URL (for authorization_code auth)"
|
|
8532
|
+
},
|
|
8533
|
+
auth_scope: {
|
|
8534
|
+
type: "string",
|
|
8535
|
+
title: "Scope",
|
|
8536
|
+
description: "OAuth scope (space-separated)"
|
|
8537
|
+
},
|
|
8538
|
+
auth_client_name: {
|
|
8539
|
+
type: "string",
|
|
8540
|
+
title: "Client Name",
|
|
8541
|
+
description: "Optional OAuth client display name"
|
|
8542
|
+
},
|
|
8543
|
+
auth_jwt_lifetime_seconds: {
|
|
8544
|
+
type: "number",
|
|
8545
|
+
title: "JWT Lifetime",
|
|
8546
|
+
description: "JWT lifetime in seconds (default: 300)",
|
|
8547
|
+
minimum: 1
|
|
8548
|
+
}
|
|
8549
|
+
},
|
|
8550
|
+
allOf: [
|
|
8551
|
+
{
|
|
8552
|
+
if: { properties: { auth_type: { const: "bearer" } }, required: ["auth_type"] },
|
|
8553
|
+
then: {
|
|
8554
|
+
required: ["auth_token"],
|
|
8555
|
+
properties: { auth_token: true }
|
|
8556
|
+
}
|
|
8557
|
+
},
|
|
8558
|
+
{
|
|
8559
|
+
if: {
|
|
8560
|
+
properties: { auth_type: { const: "client_credentials" } },
|
|
8561
|
+
required: ["auth_type"]
|
|
8562
|
+
},
|
|
8563
|
+
then: {
|
|
8564
|
+
required: ["auth_client_id", "auth_client_secret"],
|
|
8565
|
+
properties: {
|
|
8566
|
+
auth_client_id: true,
|
|
8567
|
+
auth_client_secret: true,
|
|
8568
|
+
auth_client_name: true,
|
|
8569
|
+
auth_scope: true
|
|
8570
|
+
}
|
|
8571
|
+
}
|
|
8572
|
+
},
|
|
8573
|
+
{
|
|
8574
|
+
if: { properties: { auth_type: { const: "private_key_jwt" } }, required: ["auth_type"] },
|
|
8575
|
+
then: {
|
|
8576
|
+
required: ["auth_client_id", "auth_private_key", "auth_algorithm"],
|
|
8577
|
+
properties: {
|
|
8578
|
+
auth_client_id: true,
|
|
8579
|
+
auth_private_key: true,
|
|
8580
|
+
auth_algorithm: true,
|
|
8581
|
+
auth_client_name: true,
|
|
8582
|
+
auth_jwt_lifetime_seconds: true,
|
|
8583
|
+
auth_scope: true
|
|
8584
|
+
}
|
|
8585
|
+
}
|
|
8586
|
+
},
|
|
8587
|
+
{
|
|
8588
|
+
if: {
|
|
8589
|
+
properties: { auth_type: { const: "static_private_key_jwt" } },
|
|
8590
|
+
required: ["auth_type"]
|
|
8591
|
+
},
|
|
8592
|
+
then: {
|
|
8593
|
+
required: ["auth_client_id", "auth_jwt_bearer_assertion"],
|
|
8594
|
+
properties: {
|
|
8595
|
+
auth_client_id: true,
|
|
8596
|
+
auth_jwt_bearer_assertion: true,
|
|
8597
|
+
auth_client_name: true,
|
|
8598
|
+
auth_scope: true
|
|
8599
|
+
}
|
|
8600
|
+
}
|
|
8601
|
+
},
|
|
8602
|
+
{
|
|
8603
|
+
if: { properties: { auth_type: { const: "authorization_code" } }, required: ["auth_type"] },
|
|
8604
|
+
then: {
|
|
8605
|
+
required: ["auth_client_id", "auth_redirect_url"],
|
|
8606
|
+
properties: {
|
|
8607
|
+
auth_client_id: true,
|
|
8608
|
+
auth_client_secret: true,
|
|
8609
|
+
auth_redirect_url: true,
|
|
8610
|
+
auth_scope: true
|
|
8611
|
+
}
|
|
8612
|
+
}
|
|
8613
|
+
}
|
|
8614
|
+
]
|
|
8615
|
+
};
|
|
8616
|
+
function isMcpAuthType(value) {
|
|
8617
|
+
return typeof value === "string" && mcpAuthTypes.includes(value);
|
|
8618
|
+
}
|
|
8619
|
+
function asNonEmptyString(value) {
|
|
8620
|
+
if (typeof value !== "string")
|
|
8621
|
+
return;
|
|
8622
|
+
const trimmed = value.trim();
|
|
8623
|
+
return trimmed === "" ? undefined : trimmed;
|
|
8624
|
+
}
|
|
8625
|
+
function asNumber(value) {
|
|
8626
|
+
return typeof value === "number" ? value : undefined;
|
|
8627
|
+
}
|
|
8628
|
+
function buildAuthConfig(flat) {
|
|
8629
|
+
const rawAuthType = flat.auth_type;
|
|
8630
|
+
if (!isMcpAuthType(rawAuthType) || rawAuthType === "none") {
|
|
8631
|
+
return;
|
|
8632
|
+
}
|
|
8633
|
+
const authType = rawAuthType;
|
|
8634
|
+
switch (authType) {
|
|
8635
|
+
case "bearer": {
|
|
8636
|
+
const token = asNonEmptyString(flat.auth_token);
|
|
8637
|
+
if (!token)
|
|
8638
|
+
return;
|
|
8639
|
+
return { type: "bearer", token };
|
|
8640
|
+
}
|
|
8641
|
+
case "client_credentials": {
|
|
8642
|
+
const client_id = asNonEmptyString(flat.auth_client_id);
|
|
8643
|
+
const client_secret = asNonEmptyString(flat.auth_client_secret);
|
|
8644
|
+
if (!client_id || !client_secret)
|
|
8645
|
+
return;
|
|
8646
|
+
return {
|
|
8647
|
+
type: "client_credentials",
|
|
8648
|
+
client_id,
|
|
8649
|
+
client_secret,
|
|
8650
|
+
client_name: asNonEmptyString(flat.auth_client_name),
|
|
8651
|
+
scope: asNonEmptyString(flat.auth_scope)
|
|
8652
|
+
};
|
|
8653
|
+
}
|
|
8654
|
+
case "private_key_jwt": {
|
|
8655
|
+
const client_id = asNonEmptyString(flat.auth_client_id);
|
|
8656
|
+
const private_key = asNonEmptyString(flat.auth_private_key);
|
|
8657
|
+
const algorithm = asNonEmptyString(flat.auth_algorithm);
|
|
8658
|
+
if (!client_id || !private_key || !algorithm)
|
|
8659
|
+
return;
|
|
8660
|
+
return {
|
|
8661
|
+
type: "private_key_jwt",
|
|
8662
|
+
client_id,
|
|
8663
|
+
private_key,
|
|
8664
|
+
algorithm,
|
|
8665
|
+
client_name: asNonEmptyString(flat.auth_client_name),
|
|
8666
|
+
jwt_lifetime_seconds: asNumber(flat.auth_jwt_lifetime_seconds),
|
|
8667
|
+
scope: asNonEmptyString(flat.auth_scope)
|
|
8668
|
+
};
|
|
8669
|
+
}
|
|
8670
|
+
case "static_private_key_jwt": {
|
|
8671
|
+
const client_id = asNonEmptyString(flat.auth_client_id);
|
|
8672
|
+
const jwt_bearer_assertion = asNonEmptyString(flat.auth_jwt_bearer_assertion);
|
|
8673
|
+
if (!client_id || !jwt_bearer_assertion)
|
|
8674
|
+
return;
|
|
8675
|
+
return {
|
|
8676
|
+
type: "static_private_key_jwt",
|
|
8677
|
+
client_id,
|
|
8678
|
+
jwt_bearer_assertion,
|
|
8679
|
+
client_name: asNonEmptyString(flat.auth_client_name),
|
|
8680
|
+
scope: asNonEmptyString(flat.auth_scope)
|
|
8681
|
+
};
|
|
8682
|
+
}
|
|
8683
|
+
case "authorization_code": {
|
|
8684
|
+
const client_id = asNonEmptyString(flat.auth_client_id);
|
|
8685
|
+
const redirect_url = asNonEmptyString(flat.auth_redirect_url);
|
|
8686
|
+
if (!client_id || !redirect_url)
|
|
8687
|
+
return;
|
|
8688
|
+
return {
|
|
8689
|
+
type: "authorization_code",
|
|
8690
|
+
client_id,
|
|
8691
|
+
client_secret: asNonEmptyString(flat.auth_client_secret),
|
|
8692
|
+
redirect_url,
|
|
8693
|
+
scope: asNonEmptyString(flat.auth_scope)
|
|
8694
|
+
};
|
|
8695
|
+
}
|
|
8696
|
+
default:
|
|
8697
|
+
return;
|
|
8698
|
+
}
|
|
8699
|
+
}
|
|
8700
|
+
// src/util/McpAuthProvider.ts
|
|
8701
|
+
import {
|
|
8702
|
+
ClientCredentialsProvider,
|
|
8703
|
+
PrivateKeyJwtProvider,
|
|
8704
|
+
StaticPrivateKeyJwtProvider,
|
|
8705
|
+
createPrivateKeyJwtAuth
|
|
8706
|
+
} from "@modelcontextprotocol/sdk/client/auth-extensions.js";
|
|
8707
|
+
import { UnauthorizedError } from "@modelcontextprotocol/sdk/client/auth.js";
|
|
8708
|
+
import { getGlobalCredentialStore } from "@workglow/util";
|
|
8709
|
+
function normalizeServerUrl(serverUrl) {
|
|
8710
|
+
try {
|
|
8711
|
+
const u = new URL(serverUrl);
|
|
8712
|
+
return u.origin + u.pathname.replace(/\/+$/, "");
|
|
8713
|
+
} catch {
|
|
8714
|
+
return serverUrl;
|
|
8715
|
+
}
|
|
8716
|
+
}
|
|
8717
|
+
function storeKey(serverUrl, suffix) {
|
|
8718
|
+
return `mcp:oauth:${normalizeServerUrl(serverUrl)}:${suffix}`;
|
|
8719
|
+
}
|
|
8316
8720
|
|
|
8721
|
+
class CredentialStoreOAuthProvider {
|
|
8722
|
+
store;
|
|
8723
|
+
serverUrl;
|
|
8724
|
+
_clientMetadata;
|
|
8725
|
+
_redirectUrl;
|
|
8726
|
+
_initialClientInfo;
|
|
8727
|
+
prepareTokenRequest;
|
|
8728
|
+
addClientAuthentication;
|
|
8729
|
+
constructor(options2) {
|
|
8730
|
+
this.store = options2.store;
|
|
8731
|
+
this.serverUrl = options2.serverUrl;
|
|
8732
|
+
this._clientMetadata = options2.clientMetadata;
|
|
8733
|
+
this._redirectUrl = options2.redirectUrl;
|
|
8734
|
+
this._initialClientInfo = options2.initialClientInfo;
|
|
8735
|
+
if (options2.prepareTokenRequest) {
|
|
8736
|
+
this.prepareTokenRequest = options2.prepareTokenRequest;
|
|
8737
|
+
}
|
|
8738
|
+
if (options2.addClientAuthentication) {
|
|
8739
|
+
this.addClientAuthentication = options2.addClientAuthentication;
|
|
8740
|
+
}
|
|
8741
|
+
}
|
|
8742
|
+
get redirectUrl() {
|
|
8743
|
+
return this._redirectUrl;
|
|
8744
|
+
}
|
|
8745
|
+
get clientMetadata() {
|
|
8746
|
+
return this._clientMetadata;
|
|
8747
|
+
}
|
|
8748
|
+
async clientInformation() {
|
|
8749
|
+
const raw = await this.store.get(storeKey(this.serverUrl, "client_info"));
|
|
8750
|
+
if (!raw)
|
|
8751
|
+
return this._initialClientInfo;
|
|
8752
|
+
return JSON.parse(raw);
|
|
8753
|
+
}
|
|
8754
|
+
async saveClientInformation(info) {
|
|
8755
|
+
await this.store.put(storeKey(this.serverUrl, "client_info"), JSON.stringify(info));
|
|
8756
|
+
}
|
|
8757
|
+
async tokens() {
|
|
8758
|
+
const raw = await this.store.get(storeKey(this.serverUrl, "tokens"));
|
|
8759
|
+
if (!raw)
|
|
8760
|
+
return;
|
|
8761
|
+
return JSON.parse(raw);
|
|
8762
|
+
}
|
|
8763
|
+
async saveTokens(tokens) {
|
|
8764
|
+
const expiresAt = tokens.expires_in != null ? new Date(Date.now() + tokens.expires_in * 1000) : undefined;
|
|
8765
|
+
await this.store.put(storeKey(this.serverUrl, "tokens"), JSON.stringify(tokens), {
|
|
8766
|
+
expiresAt
|
|
8767
|
+
});
|
|
8768
|
+
}
|
|
8769
|
+
async redirectToAuthorization(authorizationUrl) {
|
|
8770
|
+
throw new Error(`MCP OAuth authorization required. ` + `Open this URL to authorize: ${authorizationUrl.toString()}`);
|
|
8771
|
+
}
|
|
8772
|
+
async saveCodeVerifier(codeVerifier) {
|
|
8773
|
+
await this.store.put(storeKey(this.serverUrl, "code_verifier"), codeVerifier);
|
|
8774
|
+
}
|
|
8775
|
+
async codeVerifier() {
|
|
8776
|
+
const v = await this.store.get(storeKey(this.serverUrl, "code_verifier"));
|
|
8777
|
+
if (!v)
|
|
8778
|
+
throw new Error("No code verifier saved for this session");
|
|
8779
|
+
return v;
|
|
8780
|
+
}
|
|
8781
|
+
async saveDiscoveryState(state) {
|
|
8782
|
+
await this.store.put(storeKey(this.serverUrl, "discovery"), JSON.stringify(state));
|
|
8783
|
+
}
|
|
8784
|
+
async discoveryState() {
|
|
8785
|
+
const raw = await this.store.get(storeKey(this.serverUrl, "discovery"));
|
|
8786
|
+
if (!raw)
|
|
8787
|
+
return;
|
|
8788
|
+
return JSON.parse(raw);
|
|
8789
|
+
}
|
|
8790
|
+
async invalidateCredentials(scope) {
|
|
8791
|
+
const deleteKey = async (suffix) => {
|
|
8792
|
+
await this.store.delete(storeKey(this.serverUrl, suffix));
|
|
8793
|
+
};
|
|
8794
|
+
switch (scope) {
|
|
8795
|
+
case "all":
|
|
8796
|
+
await deleteKey("tokens");
|
|
8797
|
+
await deleteKey("client_info");
|
|
8798
|
+
await deleteKey("code_verifier");
|
|
8799
|
+
await deleteKey("discovery");
|
|
8800
|
+
break;
|
|
8801
|
+
case "client":
|
|
8802
|
+
await deleteKey("client_info");
|
|
8803
|
+
break;
|
|
8804
|
+
case "tokens":
|
|
8805
|
+
await deleteKey("tokens");
|
|
8806
|
+
break;
|
|
8807
|
+
case "verifier":
|
|
8808
|
+
await deleteKey("code_verifier");
|
|
8809
|
+
break;
|
|
8810
|
+
case "discovery":
|
|
8811
|
+
await deleteKey("discovery");
|
|
8812
|
+
break;
|
|
8813
|
+
}
|
|
8814
|
+
}
|
|
8815
|
+
}
|
|
8816
|
+
function createAuthProvider(auth, serverUrl, credentialStore) {
|
|
8817
|
+
switch (auth.type) {
|
|
8818
|
+
case "none":
|
|
8819
|
+
case "bearer":
|
|
8820
|
+
return;
|
|
8821
|
+
case "client_credentials": {
|
|
8822
|
+
if (!credentialStore) {
|
|
8823
|
+
return new ClientCredentialsProvider({
|
|
8824
|
+
clientId: auth.client_id,
|
|
8825
|
+
clientSecret: auth.client_secret,
|
|
8826
|
+
clientName: auth.client_name,
|
|
8827
|
+
scope: auth.scope
|
|
8828
|
+
});
|
|
8829
|
+
}
|
|
8830
|
+
const prepareTokenRequest = (scope) => {
|
|
8831
|
+
const params = new URLSearchParams({ grant_type: "client_credentials" });
|
|
8832
|
+
const effectiveScope = scope ?? auth.scope;
|
|
8833
|
+
if (effectiveScope)
|
|
8834
|
+
params.set("scope", effectiveScope);
|
|
8835
|
+
return params;
|
|
8836
|
+
};
|
|
8837
|
+
return new CredentialStoreOAuthProvider({
|
|
8838
|
+
store: credentialStore,
|
|
8839
|
+
serverUrl,
|
|
8840
|
+
clientMetadata: {
|
|
8841
|
+
redirect_uris: [],
|
|
8842
|
+
grant_types: ["client_credentials"],
|
|
8843
|
+
token_endpoint_auth_method: "client_secret_basic",
|
|
8844
|
+
client_name: auth.client_name
|
|
8845
|
+
},
|
|
8846
|
+
initialClientInfo: {
|
|
8847
|
+
client_id: auth.client_id,
|
|
8848
|
+
client_secret: auth.client_secret
|
|
8849
|
+
},
|
|
8850
|
+
prepareTokenRequest
|
|
8851
|
+
});
|
|
8852
|
+
}
|
|
8853
|
+
case "private_key_jwt": {
|
|
8854
|
+
if (!credentialStore) {
|
|
8855
|
+
return new PrivateKeyJwtProvider({
|
|
8856
|
+
clientId: auth.client_id,
|
|
8857
|
+
privateKey: auth.private_key,
|
|
8858
|
+
algorithm: auth.algorithm,
|
|
8859
|
+
clientName: auth.client_name,
|
|
8860
|
+
jwtLifetimeSeconds: auth.jwt_lifetime_seconds,
|
|
8861
|
+
scope: auth.scope
|
|
8862
|
+
});
|
|
8863
|
+
}
|
|
8864
|
+
const addClientAuth = createPrivateKeyJwtAuth({
|
|
8865
|
+
issuer: auth.client_id,
|
|
8866
|
+
subject: auth.client_id,
|
|
8867
|
+
privateKey: auth.private_key,
|
|
8868
|
+
alg: auth.algorithm,
|
|
8869
|
+
lifetimeSeconds: auth.jwt_lifetime_seconds
|
|
8870
|
+
});
|
|
8871
|
+
const prepareTokenRequest = (scope) => {
|
|
8872
|
+
const params = new URLSearchParams({ grant_type: "client_credentials" });
|
|
8873
|
+
const effectiveScope = scope ?? auth.scope;
|
|
8874
|
+
if (effectiveScope)
|
|
8875
|
+
params.set("scope", effectiveScope);
|
|
8876
|
+
return params;
|
|
8877
|
+
};
|
|
8878
|
+
return new CredentialStoreOAuthProvider({
|
|
8879
|
+
store: credentialStore,
|
|
8880
|
+
serverUrl,
|
|
8881
|
+
clientMetadata: {
|
|
8882
|
+
redirect_uris: [],
|
|
8883
|
+
grant_types: ["client_credentials"],
|
|
8884
|
+
token_endpoint_auth_method: "private_key_jwt",
|
|
8885
|
+
client_name: auth.client_name
|
|
8886
|
+
},
|
|
8887
|
+
initialClientInfo: { client_id: auth.client_id },
|
|
8888
|
+
prepareTokenRequest,
|
|
8889
|
+
addClientAuthentication: addClientAuth
|
|
8890
|
+
});
|
|
8891
|
+
}
|
|
8892
|
+
case "static_private_key_jwt": {
|
|
8893
|
+
if (!credentialStore) {
|
|
8894
|
+
return new StaticPrivateKeyJwtProvider({
|
|
8895
|
+
clientId: auth.client_id,
|
|
8896
|
+
jwtBearerAssertion: auth.jwt_bearer_assertion,
|
|
8897
|
+
clientName: auth.client_name,
|
|
8898
|
+
scope: auth.scope
|
|
8899
|
+
});
|
|
8900
|
+
}
|
|
8901
|
+
const assertion = auth.jwt_bearer_assertion;
|
|
8902
|
+
const addClientAuth = (_headers, params) => {
|
|
8903
|
+
params.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer");
|
|
8904
|
+
params.set("client_assertion", assertion);
|
|
8905
|
+
};
|
|
8906
|
+
const prepareTokenRequest = (scope) => {
|
|
8907
|
+
const params = new URLSearchParams({ grant_type: "client_credentials" });
|
|
8908
|
+
const effectiveScope = scope ?? auth.scope;
|
|
8909
|
+
if (effectiveScope)
|
|
8910
|
+
params.set("scope", effectiveScope);
|
|
8911
|
+
return params;
|
|
8912
|
+
};
|
|
8913
|
+
return new CredentialStoreOAuthProvider({
|
|
8914
|
+
store: credentialStore,
|
|
8915
|
+
serverUrl,
|
|
8916
|
+
clientMetadata: {
|
|
8917
|
+
redirect_uris: [],
|
|
8918
|
+
grant_types: ["client_credentials"],
|
|
8919
|
+
token_endpoint_auth_method: "private_key_jwt",
|
|
8920
|
+
client_name: auth.client_name
|
|
8921
|
+
},
|
|
8922
|
+
initialClientInfo: { client_id: auth.client_id },
|
|
8923
|
+
prepareTokenRequest,
|
|
8924
|
+
addClientAuthentication: addClientAuth
|
|
8925
|
+
});
|
|
8926
|
+
}
|
|
8927
|
+
case "authorization_code": {
|
|
8928
|
+
if (!credentialStore) {
|
|
8929
|
+
throw new Error("authorization_code auth requires a credential store for token persistence");
|
|
8930
|
+
}
|
|
8931
|
+
return new CredentialStoreOAuthProvider({
|
|
8932
|
+
store: credentialStore,
|
|
8933
|
+
serverUrl,
|
|
8934
|
+
clientMetadata: {
|
|
8935
|
+
redirect_uris: [auth.redirect_url],
|
|
8936
|
+
grant_types: ["authorization_code", "refresh_token"],
|
|
8937
|
+
token_endpoint_auth_method: auth.client_secret ? "client_secret_basic" : "none",
|
|
8938
|
+
scope: auth.scope
|
|
8939
|
+
},
|
|
8940
|
+
initialClientInfo: {
|
|
8941
|
+
client_id: auth.client_id,
|
|
8942
|
+
...auth.client_secret ? { client_secret: auth.client_secret } : {}
|
|
8943
|
+
},
|
|
8944
|
+
redirectUrl: auth.redirect_url
|
|
8945
|
+
});
|
|
8946
|
+
}
|
|
8947
|
+
default:
|
|
8948
|
+
return;
|
|
8949
|
+
}
|
|
8950
|
+
}
|
|
8951
|
+
async function resolveAuthSecrets(auth, credentialStore) {
|
|
8952
|
+
if (auth.type === "none")
|
|
8953
|
+
return auth;
|
|
8954
|
+
const store = credentialStore ?? getGlobalCredentialStore();
|
|
8955
|
+
async function resolve(value) {
|
|
8956
|
+
if (!value)
|
|
8957
|
+
return value;
|
|
8958
|
+
const resolved = await store.get(value);
|
|
8959
|
+
return resolved ?? value;
|
|
8960
|
+
}
|
|
8961
|
+
switch (auth.type) {
|
|
8962
|
+
case "bearer":
|
|
8963
|
+
return { ...auth, token: await resolve(auth.token) ?? auth.token };
|
|
8964
|
+
case "client_credentials":
|
|
8965
|
+
return {
|
|
8966
|
+
...auth,
|
|
8967
|
+
client_secret: await resolve(auth.client_secret) ?? auth.client_secret
|
|
8968
|
+
};
|
|
8969
|
+
case "private_key_jwt":
|
|
8970
|
+
return {
|
|
8971
|
+
...auth,
|
|
8972
|
+
private_key: await resolve(auth.private_key) ?? auth.private_key
|
|
8973
|
+
};
|
|
8974
|
+
case "static_private_key_jwt":
|
|
8975
|
+
return {
|
|
8976
|
+
...auth,
|
|
8977
|
+
jwt_bearer_assertion: await resolve(auth.jwt_bearer_assertion) ?? auth.jwt_bearer_assertion
|
|
8978
|
+
};
|
|
8979
|
+
case "authorization_code":
|
|
8980
|
+
return {
|
|
8981
|
+
...auth,
|
|
8982
|
+
client_secret: await resolve(auth.client_secret)
|
|
8983
|
+
};
|
|
8984
|
+
default:
|
|
8985
|
+
return auth;
|
|
8986
|
+
}
|
|
8987
|
+
}
|
|
8988
|
+
// src/util/McpClientUtil.browser.ts
|
|
8989
|
+
import { Client } from "@modelcontextprotocol/sdk/client";
|
|
8990
|
+
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
8991
|
+
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
8992
|
+
import { getGlobalCredentialStore as getGlobalCredentialStore2 } from "@workglow/util";
|
|
8993
|
+
var mcpTransportTypes = ["streamable-http", "sse"];
|
|
8994
|
+
var mcpServerConfigSchema = {
|
|
8995
|
+
properties: {
|
|
8996
|
+
transport: {
|
|
8997
|
+
type: "string",
|
|
8998
|
+
enum: mcpTransportTypes,
|
|
8999
|
+
title: "Transport",
|
|
9000
|
+
description: "The transport type to use for connecting to the MCP server"
|
|
9001
|
+
},
|
|
9002
|
+
server_url: {
|
|
9003
|
+
type: "string",
|
|
9004
|
+
format: "uri",
|
|
9005
|
+
title: "Server URL",
|
|
9006
|
+
description: "The URL of the MCP server (for streamable-http transport)"
|
|
9007
|
+
},
|
|
9008
|
+
...mcpAuthConfigSchema.properties
|
|
9009
|
+
},
|
|
9010
|
+
allOf: [
|
|
9011
|
+
{
|
|
9012
|
+
if: { properties: { transport: { const: "sse" } }, required: ["transport"] },
|
|
9013
|
+
then: { required: ["server_url"] }
|
|
9014
|
+
},
|
|
9015
|
+
{
|
|
9016
|
+
if: {
|
|
9017
|
+
properties: { transport: { const: "streamable-http" } },
|
|
9018
|
+
required: ["transport"]
|
|
9019
|
+
},
|
|
9020
|
+
then: { required: ["server_url"] }
|
|
9021
|
+
},
|
|
9022
|
+
...mcpAuthConfigSchema.allOf
|
|
9023
|
+
]
|
|
9024
|
+
};
|
|
9025
|
+
async function createMcpClient(config, signal) {
|
|
9026
|
+
let transport;
|
|
9027
|
+
let auth = config.auth ?? buildAuthConfig({ ...config });
|
|
9028
|
+
if (auth && auth.type !== "none") {
|
|
9029
|
+
auth = await resolveAuthSecrets(auth, getGlobalCredentialStore2());
|
|
9030
|
+
}
|
|
9031
|
+
const authProvider = config.authProvider ?? (auth && auth.type !== "none" && auth.type !== "bearer" ? createAuthProvider(auth, config.server_url ?? "", getGlobalCredentialStore2()) : undefined);
|
|
9032
|
+
const headers = {
|
|
9033
|
+
...auth?.type === "bearer" ? { Authorization: `Bearer ${auth.token}` } : {}
|
|
9034
|
+
};
|
|
9035
|
+
const requestInit = { headers };
|
|
9036
|
+
switch (config.transport) {
|
|
9037
|
+
case "sse": {
|
|
9038
|
+
transport = new SSEClientTransport(new URL(config.server_url), {
|
|
9039
|
+
authProvider,
|
|
9040
|
+
requestInit
|
|
9041
|
+
});
|
|
9042
|
+
break;
|
|
9043
|
+
}
|
|
9044
|
+
case "streamable-http": {
|
|
9045
|
+
transport = new StreamableHTTPClientTransport(new URL(config.server_url), {
|
|
9046
|
+
authProvider,
|
|
9047
|
+
requestInit
|
|
9048
|
+
});
|
|
9049
|
+
break;
|
|
9050
|
+
}
|
|
9051
|
+
default:
|
|
9052
|
+
throw new Error(`Unsupported transport type: ${config.transport}`);
|
|
9053
|
+
}
|
|
9054
|
+
const client = new Client({ name: "workglow-mcp-client", version: "1.0.0" });
|
|
9055
|
+
if (signal) {
|
|
9056
|
+
signal.addEventListener("abort", () => {
|
|
9057
|
+
client.close().catch(() => {});
|
|
9058
|
+
}, { once: true });
|
|
9059
|
+
}
|
|
9060
|
+
try {
|
|
9061
|
+
await client.connect(transport);
|
|
9062
|
+
} catch (err) {
|
|
9063
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
9064
|
+
const url = config.server_url ?? "";
|
|
9065
|
+
const is405 = message.includes("405") || message.includes("Method Not Allowed") || typeof err === "object" && err !== null && "status" in err && err.status === 405;
|
|
9066
|
+
if (is405) {
|
|
9067
|
+
throw new Error(`MCP connection failed with 405 Method Not Allowed for ${url}. ` + `This usually means the server does not accept GET requests. `, { cause: err });
|
|
9068
|
+
}
|
|
9069
|
+
const is406 = message.includes("406") || message.includes("Not Acceptable") || typeof err === "object" && err !== null && "code" in err && err.code === 406;
|
|
9070
|
+
if (is406) {
|
|
9071
|
+
throw new Error(`MCP connection failed with 406 Not Acceptable for ${url}. ` + `Try using transport "sse" instead of "streamable-http", or ensure the server accepts the request format (Accept: application/json, text/event-stream and MCP-Protocol-Version).`, { cause: err });
|
|
9072
|
+
}
|
|
9073
|
+
throw err;
|
|
9074
|
+
}
|
|
9075
|
+
return { client, transport };
|
|
9076
|
+
}
|
|
9077
|
+
var mcpClientFactory = {
|
|
9078
|
+
create: createMcpClient
|
|
9079
|
+
};
|
|
8317
9080
|
// src/task/FileLoaderTask.ts
|
|
8318
9081
|
import {
|
|
8319
|
-
CreateWorkflow as
|
|
8320
|
-
Task as
|
|
9082
|
+
CreateWorkflow as CreateWorkflow50,
|
|
9083
|
+
Task as Task48,
|
|
8321
9084
|
TaskAbortedError as TaskAbortedError2,
|
|
8322
|
-
Workflow as
|
|
9085
|
+
Workflow as Workflow51
|
|
8323
9086
|
} from "@workglow/task-graph";
|
|
8324
9087
|
import Papa from "papaparse";
|
|
8325
|
-
var
|
|
9088
|
+
var inputSchema44 = {
|
|
8326
9089
|
type: "object",
|
|
8327
9090
|
properties: {
|
|
8328
9091
|
url: {
|
|
@@ -8393,14 +9156,14 @@ var outputSchema44 = {
|
|
|
8393
9156
|
additionalProperties: false
|
|
8394
9157
|
};
|
|
8395
9158
|
|
|
8396
|
-
class FileLoaderTask extends
|
|
9159
|
+
class FileLoaderTask extends Task48 {
|
|
8397
9160
|
static type = "FileLoaderTask";
|
|
8398
9161
|
static category = "Document";
|
|
8399
9162
|
static title = "File Loader";
|
|
8400
9163
|
static description = "Load documents from URLs (http://, https://)";
|
|
8401
9164
|
static cacheable = true;
|
|
8402
9165
|
static inputSchema() {
|
|
8403
|
-
return
|
|
9166
|
+
return inputSchema44;
|
|
8404
9167
|
}
|
|
8405
9168
|
static outputSchema() {
|
|
8406
9169
|
return outputSchema44;
|
|
@@ -8759,9 +9522,10 @@ class FileLoaderTask extends Task47 {
|
|
|
8759
9522
|
var fileLoader = (input2, config) => {
|
|
8760
9523
|
return new FileLoaderTask({}, config).run(input2);
|
|
8761
9524
|
};
|
|
8762
|
-
|
|
8763
|
-
|
|
9525
|
+
Workflow51.prototype.fileLoader = CreateWorkflow50(FileLoaderTask);
|
|
8764
9526
|
// src/browser.ts
|
|
9527
|
+
import { TaskRegistry as TaskRegistry2 } from "@workglow/task-graph";
|
|
9528
|
+
registerMcpTaskDeps({ mcpClientFactory, mcpServerConfigSchema });
|
|
8765
9529
|
var registerCommonTasks2 = () => {
|
|
8766
9530
|
const tasks = registerCommonTasks();
|
|
8767
9531
|
TaskRegistry2.registerTask(FileLoaderTask);
|
|
@@ -8769,21 +9533,36 @@ var registerCommonTasks2 = () => {
|
|
|
8769
9533
|
};
|
|
8770
9534
|
export {
|
|
8771
9535
|
split,
|
|
9536
|
+
searchMcpRegistryPage,
|
|
9537
|
+
searchMcpRegistry,
|
|
9538
|
+
resolveAuthSecrets,
|
|
9539
|
+
registerMcpTaskDeps,
|
|
8772
9540
|
registerCommonTasks2 as registerCommonTasks,
|
|
8773
9541
|
process,
|
|
8774
9542
|
merge,
|
|
9543
|
+
mcpTransportTypes,
|
|
8775
9544
|
mcpToolCall,
|
|
9545
|
+
mcpServerConfigSchema,
|
|
9546
|
+
mcpSearch,
|
|
8776
9547
|
mcpResourceRead,
|
|
8777
9548
|
mcpPromptGet,
|
|
8778
9549
|
mcpList,
|
|
9550
|
+
mcpClientFactory,
|
|
9551
|
+
mcpAuthTypes,
|
|
9552
|
+
mcpAuthConfigSchema,
|
|
9553
|
+
mapMcpRegistryResult,
|
|
8779
9554
|
lambdaTaskConfigSchema,
|
|
8780
9555
|
lambda,
|
|
8781
9556
|
json,
|
|
8782
9557
|
javaScript,
|
|
9558
|
+
getMcpTaskDeps,
|
|
8783
9559
|
fileLoader,
|
|
8784
9560
|
fetchUrl,
|
|
8785
9561
|
delay,
|
|
8786
9562
|
debugLog,
|
|
9563
|
+
createMcpClient,
|
|
9564
|
+
createAuthProvider,
|
|
9565
|
+
buildAuthConfig,
|
|
8787
9566
|
VectorSumTask,
|
|
8788
9567
|
VectorSubtractTask,
|
|
8789
9568
|
VectorScaleTask,
|
|
@@ -8792,6 +9571,7 @@ export {
|
|
|
8792
9571
|
VectorDotProductTask,
|
|
8793
9572
|
VectorDivideTask,
|
|
8794
9573
|
VectorDistanceTask,
|
|
9574
|
+
UnauthorizedError,
|
|
8795
9575
|
TypeReplicateArray,
|
|
8796
9576
|
TemplateTask,
|
|
8797
9577
|
StringUpperCaseTask,
|
|
@@ -8821,9 +9601,11 @@ export {
|
|
|
8821
9601
|
OutputTask,
|
|
8822
9602
|
MergeTask,
|
|
8823
9603
|
McpToolCallTask,
|
|
9604
|
+
McpSearchTask,
|
|
8824
9605
|
McpResourceReadTask,
|
|
8825
9606
|
McpPromptGetTask,
|
|
8826
9607
|
McpListTask,
|
|
9608
|
+
MCP_TASK_DEPS,
|
|
8827
9609
|
LambdaTask,
|
|
8828
9610
|
JsonTask,
|
|
8829
9611
|
JsonPathTask,
|
|
@@ -8835,7 +9617,8 @@ export {
|
|
|
8835
9617
|
DelayTask,
|
|
8836
9618
|
DebugLogTask,
|
|
8837
9619
|
DateFormatTask,
|
|
9620
|
+
CredentialStoreOAuthProvider,
|
|
8838
9621
|
ArrayTask
|
|
8839
9622
|
};
|
|
8840
9623
|
|
|
8841
|
-
//# debugId=
|
|
9624
|
+
//# debugId=6DBC608C0A83C83164756E2164756E21
|