@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.
Files changed (168) hide show
  1. package/lib/cjs/index.js +1 -1
  2. package/lib/cjs/types/index.js +2 -4
  3. package/lib/esm/index.js +1 -1
  4. package/lib/esm/types/index.js +2 -4
  5. package/lib/types/index.d.ts +1 -1
  6. package/lib/types/types/agent.d.ts +5 -0
  7. package/lib/types/types/index.d.ts +2 -4
  8. package/lib/types/types/runnable.d.ts +20 -0
  9. package/package.json +6 -7
  10. package/lib/cjs/assistant/generate-output.js +0 -101
  11. package/lib/cjs/assistant/select-agent.js +0 -76
  12. package/lib/cjs/assistant/type.js +0 -11
  13. package/lib/cjs/common/aid.js +0 -42
  14. package/lib/cjs/common/index.js +0 -238
  15. package/lib/cjs/common/resource-manager.js +0 -199
  16. package/lib/cjs/constants.js +0 -9
  17. package/lib/cjs/executor/agent.js +0 -10
  18. package/lib/cjs/executor/aigc.js +0 -28
  19. package/lib/cjs/executor/api.js +0 -64
  20. package/lib/cjs/executor/base.js +0 -676
  21. package/lib/cjs/executor/blocklet.js +0 -25
  22. package/lib/cjs/executor/call-agent.js +0 -105
  23. package/lib/cjs/executor/decision.js +0 -478
  24. package/lib/cjs/executor/image-blender.js +0 -32
  25. package/lib/cjs/executor/index.js +0 -81
  26. package/lib/cjs/executor/llm.js +0 -379
  27. package/lib/cjs/executor/logic.js +0 -167
  28. package/lib/cjs/libs/blocklet/vc.js +0 -92
  29. package/lib/cjs/libs/openapi/request/index.js +0 -24
  30. package/lib/cjs/libs/openapi/request/util.js +0 -146
  31. package/lib/cjs/libs/openapi/types/index.js +0 -17
  32. package/lib/cjs/libs/openapi/util/call.js +0 -15
  33. package/lib/cjs/libs/openapi/util/check-schema.js +0 -67
  34. package/lib/cjs/libs/openapi/util/convert-schema.js +0 -44
  35. package/lib/cjs/libs/openapi/util/flatten-open-api.js +0 -21
  36. package/lib/cjs/libs/openapi/util/get-open-api-i18n-text.js +0 -7
  37. package/lib/cjs/runtime/resource-blocklet.js +0 -5
  38. package/lib/cjs/runtime/runtime.js +0 -143
  39. package/lib/cjs/types/assistant/index.js +0 -31
  40. package/lib/cjs/types/assistant/mustache/ReadableMustache.js +0 -69
  41. package/lib/cjs/types/assistant/mustache/directive.js +0 -35
  42. package/lib/cjs/types/assistant/mustache/mustache.js +0 -688
  43. package/lib/cjs/types/resource/index.js +0 -47
  44. package/lib/cjs/types/resource/project.js +0 -35
  45. package/lib/cjs/types/runtime/error.js +0 -18
  46. package/lib/cjs/types/runtime/index.js +0 -37
  47. package/lib/cjs/types/runtime/runtime-resource-blocklet-state.js +0 -4
  48. package/lib/cjs/types/runtime/schema.js +0 -259
  49. package/lib/cjs/utils/cron-job.js +0 -48
  50. package/lib/cjs/utils/extract-metadata-transform.js +0 -58
  51. package/lib/cjs/utils/extract-metadata-transform.test.js +0 -61
  52. package/lib/cjs/utils/fs.js +0 -49
  53. package/lib/cjs/utils/get-blocklet-agent.js +0 -351
  54. package/lib/cjs/utils/geti.js +0 -37
  55. package/lib/cjs/utils/is-non-nullable.js +0 -20
  56. package/lib/cjs/utils/render-message.js +0 -23
  57. package/lib/cjs/utils/resolve-secret-inputs.js +0 -49
  58. package/lib/cjs/utils/retry.js +0 -19
  59. package/lib/cjs/utils/task-id.js +0 -7
  60. package/lib/cjs/utils/tool-calls-transform.js +0 -18
  61. package/lib/esm/assistant/generate-output.js +0 -91
  62. package/lib/esm/assistant/select-agent.js +0 -71
  63. package/lib/esm/assistant/type.js +0 -7
  64. package/lib/esm/common/aid.js +0 -38
  65. package/lib/esm/common/index.js +0 -232
  66. package/lib/esm/common/resource-manager.js +0 -192
  67. package/lib/esm/constants.js +0 -6
  68. package/lib/esm/executor/agent.js +0 -6
  69. package/lib/esm/executor/aigc.js +0 -24
  70. package/lib/esm/executor/api.js +0 -34
  71. package/lib/esm/executor/base.js +0 -668
  72. package/lib/esm/executor/blocklet.js +0 -21
  73. package/lib/esm/executor/call-agent.js +0 -98
  74. package/lib/esm/executor/decision.js +0 -471
  75. package/lib/esm/executor/image-blender.js +0 -25
  76. package/lib/esm/executor/index.js +0 -74
  77. package/lib/esm/executor/llm.js +0 -372
  78. package/lib/esm/executor/logic.js +0 -160
  79. package/lib/esm/libs/blocklet/vc.js +0 -85
  80. package/lib/esm/libs/openapi/request/index.js +0 -20
  81. package/lib/esm/libs/openapi/request/util.js +0 -136
  82. package/lib/esm/libs/openapi/types/index.js +0 -1
  83. package/lib/esm/libs/openapi/util/call.js +0 -8
  84. package/lib/esm/libs/openapi/util/check-schema.js +0 -62
  85. package/lib/esm/libs/openapi/util/convert-schema.js +0 -42
  86. package/lib/esm/libs/openapi/util/flatten-open-api.js +0 -19
  87. package/lib/esm/libs/openapi/util/get-open-api-i18n-text.js +0 -5
  88. package/lib/esm/runtime/resource-blocklet.js +0 -2
  89. package/lib/esm/runtime/runtime.js +0 -136
  90. package/lib/esm/types/assistant/index.js +0 -9
  91. package/lib/esm/types/assistant/mustache/ReadableMustache.js +0 -63
  92. package/lib/esm/types/assistant/mustache/directive.js +0 -29
  93. package/lib/esm/types/assistant/mustache/mustache.js +0 -686
  94. package/lib/esm/types/resource/index.js +0 -26
  95. package/lib/esm/types/resource/project.js +0 -29
  96. package/lib/esm/types/runtime/error.js +0 -14
  97. package/lib/esm/types/runtime/index.js +0 -20
  98. package/lib/esm/types/runtime/runtime-resource-blocklet-state.js +0 -1
  99. package/lib/esm/types/runtime/schema.js +0 -249
  100. package/lib/esm/utils/cron-job.js +0 -44
  101. package/lib/esm/utils/extract-metadata-transform.js +0 -54
  102. package/lib/esm/utils/extract-metadata-transform.test.js +0 -59
  103. package/lib/esm/utils/fs.js +0 -41
  104. package/lib/esm/utils/get-blocklet-agent.js +0 -344
  105. package/lib/esm/utils/geti.js +0 -30
  106. package/lib/esm/utils/is-non-nullable.js +0 -13
  107. package/lib/esm/utils/render-message.js +0 -20
  108. package/lib/esm/utils/resolve-secret-inputs.js +0 -46
  109. package/lib/esm/utils/retry.js +0 -16
  110. package/lib/esm/utils/task-id.js +0 -3
  111. package/lib/esm/utils/tool-calls-transform.js +0 -15
  112. package/lib/types/assistant/generate-output.d.ts +0 -29
  113. package/lib/types/assistant/select-agent.d.ts +0 -14
  114. package/lib/types/assistant/type.d.ts +0 -61
  115. package/lib/types/common/aid.d.ts +0 -18
  116. package/lib/types/common/index.d.ts +0 -7
  117. package/lib/types/common/resource-manager.d.ts +0 -88
  118. package/lib/types/constants.d.ts +0 -6
  119. package/lib/types/executor/agent.d.ts +0 -5
  120. package/lib/types/executor/aigc.d.ts +0 -9
  121. package/lib/types/executor/api.d.ts +0 -9
  122. package/lib/types/executor/base.d.ts +0 -209
  123. package/lib/types/executor/blocklet.d.ts +0 -9
  124. package/lib/types/executor/call-agent.d.ts +0 -12
  125. package/lib/types/executor/decision.d.ts +0 -20
  126. package/lib/types/executor/image-blender.d.ts +0 -9
  127. package/lib/types/executor/index.d.ts +0 -8
  128. package/lib/types/executor/llm.d.ts +0 -38
  129. package/lib/types/executor/logic.d.ts +0 -9
  130. package/lib/types/libs/blocklet/vc.d.ts +0 -17
  131. package/lib/types/libs/openapi/request/index.d.ts +0 -17
  132. package/lib/types/libs/openapi/request/util.d.ts +0 -40
  133. package/lib/types/libs/openapi/types/index.d.ts +0 -20
  134. package/lib/types/libs/openapi/util/call.d.ts +0 -2
  135. package/lib/types/libs/openapi/util/check-schema.d.ts +0 -3
  136. package/lib/types/libs/openapi/util/convert-schema.d.ts +0 -8
  137. package/lib/types/libs/openapi/util/flatten-open-api.d.ts +0 -3
  138. package/lib/types/libs/openapi/util/get-open-api-i18n-text.d.ts +0 -2
  139. package/lib/types/runtime/resource-blocklet.d.ts +0 -2
  140. package/lib/types/runtime/runtime.d.ts +0 -20
  141. package/lib/types/types/assistant/index.d.ts +0 -405
  142. package/lib/types/types/assistant/mustache/ReadableMustache.d.ts +0 -2
  143. package/lib/types/types/assistant/mustache/directive.d.ts +0 -6
  144. package/lib/types/types/assistant/mustache/mustache.d.ts +0 -2
  145. package/lib/types/types/common/index.d.ts +0 -45
  146. package/lib/types/types/resource/index.d.ts +0 -17
  147. package/lib/types/types/resource/project.d.ts +0 -41
  148. package/lib/types/types/runtime/agent.d.ts +0 -33
  149. package/lib/types/types/runtime/error.d.ts +0 -10
  150. package/lib/types/types/runtime/index.d.ts +0 -116
  151. package/lib/types/types/runtime/runtime-resource-blocklet-state.d.ts +0 -5
  152. package/lib/types/types/runtime/schema.d.ts +0 -110
  153. package/lib/types/utils/cron-job.d.ts +0 -22
  154. package/lib/types/utils/extract-metadata-transform.d.ts +0 -16
  155. package/lib/types/utils/extract-metadata-transform.test.d.ts +0 -1
  156. package/lib/types/utils/fs.d.ts +0 -9
  157. package/lib/types/utils/get-blocklet-agent.d.ts +0 -219
  158. package/lib/types/utils/geti.d.ts +0 -1
  159. package/lib/types/utils/is-non-nullable.d.ts +0 -2
  160. package/lib/types/utils/render-message.d.ts +0 -6
  161. package/lib/types/utils/resolve-secret-inputs.d.ts +0 -11
  162. package/lib/types/utils/retry.d.ts +0 -1
  163. package/lib/types/utils/task-id.d.ts +0 -1
  164. package/lib/types/utils/tool-calls-transform.d.ts +0 -2
  165. /package/lib/cjs/types/{runtime/agent.js → agent.js} +0 -0
  166. /package/lib/cjs/types/{common/index.js → runnable.js} +0 -0
  167. /package/lib/esm/types/{runtime/agent.js → agent.js} +0 -0
  168. /package/lib/esm/types/{common/index.js → runnable.js} +0 -0
