@shenghuabi/workflow 1.1.3 → 1.1.5

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.
Files changed (72) hide show
  1. package/index.js +790 -916
  2. package/index.js.map +4 -4
  3. package/index.mjs +728 -850
  4. package/index.mjs.map +4 -4
  5. package/inline/inline.service.d.ts +1 -0
  6. package/inline/node/chat/main/index.d.ts +7 -12
  7. package/inline/node/chat/main/runner.d.ts +35 -0
  8. package/inline/node/chat/{chat.node.define.d.ts → node.define.d.ts} +3 -0
  9. package/inline/node/chat/util/useChat.d.ts +31 -0
  10. package/inline/node/index.browser.d.ts +2 -0
  11. package/inline/node/index.node.d.ts +2 -0
  12. package/inline/node/input-params/common.d.ts +2 -0
  13. package/inline/node/input-params/main/index.d.ts +29 -0
  14. package/inline/node/input-params/main/runner.d.ts +5 -0
  15. package/inline/node/input-params/node.define.d.ts +9 -0
  16. package/inline/node/input-params/webview/index.d.ts +2 -0
  17. package/inline/node/iteration/common.d.ts +2 -0
  18. package/inline/node/iteration/main/index.d.ts +29 -0
  19. package/inline/node/iteration/main/iteration-start.runner.d.ts +5 -0
  20. package/inline/node/iteration/main/runner.d.ts +6 -0
  21. package/inline/node/iteration/node.define.d.ts +11 -0
  22. package/inline/node/iteration/webview/index.d.ts +2 -0
  23. package/inline/node/text/main/index.d.ts +6 -11
  24. package/inline/node/text/main/runner.d.ts +14 -0
  25. package/inline/node/text/text.node.define.d.ts +2 -4
  26. package/module.d.ts +1 -3
  27. package/package.json +4 -3
  28. package/plugin/plugin.service.d.ts +1 -0
  29. package/preset/context-build.service.d.ts +2 -50
  30. package/runner/define.d.ts +3 -7
  31. package/runner/runner-item.d.ts +5 -20
  32. package/runner/workflow-runner.service.d.ts +9 -17
  33. package/share/common/const.d.ts +3 -2
  34. package/share/common/define.d.ts +3 -10
  35. package/share/const.d.ts +0 -1
  36. package/share/handle-node.d.ts +47 -18
  37. package/share/index.d.ts +0 -1
  38. package/share/index.js +27 -48
  39. package/share/index.js.map +4 -4
  40. package/share/index.mjs +25 -42
  41. package/share/index.mjs.map +3 -3
  42. package/share/type.d.ts +11 -30
  43. package/share/type2.d.ts +4 -8
  44. package/share/workflow.const.d.ts +1 -4
  45. package/test/util/chat-fixture.d.ts +44 -0
  46. package/test/util/text-input/common.d.ts +2 -0
  47. package/test/util/text-input/main/index.d.ts +25 -0
  48. package/test/util/text-input/main/runner.d.ts +6 -0
  49. package/test/util/text-input/text.node.define.d.ts +4 -0
  50. package/token.d.ts +8 -6
  51. package/type/type.d.ts +1 -1
  52. package/util/serialize-text-template.d.ts +16 -0
  53. package/webview/index.js +128 -41
  54. package/webview/index.js.map +4 -4
  55. package/webview/index.mjs +127 -43
  56. package/webview/index.mjs.map +4 -4
  57. package/workflow-exec.service.d.ts +14 -24
  58. package/workflow-parser.service.d.ts +0 -1
  59. package/inline/node/chat/main/llm.runner.d.ts +0 -41
  60. package/inline/node/text/main/textarea.runner.d.ts +0 -7
  61. package/preset/inline-build.service.d.ts +0 -11
  62. package/preset/inline-runner.service.d.ts +0 -16
  63. package/runner/inline-input-item.runner.d.ts +0 -8
  64. package/runner/input-params.runner.d.ts +0 -7
  65. package/runner/iteration-start.runner.d.ts +0 -7
  66. package/runner/iteration.runner.d.ts +0 -7
  67. package/runner/parameters.runner.d.ts +0 -10
  68. package/share/util.d.ts +0 -5
  69. package/test/chat.spec.d.ts +0 -1
  70. package/test/file.spec.d.ts +0 -1
  71. package/test/hello.spec.d.ts +0 -1
  72. package/test/plugin.spec.d.ts +0 -1
