@autobe/agent 0.25.0 → 0.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/lib/AutoBeAgent.js +11 -1
  2. package/lib/AutoBeAgent.js.map +1 -1
  3. package/lib/AutoBeMockAgent.js +1 -0
  4. package/lib/AutoBeMockAgent.js.map +1 -1
  5. package/lib/constants/AutoBeSystemPromptConstant.d.ts +13 -13
  6. package/lib/factory/createAutoBeContext.js +1 -0
  7. package/lib/factory/createAutoBeContext.js.map +1 -1
  8. package/lib/index.mjs +2250 -806
  9. package/lib/index.mjs.map +1 -1
  10. package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +1 -1
  11. package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +1 -1
  12. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +36 -23
  13. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
  14. package/lib/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.d.ts +22 -42
  15. package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.d.ts +3 -0
  16. package/lib/orchestrate/interface/histories/{transformInterfacePrerequisiteHistories.js → transformInterfaceCommonPrerequisiteHistories.js} +4 -4
  17. package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.js.map +1 -0
  18. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +2 -2
  19. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  20. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +3 -3
  21. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
  22. package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.d.ts +3 -0
  23. package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js +102 -0
  24. package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js.map +1 -0
  25. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
  26. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  27. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +2 -2
  28. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
  29. package/lib/orchestrate/interface/orchestrateInterface.js +25 -9
  30. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
  31. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +260 -29
  32. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  33. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +56 -64
  34. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  35. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +3 -3
  36. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  37. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +2 -2
  38. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +4 -5
  39. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  40. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +260 -29
  41. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  42. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.d.ts +5 -0
  43. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +713 -0
  44. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -0
  45. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +47 -35
  46. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  47. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js +41 -7
  48. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
  49. package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +0 -38
  50. package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +6 -10
  51. package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.d.ts +52 -0
  52. package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.js +3 -0
  53. package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.js.map +1 -0
  54. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +0 -33
  55. package/lib/orchestrate/interface/utils/JsonSchemaFactory.d.ts +6 -2
  56. package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +105 -5
  57. package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
  58. package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +20 -1
  59. package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
  60. package/lib/orchestrate/interface/utils/OperationValidator.d.ts +3 -4
  61. package/lib/orchestrate/interface/utils/OperationValidator.js +1 -1
  62. package/lib/orchestrate/interface/utils/OperationValidator.js.map +1 -1
  63. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +9 -10
  64. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -1
  65. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +14 -22
  66. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  67. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +6 -6
  68. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +8 -2
  69. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  70. package/lib/orchestrate/realize/internal/compileRealizeFiles.js +1 -2
  71. package/lib/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
  72. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.d.ts +2 -1
  73. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js +103 -40
  74. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +1 -1
  75. package/lib/orchestrate/realize/orchestrateRealize.js +81 -45
  76. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
  77. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +117 -87
  78. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  79. package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -1
  80. package/lib/orchestrate/realize/orchestrateRealizeWrite.js +117 -54
  81. package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  82. package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +52 -26
  83. package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +44 -34
  84. package/lib/orchestrate/realize/utils/InternalFileSystem.js +1 -1
  85. package/lib/orchestrate/realize/utils/InternalFileSystem.js.map +1 -1
  86. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +8 -3
  87. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +44 -17
  88. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -1
  89. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +4 -1
  90. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js +24 -9
  91. package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -1
  92. package/lib/orchestrate/realize/utils/printErrorHints.d.ts +8 -0
  93. package/lib/orchestrate/realize/utils/printErrorHints.js +48 -0
  94. package/lib/orchestrate/realize/utils/printErrorHints.js.map +1 -0
  95. package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +1 -0
  96. package/lib/orchestrate/realize/utils/replaceImportStatements.js +93 -55
  97. package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
  98. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +1 -1
  99. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  100. package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +1 -1
  101. package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +1 -1
  102. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +10 -79
  103. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  104. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +15 -65
  105. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
  106. package/lib/orchestrate/test/histories/transformTestWriteHistories.js +1 -1
  107. package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  108. package/lib/orchestrate/test/orchestrateTestCorrect.js +32 -17
  109. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  110. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +31 -13
  111. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
  112. package/lib/orchestrate/test/orchestrateTestScenario.d.ts +1 -1
  113. package/lib/orchestrate/test/orchestrateTestScenario.js +5 -5
  114. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  115. package/lib/orchestrate/test/orchestrateTestScenarioReview.js +1 -1
  116. package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
  117. package/lib/orchestrate/test/orchestrateTestWrite.js +37 -21
  118. package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  119. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +9 -5
  120. package/lib/orchestrate/test/structures/IAutoBeTestCorrectInvalidRequestApplication.d.ts +8 -2
  121. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +11 -7
  122. package/lib/orchestrate/test/utils/getPrerequisites.d.ts +5 -0
  123. package/lib/orchestrate/test/utils/getPrerequisites.js +36 -0
  124. package/lib/orchestrate/test/utils/getPrerequisites.js.map +1 -0
  125. package/lib/orchestrate/test/utils/getReferenceIds.js +1 -1
  126. package/lib/orchestrate/test/utils/getReferenceIds.js.map +1 -1
  127. package/package.json +5 -5
  128. package/src/AutoBeAgent.ts +17 -1
  129. package/src/AutoBeMockAgent.ts +1 -0
  130. package/src/constants/AutoBeSystemPromptConstant.ts +13 -13
  131. package/src/factory/createAutoBeContext.ts +1 -0
  132. package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +2 -2
  133. package/src/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.ts +25 -45
  134. package/src/orchestrate/interface/histories/{transformInterfacePrerequisiteHistories.ts → transformInterfaceCommonPrerequisiteHistories.ts} +1 -1
  135. package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +4 -2
  136. package/src/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.ts +118 -0
  137. package/src/orchestrate/interface/orchestrateInterface.ts +43 -17
  138. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +12 -33
  139. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +5 -5
  140. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +7 -6
  141. package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +274 -0
  142. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +1 -1
  143. package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +1 -1
  144. package/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.ts +0 -39
  145. package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +6 -10
  146. package/src/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.ts +58 -0
  147. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +0 -34
  148. package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +92 -4
  149. package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +19 -1
  150. package/src/orchestrate/interface/utils/OperationValidator.ts +9 -7
  151. package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +9 -10
  152. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +13 -24
  153. package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +6 -6
  154. package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +6 -4
  155. package/src/orchestrate/realize/internal/compileRealizeFiles.ts +1 -5
  156. package/src/orchestrate/realize/orchestRateRealizeCorrectCasting.ts +84 -17
  157. package/src/orchestrate/realize/orchestrateRealize.ts +125 -74
  158. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +33 -6
  159. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +14 -4
  160. package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +54 -29
  161. package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +46 -35
  162. package/src/orchestrate/realize/utils/InternalFileSystem.ts +1 -1
  163. package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +54 -22
  164. package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +28 -16
  165. package/src/orchestrate/realize/utils/printErrorHints.ts +55 -0
  166. package/src/orchestrate/realize/utils/replaceImportStatements.ts +99 -102
  167. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +18 -91
  168. package/src/orchestrate/test/histories/transformTestScenarioReviewHistories.ts +17 -90
  169. package/src/orchestrate/test/orchestrateTestCorrect.ts +7 -6
  170. package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +13 -1
  171. package/src/orchestrate/test/orchestrateTestScenario.ts +12 -6
  172. package/src/orchestrate/test/orchestrateTestScenarioReview.ts +3 -3
  173. package/src/orchestrate/test/orchestrateTestWrite.ts +7 -6
  174. package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +9 -228
  175. package/src/orchestrate/test/structures/IAutoBeTestCorrectInvalidRequestApplication.ts +8 -2
  176. package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +11 -78
  177. package/src/orchestrate/test/utils/getPrerequisites.ts +51 -0
  178. package/src/orchestrate/test/utils/getReferenceIds.ts +2 -1
  179. package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.d.ts +0 -3
  180. package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.js.map +0 -1
  181. package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.d.ts +0 -6
  182. package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.js +0 -22
  183. package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.js.map +0 -1
  184. package/src/orchestrate/interface/utils/OpenApiEndpointComparator.ts +0 -23