@@ -1,110 +0,0 @@
1
- import { ChatCompletionResponse } from '@blocklet/ai-kit/api/types/chat';
2
- import Joi from 'joi';
3
- import type { Assistant, BlockletAgent, OutputVariable, Variable } from '..';
4
- export declare const variableBlockListForAgent: {
5
- [key in Assistant['type']]?: {
6
- block?: Set<RuntimeOutputVariable>;
7
- allow?: Set<RuntimeOutputVariable>;
8
- };
9
- };
10
- type OmitUnion<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
11
- export declare const runtimeVariablesSchema: {
12
- [key in RuntimeOutputVariable]?: OmitUnion<OutputVariable, 'id'>;
13
- };
14
- export declare function outputVariablesToJsonSchema(assistant: Assistant, { variables, includeRuntimeOutputVariables, includeFaker, }: {
15
- variables: Variable[];
16
- includeRuntimeOutputVariables?: boolean;
17
- includeFaker?: boolean;
18
- }): {
19
- type: 'object';
20
- properties: {
21
- [key: string]: any;
22
- };
23
- } | undefined;
24
- export declare function outputVariablesToJoiSchema(assistant: Assistant | BlockletAgent, { partial, variables }: {
25
- partial?: boolean;
26
- variables: Variable[];
27
- }): Joi.AnySchema;
28
- export declare enum RuntimeOutputVariable {
29
- llmResponseStream = "$llmResponseStream",
30
- text = "$text",
31
- images = "$images",
32
- suggestedQuestions = "$suggested.questions",
33
- referenceLinks = "$reference.links",
34
- appearancePage = "$appearance.page",
35
- appearanceInput = "$appearance.input",
36
- appearanceOutput = "$appearance.output",
37
- children = "$children",
38
- share = "$share",
39
- openingQuestions = "$openingQuestions",
40
- openingMessage = "$openingMessage",
41
- profile = "$profile"
42
- }
43
- export declare function isRuntimeOutputVariable(variable: string): variable is RuntimeOutputVariable;
44
- export interface RuntimeOutputAppearance {
45
- componentBlockletDid?: string;
46
- componentId?: string;
47
- componentName?: string;
48
- componentProperties?: {
49
- [key: string]: any;
50
- };
51
- componentProps?: {
52
- [key: string]: any;
53
- };
54
- title?: string;
55
- icon?: string;
56
- jsonataExpression?: string;
57
- }
58
- export interface RuntimeOutputChildren {
59
- agents?: {
60
- id: string;
61
- name?: string;
62
- }[];
63
- }
64
- export interface RuntimeOutputShare {
65
- items?: {
66
- to: string;
67
- }[];
68
- shareAttachUrl?: boolean;
69
- shareAttachInputs?: boolean;
70
- }
71
- export interface RuntimeOutputOpeningQuestions {
72
- items?: {
73
- id: string;
74
- title?: string;
75
- parameters?: any;
76
- }[];
77
- }
78
- export interface RuntimeOutputOpeningMessage {
79
- message?: string;
80
- }
81
- export interface RuntimeOutputProfile {
82
- avatar?: string;
83
- name?: string;
84
- description?: string;
85
- ogImage?: string;
86
- }
87
- export interface RuntimeOutputVariablesSchema {
88
- [RuntimeOutputVariable.llmResponseStream]?: ReadableStream<ChatCompletionResponse>;
89
- [RuntimeOutputVariable.text]?: string;
90
- [RuntimeOutputVariable.images]?: {
91
- url: string;
92
- }[];
93
- [RuntimeOutputVariable.suggestedQuestions]?: {
94
- question: string;
95
- }[];
96
- [RuntimeOutputVariable.referenceLinks]?: {
97
- title?: string;
98
- url: string;
99
- }[];
100
- [RuntimeOutputVariable.appearancePage]?: undefined;
101
- [RuntimeOutputVariable.appearanceInput]?: undefined;
102
- [RuntimeOutputVariable.appearanceOutput]?: undefined;
103
- [RuntimeOutputVariable.children]?: RuntimeOutputChildren;
104
- [RuntimeOutputVariable.share]?: RuntimeOutputShare;
105
- [RuntimeOutputVariable.openingQuestions]?: RuntimeOutputOpeningQuestions;
106
- [RuntimeOutputVariable.openingMessage]?: RuntimeOutputOpeningMessage;
107
- [RuntimeOutputVariable.profile]?: RuntimeOutputProfile;
108
- }
109
- export declare function jsonSchemaToOpenAIJsonSchema(schema: any): any;
110
- export {};
@@ -1,22 +0,0 @@
1
- export declare const CronJobDefaultGroup = "default";
2
- export type Job = {
3
- id: string;
4
- cronTime: string;
5
- onTick: () => void;
6
- };
7
- export declare class CronJobManager {
8
- private groups;
9
- resetJobs(jobs: Job[], { groupId }?: {
10
- groupId?: string;
11
- }): void;
12
- resetJob(job: Job, { groupId }?: {
13
- groupId?: string;
14
- }): void;
15
- stopJob(jobId: string, { groupId }?: {
16
- groupId?: string;
17
- }): void;
18
- destroyGroup({ groupId }: {
19
- groupId: string;
20
- }): void;
21
- destroy(): void;
22
- }
@@ -1,16 +0,0 @@
1
- import { TransformStream } from 'stream/web';
2
- export declare class ExtractMetadataTransform extends TransformStream<string, {
3
- type: 'text';
4
- text: string;
5
- } | {
6
- type: 'match';
7
- text: string;
8
- }> {
9
- private buffer;
10
- private cursor;
11
- private state;
12
- constructor({ start, end }: {
13
- start: string;
14
- end: string;
15
- });
16
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- export declare function copyFile(src: string, dest: string, { skip }?: {
2
- skip?: (src: string) => boolean;
3
- }): Promise<void>;
4
- export declare function copyDirectory(src: string, dest: string, { skip }?: {
5
- skip?: (src: string) => boolean;
6
- }): Promise<void>;
7
- export declare function copyRecursive(src: string, dest: string, { skip }?: {
8
- skip?: (src: string) => boolean;
9
- }): Promise<void>;
@@ -1,219 +0,0 @@
1
- import { GetAgentResult } from '../assistant/type';
2
- import { DatasetObject } from '../libs/openapi/types';
3
- export declare const HISTORY_API_ID: string;
4
- export declare const KNOWLEDGE_API_ID: string;
5
- export declare const MEMORY_API_ID: string;
6
- export declare const buildInOpenAPI: {
7
- '/api/messages': {
8
- get: {
9
- summary: string;
10
- 'x-summary-zh': string;
11
- description: string;
12
- 'x-description-zh': string;
13
- tags: string[];
14
- parameters: ({
15
- in: string;
16
- name: string;
17
- schema: {
18
- type: string;
19
- };
20
- description: string;
21
- 'x-description-zh'?: undefined;
22
- } | {
23
- in: string;
24
- name: string;
25
- schema: {
26
- type: string;
27
- };
28
- description: string;
29
- 'x-description-zh': string;
30
- })[];
31
- responses: {
32
- '200': {
33
- description: string;
34
- 'x-description-zh': string;
35
- content: {
36
- 'application/json': {
37
- schema: {
38
- type: string;
39
- properties: {
40
- messages: {
41
- type: string;
42
- items: {
43
- type: string;
44
- properties: {
45
- role: {
46
- type: string;
47
- };
48
- content: {
49
- type: string;
50
- };
51
- agentId: {
52
- type: string;
53
- };
54
- };
55
- };
56
- };
57
- };
58
- };
59
- };
60
- };
61
- };
62
- };
63
- 'x-id': string;
64
- 'x-did': string;
65
- 'x-path': string;
66
- 'x-method': string;
67
- };
68
- };
69
- '/api/datasets/{datasetId}/search': {
70
- get: {
71
- summary: string;
72
- 'x-summary-zh': string;
73
- parameters: ({
74
- name: string;
75
- in: string;
76
- required: boolean;
77
- schema: {
78
- type: string;
79
- default?: undefined;
80
- };
81
- description: string;
82
- } | {
83
- name: string;
84
- in: string;
85
- required: boolean;
86
- schema: {
87
- type: string;
88
- default: number;
89
- };
90
- description: string;
91
- })[];
92
- responses: {
93
- '200': {
94
- description: string;
95
- content: {
96
- 'application/json': {
97
- schema: {
98
- type: string;
99
- properties: {
100
- docs: {
101
- type: string;
102
- items: {
103
- type: string;
104
- properties: {
105
- title: {
106
- type: string;
107
- description: string;
108
- };
109
- content: {
110
- type: string;
111
- description: string;
112
- };
113
- };
114
- };
115
- };
116
- };
117
- };
118
- };
119
- };
120
- };
121
- };
122
- 'x-id': string;
123
- 'x-did': string;
124
- 'x-path': string;
125
- 'x-method': string;
126
- };
127
- };
128
- '/api/memories/variable-by-query': {
129
- get: {
130
- summary: string;
131
- 'x-summary-zh': string;
132
- parameters: ({
133
- name: string;
134
- in: string;
135
- required: boolean;
136
- schema: {
137
- type: string;
138
- enum?: undefined;
139
- };
140
- description: string;
141
- } | {
142
- name: string;
143
- in: string;
144
- required: boolean;
145
- schema: {
146
- type: string;
147
- enum: string[];
148
- };
149
- description: string;
150
- })[];
151
- responses: {
152
- '200': {
153
- description: string;
154
- content: {
155
- 'application/json': {
156
- schema: {
157
- type: string;
158
- properties: {
159
- datastores: {
160
- type: string;
161
- items: {
162
- type: string;
163
- properties: {
164
- id: {
165
- type: string;
166
- description: string;
167
- };
168
- key: {
169
- type: string;
170
- description: string;
171
- };
172
- data: {
173
- type: string;
174
- description: string;
175
- };
176
- userId: {
177
- type: string;
178
- description: string;
179
- };
180
- projectId: {
181
- type: string;
182
- description: string;
183
- };
184
- sessionId: {
185
- type: string;
186
- description: string;
187
- };
188
- scope: {
189
- type: string;
190
- description: string;
191
- enum: string[];
192
- };
193
- };
194
- };
195
- };
196
- };
197
- };
198
- };
199
- };
200
- };
201
- };
202
- 'x-id': string;
203
- 'x-did': string;
204
- 'x-path': string;
205
- 'x-method': string;
206
- };
207
- };
208
- };
209
- export declare const getBlockletAgent: () => Promise<{
210
- agents: (GetAgentResult & {
211
- openApi: DatasetObject;
212
- })[];
213
- agentsMap: {
214
- [key: string]: GetAgentResult & {
215
- openApi: DatasetObject;
216
- };
217
- };
218
- openApis: DatasetObject[];
219
- }>;
@@ -1 +0,0 @@
1
- export declare const geti: (object: any, path: any, defaultValue?: any) => any;
@@ -1,2 +0,0 @@
1
- export declare function isNonNullable<T>(value: T): value is NonNullable<T>;
2
- export declare function isPropsNonNullable<T, K extends keyof T>(...props: (K | K[])[]): (value: T) => value is T & Required<Pick<T, K>>;
@@ -1,6 +0,0 @@
1
- export declare function renderMessage(message: string, parameters?: {
2
- [key: string]: any;
3
- }, { stringify, escapeJsonSymbols }?: {
4
- stringify?: boolean;
5
- escapeJsonSymbols?: boolean;
6
- }): Promise<any>;
@@ -1,11 +0,0 @@
1
- import { GetAgent, GetAgentResult } from '../assistant/type';
2
- import { SecretParameter, SourceParameter } from '../types';
3
- export declare function resolveSecretInputs(agent: GetAgentResult, { getAgent }: {
4
- getAgent: GetAgent;
5
- }): Promise<{
6
- agent: GetAgentResult & Required<Pick<GetAgentResult, 'project'>>;
7
- input: SourceParameter & {
8
- key: string;
9
- source: SecretParameter;
10
- };
11
- }[]>;
@@ -1 +0,0 @@
1
- export default function retry<T>(fn: () => Promise<T> | T, retries: number): Promise<T>;
@@ -1 +0,0 @@
1
- export declare const nextId: () => string;
@@ -1,2 +0,0 @@
1
- import { ChatCompletionChunk } from '@blocklet/ai-kit/api/types/chat';
2
- export declare function toolCallsTransform(calls: NonNullable<ChatCompletionChunk['delta']['toolCalls']>, chunk: ChatCompletionChunk): void;
File without changes
File without changes
File without changes
File without changes