@@ -1,7 +1,7 @@
1
- import { LlmRunner } from './llm.runner';
1
+ import { LlmRunner } from './runner';
2
2
  export declare const ChatMainConfig: {
3
3
  readonly runner: typeof LlmRunner;
4
- readonly define: import("valibot").SchemaWithPipe<readonly [import("valibot").ObjectSchema<{
4
+ readonly configDefine: import("valibot").SchemaWithPipe<readonly [import("valibot").ObjectSchema<{
5
5
  readonly llm: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").IntersectSchema<[import("valibot").SchemaWithPipe<readonly [import("valibot").IntersectSchema<[import("valibot").SchemaWithPipe<readonly [import("valibot").ObjectSchema<{
6
6
  readonly name: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>, import("valibot").TitleAction<string | undefined, "预定义模型配置">, import("@piying/valibot-visit").DefineTypeAction<string | undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", string | undefined, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
7
7
  readonly model: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>, import("valibot").TitleAction<string | undefined, "模型">]>;
@@ -123,6 +123,7 @@ export declare const ChatMainConfig: {
123
123
  }[];
124
124
  thinkContent?: string | undefined;
125
125
  })[]>]>;
126
+ readonly jsonSchema: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").AnySchema, import("valibot").CheckAction<any, (issue: import("valibot").CheckIssue<any>) => string>]>, undefined>, import("@piying/valibot-visit").DefineTypeAction<any>]>;
126
127
  }, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
127
128
  llm?: {
128
129
  name?: string | undefined;
@@ -167,6 +168,7 @@ export declare const ChatMainConfig: {
167
168
  }[];
168
169
  thinkContent?: string | undefined;
169
170
  })[];
171
+ jsonSchema?: any;
170
172
  }, import("@piying/view-angular-core").AnyCoreSchemaHandle>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
171
173
  llm?: {
172
174
  name?: string | undefined;
@@ -211,6 +213,7 @@ export declare const ChatMainConfig: {
211
213
  }[];
212
214
  thinkContent?: string | undefined;
213
215
  })[];
216
+ jsonSchema?: any;
214
217
  }, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
215
218
  readonly afterAdd?: (node: import("../../../..").CustomNode, injector: import("static-injector").Injector) => any;
216
219
  readonly priority?: number;
@@ -225,17 +228,9 @@ export declare const ChatMainConfig: {
225
228
  } | undefined;
226
229
  readonly color?: "warn" | "primary" | "accent" | undefined;
227
230
  readonly help?: string | undefined;
228
- readonly inputs?: {
229
- inputType?: string | undefined;
230
- optional?: boolean | undefined;
231
- label: string;
232
- value: string;
233
- }[][] | undefined;
234
- readonly outputs?: {
235
- label: string;
236
- value: string;
237
- }[][] | undefined;
231
+ readonly outputs?: import("../../../..").HandleNode[][] | undefined;
238
232
  readonly disableHead: boolean;
239
233
  readonly disableConnect: boolean;
234
+ readonly disableContext?: boolean | undefined;
240
235
  readonly nodeMode?: "default" | "condition" | undefined;
241
236
  };
@@ -0,0 +1,35 @@
1
+ import { CHAT_NODE_DEFINE } from '../node.define';
2
+ import { NodeRunnerBase } from '../../../../runner/runner-item';
3
+ export declare class LlmRunner extends NodeRunnerBase<typeof CHAT_NODE_DEFINE> {
4
+ #private;
5
+ chatParse: (list: import("@shenghuabi/openai").ChatMessageListInputType) => Promise<{
6
+ metadataList: import("../../../..").ChatMetadata[];
7
+ list: ({
8
+ role: "system";
9
+ content: {
10
+ text: string;
11
+ type: "text";
12
+ }[];
13
+ } | {
14
+ role: "user";
15
+ content: ({
16
+ text: string;
17
+ type: "text";
18
+ } | {
19
+ image_url: {
20
+ url: string;
21
+ detail?: "auto" | "low" | "high" | undefined;
22
+ };
23
+ type: "image_url";
24
+ })[];
25
+ } | {
26
+ role: "assistant";
27
+ content: {
28
+ text: string;
29
+ type: "text";
30
+ }[];
31
+ thinkContent?: string | undefined;
32
+ })[];
33
+ }>;
34
+ run(): Promise<(id: string) => Promise<any>>;
35
+ }
@@ -126,6 +126,7 @@ export declare const CHAT_NODE_DEFINE: v.SchemaWithPipe<readonly [v.ObjectSchema
126
126
  }[];
