@agentica/core 0.15.6 → 0.16.0

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 (195) hide show
  1. package/lib/Agentica.d.ts +21 -21
  2. package/lib/Agentica.js +27 -27
  3. package/lib/Agentica.js.map +1 -1
  4. package/lib/MicroAgentica.d.ts +115 -0
  5. package/lib/MicroAgentica.js +279 -0
  6. package/lib/MicroAgentica.js.map +1 -0
  7. package/lib/constants/AgenticaDefaultPrompt.d.ts +2 -1
  8. package/lib/constants/AgenticaDefaultPrompt.js +7 -5
  9. package/lib/constants/AgenticaDefaultPrompt.js.map +1 -1
  10. package/lib/context/AgenticaCancelPrompt.d.ts +3 -3
  11. package/lib/context/AgenticaContext.d.ts +12 -12
  12. package/lib/context/AgenticaOperationCollection.d.ts +1 -1
  13. package/lib/context/MicroAgenticaContext.d.ts +75 -0
  14. package/lib/{prompts/AgenticaCancelPrompt.js → context/MicroAgenticaContext.js} +1 -1
  15. package/lib/context/MicroAgenticaContext.js.map +1 -0
  16. package/lib/context/internal/AgenticaOperationComposer.d.ts +2 -1
  17. package/lib/context/internal/AgenticaOperationComposer.js +3 -2
  18. package/lib/context/internal/AgenticaOperationComposer.js.map +1 -1
  19. package/lib/context/internal/isAgenticaContext.d.ts +1 -0
  20. package/lib/context/internal/isAgenticaContext.js +10 -0
  21. package/lib/context/internal/isAgenticaContext.js.map +1 -0
  22. package/lib/events/AgenticaDescribeEvent.d.ts +4 -4
  23. package/lib/events/AgenticaEvent.d.ts +1 -0
  24. package/lib/events/AgenticaExecuteEvent.d.ts +5 -5
  25. package/lib/events/AgenticaSelectEvent.d.ts +2 -2
  26. package/lib/events/AgenticaTextEvent.d.ts +2 -2
  27. package/lib/events/MicroAgenticaEvent.d.ts +32 -0
  28. package/lib/{prompts/AgenticaTextPrompt.js → events/MicroAgenticaEvent.js} +1 -1
  29. package/lib/events/MicroAgenticaEvent.js.map +1 -0
  30. package/lib/factory/events.d.ts +2 -2
  31. package/lib/factory/events.js +5 -5
  32. package/lib/factory/events.js.map +1 -1
  33. package/lib/factory/histories.d.ts +33 -0
  34. package/lib/factory/{prompts.js → histories.js} +13 -13
  35. package/lib/factory/histories.js.map +1 -0
  36. package/lib/factory/index.d.ts +1 -1
  37. package/lib/factory/index.js +1 -1
  38. package/lib/factory/index.js.map +1 -1
  39. package/lib/functional/assertHttpLlmApplication.js +577 -387
  40. package/lib/functional/assertHttpLlmApplication.js.map +1 -1
  41. package/lib/functional/validateHttpLlmApplication.js +500 -348
  42. package/lib/functional/validateHttpLlmApplication.js.map +1 -1
  43. package/lib/histories/AgenticaCancelHistory.d.ts +8 -0
  44. package/lib/{prompts/AgenticaExecutePrompt.js → histories/AgenticaCancelHistory.js} +1 -1
  45. package/lib/histories/AgenticaCancelHistory.js.map +1 -0
  46. package/lib/histories/AgenticaDescribeHistory.d.ts +16 -0
  47. package/lib/histories/AgenticaDescribeHistory.js +3 -0
  48. package/lib/histories/AgenticaDescribeHistory.js.map +1 -0
  49. package/lib/{prompts/AgenticaExecutePrompt.d.ts → histories/AgenticaExecuteHistory.d.ts} +5 -5
  50. package/lib/{prompts/AgenticaDescribePrompt.js → histories/AgenticaExecuteHistory.js} +1 -1
  51. package/lib/histories/AgenticaExecuteHistory.js.map +1 -0
  52. package/lib/histories/AgenticaHistory.d.ts +17 -0
  53. package/lib/{prompts/AgenticaPrompt.js → histories/AgenticaHistory.js} +1 -1
  54. package/lib/histories/AgenticaHistory.js.map +1 -0
  55. package/lib/{prompts/AgenticaPromptBase.d.ts → histories/AgenticaHistoryBase.d.ts} +4 -4
  56. package/lib/{json/IAgenticaPromptJson.js → histories/AgenticaHistoryBase.js} +1 -1
  57. package/lib/histories/AgenticaHistoryBase.js.map +1 -0
  58. package/lib/histories/AgenticaSelectHistory.d.ts +8 -0
  59. package/lib/histories/AgenticaSelectHistory.js +3 -0
  60. package/lib/histories/AgenticaSelectHistory.js.map +1 -0
  61. package/lib/histories/AgenticaTextHistory.d.ts +6 -0
  62. package/lib/{prompts/AgenticaPromptBase.js → histories/AgenticaTextHistory.js} +1 -1
  63. package/lib/histories/AgenticaTextHistory.js.map +1 -0
  64. package/lib/histories/MicroAgenticaHistory.d.ts +13 -0
  65. package/lib/histories/MicroAgenticaHistory.js +3 -0
  66. package/lib/histories/MicroAgenticaHistory.js.map +1 -0
  67. package/lib/index.d.ts +12 -7
  68. package/lib/index.js +12 -7
  69. package/lib/index.js.map +1 -1
  70. package/lib/index.mjs +1393 -902
  71. package/lib/index.mjs.map +1 -1
  72. package/lib/json/IAgenticaEventJson.d.ts +6 -5
  73. package/lib/json/{IAgenticaPromptJson.d.ts → IAgenticaHistoryJson.d.ts} +8 -8
  74. package/lib/json/IAgenticaHistoryJson.js +3 -0
  75. package/lib/json/IAgenticaHistoryJson.js.map +1 -0
  76. package/lib/json/IAgenticaOperationSelectionJson.d.ts +7 -1
  77. package/lib/json/IMicroAgenticaEventJson.d.ts +13 -0
  78. package/lib/json/IMicroAgenticaEventJson.js +3 -0
  79. package/lib/json/IMicroAgenticaEventJson.js.map +1 -0
  80. package/lib/json/IMicroAgenticaHistoryJson.d.ts +19 -0
  81. package/lib/json/IMicroAgenticaHistoryJson.js +3 -0
  82. package/lib/json/IMicroAgenticaHistoryJson.js.map +1 -0
  83. package/lib/orchestrate/call.d.ts +4 -2
  84. package/lib/orchestrate/call.js +50 -41
  85. package/lib/orchestrate/call.js.map +1 -1
  86. package/lib/orchestrate/cancel.js +4 -4
  87. package/lib/orchestrate/cancel.js.map +1 -1
  88. package/lib/orchestrate/describe.d.ts +4 -3
  89. package/lib/orchestrate/describe.js +3 -3
  90. package/lib/orchestrate/describe.js.map +1 -1
  91. package/lib/orchestrate/execute.d.ts +2 -2
  92. package/lib/orchestrate/execute.js +1 -1
  93. package/lib/orchestrate/execute.js.map +1 -1
  94. package/lib/orchestrate/initialize.d.ts +2 -2
  95. package/lib/orchestrate/initialize.js +3 -3
  96. package/lib/orchestrate/initialize.js.map +1 -1
  97. package/lib/orchestrate/internal/selectFunction.d.ts +1 -5
  98. package/lib/orchestrate/internal/selectFunction.js +3 -0
  99. package/lib/orchestrate/internal/selectFunction.js.map +1 -1
  100. package/lib/orchestrate/select.d.ts +2 -2
  101. package/lib/orchestrate/select.js +5 -5
  102. package/lib/orchestrate/select.js.map +1 -1
  103. package/lib/structures/IAgenticaConfig.d.ts +6 -5
  104. package/lib/structures/IAgenticaController.d.ts +1 -1
  105. package/lib/structures/IAgenticaExecutor.d.ts +11 -9
  106. package/lib/structures/IAgenticaProps.d.ts +3 -3
  107. package/lib/structures/IAgenticaSystemPrompt.d.ts +13 -13
  108. package/lib/structures/IAgenticaVendor.d.ts +1 -1
  109. package/lib/structures/IMicroAgenticaConfig.d.ts +74 -0
  110. package/lib/structures/IMicroAgenticaConfig.js +3 -0
  111. package/lib/structures/IMicroAgenticaConfig.js.map +1 -0
  112. package/lib/structures/IMicroAgenticaExecutor.d.ts +57 -0
  113. package/lib/structures/IMicroAgenticaExecutor.js +3 -0
  114. package/lib/structures/IMicroAgenticaExecutor.js.map +1 -0
  115. package/lib/structures/IMicroAgenticaProps.d.ts +63 -0
  116. package/lib/structures/IMicroAgenticaProps.js +3 -0
  117. package/lib/structures/IMicroAgenticaProps.js.map +1 -0
  118. package/lib/structures/IMicroAgenticaSystemPrompt.d.ts +66 -0
  119. package/lib/structures/IMicroAgenticaSystemPrompt.js +3 -0
  120. package/lib/structures/IMicroAgenticaSystemPrompt.js.map +1 -0
  121. package/lib/transformers/AgenticaPromptTransformer.d.ts +19 -19
  122. package/lib/transformers/AgenticaPromptTransformer.js +27 -27
  123. package/lib/transformers/AgenticaPromptTransformer.js.map +1 -1
  124. package/package.json +7 -7
  125. package/src/Agentica.ts +34 -34
  126. package/src/MicroAgentica.ts +337 -0
  127. package/src/constants/AgenticaDefaultPrompt.ts +7 -3
  128. package/src/context/AgenticaCancelPrompt.ts +3 -3
  129. package/src/context/AgenticaContext.ts +12 -12
  130. package/src/context/AgenticaOperationCollection.ts +1 -1
  131. package/src/context/MicroAgenticaContext.ts +95 -0
  132. package/src/context/internal/AgenticaOperationComposer.ts +6 -3
  133. package/src/context/internal/isAgenticaContext.ts +13 -0
  134. package/src/events/AgenticaDescribeEvent.ts +4 -4
  135. package/src/events/AgenticaEvent.ts +6 -0
  136. package/src/events/AgenticaExecuteEvent.ts +5 -5
  137. package/src/events/AgenticaSelectEvent.ts +2 -2
  138. package/src/events/AgenticaTextEvent.ts +2 -2
  139. package/src/events/MicroAgenticaEvent.ts +41 -0
  140. package/src/factory/events.ts +8 -8
  141. package/src/factory/{prompts.ts → histories.ts} +18 -18
  142. package/src/factory/index.ts +1 -1
  143. package/src/histories/AgenticaCancelHistory.ts +13 -0
  144. package/src/histories/AgenticaDescribeHistory.ts +22 -0
  145. package/src/{prompts/AgenticaExecutePrompt.ts → histories/AgenticaExecuteHistory.ts} +7 -7
  146. package/src/histories/AgenticaHistory.ts +25 -0
  147. package/src/{prompts/AgenticaPromptBase.ts → histories/AgenticaHistoryBase.ts} +4 -4
  148. package/src/histories/AgenticaSelectHistory.ts +13 -0
  149. package/src/histories/AgenticaTextHistory.ts +10 -0
  150. package/src/histories/MicroAgenticaHistory.ts +18 -0
  151. package/src/index.ts +18 -15
  152. package/src/json/IAgenticaEventJson.ts +6 -5
  153. package/src/json/{IAgenticaPromptJson.ts → IAgenticaHistoryJson.ts} +13 -13
  154. package/src/json/IAgenticaOperationSelectionJson.ts +8 -1
  155. package/src/json/IMicroAgenticaEventJson.ts +21 -0
  156. package/src/json/IMicroAgenticaHistoryJson.ts +23 -0
  157. package/src/orchestrate/call.ts +83 -59
  158. package/src/orchestrate/cancel.ts +4 -4
  159. package/src/orchestrate/describe.ts +11 -7
  160. package/src/orchestrate/execute.ts +7 -7
  161. package/src/orchestrate/initialize.ts +6 -6
  162. package/src/orchestrate/internal/selectFunction.ts +3 -0
  163. package/src/orchestrate/select.ts +13 -13
  164. package/src/structures/IAgenticaConfig.ts +6 -5
  165. package/src/structures/IAgenticaController.ts +1 -1
  166. package/src/structures/IAgenticaExecutor.ts +12 -10
  167. package/src/structures/IAgenticaProps.ts +3 -3
  168. package/src/structures/IAgenticaSystemPrompt.ts +13 -13
  169. package/src/structures/IAgenticaVendor.ts +1 -1
  170. package/src/structures/IMicroAgenticaConfig.ts +82 -0
  171. package/src/structures/IMicroAgenticaExecutor.ts +63 -0
  172. package/src/structures/IMicroAgenticaProps.ts +70 -0
  173. package/src/structures/IMicroAgenticaSystemPrompt.ts +71 -0
  174. package/src/transformers/AgenticaPromptTransformer.ts +46 -46
  175. package/lib/factory/prompts.d.ts +0 -33
  176. package/lib/factory/prompts.js.map +0 -1
  177. package/lib/json/IAgenticaPromptJson.js.map +0 -1
  178. package/lib/prompts/AgenticaCancelPrompt.d.ts +0 -8
  179. package/lib/prompts/AgenticaCancelPrompt.js.map +0 -1
  180. package/lib/prompts/AgenticaDescribePrompt.d.ts +0 -16
  181. package/lib/prompts/AgenticaDescribePrompt.js.map +0 -1
  182. package/lib/prompts/AgenticaExecutePrompt.js.map +0 -1
  183. package/lib/prompts/AgenticaPrompt.d.ts +0 -17
  184. package/lib/prompts/AgenticaPrompt.js.map +0 -1
  185. package/lib/prompts/AgenticaPromptBase.js.map +0 -1
  186. package/lib/prompts/AgenticaSelectPrompt.d.ts +0 -8
  187. package/lib/prompts/AgenticaSelectPrompt.js +0 -3
  188. package/lib/prompts/AgenticaSelectPrompt.js.map +0 -1
  189. package/lib/prompts/AgenticaTextPrompt.d.ts +0 -6
  190. package/lib/prompts/AgenticaTextPrompt.js.map +0 -1
  191. package/src/prompts/AgenticaCancelPrompt.ts +0 -13
  192. package/src/prompts/AgenticaDescribePrompt.ts +0 -22
  193. package/src/prompts/AgenticaPrompt.ts +0 -25
  194. package/src/prompts/AgenticaSelectPrompt.ts +0 -13
  195. package/src/prompts/AgenticaTextPrompt.ts +0 -10
