@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
@@ -4,7 +4,8 @@ import {
4
4
  AutoBePrismaHistory,
5
5
  IAutoBePrismaCompileResult,
6
6
  } from "@autobe/interface";
7
- import { v4 } from "uuid";
7
+ import { StringUtil } from "@autobe/utils";
8
+ import { v7 } from "uuid";
8
9
 
9
10
  import { AutoBeState } from "../../../context/AutoBeState";
10
11
 
@@ -17,60 +18,58 @@ export const transformInterfaceAssetHistories = (
17
18
  const prisma: AutoBePrismaHistory = state.prisma!;
18
19
  return [
19
20
  {
20
- id: v4(),
21
+ id: v7(),
21
22
  created_at: new Date().toISOString(),
22
23
  type: "assistantMessage",
23
- text: [
24
- "Requirement analysis and Prisma DB schema generation are ready.",
25
- "",
26
- "Call the provided tool function to generate the OpenAPI document",
27
- "referencing below requirement analysis and Prisma DB schema.",
28
- "",
29
- // User Request
30
- `## User Request`,
31
- "",
32
- analyze.reason,
33
- "",
34
- // Requirement Analysis Report
35
- `## Requirement Analysis Report`,
36
- "",
37
- "```json",
38
- JSON.stringify(analyze.files),
39
- "```",
40
- ].join("\n"),
24
+ text: StringUtil.trim`
25
+ Requirement analysis and Prisma DB schema generation are ready.
26
+
27
+ Call the provided tool function to generate the OpenAPI document
28
+ referencing below requirement analysis and Prisma DB schema.
29
+
30
+ ## User Request
31
+
32
+ ${analyze.reason}
33
+
34
+ ## Requirement Analysis Report
35
+
36
+ \`\`\`json
37
+ ${JSON.stringify(analyze.files)}
38
+ \`\`\`
39
+ `,
41
40
  },
42
41
  {
43
- id: v4(),
42
+ id: v7(),
44
43
  created_at: new Date().toISOString(),
45
44
  type: "assistantMessage",
46
- text: [
47
- "Database schema and entity relationship diagrams are ready.",
48
- "You should also look at this and consider logic including membership/login and token issuance.",
49
- "You can use table's name to define role in operations.",
50
- "",
51
- "## Critical Schema Verification Instructions",
52
- "",
53
- "**IMPORTANT**: When generating API operations and descriptions:",
54
- "1. ONLY reference fields that ACTUALLY EXIST in the Prisma schema below",
55
- "2. NEVER assume common fields like `deleted_at`, `created_by`, `updated_by`, `is_deleted` exist",
56
- "3. For DELETE operations:",
57
- " - If schema HAS soft delete fields (e.g., `deleted_at`), describe soft delete behavior",
58
- " - If schema LACKS soft delete fields, describe hard delete behavior",
59
- "4. Verify EVERY field reference against the actual schema before including in descriptions",
60
- "",
61
- "## Prisma DB Schema",
62
- "",
63
- "```json",
64
- JSON.stringify(prisma.schemas),
65
- "```",
66
- "",
67
- "## Entity Relationship Diagrams",
68
- "```json",
69
- JSON.stringify(
45
+ text: StringUtil.trim`
46
+ Database schema and entity relationship diagrams are ready.
47
+ You should also look at this and consider logic including membership/login and token issuance.
48
+ You can use table's name to define role in operations.
49
+
50
+ ## Critical Schema Verification Instructions
51
+
52
+ **IMPORTANT**: When generating API operations and descriptions:
53
+ 1. ONLY reference fields that ACTUALLY EXIST in the Prisma schema below
54
+ 2. NEVER assume common fields like \`deleted_at\`, \`created_by\`, \`updated_by\`, \`is_deleted\` exist
55
+ 3. For DELETE operations:
56
+ - If schema HAS soft delete fields (e.g., \`deleted_at\`), describe soft delete behavior
57
+ - If schema LACKS soft delete fields, describe hard delete behavior
58
+ 4. Verify EVERY field reference against the actual schema before including in descriptions
59
+
60
+ ## Prisma DB Schema
61
+
62
+ \`\`\`json
63
+ ${JSON.stringify(prisma.schemas)}
64
+ \`\`\`
65
+
66
+ ## Entity Relationship Diagrams
67
+ \`\`\`json
68
+ ${JSON.stringify(
70
69
  (prisma.compiled as IAutoBePrismaCompileResult.ISuccess).diagrams,
71
- ),
72
- "```",
73
- ].join("\n"),
70
+ )}
71
+ \`\`\`
72
+ `,
74
73
  },
75
74
  ];