127
127
  thinkContent?: string | undefined;
128
128
  })[]>]>;
129
+ readonly jsonSchema: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.AnySchema, v.CheckAction<any, (issue: v.CheckIssue<any>) => string>]>, undefined>, import("@piying/valibot-visit").DefineTypeAction<any>]>;
129
130
  }, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
130
131
  llm?: {
131
132
  name?: string | undefined;
@@ -170,6 +171,7 @@ export declare const CHAT_NODE_DEFINE: v.SchemaWithPipe<readonly [v.ObjectSchema
170
171
  }[];
171
172
  thinkContent?: string | undefined;
172
173
  })[];
174
+ jsonSchema?: any;
173
175
  }, import("@piying/view-angular-core").AnyCoreSchemaHandle>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
174
176
  llm?: {
175
177
  name?: string | undefined;
@@ -214,4 +216,5 @@ export declare const CHAT_NODE_DEFINE: v.SchemaWithPipe<readonly [v.ObjectSchema
214
216
  }[];
215
217
  thinkContent?: string | undefined;
216
218
  })[];
219
+ jsonSchema?: any;
217
220
  }, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
@@ -0,0 +1,31 @@
1
+ import type { ChatMessageListInputType } from '@shenghuabi/openai';
2
+ import { ChatMetadata } from '../../../../share/type';
3
+ export declare function useChat(): (list: ChatMessageListInputType) => Promise<{
4
+ metadataList: ChatMetadata[];
5
+ list: ({
6
+ role: "system";
7
+ content: {
8
+ text: string;
9
+ type: "text";
10
+ }[];
11
+ } | {
12
+ role: "user";
13
+ content: ({
14
+ text: string;
15
+ type: "text";
16
+ } | {
17
+ image_url: {
18
+ url: string;
19
+ detail?: "auto" | "low" | "high" | undefined;
20
+ };
21
+ type: "image_url";
22
+ })[];
23
+ } | {
24
+ role: "assistant";
25
+ content: {
26
+ text: string;
27
+ type: "text";
28
+ }[];
29
+ thinkContent?: string | undefined;
30
+ })[];
31
+ }>;
@@ -1,2 +1,4 @@
1
1
  export * from './chat/webview';
2
2
  export * from './text/webview';
3
+ export * from './iteration/webview';
4
+ export * from './input-params/webview';
@@ -1,2 +1,4 @@
1
1
  export * from './chat/main';
2
2
  export * from './text/main';
