@aigne/core 1.0.17 → 1.1.0-beta.2

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 (252) hide show
  1. package/lib/cjs/agents/agent.d.ts +55 -0
  2. package/lib/cjs/agents/agent.js +91 -0
  3. package/lib/cjs/agents/ai-agent.d.ts +20 -0
  4. package/lib/cjs/agents/ai-agent.js +86 -0
  5. package/lib/cjs/agents/mcp-agent.d.ts +27 -0
  6. package/lib/cjs/agents/mcp-agent.js +95 -0
  7. package/lib/cjs/agents/types.d.ts +9 -0
  8. package/lib/cjs/agents/types.js +16 -0
  9. package/lib/cjs/execution-engine/context.d.ts +10 -0
  10. package/lib/cjs/execution-engine/index.d.ts +45 -0
  11. package/lib/cjs/execution-engine/index.js +190 -0
  12. package/lib/cjs/execution-engine/message-queue.d.ts +5 -0
  13. package/lib/cjs/execution-engine/message-queue.js +9 -0
  14. package/lib/cjs/index.d.ts +10 -21
  15. package/lib/cjs/index.js +10 -21
  16. package/lib/cjs/models/chat-openai.d.ts +14 -0
  17. package/lib/cjs/{llm-models/openai-llm-model.js → models/chat-openai.js} +62 -27
  18. package/lib/cjs/models/chat.d.ts +78 -0
  19. package/lib/cjs/models/chat.js +91 -0
  20. package/lib/cjs/prompt/prompt-builder.d.ts +34 -0
  21. package/lib/cjs/prompt/prompt-builder.js +140 -0
  22. package/lib/cjs/prompt/template.d.ts +70 -0
  23. package/lib/cjs/prompt/template.js +172 -0
  24. package/lib/cjs/utils/logger.d.ts +6 -3
  25. package/lib/cjs/utils/logger.js +9 -14
  26. package/lib/cjs/utils/type-utils.d.ts +5 -1
  27. package/lib/cjs/utils/type-utils.js +23 -0
  28. package/lib/dts/agents/agent.d.ts +55 -0
  29. package/lib/dts/agents/ai-agent.d.ts +20 -0
  30. package/lib/dts/agents/mcp-agent.d.ts +27 -0
  31. package/lib/dts/agents/types.d.ts +9 -0
  32. package/lib/dts/execution-engine/context.d.ts +10 -0
  33. package/lib/dts/execution-engine/index.d.ts +45 -0
  34. package/lib/dts/execution-engine/message-queue.d.ts +5 -0
  35. package/lib/dts/index.d.ts +10 -21
  36. package/lib/dts/models/chat-openai.d.ts +14 -0
  37. package/lib/dts/models/chat.d.ts +78 -0
  38. package/lib/dts/prompt/prompt-builder.d.ts +34 -0
  39. package/lib/dts/prompt/template.d.ts +70 -0
  40. package/lib/dts/utils/logger.d.ts +6 -3
  41. package/lib/dts/utils/type-utils.d.ts +5 -1
  42. package/lib/esm/agents/agent.d.ts +55 -0
  43. package/lib/esm/agents/agent.js +83 -0
  44. package/lib/esm/agents/ai-agent.d.ts +20 -0
  45. package/lib/esm/agents/ai-agent.js +82 -0
  46. package/lib/esm/agents/mcp-agent.d.ts +27 -0
  47. package/lib/esm/agents/mcp-agent.js +90 -0
  48. package/lib/esm/agents/types.d.ts +9 -0
  49. package/lib/esm/agents/types.js +11 -0
  50. package/lib/esm/execution-engine/context.d.ts +10 -0
  51. package/lib/esm/execution-engine/index.d.ts +45 -0
  52. package/lib/esm/execution-engine/index.js +182 -0
  53. package/lib/esm/execution-engine/message-queue.d.ts +5 -0
  54. package/lib/esm/execution-engine/message-queue.js +5 -0
  55. package/lib/esm/index.d.ts +10 -21
  56. package/lib/esm/index.js +10 -21
  57. package/lib/esm/models/chat-openai.d.ts +14 -0
  58. package/lib/esm/{llm-models/openai-llm-model.js → models/chat-openai.js} +59 -24
  59. package/lib/esm/models/chat.d.ts +78 -0
  60. package/lib/esm/models/chat.js +87 -0
  61. package/lib/esm/prompt/prompt-builder.d.ts +34 -0
  62. package/lib/esm/prompt/prompt-builder.js +131 -0
  63. package/lib/esm/prompt/template.d.ts +70 -0
  64. package/lib/esm/prompt/template.js +158 -0
  65. package/lib/esm/utils/logger.d.ts +6 -3
  66. package/lib/esm/utils/logger.js +6 -14
  67. package/lib/esm/utils/type-utils.d.ts +5 -1
  68. package/lib/esm/utils/type-utils.js +17 -1
  69. package/package.json +18 -14
  70. package/lib/cjs/agent.d.ts +0 -96
  71. package/lib/cjs/agent.js +0 -165
  72. package/lib/cjs/constants.d.ts +0 -7
  73. package/lib/cjs/constants.js +0 -10
  74. package/lib/cjs/context.d.ts +0 -23
  75. package/lib/cjs/definitions/data-schema.d.ts +0 -61
  76. package/lib/cjs/definitions/data-schema.js +0 -47
  77. package/lib/cjs/definitions/data-type.d.ts +0 -32
  78. package/lib/cjs/definitions/data-type.js +0 -2
  79. package/lib/cjs/definitions/memory.d.ts +0 -53
  80. package/lib/cjs/definitions/memory.js +0 -23
  81. package/lib/cjs/definitions/open-api.d.ts +0 -36
  82. package/lib/cjs/definitions/open-api.js +0 -2
  83. package/lib/cjs/definitions/preload.d.ts +0 -43
  84. package/lib/cjs/definitions/preload.js +0 -34
  85. package/lib/cjs/function-agent.d.ts +0 -23
  86. package/lib/cjs/function-agent.js +0 -62
  87. package/lib/cjs/llm-agent.d.ts +0 -53
  88. package/lib/cjs/llm-agent.js +0 -140
  89. package/lib/cjs/llm-decision-agent.d.ts +0 -53
  90. package/lib/cjs/llm-decision-agent.js +0 -144
  91. package/lib/cjs/llm-model.d.ts +0 -80
  92. package/lib/cjs/llm-model.js +0 -27
  93. package/lib/cjs/llm-models/gemini-llm-model.d.ts +0 -24
  94. package/lib/cjs/llm-models/gemini-llm-model.js +0 -199
  95. package/lib/cjs/llm-models/openai-llm-model.d.ts +0 -26
  96. package/lib/cjs/memorable.d.ts +0 -198
  97. package/lib/cjs/memorable.js +0 -33
  98. package/lib/cjs/open-api-agent.d.ts +0 -26
  99. package/lib/cjs/open-api-agent.js +0 -68
  100. package/lib/cjs/pipeline-agent.d.ts +0 -56
  101. package/lib/cjs/pipeline-agent.js +0 -206
  102. package/lib/cjs/runnable.d.ts +0 -76
  103. package/lib/cjs/runnable.js +0 -37
  104. package/lib/cjs/runtime.d.ts +0 -64
  105. package/lib/cjs/runtime.js +0 -149
  106. package/lib/cjs/sandbox-function-agent.d.ts +0 -21
  107. package/lib/cjs/sandbox-function-agent.js +0 -78
  108. package/lib/cjs/sandbox-function-runner.d.ts +0 -16
  109. package/lib/cjs/sandbox-function-runner.js +0 -32
  110. package/lib/cjs/utils/constants.d.ts +0 -1
  111. package/lib/cjs/utils/constants.js +0 -4
  112. package/lib/cjs/utils/fetch-open-api.d.ts +0 -2
  113. package/lib/cjs/utils/fetch-open-api.js +0 -31
  114. package/lib/cjs/utils/fetch.d.ts +0 -1
  115. package/lib/cjs/utils/fetch.js +0 -21
  116. package/lib/cjs/utils/index.d.ts +0 -12
  117. package/lib/cjs/utils/index.js +0 -28
  118. package/lib/cjs/utils/is-non-nullable.d.ts +0 -2
  119. package/lib/cjs/utils/is-non-nullable.js +0 -20
  120. package/lib/cjs/utils/message-utils.d.ts +0 -20
  121. package/lib/cjs/utils/message-utils.js +0 -79
  122. package/lib/cjs/utils/mustache-utils.d.ts +0 -3
  123. package/lib/cjs/utils/mustache-utils.js +0 -14
  124. package/lib/cjs/utils/nullable.d.ts +0 -7
  125. package/lib/cjs/utils/nullable.js +0 -2
  126. package/lib/cjs/utils/omit.d.ts +0 -1
  127. package/lib/cjs/utils/omit.js +0 -2
  128. package/lib/cjs/utils/open-api-parameter.d.ts +0 -7
  129. package/lib/cjs/utils/open-api-parameter.js +0 -81
  130. package/lib/cjs/utils/ordered-map.d.ts +0 -37
  131. package/lib/cjs/utils/ordered-map.js +0 -103
  132. package/lib/cjs/utils/partial.d.ts +0 -3
  133. package/lib/cjs/utils/partial.js +0 -2
  134. package/lib/cjs/utils/runnable-type.d.ts +0 -5
  135. package/lib/cjs/utils/runnable-type.js +0 -2
  136. package/lib/cjs/utils/stream-utils.d.ts +0 -20
  137. package/lib/cjs/utils/stream-utils.js +0 -86
  138. package/lib/cjs/utils/structured-output-schema.d.ts +0 -3
  139. package/lib/cjs/utils/structured-output-schema.js +0 -43
  140. package/lib/cjs/utils/union.d.ts +0 -1
  141. package/lib/cjs/utils/union.js +0 -2
  142. package/lib/dts/agent.d.ts +0 -96
  143. package/lib/dts/constants.d.ts +0 -7
  144. package/lib/dts/context.d.ts +0 -23
  145. package/lib/dts/definitions/data-schema.d.ts +0 -61
  146. package/lib/dts/definitions/data-type.d.ts +0 -32
  147. package/lib/dts/definitions/memory.d.ts +0 -53
  148. package/lib/dts/definitions/open-api.d.ts +0 -36
  149. package/lib/dts/definitions/preload.d.ts +0 -43
  150. package/lib/dts/function-agent.d.ts +0 -23
  151. package/lib/dts/llm-agent.d.ts +0 -53
  152. package/lib/dts/llm-decision-agent.d.ts +0 -53
  153. package/lib/dts/llm-model.d.ts +0 -80
  154. package/lib/dts/llm-models/gemini-llm-model.d.ts +0 -24
  155. package/lib/dts/llm-models/openai-llm-model.d.ts +0 -26
  156. package/lib/dts/memorable.d.ts +0 -198
  157. package/lib/dts/open-api-agent.d.ts +0 -26
  158. package/lib/dts/pipeline-agent.d.ts +0 -56
  159. package/lib/dts/runnable.d.ts +0 -76
  160. package/lib/dts/runtime.d.ts +0 -64
  161. package/lib/dts/sandbox-function-agent.d.ts +0 -21
  162. package/lib/dts/sandbox-function-runner.d.ts +0 -16
  163. package/lib/dts/utils/constants.d.ts +0 -1
  164. package/lib/dts/utils/fetch-open-api.d.ts +0 -2
  165. package/lib/dts/utils/fetch.d.ts +0 -1
  166. package/lib/dts/utils/index.d.ts +0 -12
  167. package/lib/dts/utils/is-non-nullable.d.ts +0 -2
  168. package/lib/dts/utils/message-utils.d.ts +0 -20
  169. package/lib/dts/utils/mustache-utils.d.ts +0 -3
  170. package/lib/dts/utils/nullable.d.ts +0 -7
  171. package/lib/dts/utils/omit.d.ts +0 -1
  172. package/lib/dts/utils/open-api-parameter.d.ts +0 -7
  173. package/lib/dts/utils/ordered-map.d.ts +0 -37
  174. package/lib/dts/utils/partial.d.ts +0 -3
  175. package/lib/dts/utils/runnable-type.d.ts +0 -5
  176. package/lib/dts/utils/stream-utils.d.ts +0 -20
  177. package/lib/dts/utils/structured-output-schema.d.ts +0 -3
  178. package/lib/dts/utils/union.d.ts +0 -1
  179. package/lib/esm/agent.d.ts +0 -96
  180. package/lib/esm/agent.js +0 -161
  181. package/lib/esm/constants.d.ts +0 -7
  182. package/lib/esm/constants.js +0 -7
  183. package/lib/esm/context.d.ts +0 -23
  184. package/lib/esm/definitions/data-schema.d.ts +0 -61
  185. package/lib/esm/definitions/data-schema.js +0 -44
  186. package/lib/esm/definitions/data-type.d.ts +0 -32
  187. package/lib/esm/definitions/data-type.js +0 -1
  188. package/lib/esm/definitions/memory.d.ts +0 -53
  189. package/lib/esm/definitions/memory.js +0 -20
  190. package/lib/esm/definitions/open-api.d.ts +0 -36
  191. package/lib/esm/definitions/open-api.js +0 -1
  192. package/lib/esm/definitions/preload.d.ts +0 -43
  193. package/lib/esm/definitions/preload.js +0 -31
  194. package/lib/esm/function-agent.d.ts +0 -23
  195. package/lib/esm/function-agent.js +0 -59
  196. package/lib/esm/llm-agent.d.ts +0 -53
  197. package/lib/esm/llm-agent.js +0 -137
  198. package/lib/esm/llm-decision-agent.d.ts +0 -53
  199. package/lib/esm/llm-decision-agent.js +0 -141
  200. package/lib/esm/llm-model.d.ts +0 -80
  201. package/lib/esm/llm-model.js +0 -23
  202. package/lib/esm/llm-models/gemini-llm-model.d.ts +0 -24
  203. package/lib/esm/llm-models/gemini-llm-model.js +0 -195
  204. package/lib/esm/llm-models/openai-llm-model.d.ts +0 -26
  205. package/lib/esm/memorable.d.ts +0 -198
  206. package/lib/esm/memorable.js +0 -28
  207. package/lib/esm/open-api-agent.d.ts +0 -26
  208. package/lib/esm/open-api-agent.js +0 -65
  209. package/lib/esm/pipeline-agent.d.ts +0 -56
  210. package/lib/esm/pipeline-agent.js +0 -203
  211. package/lib/esm/runnable.d.ts +0 -76
  212. package/lib/esm/runnable.js +0 -30
  213. package/lib/esm/runtime.d.ts +0 -64
  214. package/lib/esm/runtime.js +0 -146
  215. package/lib/esm/sandbox-function-agent.d.ts +0 -21
  216. package/lib/esm/sandbox-function-agent.js +0 -74
  217. package/lib/esm/sandbox-function-runner.d.ts +0 -16
  218. package/lib/esm/sandbox-function-runner.js +0 -28
  219. package/lib/esm/utils/constants.d.ts +0 -1
  220. package/lib/esm/utils/constants.js +0 -1
  221. package/lib/esm/utils/fetch-open-api.d.ts +0 -2
  222. package/lib/esm/utils/fetch-open-api.js +0 -28
  223. package/lib/esm/utils/fetch.d.ts +0 -1
  224. package/lib/esm/utils/fetch.js +0 -18
  225. package/lib/esm/utils/index.d.ts +0 -12
  226. package/lib/esm/utils/index.js +0 -12
  227. package/lib/esm/utils/is-non-nullable.d.ts +0 -2
  228. package/lib/esm/utils/is-non-nullable.js +0 -13
  229. package/lib/esm/utils/message-utils.d.ts +0 -20
  230. package/lib/esm/utils/message-utils.js +0 -71
  231. package/lib/esm/utils/mustache-utils.d.ts +0 -3
  232. package/lib/esm/utils/mustache-utils.js +0 -8
  233. package/lib/esm/utils/nullable.d.ts +0 -7
  234. package/lib/esm/utils/nullable.js +0 -1
  235. package/lib/esm/utils/omit.d.ts +0 -1
  236. package/lib/esm/utils/omit.js +0 -1
  237. package/lib/esm/utils/open-api-parameter.d.ts +0 -7
  238. package/lib/esm/utils/open-api-parameter.js +0 -78
  239. package/lib/esm/utils/ordered-map.d.ts +0 -37
  240. package/lib/esm/utils/ordered-map.js +0 -100
  241. package/lib/esm/utils/partial.d.ts +0 -3
  242. package/lib/esm/utils/partial.js +0 -1
  243. package/lib/esm/utils/runnable-type.d.ts +0 -5
  244. package/lib/esm/utils/runnable-type.js +0 -1
  245. package/lib/esm/utils/stream-utils.d.ts +0 -20
  246. package/lib/esm/utils/stream-utils.js +0 -79
  247. package/lib/esm/utils/structured-output-schema.d.ts +0 -3
  248. package/lib/esm/utils/structured-output-schema.js +0 -37
  249. package/lib/esm/utils/union.d.ts +0 -1
  250. package/lib/esm/utils/union.js +0 -1
  251. /package/lib/cjs/{context.js → execution-engine/context.js} +0 -0
  252. /package/lib/esm/{context.js → execution-engine/context.js} +0 -0