76
75
  };
@@ -1,6 +1,7 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { AutoBeAnalyzeRole } 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 { AutoBeState } from "../../../context/AutoBeState";
@@ -15,26 +16,25 @@ export const transformInterfaceAuthorizationsHistories = (
15
16
  return [
16
17
  {
17
18
  type: "systemMessage",
18
- id: v4(),
19
+ id: v7(),
19
20
  created_at: new Date().toISOString(),
20
21
  text: AutoBeSystemPromptConstant.INTERFACE_AUTHORIZATION,
21
22
  },
22
23
  ...transformInterfaceAssetHistories(state),
23
24
  {
24
25
  type: "assistantMessage",
25
- id: v4(),
26
+ id: v7(),
26
27
  created_at: new Date().toISOString(),
27
- text: [
28
- "You have to make API operations for the given role:",
29
- "",
30
- "## Role",
31
- "",
32
- "```json",
33
- JSON.stringify(role),
34
- "```",
35
- "",
36
- "",
37
- ].join("\n"),
28
+ text: StringUtil.trim`
29
+ You have to make API operations for the given role:
30
+
31
+ ## Role
32
+
33
+ \`\`\`json
34
+ ${JSON.stringify(role)}
35
+ \`\`\`
36
+
37
+ `,
38
38
  },
39
39
  ];
40
40
  };
