@fastgpt-plugin/helpers 0.0.1-alpha.6 → 0.0.1-alpha.8

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.
@@ -0,0 +1,156 @@
1
+ import { z as z$1 } from "zod";
2
+
3
+ //#region src/datasets/schemas.d.ts
4
+ /**
5
+ * Plugin Dataset Source ID 常量
6
+ */
7
+ declare const PluginDatasetSourceIds: {
8
+ readonly customApi: "custom-api";
9
+ readonly feishu: "feishu";
10
+ readonly yuque: "yuque";
11
+ };
12
+ type PluginDatasetSourceId = (typeof PluginDatasetSourceIds)[keyof typeof PluginDatasetSourceIds];
13
+ declare const DatasetSourceIdEnum: z$1.ZodEnum<{
14
+ "custom-api": "custom-api";
15
+ feishu: "feishu";
16
+ yuque: "yuque";
17
+ }>;
18
+ type DatasetSourceId = z$1.infer<typeof DatasetSourceIdEnum>;
19
+ declare const FormFieldTypeEnum: z$1.ZodEnum<{
20
+ input: "input";
21
+ select: "select";
22
+ password: "password";
23
+ "tree-select": "tree-select";
24
+ }>;
25
+ declare const FormFieldConfigSchema: z$1.ZodObject<{
26
+ key: z$1.ZodString;
27
+ label: z$1.ZodObject<{
28
+ en: z$1.ZodString;
29
+ 'zh-CN': z$1.ZodOptional<z$1.ZodString>;
30
+ 'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
31
+ }, z$1.core.$strip>;
32
+ type: z$1.ZodEnum<{
33
+ input: "input";
34
+ select: "select";
35
+ password: "password";
36
+ "tree-select": "tree-select";
37
+ }>;
38
+ required: z$1.ZodOptional<z$1.ZodBoolean>;
39
+ placeholder: z$1.ZodOptional<z$1.ZodObject<{
40
+ en: z$1.ZodString;
41
+ 'zh-CN': z$1.ZodOptional<z$1.ZodString>;
42
+ 'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
43
+ }, z$1.core.$strip>>;
44
+ description: z$1.ZodOptional<z$1.ZodObject<{
45
+ en: z$1.ZodString;
46
+ 'zh-CN': z$1.ZodOptional<z$1.ZodString>;
47
+ 'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
48
+ }, z$1.core.$strip>>;
49
+ options: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
50
+ label: z$1.ZodObject<{
51
+ en: z$1.ZodString;
52
+ 'zh-CN': z$1.ZodOptional<z$1.ZodString>;
53
+ 'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
54
+ }, z$1.core.$strip>;
55
+ value: z$1.ZodString;
56
+ }, z$1.core.$strip>>>;
57
+ }, z$1.core.$strip>;
58
+ declare const DatasetSourceInfoSchema: z$1.ZodObject<{
59
+ sourceId: z$1.ZodEnum<{
60
+ "custom-api": "custom-api";
61
+ feishu: "feishu";
62
+ yuque: "yuque";
63
+ }>;
64
+ name: z$1.ZodObject<{
65
+ en: z$1.ZodString;
66
+ 'zh-CN': z$1.ZodOptional<z$1.ZodString>;
67
+ 'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
68
+ }, z$1.core.$strip>;
69
+ icon: z$1.ZodString;
70
+ iconOutline: z$1.ZodOptional<z$1.ZodString>;
71
+ description: z$1.ZodOptional<z$1.ZodObject<{
72
+ en: z$1.ZodString;
73
+ 'zh-CN': z$1.ZodOptional<z$1.ZodString>;
74
+ 'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
75
+ }, z$1.core.$strip>>;
76
+ courseUrl: z$1.ZodOptional<z$1.ZodString>;
77
+ }, z$1.core.$strip>;
78
+ declare const DatasetSourceConfigSchema: z$1.ZodObject<{
79
+ sourceId: z$1.ZodEnum<{
80
+ "custom-api": "custom-api";
81
+ feishu: "feishu";
82
+ yuque: "yuque";
83
+ }>;
84
+ name: z$1.ZodObject<{
85
+ en: z$1.ZodString;
86
+ 'zh-CN': z$1.ZodOptional<z$1.ZodString>;
87
+ 'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
88
+ }, z$1.core.$strip>;
89
+ icon: z$1.ZodString;
90
+ iconOutline: z$1.ZodOptional<z$1.ZodString>;
91
+ description: z$1.ZodOptional<z$1.ZodObject<{
92
+ en: z$1.ZodString;
93
+ 'zh-CN': z$1.ZodOptional<z$1.ZodString>;
94
+ 'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
95
+ }, z$1.core.$strip>>;
96
+ courseUrl: z$1.ZodOptional<z$1.ZodString>;
97
+ formFields: z$1.ZodArray<z$1.ZodObject<{
98
+ key: z$1.ZodString;
99
+ label: z$1.ZodObject<{
100
+ en: z$1.ZodString;
101
+ 'zh-CN': z$1.ZodOptional<z$1.ZodString>;
102
+ 'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
103
+ }, z$1.core.$strip>;
104
+ type: z$1.ZodEnum<{
105
+ input: "input";
106
+ select: "select";
107
+ password: "password";
108
+ "tree-select": "tree-select";
109
+ }>;
110
+ required: z$1.ZodOptional<z$1.ZodBoolean>;
111
+ placeholder: z$1.ZodOptional<z$1.ZodObject<{
112
+ en: z$1.ZodString;
113
+ 'zh-CN': z$1.ZodOptional<z$1.ZodString>;
114
+ 'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
115
+ }, z$1.core.$strip>>;
116
+ description: z$1.ZodOptional<z$1.ZodObject<{
117
+ en: z$1.ZodString;
118
+ 'zh-CN': z$1.ZodOptional<z$1.ZodString>;
119
+ 'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
120
+ }, z$1.core.$strip>>;
121
+ options: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
122
+ label: z$1.ZodObject<{
123
+ en: z$1.ZodString;
124
+ 'zh-CN': z$1.ZodOptional<z$1.ZodString>;
125
+ 'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
126
+ }, z$1.core.$strip>;
127
+ value: z$1.ZodString;
128
+ }, z$1.core.$strip>>>;
129
+ }, z$1.core.$strip>>;
130
+ }, z$1.core.$strip>;
131
+ declare const FileItemSchema: z$1.ZodObject<{
132
+ id: z$1.ZodString;
133
+ rawId: z$1.ZodOptional<z$1.ZodString>;
134
+ parentId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
135
+ name: z$1.ZodString;
136
+ type: z$1.ZodEnum<{
137
+ file: "file";
138
+ folder: "folder";
139
+ }>;
140
+ updateTime: z$1.ZodOptional<z$1.ZodString>;
141
+ createTime: z$1.ZodOptional<z$1.ZodString>;
142
+ hasChild: z$1.ZodOptional<z$1.ZodBoolean>;
143
+ }, z$1.core.$strip>;
144
+ declare const FileContentResponseSchema: z$1.ZodObject<{
145
+ title: z$1.ZodOptional<z$1.ZodString>;
146
+ rawText: z$1.ZodOptional<z$1.ZodString>;
147
+ previewUrl: z$1.ZodOptional<z$1.ZodString>;
148
+ }, z$1.core.$strip>;
149
+ type FormFieldType = z$1.infer<typeof FormFieldTypeEnum>;
150
+ type FormFieldConfig = z$1.infer<typeof FormFieldConfigSchema>;
151
+ type DatasetSourceInfo = z$1.infer<typeof DatasetSourceInfoSchema>;
152
+ type DatasetSourceConfig = z$1.infer<typeof DatasetSourceConfigSchema>;
153
+ type FileItem = z$1.infer<typeof FileItemSchema>;
154
+ type FileContentResponse = z$1.infer<typeof FileContentResponseSchema>;
155
+ //#endregion
156
+ export { DatasetSourceConfig, DatasetSourceConfigSchema, DatasetSourceId, DatasetSourceIdEnum, DatasetSourceInfo, DatasetSourceInfoSchema, FileContentResponse, FileContentResponseSchema, FileItem, FileItemSchema, FormFieldConfig, FormFieldConfigSchema, FormFieldType, FormFieldTypeEnum, PluginDatasetSourceId, PluginDatasetSourceIds };
@@ -0,0 +1 @@
1
+ import{I18nStringSchema as e}from"../common/schemas/i18n.js";import{z as t}from"zod";const n={customApi:`custom-api`,feishu:`feishu`,yuque:`yuque`},r=t.enum([`yuque`,`feishu`,`custom-api`]),i=t.enum([`input`,`password`,`select`,`tree-select`]),a=t.object({key:t.string(),label:e,type:i,required:t.boolean().optional(),placeholder:e.optional(),description:e.optional(),options:t.array(t.object({label:e,value:t.string()})).optional()}),o=t.object({sourceId:r,name:e,icon:t.string(),iconOutline:t.string().optional(),description:e.optional(),courseUrl:t.string().optional()}),s=o.extend({formFields:t.array(a)}),c=t.object({id:t.string(),rawId:t.string().optional(),parentId:t.string().nullable().optional(),name:t.string(),type:t.enum([`file`,`folder`]),updateTime:t.string().optional(),createTime:t.string().optional(),hasChild:t.boolean().optional()}),l=t.object({title:t.string().optional(),rawText:t.string().optional(),previewUrl:t.string().optional()});export{s as DatasetSourceConfigSchema,r as DatasetSourceIdEnum,o as DatasetSourceInfoSchema,l as FileContentResponseSchema,c as FileItemSchema,a as FormFieldConfigSchema,i as FormFieldTypeEnum,n as PluginDatasetSourceIds};
@@ -1,4 +1,5 @@
1
1
  import { FileMetadata } from "../common/schemas/s3.js";
2
+ import { InvokeInput } from "./type.js";
2
3
  import { StreamDataType } from "../tools/schemas/req.js";
3
4
  import z from "zod";
4
5
 
@@ -8,12 +9,14 @@ declare const EventEnumSchema: z.ZodEnum<{
8
9
  "stream-response": "stream-response";
9
10
  html2md: "html2md";
10
11
  cherrio2md: "cherrio2md";
12
+ invoke: "invoke";
11
13
  }>;
12
14
  declare const EventEnum: {
13
15
  "file-upload": "file-upload";
14
16
  "stream-response": "stream-response";
15
17
  html2md: "html2md";
16
18
  cherrio2md: "cherrio2md";
19
+ invoke: "invoke";
17
20
  };
18
21
  type EventEnumType = z.infer<typeof EventEnumSchema>;
19
22
  declare const FileInputSchema: z.ZodObject<{
@@ -52,7 +55,7 @@ type EventDataType<T extends EventEnumType> = T extends 'file-upload' ? FileInpu
52
55
  fetchUrl: string;
53
56
  html: string;
54
57
  selector?: string;
55
- } : never;
56
- type EventResponseType<T extends EventEnumType> = T extends 'file-upload' ? FileMetadata : T extends 'stream-response' ? void : T extends 'html2md' ? string : T extends 'cherrio2md' ? Cherrio2MdResult : never;
58
+ } : T extends 'invoke' ? InvokeInput : never;
59
+ type EventResponseType<T extends EventEnumType> = T extends 'file-upload' ? FileMetadata : T extends 'stream-response' ? void : T extends 'html2md' ? string : T extends 'cherrio2md' ? Cherrio2MdResult : T extends 'invoke' ? unknown : never;
57
60
  //#endregion
