@aigne/core 0.0.1
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/assistant/generate-output.js +101 -0
- package/lib/cjs/assistant/select-agent.js +76 -0
- package/lib/cjs/assistant/type.js +11 -0
- package/lib/cjs/common/aid.js +42 -0
- package/lib/cjs/common/index.js +238 -0
- package/lib/cjs/common/resource-manager.js +199 -0
- package/lib/cjs/constants.js +9 -0
- package/lib/cjs/executor/agent.js +10 -0
- package/lib/cjs/executor/aigc.js +28 -0
- package/lib/cjs/executor/api.js +64 -0
- package/lib/cjs/executor/base.js +676 -0
- package/lib/cjs/executor/blocklet.js +25 -0
- package/lib/cjs/executor/call-agent.js +105 -0
- package/lib/cjs/executor/decision.js +478 -0
- package/lib/cjs/executor/image-blender.js +32 -0
- package/lib/cjs/executor/index.js +81 -0
- package/lib/cjs/executor/llm.js +379 -0
- package/lib/cjs/executor/logic.js +167 -0
- package/lib/cjs/index.js +17 -0
- package/lib/cjs/libs/blocklet/vc.js +92 -0
- package/lib/cjs/libs/openapi/request/index.js +24 -0
- package/lib/cjs/libs/openapi/request/util.js +146 -0
- package/lib/cjs/libs/openapi/types/index.js +17 -0
- package/lib/cjs/libs/openapi/util/call.js +15 -0
- package/lib/cjs/libs/openapi/util/check-schema.js +67 -0
- package/lib/cjs/libs/openapi/util/convert-schema.js +44 -0
- package/lib/cjs/libs/openapi/util/flatten-open-api.js +21 -0
- package/lib/cjs/libs/openapi/util/get-open-api-i18n-text.js +7 -0
- package/lib/cjs/logger.js +4 -0
- package/lib/cjs/runtime/resource-blocklet.js +5 -0
- package/lib/cjs/runtime/runtime.js +143 -0
- package/lib/cjs/types/assistant/index.js +31 -0
- package/lib/cjs/types/assistant/mustache/ReadableMustache.js +69 -0
- package/lib/cjs/types/assistant/mustache/directive.js +35 -0
- package/lib/cjs/types/assistant/mustache/mustache.js +688 -0
- package/lib/cjs/types/common/index.js +2 -0
- package/lib/cjs/types/index.js +20 -0
- package/lib/cjs/types/resource/index.js +47 -0
- package/lib/cjs/types/resource/project.js +35 -0
- package/lib/cjs/types/runtime/agent.js +2 -0
- package/lib/cjs/types/runtime/error.js +18 -0
- package/lib/cjs/types/runtime/index.js +37 -0
- package/lib/cjs/types/runtime/runtime-resource-blocklet-state.js +4 -0
- package/lib/cjs/types/runtime/schema.js +259 -0
- package/lib/cjs/utils/cron-job.js +48 -0
- package/lib/cjs/utils/extract-metadata-transform.js +58 -0
- package/lib/cjs/utils/extract-metadata-transform.test.js +61 -0
- package/lib/cjs/utils/fs.js +49 -0
- package/lib/cjs/utils/get-blocklet-agent.js +351 -0
- package/lib/cjs/utils/geti.js +37 -0
- package/lib/cjs/utils/is-non-nullable.js +20 -0
- package/lib/cjs/utils/render-message.js +23 -0
- package/lib/cjs/utils/resolve-secret-inputs.js +49 -0
- package/lib/cjs/utils/retry.js +19 -0
- package/lib/cjs/utils/task-id.js +7 -0
- package/lib/cjs/utils/tool-calls-transform.js +18 -0
- package/lib/esm/assistant/generate-output.js +91 -0
- package/lib/esm/assistant/select-agent.js +71 -0
- package/lib/esm/assistant/type.js +7 -0
- package/lib/esm/common/aid.js +38 -0
- package/lib/esm/common/index.js +232 -0
- package/lib/esm/common/resource-manager.js +192 -0
- package/lib/esm/constants.js +6 -0
- package/lib/esm/executor/agent.js +6 -0
- package/lib/esm/executor/aigc.js +24 -0
- package/lib/esm/executor/api.js +34 -0
- package/lib/esm/executor/base.js +668 -0
- package/lib/esm/executor/blocklet.js +21 -0
- package/lib/esm/executor/call-agent.js +98 -0
- package/lib/esm/executor/decision.js +471 -0
- package/lib/esm/executor/image-blender.js +25 -0
- package/lib/esm/executor/index.js +74 -0
- package/lib/esm/executor/llm.js +372 -0
- package/lib/esm/executor/logic.js +160 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/libs/blocklet/vc.js +85 -0
- package/lib/esm/libs/openapi/request/index.js +20 -0
- package/lib/esm/libs/openapi/request/util.js +136 -0
- package/lib/esm/libs/openapi/types/index.js +1 -0
- package/lib/esm/libs/openapi/util/call.js +8 -0
- package/lib/esm/libs/openapi/util/check-schema.js +62 -0
- package/lib/esm/libs/openapi/util/convert-schema.js +42 -0
- package/lib/esm/libs/openapi/util/flatten-open-api.js +19 -0
- package/lib/esm/libs/openapi/util/get-open-api-i18n-text.js +5 -0
- package/lib/esm/logger.js +2 -0
- package/lib/esm/runtime/resource-blocklet.js +2 -0
- package/lib/esm/runtime/runtime.js +136 -0
- package/lib/esm/types/assistant/index.js +9 -0
- package/lib/esm/types/assistant/mustache/ReadableMustache.js +63 -0
- package/lib/esm/types/assistant/mustache/directive.js +29 -0
- package/lib/esm/types/assistant/mustache/mustache.js +686 -0
- package/lib/esm/types/common/index.js +1 -0
- package/lib/esm/types/index.js +4 -0
- package/lib/esm/types/resource/index.js +26 -0
- package/lib/esm/types/resource/project.js +29 -0
- package/lib/esm/types/runtime/agent.js +1 -0
- package/lib/esm/types/runtime/error.js +14 -0
- package/lib/esm/types/runtime/index.js +20 -0
- package/lib/esm/types/runtime/runtime-resource-blocklet-state.js +1 -0
- package/lib/esm/types/runtime/schema.js +249 -0
- package/lib/esm/utils/cron-job.js +44 -0
- package/lib/esm/utils/extract-metadata-transform.js +54 -0
- package/lib/esm/utils/extract-metadata-transform.test.js +59 -0
- package/lib/esm/utils/fs.js +41 -0
- package/lib/esm/utils/get-blocklet-agent.js +344 -0
- package/lib/esm/utils/geti.js +30 -0
- package/lib/esm/utils/is-non-nullable.js +13 -0
- package/lib/esm/utils/render-message.js +20 -0
- package/lib/esm/utils/resolve-secret-inputs.js +46 -0
- package/lib/esm/utils/retry.js +16 -0
- package/lib/esm/utils/task-id.js +3 -0
- package/lib/esm/utils/tool-calls-transform.js +15 -0
- package/lib/types/assistant/generate-output.d.ts +29 -0
- package/lib/types/assistant/select-agent.d.ts +14 -0
- package/lib/types/assistant/type.d.ts +61 -0
- package/lib/types/common/aid.d.ts +18 -0
- package/lib/types/common/index.d.ts +7 -0
- package/lib/types/common/resource-manager.d.ts +88 -0
- package/lib/types/constants.d.ts +6 -0
- package/lib/types/executor/agent.d.ts +5 -0
- package/lib/types/executor/aigc.d.ts +9 -0
- package/lib/types/executor/api.d.ts +9 -0
- package/lib/types/executor/base.d.ts +209 -0
- package/lib/types/executor/blocklet.d.ts +9 -0
- package/lib/types/executor/call-agent.d.ts +12 -0
- package/lib/types/executor/decision.d.ts +20 -0
- package/lib/types/executor/image-blender.d.ts +9 -0
- package/lib/types/executor/index.d.ts +8 -0
- package/lib/types/executor/llm.d.ts +38 -0
- package/lib/types/executor/logic.d.ts +9 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/libs/blocklet/vc.d.ts +17 -0
- package/lib/types/libs/openapi/request/index.d.ts +17 -0
- package/lib/types/libs/openapi/request/util.d.ts +40 -0
- package/lib/types/libs/openapi/types/index.d.ts +20 -0
- package/lib/types/libs/openapi/util/call.d.ts +2 -0
- package/lib/types/libs/openapi/util/check-schema.d.ts +3 -0
- package/lib/types/libs/openapi/util/convert-schema.d.ts +8 -0
- package/lib/types/libs/openapi/util/flatten-open-api.d.ts +3 -0
- package/lib/types/libs/openapi/util/get-open-api-i18n-text.d.ts +2 -0
- package/lib/types/logger.d.ts +2 -0
- package/lib/types/runtime/resource-blocklet.d.ts +2 -0
- package/lib/types/runtime/runtime.d.ts +20 -0
- package/lib/types/types/assistant/index.d.ts +405 -0
- package/lib/types/types/assistant/mustache/ReadableMustache.d.ts +2 -0
- package/lib/types/types/assistant/mustache/directive.d.ts +6 -0
- package/lib/types/types/assistant/mustache/mustache.d.ts +2 -0
- package/lib/types/types/common/index.d.ts +45 -0
- package/lib/types/types/index.d.ts +4 -0
- package/lib/types/types/resource/index.d.ts +17 -0
- package/lib/types/types/resource/project.d.ts +41 -0
- package/lib/types/types/runtime/agent.d.ts +33 -0
- package/lib/types/types/runtime/error.d.ts +10 -0
- package/lib/types/types/runtime/index.d.ts +116 -0
- package/lib/types/types/runtime/runtime-resource-blocklet-state.d.ts +5 -0
- package/lib/types/types/runtime/schema.d.ts +110 -0
- package/lib/types/utils/cron-job.d.ts +22 -0
- package/lib/types/utils/extract-metadata-transform.d.ts +16 -0
- package/lib/types/utils/extract-metadata-transform.test.d.ts +1 -0
- package/lib/types/utils/fs.d.ts +9 -0
- package/lib/types/utils/get-blocklet-agent.d.ts +219 -0
- package/lib/types/utils/geti.d.ts +1 -0
- package/lib/types/utils/is-non-nullable.d.ts +2 -0
- package/lib/types/utils/render-message.d.ts +6 -0
- package/lib/types/utils/resolve-secret-inputs.d.ts +11 -0
- package/lib/types/utils/retry.d.ts +1 -0
- package/lib/types/utils/task-id.d.ts +1 -0
- package/lib/types/utils/tool-calls-transform.d.ts +2 -0
- package/package.json +67 -0
- package/tsconfig.json +12 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Assistant, ResourceProject, ResourceType } from '../types';
|
|
2
|
+
export type ResourceProjectItem = ResourceProject & {
|
|
3
|
+
blocklet: {
|
|
4
|
+
did: string;
|
|
5
|
+
};
|
|
6
|
+
dir: string;
|
|
7
|
+
agentMap: {
|
|
8
|
+
[agentId: string]: Assistant;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export type ResourceBlockletItem = {
|
|
12
|
+
did: string;
|
|
13
|
+
status?: number;
|
|
14
|
+
projectMap: {
|
|
15
|
+
[projectId: string]: ResourceProjectItem;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export interface ResourceKnowledge {
|
|
19
|
+
knowledge: any & {
|
|
20
|
+
public?: boolean;
|
|
21
|
+
};
|
|
22
|
+
blockletDid: string;
|
|
23
|
+
documents: any[];
|
|
24
|
+
contents: any[];
|
|
25
|
+
segments: any[];
|
|
26
|
+
vectorsPath: string;
|
|
27
|
+
uploadPath: string;
|
|
28
|
+
sourcesPath: string;
|
|
29
|
+
processedPath: string;
|
|
30
|
+
logoPath: string;
|
|
31
|
+
title: string;
|
|
32
|
+
did: string;
|
|
33
|
+
}
|
|
34
|
+
export interface Resources {
|
|
35
|
+
knowledge: {
|
|
36
|
+
knowledgeList: ResourceKnowledge[];
|
|
37
|
+
blockletMap: {
|
|
38
|
+
[blockletDid: string]: {
|
|
39
|
+
knowledgeMap: {
|
|
40
|
+
[knowledgeId: string]: ResourceKnowledge;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
agents: {
|
|
46
|
+
[type: string]: {
|
|
47
|
+
projects: ResourceProjectItem[];
|
|
48
|
+
blockletMap: {
|
|
49
|
+
[blockletDid: string]: ResourceBlockletItem;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export declare class ResourceManager {
|
|
55
|
+
constructor({ wait, watch }?: {
|
|
56
|
+
wait?: number;
|
|
57
|
+
watch?: boolean;
|
|
58
|
+
});
|
|
59
|
+
private promise?;
|
|
60
|
+
get resources(): Promise<Resources>;
|
|
61
|
+
reload(): Promise<Resources>;
|
|
62
|
+
getProjects({ blockletDid, type }: {
|
|
63
|
+
blockletDid?: string;
|
|
64
|
+
type: ResourceType;
|
|
65
|
+
}): Promise<ResourceProjectItem[]>;
|
|
66
|
+
getProject({ blockletDid, projectId, type, }: {
|
|
67
|
+
blockletDid: string;
|
|
68
|
+
projectId: string;
|
|
69
|
+
type?: ResourceType | ResourceType[];
|
|
70
|
+
}): Promise<ResourceProjectItem | undefined>;
|
|
71
|
+
getAgent({ blockletDid, projectId, agentId, type, }: {
|
|
72
|
+
blockletDid: string;
|
|
73
|
+
projectId: string;
|
|
74
|
+
agentId: string;
|
|
75
|
+
type?: ResourceType | ResourceType[];
|
|
76
|
+
}): Promise<{
|
|
77
|
+
agent: Assistant;
|
|
78
|
+
project: import("../types").ProjectSettings;
|
|
79
|
+
blocklet: {
|
|
80
|
+
did: string;
|
|
81
|
+
};
|
|
82
|
+
} | undefined>;
|
|
83
|
+
getKnowledgeList(): Promise<ResourceKnowledge[]>;
|
|
84
|
+
getKnowledge({ blockletDid, knowledgeId }: {
|
|
85
|
+
blockletDid: string;
|
|
86
|
+
knowledgeId: string;
|
|
87
|
+
}): Promise<ResourceKnowledge>;
|
|
88
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const AIGNE_RUNTIME_COMPONENT_DID = "z2qaBP9SahqU2L2YA3ip7NecwKACMByTFuiJ2";
|
|
2
|
+
export declare const AIGNE_COMPONENTS_COMPONENT_DID = "z2qa6fvjmjew4pWJyTsKaWFuNoMUMyXDh5A1D";
|
|
3
|
+
export declare const AIGNE_RUNTIME_CUSTOM_COMPONENT_ID = "grc9q1cveub6pnl8";
|
|
4
|
+
export declare const AIGNE_STUDIO_COMPONENT_DID = "z8iZpog7mcgcgBZzTiXJCWESvmnRrQmnd3XBB";
|
|
5
|
+
export declare const NFT_BLENDER_COMPONENT_DID = "z8ia1ieY5KhEC4LMRETzS5nUwD7PvAND8qkfX";
|
|
6
|
+
export declare const AIGNE_ISSUE_VC_PREFIX = "AIGNE";
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { CallAI, CallAIImage, GetAgent, GetAgentResult, RunAssistantCallback } from '../assistant/type';
|
|
2
|
+
import { issueVC } from '../libs/blocklet/vc';
|
|
3
|
+
import type { DatasetObject } from '../libs/openapi/types';
|
|
4
|
+
import { ProjectSettings, Variable, VariableScope } from '../types';
|
|
5
|
+
import { renderMessage } from '../utils/render-message';
|
|
6
|
+
export declare class ExecutorContext {
|
|
7
|
+
constructor(options: Pick<ExecutorContext, 'entry' | 'getAgent' | 'callAI' | 'callAIImage' | 'callback' | 'getMemoryVariables' | 'user' | 'sessionId' | 'messageId' | 'clientTime' | 'executor' | 'entryProjectId' | 'queryCache' | 'setCache'>);
|
|
8
|
+
entry: {
|
|
9
|
+
blockletDid?: string;
|
|
10
|
+
project: ProjectSettings;
|
|
11
|
+
working?: boolean;
|
|
12
|
+
appUrl?: string;
|
|
13
|
+
};
|
|
14
|
+
getAgent: GetAgent;
|
|
15
|
+
callAI: CallAI;
|
|
16
|
+
callAIImage: CallAIImage;
|
|
17
|
+
queryCache: (options: {
|
|
18
|
+
aid: string;
|
|
19
|
+
cacheKey: string;
|
|
20
|
+
}) => Promise<{
|
|
21
|
+
inputs: {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
};
|
|
24
|
+
outputs: {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
};
|
|
27
|
+
} | null>;
|
|
28
|
+
setCache: (options: {
|
|
29
|
+
aid: string;
|
|
30
|
+
cacheKey: string;
|
|
31
|
+
inputs: {
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
};
|
|
34
|
+
outputs: {
|
|
35
|
+
objects: any[];
|
|
36
|
+
};
|
|
37
|
+
}) => Promise<any>;
|
|
38
|
+
callback: RunAssistantCallback;
|
|
39
|
+
sessionId: string;
|
|
40
|
+
messageId: string;
|
|
41
|
+
clientTime: string;
|
|
42
|
+
promise?: Promise<{
|
|
43
|
+
agents: (GetAgentResult & {
|
|
44
|
+
openApi: DatasetObject;
|
|
45
|
+
})[];
|
|
46
|
+
agentsMap: {
|
|
47
|
+
[key: string]: GetAgentResult & {
|
|
48
|
+
openApi: DatasetObject;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
openApis: DatasetObject[];
|
|
52
|
+
}>;
|
|
53
|
+
entryProjectId: string;
|
|
54
|
+
user?: {
|
|
55
|
+
id: string;
|
|
56
|
+
did: string;
|
|
57
|
+
role?: string;
|
|
58
|
+
fullName?: string;
|
|
59
|
+
provider?: string;
|
|
60
|
+
walletOS?: string;
|
|
61
|
+
isAdmin?: boolean;
|
|
62
|
+
};
|
|
63
|
+
getMemoryVariables: (options: {
|
|
64
|
+
blockletDid?: string;
|
|
65
|
+
projectId: string;
|
|
66
|
+
projectRef?: string;
|
|
67
|
+
working?: boolean;
|
|
68
|
+
}) => Promise<Variable[]>;
|
|
69
|
+
maxRetries: number;
|
|
70
|
+
executor: <T extends GetAgentResult>(agent: T, options: AgentExecutorOptions) => AgentExecutorBase<T>;
|
|
71
|
+
execute<T extends GetAgentResult>(agent: T, options: AgentExecutorOptions): Promise<any>;
|
|
72
|
+
copy(options: Partial<ExecutorContext>): ExecutorContext;
|
|
73
|
+
getBlockletAgent(agentId: string): Promise<{
|
|
74
|
+
agent: GetAgentResult & {
|
|
75
|
+
openApi: DatasetObject;
|
|
76
|
+
};
|
|
77
|
+
openApis: DatasetObject[];
|
|
78
|
+
}>;
|
|
79
|
+
}
|
|
80
|
+
export interface AgentExecutorOptions {
|
|
81
|
+
inputs?: {
|
|
82
|
+
[key: string]: any;
|
|
83
|
+
};
|
|
84
|
+
taskId: string;
|
|
85
|
+
parentTaskId?: string;
|
|
86
|
+
variables?: {
|
|
87
|
+
[key: string]: any;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export declare abstract class AgentExecutorBase<T> {
|
|
91
|
+
readonly context: ExecutorContext;
|
|
92
|
+
readonly agent: GetAgentResult & T;
|
|
93
|
+
readonly options: AgentExecutorOptions;
|
|
94
|
+
constructor(context: ExecutorContext, agent: GetAgentResult & T, options: AgentExecutorOptions);
|
|
95
|
+
abstract process(options: {
|
|
96
|
+
inputs: {
|
|
97
|
+
[key: string]: any;
|
|
98
|
+
};
|
|
99
|
+
}): Promise<any>;
|
|
100
|
+
execute(): Promise<any>;
|
|
101
|
+
private _finalInputs;
|
|
102
|
+
private get finalInputs();
|
|
103
|
+
private set finalInputs(value);
|
|
104
|
+
private cacheKey;
|
|
105
|
+
get globalContext(): {
|
|
106
|
+
$sys: {
|
|
107
|
+
sessionId: string;
|
|
108
|
+
messageId: string;
|
|
109
|
+
clientTime: string;
|
|
110
|
+
user: {
|
|
111
|
+
id: string;
|
|
112
|
+
did: string;
|
|
113
|
+
role?: string;
|
|
114
|
+
fullName?: string;
|
|
115
|
+
provider?: string;
|
|
116
|
+
walletOS?: string;
|
|
117
|
+
isAdmin?: boolean;
|
|
118
|
+
} | undefined;
|
|
119
|
+
env: Pick<{
|
|
120
|
+
[key: string]: any;
|
|
121
|
+
appId: string;
|
|
122
|
+
appPid: string;
|
|
123
|
+
appIds: string[];
|
|
124
|
+
appName: string;
|
|
125
|
+
appNameSlug: string;
|
|
126
|
+
appDescription: string;
|
|
127
|
+
appUrl: string;
|
|
128
|
+
isComponent: boolean;
|
|
129
|
+
dataDir: string;
|
|
130
|
+
cacheDir: string;
|
|
131
|
+
mode: string;
|
|
132
|
+
tenantMode: string;
|
|
133
|
+
appStorageEndpoint: string;
|
|
134
|
+
serverVersion: string;
|
|
135
|
+
languages: {
|
|
136
|
+
code: string;
|
|
137
|
+
name: string;
|
|
138
|
+
}[];
|
|
139
|
+
preferences: Record<string, any>;
|
|
140
|
+
componentDid: string;
|
|
141
|
+
initialized?: boolean;
|
|
142
|
+
}, "appId" | "appName" | "appDescription" | "appUrl">;
|
|
143
|
+
};
|
|
144
|
+
$storage: {
|
|
145
|
+
getItem(key: string, { scope, onlyOne }?: {
|
|
146
|
+
scope?: VariableScope;
|
|
147
|
+
onlyOne?: boolean;
|
|
148
|
+
}): Promise<{
|
|
149
|
+
id: string;
|
|
150
|
+
key: string;
|
|
151
|
+
data: any;
|
|
152
|
+
scope: VariableScope;
|
|
153
|
+
}[] | {
|
|
154
|
+
id: string;
|
|
155
|
+
key: string;
|
|
156
|
+
data: any;
|
|
157
|
+
scope: VariableScope;
|
|
158
|
+
} | null>;
|
|
159
|
+
setItem(key: string, value: any, { scope, onlyOne }?: {
|
|
160
|
+
scope?: VariableScope;
|
|
161
|
+
onlyOne?: boolean;
|
|
162
|
+
}): Promise<{
|
|
163
|
+
id: string;
|
|
164
|
+
key: string;
|
|
165
|
+
data: any;
|
|
166
|
+
scope: VariableScope;
|
|
167
|
+
}>;
|
|
168
|
+
};
|
|
169
|
+
$cache: {
|
|
170
|
+
readonly key: string;
|
|
171
|
+
getItem(key: string, { agentId }?: {
|
|
172
|
+
agentId?: string;
|
|
173
|
+
}): Promise<{
|
|
174
|
+
inputs: {
|
|
175
|
+
[key: string]: any;
|
|
176
|
+
};
|
|
177
|
+
outputs: {
|
|
178
|
+
[key: string]: any;
|
|
179
|
+
};
|
|
180
|
+
} | null>;
|
|
181
|
+
};
|
|
182
|
+
$blocklet: {
|
|
183
|
+
issueVC: (args: Omit<Parameters<typeof issueVC>[0], "userDid" | "project">) => Promise<{
|
|
184
|
+
user: import("@abtnode/client").UserInfo;
|
|
185
|
+
vc: object;
|
|
186
|
+
}>;
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
private prepareInputs;
|
|
190
|
+
protected renderMessage: typeof renderMessage;
|
|
191
|
+
protected validateOutputs({ inputs, outputs, partial, processCallAgentOutputs, }: {
|
|
192
|
+
inputs?: {
|
|
193
|
+
[key: string]: any;
|
|
194
|
+
};
|
|
195
|
+
outputs?: {
|
|
196
|
+
[key: string]: any;
|
|
197
|
+
};
|
|
198
|
+
partial?: boolean;
|
|
199
|
+
processCallAgentOutputs?: boolean;
|
|
200
|
+
}): Promise<any>;
|
|
201
|
+
private postProcessOutputs;
|
|
202
|
+
private setMemory;
|
|
203
|
+
private getMemory;
|
|
204
|
+
hideSecretInputs(partial: {
|
|
205
|
+
[key: string]: any;
|
|
206
|
+
}, agent: GetAgentResult): {
|
|
207
|
+
[x: string]: any;
|
|
208
|
+
};
|
|
209
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CallAssistant } from '../types';
|
|
2
|
+
import { AgentExecutorBase } from './base';
|
|
3
|
+
export declare class CallAgentExecutor extends AgentExecutorBase<CallAssistant> {
|
|
4
|
+
private getCalledAgents;
|
|
5
|
+
private getLastTextSteamAgentId;
|
|
6
|
+
private getOutputVariables;
|
|
7
|
+
process(options: {
|
|
8
|
+
inputs: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
}): Promise<Partial<{}>>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RouterAssistant } from '../types';
|
|
2
|
+
import { AgentExecutorBase } from './base';
|
|
3
|
+
export declare class DecisionAgentExecutor extends AgentExecutorBase<RouterAssistant> {
|
|
4
|
+
process({ inputs }: {
|
|
5
|
+
inputs: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
}): Promise<any>;
|
|
9
|
+
processWithJsonLogic({ inputs }: {
|
|
10
|
+
inputs: {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
};
|
|
13
|
+
}): Promise<any>;
|
|
14
|
+
processWithLLM({ inputs }: {
|
|
15
|
+
inputs: {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
};
|
|
18
|
+
}): Promise<any>;
|
|
19
|
+
private getEnglishFunctionName;
|
|
20
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GetAgentResult } from '../assistant/type';
|
|
2
|
+
import { AgentExecutorBase, AgentExecutorOptions, ExecutorContext } from './base';
|
|
3
|
+
export declare class RuntimeExecutor extends AgentExecutorBase<GetAgentResult> {
|
|
4
|
+
private parentAgent?;
|
|
5
|
+
constructor(context: Omit<ConstructorParameters<typeof ExecutorContext>[0], 'executor'>, agent: GetAgentResult, options: AgentExecutorOptions, parentAgent?: GetAgentResult | undefined);
|
|
6
|
+
process(): Promise<void>;
|
|
7
|
+
execute(): Promise<any>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { GetAgentResult } from '../assistant/type';
|
|
2
|
+
import { OutputVariable, PromptAssistant } from '../types';
|
|
3
|
+
import { AgentExecutorBase } from './base';
|
|
4
|
+
export declare class LLMAgentExecutor extends AgentExecutorBase<PromptAssistant> {
|
|
5
|
+
private retryTimes;
|
|
6
|
+
get modelInfo(): {
|
|
7
|
+
model: string;
|
|
8
|
+
temperature: number | undefined;
|
|
9
|
+
topP: number | undefined;
|
|
10
|
+
presencePenalty: number | undefined;
|
|
11
|
+
frequencyPenalty: number | undefined;
|
|
12
|
+
};
|
|
13
|
+
private _executor;
|
|
14
|
+
get executor(): Promise<{
|
|
15
|
+
executor: GetAgentResult;
|
|
16
|
+
inputValues?: {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
};
|
|
19
|
+
} | undefined>;
|
|
20
|
+
private _outputsInfo;
|
|
21
|
+
get outputsInfo(): Promise<{
|
|
22
|
+
outputs: OutputVariable[];
|
|
23
|
+
schema: any;
|
|
24
|
+
hasStreamingTextOutput: boolean;
|
|
25
|
+
hasJsonOutputs: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
private getMessages;
|
|
28
|
+
process({ inputs }: {
|
|
29
|
+
inputs: {
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
};
|
|
32
|
+
}): Promise<any>;
|
|
33
|
+
private processWithOutJsonSchemaFormatSupport;
|
|
34
|
+
private processWithJsonSchemaFormat;
|
|
35
|
+
private callAIGetJsonOutput;
|
|
36
|
+
private callAIGetTextStreamOutput;
|
|
37
|
+
private callAIOrExecutor;
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FunctionAssistant } from '../types';
|
|
2
|
+
import { AgentExecutorBase } from './base';
|
|
3
|
+
export declare class LogicAgentExecutor extends AgentExecutorBase<FunctionAssistant> {
|
|
4
|
+
process({ inputs }: {
|
|
5
|
+
inputs: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
}): Promise<any>;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './runtime/runtime';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UserInfo } from '@abtnode/client';
|
|
2
|
+
import AuthService from '@blocklet/sdk/lib/service/auth';
|
|
3
|
+
import type { ExecutorContext } from '../../executor/base';
|
|
4
|
+
export declare const authService: AuthService;
|
|
5
|
+
export declare function issueVC({ context: { entry }, userDid, name, title, description, reissue, displayUrl, notify, }: {
|
|
6
|
+
context: ExecutorContext;
|
|
7
|
+
userDid: string;
|
|
8
|
+
name: string;
|
|
9
|
+
title: string;
|
|
10
|
+
description: string;
|
|
11
|
+
reissue?: boolean;
|
|
12
|
+
displayUrl?: string;
|
|
13
|
+
notify?: boolean;
|
|
14
|
+
}): Promise<{
|
|
15
|
+
user: UserInfo;
|
|
16
|
+
vc: object;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DatasetObject } from '../types';
|
|
2
|
+
export interface User {
|
|
3
|
+
did: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const callBlockletApi: (pathItem: DatasetObject, data: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}, options?: {
|
|
8
|
+
user?: User;
|
|
9
|
+
params?: {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
};
|
|
12
|
+
data?: {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
};
|
|
15
|
+
}) => Promise<import("axios").AxiosResponse<any, {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}>>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DatasetObject, RequestBodyObject } from '../types';
|
|
2
|
+
export declare const getRequestConfig: (pathItem: DatasetObject, requestData: {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}, options?: {
|
|
5
|
+
params: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
data: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
}) => {
|
|
12
|
+
url: string;
|
|
13
|
+
method: string;
|
|
14
|
+
headers: {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
};
|
|
17
|
+
params: {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
};
|
|
20
|
+
data: {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
};
|
|
23
|
+
body: {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
};
|
|
26
|
+
cookies: {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare function extractRequestBodyParameters(requestBody?: RequestBodyObject): {
|
|
31
|
+
name: string;
|
|
32
|
+
value: any;
|
|
33
|
+
description?: string;
|
|
34
|
+
}[];
|
|
35
|
+
export declare function getAllParameters(dataset: DatasetObject): {
|
|
36
|
+
name: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
type?: string;
|
|
39
|
+
}[];
|
|
40
|
+
export declare function getRequiredFields(dataset: DatasetObject): any[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ParameterObject, RequestBodyObject, ResponsesObject } from 'openapi3-ts/oas31';
|
|
2
|
+
export * from 'openapi3-ts/oas31';
|
|
3
|
+
export interface PathItemObject {
|
|
4
|
+
path: string;
|
|
5
|
+
method: string;
|
|
6
|
+
summary?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
parameters?: ParameterObject[];
|
|
9
|
+
requestBody?: RequestBodyObject;
|
|
10
|
+
responses?: ResponsesObject;
|
|
11
|
+
}
|
|
12
|
+
export interface DatasetObject extends PathItemObject {
|
|
13
|
+
id: string;
|
|
14
|
+
type: string;
|
|
15
|
+
url?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
did?: string;
|
|
18
|
+
[key: `x-summary-${string}`]: string | undefined;
|
|
19
|
+
[key: `x-description-${string}`]: string | undefined;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Agent, Variable } from '../types';
|
|
2
|
+
export interface AIGNEProject {
|
|
3
|
+
id: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
createdAt?: string;
|
|
7
|
+
updatedAt?: string;
|
|
8
|
+
createdBy?: string;
|
|
9
|
+
updatedBy?: string;
|
|
10
|
+
agents?: Agent[];
|
|
11
|
+
memories?: Variable[];
|
|
12
|
+
}
|
|
13
|
+
export declare class AIGNERuntime {
|
|
14
|
+
project: AIGNEProject;
|
|
15
|
+
static load(options: {
|
|
16
|
+
path: string;
|
|
17
|
+
}): Promise<AIGNERuntime>;
|
|
18
|
+
constructor(project: AIGNEProject);
|
|
19
|
+
runAgent(agentId: string, inputs: object): Promise<any>;
|
|
20
|
+
}
|