@@ -1,6 +1,7 @@
1
1
  import type { ILlmSchema } from "@samchon/openapi";
2
2
  import type { IAgenticaConfig } from "../structures/IAgenticaConfig";
3
- export declare function write<Model extends ILlmSchema.Model>(config?: IAgenticaConfig<Model>): string;
3
+ import type { IMicroAgenticaConfig } from "../structures/IMicroAgenticaConfig";
4
+ export declare function write<Model extends ILlmSchema.Model>(config?: IAgenticaConfig<Model> | IMicroAgenticaConfig<Model>): string;
4
5
  export declare const AgenticaDefaultPrompt: {
5
6
  write: typeof write;
6
7
  };
@@ -33,18 +33,20 @@ const getLocale = new Singleton_1.Singleton(() => {
33
33
  });
34
34
  const getTimezone = new Singleton_1.Singleton(() => Intl.DateTimeFormat().resolvedOptions().timeZone);
35
35
  function write(config) {
36
- var _a, _b, _c, _d;
36
+ var _a, _b, _c;
37
37
  if (((_a = config === null || config === void 0 ? void 0 : config.systemPrompt) === null || _a === void 0 ? void 0 : _a.common) !== undefined) {
38
- return (_b = config === null || config === void 0 ? void 0 : config.systemPrompt) === null || _b === void 0 ? void 0 : _b.common(config);
38
+ return config.systemPrompt.common(config);
39
39
  }
40
- const locale = (_c = config === null || config === void 0 ? void 0 : config.locale) !== null && _c !== void 0 ? _c : getLocale.get();
41
- const timezone = (_d = config === null || config === void 0 ? void 0 : config.timezone) !== null && _d !== void 0 ? _d : getTimezone.get();
40
+ const locale = (_b = config === null || config === void 0 ? void 0 : config.locale) !== null && _b !== void 0 ? _b : getLocale.get();
41
+ const timezone = (_c = config === null || config === void 0 ? void 0 : config.timezone) !== null && _c !== void 0 ? _c : getTimezone.get();
42
42
  return AgenticaSystemPrompt_1.AgenticaSystemPrompt.COMMON
43
43
  // intended code
44
44
  // eslint-disable-next-line no-template-curly-in-string
45
45
  .replace("${locale}", locale)
46
46
  // eslint-disable-next-line no-template-curly-in-string
47
- .replace("${timezone}", timezone);
47
+ .replace("${timezone}", timezone)
48
+ // eslint-disable-next-line no-template-curly-in-string
49
+ .replace("${datetime}", new Date().toISOString());
48
50
  }
