@autobe/agent 0.19.1 → 0.20.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 (222) hide show
  1. package/lib/agent/src/AutoBeAgent.js +3 -2
  2. package/lib/agent/src/AutoBeAgent.js.map +1 -1
  3. package/lib/agent/src/AutoBeMockAgent.js +3 -3
  4. package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +6 -6
  5. package/lib/agent/src/context/AutoBeContext.d.ts +1 -0
  6. package/lib/agent/src/factory/consentFunctionCall.js +3 -2
  7. package/lib/agent/src/factory/consentFunctionCall.js.map +1 -1
  8. package/lib/agent/src/factory/createAutoBeContext.js +8 -5
  9. package/lib/agent/src/factory/createAutoBeContext.js.map +1 -1
  10. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.d.ts +6 -0
  11. package/lib/agent/src/orchestrate/analyze/histories/{transformAnalyzeReviewerHistories.js → transformAnalyzeReviewHistories.js} +24 -29
  12. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -0
  13. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +12 -9
  14. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  15. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +31 -29
  16. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  17. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js +19 -5
  18. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  19. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +7 -1
  20. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js +9 -6
  21. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
  22. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js +11 -9
  23. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  24. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +6 -4
  25. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js +5 -1
  26. package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
  27. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js +45 -46
  28. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
  29. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +13 -13
  30. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  31. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js +31 -30
  32. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  33. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +23 -22
  34. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  35. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
  36. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js +27 -26
  37. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  38. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +13 -12
  39. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  40. package/lib/agent/src/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.js +4 -4
  41. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +11 -10
  42. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  43. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +31 -30
  44. package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
  45. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js +3 -1
  46. package/lib/agent/src/orchestrate/interface/orchestrateInterface.js.map +1 -1
  47. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js +22 -18
  48. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  49. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js +2 -0
  50. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  51. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js +6 -2
  52. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  53. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js +2 -0
  54. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
  55. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +74 -48
  56. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  57. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +24 -4
  58. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  59. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +30 -24
  60. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  61. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +2 -5
  62. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js +178 -0
  63. package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
  64. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +38 -0
  65. package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +38 -0
  66. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +54 -54
  67. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  68. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +18 -29
  69. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
  70. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +37 -34
  71. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  72. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +38 -25
  73. package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  74. package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js +3 -1
  75. package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  76. package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js +2 -0
  77. package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  78. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +3 -0
  79. package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  80. package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js +19 -9
  81. package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
  82. package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js +28 -21
  83. package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
  84. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +24 -21
  85. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
  86. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +58 -56
  87. package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
  88. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +17 -13
  89. package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  90. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +12 -3
  91. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -1
  92. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +35 -30
  93. package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  94. package/lib/{orchestrate/realize/internal/compile.d.ts → agent/src/orchestrate/realize/internal/compileRealizeFiles.d.ts} +1 -1
  95. package/lib/agent/src/orchestrate/realize/internal/{compile.js → compileRealizeFiles.js} +6 -6
  96. package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -0
  97. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +26 -12
  98. package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
  99. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +9 -3
  100. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  101. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +3 -1
  102. package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
  103. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +2 -6
  104. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +8 -4
  105. package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  106. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.d.ts +0 -66
  107. package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.map +1 -1
  108. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +3 -6
  109. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +21 -17
  110. package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  111. package/lib/agent/src/orchestrate/test/compile/completeTestCode.js +13 -10
  112. package/lib/agent/src/orchestrate/test/compile/completeTestCode.js.map +1 -1
  113. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +16 -15
  114. package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  115. package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js +33 -32
  116. package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js.map +1 -1
  117. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +62 -59
  118. package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  119. package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +2 -2
  120. package/lib/agent/src/orchestrate/test/orchestrateTest.js +6 -5
  121. package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
  122. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +16 -7
  123. package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  124. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +20 -8
  125. package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  126. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +17 -17
  127. package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  128. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +2 -2
  129. package/lib/agent/src/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +2 -2
  130. package/lib/agent/src/utils/executeCachedBatch.d.ts +1 -0
  131. package/lib/agent/src/utils/executeCachedBatch.js +23 -0
  132. package/lib/agent/src/utils/executeCachedBatch.js.map +1 -0
  133. package/lib/constants/AutoBeSystemPromptConstant.d.ts +6 -6
  134. package/lib/context/AutoBeContext.d.ts +1 -0
  135. package/lib/index.mjs +1044 -270
  136. package/lib/index.mjs.map +1 -1
  137. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.d.ts +6 -0
  138. package/lib/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +7 -1
  139. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +6 -4
  140. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +2 -5
  141. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +38 -0
  142. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +38 -0
  143. package/lib/{agent/src/orchestrate/realize/internal/compile.d.ts → orchestrate/realize/internal/compileRealizeFiles.d.ts} +1 -1
  144. package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +2 -6
  145. package/lib/orchestrate/realize/orchestrateRealizeScenario.d.ts +0 -66
  146. package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +3 -6
  147. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +2 -2
  148. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +2 -2
  149. package/lib/utils/executeCachedBatch.d.ts +1 -0
  150. package/package.json +6 -6
  151. package/src/AutoBeAgent.ts +4 -3
  152. package/src/AutoBeMockAgent.ts +4 -4
  153. package/src/constants/AutoBeSystemPromptConstant.ts +6 -6
  154. package/src/context/AutoBeContext.ts +1 -0
  155. package/src/factory/consentFunctionCall.ts +4 -3
  156. package/src/factory/createAutoBeContext.ts +9 -6
  157. package/src/orchestrate/analyze/histories/{transformAnalyzeReviewerHistories.ts → transformAnalyzeReviewHistories.ts} +23 -30
  158. package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +13 -10
  159. package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +60 -61
  160. package/src/orchestrate/analyze/orchestrateAnalyze.ts +20 -13
  161. package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +20 -9
  162. package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +13 -11
  163. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +10 -5
  164. package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +47 -48
  165. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +14 -14
  166. package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +31 -30
  167. package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +20 -19
  168. package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +3 -3
  169. package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +23 -22
  170. package/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.ts +12 -11
  171. package/src/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.ts +5 -5
  172. package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +11 -10
  173. package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +31 -30
  174. package/src/orchestrate/interface/orchestrateInterface.ts +4 -2
  175. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +36 -29
  176. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +2 -0
  177. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +13 -9
  178. package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +2 -0
  179. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +53 -50
  180. package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +2 -0
  181. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +47 -23
  182. package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +85 -1
  183. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +39 -0
  184. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +40 -1
  185. package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +57 -55
  186. package/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.ts +19 -30
  187. package/src/orchestrate/prisma/histories/transformPrismaReviewHistories.ts +38 -35
  188. package/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts +36 -23
  189. package/src/orchestrate/prisma/orchestratePrisma.ts +4 -2
  190. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +2 -0
  191. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +3 -0
  192. package/src/orchestrate/prisma/orchestratePrismaReview.ts +26 -13
  193. package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +25 -17
  194. package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +24 -21
  195. package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +42 -40
  196. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +17 -13
  197. package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +14 -5
  198. package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +35 -30
  199. package/src/orchestrate/realize/internal/{compile.ts → compileRealizeFiles.ts} +15 -11
  200. package/src/orchestrate/realize/orchestrateRealize.ts +59 -40
  201. package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +19 -10
  202. package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +3 -0
  203. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +10 -10
  204. package/src/orchestrate/realize/orchestrateRealizeScenario.ts +0 -74
  205. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +24 -23
  206. package/src/orchestrate/test/compile/completeTestCode.ts +17 -13
  207. package/src/orchestrate/test/experimental/transformTestCorrectHistories.ast +4 -4
  208. package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +17 -16
  209. package/src/orchestrate/test/histories/transformTestHistories.ts +35 -34
  210. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +62 -57
  211. package/src/orchestrate/test/histories/transformTestWriteHistories.ts +3 -3
  212. package/src/orchestrate/test/orchestrateTest.ts +7 -9
  213. package/src/orchestrate/test/orchestrateTestCorrect.ts +34 -24
  214. package/src/orchestrate/test/orchestrateTestScenario.ts +28 -21
  215. package/src/orchestrate/test/orchestrateTestWrite.ts +16 -17
  216. package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +3 -3
  217. package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +2 -2
  218. package/src/utils/executeCachedBatch.ts +15 -0
  219. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +0 -6
  220. package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.js.map +0 -1
  221. package/lib/agent/src/orchestrate/realize/internal/compile.js.map +0 -1
  222. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +0 -6
