@agentica/core 0.15.7 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/lib/Agentica.d.ts +21 -21
  2. package/lib/Agentica.js +29 -29
  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 +4 -4
  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 +1408 -917
  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 +58 -49
  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 +5 -5
  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 +5 -5
  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 +5 -2
  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 +36 -36
  126. package/src/MicroAgentica.ts +337 -0
  127. package/src/constants/AgenticaDefaultPrompt.ts +4 -2
  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 +91 -67
  158. package/src/orchestrate/cancel.ts +4 -4
  159. package/src/orchestrate/describe.ts +13 -9
  160. package/src/orchestrate/execute.ts +7 -7
  161. package/src/orchestrate/initialize.ts +8 -8
  162. package/src/orchestrate/internal/selectFunction.ts +5 -2
  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,35 +1,35 @@
1
1
  import type { ILlmSchema } from "@samchon/openapi";
2
2
  import type { AgenticaOperation } from "../context/AgenticaOperation";
3
- import type { IAgenticaPromptJson } from "../json/IAgenticaPromptJson";
4
- import type { AgenticaCancelPrompt } from "../prompts/AgenticaCancelPrompt";
5
- import type { AgenticaDescribePrompt } from "../prompts/AgenticaDescribePrompt";
6
- import type { AgenticaExecutePrompt } from "../prompts/AgenticaExecutePrompt";
7
- import type { AgenticaPrompt } from "../prompts/AgenticaPrompt";
8
- import type { AgenticaSelectPrompt } from "../prompts/AgenticaSelectPrompt";
9
- import type { AgenticaTextPrompt } from "../prompts/AgenticaTextPrompt";
3
+ import type { AgenticaCancelHistory } from "../histories/AgenticaCancelHistory";
4
+ import type { AgenticaDescribeHistory } from "../histories/AgenticaDescribeHistory";
5
+ import type { AgenticaExecuteHistory } from "../histories/AgenticaExecuteHistory";
6
+ import type { AgenticaHistory } from "../histories/AgenticaHistory";
7
+ import type { AgenticaSelectHistory } from "../histories/AgenticaSelectHistory";
8
+ import type { AgenticaTextHistory } from "../histories/AgenticaTextHistory";
9
+ import type { IAgenticaHistoryJson } from "../json/IAgenticaHistoryJson";
10
10
  declare function transform<Model extends ILlmSchema.Model>(props: {
11
11
  operations: Map<string, Map<string, AgenticaOperation<Model>>>;
12
- prompt: IAgenticaPromptJson;
13
- }): AgenticaPrompt<Model>;
12
+ history: IAgenticaHistoryJson;
13
+ }): AgenticaHistory<Model>;
14
14
  declare function transformText(props: {
15
- prompt: IAgenticaPromptJson.IText;
16
- }): AgenticaTextPrompt;
15
+ history: IAgenticaHistoryJson.IText;
16
+ }): AgenticaTextHistory;
17
17
  declare function transformSelect<Model extends ILlmSchema.Model>(props: {
18
18
  operations: Map<string, Map<string, AgenticaOperation<Model>>>;
19
- prompt: IAgenticaPromptJson.ISelect;
20
- }): AgenticaSelectPrompt<Model>;
19
+ history: IAgenticaHistoryJson.ISelect;
20
+ }): AgenticaSelectHistory<Model>;
21
21
  declare function transformCancel<Model extends ILlmSchema.Model>(props: {
22
22
  operations: Map<string, Map<string, AgenticaOperation<Model>>>;
23
- prompt: IAgenticaPromptJson.ICancel;
24
- }): AgenticaCancelPrompt<Model>;
23
+ history: IAgenticaHistoryJson.ICancel;
24
+ }): AgenticaCancelHistory<Model>;
25
25
  declare function transformExecute<Model extends ILlmSchema.Model>(props: {
26
26
  operations: Map<string, Map<string, AgenticaOperation<Model>>>;
27
- prompt: IAgenticaPromptJson.IExecute;
28
- }): AgenticaExecutePrompt<Model>;
27
+ history: IAgenticaHistoryJson.IExecute;
28
+ }): AgenticaExecuteHistory<Model>;
29
29
  declare function transformDescribe<Model extends ILlmSchema.Model>(props: {
30
30
  operations: Map<string, Map<string, AgenticaOperation<Model>>>;
31
- prompt: IAgenticaPromptJson.IDescribe;
32
- }): AgenticaDescribePrompt<Model>;
31
+ history: IAgenticaHistoryJson.IDescribe;
32
+ }): AgenticaDescribeHistory<Model>;
33
33
  export declare const AgenticaPromptTransformer: {
34
34
  transform: typeof transform;
35
35
  transformText: typeof transformText;
@@ -1,50 +1,50 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AgenticaPromptTransformer = void 0;
4
+ const histories_1 = require("../factory/histories");
4
5
  const operations_1 = require("../factory/operations");
5
- const prompts_1 = require("../factory/prompts");
6
6
  function transform(props) {
7
7
  // TEXT
8
- if (props.prompt.type === "text") {
8
+ if (props.history.type === "text") {
9
9
  return transformText({
10
- prompt: props.prompt,
10
+ history: props.history,
11
11
  });
12
12
  }
13
13
  // SELECT & CANCEL
14
- else if (props.prompt.type === "select") {
14
+ else if (props.history.type === "select") {
15
15
  return transformSelect({
16
16
  operations: props.operations,
17
- prompt: props.prompt,
17
+ history: props.history,
18
18
  });
19
19
  }
20
- else if (props.prompt.type === "cancel") {
20
+ else if (props.history.type === "cancel") {
21
21
  return transformCancel({
22
22
  operations: props.operations,
23
- prompt: props.prompt,
23
+ history: props.history,
24
24
  });
25
25
  }
26
26
  // EXECUTE
27
- else if (props.prompt.type === "execute") {
27
+ else if (props.history.type === "execute") {
28
28
  return transformExecute({
29
29
  operations: props.operations,
30
- prompt: props.prompt,
30
+ history: props.history,
31
31
  });
32
32
  }
33
- else if (props.prompt.type === "describe") {
33
+ else if (props.history.type === "describe") {
34
34
  return transformDescribe({
35
35
  operations: props.operations,
36
- prompt: props.prompt,
36
+ history: props.history,
37
37
  });
38
38
  }
39
39
  throw new Error("Invalid prompt type.");
40
40
  }
41
41
  function transformText(props) {
42
- return (0, prompts_1.createTextPrompt)(props.prompt);
42
+ return (0, histories_1.createTextHistory)(props.history);
43
43
  }
44
44
  function transformSelect(props) {
45
- return (0, prompts_1.createSelectPrompt)({
46
- id: props.prompt.id,
47
- selections: props.prompt.selections.map(select => (0, operations_1.createOperationSelection)({
45
+ return (0, histories_1.createSelectHistory)({
46
+ id: props.history.id,
47
+ selections: props.history.selections.map(select => (0, operations_1.createOperationSelection)({
48
48
  operation: findOperation({
49
49
  operations: props.operations,
50
50
  input: select.operation,
@@ -54,9 +54,9 @@ function transformSelect(props) {
54
54
  });
55
55
  }
56
56
  function transformCancel(props) {
57
- return (0, prompts_1.createCancelPrompt)({
58
- id: props.prompt.id,
59
- selections: props.prompt.selections.map(select => (0, operations_1.createOperationSelection)({
57
+ return (0, histories_1.createCancelHistory)({
58
+ id: props.history.id,
59
+ selections: props.history.selections.map(select => (0, operations_1.createOperationSelection)({
60
60
  operation: findOperation({
61
61
  operations: props.operations,
62
62
  input: select.operation,
@@ -66,26 +66,26 @@ function transformCancel(props) {
66
66
  });
67
67
  }
68
68
  function transformExecute(props) {
69
- return (0, prompts_1.createExecutePrompt)({
70
- id: props.prompt.id,
69
+ return (0, histories_1.createExecuteHistory)({
70
+ id: props.history.id,
71
71
  operation: findOperation({
72
72
  operations: props.operations,
73
- input: props.prompt.operation,
73
+ input: props.history.operation,
74
74
  }),
75
- arguments: props.prompt.arguments,
75
+ arguments: props.history.arguments,
76
76
  /**
77
77
  * @TODO fix it
78
78
  * The property and value have a type mismatch, but it works.
79
79
  */
80
- value: props.prompt.value,
80
+ value: props.history.value,
81
81
  });
82
82
  }
83
83
  function transformDescribe(props) {
84
- return (0, prompts_1.createDescribePrompt)({
85
- text: props.prompt.text,
86
- executes: props.prompt.executes.map(next => transformExecute({
84
+ return (0, histories_1.createDescribeHistory)({
85
+ text: props.history.text,
86
+ executes: props.history.executes.map(next => transformExecute({
87
87
  operations: props.operations,
88
- prompt: next,
88
+ history: next,
89
89
  })),
90
90
  });
91
91
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AgenticaPromptTransformer.js","sourceRoot":"","sources":["../../src/transformers/AgenticaPromptTransformer.ts"],"names":[],"mappings":";;;AAWA,sDAAiE;AACjE,gDAAyI;AAEzI,SAAS,SAAS,CAAiC,KAGlD;IACC,OAAO;IACP,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACjC,OAAO,aAAa,CAAC;YACnB,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,CAAC,CAAC;IACL,CAAC;IACD,kBAAkB;SACb,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,eAAe,CAAC;YACrB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,CAAC,CAAC;IACL,CAAC;SACI,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,eAAe,CAAC;YACrB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,CAAC,CAAC;IACL,CAAC;IACD,UAAU;SACL,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACzC,OAAO,gBAAgB,CAAC;YACtB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,CAAC,CAAC;IACL,CAAC;SACI,IAAI,KAAK,CAAC,MAAM,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C,KAG1D;IACC,OAAO,IAAA,iCAAqB,EAAC;QAC3B,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI;QACxB,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAC1C,gBAAgB,CAAC;YACf,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,OAAO,EAAE,IAAI;SACd,CAAC,CACH;KACF,CAAC,CAAC;AACL,CAAC;AAED,SAAS,aAAa,CAAiC,KAMtD;;IACC,MAAM,KAAK,GAAyC,MAAA,KAAK,CAAC,UAAU;SACjE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,0CAC1B,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC9B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CACb,oCAAoC,KAAK,CAAC,KAAK,CAAC,UAAU,eAAe,KAAK,CAAC,KAAK,CAAC,QAAQ,GAAG,CACjG,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAEY,QAAA,yBAAyB,GAAG;IACvC,SAAS;IACT,aAAa;IACb,eAAe;IACf,eAAe;IACf,gBAAgB;IAChB,iBAAiB;CAClB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentica/core",
3
- "version": "0.15.7",
3
+ "version": "0.16.1",
4
4
  "description": "Agentic AI Library specialized in LLM Function Calling",
5
5
  "author": "Wrtn Technologies",
6
6
  "license": "MIT",
@@ -36,17 +36,17 @@
36
36
  "access": "public"
37
37
  },
38
38
  "peerDependencies": {
39
- "@samchon/openapi": ">=3.2.2 <4.0.0",
39
+ "@samchon/openapi": ">=4.0.0 <5.0.0",
40
40
  "openai": ">=4.80.0",
41
- "typia": ">=8.1.0 <9.0.0"
41
+ "typia": ">=9.0.1 <10.0.0"
42
42
  },
43
43
  "dependencies": {
44
- "@samchon/openapi": "^3.2.3",
45
- "typia": "^8.1.1",
44
+ "@samchon/openapi": "^4.0.0",
45
+ "typia": "^9.0.1",
46
46
  "uuid": "^11.0.4"
47
47
  },
48
48
  "devDependencies": {
49
- "@nestia/e2e": "^0.8.2",
49
+ "@nestia/e2e": "^6.0.1",
50
50
  "@rollup/plugin-terser": "^0.4.4",
51
51
  "@rollup/plugin-typescript": "^12.1.2",
52
52
  "@types/node": "^22.13.4",
@@ -57,7 +57,7 @@
57
57
  "ts-node": "^10.9.2",
58
58
  "ts-patch": "^3.3.0",
59
59
  "typedoc": "^0.27.7",
60
- "typescript": "~5.8.2"
60
+ "typescript": "~5.8.3"
61
61
  },
62
62
  "scripts": {
63
63
  "build": "rimraf lib && pnpm build:prompt && tsc && rollup -c",
package/src/Agentica.ts CHANGED
@@ -6,8 +6,8 @@ import type { AgenticaOperationCollection } from "./context/AgenticaOperationCol
6
6
  import type { AgenticaOperationSelection } from "./context/AgenticaOperationSelection";
7
7
  import type { AgenticaEvent } from "./events/AgenticaEvent";
8
8
  import type { AgenticaRequestEvent } from "./events/AgenticaRequestEvent";
9
- import type { AgenticaPrompt } from "./prompts/AgenticaPrompt";
10
- import type { AgenticaTextPrompt } from "./prompts/AgenticaTextPrompt";
9
+ import type { AgenticaHistory } from "./histories/AgenticaHistory";
10
+ import type { AgenticaTextHistory } from "./histories/AgenticaTextHistory";
11
11
  import type { IAgenticaConfig } from "./structures/IAgenticaConfig";
12
12
  import type { IAgenticaController } from "./structures/IAgenticaController";
13
13
  import type { IAgenticaProps } from "./structures/IAgenticaProps";
@@ -17,7 +17,7 @@ import { AgenticaTokenUsage } from "./context/AgenticaTokenUsage";
17
17
  import { AgenticaOperationComposer } from "./context/internal/AgenticaOperationComposer";
18
18
  import { AgenticaTokenUsageAggregator } from "./context/internal/AgenticaTokenUsageAggregator";
19
19
  import { createInitializeEvent, createRequestEvent, createTextEvent } from "./factory/events";
20
- import { createTextPrompt } from "./factory/prompts";
20
+ import { createTextHistory } from "./factory/histories";
21
21
  import { execute } from "./orchestrate/execute";
22
22
  import { AgenticaPromptTransformer } from "./transformers/AgenticaPromptTransformer";
23
23
  import { __map_take } from "./utils/__map_take";
@@ -25,12 +25,12 @@ import { ChatGptCompletionMessageUtil } from "./utils/ChatGptCompletionMessageUt
25
25
  import { StreamUtil } from "./utils/StreamUtil";
26
26
 
27
27
  /**
28
- * Nestia A.I. chatbot agent.
28
+ * Agentica AI chatbot agent.
29
29
  *
30
- * `Agentica` is a facade class for the super A.I. chatbot agent
31
- * which performs the {@link conversate user's conversation function}
32
- * with LLM (Large Language Model) function calling and manages the
33
- * {@link getPromptHistories prompt histories}.
30
+ * `Agentica` is a facade class for the super AI chatbot agent
31
+ * which performs LLM (Large Language Model) function calling from the
32
+ * {@link conversate user's conversation}, and manages the
33
+ * {@link getHistories prompt histories}.
34
34
  *
35
35
  * To understand and compose the `Agentica` class exactly, reference
36
36
  * below types concentrating on the documentation comments please.
@@ -45,7 +45,7 @@ import { StreamUtil } from "./utils/StreamUtil";
45
45
  * - {@link IAgenticaSystemPrompt}
46
46
  * - Accessors
47
47
  * - {@link IAgenticaOperation}
48
- * - {@link IAgenticaPromptJson}
48
+ * - {@link IAgenticaHistoryJson}
49
49
  * - {@link IAgenticaEventJson}
50
50
  * - {@link IAgenticaTokenUsageJson}
51
51
  *
@@ -57,7 +57,7 @@ export class Agentica<Model extends ILlmSchema.Model> {
57
57
 
58
58
  // STACK
59
59
  private readonly stack_: AgenticaOperationSelection<Model>[];
60
- private readonly prompt_histories_: AgenticaPrompt<Model>[];
60
+ private readonly histories_: AgenticaHistory<Model>[];
61
61
  private readonly listeners_: Map<string, Set<(event: AgenticaEvent<Model>) => Promise<void> | void>>;
62
62
 
63
63
  // STATUS
@@ -65,7 +65,7 @@ export class Agentica<Model extends ILlmSchema.Model> {
65
65
  private ready_: boolean;
66
66
  private readonly executor_: (
67
67
  ctx: AgenticaContext<Model>,
68
- ) => Promise<AgenticaPrompt<Model>[]>;
68
+ ) => Promise<AgenticaHistory<Model>[]>;
69
69
 
70
70
  /* -----------------------------------------------------------
71
71
  CONSTRUCTOR
@@ -85,10 +85,10 @@ export class Agentica<Model extends ILlmSchema.Model> {
85
85
  // STATUS
86
86
  this.stack_ = [];
87
87
  this.listeners_ = new Map();
88
- this.prompt_histories_ = (props.histories ?? []).map(input =>
88
+ this.histories_ = (props.histories ?? []).map(input =>
89
89
  AgenticaPromptTransformer.transform({
90
90
  operations: this.operations_.group,
91
- prompt: input,
91
+ history: input,
92
92
  }),
93
93
  );
94
94
 
@@ -115,19 +115,19 @@ export class Agentica<Model extends ILlmSchema.Model> {
115
115
  ACCESSORS
116
116
  ----------------------------------------------------------- */
117
117
  /**
118
- * Conversate with the A.I. chatbot.
118
+ * Conversate with the AI chatbot.
119
119
  *
120
- * User talks to the A.I. chatbot with the content.
120
+ * User talks to the AI chatbot with the given content.
121
121
  *
122
- * When the user's conversation implies the A.I. chatbot to execute a
122
+ * When the user's conversation implies the AI chatbot to execute a
123
123
  * function calling, the returned chat prompts will contain the
124
- * function calling information like {@link IAgenticaPromptJson.IExecute}.
124
+ * function calling information like {@link AgenticaExecuteHistory}.
125
125
  *
126
126
  * @param content The content to talk
127
127
  * @returns List of newly created chat prompts
128
128
  */
129
- public async conversate(content: string): Promise<AgenticaPrompt<Model>[]> {
130
- const prompt: AgenticaTextPrompt<"user"> = createTextPrompt<"user">({
129
+ public async conversate(content: string): Promise<AgenticaHistory<Model>[]> {
130
+ const text: AgenticaTextHistory<"user"> = createTextHistory<"user">({
131
131
  role: "user",
132
132
  text: content,
133
133
  });
@@ -141,14 +141,14 @@ export class Agentica<Model extends ILlmSchema.Model> {
141
141
  }),
142
142
  );
143
143
 
144
- const newbie: AgenticaPrompt<Model>[] = await this.executor_(
144
+ const newbie: AgenticaHistory<Model>[] = await this.executor_(
145
145
  this.getContext({
146
- prompt,
146
+ prompt: text,
147
147
  usage: this.token_usage_,
148
148
  }),
149
149
  );
150
- this.prompt_histories_.push(prompt, ...newbie);
151
- return [prompt, ...newbie];
150
+ this.histories_.push(text, ...newbie);
151
+ return [text, ...newbie];
152
152
  }
153
153
 
154
154
  /**
@@ -169,7 +169,7 @@ export class Agentica<Model extends ILlmSchema.Model> {
169
169
  * Get controllers.
170
170
  *
171
171
  * Get list of controllers, which are the collection of functions that
172
- * the "Super A.I. Chatbot" can execute.
172
+ * the "Super AI Chatbot" can execute.
173
173
  */
174
174
  public getControllers(): ReadonlyArray<IAgenticaController<Model>> {
175
175
  return this.props.controllers;
@@ -188,23 +188,23 @@ export class Agentica<Model extends ILlmSchema.Model> {
188
188
  }
189
189
 
190
190
  /**
191
- * Get the chatbot's prompt histories.
191
+ * Get the chatbot's histories.
192
192
  *
193
- * Get list of chat prompts that the chatbot has been conversated.
193
+ * Get list of chat histories that the chatbot has been conversated.
194
194
  *
195
- * @returns List of chat prompts
195
+ * @returns List of chat histories
196
196
  */
197
- public getPromptHistories(): AgenticaPrompt<Model>[] {
198
- return this.prompt_histories_;
197
+ public getHistories(): AgenticaHistory<Model>[] {
198
+ return this.histories_;
199
199
  }
200
200
 
201
201
  /**
202
- * Get token usage of the A.I. chatbot.
202
+ * Get token usage of the AI chatbot.
203
203
  *
204
- * Entire token usage of the A.I. chatbot during the conversating
204
+ * Entire token usage of the AI chatbot during the conversating
205
205
  * with the user by {@link conversate} method callings.
206
206
  *
207
- * @returns Cost of the A.I. chatbot
207
+ * @returns Cost of the AI chatbot
208
208
  */
209
209
  public getTokenUsage(): AgenticaTokenUsage {
210
210
  return this.token_usage_;
@@ -214,7 +214,7 @@ export class Agentica<Model extends ILlmSchema.Model> {
214
214
  * @internal
215
215
  */
216
216
  public getContext(props: {
217
- prompt: AgenticaTextPrompt<"user">;
217
+ prompt: AgenticaTextHistory<"user">;
218
218
  usage: AgenticaTokenUsage;
219
219
  }): AgenticaContext<Model> {
220
220
  const dispatch = async (event: AgenticaEvent<Model>) => this.dispatch(event);
@@ -224,7 +224,7 @@ export class Agentica<Model extends ILlmSchema.Model> {
224
224
  config: this.props.config,
225
225
 
226
226
  // STATES
227
- histories: this.prompt_histories_,
227
+ histories: this.histories_,
228
228
  stack: this.stack_,
229
229
  ready: () => this.ready_,
230
230
  prompt: props.prompt,
@@ -261,7 +261,7 @@ export class Agentica<Model extends ILlmSchema.Model> {
261
261
 
262
262
  const [streamForAggregate, streamForReturn] = temporaryStream.tee();
263
263
 
264
- void (async () => {
264
+ (async () => {
265
265
  const reader = streamForAggregate.getReader();
266
266
  while (true) {
267
267
  const chunk = await reader.read();
@@ -276,7 +276,7 @@ export class Agentica<Model extends ILlmSchema.Model> {
276
276
  });
277
277
  }
278
278
  }
279
- })();
279
+ })().catch(() => {});
280
280
 
281
281
  const [streamForStream, streamForJoin] = streamForEvent.tee();
282
282
  await dispatch({