58
61
  export { Cherrio2MdInput, Cherrio2MdInputSchema, Cherrio2MdResult, Cherrio2MdResultSchema, EventDataType, EventEnum, EventEnumSchema, EventEnumType, EventResponseType, FileInput, FileInputSchema };
@@ -1 +1 @@
1
- import e from"zod";const t=e.enum([`file-upload`,`stream-response`,`html2md`,`cherrio2md`]),n=t.enum,r=e.object({url:e.url(`Invalid URL format`).optional(),path:e.string().min(1,`File path cannot be empty`).optional(),base64:e.string().min(1,`Base64 data cannot be empty`).optional(),buffer:e.union([e.instanceof(Buffer,{error:`Buffer is required`}),e.instanceof(Uint8Array,{error:`Uint8Array is required`})]).transform(e=>e instanceof Uint8Array&&!(e instanceof Buffer)?Buffer.from(e):e).optional(),defaultFilename:e.string().optional(),prefix:e.string().optional(),keepRawFilename:e.boolean().optional(),contentType:e.string().optional(),expireMins:e.number().optional()}).refine(e=>[e.url,e.path,e.base64,e.buffer].filter(Boolean).length===1&&(!(e.base64||e.buffer)||e.defaultFilename),{error:`Provide exactly one input method. Filename required for base64/buffer inputs.`}),i=e.object({fetchUrl:e.url(`Invalid URL format`),html:e.string().min(1,`HTML content cannot be empty`),selector:e.string().optional().default(`body`)}),a=e.object({markdown:e.string(),title:e.string(),usedSelector:e.string()});export{i as Cherrio2MdInputSchema,a as Cherrio2MdResultSchema,n as EventEnum,t as EventEnumSchema,r as FileInputSchema};
1
+ import e from"zod";const t=e.enum([`file-upload`,`stream-response`,`html2md`,`cherrio2md`,`invoke`]),n=t.enum,r=e.object({url:e.url(`Invalid URL format`).optional(),path:e.string().min(1,`File path cannot be empty`).optional(),base64:e.string().min(1,`Base64 data cannot be empty`).optional(),buffer:e.union([e.instanceof(Buffer,{error:`Buffer is required`}),e.instanceof(Uint8Array,{error:`Uint8Array is required`})]).transform(e=>e instanceof Uint8Array&&!(e instanceof Buffer)?Buffer.from(e):e).optional(),defaultFilename:e.string().optional(),prefix:e.string().optional(),keepRawFilename:e.boolean().optional(),contentType:e.string().optional(),expireMins:e.number().optional()}).refine(e=>[e.url,e.path,e.base64,e.buffer].filter(Boolean).length===1&&(!(e.base64||e.buffer)||e.defaultFilename),{error:`Provide exactly one input method. Filename required for base64/buffer inputs.`}),i=e.object({fetchUrl:e.url(`Invalid URL format`),html:e.string().min(1,`HTML content cannot be empty`),selector:e.string().optional().default(`body`)}),a=e.object({markdown:e.string(),title:e.string(),usedSelector:e.string()});export{i as Cherrio2MdInputSchema,a as Cherrio2MdResultSchema,n as EventEnum,t as EventEnumSchema,r as FileInputSchema};
@@ -1,13 +1,22 @@
1
1
  import { FileMetadata } from "../common/schemas/s3.js";
2
2
  import { StreamMessageType } from "../tools/schemas/req.js";
3
3
  import { Cherrio2MdInput, Cherrio2MdResult, FileInput } from "./schemas.js";
4
+ import { InvokeGetWecomCropTokenResponseType, InvokeTeamInfoResponseType, InvokeTypeEnum, InvokeTypeEnumType, InvokeUserInfoResponseType } from "@fastgpt-sdk/invoke";
4
5
 
5
6
  //#region src/events/type.d.ts
7
+ type InvokeInput<T extends InvokeTypeEnumType = InvokeTypeEnumType> = {
8
+ type: T;
9
+ data: object;
10
+ };
11
+ type InvokeOutput<T = InvokeTypeEnumType> = T extends typeof InvokeTypeEnum.getUserInfo ? InvokeUserInfoResponseType : T extends typeof InvokeTypeEnum.getTeamInfo ? InvokeTeamInfoResponseType : T extends typeof InvokeTypeEnum.getWecomCorpToken ? InvokeGetWecomCropTokenResponseType : T extends typeof InvokeTypeEnum.getWecomCorpInfo ? never : never;
6
12
  interface EventEmitter {
7
13
  uploadFile(input: FileInput): Promise<FileMetadata>;
8
14
  streamResponse(input: StreamMessageType): void;
9
- html2md(html: string): Promise<string>;
15
+ html2md(data: {
16
+ html: string;
17
+ }): Promise<string>;
10
18
  cherrio2md(input: Cherrio2MdInput): Promise<Cherrio2MdResult>;
19
+ invoke<T extends InvokeTypeEnumType>(input: InvokeInput<T>): Promise<InvokeOutput<T>>;
11
20
  }
12
21
  //#endregion
13
- export { EventEmitter };
22
+ export { EventEmitter, InvokeInput, InvokeOutput };
@@ -1 +1 @@
1
- export{};
1
+ import{InvokeTypeEnum as e}from"@fastgpt-sdk/invoke";export{};
package/dist/index.d.ts CHANGED
@@ -2,13 +2,15 @@ import { batch, catchError, delay } from "./common/fn.js";
2
2
  import { ensureDir, refreshDir } from "./common/fs.js";
3
3
  import { I18nStringSchema, I18nStringStrictSchema, I18nStringStrictType, I18nStringType } from "./common/schemas/i18n.js";
4
4
  import { pkg, unpkg } from "./common/zip.js";
5
+ import { DatasetSourceConfig, DatasetSourceConfigSchema, DatasetSourceId, DatasetSourceIdEnum, DatasetSourceInfo, DatasetSourceInfoSchema, FileContentResponse, FileContentResponseSchema, FileItem, FileItemSchema, FormFieldConfig, FormFieldConfigSchema, FormFieldType, FormFieldTypeEnum, PluginDatasetSourceId, PluginDatasetSourceIds } from "./datasets/schemas.js";
5
6
  import { EventEmitter } from "./events/type.js";
6
7
  import { StreamDataAnswerTypeEnum, StreamDataSchema, StreamDataType, StreamMessageSchema, StreamMessageType, StreamMessageTypeEnum, SystemVarSchema, SystemVarType, ToolContextType, ToolHandlerFunctionType, ToolHandlerReturnSchema, ToolHandlerReturnType } from "./tools/schemas/req.js";
7
8
  import { Cherrio2MdInput, Cherrio2MdResult, EventEnumType, FileInput } from "./events/schemas.js";
8
9
  import { ToolConfigSchema, ToolDetailSchema, ToolDetailType, ToolSchema, ToolSetConfigSchema, ToolSetSchema, ToolSimpleSchema, ToolSimpleType, ToolTagEnum, UnifiedToolSchema, VersionListItemSchema, VersionListItemType } from "./tools/schemas/tool.js";
9
10
  import { defineTool, defineToolSet } from "./tools/helper.js";
10
11
  import { EmbeddingModelItemSchema, LLMModelItemSchema, ListModelsSchema, ListModelsType, ModelItemSchema, ModelItemType, ModelTypeEnum, RerankModelItemSchema, STTModelSchema, TTSModelSchema } from "./models/schemas.js";
12
+ import { AiproxyMapProviderType, ModelProviderMap, ModelProviders, aiproxyIdMap } from "./models/constants.js";
11
13
  import { TemplateItemSchema, TemplateItemType, TemplateListSchema, TemplateListType } from "./workflows/schemas.js";
12
- import { ToolTagsNameMap, ToolTagsType } from "./tools/constants.js";
14
+ import { PluginBaseS3Prefix, ToolTagsNameMap, ToolTagsType, UploadToolsS3Path } from "./tools/constants.js";
13
15
  import { FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum, InputSchema, LLMModelTypeEnum, OutputSchema, OutputType, SecretInputItemSchema, SecretInputItemType, WorkflowIOValueTypeEnum } from "./tools/schemas/fastgpt.js";