@@ -1,6 +1,7 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { IAutoBeTypeScriptCompileResult } from "@autobe/interface";
3
- import { v4 } from "uuid";
3
+ import { StringUtil } from "@autobe/utils";
4
+ import { v7 } from "uuid";
4
5
 
5
6
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
6
7
  import { IAutoBeTestFunction } from "../structures/IAutoBeTestFunction";
@@ -14,25 +15,25 @@ export const transformTestCorrectHistories = (
14
15
  > => [
15
16
  ...transformTestWriteHistories(func.scenario, func.artifacts),
16
17
  {
17
- id: v4(),
18
+ id: v7(),
18
19
  created_at: new Date().toISOString(),
19
20
  type: "assistantMessage",
20
- text: [
21
- "## Generated TypeScript Code",
22
- "```typescript",
23
- func.script,
24
- "```",
25
- "",
26
- "## Compile Errors",
27
- "Fix the compilation error in the provided code.",
28
- "",
29
- "```json",
30
- JSON.stringify(failure.diagnostics),
31
- "```",
32
- ].join("\n"),
21
+ text: StringUtil.trim`
22
+ ## Generated TypeScript Code
23
+ \`\`\`typescript
24
+ ${func.script}
25
+ \`\`\`
26
+
27
+ ## Compile Errors
28
+ Fix the compilation error in the provided code.
29
+
30
+ \`\`\`json
31
+ ${JSON.stringify(failure.diagnostics)}
32
+ \`\`\`
33
+ `,
33
34
  },
34
35
  {
35
- id: v4(),
36
+ id: v7(),
36
37
  created_at: new Date().toISOString(),
37
38
  type: "systemMessage",
38
39
  text: AutoBeSystemPromptConstant.TEST_CORRECT.replace(
@@ -1,5 +1,6 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
- import { v4 } from "uuid";
2
+ import { StringUtil } from "@autobe/utils";
3
+ import { v7 } from "uuid";
3
4
 
4
5
  import { AutoBeState } from "../../../context/AutoBeState";
5
6
 
@@ -11,67 +12,67 @@ export const transformTestHistories = (
11
12
  if (state.analyze === null)
12
13
  return [
13
14
  {
14
- id: v4(),
15
+ id: v7(),
15
16
  created_at: new Date().toISOString(),
16
17
  type: "systemMessage",
17
- text: [
18
- "Requirement analysis is not yet completed.",
19
- "Don't call the any tool function,",
20
- "but say to process the requirement analysis.",
21
- ].join(" "),
18
+ text: StringUtil.trim`
19
+ Requirement analysis is not yet completed.
20
+ Don't call the any tool function,
21
+ but say to process the requirement analysis.
22
+ `,
22
23
  },
23
24
  ];
24
25
  else if (state.prisma === null)
25
26
  return [
26
27
  {
27
- id: v4(),
28
+ id: v7(),
28
29
  created_at: new Date().toISOString(),
29
30
  type: "systemMessage",
30
- text: [
31
- "Prisma DB schema generation is not yet completed.",
32
- "Don't call the any tool function,",
33
- "but say to process the Prisma DB schema generation.",
34
- ].join(" "),
31
+ text: StringUtil.trim`
32
+ Prisma DB schema generation is not yet completed.
33
+ Don't call the any tool function,
34
+ but say to process the Prisma DB schema generation.
35
+ `,
35
36
  },
36
37
  ];
37
38
  else if (state.analyze.step !== state.prisma.step)
38
39
  return [
39
40
  {
40
- id: v4(),
41
+ id: v7(),
41
42
  created_at: new Date().toISOString(),
42
43
  type: "systemMessage",
43
- text: [
44
- "Prisma DB schema generation has not been updated",
45
- "for the latest requirement analysis.",
46
- "Don't call the any tool function,",
47
- "but say to re-process the Prisma DB schema generation.",
48
- ].join(" "),
44
+ text: StringUtil.trim`
45
+ Prisma DB schema generation has not been updated
46
+ for the latest requirement analysis.
47
+ Don't call the any tool function,
48
+ but say to re-process the Prisma DB schema generation.
49
+ `,
49
50
  },
50
51
  ];
51
52
  else if (state.prisma.compiled.type !== "success")
52
53
  return [
53
54
  {
54
- id: v4(),
55
+ id: v7(),
55
56
  created_at: new Date().toISOString(),
56
57
  type: "systemMessage",
57
- text: [
58
- "Prisma DB schema generation has not been updated",
59
- "for the latest requirement analysis.",
60
- "Don't call the any tool function,",
61
- "but say to re-process the Prisma DB schema generation.",
62
- ].join(" "),
58
+ text: StringUtil.trim`
59
+ Prisma DB schema generation has not been updated
60
+ for the latest requirement analysis.
61
+ Don't call the any tool function,
62
+ but say to re-process the Prisma DB schema generation.
63
+ `,
63
64
  },
64
65
  ];
65
66
  return [
66
67
  {
67
- id: v4(),
68
+ id: v7(),
68
69
  created_at: new Date().toISOString(),
69
70
  type: "systemMessage",
70
- text: [
71
- "Interface generation is not yet completed.",
72
- "Don't call the any tool function,",
73
- "but say to process the interface generation.",
74
- ].join(" "),
71
+ text: StringUtil.trim`
72
+ Interface generation is not yet completed.
73
+ Don't call the any tool function,
74
+ but say to process the interface generation.
75
+ `,
75
76
  },
76
77
  ];
77
- };
78
+ };
@@ -1,7 +1,7 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { AutoBeInterfaceAuthorization, AutoBeOpenApi } from "@autobe/interface";
3
- import { MapUtil } from "@autobe/utils";
4
- import { v4 } from "uuid";
3
+ import { MapUtil, StringUtil } from "@autobe/utils";
4
+ import { v7 } from "uuid";
5
5
 
6
6
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
7
7
  import { AutoBeState } from "../../../context/AutoBeState";
@@ -40,82 +40,87 @@ export const transformTestScenarioHistories = (
40
40
 
41
41
  return [
42
42
  {
43
- id: v4(),
43
+ id: v7(),
44
44
  created_at: new Date().toISOString(),
45
45
  type: "systemMessage",
46
46
  text: AutoBeSystemPromptConstant.TEST_SCENARIO,
47
47
  } satisfies IAgenticaHistoryJson.ISystemMessage,
48
48
  {
49
- id: v4(),
49
+ id: v7(),
50
50
  created_at: new Date().toISOString(),
51
51
  type: "systemMessage",
52
- text: [
53
- "# Operations",
54
- "",
55
- "Below are the full operations. Please refer to this.",
56
- "Your role is to draft all test cases for each given Operation.",
57
- "It is also permissible to write multiple test codes on a single endpoint.",
58
- "However, rather than meaningless tests, business logic tests should be written and an E2E test situation should be assumed.",
59
- "",
60
- "Please carefully analyze each operation to identify all dependencies required for testing.",
61
- "For example, if you want to test liking and then deleting a post,",
62
- "you might think to test post creation, liking, and unlike operations.",
63
- "However, even if not explicitly mentioned, user registration or login are essential prerequisites.",
64
- "Pay close attention to IDs and related values in the API,",
65
- "and ensure you identify all dependencies between endpoints.",
66
- "",
67
- "```json",
68
- JSON.stringify(
52
+ text: StringUtil.trim`
53
+ # Operations
54
+
55
+ Below are the full operations. Please refer to this.
56
+ Your role is to draft all test cases for each given Operation.
57
+ It is also permissible to write multiple test codes on a single endpoint.
58
+ However, rather than meaningless tests, business logic tests should be written and an E2E test situation should be assumed.
59
+
60
+ Please carefully analyze each operation to identify all dependencies required for testing.
61
+ For example, if you want to test liking and then deleting a post,
62
+ you might think to test post creation, liking, and unlike operations.
63
+ However, even if not explicitly mentioned, user registration or login are essential prerequisites.
64
+ Pay close attention to IDs and related values in the API,
65
+ and ensure you identify all dependencies between endpoints.
66
+
67
+ \`\`\`json
68
+ ${JSON.stringify(
69
69
  entire.map((el) => ({
70
70
  ...el,
71
71
  specification: undefined,
72
72
  })),
73
- ),
74
- "```",
75
- ].join("\n"),
73
+ )}
74
+ \`\`\`
75
+ `,
76
76
  } satisfies IAgenticaHistoryJson.ISystemMessage,
77
77
  {
78
- id: v4(),
78
+ id: v7(),
79
79
  created_at: new Date().toISOString(),
80
80
  type: "systemMessage",
81
- text: [
82
- "# Included in Test Plan",
83
- "",
84
- "Below are the endpoints that have been included in the test plan.",
85
- "Each endpoint shows its authentication requirements and related authentication APIs.",
86
- "When testing endpoints that require authentication, ensure you include the corresponding join/login operations in your test scenario to establish proper authentication context.",
87
- "",
88
- include
81
+ text: StringUtil.trim`
82
+ # Included in Test Plan
83
+
84
+ Below are the endpoints that have been included in the test plan.
85
+ Each endpoint shows its authentication requirements and related authentication APIs.
86
+ When testing endpoints that require authentication, ensure you include the corresponding join/login operations in your test scenario to establish proper authentication context.
87
+
88
+ ${include
89
89
  .map((el, i) => {
90
90
  const roles = Array.from(authorizationRoles.values()).filter(
91
91
  (role) => role.name === el.authorizationRole,
92
92
  );
93
- return [
94
- `## ${i + 1}. ${el.method.toUpperCase()} ${el.path}`,
95
- "",
96
- "Related Authentication APIs:",
97
- "",
98
- roles.length > 0
99
- ? roles.map((role) => {
100
- return [
101
- `- ${role.join?.method.toUpperCase()}: ${role.join?.path}`,
102
- `- ${role.login?.method.toUpperCase()}: ${role.login?.path}`,
103
- ].join("\n");
104
- })
105
- : "- None",
106
- ];
93
+ return StringUtil.trim`
94
+ ## ${i + 1}. ${el.method.toUpperCase()} ${el.path}
95
+
96
+ Related Authentication APIs:
97
+
98
+ ${
99
+ roles.length > 0
100
+ ? roles
101
+ .map((role) => {
102
+ return StringUtil.trim`
103
+ - ${role.join?.method.toUpperCase()}: ${role.join?.path}
104
+ - ${role.login?.method.toUpperCase()}: ${role.login?.path}
105
+ `;
106
+ })
107
+ .join("\n")
108
+ : "- None"
109
+ }
110
+ `;
107
111
  })
108
- .join("\n"),
109
- "",
110
- "# Excluded from Test Plan",
111
- "",
112
- "These are the endpoints that have already been used in test codes generated as part of a plan group.",
113
- "These endpoints do not need to be tested again.",
114
- "However, it is allowed to reference or depend on these endpoints when writing test codes for other purposes.",
115
- exclude
112
+ .join("\n")}
113
+
114
+ # Excluded from Test Plan
115
+
116
+ These are the endpoints that have already been used in test codes generated as part of a plan group.
117
+ These endpoints do not need to be tested again.
118
+ However, it is allowed to reference or depend on these endpoints when writing test codes for other purposes.
119
+
120
+ ${exclude
116
121
  .map((el) => `- ${el.method.toUpperCase()}: ${el.path}`)
117
- .join("\n"),
118
- ].join("\n"),
122
+ .join("\n")}
123
+ `,
119
124
  } satisfies IAgenticaHistoryJson.ISystemMessage,
120
125
  ];
121
126
  };
@@ -7,7 +7,7 @@ import {
7
7
  OpenApi,
8
8
  } from "@samchon/openapi";
9
9
  import typia from "typia";
10
- import { v4 } from "uuid";
10
+ import { v7 } from "uuid";
11
11
 
12
12
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
13
13
  import { IAutoBeTestScenarioArtifacts } from "../structures/IAutoBeTestScenarioArtifacts";
@@ -18,7 +18,7 @@ export function transformTestWriteHistories(
18
18
  ): Array<IAgenticaHistoryJson.ISystemMessage> {
19
19
  return [
20
20
  {
21
- id: v4(),
21
+ id: v7(),
22
22
  created_at: new Date().toISOString(),
23
23
  type: "systemMessage",
24
24
  text: AutoBeSystemPromptConstant.TEST_WRITE.replace(
@@ -27,7 +27,7 @@ export function transformTestWriteHistories(
27
27
  ).replaceAll("{{FUNCTION_NAME}}", scenario.functionName),
28
28
  },
29
29
  {
30
- id: v4(),
30
+ id: v7(),
31
31
  created_at: new Date().toISOString(),
32
32
  type: "systemMessage",
33
33
  text: StringUtil.trim`
@@ -8,7 +8,7 @@ import {
8
8
  IAutoBeTypeScriptCompileResult,
9
9
  } from "@autobe/interface";
10
10
  import { ILlmSchema } from "@samchon/openapi";
11
- import { v4 } from "uuid";
11
+ import { v7 } from "uuid";
12
12
 
13
13
  import { AutoBeContext } from "../../context/AutoBeContext";
14
14
  import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
@@ -29,13 +29,14 @@ export const orchestrateTest =
29
29
  if (predicate !== null)
30
30
  return ctx.assistantMessage({
31
31
  type: "assistantMessage",
32
- id: v4(),
32
+ id: v7(),
33
33
  created_at: start.toISOString(),
34
34
  text: predicate,
35
35
  completed_at: new Date().toISOString(),
36
36
  });
37
37
  ctx.dispatch({
38
38
  type: "testStart",
39
+ id: v7(),
39
40
  created_at: start.toISOString(),
40
41
  reason: props.reason,
41
42
  step: ctx.state().analyze?.step ?? 0,
@@ -46,7 +47,7 @@ export const orchestrateTest =
46
47
  ctx.state().interface?.document.operations ?? [];
47
48
  if (operations.length === 0)
48
49
  return ctx.assistantMessage({
49
- id: v4(),
50
+ id: v7(),
50
51
  type: "assistantMessage",
51
52
  created_at: start.toISOString(),
52
53
  completed_at: new Date().toISOString(),
@@ -63,14 +64,10 @@ export const orchestrateTest =
63
64
  ctx,
64
65
  scenarios,
65
66
  );
66
-
67
67
  const corrects: AutoBeTestValidateEvent[] = await orchestrateTestCorrect(
68
68
  ctx,
69
69
  written,
70
70
  );
71
- const success: AutoBeTestValidateEvent[] = corrects.filter(
72
- (c) => c.result.type === "success",
73
- );
74
71
 
75
72
  // DO COMPILE
76
73
  const compiler: IAutoBeCompiler = await ctx.compiler();
@@ -82,13 +79,14 @@ export const orchestrateTest =
82
79
  dbms: "sqlite",
83
80
  }),
84
81
  ).filter(([key]) => key.endsWith(".ts")),
85
- ...success.map((s) => [s.file.location, s.file.content]),
82
+ ...corrects.map((s) => [s.file.location, s.file.content]),
86
83
  ]),
