@aigne/core 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/types/index.js +2 -4
- package/lib/esm/index.js +1 -1
- package/lib/esm/types/index.js +2 -4
- package/lib/types/index.d.ts +1 -1
- package/lib/types/types/agent.d.ts +5 -0
- package/lib/types/types/index.d.ts +2 -4
- package/lib/types/types/runnable.d.ts +20 -0
- package/package.json +6 -7
- package/lib/cjs/assistant/generate-output.js +0 -101
- package/lib/cjs/assistant/select-agent.js +0 -76
- package/lib/cjs/assistant/type.js +0 -11
- package/lib/cjs/common/aid.js +0 -42
- package/lib/cjs/common/index.js +0 -238
- package/lib/cjs/common/resource-manager.js +0 -199
- package/lib/cjs/constants.js +0 -9
- package/lib/cjs/executor/agent.js +0 -10
- package/lib/cjs/executor/aigc.js +0 -28
- package/lib/cjs/executor/api.js +0 -64
- package/lib/cjs/executor/base.js +0 -676
- package/lib/cjs/executor/blocklet.js +0 -25
- package/lib/cjs/executor/call-agent.js +0 -105
- package/lib/cjs/executor/decision.js +0 -478
- package/lib/cjs/executor/image-blender.js +0 -32
- package/lib/cjs/executor/index.js +0 -81
- package/lib/cjs/executor/llm.js +0 -379
- package/lib/cjs/executor/logic.js +0 -167
- package/lib/cjs/libs/blocklet/vc.js +0 -92
- package/lib/cjs/libs/openapi/request/index.js +0 -24
- package/lib/cjs/libs/openapi/request/util.js +0 -146
- package/lib/cjs/libs/openapi/types/index.js +0 -17
- package/lib/cjs/libs/openapi/util/call.js +0 -15
- package/lib/cjs/libs/openapi/util/check-schema.js +0 -67
- package/lib/cjs/libs/openapi/util/convert-schema.js +0 -44
- package/lib/cjs/libs/openapi/util/flatten-open-api.js +0 -21
- package/lib/cjs/libs/openapi/util/get-open-api-i18n-text.js +0 -7
- package/lib/cjs/runtime/resource-blocklet.js +0 -5
- package/lib/cjs/runtime/runtime.js +0 -143
- package/lib/cjs/types/assistant/index.js +0 -31
- package/lib/cjs/types/assistant/mustache/ReadableMustache.js +0 -69
- package/lib/cjs/types/assistant/mustache/directive.js +0 -35
- package/lib/cjs/types/assistant/mustache/mustache.js +0 -688
- package/lib/cjs/types/resource/index.js +0 -47
- package/lib/cjs/types/resource/project.js +0 -35
- package/lib/cjs/types/runtime/error.js +0 -18
- package/lib/cjs/types/runtime/index.js +0 -37
- package/lib/cjs/types/runtime/runtime-resource-blocklet-state.js +0 -4
- package/lib/cjs/types/runtime/schema.js +0 -259
- package/lib/cjs/utils/cron-job.js +0 -48
- package/lib/cjs/utils/extract-metadata-transform.js +0 -58
- package/lib/cjs/utils/extract-metadata-transform.test.js +0 -61
- package/lib/cjs/utils/fs.js +0 -49
- package/lib/cjs/utils/get-blocklet-agent.js +0 -351
- package/lib/cjs/utils/geti.js +0 -37
- package/lib/cjs/utils/is-non-nullable.js +0 -20
- package/lib/cjs/utils/render-message.js +0 -23
- package/lib/cjs/utils/resolve-secret-inputs.js +0 -49
- package/lib/cjs/utils/retry.js +0 -19
- package/lib/cjs/utils/task-id.js +0 -7
- package/lib/cjs/utils/tool-calls-transform.js +0 -18
- package/lib/esm/assistant/generate-output.js +0 -91
- package/lib/esm/assistant/select-agent.js +0 -71
- package/lib/esm/assistant/type.js +0 -7
- package/lib/esm/common/aid.js +0 -38
- package/lib/esm/common/index.js +0 -232
- package/lib/esm/common/resource-manager.js +0 -192
- package/lib/esm/constants.js +0 -6
- package/lib/esm/executor/agent.js +0 -6
- package/lib/esm/executor/aigc.js +0 -24
- package/lib/esm/executor/api.js +0 -34
- package/lib/esm/executor/base.js +0 -668
- package/lib/esm/executor/blocklet.js +0 -21
- package/lib/esm/executor/call-agent.js +0 -98
- package/lib/esm/executor/decision.js +0 -471
- package/lib/esm/executor/image-blender.js +0 -25
- package/lib/esm/executor/index.js +0 -74
- package/lib/esm/executor/llm.js +0 -372
- package/lib/esm/executor/logic.js +0 -160
- package/lib/esm/libs/blocklet/vc.js +0 -85
- package/lib/esm/libs/openapi/request/index.js +0 -20
- package/lib/esm/libs/openapi/request/util.js +0 -136
- package/lib/esm/libs/openapi/types/index.js +0 -1
- package/lib/esm/libs/openapi/util/call.js +0 -8
- package/lib/esm/libs/openapi/util/check-schema.js +0 -62
- package/lib/esm/libs/openapi/util/convert-schema.js +0 -42
- package/lib/esm/libs/openapi/util/flatten-open-api.js +0 -19
- package/lib/esm/libs/openapi/util/get-open-api-i18n-text.js +0 -5
- package/lib/esm/runtime/resource-blocklet.js +0 -2
- package/lib/esm/runtime/runtime.js +0 -136
- package/lib/esm/types/assistant/index.js +0 -9
- package/lib/esm/types/assistant/mustache/ReadableMustache.js +0 -63
- package/lib/esm/types/assistant/mustache/directive.js +0 -29
- package/lib/esm/types/assistant/mustache/mustache.js +0 -686
- package/lib/esm/types/resource/index.js +0 -26
- package/lib/esm/types/resource/project.js +0 -29
- package/lib/esm/types/runtime/error.js +0 -14
- package/lib/esm/types/runtime/index.js +0 -20
- package/lib/esm/types/runtime/runtime-resource-blocklet-state.js +0 -1
- package/lib/esm/types/runtime/schema.js +0 -249
- package/lib/esm/utils/cron-job.js +0 -44
- package/lib/esm/utils/extract-metadata-transform.js +0 -54
- package/lib/esm/utils/extract-metadata-transform.test.js +0 -59
- package/lib/esm/utils/fs.js +0 -41
- package/lib/esm/utils/get-blocklet-agent.js +0 -344
- package/lib/esm/utils/geti.js +0 -30
- package/lib/esm/utils/is-non-nullable.js +0 -13
- package/lib/esm/utils/render-message.js +0 -20
- package/lib/esm/utils/resolve-secret-inputs.js +0 -46
- package/lib/esm/utils/retry.js +0 -16
- package/lib/esm/utils/task-id.js +0 -3
- package/lib/esm/utils/tool-calls-transform.js +0 -15
- package/lib/types/assistant/generate-output.d.ts +0 -29
- package/lib/types/assistant/select-agent.d.ts +0 -14
- package/lib/types/assistant/type.d.ts +0 -61
- package/lib/types/common/aid.d.ts +0 -18
- package/lib/types/common/index.d.ts +0 -7
- package/lib/types/common/resource-manager.d.ts +0 -88
- package/lib/types/constants.d.ts +0 -6
- package/lib/types/executor/agent.d.ts +0 -5
- package/lib/types/executor/aigc.d.ts +0 -9
- package/lib/types/executor/api.d.ts +0 -9
- package/lib/types/executor/base.d.ts +0 -209
- package/lib/types/executor/blocklet.d.ts +0 -9
- package/lib/types/executor/call-agent.d.ts +0 -12
- package/lib/types/executor/decision.d.ts +0 -20
- package/lib/types/executor/image-blender.d.ts +0 -9
- package/lib/types/executor/index.d.ts +0 -8
- package/lib/types/executor/llm.d.ts +0 -38
- package/lib/types/executor/logic.d.ts +0 -9
- package/lib/types/libs/blocklet/vc.d.ts +0 -17
- package/lib/types/libs/openapi/request/index.d.ts +0 -17
- package/lib/types/libs/openapi/request/util.d.ts +0 -40
- package/lib/types/libs/openapi/types/index.d.ts +0 -20
- package/lib/types/libs/openapi/util/call.d.ts +0 -2
- package/lib/types/libs/openapi/util/check-schema.d.ts +0 -3
- package/lib/types/libs/openapi/util/convert-schema.d.ts +0 -8
- package/lib/types/libs/openapi/util/flatten-open-api.d.ts +0 -3
- package/lib/types/libs/openapi/util/get-open-api-i18n-text.d.ts +0 -2
- package/lib/types/runtime/resource-blocklet.d.ts +0 -2
- package/lib/types/runtime/runtime.d.ts +0 -20
- package/lib/types/types/assistant/index.d.ts +0 -405
- package/lib/types/types/assistant/mustache/ReadableMustache.d.ts +0 -2
- package/lib/types/types/assistant/mustache/directive.d.ts +0 -6
- package/lib/types/types/assistant/mustache/mustache.d.ts +0 -2
- package/lib/types/types/common/index.d.ts +0 -45
- package/lib/types/types/resource/index.d.ts +0 -17
- package/lib/types/types/resource/project.d.ts +0 -41
- package/lib/types/types/runtime/agent.d.ts +0 -33
- package/lib/types/types/runtime/error.d.ts +0 -10
- package/lib/types/types/runtime/index.d.ts +0 -116
- package/lib/types/types/runtime/runtime-resource-blocklet-state.d.ts +0 -5
- package/lib/types/types/runtime/schema.d.ts +0 -110
- package/lib/types/utils/cron-job.d.ts +0 -22
- package/lib/types/utils/extract-metadata-transform.d.ts +0 -16
- package/lib/types/utils/extract-metadata-transform.test.d.ts +0 -1
- package/lib/types/utils/fs.d.ts +0 -9
- package/lib/types/utils/get-blocklet-agent.d.ts +0 -219
- package/lib/types/utils/geti.d.ts +0 -1
- package/lib/types/utils/is-non-nullable.d.ts +0 -2
- package/lib/types/utils/render-message.d.ts +0 -6
- package/lib/types/utils/resolve-secret-inputs.d.ts +0 -11
- package/lib/types/utils/retry.d.ts +0 -1
- package/lib/types/utils/task-id.d.ts +0 -1
- package/lib/types/utils/tool-calls-transform.d.ts +0 -2
- /package/lib/cjs/types/{runtime/agent.js → agent.js} +0 -0
- /package/lib/cjs/types/{common/index.js → runnable.js} +0 -0
- /package/lib/esm/types/{runtime/agent.js → agent.js} +0 -0
- /package/lib/esm/types/{common/index.js → runnable.js} +0 -0
|
@@ -1,405 +0,0 @@
|
|
|
1
|
-
import type { RuleGroupType } from 'react-querybuilder';
|
|
2
|
-
import { AgentExecutor } from '../resource';
|
|
3
|
-
import type { RuntimeOutputAppearance, RuntimeOutputVariable, RuntimeOutputVariablesSchema } from '../runtime';
|
|
4
|
-
export { default as Mustache } from './mustache/mustache';
|
|
5
|
-
export * from './mustache/directive';
|
|
6
|
-
export declare enum OnTaskCompletion {
|
|
7
|
-
EXIT = "EXIT"
|
|
8
|
-
}
|
|
9
|
-
export type MemoryFile = {
|
|
10
|
-
variables?: Variable[];
|
|
11
|
-
};
|
|
12
|
-
export type ConfigFile = {
|
|
13
|
-
entry?: string;
|
|
14
|
-
};
|
|
15
|
-
export interface CronJob {
|
|
16
|
-
id: string;
|
|
17
|
-
name?: string;
|
|
18
|
-
cronExpression?: string;
|
|
19
|
-
enable?: boolean;
|
|
20
|
-
agentId?: string;
|
|
21
|
-
inputs?: {
|
|
22
|
-
[key: string]: any;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
export type CronFile = {
|
|
26
|
-
jobs?: CronJob[];
|
|
27
|
-
};
|
|
28
|
-
export type Assistant = Agent | PromptAssistant | ImageAssistant | ApiAssistant | FunctionAssistant | RouterAssistant | CallAssistant | ImageBlenderAssistant;
|
|
29
|
-
export type Role = 'system' | 'user' | 'assistant';
|
|
30
|
-
export type ExecuteBlockRole = Role | 'none';
|
|
31
|
-
export type Tool = {
|
|
32
|
-
blockletDid?: string;
|
|
33
|
-
projectId?: string;
|
|
34
|
-
id: string;
|
|
35
|
-
from?: 'assistant' | 'blockletAPI' | 'knowledge';
|
|
36
|
-
parameters?: {
|
|
37
|
-
[key: string]: any;
|
|
38
|
-
};
|
|
39
|
-
functionName?: string;
|
|
40
|
-
onEnd?: OnTaskCompletion;
|
|
41
|
-
};
|
|
42
|
-
type ExecuteBlockCommon = {
|
|
43
|
-
id: string;
|
|
44
|
-
role?: ExecuteBlockRole;
|
|
45
|
-
selectByPrompt?: string;
|
|
46
|
-
tools?: Tool[];
|
|
47
|
-
formatResultType?: 'none' | 'asHistory';
|
|
48
|
-
prefix?: string;
|
|
49
|
-
suffix?: string;
|
|
50
|
-
variable?: string;
|
|
51
|
-
type?: 'dataset' | 'history' | 'setStore' | 'getStore' | 'knowledge';
|
|
52
|
-
respondAs?: 'none' | 'message' | 'systemMessage';
|
|
53
|
-
};
|
|
54
|
-
export type ExecuteBlockSelectAll = ExecuteBlockCommon & {
|
|
55
|
-
selectType: 'all';
|
|
56
|
-
};
|
|
57
|
-
type ModelConfiguration = {
|
|
58
|
-
temperature?: number;
|
|
59
|
-
topP?: number;
|
|
60
|
-
presencePenalty?: number;
|
|
61
|
-
frequencyPenalty?: number;
|
|
62
|
-
maxTokens?: number;
|
|
63
|
-
model?: string;
|
|
64
|
-
};
|
|
65
|
-
export type ExecuteBlockSelectByPrompt = ExecuteBlockCommon & {
|
|
66
|
-
selectType: 'selectByPrompt';
|
|
67
|
-
executeModel?: ModelConfiguration;
|
|
68
|
-
defaultToolId?: string;
|
|
69
|
-
};
|
|
70
|
-
export type ExecuteBlock = ExecuteBlockSelectAll | ExecuteBlockSelectByPrompt;
|
|
71
|
-
export type PromptMessage = {
|
|
72
|
-
id: string;
|
|
73
|
-
role: Role;
|
|
74
|
-
content?: string;
|
|
75
|
-
name?: string;
|
|
76
|
-
};
|
|
77
|
-
export type Prompt = {
|
|
78
|
-
type: 'message';
|
|
79
|
-
data: PromptMessage;
|
|
80
|
-
visibility?: 'hidden';
|
|
81
|
-
} | {
|
|
82
|
-
type: 'executeBlock';
|
|
83
|
-
data: ExecuteBlock;
|
|
84
|
-
visibility?: 'hidden';
|
|
85
|
-
};
|
|
86
|
-
export type Variable = {
|
|
87
|
-
id: string;
|
|
88
|
-
scope?: VariableScope;
|
|
89
|
-
key: string;
|
|
90
|
-
reset?: boolean;
|
|
91
|
-
defaultValue?: any;
|
|
92
|
-
type?: VariableType;
|
|
93
|
-
};
|
|
94
|
-
export type VariableScope = 'user' | 'session' | 'global';
|
|
95
|
-
export interface AssistantBase {
|
|
96
|
-
id: string;
|
|
97
|
-
name?: string;
|
|
98
|
-
parameters?: Parameter[];
|
|
99
|
-
tags?: string[];
|
|
100
|
-
description?: string;
|
|
101
|
-
createdAt: string;
|
|
102
|
-
updatedAt: string;
|
|
103
|
-
createdBy: string;
|
|
104
|
-
updatedBy: string;
|
|
105
|
-
executor?: AgentExecutor;
|
|
106
|
-
tests?: {
|
|
107
|
-
id: string;
|
|
108
|
-
parameters: {
|
|
109
|
-
[key: string]: any;
|
|
110
|
-
};
|
|
111
|
-
output?: string;
|
|
112
|
-
error?: {
|
|
113
|
-
message: string;
|
|
114
|
-
};
|
|
115
|
-
createdBy: string;
|
|
116
|
-
}[];
|
|
117
|
-
formatResultType?: 'none';
|
|
118
|
-
release?: {
|
|
119
|
-
template?: string;
|
|
120
|
-
title?: string;
|
|
121
|
-
description?: string;
|
|
122
|
-
openerMessage?: string;
|
|
123
|
-
logo?: string;
|
|
124
|
-
maxRoundLimit?: number;
|
|
125
|
-
reachMaxRoundLimitTip?: string;
|
|
126
|
-
submitButton?: {
|
|
127
|
-
title?: string;
|
|
128
|
-
background?: string;
|
|
129
|
-
};
|
|
130
|
-
payment?: {
|
|
131
|
-
enable?: boolean;
|
|
132
|
-
price?: string;
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
entries?: {
|
|
136
|
-
id: string;
|
|
137
|
-
title?: string;
|
|
138
|
-
parameters?: {
|
|
139
|
-
[key: string]: any;
|
|
140
|
-
};
|
|
141
|
-
}[];
|
|
142
|
-
outputVariables?: OutputVariable[];
|
|
143
|
-
cache?: {
|
|
144
|
-
enable?: boolean;
|
|
145
|
-
};
|
|
146
|
-
openEmbed?: {
|
|
147
|
-
enable?: boolean;
|
|
148
|
-
};
|
|
149
|
-
access?: {
|
|
150
|
-
noLoginRequired?: boolean;
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
export interface VariableTypeBase {
|
|
154
|
-
id: string;
|
|
155
|
-
name?: string;
|
|
156
|
-
description?: string;
|
|
157
|
-
required?: boolean;
|
|
158
|
-
hidden?: boolean;
|
|
159
|
-
faker?: any;
|
|
160
|
-
}
|
|
161
|
-
export type VariableType = VariableTypeBase & ({
|
|
162
|
-
type?: undefined;
|
|
163
|
-
} | {
|
|
164
|
-
type: 'string';
|
|
165
|
-
defaultValue?: string;
|
|
166
|
-
} | {
|
|
167
|
-
type: 'number';
|
|
168
|
-
defaultValue?: number;
|
|
169
|
-
} | {
|
|
170
|
-
type: 'boolean';
|
|
171
|
-
defaultValue?: boolean;
|
|
172
|
-
} | {
|
|
173
|
-
type: 'object';
|
|
174
|
-
properties?: VariableType[];
|
|
175
|
-
} | {
|
|
176
|
-
type: 'array';
|
|
177
|
-
element?: VariableType;
|
|
178
|
-
});
|
|
179
|
-
export type OutputVariable = VariableType & {
|
|
180
|
-
variable?: {
|
|
181
|
-
key: string;
|
|
182
|
-
scope: VariableScope;
|
|
183
|
-
};
|
|
184
|
-
valueTemplate?: string;
|
|
185
|
-
activeWhen?: string;
|
|
186
|
-
from?: {
|
|
187
|
-
type?: undefined;
|
|
188
|
-
} | {
|
|
189
|
-
type: 'input' | 'output';
|
|
190
|
-
id?: string;
|
|
191
|
-
} | {
|
|
192
|
-
type: 'callAgent';
|
|
193
|
-
callAgent?: {
|
|
194
|
-
blockletDid?: string;
|
|
195
|
-
projectId?: string;
|
|
196
|
-
agentId?: string;
|
|
197
|
-
inputs?: {
|
|
198
|
-
[key: string]: any;
|
|
199
|
-
};
|
|
200
|
-
};
|
|
201
|
-
};
|
|
202
|
-
appearance?: RuntimeOutputAppearance;
|
|
203
|
-
initialValue?: RuntimeOutputVariablesSchema[RuntimeOutputVariable];
|
|
204
|
-
};
|
|
205
|
-
export interface Agent extends AssistantBase {
|
|
206
|
-
type: 'agent';
|
|
207
|
-
}
|
|
208
|
-
export interface BlockletAgent extends Omit<AssistantBase, 'createdAt' | 'updatedAt' | 'createdBy' | 'updatedBy'> {
|
|
209
|
-
type: 'blocklet';
|
|
210
|
-
createdAt?: string;
|
|
211
|
-
updatedAt?: string;
|
|
212
|
-
createdBy?: string;
|
|
213
|
-
updatedBy?: string;
|
|
214
|
-
}
|
|
215
|
-
export interface RouterAssistant extends AssistantBase {
|
|
216
|
-
type: 'router';
|
|
217
|
-
defaultToolId?: string;
|
|
218
|
-
prompt?: string;
|
|
219
|
-
decisionType?: 'ai' | 'json-logic';
|
|
220
|
-
routes?: ({
|
|
221
|
-
condition?: RuleGroupType;
|
|
222
|
-
} & Tool)[];
|
|
223
|
-
temperature?: number;
|
|
224
|
-
topP?: number;
|
|
225
|
-
presencePenalty?: number;
|
|
226
|
-
frequencyPenalty?: number;
|
|
227
|
-
maxTokens?: number;
|
|
228
|
-
model?: string;
|
|
229
|
-
}
|
|
230
|
-
export interface ImageBlenderAssistant extends AssistantBase {
|
|
231
|
-
type: 'imageBlender';
|
|
232
|
-
templateId?: string;
|
|
233
|
-
dynamicData?: {
|
|
234
|
-
[key: string]: string;
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
export interface CallAssistant extends AssistantBase {
|
|
238
|
-
type: 'callAgent';
|
|
239
|
-
agents?: Tool[];
|
|
240
|
-
}
|
|
241
|
-
export interface PromptAssistant extends AssistantBase {
|
|
242
|
-
type: 'prompt';
|
|
243
|
-
prompts?: Prompt[];
|
|
244
|
-
temperature?: number;
|
|
245
|
-
topP?: number;
|
|
246
|
-
presencePenalty?: number;
|
|
247
|
-
frequencyPenalty?: number;
|
|
248
|
-
maxTokens?: number;
|
|
249
|
-
model?: string;
|
|
250
|
-
}
|
|
251
|
-
export interface ImageAssistant extends AssistantBase {
|
|
252
|
-
type: 'image';
|
|
253
|
-
prepareExecutes?: ExecuteBlock[];
|
|
254
|
-
prompt?: string;
|
|
255
|
-
model?: string;
|
|
256
|
-
n?: number;
|
|
257
|
-
quality?: string;
|
|
258
|
-
style?: string;
|
|
259
|
-
size?: string;
|
|
260
|
-
}
|
|
261
|
-
export interface ApiAssistant extends AssistantBase {
|
|
262
|
-
type: 'api';
|
|
263
|
-
prepareExecutes?: ExecuteBlock[];
|
|
264
|
-
requestParameters?: {
|
|
265
|
-
id: string;
|
|
266
|
-
key?: string;
|
|
267
|
-
value?: string;
|
|
268
|
-
}[];
|
|
269
|
-
requestMethod?: string;
|
|
270
|
-
requestUrl?: string;
|
|
271
|
-
requestHeaders: {
|
|
272
|
-
id: string;
|
|
273
|
-
key?: string;
|
|
274
|
-
value?: string;
|
|
275
|
-
}[];
|
|
276
|
-
}
|
|
277
|
-
export interface FunctionAssistant extends AssistantBase {
|
|
278
|
-
type: 'function';
|
|
279
|
-
prepareExecutes?: ExecuteBlock[];
|
|
280
|
-
code?: string;
|
|
281
|
-
}
|
|
282
|
-
export interface DatastoreParameter {
|
|
283
|
-
variableFrom?: 'datastore';
|
|
284
|
-
variable?: {
|
|
285
|
-
key: string;
|
|
286
|
-
scope: string;
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
export interface AgentParameter {
|
|
290
|
-
variableFrom?: 'tool';
|
|
291
|
-
agent?: Tool;
|
|
292
|
-
}
|
|
293
|
-
export interface KnowledgeParameter {
|
|
294
|
-
variableFrom?: 'knowledge';
|
|
295
|
-
knowledge?: Tool;
|
|
296
|
-
}
|
|
297
|
-
export interface HistoryParameter {
|
|
298
|
-
variableFrom?: 'history';
|
|
299
|
-
chatHistory?: {
|
|
300
|
-
limit?: number;
|
|
301
|
-
keyword?: string;
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
export interface APIParameter {
|
|
305
|
-
variableFrom?: 'blockletAPI';
|
|
306
|
-
api?: Tool;
|
|
307
|
-
}
|
|
308
|
-
export interface SecretParameter {
|
|
309
|
-
variableFrom?: 'secret';
|
|
310
|
-
}
|
|
311
|
-
export type Parameter = StringParameter | NumberParameter | SelectParameter | LanguageParameter | BooleanParameter | SourceParameter | LLMInputMessagesParameter | LLMInputToolsParameter | LLMInputToolChoiceParameter | LLMInputResponseFormatParameter | ImageParameter | VerifyVCParameter;
|
|
312
|
-
export interface ParameterBase {
|
|
313
|
-
id: string;
|
|
314
|
-
key?: string;
|
|
315
|
-
label?: string;
|
|
316
|
-
docLink?: string;
|
|
317
|
-
placeholder?: string;
|
|
318
|
-
helper?: string;
|
|
319
|
-
required?: boolean;
|
|
320
|
-
from?: 'editor' | 'agentParameter' | 'knowledgeParameter' | 'blockletAPIParameter' | 'imageBlenderParameter';
|
|
321
|
-
hidden?: boolean;
|
|
322
|
-
}
|
|
323
|
-
export declare function isUserInputParameter(parameter: Parameter): parameter is Exclude<Parameter, SourceParameter>;
|
|
324
|
-
export interface LLMInputMessagesParameter extends ParameterBase {
|
|
325
|
-
type: 'llmInputMessages';
|
|
326
|
-
defaultValue?: any;
|
|
327
|
-
}
|
|
328
|
-
export interface LLMInputToolsParameter extends ParameterBase {
|
|
329
|
-
type: 'llmInputTools';
|
|
330
|
-
defaultValue?: any;
|
|
331
|
-
}
|
|
332
|
-
export interface LLMInputToolChoiceParameter extends ParameterBase {
|
|
333
|
-
type: 'llmInputToolChoice';
|
|
334
|
-
defaultValue?: any;
|
|
335
|
-
}
|
|
336
|
-
export interface LLMInputResponseFormatParameter extends ParameterBase {
|
|
337
|
-
type: 'llmInputResponseFormat';
|
|
338
|
-
defaultValue?: any;
|
|
339
|
-
}
|
|
340
|
-
export interface SourceParameter extends ParameterBase {
|
|
341
|
-
type: 'source';
|
|
342
|
-
defaultValue?: string;
|
|
343
|
-
source?: DatastoreParameter | AgentParameter | KnowledgeParameter | HistoryParameter | APIParameter | SecretParameter;
|
|
344
|
-
}
|
|
345
|
-
export interface StringParameter extends ParameterBase {
|
|
346
|
-
type?: 'string';
|
|
347
|
-
value?: string;
|
|
348
|
-
defaultValue?: string;
|
|
349
|
-
multiline?: boolean;
|
|
350
|
-
minLength?: number;
|
|
351
|
-
maxLength?: number;
|
|
352
|
-
}
|
|
353
|
-
export interface VerifyVCParameter extends ParameterBase {
|
|
354
|
-
type?: 'verify_vc';
|
|
355
|
-
value?: any;
|
|
356
|
-
defaultValue?: any;
|
|
357
|
-
vcItem?: string[];
|
|
358
|
-
vcTrustedIssuers?: string[];
|
|
359
|
-
buttonTitle?: string;
|
|
360
|
-
buttonTitleVerified?: string;
|
|
361
|
-
alertTitleVerified?: string;
|
|
362
|
-
}
|
|
363
|
-
export interface BooleanParameter extends ParameterBase {
|
|
364
|
-
type: 'boolean';
|
|
365
|
-
value?: boolean;
|
|
366
|
-
defaultValue?: boolean;
|
|
367
|
-
}
|
|
368
|
-
export interface NumberParameter extends ParameterBase {
|
|
369
|
-
type: 'number';
|
|
370
|
-
value?: number;
|
|
371
|
-
defaultValue?: number;
|
|
372
|
-
min?: number;
|
|
373
|
-
max?: number;
|
|
374
|
-
}
|
|
375
|
-
export interface SelectParameter extends ParameterBase {
|
|
376
|
-
type: 'select';
|
|
377
|
-
value?: string | string[];
|
|
378
|
-
defaultValue?: string | string[];
|
|
379
|
-
multiple?: boolean;
|
|
380
|
-
style?: 'dropdown' | 'checkbox';
|
|
381
|
-
options?: {
|
|
382
|
-
id: string;
|
|
383
|
-
label: string;
|
|
384
|
-
value: string;
|
|
385
|
-
}[];
|
|
386
|
-
}
|
|
387
|
-
export interface LanguageParameter extends ParameterBase {
|
|
388
|
-
type: 'language';
|
|
389
|
-
value?: string;
|
|
390
|
-
defaultValue?: string;
|
|
391
|
-
}
|
|
392
|
-
export interface ImageParameter extends ParameterBase {
|
|
393
|
-
type: 'image';
|
|
394
|
-
value?: string | string[];
|
|
395
|
-
multiple?: boolean;
|
|
396
|
-
defaultValue?: string | string[];
|
|
397
|
-
}
|
|
398
|
-
export interface User {
|
|
399
|
-
id: string;
|
|
400
|
-
did: string;
|
|
401
|
-
role?: string;
|
|
402
|
-
fullName?: string;
|
|
403
|
-
provider?: string;
|
|
404
|
-
walletOS?: string;
|
|
405
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
export interface ModelInfoBase {
|
|
2
|
-
brand: string;
|
|
3
|
-
model: string;
|
|
4
|
-
name?: string;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface TextModelInfo extends ModelInfoBase {
|
|
8
|
-
temperatureMin?: number;
|
|
9
|
-
temperatureMax?: number;
|
|
10
|
-
temperatureDefault?: number;
|
|
11
|
-
topPMin?: number;
|
|
12
|
-
topPMax?: number;
|
|
13
|
-
topPDefault?: number;
|
|
14
|
-
presencePenaltyMin?: number;
|
|
15
|
-
presencePenaltyMax?: number;
|
|
16
|
-
presencePenaltyDefault?: number;
|
|
17
|
-
frequencyPenaltyMin?: number;
|
|
18
|
-
frequencyPenaltyMax?: number;
|
|
19
|
-
frequencyPenaltyDefault?: number;
|
|
20
|
-
maxTokensMin?: number;
|
|
21
|
-
maxTokensMax?: number;
|
|
22
|
-
maxTokensDefault?: number;
|
|
23
|
-
}
|
|
24
|
-
export type ServiceMode = 'single' | 'multiple';
|
|
25
|
-
export type ServiceModePermissionMap = {
|
|
26
|
-
ensureViewAllProjectsRoles: string[] | undefined;
|
|
27
|
-
ensurePromptsEditorRoles: string[] | undefined;
|
|
28
|
-
ensurePromptsAdminRoles: string[] | undefined;
|
|
29
|
-
};
|
|
30
|
-
export interface ImageModelInfo extends ModelInfoBase {
|
|
31
|
-
brand: string;
|
|
32
|
-
model: string;
|
|
33
|
-
nMin?: number;
|
|
34
|
-
nMax?: number;
|
|
35
|
-
nDefault?: number;
|
|
36
|
-
disabled?: boolean;
|
|
37
|
-
quality?: string[];
|
|
38
|
-
qualityDefault?: 'standard' | 'hd';
|
|
39
|
-
responseFormat?: string[];
|
|
40
|
-
responseFormatDefault?: 'url' | 'b64_json';
|
|
41
|
-
size?: string[];
|
|
42
|
-
sizeDefault?: '256x256' | '512x512' | '1024x1024' | '1024x1792' | '1792x1024';
|
|
43
|
-
style?: string[];
|
|
44
|
-
styleDefault?: 'vivid' | 'natural';
|
|
45
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Assistant, ConfigFile, CronFile, MemoryFile } from '../assistant';
|
|
2
|
-
import { ProjectSettings } from './project';
|
|
3
|
-
export * from './project';
|
|
4
|
-
export type ResourceType = 'application' | 'tool' | 'llm-adapter' | 'aigc-adapter' | 'knowledge' | 'template' | 'example';
|
|
5
|
-
export declare const ResourceTypes: ResourceType[];
|
|
6
|
-
export interface ResourceProject {
|
|
7
|
-
project: ProjectSettings;
|
|
8
|
-
agents: (Assistant & {
|
|
9
|
-
public?: boolean;
|
|
10
|
-
parent: string[];
|
|
11
|
-
})[];
|
|
12
|
-
config: ConfigFile;
|
|
13
|
-
cron: CronFile;
|
|
14
|
-
memory: MemoryFile;
|
|
15
|
-
dir?: string;
|
|
16
|
-
}
|
|
17
|
-
export declare function validateResourceProject(value: any): Promise<ResourceProject>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import Joi from 'joi';
|
|
2
|
-
export type ProjectSettings = {
|
|
3
|
-
id: string;
|
|
4
|
-
name?: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
createdAt?: string;
|
|
7
|
-
updatedAt?: string;
|
|
8
|
-
createdBy?: string;
|
|
9
|
-
updatedBy?: string;
|
|
10
|
-
model?: string;
|
|
11
|
-
temperature?: number;
|
|
12
|
-
topP?: number;
|
|
13
|
-
presencePenalty?: number;
|
|
14
|
-
frequencyPenalty?: number;
|
|
15
|
-
maxTokens?: number;
|
|
16
|
-
appearance?: {
|
|
17
|
-
primaryColor?: string;
|
|
18
|
-
secondaryColor?: string;
|
|
19
|
-
typography?: {
|
|
20
|
-
fontFamily?: string;
|
|
21
|
-
heading?: {
|
|
22
|
-
fontFamily?: string;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
aigneBannerVisible?: boolean;
|
|
26
|
-
};
|
|
27
|
-
iconVersion?: string;
|
|
28
|
-
readme?: string;
|
|
29
|
-
executor?: AgentExecutor;
|
|
30
|
-
};
|
|
31
|
-
export declare const projectSettingsSchema: Joi.ObjectSchema<ProjectSettings>;
|
|
32
|
-
export interface AgentExecutor {
|
|
33
|
-
agent?: {
|
|
34
|
-
blockletDid?: string;
|
|
35
|
-
projectId?: string;
|
|
36
|
-
id: string;
|
|
37
|
-
};
|
|
38
|
-
inputValues?: {
|
|
39
|
-
[key: string]: any;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { OutputVariable, Parameter } from '../assistant';
|
|
2
|
-
import { ProjectSettings } from '../resource';
|
|
3
|
-
export interface Agent {
|
|
4
|
-
id: string;
|
|
5
|
-
name?: string;
|
|
6
|
-
description?: string;
|
|
7
|
-
parameters?: Parameter[];
|
|
8
|
-
outputVariables?: OutputVariable[];
|
|
9
|
-
createdBy?: string;
|
|
10
|
-
type?: string;
|
|
11
|
-
identity: {
|
|
12
|
-
blockletDid?: string;
|
|
13
|
-
projectId: string;
|
|
14
|
-
projectRef?: string;
|
|
15
|
-
agentId: string;
|
|
16
|
-
aid: string;
|
|
17
|
-
working?: boolean;
|
|
18
|
-
};
|
|
19
|
-
project: ProjectSettings;
|
|
20
|
-
access?: {
|
|
21
|
-
noLoginRequired?: boolean;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export interface AgentWithConfig extends Agent {
|
|
25
|
-
config: {
|
|
26
|
-
secrets: {
|
|
27
|
-
targetProjectId: string;
|
|
28
|
-
targetAgentId: string;
|
|
29
|
-
targetInput: Parameter;
|
|
30
|
-
hasValue: boolean;
|
|
31
|
-
}[];
|
|
32
|
-
};
|
|
33
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare enum RuntimeErrorType {
|
|
2
|
-
MissingSecretError = "MissingSecretError",
|
|
3
|
-
RequestExceededError = "RequestExceededError",
|
|
4
|
-
ProjectOwnerRequestExceededError = "ProjectOwnerRequestExceededError",
|
|
5
|
-
ProjectLimitExceededError = "ProjectLimitExceededError"
|
|
6
|
-
}
|
|
7
|
-
export declare class RuntimeError extends Error {
|
|
8
|
-
type: RuntimeErrorType;
|
|
9
|
-
constructor(type: RuntimeErrorType, message?: string);
|
|
10
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { SubscriptionError } from '@blocklet/ai-kit/api';
|
|
2
|
-
import { ChatCompletionInput } from '@blocklet/ai-kit/api/types/chat';
|
|
3
|
-
import type { ExecuteBlock } from '../assistant';
|
|
4
|
-
import { RuntimeOutputVariablesSchema } from './schema';
|
|
5
|
-
export * from './schema';
|
|
6
|
-
export * from './error';
|
|
7
|
-
export declare enum ExecutionPhase {
|
|
8
|
-
EXECUTE_BLOCK_START = "EXECUTE_BLOCK_START",
|
|
9
|
-
EXECUTE_SELECT_STOP = "EXECUTE_SELECT_STOP",
|
|
10
|
-
EXECUTE_ASSISTANT_START = "EXECUTE_ASSISTANT_START",
|
|
11
|
-
EXECUTE_ASSISTANT_RUNNING = "EXECUTE_BLOCK_RUNNING",
|
|
12
|
-
EXECUTE_ASSISTANT_END = "EXECUTE_ASSISTANT_END"
|
|
13
|
-
}
|
|
14
|
-
export declare enum AssistantResponseType {
|
|
15
|
-
ERROR = "ERROR",
|
|
16
|
-
LOG = "LOG",
|
|
17
|
-
INPUT = "INPUT",
|
|
18
|
-
CHUNK = "CHUNK",
|
|
19
|
-
USAGE = "USAGE",
|
|
20
|
-
EXECUTE = "EXECUTE",
|
|
21
|
-
INPUT_PARAMETER = "INPUT_PARAMETER"
|
|
22
|
-
}
|
|
23
|
-
export type RunAssistantResponse = {
|
|
24
|
-
messageId: string;
|
|
25
|
-
sessionId: string;
|
|
26
|
-
} & (RunAssistantChunk | RunAssistantUsage | RunAssistantError | RunAssistantInput | RunAssistantLog | RunAssistantExecute | RunAssistantInputParameter);
|
|
27
|
-
export type RunAssistantInputParameter = {
|
|
28
|
-
type: AssistantResponseType.INPUT_PARAMETER;
|
|
29
|
-
taskId: string;
|
|
30
|
-
assistantId: string;
|
|
31
|
-
delta: {
|
|
32
|
-
content?: string | null;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
export type RunAssistantInput = {
|
|
36
|
-
type: AssistantResponseType.INPUT;
|
|
37
|
-
taskId: string;
|
|
38
|
-
parentTaskId?: string;
|
|
39
|
-
assistantId: string;
|
|
40
|
-
assistantName?: string;
|
|
41
|
-
inputParameters?: {
|
|
42
|
-
[key: string]: any;
|
|
43
|
-
};
|
|
44
|
-
apiArgs?: any;
|
|
45
|
-
fnArgs?: any;
|
|
46
|
-
promptMessages?: ChatCompletionInput['messages'];
|
|
47
|
-
modelParameters?: {
|
|
48
|
-
temperature?: number;
|
|
49
|
-
topP?: number;
|
|
50
|
-
presencePenalty?: number;
|
|
51
|
-
frequencyPenalty?: number;
|
|
52
|
-
model?: string;
|
|
53
|
-
n?: number;
|
|
54
|
-
quality?: string;
|
|
55
|
-
style?: string;
|
|
56
|
-
size?: string;
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
export type RunAssistantExecute = {
|
|
60
|
-
type: AssistantResponseType.EXECUTE;
|
|
61
|
-
taskId: string;
|
|
62
|
-
parentTaskId?: string;
|
|
63
|
-
assistantId: string;
|
|
64
|
-
assistantName?: string;
|
|
65
|
-
execution: {
|
|
66
|
-
currentPhase: ExecutionPhase.EXECUTE_BLOCK_START;
|
|
67
|
-
blockId: string;
|
|
68
|
-
blockName?: string;
|
|
69
|
-
} | {
|
|
70
|
-
currentPhase: ExecutionPhase.EXECUTE_ASSISTANT_START;
|
|
71
|
-
} | {
|
|
72
|
-
currentPhase: ExecutionPhase.EXECUTE_SELECT_STOP;
|
|
73
|
-
} | {
|
|
74
|
-
currentPhase: ExecutionPhase.EXECUTE_ASSISTANT_END;
|
|
75
|
-
} | {
|
|
76
|
-
currentPhase: ExecutionPhase.EXECUTE_ASSISTANT_RUNNING;
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
export type RunAssistantLog = {
|
|
80
|
-
type: AssistantResponseType.LOG;
|
|
81
|
-
taskId: string;
|
|
82
|
-
assistantId: string;
|
|
83
|
-
log: string;
|
|
84
|
-
timestamp: number;
|
|
85
|
-
};
|
|
86
|
-
export type RunAssistantChunk = {
|
|
87
|
-
type: AssistantResponseType.CHUNK;
|
|
88
|
-
taskId: string;
|
|
89
|
-
assistantId: string;
|
|
90
|
-
sessionId: string;
|
|
91
|
-
respondAs?: ExecuteBlock['respondAs'];
|
|
92
|
-
delta: {
|
|
93
|
-
content?: string | null;
|
|
94
|
-
images?: {
|
|
95
|
-
url: string;
|
|
96
|
-
}[];
|
|
97
|
-
object?: RuntimeOutputVariablesSchema | object;
|
|
98
|
-
};
|
|
99
|
-
messageId: string;
|
|
100
|
-
};
|
|
101
|
-
export type RunAssistantUsage = {
|
|
102
|
-
type: AssistantResponseType.USAGE;
|
|
103
|
-
taskId: string;
|
|
104
|
-
assistantId: string;
|
|
105
|
-
usage: {
|
|
106
|
-
promptTokens: number;
|
|
107
|
-
completionTokens: number;
|
|
108
|
-
totalTokens: number;
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
export type RunAssistantError = {
|
|
112
|
-
type: AssistantResponseType.ERROR;
|
|
113
|
-
error: {
|
|
114
|
-
message: string;
|
|
115
|
-
} | SubscriptionError;
|
|
116
|
-
};
|