14
- export { type Cherrio2MdInput, type Cherrio2MdResult, EmbeddingModelItemSchema, type EventEmitter, type EventEnumType, type FileInput, FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum, I18nStringSchema, I18nStringStrictSchema, type I18nStringStrictType, type I18nStringType, InputSchema, LLMModelItemSchema, LLMModelTypeEnum, ListModelsSchema, type ListModelsType, ModelItemSchema, type ModelItemType, ModelTypeEnum, OutputSchema, type OutputType, RerankModelItemSchema, STTModelSchema, SecretInputItemSchema, type SecretInputItemType, StreamDataAnswerTypeEnum, StreamDataSchema, type StreamDataType, StreamMessageSchema, type StreamMessageType, StreamMessageTypeEnum, SystemVarSchema, type SystemVarType, TTSModelSchema, TemplateItemSchema, type TemplateItemType, TemplateListSchema, type TemplateListType, ToolConfigSchema, type ToolContextType, ToolDetailSchema, type ToolDetailType, type ToolHandlerFunctionType, ToolHandlerReturnSchema, type ToolHandlerReturnType, ToolSchema, ToolSetConfigSchema, ToolSetSchema, ToolSimpleSchema, type ToolSimpleType, ToolTagEnum, ToolTagsNameMap, type ToolTagsType, UnifiedToolSchema, VersionListItemSchema, type VersionListItemType, WorkflowIOValueTypeEnum, batch, catchError, defineTool, defineToolSet, delay, ensureDir, pkg, refreshDir, unpkg };
16
+ export { type AiproxyMapProviderType, type Cherrio2MdInput, type Cherrio2MdResult, type DatasetSourceConfig, DatasetSourceConfigSchema, type DatasetSourceId, DatasetSourceIdEnum, type DatasetSourceInfo, DatasetSourceInfoSchema, EmbeddingModelItemSchema, type EventEmitter, type EventEnumType, type FileContentResponse, FileContentResponseSchema, type FileInput, type FileItem, FileItemSchema, FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum, type FormFieldConfig, FormFieldConfigSchema, type FormFieldType, FormFieldTypeEnum, I18nStringSchema, I18nStringStrictSchema, type I18nStringStrictType, type I18nStringType, InputSchema, LLMModelItemSchema, LLMModelTypeEnum, ListModelsSchema, type ListModelsType, ModelItemSchema, type ModelItemType, ModelProviderMap, type ModelProviderMap as ModelProviderMapType, ModelProviders, ModelTypeEnum, OutputSchema, type OutputType, PluginBaseS3Prefix, type PluginDatasetSourceId, PluginDatasetSourceIds, RerankModelItemSchema, STTModelSchema, SecretInputItemSchema, type SecretInputItemType, StreamDataAnswerTypeEnum, StreamDataSchema, type StreamDataType, StreamMessageSchema, type StreamMessageType, StreamMessageTypeEnum, SystemVarSchema, type SystemVarType, TTSModelSchema, TemplateItemSchema, type TemplateItemType, TemplateListSchema, type TemplateListType, ToolConfigSchema, type ToolContextType, ToolDetailSchema, type ToolDetailType, type ToolHandlerFunctionType, ToolHandlerReturnSchema, type ToolHandlerReturnType, ToolSchema, ToolSetConfigSchema, ToolSetSchema, ToolSimpleSchema, type ToolSimpleType, ToolTagEnum, ToolTagsNameMap, type ToolTagsType, UnifiedToolSchema, UploadToolsS3Path, VersionListItemSchema, type VersionListItemType, WorkflowIOValueTypeEnum, aiproxyIdMap, batch, catchError, defineTool, defineToolSet, delay, ensureDir, pkg, refreshDir, unpkg };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{ensureDir as e,refreshDir as t}from"./common/fs.js";import{batch as n,catchError as r,delay as i}from"./common/fn.js";import{pkg as a,unpkg as o}from"./common/zip.js";import{I18nStringSchema as s,I18nStringStrictSchema as c}from"./common/schemas/i18n.js";import{FlowNodeInputTypeEnum as l,FlowNodeOutputTypeEnum as u,InputSchema as d,LLMModelTypeEnum as f,OutputSchema as p,SecretInputItemSchema as m,WorkflowIOValueTypeEnum as h}from"./tools/schemas/fastgpt.js";import{ToolConfigSchema as g,ToolDetailSchema as _,ToolSchema as v,ToolSetConfigSchema as y,ToolSetSchema as b,ToolSimpleSchema as x,ToolTagEnum as S,UnifiedToolSchema as C,VersionListItemSchema as w}from"./tools/schemas/tool.js";import{defineTool as T,defineToolSet as E}from"./tools/helper.js";import{EmbeddingModelItemSchema as D,LLMModelItemSchema as O,ListModelsSchema as k,ModelItemSchema as A,ModelTypeEnum as j,RerankModelItemSchema as M,STTModelSchema as N,TTSModelSchema as P}from"./models/schemas.js";import{TemplateItemSchema as F,TemplateListSchema as I}from"./workflows/schemas.js";import{ToolTagsNameMap as L}from"./tools/constants.js";import{StreamDataAnswerTypeEnum as R,StreamDataSchema as z,StreamMessageSchema as B,StreamMessageTypeEnum as V,SystemVarSchema as H,ToolHandlerReturnSchema as U}from"./tools/schemas/req.js";export{D as EmbeddingModelItemSchema,l as FlowNodeInputTypeEnum,u as FlowNodeOutputTypeEnum,s as I18nStringSchema,c as I18nStringStrictSchema,d as InputSchema,O as LLMModelItemSchema,f as LLMModelTypeEnum,k as ListModelsSchema,A as ModelItemSchema,j as ModelTypeEnum,p as OutputSchema,M as RerankModelItemSchema,N as STTModelSchema,m as SecretInputItemSchema,R as StreamDataAnswerTypeEnum,z as StreamDataSchema,B as StreamMessageSchema,V as StreamMessageTypeEnum,H as SystemVarSchema,P as TTSModelSchema,F as TemplateItemSchema,I as TemplateListSchema,g as ToolConfigSchema,_ as ToolDetailSchema,U as ToolHandlerReturnSchema,v as ToolSchema,y as ToolSetConfigSchema,b as ToolSetSchema,x as ToolSimpleSchema,S as ToolTagEnum,L as ToolTagsNameMap,C as UnifiedToolSchema,w as VersionListItemSchema,h as WorkflowIOValueTypeEnum,n as batch,r as catchError,T as defineTool,E as defineToolSet,i as delay,e as ensureDir,a as pkg,t as refreshDir,o as unpkg};
1
+ import{ensureDir as e,refreshDir as t}from"./common/fs.js";import{batch as n,catchError as r,delay as i}from"./common/fn.js";import{pkg as a,unpkg as o}from"./common/zip.js";import{I18nStringSchema as s,I18nStringStrictSchema as c}from"./common/schemas/i18n.js";import{FlowNodeInputTypeEnum as l,FlowNodeOutputTypeEnum as u,InputSchema as d,LLMModelTypeEnum as f,OutputSchema as p,SecretInputItemSchema as m,WorkflowIOValueTypeEnum as h}from"./tools/schemas/fastgpt.js";import{ToolConfigSchema as g,ToolDetailSchema as _,ToolSchema as v,ToolSetConfigSchema as y,ToolSetSchema as b,ToolSimpleSchema as x,ToolTagEnum as S,UnifiedToolSchema as C,VersionListItemSchema as w}from"./tools/schemas/tool.js";import{defineTool as T,defineToolSet as E}from"./tools/helper.js";import{EmbeddingModelItemSchema as D,LLMModelItemSchema as O,ListModelsSchema as k,ModelItemSchema as A,ModelTypeEnum as j,RerankModelItemSchema as M,STTModelSchema as N,TTSModelSchema as P}from"./models/schemas.js";import{ModelProviderMap as F,ModelProviders as I,aiproxyIdMap as L}from"./models/constants.js";import{TemplateItemSchema as R,TemplateListSchema as z}from"./workflows/schemas.js";import{PluginBaseS3Prefix as B,ToolTagsNameMap as V,UploadToolsS3Path as H}from"./tools/constants.js";import{StreamDataAnswerTypeEnum as U,StreamDataSchema as W,StreamMessageSchema as G,StreamMessageTypeEnum as K,SystemVarSchema as q,ToolHandlerReturnSchema as J}from"./tools/schemas/req.js";import{DatasetSourceConfigSchema as Y,DatasetSourceIdEnum as X,DatasetSourceInfoSchema as Z,FileContentResponseSchema as Q,FileItemSchema as $,FormFieldConfigSchema as ee,FormFieldTypeEnum as te,PluginDatasetSourceIds as ne}from"./datasets/schemas.js";export{Y as DatasetSourceConfigSchema,X as DatasetSourceIdEnum,Z as DatasetSourceInfoSchema,D as EmbeddingModelItemSchema,Q as FileContentResponseSchema,$ as FileItemSchema,l as FlowNodeInputTypeEnum,u as FlowNodeOutputTypeEnum,ee as FormFieldConfigSchema,te as FormFieldTypeEnum,s as I18nStringSchema,c as I18nStringStrictSchema,d as InputSchema,O as LLMModelItemSchema,f as LLMModelTypeEnum,k as ListModelsSchema,A as ModelItemSchema,F as ModelProviderMap,I as ModelProviders,j as ModelTypeEnum,p as OutputSchema,B as PluginBaseS3Prefix,ne as PluginDatasetSourceIds,M as RerankModelItemSchema,N as STTModelSchema,m as SecretInputItemSchema,U as StreamDataAnswerTypeEnum,W as StreamDataSchema,G as StreamMessageSchema,K as StreamMessageTypeEnum,q as SystemVarSchema,P as TTSModelSchema,R as TemplateItemSchema,z as TemplateListSchema,g as ToolConfigSchema,_ as ToolDetailSchema,J as ToolHandlerReturnSchema,v as ToolSchema,y as ToolSetConfigSchema,b as ToolSetSchema,x as ToolSimpleSchema,S as ToolTagEnum,V as ToolTagsNameMap,C as UnifiedToolSchema,H as UploadToolsS3Path,w as VersionListItemSchema,h as WorkflowIOValueTypeEnum,L as aiproxyIdMap,n as batch,r as catchError,T as defineTool,E as defineToolSet,i as delay,e as ensureDir,a as pkg,t as refreshDir,o as unpkg};
@@ -0,0 +1,23 @@
1
+ import { I18nStringStrictType } from "../common/schemas/i18n.js";
2
+
3
+ //#region src/models/constants.d.ts
4
+ type ModelProviderMap = {
5
+ [key: string]: I18nStringStrictType;
6
+ };
7
+ declare const ModelProviderMap: ModelProviderMap;
8
+ declare const ModelProviders: {
9
+ provider: string;
10
+ value: {
11
+ en: string;
12
+ 'zh-CN': string;
13
+ 'zh-Hant': string;
14
+ };
15
+ }[];
16
+ type AiproxyMapProviderType = Record<number, {
17
+ name: I18nStringStrictType | string;
18
+ provider?: string;
19
+ avatar?: string;
20
+ }>;
21
+ declare const aiproxyIdMap: AiproxyMapProviderType;
22
+ //#endregion
23
+ export { AiproxyMapProviderType, ModelProviderMap, ModelProviders, aiproxyIdMap };
@@ -0,0 +1 @@
1
+ const e={OpenAI:{en:`OpenAI`,"zh-CN":`OpenAI`,"zh-Hant":`OpenAI`},Claude:{en:`Claude`,"zh-CN":`Claude`,"zh-Hant":`Claude`},Gemini:{en:`Gemini`,"zh-CN":`Gemini`,"zh-Hant":`Gemini`},Meta:{en:`Meta`,"zh-CN":`Meta`,"zh-Hant":`Meta`},MistralAI:{en:`MistralAI`,"zh-CN":`MistralAI`,"zh-Hant":`MistralAI`},Grok:{en:`Grok`,"zh-CN":`Grok`,"zh-Hant":`Grok`},Groq:{en:`Groq`,"zh-CN":`Groq`,"zh-Hant":`Groq`},Jina:{en:`Jina`,"zh-CN":`Jina`,"zh-Hant":`Jina`},Qwen:{en:`Qwen`,"zh-CN":`通义千问`,"zh-Hant":`通義千問`},Doubao:{en:`Doubao`,"zh-CN":`豆包`,"zh-Hant":`豆包`},DeepSeek:{en:`DeepSeek`,"zh-CN":`深度求索`,"zh-Hant":`深度求索`},ChatGLM:{en:`ChatGLM`,"zh-CN":`ChatGLM`,"zh-Hant":`ChatGLM`},MiniMax:{en:`MiniMax`,"zh-CN":`MiniMax`,"zh-Hant":`MiniMax`},Moonshot:{en:`Moonshot`,"zh-CN":`月之暗面`,"zh-Hant":`月之暗面`},Ernie:{en:`Ernie`,"zh-CN":`文心一言`,"zh-Hant":`文心一言`},SparkDesk:{en:`SparkDesk`,"zh-CN":`讯飞星火`,"zh-Hant":`訊飛星火`},Hunyuan:{en:`Hunyuan`,"zh-CN":`混元`,"zh-Hant":`混元`},Baichuan:{en:`Baichuan`,"zh-CN":`百川智能`,"zh-Hant":`百川智能`},StepFun:{en:`StepFun`,"zh-CN":`阶跃星辰`,"zh-Hant":`階躍星辰`},ai360:{en:`ai360`,"zh-CN":`ai360`,"zh-Hant":`ai360`},Yi:{en:`Yi`,"zh-CN":`零一万物`,"zh-Hant":`零一萬物`},BAAI:{en:`BAAI`,"zh-CN":`北京智源`,"zh-Hant":`北京智源`},FishAudio:{en:`FishAudio`,"zh-CN":`FishAudio`,"zh-Hant":`FishAudio`},InternLM:{en:`InternLM`,"zh-CN":`书生大模型`,"zh-Hant":`書生大模型`},Moka:{en:`Moka`,"zh-CN":`Moka`,"zh-Hant":`Moka`},Ollama:{en:`Ollama`,"zh-CN":`Ollama`,"zh-Hant":`Ollama`},OpenRouter:{en:`OpenRouter`,"zh-CN":`OpenRouter`,"zh-Hant":`OpenRouter`},vertexai:{en:`vertexai`,"zh-CN":`vertexai`,"zh-Hant":`vertexai`},novita:{en:`novita`,"zh-CN":`novita`,"zh-Hant":`novita`},AliCloud:{en:`AliCloud`,"zh-CN":`阿里云`,"zh-Hant":`阿里雲`},Siliconflow:{en:`Siliconflow`,"zh-CN":`硅基流动`,"zh-Hant":`矽基流動`},PPIO:{en:`PPIO`,"zh-CN":`PPIO`,"zh-Hant":`PPIO`},Sangfor:{en:`Sangfor`,"zh-CN":`深信服`,"zh-Hant":`深信服`},Other:{en:`Other`,"zh-CN":`其他`,"zh-Hant":`其他`}},t=Object.entries(e).map(([e,t])=>({provider:e,value:t})),n={1:{name:`OpenAI`,provider:`OpenAI`},3:{name:{en:`微软 Azure`,"zh-CN":`Azure`,"zh-Hant":`Azure`},avatar:`model/azure`,provider:`OpenAI`},4:{name:`azure (弃用)`,avatar:`model/azure`,provider:`Other`},14:{name:`Anthropic`,provider:`Claude`},12:{name:`Google Gemini(OpenAI)`,provider:`Gemini`},24:{name:`Google Gemini`,provider:`Gemini`},28:{name:`Mistral AI`,provider:`MistralAI`},29:{name:`Groq`,provider:`Groq`},17:{name:{en:`Qwen`,"zh-CN":`阿里百炼`,"zh-Hant":`阿里百煉`},provider:`Qwen`},40:{name:{en:`Doubao`,"zh-CN":`火山引擎(豆包)`,"zh-Hant":`火山引擎(豆包)`},provider:`Doubao`},36:{name:`DeepSeek`,provider:`DeepSeek`},13:{name:{en:`Ernie V2`,"zh-CN":`百度智能云 V2`,"zh-Hant":`百度智能云 V2`},provider:`Ernie`},15:{name:{en:`Ernie`,"zh-CN":`百度智能云`,"zh-Hant":`百度智能云`},provider:`Ernie`},16:{name:{en:`ChatGLM`,"zh-CN":`智谱清言`,"zh-Hant":`智譜清言`},provider:`ChatGLM`},18:{name:{en:`SparkDesk`,"zh-CN":`讯飞星火`,"zh-Hant":`訊飛星火`},provider:`SparkDesk`},25:{name:{en:`Moonshot`,"zh-CN":`月之暗面`,"zh-Hant":`月之暗面`},provider:`Moonshot`},26:{name:{en:`Baichuan`,"zh-CN":`百川智能`,"zh-Hant":`百川智能`},provider:`Baichuan`},27:{name:`MiniMax`,provider:`MiniMax`},31:{name:{en:`Yi`,"zh-CN":`零一万物`,"zh-Hant":`零一萬物`},provider:`Yi`},32:{name:{en:`StepFun`,"zh-CN":`阶跃星辰`,"zh-Hant":`階躍星辰`},provider:`StepFun`},43:{name:{en:`Siliconflow`,"zh-CN":`硅基流动`,"zh-Hant":`矽基流動`},provider:`Siliconflow`},30:{name:`Ollama`,provider:`Ollama`},23:{name:{en:`Hunyuan`,"zh-CN":`腾讯混元`,"zh-Hant":`騰訊混元`},provider:`Hunyuan`},44:{name:{en:`Doubao Audio`,"zh-CN":`火山引擎(豆包音频)`,"zh-Hant":`火山引擎(豆包音频)`},provider:`Doubao`},33:{name:`AWS`,provider:`Other`,avatar:`model/aws`},35:{name:`Cohere`,provider:`Other`,avatar:`model/cohere`},37:{name:`Cloudflare`,provider:`Other`,avatar:`model/cloudflare`},20:{name:`OpenRouter`,provider:`OpenRouter`},47:{name:`JinaAI`,provider:`Jina`},19:{name:`ai360`,provider:`ai360`},42:{name:`vertexai`,provider:`vertexai`},41:{name:`novita`,provider:`novita`},45:{name:`Grok`,provider:`Grok`},46:{name:`Doc2X`,provider:`Other`,avatar:`plugins/doc2x`},34:{name:`Coze`,provider:`Other`,avatar:`model/coze`},48:{name:`Sangfor`,provider:`Sangfor`}};export{e as ModelProviderMap,t as ModelProviders,n as aiproxyIdMap};
@@ -68,5 +68,13 @@ type ToolTagsType = { [key in keyof typeof ToolTagEnum]: {
68
68
  'zh-CN': string;
69
69
  'zh-Hant': string;
70
70
  } };