@@ -1,56 +0,0 @@
1
- import { Agent, type AgentDefinition, type AgentMemories, type AgentPreloads, type AgentProcessInput, type AgentProcessOptions, type CreateAgentInputSchema, type CreateAgentMemoriesSchema, type CreateAgentMemoriesType, type CreateAgentOptions, type CreateAgentOutputSchema, type CreateAgentPreloadsSchema, type CreateAgentPreloadsType } from "./agent";
2
- import type { Context, ContextState } from "./context";
3
- import { type SchemaToType } from "./definitions/data-schema";
4
- import { type Runnable, type RunnableInput, type RunnableOutput, type RunnableOutputType, type RunnableResponseDelta } from "./runnable";
5
- import type { MakeNullablePropertyOptional } from "./utils/nullable";
6
- import { OrderedRecord } from "./utils/ordered-map";
7
- import type { ExtractRunnableInputType } from "./utils/runnable-type";
8
- export declare class PipelineAgent<I extends RunnableInput = RunnableInput, O extends RunnableOutput = RunnableOutput, State extends ContextState = ContextState, Preloads extends AgentPreloads = AgentPreloads, Memories extends AgentMemories = AgentMemories> extends Agent<I, O, State, AgentPreloads, Memories> {
9
- definition: PipelineAgentDefinition;
10
- static create: typeof create;
11
- constructor(definition: PipelineAgentDefinition, context?: Context<State>);
12
- process(input: AgentProcessInput<I, Preloads, Memories>, options: AgentProcessOptions<Preloads, Memories>): Promise<import("stream/web").ReadableStream<RunnableResponseDelta<O>>>;
13
- }
14
- type VariableWithPropPath = {
15
- fromVariable: string;
16
- fromVariablePropPath?: (string | number)[];
17
- };
18
- export type PipelineAgentProcessParameter<R extends Runnable = Runnable, RI extends RunnableInput = ExtractRunnableInputType<R>> = {
19
- runnable: R;
20
- input: MakeNullablePropertyOptional<{
21
- [key in keyof RI]: VariableWithPropPath;
22
- }>;
23
- };
24
- declare function create<I extends CreateAgentInputSchema, O extends CreateAgentOutputSchema<{
25
- fromVariable: string;
26
- fromVariablePropPath?: string[];
27
- }>, State extends ContextState, Preloads extends CreateAgentPreloadsSchema<I>, Memories extends CreateAgentMemoriesSchema<I>, Processes extends {
28
- [name: string]: PipelineAgentProcessParameter;
29
- }>(options: CreateAgentOptions<I, O, State, Preloads, Memories> & {
30
- processes: Processes;
31
- }): PipelineAgent<SchemaToType<I>, SchemaToType<O>, State, CreateAgentPreloadsType<I, Preloads>, CreateAgentMemoriesType<I, Memories>>;
32
- export interface PipelineAgentDefinition extends AgentDefinition {
33
- type: "pipeline_agent";
34
- processes?: OrderedRecord<PipelineAgentProcess>;
35
- outputs: OrderedRecord<PipelineAgentOutput>;
36
- }
37
- export type PipelineAgentOutput = RunnableOutputType & {
38
- from: "variable";
39
- fromVariableId?: string;
40
- fromVariablePropPath?: (string | number)[];
41
- };
42
- export type PipelineAgentProcess = {
43
- id: string;
44
- name?: string;
45
- runnable?: {
46
- id?: string;
47
- };
48
- input?: {
49
- [inputId: string]: {
50
- from: "variable";
51
- fromVariableId?: string;
52
- fromVariablePropPath?: (string | number | symbol)[];
53
- };
54
- };
55
- };
56
- export {};
@@ -1,76 +0,0 @@
1
- import type { Context, ContextState } from "./context";
2
- import type { DataType } from "./definitions/data-type";
3
- import { OrderedRecord } from "./utils/ordered-map";
4
- export interface RunOptions {
5
- stream?: boolean;
6
- }
7
- export type RunnableResponse<T> = T | RunnableResponseStream<T>;
8
- export type RunnableInput = Record<string, any>;
9
- export type RunnableOutput = Record<string, any>;
10
- export declare abstract class Runnable<I extends RunnableInput = RunnableInput, O extends RunnableOutput = RunnableOutput, State extends ContextState = ContextState> {
11
- definition: RunnableDefinition;
12
- context?: Context<State> | undefined;
13
- constructor(definition: RunnableDefinition, context?: Context<State> | undefined);
14
- get id(): string;
15
- get name(): string | undefined;
16
- inputs: {
17
- [key in keyof I]: DataType;
18
- };
19
- outputs: {
20
- [key in keyof O]: DataType;
21
- };
22
- abstract run(input: I, options: RunOptions & {
23
- stream: true;
24
- }): Promise<RunnableResponseStream<O>>;
25
- abstract run(input: I, options?: RunOptions & {
26
- stream?: false;
27
- }): Promise<O>;
28
- abstract run(input: I, options?: RunOptions): Promise<RunnableResponse<O>>;
29
- }
30
- export interface RunnableDefinition {
31
- id: string;
32
- type: string;
33
- name?: string;
34
- description?: string;
35
- inputs: OrderedRecord<RunnableInputType>;
36
- outputs: OrderedRecord<RunnableOutputType>;
37
- }
38
- export type RunnableInputType = DataType;
39
- export type RunnableOutputType = DataType;
40
- export interface RunnableResponseDelta<T> {
41
- $text?: string;
42
- delta?: Partial<T>;
43
- }
44
- export interface RunnableResponseProgress {
45
- progress: {
46
- taskId: string;
47
- time: string;
48
- agent: {
49
- id: string;
50
- name?: string;
51
- description?: string;
52
- };
53
- payload: {
54
- type: "start";
55
- input: {
56
- [key: string]: any;
57
- };
58
- } | {
59
- type: "end";
60
- output: {
61
- [key: string]: any;
62
- };
63
- };
64
- };
65
- }
66
- export interface RunnableResponseError {
67
- error: {
68
- message: string;
69
- };
70
- }
71
- export type RunnableResponseChunk<T> = RunnableResponseDelta<T> | RunnableResponseProgress;
72
- export type RunnableResponseChunkWithError<T> = RunnableResponseChunk<T> | RunnableResponseError;
73
- export declare function isRunnableResponseDelta<T>(chunk: RunnableResponseChunkWithError<T>): chunk is RunnableResponseDelta<T>;
74
- export declare function isRunnableResponseProgress<T>(chunk: RunnableResponseChunkWithError<T>): chunk is RunnableResponseProgress;
75
- export declare function isRunnableResponseError<T>(chunk: RunnableResponseChunkWithError<T>): chunk is RunnableResponseError;
76
- export type RunnableResponseStream<T> = ReadableStream<RunnableResponseChunk<T>>;
@@ -1,64 +0,0 @@
1
- import { type DependencyContainer } from "tsyringe";
2
- import type { constructor as Constructor } from "tsyringe/dist/typings/types";
3
- import type { Context, ContextState } from "./context";
4
- import type { LLMModel, LLMModelConfiguration } from "./llm-model";
5
- import type { Memorable } from "./memorable";
6
- import { Runnable, type RunnableDefinition } from "./runnable";
7
- import type { SandboxFunctionRunner } from "./sandbox-function-runner";
8
- import { OrderedRecord } from "./utils/ordered-map";
9
- import type { DeepPartial } from "./utils/partial";
10
- export interface RuntimeConfiguration {
11
- llmModel?: LLMModelConfiguration;
12
- }
13
- export interface RuntimeOptions<Agents extends {
14
- [name: string]: Runnable;
15
- }, State extends ContextState> {
16
- id?: string;
17
- name?: string;
18
- config?: RuntimeConfiguration;
19
- state?: State;
20
- agents?: Agents;
21
- historyManager?: Memorable<{
22
- input: object;
23
- output: object;
24
- }>;
25
- llmModel?: LLMModel | Constructor<LLMModel>;
26
- sandboxFunctionRunner?: SandboxFunctionRunner | Constructor<SandboxFunctionRunner>;
27
- }
28
- export declare class Runtime<Agents extends {
29
- [name: string]: Runnable;
30
- } = {}, State extends ContextState = ContextState> implements Context<State> {
31
- constructor(options?: RuntimeOptions<Agents, State>);
32
- protected inner: RuntimeInner<Agents, State>;
33
- get options(): RuntimeOptions<Agents, State>;
34
- get id(): string;
35
- get name(): string | undefined;
36
- get historyManager(): Memorable<{
37
- input: object;
38
- output: object;
39
- }, Record<string, any>> | undefined;
40
- config: RuntimeConfiguration;
41
- state: State;
42
- agents: Agents;
43
- private container;
44
- setup(config: DeepPartial<RuntimeConfiguration>): void;
45
- register<R extends Array<RunnableDefinition | Runnable> = []>(...runnables: R): void;
46
- private resolveSync;
47
- resolve<T extends Runnable>(id: string | RunnableDefinition | T): Promise<T>;
48
- resolveDependency<T>(token: string | symbol): T;
49
- copy<State extends ContextState = ContextState>(options: Pick<RuntimeOptions<Agents, State>, "state" | "config">): Runtime<Agents, State>;
50
- }
51
- declare class RuntimeInner<Agents extends {
52
- [name: string]: Runnable;
53
- } = {}, State extends ContextState = ContextState> {
54
- options: RuntimeOptions<Agents, State>;
55
- constructor(options: RuntimeOptions<Agents, State>);
56
- readonly id: string;
57
- readonly name?: string;
58
- config: RuntimeConfiguration;
59
- state: State;
60
- container: DependencyContainer;
61
- runnableDefinitions: OrderedRecord<RunnableDefinition>;
62
- registerDependency<T>(token: string | symbol, dependency: Constructor<T> | T): void;
63
- }
64
- export {};
@@ -1,21 +0,0 @@
1
- import { Agent, type AgentDefinition, type AgentMemories, type AgentPreloads, type AgentProcessInput, type AgentProcessOptions, type CreateAgentInputSchema, type CreateAgentMemoriesSchema, type CreateAgentMemoriesType, type CreateAgentOptions, type CreateAgentOutputSchema, type CreateAgentPreloadsSchema, type CreateAgentPreloadsType } from "./agent";
2
- import type { Context, ContextState } from "./context";
3
- import { type SchemaToType } from "./definitions/data-schema";
4
- import type { RunnableInput, RunnableOutput } from "./runnable";
5
- import type { SandboxFunctionRunner } from "./sandbox-function-runner";
6
- export declare class SandboxFunctionAgent<I extends RunnableInput = RunnableInput, O extends RunnableOutput = RunnableOutput, State extends ContextState = ContextState, Preloads extends AgentPreloads = AgentPreloads, Memories extends AgentMemories = AgentMemories> extends Agent<I, O, State, Preloads, Memories> {
7
- definition: SandboxFunctionAgentDefinition;
8
- runner?: SandboxFunctionRunner<I, O, State, Preloads, Memories> | undefined;
9
- static create: typeof create;
10
- constructor(definition: SandboxFunctionAgentDefinition, context?: Context<State>, runner?: SandboxFunctionRunner<I, O, State, Preloads, Memories> | undefined);
11
- process(input: AgentProcessInput<I, Preloads, Memories>, options: AgentProcessOptions<Preloads, Memories>): Promise<import("./runnable").RunnableResponseStream<O>>;
12
- }
13
- export declare function create<I extends CreateAgentInputSchema, O extends CreateAgentOutputSchema, State extends ContextState, Preloads extends CreateAgentPreloadsSchema<I>, Memories extends CreateAgentMemoriesSchema<I>>(options: CreateAgentOptions<I, O, State, Preloads, Memories> & {
14
- language?: string;
15
- code: string;
16
- }): SandboxFunctionAgent<SchemaToType<I>, SchemaToType<O>, State, CreateAgentPreloadsType<I, Preloads>, CreateAgentMemoriesType<I, Memories>>;
17
- export interface SandboxFunctionAgentDefinition extends AgentDefinition {
18
- type: "sandbox_function_agent";
19
- language?: string;
20
- code?: string;
21
- }
@@ -1,16 +0,0 @@
1
- import { Agent, type AgentMemories, type AgentPreloads } from "./agent";
2
- import type { Context, ContextState } from "./context";
3
- import type { RunnableInput, RunnableOutput } from "./runnable";
4
- export type SandboxFunctionRunnerInput<Input extends RunnableInput = RunnableInput, State extends ContextState = ContextState, Preloads extends AgentPreloads = AgentPreloads, Memories extends AgentMemories = AgentMemories> = {
5
- name: string;
6
- language?: string;
7
- code: string;
8
- input: Input;
9
- preloads: Preloads;
10
- memories: Memories;
11
- context: Pick<Context<State>, "state">;
12
- };
13
- export type SandboxFunctionRunnerOutput<Output extends RunnableOutput> = Output;
14
- export declare abstract class SandboxFunctionRunner<I extends RunnableInput = RunnableInput, O extends RunnableOutput = RunnableOutput, State extends ContextState = ContextState, Preloads extends AgentPreloads = AgentPreloads, Memories extends AgentMemories = AgentMemories> extends Agent<SandboxFunctionRunnerInput<I, State, Preloads, Memories>, SandboxFunctionRunnerOutput<O>> {
15
- constructor(context?: Context);
16
- }
@@ -1 +0,0 @@
1
- export declare const FETCH_TIMEOUT: number;
@@ -1,2 +0,0 @@
1
- import type { FetchRequest } from "../definitions/open-api";
2
- export declare function fetchOpenApi<T>(request: FetchRequest): Promise<T>;
@@ -1 +0,0 @@
1
- export declare function checkFetchResponse(result: Response): Promise<Response>;
@@ -1,12 +0,0 @@
1
- export * from "./fetch";
2
- export * from "./fetch-open-api";
3
- export * from "./is-non-nullable";
4
- export * from "./logger";
5
- export * from "./mustache-utils";
6
- export * from "./nullable";
7
- export * from "./omit";
8
- export * from "./open-api-parameter";
9
- export * from "./ordered-map";
10
- export * from "./partial";
11
- export * from "./stream-utils";
12
- export * from "./union";
@@ -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,20 +0,0 @@
1
- import type { LLMAgentDefinition } from "../llm-agent";
2
- import type { LLMModelInputMessage } from "../llm-model";
3
- import type { MemoryItemWithScore } from "../memorable";
4
- export declare function mergeHistoryMessages(messages: LLMModelInputMessage[], history: LLMModelInputMessage[]): LLMModelInputMessage[];
5
- export declare function memoriesToMessages(memories: {
6
- [name: string]: MemoryItemWithScore[];
7
- }, { primaryMemoryName }?: {
8
- primaryMemoryName?: string;
9
- }): {
10
- primaryMemory: LLMModelInputMessage[];
11
- memory: string;
12
- };
13
- export declare function prepareMessages(definition: Pick<LLMAgentDefinition, "messages" | "memories" | "primaryMemoryId">, input: {
14
- [name: string]: unknown;
15
- }, memories: {
16
- [name: string]: MemoryItemWithScore[];
17
- }): {
18
- originalMessages: LLMModelInputMessage[];
19
- messagesWithMemory: LLMModelInputMessage[];
20
- };
@@ -1,3 +0,0 @@
1
- export declare function renderMessage(template: string, variables?: {
2
- [key: string]: any;
3
- }): string;
@@ -1,7 +0,0 @@
1
- export type MakeNullablePropertyOptional<T extends {
2
- [key: string]: any;
3
- }> = {
4
- [K in keyof T as Extract<T[K], null | undefined> extends never ? K : never]: T[K];
5
- } & {
6
- [K in keyof T as Extract<T[K], null | undefined> extends never ? never : K]?: T[K];
7
- };
@@ -1 +0,0 @@
1
- export type OmitPropsFromUnion<T, K extends string | number | symbol> = T extends any ? Omit<T, K> : never;
@@ -1,7 +0,0 @@
1
- import type { AuthConfig, FetchRequest, HTTPMethod } from "../definitions/open-api";
2
- import type { OpenAPIAgentDefinition } from "../open-api-agent";
3
- export declare function formatOpenAPIRequest(api: {
4
- url: string;
5
- method: HTTPMethod;
6
- auth?: AuthConfig;
7
- }, inputs: OpenAPIAgentDefinition["inputs"], input: Record<string, any>): Promise<FetchRequest>;
@@ -1,37 +0,0 @@
1
- export type OrderedRecord<T extends {
2
- id: string;
3
- }> = Record<string, T> & {
4
- $indexes: string[];
5
- };
6
- export declare namespace OrderedRecord {
7
- function iterator<T extends {
8
- id: string;
9
- }>(record?: OrderedRecord<T>): IterableIterator<T>;
10
- function map<O, T extends {
11
- id: string;
12
- }>(record: OrderedRecord<T> | undefined, fn: (value: T, index: number) => O): O[];
13
- function toArray<T extends {
14
- id: string;
15
- }>(record: OrderedRecord<T> | undefined): T[];
16
- function fromArray<T extends {
17
- id: string;
18
- }>(array?: T[]): OrderedRecord<T>;
19
- function find<T extends {
20
- id: string;
21
- }>(record: OrderedRecord<T> | undefined, predicate: (value: T, index: number) => boolean): T | undefined;
22
- function filter<T extends {
23
- id: string;
24
- }>(record: OrderedRecord<T> | undefined, predicate: (value: T, index: number) => boolean): T[];
25
- function at<T extends {
26
- id: string;
27
- }>(record: OrderedRecord<T> | undefined, index: number): T | undefined;
28
- function push<T extends {
29
- id: string;
30
- }>(record: OrderedRecord<T>, ...items: T[]): OrderedRecord<T>;
31
- function merge<T extends {
32
- id: string;
33
- }>(...records: OrderedRecord<T>[]): OrderedRecord<T>;
34
- function pushOrUpdate<T extends {
35
- id: string;
36
- }>(record: OrderedRecord<T>, ...items: T[]): OrderedRecord<T>;
37
- }
@@ -1,3 +0,0 @@
1
- export type DeepPartial<T> = T extends object ? {
2
- [P in keyof T]?: DeepPartial<T[P]>;
3
- } : T;
@@ -1,5 +0,0 @@
1
- import type { Runnable, RunnableInput, RunnableOutput, RunnableResponseStream } from "../runnable";
2
- import type { UnionToIntersection } from "./union";
3
- export type ExtractRunnableInputType<T> = T extends Runnable<infer I, RunnableOutput> ? I : never;
4
- export type ExtractRunnableOutputType<T> = T extends Runnable<RunnableInput, infer O> ? Exclude<O, RunnableResponseStream<unknown>> : never;
5
- export type ExtractRunnableInputTypeIntersection<T> = UnionToIntersection<ExtractRunnableInputType<T>, Record<string, unknown>>;
@@ -1,20 +0,0 @@
1
- import { type RunnableResponse, type RunnableResponseChunk, type RunnableResponseStream } from "../runnable";
2
- export declare function objectToRunnableResponseStream<T extends {
3
- [key: string]: any;
4
- }>(obj: T): RunnableResponseStream<T>;
5
- export declare function runnableResponseStreamToObject<T extends {
6
- [key: string]: any;
7
- }>(stream: RunnableResponseStream<T> | AsyncGenerator<RunnableResponseChunk<T>>): Promise<T>;
8
- /**
9
- * Extracts the outputs from a runnable output stream and run the
10
- * resolve function on the result before the stream closes. It can be
11
- * used to update the memories of an agent.
12
- * @param output The runnable output stream or object
13
- * @param resolve The function to run on the result
14
- * @returns The runnable output stream or object
15
- */
16
- export declare function extractOutputsFromRunnableOutput<T extends {
17
- [key: string]: any;
18
- }>(output: RunnableResponse<T> | AsyncGenerator<RunnableResponseChunk<T>>, resolve: (result: T) => Promise<void> | void): Promise<RunnableResponse<T>>;
19
- export declare function asyncGeneratorToReadableStream<T>(generator: AsyncGenerator<T>): ReadableStream<T>;
20
- export declare function isAsyncGenerator<T extends AsyncGenerator>(value: any): value is T;
@@ -1,3 +0,0 @@
1
- import type { RunnableOutputType } from "../runnable";
2
- import { OrderedRecord } from "./ordered-map";
3
- export declare function outputsToJsonSchema(outputs: OrderedRecord<RunnableOutputType>): object;
@@ -1 +0,0 @@
1
- export type UnionToIntersection<U, O = any> = (U extends any ? (arg: U) => void : never) extends (arg: infer I) => void ? I extends O ? I : never : never;
@@ -1,96 +0,0 @@
1
- import type { Context, ContextState } from "./context";
2
- import type { DataSchema } from "./definitions/data-schema";
3
- import type { AgentMemory, CreateRunnableMemory } from "./definitions/memory";
4
- import type { AgentPreload, BindAgentInputs, BoundAgent, PreloadCreator } from "./definitions/preload";
5
- import type { MemorableSearchOutput, MemoryItemWithScore, MemoryMessage } from "./memorable";
6
- import { type RunOptions, Runnable, type RunnableDefinition, type RunnableInput, type RunnableOutput, type RunnableResponse, type RunnableResponseChunk, type RunnableResponseStream } from "./runnable";
7
- import { OrderedRecord } from "./utils";
8
- import type { ExtractRunnableOutputType } from "./utils/runnable-type";
9
- export type AgentPreloads = Record<string, unknown>;
10
- export type AgentMemories = Record<string, MemoryItemWithScore[]>;
11
- export declare abstract class Agent<I extends RunnableInput = RunnableInput, O extends RunnableOutput = RunnableOutput, State extends ContextState = ContextState, Preloads extends AgentPreloads = AgentPreloads, Memories extends AgentMemories = AgentMemories> extends Runnable<I, O, State> {
12
- definition: AgentDefinition;
13
- context?: Context<State> | undefined;
14
- constructor(definition: AgentDefinition, context?: Context<State> | undefined);
15
- private getMemoryQuery;
16
- /**
17
- * Load memories that are defined in the agent definition.
18
- * @param input The agent input.
19
- * @param context The AIGNE context.
20
- * @returns A dictionary of memories, where the key is the memory id or name and the value is an array of memory items.
21
- */
22
- protected loadMemories(input: I): Promise<Memories>;
23
- /**
24
- * Update memories by user messages and assistant responses.
25
- * @param messages Messages to be added to memories.
26
- */
27
- protected updateMemories(messages: MemoryMessage[]): Promise<void>;
28
- protected loadPreloads(input: I): Promise<Preloads>;
29
- run(input: I, options: RunOptions & {
30
- stream: true;
31
- }): Promise<RunnableResponseStream<O>>;
32
- run(input: I, options?: RunOptions & {
33
- stream?: false;
34
- }): Promise<O>;
35
- private addHistory;
36
- /**
37
- * Hook that is called before the agent result is returned.
38
- * @param _result The agent result.
39
- */
40
- protected onResult(_result: O): Promise<void>;
41
- abstract process(input: AgentProcessInput<I, Preloads, Memories>, options: AgentProcessOptions): Promise<RunnableResponse<O> | AsyncGenerator<RunnableResponseChunk<O>, void>> | AsyncGenerator<RunnableResponseChunk<O>, void>;
42
- /**
43
- * Bind some inputs to the agent, used for process of `PipelineAgent` or case of `LLMDecisionAgent`.
44
- * @param options The bind options.
45
- * @returns The bound agent.
46
- */
47
- bind<Input extends BindAgentInputs<Record<string, never>, typeof this>>(options: {
48
- description?: string;
49
- input?: Input;
50
- }): BoundAgent<Record<string, never>, typeof this, Readonly<Input>>;
51
- }
52
- export type AgentProcessOptions<Preloads extends AgentPreloads = AgentPreloads, Memories extends AgentMemories = AgentMemories> = {
53
- preloads: Preloads;
54
- memories: Memories;
55
- };
56
- export type AgentProcessInput<I extends RunnableInput, Preloads extends AgentPreloads, Memories extends AgentMemories> = I & Preloads & Memories;
57
- export interface AgentDefinition extends RunnableDefinition {
58
- preloads?: OrderedRecord<AgentPreload>;
59
- memories?: OrderedRecord<AgentMemory>;
60
- }
61
- export type CreateAgentInputSchema = Record<string, DataSchema>;
62
- export type CreateAgentOutputSchema<Extra extends Record<string, unknown> = Record<string, unknown>> = Record<string, DataSchema & Extra>;
63
- export type CreateAgentPreloadsSchema<I extends CreateAgentInputSchema> = Record<string, PreloadCreator<I>>;
64
- export type CreateAgentPreloadsType<I extends CreateAgentInputSchema, Preloads extends CreateAgentPreloadsSchema<I>> = {
65
- [name in keyof Preloads]: ExtractRunnableOutputType<ReturnType<Preloads[name]>["runnable"]>;
66
- };
67
- export type CreateAgentMemoriesSchema<I extends CreateAgentInputSchema, Extras extends Record<string, unknown> = Record<string, unknown>> = Record<string, CreateRunnableMemory<I> & Extras>;
68
- export type CreateAgentMemoriesType<I extends CreateAgentInputSchema, Memories extends CreateAgentMemoriesSchema<I, Record<string, unknown>>> = {
69
- [key in keyof Memories]: MemorableSearchOutput<Memories[key]["memory"]>;
70
- };
71
- /**
72
- * Common options to create Agent.
73
- */
74
- export interface CreateAgentOptions<I extends CreateAgentInputSchema, O extends CreateAgentOutputSchema, State extends ContextState, Preloads extends CreateAgentPreloadsSchema<I>, Memories extends CreateAgentMemoriesSchema<I, Record<string, unknown>>> {
75
- context?: Context<State>;
76
- /**
77
- * Agent name, used to identify the agent.
78
- */
79
- name?: string;
80
- /**
81
- * Input variables for this agent.
82
- */
83
- inputs: I;
84
- /**
85
- * Output variables for this agent.
86
- */
87
- outputs: O;
88
- /**
89
- * Preload runnables before running this agent. the preloaded data are available in the agent as input variables.
90
- */
91
- preloads?: Preloads;
92
- /**
93
- * Memories to be used in this agent.
94
- */
95
- memories?: Memories;
96
- }
package/lib/esm/agent.js DELETED
@@ -1,161 +0,0 @@
1
- import { Runnable, } from "./runnable";
2
- import { OrderedRecord, extractOutputsFromRunnableOutput, isAsyncGenerator, isNonNullable, objectToRunnableResponseStream, renderMessage, runnableResponseStreamToObject, } from "./utils";
3
- import { logger } from "./utils/logger";
4
- export class Agent extends Runnable {
5
- definition;
6
- context;
7
- constructor(definition, context) {
8
- super(definition, context);
9
- this.definition = definition;
10
- this.context = context;
11
- }
12
- async getMemoryQuery(input, query) {
13
- if (query?.from === "variable") {
14
- const i = OrderedRecord.find(this.definition.inputs, (i) => i.id === query.fromVariableId);
15
- if (!i)
16
- throw new Error(`Input variable ${query.fromVariableId} not found`);
17
- const value = i.name ? input[i.name] : undefined;
18
- return renderMessage("{{value}}", { value });
19
- }
20
- return Object.entries(input)
21
- .map(([key, value]) => `${key} ${value}`)
22
- .join("\n");
23
- }
24
- /**
25
- * Load memories that are defined in the agent definition.
26
- * @param input The agent input.
27
- * @param context The AIGNE context.
28
- * @returns A dictionary of memories, where the key is the memory id or name and the value is an array of memory items.
29
- */
30
- async loadMemories(input) {
31
- const { definition: { memories }, context, } = this;
32
- if (!memories?.$indexes.length)
33
- return {};
34
- if (!context)
35
- throw new Error("Context is required");
36
- const { userId, sessionId } = context.state;
37
- return Object.fromEntries((await Promise.all(OrderedRecord.map(memories, async ({ id, name, memory, query, options }) => {
38
- if (!name || !memory)
39
- return null;
40
- const q = await this.getMemoryQuery(input, query);
41
- const { results: memories } = await memory.search(q, {
42
- ...options,
43
- userId,
44
- sessionId,
45
- });
46
- return [
47
- [id, memories],
48
- [name, memories],
49
- ];
50
- })))
51
- .flat()
52
- .filter(isNonNullable));
53
- }
54
- /**
55
- * Update memories by user messages and assistant responses.
56
- * @param messages Messages to be added to memories.
57
- */
58
- async updateMemories(messages) {
59
- const { context, definition: { memories }, } = this;
60
- if (!context)
61
- throw new Error("Context is required");
62
- const { userId, sessionId } = context.state ?? {};
63
- await Promise.all(OrderedRecord.map(memories, async ({ memory }) => {
64
- if (!memory) {
65
- logger.warn(`Memory is not defined in agent ${this.name || this.id}`);
66
- return;
67
- }
68
- await memory.add(messages, { userId, sessionId });
69
- }));
70
- }
71
- async loadPreloads(input) {
72
- const { context, definition: { preloads }, } = this;
73
- if (!preloads?.$indexes.length)
74
- return {};
75
- if (!context)
76
- throw new Error("Context is required");
77
- return Object.fromEntries(await Promise.all(OrderedRecord.map(preloads, async (preload) => {
78
- if (!preload.runnable?.id)
79
- throw new Error("Runnable id in preload is required");
80
- const runnable = await context.resolve(preload.runnable.id);
81
- const runnableInput = Object.fromEntries(OrderedRecord.map(runnable.definition.inputs, (i) => {
82
- if (!i.name)
83
- return null;
84
- const bind = preload.input?.[i.id];
85
- if (!bind)
86
- return null;
87
- if (bind.from !== "input")
88
- throw new Error(`Unsupported bind from ${bind.from}`);
89
- const from = this.definition.inputs[bind.fromInput];
90
- if (!from)
91
- throw new Error(`Input ${bind.fromInput} not found`);
92
- if (!from.name)
93
- return null;
94
- const v = input[from.name];
95
- return [i.name, v];
96
- }).filter(isNonNullable));
97
- const result = await runnable.run(runnableInput);
98
- return [preload.id, result];
99
- })));
100
- }
101
- async run(input, options) {
102
- logger.debug(`AIGNE core: run agent ${this.name || this.id} with`, {
103
- input,
104
- });
105
- const preloads = await this.loadPreloads(input);
106
- const memories = await this.loadMemories(input);
107
- const processResult = await this.process({ ...input, ...preloads, ...memories }, { preloads, memories });
108
- if (options?.stream) {
109
- const stream = processResult instanceof ReadableStream ||
110
- isAsyncGenerator(processResult)
111
- ? processResult
112
- : objectToRunnableResponseStream(processResult);
113
- return extractOutputsFromRunnableOutput(stream, async (result) => {
114
- // TODO: validate result against outputs schema
115
- logger.debug(`AIGNE core: run agent ${this.name || this.id} success`, {
116
- result,
117
- });
118
- await this.addHistory({ input, output: result });
119
- await this.onResult(result);
120
- });
121
- }
122
- const result = processResult instanceof ReadableStream
123
- ? await runnableResponseStreamToObject(processResult)
124
- : Symbol.asyncIterator in processResult
125
- ? await runnableResponseStreamToObject(processResult)
126
- : processResult;
127
- logger.debug(`AIGNE core: run agent ${this.name || this.id} success`, {
128
- result,
129
- });
130
- // TODO: validate result against outputs schema
131
- await this.addHistory({ input, output: result });
132
- await this.onResult(result);
133
- return result;
134
- }
135
- async addHistory({ input, output }) {
136
- await this.context?.historyManager?.create({ input, output }, {
137
- userId: this.context?.state.userId,
138
- sessionId: this.context?.state.sessionId,
139
- agentId: this.id,
140
- });
141
- }
142
- /**
143
- * Hook that is called before the agent result is returned.
144
- * @param _result The agent result.
145
- */
146
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
147
- async onResult(_result) {
148
- // Override this method to perform additional operations before the result is returned
149
- }
150
- /**
151
- * Bind some inputs to the agent, used for process of `PipelineAgent` or case of `LLMDecisionAgent`.
152
- * @param options The bind options.
153
- * @returns The bound agent.
154
- */
155
- bind(options) {
156
- return {
157
- ...options,
158
- runnable: this,
159
- };
160
- }
161
- }