49
51
  exports.AgenticaDefaultPrompt = {
50
52
  write,
@@ -1 +1 @@
1
- {"version":3,"file":"Agentic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8 +1,8 @@
1
1
  import type { ILlmSchema } from "@samchon/openapi";
2
- import type { IAgenticaPromptJson } from "../json/IAgenticaPromptJson";
3
- import type { AgenticaPromptBase } from "../prompts/AgenticaPromptBase";
2
+ import type { AgenticaHistoryBase } from "../histories/AgenticaHistoryBase";
3
+ import type { IAgenticaHistoryJson } from "../json/IAgenticaHistoryJson";
4
4
  import type { AgenticaOperationSelection } from "./AgenticaOperationSelection";
5
- export interface AgenticaCancelPrompt<Model extends ILlmSchema.Model> extends AgenticaPromptBase<"cancel", IAgenticaPromptJson.ICancel> {
5
+ export interface AgenticaCancelPrompt<Model extends ILlmSchema.Model> extends AgenticaHistoryBase<"cancel", IAgenticaHistoryJson.ICancel> {
6
6
  id: string;
7
7
  selections: AgenticaOperationSelection<Model>[];
8
8
  }
@@ -2,26 +2,26 @@ import type { ILlmSchema } from "@samchon/openapi";
2
2
  import type OpenAI from "openai";
3
3
  import type { AgenticaEvent } from "../events/AgenticaEvent";
4
4
  import type { AgenticaEventSource } from "../events/AgenticaEventSource";
5
- import type { AgenticaPrompt } from "../prompts/AgenticaPrompt";
6
- import type { AgenticaTextPrompt } from "../prompts/AgenticaTextPrompt";
5
+ import type { AgenticaHistory } from "../histories/AgenticaHistory";
6
+ import type { AgenticaTextHistory } from "../histories/AgenticaTextHistory";
7
7
  import type { IAgenticaConfig } from "../structures/IAgenticaConfig";
8
8
  import type { AgenticaOperationCollection } from "./AgenticaOperationCollection";
9
9
  import type { AgenticaOperationSelection } from "./AgenticaOperationSelection";
10
10
  /**
11
- * Context of the Nestia A.I. agent.
11
+ * Context of the Agentic AI agent.
12
12
  *
13
- * `IAgenticaContext` is a structure defining the context of the
13
+ * `AgenticaContext` is a structure defining the context of the
14
14
  * internal agents composing the {@link Agentica}, like function
15
15
  * selector, executor, and describer, and so on. For example, if an
16
16
  * agent has been configured to utilize the OpenAI, the context will
17
17
  * be delivered to the below components.
18
18
  *
19
- * - {@link ChatGptAgent}
20
- * - {@link ChatGptInitializeFunctionAgent}
21
- * - {@link ChatGptSelectFunctionAgent}
22
- * - {@link ChatGptExecuteFunctionAgent}
23
- * - {@link ChatGptDescribeFunctionAgent}
24
- * - {@link ChatGptCancelFunctionAgent}
19
+ * - {@link orchestrate.execute}
20
+ * - {@link orchestrate.initialize}
21
+ * - {@link orchestrate.select}
22
+ * - {@link orchestrate.call}
23
+ * - {@link orchestrate.describe}
24
+ * - {@link orchestrate.cancel}
25
25
  *
26
26
  * Also, as its name is context, it contains every information that
27
27
  * is required to interact with the AI vendor like OpenAI. It
@@ -59,7 +59,7 @@ export interface AgenticaContext<Model extends ILlmSchema.Model> {
59
59
  /**
60
60
  * Prompt histories.
61
61
  */
62
- histories: AgenticaPrompt<Model>[];
62
+ histories: AgenticaHistory<Model>[];
63
63
  /**
64
64
  * Stacked operations.
65
65
  *
@@ -72,7 +72,7 @@ export interface AgenticaContext<Model extends ILlmSchema.Model> {
72
72
  * Text conversation written the by user through the
73
73
  * {@link Agentica.conversate} function.
74
74
  */
75
- prompt: AgenticaTextPrompt<"user">;
75
+ prompt: AgenticaTextHistory<"user">;
76
76
  /**
77
77
  * Whether the agent is ready.
78
78
  *
@@ -1,7 +1,7 @@
1
1
  import type { ILlmSchema } from "@samchon/openapi";
2
2
  import type { AgenticaOperation } from "./AgenticaOperation";
3
3
  /**
4
- * Collection of operations used in the Nestia Agent.
4
+ * Collection of operations used in the Agentica Agent.
5
5
  *
6
6
  * `IAgenticaOperationCollection` is an interface type representing
7
7
  * a collection of operations for several purposes used in the
@@ -0,0 +1,75 @@
1
+ import type { ILlmSchema } from "@samchon/openapi";
2
+ import type OpenAI from "openai";
3
+ import type { MicroAgenticaEvent } from "../events/MicroAgenticaEvent";
4
+ import type { AgenticaTextHistory } from "../histories/AgenticaTextHistory";
5
+ import type { MicroAgenticaHistory } from "../histories/MicroAgenticaHistory";
6
+ import type { IMicroAgenticaConfig } from "../structures/IMicroAgenticaConfig";
7
+ import type { AgenticaOperationCollection } from "./AgenticaOperationCollection";
8
+ /**
9
+ * Context of the Micro Agentic AI agent.
10
+ *
11
+ * `MicroAgenticaContext` is a structure defining the context of the
12
+ * internal agents composing the {@link MicroAgentica}.
13
+ *
14
+ * It contains every information that is required to interact with
15
+ * the AI vendor like OpenAI. It contains every operations for LLM
16
+ * function calling, and configuration used for the agent construction.
17
+ * And it contains the prompt histories, and facade controller
18
+ * functions for interacting with the {@link MicroAgentica} like
19
+ * {@link dispatch}.
20
+ *
21
+ * In such reasons, if you're planning to customize some internal
22
+ * agents, or add new agents with new process routine, you have to
23
+ * understand this context structure. Otherwise you don't have any
24
+ * plan to customize the internal agents, this context information is
25
+ * not important for you.
26
+ *
27
+ * @author Samchon
28
+ */
29
+ export interface MicroAgenticaContext<Model extends ILlmSchema.Model> {
30
+ /**
31
+ * Collection of operations.
32
+ *
33
+ * Collection of operations from every controllers, and their
34
+ * groups composed by the divide and conquer rule for the
35
+ * efficient operation selection if configured.
36
+ */
37
+ operations: AgenticaOperationCollection<Model>;
38
+ /**
39
+ * Configuration of the agent.
40
+ *
41
+ * Configuration of the agent, that is used when constructing the
42
+ * {@link Agentica} instance.
43
+ *
44
+ * @todo Write detaily after supporting the agent customization feature
45
+ */
46
+ config: IMicroAgenticaConfig<Model> | undefined;
47
+ /**
48
+ * Prompt histories.
49
+ */
50
+ histories: MicroAgenticaHistory<Model>[];
51
+ /**
52
+ * Text prompt of the user.
53
+ *
54
+ * Text conversation written the by user through the
55
+ * {@link Agentica.conversate} function.
56
+ */
57
+ prompt: AgenticaTextHistory<"user">;
58
+ /**
59
+ * Dispatch event.
60
+ *
61
+ * Dispatch event so that the agent can be handle the event
62
+ * through the {@link Agentica.on} function.
63
+ *
64
+ * @param event Event to deliver
65
+ */
66
+ dispatch: (event: MicroAgenticaEvent<Model>) => Promise<void>;
67
+ /**
68
+ * Request to the OpenAI server.
69
+ *
70
+ * @param source The source agent of the agent
71
+ * @param body The request body to the OpenAI server
72
+ * @returns Response from the OpenAI server
73
+ */
74
+ request: (source: MicroAgenticaEvent.Source, body: Omit<OpenAI.ChatCompletionCreateParamsStreaming, "model" | "stream">) => Promise<ReadableStream<OpenAI.Chat.Completions.ChatCompletionChunk>>;
75
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=AgenticaCancelPrompt.js.map
3
+ //# sourceMappingURL=MicroAgenticaContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MicroAgenticaContext.js","sourceRoot":"","sources":["../../src/context/MicroAgenticaContext.ts"],"names":[],"mappings":""}
@@ -1,10 +1,11 @@
1
1
  import type { ILlmSchema } from "@samchon/openapi";
2
2
  import type { IAgenticaConfig } from "../../structures/IAgenticaConfig";
3
3
  import type { IAgenticaController } from "../../structures/IAgenticaController";
4
+ import type { IMicroAgenticaConfig } from "../../structures/IMicroAgenticaConfig";
4
5
  import type { AgenticaOperationCollection } from "../AgenticaOperationCollection";
5
6
  export declare function compose<Model extends ILlmSchema.Model>(props: {
6
7
  controllers: IAgenticaController<Model>[];
7
- config?: IAgenticaConfig<Model> | undefined;
8
+ config?: IAgenticaConfig<Model> | IMicroAgenticaConfig<Model> | undefined;
8
9
  }): AgenticaOperationCollection<Model>;
9
10
  export declare const AgenticaOperationComposer: {
10
11
  compose: typeof compose;
@@ -40,10 +40,11 @@ function compose(props) {
40
40
  }),
41
41
  })))
