@autobe/agent 0.26.0 → 0.28.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 (205) hide show
  1. package/lib/AutoBeAgent.d.ts +2 -1
  2. package/lib/AutoBeAgent.js +27 -7
  3. package/lib/AutoBeAgent.js.map +1 -1
  4. package/lib/AutoBeMockAgent.js +2 -4
  5. package/lib/AutoBeMockAgent.js.map +1 -1
  6. package/lib/constants/AutoBeSystemPromptConstant.d.ts +11 -11
  7. package/lib/context/AutoBeContext.d.ts +4 -1
  8. package/lib/context/AutoBeTokenUsage.d.ts +1 -1
  9. package/lib/context/AutoBeTokenUsage.js.map +1 -1
  10. package/lib/context/assertSchemaModel.d.ts +1 -1
  11. package/lib/context/assertSchemaModel.js +4 -7
  12. package/lib/context/assertSchemaModel.js.map +1 -1
  13. package/lib/factory/AutoBeFunctionCallingMetricFactory.d.ts +7 -0
  14. package/lib/factory/AutoBeFunctionCallingMetricFactory.js +35 -0
  15. package/lib/factory/AutoBeFunctionCallingMetricFactory.js.map +1 -0
  16. package/lib/factory/AutoBeProcessAggregateFactory.d.ts +13 -0
  17. package/lib/factory/AutoBeProcessAggregateFactory.js +100 -0
  18. package/lib/factory/AutoBeProcessAggregateFactory.js.map +1 -0
  19. package/lib/factory/createAutoBeContext.d.ts +2 -1
  20. package/lib/factory/createAutoBeContext.js +78 -27
  21. package/lib/factory/createAutoBeContext.js.map +1 -1
  22. package/lib/index.mjs +24065 -12997
  23. package/lib/index.mjs.map +1 -1
  24. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +1 -1
  25. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  26. package/lib/orchestrate/analyze/orchestrateAnalyze.js +1 -0
  27. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  28. package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js +166 -87
  29. package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
  30. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +639 -322
  31. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  32. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +146 -76
  33. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
  34. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +17 -52
  35. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +25 -22
  36. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +7 -23
  37. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.d.ts +2 -1
  38. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +168 -4
  39. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
  40. package/lib/{factory/createAutoBeApplication.d.ts → orchestrate/facade/createAutoBeFacadeController.d.ts} +2 -2
  41. package/lib/orchestrate/facade/createAutoBeFacadeController.js +1308 -0
  42. package/lib/orchestrate/facade/createAutoBeFacadeController.js.map +1 -0
  43. package/lib/orchestrate/facade/histories/IAutoBeFacadeApplication.js.map +1 -0
  44. package/lib/orchestrate/facade/histories/IAutoBeFacadeApplicationProps.js.map +1 -0
  45. package/lib/orchestrate/facade/histories/IAutoBeFacadeApplicationResult.js.map +1 -0
  46. package/lib/orchestrate/facade/{transformFacadeStateMessage.d.ts → structures/transformFacadeStateMessage.d.ts} +1 -1
  47. package/lib/orchestrate/facade/structures/transformFacadeStateMessage.js.map +1 -0
  48. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +2 -2
  49. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  50. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
  51. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  52. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +3 -2
  53. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
  54. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +1 -1
  55. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
  56. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
  57. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  58. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
  59. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  60. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
  61. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  62. package/lib/orchestrate/interface/orchestrateInterface.d.ts +1 -1
  63. package/lib/orchestrate/interface/orchestrateInterface.js +15 -8
  64. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
  65. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +874 -49
  66. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  67. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +1858 -67
  68. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  69. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +251 -133
  70. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  71. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +0 -6
  72. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +257 -135
  73. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -1
  74. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +341 -227
  75. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
  76. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +761 -49
  77. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  78. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +911 -50
  79. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  80. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +207 -4
  81. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -1
  82. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +109 -2
  83. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js.map +1 -1
  84. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.d.ts +5 -3
  85. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js +1904 -77
  86. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -1
  87. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +1858 -67
  88. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  89. package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +23 -23
  90. package/lib/orchestrate/prisma/orchestratePrisma.d.ts +1 -1
  91. package/lib/orchestrate/prisma/orchestratePrisma.js +1 -0
  92. package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  93. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +391 -197
  94. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  95. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +1168 -591
  96. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  97. package/lib/orchestrate/prisma/orchestratePrismaReview.js +1186 -600
  98. package/lib/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
  99. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +6 -3
  100. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
  101. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +2 -2
  102. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -1
  103. package/lib/orchestrate/realize/orchestrateRealize.d.ts +1 -1
  104. package/lib/orchestrate/realize/orchestrateRealize.js +2 -1
  105. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
  106. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +362 -180
  107. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  108. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +399 -199
  109. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
  110. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +133 -4
  111. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  112. package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js +171 -7
  113. package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js.map +1 -1
  114. package/lib/orchestrate/realize/orchestrateRealizeWrite.js +132 -3
  115. package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  116. package/lib/orchestrate/realize/utils/replaceImportStatements.js +0 -85
  117. package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
  118. package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  119. package/lib/orchestrate/test/orchestrateTest.d.ts +1 -1
  120. package/lib/orchestrate/test/orchestrateTest.js +2 -1
  121. package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
  122. package/lib/orchestrate/test/orchestrateTestCorrect.js +134 -3
  123. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  124. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +169 -4
  125. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
  126. package/lib/orchestrate/test/orchestrateTestScenario.js +257 -4
  127. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  128. package/lib/orchestrate/test/orchestrateTestScenarioReview.js +283 -4
  129. package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
  130. package/lib/orchestrate/test/orchestrateTestWrite.js +141 -3
  131. package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  132. package/lib/utils/TokenUsageComputer.d.ts +5 -0
  133. package/lib/utils/TokenUsageComputer.js +29 -0
  134. package/lib/utils/TokenUsageComputer.js.map +1 -0
  135. package/package.json +10 -10
  136. package/src/AutoBeAgent.ts +40 -6
  137. package/src/AutoBeMockAgent.ts +2 -4
  138. package/src/constants/AutoBeSystemPromptConstant.ts +11 -11
  139. package/src/context/AutoBeContext.ts +8 -0
  140. package/src/context/AutoBeTokenUsage.ts +1 -1
  141. package/src/context/assertSchemaModel.ts +5 -8
  142. package/src/factory/AutoBeFunctionCallingMetricFactory.ts +44 -0
  143. package/src/factory/AutoBeProcessAggregateFactory.ts +141 -0
  144. package/src/factory/createAutoBeContext.ts +96 -36
  145. package/src/orchestrate/analyze/orchestrateAnalyze.ts +1 -0
  146. package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +9 -10
  147. package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +15 -10
  148. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +10 -11
  149. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.ts +19 -54
  150. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +25 -22
  151. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +8 -24
  152. package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +20 -3
  153. package/src/orchestrate/facade/createAutoBeFacadeController.ts +136 -0
  154. package/src/orchestrate/facade/{transformFacadeStateMessage.ts → structures/transformFacadeStateMessage.ts} +2 -2
  155. package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +1 -0
  156. package/src/orchestrate/interface/orchestrateInterface.ts +17 -6
  157. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +13 -2
  158. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +13 -2
  159. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +16 -11
  160. package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +16 -13
  161. package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +19 -15
  162. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +13 -2
  163. package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +16 -2
  164. package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +13 -2
  165. package/src/orchestrate/interface/orchestrateInterfaceSchemaRename.ts +11 -2
  166. package/src/orchestrate/interface/orchestrateInterfaceSchemaReview.ts +24 -16
  167. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +13 -2
  168. package/src/orchestrate/prisma/orchestratePrisma.ts +2 -1
  169. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +15 -10
  170. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +9 -10
  171. package/src/orchestrate/prisma/orchestratePrismaReview.ts +9 -11
  172. package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +2 -1
  173. package/src/orchestrate/realize/orchestrateRealize.ts +3 -2
  174. package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +15 -10
  175. package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +15 -10
  176. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +14 -3
  177. package/src/orchestrate/realize/orchestrateRealizeCorrectCasting.ts +21 -6
  178. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +13 -2
  179. package/src/orchestrate/realize/utils/replaceImportStatements.ts +0 -90
  180. package/src/orchestrate/test/experimental/orchestrateTestWrite.ast +5 -1
  181. package/src/orchestrate/test/histories/transformTestWriteHistories.ts +1 -1
  182. package/src/orchestrate/test/orchestrateTest.ts +3 -2
  183. package/src/orchestrate/test/orchestrateTestCorrect.ts +14 -2
  184. package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +21 -3
  185. package/src/orchestrate/test/orchestrateTestScenario.ts +13 -2
  186. package/src/orchestrate/test/orchestrateTestScenarioReview.ts +13 -2
  187. package/src/orchestrate/test/orchestrateTestWrite.ts +13 -2
  188. package/src/utils/TokenUsageComputer.ts +35 -0
  189. package/lib/context/IAutoBeFacadeApplication.js.map +0 -1
  190. package/lib/context/IAutoBeFacadeApplicationProps.js.map +0 -1
  191. package/lib/context/IAutoBeFacadeApplicationResult.js.map +0 -1
  192. package/lib/factory/createAutoBeApplication.js +0 -942
  193. package/lib/factory/createAutoBeApplication.js.map +0 -1
  194. package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +0 -1
  195. package/src/factory/createAutoBeApplication.ts +0 -123
  196. /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.d.ts +0 -0
  197. /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.js +0 -0
  198. /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.d.ts +0 -0
  199. /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.js +0 -0
  200. /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.d.ts +0 -0
  201. /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.js +0 -0
  202. /package/lib/orchestrate/facade/{transformFacadeStateMessage.js → structures/transformFacadeStateMessage.js} +0 -0
  203. /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.ts +0 -0
  204. /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.ts +0 -0
  205. /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.ts +0 -0
