@flowgram.ai/runtime-interface 0.2.16 → 0.2.18
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.map +1 -1
- package/dist/index.d.mts +204 -0
- package/dist/index.d.ts +204 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
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":["import 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","export 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","import 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","import 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","import 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","import 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","import 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","import 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","import { 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","export 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","export 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","import { 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","import { 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","export 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","import { 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,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,iBA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A,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","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/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,MAAM,EAAE,OAAO;AAAA,YACb,cAAc,EAAE,OAAO;AAAA,YACvB,cAAc,EAAE,OAAO;AAAA,YACvB,cAAc,EAAE,OAAO,EAAE,SAAS;AAAA,Y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PIName","FlowGramAPIModule","z","z","z","z","z","z","z","z","z","z","z","WorkflowPortType","WorkflowVariableType","FlowGramNode","WorkflowStatus"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
5
|
+
* SPDX-License-Identifier: MIT
|
|
6
|
+
*/
|
|
3
7
|
declare enum FlowGramAPIMethod {
|
|
4
8
|
GET = "GET",
|
|
5
9
|
POST = "POST",
|
|
@@ -21,6 +25,11 @@ declare enum FlowGramAPIModule {
|
|
|
21
25
|
Validation = "Validation"
|
|
22
26
|
}
|
|
23
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
30
|
+
* SPDX-License-Identifier: MIT
|
|
31
|
+
*/
|
|
32
|
+
|
|
24
33
|
interface FlowGramAPIDefine {
|
|
25
34
|
name: FlowGramAPIName;
|
|
26
35
|
method: FlowGramAPIMethod;
|
|
@@ -35,16 +44,33 @@ interface FlowGramAPIDefines {
|
|
|
35
44
|
[key: string]: FlowGramAPIDefine;
|
|
36
45
|
}
|
|
37
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
49
|
+
* SPDX-License-Identifier: MIT
|
|
50
|
+
*/
|
|
51
|
+
|
|
38
52
|
declare const FlowGramAPIs: FlowGramAPIDefines;
|
|
39
53
|
declare const FlowGramAPINames: FlowGramAPIName[];
|
|
40
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
57
|
+
* SPDX-License-Identifier: MIT
|
|
58
|
+
*/
|
|
41
59
|
type ContainerService = any;
|
|
42
60
|
interface IContainer {
|
|
43
61
|
get<T = ContainerService>(key: any): T;
|
|
44
62
|
}
|
|
45
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
66
|
+
* SPDX-License-Identifier: MIT
|
|
67
|
+
*/
|
|
46
68
|
type VOData<T> = Omit<T, 'id'>;
|
|
47
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
72
|
+
* SPDX-License-Identifier: MIT
|
|
73
|
+
*/
|
|
48
74
|
interface WorkflowEdgeSchema {
|
|
49
75
|
sourceNodeID: string;
|
|
50
76
|
targetNodeID: string;
|
|
@@ -52,6 +78,10 @@ interface WorkflowEdgeSchema {
|
|
|
52
78
|
targetPortID?: string;
|
|
53
79
|
}
|
|
54
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
83
|
+
* SPDX-License-Identifier: MIT
|
|
84
|
+
*/
|
|
55
85
|
type JsonSchemaBasicType = 'boolean' | 'string' | 'integer' | 'number' | 'object' | 'array' | 'map';
|
|
56
86
|
interface IJsonSchema<T = string> {
|
|
57
87
|
type: T;
|
|
@@ -73,17 +103,30 @@ interface IJsonSchema<T = string> {
|
|
|
73
103
|
}
|
|
74
104
|
type IBasicJsonSchema = IJsonSchema<JsonSchemaBasicType>;
|
|
75
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
108
|
+
* SPDX-License-Identifier: MIT
|
|
109
|
+
*/
|
|
76
110
|
interface XYSchema {
|
|
77
111
|
x: number;
|
|
78
112
|
y: number;
|
|
79
113
|
}
|
|
80
114
|
type PositionSchema = XYSchema;
|
|
81
115
|
|
|
116
|
+
/**
|
|
117
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
118
|
+
* SPDX-License-Identifier: MIT
|
|
119
|
+
*/
|
|
120
|
+
|
|
82
121
|
interface WorkflowNodeMetaSchema {
|
|
83
122
|
position: PositionSchema;
|
|
84
123
|
canvasPosition?: PositionSchema;
|
|
85
124
|
}
|
|
86
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
128
|
+
* SPDX-License-Identifier: MIT
|
|
129
|
+
*/
|
|
87
130
|
interface IFlowConstantValue {
|
|
88
131
|
type: 'constant';
|
|
89
132
|
content?: string | number | boolean;
|
|
@@ -94,6 +137,11 @@ interface IFlowRefValue {
|
|
|
94
137
|
}
|
|
95
138
|
type IFlowConstantRefValue = IFlowConstantValue | IFlowRefValue;
|
|
96
139
|
|
|
140
|
+
/**
|
|
141
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
142
|
+
* SPDX-License-Identifier: MIT
|
|
143
|
+
*/
|
|
144
|
+
|
|
97
145
|
interface WorkflowNodeSchema<T = string, D = any> {
|
|
98
146
|
id: string;
|
|
99
147
|
type: T;
|
|
@@ -109,11 +157,20 @@ interface WorkflowNodeSchema<T = string, D = any> {
|
|
|
109
157
|
edges?: WorkflowEdgeSchema[];
|
|
110
158
|
}
|
|
111
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
162
|
+
* SPDX-License-Identifier: MIT
|
|
163
|
+
*/
|
|
164
|
+
|
|
112
165
|
interface WorkflowSchema {
|
|
113
166
|
nodes: WorkflowNodeSchema[];
|
|
114
167
|
edges: WorkflowEdgeSchema[];
|
|
115
168
|
}
|
|
116
169
|
|
|
170
|
+
/**
|
|
171
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
172
|
+
* SPDX-License-Identifier: MIT
|
|
173
|
+
*/
|
|
117
174
|
declare enum WorkflowPortType {
|
|
118
175
|
Input = "input",
|
|
119
176
|
Output = "output"
|
|
@@ -128,15 +185,29 @@ declare enum WorkflowVariableType {
|
|
|
128
185
|
Null = "null"
|
|
129
186
|
}
|
|
130
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
190
|
+
* SPDX-License-Identifier: MIT
|
|
191
|
+
*/
|
|
131
192
|
type WorkflowInputs = Record<string, any>;
|
|
132
193
|
type WorkflowOutputs = Record<string, any>;
|
|
133
194
|
|
|
195
|
+
/**
|
|
196
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
197
|
+
* SPDX-License-Identifier: MIT
|
|
198
|
+
*/
|
|
199
|
+
|
|
134
200
|
interface InvokeParams {
|
|
135
201
|
schema: WorkflowSchema;
|
|
136
202
|
inputs: WorkflowInputs;
|
|
137
203
|
}
|
|
138
204
|
type WorkflowRuntimeInvoke = (params: InvokeParams) => Promise<WorkflowInputs>;
|
|
139
205
|
|
|
206
|
+
/**
|
|
207
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
208
|
+
* SPDX-License-Identifier: MIT
|
|
209
|
+
*/
|
|
210
|
+
|
|
140
211
|
interface VariableTypeInfo {
|
|
141
212
|
type: WorkflowVariableType;
|
|
142
213
|
itemsType?: WorkflowVariableType;
|
|
@@ -175,6 +246,10 @@ interface IVariableStore {
|
|
|
175
246
|
dispose(): void;
|
|
176
247
|
}
|
|
177
248
|
|
|
249
|
+
/**
|
|
250
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
251
|
+
* SPDX-License-Identifier: MIT
|
|
252
|
+
*/
|
|
178
253
|
declare enum WorkflowStatus {
|
|
179
254
|
Pending = "pending",
|
|
180
255
|
Processing = "processing",
|
|
@@ -206,6 +281,11 @@ interface IStatusCenter {
|
|
|
206
281
|
exportNodeStatus(): Record<string, StatusData>;
|
|
207
282
|
}
|
|
208
283
|
|
|
284
|
+
/**
|
|
285
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
286
|
+
* SPDX-License-Identifier: MIT
|
|
287
|
+
*/
|
|
288
|
+
|
|
209
289
|
interface SnapshotData {
|
|
210
290
|
nodeID: string;
|
|
211
291
|
inputs: WorkflowInputs;
|
|
@@ -224,6 +304,11 @@ interface ISnapshot {
|
|
|
224
304
|
export(): Snapshot;
|
|
225
305
|
}
|
|
226
306
|
|
|
307
|
+
/**
|
|
308
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
309
|
+
* SPDX-License-Identifier: MIT
|
|
310
|
+
*/
|
|
311
|
+
|
|
227
312
|
interface ISnapshotCenter {
|
|
228
313
|
id: string;
|
|
229
314
|
create(snapshot: Partial<SnapshotData>): ISnapshot;
|
|
@@ -233,6 +318,11 @@ interface ISnapshotCenter {
|
|
|
233
318
|
dispose(): void;
|
|
234
319
|
}
|
|
235
320
|
|
|
321
|
+
/**
|
|
322
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
323
|
+
* SPDX-License-Identifier: MIT
|
|
324
|
+
*/
|
|
325
|
+
|
|
236
326
|
interface IOData {
|
|
237
327
|
inputs: WorkflowInputs;
|
|
238
328
|
outputs: WorkflowOutputs;
|
|
@@ -248,6 +338,10 @@ interface IIOCenter {
|
|
|
248
338
|
export(): IOData;
|
|
249
339
|
}
|
|
250
340
|
|
|
341
|
+
/**
|
|
342
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
343
|
+
* SPDX-License-Identifier: MIT
|
|
344
|
+
*/
|
|
251
345
|
declare enum FlowGramNode {
|
|
252
346
|
Root = "root",
|
|
253
347
|
Start = "start",
|
|
@@ -260,6 +354,11 @@ declare enum FlowGramNode {
|
|
|
260
354
|
Group = "group"
|
|
261
355
|
}
|
|
262
356
|
|
|
357
|
+
/**
|
|
358
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
359
|
+
* SPDX-License-Identifier: MIT
|
|
360
|
+
*/
|
|
361
|
+
|
|
263
362
|
interface IEdge {
|
|
264
363
|
id: string;
|
|
265
364
|
from: INode;
|
|
@@ -273,6 +372,11 @@ interface CreateEdgeParams {
|
|
|
273
372
|
to: INode;
|
|
274
373
|
}
|
|
275
374
|
|
|
375
|
+
/**
|
|
376
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
377
|
+
* SPDX-License-Identifier: MIT
|
|
378
|
+
*/
|
|
379
|
+
|
|
276
380
|
interface IPort {
|
|
277
381
|
id: string;
|
|
278
382
|
node: INode;
|
|
@@ -285,6 +389,11 @@ interface CreatePortParams {
|
|
|
285
389
|
type: WorkflowPortType;
|
|
286
390
|
}
|
|
287
391
|
|
|
392
|
+
/**
|
|
393
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
394
|
+
* SPDX-License-Identifier: MIT
|
|
395
|
+
*/
|
|
396
|
+
|
|
288
397
|
interface NodeDeclare {
|
|
289
398
|
inputsValues?: Record<string, IFlowConstantRefValue>;
|
|
290
399
|
inputs?: IJsonSchema;
|
|
@@ -320,6 +429,11 @@ interface CreateNodeParams {
|
|
|
320
429
|
data?: any;
|
|
321
430
|
}
|
|
322
431
|
|
|
432
|
+
/**
|
|
433
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
434
|
+
* SPDX-License-Identifier: MIT
|
|
435
|
+
*/
|
|
436
|
+
|
|
323
437
|
interface IDocument {
|
|
324
438
|
id: string;
|
|
325
439
|
nodes: INode[];
|
|
@@ -331,6 +445,11 @@ interface IDocument {
|
|
|
331
445
|
dispose(): void;
|
|
332
446
|
}
|
|
333
447
|
|
|
448
|
+
/**
|
|
449
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
450
|
+
* SPDX-License-Identifier: MIT
|
|
451
|
+
*/
|
|
452
|
+
|
|
334
453
|
interface IState {
|
|
335
454
|
id: string;
|
|
336
455
|
variableStore: IVariableStore;
|
|
@@ -347,6 +466,11 @@ interface IState {
|
|
|
347
466
|
addExecutedNode(node: INode): void;
|
|
348
467
|
}
|
|
349
468
|
|
|
469
|
+
/**
|
|
470
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
471
|
+
* SPDX-License-Identifier: MIT
|
|
472
|
+
*/
|
|
473
|
+
|
|
350
474
|
interface NodeReport extends StatusData {
|
|
351
475
|
id: string;
|
|
352
476
|
snapshots: Snapshot[];
|
|
@@ -366,6 +490,11 @@ interface IReporter {
|
|
|
366
490
|
export(): IReport;
|
|
367
491
|
}
|
|
368
492
|
|
|
493
|
+
/**
|
|
494
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
495
|
+
* SPDX-License-Identifier: MIT
|
|
496
|
+
*/
|
|
497
|
+
|
|
369
498
|
interface ContextData {
|
|
370
499
|
variableStore: IVariableStore;
|
|
371
500
|
state: IState;
|
|
@@ -382,6 +511,11 @@ interface IContext extends ContextData {
|
|
|
382
511
|
sub(): IContext;
|
|
383
512
|
}
|
|
384
513
|
|
|
514
|
+
/**
|
|
515
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
516
|
+
* SPDX-License-Identifier: MIT
|
|
517
|
+
*/
|
|
518
|
+
|
|
385
519
|
interface ITask {
|
|
386
520
|
id: string;
|
|
387
521
|
processing: Promise<WorkflowOutputs>;
|
|
@@ -393,6 +527,11 @@ interface TaskParams {
|
|
|
393
527
|
context: IContext;
|
|
394
528
|
}
|
|
395
529
|
|
|
530
|
+
/**
|
|
531
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
532
|
+
* SPDX-License-Identifier: MIT
|
|
533
|
+
*/
|
|
534
|
+
|
|
396
535
|
interface EndNodeData {
|
|
397
536
|
title: string;
|
|
398
537
|
inputs: IJsonSchema<'object'>;
|
|
@@ -401,6 +540,11 @@ interface EndNodeData {
|
|
|
401
540
|
}
|
|
402
541
|
type EndNodeSchema = WorkflowNodeSchema<FlowGramNode.End, EndNodeData>;
|
|
403
542
|
|
|
543
|
+
/**
|
|
544
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
545
|
+
* SPDX-License-Identifier: MIT
|
|
546
|
+
*/
|
|
547
|
+
|
|
404
548
|
interface LLMNodeData {
|
|
405
549
|
title: string;
|
|
406
550
|
inputs: IJsonSchema<'object'>;
|
|
@@ -416,12 +560,22 @@ interface LLMNodeData {
|
|
|
416
560
|
}
|
|
417
561
|
type LLMNodeSchema = WorkflowNodeSchema<FlowGramNode.LLM, LLMNodeData>;
|
|
418
562
|
|
|
563
|
+
/**
|
|
564
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
565
|
+
* SPDX-License-Identifier: MIT
|
|
566
|
+
*/
|
|
567
|
+
|
|
419
568
|
interface StartNodeData {
|
|
420
569
|
title: string;
|
|
421
570
|
outputs: IJsonSchema<'object'>;
|
|
422
571
|
}
|
|
423
572
|
type StartNodeSchema = WorkflowNodeSchema<FlowGramNode.Start, StartNodeData>;
|
|
424
573
|
|
|
574
|
+
/**
|
|
575
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
576
|
+
* SPDX-License-Identifier: MIT
|
|
577
|
+
*/
|
|
578
|
+
|
|
425
579
|
interface ExecutionContext {
|
|
426
580
|
node: INode;
|
|
427
581
|
inputs: WorkflowInputs;
|
|
@@ -440,12 +594,22 @@ interface INodeExecutorFactory {
|
|
|
440
594
|
new (): INodeExecutor;
|
|
441
595
|
}
|
|
442
596
|
|
|
597
|
+
/**
|
|
598
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
599
|
+
* SPDX-License-Identifier: MIT
|
|
600
|
+
*/
|
|
601
|
+
|
|
443
602
|
interface IExecutor {
|
|
444
603
|
execute: (context: ExecutionContext) => Promise<ExecutionResult>;
|
|
445
604
|
register: (executor: INodeExecutor) => void;
|
|
446
605
|
}
|
|
447
606
|
declare const IExecutor: unique symbol;
|
|
448
607
|
|
|
608
|
+
/**
|
|
609
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
610
|
+
* SPDX-License-Identifier: MIT
|
|
611
|
+
*/
|
|
612
|
+
|
|
449
613
|
interface EngineServices {
|
|
450
614
|
Executor: IExecutor;
|
|
451
615
|
}
|
|
@@ -458,6 +622,11 @@ interface IEngine {
|
|
|
458
622
|
}
|
|
459
623
|
declare const IEngine: unique symbol;
|
|
460
624
|
|
|
625
|
+
/**
|
|
626
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
627
|
+
* SPDX-License-Identifier: MIT
|
|
628
|
+
*/
|
|
629
|
+
|
|
461
630
|
interface ValidationResult {
|
|
462
631
|
valid: boolean;
|
|
463
632
|
errors?: string[];
|
|
@@ -467,6 +636,11 @@ interface IValidation {
|
|
|
467
636
|
}
|
|
468
637
|
declare const IValidation: unique symbol;
|
|
469
638
|
|
|
639
|
+
/**
|
|
640
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
641
|
+
* SPDX-License-Identifier: MIT
|
|
642
|
+
*/
|
|
643
|
+
|
|
470
644
|
interface TaskRunInput {
|
|
471
645
|
inputs: WorkflowInputs;
|
|
472
646
|
schema: string;
|
|
@@ -476,6 +650,11 @@ interface TaskRunOutput {
|
|
|
476
650
|
}
|
|
477
651
|
declare const TaskRunDefine: FlowGramAPIDefine;
|
|
478
652
|
|
|
653
|
+
/**
|
|
654
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
655
|
+
* SPDX-License-Identifier: MIT
|
|
656
|
+
*/
|
|
657
|
+
|
|
479
658
|
interface ServerInfoInput {
|
|
480
659
|
}
|
|
481
660
|
interface ServerInfoOutput {
|
|
@@ -488,12 +667,22 @@ interface ServerInfoOutput {
|
|
|
488
667
|
}
|
|
489
668
|
declare const ServerInfoDefine: FlowGramAPIDefine;
|
|
490
669
|
|
|
670
|
+
/**
|
|
671
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
672
|
+
* SPDX-License-Identifier: MIT
|
|
673
|
+
*/
|
|
674
|
+
|
|
491
675
|
interface TaskReportInput {
|
|
492
676
|
taskID: string;
|
|
493
677
|
}
|
|
494
678
|
type TaskReportOutput = IReport | undefined;
|
|
495
679
|
declare const TaskReportDefine: FlowGramAPIDefine;
|
|
496
680
|
|
|
681
|
+
/**
|
|
682
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
683
|
+
* SPDX-License-Identifier: MIT
|
|
684
|
+
*/
|
|
685
|
+
|
|
497
686
|
interface ValidationReq {
|
|
498
687
|
schema: string;
|
|
499
688
|
}
|
|
@@ -501,12 +690,22 @@ interface ValidationRes extends ValidationResult {
|
|
|
501
690
|
}
|
|
502
691
|
declare const ValidationDefine: FlowGramAPIDefine;
|
|
503
692
|
|
|
693
|
+
/**
|
|
694
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
695
|
+
* SPDX-License-Identifier: MIT
|
|
696
|
+
*/
|
|
697
|
+
|
|
504
698
|
interface TaskResultInput {
|
|
505
699
|
taskID: string;
|
|
506
700
|
}
|
|
507
701
|
type TaskResultOutput = WorkflowOutputs | undefined;
|
|
508
702
|
declare const TaskResultDefine: FlowGramAPIDefine;
|
|
509
703
|
|
|
704
|
+
/**
|
|
705
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
706
|
+
* SPDX-License-Identifier: MIT
|
|
707
|
+
*/
|
|
708
|
+
|
|
510
709
|
interface TaskCancelInput {
|
|
511
710
|
taskID: string;
|
|
512
711
|
}
|
|
@@ -515,6 +714,11 @@ type TaskCancelOutput = {
|
|
|
515
714
|
};
|
|
516
715
|
declare const TaskCancelDefine: FlowGramAPIDefine;
|
|
517
716
|
|
|
717
|
+
/**
|
|
718
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
719
|
+
* SPDX-License-Identifier: MIT
|
|
720
|
+
*/
|
|
721
|
+
|
|
518
722
|
interface IRuntimeClient {
|
|
519
723
|
[FlowGramAPIName.TaskRun]: (input: TaskRunInput) => Promise<TaskRunOutput | undefined>;
|
|
520
724
|
[FlowGramAPIName.TaskReport]: (input: TaskReportInput) => Promise<TaskReportOutput | undefined>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
5
|
+
* SPDX-License-Identifier: MIT
|
|
6
|
+
*/
|
|
3
7
|
declare enum FlowGramAPIMethod {
|
|
4
8
|
GET = "GET",
|
|
5
9
|
POST = "POST",
|
|
@@ -21,6 +25,11 @@ declare enum FlowGramAPIModule {
|
|
|
21
25
|
Validation = "Validation"
|
|
22
26
|
}
|
|
23
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
30
|
+
* SPDX-License-Identifier: MIT
|
|
31
|
+
*/
|
|
32
|
+
|
|
24
33
|
interface FlowGramAPIDefine {
|
|
25
34
|
name: FlowGramAPIName;
|
|
26
35
|
method: FlowGramAPIMethod;
|
|
@@ -35,16 +44,33 @@ interface FlowGramAPIDefines {
|
|
|
35
44
|
[key: string]: FlowGramAPIDefine;
|
|
36
45
|
}
|
|
37
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
49
|
+
* SPDX-License-Identifier: MIT
|
|
50
|
+
*/
|
|
51
|
+
|
|
38
52
|
declare const FlowGramAPIs: FlowGramAPIDefines;
|
|
39
53
|
declare const FlowGramAPINames: FlowGramAPIName[];
|
|
40
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
57
|
+
* SPDX-License-Identifier: MIT
|
|
58
|
+
*/
|
|
41
59
|
type ContainerService = any;
|
|
42
60
|
interface IContainer {
|
|
43
61
|
get<T = ContainerService>(key: any): T;
|
|
44
62
|
}
|
|
45
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
66
|
+
* SPDX-License-Identifier: MIT
|
|
67
|
+
*/
|
|
46
68
|
type VOData<T> = Omit<T, 'id'>;
|
|
47
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
72
|
+
* SPDX-License-Identifier: MIT
|
|
73
|
+
*/
|
|
48
74
|
interface WorkflowEdgeSchema {
|
|
49
75
|
sourceNodeID: string;
|
|
50
76
|
targetNodeID: string;
|
|
@@ -52,6 +78,10 @@ interface WorkflowEdgeSchema {
|
|
|
52
78
|
targetPortID?: string;
|
|
53
79
|
}
|
|
54
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
83
|
+
* SPDX-License-Identifier: MIT
|
|
84
|
+
*/
|
|
55
85
|
type JsonSchemaBasicType = 'boolean' | 'string' | 'integer' | 'number' | 'object' | 'array' | 'map';
|
|
56
86
|
interface IJsonSchema<T = string> {
|
|
57
87
|
type: T;
|
|
@@ -73,17 +103,30 @@ interface IJsonSchema<T = string> {
|
|
|
73
103
|
}
|
|
74
104
|
type IBasicJsonSchema = IJsonSchema<JsonSchemaBasicType>;
|
|
75
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
108
|
+
* SPDX-License-Identifier: MIT
|
|
109
|
+
*/
|
|
76
110
|
interface XYSchema {
|
|
77
111
|
x: number;
|
|
78
112
|
y: number;
|
|
79
113
|
}
|
|
80
114
|
type PositionSchema = XYSchema;
|
|
81
115
|
|
|
116
|
+
/**
|
|
117
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
118
|
+
* SPDX-License-Identifier: MIT
|
|
119
|
+
*/
|
|
120
|
+
|
|
82
121
|
interface WorkflowNodeMetaSchema {
|
|
83
122
|
position: PositionSchema;
|
|
84
123
|
canvasPosition?: PositionSchema;
|
|
85
124
|
}
|
|
86
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
128
|
+
* SPDX-License-Identifier: MIT
|
|
129
|
+
*/
|
|
87
130
|
interface IFlowConstantValue {
|
|
88
131
|
type: 'constant';
|
|
89
132
|
content?: string | number | boolean;
|
|
@@ -94,6 +137,11 @@ interface IFlowRefValue {
|
|
|
94
137
|
}
|
|
95
138
|
type IFlowConstantRefValue = IFlowConstantValue | IFlowRefValue;
|
|
96
139
|
|
|
140
|
+
/**
|
|
141
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
142
|
+
* SPDX-License-Identifier: MIT
|
|
143
|
+
*/
|
|
144
|
+
|
|
97
145
|
interface WorkflowNodeSchema<T = string, D = any> {
|
|
98
146
|
id: string;
|
|
99
147
|
type: T;
|
|
@@ -109,11 +157,20 @@ interface WorkflowNodeSchema<T = string, D = any> {
|
|
|
109
157
|
edges?: WorkflowEdgeSchema[];
|
|
110
158
|
}
|
|
111
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
162
|
+
* SPDX-License-Identifier: MIT
|
|
163
|
+
*/
|
|
164
|
+
|
|
112
165
|
interface WorkflowSchema {
|
|
113
166
|
nodes: WorkflowNodeSchema[];
|
|
114
167
|
edges: WorkflowEdgeSchema[];
|
|
115
168
|
}
|
|
116
169
|
|
|
170
|
+
/**
|
|
171
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
172
|
+
* SPDX-License-Identifier: MIT
|
|
173
|
+
*/
|
|
117
174
|
declare enum WorkflowPortType {
|
|
118
175
|
Input = "input",
|
|
119
176
|
Output = "output"
|
|
@@ -128,15 +185,29 @@ declare enum WorkflowVariableType {
|
|
|
128
185
|
Null = "null"
|
|
129
186
|
}
|
|
130
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
190
|
+
* SPDX-License-Identifier: MIT
|
|
191
|
+
*/
|
|
131
192
|
type WorkflowInputs = Record<string, any>;
|
|
132
193
|
type WorkflowOutputs = Record<string, any>;
|
|
133
194
|
|
|
195
|
+
/**
|
|
196
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
197
|
+
* SPDX-License-Identifier: MIT
|
|
198
|
+
*/
|
|
199
|
+
|
|
134
200
|
interface InvokeParams {
|
|
135
201
|
schema: WorkflowSchema;
|
|
136
202
|
inputs: WorkflowInputs;
|
|
137
203
|
}
|
|
138
204
|
type WorkflowRuntimeInvoke = (params: InvokeParams) => Promise<WorkflowInputs>;
|
|
139
205
|
|
|
206
|
+
/**
|
|
207
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
208
|
+
* SPDX-License-Identifier: MIT
|
|
209
|
+
*/
|
|
210
|
+
|
|
140
211
|
interface VariableTypeInfo {
|
|
141
212
|
type: WorkflowVariableType;
|
|
142
213
|
itemsType?: WorkflowVariableType;
|
|
@@ -175,6 +246,10 @@ interface IVariableStore {
|
|
|
175
246
|
dispose(): void;
|
|
176
247
|
}
|
|
177
248
|
|
|
249
|
+
/**
|
|
250
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
251
|
+
* SPDX-License-Identifier: MIT
|
|
252
|
+
*/
|
|
178
253
|
declare enum WorkflowStatus {
|
|
179
254
|
Pending = "pending",
|
|
180
255
|
Processing = "processing",
|
|
@@ -206,6 +281,11 @@ interface IStatusCenter {
|
|
|
206
281
|
exportNodeStatus(): Record<string, StatusData>;
|
|
207
282
|
}
|
|
208
283
|
|
|
284
|
+
/**
|
|
285
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
286
|
+
* SPDX-License-Identifier: MIT
|
|
287
|
+
*/
|
|
288
|
+
|
|
209
289
|
interface SnapshotData {
|
|
210
290
|
nodeID: string;
|
|
211
291
|
inputs: WorkflowInputs;
|
|
@@ -224,6 +304,11 @@ interface ISnapshot {
|
|
|
224
304
|
export(): Snapshot;
|
|
225
305
|
}
|
|
226
306
|
|
|
307
|
+
/**
|
|
308
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
309
|
+
* SPDX-License-Identifier: MIT
|
|
310
|
+
*/
|
|
311
|
+
|
|
227
312
|
interface ISnapshotCenter {
|
|
228
313
|
id: string;
|
|
229
314
|
create(snapshot: Partial<SnapshotData>): ISnapshot;
|
|
@@ -233,6 +318,11 @@ interface ISnapshotCenter {
|
|
|
233
318
|
dispose(): void;
|
|
234
319
|
}
|
|
235
320
|
|
|
321
|
+
/**
|
|
322
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
323
|
+
* SPDX-License-Identifier: MIT
|
|
324
|
+
*/
|
|
325
|
+
|
|
236
326
|
interface IOData {
|
|
237
327
|
inputs: WorkflowInputs;
|
|
238
328
|
outputs: WorkflowOutputs;
|
|
@@ -248,6 +338,10 @@ interface IIOCenter {
|
|
|
248
338
|
export(): IOData;
|
|
249
339
|
}
|
|
250
340
|
|
|
341
|
+
/**
|
|
342
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
343
|
+
* SPDX-License-Identifier: MIT
|
|
344
|
+
*/
|
|
251
345
|
declare enum FlowGramNode {
|
|
252
346
|
Root = "root",
|
|
253
347
|
Start = "start",
|
|
@@ -260,6 +354,11 @@ declare enum FlowGramNode {
|
|
|
260
354
|
Group = "group"
|
|
261
355
|
}
|
|
262
356
|
|
|
357
|
+
/**
|
|
358
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
359
|
+
* SPDX-License-Identifier: MIT
|
|
360
|
+
*/
|
|
361
|
+
|
|
263
362
|
interface IEdge {
|
|
264
363
|
id: string;
|
|
265
364
|
from: INode;
|
|
@@ -273,6 +372,11 @@ interface CreateEdgeParams {
|
|
|
273
372
|
to: INode;
|
|
274
373
|
}
|
|
275
374
|
|
|
375
|
+
/**
|
|
376
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
377
|
+
* SPDX-License-Identifier: MIT
|
|
378
|
+
*/
|
|
379
|
+
|
|
276
380
|
interface IPort {
|
|
277
381
|
id: string;
|
|
278
382
|
node: INode;
|
|
@@ -285,6 +389,11 @@ interface CreatePortParams {
|
|
|
285
389
|
type: WorkflowPortType;
|
|
286
390
|
}
|
|
287
391
|
|
|
392
|
+
/**
|
|
393
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
394
|
+
* SPDX-License-Identifier: MIT
|
|
395
|
+
*/
|
|
396
|
+
|
|
288
397
|
interface NodeDeclare {
|
|
289
398
|
inputsValues?: Record<string, IFlowConstantRefValue>;
|
|
290
399
|
inputs?: IJsonSchema;
|
|
@@ -320,6 +429,11 @@ interface CreateNodeParams {
|
|
|
320
429
|
data?: any;
|
|
321
430
|
}
|
|
322
431
|
|
|
432
|
+
/**
|
|
433
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
434
|
+
* SPDX-License-Identifier: MIT
|
|
435
|
+
*/
|
|
436
|
+
|
|
323
437
|
interface IDocument {
|
|
324
438
|
id: string;
|
|
325
439
|
nodes: INode[];
|
|
@@ -331,6 +445,11 @@ interface IDocument {
|
|
|
331
445
|
dispose(): void;
|
|
332
446
|
}
|
|
333
447
|
|
|
448
|
+
/**
|
|
449
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
450
|
+
* SPDX-License-Identifier: MIT
|
|
451
|
+
*/
|
|
452
|
+
|
|
334
453
|
interface IState {
|
|
335
454
|
id: string;
|
|
336
455
|
variableStore: IVariableStore;
|
|
@@ -347,6 +466,11 @@ interface IState {
|
|
|
347
466
|
addExecutedNode(node: INode): void;
|
|
348
467
|
}
|
|
349
468
|
|
|
469
|
+
/**
|
|
470
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
471
|
+
* SPDX-License-Identifier: MIT
|
|
472
|
+
*/
|
|
473
|
+
|
|
350
474
|
interface NodeReport extends StatusData {
|
|
351
475
|
id: string;
|
|
352
476
|
snapshots: Snapshot[];
|
|
@@ -366,6 +490,11 @@ interface IReporter {
|
|
|
366
490
|
export(): IReport;
|
|
367
491
|
}
|
|
368
492
|
|
|
493
|
+
/**
|
|
494
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
495
|
+
* SPDX-License-Identifier: MIT
|
|
496
|
+
*/
|
|
497
|
+
|
|
369
498
|
interface ContextData {
|
|
370
499
|
variableStore: IVariableStore;
|
|
371
500
|
state: IState;
|
|
@@ -382,6 +511,11 @@ interface IContext extends ContextData {
|
|
|
382
511
|
sub(): IContext;
|
|
383
512
|
}
|
|
384
513
|
|
|
514
|
+
/**
|
|
515
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
516
|
+
* SPDX-License-Identifier: MIT
|
|
517
|
+
*/
|
|
518
|
+
|
|
385
519
|
interface ITask {
|
|
386
520
|
id: string;
|
|
387
521
|
processing: Promise<WorkflowOutputs>;
|
|
@@ -393,6 +527,11 @@ interface TaskParams {
|
|
|
393
527
|
context: IContext;
|
|
394
528
|
}
|
|
395
529
|
|
|
530
|
+
/**
|
|
531
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
532
|
+
* SPDX-License-Identifier: MIT
|
|
533
|
+
*/
|
|
534
|
+
|
|
396
535
|
interface EndNodeData {
|
|
397
536
|
title: string;
|
|
398
537
|
inputs: IJsonSchema<'object'>;
|
|
@@ -401,6 +540,11 @@ interface EndNodeData {
|
|
|
401
540
|
}
|
|
402
541
|
type EndNodeSchema = WorkflowNodeSchema<FlowGramNode.End, EndNodeData>;
|
|
403
542
|
|
|
543
|
+
/**
|
|
544
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
545
|
+
* SPDX-License-Identifier: MIT
|
|
546
|
+
*/
|
|
547
|
+
|
|
404
548
|
interface LLMNodeData {
|
|
405
549
|
title: string;
|
|
406
550
|
inputs: IJsonSchema<'object'>;
|
|
@@ -416,12 +560,22 @@ interface LLMNodeData {
|
|
|
416
560
|
}
|
|
417
561
|
type LLMNodeSchema = WorkflowNodeSchema<FlowGramNode.LLM, LLMNodeData>;
|
|
418
562
|
|
|
563
|
+
/**
|
|
564
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
565
|
+
* SPDX-License-Identifier: MIT
|
|
566
|
+
*/
|
|
567
|
+
|
|
419
568
|
interface StartNodeData {
|
|
420
569
|
title: string;
|
|
421
570
|
outputs: IJsonSchema<'object'>;
|
|
422
571
|
}
|
|
423
572
|
type StartNodeSchema = WorkflowNodeSchema<FlowGramNode.Start, StartNodeData>;
|
|
424
573
|
|
|
574
|
+
/**
|
|
575
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
576
|
+
* SPDX-License-Identifier: MIT
|
|
577
|
+
*/
|
|
578
|
+
|
|
425
579
|
interface ExecutionContext {
|
|
426
580
|
node: INode;
|
|
427
581
|
inputs: WorkflowInputs;
|
|
@@ -440,12 +594,22 @@ interface INodeExecutorFactory {
|
|
|
440
594
|
new (): INodeExecutor;
|
|
441
595
|
}
|
|
442
596
|
|
|
597
|
+
/**
|
|
598
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
599
|
+
* SPDX-License-Identifier: MIT
|
|
600
|
+
*/
|
|
601
|
+
|
|
443
602
|
interface IExecutor {
|
|
444
603
|
execute: (context: ExecutionContext) => Promise<ExecutionResult>;
|
|
445
604
|
register: (executor: INodeExecutor) => void;
|
|
446
605
|
}
|
|
447
606
|
declare const IExecutor: unique symbol;
|
|
448
607
|
|
|
608
|
+
/**
|
|
609
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
610
|
+
* SPDX-License-Identifier: MIT
|
|
611
|
+
*/
|
|
612
|
+
|
|
449
613
|
interface EngineServices {
|
|
450
614
|
Executor: IExecutor;
|
|
451
615
|
}
|
|
@@ -458,6 +622,11 @@ interface IEngine {
|
|
|
458
622
|
}
|
|
459
623
|
declare const IEngine: unique symbol;
|
|
460
624
|
|
|
625
|
+
/**
|
|
626
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
627
|
+
* SPDX-License-Identifier: MIT
|
|
628
|
+
*/
|
|
629
|
+
|
|
461
630
|
interface ValidationResult {
|
|
462
631
|
valid: boolean;
|
|
463
632
|
errors?: string[];
|
|
@@ -467,6 +636,11 @@ interface IValidation {
|
|
|
467
636
|
}
|
|
468
637
|
declare const IValidation: unique symbol;
|
|
469
638
|
|
|
639
|
+
/**
|
|
640
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
641
|
+
* SPDX-License-Identifier: MIT
|
|
642
|
+
*/
|
|
643
|
+
|
|
470
644
|
interface TaskRunInput {
|
|
471
645
|
inputs: WorkflowInputs;
|
|
472
646
|
schema: string;
|
|
@@ -476,6 +650,11 @@ interface TaskRunOutput {
|
|
|
476
650
|
}
|
|
477
651
|
declare const TaskRunDefine: FlowGramAPIDefine;
|
|
478
652
|
|
|
653
|
+
/**
|
|
654
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
655
|
+
* SPDX-License-Identifier: MIT
|
|
656
|
+
*/
|
|
657
|
+
|
|
479
658
|
interface ServerInfoInput {
|
|
480
659
|
}
|
|
481
660
|
interface ServerInfoOutput {
|
|
@@ -488,12 +667,22 @@ interface ServerInfoOutput {
|
|
|
488
667
|
}
|
|
489
668
|
declare const ServerInfoDefine: FlowGramAPIDefine;
|
|
490
669
|
|
|
670
|
+
/**
|
|
671
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
672
|
+
* SPDX-License-Identifier: MIT
|
|
673
|
+
*/
|
|
674
|
+
|
|
491
675
|
interface TaskReportInput {
|
|
492
676
|
taskID: string;
|
|
493
677
|
}
|
|
494
678
|
type TaskReportOutput = IReport | undefined;
|
|
495
679
|
declare const TaskReportDefine: FlowGramAPIDefine;
|
|
496
680
|
|
|
681
|
+
/**
|
|
682
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
683
|
+
* SPDX-License-Identifier: MIT
|
|
684
|
+
*/
|
|
685
|
+
|
|
497
686
|
interface ValidationReq {
|
|
498
687
|
schema: string;
|
|
499
688
|
}
|
|
@@ -501,12 +690,22 @@ interface ValidationRes extends ValidationResult {
|
|
|
501
690
|
}
|
|
502
691
|
declare const ValidationDefine: FlowGramAPIDefine;
|
|
503
692
|
|
|
693
|
+
/**
|
|
694
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
695
|
+
* SPDX-License-Identifier: MIT
|
|
696
|
+
*/
|
|
697
|
+
|
|
504
698
|
interface TaskResultInput {
|
|
505
699
|
taskID: string;
|
|
506
700
|
}
|
|
507
701
|
type TaskResultOutput = WorkflowOutputs | undefined;
|
|
508
702
|
declare const TaskResultDefine: FlowGramAPIDefine;
|
|
509
703
|
|
|
704
|
+
/**
|
|
705
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
706
|
+
* SPDX-License-Identifier: MIT
|
|
707
|
+
*/
|
|
708
|
+
|
|
510
709
|
interface TaskCancelInput {
|
|
511
710
|
taskID: string;
|
|
512
711
|
}
|
|
@@ -515,6 +714,11 @@ type TaskCancelOutput = {
|
|
|
515
714
|
};
|
|
516
715
|
declare const TaskCancelDefine: FlowGramAPIDefine;
|
|
517
716
|
|
|
717
|
+
/**
|
|
718
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
719
|
+
* SPDX-License-Identifier: MIT
|
|
720
|
+
*/
|
|
721
|
+
|
|
518
722
|
interface IRuntimeClient {
|
|
519
723
|
[FlowGramAPIName.TaskRun]: (input: TaskRunInput) => Promise<TaskRunOutput | undefined>;
|
|
520
724
|
[FlowGramAPIName.TaskReport]: (input: TaskReportInput) => Promise<TaskReportOutput | undefined>;
|
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":["export * from './api';\nexport * from './schema';\nexport * from './node';\nexport * from './runtime';\nexport * from './client';\n","import 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","export 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","import 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","import 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","import 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","import 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","import 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","import 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","import { 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","export 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","export 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","import { 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","import { 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","export 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","import { 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;;;ACAA,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;A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GAAG;AAChC;AAEO,IAAM,mBAAmB,OAAO,KAAK,YAAY;;;AClBjD,IAAK,mBAAL,kBAAKC,sBAAL;AACL,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,YAAS;AAFC,SAAAA;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/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;A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,kBAAA,WAAQ;AACR,EAAAA,kBAAA,YAAS;AAFC,SAAAA;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"]}
|
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.18",
|
|
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/
|
|
27
|
-
"@flowgram.ai/
|
|
26
|
+
"@flowgram.ai/eslint-config": "0.2.18",
|
|
27
|
+
"@flowgram.ai/ts-config": "0.2.18"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public",
|