42
42
  .flat();
43
- const divided = ((_a = props.config) === null || _a === void 0 ? void 0 : _a.capacity) !== undefined && array.length > props.config.capacity
43
+ const capacity = (_a = props.config) === null || _a === void 0 ? void 0 : _a.capacity;
44
+ const divided = capacity !== undefined && array.length > capacity
44
45
  ? divide({
45
46
  array,
46
- capacity: props.config.capacity,
47
+ capacity,
47
48
  })
48
49
  : undefined;
49
50
  const flat = new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"AgenticaOperationComposer.js","sourceRoot":"","sources":["../../../src/context/internal/AgenticaOperationComposer.ts"],"names":[],"mappings":";;;AASA,0BA2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perty(exports, "__esModule", { value: true });
3
+ exports.isAgenticaContext = isAgenticaContext;
4
+ /**
5
+ * @internal
6
+ */
7
+ function isAgenticaContext(ctx) {
8
+ return typeof ctx.initialize === "function";
9
+ }
10
+ //# sourceMappingURL=isAgenticaContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isAgenticaContext.js","sourceRoot":"","sources":["../../../src/context/internal/isAgenticaContext.ts"],"names":[],"mappings":";;AAQA,8CAIC;AAPD;;GAEG;AACH,SAAgB,iBAAiB,CAC/B,GAAyD;IAEzD,OAAO,OAAQ,GAA8B,CAAC,UAAU,KAAK,UAAU,CAAC;AAC1E,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import type { ILlmSchema } from "@samchon/openapi";
2
+ import type { AgenticaDescribeHistory } from "../histories/AgenticaDescribeHistory";
3
+ import type { AgenticaExecuteHistory } from "../histories/AgenticaExecuteHistory";
2
4
  import type { IAgenticaEventJson } from "../json/IAgenticaEventJson";
