@flowgram.ai/runtime-interface 0.1.0-alpha.10 → 0.1.0-alpha.11
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/esm/index.js +73 -65
- package/dist/esm/index.js.map +1 -1
- package/dist/{index.d.mts → index.d.cts} +119 -79
- package/dist/index.d.ts +119 -79
- package/dist/index.js +81 -72
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
|
-
// src/api/
|
|
1
|
+
// src/api/task-validate/index.ts
|
|
2
|
+
import z2 from "zod";
|
|
3
|
+
|
|
4
|
+
// src/api/schema.ts
|
|
2
5
|
import z from "zod";
|
|
6
|
+
var WorkflowIOZodSchema = z.record(z.string(), z.any());
|
|
7
|
+
var WorkflowSnapshotZodSchema = z.object({
|
|
8
|
+
id: z.string(),
|
|
9
|
+
nodeID: z.string(),
|
|
10
|
+
inputs: WorkflowIOZodSchema,
|
|
11
|
+
outputs: WorkflowIOZodSchema.optional(),
|
|
12
|
+
data: WorkflowIOZodSchema,
|
|
13
|
+
branch: z.string().optional()
|
|
14
|
+
});
|
|
15
|
+
var WorkflowStatusZodShape = {
|
|
16
|
+
status: z.string(),
|
|
17
|
+
terminated: z.boolean(),
|
|
18
|
+
startTime: z.number(),
|
|
19
|
+
endTime: z.number().optional(),
|
|
20
|
+
timeCost: z.number()
|
|
21
|
+
};
|
|
22
|
+
var WorkflowStatusZodSchema = z.object(WorkflowStatusZodShape);
|
|
23
|
+
var WorkflowNodeReportZodSchema = z.object({
|
|
24
|
+
id: z.string(),
|
|
25
|
+
...WorkflowStatusZodShape,
|
|
26
|
+
snapshots: z.array(WorkflowSnapshotZodSchema)
|
|
27
|
+
});
|
|
28
|
+
var WorkflowReportsZodSchema = z.record(z.string(), WorkflowNodeReportZodSchema);
|
|
29
|
+
var WorkflowMessageZodSchema = z.object({
|
|
30
|
+
id: z.string(),
|
|
31
|
+
type: z.enum(["log", "info", "debug", "error", "warning"]),
|
|
32
|
+
message: z.string(),
|
|
33
|
+
nodeID: z.string().optional(),
|
|
34
|
+
timestamp: z.number()
|
|
35
|
+
});
|
|
36
|
+
var WorkflowMessagesZodSchema = z.record(
|
|
37
|
+
z.enum(["log", "info", "debug", "error", "warning"]),
|
|
38
|
+
z.array(WorkflowMessageZodSchema)
|
|
39
|
+
);
|
|
40
|
+
var WorkflowZodSchema = {
|
|
41
|
+
Inputs: WorkflowIOZodSchema,
|
|
42
|
+
Outputs: WorkflowIOZodSchema,
|
|
43
|
+
Status: WorkflowStatusZodSchema,
|
|
44
|
+
Snapshot: WorkflowSnapshotZodSchema,
|
|
45
|
+
Reports: WorkflowReportsZodSchema,
|
|
46
|
+
Messages: WorkflowMessagesZodSchema
|
|
47
|
+
};
|
|
3
48
|
|
|
4
49
|
// src/api/constant.ts
|
|
5
50
|
var FlowGramAPIMethod = /* @__PURE__ */ ((FlowGramAPIMethod2) => {
|
|
@@ -16,84 +61,35 @@ var FlowGramAPIName = /* @__PURE__ */ ((FlowGramAPIName2) => {
|
|
|
16
61
|
FlowGramAPIName2["TaskReport"] = "TaskReport";
|
|
17
62
|
FlowGramAPIName2["TaskResult"] = "TaskResult";
|
|
18
63
|
FlowGramAPIName2["TaskCancel"] = "TaskCancel";
|
|
19
|
-
FlowGramAPIName2["
|
|
64
|
+
FlowGramAPIName2["TaskValidate"] = "TaskValidate";
|
|
20
65
|
return FlowGramAPIName2;
|
|
21
66
|
})(FlowGramAPIName || {});
|
|
22
67
|
var FlowGramAPIModule = /* @__PURE__ */ ((FlowGramAPIModule2) => {
|
|
23
68
|
FlowGramAPIModule2["Info"] = "Info";
|
|
24
69
|
FlowGramAPIModule2["Task"] = "Task";
|
|
25
|
-
FlowGramAPIModule2["Validation"] = "Validation";
|
|
26
70
|
return FlowGramAPIModule2;
|
|
27
71
|
})(FlowGramAPIModule || {});
|
|
28
72
|
|
|
29
|
-
// src/api/
|
|
30
|
-
var
|
|
31
|
-
name: "
|
|
73
|
+
// src/api/task-validate/index.ts
|
|
74
|
+
var TaskValidateDefine = {
|
|
75
|
+
name: "TaskValidate" /* TaskValidate */,
|
|
32
76
|
method: "POST" /* POST */,
|
|
33
|
-
path: "/
|
|
34
|
-
module: "
|
|
77
|
+
path: "/task/validate",
|
|
78
|
+
module: "Task" /* Task */,
|
|
35
79
|
schema: {
|
|
36
|
-
input:
|
|
37
|
-
schema:
|
|
80
|
+
input: z2.object({
|
|
81
|
+
schema: z2.string(),
|
|
82
|
+
inputs: WorkflowZodSchema.Inputs
|
|
38
83
|
}),
|
|
39
|
-
output:
|
|
40
|
-
valid:
|
|
41
|
-
|
|
42
|
-
z.object({
|
|
43
|
-
message: z.string(),
|
|
44
|
-
nodeID: z.string()
|
|
45
|
-
})
|
|
46
|
-
),
|
|
47
|
-
edgeErrors: z.array(
|
|
48
|
-
z.object({
|
|
49
|
-
message: z.string(),
|
|
50
|
-
edge: z.object({
|
|
51
|
-
sourceNodeID: z.string(),
|
|
52
|
-
targetNodeID: z.string(),
|
|
53
|
-
sourcePortID: z.string().optional(),
|
|
54
|
-
targetPortID: z.string().optional()
|
|
55
|
-
})
|
|
56
|
-
})
|
|
57
|
-
)
|
|
84
|
+
output: z2.object({
|
|
85
|
+
valid: z2.boolean(),
|
|
86
|
+
errors: z2.array(z2.string()).optional()
|
|
58
87
|
})
|
|
59
88
|
}
|
|
60
89
|
};
|
|
61
90
|
|
|
62
91
|
// src/api/task-run/index.ts
|
|
63
92
|
import z3 from "zod";
|
|
64
|
-
|
|
65
|
-
// src/api/schema.ts
|
|
66
|
-
import z2 from "zod";
|
|
67
|
-
var WorkflowIOZodSchema = z2.record(z2.string(), z2.any());
|
|
68
|
-
var WorkflowSnapshotZodSchema = z2.object({
|
|
69
|
-
id: z2.string(),
|
|
70
|
-
nodeID: z2.string(),
|
|
71
|
-
inputs: WorkflowIOZodSchema,
|
|
72
|
-
outputs: WorkflowIOZodSchema.optional(),
|
|
73
|
-
data: WorkflowIOZodSchema,
|
|
74
|
-
branch: z2.string().optional()
|
|
75
|
-
});
|
|
76
|
-
var WorkflowStatusZodShape = {
|
|
77
|
-
status: z2.string(),
|
|
78
|
-
terminated: z2.boolean(),
|
|
79
|
-
startTime: z2.number(),
|
|
80
|
-
endTime: z2.number().optional(),
|
|
81
|
-
timeCost: z2.number()
|
|
82
|
-
};
|
|
83
|
-
var WorkflowStatusZodSchema = z2.object(WorkflowStatusZodShape);
|
|
84
|
-
var WorkflowZodSchema = {
|
|
85
|
-
Inputs: WorkflowIOZodSchema,
|
|
86
|
-
Outputs: WorkflowIOZodSchema,
|
|
87
|
-
Status: WorkflowStatusZodSchema,
|
|
88
|
-
Snapshot: WorkflowSnapshotZodSchema,
|
|
89
|
-
NodeReport: z2.object({
|
|
90
|
-
id: z2.string(),
|
|
91
|
-
...WorkflowStatusZodShape,
|
|
92
|
-
snapshots: z2.array(WorkflowSnapshotZodSchema)
|
|
93
|
-
})
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
// src/api/task-run/index.ts
|
|
97
93
|
var TaskRunDefine = {
|
|
98
94
|
name: "TaskRun" /* TaskRun */,
|
|
99
95
|
method: "POST" /* POST */,
|
|
@@ -141,7 +137,8 @@ var TaskReportDefine = {
|
|
|
141
137
|
inputs: WorkflowZodSchema.Inputs,
|
|
142
138
|
outputs: WorkflowZodSchema.Outputs,
|
|
143
139
|
workflowStatus: WorkflowZodSchema.Status,
|
|
144
|
-
reports:
|
|
140
|
+
reports: WorkflowZodSchema.Reports,
|
|
141
|
+
messages: WorkflowZodSchema.Messages
|
|
145
142
|
})
|
|
146
143
|
}
|
|
147
144
|
};
|
|
@@ -188,7 +185,7 @@ var FlowGramAPIs = {
|
|
|
188
185
|
["TaskReport" /* TaskReport */]: TaskReportDefine,
|
|
189
186
|
["TaskResult" /* TaskResult */]: TaskResultDefine,
|
|
190
187
|
["TaskCancel" /* TaskCancel */]: TaskCancelDefine,
|
|
191
|
-
["
|
|
188
|
+
["TaskValidate" /* TaskValidate */]: TaskValidateDefine
|
|
192
189
|
};
|
|
193
190
|
var FlowGramAPINames = Object.keys(FlowGramAPIs);
|
|
194
191
|
|
|
@@ -262,6 +259,16 @@ var WorkflowStatus = /* @__PURE__ */ ((WorkflowStatus2) => {
|
|
|
262
259
|
|
|
263
260
|
// src/runtime/validation/index.ts
|
|
264
261
|
var IValidation = Symbol.for("Validation");
|
|
262
|
+
|
|
263
|
+
// src/runtime/message/index.ts
|
|
264
|
+
var WorkflowMessageType = /* @__PURE__ */ ((WorkflowMessageType2) => {
|
|
265
|
+
WorkflowMessageType2["Log"] = "log";
|
|
266
|
+
WorkflowMessageType2["Info"] = "info";
|
|
267
|
+
WorkflowMessageType2["Debug"] = "debug";
|
|
268
|
+
WorkflowMessageType2["Error"] = "error";
|
|
269
|
+
WorkflowMessageType2["Warn"] = "warning";
|
|
270
|
+
return WorkflowMessageType2;
|
|
271
|
+
})(WorkflowMessageType || {});
|
|
265
272
|
export {
|
|
266
273
|
ConditionOperation,
|
|
267
274
|
FlowGramAPIMethod,
|
|
@@ -278,7 +285,8 @@ export {
|
|
|
278
285
|
TaskReportDefine,
|
|
279
286
|
TaskResultDefine,
|
|
280
287
|
TaskRunDefine,
|
|
281
|
-
|
|
288
|
+
TaskValidateDefine,
|
|
289
|
+
WorkflowMessageType,
|
|
282
290
|
WorkflowPortType,
|
|
283
291
|
WorkflowStatus,
|
|
284
292
|
WorkflowVariableType
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/validation/index.ts","../../src/api/constant.ts","../../src/api/task-run/index.ts","../../src/api/schema.ts","../../src/api/task-result/index.ts","../../src/api/task-report/index.ts","../../src/api/task-cancel/index.ts","../../src/api/server-info/index.ts","../../src/api/define.ts","../../src/schema/constant.ts","../../src/node/constant.ts","../../src/node/condition/constant.ts","../../src/runtime/engine/index.ts","../../src/runtime/executor/executor.ts","../../src/runtime/status/index.ts","../../src/runtime/validation/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { ValidationResult } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName } from '@api/constant';\n\nexport interface ValidationReq {\n schema: string;\n}\n\nexport interface ValidationRes extends ValidationResult {}\n\nexport const ValidationDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.Validation,\n method: FlowGramAPIMethod.POST,\n path: '/validation',\n module: FlowGramAPIModule.Validation,\n schema: {\n input: z.object({\n schema: z.string(),\n }),\n output: z.object({\n valid: z.boolean(),\n nodeErrors: z.array(\n z.object({\n message: z.string(),\n nodeID: z.string(),\n })\n ),\n edgeErrors: z.array(\n z.object({\n message: z.string(),\n edge: z.object({\n sourceNodeID: z.string(),\n targetNodeID: z.string(),\n sourcePortID: z.string().optional(),\n targetPortID: z.string().optional(),\n }),\n })\n ),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum FlowGramAPIMethod {\n GET = 'GET',\n POST = 'POST',\n PUT = 'PUT',\n DELETE = 'DELETE',\n PATCH = 'PATCH',\n}\n\nexport enum FlowGramAPIName {\n ServerInfo = 'ServerInfo',\n TaskRun = 'TaskRun',\n TaskReport = 'TaskReport',\n TaskResult = 'TaskResult',\n TaskCancel = 'TaskCancel',\n Validation = 'Validation',\n}\n\nexport enum FlowGramAPIModule {\n Info = 'Info',\n Task = 'Task',\n Validation = 'Validation',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { WorkflowInputs } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName } from '@api/constant';\n\nexport interface TaskRunInput {\n inputs: WorkflowInputs;\n schema: string;\n}\n\nexport interface TaskRunOutput {\n taskID: string;\n}\n\nexport const TaskRunDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskRun,\n method: FlowGramAPIMethod.POST,\n path: '/task/run',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n schema: z.string(),\n inputs: WorkflowZodSchema.Inputs,\n }),\n output: z.object({\n taskID: z.string(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nconst WorkflowIOZodSchema = z.record(z.string(), z.any());\nconst WorkflowSnapshotZodSchema = z.object({\n id: z.string(),\n nodeID: z.string(),\n inputs: WorkflowIOZodSchema,\n outputs: WorkflowIOZodSchema.optional(),\n data: WorkflowIOZodSchema,\n branch: z.string().optional(),\n});\nconst WorkflowStatusZodShape = {\n status: z.string(),\n terminated: z.boolean(),\n startTime: z.number(),\n endTime: z.number().optional(),\n timeCost: z.number(),\n};\nconst WorkflowStatusZodSchema = z.object(WorkflowStatusZodShape);\n\nexport const WorkflowZodSchema = {\n Inputs: WorkflowIOZodSchema,\n Outputs: WorkflowIOZodSchema,\n Status: WorkflowStatusZodSchema,\n Snapshot: WorkflowSnapshotZodSchema,\n NodeReport: z.object({\n id: z.string(),\n ...WorkflowStatusZodShape,\n snapshots: z.array(WorkflowSnapshotZodSchema),\n }),\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { WorkflowOutputs } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIName, FlowGramAPIMethod, FlowGramAPIModule } from '@api/constant';\n\nexport interface TaskResultInput {\n taskID: string;\n}\n\nexport type TaskResultOutput = WorkflowOutputs | undefined;\n\nexport const TaskResultDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskResult,\n method: FlowGramAPIMethod.GET,\n path: '/task/result',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n taskID: z.string(),\n }),\n output: WorkflowZodSchema.Outputs,\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { IReport } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIName, FlowGramAPIMethod, FlowGramAPIModule } from '@api/constant';\n\nexport interface TaskReportInput {\n taskID: string;\n}\n\nexport type TaskReportOutput = IReport | undefined;\n\nexport const TaskReportDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskReport,\n method: FlowGramAPIMethod.GET,\n path: '/task/report',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n taskID: z.string(),\n }),\n output: z.object({\n id: z.string(),\n inputs: WorkflowZodSchema.Inputs,\n outputs: WorkflowZodSchema.Outputs,\n workflowStatus: WorkflowZodSchema.Status,\n reports: z.record(z.string(), WorkflowZodSchema.NodeReport),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { FlowGramAPIDefine } from '@api/type';\nimport { FlowGramAPIName, FlowGramAPIMethod, FlowGramAPIModule } from '@api/constant';\n\nexport interface TaskCancelInput {\n taskID: string;\n}\n\nexport type TaskCancelOutput = {\n success: boolean;\n};\n\nexport const TaskCancelDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskCancel,\n method: FlowGramAPIMethod.PUT,\n path: '/task/cancel',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n taskID: z.string(),\n }),\n output: z.object({\n success: z.boolean(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { type FlowGramAPIDefine } from '@api/type';\nimport { FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName } from '@api/constant';\n\nexport interface ServerInfoInput {}\n\nexport interface ServerInfoOutput {\n name: string;\n title: string;\n description: string;\n runtime: string;\n version: string;\n time: string;\n}\n\nexport const ServerInfoDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.ServerInfo,\n method: FlowGramAPIMethod.GET,\n path: '/info',\n module: FlowGramAPIModule.Info,\n schema: {\n input: z.undefined(),\n output: z.object({\n name: z.string(),\n runtime: z.string(),\n version: z.string(),\n time: z.string(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ValidationDefine } from './validation';\nimport { FlowGramAPIDefines } from './type';\nimport { TaskRunDefine } from './task-run';\nimport { TaskResultDefine } from './task-result';\nimport { TaskReportDefine } from './task-report';\nimport { TaskCancelDefine } from './task-cancel';\nimport { ServerInfoDefine } from './server-info';\nimport { FlowGramAPIName } from './constant';\n\nexport const FlowGramAPIs: FlowGramAPIDefines = {\n [FlowGramAPIName.ServerInfo]: ServerInfoDefine,\n [FlowGramAPIName.TaskRun]: TaskRunDefine,\n [FlowGramAPIName.TaskReport]: TaskReportDefine,\n [FlowGramAPIName.TaskResult]: TaskResultDefine,\n [FlowGramAPIName.TaskCancel]: TaskCancelDefine,\n [FlowGramAPIName.Validation]: ValidationDefine,\n};\n\nexport const FlowGramAPINames = Object.keys(FlowGramAPIs) as FlowGramAPIName[];\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum WorkflowPortType {\n Input = 'input',\n Output = 'output',\n}\n\nexport enum WorkflowVariableType {\n String = 'string',\n Integer = 'integer',\n Number = 'number',\n Boolean = 'boolean',\n Object = 'object',\n Array = 'array',\n Null = 'null',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum FlowGramNode {\n Root = 'root',\n Start = 'start',\n End = 'end',\n LLM = 'llm',\n code = 'code',\n Condition = 'condition',\n Loop = 'loop',\n Comment = 'comment',\n Group = 'group',\n BlockStart = 'block-start',\n BlockEnd = 'block-end',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum ConditionOperation {\n EQ = 'eq',\n NEQ = 'neq',\n GT = 'gt',\n GTE = 'gte',\n LT = 'lt',\n LTE = 'lte',\n IN = 'in',\n NIN = 'nin',\n CONTAINS = 'contains',\n NOT_CONTAINS = 'not_contains',\n IS_EMPTY = 'is_empty',\n IS_NOT_EMPTY = 'is_not_empty',\n IS_TRUE = 'is_true',\n IS_FALSE = 'is_false',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ITask } from '../task';\nimport { IExecutor } from '../executor';\nimport { INode } from '../document';\nimport { IContext } from '../context';\nimport { InvokeParams } from '../base';\n\nexport interface EngineServices {\n Executor: IExecutor;\n}\n\nexport interface IEngine {\n invoke(params: InvokeParams): ITask;\n executeNode(params: { context: IContext; node: INode }): Promise<void>;\n}\n\nexport const IEngine = Symbol.for('Engine');\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ExecutionContext, ExecutionResult, INodeExecutor } from './node-executor';\n\nexport interface IExecutor {\n execute: (context: ExecutionContext) => Promise<ExecutionResult>;\n register: (executor: INodeExecutor) => void;\n}\n\nexport const IExecutor = Symbol.for('Executor');\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum WorkflowStatus {\n Pending = 'pending',\n Processing = 'processing',\n Succeeded = 'succeeded',\n Failed = 'failed',\n Canceled = 'canceled',\n}\n\nexport interface StatusData {\n status: WorkflowStatus;\n terminated: boolean;\n startTime: number;\n endTime?: number;\n timeCost: number;\n}\n\nexport interface IStatus extends StatusData {\n id: string;\n process(): void;\n success(): void;\n fail(): void;\n cancel(): void;\n export(): StatusData;\n}\n\nexport interface IStatusCenter {\n workflow: IStatus;\n nodeStatus(nodeID: string): IStatus;\n init(): void;\n dispose(): void;\n getStatusNodeIDs(status: WorkflowStatus): string[];\n exportNodeStatus(): Record<string, StatusData>;\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowSchema } from '@schema/index';\n\nexport interface ValidationResult {\n valid: boolean;\n errors?: string[];\n}\n\nexport interface IValidation {\n validate(schema: WorkflowSchema): ValidationResult;\n}\n\nexport const IValidation = Symbol.for('Validation');\n"],"mappings":";AAKA,OAAO,OAAO;;;ACAP,IAAK,oBAAL,kBAAKA,uBAAL;AACL,EAAAA,mBAAA,SAAM;AACN,EAAAA,mBAAA,UAAO;AACP,EAAAA,mBAAA,SAAM;AACN,EAAAA,mBAAA,YAAS;AACT,EAAAA,mBAAA,WAAQ;AALE,SAAAA;AAAA,GAAA;AAQL,IAAK,kBAAL,kBAAKC,qBAAL;AACL,EAAAA,iBAAA,gBAAa;AACb,EAAAA,iBAAA,aAAU;AACV,EAAAA,iBAAA,gBAAa;AACb,EAAAA,iBAAA,gBAAa;AACb,EAAAA,iBAAA,gBAAa;AACb,EAAAA,iBAAA,gBAAa;AANH,SAAAA;AAAA,GAAA;AASL,IAAK,oBAAL,kBAAKC,uBAAL;AACL,EAAAA,mBAAA,UAAO;AACP,EAAAA,mBAAA,UAAO;AACP,EAAAA,mBAAA,gBAAa;AAHH,SAAAA;AAAA,GAAA;;;ADLL,IAAM,mBAAsC;AAAA,EACjD;AAAA,EACA;AAAA,EACA,MAAM;AAAA,EACN;AAAA,EACA,QAAQ;AAAA,IACN,OAAO,EAAE,OAAO;A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AACP,EAAAA,cAAA,eAAY;AACZ,EAAAA,cAAA,UAAO;AACP,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,WAAQ;AACR,EAAAA,cAAA,gBAAa;AACb,EAAAA,cAAA,cAAW;AAXD,SAAAA;AAAA,GAAA;;;ACAL,IAAK,qBAAL,kBAAKC,wBAAL;AACL,EAAAA,oBAAA,QAAK;AACL,EAAAA,oBAAA,SAAM;AACN,EAAAA,oBAAA,QAAK;AACL,EAAAA,oBAAA,SAAM;AACN,EAAAA,oBAAA,QAAK;AACL,EAAAA,oBAAA,SAAM;AACN,EAAAA,oBAAA,QAAK;AACL,EAAAA,oBAAA,SAAM;AACN,EAAAA,oBAAA,cAAW;AACX,EAAAA,oBAAA,kBAAe;AACf,EAAAA,oBAAA,cAAW;AACX,EAAAA,oBAAA,kBAAe;AACf,EAAAA,oBAAA,aAAU;AACV,EAAAA,oBAAA,cAAW;AAdD,SAAAA;AAAA,GAAA;;;ACeL,IAAM,UAAU,OAAO,IAAI,QAAQ;;;ACRnC,IAAM,YAAY,OAAO,IAAI,UAAU;;;ACPvC,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,gBAAa;AACb,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,YAAS;AACT,EAAAA,gBAAA,cAAW;AALD,SAAAA;AAAA,GAAA;;;ACWL,IAAM,cAAc,OAAO,IAAI,YAAY;","names":["FlowGramAPIMethod","FlowGramAPIName","FlowGramAPIModule","z","z","z","z","z","z","z","z","z","z","z","WorkflowPortType","WorkflowVariableType","FlowGramNode","ConditionOperation","WorkflowStatus"]}
|
|
1
|
+
{"version":3,"sources":["../../src/api/task-validate/index.ts","../../src/api/schema.ts","../../src/api/constant.ts","../../src/api/task-run/index.ts","../../src/api/task-result/index.ts","../../src/api/task-report/index.ts","../../src/api/task-cancel/index.ts","../../src/api/server-info/index.ts","../../src/api/define.ts","../../src/schema/constant.ts","../../src/node/constant.ts","../../src/node/condition/constant.ts","../../src/runtime/engine/index.ts","../../src/runtime/executor/executor.ts","../../src/runtime/status/index.ts","../../src/runtime/validation/index.ts","../../src/runtime/message/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { ValidationResult, WorkflowInputs } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName } from '@api/constant';\n\nexport interface TaskValidateInput {\n inputs: WorkflowInputs;\n schema: string;\n}\n\nexport interface TaskValidateOutput extends ValidationResult {}\n\nexport const TaskValidateDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskValidate,\n method: FlowGramAPIMethod.POST,\n path: '/task/validate',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n schema: z.string(),\n inputs: WorkflowZodSchema.Inputs,\n }),\n output: z.object({\n valid: z.boolean(),\n errors: z.array(z.string()).optional(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nconst WorkflowIOZodSchema = z.record(z.string(), z.any());\n\nconst WorkflowSnapshotZodSchema = z.object({\n id: z.string(),\n nodeID: z.string(),\n inputs: WorkflowIOZodSchema,\n outputs: WorkflowIOZodSchema.optional(),\n data: WorkflowIOZodSchema,\n branch: z.string().optional(),\n});\n\nconst WorkflowStatusZodShape = {\n status: z.string(),\n terminated: z.boolean(),\n startTime: z.number(),\n endTime: z.number().optional(),\n timeCost: z.number(),\n};\nconst WorkflowStatusZodSchema = z.object(WorkflowStatusZodShape);\n\nconst WorkflowNodeReportZodSchema = z.object({\n id: z.string(),\n ...WorkflowStatusZodShape,\n snapshots: z.array(WorkflowSnapshotZodSchema),\n});\n\nconst WorkflowReportsZodSchema = z.record(z.string(), WorkflowNodeReportZodSchema);\n\nconst WorkflowMessageZodSchema = z.object({\n id: z.string(),\n type: z.enum(['log', 'info', 'debug', 'error', 'warning']),\n message: z.string(),\n nodeID: z.string().optional(),\n timestamp: z.number(),\n});\n\nconst WorkflowMessagesZodSchema = z.record(\n z.enum(['log', 'info', 'debug', 'error', 'warning']),\n z.array(WorkflowMessageZodSchema)\n);\n\nexport const WorkflowZodSchema = {\n Inputs: WorkflowIOZodSchema,\n Outputs: WorkflowIOZodSchema,\n Status: WorkflowStatusZodSchema,\n Snapshot: WorkflowSnapshotZodSchema,\n Reports: WorkflowReportsZodSchema,\n Messages: WorkflowMessagesZodSchema,\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum FlowGramAPIMethod {\n GET = 'GET',\n POST = 'POST',\n PUT = 'PUT',\n DELETE = 'DELETE',\n PATCH = 'PATCH',\n}\n\nexport enum FlowGramAPIName {\n ServerInfo = 'ServerInfo',\n TaskRun = 'TaskRun',\n TaskReport = 'TaskReport',\n TaskResult = 'TaskResult',\n TaskCancel = 'TaskCancel',\n TaskValidate = 'TaskValidate',\n}\n\nexport enum FlowGramAPIModule {\n Info = 'Info',\n Task = 'Task',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { WorkflowInputs } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName } from '@api/constant';\n\nexport interface TaskRunInput {\n inputs: WorkflowInputs;\n schema: string;\n}\n\nexport interface TaskRunOutput {\n taskID: string;\n}\n\nexport const TaskRunDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskRun,\n method: FlowGramAPIMethod.POST,\n path: '/task/run',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n schema: z.string(),\n inputs: WorkflowZodSchema.Inputs,\n }),\n output: z.object({\n taskID: z.string(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { WorkflowOutputs } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIName, FlowGramAPIMethod, FlowGramAPIModule } from '@api/constant';\n\nexport interface TaskResultInput {\n taskID: string;\n}\n\nexport type TaskResultOutput = WorkflowOutputs | undefined;\n\nexport const TaskResultDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskResult,\n method: FlowGramAPIMethod.GET,\n path: '/task/result',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n taskID: z.string(),\n }),\n output: WorkflowZodSchema.Outputs,\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { IReport } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIName, FlowGramAPIMethod, FlowGramAPIModule } from '@api/constant';\n\nexport interface TaskReportInput {\n taskID: string;\n}\n\nexport type TaskReportOutput = IReport | undefined;\n\nexport const TaskReportDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskReport,\n method: FlowGramAPIMethod.GET,\n path: '/task/report',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n taskID: z.string(),\n }),\n output: z.object({\n id: z.string(),\n inputs: WorkflowZodSchema.Inputs,\n outputs: WorkflowZodSchema.Outputs,\n workflowStatus: WorkflowZodSchema.Status,\n reports: WorkflowZodSchema.Reports,\n messages: WorkflowZodSchema.Messages,\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { FlowGramAPIDefine } from '@api/type';\nimport { FlowGramAPIName, FlowGramAPIMethod, FlowGramAPIModule } from '@api/constant';\n\nexport interface TaskCancelInput {\n taskID: string;\n}\n\nexport type TaskCancelOutput = {\n success: boolean;\n};\n\nexport const TaskCancelDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskCancel,\n method: FlowGramAPIMethod.PUT,\n path: '/task/cancel',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n taskID: z.string(),\n }),\n output: z.object({\n success: z.boolean(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { type FlowGramAPIDefine } from '@api/type';\nimport { FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName } from '@api/constant';\n\nexport interface ServerInfoInput {}\n\nexport interface ServerInfoOutput {\n name: string;\n title: string;\n description: string;\n runtime: string;\n version: string;\n time: string;\n}\n\nexport const ServerInfoDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.ServerInfo,\n method: FlowGramAPIMethod.GET,\n path: '/info',\n module: FlowGramAPIModule.Info,\n schema: {\n input: z.undefined(),\n output: z.object({\n name: z.string(),\n runtime: z.string(),\n version: z.string(),\n time: z.string(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { FlowGramAPIDefines } from './type';\nimport { TaskValidateDefine } from './task-validate';\nimport { TaskRunDefine } from './task-run';\nimport { TaskResultDefine } from './task-result';\nimport { TaskReportDefine } from './task-report';\nimport { TaskCancelDefine } from './task-cancel';\nimport { ServerInfoDefine } from './server-info';\nimport { FlowGramAPIName } from './constant';\n\nexport const FlowGramAPIs: FlowGramAPIDefines = {\n [FlowGramAPIName.ServerInfo]: ServerInfoDefine,\n [FlowGramAPIName.TaskRun]: TaskRunDefine,\n [FlowGramAPIName.TaskReport]: TaskReportDefine,\n [FlowGramAPIName.TaskResult]: TaskResultDefine,\n [FlowGramAPIName.TaskCancel]: TaskCancelDefine,\n [FlowGramAPIName.TaskValidate]: TaskValidateDefine,\n};\n\nexport const FlowGramAPINames = Object.keys(FlowGramAPIs) as FlowGramAPIName[];\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum WorkflowPortType {\n Input = 'input',\n Output = 'output',\n}\n\nexport enum WorkflowVariableType {\n String = 'string',\n Integer = 'integer',\n Number = 'number',\n Boolean = 'boolean',\n Object = 'object',\n Array = 'array',\n Null = 'null',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum FlowGramNode {\n Root = 'root',\n Start = 'start',\n End = 'end',\n LLM = 'llm',\n code = 'code',\n Condition = 'condition',\n Loop = 'loop',\n Comment = 'comment',\n Group = 'group',\n BlockStart = 'block-start',\n BlockEnd = 'block-end',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum ConditionOperation {\n EQ = 'eq',\n NEQ = 'neq',\n GT = 'gt',\n GTE = 'gte',\n LT = 'lt',\n LTE = 'lte',\n IN = 'in',\n NIN = 'nin',\n CONTAINS = 'contains',\n NOT_CONTAINS = 'not_contains',\n IS_EMPTY = 'is_empty',\n IS_NOT_EMPTY = 'is_not_empty',\n IS_TRUE = 'is_true',\n IS_FALSE = 'is_false',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IValidation } from '@runtime/validation';\nimport { ITask } from '../task';\nimport { IExecutor } from '../executor';\nimport { INode } from '../document';\nimport { IContext } from '../context';\nimport { InvokeParams } from '../base';\n\nexport interface EngineServices {\n Validation: IValidation;\n Executor: IExecutor;\n}\n\nexport interface IEngine {\n invoke(params: InvokeParams): ITask;\n executeNode(params: { context: IContext; node: INode }): Promise<void>;\n}\n\nexport const IEngine = Symbol.for('Engine');\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ExecutionContext, ExecutionResult, INodeExecutor } from './node-executor';\n\nexport interface IExecutor {\n execute: (context: ExecutionContext) => Promise<ExecutionResult>;\n register: (executor: INodeExecutor) => void;\n}\n\nexport const IExecutor = Symbol.for('Executor');\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum WorkflowStatus {\n Pending = 'pending',\n Processing = 'processing',\n Succeeded = 'succeeded',\n Failed = 'failed',\n Canceled = 'canceled',\n}\n\nexport interface StatusData {\n status: WorkflowStatus;\n terminated: boolean;\n startTime: number;\n endTime?: number;\n timeCost: number;\n}\n\nexport interface IStatus extends StatusData {\n id: string;\n process(): void;\n success(): void;\n fail(): void;\n cancel(): void;\n export(): StatusData;\n}\n\nexport interface IStatusCenter {\n workflow: IStatus;\n nodeStatus(nodeID: string): IStatus;\n init(): void;\n dispose(): void;\n getStatusNodeIDs(status: WorkflowStatus): string[];\n exportNodeStatus(): Record<string, StatusData>;\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { InvokeParams } from '@runtime/base';\n\nexport interface ValidationResult {\n valid: boolean;\n errors?: string[];\n}\n\nexport interface IValidation {\n invoke(params: InvokeParams): ValidationResult;\n}\n\nexport const IValidation = Symbol.for('Validation');\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum WorkflowMessageType {\n Log = 'log',\n Info = 'info',\n Debug = 'debug',\n Error = 'error',\n Warn = 'warning',\n}\n\nexport interface MessageData {\n message: string;\n nodeID?: string;\n timestamp?: number;\n}\n\nexport interface IMessage extends MessageData {\n id: string;\n type: WorkflowMessageType;\n timestamp: number;\n}\n\nexport type WorkflowMessages = Record<WorkflowMessageType, IMessage[]>;\n\nexport interface IMessageCenter {\n init(): void;\n dispose(): void;\n log(data: MessageData): IMessage;\n info(data: MessageData): IMessage;\n debug(data: MessageData): IMessage;\n error(data: MessageData): IMessage;\n warn(data: MessageData): IMessage;\n export(): WorkflowMessages;\n}\n"],"mappings":";AAKA,OAAOA,QAAO;;;ACAd,OAAO,OAAO;AAEd,IAAM,sBAAsB,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC;AAExD,IAAM,4BAA4B,EAAE,OAAO;AAAA,EACzC,IAAI,EAAE,OAAO;AAAA,EACb,QAAQ,EAAE,OAAO;AAAA,EACjB,QAAQ;AAAA,EACR,SAAS,oBAAoB,SAAS;AAAA,EACtC,MAAM;AAAA,EACN,QAAQ,EAAE,OAAO,EAAE,SAAS;AAC9B,CAAC;AAED,IAAM,yBAAyB;AAAA,EAC7B,QAAQ,EAAE,OAAO;AAAA,EACjB,YAAY,EAAE,QAAQ;AAAA,EACtB,WAAW,EAAE,OAAO;AAAA,EACpB,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,UAAU,EAAE,OAAO;AACrB;AACA,IAAM,0BAA0B,EAAE,OAAO,sBAAsB;AAE/D,IAAM,8BAA8B,EAAE,OAAO;AAAA,EAC3C,IAAI,EAAE,OAAO;AAAA,EACb,GAAG;AAAA,EACH,WAAW,EAAE,MAAM,yBAAyB;AAC9C,CAAC;AAED,IAAM,2BAA2B,EAAE,OAAO,EAAE,OAAO,GAAG,2BAA2B;AAEjF,IAAM,2BAA2B,EAAE,OAAO;AAAA,EACxC,IAAI,EAAE,OAAO;AAAA,EACb,MAAM,EAAE,KAAK,CAAC,OAAO,QAAQ,SAAS,SAAS,SAAS,CAAC;AAAA,EACzD,SAAS,EAAE,OAAO;AAAA,EAClB,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,WAAW,EAAE,OAAO;AACtB,CAAC;AAED,IAAM,4BAA4B,EAAE;A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AM;AACN,EAAAA,oBAAA,QAAK;AACL,EAAAA,oBAAA,SAAM;AACN,EAAAA,oBAAA,QAAK;AACL,EAAAA,oBAAA,SAAM;AACN,EAAAA,oBAAA,QAAK;AACL,EAAAA,oBAAA,SAAM;AACN,EAAAA,oBAAA,cAAW;AACX,EAAAA,oBAAA,kBAAe;AACf,EAAAA,oBAAA,cAAW;AACX,EAAAA,oBAAA,kBAAe;AACf,EAAAA,oBAAA,aAAU;AACV,EAAAA,oBAAA,cAAW;AAdD,SAAAA;AAAA,GAAA;;;ACiBL,IAAM,UAAU,OAAO,IAAI,QAAQ;;;ACVnC,IAAM,YAAY,OAAO,IAAI,UAAU;;;ACPvC,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,gBAAa;AACb,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,YAAS;AACT,EAAAA,gBAAA,cAAW;AALD,SAAAA;AAAA,GAAA;;;ACWL,IAAM,cAAc,OAAO,IAAI,YAAY;;;ACX3C,IAAK,sBAAL,kBAAKC,yBAAL;AACL,EAAAA,qBAAA,SAAM;AACN,EAAAA,qBAAA,UAAO;AACP,EAAAA,qBAAA,WAAQ;AACR,EAAAA,qBAAA,WAAQ;AACR,EAAAA,qBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;","names":["z","FlowGramAPIMethod","FlowGramAPIName","FlowGramAPIModule","z","z","z","z","z","z","z","z","z","z","z","WorkflowPortType","WorkflowVariableType","FlowGramNode","ConditionOperation","WorkflowStatus","WorkflowMessageType"]}
|
|
@@ -17,12 +17,11 @@ declare enum FlowGramAPIName {
|
|
|
17
17
|
TaskReport = "TaskReport",
|
|
18
18
|
TaskResult = "TaskResult",
|
|
19
19
|
TaskCancel = "TaskCancel",
|
|
20
|
-
|
|
20
|
+
TaskValidate = "TaskValidate"
|
|
21
21
|
}
|
|
22
22
|
declare enum FlowGramAPIModule {
|
|
23
23
|
Info = "Info",
|
|
24
|
-
Task = "Task"
|
|
25
|
-
Validation = "Validation"
|
|
24
|
+
Task = "Task"
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
/**
|
|
@@ -212,6 +211,20 @@ interface InvokeParams {
|
|
|
212
211
|
}
|
|
213
212
|
type WorkflowRuntimeInvoke = (params: InvokeParams) => Promise<WorkflowInputs>;
|
|
214
213
|
|
|
214
|
+
/**
|
|
215
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
216
|
+
* SPDX-License-Identifier: MIT
|
|
217
|
+
*/
|
|
218
|
+
|
|
219
|
+
interface ValidationResult {
|
|
220
|
+
valid: boolean;
|
|
221
|
+
errors?: string[];
|
|
222
|
+
}
|
|
223
|
+
interface IValidation {
|
|
224
|
+
invoke(params: InvokeParams): ValidationResult;
|
|
225
|
+
}
|
|
226
|
+
declare const IValidation: unique symbol;
|
|
227
|
+
|
|
215
228
|
/**
|
|
216
229
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
217
230
|
* SPDX-License-Identifier: MIT
|
|
@@ -290,63 +303,6 @@ interface IStatusCenter {
|
|
|
290
303
|
exportNodeStatus(): Record<string, StatusData>;
|
|
291
304
|
}
|
|
292
305
|
|
|
293
|
-
/**
|
|
294
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
295
|
-
* SPDX-License-Identifier: MIT
|
|
296
|
-
*/
|
|
297
|
-
|
|
298
|
-
interface SnapshotData {
|
|
299
|
-
nodeID: string;
|
|
300
|
-
inputs: WorkflowInputs;
|
|
301
|
-
outputs: WorkflowOutputs;
|
|
302
|
-
data: any;
|
|
303
|
-
branch?: string;
|
|
304
|
-
}
|
|
305
|
-
interface Snapshot extends SnapshotData {
|
|
306
|
-
id: string;
|
|
307
|
-
}
|
|
308
|
-
interface ISnapshot {
|
|
309
|
-
id: string;
|
|
310
|
-
data: Partial<SnapshotData>;
|
|
311
|
-
addData(data: Partial<SnapshotData>): void;
|
|
312
|
-
validate(): boolean;
|
|
313
|
-
export(): Snapshot;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
318
|
-
* SPDX-License-Identifier: MIT
|
|
319
|
-
*/
|
|
320
|
-
|
|
321
|
-
interface ISnapshotCenter {
|
|
322
|
-
id: string;
|
|
323
|
-
create(snapshot: Partial<SnapshotData>): ISnapshot;
|
|
324
|
-
exportAll(): Snapshot[];
|
|
325
|
-
export(): Record<string, Snapshot[]>;
|
|
326
|
-
init(): void;
|
|
327
|
-
dispose(): void;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
332
|
-
* SPDX-License-Identifier: MIT
|
|
333
|
-
*/
|
|
334
|
-
|
|
335
|
-
interface IOData {
|
|
336
|
-
inputs: WorkflowInputs;
|
|
337
|
-
outputs: WorkflowOutputs;
|
|
338
|
-
}
|
|
339
|
-
/** Input & Output */
|
|
340
|
-
interface IIOCenter {
|
|
341
|
-
inputs: WorkflowInputs;
|
|
342
|
-
outputs: WorkflowOutputs;
|
|
343
|
-
setInputs(inputs: WorkflowInputs): void;
|
|
344
|
-
setOutputs(outputs: WorkflowOutputs): void;
|
|
345
|
-
init(inputs: WorkflowInputs): void;
|
|
346
|
-
dispose(): void;
|
|
347
|
-
export(): IOData;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
306
|
/**
|
|
351
307
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
352
308
|
* SPDX-License-Identifier: MIT
|
|
@@ -480,6 +436,77 @@ interface IState {
|
|
|
480
436
|
addExecutedNode(node: INode): void;
|
|
481
437
|
}
|
|
482
438
|
|
|
439
|
+
/**
|
|
440
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
441
|
+
* SPDX-License-Identifier: MIT
|
|
442
|
+
*/
|
|
443
|
+
|
|
444
|
+
interface SnapshotData {
|
|
445
|
+
nodeID: string;
|
|
446
|
+
inputs: WorkflowInputs;
|
|
447
|
+
outputs: WorkflowOutputs;
|
|
448
|
+
data: any;
|
|
449
|
+
branch?: string;
|
|
450
|
+
error?: string;
|
|
451
|
+
}
|
|
452
|
+
interface Snapshot extends SnapshotData {
|
|
453
|
+
id: string;
|
|
454
|
+
}
|
|
455
|
+
interface ISnapshot {
|
|
456
|
+
id: string;
|
|
457
|
+
data: Partial<SnapshotData>;
|
|
458
|
+
update(data: Partial<SnapshotData>): void;
|
|
459
|
+
validate(): boolean;
|
|
460
|
+
export(): Snapshot;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
465
|
+
* SPDX-License-Identifier: MIT
|
|
466
|
+
*/
|
|
467
|
+
|
|
468
|
+
interface ISnapshotCenter {
|
|
469
|
+
id: string;
|
|
470
|
+
create(snapshot: Partial<SnapshotData>): ISnapshot;
|
|
471
|
+
exportAll(): Snapshot[];
|
|
472
|
+
export(): Record<string, Snapshot[]>;
|
|
473
|
+
init(): void;
|
|
474
|
+
dispose(): void;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
479
|
+
* SPDX-License-Identifier: MIT
|
|
480
|
+
*/
|
|
481
|
+
declare enum WorkflowMessageType {
|
|
482
|
+
Log = "log",
|
|
483
|
+
Info = "info",
|
|
484
|
+
Debug = "debug",
|
|
485
|
+
Error = "error",
|
|
486
|
+
Warn = "warning"
|
|
487
|
+
}
|
|
488
|
+
interface MessageData {
|
|
489
|
+
message: string;
|
|
490
|
+
nodeID?: string;
|
|
491
|
+
timestamp?: number;
|
|
492
|
+
}
|
|
493
|
+
interface IMessage extends MessageData {
|
|
494
|
+
id: string;
|
|
495
|
+
type: WorkflowMessageType;
|
|
496
|
+
timestamp: number;
|
|
497
|
+
}
|
|
498
|
+
type WorkflowMessages = Record<WorkflowMessageType, IMessage[]>;
|
|
499
|
+
interface IMessageCenter {
|
|
500
|
+
init(): void;
|
|
501
|
+
dispose(): void;
|
|
502
|
+
log(data: MessageData): IMessage;
|
|
503
|
+
info(data: MessageData): IMessage;
|
|
504
|
+
debug(data: MessageData): IMessage;
|
|
505
|
+
error(data: MessageData): IMessage;
|
|
506
|
+
warn(data: MessageData): IMessage;
|
|
507
|
+
export(): WorkflowMessages;
|
|
508
|
+
}
|
|
509
|
+
|
|
483
510
|
/**
|
|
484
511
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
485
512
|
* SPDX-License-Identifier: MIT
|
|
@@ -489,21 +516,44 @@ interface NodeReport extends StatusData {
|
|
|
489
516
|
id: string;
|
|
490
517
|
snapshots: Snapshot[];
|
|
491
518
|
}
|
|
519
|
+
type WorkflowReports = Record<string, NodeReport>;
|
|
492
520
|
interface IReport {
|
|
493
521
|
id: string;
|
|
494
522
|
inputs: WorkflowInputs;
|
|
495
523
|
outputs: WorkflowOutputs;
|
|
496
524
|
workflowStatus: StatusData;
|
|
497
|
-
reports:
|
|
525
|
+
reports: WorkflowReports;
|
|
526
|
+
messages: WorkflowMessages;
|
|
498
527
|
}
|
|
499
528
|
interface IReporter {
|
|
500
529
|
snapshotCenter: ISnapshotCenter;
|
|
501
530
|
statusCenter: IStatusCenter;
|
|
531
|
+
messageCenter: IMessageCenter;
|
|
502
532
|
init(): void;
|
|
503
533
|
dispose(): void;
|
|
504
534
|
export(): IReport;
|
|
505
535
|
}
|
|
506
536
|
|
|
537
|
+
/**
|
|
538
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
539
|
+
* SPDX-License-Identifier: MIT
|
|
540
|
+
*/
|
|
541
|
+
|
|
542
|
+
interface IOData {
|
|
543
|
+
inputs: WorkflowInputs;
|
|
544
|
+
outputs: WorkflowOutputs;
|
|
545
|
+
}
|
|
546
|
+
/** Input & Output */
|
|
547
|
+
interface IIOCenter {
|
|
548
|
+
inputs: WorkflowInputs;
|
|
549
|
+
outputs: WorkflowOutputs;
|
|
550
|
+
setInputs(inputs: WorkflowInputs): void;
|
|
551
|
+
setOutputs(outputs: WorkflowOutputs): void;
|
|
552
|
+
init(inputs: WorkflowInputs): void;
|
|
553
|
+
dispose(): void;
|
|
554
|
+
export(): IOData;
|
|
555
|
+
}
|
|
556
|
+
|
|
507
557
|
/**
|
|
508
558
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
509
559
|
* SPDX-License-Identifier: MIT
|
|
@@ -516,6 +566,7 @@ interface ContextData {
|
|
|
516
566
|
ioCenter: IIOCenter;
|
|
517
567
|
snapshotCenter: ISnapshotCenter;
|
|
518
568
|
statusCenter: IStatusCenter;
|
|
569
|
+
messageCenter: IMessageCenter;
|
|
519
570
|
reporter: IReporter;
|
|
520
571
|
}
|
|
521
572
|
interface IContext extends ContextData {
|
|
@@ -676,6 +727,7 @@ declare const IExecutor: unique symbol;
|
|
|
676
727
|
*/
|
|
677
728
|
|
|
678
729
|
interface EngineServices {
|
|
730
|
+
Validation: IValidation;
|
|
679
731
|
Executor: IExecutor;
|
|
680
732
|
}
|
|
681
733
|
interface IEngine {
|
|
@@ -687,20 +739,6 @@ interface IEngine {
|
|
|
687
739
|
}
|
|
688
740
|
declare const IEngine: unique symbol;
|
|
689
741
|
|
|
690
|
-
/**
|
|
691
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
692
|
-
* SPDX-License-Identifier: MIT
|
|
693
|
-
*/
|
|
694
|
-
|
|
695
|
-
interface ValidationResult {
|
|
696
|
-
valid: boolean;
|
|
697
|
-
errors?: string[];
|
|
698
|
-
}
|
|
699
|
-
interface IValidation {
|
|
700
|
-
validate(schema: WorkflowSchema): ValidationResult;
|
|
701
|
-
}
|
|
702
|
-
declare const IValidation: unique symbol;
|
|
703
|
-
|
|
704
742
|
/**
|
|
705
743
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
706
744
|
* SPDX-License-Identifier: MIT
|
|
@@ -748,12 +786,13 @@ declare const TaskReportDefine: FlowGramAPIDefine;
|
|
|
748
786
|
* SPDX-License-Identifier: MIT
|
|
749
787
|
*/
|
|
750
788
|
|
|
751
|
-
interface
|
|
789
|
+
interface TaskValidateInput {
|
|
790
|
+
inputs: WorkflowInputs;
|
|
752
791
|
schema: string;
|
|
753
792
|
}
|
|
754
|
-
interface
|
|
793
|
+
interface TaskValidateOutput extends ValidationResult {
|
|
755
794
|
}
|
|
756
|
-
declare const
|
|
795
|
+
declare const TaskValidateDefine: FlowGramAPIDefine;
|
|
757
796
|
|
|
758
797
|
/**
|
|
759
798
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
@@ -789,6 +828,7 @@ interface IRuntimeClient {
|
|
|
789
828
|
[FlowGramAPIName.TaskReport]: (input: TaskReportInput) => Promise<TaskReportOutput | undefined>;
|
|
790
829
|
[FlowGramAPIName.TaskResult]: (input: TaskResultInput) => Promise<TaskResultOutput | undefined>;
|
|
791
830
|
[FlowGramAPIName.TaskCancel]: (input: TaskCancelInput) => Promise<TaskCancelOutput | undefined>;
|
|
831
|
+
[FlowGramAPIName.TaskValidate]: (input: TaskValidateInput) => Promise<TaskValidateOutput | undefined>;
|
|
792
832
|
}
|
|
793
833
|
|
|
794
|
-
export { type ConditionItem, type ConditionNodeSchema, ConditionOperation, type ContainerService, type ContextData, type CreateEdgeParams, type CreateNodeParams, type CreatePortParams, type EndNodeSchema, type EngineServices, type ExecutionContext, type ExecutionResult, type FlowGramAPIDefine, type FlowGramAPIDefines, FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName, FlowGramAPINames, FlowGramAPIs, FlowGramNode, type IBasicJsonSchema, type IContainer, type IContext, type IDocument, type IEdge, IEngine, IExecutor, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IIOCenter, type IJsonSchema, type INode, type INodeExecutor, type INodeExecutorFactory, type IOData, type IPort, type IReport, type IReporter, type IRuntimeClient, type ISnapshot, type ISnapshotCenter, type IState, type IStatus, type IStatusCenter, type ITask, IValidation, type IVariable, type IVariableParseResult, type IVariableStore, type InvokeParams, type JsonSchemaBasicType, type LLMNodeSchema, type LoopNodeSchema, type NodeReport, type NodeDeclare as NodeVariable, type PositionSchema, ServerInfoDefine, type ServerInfoInput, type ServerInfoOutput, type Snapshot, type SnapshotData, type StartNodeSchema, type StatusData, TaskCancelDefine, type TaskCancelInput, type TaskCancelOutput, type TaskParams, TaskReportDefine, type TaskReportInput, type TaskReportOutput, TaskResultDefine, type TaskResultInput, type TaskResultOutput, TaskRunDefine, type TaskRunInput, type TaskRunOutput, type
|
|
834
|
+
export { type ConditionItem, type ConditionNodeSchema, ConditionOperation, type ContainerService, type ContextData, type CreateEdgeParams, type CreateNodeParams, type CreatePortParams, type EndNodeSchema, type EngineServices, type ExecutionContext, type ExecutionResult, type FlowGramAPIDefine, type FlowGramAPIDefines, FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName, FlowGramAPINames, FlowGramAPIs, FlowGramNode, type IBasicJsonSchema, type IContainer, type IContext, type IDocument, type IEdge, IEngine, IExecutor, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IIOCenter, type IJsonSchema, type IMessage, type IMessageCenter, type INode, type INodeExecutor, type INodeExecutorFactory, type IOData, type IPort, type IReport, type IReporter, type IRuntimeClient, type ISnapshot, type ISnapshotCenter, type IState, type IStatus, type IStatusCenter, type ITask, IValidation, type IVariable, type IVariableParseResult, type IVariableStore, type InvokeParams, type JsonSchemaBasicType, type LLMNodeSchema, type LoopNodeSchema, type MessageData, type NodeReport, type NodeDeclare as NodeVariable, type PositionSchema, ServerInfoDefine, type ServerInfoInput, type ServerInfoOutput, type Snapshot, type SnapshotData, type StartNodeSchema, type StatusData, TaskCancelDefine, type TaskCancelInput, type TaskCancelOutput, type TaskParams, TaskReportDefine, type TaskReportInput, type TaskReportOutput, TaskResultDefine, type TaskResultInput, type TaskResultOutput, TaskRunDefine, type TaskRunInput, type TaskRunOutput, TaskValidateDefine, type TaskValidateInput, type TaskValidateOutput, type VOData, type ValidationResult, type WorkflowEdgeSchema, type WorkflowInputs, WorkflowMessageType, type WorkflowMessages, type WorkflowNodeMetaSchema, type WorkflowNodeSchema, type WorkflowOutputs, WorkflowPortType, type WorkflowReports, type WorkflowRuntimeInvoke, type WorkflowSchema, WorkflowStatus, WorkflowVariableType, type XYSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -17,12 +17,11 @@ declare enum FlowGramAPIName {
|
|
|
17
17
|
TaskReport = "TaskReport",
|
|
18
18
|
TaskResult = "TaskResult",
|
|
19
19
|
TaskCancel = "TaskCancel",
|
|
20
|
-
|
|
20
|
+
TaskValidate = "TaskValidate"
|
|
21
21
|
}
|
|
22
22
|
declare enum FlowGramAPIModule {
|
|
23
23
|
Info = "Info",
|
|
24
|
-
Task = "Task"
|
|
25
|
-
Validation = "Validation"
|
|
24
|
+
Task = "Task"
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
/**
|
|
@@ -212,6 +211,20 @@ interface InvokeParams {
|
|
|
212
211
|
}
|
|
213
212
|
type WorkflowRuntimeInvoke = (params: InvokeParams) => Promise<WorkflowInputs>;
|
|
214
213
|
|
|
214
|
+
/**
|
|
215
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
216
|
+
* SPDX-License-Identifier: MIT
|
|
217
|
+
*/
|
|
218
|
+
|
|
219
|
+
interface ValidationResult {
|
|
220
|
+
valid: boolean;
|
|
221
|
+
errors?: string[];
|
|
222
|
+
}
|
|
223
|
+
interface IValidation {
|
|
224
|
+
invoke(params: InvokeParams): ValidationResult;
|
|
225
|
+
}
|
|
226
|
+
declare const IValidation: unique symbol;
|
|
227
|
+
|
|
215
228
|
/**
|
|
216
229
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
217
230
|
* SPDX-License-Identifier: MIT
|
|
@@ -290,63 +303,6 @@ interface IStatusCenter {
|
|
|
290
303
|
exportNodeStatus(): Record<string, StatusData>;
|
|
291
304
|
}
|
|
292
305
|
|
|
293
|
-
/**
|
|
294
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
295
|
-
* SPDX-License-Identifier: MIT
|
|
296
|
-
*/
|
|
297
|
-
|
|
298
|
-
interface SnapshotData {
|
|
299
|
-
nodeID: string;
|
|
300
|
-
inputs: WorkflowInputs;
|
|
301
|
-
outputs: WorkflowOutputs;
|
|
302
|
-
data: any;
|
|
303
|
-
branch?: string;
|
|
304
|
-
}
|
|
305
|
-
interface Snapshot extends SnapshotData {
|
|
306
|
-
id: string;
|
|
307
|
-
}
|
|
308
|
-
interface ISnapshot {
|
|
309
|
-
id: string;
|
|
310
|
-
data: Partial<SnapshotData>;
|
|
311
|
-
addData(data: Partial<SnapshotData>): void;
|
|
312
|
-
validate(): boolean;
|
|
313
|
-
export(): Snapshot;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
318
|
-
* SPDX-License-Identifier: MIT
|
|
319
|
-
*/
|
|
320
|
-
|
|
321
|
-
interface ISnapshotCenter {
|
|
322
|
-
id: string;
|
|
323
|
-
create(snapshot: Partial<SnapshotData>): ISnapshot;
|
|
324
|
-
exportAll(): Snapshot[];
|
|
325
|
-
export(): Record<string, Snapshot[]>;
|
|
326
|
-
init(): void;
|
|
327
|
-
dispose(): void;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
332
|
-
* SPDX-License-Identifier: MIT
|
|
333
|
-
*/
|
|
334
|
-
|
|
335
|
-
interface IOData {
|
|
336
|
-
inputs: WorkflowInputs;
|
|
337
|
-
outputs: WorkflowOutputs;
|
|
338
|
-
}
|
|
339
|
-
/** Input & Output */
|
|
340
|
-
interface IIOCenter {
|
|
341
|
-
inputs: WorkflowInputs;
|
|
342
|
-
outputs: WorkflowOutputs;
|
|
343
|
-
setInputs(inputs: WorkflowInputs): void;
|
|
344
|
-
setOutputs(outputs: WorkflowOutputs): void;
|
|
345
|
-
init(inputs: WorkflowInputs): void;
|
|
346
|
-
dispose(): void;
|
|
347
|
-
export(): IOData;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
306
|
/**
|
|
351
307
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
352
308
|
* SPDX-License-Identifier: MIT
|
|
@@ -480,6 +436,77 @@ interface IState {
|
|
|
480
436
|
addExecutedNode(node: INode): void;
|
|
481
437
|
}
|
|
482
438
|
|
|
439
|
+
/**
|
|
440
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
441
|
+
* SPDX-License-Identifier: MIT
|
|
442
|
+
*/
|
|
443
|
+
|
|
444
|
+
interface SnapshotData {
|
|
445
|
+
nodeID: string;
|
|
446
|
+
inputs: WorkflowInputs;
|
|
447
|
+
outputs: WorkflowOutputs;
|
|
448
|
+
data: any;
|
|
449
|
+
branch?: string;
|
|
450
|
+
error?: string;
|
|
451
|
+
}
|
|
452
|
+
interface Snapshot extends SnapshotData {
|
|
453
|
+
id: string;
|
|
454
|
+
}
|
|
455
|
+
interface ISnapshot {
|
|
456
|
+
id: string;
|
|
457
|
+
data: Partial<SnapshotData>;
|
|
458
|
+
update(data: Partial<SnapshotData>): void;
|
|
459
|
+
validate(): boolean;
|
|
460
|
+
export(): Snapshot;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
465
|
+
* SPDX-License-Identifier: MIT
|
|
466
|
+
*/
|
|
467
|
+
|
|
468
|
+
interface ISnapshotCenter {
|
|
469
|
+
id: string;
|
|
470
|
+
create(snapshot: Partial<SnapshotData>): ISnapshot;
|
|
471
|
+
exportAll(): Snapshot[];
|
|
472
|
+
export(): Record<string, Snapshot[]>;
|
|
473
|
+
init(): void;
|
|
474
|
+
dispose(): void;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
479
|
+
* SPDX-License-Identifier: MIT
|
|
480
|
+
*/
|
|
481
|
+
declare enum WorkflowMessageType {
|
|
482
|
+
Log = "log",
|
|
483
|
+
Info = "info",
|
|
484
|
+
Debug = "debug",
|
|
485
|
+
Error = "error",
|
|
486
|
+
Warn = "warning"
|
|
487
|
+
}
|
|
488
|
+
interface MessageData {
|
|
489
|
+
message: string;
|
|
490
|
+
nodeID?: string;
|
|
491
|
+
timestamp?: number;
|
|
492
|
+
}
|
|
493
|
+
interface IMessage extends MessageData {
|
|
494
|
+
id: string;
|
|
495
|
+
type: WorkflowMessageType;
|
|
496
|
+
timestamp: number;
|
|
497
|
+
}
|
|
498
|
+
type WorkflowMessages = Record<WorkflowMessageType, IMessage[]>;
|
|
499
|
+
interface IMessageCenter {
|
|
500
|
+
init(): void;
|
|
501
|
+
dispose(): void;
|
|
502
|
+
log(data: MessageData): IMessage;
|
|
503
|
+
info(data: MessageData): IMessage;
|
|
504
|
+
debug(data: MessageData): IMessage;
|
|
505
|
+
error(data: MessageData): IMessage;
|
|
506
|
+
warn(data: MessageData): IMessage;
|
|
507
|
+
export(): WorkflowMessages;
|
|
508
|
+
}
|
|
509
|
+
|
|
483
510
|
/**
|
|
484
511
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
485
512
|
* SPDX-License-Identifier: MIT
|
|
@@ -489,21 +516,44 @@ interface NodeReport extends StatusData {
|
|
|
489
516
|
id: string;
|
|
490
517
|
snapshots: Snapshot[];
|
|
491
518
|
}
|
|
519
|
+
type WorkflowReports = Record<string, NodeReport>;
|
|
492
520
|
interface IReport {
|
|
493
521
|
id: string;
|
|
494
522
|
inputs: WorkflowInputs;
|
|
495
523
|
outputs: WorkflowOutputs;
|
|
496
524
|
workflowStatus: StatusData;
|
|
497
|
-
reports:
|
|
525
|
+
reports: WorkflowReports;
|
|
526
|
+
messages: WorkflowMessages;
|
|
498
527
|
}
|
|
499
528
|
interface IReporter {
|
|
500
529
|
snapshotCenter: ISnapshotCenter;
|
|
501
530
|
statusCenter: IStatusCenter;
|
|
531
|
+
messageCenter: IMessageCenter;
|
|
502
532
|
init(): void;
|
|
503
533
|
dispose(): void;
|
|
504
534
|
export(): IReport;
|
|
505
535
|
}
|
|
506
536
|
|
|
537
|
+
/**
|
|
538
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
539
|
+
* SPDX-License-Identifier: MIT
|
|
540
|
+
*/
|
|
541
|
+
|
|
542
|
+
interface IOData {
|
|
543
|
+
inputs: WorkflowInputs;
|
|
544
|
+
outputs: WorkflowOutputs;
|
|
545
|
+
}
|
|
546
|
+
/** Input & Output */
|
|
547
|
+
interface IIOCenter {
|
|
548
|
+
inputs: WorkflowInputs;
|
|
549
|
+
outputs: WorkflowOutputs;
|
|
550
|
+
setInputs(inputs: WorkflowInputs): void;
|
|
551
|
+
setOutputs(outputs: WorkflowOutputs): void;
|
|
552
|
+
init(inputs: WorkflowInputs): void;
|
|
553
|
+
dispose(): void;
|
|
554
|
+
export(): IOData;
|
|
555
|
+
}
|
|
556
|
+
|
|
507
557
|
/**
|
|
508
558
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
509
559
|
* SPDX-License-Identifier: MIT
|
|
@@ -516,6 +566,7 @@ interface ContextData {
|
|
|
516
566
|
ioCenter: IIOCenter;
|
|
517
567
|
snapshotCenter: ISnapshotCenter;
|
|
518
568
|
statusCenter: IStatusCenter;
|
|
569
|
+
messageCenter: IMessageCenter;
|
|
519
570
|
reporter: IReporter;
|
|
520
571
|
}
|
|
521
572
|
interface IContext extends ContextData {
|
|
@@ -676,6 +727,7 @@ declare const IExecutor: unique symbol;
|
|
|
676
727
|
*/
|
|
677
728
|
|
|
678
729
|
interface EngineServices {
|
|
730
|
+
Validation: IValidation;
|
|
679
731
|
Executor: IExecutor;
|
|
680
732
|
}
|
|
681
733
|
interface IEngine {
|
|
@@ -687,20 +739,6 @@ interface IEngine {
|
|
|
687
739
|
}
|
|
688
740
|
declare const IEngine: unique symbol;
|
|
689
741
|
|
|
690
|
-
/**
|
|
691
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
692
|
-
* SPDX-License-Identifier: MIT
|
|
693
|
-
*/
|
|
694
|
-
|
|
695
|
-
interface ValidationResult {
|
|
696
|
-
valid: boolean;
|
|
697
|
-
errors?: string[];
|
|
698
|
-
}
|
|
699
|
-
interface IValidation {
|
|
700
|
-
validate(schema: WorkflowSchema): ValidationResult;
|
|
701
|
-
}
|
|
702
|
-
declare const IValidation: unique symbol;
|
|
703
|
-
|
|
704
742
|
/**
|
|
705
743
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
706
744
|
* SPDX-License-Identifier: MIT
|
|
@@ -748,12 +786,13 @@ declare const TaskReportDefine: FlowGramAPIDefine;
|
|
|
748
786
|
* SPDX-License-Identifier: MIT
|
|
749
787
|
*/
|
|
750
788
|
|
|
751
|
-
interface
|
|
789
|
+
interface TaskValidateInput {
|
|
790
|
+
inputs: WorkflowInputs;
|
|
752
791
|
schema: string;
|
|
753
792
|
}
|
|
754
|
-
interface
|
|
793
|
+
interface TaskValidateOutput extends ValidationResult {
|
|
755
794
|
}
|
|
756
|
-
declare const
|
|
795
|
+
declare const TaskValidateDefine: FlowGramAPIDefine;
|
|
757
796
|
|
|
758
797
|
/**
|
|
759
798
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
@@ -789,6 +828,7 @@ interface IRuntimeClient {
|
|
|
789
828
|
[FlowGramAPIName.TaskReport]: (input: TaskReportInput) => Promise<TaskReportOutput | undefined>;
|
|
790
829
|
[FlowGramAPIName.TaskResult]: (input: TaskResultInput) => Promise<TaskResultOutput | undefined>;
|
|
791
830
|
[FlowGramAPIName.TaskCancel]: (input: TaskCancelInput) => Promise<TaskCancelOutput | undefined>;
|
|
831
|
+
[FlowGramAPIName.TaskValidate]: (input: TaskValidateInput) => Promise<TaskValidateOutput | undefined>;
|
|
792
832
|
}
|
|
793
833
|
|
|
794
|
-
export { type ConditionItem, type ConditionNodeSchema, ConditionOperation, type ContainerService, type ContextData, type CreateEdgeParams, type CreateNodeParams, type CreatePortParams, type EndNodeSchema, type EngineServices, type ExecutionContext, type ExecutionResult, type FlowGramAPIDefine, type FlowGramAPIDefines, FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName, FlowGramAPINames, FlowGramAPIs, FlowGramNode, type IBasicJsonSchema, type IContainer, type IContext, type IDocument, type IEdge, IEngine, IExecutor, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IIOCenter, type IJsonSchema, type INode, type INodeExecutor, type INodeExecutorFactory, type IOData, type IPort, type IReport, type IReporter, type IRuntimeClient, type ISnapshot, type ISnapshotCenter, type IState, type IStatus, type IStatusCenter, type ITask, IValidation, type IVariable, type IVariableParseResult, type IVariableStore, type InvokeParams, type JsonSchemaBasicType, type LLMNodeSchema, type LoopNodeSchema, type NodeReport, type NodeDeclare as NodeVariable, type PositionSchema, ServerInfoDefine, type ServerInfoInput, type ServerInfoOutput, type Snapshot, type SnapshotData, type StartNodeSchema, type StatusData, TaskCancelDefine, type TaskCancelInput, type TaskCancelOutput, type TaskParams, TaskReportDefine, type TaskReportInput, type TaskReportOutput, TaskResultDefine, type TaskResultInput, type TaskResultOutput, TaskRunDefine, type TaskRunInput, type TaskRunOutput, type
|
|
834
|
+
export { type ConditionItem, type ConditionNodeSchema, ConditionOperation, type ContainerService, type ContextData, type CreateEdgeParams, type CreateNodeParams, type CreatePortParams, type EndNodeSchema, type EngineServices, type ExecutionContext, type ExecutionResult, type FlowGramAPIDefine, type FlowGramAPIDefines, FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName, FlowGramAPINames, FlowGramAPIs, FlowGramNode, type IBasicJsonSchema, type IContainer, type IContext, type IDocument, type IEdge, IEngine, IExecutor, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IIOCenter, type IJsonSchema, type IMessage, type IMessageCenter, type INode, type INodeExecutor, type INodeExecutorFactory, type IOData, type IPort, type IReport, type IReporter, type IRuntimeClient, type ISnapshot, type ISnapshotCenter, type IState, type IStatus, type IStatusCenter, type ITask, IValidation, type IVariable, type IVariableParseResult, type IVariableStore, type InvokeParams, type JsonSchemaBasicType, type LLMNodeSchema, type LoopNodeSchema, type MessageData, type NodeReport, type NodeDeclare as NodeVariable, type PositionSchema, ServerInfoDefine, type ServerInfoInput, type ServerInfoOutput, type Snapshot, type SnapshotData, type StartNodeSchema, type StatusData, TaskCancelDefine, type TaskCancelInput, type TaskCancelOutput, type TaskParams, TaskReportDefine, type TaskReportInput, type TaskReportOutput, TaskResultDefine, type TaskResultInput, type TaskResultOutput, TaskRunDefine, type TaskRunInput, type TaskRunOutput, TaskValidateDefine, type TaskValidateInput, type TaskValidateOutput, type VOData, type ValidationResult, type WorkflowEdgeSchema, type WorkflowInputs, WorkflowMessageType, type WorkflowMessages, type WorkflowNodeMetaSchema, type WorkflowNodeSchema, type WorkflowOutputs, WorkflowPortType, type WorkflowReports, type WorkflowRuntimeInvoke, type WorkflowSchema, WorkflowStatus, WorkflowVariableType, type XYSchema };
|
package/dist/index.js
CHANGED
|
@@ -45,15 +45,61 @@ __export(src_exports, {
|
|
|
45
45
|
TaskReportDefine: () => TaskReportDefine,
|
|
46
46
|
TaskResultDefine: () => TaskResultDefine,
|
|
47
47
|
TaskRunDefine: () => TaskRunDefine,
|
|
48
|
-
|
|
48
|
+
TaskValidateDefine: () => TaskValidateDefine,
|
|
49
|
+
WorkflowMessageType: () => WorkflowMessageType,
|
|
49
50
|
WorkflowPortType: () => WorkflowPortType,
|
|
50
51
|
WorkflowStatus: () => WorkflowStatus,
|
|
51
52
|
WorkflowVariableType: () => WorkflowVariableType
|
|
52
53
|
});
|
|
53
54
|
module.exports = __toCommonJS(src_exports);
|
|
54
55
|
|
|
55
|
-
// src/api/
|
|
56
|
-
var
|
|
56
|
+
// src/api/task-validate/index.ts
|
|
57
|
+
var import_zod2 = __toESM(require("zod"), 1);
|
|
58
|
+
|
|
59
|
+
// src/api/schema.ts
|
|
60
|
+
var import_zod = __toESM(require("zod"), 1);
|
|
61
|
+
var WorkflowIOZodSchema = import_zod.default.record(import_zod.default.string(), import_zod.default.any());
|
|
62
|
+
var WorkflowSnapshotZodSchema = import_zod.default.object({
|
|
63
|
+
id: import_zod.default.string(),
|
|
64
|
+
nodeID: import_zod.default.string(),
|
|
65
|
+
inputs: WorkflowIOZodSchema,
|
|
66
|
+
outputs: WorkflowIOZodSchema.optional(),
|
|
67
|
+
data: WorkflowIOZodSchema,
|
|
68
|
+
branch: import_zod.default.string().optional()
|
|
69
|
+
});
|
|
70
|
+
var WorkflowStatusZodShape = {
|
|
71
|
+
status: import_zod.default.string(),
|
|
72
|
+
terminated: import_zod.default.boolean(),
|
|
73
|
+
startTime: import_zod.default.number(),
|
|
74
|
+
endTime: import_zod.default.number().optional(),
|
|
75
|
+
timeCost: import_zod.default.number()
|
|
76
|
+
};
|
|
77
|
+
var WorkflowStatusZodSchema = import_zod.default.object(WorkflowStatusZodShape);
|
|
78
|
+
var WorkflowNodeReportZodSchema = import_zod.default.object({
|
|
79
|
+
id: import_zod.default.string(),
|
|
80
|
+
...WorkflowStatusZodShape,
|
|
81
|
+
snapshots: import_zod.default.array(WorkflowSnapshotZodSchema)
|
|
82
|
+
});
|
|
83
|
+
var WorkflowReportsZodSchema = import_zod.default.record(import_zod.default.string(), WorkflowNodeReportZodSchema);
|
|
84
|
+
var WorkflowMessageZodSchema = import_zod.default.object({
|
|
85
|
+
id: import_zod.default.string(),
|
|
86
|
+
type: import_zod.default.enum(["log", "info", "debug", "error", "warning"]),
|
|
87
|
+
message: import_zod.default.string(),
|
|
88
|
+
nodeID: import_zod.default.string().optional(),
|
|
89
|
+
timestamp: import_zod.default.number()
|
|
90
|
+
});
|
|
91
|
+
var WorkflowMessagesZodSchema = import_zod.default.record(
|
|
92
|
+
import_zod.default.enum(["log", "info", "debug", "error", "warning"]),
|
|
93
|
+
import_zod.default.array(WorkflowMessageZodSchema)
|
|
94
|
+
);
|
|
95
|
+
var WorkflowZodSchema = {
|
|
96
|
+
Inputs: WorkflowIOZodSchema,
|
|
97
|
+
Outputs: WorkflowIOZodSchema,
|
|
98
|
+
Status: WorkflowStatusZodSchema,
|
|
99
|
+
Snapshot: WorkflowSnapshotZodSchema,
|
|
100
|
+
Reports: WorkflowReportsZodSchema,
|
|
101
|
+
Messages: WorkflowMessagesZodSchema
|
|
102
|
+
};
|
|
57
103
|
|
|
58
104
|
// src/api/constant.ts
|
|
59
105
|
var FlowGramAPIMethod = /* @__PURE__ */ ((FlowGramAPIMethod2) => {
|
|
@@ -70,84 +116,35 @@ var FlowGramAPIName = /* @__PURE__ */ ((FlowGramAPIName2) => {
|
|
|
70
116
|
FlowGramAPIName2["TaskReport"] = "TaskReport";
|
|
71
117
|
FlowGramAPIName2["TaskResult"] = "TaskResult";
|
|
72
118
|
FlowGramAPIName2["TaskCancel"] = "TaskCancel";
|
|
73
|
-
FlowGramAPIName2["
|
|
119
|
+
FlowGramAPIName2["TaskValidate"] = "TaskValidate";
|
|
74
120
|
return FlowGramAPIName2;
|
|
75
121
|
})(FlowGramAPIName || {});
|
|
76
122
|
var FlowGramAPIModule = /* @__PURE__ */ ((FlowGramAPIModule2) => {
|
|
77
123
|
FlowGramAPIModule2["Info"] = "Info";
|
|
78
124
|
FlowGramAPIModule2["Task"] = "Task";
|
|
79
|
-
FlowGramAPIModule2["Validation"] = "Validation";
|
|
80
125
|
return FlowGramAPIModule2;
|
|
81
126
|
})(FlowGramAPIModule || {});
|
|
82
127
|
|
|
83
|
-
// src/api/
|
|
84
|
-
var
|
|
85
|
-
name: "
|
|
128
|
+
// src/api/task-validate/index.ts
|
|
129
|
+
var TaskValidateDefine = {
|
|
130
|
+
name: "TaskValidate" /* TaskValidate */,
|
|
86
131
|
method: "POST" /* POST */,
|
|
87
|
-
path: "/
|
|
88
|
-
module: "
|
|
132
|
+
path: "/task/validate",
|
|
133
|
+
module: "Task" /* Task */,
|
|
89
134
|
schema: {
|
|
90
|
-
input:
|
|
91
|
-
schema:
|
|
135
|
+
input: import_zod2.default.object({
|
|
136
|
+
schema: import_zod2.default.string(),
|
|
137
|
+
inputs: WorkflowZodSchema.Inputs
|
|
92
138
|
}),
|
|
93
|
-
output:
|
|
94
|
-
valid:
|
|
95
|
-
|
|
96
|
-
import_zod.default.object({
|
|
97
|
-
message: import_zod.default.string(),
|
|
98
|
-
nodeID: import_zod.default.string()
|
|
99
|
-
})
|
|
100
|
-
),
|
|
101
|
-
edgeErrors: import_zod.default.array(
|
|
102
|
-
import_zod.default.object({
|
|
103
|
-
message: import_zod.default.string(),
|
|
104
|
-
edge: import_zod.default.object({
|
|
105
|
-
sourceNodeID: import_zod.default.string(),
|
|
106
|
-
targetNodeID: import_zod.default.string(),
|
|
107
|
-
sourcePortID: import_zod.default.string().optional(),
|
|
108
|
-
targetPortID: import_zod.default.string().optional()
|
|
109
|
-
})
|
|
110
|
-
})
|
|
111
|
-
)
|
|
139
|
+
output: import_zod2.default.object({
|
|
140
|
+
valid: import_zod2.default.boolean(),
|
|
141
|
+
errors: import_zod2.default.array(import_zod2.default.string()).optional()
|
|
112
142
|
})
|
|
113
143
|
}
|
|
114
144
|
};
|
|
115
145
|
|
|
116
146
|
// src/api/task-run/index.ts
|
|
117
|
-
var import_zod3 = __toESM(require("zod"));
|
|
118
|
-
|
|
119
|
-
// src/api/schema.ts
|
|
120
|
-
var import_zod2 = __toESM(require("zod"));
|
|
121
|
-
var WorkflowIOZodSchema = import_zod2.default.record(import_zod2.default.string(), import_zod2.default.any());
|
|
122
|
-
var WorkflowSnapshotZodSchema = import_zod2.default.object({
|
|
123
|
-
id: import_zod2.default.string(),
|
|
124
|
-
nodeID: import_zod2.default.string(),
|
|
125
|
-
inputs: WorkflowIOZodSchema,
|
|
126
|
-
outputs: WorkflowIOZodSchema.optional(),
|
|
127
|
-
data: WorkflowIOZodSchema,
|
|
128
|
-
branch: import_zod2.default.string().optional()
|
|
129
|
-
});
|
|
130
|
-
var WorkflowStatusZodShape = {
|
|
131
|
-
status: import_zod2.default.string(),
|
|
132
|
-
terminated: import_zod2.default.boolean(),
|
|
133
|
-
startTime: import_zod2.default.number(),
|
|
134
|
-
endTime: import_zod2.default.number().optional(),
|
|
135
|
-
timeCost: import_zod2.default.number()
|
|
136
|
-
};
|
|
137
|
-
var WorkflowStatusZodSchema = import_zod2.default.object(WorkflowStatusZodShape);
|
|
138
|
-
var WorkflowZodSchema = {
|
|
139
|
-
Inputs: WorkflowIOZodSchema,
|
|
140
|
-
Outputs: WorkflowIOZodSchema,
|
|
141
|
-
Status: WorkflowStatusZodSchema,
|
|
142
|
-
Snapshot: WorkflowSnapshotZodSchema,
|
|
143
|
-
NodeReport: import_zod2.default.object({
|
|
144
|
-
id: import_zod2.default.string(),
|
|
145
|
-
...WorkflowStatusZodShape,
|
|
146
|
-
snapshots: import_zod2.default.array(WorkflowSnapshotZodSchema)
|
|
147
|
-
})
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
// src/api/task-run/index.ts
|
|
147
|
+
var import_zod3 = __toESM(require("zod"), 1);
|
|
151
148
|
var TaskRunDefine = {
|
|
152
149
|
name: "TaskRun" /* TaskRun */,
|
|
153
150
|
method: "POST" /* POST */,
|
|
@@ -165,7 +162,7 @@ var TaskRunDefine = {
|
|
|
165
162
|
};
|
|
166
163
|
|
|
167
164
|
// src/api/task-result/index.ts
|
|
168
|
-
var import_zod4 = __toESM(require("zod"));
|
|
165
|
+
var import_zod4 = __toESM(require("zod"), 1);
|
|
169
166
|
var TaskResultDefine = {
|
|
170
167
|
name: "TaskResult" /* TaskResult */,
|
|
171
168
|
method: "GET" /* GET */,
|
|
@@ -180,7 +177,7 @@ var TaskResultDefine = {
|
|
|
180
177
|
};
|
|
181
178
|
|
|
182
179
|
// src/api/task-report/index.ts
|
|
183
|
-
var import_zod5 = __toESM(require("zod"));
|
|
180
|
+
var import_zod5 = __toESM(require("zod"), 1);
|
|
184
181
|
var TaskReportDefine = {
|
|
185
182
|
name: "TaskReport" /* TaskReport */,
|
|
186
183
|
method: "GET" /* GET */,
|
|
@@ -195,13 +192,14 @@ var TaskReportDefine = {
|
|
|
195
192
|
inputs: WorkflowZodSchema.Inputs,
|
|
196
193
|
outputs: WorkflowZodSchema.Outputs,
|
|
197
194
|
workflowStatus: WorkflowZodSchema.Status,
|
|
198
|
-
reports:
|
|
195
|
+
reports: WorkflowZodSchema.Reports,
|
|
196
|
+
messages: WorkflowZodSchema.Messages
|
|
199
197
|
})
|
|
200
198
|
}
|
|
201
199
|
};
|
|
202
200
|
|
|
203
201
|
// src/api/task-cancel/index.ts
|
|
204
|
-
var import_zod6 = __toESM(require("zod"));
|
|
202
|
+
var import_zod6 = __toESM(require("zod"), 1);
|
|
205
203
|
var TaskCancelDefine = {
|
|
206
204
|
name: "TaskCancel" /* TaskCancel */,
|
|
207
205
|
method: "PUT" /* PUT */,
|
|
@@ -218,7 +216,7 @@ var TaskCancelDefine = {
|
|
|
218
216
|
};
|
|
219
217
|
|
|
220
218
|
// src/api/server-info/index.ts
|
|
221
|
-
var import_zod7 = __toESM(require("zod"));
|
|
219
|
+
var import_zod7 = __toESM(require("zod"), 1);
|
|
222
220
|
var ServerInfoDefine = {
|
|
223
221
|
name: "ServerInfo" /* ServerInfo */,
|
|
224
222
|
method: "GET" /* GET */,
|
|
@@ -242,7 +240,7 @@ var FlowGramAPIs = {
|
|
|
242
240
|
["TaskReport" /* TaskReport */]: TaskReportDefine,
|
|
243
241
|
["TaskResult" /* TaskResult */]: TaskResultDefine,
|
|
244
242
|
["TaskCancel" /* TaskCancel */]: TaskCancelDefine,
|
|
245
|
-
["
|
|
243
|
+
["TaskValidate" /* TaskValidate */]: TaskValidateDefine
|
|
246
244
|
};
|
|
247
245
|
var FlowGramAPINames = Object.keys(FlowGramAPIs);
|
|
248
246
|
|
|
@@ -316,6 +314,16 @@ var WorkflowStatus = /* @__PURE__ */ ((WorkflowStatus2) => {
|
|
|
316
314
|
|
|
317
315
|
// src/runtime/validation/index.ts
|
|
318
316
|
var IValidation = Symbol.for("Validation");
|
|
317
|
+
|
|
318
|
+
// src/runtime/message/index.ts
|
|
319
|
+
var WorkflowMessageType = /* @__PURE__ */ ((WorkflowMessageType2) => {
|
|
320
|
+
WorkflowMessageType2["Log"] = "log";
|
|
321
|
+
WorkflowMessageType2["Info"] = "info";
|
|
322
|
+
WorkflowMessageType2["Debug"] = "debug";
|
|
323
|
+
WorkflowMessageType2["Error"] = "error";
|
|
324
|
+
WorkflowMessageType2["Warn"] = "warning";
|
|
325
|
+
return WorkflowMessageType2;
|
|
326
|
+
})(WorkflowMessageType || {});
|
|
319
327
|
// Annotate the CommonJS export names for ESM import in node:
|
|
320
328
|
0 && (module.exports = {
|
|
321
329
|
ConditionOperation,
|
|
@@ -333,7 +341,8 @@ var IValidation = Symbol.for("Validation");
|
|
|
333
341
|
TaskReportDefine,
|
|
334
342
|
TaskResultDefine,
|
|
335
343
|
TaskRunDefine,
|
|
336
|
-
|
|
344
|
+
TaskValidateDefine,
|
|
345
|
+
WorkflowMessageType,
|
|
337
346
|
WorkflowPortType,
|
|
338
347
|
WorkflowStatus,
|
|
339
348
|
WorkflowVariableType
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/api/validation/index.ts","../src/api/constant.ts","../src/api/task-run/index.ts","../src/api/schema.ts","../src/api/task-result/index.ts","../src/api/task-report/index.ts","../src/api/task-cancel/index.ts","../src/api/server-info/index.ts","../src/api/define.ts","../src/schema/constant.ts","../src/node/constant.ts","../src/node/condition/constant.ts","../src/runtime/engine/index.ts","../src/runtime/executor/executor.ts","../src/runtime/status/index.ts","../src/runtime/validation/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport * from './api';\nexport * from './schema';\nexport * from './node';\nexport * from './runtime';\nexport * from './client';\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { ValidationResult } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName } from '@api/constant';\n\nexport interface ValidationReq {\n schema: string;\n}\n\nexport interface ValidationRes extends ValidationResult {}\n\nexport const ValidationDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.Validation,\n method: FlowGramAPIMethod.POST,\n path: '/validation',\n module: FlowGramAPIModule.Validation,\n schema: {\n input: z.object({\n schema: z.string(),\n }),\n output: z.object({\n valid: z.boolean(),\n nodeErrors: z.array(\n z.object({\n message: z.string(),\n nodeID: z.string(),\n })\n ),\n edgeErrors: z.array(\n z.object({\n message: z.string(),\n edge: z.object({\n sourceNodeID: z.string(),\n targetNodeID: z.string(),\n sourcePortID: z.string().optional(),\n targetPortID: z.string().optional(),\n }),\n })\n ),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum FlowGramAPIMethod {\n GET = 'GET',\n POST = 'POST',\n PUT = 'PUT',\n DELETE = 'DELETE',\n PATCH = 'PATCH',\n}\n\nexport enum FlowGramAPIName {\n ServerInfo = 'ServerInfo',\n TaskRun = 'TaskRun',\n TaskReport = 'TaskReport',\n TaskResult = 'TaskResult',\n TaskCancel = 'TaskCancel',\n Validation = 'Validation',\n}\n\nexport enum FlowGramAPIModule {\n Info = 'Info',\n Task = 'Task',\n Validation = 'Validation',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { WorkflowInputs } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName } from '@api/constant';\n\nexport interface TaskRunInput {\n inputs: WorkflowInputs;\n schema: string;\n}\n\nexport interface TaskRunOutput {\n taskID: string;\n}\n\nexport const TaskRunDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskRun,\n method: FlowGramAPIMethod.POST,\n path: '/task/run',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n schema: z.string(),\n inputs: WorkflowZodSchema.Inputs,\n }),\n output: z.object({\n taskID: z.string(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nconst WorkflowIOZodSchema = z.record(z.string(), z.any());\nconst WorkflowSnapshotZodSchema = z.object({\n id: z.string(),\n nodeID: z.string(),\n inputs: WorkflowIOZodSchema,\n outputs: WorkflowIOZodSchema.optional(),\n data: WorkflowIOZodSchema,\n branch: z.string().optional(),\n});\nconst WorkflowStatusZodShape = {\n status: z.string(),\n terminated: z.boolean(),\n startTime: z.number(),\n endTime: z.number().optional(),\n timeCost: z.number(),\n};\nconst WorkflowStatusZodSchema = z.object(WorkflowStatusZodShape);\n\nexport const WorkflowZodSchema = {\n Inputs: WorkflowIOZodSchema,\n Outputs: WorkflowIOZodSchema,\n Status: WorkflowStatusZodSchema,\n Snapshot: WorkflowSnapshotZodSchema,\n NodeReport: z.object({\n id: z.string(),\n ...WorkflowStatusZodShape,\n snapshots: z.array(WorkflowSnapshotZodSchema),\n }),\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { WorkflowOutputs } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIName, FlowGramAPIMethod, FlowGramAPIModule } from '@api/constant';\n\nexport interface TaskResultInput {\n taskID: string;\n}\n\nexport type TaskResultOutput = WorkflowOutputs | undefined;\n\nexport const TaskResultDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskResult,\n method: FlowGramAPIMethod.GET,\n path: '/task/result',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n taskID: z.string(),\n }),\n output: WorkflowZodSchema.Outputs,\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { IReport } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIName, FlowGramAPIMethod, FlowGramAPIModule } from '@api/constant';\n\nexport interface TaskReportInput {\n taskID: string;\n}\n\nexport type TaskReportOutput = IReport | undefined;\n\nexport const TaskReportDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskReport,\n method: FlowGramAPIMethod.GET,\n path: '/task/report',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n taskID: z.string(),\n }),\n output: z.object({\n id: z.string(),\n inputs: WorkflowZodSchema.Inputs,\n outputs: WorkflowZodSchema.Outputs,\n workflowStatus: WorkflowZodSchema.Status,\n reports: z.record(z.string(), WorkflowZodSchema.NodeReport),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { FlowGramAPIDefine } from '@api/type';\nimport { FlowGramAPIName, FlowGramAPIMethod, FlowGramAPIModule } from '@api/constant';\n\nexport interface TaskCancelInput {\n taskID: string;\n}\n\nexport type TaskCancelOutput = {\n success: boolean;\n};\n\nexport const TaskCancelDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskCancel,\n method: FlowGramAPIMethod.PUT,\n path: '/task/cancel',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n taskID: z.string(),\n }),\n output: z.object({\n success: z.boolean(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { type FlowGramAPIDefine } from '@api/type';\nimport { FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName } from '@api/constant';\n\nexport interface ServerInfoInput {}\n\nexport interface ServerInfoOutput {\n name: string;\n title: string;\n description: string;\n runtime: string;\n version: string;\n time: string;\n}\n\nexport const ServerInfoDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.ServerInfo,\n method: FlowGramAPIMethod.GET,\n path: '/info',\n module: FlowGramAPIModule.Info,\n schema: {\n input: z.undefined(),\n output: z.object({\n name: z.string(),\n runtime: z.string(),\n version: z.string(),\n time: z.string(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ValidationDefine } from './validation';\nimport { FlowGramAPIDefines } from './type';\nimport { TaskRunDefine } from './task-run';\nimport { TaskResultDefine } from './task-result';\nimport { TaskReportDefine } from './task-report';\nimport { TaskCancelDefine } from './task-cancel';\nimport { ServerInfoDefine } from './server-info';\nimport { FlowGramAPIName } from './constant';\n\nexport const FlowGramAPIs: FlowGramAPIDefines = {\n [FlowGramAPIName.ServerInfo]: ServerInfoDefine,\n [FlowGramAPIName.TaskRun]: TaskRunDefine,\n [FlowGramAPIName.TaskReport]: TaskReportDefine,\n [FlowGramAPIName.TaskResult]: TaskResultDefine,\n [FlowGramAPIName.TaskCancel]: TaskCancelDefine,\n [FlowGramAPIName.Validation]: ValidationDefine,\n};\n\nexport const FlowGramAPINames = Object.keys(FlowGramAPIs) as FlowGramAPIName[];\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum WorkflowPortType {\n Input = 'input',\n Output = 'output',\n}\n\nexport enum WorkflowVariableType {\n String = 'string',\n Integer = 'integer',\n Number = 'number',\n Boolean = 'boolean',\n Object = 'object',\n Array = 'array',\n Null = 'null',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum FlowGramNode {\n Root = 'root',\n Start = 'start',\n End = 'end',\n LLM = 'llm',\n code = 'code',\n Condition = 'condition',\n Loop = 'loop',\n Comment = 'comment',\n Group = 'group',\n BlockStart = 'block-start',\n BlockEnd = 'block-end',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum ConditionOperation {\n EQ = 'eq',\n NEQ = 'neq',\n GT = 'gt',\n GTE = 'gte',\n LT = 'lt',\n LTE = 'lte',\n IN = 'in',\n NIN = 'nin',\n CONTAINS = 'contains',\n NOT_CONTAINS = 'not_contains',\n IS_EMPTY = 'is_empty',\n IS_NOT_EMPTY = 'is_not_empty',\n IS_TRUE = 'is_true',\n IS_FALSE = 'is_false',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ITask } from '../task';\nimport { IExecutor } from '../executor';\nimport { INode } from '../document';\nimport { IContext } from '../context';\nimport { InvokeParams } from '../base';\n\nexport interface EngineServices {\n Executor: IExecutor;\n}\n\nexport interface IEngine {\n invoke(params: InvokeParams): ITask;\n executeNode(params: { context: IContext; node: INode }): Promise<void>;\n}\n\nexport const IEngine = Symbol.for('Engine');\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ExecutionContext, ExecutionResult, INodeExecutor } from './node-executor';\n\nexport interface IExecutor {\n execute: (context: ExecutionContext) => Promise<ExecutionResult>;\n register: (executor: INodeExecutor) => void;\n}\n\nexport const IExecutor = Symbol.for('Executor');\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum WorkflowStatus {\n Pending = 'pending',\n Processing = 'processing',\n Succeeded = 'succeeded',\n Failed = 'failed',\n Canceled = 'canceled',\n}\n\nexport interface StatusData {\n status: WorkflowStatus;\n terminated: boolean;\n startTime: number;\n endTime?: number;\n timeCost: number;\n}\n\nexport interface IStatus extends StatusData {\n id: string;\n process(): void;\n success(): void;\n fail(): void;\n cancel(): void;\n export(): StatusData;\n}\n\nexport interface IStatusCenter {\n workflow: IStatus;\n nodeStatus(nodeID: string): IStatus;\n init(): void;\n dispose(): void;\n getStatusNodeIDs(status: WorkflowStatus): string[];\n exportNodeStatus(): Record<string, StatusData>;\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowSchema } from '@schema/index';\n\nexport interface ValidationResult {\n valid: boolean;\n errors?: string[];\n}\n\nexport interface IValidation {\n validate(schema: WorkflowSchema): ValidationResult;\n}\n\nexport const IValidation = Symbol.for('Validation');\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKA,iBAAc;;;ACAP,IAAK,oBAAL,kBAAKA,uBAAL;AACL,EAAAA,mBAAA,SAAM;AACN,EAAAA,mBAAA,UAAO;AACP,EAAAA,mBAAA,SAAM;AACN,EAAAA,mBAAA,YAAS;AACT,EAAAA,mBAAA,WAAQ;AALE,SAAAA;AAAA,GAAA;AAQL,IAAK,kBAAL,kBAAKC,qBAAL;AACL,EAAAA,iBAAA,gBAAa;AACb,EAAAA,iBAAA,aAAU;AACV,EAAAA,iBAAA,gBA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BAAA,kBAAe;AACf,EAAAA,oBAAA,aAAU;AACV,EAAAA,oBAAA,cAAW;AAdD,SAAAA;AAAA,GAAA;;;ACeL,IAAM,UAAU,OAAO,IAAI,QAAQ;;;ACRnC,IAAM,YAAY,OAAO,IAAI,UAAU;;;ACPvC,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,gBAAa;AACb,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,YAAS;AACT,EAAAA,gBAAA,cAAW;AALD,SAAAA;AAAA,GAAA;;;ACWL,IAAM,cAAc,OAAO,IAAI,YAAY;","names":["FlowGramAPIMethod","FlowGramAPIName","FlowGramAPIModule","z","import_zod","import_zod","z","z","import_zod","z","import_zod","z","import_zod","z","import_zod","z","WorkflowPortType","WorkflowVariableType","FlowGramNode","ConditionOperation","WorkflowStatus"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/api/task-validate/index.ts","../src/api/schema.ts","../src/api/constant.ts","../src/api/task-run/index.ts","../src/api/task-result/index.ts","../src/api/task-report/index.ts","../src/api/task-cancel/index.ts","../src/api/server-info/index.ts","../src/api/define.ts","../src/schema/constant.ts","../src/node/constant.ts","../src/node/condition/constant.ts","../src/runtime/engine/index.ts","../src/runtime/executor/executor.ts","../src/runtime/status/index.ts","../src/runtime/validation/index.ts","../src/runtime/message/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport * from './api';\nexport * from './schema';\nexport * from './node';\nexport * from './runtime';\nexport * from './client';\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { ValidationResult, WorkflowInputs } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName } from '@api/constant';\n\nexport interface TaskValidateInput {\n inputs: WorkflowInputs;\n schema: string;\n}\n\nexport interface TaskValidateOutput extends ValidationResult {}\n\nexport const TaskValidateDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskValidate,\n method: FlowGramAPIMethod.POST,\n path: '/task/validate',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n schema: z.string(),\n inputs: WorkflowZodSchema.Inputs,\n }),\n output: z.object({\n valid: z.boolean(),\n errors: z.array(z.string()).optional(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nconst WorkflowIOZodSchema = z.record(z.string(), z.any());\n\nconst WorkflowSnapshotZodSchema = z.object({\n id: z.string(),\n nodeID: z.string(),\n inputs: WorkflowIOZodSchema,\n outputs: WorkflowIOZodSchema.optional(),\n data: WorkflowIOZodSchema,\n branch: z.string().optional(),\n});\n\nconst WorkflowStatusZodShape = {\n status: z.string(),\n terminated: z.boolean(),\n startTime: z.number(),\n endTime: z.number().optional(),\n timeCost: z.number(),\n};\nconst WorkflowStatusZodSchema = z.object(WorkflowStatusZodShape);\n\nconst WorkflowNodeReportZodSchema = z.object({\n id: z.string(),\n ...WorkflowStatusZodShape,\n snapshots: z.array(WorkflowSnapshotZodSchema),\n});\n\nconst WorkflowReportsZodSchema = z.record(z.string(), WorkflowNodeReportZodSchema);\n\nconst WorkflowMessageZodSchema = z.object({\n id: z.string(),\n type: z.enum(['log', 'info', 'debug', 'error', 'warning']),\n message: z.string(),\n nodeID: z.string().optional(),\n timestamp: z.number(),\n});\n\nconst WorkflowMessagesZodSchema = z.record(\n z.enum(['log', 'info', 'debug', 'error', 'warning']),\n z.array(WorkflowMessageZodSchema)\n);\n\nexport const WorkflowZodSchema = {\n Inputs: WorkflowIOZodSchema,\n Outputs: WorkflowIOZodSchema,\n Status: WorkflowStatusZodSchema,\n Snapshot: WorkflowSnapshotZodSchema,\n Reports: WorkflowReportsZodSchema,\n Messages: WorkflowMessagesZodSchema,\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum FlowGramAPIMethod {\n GET = 'GET',\n POST = 'POST',\n PUT = 'PUT',\n DELETE = 'DELETE',\n PATCH = 'PATCH',\n}\n\nexport enum FlowGramAPIName {\n ServerInfo = 'ServerInfo',\n TaskRun = 'TaskRun',\n TaskReport = 'TaskReport',\n TaskResult = 'TaskResult',\n TaskCancel = 'TaskCancel',\n TaskValidate = 'TaskValidate',\n}\n\nexport enum FlowGramAPIModule {\n Info = 'Info',\n Task = 'Task',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { WorkflowInputs } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName } from '@api/constant';\n\nexport interface TaskRunInput {\n inputs: WorkflowInputs;\n schema: string;\n}\n\nexport interface TaskRunOutput {\n taskID: string;\n}\n\nexport const TaskRunDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskRun,\n method: FlowGramAPIMethod.POST,\n path: '/task/run',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n schema: z.string(),\n inputs: WorkflowZodSchema.Inputs,\n }),\n output: z.object({\n taskID: z.string(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { WorkflowOutputs } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIName, FlowGramAPIMethod, FlowGramAPIModule } from '@api/constant';\n\nexport interface TaskResultInput {\n taskID: string;\n}\n\nexport type TaskResultOutput = WorkflowOutputs | undefined;\n\nexport const TaskResultDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskResult,\n method: FlowGramAPIMethod.GET,\n path: '/task/result',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n taskID: z.string(),\n }),\n output: WorkflowZodSchema.Outputs,\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { IReport } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIName, FlowGramAPIMethod, FlowGramAPIModule } from '@api/constant';\n\nexport interface TaskReportInput {\n taskID: string;\n}\n\nexport type TaskReportOutput = IReport | undefined;\n\nexport const TaskReportDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskReport,\n method: FlowGramAPIMethod.GET,\n path: '/task/report',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n taskID: z.string(),\n }),\n output: z.object({\n id: z.string(),\n inputs: WorkflowZodSchema.Inputs,\n outputs: WorkflowZodSchema.Outputs,\n workflowStatus: WorkflowZodSchema.Status,\n reports: WorkflowZodSchema.Reports,\n messages: WorkflowZodSchema.Messages,\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { FlowGramAPIDefine } from '@api/type';\nimport { FlowGramAPIName, FlowGramAPIMethod, FlowGramAPIModule } from '@api/constant';\n\nexport interface TaskCancelInput {\n taskID: string;\n}\n\nexport type TaskCancelOutput = {\n success: boolean;\n};\n\nexport const TaskCancelDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskCancel,\n method: FlowGramAPIMethod.PUT,\n path: '/task/cancel',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n taskID: z.string(),\n }),\n output: z.object({\n success: z.boolean(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { type FlowGramAPIDefine } from '@api/type';\nimport { FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName } from '@api/constant';\n\nexport interface ServerInfoInput {}\n\nexport interface ServerInfoOutput {\n name: string;\n title: string;\n description: string;\n runtime: string;\n version: string;\n time: string;\n}\n\nexport const ServerInfoDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.ServerInfo,\n method: FlowGramAPIMethod.GET,\n path: '/info',\n module: FlowGramAPIModule.Info,\n schema: {\n input: z.undefined(),\n output: z.object({\n name: z.string(),\n runtime: z.string(),\n version: z.string(),\n time: z.string(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { FlowGramAPIDefines } from './type';\nimport { TaskValidateDefine } from './task-validate';\nimport { TaskRunDefine } from './task-run';\nimport { TaskResultDefine } from './task-result';\nimport { TaskReportDefine } from './task-report';\nimport { TaskCancelDefine } from './task-cancel';\nimport { ServerInfoDefine } from './server-info';\nimport { FlowGramAPIName } from './constant';\n\nexport const FlowGramAPIs: FlowGramAPIDefines = {\n [FlowGramAPIName.ServerInfo]: ServerInfoDefine,\n [FlowGramAPIName.TaskRun]: TaskRunDefine,\n [FlowGramAPIName.TaskReport]: TaskReportDefine,\n [FlowGramAPIName.TaskResult]: TaskResultDefine,\n [FlowGramAPIName.TaskCancel]: TaskCancelDefine,\n [FlowGramAPIName.TaskValidate]: TaskValidateDefine,\n};\n\nexport const FlowGramAPINames = Object.keys(FlowGramAPIs) as FlowGramAPIName[];\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum WorkflowPortType {\n Input = 'input',\n Output = 'output',\n}\n\nexport enum WorkflowVariableType {\n String = 'string',\n Integer = 'integer',\n Number = 'number',\n Boolean = 'boolean',\n Object = 'object',\n Array = 'array',\n Null = 'null',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum FlowGramNode {\n Root = 'root',\n Start = 'start',\n End = 'end',\n LLM = 'llm',\n code = 'code',\n Condition = 'condition',\n Loop = 'loop',\n Comment = 'comment',\n Group = 'group',\n BlockStart = 'block-start',\n BlockEnd = 'block-end',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum ConditionOperation {\n EQ = 'eq',\n NEQ = 'neq',\n GT = 'gt',\n GTE = 'gte',\n LT = 'lt',\n LTE = 'lte',\n IN = 'in',\n NIN = 'nin',\n CONTAINS = 'contains',\n NOT_CONTAINS = 'not_contains',\n IS_EMPTY = 'is_empty',\n IS_NOT_EMPTY = 'is_not_empty',\n IS_TRUE = 'is_true',\n IS_FALSE = 'is_false',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IValidation } from '@runtime/validation';\nimport { ITask } from '../task';\nimport { IExecutor } from '../executor';\nimport { INode } from '../document';\nimport { IContext } from '../context';\nimport { InvokeParams } from '../base';\n\nexport interface EngineServices {\n Validation: IValidation;\n Executor: IExecutor;\n}\n\nexport interface IEngine {\n invoke(params: InvokeParams): ITask;\n executeNode(params: { context: IContext; node: INode }): Promise<void>;\n}\n\nexport const IEngine = Symbol.for('Engine');\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ExecutionContext, ExecutionResult, INodeExecutor } from './node-executor';\n\nexport interface IExecutor {\n execute: (context: ExecutionContext) => Promise<ExecutionResult>;\n register: (executor: INodeExecutor) => void;\n}\n\nexport const IExecutor = Symbol.for('Executor');\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum WorkflowStatus {\n Pending = 'pending',\n Processing = 'processing',\n Succeeded = 'succeeded',\n Failed = 'failed',\n Canceled = 'canceled',\n}\n\nexport interface StatusData {\n status: WorkflowStatus;\n terminated: boolean;\n startTime: number;\n endTime?: number;\n timeCost: number;\n}\n\nexport interface IStatus extends StatusData {\n id: string;\n process(): void;\n success(): void;\n fail(): void;\n cancel(): void;\n export(): StatusData;\n}\n\nexport interface IStatusCenter {\n workflow: IStatus;\n nodeStatus(nodeID: string): IStatus;\n init(): void;\n dispose(): void;\n getStatusNodeIDs(status: WorkflowStatus): string[];\n exportNodeStatus(): Record<string, StatusData>;\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { InvokeParams } from '@runtime/base';\n\nexport interface ValidationResult {\n valid: boolean;\n errors?: string[];\n}\n\nexport interface IValidation {\n invoke(params: InvokeParams): ValidationResult;\n}\n\nexport const IValidation = Symbol.for('Validation');\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum WorkflowMessageType {\n Log = 'log',\n Info = 'info',\n Debug = 'debug',\n Error = 'error',\n Warn = 'warning',\n}\n\nexport interface MessageData {\n message: string;\n nodeID?: string;\n timestamp?: number;\n}\n\nexport interface IMessage extends MessageData {\n id: string;\n type: WorkflowMessageType;\n timestamp: number;\n}\n\nexport type WorkflowMessages = Record<WorkflowMessageType, IMessage[]>;\n\nexport interface IMessageCenter {\n init(): void;\n dispose(): void;\n log(data: MessageData): IMessage;\n info(data: MessageData): IMessage;\n debug(data: MessageData): IMessage;\n error(data: MessageData): IMessage;\n warn(data: MessageData): IMessage;\n export(): WorkflowMessages;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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AAU;AACV,EAAAA,cAAA,WAAQ;AACR,EAAAA,cAAA,gBAAa;AACb,EAAAA,cAAA,cAAW;AAXD,SAAAA;AAAA,GAAA;;;ACAL,IAAK,qBAAL,kBAAKC,wBAAL;AACL,EAAAA,oBAAA,QAAK;AACL,EAAAA,oBAAA,SAAM;AACN,EAAAA,oBAAA,QAAK;AACL,EAAAA,oBAAA,SAAM;AACN,EAAAA,oBAAA,QAAK;AACL,EAAAA,oBAAA,SAAM;AACN,EAAAA,oBAAA,QAAK;AACL,EAAAA,oBAAA,SAAM;AACN,EAAAA,oBAAA,cAAW;AACX,EAAAA,oBAAA,kBAAe;AACf,EAAAA,oBAAA,cAAW;AACX,EAAAA,oBAAA,kBAAe;AACf,EAAAA,oBAAA,aAAU;AACV,EAAAA,oBAAA,cAAW;AAdD,SAAAA;AAAA,GAAA;;;ACiBL,IAAM,UAAU,OAAO,IAAI,QAAQ;;;ACVnC,IAAM,YAAY,OAAO,IAAI,UAAU;;;ACPvC,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,gBAAa;AACb,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,YAAS;AACT,EAAAA,gBAAA,cAAW;AALD,SAAAA;AAAA,GAAA;;;ACWL,IAAM,cAAc,OAAO,IAAI,YAAY;;;ACX3C,IAAK,sBAAL,kBAAKC,yBAAL;AACL,EAAAA,qBAAA,SAAM;AACN,EAAAA,qBAAA,UAAO;AACP,EAAAA,qBAAA,WAAQ;AACR,EAAAA,qBAAA,WAAQ;AACR,EAAAA,qBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;","names":["import_zod","z","FlowGramAPIMethod","FlowGramAPIName","FlowGramAPIModule","z","import_zod","z","import_zod","z","import_zod","z","import_zod","z","import_zod","z","WorkflowPortType","WorkflowVariableType","FlowGramNode","ConditionOperation","WorkflowStatus","WorkflowMessageType"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowgram.ai/runtime-interface",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.11",
|
|
4
4
|
"homepage": "https://flowgram.ai/",
|
|
5
5
|
"repository": "https://github.com/bytedance/flowgram.ai",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
7
8
|
"exports": {
|
|
8
9
|
"types": "./dist/index.d.ts",
|
|
9
10
|
"import": "./dist/esm/index.js",
|
|
@@ -21,10 +22,10 @@
|
|
|
21
22
|
"devDependencies": {
|
|
22
23
|
"eslint": "^8.54.0",
|
|
23
24
|
"tsup": "^8.0.1",
|
|
24
|
-
"typescript": "^5.
|
|
25
|
+
"typescript": "^5.8.3",
|
|
25
26
|
"vitest": "^0.34.6",
|
|
26
|
-
"@flowgram.ai/eslint-config": "0.1.0-alpha.
|
|
27
|
-
"@flowgram.ai/ts-config": "0.1.0-alpha.
|
|
27
|
+
"@flowgram.ai/eslint-config": "0.1.0-alpha.11",
|
|
28
|
+
"@flowgram.ai/ts-config": "0.1.0-alpha.11"
|
|
28
29
|
},
|
|
29
30
|
"publishConfig": {
|
|
30
31
|
"access": "public",
|