87
84
  });
88
85
  return ctx.dispatch({
89
86
  type: "testComplete",
87
+ id: v7(),
90
88
  created_at: new Date().toISOString(),
91
- files: success.map((s) => s.file),
89
+ files: corrects.map((s) => s.file),
92
90
  compiled,
93
91
  step: ctx.state().interface?.step ?? 0,
94
92
  elapsed: new Date().getTime() - start.getTime(),
@@ -4,12 +4,15 @@ import {
4
4
  IAutoBeCompiler,
5
5
  IAutoBeTypeScriptCompileResult,
6
6
  } from "@autobe/interface";
7
+ import { StringUtil } from "@autobe/utils";
7
8
  import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
8
9
  import { IPointer } from "tstl";
9
10
  import typia from "typia";
11
+ import { v7 } from "uuid";
10
12
 
11
13
  import { AutoBeContext } from "../../context/AutoBeContext";
12
14
  import { assertSchemaModel } from "../../context/assertSchemaModel";
15
+ import { executeCachedBatch } from "../../utils/executeCachedBatch";
13
16
  import { completeTestCode } from "./compile/completeTestCode";
14
17
  import { transformTestCorrectHistories } from "./histories/transformTestCorrectHistories";
15
18
  import { IAutoBeTestCorrectApplication } from "./structures/IAutoBeTestCorrectApplication";
@@ -22,31 +25,32 @@ export const orchestrateTestCorrect = async <Model extends ILlmSchema.Model>(
22
25
  writeResult: IAutoBeTestWriteResult[],
23
26
  life: number = 4,
24
27
  ): Promise<AutoBeTestValidateEvent[]> => {
25
- const result: Array<AutoBeTestValidateEvent | null> = await Promise.all(
26
- writeResult.map(async (w) => {
27
- try {
28
- const event: AutoBeTestValidateEvent = await compile(ctx, {
29
- artifacts: w.artifacts,
30
- scenario: w.scenario,
31
- location: w.event.location,
32
- script: w.event.final,
33
- });
34
- return predicate(
35
- ctx,
36
- {
28
+ const result: Array<AutoBeTestValidateEvent | null> =
29
+ await executeCachedBatch(
30
+ writeResult.map((w) => async () => {
31
+ try {
32
+ const event: AutoBeTestValidateEvent = await compile(ctx, {
37
33
  artifacts: w.artifacts,
38
34
  scenario: w.scenario,
39
35
  location: w.event.location,
40
36
  script: w.event.final,
41
- },
42
- event,
43
- life,
44
- );
45
- } catch {
46
- return null;
47
- }
48
- }),
49
- );
37
+ });
38
+ return await predicate(
39
+ ctx,
40
+ {
41
+ artifacts: w.artifacts,
42
+ scenario: w.scenario,
43
+ location: w.event.location,
44
+ script: w.event.final,
45
+ },
46
+ event,
47
+ life,
48
+ );
49
+ } catch {
50
+ return null;
51
+ }
52
+ }),
53
+ );
50
54
  return result.filter((r) => r !== null);
51
55
  };
52
56
 
@@ -64,6 +68,7 @@ const compile = async <Model extends ILlmSchema.Model>(
64
68
  });
65
69
  return {
66
70
  type: "testValidate",
71
+ id: v7(),
67
72
  file: {
68
73
  scenario: func.scenario,
69
74
  location: func.location,
@@ -83,7 +88,7 @@ const predicate = async <Model extends ILlmSchema.Model>(
83
88
  ): Promise<AutoBeTestValidateEvent> => {
84
89
  if (event.result.type === "failure") ctx.dispatch(event);
85
90
  return event.result.type === "failure"
86
- ? correct(ctx, content, event, life - 1)
91
+ ? await correct(ctx, content, event, life - 1)
87
92
  : event;
88
93
  };
89
94
 
@@ -110,8 +115,12 @@ const correct = async <Model extends ILlmSchema.Model>(
110
115
  },
111
116
  }),
112
117
  enforceFunctionCall: true,
113
- message:
114
- "Fix the `AutoBeTest.IFunction` data to resolve the compilation error.",
118
+ message: StringUtil.trim`
119
+ Fix the AutoBeTest.IFunction data to resolve the compilation error.
120
+
121
+ You don't need to explain me anything, but just fix it immediately
122
+ without any hesitation, explanation, and questions.
123
+ `,
115
124
  });