71
+ /**
72
+ * S3 路径:上传的工具存储路径
73
+ */
74
+ declare const UploadToolsS3Path = "system/plugin/tools";
75
+ /**
76
+ * S3 路径:插件文件的基础前缀
77
+ */
78
+ declare const PluginBaseS3Prefix = "system/plugin/files";
71
79
  //#endregion
72
- export { ToolTagsNameMap, ToolTagsType };
80
+ export { PluginBaseS3Prefix, ToolTagsNameMap, ToolTagsType, UploadToolsS3Path };
@@ -1 +1 @@
1
- import{ToolTagEnum as e}from"./schemas/tool.js";const t={[e.tools]:{en:`tools`,"zh-CN":`工具`,"zh-Hant":`工具`},[e.search]:{en:`search`,"zh-CN":`搜索`,"zh-Hant":`搜尋`},[e.multimodal]:{en:`multimodal`,"zh-CN":`多模态`,"zh-Hant":`多模態`},[e.communication]:{en:`communication`,"zh-CN":`通信`,"zh-Hant":`通訊`},[e.finance]:{en:`finance`,"zh-CN":`金融`,"zh-Hant":`金融`},[e.design]:{en:`design`,"zh-CN":`设计`,"zh-Hant":`設計`},[e.productivity]:{en:`productivity`,"zh-CN":`生产力`,"zh-Hant":`生產力`},[e.news]:{en:`news`,"zh-CN":`新闻`,"zh-Hant":`新聞`},[e.entertainment]:{en:`entertainment`,"zh-CN":`娱乐`,"zh-Hant":`娛樂`},[e.social]:{en:`social`,"zh-CN":`社交`,"zh-Hant":`社群`},[e.scientific]:{en:`scientific`,"zh-CN":`科学`,"zh-Hant":`科學`},[e.other]:{en:`other`,"zh-CN":`其他`,"zh-Hant":`其他`}};export{t as ToolTagsNameMap};
1
+ import{ToolTagEnum as e}from"./schemas/tool.js";const t={[e.tools]:{en:`tools`,"zh-CN":`工具`,"zh-Hant":`工具`},[e.search]:{en:`search`,"zh-CN":`搜索`,"zh-Hant":`搜尋`},[e.multimodal]:{en:`multimodal`,"zh-CN":`多模态`,"zh-Hant":`多模態`},[e.communication]:{en:`communication`,"zh-CN":`通信`,"zh-Hant":`通訊`},[e.finance]:{en:`finance`,"zh-CN":`金融`,"zh-Hant":`金融`},[e.design]:{en:`design`,"zh-CN":`设计`,"zh-Hant":`設計`},[e.productivity]:{en:`productivity`,"zh-CN":`生产力`,"zh-Hant":`生產力`},[e.news]:{en:`news`,"zh-CN":`新闻`,"zh-Hant":`新聞`},[e.entertainment]:{en:`entertainment`,"zh-CN":`娱乐`,"zh-Hant":`娛樂`},[e.social]:{en:`social`,"zh-CN":`社交`,"zh-Hant":`社群`},[e.scientific]:{en:`scientific`,"zh-CN":`科学`,"zh-Hant":`科學`},[e.other]:{en:`other`,"zh-CN":`其他`,"zh-Hant":`其他`}},n=`system/plugin/tools`,r=`system/plugin/files`;export{r as PluginBaseS3Prefix,t as ToolTagsNameMap,n as UploadToolsS3Path};
@@ -16,7 +16,7 @@ declare const exportTool: <I, O>({
16
16
  OutputSchema: ZodType<O>;
17
17
  config: ToolConfigType;
18
18
  }) => {
19
- handler: (props: I, e: ToolContextType) => Promise<{
19
+ handler: (props: I, ctx: ToolContextType) => Promise<{
20
20
  output: O;
21
21
  error?: never;
22
22
  } | {
@@ -86,12 +86,12 @@ declare const exportTool: <I, O>({
86
86
  }[];
87
87
  description?: string | undefined;
88
88
  }[];
89
- description: {
89
+ name: {
90
90
  en: string;
91
91
  'zh-CN'?: string | undefined;
92
92
  'zh-Hant'?: string | undefined;
93
93
  };
94
- name: {
94
+ description: {
95
95
  en: string;
96
96
  'zh-CN'?: string | undefined;
97
97
  'zh-Hant'?: string | undefined;
@@ -100,7 +100,7 @@ declare const exportTool: <I, O>({
100
100
  tags?: ("tools" | "search" | "multimodal" | "communication" | "finance" | "design" | "productivity" | "news" | "entertainment" | "social" | "scientific" | "other")[] | undefined;
101
101
  icon?: string | undefined;
102
102
  author?: string | undefined;
103
- tutorialLink?: string | undefined;
103
+ tutorialUrl?: string | undefined;
104
104
  secretInputConfig?: {
105
105
  key: string;
106
106
  label: string;
@@ -114,131 +114,29 @@ declare const exportTool: <I, O>({
114
114
  }[] | undefined;
115
115
  }[] | undefined;
116
116
  parentId?: string | undefined;
117
- tutorialUrl?: string | undefined;
118
- etag?: string | undefined;
117
+ permission?: ("userInfo:read" | "teamInfo:read" | "model:read" | "dataset:read")[] | undefined;
119
118
  };
120
119
  declare const exportToolSet: ({
121
120
  config
122
121
  }: {
123
122
  config: ToolSetConfigType;
124
123
  }) => {
125
- children: {
126
- toolId: string;
127
- name: {
128
- en: string;
129
- 'zh-CN'?: string | undefined;
130
- 'zh-Hant'?: string | undefined;
131
- };
132
- description: {
133
- en: string;
134
- 'zh-CN'?: string | undefined;
135
- 'zh-Hant'?: string | undefined;
136
- };
137
- toolDescription: string;
138
- icon: string;
139
- handler: any;
140
- filename: string;
141
- parentId?: string | undefined;
142
- versionList?: {
143
- value: string;
144
- inputs: {
145
- key: string;
146
- label: string;
147
- renderTypeList: ("reference" | "input" | "textarea" | "numberInput" | "switch" | "select" | "multipleSelect" | "JSONEditor" | "addInputParam" | "selectApp" | "customVariable" | "selectLLMModel" | "settingLLMModel" | "selectDataset" | "selectDatasetParamsModal" | "settingDatasetQuotePrompt" | "hidden" | "custom" | "fileSelect")[];
148
- valueType: "string" | "number" | "boolean" | "object" | "selectApp" | "selectDataset" | "any" | "arrayString" | "arrayNumber" | "arrayBoolean" | "arrayObject" | "arrayAny" | "chatHistory" | "datasetQuote" | "dynamic";
149
- referencePlaceholder?: string | undefined;
150
- placeholder?: string | undefined;
151
- defaultValue?: any;
152
- selectedTypeIndex?: number | undefined;
153
- valueDesc?: string | undefined;
154
- value?: unknown;
155
- description?: string | undefined;
156
- required?: boolean | undefined;
157
- toolDescription?: string | undefined;
158
- canEdit?: boolean | undefined;
159
- isPro?: boolean | undefined;
160
- maxLength?: number | undefined;
161
- canSelectFile?: boolean | undefined;
162
- canSelectImg?: boolean | undefined;
163
- maxFiles?: number | undefined;
164
- inputList?: {
165
- key: string;
166
- label: string;
167
- inputType: "input" | "numberInput" | "switch" | "select" | "secret";
168
- description?: string | undefined;
169
- required?: boolean | undefined;
170
- defaultValue?: any;
171
- list?: {
172
- label: string;
173
- value: string;
174
- }[] | undefined;
175
- }[] | undefined;
176
- llmModelType?: "all" | "classify" | "extractFields" | "toolCall" | undefined;
177
- list?: {
178
- label: string;
179
- value: string;
180
- }[] | undefined;
181
- markList?: {
182
- label: string;
183
- value: number;
184
- }[] | undefined;
185
- step?: number | undefined;
186
- max?: number | undefined;
187
- min?: number | undefined;
188
- precision?: number | undefined;
189
- }[];
190
- outputs: {
191
- key: string;
192
- valueType: "string" | "number" | "boolean" | "object" | "selectApp" | "selectDataset" | "any" | "arrayString" | "arrayNumber" | "arrayBoolean" | "arrayObject" | "arrayAny" | "chatHistory" | "datasetQuote" | "dynamic";
193
- id?: string | undefined;
194
- type?: "hidden" | "dynamic" | "source" | "static" | "error" | undefined;
195
- valueDesc?: string | undefined;
196
- value?: unknown;
197
- label?: string | undefined;
198
- description?: string | undefined;
199
- defaultValue?: any;
200
- required?: boolean | undefined;
201
- }[];
202
- description?: string | undefined;
203
- }[] | undefined;
204
- tags?: ("tools" | "search" | "multimodal" | "communication" | "finance" | "design" | "productivity" | "news" | "entertainment" | "social" | "scientific" | "other")[] | undefined;
205
- author?: string | undefined;
206
- tutorialUrl?: string | undefined;
207
- readmeUrl?: string | undefined;
208
- secretInputConfig?: {
209
- key: string;
210
- label: string;
211
- inputType: "input" | "numberInput" | "switch" | "select" | "secret";
212
- description?: string | undefined;
213
- required?: boolean | undefined;
214
- defaultValue?: any;
215
- list?: {
216
- label: string;
217
- value: string;
218
- }[] | undefined;
219
- }[] | undefined;
220
- etag?: string | undefined;
221
- }[];
222
- description: {
124
+ name: {
223
125
  en: string;
224
126
  'zh-CN'?: string | undefined;
225
127
  'zh-Hant'?: string | undefined;
226
128
  };
227
- name: {
129
+ description: {
228
130
  en: string;
229
131
  'zh-CN'?: string | undefined;
230
132
  'zh-Hant'?: string | undefined;
231
133
  };
232
- filename: string;
233
- tutorialUrl?: string | undefined;
234
- readmeUrl?: string | undefined;
235
- etag?: string | undefined;
236
134
  toolId?: string | undefined;
237
135
  toolDescription?: string | undefined;
238
136
  tags?: ("tools" | "search" | "multimodal" | "communication" | "finance" | "design" | "productivity" | "news" | "entertainment" | "social" | "scientific" | "other")[] | undefined;
239
137
  icon?: string | undefined;
240
138
  author?: string | undefined;
241
- tutorialLink?: string | undefined;
139
+ tutorialUrl?: string | undefined;
242
140
  secretInputConfig?: {
243
141
  key: string;
244
142
  label: string;
@@ -251,6 +149,8 @@ declare const exportToolSet: ({
251
149
  value: string;
252
150
  }[] | undefined;
253
151
  }[] | undefined;
152
+ readmeUrl?: string | undefined;
153
+ permission?: ("userInfo:read" | "teamInfo:read" | "model:read" | "dataset:read")[] | undefined;
254
154
  };
255
155
  //#endregion
256
156
  export { defineTool, defineToolSet, exportTool, exportToolSet };
@@ -2,4 +2,4 @@ import{vi as e}from"vitest";const t={user:{id:`mock-user-id`,username:`mock-user
2
2
 
3
3
  Converted from HTML.`),cherrio2md:e.fn().mockResolvedValue({markdown:`# Mock Markdown
4
4
 
5
- Fetched from URL`,title:`Mock Title`,usedSelector:`body`})};export{n as mockedEventEmitter,t as mockedSystemVar};
5
+ Fetched from URL`,title:`Mock Title`,usedSelector:`body`}),invoke:e.fn()};export{n as mockedEventEmitter,t as mockedSystemVar};
@@ -0,0 +1,18 @@
1
+ import { z as z$1 } from "zod";
2
+
3
+ //#region src/tools/schemas/permission.d.ts
4
+ declare const ToolPermissionEnumSchema: z$1.ZodEnum<{
5
+ "userInfo:read": "userInfo:read";
6
+ "teamInfo:read": "teamInfo:read";
7
+ "model:read": "model:read";
8
+ "dataset:read": "dataset:read";
9
+ }>;
10
+ declare const ToolPermissionEnum: {
11
+ "userInfo:read": "userInfo:read";
12
+ "teamInfo:read": "teamInfo:read";
13
+ "model:read": "model:read";
14
+ "dataset:read": "dataset:read";
15
+ };
16
+ type ToolPermissionEnumType = z$1.infer<typeof ToolPermissionEnumSchema>;
17
+ //#endregion
18
+ export { ToolPermissionEnum, ToolPermissionEnumSchema, ToolPermissionEnumType };
@@ -0,0 +1 @@
1
+ import{z as e}from"zod";const t=e.enum([`userInfo:read`,`teamInfo:read`,`model:read`,`dataset:read`]),n=t.enum;export{n as ToolPermissionEnum,t as ToolPermissionEnumSchema};
@@ -25,6 +25,7 @@ declare const SystemVarSchema: z$1.ZodObject<{
25
25
  id: z$1.ZodString;
26
26
  version: z$1.ZodString;
27
27
  prefix: z$1.ZodOptional<z$1.ZodString>;
28
+ accessToken: z$1.ZodOptional<z$1.ZodString>;
28
29
  }, z$1.core.$strip>;
29
30
  time: z$1.ZodString;
30
31
  }, z$1.core.$strip>;
@@ -1 +1 @@
1
- import{z as e}from"zod";const t=e.object({error:e.union([e.string(),e.record(e.string(),e.any())]).optional(),output:e.record(e.string(),e.any()).optional()}),n=e.object({user:e.object({id:e.string(),username:e.string(),contact:e.string(),membername:e.string(),teamName:e.string(),teamId:e.string(),name:e.string()}),app:e.object({id:e.string(),name:e.string()}),tool:e.object({id:e.string(),version:e.string(),prefix:e.string().optional()}),time:e.string()}),r=e.enum([`response`,`error`,`stream`]),i=r.enum,a=e.enum([`answer`,`fastAnswer`]),o=a.enum,s=e.object({type:a,content:e.string()}),c=e.discriminatedUnion(`type`,[e.object({type:i.response,data:t}),e.object({type:i.stream,data:s}),e.object({type:i.error,data:e.string()})]);export{o as StreamDataAnswerTypeEnum,a as StreamDataAnswerTypeSchema,s as StreamDataSchema,c as StreamMessageSchema,i as StreamMessageTypeEnum,r as StreamMessageTypeSchema,n as SystemVarSchema,t as ToolHandlerReturnSchema};
1
+ import{z as e}from"zod";const t=e.object({error:e.union([e.string(),e.record(e.string(),e.any())]).optional(),output:e.record(e.string(),e.any()).optional()}),n=e.object({user:e.object({id:e.string(),username:e.string(),contact:e.string(),membername:e.string(),teamName:e.string(),teamId:e.string(),name:e.string()}),app:e.object({id:e.string(),name:e.string()}),tool:e.object({id:e.string(),version:e.string(),prefix:e.string().optional(),accessToken:e.string().optional()}),time:e.string()}),r=e.enum([`response`,`error`,`stream`]),i=r.enum,a=e.enum([`answer`,`fastAnswer`]),o=a.enum,s=e.object({type:a,content:e.string()}),c=e.discriminatedUnion(`type`,[e.object({type:i.response,data:t}),e.object({type:i.stream,data:s}),e.object({type:i.error,data:e.string()})]);export{o as StreamDataAnswerTypeEnum,a as StreamDataAnswerTypeSchema,s as StreamDataSchema,c as StreamMessageSchema,i as StreamMessageTypeEnum,r as StreamMessageTypeSchema,n as SystemVarSchema,t as ToolHandlerReturnSchema};
@@ -349,6 +349,12 @@ declare const ToolSchema: z$1.ZodObject<{
349
349
  handler: z$1.ZodAny;
350
350
  filename: z$1.ZodString;
351
351
  etag: z$1.ZodOptional<z$1.ZodString>;
352
+ permission: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
353
+ "userInfo:read": "userInfo:read";
354
+ "teamInfo:read": "teamInfo:read";
355
+ "model:read": "model:read";
356
+ "dataset:read": "dataset:read";
357
+ }>>>;
352
358
  }, z$1.core.$strip>;
353
359
  type ToolType = z$1.infer<typeof ToolSchema> & {
354
360
  handler: ToolHandlerFunctionType;
@@ -542,18 +548,24 @@ declare const ToolSetSchema: z$1.ZodObject<{
542
548
  handler: z$1.ZodAny;
543
549
  filename: z$1.ZodString;
544
550
  etag: z$1.ZodOptional<z$1.ZodString>;
551
+ permission: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
552
+ "userInfo:read": "userInfo:read";
553
+ "teamInfo:read": "teamInfo:read";
554
+ "model:read": "model:read";
555
+ "dataset:read": "dataset:read";
556
+ }>>>;
545
557
  }, z$1.core.$strip>>;
546
- description: z$1.ZodObject<{
558
+ name: z$1.ZodObject<{
547
559
  en: z$1.ZodString;
548
560
  'zh-CN': z$1.ZodOptional<z$1.ZodString>;
549
561
  'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
550
562
  }, z$1.core.$strip>;
551
- toolDescription: z$1.ZodString;
552
- name: z$1.ZodObject<{
563
+ description: z$1.ZodObject<{
553
564
  en: z$1.ZodString;
554
565
  'zh-CN': z$1.ZodOptional<z$1.ZodString>;
555
566
  'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
556
567
  }, z$1.core.$strip>;
568
+ toolDescription: z$1.ZodString;
557
569
  tags: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
558
570
  tools: "tools";
559
571
  search: "search";
@@ -592,6 +604,12 @@ declare const ToolSetSchema: z$1.ZodObject<{
592
604
  }, z$1.core.$strip>>>;
593
605
  filename: z$1.ZodString;
594
606
  etag: z$1.ZodOptional<z$1.ZodString>;
607
+ permission: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
608
+ "userInfo:read": "userInfo:read";
609
+ "teamInfo:read": "teamInfo:read";
610
+ "model:read": "model:read";
611
+ "dataset:read": "dataset:read";
612
+ }>>>;
595
613
  }, z$1.core.$strip>;
596
614
  type ToolSetType = z$1.infer<typeof ToolSetSchema>;
597
615
  declare const UnifiedToolSchema: z$1.ZodObject<{
@@ -780,18 +798,24 @@ declare const UnifiedToolSchema: z$1.ZodObject<{
780
798
  handler: z$1.ZodAny;
781
799
  filename: z$1.ZodString;
782
800
  etag: z$1.ZodOptional<z$1.ZodString>;
801
+ permission: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
802
+ "userInfo:read": "userInfo:read";
803
+ "teamInfo:read": "teamInfo:read";
804
+ "model:read": "model:read";
805
+ "dataset:read": "dataset:read";
806
+ }>>>;
783
807
  }, z$1.core.$strip>>;
784
- description: z$1.ZodObject<{
808
+ name: z$1.ZodObject<{
785
809
  en: z$1.ZodString;
786
810
  'zh-CN': z$1.ZodOptional<z$1.ZodString>;
787
811
  'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
788
812
  }, z$1.core.$strip>;
789
- toolDescription: z$1.ZodString;
790
- name: z$1.ZodObject<{
813
+ description: z$1.ZodObject<{
791
814
  en: z$1.ZodString;
792
815
  'zh-CN': z$1.ZodOptional<z$1.ZodString>;
793
816
  'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
794
817
  }, z$1.core.$strip>;
818
+ toolDescription: z$1.ZodString;
795
819
  tags: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
796
820
  tools: "tools";
797
821
  search: "search";
@@ -830,6 +854,12 @@ declare const UnifiedToolSchema: z$1.ZodObject<{
830
854
  }, z$1.core.$strip>>>;
831
855
  filename: z$1.ZodString;
832
856
  etag: z$1.ZodOptional<z$1.ZodString>;
857
+ permission: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
858
+ "userInfo:read": "userInfo:read";
859
+ "teamInfo:read": "teamInfo:read";
860
+ "model:read": "model:read";
861
+ "dataset:read": "dataset:read";
862
+ }>>>;
833
863
  parentId: z$1.ZodOptional<z$1.ZodString>;
834
864
  versionList: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
835
865
  value: z$1.ZodString;
@@ -1103,18 +1133,18 @@ declare const ToolDistSchema: z$1.ZodObject<{
1103
1133
  }, z$1.core.$strip>>>;
1104
1134
  children: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1105
1135
  icon: z$1.ZodOptional<z$1.ZodString>;
1106
- description: z$1.ZodObject<{
1136
+ name: z$1.ZodObject<{
1107
1137
  en: z$1.ZodString;
1108
1138
  'zh-CN': z$1.ZodOptional<z$1.ZodString>;
1109
1139
  'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
1110
1140
  }, z$1.core.$strip>;
1111
- toolDescription: z$1.ZodString;
1112
- name: z$1.ZodObject<{
1141
+ description: z$1.ZodObject<{
1113
1142
  en: z$1.ZodString;
1114
1143
  'zh-CN': z$1.ZodOptional<z$1.ZodString>;
1115
1144
  'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
1116
1145
  }, z$1.core.$strip>;
1117
1146
  toolId: z$1.ZodString;
1147
+ toolDescription: z$1.ZodString;
1118
1148
  versionList: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1119
1149
  value: z$1.ZodString;
1120
1150
  description: z$1.ZodOptional<z$1.ZodString>;
@@ -1283,19 +1313,25 @@ declare const ToolDistSchema: z$1.ZodObject<{
1283
1313
  handler: z$1.ZodAny;
1284
1314
  filename: z$1.ZodString;
1285
1315
  etag: z$1.ZodOptional<z$1.ZodString>;
1316
+ permission: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
1317
+ "userInfo:read": "userInfo:read";
1318
+ "teamInfo:read": "teamInfo:read";
1319
+ "model:read": "model:read";
1320
+ "dataset:read": "dataset:read";
1321
+ }>>>;
1286
1322
  }, z$1.core.$strip>>>;
1287
- description: z$1.ZodObject<{
1323
+ name: z$1.ZodObject<{
1288
1324
  en: z$1.ZodString;
1289
1325
  'zh-CN': z$1.ZodOptional<z$1.ZodString>;
1290
1326
  'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
1291
1327
  }, z$1.core.$strip>;
1292
- toolDescription: z$1.ZodString;
1293
- name: z$1.ZodObject<{
1328
+ description: z$1.ZodObject<{
1294
1329
  en: z$1.ZodString;
1295
1330
  'zh-CN': z$1.ZodOptional<z$1.ZodString>;
1296
1331
  'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
1297
1332
  }, z$1.core.$strip>;
1298
1333
  toolId: z$1.ZodString;
1334
+ toolDescription: z$1.ZodString;
1299
1335
  tags: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
1300
1336
  tools: "tools";
1301
1337
  search: "search";
@@ -1332,6 +1368,12 @@ declare const ToolDistSchema: z$1.ZodObject<{
1332
1368
  }, z$1.core.$strip>>>;
1333
1369
  filename: z$1.ZodString;
1334
1370
  etag: z$1.ZodOptional<z$1.ZodString>;
1371
+ permission: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
1372
+ "userInfo:read": "userInfo:read";
1373
+ "teamInfo:read": "teamInfo:read";
1374
+ "model:read": "model:read";
1375
+ "dataset:read": "dataset:read";
1376
+ }>>>;
1335
1377
  }, z$1.core.$strip>;
1336
1378
  type ToolDistType = z$1.infer<typeof ToolDistSchema>;
1337
1379
  /**
@@ -1488,7 +1530,7 @@ declare const ToolConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
1488
1530
  }>>>;
1489
1531
  icon: z$1.ZodOptional<z$1.ZodString>;
1490
1532
  author: z$1.ZodOptional<z$1.ZodString>;
1491
- tutorialLink: z$1.ZodOptional<z$1.ZodURL>;
1533
+ tutorialUrl: z$1.ZodOptional<z$1.ZodURL>;
1492
1534
  secretInputConfig: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1493
1535
  key: z$1.ZodString;
1494
1536
  label: z$1.ZodString;
@@ -1507,19 +1549,23 @@ declare const ToolConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
1507
1549
  value: z$1.ZodString;
1508
1550
  }, z$1.core.$strip>>>;
1509
1551
  }, z$1.core.$strip>>>;
1510
- description: z$1.ZodObject<{
1552
+ name: z$1.ZodObject<{
1511
1553
  en: z$1.ZodString;
1512
1554
  'zh-CN': z$1.ZodOptional<z$1.ZodString>;
1513
1555
  'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
1514
1556
  }, z$1.core.$strip>;
1515
- name: z$1.ZodObject<{
1557
+ description: z$1.ZodObject<{
1516
1558
  en: z$1.ZodString;
1517
1559
  'zh-CN': z$1.ZodOptional<z$1.ZodString>;
1518
1560
  'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
1519
1561
  }, z$1.core.$strip>;
1520
1562
  parentId: z$1.ZodOptional<z$1.ZodString>;
1521
- tutorialUrl: z$1.ZodOptional<z$1.ZodURL>;
1522
- etag: z$1.ZodOptional<z$1.ZodString>;
1563
+ permission: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
1564
+ "userInfo:read": "userInfo:read";
1565
+ "teamInfo:read": "teamInfo:read";
1566
+ "model:read": "model:read";
1567
+ "dataset:read": "dataset:read";
1568
+ }>>>;
1523
1569
  }, z$1.core.$strip>, z$1.ZodTransform<{
1524
1570
  toolDescription: string;
1525
1571
  versionList: {
@@ -1584,12 +1630,12 @@ declare const ToolConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
1584
1630
  }[];
1585
1631
  description?: string | undefined;
1586
1632
  }[];
1587
- description: {
1633
+ name: {
1588
1634
  en: string;
1589
1635
  'zh-CN'?: string | undefined;
1590
1636
  'zh-Hant'?: string | undefined;
1591
1637
  };
1592
- name: {
1638
+ description: {
1593
1639
  en: string;
1594
1640
  'zh-CN'?: string | undefined;
1595
1641
  'zh-Hant'?: string | undefined;
@@ -1598,7 +1644,7 @@ declare const ToolConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
1598
1644
  tags?: ("tools" | "search" | "multimodal" | "communication" | "finance" | "design" | "productivity" | "news" | "entertainment" | "social" | "scientific" | "other")[] | undefined;
1599
1645
  icon?: string | undefined;
1600
1646
  author?: string | undefined;
1601
- tutorialLink?: string | undefined;
1647
+ tutorialUrl?: string | undefined;
1602
1648
  secretInputConfig?: {
1603
1649
  key: string;
1604
1650
  label: string;
@@ -1612,8 +1658,7 @@ declare const ToolConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
1612
1658
  }[] | undefined;
1613
1659
  }[] | undefined;
1614
1660
  parentId?: string | undefined;
1615
- tutorialUrl?: string | undefined;
1616
- etag?: string | undefined;
1661
+ permission?: ("userInfo:read" | "teamInfo:read" | "model:read" | "dataset:read")[] | undefined;
1617
1662
  }, {
1618
1663
  versionList: {
1619
1664
  value: string;
@@ -1677,12 +1722,12 @@ declare const ToolConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
1677
1722
  }[];
1678
1723
  description?: string | undefined;
1679
1724
  }[];
1680
- description: {
1725
+ name: {
1681
1726
  en: string;
1682
1727
  'zh-CN'?: string | undefined;
1683
1728
  'zh-Hant'?: string | undefined;
1684
1729
  };
1685
- name: {
1730
+ description: {
1686
1731
  en: string;
1687
1732
  'zh-CN'?: string | undefined;
1688
1733
  'zh-Hant'?: string | undefined;
@@ -1692,7 +1737,7 @@ declare const ToolConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
1692
1737
  tags?: ("tools" | "search" | "multimodal" | "communication" | "finance" | "design" | "productivity" | "news" | "entertainment" | "social" | "scientific" | "other")[] | undefined;
1693
1738
  icon?: string | undefined;
1694
1739
  author?: string | undefined;
1695
- tutorialLink?: string | undefined;
1740
+ tutorialUrl?: string | undefined;
1696
1741
  secretInputConfig?: {
1697
1742
  key: string;
1698
1743
  label: string;
@@ -1706,213 +1751,13 @@ declare const ToolConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
1706
1751
  }[] | undefined;
1707
1752
  }[] | undefined;
1708
1753
  parentId?: string | undefined;
1709
- tutorialUrl?: string | undefined;
1710
- etag?: string | undefined;
1754
+ permission?: ("userInfo:read" | "teamInfo:read" | "model:read" | "dataset:read")[] | undefined;
1711
1755
  }>>;
1712
1756
  type ToolConfigType = z$1.infer<typeof ToolConfigSchema>;
1713
1757
  /**
1714
1758
  * 工具集配置
1715
1759
  */
1716
1760
  declare const ToolSetConfigSchema: z$1.ZodObject<{
1717
- children: z$1.ZodArray<z$1.ZodObject<{
1718
- toolId: z$1.ZodString;
1719
- parentId: z$1.ZodOptional<z$1.ZodString>;
1720
- name: z$1.ZodObject<{
1721
- en: z$1.ZodString;
1722
- 'zh-CN': z$1.ZodOptional<z$1.ZodString>;
1723
- 'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
1724
- }, z$1.core.$strip>;
1725
- description: z$1.ZodObject<{
1726
- en: z$1.ZodString;
1727
- 'zh-CN': z$1.ZodOptional<z$1.ZodString>;
1728
- 'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
1729
- }, z$1.core.$strip>;
1730
- toolDescription: z$1.ZodString;
1731
- versionList: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1732
- value: z$1.ZodString;
1733
- description: z$1.ZodOptional<z$1.ZodString>;
1734
- inputs: z$1.ZodArray<z$1.ZodObject<{
1735
- key: z$1.ZodString;
1736
- label: z$1.ZodString;
1737
- referencePlaceholder: z$1.ZodOptional<z$1.ZodString>;
1738
- placeholder: z$1.ZodOptional<z$1.ZodString>;
1739
- defaultValue: z$1.ZodOptional<z$1.ZodAny>;
1740
- selectedTypeIndex: z$1.ZodOptional<z$1.ZodNumber>;
1741
- renderTypeList: z$1.ZodArray<z$1.ZodEnum<{
1742
- reference: "reference";
1743
- input: "input";
1744
- textarea: "textarea";
1745
- numberInput: "numberInput";
1746
- switch: "switch";
1747
- select: "select";
1748
- multipleSelect: "multipleSelect";
1749
- JSONEditor: "JSONEditor";
1750
- addInputParam: "addInputParam";
1751
- selectApp: "selectApp";
1752
- customVariable: "customVariable";
1753
- selectLLMModel: "selectLLMModel";
1754
- settingLLMModel: "settingLLMModel";
1755
- selectDataset: "selectDataset";
1756
- selectDatasetParamsModal: "selectDatasetParamsModal";
1757
- settingDatasetQuotePrompt: "settingDatasetQuotePrompt";
1758
- hidden: "hidden";
1759
- custom: "custom";
1760
- fileSelect: "fileSelect";
1761
- }>>;
1762
- valueType: z$1.ZodEnum<{
1763
- string: "string";
1764
- number: "number";
1765
- boolean: "boolean";
1766
- object: "object";
1767
- selectApp: "selectApp";
1768
- selectDataset: "selectDataset";
1769
- any: "any";
1770
- arrayString: "arrayString";
1771
- arrayNumber: "arrayNumber";
1772
- arrayBoolean: "arrayBoolean";
1773
- arrayObject: "arrayObject";
1774
- arrayAny: "arrayAny";
1775
- chatHistory: "chatHistory";
1776
- datasetQuote: "datasetQuote";
1777
- dynamic: "dynamic";
1778
- }>;
1779
- valueDesc: z$1.ZodOptional<z$1.ZodString>;
1780
- value: z$1.ZodOptional<z$1.ZodUnknown>;
1781
- description: z$1.ZodOptional<z$1.ZodString>;
1782
- required: z$1.ZodOptional<z$1.ZodBoolean>;
1783
- toolDescription: z$1.ZodOptional<z$1.ZodString>;
1784
- canEdit: z$1.ZodOptional<z$1.ZodBoolean>;
1785
- isPro: z$1.ZodOptional<z$1.ZodBoolean>;
1786
- maxLength: z$1.ZodOptional<z$1.ZodNumber>;
1787
- canSelectFile: z$1.ZodOptional<z$1.ZodBoolean>;
1788
- canSelectImg: z$1.ZodOptional<z$1.ZodBoolean>;
1789
- maxFiles: z$1.ZodOptional<z$1.ZodNumber>;
1790
- inputList: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1791
- key: z$1.ZodString;
1792
- label: z$1.ZodString;
1793
- description: z$1.ZodOptional<z$1.ZodString>;
1794
- required: z$1.ZodOptional<z$1.ZodBoolean>;
1795
- inputType: z$1.ZodEnum<{
1796
- input: "input";
1797
- numberInput: "numberInput";
1798
- switch: "switch";
1799
- select: "select";
1800
- secret: "secret";
1801
- }>;
1802
- defaultValue: z$1.ZodOptional<z$1.ZodAny>;
1803
- list: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1804
- label: z$1.ZodString;
1805
- value: z$1.ZodString;
1806
- }, z$1.core.$strip>>>;
1807
- }, z$1.core.$strip>>>;
1808
- llmModelType: z$1.ZodOptional<z$1.ZodEnum<{
1809
- all: "all";
1810
- classify: "classify";
1811
- extractFields: "extractFields";
1812
- toolCall: "toolCall";
1813
- }>>;
1814
- list: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1815
- label: z$1.ZodString;
1816
- value: z$1.ZodString;
1817
- }, z$1.core.$strip>>>;
1818
- markList: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1819
- label: z$1.ZodString;
1820
- value: z$1.ZodNumber;
1821
- }, z$1.core.$strip>>>;
1822
- step: z$1.ZodOptional<z$1.ZodNumber>;
1823
- max: z$1.ZodOptional<z$1.ZodNumber>;
1824
- min: z$1.ZodOptional<z$1.ZodNumber>;
1825
- precision: z$1.ZodOptional<z$1.ZodNumber>;
1826
- }, z$1.core.$strip>>;
1827
- outputs: z$1.ZodArray<z$1.ZodObject<{
1828
- id: z$1.ZodOptional<z$1.ZodString>;
1829
- type: z$1.ZodOptional<z$1.ZodEnum<{
1830
- hidden: "hidden";
1831
- dynamic: "dynamic";
1832
- source: "source";
1833
- static: "static";
1834
- error: "error";
1835
- }>>;
1836
- key: z$1.ZodString;
1837
- valueType: z$1.ZodEnum<{
1838
- string: "string";
1839
- number: "number";
1840
- boolean: "boolean";
1841
- object: "object";
1842
- selectApp: "selectApp";
1843
- selectDataset: "selectDataset";
1844
- any: "any";
1845
- arrayString: "arrayString";
1846
- arrayNumber: "arrayNumber";
1847
- arrayBoolean: "arrayBoolean";
1848
- arrayObject: "arrayObject";
1849
- arrayAny: "arrayAny";
1850
- chatHistory: "chatHistory";
1851
- datasetQuote: "datasetQuote";
1852
- dynamic: "dynamic";
1853
- }>;
1854
- valueDesc: z$1.ZodOptional<z$1.ZodString>;
1855
- value: z$1.ZodOptional<z$1.ZodUnknown>;
1856
- label: z$1.ZodOptional<z$1.ZodString>;
1857
- description: z$1.ZodOptional<z$1.ZodString>;
1858
- defaultValue: z$1.ZodOptional<z$1.ZodAny>;
1859
- required: z$1.ZodOptional<z$1.ZodBoolean>;
1860
- }, z$1.core.$strip>>;
1861
- }, z$1.core.$strip>>>;
1862
- tags: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
1863
- tools: "tools";
1864
- search: "search";
1865
- multimodal: "multimodal";
1866
- communication: "communication";
1867
- finance: "finance";
1868
- design: "design";
1869
- productivity: "productivity";
1870
- news: "news";
1871
- entertainment: "entertainment";
1872
- social: "social";
1873
- scientific: "scientific";
1874
- other: "other";
1875
- }>>>;
1876
- icon: z$1.ZodString;
1877
- author: z$1.ZodOptional<z$1.ZodString>;
1878
- tutorialUrl: z$1.ZodOptional<z$1.ZodURL>;
1879
- readmeUrl: z$1.ZodOptional<z$1.ZodURL>;
1880
- secretInputConfig: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1881
- key: z$1.ZodString;
1882
- label: z$1.ZodString;
1883
- description: z$1.ZodOptional<z$1.ZodString>;
1884
- required: z$1.ZodOptional<z$1.ZodBoolean>;
1885
- inputType: z$1.ZodEnum<{
1886
- input: "input";
1887
- numberInput: "numberInput";
1888
- switch: "switch";
1889
- select: "select";
1890
- secret: "secret";
1891
- }>;
1892
- defaultValue: z$1.ZodOptional<z$1.ZodAny>;
1893
- list: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1894
- label: z$1.ZodString;
1895
- value: z$1.ZodString;
1896
- }, z$1.core.$strip>>>;
1897
- }, z$1.core.$strip>>>;
1898
- handler: z$1.ZodAny;
1899
- filename: z$1.ZodString;
1900
- etag: z$1.ZodOptional<z$1.ZodString>;
1901
- }, z$1.core.$strip>>;
1902
- description: z$1.ZodObject<{
1903
- en: z$1.ZodString;
1904
- 'zh-CN': z$1.ZodOptional<z$1.ZodString>;
1905
- 'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
1906
- }, z$1.core.$strip>;
1907
- name: z$1.ZodObject<{
1908
- en: z$1.ZodString;
1909
- 'zh-CN': z$1.ZodOptional<z$1.ZodString>;
1910
- 'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
1911
- }, z$1.core.$strip>;
1912
- tutorialUrl: z$1.ZodOptional<z$1.ZodURL>;
1913
- readmeUrl: z$1.ZodOptional<z$1.ZodURL>;
1914
- filename: z$1.ZodString;
1915
- etag: z$1.ZodOptional<z$1.ZodString>;
1916
1761
  toolId: z$1.ZodOptional<z$1.ZodString>;
1917
1762
  toolDescription: z$1.ZodOptional<z$1.ZodString>;
1918
1763
  tags: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
@@ -1931,7 +1776,7 @@ declare const ToolSetConfigSchema: z$1.ZodObject<{
1931
1776
  }>>>;
1932
1777
  icon: z$1.ZodOptional<z$1.ZodString>;
1933
1778
  author: z$1.ZodOptional<z$1.ZodString>;
1934
- tutorialLink: z$1.ZodOptional<z$1.ZodURL>;
1779
+ tutorialUrl: z$1.ZodOptional<z$1.ZodURL>;
1935
1780
  secretInputConfig: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1936
1781
  key: z$1.ZodString;
1937
1782
  label: z$1.ZodString;
@@ -1950,21 +1795,39 @@ declare const ToolSetConfigSchema: z$1.ZodObject<{
1950
1795
  value: z$1.ZodString;
1951
1796
  }, z$1.core.$strip>>>;
1952
1797
  }, z$1.core.$strip>>>;
1798
+ name: z$1.ZodObject<{
1799
+ en: z$1.ZodString;
1800
+ 'zh-CN': z$1.ZodOptional<z$1.ZodString>;
1801
+ 'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
1802
+ }, z$1.core.$strip>;
1803
+ description: z$1.ZodObject<{
1804
+ en: z$1.ZodString;
1805
+ 'zh-CN': z$1.ZodOptional<z$1.ZodString>;
1806
+ 'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
1807
+ }, z$1.core.$strip>;
1808
+ readmeUrl: z$1.ZodOptional<z$1.ZodURL>;
1809
+ permission: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
1810
+ "userInfo:read": "userInfo:read";
1811
+ "teamInfo:read": "teamInfo:read";
1812
+ "model:read": "model:read";
1813
+ "dataset:read": "dataset:read";
1814
+ }>>>;
1953
1815
  }, z$1.core.$strip>;
1954
1816
  type ToolSetConfigType = z$1.infer<typeof ToolSetConfigSchema>;
1955
1817
  declare const ToolDetailSchema: z$1.ZodObject<{
1956
- description: z$1.ZodObject<{
1818
+ name: z$1.ZodObject<{
1957
1819
  en: z$1.ZodString;
1958
1820
  'zh-CN': z$1.ZodOptional<z$1.ZodString>;
1959
1821
  'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
1960
1822
  }, z$1.core.$strip>;
1961
- toolDescription: z$1.ZodString;
1962
- name: z$1.ZodObject<{
1823
+ description: z$1.ZodObject<{
1963
1824
  en: z$1.ZodString;
1964
1825
  'zh-CN': z$1.ZodOptional<z$1.ZodString>;
1965
1826
  'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
1966
1827
  }, z$1.core.$strip>;
1967
1828
  toolId: z$1.ZodString;
1829
+ parentId: z$1.ZodOptional<z$1.ZodString>;
1830
+ toolDescription: z$1.ZodString;
1968
1831
  versionList: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1969
1832
  value: z$1.ZodString;
1970
1833
  description: z$1.ZodOptional<z$1.ZodString>;
@@ -2133,20 +1996,27 @@ declare const ToolDetailSchema: z$1.ZodObject<{
2133
1996
  }, z$1.core.$strip>>>;
2134
1997
  }, z$1.core.$strip>>>;
2135
1998
  etag: z$1.ZodOptional<z$1.ZodString>;
1999
+ permission: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
2000
+ "userInfo:read": "userInfo:read";
2001
+ "teamInfo:read": "teamInfo:read";
2002
+ "model:read": "model:read";
2003
+ "dataset:read": "dataset:read";
2004
+ }>>>;
2136
2005
  }, z$1.core.$strip>;
2137
2006
  type ToolDetailType = z$1.infer<typeof ToolDetailSchema>;
2138
2007
  declare const ToolSimpleSchema: z$1.ZodObject<{
2139
- description: z$1.ZodObject<{
2008
+ name: z$1.ZodObject<{
2140
2009
  en: z$1.ZodString;
2141
2010
  'zh-CN': z$1.ZodOptional<z$1.ZodString>;
2142
2011
  'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
2143
2012
  }, z$1.core.$strip>;
2144
- name: z$1.ZodObject<{
2013
+ description: z$1.ZodObject<{
2145
2014
  en: z$1.ZodString;
2146
2015
  'zh-CN': z$1.ZodOptional<z$1.ZodString>;
2147
2016
  'zh-Hant': z$1.ZodOptional<z$1.ZodString>;
2148
2017
  }, z$1.core.$strip>;
2149
2018
  toolId: z$1.ZodString;
2019
+ parentId: z$1.ZodOptional<z$1.ZodString>;
2150
2020
  tags: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
2151
2021
  tools: "tools";
2152
2022
  search: "search";
@@ -2166,6 +2036,12 @@ declare const ToolSimpleSchema: z$1.ZodObject<{
2166
2036
  tutorialUrl: z$1.ZodOptional<z$1.ZodURL>;
2167
2037
  readmeUrl: z$1.ZodOptional<z$1.ZodURL>;
2168
2038
  etag: z$1.ZodOptional<z$1.ZodString>;
2039
+ permission: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
2040
+ "userInfo:read": "userInfo:read";
2041
+ "teamInfo:read": "teamInfo:read";
2042
+ "model:read": "model:read";
2043
+ "dataset:read": "dataset:read";
2044
+ }>>>;
2169
2045
  }, z$1.core.$strip>;
2170
2046
  type ToolSimpleType = z$1.infer<typeof ToolSimpleSchema>;
2171
2047
  //#endregion
@@ -1 +1 @@
1
- import{I18nStringSchema as e}from"../../common/schemas/i18n.js";import{InputSchema as t,OutputSchema as n,SecretInputItemSchema as r}from"./fastgpt.js";import{z as i}from"zod";const a=i.enum([`tools`,`search`,`multimodal`,`communication`,`finance`,`design`,`productivity`,`news`,`entertainment`,`social`,`scientific`,`other`]),o=a.enum,s=i.object({value:i.string(),description:i.string().optional(),inputs:i.array(t),outputs:i.array(n)}),c=i.object({toolId:i.string(),parentId:i.string().optional(),name:e,description:e,toolDescription:i.string(),versionList:i.array(s).optional(),tags:i.array(a).optional(),icon:i.string(),author:i.string().optional(),tutorialUrl:i.url().optional(),readmeUrl:i.url().optional(),secretInputConfig:i.array(r).optional(),handler:i.any(),filename:i.string(),etag:i.string().nonempty().optional()}),l=i.object({...c.omit({parentId:!0,versionList:!0,handler:!0}).shape,toolId:i.string().refine(e=>!e.includes(`/`)),children:i.array(c).min(1)}),u=i.object({...c.shape,...l.shape}),d=i.object({...l.omit({readmeUrl:!0}).shape,icon:i.string().optional(),versionList:i.array(s).optional(),children:i.array(i.object({...c.omit({parentId:!0,readmeUrl:!0}).shape,icon:i.string().optional()})).optional()}),f=i.object({...c.omit({filename:!0,readmeUrl:!0,handler:!0}).shape,toolId:i.string().optional(),toolDescription:i.string().optional(),versionList:i.array(s).min(1),tags:i.array(a).optional(),icon:i.string().optional(),author:i.string().optional(),tutorialLink:i.url().optional(),secretInputConfig:i.array(r).optional()}).transform(e=>({...e,toolDescription:e.toolDescription??e.description.en})),p=l.extend({toolId:i.string().optional(),toolDescription:i.string().optional(),tags:i.array(a).optional(),icon:i.string().optional(),author:i.string().optional(),tutorialLink:i.url().optional(),secretInputConfig:i.array(r).optional()}),m=u.pick({toolId:!0,name:!0,description:!0,toolDescription:!0,author:!0,tags:!0,icon:!0,tutorialUrl:!0,readmeUrl:!0,secretInputConfig:!0,etag:!0,versionList:!0}),h=m.omit({secretInputConfig:!0,toolDescription:!0,versionList:!0});export{f as ToolConfigSchema,m as ToolDetailSchema,d as ToolDistSchema,c as ToolSchema,p as ToolSetConfigSchema,l as ToolSetSchema,h as ToolSimpleSchema,o as ToolTagEnum,a as ToolTagSchema,u as UnifiedToolSchema,s as VersionListItemSchema};
1
+ import{I18nStringSchema as e}from"../../common/schemas/i18n.js";import{InputSchema as t,OutputSchema as n,SecretInputItemSchema as r}from"./fastgpt.js";import{ToolPermissionEnumSchema as i}from"./permission.js";import{z as a}from"zod";const o=a.enum([`tools`,`search`,`multimodal`,`communication`,`finance`,`design`,`productivity`,`news`,`entertainment`,`social`,`scientific`,`other`]),s=o.enum,c=a.object({value:a.string(),description:a.string().optional(),inputs:a.array(t),outputs:a.array(n)}),l=a.object({toolId:a.string(),parentId:a.string().optional(),name:e,description:e,toolDescription:a.string(),versionList:a.array(c).optional(),tags:a.array(o).optional(),icon:a.string(),author:a.string().optional(),tutorialUrl:a.url().optional(),readmeUrl:a.url().optional(),secretInputConfig:a.array(r).optional(),handler:a.any(),filename:a.string(),etag:a.string().nonempty().optional(),permission:a.array(i).optional()}),u=a.object({...l.omit({parentId:!0,versionList:!0,handler:!0}).shape,toolId:a.string().refine(e=>!e.includes(`/`)),children:a.array(l).min(1)}),d=a.object({...l.shape,...u.shape}),f=a.object({...u.omit({readmeUrl:!0}).shape,icon:a.string().optional(),versionList:a.array(c).optional(),children:a.array(a.object({...l.omit({parentId:!0,readmeUrl:!0}).shape,icon:a.string().optional()})).optional()}),p=a.object({...l.omit({filename:!0,readmeUrl:!0,handler:!0,etag:!0}).shape,toolId:a.string().optional(),toolDescription:a.string().optional(),versionList:a.array(c).min(1),tags:a.array(o).optional(),icon:a.string().optional(),author:a.string().optional(),tutorialUrl:a.url().optional(),secretInputConfig:a.array(r).optional()}).transform(e=>({...e,toolDescription:e.toolDescription??e.description.en})),m=a.object({...u.omit({filename:!0,etag:!0,children:!0}).shape,toolId:a.string().optional(),toolDescription:a.string().optional(),tags:a.array(o).optional(),icon:a.string().optional(),author:a.string().optional(),tutorialUrl:a.url().optional(),secretInputConfig:a.array(r).optional()}),h=d.pick({toolId:!0,parentId:!0,name:!0,description:!0,toolDescription:!0,author:!0,tags:!0,icon:!0,tutorialUrl:!0,readmeUrl:!0,secretInputConfig:!0,etag:!0,versionList:!0,permission:!0}),g=h.omit({secretInputConfig:!0,toolDescription:!0,versionList:!0});export{p as ToolConfigSchema,h as ToolDetailSchema,f as ToolDistSchema,l as ToolSchema,m as ToolSetConfigSchema,u as ToolSetSchema,g as ToolSimpleSchema,s as ToolTagEnum,o as ToolTagSchema,d as UnifiedToolSchema,c as VersionListItemSchema};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastgpt-plugin/helpers",
3
- "version": "0.0.1-alpha.6",
3
+ "version": "0.0.1-alpha.8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -23,6 +23,7 @@
23
23
  "build": "tsdown"
24
24
  },
25
25
  "dependencies": {
26
+ "@fastgpt-sdk/invoke": "^0.0.1-alpha.2",
26
27
  "jszip": "^3.10.1",
27
28
  "vitest": "^4.0.18",
28
29
  "zod": "^4"