3
+ export * from './iteration/main';
4
+ export * from './input-params/main';
@@ -0,0 +1,2 @@
1
+ import { NodeComponentType } from '../../../share';
2
+ export declare const NODE_COMMON: NodeComponentType;
@@ -0,0 +1,29 @@
1
+ import { InputParamsRunner } from './runner';
2
+ export declare const EntryMainConfig: {
3
+ readonly runner: typeof InputParamsRunner;
4
+ readonly configDefine: import("valibot").SchemaWithPipe<readonly [import("valibot").ObjectSchema<{
5
+ readonly type: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("@piying/valibot-visit").DefineTypeAction<string>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", string, import("@piying/view-angular-core").AnyCoreSchemaHandle>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", string, import("@piying/view-angular-core").AnyCoreSchemaHandle>, import("valibot").TitleAction<string, "输入类型">]>;
6
+ }, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
7
+ type: string;
8
+ }, import("@piying/view-angular-core").AnyCoreSchemaHandle>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
9
+ type: string;
10
+ }, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
11
+ readonly afterAdd?: (node: import("../../../..").CustomNode, injector: import("static-injector").Injector) => any;
12
+ readonly priority?: number;
13
+ readonly type: string;
14
+ readonly label?: string | undefined;
15
+ readonly icon?: {
16
+ fontIcon: string;
17
+ fontSet?: string | undefined;
18
+ } | {
19
+ fontIcon: string;
20
+ fontSet: undefined;
21
+ } | undefined;
22
+ readonly color?: "warn" | "primary" | "accent" | undefined;
23
+ readonly help?: string | undefined;
24
+ readonly outputs?: import("../../../..").HandleNode[][] | undefined;
25
+ readonly disableHead: boolean;
26
+ readonly disableConnect: boolean;
27
+ readonly disableContext?: boolean | undefined;
28
+ readonly nodeMode?: "default" | "condition" | undefined;
29
+ };
@@ -0,0 +1,5 @@
1
+ import { NodeRunnerBase } from '../../../../runner/runner-item';
2
+ export declare class InputParamsRunner extends NodeRunnerBase {
3
+ #private;
4
+ run(): Promise<(id?: string) => Promise<any>>;
5
+ }
@@ -0,0 +1,9 @@
1
+ import * as v from 'valibot';
2
+ export declare const InputParams_NODE_DEFINE: v.SchemaWithPipe<readonly [v.ObjectSchema<{
3
+ /** 入口点通过不同的选择,提供不同的数据 */
4
+ readonly type: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, import("@piying/valibot-visit").DefineTypeAction<string>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", string, import("@piying/view-angular-core").AnyCoreSchemaHandle>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", string, import("@piying/view-angular-core").AnyCoreSchemaHandle>, v.TitleAction<string, "输入类型">]>;
5
+ }, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
6
+ type: string;
7
+ }, import("@piying/view-angular-core").AnyCoreSchemaHandle>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
8
+ type: string;
9
+ }, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
@@ -0,0 +1,2 @@
1
+ import { WebviewNodeConfig } from '../../../../share/type';
2
+ export declare const InputParamsWebviewConfig: WebviewNodeConfig;
@@ -0,0 +1,2 @@
1
+ import { NodeComponentType } from '../../../share';
2
+ export declare const NODE_COMMON: NodeComponentType;
@@ -0,0 +1,29 @@
1
+ import { IterationRunner } from './runner';
2
+ export declare const IterationMainConfig: {
3
+ readonly runner: typeof IterationRunner;
4
+ readonly configDefine: import("valibot").SchemaWithPipe<readonly [import("valibot").ObjectSchema<{
5
+ readonly list: import("valibot").SchemaWithPipe<readonly [import("valibot").ArraySchema<import("valibot").AnySchema, undefined>, import("@piying/valibot-visit").GroupControlAction<any[]>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", any[], import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
6
+ }, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
7
+ list: any[];
8
+ }, import("@piying/view-angular-core").AnyCoreSchemaHandle>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
9
+ list: any[];
10
+ }, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
11
+ readonly afterAdd?: (node: import("../../../..").CustomNode, injector: import("static-injector").Injector) => any;
12
+ readonly priority?: number;
13
+ readonly type: string;
14
+ readonly label?: string | undefined;
15
+ readonly icon?: {
16
+ fontIcon: string;
17
+ fontSet?: string | undefined;
18
+ } | {
19
+ fontIcon: string;
20
+ fontSet: undefined;
21
+ } | undefined;
22
+ readonly color?: "warn" | "primary" | "accent" | undefined;
23
+ readonly help?: string | undefined;
24
+ readonly outputs?: import("../../../..").HandleNode[][] | undefined;
25
+ readonly disableHead: boolean;
26
+ readonly disableConnect: boolean;
27
+ readonly disableContext?: boolean | undefined;
28
+ readonly nodeMode?: "default" | "condition" | undefined;
29
+ };
@@ -0,0 +1,5 @@
1
+ import { NodeRunnerBase } from '../../../../runner/runner-item';
2
+ export declare class IterationStartRunner extends NodeRunnerBase {
3
+ #private;
4
+ run(): Promise<(id?: string) => Promise<any>>;
5
+ }
@@ -0,0 +1,6 @@
1
+ import { NodeRunnerBase } from '../../../../runner/runner-item';
2
+ import { ITERATION_NODE_DEFINE } from '../node.define';
3
+ export declare class IterationRunner extends NodeRunnerBase<typeof ITERATION_NODE_DEFINE> {
4
+ #private;
5
+ run(): Promise<(id: string) => Promise<any[]>>;
6
+ }
@@ -0,0 +1,11 @@
1
+ import * as v from 'valibot';
2
+ export declare const ResponseList: readonly ["json", "markdown", "yaml"];
3
+ export declare const ResponseFormat: readonly ["text", "json_object", "json_schema"];
4
+ export type ResponseType = (typeof ResponseList)[number];
5
+ export declare const ITERATION_NODE_DEFINE: v.SchemaWithPipe<readonly [v.ObjectSchema<{
6
+ readonly list: v.SchemaWithPipe<readonly [v.ArraySchema<v.AnySchema, undefined>, import("@piying/valibot-visit").GroupControlAction<any[]>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", any[], import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
7
+ }, undefined>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
8
+ list: any[];
9
+ }, import("@piying/view-angular-core").AnyCoreSchemaHandle>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", {
10
+ list: any[];
11
+ }, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
@@ -0,0 +1,2 @@
1
+ import { WebviewNodeConfig } from '../../../../share/type';
2
+ export declare const IterationWebviewConfig: WebviewNodeConfig;
@@ -1,6 +1,9 @@
1
- import { TextareaRunner } from './textarea.runner';
1
+ import { TextareaRunner } from './runner';
2
2
  export declare const TextMainConfig: {
3
3
  readonly runner: typeof TextareaRunner;
4
+ readonly configDefine: import("valibot").ObjectSchema<{
5
+ readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").AnySchema, import("@piying/valibot-visit").DefineTypeAction<any>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", any, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
6
+ }, undefined>;
4
7
  readonly afterAdd?: (node: import("../../../..").CustomNode, injector: import("static-injector").Injector) => any;
5
8
  readonly priority?: number;
6
9
  readonly type: string;
@@ -14,17 +17,9 @@ export declare const TextMainConfig: {
14
17
  } | undefined;
15
18
  readonly color?: "warn" | "primary" | "accent" | undefined;
16
19
  readonly help?: string | undefined;
17
- readonly inputs?: {
18
- inputType?: string | undefined;
19
- optional?: boolean | undefined;
20
- label: string;
21
- value: string;
22
- }[][] | undefined;
23
- readonly outputs?: {
24
- label: string;
25
- value: string;
26
- }[][] | undefined;
20
+ readonly outputs?: import("../../../..").HandleNode[][] | undefined;
27
21
  readonly disableHead: boolean;
28
22
  readonly disableConnect: boolean;
23
+ readonly disableContext?: boolean | undefined;
29
24
  readonly nodeMode?: "default" | "condition" | undefined;
30
25
  };