@@ -28,7 +28,7 @@ export const orchestrateAnalyzeWrite = async <Model extends ILlmSchema.Model>(
28
28
  const pointer: IPointer<IAutoBeAnalyzeWriteApplication.IProps | null> = {
29
29
  value: null,
30
30
  };
31
- const { tokenUsage } = await ctx.conversate({
31
+ const { metric, tokenUsage } = await ctx.conversate({
32
32
  source: "analyzeWrite",
33
33
  controller: createController<Model>({
34
34
  model: ctx.model,
@@ -49,7 +49,8 @@ export const orchestrateAnalyzeWrite = async <Model extends ILlmSchema.Model>(
49
49
  ...file,
50
50
  content: pointer.value.content,
51
51
  },
52
- tokenUsage: tokenUsage,
52
+ tokenUsage,
53
+ metric,
53
54
  step: (ctx.state().analyze?.step ?? -1) + 1,
54
55
  total: progress.total,
55
56
  completed: ++progress.completed,
@@ -65,7 +66,11 @@ function createController<Model extends ILlmSchema.Model>(props: {
65
66
  }): IAgenticaController.IClass<Model> {
66
67
  assertSchemaModel(props.model);
67
68
  const application: ILlmApplication<Model> = collection[
68
- props.model
69
+ props.model === "chatgpt"
70
+ ? "chatgpt"
71
+ : props.model === "gemini"
72
+ ? "gemini"
73
+ : "claude"
69
74
  ] satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
70
75
  return {
71
76
  protocol: "class",
@@ -79,14 +84,8 @@ function createController<Model extends ILlmSchema.Model>(props: {
79
84
  };
80
85
  }
81
86
 
82
- const claude = typia.llm.application<
83
- IAutoBeAnalyzeWriteApplication,
84
- "claude"
85
- >();
86
87
  const collection = {
87
88
  chatgpt: typia.llm.application<IAutoBeAnalyzeWriteApplication, "chatgpt">(),
88
- claude,
89
- llama: claude,
90
- deepseek: claude,
91
- "3.1": claude,
89
+ claude: typia.llm.application<IAutoBeAnalyzeWriteApplication, "claude">(),
90
+ gemini: typia.llm.application<IAutoBeAnalyzeWriteApplication, "gemini">(),
92
91
  };
@@ -1,24 +1,11 @@
1
1
  export interface IAutoBeAnalyzeReviewApplication {
2
2
  /**
3
- * Enhances planning documentation to meet all quality standards and requirements.
3
+ * Enhances and finalizes planning documentation.
4
4
  *
5
- * This function receives a document and outputs an improved version directly.
6
- * The output IS the enhanced document itself, NOT review comments or feedback.
5
+ * Receives a draft document and outputs the improved version. The output is
6
+ * the enhanced document itself, not review comments.
7
7
  *
8
- * The enhancement process includes:
9
- * - Expanding sections that are too brief
10
- * - Converting vague statements to specific EARS format requirements
11
- * - Fixing Mermaid diagram syntax errors
12
- * - Adding missing business processes and workflows
13
- * - Ensuring proper document structure and completeness
14
- *
15
- * DO: Output the actual document content that will be saved.
16
- * DO NOT: Output review comments or analysis of the document.
17
- *
18
- * Note: Any text output becomes part of the final document.
19
- *
20
- * @param props - The properties containing the document to enhance along with
21
- * plan and review criteria for guidance
8
+ * @param props - Document content, plan, and review criteria
22
9
  */
23
10
  review(props: IAutoBeAnalyzeReviewApplication.IProps): void;
24
11
  }
@@ -27,7 +14,7 @@ export namespace IAutoBeAnalyzeReviewApplication {
27
14
  export interface IProps {
28
15
  /**
29
16
  * Step 1 (CoT: Review Phase) - Enhancement Criteria
30
- *
17
+ *
31
18
  * The enhancement criteria and guidelines that the agent must follow.
32
19
  *
33
20
  * This includes:
@@ -48,14 +35,16 @@ export namespace IAutoBeAnalyzeReviewApplication {
48
35
  * - DO NOT: Use spaces between brackets and quotes in Mermaid
49
36
  * - DO: Make requirements specific and measurable in natural language
50
37
  * - DO: Focus on business requirements and user scenarios
51
- * - DO NOT: Accept documents containing database schemas or API specifications
52
- * - DO: Describe business model and authentication requirements in natural language
38
+ * - DO NOT: Accept documents containing database schemas or API
39
+ * specifications
40
+ * - DO: Describe business model and authentication requirements in natural
41
+ * language
53
42
  */
54
43
  review: string;
55
44
 
56
45
  /**
57
46
  * Step 2 (CoT: Plan Phase) - Original Document Plan
58
- *
47
+ *
59
48
  * The document plan that was used to create the content.
60
49
  *
61
50
  * This helps the reviewer understand:
@@ -71,43 +60,19 @@ export namespace IAutoBeAnalyzeReviewApplication {
71
60
  plan: string;
72
61
 
73
62
  /**
74
- * Step 3 (CoT: Content Phase) - Complete Document Content
75
- *
76
- * The actual markdown document content that incorporates review feedback.
63
+ * Step 3 (CoT: Content Phase) - Document Content (INPUT → OUTPUT)
77
64
  *
78
- * This field contains a COMPLETE MARKDOWN DOCUMENT that has already
79
- * incorporated the review criteria and plan requirements.
80
- *
81
- * DO: Treat this as the final, production-ready document.
82
- * DO NOT: Treat this as raw input to be reviewed.
83
- *
84
- * This content represents:
85
- * - A fully-formed markdown document (.md file)
86
- * - The result of applying review criteria to the original plan
87
- * - A production-ready document for immediate deployment
88
- * - Complete business requirements ready for developers
89
- *
90
- * The enhancer should treat this as the actual document content:
65
+ * INPUT: The document written by Write Agent (may have issues) OUTPUT: The
66
+ * enhanced, complete markdown document to be saved
91
67
  *
92
- * - Length and completeness (minimum 2,000 characters, more for technical
93
- * docs)
94
- * - All sections from the plan are fully written
95
- * - No vague or abstract statements
96
- * - Proper use of EARS format for requirements
97
- * - Correct Mermaid diagram syntax (double quotes mandatory)
98
- * - Appropriate level of detail for backend implementation
99
- * - Proper document linking (descriptive text, not raw filenames)
68
+ * Enhancement requirements:
100
69
  *
101
- * The enhancer outputs the document itself:
70
+ * - Fix Mermaid syntax errors (add quotes, fix arrows)
71
+ * - Convert vague statements to EARS format
72
+ * - Expand sections that are too brief
73
+ * - Add missing business processes
102
74
  *
103
- * - If content is provided, it represents the actual document
104
- * - The enhancer outputs the enhanced version AS the document itself
105
- * - No meta-commentary or review feedback should be in the output
106
- * - The output becomes the saved .md file directly
107
- *
108
- * Example of what this field contains:
109
- * "# Service Overview\n## Vision\nThe service provides..." (actual document)
110
- * NOT: "This document should cover service overview..." (review comment)
75
+ * Output must be the actual document content (not review comments).
111
76
  */
112
77
  content: string;
113
78
  }
@@ -4,18 +4,12 @@ import { tags } from "typia";
4
4
 
5
5
  export interface IAutoBeAnalyzeScenarioApplication {
6
6
  /**
7
- * Compose project structure with actors and files.
7
+ * Composes project structure with actors and documentation files.
8
8
  *
9
- * Design a list of actors and initial documents that you need to create for
10
- * that requirement. Actors define user types and their responsibilities, while files
11
- * define the documentation structure. These are managed separately. If you
12
- * determine from the conversation that the user's requirements have not been
13
- * fully gathered, you must stop the analysis and continue collecting the
14
- * remaining requirements. In this case, you do not need to generate any files
15
- * or actors. Simply pass an empty array to `input.files` and `input.actors`.
9
+ * Determines the list of user actors and documents to generate based on
10
+ * requirements. If requirements are incomplete, returns empty arrays.
16
11
  *
17
- * @param input Prefix, actors, and files
18
- * @returns
12
+ * @param input - Project prefix, actors, and file list
19
13
  */
20
14
  compose(input: IAutoBeAnalyzeScenarioApplication.IProps): void;
21
15
  }
@@ -33,7 +27,15 @@ export namespace IAutoBeAnalyzeScenarioApplication {
33
27
  */
34
28
  prefix: string & CamelCasePattern;
35
29
 
36
- /** Actors to be assigned for the project */
30
+ /**
31
+ * Actors to be assigned for the project.
32
+ *
33
+ * Each actor has:
34
+ *
35
+ * - `name`: Actor identifier (camelCase)
36
+ * - `kind`: "guest" | "member" | "admin"
37
+ * - `description`: Actor's permissions and capabilities
38
+ */
37
39
  actors: AutoBeAnalyzeActor[];
38
40
 
39
41
  /**
@@ -53,12 +55,14 @@ export namespace IAutoBeAnalyzeScenarioApplication {
53
55
  page: number;
54
56
 
55
57
  /**
56
- * # Document files to be generated
57
- *
58
- * File name must be English and it must contain the numbering and prefix.
58
+ * Array of document metadata objects defining files to be generated.
59
59
  *
60
- * These files represent business documentation that may include:
60
+ * Each array element is an AutoBeAnalyzeFile.Scenario object containing:
61
+ * - filename: The output file name (e.g., "01-service-overview.md")
62
+ * - reason: Why this document is being created
63
+ * - documentType, outline, constraints, etc.: Metadata guiding content generation
61
64
  *
65
+ * These documents represent business-focused planning documentation:
62
66
  * - Business requirements and functional specifications in natural language
63
67
  * - User journey mapping and use case scenarios
64
68
  * - Business rules and workflow definitions
@@ -68,17 +72,16 @@ export namespace IAutoBeAnalyzeScenarioApplication {
68
72
  * - DO NOT: Include database schemas, ERD, or API specifications
69
73
  * - DO: Write all requirements in natural language for clarity
70
74
  *
71
- * Generate files based on actual requirements gathered from conversation.
75
+ * Generate metadata objects based on actual requirements gathered from conversation.
72
76
  * Do not create unnecessary documentation - only generate what is needed to
73
77
  * properly define the business requirements and system specifications.
74
78
  *
75
- * # Page Length Rules
79
+ * # Array Length Rules
76
80
  *
77
- * The number of documents must match the user's request, excluding the
78
- * table of contents. For example, if the user requests 3 pages, a total of
79
- * 4 documents should be generated, including the table of contents. If the
80
- * user does not specify a number, generate a sufficient number of documents
81
- * to adequately support the service.
81
+ * The array length must match the user's requested page count plus one for ToC.
82
+ * For example: user requests 3 pages generate 4 objects (1 ToC + 3 content).
83
+ * If user does not specify a number, generate sufficient objects to adequately
84
+ * document the service (typically 11+ objects including ToC).
82
85
  */
83
86
  files: Array<AutoBeAnalyzeFile.Scenario> & tags.MinItems<1>;
84
87
  }
@@ -16,7 +16,7 @@ export namespace IAutoBeAnalyzeWriteApplication {
16
16
  export interface IProps {
17
17
  /**
18
18
  * Step 1 (CoT: Plan Phase) - Document Planning Structure
19
- *
19
+ *
20
20
  * The document planning structure that outlines what needs to be written.
21
21
  *
22
22
  * This includes:
@@ -42,33 +42,17 @@ export namespace IAutoBeAnalyzeWriteApplication {
42
42
  plan: string;
43
43
 
44
44
  /**
45
- * Step 2 (CoT: Write Phase) - Document Content Creation
46
- *
47
- * The initial content or context for the document being written.
48
- *
49
- * This may include:
50
- *
51
- * - User requirements and business goals
52
- * - Existing documentation to build upon
53
- * - Specific scenarios or use cases to document
54
- * - Technical constraints or preferences
55
- * - Related documents for reference
45
+ * Step 2 (CoT: Write Phase) - Complete Document Content
56
46
  *
57
- * The content provides the raw material that the AI agent will transform
58
- * into structured, developer-ready documentation following the planning
59
- * guidelines.
47
+ * The complete, production-ready markdown document content to be saved.
60
48
  *
61
- * The AI agent will expand this content into comprehensive documentation
62
- * that:
49
+ * Requirements:
63
50
  *
64
- * - Removes all ambiguity for backend developers
65
- * - Provides specific, measurable requirements in natural language
66
- * - Focuses on business logic and requirements, NOT technical implementation
67
- * - STRICTLY PROHIBITED: Do NOT write database schemas, ERD, or API
68
- * specifications
51
+ * - Minimum 5,000 characters for technical documents
69
52
  * - Uses EARS format for all applicable requirements
70
- * - Follows proper document linking conventions
71
- * - Includes Mermaid diagrams with proper syntax (double quotes mandatory)
53
+ * - Includes proper Mermaid diagram syntax (double quotes for labels)
54
+ * - Focuses on business requirements in natural language
55
+ * - PROHIBITED: Database schemas, ERD, API specifications
72
56
  */
73
57
  content: string;
74
58
  }
@@ -1,4 +1,5 @@
1
1
  import {
2
+ AutoBeFunctionCallingMetric,
2
3
  AutoBeRealizeCorrectEvent,
3
4
  AutoBeRealizeValidateEvent,
4
5
  AutoBeTestCorrectEvent,
@@ -33,6 +34,7 @@ interface IFactoryProps<
33
34
  draft: string;
34
35
  review: string | undefined;
35
36
  final: string | undefined;
37
+ metric: AutoBeFunctionCallingMetric;
36
38
  tokenUsage: IAutoBeTokenUsageJson.IComponent;
37
39
  }): CorrectEvent;
38
40
  script(event: ValidateEvent): string;
@@ -92,7 +94,7 @@ const correct = async <
92
94
  > = {
93
95
  value: null,
94
96
  };
95
- const { tokenUsage } = await ctx.conversate({
97
+ const { metric, tokenUsage } = await ctx.conversate({
96
98
  source: factory.source,
97
99
  histories: transformCommonCorrectCastingHistories(
98
100
  [...failures, event].map((e) => ({
@@ -115,7 +117,7 @@ const correct = async <
115
117
  message: StringUtil.trim`
116
118
  Fix the TypeScript casting problems to resolve the compilation error.
117
119
 
118
- You don't need to explain me anything, but just fix or give it up
120
+ You don't need to explain me anything, but just fix or give it up
119
121
  immediately without any hesitation, explanation, and questions.
120
122
  `,
121
123
  });
@@ -129,6 +131,7 @@ const correct = async <
129
131
  draft: pointer.value.draft,
130
132
  review: pointer.value.revise.review,
131
133
  final: pointer.value.revise.final ?? undefined,
134
+ metric,
132
135
  tokenUsage,
133
136
  }),
134
137
  );
@@ -167,7 +170,11 @@ const createController = <Model extends ILlmSchema.Model>(props: {
167
170
  : result;
168
171
  };
169
172
  const application = collection[
170
- props.model === "chatgpt" ? "chatgpt" : "claude"
173
+ props.model === "chatgpt"
174
+ ? "chatgpt"
175
+ : props.model === "gemini"
176
+ ? "gemini"
177
+ : "claude"
171
178
  ](validate) satisfies ILlmApplication<any> as any as ILlmApplication<Model>;
172
179
  return {
173
180
  protocol: "class",
@@ -205,6 +212,16 @@ const collection = {
205
212
  }),
206
213
  },
207
214
  }),
215
+ gemini: (validate: Validator) =>
216
+ typia.llm.application<IAutoBeCommonCorrectCastingApplication, "gemini">({
217
+ validate: {
218
+ rewrite: validate,
219
+ reject: () => ({
220
+ success: true,
221
+ data: undefined,
222
+ }),
223
+ },
224
+ }),
208
225
  };
209
226
 
210
227
  type Validator = (
@@ -0,0 +1,136 @@
1
+ import { IAgenticaController } from "@agentica/core";
2
+ import {
3
+ AutoBeAnalyzeHistory,
4
+ AutoBeAssistantMessageEvent,
5
+ AutoBeAssistantMessageHistory,
6
+ AutoBeInterfaceHistory,
7
+ AutoBePrismaHistory,
8
+ AutoBeRealizeHistory,
9
+ AutoBeTestHistory,
10
+ } from "@autobe/interface";
11
+ import { StringUtil } from "@autobe/utils";
12
+ import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
13
+ import typia from "typia";
14
+
15
+ import { AutoBeContext } from "../../context/AutoBeContext";
16
+ import { assertSchemaModel } from "../../context/assertSchemaModel";
17
+ import { orchestrateAnalyze } from "../analyze/orchestrateAnalyze";
18
+ import { orchestrateInterface } from "../interface/orchestrateInterface";
19
+ import { orchestratePrisma } from "../prisma/orchestratePrisma";
20
+ import { orchestrateRealize } from "../realize/orchestrateRealize";
21
+ import { orchestrateTest } from "../test/orchestrateTest";
22
+ import { IAutoBeFacadeApplication } from "./histories/IAutoBeFacadeApplication";
23
+
24
+ export const createAutoBeFacadeController = <
25
+ Model extends ILlmSchema.Model,
26
+ >(props: {
27
+ model: Model;
28
+ context: AutoBeContext<Model>;
29
+ }): IAgenticaController.IClass<Model> => {
30
+ assertSchemaModel(props.model);
31
+ const application: ILlmApplication<Model> = collection[
32
+ props.model === "chatgpt"
33
+ ? "chatgpt"
34
+ : props.model === "gemini"
35
+ ? "gemini"
36
+ : "claude"
37
+ ] satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
38
+ return {
39
+ protocol: "class",
40
+ name: "autobe",
41
+ application,
42
+ execute: {
43
+ analyze: async () => {
44
+ const history: AutoBeAssistantMessageHistory | AutoBeAnalyzeHistory =
45
+ await orchestrateAnalyze(props.context);
46
+ if (history.type === "assistantMessage")
47
+ return {
48
+ type: "in-progress",
49
+ description: StringUtil.trim`
50
+ Requirements are not yet fully elicited,
51
+ therefore additional questions will be made to the user.
52
+ `,
53
+ };
54
+ return {
55
+ type: "success",
56
+ description:
57
+ "Analysis completed successfully, and report has been published.",
58
+ };
59
+ },
60
+ prisma: async (next) => {
61
+ const history: AutoBeAssistantMessageHistory | AutoBePrismaHistory =
62
+ await orchestratePrisma(props.context, next);
63
+ if (history.type === "assistantMessage")
64
+ return {
65
+ type: "prerequisites-not-satisfied",
66
+ description: "Requirement analysis is not yet completed.",
67
+ };
68
+ return {
69
+ type: history.compiled.type,
70
+ description:
71
+ history.compiled.type === "success"
72
+ ? "Prisma schemas have been generated successfully."
73
+ : history.result.success === false ||
74
+ history.compiled.type === "failure"
75
+ ? "Prisma schemas are generated, but compilation failed."
76
+ : "Unexpected error occurred while generating Prisma schemas.",
77
+ };
78
+ },
79
+ interface: async (next) => {
80
+ const history: AutoBeAssistantMessageEvent | AutoBeInterfaceHistory =
81
+ await orchestrateInterface(props.context)(next);
82
+ if (history.type === "assistantMessage")
83
+ return {
84
+ type: "prerequisites-not-satisfied",
85
+ description: "Prisma schemas are not yet completed.",
86
+ };
87
+ return {
88
+ type: "success",
89
+ description: "API interfaces have been designed successfully.",
90
+ };
91
+ },
92
+ test: async (next) => {
93
+ const history: AutoBeAssistantMessageHistory | AutoBeTestHistory =
94
+ await orchestrateTest(props.context)(next);
95
+ if (history.type === "assistantMessage")
96
+ return {
97
+ type: "prerequisites-not-satisfied",
98
+ description: "API interfaces are not yet completed.",
99
+ };
100
+ return {
101
+ type: history.compiled.type,
102
+ description:
103
+ history.compiled.type === "success"
104
+ ? "Test functions have been generated successfully."
105
+ : history.compiled.type === "failure"
106
+ ? "Test functions are written, but compilation failed."
107
+ : "Unexpected error occurred while writing test functions.",
108
+ };
109
+ },
110
+ realize: async (next) => {
111
+ const history: AutoBeAssistantMessageHistory | AutoBeRealizeHistory =
112
+ await orchestrateRealize(props.context)(next);
113
+ if (history.type === "assistantMessage")
114
+ return {
115
+ type: "prerequisites-not-satisfied",
116
+ description: "API interfaces are not yet completed.",
117
+ };
118
+ return {
119
+ type: history.compiled.type,
120
+ description:
121
+ history.compiled.type === "success"
122
+ ? "API implementation codes have been generated successfully."
123
+ : history.compiled.type === "failure"
124
+ ? "Implementation codes are composed, but compilation failed."
125
+ : "Unexpected error occurred while writing implementation codes.",
126
+ };
127
+ },
128
+ } satisfies IAutoBeFacadeApplication,
129
+ };
130
+ };
131
+
132
+ const collection = {
133
+ chatgpt: typia.llm.application<IAutoBeFacadeApplication, "chatgpt">(),
134
+ claude: typia.llm.application<IAutoBeFacadeApplication, "claude">(),
135
+ gemini: typia.llm.application<IAutoBeFacadeApplication, "gemini">(),
136
+ };
@@ -1,7 +1,7 @@
1
1
  import { StringUtil } from "@autobe/utils";
2
2
 
3
- import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
4
- import { AutoBeState } from "../../context/AutoBeState";
3
+ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
4
+ import { AutoBeState } from "../../../context/AutoBeState";
5
5
 
6
6
  export function transformFacadeStateMessage(state: AutoBeState): string {
7
7
  const currentState: ICurrentState = getCurrentState(state);
@@ -24,6 +24,7 @@ export const transformInterfaceEndpointsReviewHistories = (
24
24
  type: "assistantMessage",
25
25
  text: [
26
26
  "Below are endpoints generated by your request.",
27
+ "",
27
28
  "```json",
28
29
  JSON.stringify(endpoints),
29
30
  "```",
@@ -5,6 +5,7 @@ import {
5
5
  AutoBeInterfaceGroupEvent,
6
6
  AutoBeInterfaceHistory,
7
7
  AutoBeOpenApi,
8
+ AutoBeProgressEventBase,
8
9
  } from "@autobe/interface";
9
10
  import { AutoBeInterfacePrerequisite } from "@autobe/interface/src/histories/contents/AutoBeInterfacePrerequisite";
10
11
  import {
@@ -16,10 +17,11 @@ import { ILlmSchema } from "@samchon/openapi";
16
17
  import { HashMap, Pair } from "tstl";
17
18
  import { v7 } from "uuid";
18
19
 
20
+ import { AutoBeConfigConstant } from "../../constants/AutoBeConfigConstant";
19
21
  import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
20
22
  import { AutoBeContext } from "../../context/AutoBeContext";
21
- import { IAutoBeFacadeApplicationProps } from "../../context/IAutoBeFacadeApplicationProps";
22
23
  import { predicateStateMessage } from "../../utils/predicateStateMessage";
24
+ import { IAutoBeFacadeApplicationProps } from "../facade/histories/IAutoBeFacadeApplicationProps";
23
25
  import { orchestrateInterfaceAuthorizations } from "./orchestrateInterfaceAuthorizations";
24
26
  import { orchestrateInterfaceComplement } from "./orchestrateInterfaceComplement";
25
27
  import { orchestrateInterfaceEndpoints } from "./orchestrateInterfaceEndpoints";
@@ -130,19 +132,26 @@ export const orchestrateInterface =
130
132
  );
131
133
  await complement();
132
134
 
135
+ const reviewProgress: AutoBeProgressEventBase = {
136
+ completed: 0,
137
+ total: Math.ceil(
138
+ Object.keys(document.components.schemas).length /
139
+ AutoBeConfigConstant.INTERFACE_CAPACITY,
140
+ ),
141
+ };
133
142
  for (const config of [
134
143
  {
135
- type: "interfaceSchemaSecurityReview" as const,
144
+ kind: "security" as const,
136
145
  systemPrompt:
137
146
  AutoBeSystemPromptConstant.INTERFACE_SCHEMA_SECURITY_REVIEW,
138
147
  },
139
148
  {
140
- type: "interfaceSchemaRelationReview" as const,
149
+ kind: "relation" as const,
141
150
  systemPrompt:
142
151
  AutoBeSystemPromptConstant.INTERFACE_SCHEMA_RELATION_REVIEW,
143
152
  },
144
153
  {
145
- type: "interfaceSchemaContentReview" as const,
154
+ kind: "content" as const,
146
155
  systemPrompt:
147
156
  AutoBeSystemPromptConstant.INTERFACE_SCHEMA_CONTENT_REVIEW,
148
157
  },
@@ -151,6 +160,7 @@ export const orchestrateInterface =
151
160
  await orchestrateInterfaceSchemaReview(ctx, config, {
152
161
  instruction: props.instruction,
153
162
  document,
163
+ progress: reviewProgress,
154
164
  }),
155
165
  );
156
166
  if (missedOpenApiSchemas(document).length !== 0) await complement();
@@ -181,8 +191,9 @@ export const orchestrateInterface =
181
191
  document,
182
192
  missed: missedOpenApiSchemas(document),
183
193
  authorizations,
184
- created_at: new Date().toISOString(),
185
- elapsed: new Date().getTime() - start.getTime(),
194
+ aggregates: ctx.getCurrentAggregates("interface"),
186
195
  step: ctx.state().analyze?.step ?? 0,
196
+ elapsed: new Date().getTime() - start.getTime(),
197
+ created_at: new Date().toISOString(),
187
198
  } satisfies AutoBeInterfaceCompleteEvent);
188
199
  };
@@ -62,7 +62,7 @@ async function process<Model extends ILlmSchema.Model>(
62
62
  {
63
63
  value: null,
64
64
  };
65
- const { tokenUsage } = await ctx.conversate({
65
+ const { metric, tokenUsage } = await ctx.conversate({
66
66
  source: "interfaceAuthorization",
67
67
  histories: transformInterfaceAuthorizationsHistories({
68
68
  state: ctx.state(),
@@ -88,6 +88,7 @@ async function process<Model extends ILlmSchema.Model>(
88
88
  id: v7(),
89
89
  operations: pointer.value.operations,
90
90
  completed: ++props.progress.completed,
91
+ metric,
91
92
  tokenUsage,
92
93
  created_at: new Date().toISOString(),
93
94
  step: ctx.state().analyze?.step ?? 0,
@@ -195,7 +196,11 @@ function createController<Model extends ILlmSchema.Model>(props: {
195
196
  };
196
197
 
197
198
  const application: ILlmApplication<Model> = collection[
198
- props.model === "chatgpt" ? "chatgpt" : "claude"
199
+ props.model === "chatgpt"
200
+ ? "chatgpt"
201
+ : props.model === "gemini"
202
+ ? "gemini"
203
+ : "claude"
199
204
  ](
200
205
  validate,
201
206
  ) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
@@ -227,6 +232,12 @@ const collection = {
227
232
  makeOperations: validate,
228
233
  },
229
234
  }),
235
+ gemini: (validate: Validator) =>
236
+ typia.llm.application<IAutoBeInterfaceAuthorizationsApplication, "gemini">({
237
+ validate: {
238
+ makeOperations: validate,
239
+ },
240
+ }),
230
241
  };
231
242
 
232
243
  type Validator = (
@@ -50,7 +50,7 @@ async function step<Model extends ILlmSchema.Model>(
50
50
  > | null> = {
51
51
  value: null,
52
52
  };
53
- const { tokenUsage } = await ctx.conversate({
53
+ const { metric, tokenUsage } = await ctx.conversate({
54
54
  source: "interfaceComplement",
55
55
  histories: transformInterfaceComplementHistories({
56
56
  state: ctx.state(),
@@ -86,6 +86,7 @@ async function step<Model extends ILlmSchema.Model>(
86
86
  id: v7(),
87
87
  missed,
88
88
  schemas: pointer.value,
89
+ metric,
89
90
  tokenUsage,
90
91
  step: ctx.state().analyze?.step ?? 0,
91
92
  created_at: new Date().toISOString(),
@@ -155,7 +156,11 @@ function createController<Model extends ILlmSchema.Model>(props: {
155
156
  };
156
157
 
157
158
  const application: ILlmApplication<Model> = collection[
158
- props.model === "chatgpt" ? "chatgpt" : "claude"
159
+ props.model === "chatgpt"
160
+ ? "chatgpt"
161
+ : props.model === "gemini"
162
+ ? "gemini"
163
+ : "claude"
159
164
  ](
160
165
  validate,
161
166
  ) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
@@ -184,6 +189,12 @@ const collection = {
184
189
  complementComponents: validate,
185
190
  },
186
191
  }),
192
+ gemini: (validate: Validator) =>
193
+ typia.llm.application<IAutoBeInterfaceComplementApplication, "gemini">({
194
+ validate: {
195
+ complementComponents: validate,
196
+ },
197
+ }),
187
198
  };
188
199
 
189
200
  type Validator = (