116
125
  if (pointer.value === null) throw new Error("Failed to modify test code.");
117
126
 
@@ -120,6 +129,7 @@ const correct = async <Model extends ILlmSchema.Model>(
120
129
 
121
130
  ctx.dispatch({
122
131
  type: "testCorrect",
132
+ id: v7(),
123
133
  created_at: new Date().toISOString(),
124
134
  file: validate.file,
125
135
  result: validate.result,
@@ -9,10 +9,12 @@ import { AutoBeEndpointComparator, MapUtil, StringUtil } from "@autobe/utils";
9
9
  import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
10
10
  import { HashMap, IPointer, Pair } from "tstl";
11
11
  import typia from "typia";
12
+ import { v7 } from "uuid";
12
13
 
13
14
  import { AutoBeContext } from "../../context/AutoBeContext";
14
15
  import { assertSchemaModel } from "../../context/assertSchemaModel";
15
16
  import { divideArray } from "../../utils/divideArray";
17
+ import { executeCachedBatch } from "../../utils/executeCachedBatch";
16
18
  import { transformTestScenarioHistories } from "./histories/transformTestScenarioHistories";
17
19
  import { IAutoBeTestScenarioApplication } from "./structures/IAutoBeTestScenarioApplication";
18
20
  import { IAutoBeTestScenarioAuthorizationRole } from "./structures/IAutoBeTestScenarioAuthorizationRole";
@@ -64,18 +66,18 @@ export async function orchestrateTestScenario<Model extends ILlmSchema.Model>(
64
66
  array: include,
65
67
  capacity: 5,
66
68
  });
67
- await Promise.all(
68
- matrix.map(async (include) => {
69
+ await executeCachedBatch(
70
+ matrix.map((include) => async (promptCacheKey) => {
69
71
  exclude.push(
70
- ...(await divideAndConquer(
71
- ctx,
72
+ ...(await divideAndConquer(ctx, {
72
73
  dict,
73
74
  endpointNotFound,
74
- operations,
75
+ entire: operations,
75
76
  include,
76
- exclude.map((x) => x.endpoint),
77
+ exclude: exclude.map((x) => x.endpoint),
77
78
  progress,
78
- )),
79
+ promptCacheKey,
80
+ })),
79
81
  );
80
82
  }),
81
83
  );
@@ -106,13 +108,16 @@ export async function orchestrateTestScenario<Model extends ILlmSchema.Model>(
106
108
 
107
109
  const divideAndConquer = async <Model extends ILlmSchema.Model>(
108
110
  ctx: AutoBeContext<Model>,
109
- dict: HashMap<AutoBeOpenApi.IEndpoint, AutoBeOpenApi.IOperation>,
110
- endpointNotFound: string,
111
- entire: AutoBeOpenApi.IOperation[],
112
- include: AutoBeOpenApi.IOperation[],
113
- exclude: AutoBeOpenApi.IEndpoint[],
114
- progress: AutoBeProgressEventBase,
115
- ) => {
111
+ props: {
112
+ dict: HashMap<AutoBeOpenApi.IEndpoint, AutoBeOpenApi.IOperation>;
113
+ endpointNotFound: string;
114
+ entire: AutoBeOpenApi.IOperation[];
115
+ include: AutoBeOpenApi.IOperation[];
116
+ exclude: AutoBeOpenApi.IEndpoint[];
117
+ progress: AutoBeProgressEventBase;
118
+ promptCacheKey: string;
119
+ },
120
+ ): Promise<IAutoBeTestScenarioApplication.IScenarioGroup[]> => {
116
121
  const pointer: IPointer<IAutoBeTestScenarioApplication.IScenarioGroup[]> = {
117
122
  value: [],
118
123
  };
@@ -124,14 +129,14 @@ const divideAndConquer = async <Model extends ILlmSchema.Model>(
124
129
  source: "testScenarios",
125
130
  histories: transformTestScenarioHistories(
126
131
  ctx.state(),
127
- entire,
128
- include,
129
- exclude,
132
+ props.entire,
133
+ props.include,
134
+ props.exclude,
130
135
  ),
131
136
  controller: createController({
132
137
  model: ctx.model,
133
- endpointNotFound,
134
- dict,
138
+ endpointNotFound: props.endpointNotFound,
139
+ dict: props.dict,
135
140
  authorizations,
136
141
  build: (next) => {
137
142
  pointer.value ??= [];
@@ -139,11 +144,13 @@ const divideAndConquer = async <Model extends ILlmSchema.Model>(
139
144
  },
140
145
  }),
141
146
  enforceFunctionCall: true,
147
+ promptCacheKey: props.promptCacheKey,
142
148
  message: `Create e2e test scenarios.`,
143
149
  });
144
150
  if (pointer.value.length === 0) return [];
145
151
  ctx.dispatch({
146
152
  type: "testScenarios",
153
+ id: v7(),
147
154
  tokenUsage,
148
155
  scenarios: pointer.value
149
156
  .map((v) =>
@@ -158,8 +165,8 @@ const divideAndConquer = async <Model extends ILlmSchema.Model>(
158
165
  ),
159
166
  )
160
167
  .flat(),
161
- completed: ++progress.completed,
162
- total: progress.total,
168
+ completed: ++props.progress.completed,
169
+ total: props.progress.total,
163
170
  step: ctx.state().interface?.step ?? 0,
164
171
  created_at: new Date().toISOString(),
165
172
  });