3
- import type { AgenticaDescribePrompt } from "../prompts/AgenticaDescribePrompt";
4
- import type { AgenticaExecutePrompt } from "../prompts/AgenticaExecutePrompt";
5
5
  import type { AgenticaEventBase } from "./AgenticaEventBase";
6
6
  export interface AgenticaDescribeEvent<Model extends ILlmSchema.Model> extends AgenticaEventBase<"describe"> {
7
- executes: AgenticaExecutePrompt<Model>[];
7
+ executes: AgenticaExecuteHistory<Model>[];
8
8
  stream: ReadableStream<string>;
9
9
  join: () => Promise<string>;
10
10
  toJSON: () => IAgenticaEventJson.IDescribe;
11
- toPrompt: () => AgenticaDescribePrompt<Model>;
11
+ toHistory: () => AgenticaDescribeHistory<Model>;
12
12
  }
@@ -34,4 +34,5 @@ export declare namespace AgenticaEvent {
34
34
  text: AgenticaTextEvent;
35
35
  validate: AgenticaValidateEvent<Model>;
36
36
  }
37
+ type Source = "initialize" | "select" | "cancel" | "call" | "describe";
37
38
  }
@@ -1,22 +1,22 @@
1
1
  import type { IHttpResponse, ILlmSchema } from "@samchon/openapi";