@@ -1,6 +1,7 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { AutoBeOpenApi } 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 { AutoBeState } from "../../../context/AutoBeState";
@@ -15,55 +16,55 @@ export const transformInterfaceComplementHistories = (
15
16
  > => [
16
17
  {
17
18
  type: "systemMessage",
18
- id: v4(),
19
+ id: v7(),
19
20
  created_at: new Date().toISOString(),
20
21
  text: AutoBeSystemPromptConstant.INTERFACE_OPERATION,
21
22
  },
22
23
  ...transformInterfaceAssetHistories(state),
23
24
  {
24
- type: "assistantMessage",
25
- id: v4(),
25
+ type: "systemMessage",
26
+ id: v7(),
26
27
  created_at: new Date().toISOString(),
27
- text: [
28
- "Here is the OpenAPI operations what you AI have made:",
29
- "",
30
- "```json",
31
- JSON.stringify(document.operations),
32
- "```",
33
- ].join("\n"),
28
+ text: AutoBeSystemPromptConstant.INTERFACE_SCHEMA,
34
29
  },
35
30
  {
36
31
  type: "systemMessage",
37
- id: v4(),
32
+ id: v7(),
38
33
  created_at: new Date().toISOString(),
39
- text: AutoBeSystemPromptConstant.INTERFACE_SCHEMA,
34
+ text: AutoBeSystemPromptConstant.INTERFACE_COMPLEMENT,
40
35
  },
41
36
  {
42
37
  type: "assistantMessage",
43
- id: v4(),
38
+ id: v7(),
44
39
  created_at: new Date().toISOString(),
45
- text: [
46
- "Here is the OpenAPI schemas what you AI have made:",
47
- "",
48
- "```json",
49
- JSON.stringify(document.components.schemas),
50
- "```",
51
- ].join("\n"),
40
+ text: StringUtil.trim`
41
+ Here is the OpenAPI operations what you AI have made:
42
+
43
+ \`\`\`json
44
+ ${JSON.stringify(document.operations)}
45
+ \`\`\`
46
+ `,
52
47
  },
53
48
  {
54
- type: "systemMessage",
55
- id: v4(),
49
+ type: "assistantMessage",
50
+ id: v7(),
56
51
  created_at: new Date().toISOString(),
57
- text: AutoBeSystemPromptConstant.INTERFACE_COMPLEMENT,
52
+ text: StringUtil.trim`
53
+ Here is the OpenAPI schemas what you AI have made:
54
+
55
+ \`\`\`json
56
+ ${JSON.stringify(document.components.schemas)}
57
+ \`\`\`
58
+ `,
58
59
  },
59
60
  {
60
61
  type: "assistantMessage",
61
- id: v4(),
62
+ id: v7(),
62
63
  created_at: new Date().toISOString(),
63
- text: [
64
- "You AI have missed below schema types:",
65
- "",
66
- ...missed.map((s) => `- ${s}`),
67
- ].join("\n"),
64
+ text: StringUtil.trim`
65
+ You AI have missed below schema types:
66
+
67
+ ${missed.map((s) => `- ${s}`).join("\n")}
68
+ `,
68
69
  },
69
70
  ];
@@ -1,7 +1,8 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { AutoBeOpenApi } from "@autobe/interface";
3
3
  import { AutoBeInterfaceGroup } from "@autobe/interface/src/histories/contents/AutoBeInterfaceGroup";
4
- import { v4 } from "uuid";
4
+ import { StringUtil } from "@autobe/utils";
5
+ import { v7 } from "uuid";
5
6
 
6
7
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
7
8
  import { AutoBeState } from "../../../context/AutoBeState";
@@ -16,36 +17,36 @@ export const transformInterfaceEndpointHistories = (
16
17
  > => [
17
18
  {
18
19
  type: "systemMessage",
19
- id: v4(),
20
+ id: v7(),
20
21
  created_at: new Date().toISOString(),
21
22
  text: AutoBeSystemPromptConstant.INTERFACE_ENDPOINT,
22
23
  },
23
24
  ...transformInterfaceAssetHistories(state),
24
25
  {
25
26
  type: "assistantMessage",
26
- id: v4(),
27
+ id: v7(),
27
28
  created_at: new Date().toISOString(),
28
- text: [
29
- "Here is the target group for the endpoints:",
30
- "",
31
- "```json",
32
- JSON.stringify(group),
33
- "```",
34
- "",
35
- "**IMPORTANT: DO NOT DUPLICATE EXISTING OPERATIONS**",
36
- "",
37
- "These operations already exist. Do NOT create similar endpoints:",
38
- "",
39
- "```json",
40
- JSON.stringify(
29
+ text: StringUtil.trim`
30
+ Here is the target group for the endpoints:
31
+
32
+ \`\`\`json
33
+ ${JSON.stringify(group)}
34
+ \`\`\`
35
+
36
+ **IMPORTANT: DO NOT DUPLICATE EXISTING OPERATIONS**
37
+
38
+ These operations already exist. Do NOT create similar endpoints:
39
+
40
+ \`\`\`json
41
+ ${JSON.stringify(
41
42
  authorizations.map((op) => ({
42
43
  path: op.path,
43
44
  method: op.method,
44
45
  name: op.name,
45
46
  summary: op.summary,
46
47
  })),
47
- ),
48
- "```",
49
- ].join("\n"),
48
+ )}
49
+ \`\`\`
50
+ `,
50
51
  },
51
52
  ];
@@ -1,5 +1,5 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
- import { v4 } from "uuid";
2
+ import { v7 } from "uuid";
3
3
 
4
4
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
5
5
  import { AutoBeState } from "../../../context/AutoBeState";
@@ -16,14 +16,14 @@ export const transformInterfaceGroupHistories = (
16
16
 
17
17
  return [
18
18
  {
19
- id: v4(),
19
+ id: v7(),
20
20
  created_at: new Date().toISOString(),
21
21
  type: "systemMessage",
22
22
  text: AutoBeSystemPromptConstant.INTERFACE_ENDPOINT,
23
23
  },
24
24
  ...transformInterfaceAssetHistories(state),
25
25
  {
26
- id: v4(),
26
+ id: v7(),
27
27
  created_at: new Date().toISOString(),
28
28
  type: "systemMessage",
29
29
  text: AutoBeSystemPromptConstant.INTERFACE_GROUP,
@@ -1,6 +1,7 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { AutoBeAnalyzeHistory, AutoBeOpenApi } 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 { AutoBeState } from "../../../context/AutoBeState";
@@ -16,42 +17,42 @@ export const transformInterfaceOperationHistories = (
16
17
  return [
17
18
  {
18
19
  type: "systemMessage",
19
- id: v4(),
20
+ id: v7(),
20
21
  created_at: new Date().toISOString(),
21
22
  text: AutoBeSystemPromptConstant.INTERFACE_OPERATION,
22
23
  },
23
24
  ...transformInterfaceAssetHistories(state),
24
25
  {
25
26
  type: "systemMessage",
26
- id: v4(),
27
+ id: v7(),
27
28
  created_at: new Date().toISOString(),
28
- text: [
29
- `## Service Prefix`,
30
- `- Original: ${analyze.prefix}`,
31
- `- PascalCase for DTOs: ${analyze.prefix
29
+ text: StringUtil.trim`
30
+ ## Service Prefix
31
+ - Original: ${analyze.prefix}
32
+ - PascalCase for DTOs: ${analyze.prefix
32
33
  .split(/[-_]/)
33
34
  .map((p) => p.charAt(0).toUpperCase() + p.slice(1))
34
- .join("")}`,
35
- `- Expected DTO pattern: I${analyze.prefix
35
+ .join("")}
36
+ - Expected DTO pattern: I${analyze.prefix
36
37
  .split(/[-_]/)
37
38
  .map((p) => p.charAt(0).toUpperCase() + p.slice(1))
38
- .join("")}{EntityName}`,
39
- ].join("\n"),
39
+ .join("")}{EntityName}
40
+ `,
40
41
  },
41
42
  {
42
43
  type: "assistantMessage",
43
- id: v4(),
44
+ id: v7(),
44
45
  created_at: new Date().toISOString(),
45
- text: [
46
- "You have to make API operations for the given endpoints:",
47
- "",
48
- "```json",
49
- JSON.stringify(endpoints),
50
- "```",
51
- "",
52
- "If there is a content in the failure, it is to explain why it failed before.",
53
- "Please supplement or modify the Operation accordingly.",
54
- ].join("\n"),
46
+ text: StringUtil.trim`
47
+ You have to make API operations for the given endpoints:
48
+
49
+ \`\`\`json
50
+ ${JSON.stringify(endpoints)}
51
+ \`\`\`
52
+
53
+ If there is a content in the failure, it is to explain why it failed before.
54
+ Please supplement or modify the Operation accordingly.
55
+ `,
55
56
  },
56
57
  ];
57
58
  };
@@ -1,7 +1,8 @@
1
1
  import { IMicroAgenticaHistoryJson } from "@agentica/core";
2
2
  import { AutoBeOpenApi } from "@autobe/interface";
3
+ import { StringUtil } from "@autobe/utils";
3
4
  import { ILlmSchema } from "@samchon/openapi";
4
- import { v4 } from "uuid";
5
+ import { v7 } from "uuid";
5
6
 
6
7
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
7
8
  import { AutoBeContext } from "../../../context/AutoBeContext";
@@ -16,28 +17,28 @@ export function transformInterfaceOperationsReviewHistories<
16
17
  return [
17
18
  {
18
19
  type: "systemMessage",
19
- id: v4(),
20
+ id: v7(),
20
21
  created_at: new Date().toISOString(),
21
22
  text: AutoBeSystemPromptConstant.INTERFACE_OPERATION,
22
23
  },
23
24
  ...transformInterfaceAssetHistories(ctx.state()),
24
25
  {
25
26
  type: "systemMessage",
26
- id: v4(),
27
+ id: v7(),
27
28
  created_at: new Date().toISOString(),
28
29
  text: AutoBeSystemPromptConstant.INTERFACE_OPERATION_REVIEW,
29
30
  },
30
31
  {
31
32
  type: "assistantMessage",
32
- id: v4(),
33
+ id: v7(),
33
34
  created_at: new Date().toISOString(),
34
- text: [
35
- "Review the following API operations:",
36
- "",
37
- "```json",
38
- JSON.stringify(operations),
39
- "```",
40
- ].join("\n"),
35
+ text: StringUtil.trim`
36
+ Review the following API operations:
37
+
38
+ \`\`\`json
39
+ ${JSON.stringify(operations)}
40
+ \`\`\`
41
+ `,
41
42
  },
42
43
  ];
43
44
  }
@@ -1,5 +1,5 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
- import { v4 } from "uuid";
2
+ import { v7 } from "uuid";
3
3
 
4
4
  import { AutoBeState } from "../../../context/AutoBeState";
5
5
 
@@ -11,7 +11,7 @@ export const transformInterfacePrerequisiteHistories = (
11
11
  if (state.analyze === null)
12
12
  return [
13
13
  {
14
- id: v4(),
14
+ id: v7(),
15
15
  created_at: new Date().toISOString(),
16
16
  type: "systemMessage",
17
17
  text: [
@@ -24,7 +24,7 @@ export const transformInterfacePrerequisiteHistories = (
24
24
  else if (state.prisma === null)
25
25
  return [
26
26
  {
27
- id: v4(),
27
+ id: v7(),
28
28
  created_at: new Date().toISOString(),
29
29
  type: "systemMessage",
30
30
  text: [
@@ -37,7 +37,7 @@ export const transformInterfacePrerequisiteHistories = (
37
37
  else if (state.analyze.step !== state.prisma.step)
38
38
  return [
39
39
  {
40
- id: v4(),
40
+ id: v7(),
41
41
  created_at: new Date().toISOString(),
42
42
  type: "systemMessage",
43
43
  text: [
@@ -51,7 +51,7 @@ export const transformInterfacePrerequisiteHistories = (
51
51
  else if (state.prisma.compiled.type !== "success")
52
52
  return [
53
53
  {
54
- id: v4(),
54
+ id: v7(),
55
55
  created_at: new Date().toISOString(),
56
56
  type: "systemMessage",
57
57
  text: [
@@ -1,6 +1,7 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { AutoBeOpenApi } 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 { AutoBeState } from "../../../context/AutoBeState";
@@ -14,21 +15,21 @@ export const transformInterfaceSchemaHistories = (
14
15
  > => [
15
16
  {
16
17
  type: "systemMessage",
17
- id: v4(),
18
+ id: v7(),
18
19
  created_at: new Date().toISOString(),
19
20
  text: AutoBeSystemPromptConstant.INTERFACE_SCHEMA,
20
21
  },
21
22
  ...transformInterfaceAssetHistories(state),
22
23
  {
23
24
  type: "assistantMessage",
24
- id: v4(),
25
+ id: v7(),
25
26
  created_at: new Date().toISOString(),
26
- text: [
27
- "Here is the list of API operations you have to implement its types:",
28
- "",
29
- "```json",
30
- JSON.stringify(operations),
31
- "```",
32
- ].join("\n"),
27
+ text: StringUtil.trim`
28
+ Here is the list of API operations you have to implement its types:
29
+
30
+ \`\`\`json
31
+ ${JSON.stringify(operations)}
32
+ \`\`\`
33
+ `,
33
34
  },
34
35
  ];
@@ -1,6 +1,7 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
2
  import { AutoBeOpenApi } 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 { AutoBeState } from "../../../context/AutoBeState";
@@ -19,51 +20,51 @@ export const transformInterfaceSchemasReviewHistories = (
19
20
  return [
20
21
  {
21
22
  type: "systemMessage",
22
- id: v4(),
23
+ id: v7(),
23
24
  created_at: new Date().toISOString(),
24
25
  text: AutoBeSystemPromptConstant.INTERFACE_SCHEMA,
25
26
  },
26
27
  ...transformInterfaceAssetHistories(state),
27
28
  {
28
29
  type: "systemMessage",
29
- id: v4(),
30
+ id: v7(),
30
31
  created_at: new Date().toISOString(),
31
32
  text: AutoBeSystemPromptConstant.INTERFACE_SCHEMA_REVIEW,
32
33
  },
33
34
  {
34
35
  type: "assistantMessage",
35
- id: v4(),
36
+ id: v7(),
36
37
  created_at: new Date().toISOString(),
37
- text: [
38
- "The Schema Agent has generated schemas for the following API operations.",
39
- "These operations define what endpoints exist and what request/response types they use:",
40
- "",
41
- "```json",
42
- JSON.stringify(operations),
43
- "```",
44
- "",
45
- "All schema types referenced in these operations (in requestBody and responses) must exist in the schemas.",
46
- ].join("\n"),
38
+ text: StringUtil.trim`
39
+ The Schema Agent has generated schemas for the following API operations.
40
+ These operations define what endpoints exist and what request/response types they use:
41
+
42
+ \`\`\`json
43
+ ${JSON.stringify(operations)}
44
+ \`\`\`
45
+
46
+ All schema types referenced in these operations (in requestBody and responses) must exist in the schemas.
47
+ `,
47
48
  },
48
49
  {
49
- id: v4(),
50
+ id: v7(),
50
51
  type: "assistantMessage",
51
52
  created_at: new Date().toISOString(),
52
- text: [
53
- "Here are the schemas generated by the Schema Agent that need your review:",
54
- "",
55
- "```json",
56
- JSON.stringify(schemaDescriptive),
57
- "```",
58
- "",
59
- "Please review these schemas for:",
60
- "1. Security vulnerabilities (passwords in responses, actor IDs in requests)",
61
- "2. Missing entities or variants referenced by the operations",
62
- "3. Type accuracy and format specifications",
63
- "4. Alignment with Prisma schema and business requirements",
64
- "",
65
- "Fix all critical issues and return the enhanced schemas in the content field.",
66
- ].join("\n"),
53
+ text: StringUtil.trim`
54
+ Here are the schemas generated by the Schema Agent that need your review:
55
+
56
+ \`\`\`json
57
+ ${JSON.stringify(schemaDescriptive)}
58
+ \`\`\`
59
+
60
+ Please review these schemas for:
61
+ 1. Security vulnerabilities (passwords in responses, actor IDs in requests)
62
+ 2. Missing entities or variants referenced by the operations
63
+ 3. Type accuracy and format specifications
64
+ 4. Alignment with Prisma schema and business requirements
65
+
66
+ Fix all critical issues and return the enhanced schemas in the content field.
67
+ `,
67
68
  },
68
69
  ];
69
70
  };