@@ -0,0 +1,14 @@
1
+ import { NodeRunnerBase } from '../../../../runner/runner-item';
2
+ import { TEXT_NODE_DEFINE } from '../text.node.define';
3
+ import { ChatMetadata } from '@shenghuabi/workflow/share';
4
+ export declare class TextareaRunner extends NodeRunnerBase<typeof TEXT_NODE_DEFINE> {
5
+ environmentContext: import("@shenghuabi/workflow/share").WorkflowRunnerEnvironmentParams;
6
+ run(): Promise<() => Promise<string | {
7
+ toJSON: () => {
8
+ ref: ChatMetadata[] | undefined;
9
+ value: string;
10
+ };
11
+ toString: () => string;
12
+ ref: ChatMetadata[];
13
+ }>>;
14
+ }
@@ -1,6 +1,4 @@
1
1
  import * as v from 'valibot';
2
- export declare const TEXT_NODE_DEFINE: v.LooseObjectSchema<{
3
- readonly data: v.LooseObjectSchema<{
4
- readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, import("@piying/valibot-visit").DefineTypeAction<string>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", string, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
5
- }, undefined>;
2
+ export declare const TEXT_NODE_DEFINE: v.ObjectSchema<{
3
+ readonly value: v.SchemaWithPipe<readonly [v.AnySchema, import("@piying/valibot-visit").DefineTypeAction<any>, import("@piying/valibot-visit").RawConfigAction<"viewRawConfig", any, import("@piying/view-angular-core").AnyCoreSchemaHandle>]>;
6
4
  }, undefined>;
package/module.d.ts CHANGED
@@ -1,15 +1,13 @@
1
1
  import { InlineNodeService } from './inline/inline.service';
2
2
  import { WorkflowPluginService } from './plugin/plugin.service';
3
3
  import { ContextBuildService } from './preset/context-build.service';
4
- import { InlineBuilderService } from './preset/inline-build.service';
5
- import { InlineParametersService } from './preset/inline-runner.service';
6
4
  import { WorkflowRunnerService } from './runner/workflow-runner.service';
7
5
  import { WorkflowFileService } from './workflow-file.service';
8
6
  import { WorkflowExecService } from './workflow-exec.service';
9
7
  import { WorkflowParserService } from './workflow-parser.service';
10
8
  import { WorkflowSelectService } from './workflow-select.service';
11
9
  export declare const WORKFLOW_MODULE: {
12
- provider: (typeof WorkflowRunnerService | typeof WorkflowPluginService | typeof InlineNodeService | typeof WorkflowParserService | typeof InlineBuilderService | typeof InlineParametersService | typeof ContextBuildService | typeof WorkflowExecService | typeof WorkflowFileService | typeof WorkflowSelectService)[];
10
+ provider: (typeof WorkflowRunnerService | typeof WorkflowPluginService | typeof InlineNodeService | typeof WorkflowParserService | typeof ContextBuildService | typeof WorkflowExecService | typeof WorkflowFileService | typeof WorkflowSelectService)[];
13
11
  token: {
14
12
  ChatServiceToken: import("static-injector").InjectionToken<{
15
13
  chat: (input: Partial<import("@shenghuabi/openai").ChatModelOptions>) => ReturnType<import("@shenghuabi/openai").ChatProviderService["create"]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shenghuabi/workflow",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "模板",
5
5
  "author": "wszgrcy",
6
6
  "sideEffects": false,
@@ -11,7 +11,7 @@
11
11
  "@cyia/external-call": "^1.5.2",
12
12
  "@cyia/util": "^1.5.2",
13
13
  "@cyia/vfs2": "^1.5.2",
14
- "@shenghuabi/openai": "1.1.3",
14
+ "@shenghuabi/openai": "1.1.5",
15
15
  "static-injector": "^6.1.2",
16
16
  "@piying/view-angular-core": "^2.9.3",
17
17
  "@piying/valibot-visit": "^1.3.11"
@@ -22,7 +22,8 @@
22
22
  "graphology": "^0.26.0",
23
23
  "handlebars": "^4.7.9",
24
24
  "liquidjs": "^10.25.7",
25
- "uuid": "^13.0.2"
25
+ "uuid": "^13.0.2",
26
+ "@shenghuabi/lexical-textarea": "1.0.1"
26
27
  },
27
28
  "overrides": {},
28
29
  "exports": {
@@ -4,4 +4,5 @@ export declare class WorkflowPluginService {
4
4
  setNodeObject(obj: NodeItemDefine[]): void;
5
5
  conditionNodeList$$: import("static-injector").Signal<Record<string, any>>;
6
6
  getNodeRunner(type: string): typeof import("..").NodeRunnerBase;
7
+ getNodeDefine(type: string): NodeItemDefine;
7
8
  }
@@ -1,6 +1,5 @@
1
1
  import { TemplateFormatService } from '../template-format.service';
2
2
  import { WorkflowParserService } from '../workflow-parser.service';
3
- import { WorkflowNodeType } from '../share/workflow.const';
4
3
  import { ChatMessageListInputType } from '@shenghuabi/openai/define';
5
4
  /** 对话使用 */
6
5
  export declare class ContextBuildService {
@@ -9,18 +8,12 @@ export declare class ContextBuildService {
9
8
  createWorkflow(input: {
10
9
  template: ChatMessageListInputType;
11
10
  input: Record<string, any>;
12
- context: any;
13
- }, inlineMode: boolean): {
14
- nodes: ({
11
+ }): {
12
+ nodes: {
15
13
  id: string;
16
14
  data: {
17
15
  title: string;
18
16
  handle: {
19
- input: {
20
- id: string;
21
- value: string;
22
- label: string;
23
- }[][];
24
17
  output: {
25
18
  id: string;
26
19
  label: string;
@@ -56,47 +49,6 @@ export declare class ContextBuildService {
56
49
  config: {};
57
50
  };
58
51
  type: string;
59
- } | {
60
- id: string;
61
- type: WorkflowNodeType;
62
- data: {
63
- handle: {
64
- input: {
65
- inputType: string;
66
- id: string;
67
- label: string;
68
- value: string;
69
- }[][];
70
- output: {
71
- id: string;
72
- value: string;
73
- label: string;
74
- }[][];
75
- };
76
- };
77
- } | {
78
- id: string;
79
- type: "inlineInputItem";
80
- data: {
81
- handle: {
82
- input: {
83
- id: string;
84
- value: string;
85
- label: string;
86
- }[][];
87
- output: {
88
- id: string;
89
- label: string;
90
- value: string;
91
- }[][];
92
- };
93
- };
94
- })[];
95
- edges: {
96
- source: string;
97
- sourceHandle: string;
98
- target: string;
99
- targetHandle: string;
100
52
  }[];
101
53
  };
102
54
  }
@@ -1,12 +1,8 @@
1
- import { InlineInputItemRunner } from './inline-input-item.runner';
2
- import { InputParamsRunner } from './input-params.runner';
3
- import { IterationStartRunner } from './iteration-start.runner';
4
- import { IterationRunner } from './iteration.runner';
5
- import { ParametersRunner } from './parameters.runner';
1
+ import { InputParamsRunner } from '../inline/node/input-params/main/runner';
2
+ import { IterationRunner } from '../inline/node/iteration/main/runner';
3
+ import { IterationStartRunner } from '../inline/node/iteration/main/iteration-start.runner';
6
4
  export declare const ItemRunnerObject: {
7
5
  iteration: typeof IterationRunner;
8
6
  "iteration-start": typeof IterationStartRunner;
9
7
  "input-params": typeof InputParamsRunner;
10
- parameters: typeof ParametersRunner;
11
- inlineInputItem: typeof InlineInputItemRunner;
12
8
  };
@@ -1,35 +1,20 @@
1
1
  import { Injector } from 'static-injector';
2
- export type RunnerResult = Promise<(output: string) => Promise<{
3
- extra?: any;
4
- value: any;
5
- }>>;
2
+ export type RunnerResult = Promise<(id: string) => Promise<any>>;
6
3
  export type OutputResult = ReturnType<Awaited<RunnerResult>>;
7
4
  import * as v from 'valibot';
8
5
  import { WorkflowEmitter } from '../share';
9
- import { ChatMetadata } from '../share/type';
10
6
  import { ChatModelOptions } from '@shenghuabi/openai';
11
7
  import { ModelInputConfig } from '../share/common';
12
- export declare class NodeRunnerBase {
8
+ export declare class NodeRunnerBase<TSchema extends v.BaseSchema<any, any, any> | undefined = undefined> {
13
9
  #private;
14
10
  protected node: import("..").ParsedNode;
15
- protected callNode: import("..").ParsedNode;
11
+ protected callNode: import("..").ParsedNode | undefined;
16
12
  protected context: import("./workflow-runner.service").WorkflowRunnerContext;
17
- protected inputParams: import("..").WorkflowRunnerInputs;
18
13
  protected injector: Injector;
19
14
  protected emitter: WorkflowEmitter;
20
15
  protected abortSignal: AbortSignal | undefined;
16
+ protected inputs: TSchema extends v.BaseSchema<any, any, any> ? v.InferOutput<TSchema> : undefined;
21
17
  run(): RunnerResult;
22
- inputs$$: import("static-injector").Signal<Record<string, {
23
- value: any;
24
- extra?: any;
25
- }>>;
26
- inputValueObject$$: import("static-injector").Signal<Record<string, any>>;
27
- inputMetadataList$$: import("static-injector").Signal<any[]>;
28
- getInputMetadata(input: string): any;
29
- getInputChat(): Promise<{
30
- metadataList: ChatMetadata[];
31
- obj: Record<string, any>;
32
- }>;
18
+ context$$: import("static-injector").Signal<Promise<Record<string, any>>>;
33
19
  mergeChatModel(input?: ModelInputConfig): Partial<ChatModelOptions>;
34
- getParsedNode<T extends v.BaseSchema<any, any, any>>(schema: T): v.InferOutput<T>;
35
20
  }
@@ -1,35 +1,27 @@
1
- import { Injector } from 'static-injector';
2
- import { WorkflowRunnerInputs, WorkflowRunnerInputsWithContext } from '../share/type2';
1
+ import { Injector, Provider } from 'static-injector';
2
+ import { WorkflowRunnerInputsWithContext } from '../share/type2';
3
3
  import { ParsedNode, ResolvedWorkflow } from '../share/handle-node';
4
4
  import { LogType } from '@cyia/external-call';
5
5
  import { Observer } from '../share';
6
6
  /** 用于上下文start */
7
- export declare const ITERATION_ITEM_SYMBOL: unique symbol;
8
7
  export declare class WorkflowRunnerContext {
9
8
  #private;
10
9
  data: ResolvedWorkflow;
11
10
  parent: WorkflowRunnerContext | undefined;
12
- inputs: WorkflowRunnerInputs;
13
- getNodeById(id: string): ParsedNode;
14
- startRun(): Promise<{
15
- extra?: any;
16
- value: any;
17
- }>;
18
- run(): Promise<{
19
- extra?: any;
11
+ inputs: Record<string, (import("..").InputInvalidItem & {
20
12
  value: any;
21
- }>;
13
+ })[]>;
14
+ getNodeById(id: string): ParsedNode;
15
+ startRun(): Promise<any>;
16
+ run(): Promise<any>;
22
17
  }
23
18
  export declare class WorkflowRunnerService {
24
19
  #private;
25
20
  /** 自己使用
26
21
  * @internal
27
22
  */
28
- createContext(data: ResolvedWorkflow, inputs: WorkflowRunnerInputs, parent?: WorkflowRunnerContext, parentInjector?: Injector): WorkflowRunnerContext;
23
+ createContext(data: ResolvedWorkflow, parent?: WorkflowRunnerContext, parentInjector?: Injector): WorkflowRunnerContext;
29
24
  get log(): LogType | undefined;
30
25
  /** 入口 */
31
- run(data: ResolvedWorkflow, input: WorkflowRunnerInputsWithContext, ob?: Observer<any, any>, signal?: AbortSignal): Promise<{
32
- extra?: any;
33
- value: any;
34
- }>;
26
+ run(wofkflowData: ResolvedWorkflow, input: WorkflowRunnerInputsWithContext, ob?: Observer<any, any>, signal?: AbortSignal, providers?: Provider[]): Promise<any>;
35
27
  }
@@ -1,2 +1,3 @@
1
- export declare const DEFAULT_CHAT_SCHEMA_KEY = "[JsonSchema]";
2
- export declare const RUNNER_ORIGIN_OUTPUT_KEY = "[Origin]";
1
+ import { HandleNode } from '../handle-node';
2
+ /** 导出使用,默认给所有节点加一个出口, */
3
+ export declare const RUNNER_ORIGIN_OUTPUT: HandleNode[];
@@ -1,4 +1,5 @@
1
1
  import * as v from 'valibot';
2
+ import { HandleNode } from '../handle-node';
2
3
  export declare const HandleDefine: v.ObjectSchema<{
3
4
  readonly label: v.StringSchema<undefined>;
4
5
  readonly value: v.StringSchema<undefined>;
@@ -52,18 +53,10 @@ export declare const NodeDefine: v.ObjectSchema<{
52
53
  }>]>], undefined>, undefined>;
53
54
  readonly color: v.OptionalSchema<v.PicklistSchema<["primary", "accent", "warn"], undefined>, undefined>;
54
55
  readonly help: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
55
- readonly inputs: v.OptionalSchema<v.ArraySchema<v.ArraySchema<v.ObjectSchema<{
56
- readonly inputType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
57
- readonly optional: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
58
- readonly label: v.StringSchema<undefined>;
59
- readonly value: v.StringSchema<undefined>;
60
- }, undefined>, undefined>, undefined>, undefined>;
61
- readonly outputs: v.OptionalSchema<v.ArraySchema<v.ArraySchema<v.ObjectSchema<{
62
- readonly label: v.StringSchema<undefined>;
63
- readonly value: v.StringSchema<undefined>;
64
- }, undefined>, undefined>, undefined>, undefined>;
56
+ readonly outputs: v.OptionalSchema<v.ArraySchema<v.ArraySchema<v.CustomSchema<HandleNode, undefined>, undefined>, undefined>, undefined>;
65
57
  readonly disableHead: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
66
58
  readonly disableConnect: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
59
+ readonly disableContext: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
67
60
  /** 出口表示分支 */
68
61
  readonly nodeMode: v.OptionalSchema<v.PicklistSchema<["condition", "default"], undefined>, undefined>;
69
62
  }, undefined>;
package/share/const.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export declare const DEFAULT_INPUT_KEY = "[INPUT]";
2
1
  export declare const HelpObj: {
3
2
  templateVarLine: string;
4
3
  pathTodoLine: string;