2
2
  import type { AgenticaOperation } from "../context/AgenticaOperation";
3
+ import type { AgenticaExecuteHistory } from "../histories/AgenticaExecuteHistory";
3
4
  import type { IAgenticaEventJson } from "../json/IAgenticaEventJson";
4
- import type { AgenticaExecutePrompt } from "../prompts/AgenticaExecutePrompt";
5
5
  import type { AgenticaEventBase } from "./AgenticaEventBase";
6
6
  export type AgenticaExecuteEvent<Model extends ILlmSchema.Model> = AgenticaExecuteEvent.Class<Model> | AgenticaExecuteEvent.Protocol<Model>;
7
7
  export declare namespace AgenticaExecuteEvent {
8
- export interface Class<Model extends ILlmSchema.Model> extends Base<"class", AgenticaOperation.Class<Model>, AgenticaExecutePrompt.Class<Model>, unknown> {
8
+ export interface Class<Model extends ILlmSchema.Model> extends Base<"class", AgenticaOperation.Class<Model>, AgenticaExecuteHistory.Class<Model>, unknown> {
9
9
  }
10
- export interface Protocol<Model extends ILlmSchema.Model> extends Base<"http", AgenticaOperation.Http<Model>, AgenticaExecutePrompt.Http<Model>, IHttpResponse> {
10
+ export interface Protocol<Model extends ILlmSchema.Model> extends Base<"http", AgenticaOperation.Http<Model>, AgenticaExecuteHistory.Http<Model>, IHttpResponse> {
11
11
  }
12
- interface Base<Protocol extends "http" | "class", Operation extends AgenticaOperation<any>, Prompt extends AgenticaExecutePrompt<any>, Value> extends AgenticaEventBase<"execute"> {
12
+ interface Base<Protocol extends "http" | "class", Operation extends AgenticaOperation<any>, History extends AgenticaExecuteHistory<any>, Value> extends AgenticaEventBase<"execute"> {
13
13
  protocol: Protocol;
14
14
  id: string;
15
15
  operation: Operation;
16
16
  arguments: Record<string, unknown>;
17
17
  value: Value;
18
18
  toJSON: () => IAgenticaEventJson.IExecute;
19
- toPrompt: () => Prompt;
19
+ toHistory: () => History;
20
20
  }
21
21
  export {};
22
22
  }
@@ -1,10 +1,10 @@
1
1
  import type { ILlmSchema } from "@samchon/openapi";
2
2
  import type { AgenticaOperationSelection } from "../context/AgenticaOperationSelection";
3
+ import type { AgenticaSelectHistory } from "../histories/AgenticaSelectHistory";
3
4
  import type { IAgenticaEventJson } from "../json/IAgenticaEventJson";
4
- import type { AgenticaSelectPrompt } from "../prompts/AgenticaSelectPrompt";
5
5
  import type { AgenticaEventBase } from "./AgenticaEventBase";
6
6
  export interface AgenticaSelectEvent<Model extends ILlmSchema.Model> extends AgenticaEventBase<"select"> {
7
7
  selection: AgenticaOperationSelection<Model>;
8
8
  toJSON: () => IAgenticaEventJson.ISelect;
9
- toPrompt: () => AgenticaSelectPrompt<Model>;
9
+ toHistory: () => AgenticaSelectHistory<Model>;
10
10
  }
@@ -1,10 +1,10 @@
1
+ import type { AgenticaTextHistory } from "../histories/AgenticaTextHistory";
1
2
  import type { IAgenticaEventJson } from "../json/IAgenticaEventJson";
2
- import type { AgenticaTextPrompt } from "../prompts/AgenticaTextPrompt";
3
3
  import type { AgenticaEventBase } from "./AgenticaEventBase";
4
4
  export interface AgenticaTextEvent<Role extends "assistant" | "user" = "assistant" | "user"> extends AgenticaEventBase<"text"> {
5
5
  role: Role;
6
6
  stream: ReadableStream<string>;
7
7
  join: () => Promise<string>;
8
8
  toJSON: () => IAgenticaEventJson.IText;
9
- toPrompt: () => AgenticaTextPrompt;
9
+ toHistory: () => AgenticaTextHistory;
10
10
  }
@@ -0,0 +1,32 @@
1
+ import type { ILlmSchema } from "@samchon/openapi";
2
+ import type { AgenticaCallEvent } from "./AgenticaCallEvent";
3
+ import type { AgenticaDescribeEvent } from "./AgenticaDescribeEvent";
4
+ import type { AgenticaExecuteEvent } from "./AgenticaExecuteEvent";
5
+ import type { AgenticaRequestEvent } from "./AgenticaRequestEvent";
6
+ import type { AgenticaResponseEvent } from "./AgenticaResponseEvent";
7
+ import type { AgenticaTextEvent } from "./AgenticaTextEvent";
8
+ import type { AgenticaValidateEvent } from "./AgenticaValidateEvent";
9
+ /**
10
+ * Micro Agentica agent event.
11
+ *
12
+ * `MicroAgenticaEvent` is an union type of all possible events that
13
+ * can be emitted by the AI chatbot of the {@link MicroAgentica} class.
14
+ *
15
+ * You can discriminate the subtype by checking the {@link type} property.
16
+ *
17
+ * @author Samchon
18
+ */
19
+ export type MicroAgenticaEvent<Model extends ILlmSchema.Model> = AgenticaCallEvent<Model> | AgenticaDescribeEvent<Model> | AgenticaExecuteEvent<Model> | AgenticaRequestEvent | AgenticaResponseEvent | AgenticaTextEvent | AgenticaValidateEvent<Model>;
20
+ export declare namespace MicroAgenticaEvent {
21
+ type Type = MicroAgenticaEvent<any>["type"];
22
+ interface Mapper<Model extends ILlmSchema.Model> {
23
+ call: AgenticaCallEvent<Model>;
24
+ describe: AgenticaDescribeEvent<Model>;
25
+ execute: AgenticaExecuteEvent<Model>;
26
+ request: AgenticaRequestEvent;
27
+ response: AgenticaResponseEvent;
28
+ text: AgenticaTextEvent;
29
+ validate: AgenticaValidateEvent<Model>;
30
+ }
31
+ type Source = "call" | "describe";
32
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=AgenticaTextPrompt.js.map
3
+ //# sourceMappingURL=MicroAgenticaEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MicroAgenticaEvent.js","sourceRoot":"","sources":["../../src/events/MicroAgenticaEvent.ts"],"names":[],"mappings":""}
@@ -13,7 +13,7 @@ import type { AgenticaResponseEvent } from "../events/AgenticaResponseEvent";
13
13
  import type { AgenticaSelectEvent } from "../events/AgenticaSelectEvent";
14
14
  import type { AgenticaTextEvent } from "../events/AgenticaTextEvent";
15
15
  import type { AgenticaValidateEvent } from "../events/AgenticaValidateEvent";
16
- import type { AgenticaExecutePrompt } from "../prompts/AgenticaExecutePrompt";
16
+ import type { AgenticaExecuteHistory } from "../histories/AgenticaExecuteHistory";
17
17
  export declare function createInitializeEvent(): AgenticaInitializeEvent;
18
18
  export declare function createSelectEvent<Model extends ILlmSchema.Model>(props: {
19
19
  selection: AgenticaOperationSelection<Model>;
@@ -45,7 +45,7 @@ export declare function createTextEvent<Role extends "user" | "assistant">(props
45
45
  join: () => Promise<string>;
46
46
  }): AgenticaTextEvent<Role>;
47
47
  export declare function createDescribeEvent<Model extends ILlmSchema.Model>(props: {
48
- executes: AgenticaExecutePrompt<Model>[];
48
+ executes: AgenticaExecuteHistory<Model>[];
49
49
  stream: ReadableStream<string>;
50
50
  done: () => boolean;
51
51
  get: () => string;
@@ -11,7 +11,7 @@ exports.createDescribeEvent = createDescribeEvent;
11
11
  exports.createRequestEvent = createRequestEvent;
12
12
  exports.createResponseEvent = createResponseEvent;
13
13
  const uuid_1 = require("uuid");
14
- const prompts_1 = require("./prompts");
14
+ const histories_1 = require("./histories");
15
15
  /* -----------------------------------------------------------
16
16
  FUNCTION SELECTS
17
17
  ----------------------------------------------------------- */
@@ -32,7 +32,7 @@ function createSelectEvent(props) {
32
32
  type: "select",
33
33
  selection: props.selection.toJSON(),
34
34
  }),
35
- toPrompt: () => (0, prompts_1.createSelectPrompt)({
35
+ toHistory: () => (0, histories_1.createSelectHistory)({
36
36
  id: (0, uuid_1.v4)(),
37
37
  selections: [props.selection],
38
38
  }),
@@ -95,7 +95,7 @@ function createExecuteEvent(props) {
95
95
  arguments: props.arguments,
96
96
  value: props.value,
97
97
  }),
98
- toPrompt: () => (0, prompts_1.createExecutePrompt)(props),
98
+ toHistory: () => (0, histories_1.createExecuteHistory)(props),
99
99
  };
100
100
  }
101
101
  /* -----------------------------------------------------------
@@ -113,7 +113,7 @@ function createTextEvent(props) {
113
113
  done: props.done(),
114
114
  text: props.get(),
115
115
  }),
116
- toPrompt: () => ({
116
+ toHistory: () => ({
117
117
  type: "text",
118
118
  role: props.role,
119
119
  text: props.get(),
@@ -137,7 +137,7 @@ function createDescribeEvent(props) {
137
137
  done: props.done(),
138
138
  text: props.get(),
139
139
  }),
140
- toPrompt: () => ({
140
+ toHistory: () => ({
141
141
  type: "describe",
142
142
  executes: props.executes,
143
143
  text: props.get(),
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sourceRoot":"","sources":["../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EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;gBACzD,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE;aAClB,CAAC;SACH,CAAC;KACH,CAAC;AACJ,CAAC;AAED;;gEAEgE;AAChE,SAAgB,kBAAkB,CAAC,KAIlC;IACC,OAAO;QACL,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC;AACJ,CAAC;AAED,SAAgB,mBAAmB,CAAC,KAMnC;IACC,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { ILlmSchema } from "@samchon/openapi";
2
+ import type OpenAI from "openai";
3
+ import type { AgenticaCancelPrompt } from "../context/AgenticaCancelPrompt";
4
+ import type { AgenticaOperation } from "../context/AgenticaOperation";
5
+ import type { AgenticaOperationSelection } from "../context/AgenticaOperationSelection";
6
+ import type { AgenticaDescribeHistory } from "../histories/AgenticaDescribeHistory";
7
+ import type { AgenticaExecuteHistory } from "../histories/AgenticaExecuteHistory";
8
+ import type { AgenticaHistory } from "../histories/AgenticaHistory";
9
+ import type { AgenticaSelectHistory } from "../histories/AgenticaSelectHistory";
10
+ import type { AgenticaTextHistory } from "../histories/AgenticaTextHistory";
11
+ export declare function decodeHistory<Model extends ILlmSchema.Model>(history: AgenticaHistory<Model>): OpenAI.ChatCompletionMessageParam[];
12
+ export declare function createTextHistory<Role extends "assistant" | "user" = "assistant" | "user">(props: {
13
+ role: Role;
14
+ text: string;
15
+ }): AgenticaTextHistory<Role>;
16
+ export declare function createDescribeHistory<Model extends ILlmSchema.Model>(props: {
17
+ executes: AgenticaExecuteHistory<Model>[];
18
+ text: string;
19
+ }): AgenticaDescribeHistory<Model>;
20
+ export declare function createSelectHistory<Model extends ILlmSchema.Model>(props: {
21
+ id: string;
22
+ selections: AgenticaOperationSelection<Model>[];
23
+ }): AgenticaSelectHistory<Model>;
24
+ export declare function createCancelHistory<Model extends ILlmSchema.Model>(props: {
25
+ id: string;
26
+ selections: AgenticaOperationSelection<Model>[];
27
+ }): AgenticaCancelPrompt<Model>;
28
+ export declare function createExecuteHistory<Model extends ILlmSchema.Model>(props: {
29
+ id: string;
30
+ operation: AgenticaOperation<Model>;
31
+ arguments: Record<string, any>;
32
+ value: unknown;
33
+ }): AgenticaExecuteHistory<Model>;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decodePrompt = decodePrompt;
4
- exports.createTextPrompt = createTextPrompt;
5
- exports.createDescribePrompt = createDescribePrompt;
6
- exports.createSelectPrompt = createSelectPrompt;
7
- exports.createCancelPrompt = createCancelPrompt;
8
- exports.createExecutePrompt = createExecutePrompt;
9
- function decodePrompt(history) {
3
+ exports.decodeHistory = decodeHistory;
4
+ exports.createTextHistory = createTextHistory;
5
+ exports.createDescribeHistory = createDescribeHistory;
6
+ exports.createSelectHistory = createSelectHistory;
7
+ exports.createCancelHistory = createCancelHistory;
8
+ exports.createExecuteHistory = createExecuteHistory;
9
+ function decodeHistory(history) {
10
10
  // NO NEED TO DECODE DESCRIBE
11
11
  if (history.type === "describe") {
12
12
  return [];
@@ -82,7 +82,7 @@ function decodePrompt(history) {
82
82
  /* -----------------------------------------------------------
83
83
  TEXT PROMPTS
84
84
  ----------------------------------------------------------- */
85
- function createTextPrompt(props) {
85
+ function createTextHistory(props) {
86
86
  const prompt = {
87
87
  type: "text",
88
88
  role: props.role,
@@ -90,7 +90,7 @@ function createTextPrompt(props) {
90
90
  };
91
91
  return Object.assign(Object.assign({}, prompt), { toJSON: () => prompt });
92
92
  }
93
- function createDescribePrompt(props) {
93
+ function createDescribeHistory(props) {
94
94
  return {
95
95
  type: "describe",
96
96
  text: props.text,
@@ -105,7 +105,7 @@ function createDescribePrompt(props) {
105
105
  /* -----------------------------------------------------------
106
106
  FUNCTION CALLING PROMPTS
107
107
  ----------------------------------------------------------- */
108
- function createSelectPrompt(props) {
108
+ function createSelectHistory(props) {
109
109
  return {
110
110
  type: "select",
111
111
  id: props.id,
@@ -117,7 +117,7 @@ function createSelectPrompt(props) {
117
117
  }),
118
118
  };
119
119
  }
120
- function createCancelPrompt(props) {
120
+ function createCancelHistory(props) {
121
121
  return {
122
122
  type: "cancel",
123
123
  id: props.id,
@@ -129,7 +129,7 @@ function createCancelPrompt(props) {
129
129
  }),
130
130
  };
131
131
  }
132
- function createExecutePrompt(props) {
132
+ function createExecuteHistory(props) {
133
133
  return {
134
134
  type: "execute",
135
135
  protocol: props.operation.protocol,
@@ -147,4 +147,4 @@ function createExecutePrompt(props) {
147
147
  }),
148
148
  };
149
149
  }
150
- //# sourceMappingURL=prompts.js.map
150
+ //# sourceMappingURL=histories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"histories.js","sourceRoot":"","sources":["../../src/factory/histories.ts"],"names":[],"mappings":";;AAaA,sCAkFC;AAKD,8CAaC;AAED,sDAcC;AAKD,kDAcC;AAED,kDAcC;AAED,oDAwBC;AAjLD,SAAgB,aAAa,CAAiC,OAA+B;IAC3F,6BAA6B;IAC7B,IAAI,OAAO,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAChC,OAAO,EAAE,CAAC;IACZ,CAAC;SACI,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACjC,OAAO;YACL;gBACE,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,OAAO,EAAE,OAAO,CAAC,IAAI;aACtB;SACF,CAAC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KAAK,CAAC,EAAE;YACZ,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE;YACnC,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB,CAAC;KACH,CAAC;AACJ,CAAC"}
@@ -1,3 +1,3 @@
1
1
  export * from "./events";
2
+ export * from "./histories";
2
3
  export * from "./operations";
3
- export * from "./prompts";
@@ -15,6 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./events"), exports);
18
+ __exportStar(require("./histories"), exports);
18
19
  __exportStar(require("./operations"), exports);
19
- __exportStar(require("./prompts"), exports);
20
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,+CAA6B;AAC7B,4CAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8CAA4B;AAC5B,+CAA6B"}