@@ -99,11 +99,12 @@ async function process<Model extends ILlmSchema.Model>(
99
99
  throw new Error("Failed to create test code.");
100
100
  }
101
101
 
102
- pointer.value.revise.final = await completeTestCode(
103
- ctx,
104
- artifacts,
105
- pointer.value.revise.final,
106
- );
102
+ if (pointer.value.revise.final)
103
+ pointer.value.revise.final = await completeTestCode(
104
+ ctx,
105
+ artifacts,
106
+ pointer.value.revise.final,
107
+ );
107
108
  pointer.value.draft = await completeTestCode(
108
109
  ctx,
109
110
  artifacts,
@@ -118,7 +119,7 @@ async function process<Model extends ILlmSchema.Model>(
118
119
  domain: pointer.value.domain,
119
120
  draft: pointer.value.draft,
120
121
  review: pointer.value.revise?.review,
121
- final: pointer.value.revise?.final,
122
+ final: pointer.value.revise?.final ?? undefined,
122
123
  tokenUsage,
123
124
  completed: ++progress.completed,
124
125
  total: progress.total,
@@ -91,161 +91,6 @@ export namespace IAutoBeTestCorrectApplication {
91
91
  revise: IReviseProps;
92
92
  }
93
93
 
94
- // /**
95
- // * Comprehensive compilation error analysis and correction planning
96
- // * properties.
97
- // *
98
- // * This interface structures the AI's deep thinking process during error
99
- // * correction, requiring individual analysis of each compilation error along
100
- // * with an overall strategy assessment. The AI must meticulously examine every
101
- // * error message, understand its root cause, and propose targeted solutions
102
- // * while maintaining a holistic view of the correction process.
103
- // *
104
- // * The structure enforces granular error analysis while ensuring the AI
105
- // * maintains awareness of overarching patterns and systemic issues that may
106
- // * require broader strategic changes like scenario rewrites or architectural
107
- // * adjustments.
108
- // */
109
- // export interface IThinkProps {
110
- // /**
111
- // * Individual analyses for each compilation diagnostic.
112
- // *
113
- // * Contains detailed examination of every compilation error encountered,
114
- // * with specific analysis and targeted solutions. Each entry represents a
115
- // * single compilation diagnostic that must be resolved. The AI must read the
116
- // * IAutoBeTypeScriptCompileResult.IDiagnostic objects, interpret their
117
- // * content, and provide human-readable summaries along with precise fixes.
118
- // *
119
- // * This granular approach ensures no error is overlooked and each issue
120
- // * receives appropriate attention and resolution strategy.
121
- // */
122
- // analyses: IDiagnosticAnalysis[] & tags.MinItems<1>;
123
-
124
- // /**
125
- // * Overall assessment of compilation issues and correction strategies.
126
- // *
127
- // * Synthesizes patterns across all individual errors to identify systemic
128
- // * issues and overarching correction strategies. This includes verification
129
- // * of TEST_WRITE.md and TEST_CORRECT.md compliance, assessment of whether
130
- // * scenario rewrites are needed, identification of common error patterns,
131
- // * and documentation of broad strategic decisions.
132
- // *
133
- // * Must address: type safety compliance, async/await patterns, scenario
134
- // * adaptation requirements, and overall code quality considerations that
135
- // * span multiple errors.
136
- // */
137
- // overall: string;
138
- // }
139
-
140
- // /**
141
- // * Detailed analysis structure for individual compilation diagnostics.
142
- // *
143
- // * Represents the AI's systematic approach to understanding and resolving each
144
- // * compilation diagnostic. Each diagnostic must be thoroughly analyzed to
145
- // * understand its root cause, with a specific solution that addresses the
146
- // * exact issue while maintaining type safety and code quality.
147
- // */
148
- // export interface IDiagnosticAnalysis {
149
- // /**
150
- // * AI-generated summary of the compilation diagnostic.
151
- // *
152
- // * The AI must analyze the `IAutoBeTypeScriptCompileResult.IDiagnostic`
153
- // * object and provide a clear, concise summary of the error. This should
154
- // * include the error message, file location, line/column position, and error
155
- // * code in a human-readable format. The AI interprets and restructures the
156
- // * raw diagnostic data to present it in a more understandable way.
157
- // *
158
- // * **IMPORTANT**: The AI should not copy the raw diagnostic object. Instead,
159
- // * it must read and understand the diagnostic details, then compose a clear
160
- // * string description that captures all essential information about the
161
- // * error.
162
- // */
163
- // diagnostic: string;
164
-
165
- // /**
166
- // * Root cause analysis of why this compilation error occurred.
167
- // *
168
- // * **🚨 CRITICAL FIRST CHECK: Is this caused by INTENTIONAL TYPE ERROR TESTING? 🚨**
169
- // * - Look for `as any` usage in the error location
170
- // * - Check if code is intentionally sending wrong types to test type validation
171
- // * - Check if code is testing missing required fields
172
- // * - **IF YES → Root cause: "Prohibited type error testing code that must be DELETED"**
173
- // *
174
- // * **⚠️ THINK BEYOND THE DIAGNOSTIC LINE - EXPAND YOUR INVESTIGATION ⚠️**
175
- // * - Do NOT focus only on the error line - it might be just a symptom
176
- // * - The real cause might be ABOVE the error location in earlier code
177
- // * - The test scenario itself might be fundamentally flawed or impossible
178
- // * - Consider if the scenario is requesting non-existent APIs or prohibited actions
179
- // * - Example: Error on line 50 might be caused by wrong type assignment on line 20
180
- // * - Example: API call fails because the scenario describes unimplemented functionality
181
- // *
182
- // * AI must examine the error message carefully and identify the specific
183
- // * reason for failure. This includes understanding whether it's a missing
184
- // * property, type mismatch, nullable/undefined issue, incorrect API usage,
185
- // * intentional type error testing, flawed scenario, or other TypeScript
186
- // * violations. The analysis should be precise and fact-based, but also
187
- // * consider the broader context and causal relationships.
188
- // *
189
- // * **MANDATORY**: The AI must thoroughly review ALL sections of
190
- // * TEST_CORRECT.md and apply relevant error patterns and analysis guidelines
191
- // * from sections 4.1-4.16 to ensure accurate diagnosis.
192
- // *
193
- // * Example: "Property 'code' is missing because the object literal lacks
194
- // * this required field from ICommunityPlatformCommunity.ICreate interface"
195
- // *
196
- // * Example: "Type error caused by intentional wrong type test using 'as any'
197
- // * - prohibited pattern that must be deleted"
198
- // *
199
- // * Example: "API endpoint doesn't exist - scenario requests unimplemented
200
- // * functionality that cannot be tested"
201
- // */
202
- // analysis: string;
203
-
204
- // /**
205
- // * Specific solution to resolve this compilation error.
206
- // *
207
- // * **🚨 IF ROOT CAUSE IS TYPE ERROR TESTING → Solution: "DELETE entire test block" 🚨**
208
- // * **🚨 IF PROBLEM IS UNRECOVERABLE → Solution: "DELETE the problematic section" 🚨**
209
- // * - NEVER try to "fix" intentional type error tests - DELETE them
210
- // * - NEVER violate type safety to force a fix - DELETE instead
211
- // * - Tests using `as any` to send wrong types must be DELETED
212
- // * - Tests checking type validation must be DELETED
213
- // * - Unrecoverable compilation errors should result in DELETION
214
- // *
215
- // * **THREE SOLUTION TYPES:**
216
- // * 1. **FIX**: Correct the error while maintaining functionality
217
- // * 2. **DELETE**: Remove prohibited or unrecoverable code entirely
218
- // * 3. **REWRITE**: Restructure if the scenario itself is fundamentally flawed
219
- // *
220
- // * Detailed correction strategy that addresses the exact issue identified in
221
- // * the analysis. Solutions must be actionable, type-safe, and compliant with
222
- // * all project guidelines. For nullable/undefined errors with typia tags,
223
- // * immediately apply typia.assert(value!) pattern. For missing properties,
224
- // * specify what will be added and how.
225
- // *
226
- // * **CRITICAL**: The AI must thoroughly review BOTH TEST_WRITE.md and
227
- // * TEST_CORRECT.md before proposing solutions. All prohibitions from
228
- // * TEST_WRITE.md must be strictly respected (no type bypasses, proper
229
- // * async/await usage, etc.), and correction patterns from TEST_CORRECT.md
230
- // * sections 4.1-4.16 must be properly applied.
231
- // *
232
- // * **DELETION IS A VALID SOLUTION** when:
233
- // * - Code violates absolute prohibitions
234
- // * - Fixing would require type safety violations
235
- // * - The scenario describes impossible functionality
236
- // * - Multiple fix attempts have failed
237
- // *
238
- // * Example: "Add missing 'code' property using typia.random<string>() to
239
- // * generate a valid string value that satisfies the interface requirement"
240
- // *
241
- // * Example: "DELETE this entire test - it's testing type errors with 'as any'"
242
- // *
243
- // * Example: "DELETE this section - API endpoint doesn't exist and cannot be
244
- // * tested without violating type safety"
245
- // */
246
- // solution: string;
247
- // }
248
-
249
94
  /**
250
95
  * Revision properties for the final review and implementation phases.
251
96
  *
@@ -253,74 +98,6 @@ export namespace IAutoBeTestCorrectApplication {
253
98
  * workflow, ensuring systematic review and production-ready code delivery.
254
99
  */
255
100
  export interface IReviseProps {
256
- // /**
257
- // * Dual-document compliance validation for TEST_WRITE.md and
258
- // * TEST_CORRECT.md.
259
- // *
260
- // * This property tracks whether each section from BOTH TEST_WRITE.md and
261
- // * TEST_CORRECT.md guidelines has been properly followed. Since the correct
262
- // * agent must ensure compliance with both documents, keys should include
263
- // * sections from both prompt files.
264
- // *
265
- // * Each ICheck item should have:
266
- // *
267
- // * - Title: Prefixed with source document for clarity ("TEST_WRITE: " or
268
- // * "TEST_CORRECT: ")
269
- // * - State: Compliance status (true if followed, false if violated)
270
- // *
271
- // * Note: Section identifiers may evolve as documentation updates, so
272
- // * implementations should be flexible in handling different key formats.
273
- // *
274
- // * Example:
275
- // *
276
- // * ```typescript
277
- // * rules: [
278
- // * { title: "TEST_WRITE: 1. Role and Responsibility", state: true },
279
- // * { title: "TEST_WRITE: 3.1. Import Management", state: true },
280
- // * {
281
- // * title: "TEST_CORRECT: 4.1. Missing Properties Pattern",
282
- // * state: true,
283
- // * },
284
- // * {
285
- // * title: "TEST_CORRECT: 4.2. Type Mismatch Pattern",
286
- // * state: false,
287
- // * },
288
- // * // ... other sections from both documents
289
- // * ];
290
- // * ```
291
- // */
292
- // rules: ICheck[] & tags.MinItems<1>;
293
-
294
- // /**
295
- // * Combined quality checklist validation from both prompt documents.
296
- // *
297
- // * This property captures the compliance status for checklist items from
298
- // * BOTH TEST_WRITE.md (Section 5: Final Checklist) and TEST_CORRECT.md
299
- // * (Section 5: Final Review Checklist). The correct agent must validate
300
- // * against both checklists to ensure comprehensive quality control.
301
- // *
302
- // * Each ICheck item should have:
303
- // *
304
- // * - Title: Checklist item as described in the documents
305
- // * - State: Whether the criterion has been satisfied
306
- // *
307
- // * Note: Checklist items may be updated over time, so implementations should
308
- // * adapt to documentation changes while maintaining the validation purpose.
309
- // *
310
- // * Example:
311
- // *
312
- // * ```typescript
313
- // * checkList: [
314
- // * { title: "No compilation errors", state: true },
315
- // * { title: "Proper async/await usage", state: true },
316
- // * { title: "All typia tags preserved", state: true },
317
- // * { title: "No type bypasses or workarounds", state: false },
318
- // * // ... other checklist items from both documents
319
- // * ];
320
- // * ```
321
- // */
322
- // checkList: ICheck[] & tags.MinItems<1>;
323
-
324
101
  /**
325
102
  * Step 3: Code review and correction validation.
326
103
  *
@@ -347,17 +124,21 @@ export namespace IAutoBeTestCorrectApplication {
347
124
  * incorporating all review feedback and validation results. This code
348
125
  * represents the completed error correction, guaranteed to compile
349
126
  * successfully while preserving all original test functionality and
350
- * business logic.
127
+ * business logic. When the draft correction already perfectly resolves all
128
+ * issues with no problems found during review, this value can be null,
129
+ * indicating no further refinement was necessary.
351
130
  *
352
131
  * The final implementation resolves all compilation issues, maintains
353
132
  * strict type safety, follows all established conventions, and delivers a
354
133
  * production-ready test that accurately validates the intended API
355
- * behaviors and user workflows.
134
+ * behaviors and user workflows. A null value signifies the draft correction
135
+ * was already optimal and requires no modifications.
356
136
  *
357
137
  * Workflow: Review integration → Final refinement → Production-ready
358
- * implementation. This is the ultimate deliverable that will replace the
359
- * compilation-failed code.
138
+ * implementation (or null if draft needs no changes). This is the ultimate
139
+ * deliverable that will replace the compilation-failed code when provided,
140
+ * otherwise the draft correction is used as-is.
360
141
  */
361
- final: string;
142
+ final: string | null;
362
143
  }
363
144
  }
@@ -131,7 +131,10 @@ export namespace IAutoBeTestCorrectInvalidRequestApplication {
131
131
  * Final corrected code.
132
132
  *
133
133
  * The complete, cleaned test code with all invalid API request sections
134
- * removed, ready for compilation.
134
+ * removed, ready for compilation. When the draft already successfully
135
+ * removes all problematic code with no additional issues found during
136
+ * review, this value can be null, indicating the draft deletion was
137
+ * sufficient and requires no further changes.
135
138
  *
136
139
  * This code must:
137
140
  *
@@ -140,7 +143,10 @@ export namespace IAutoBeTestCorrectInvalidRequestApplication {
140
143
  * - Have no `as any` or similar type violations
141
144
  * - Maintain the original file structure
142
145
  * - Be production-ready E2E test code
146
+ *
147
+ * A null value indicates the draft successfully removed all invalid code
148
+ * and needs no additional modifications.
143
149
  */
144
- final: string;
150
+ final: string | null;
145
151
  }
146
152
  }
@@ -65,8 +65,8 @@ export namespace IAutoBeTestWriteApplication {
65
65
  *
66
66
  * Contains the iterative improvement workflow that transforms the initial
67
67
  * draft into production-ready test code. The review phase identifies issues
68
- * to fix or code to delete, followed by the final phase that produces
69
- * the polished, production-ready test implementation.
68
+ * to fix or code to delete, followed by the final phase that produces the
69
+ * polished, production-ready test implementation.
70
70
  *
71
71
  * Workflow: Draft → Review analysis → Final implementation
72
72
  */
@@ -74,52 +74,6 @@ export namespace IAutoBeTestWriteApplication {
74
74
  }
75
75
 
76
76
  export interface IReviseProps {
77
- // /**
78
- // * Test implementation rules compliance validation.
79
- // *
80
- // * This property tracks whether each section of the TEST_WRITE.md guidelines
81
- // * has been properly followed. Each array element represents a section from
82
- // * the documentation with its title and compliance status.
83
- // *
84
- // * Note: The specific section titles may evolve as documentation updates, so
85
- // * implementations should be flexible in handling different titles.
86
- // *
87
- // * Example:
88
- // *
89
- // * ```typescript
90
- // * rules: [
91
- // * { title: "1. Role and Responsibility", state: true },
92
- // * { title: "2. Input Materials Provided", state: true },
93
- // * { title: "3. Code Generation Requirements", state: false },
94
- // * // ... other sections
95
- // * ];
96
- // * ```
97
- // */
98
- // rules: ICheck[] & tags.MinItems<1>;
99
-
100
- // /**
101
- // * Final quality checklist validation results.
102
- // *
103
- // * This property captures the compliance status for each item in the Final
104
- // * Checklist (Section 5) from TEST_WRITE.md. Each array element represents a
105
- // * checklist item with its description and validation result.
106
- // *
107
- // * Note: Checklist items may be updated over time, so implementations should
108
- // * adapt to documentation changes while maintaining the validation purpose.
109
- // *
110
- // * Example:
111
- // *
112
- // * ```typescript
113
- // * checkList: [
114
- // * { title: "NO additional import statements", state: true },
115
- // * { title: "NO wrong type data in requests", state: true },
116
- // * { title: "EVERY api.functional.* call has await", state: false },
117
- // * // ... other checklist items
118
- // * ];
119
- // * ```
120
- // */
121
- // checkList: ICheck[] & tags.MinItems<1>;
122
-
123
77
  /**
124
78
  * Step 4: Code review and quality assessment.
125
79
  *
@@ -180,7 +134,9 @@ export namespace IAutoBeTestWriteApplication {
180
134
  *
181
135
  * AI produces the final, polished version of the test code incorporating
182
136
  * all review feedback. This code represents the completed test
183
- * implementation, ready for production deployment.
137
+ * implementation, ready for production deployment. When the draft code is
138
+ * already perfect with no issues found during review, this value can be
139
+ * null, indicating no revisions were necessary.
184
140
  *
185
141
  * **🚨 CRITICAL: APPLY ALL FIXES AND DELETIONS FROM REVIEW 🚨**
186
142
  *
@@ -188,41 +144,18 @@ export namespace IAutoBeTestWriteApplication {
188
144
  * - DELETE all prohibited code identified in review
189
145
  * - If review found type error tests, they MUST be deleted in final
190
146
  * - If review found code to DELETE, final MUST be different from draft
147
+ * - If review finds NO issues requiring changes, set to null
191
148
  *
192
149
  * All identified issues must be resolved, and the code must meet the
193
- * highest quality standards.
150
+ * highest quality standards. A null value indicates the draft code already
151
+ * meets all requirements without modification.
194
152
  *
195
153
  * Workflow: Review feedback → Apply FIXES → Apply DELETIONS →
196
- * Production-ready implementation
154
+ * Production-ready implementation (or null if no changes needed)
197
155
  *
198
156
  * This is the ultimate deliverable that will be used in the actual test
199
- * suite.
157
+ * suite when provided, otherwise the draft is used as-is.
200
158
  */
201
- final: string;
159
+ final: string | null;
202
160
  }
203
-
204
- // /**
205
- // * Check validation item structure.
206
- // *
207
- // * Represents a validation check with its title and compliance state. Used for
208
- // * both rules validation and final checklist validation.
209
- // */
210
- // export interface ICheck {
211
- // /**
212
- // * The title or description of the check.
213
- // *
214
- // * For rules: Section identifiers from TEST_WRITE.md (e.g., "1. Role and
215
- // * Responsibility") For checklist: Checklist item descriptions (e.g., "No
216
- // * compilation errors")
217
- // */
218
- // title: string;
219
-
220
- // /**
221
- // * The validation state of this check.
222
- // *
223
- // * - True: The requirement has been satisfied
224
- // * - False: The requirement has been violated or not met
225
- // */
226
- // state: boolean;
227
- // }
228
161
  }
@@ -0,0 +1,51 @@
1
+ import { AutoBeOpenApi } from "@autobe/interface";
2
+ import { AutoBeOpenApiEndpointComparator } from "@autobe/utils";
3
+ import { HashMap } from "tstl";
4
+
5
+ export const getPrerequisites = (props: {
6
+ document: AutoBeOpenApi.IDocument;
7
+ endpoint: AutoBeOpenApi.IEndpoint;
8
+ }): AutoBeOpenApi.IPrerequisite[] => {
9
+ const visited: Set<string> = new Set<string>();
10
+ const result: HashMap<
11
+ AutoBeOpenApi.IEndpoint,
12
+ AutoBeOpenApi.IPrerequisite[]
13
+ > = new HashMap<AutoBeOpenApi.IEndpoint, AutoBeOpenApi.IPrerequisite[]>(
14
+ AutoBeOpenApiEndpointComparator.hashCode,
15
+ AutoBeOpenApiEndpointComparator.equals,
16
+ );
17
+
18
+ const traverse = (endpoint: AutoBeOpenApi.IEndpoint): void => {
19
+ const key = `${endpoint.method}:${endpoint.path}`;
20
+
21
+ // prevent circular structure: skip visited endpoint
22
+ if (visited.has(key)) return;
23
+ visited.add(key);
24
+
25
+ const operation: AutoBeOpenApi.IOperation | undefined =
26
+ props.document.operations.find(
27
+ (op) => op.method === endpoint.method && op.path === endpoint.path,
28
+ );
29
+
30
+ if (operation === undefined) return;
31
+
32
+ // add current operation's prerequisites
33
+ for (const prerequisite of operation.prerequisites) {
34
+ // check if already in result to avoid duplicates
35
+ const exists: boolean = result.has(prerequisite.endpoint);
36
+
37
+ if (!exists) {
38
+ result.set(prerequisite.endpoint, [prerequisite]);
39
+ }
40
+
41
+ // recursively traverse prerequisite's prerequisites
42
+ traverse(prerequisite.endpoint);
43
+ }
44
+ };
45
+
46
+ traverse(props.endpoint);
47
+ return result
48
+ .toJSON()
49
+ .map((it) => it.second)
50
+ .flat();
51
+ };
@@ -7,7 +7,8 @@ export const getReferenceIds = (props: {
7
7
  }): string[] => {
8
8
  const result: Set<string> = new Set();
9
9
  const emplace = (key: string) => {
10
- if (key.endsWith("_id") || key.endsWith("Id")) result.add(key);
10
+ if (key.endsWith("_id") || key.endsWith("Id") || key === "id")
11
+ result.add(key);
11
12
  };
12
13
 
13
14
  props.operation.parameters.forEach((p) => emplace(p.name));
@@ -1,3 +0,0 @@
1
- import { IAgenticaHistoryJson } from "@agentica/core";
2
- import { AutoBeState } from "../../../context/AutoBeState";
3
- export declare const transformInterfacePrerequisiteHistories: (state: AutoBeState) => Array<IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage> | null;
@@ -1 +0,0 @@
1
- {"version":3,"file":"transformInterfacePrerequisiteHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.ts"],"names":[],"mappings":";;;AACA,+BAA0B;AAInB,MAAM,uCAAuC,GAAG,CACrD,KAAkB,EAGX,EAAE;IACT,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI;QACxB,OAAO;YACL;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE;oBACJ,4CAA4C;oBAC5C,mCAAmC;oBACnC,8CAA8C;iBAC/C,CAAC,IAAI,CAAC,GAAG,CAAC;aACZ;SACF,CAAC;SACC,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI;QAC5B,OAAO;YACL;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE;oBACJ,mDAAmD;oBACnD,mCAAmC;oBACnC,qDAAqD;iBACtD,CAAC,IAAI,CAAC,GAAG,CAAC;aACZ;SACF,CAAC;SACC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM,CAAC,IAAI;QAC/C,OAAO;YACL;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE;oBACJ,kDAAkD;oBAClD,sCAAsC;oBACtC,mCAAmC;oBACnC,wDAAwD;iBACzD,CAAC,IAAI,CAAC,GAAG,CAAC;aACZ;SACF,CAAC;SACC,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS;QAC/C,OAAO;YACL;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE;oBACJ,kDAAkD;oBAClD,sCAAsC;oBACtC,mCAAmC;oBACnC,wDAAwD;iBACzD,CAAC,IAAI,CAAC,GAAG,CAAC;aACZ;SACF,CAAC;IACJ,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AA5DW,QAAA,uCAAuC,2CA4DlD"}
@@ -1,6 +0,0 @@
1
- import { AutoBeOpenApi } from "@autobe/interface";
2
- export declare namespace OpenApiEndpointComparator {
3
- function hashCode(e: AutoBeOpenApi.IEndpoint): number;
4
- function equals(x: AutoBeOpenApi.IEndpoint, y: AutoBeOpenApi.IEndpoint): boolean;
5
- function compare(x: AutoBeOpenApi.IEndpoint, y: AutoBeOpenApi.IEndpoint): number;
6
- }
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OpenApiEndpointComparator = void 0;
4
- const tstl_1 = require("tstl");
5
- var OpenApiEndpointComparator;
6
- (function (OpenApiEndpointComparator) {
7
- function hashCode(e) {
8
- return (0, tstl_1.hash)(e.path, e.method);
9
- }
10
- OpenApiEndpointComparator.hashCode = hashCode;
11
- function equals(x, y) {
12
- return x.path === y.path && x.method === y.method;
13
- }
14
- OpenApiEndpointComparator.equals = equals;
15
- function compare(x, y) {
16
- if (x.path !== y.path)
17
- return x.path.localeCompare(y.path);
18
- return x.method.localeCompare(y.method);
19
- }
20
- OpenApiEndpointComparator.compare = compare;
21
- })(OpenApiEndpointComparator || (exports.OpenApiEndpointComparator = OpenApiEndpointComparator = {}));
22
- //# sourceMappingURL=OpenApiEndpointComparator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OpenApiEndpointComparator.js","sourceRoot":"","sources":["../../../../src/orchestrate/interface/utils/OpenApiEndpointComparator.ts"],"names":[],"mappings":";;;AACA,+BAA4B;AAE5B,IAAiB,yBAAyB,CAmBzC;AAnBD,WAAiB,yBAAyB;IACxC,SAAgB,QAAQ,CAAC,CAA0B;QACjD,OAAO,IAAA,WAAI,EAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAFe,kCAAQ,WAEvB,CAAA;IAED,SAAgB,MAAM,CACpB,CAA0B,EAC1B,CAA0B;QAE1B,OAAO,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,CAAC;IACpD,CAAC;IALe,gCAAM,SAKrB,CAAA;IAED,SAAgB,OAAO,CACrB,CAA0B,EAC1B,CAA0B;QAE1B,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI;YAAE,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC3D,OAAO,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IANe,iCAAO,UAMtB,CAAA;AACH,CAAC,EAnBgB,yBAAyB,yCAAzB,yBAAyB,QAmBzC"}
@@ -1,23 +0,0 @@
1
- import { AutoBeOpenApi } from "@autobe/interface";
2
- import { hash } from "tstl";
3
-
4
- export namespace OpenApiEndpointComparator {
5
- export function hashCode(e: AutoBeOpenApi.IEndpoint): number {
6
- return hash(e.path, e.method);
7
- }
8
-
9
- export function equals(
10
- x: AutoBeOpenApi.IEndpoint,
11
- y: AutoBeOpenApi.IEndpoint,
12
- ): boolean {
13
- return x.path === y.path && x.method === y.method;
14
- }
15
-
16
- export function compare(
17
- x: AutoBeOpenApi.IEndpoint,
18
- y: AutoBeOpenApi.IEndpoint,
19
- ): number {
20
- if (x.path !== y.path) return x.path.localeCompare(y.path);
21
- return x.method.localeCompare(y.method);
22
- }
23
- }