@flowgram.ai/runtime-interface 0.2.22 → 0.2.23
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 +33 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +99 -6
- package/dist/index.d.ts +99 -6
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/esm/index.js
CHANGED
|
@@ -220,9 +220,30 @@ var FlowGramNode = /* @__PURE__ */ ((FlowGramNode2) => {
|
|
|
220
220
|
FlowGramNode2["Loop"] = "loop";
|
|
221
221
|
FlowGramNode2["Comment"] = "comment";
|
|
222
222
|
FlowGramNode2["Group"] = "group";
|
|
223
|
+
FlowGramNode2["BlockStart"] = "block-start";
|
|
224
|
+
FlowGramNode2["BlockEnd"] = "block-end";
|
|
223
225
|
return FlowGramNode2;
|
|
224
226
|
})(FlowGramNode || {});
|
|
225
227
|
|
|
228
|
+
// src/node/condition/constant.ts
|
|
229
|
+
var ConditionOperation = /* @__PURE__ */ ((ConditionOperation2) => {
|
|
230
|
+
ConditionOperation2["EQ"] = "eq";
|
|
231
|
+
ConditionOperation2["NEQ"] = "neq";
|
|
232
|
+
ConditionOperation2["GT"] = "gt";
|
|
233
|
+
ConditionOperation2["GTE"] = "gte";
|
|
234
|
+
ConditionOperation2["LT"] = "lt";
|
|
235
|
+
ConditionOperation2["LTE"] = "lte";
|
|
236
|
+
ConditionOperation2["IN"] = "in";
|
|
237
|
+
ConditionOperation2["NIN"] = "nin";
|
|
238
|
+
ConditionOperation2["CONTAINS"] = "contains";
|
|
239
|
+
ConditionOperation2["NOT_CONTAINS"] = "not_contains";
|
|
240
|
+
ConditionOperation2["IS_EMPTY"] = "is_empty";
|
|
241
|
+
ConditionOperation2["IS_NOT_EMPTY"] = "is_not_empty";
|
|
242
|
+
ConditionOperation2["IS_TRUE"] = "is_true";
|
|
243
|
+
ConditionOperation2["IS_FALSE"] = "is_false";
|
|
244
|
+
return ConditionOperation2;
|
|
245
|
+
})(ConditionOperation || {});
|
|
246
|
+
|
|
226
247
|
// src/runtime/engine/index.ts
|
|
227
248
|
var IEngine = Symbol.for("Engine");
|
|
228
249
|
|
|
@@ -241,7 +262,18 @@ var WorkflowStatus = /* @__PURE__ */ ((WorkflowStatus2) => {
|
|
|
241
262
|
|
|
242
263
|
// src/runtime/validation/index.ts
|
|
243
264
|
var IValidation = Symbol.for("Validation");
|
|
265
|
+
|
|
266
|
+
// src/runtime/message/index.ts
|
|
267
|
+
var WorkflowMessageType = /* @__PURE__ */ ((WorkflowMessageType2) => {
|
|
268
|
+
WorkflowMessageType2["Log"] = "log";
|
|
269
|
+
WorkflowMessageType2["Info"] = "info";
|
|
270
|
+
WorkflowMessageType2["Debug"] = "debug";
|
|
271
|
+
WorkflowMessageType2["Error"] = "error";
|
|
272
|
+
WorkflowMessageType2["Warn"] = "warning";
|
|
273
|
+
return WorkflowMessageType2;
|
|
274
|
+
})(WorkflowMessageType || {});
|
|
244
275
|
export {
|
|
276
|
+
ConditionOperation,
|
|
245
277
|
FlowGramAPIMethod,
|
|
246
278
|
FlowGramAPIModule,
|
|
247
279
|
FlowGramAPIName,
|
|
@@ -257,6 +289,7 @@ export {
|
|
|
257
289
|
TaskResultDefine,
|
|
258
290
|
TaskRunDefine,
|
|
259
291
|
ValidationDefine,
|
|
292
|
+
WorkflowMessageType,
|
|
260
293
|
WorkflowPortType,
|
|
261
294
|
WorkflowStatus,
|
|
262
295
|
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/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}\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;AAAA,MACd,QAAQ,EAAE,OAAO;AAAA,IACnB,CAAC;AAAA,IACD,QAAQ,EAAE,OAAO;AAAA,MACf,OAAO,EAAE,QAAQ;AAAA,MACjB,YAAY,EAAE;AAAA,QACZ,EAAE,OAAO;AAAA,UACP,SAAS,EAAE,OAAO;AAAA,UAClB,QAAQ,EAAE,OAAO;AAAA,QACnB,CAAC;AAAA,MACH;AAAA,MACA,YAAY,EAAE;AAAA,QACZ,EAAE,OAAO;AAAA,UACP,SAAS,EAAE,OAAO;AAAA,UAClB,MAA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A,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","WorkflowStatus"]}
|
|
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","../../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 } 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","/**\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,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;AAAA,MACd,QAAQ,EAAE,OAAO;AAAA,IACnB,CAAC;AAAA,IACD,QAAQ,EAAE,OAAO;AAAA,MACf,OAAO,EAAE,QAAQ;AAAA,MACjB,YAAY,EAAE;AAAA,QACZ,EAAE,OAAO;AAAA,UACP,SAAS,EAAE,OAAO;AAAA,UAClB,QAAQ,EAAE,OAAO;AAAA,QACnB,CAAC;AAAA,MACH;AAAA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BAAA,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;;;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":["FlowGramAPIMethod","FlowGramAPIName","FlowGramAPIModule","z","z","z","z","z","z","z","z","z","z","z","WorkflowPortType","WorkflowVariableType","FlowGramNode","ConditionOperation","WorkflowStatus","WorkflowMessageType"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -301,6 +301,7 @@ interface SnapshotData {
|
|
|
301
301
|
outputs: WorkflowOutputs;
|
|
302
302
|
data: any;
|
|
303
303
|
branch?: string;
|
|
304
|
+
error?: string;
|
|
304
305
|
}
|
|
305
306
|
interface Snapshot extends SnapshotData {
|
|
306
307
|
id: string;
|
|
@@ -308,7 +309,7 @@ interface Snapshot extends SnapshotData {
|
|
|
308
309
|
interface ISnapshot {
|
|
309
310
|
id: string;
|
|
310
311
|
data: Partial<SnapshotData>;
|
|
311
|
-
|
|
312
|
+
update(data: Partial<SnapshotData>): void;
|
|
312
313
|
validate(): boolean;
|
|
313
314
|
export(): Snapshot;
|
|
314
315
|
}
|
|
@@ -327,6 +328,39 @@ interface ISnapshotCenter {
|
|
|
327
328
|
dispose(): void;
|
|
328
329
|
}
|
|
329
330
|
|
|
331
|
+
/**
|
|
332
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
333
|
+
* SPDX-License-Identifier: MIT
|
|
334
|
+
*/
|
|
335
|
+
declare enum WorkflowMessageType {
|
|
336
|
+
Log = "log",
|
|
337
|
+
Info = "info",
|
|
338
|
+
Debug = "debug",
|
|
339
|
+
Error = "error",
|
|
340
|
+
Warn = "warning"
|
|
341
|
+
}
|
|
342
|
+
interface MessageData {
|
|
343
|
+
message: string;
|
|
344
|
+
nodeID?: string;
|
|
345
|
+
timestamp?: number;
|
|
346
|
+
}
|
|
347
|
+
interface IMessage extends MessageData {
|
|
348
|
+
id: string;
|
|
349
|
+
type: WorkflowMessageType;
|
|
350
|
+
timestamp: number;
|
|
351
|
+
}
|
|
352
|
+
type WorkflowMessages = Record<WorkflowMessageType, IMessage[]>;
|
|
353
|
+
interface IMessageCenter {
|
|
354
|
+
init(): void;
|
|
355
|
+
dispose(): void;
|
|
356
|
+
log(data: MessageData): IMessage;
|
|
357
|
+
info(data: MessageData): IMessage;
|
|
358
|
+
debug(data: MessageData): IMessage;
|
|
359
|
+
error(data: MessageData): IMessage;
|
|
360
|
+
warn(data: MessageData): IMessage;
|
|
361
|
+
export(): WorkflowMessages;
|
|
362
|
+
}
|
|
363
|
+
|
|
330
364
|
/**
|
|
331
365
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
332
366
|
* SPDX-License-Identifier: MIT
|
|
@@ -360,7 +394,9 @@ declare enum FlowGramNode {
|
|
|
360
394
|
Condition = "condition",
|
|
361
395
|
Loop = "loop",
|
|
362
396
|
Comment = "comment",
|
|
363
|
-
Group = "group"
|
|
397
|
+
Group = "group",
|
|
398
|
+
BlockStart = "block-start",
|
|
399
|
+
BlockEnd = "block-end"
|
|
364
400
|
}
|
|
365
401
|
|
|
366
402
|
/**
|
|
@@ -427,6 +463,8 @@ interface INode<T = any> {
|
|
|
427
463
|
children: INode[];
|
|
428
464
|
prev: INode[];
|
|
429
465
|
next: INode[];
|
|
466
|
+
successors: INode[];
|
|
467
|
+
predecessors: INode[];
|
|
430
468
|
isBranch: boolean;
|
|
431
469
|
}
|
|
432
470
|
interface CreateNodeParams {
|
|
@@ -485,16 +523,19 @@ interface NodeReport extends StatusData {
|
|
|
485
523
|
id: string;
|
|
486
524
|
snapshots: Snapshot[];
|
|
487
525
|
}
|
|
526
|
+
type WorkflowReports = Record<string, NodeReport>;
|
|
488
527
|
interface IReport {
|
|
489
528
|
id: string;
|
|
490
529
|
inputs: WorkflowInputs;
|
|
491
530
|
outputs: WorkflowOutputs;
|
|
492
531
|
workflowStatus: StatusData;
|
|
493
|
-
reports:
|
|
532
|
+
reports: WorkflowReports;
|
|
533
|
+
messages: WorkflowMessages;
|
|
494
534
|
}
|
|
495
535
|
interface IReporter {
|
|
496
536
|
snapshotCenter: ISnapshotCenter;
|
|
497
537
|
statusCenter: IStatusCenter;
|
|
538
|
+
messageCenter: IMessageCenter;
|
|
498
539
|
init(): void;
|
|
499
540
|
dispose(): void;
|
|
500
541
|
export(): IReport;
|
|
@@ -512,6 +553,7 @@ interface ContextData {
|
|
|
512
553
|
ioCenter: IIOCenter;
|
|
513
554
|
snapshotCenter: ISnapshotCenter;
|
|
514
555
|
statusCenter: IStatusCenter;
|
|
556
|
+
messageCenter: IMessageCenter;
|
|
515
557
|
reporter: IReporter;
|
|
516
558
|
}
|
|
517
559
|
interface IContext extends ContextData {
|
|
@@ -545,8 +587,7 @@ interface TaskParams {
|
|
|
545
587
|
interface EndNodeData {
|
|
546
588
|
title: string;
|
|
547
589
|
inputs: IJsonSchema<'object'>;
|
|
548
|
-
|
|
549
|
-
outputValues: Record<string, IFlowConstantRefValue>;
|
|
590
|
+
inputsValues: Record<string, IFlowConstantRefValue>;
|
|
550
591
|
}
|
|
551
592
|
type EndNodeSchema = WorkflowNodeSchema<FlowGramNode.End, EndNodeData>;
|
|
552
593
|
|
|
@@ -581,6 +622,58 @@ interface StartNodeData {
|
|
|
581
622
|
}
|
|
582
623
|
type StartNodeSchema = WorkflowNodeSchema<FlowGramNode.Start, StartNodeData>;
|
|
583
624
|
|
|
625
|
+
/**
|
|
626
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
627
|
+
* SPDX-License-Identifier: MIT
|
|
628
|
+
*/
|
|
629
|
+
|
|
630
|
+
interface LoopNodeData {
|
|
631
|
+
title: string;
|
|
632
|
+
loopFor: IFlowRefValue;
|
|
633
|
+
loopOutputs: Record<string, IFlowRefValue>;
|
|
634
|
+
}
|
|
635
|
+
type LoopNodeSchema = WorkflowNodeSchema<FlowGramNode.Loop, LoopNodeData>;
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
639
|
+
* SPDX-License-Identifier: MIT
|
|
640
|
+
*/
|
|
641
|
+
declare enum ConditionOperation {
|
|
642
|
+
EQ = "eq",
|
|
643
|
+
NEQ = "neq",
|
|
644
|
+
GT = "gt",
|
|
645
|
+
GTE = "gte",
|
|
646
|
+
LT = "lt",
|
|
647
|
+
LTE = "lte",
|
|
648
|
+
IN = "in",
|
|
649
|
+
NIN = "nin",
|
|
650
|
+
CONTAINS = "contains",
|
|
651
|
+
NOT_CONTAINS = "not_contains",
|
|
652
|
+
IS_EMPTY = "is_empty",
|
|
653
|
+
IS_NOT_EMPTY = "is_not_empty",
|
|
654
|
+
IS_TRUE = "is_true",
|
|
655
|
+
IS_FALSE = "is_false"
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
660
|
+
* SPDX-License-Identifier: MIT
|
|
661
|
+
*/
|
|
662
|
+
|
|
663
|
+
interface ConditionItem {
|
|
664
|
+
key: string;
|
|
665
|
+
value: {
|
|
666
|
+
left: IFlowRefValue;
|
|
667
|
+
operator: ConditionOperation;
|
|
668
|
+
right: IFlowConstantRefValue;
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
interface ConditionNodeData {
|
|
672
|
+
title: string;
|
|
673
|
+
conditions: ConditionItem[];
|
|
674
|
+
}
|
|
675
|
+
type ConditionNodeSchema = WorkflowNodeSchema<FlowGramNode.Condition, ConditionNodeData>;
|
|
676
|
+
|
|
584
677
|
/**
|
|
585
678
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
586
679
|
* SPDX-License-Identifier: MIT
|
|
@@ -736,4 +829,4 @@ interface IRuntimeClient {
|
|
|
736
829
|
[FlowGramAPIName.TaskCancel]: (input: TaskCancelInput) => Promise<TaskCancelOutput | undefined>;
|
|
737
830
|
}
|
|
738
831
|
|
|
739
|
-
export { 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 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 VOData, ValidationDefine, type ValidationReq, type ValidationRes, type ValidationResult, type WorkflowEdgeSchema, type WorkflowInputs, type WorkflowNodeMetaSchema, type WorkflowNodeSchema, type WorkflowOutputs, WorkflowPortType, type WorkflowRuntimeInvoke, type WorkflowSchema, WorkflowStatus, WorkflowVariableType, type XYSchema };
|
|
832
|
+
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, type VOData, ValidationDefine, type ValidationReq, type ValidationRes, 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
|
@@ -301,6 +301,7 @@ interface SnapshotData {
|
|
|
301
301
|
outputs: WorkflowOutputs;
|
|
302
302
|
data: any;
|
|
303
303
|
branch?: string;
|
|
304
|
+
error?: string;
|
|
304
305
|
}
|
|
305
306
|
interface Snapshot extends SnapshotData {
|
|
306
307
|
id: string;
|
|
@@ -308,7 +309,7 @@ interface Snapshot extends SnapshotData {
|
|
|
308
309
|
interface ISnapshot {
|
|
309
310
|
id: string;
|
|
310
311
|
data: Partial<SnapshotData>;
|
|
311
|
-
|
|
312
|
+
update(data: Partial<SnapshotData>): void;
|
|
312
313
|
validate(): boolean;
|
|
313
314
|
export(): Snapshot;
|
|
314
315
|
}
|
|
@@ -327,6 +328,39 @@ interface ISnapshotCenter {
|
|
|
327
328
|
dispose(): void;
|
|
328
329
|
}
|
|
329
330
|
|
|
331
|
+
/**
|
|
332
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
333
|
+
* SPDX-License-Identifier: MIT
|
|
334
|
+
*/
|
|
335
|
+
declare enum WorkflowMessageType {
|
|
336
|
+
Log = "log",
|
|
337
|
+
Info = "info",
|
|
338
|
+
Debug = "debug",
|
|
339
|
+
Error = "error",
|
|
340
|
+
Warn = "warning"
|
|
341
|
+
}
|
|
342
|
+
interface MessageData {
|
|
343
|
+
message: string;
|
|
344
|
+
nodeID?: string;
|
|
345
|
+
timestamp?: number;
|
|
346
|
+
}
|
|
347
|
+
interface IMessage extends MessageData {
|
|
348
|
+
id: string;
|
|
349
|
+
type: WorkflowMessageType;
|
|
350
|
+
timestamp: number;
|
|
351
|
+
}
|
|
352
|
+
type WorkflowMessages = Record<WorkflowMessageType, IMessage[]>;
|
|
353
|
+
interface IMessageCenter {
|
|
354
|
+
init(): void;
|
|
355
|
+
dispose(): void;
|
|
356
|
+
log(data: MessageData): IMessage;
|
|
357
|
+
info(data: MessageData): IMessage;
|
|
358
|
+
debug(data: MessageData): IMessage;
|
|
359
|
+
error(data: MessageData): IMessage;
|
|
360
|
+
warn(data: MessageData): IMessage;
|
|
361
|
+
export(): WorkflowMessages;
|
|
362
|
+
}
|
|
363
|
+
|
|
330
364
|
/**
|
|
331
365
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
332
366
|
* SPDX-License-Identifier: MIT
|
|
@@ -360,7 +394,9 @@ declare enum FlowGramNode {
|
|
|
360
394
|
Condition = "condition",
|
|
361
395
|
Loop = "loop",
|
|
362
396
|
Comment = "comment",
|
|
363
|
-
Group = "group"
|
|
397
|
+
Group = "group",
|
|
398
|
+
BlockStart = "block-start",
|
|
399
|
+
BlockEnd = "block-end"
|
|
364
400
|
}
|
|
365
401
|
|
|
366
402
|
/**
|
|
@@ -427,6 +463,8 @@ interface INode<T = any> {
|
|
|
427
463
|
children: INode[];
|
|
428
464
|
prev: INode[];
|
|
429
465
|
next: INode[];
|
|
466
|
+
successors: INode[];
|
|
467
|
+
predecessors: INode[];
|
|
430
468
|
isBranch: boolean;
|
|
431
469
|
}
|
|
432
470
|
interface CreateNodeParams {
|
|
@@ -485,16 +523,19 @@ interface NodeReport extends StatusData {
|
|
|
485
523
|
id: string;
|
|
486
524
|
snapshots: Snapshot[];
|
|
487
525
|
}
|
|
526
|
+
type WorkflowReports = Record<string, NodeReport>;
|
|
488
527
|
interface IReport {
|
|
489
528
|
id: string;
|
|
490
529
|
inputs: WorkflowInputs;
|
|
491
530
|
outputs: WorkflowOutputs;
|
|
492
531
|
workflowStatus: StatusData;
|
|
493
|
-
reports:
|
|
532
|
+
reports: WorkflowReports;
|
|
533
|
+
messages: WorkflowMessages;
|
|
494
534
|
}
|
|
495
535
|
interface IReporter {
|
|
496
536
|
snapshotCenter: ISnapshotCenter;
|
|
497
537
|
statusCenter: IStatusCenter;
|
|
538
|
+
messageCenter: IMessageCenter;
|
|
498
539
|
init(): void;
|
|
499
540
|
dispose(): void;
|
|
500
541
|
export(): IReport;
|
|
@@ -512,6 +553,7 @@ interface ContextData {
|
|
|
512
553
|
ioCenter: IIOCenter;
|
|
513
554
|
snapshotCenter: ISnapshotCenter;
|
|
514
555
|
statusCenter: IStatusCenter;
|
|
556
|
+
messageCenter: IMessageCenter;
|
|
515
557
|
reporter: IReporter;
|
|
516
558
|
}
|
|
517
559
|
interface IContext extends ContextData {
|
|
@@ -545,8 +587,7 @@ interface TaskParams {
|
|
|
545
587
|
interface EndNodeData {
|
|
546
588
|
title: string;
|
|
547
589
|
inputs: IJsonSchema<'object'>;
|
|
548
|
-
|
|
549
|
-
outputValues: Record<string, IFlowConstantRefValue>;
|
|
590
|
+
inputsValues: Record<string, IFlowConstantRefValue>;
|
|
550
591
|
}
|
|
551
592
|
type EndNodeSchema = WorkflowNodeSchema<FlowGramNode.End, EndNodeData>;
|
|
552
593
|
|
|
@@ -581,6 +622,58 @@ interface StartNodeData {
|
|
|
581
622
|
}
|
|
582
623
|
type StartNodeSchema = WorkflowNodeSchema<FlowGramNode.Start, StartNodeData>;
|
|
583
624
|
|
|
625
|
+
/**
|
|
626
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
627
|
+
* SPDX-License-Identifier: MIT
|
|
628
|
+
*/
|
|
629
|
+
|
|
630
|
+
interface LoopNodeData {
|
|
631
|
+
title: string;
|
|
632
|
+
loopFor: IFlowRefValue;
|
|
633
|
+
loopOutputs: Record<string, IFlowRefValue>;
|
|
634
|
+
}
|
|
635
|
+
type LoopNodeSchema = WorkflowNodeSchema<FlowGramNode.Loop, LoopNodeData>;
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
639
|
+
* SPDX-License-Identifier: MIT
|
|
640
|
+
*/
|
|
641
|
+
declare enum ConditionOperation {
|
|
642
|
+
EQ = "eq",
|
|
643
|
+
NEQ = "neq",
|
|
644
|
+
GT = "gt",
|
|
645
|
+
GTE = "gte",
|
|
646
|
+
LT = "lt",
|
|
647
|
+
LTE = "lte",
|
|
648
|
+
IN = "in",
|
|
649
|
+
NIN = "nin",
|
|
650
|
+
CONTAINS = "contains",
|
|
651
|
+
NOT_CONTAINS = "not_contains",
|
|
652
|
+
IS_EMPTY = "is_empty",
|
|
653
|
+
IS_NOT_EMPTY = "is_not_empty",
|
|
654
|
+
IS_TRUE = "is_true",
|
|
655
|
+
IS_FALSE = "is_false"
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
660
|
+
* SPDX-License-Identifier: MIT
|
|
661
|
+
*/
|
|
662
|
+
|
|
663
|
+
interface ConditionItem {
|
|
664
|
+
key: string;
|
|
665
|
+
value: {
|
|
666
|
+
left: IFlowRefValue;
|
|
667
|
+
operator: ConditionOperation;
|
|
668
|
+
right: IFlowConstantRefValue;
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
interface ConditionNodeData {
|
|
672
|
+
title: string;
|
|
673
|
+
conditions: ConditionItem[];
|
|
674
|
+
}
|
|
675
|
+
type ConditionNodeSchema = WorkflowNodeSchema<FlowGramNode.Condition, ConditionNodeData>;
|
|
676
|
+
|
|
584
677
|
/**
|
|
585
678
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
586
679
|
* SPDX-License-Identifier: MIT
|
|
@@ -736,4 +829,4 @@ interface IRuntimeClient {
|
|
|
736
829
|
[FlowGramAPIName.TaskCancel]: (input: TaskCancelInput) => Promise<TaskCancelOutput | undefined>;
|
|
737
830
|
}
|
|
738
831
|
|
|
739
|
-
export { 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 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 VOData, ValidationDefine, type ValidationReq, type ValidationRes, type ValidationResult, type WorkflowEdgeSchema, type WorkflowInputs, type WorkflowNodeMetaSchema, type WorkflowNodeSchema, type WorkflowOutputs, WorkflowPortType, type WorkflowRuntimeInvoke, type WorkflowSchema, WorkflowStatus, WorkflowVariableType, type XYSchema };
|
|
832
|
+
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, type VOData, ValidationDefine, type ValidationReq, type ValidationRes, 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
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
ConditionOperation: () => ConditionOperation,
|
|
33
34
|
FlowGramAPIMethod: () => FlowGramAPIMethod,
|
|
34
35
|
FlowGramAPIModule: () => FlowGramAPIModule,
|
|
35
36
|
FlowGramAPIName: () => FlowGramAPIName,
|
|
@@ -45,6 +46,7 @@ __export(src_exports, {
|
|
|
45
46
|
TaskResultDefine: () => TaskResultDefine,
|
|
46
47
|
TaskRunDefine: () => TaskRunDefine,
|
|
47
48
|
ValidationDefine: () => ValidationDefine,
|
|
49
|
+
WorkflowMessageType: () => WorkflowMessageType,
|
|
48
50
|
WorkflowPortType: () => WorkflowPortType,
|
|
49
51
|
WorkflowStatus: () => WorkflowStatus,
|
|
50
52
|
WorkflowVariableType: () => WorkflowVariableType
|
|
@@ -273,9 +275,30 @@ var FlowGramNode = /* @__PURE__ */ ((FlowGramNode2) => {
|
|
|
273
275
|
FlowGramNode2["Loop"] = "loop";
|
|
274
276
|
FlowGramNode2["Comment"] = "comment";
|
|
275
277
|
FlowGramNode2["Group"] = "group";
|
|
278
|
+
FlowGramNode2["BlockStart"] = "block-start";
|
|
279
|
+
FlowGramNode2["BlockEnd"] = "block-end";
|
|
276
280
|
return FlowGramNode2;
|
|
277
281
|
})(FlowGramNode || {});
|
|
278
282
|
|
|
283
|
+
// src/node/condition/constant.ts
|
|
284
|
+
var ConditionOperation = /* @__PURE__ */ ((ConditionOperation2) => {
|
|
285
|
+
ConditionOperation2["EQ"] = "eq";
|
|
286
|
+
ConditionOperation2["NEQ"] = "neq";
|
|
287
|
+
ConditionOperation2["GT"] = "gt";
|
|
288
|
+
ConditionOperation2["GTE"] = "gte";
|
|
289
|
+
ConditionOperation2["LT"] = "lt";
|
|
290
|
+
ConditionOperation2["LTE"] = "lte";
|
|
291
|
+
ConditionOperation2["IN"] = "in";
|
|
292
|
+
ConditionOperation2["NIN"] = "nin";
|
|
293
|
+
ConditionOperation2["CONTAINS"] = "contains";
|
|
294
|
+
ConditionOperation2["NOT_CONTAINS"] = "not_contains";
|
|
295
|
+
ConditionOperation2["IS_EMPTY"] = "is_empty";
|
|
296
|
+
ConditionOperation2["IS_NOT_EMPTY"] = "is_not_empty";
|
|
297
|
+
ConditionOperation2["IS_TRUE"] = "is_true";
|
|
298
|
+
ConditionOperation2["IS_FALSE"] = "is_false";
|
|
299
|
+
return ConditionOperation2;
|
|
300
|
+
})(ConditionOperation || {});
|
|
301
|
+
|
|
279
302
|
// src/runtime/engine/index.ts
|
|
280
303
|
var IEngine = Symbol.for("Engine");
|
|
281
304
|
|
|
@@ -294,8 +317,19 @@ var WorkflowStatus = /* @__PURE__ */ ((WorkflowStatus2) => {
|
|
|
294
317
|
|
|
295
318
|
// src/runtime/validation/index.ts
|
|
296
319
|
var IValidation = Symbol.for("Validation");
|
|
320
|
+
|
|
321
|
+
// src/runtime/message/index.ts
|
|
322
|
+
var WorkflowMessageType = /* @__PURE__ */ ((WorkflowMessageType2) => {
|
|
323
|
+
WorkflowMessageType2["Log"] = "log";
|
|
324
|
+
WorkflowMessageType2["Info"] = "info";
|
|
325
|
+
WorkflowMessageType2["Debug"] = "debug";
|
|
326
|
+
WorkflowMessageType2["Error"] = "error";
|
|
327
|
+
WorkflowMessageType2["Warn"] = "warning";
|
|
328
|
+
return WorkflowMessageType2;
|
|
329
|
+
})(WorkflowMessageType || {});
|
|
297
330
|
// Annotate the CommonJS export names for ESM import in node:
|
|
298
331
|
0 && (module.exports = {
|
|
332
|
+
ConditionOperation,
|
|
299
333
|
FlowGramAPIMethod,
|
|
300
334
|
FlowGramAPIModule,
|
|
301
335
|
FlowGramAPIName,
|
|
@@ -311,6 +345,7 @@ var IValidation = Symbol.for("Validation");
|
|
|
311
345
|
TaskResultDefine,
|
|
312
346
|
TaskRunDefine,
|
|
313
347
|
ValidationDefine,
|
|
348
|
+
WorkflowMessageType,
|
|
314
349
|
WorkflowPortType,
|
|
315
350
|
WorkflowStatus,
|
|
316
351
|
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/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}\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;;;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,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;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AAA;AAAA,GAAA;AAKL,IAAK,uBAAL,kBAAKC,0BAAL;AACL,EAAAA,sBAAA,YAAS;AACT,EAAAA,sBAAA,aAAU;AACV,EAAAA,sBAAA,YAAS;AACT,EAAAA,sBAAA,aAAU;AACV,EAAAA,sBAAA,YAAS;AACT,EAAAA,sBAAA,WAAQ;AACR,EAAAA,sBAAA,UAAO;AAPG,SAAAA;AAAA,GAAA;;;ACLL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,UAAO;AACP,EAAAA,cAAA,WAAQ;AACR,EAAAA,cAAA,SAAM;AACN,EAAAA,cAAA,SAAM;AACN,EAAAA,cAAA,UAAO;AACP,EAAAA,cAAA,eAAY;AACZ,EAAAA,cAAA,UAAO;AACP,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,WAAQ;AATE,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","WorkflowStatus"]}
|
|
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","../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 } 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","/**\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A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AO;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;;;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":["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","WorkflowMessageType"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowgram.ai/runtime-interface",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.23",
|
|
4
4
|
"homepage": "https://flowgram.ai/",
|
|
5
5
|
"repository": "https://github.com/bytedance/flowgram.ai",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"tsup": "^8.0.1",
|
|
24
24
|
"typescript": "^5.0.4",
|
|
25
25
|
"vitest": "^0.34.6",
|
|
26
|
-
"@flowgram.ai/eslint-config": "0.2.
|
|
27
|
-
"@flowgram.ai/ts-config": "0.2.
|
|
26
|
+
"@flowgram.ai/eslint-config": "0.2.23",
|
|
27
|
+
"@flowgram.ai/ts-config": "0.2.23"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public",
|