@autobe/agent 0.30.4 → 0.30.5

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 (210) hide show
  1. package/lib/constants/AutoBeSystemPromptConstant.d.ts +5 -4
  2. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  3. package/lib/describe/image/orchestrateImageDescribeDraft.js +6 -6
  4. package/lib/describe/image/structures/IAutoBeImageDescribeDraftApplication.d.ts +12 -63
  5. package/lib/index.mjs +2918 -2842
  6. package/lib/index.mjs.map +1 -1
  7. package/lib/orchestrate/analyze/orchestrateAnalyzeExtractDecisions.js +8 -8
  8. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +36 -37
  9. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  10. package/lib/orchestrate/analyze/orchestrateAnalyzeScenarioReview.js +7 -7
  11. package/lib/orchestrate/analyze/orchestrateAnalyzeSectionCrossFileReview.js +55 -42
  12. package/lib/orchestrate/analyze/orchestrateAnalyzeSectionCrossFileReview.js.map +1 -1
  13. package/lib/orchestrate/analyze/orchestrateAnalyzeSectionReview.js +67 -54
  14. package/lib/orchestrate/analyze/orchestrateAnalyzeSectionReview.js.map +1 -1
  15. package/lib/orchestrate/analyze/orchestrateAnalyzeWriteSection.js +24 -25
  16. package/lib/orchestrate/analyze/orchestrateAnalyzeWriteSection.js.map +1 -1
  17. package/lib/orchestrate/analyze/orchestrateAnalyzeWriteSectionPatch.js +24 -25
  18. package/lib/orchestrate/analyze/orchestrateAnalyzeWriteSectionPatch.js.map +1 -1
  19. package/lib/orchestrate/analyze/orchestrateAnalyzeWriteUnit.js +30 -31
  20. package/lib/orchestrate/analyze/orchestrateAnalyzeWriteUnit.js.map +1 -1
  21. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeExtractDecisionsApplication.d.ts +14 -52
  22. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +23 -96
  23. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioReviewApplication.d.ts +12 -40
  24. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeSectionCrossFileReviewApplication.d.ts +30 -88
  25. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeSectionReviewApplication.d.ts +35 -94
  26. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteSectionApplication.d.ts +23 -93
  27. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteUnitApplication.d.ts +15 -88
  28. package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistory.js +76 -31
  29. package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistory.js.map +1 -1
  30. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +7 -7
  31. package/lib/orchestrate/common/structures/IAnalysisSectionEntry.d.ts +2 -8
  32. package/lib/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.d.ts +8 -50
  33. package/lib/orchestrate/common/structures/IAutoBePreliminaryCollection.d.ts +1 -9
  34. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetAnalysisSections.d.ts +4 -23
  35. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetDatabaseSchemas.d.ts +3 -21
  36. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceOperations.d.ts +4 -22
  37. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceSchemas.d.ts +4 -22
  38. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetPreviousAnalysisSections.d.ts +5 -17
  39. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetPreviousDatabaseSchemas.d.ts +7 -76
  40. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetPreviousInterfaceOperations.d.ts +6 -89
  41. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetPreviousInterfaceSchemas.d.ts +7 -93
  42. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetRealizeCollectors.d.ts +3 -22
  43. package/lib/orchestrate/common/structures/IAutoBePreliminaryGetRealizeTransformers.d.ts +3 -22
  44. package/lib/orchestrate/interface/orchestrateInterfaceAuthorization.js +114 -139
  45. package/lib/orchestrate/interface/orchestrateInterfaceAuthorization.js.map +1 -1
  46. package/lib/orchestrate/interface/orchestrateInterfaceEndpointReview.js +90 -91
  47. package/lib/orchestrate/interface/orchestrateInterfaceEndpointReview.js.map +1 -1
  48. package/lib/orchestrate/interface/orchestrateInterfaceEndpointWrite.js +58 -59
  49. package/lib/orchestrate/interface/orchestrateInterfaceEndpointWrite.js.map +1 -1
  50. package/lib/orchestrate/interface/orchestrateInterfaceGroup.js +58 -59
  51. package/lib/orchestrate/interface/orchestrateInterfaceGroup.js.map +1 -1
  52. package/lib/orchestrate/interface/orchestrateInterfaceOperation.js +108 -132
  53. package/lib/orchestrate/interface/orchestrateInterfaceOperation.js.map +1 -1
  54. package/lib/orchestrate/interface/orchestrateInterfaceOperationReview.js +72 -72
  55. package/lib/orchestrate/interface/orchestrateInterfacePrerequisite.js +76 -77
  56. package/lib/orchestrate/interface/orchestrateInterfacePrerequisite.js.map +1 -1
  57. package/lib/orchestrate/interface/orchestrateInterfaceSchemaCasting.js +130 -159
  58. package/lib/orchestrate/interface/orchestrateInterfaceSchemaCasting.js.map +1 -1
  59. package/lib/orchestrate/interface/orchestrateInterfaceSchemaComplement.js +126 -155
  60. package/lib/orchestrate/interface/orchestrateInterfaceSchemaComplement.js.map +1 -1
  61. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRefine.js +114 -142
  62. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRefine.js.map +1 -1
  63. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +5 -5
  64. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js +100 -129
  65. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -1
  66. package/lib/orchestrate/interface/orchestrateInterfaceSchemaWrite.js +120 -149
  67. package/lib/orchestrate/interface/orchestrateInterfaceSchemaWrite.js.map +1 -1
  68. package/lib/orchestrate/interface/structures/IAutoBeInterfaceAuthorizationApplication.d.ts +10 -97
  69. package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointReviewApplication.d.ts +14 -83
  70. package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointWriteApplication.d.ts +12 -90
  71. package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +12 -80
  72. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +21 -116
  73. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationReviewApplication.d.ts +24 -112
  74. package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisiteApplication.d.ts +11 -83
  75. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +11 -76
  76. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaCastingApplication.d.ts +18 -96
  77. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaComplementApplication.d.ts +11 -76
  78. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRefineApplication.d.ts +25 -107
  79. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.d.ts +5 -31
  80. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaReviewApplication.d.ts +6 -42
  81. package/lib/orchestrate/prisma/orchestratePrismaAuthorization.js +41 -41
  82. package/lib/orchestrate/prisma/orchestratePrismaAuthorizationReview.js +62 -63
  83. package/lib/orchestrate/prisma/orchestratePrismaAuthorizationReview.js.map +1 -1
  84. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +40 -41
  85. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  86. package/lib/orchestrate/prisma/orchestratePrismaComponentReview.js +60 -61
  87. package/lib/orchestrate/prisma/orchestratePrismaComponentReview.js.map +1 -1
  88. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +112 -116
  89. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  90. package/lib/orchestrate/prisma/orchestratePrismaGroup.js +48 -49
  91. package/lib/orchestrate/prisma/orchestratePrismaGroup.js.map +1 -1
  92. package/lib/orchestrate/prisma/orchestratePrismaGroupReview.js +70 -71
  93. package/lib/orchestrate/prisma/orchestratePrismaGroupReview.js.map +1 -1
  94. package/lib/orchestrate/prisma/orchestratePrismaSchema.js +118 -122
  95. package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -1
  96. package/lib/orchestrate/prisma/orchestratePrismaSchemaReview.js +126 -131
  97. package/lib/orchestrate/prisma/orchestratePrismaSchemaReview.js.map +1 -1
  98. package/lib/orchestrate/prisma/structures/IAutoBeDatabaseAuthorizationApplication.d.ts +22 -99
  99. package/lib/orchestrate/prisma/structures/IAutoBeDatabaseAuthorizationReviewApplication.d.ts +12 -109
  100. package/lib/orchestrate/prisma/structures/IAutoBeDatabaseComponentApplication.d.ts +14 -100
  101. package/lib/orchestrate/prisma/structures/IAutoBeDatabaseComponentReviewApplication.d.ts +15 -108
  102. package/lib/orchestrate/prisma/structures/IAutoBeDatabaseCorrectApplication.d.ts +24 -106
  103. package/lib/orchestrate/prisma/structures/IAutoBeDatabaseGroupApplication.d.ts +13 -76
  104. package/lib/orchestrate/prisma/structures/IAutoBeDatabaseGroupReviewApplication.d.ts +13 -111
  105. package/lib/orchestrate/prisma/structures/IAutoBeDatabaseSchemaApplication.d.ts +26 -97
  106. package/lib/orchestrate/prisma/structures/IAutoBeDatabaseSchemaReviewApplication.d.ts +16 -93
  107. package/lib/orchestrate/realize/histories/transformRealizeOperationCorrectHistory.js +1 -1
  108. package/lib/orchestrate/realize/histories/transformRealizeOperationCorrectHistory.js.map +1 -1
  109. package/lib/orchestrate/realize/histories/transformRealizeOperationWriteHistory.js +1 -1
  110. package/lib/orchestrate/realize/histories/transformRealizeOperationWriteHistory.js.map +1 -1
  111. package/lib/orchestrate/realize/histories/transformRealizeTransformerCorrectHistory.js +20 -2
  112. package/lib/orchestrate/realize/histories/transformRealizeTransformerCorrectHistory.js.map +1 -1
  113. package/lib/orchestrate/realize/histories/transformRealizeTransformerWriteHistory.js +22 -2
  114. package/lib/orchestrate/realize/histories/transformRealizeTransformerWriteHistory.js.map +1 -1
  115. package/lib/orchestrate/realize/internal/orchestrateRealizeCorrectCasting.js +7 -7
  116. package/lib/orchestrate/realize/internal/orchestrateRealizeCorrectOverall.js +86 -6
  117. package/lib/orchestrate/realize/internal/orchestrateRealizeCorrectOverall.js.map +1 -1
  118. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +38 -38
  119. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationWrite.js +34 -34
  120. package/lib/orchestrate/realize/orchestrateRealizeCollectorCorrectOverall.js +38 -38
  121. package/lib/orchestrate/realize/orchestrateRealizeCollectorPlan.js +54 -54
  122. package/lib/orchestrate/realize/orchestrateRealizeCollectorWrite.js +36 -36
  123. package/lib/orchestrate/realize/orchestrateRealizeOperationCorrectOverall.js +44 -44
  124. package/lib/orchestrate/realize/orchestrateRealizeOperationWrite.js +42 -42
  125. package/lib/orchestrate/realize/orchestrateRealizeTransformerCorrectCasting.js +1 -0
  126. package/lib/orchestrate/realize/orchestrateRealizeTransformerCorrectCasting.js.map +1 -1
  127. package/lib/orchestrate/realize/orchestrateRealizeTransformerCorrectOverall.js +46 -46
  128. package/lib/orchestrate/realize/orchestrateRealizeTransformerPlan.js +36 -36
  129. package/lib/orchestrate/realize/orchestrateRealizeTransformerWrite.js +44 -44
  130. package/lib/orchestrate/realize/programmers/AutoBeRealizeTransformerProgrammer.d.ts +18 -0
  131. package/lib/orchestrate/realize/programmers/AutoBeRealizeTransformerProgrammer.js +167 -8
  132. package/lib/orchestrate/realize/programmers/AutoBeRealizeTransformerProgrammer.js.map +1 -1
  133. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +17 -71
  134. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationWriteApplication.d.ts +32 -92
  135. package/lib/orchestrate/realize/structures/IAutoBeRealizeCollectorCorrectApplication.d.ts +32 -114
  136. package/lib/orchestrate/realize/structures/IAutoBeRealizeCollectorPlanApplication.d.ts +29 -106
  137. package/lib/orchestrate/realize/structures/IAutoBeRealizeCollectorWriteApplication.d.ts +38 -131
  138. package/lib/orchestrate/realize/structures/IAutoBeRealizeOperationCorrectApplication.d.ts +16 -71
  139. package/lib/orchestrate/realize/structures/IAutoBeRealizeOperationWriteApplication.d.ts +16 -73
  140. package/lib/orchestrate/realize/structures/IAutoBeRealizeTransformerCorrectApplication.d.ts +37 -155
  141. package/lib/orchestrate/realize/structures/IAutoBeRealizeTransformerPlanApplication.d.ts +25 -88
  142. package/lib/orchestrate/realize/structures/IAutoBeRealizeTransformerWriteApplication.d.ts +48 -181
  143. package/lib/orchestrate/realize/utils/generateTS2339Hints.d.ts +5 -3
  144. package/lib/orchestrate/realize/utils/generateTS2339Hints.js +37 -19
  145. package/lib/orchestrate/realize/utils/generateTS2339Hints.js.map +1 -1
  146. package/lib/orchestrate/test/histories/transformTestOperationWriteHistory.js +2 -2
  147. package/lib/orchestrate/test/orchestrateTestScenario.js +22 -22
  148. package/lib/orchestrate/test/orchestrateTestScenarioReview.js +22 -22
  149. package/package.json +5 -5
  150. package/src/constants/AutoBeSystemPromptConstant.ts +5 -4
  151. package/src/describe/image/structures/IAutoBeImageDescribeDraftApplication.ts +12 -63
  152. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeExtractDecisionsApplication.ts +14 -52
  153. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +23 -96
  154. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioReviewApplication.ts +12 -40
  155. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeSectionCrossFileReviewApplication.ts +30 -88
  156. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeSectionReviewApplication.ts +35 -94
  157. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteSectionApplication.ts +23 -93
  158. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteUnitApplication.ts +15 -88
  159. package/src/orchestrate/common/histories/transformPreviousAndLatestCorrectHistory.ts +92 -31
  160. package/src/orchestrate/common/structures/IAnalysisSectionEntry.ts +2 -8
  161. package/src/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.ts +8 -50
  162. package/src/orchestrate/common/structures/IAutoBePreliminaryCollection.ts +1 -9
  163. package/src/orchestrate/common/structures/IAutoBePreliminaryGetAnalysisSections.ts +4 -23
  164. package/src/orchestrate/common/structures/IAutoBePreliminaryGetDatabaseSchemas.ts +3 -21
  165. package/src/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceOperations.ts +4 -22
  166. package/src/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceSchemas.ts +4 -22
  167. package/src/orchestrate/common/structures/IAutoBePreliminaryGetPreviousAnalysisSections.ts +5 -17
  168. package/src/orchestrate/common/structures/IAutoBePreliminaryGetPreviousDatabaseSchemas.ts +7 -76
  169. package/src/orchestrate/common/structures/IAutoBePreliminaryGetPreviousInterfaceOperations.ts +6 -89
  170. package/src/orchestrate/common/structures/IAutoBePreliminaryGetPreviousInterfaceSchemas.ts +7 -93
  171. package/src/orchestrate/common/structures/IAutoBePreliminaryGetRealizeCollectors.ts +3 -22
  172. package/src/orchestrate/common/structures/IAutoBePreliminaryGetRealizeTransformers.ts +3 -22
  173. package/src/orchestrate/interface/structures/IAutoBeInterfaceAuthorizationApplication.ts +10 -97
  174. package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointReviewApplication.ts +14 -83
  175. package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointWriteApplication.ts +12 -90
  176. package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +12 -80
  177. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +21 -116
  178. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationReviewApplication.ts +24 -112
  179. package/src/orchestrate/interface/structures/IAutoBeInterfacePrerequisiteApplication.ts +11 -83
  180. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +11 -76
  181. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaCastingApplication.ts +18 -96
  182. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaComplementApplication.ts +11 -76
  183. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRefineApplication.ts +25 -107
  184. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.ts +5 -31
  185. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaReviewApplication.ts +6 -42
  186. package/src/orchestrate/prisma/structures/IAutoBeDatabaseAuthorizationApplication.ts +22 -99
  187. package/src/orchestrate/prisma/structures/IAutoBeDatabaseAuthorizationReviewApplication.ts +12 -109
  188. package/src/orchestrate/prisma/structures/IAutoBeDatabaseComponentApplication.ts +14 -100
  189. package/src/orchestrate/prisma/structures/IAutoBeDatabaseComponentReviewApplication.ts +15 -108
  190. package/src/orchestrate/prisma/structures/IAutoBeDatabaseCorrectApplication.ts +24 -106
  191. package/src/orchestrate/prisma/structures/IAutoBeDatabaseGroupApplication.ts +13 -76
  192. package/src/orchestrate/prisma/structures/IAutoBeDatabaseGroupReviewApplication.ts +13 -111
  193. package/src/orchestrate/prisma/structures/IAutoBeDatabaseSchemaApplication.ts +26 -97
  194. package/src/orchestrate/prisma/structures/IAutoBeDatabaseSchemaReviewApplication.ts +16 -93
  195. package/src/orchestrate/realize/histories/transformRealizeTransformerCorrectHistory.ts +21 -1
  196. package/src/orchestrate/realize/histories/transformRealizeTransformerWriteHistory.ts +26 -4
  197. package/src/orchestrate/realize/internal/orchestrateRealizeCorrectOverall.ts +125 -9
  198. package/src/orchestrate/realize/orchestrateRealizeTransformerCorrectCasting.ts +1 -0
  199. package/src/orchestrate/realize/programmers/AutoBeRealizeTransformerProgrammer.ts +210 -7
  200. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +17 -71
  201. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationWriteApplication.ts +32 -92
  202. package/src/orchestrate/realize/structures/IAutoBeRealizeCollectorCorrectApplication.ts +32 -114
  203. package/src/orchestrate/realize/structures/IAutoBeRealizeCollectorPlanApplication.ts +29 -106
  204. package/src/orchestrate/realize/structures/IAutoBeRealizeCollectorWriteApplication.ts +38 -131
  205. package/src/orchestrate/realize/structures/IAutoBeRealizeOperationCorrectApplication.ts +16 -71
  206. package/src/orchestrate/realize/structures/IAutoBeRealizeOperationWriteApplication.ts +16 -73
  207. package/src/orchestrate/realize/structures/IAutoBeRealizeTransformerCorrectApplication.ts +37 -155
  208. package/src/orchestrate/realize/structures/IAutoBeRealizeTransformerPlanApplication.ts +25 -88
  209. package/src/orchestrate/realize/structures/IAutoBeRealizeTransformerWriteApplication.ts +48 -181
  210. package/src/orchestrate/realize/utils/generateTS2339Hints.ts +39 -19
@@ -6,51 +6,20 @@ import { IAutoBePreliminaryGetPreviousAnalysisSections } from "../../common/stru
6
6
  import { IAutoBePreliminaryGetPreviousDatabaseSchemas } from "../../common/structures/IAutoBePreliminaryGetPreviousDatabaseSchemas";
7
7
 
8
8
  export interface IAutoBeDatabaseSchemaReviewApplication {
9
- /**
10
- * Process schema review task or preliminary data requests.
11
- *
12
- * Reviews generated database models to validate normalization, relationships,
13
- * indexes, and business alignment, producing necessary modifications.
14
- *
15
- * @param props Request containing either preliminary data request or complete
16
- * task
17
- */
9
+ /** Process schema review task or retrieve preliminary data. */
18
10
  process(props: IAutoBeDatabaseSchemaReviewApplication.IProps): void;
19
11
  }
20
12
  export namespace IAutoBeDatabaseSchemaReviewApplication {
21
13
  export interface IProps {
22
14
  /**
23
- * Think before you act.
24
- *
25
- * Before requesting preliminary data or completing your task, reflect on
26
- * your current state and explain your reasoning:
27
- *
28
- * For preliminary requests (getAnalysisSections, getDatabaseSchemas, etc.):
29
- *
30
- * - What critical information is missing that you don't already have?
31
- * - Why do you need it specifically right now?
32
- * - Be brief - state the gap, don't list everything you have.
33
- *
34
- * For completion (complete):
35
- *
36
- * - What key assets did you acquire?
37
- * - What did you accomplish?
38
- * - Why is it sufficient to complete?
39
- * - Summarize - don't enumerate every single item.
40
- *
41
- * This reflection helps you avoid duplicate requests and premature
42
- * completion.
15
+ * Reasoning about your current state: what's missing (preliminary) or what
16
+ * you accomplished (completion).
43
17
  */
44
18
  thinking: string;
45
19
 
46
20
  /**
47
- * Type discriminator for the request.
48
- *
49
- * Determines which action to perform: preliminary data retrieval
50
- * (getAnalysisSections, getPreviousAnalysisSections, getDatabaseSchemas,
51
- * getPreviousDatabaseSchemas) or final schema review (complete). When
52
- * preliminary returns empty array, that type is removed from the union,
53
- * physically preventing repeated calls.
21
+ * Action to perform. Exhausted preliminary types are removed from the
22
+ * union.
54
23
  */
55
24
  request:
56
25
  | IComplete
@@ -61,77 +30,31 @@ export namespace IAutoBeDatabaseSchemaReviewApplication {
61
30
  }
62
31
 
63
32
  /**
64
- * Request to review and refine database schema models.
65
- *
66
- * Executes comprehensive schema review to validate design quality and
67
- * identify necessary improvements for normalization, relationships, and
68
- * performance optimization.
33
+ * Review and refine database schema models for normalization, relationships,
34
+ * and performance.
69
35
  */
70
36
  export interface IComplete {
71
- /**
72
- * Type discriminator for the request.
73
- *
74
- * Determines which action to perform: preliminary data retrieval or actual
75
- * task execution. Value "complete" indicates this is the final task
76
- * execution request.
77
- */
37
+ /** Type discriminator for completion request. */
78
38
  type: "complete";
79
39
 
80
40
  /**
81
- * Comprehensive review analysis of the schema.
82
- *
83
- * Contains detailed evaluation of the schema design including:
84
- *
85
- * - Normalization validation: Confirms 3NF compliance and proper data
86
- * structure
87
- * - Relationship integrity: Validates foreign key references and cardinality
88
- * - Performance optimization: Reviews indexing strategy and query patterns
89
- * - Business logic alignment: Ensures schema supports all use cases
90
- * - Naming conventions: Verifies consistent naming patterns
91
- * - Data type consistency: Confirms appropriate field types
92
- * - Temporal field handling: Validates audit trail implementation
93
- *
94
- * The review identifies potential issues and confirms adherence to best
95
- * practices before final implementation.
41
+ * Review analysis covering normalization, relationships, indexes, naming,
42
+ * and business alignment.
96
43
  */
97
44
  review: string;
98
45
 
99
46
  /**
100
- * Strategic database design plan.
101
- *
102
- * Contains the original planning document outlining the database
103
- * architecture strategy including table structures, relationships,
104
- * normalization approach, and business requirement mapping. This plan
105
- * serves as the blueprint for validating the implemented schema.
106
- *
107
- * Planning components:
108
- *
109
- * - Business requirements: Mapping of business needs to database structures
110
- * - Table design: Entity definitions and attribute specifications
111
- * - Relationship strategy: Cardinality and referential integrity planning
112
- * - Normalization approach: Application of 1NF, 2NF, 3NF principles
113
- * - Performance considerations: Index strategy and query optimization
114
- * - Snapshot architecture: Temporal data handling and audit requirements
115
- * - Materialized views: Denormalization strategy for performance
47
+ * Database design plan serving as the blueprint for validating the
48
+ * implemented schema.
116
49
  */
117
50
  plan: string;
118
51
 
119
52
  /**
120
- * Corrected schema definition based on review feedback, or null if no
121
- * changes are needed.
122
- *
123
- * When not null, the definition carries exactly one corrected
124
- * {@link AutoBeDatabaseSchemaDefinition.model} for the reviewed target table
125
- * so that the output stays within the LLM's maximum output token limit. If
126
- * the review determines that additional child tables are required (e.g. 1NF
127
- * decomposition), they are declared in
128
- * {@link AutoBeDatabaseSchemaDefinition.newDesigns} as lightweight name +
129
- * description pairs and will be generated by their own dedicated pipeline
130
- * calls.
53
+ * Corrected schema definition, or null if no changes are needed.
131
54
  *
132
- * If null, the original model remains unchanged from the original schema.
133
- * If not null, the modification must resolve issues identified in the
134
- * review.
55
+ * When not null, carries exactly one corrected
56
+ * {@link AutoBeDatabaseSchemaDefinition.model}. Additional child tables go
57
+ * in {@link AutoBeDatabaseSchemaDefinition.newDesigns}.
135
58
  */
136
59
  content: AutoBeDatabaseSchemaDefinition | null;
137
60
  }
@@ -30,6 +30,11 @@ export const transformRealizeTransformerCorrectHistory = async (
30
30
  .flat()
31
31
  .find((m) => m.name === props.function.plan.databaseSchemaName)!;
32
32
  const document: AutoBeOpenApi.IDocument = ctx.state().interface!.document;
33
+ const recursiveProperty: string | null =
34
+ AutoBeRealizeTransformerProgrammer.getRecursiveProperty({
35
+ schemas: document.components.schemas,
36
+ typeName: props.function.plan.dtoTypeName,
37
+ });
33
38
  const dto: Record<string, string> =
34
39
  await AutoBeRealizeTransformerProgrammer.writeStructures(
35
40
  ctx,
@@ -41,7 +46,13 @@ export const transformRealizeTransformerCorrectHistory = async (
41
46
  id: v7(),
42
47
  created_at: new Date().toISOString(),
43
48
  type: "systemMessage",
44
- text: AutoBeSystemPromptConstant.REALIZE_TRANSFORMER_WRITE,
49
+ text:
50
+ recursiveProperty !== null
51
+ ? [
52
+ AutoBeSystemPromptConstant.REALIZE_TRANSFORMER_WRITE,
53
+ AutoBeSystemPromptConstant.REALIZE_TRANSFORMER_RECURSIVE,
54
+ ].join("\n\n")
55
+ : AutoBeSystemPromptConstant.REALIZE_TRANSFORMER_WRITE,
45
56
  },
46
57
  {
47
58
  id: v7(),
@@ -84,6 +95,14 @@ export const transformRealizeTransformerCorrectHistory = async (
84
95
  )}
85
96
  \`\`\`
86
97
 
98
+ Here is the **Relation Mapping Table** for model \`${props.function.plan.databaseSchemaName}\`.
99
+ ONLY use propertyKey values from this table in select() — NEVER guess or derive from table names:
100
+
101
+ ${AutoBeRealizeTransformerProgrammer.formatRelationMappingTable({
102
+ application,
103
+ model,
104
+ })}
105
+
87
106
  Here is the list of database schema members you have to consider
88
107
  when writing select() function:
89
108
 
@@ -127,6 +146,7 @@ export const transformRealizeTransformerCorrectHistory = async (
127
146
  schema: ctx.state().interface!.document.components.schemas[
128
147
  props.function.plan.dtoTypeName
129
148
  ] as AutoBeOpenApi.IJsonSchemaDescriptive.IObject,
149
+ schemas: document.components.schemas,
130
150
  })}
131
151
 
132
152
  Current code is as follows:
@@ -27,6 +27,15 @@ export const transformRealizeTransformerWriteHistory = async (
27
27
  .flat()
28
28
  .find((m) => m.name === props.plan.databaseSchemaName)!;
29
29
  const document: AutoBeOpenApi.IDocument = ctx.state().interface!.document;
30
+ const schema: AutoBeOpenApi.IJsonSchemaDescriptive.IObject = document
31
+ .components.schemas[
32
+ props.plan.dtoTypeName
33
+ ] as AutoBeOpenApi.IJsonSchemaDescriptive.IObject;
34
+ const recursiveProperty: string | null =
35
+ AutoBeRealizeTransformerProgrammer.getRecursiveProperty({
36
+ schemas: document.components.schemas,
37
+ typeName: props.plan.dtoTypeName,
38
+ });
30
39
  const dto: Record<string, string> =
31
40
  await AutoBeRealizeTransformerProgrammer.writeStructures(
32
41
  ctx,
@@ -38,7 +47,13 @@ export const transformRealizeTransformerWriteHistory = async (
38
47
  id: v7(),
39
48
  created_at: new Date().toISOString(),
40
49
  type: "systemMessage",
41
- text: AutoBeSystemPromptConstant.REALIZE_TRANSFORMER_WRITE,
50
+ text:
51
+ recursiveProperty !== null
52
+ ? [
53
+ AutoBeSystemPromptConstant.REALIZE_TRANSFORMER_WRITE,
54
+ AutoBeSystemPromptConstant.REALIZE_TRANSFORMER_RECURSIVE,
55
+ ].join("\n\n")
56
+ : AutoBeSystemPromptConstant.REALIZE_TRANSFORMER_WRITE,
42
57
  },
43
58
  ...props.preliminary.getHistories(),
44
59
  {
@@ -65,9 +80,8 @@ export const transformRealizeTransformerWriteHistory = async (
65
80
  \`\`\`typescript
66
81
  ${AutoBeRealizeTransformerProgrammer.writeTemplate({
67
82
  plan: props.plan,
68
- schema: ctx.state().interface!.document.components.schemas[
69
- props.plan.dtoTypeName
70
- ] as AutoBeOpenApi.IJsonSchemaDescriptive.IObject,
83
+ schema,
84
+ schemas: document.components.schemas,
71
85
  })}
72
86
  \`\`\`
73
87
 
@@ -85,6 +99,14 @@ export const transformRealizeTransformerWriteHistory = async (
85
99
  )
86
100
  .join("\n")}
87
101
 
102
+ Here is the **Relation Mapping Table** for model \`${props.plan.databaseSchemaName}\`.
103
+ ONLY use propertyKey values from this table in select() — NEVER guess or derive from table names:
104
+
105
+ ${AutoBeRealizeTransformerProgrammer.formatRelationMappingTable({
106
+ application,
107
+ model,
108
+ })}
109
+
88
110
  Here is the list of database schema members you have to consider
89
111
  when writing select() function:
90
112
 
@@ -20,6 +20,96 @@ import { AutoBePreliminaryController } from "../../common/AutoBePreliminaryContr
20
20
  import { compileRealizeFiles } from "../programmers/compileRealizeFiles";
21
21
  import { IAutoBeRealizeFunctionFailure } from "../structures/IAutoBeRealizeFunctionFailure";
22
22
 
23
+ /**
24
+ * Deduplicate diagnostics by grouping identical messages and capping total
25
+ * count.
26
+ *
27
+ * Single root causes (e.g., `null` in select) can produce 50-300 cascading
28
+ * errors with identical messages. This function collapses them so the LLM
29
+ * focuses on the root cause instead of being overwhelmed by repetition.
30
+ */
31
+ const deduplicateDiagnostics = (
32
+ diagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[],
33
+ ): IAutoBeTypeScriptCompileResult.IDiagnostic[] => {
34
+ const byMessage = new Map<
35
+ string,
36
+ {
37
+ diag: IAutoBeTypeScriptCompileResult.IDiagnostic;
38
+ count: number;
39
+ }
40
+ >();
41
+ for (const d of diagnostics) {
42
+ const key = d.messageText;
43
+ const existing = byMessage.get(key);
44
+ if (existing) {
45
+ existing.count++;
46
+ } else {
47
+ byMessage.set(key, { diag: d, count: 1 });
48
+ }
49
+ }
50
+
51
+ const deduped: IAutoBeTypeScriptCompileResult.IDiagnostic[] = [];
52
+ for (const [, { diag, count }] of byMessage) {
53
+ deduped.push({
54
+ ...diag,
55
+ messageText:
56
+ count > 1
57
+ ? `${diag.messageText} (repeated ${count} times - fix the root cause)`
58
+ : diag.messageText,
59
+ });
60
+ }
61
+
62
+ if (deduped.length > 25) {
63
+ const truncated = deduped.slice(0, 25);
64
+ truncated.push({
65
+ file: deduped[0]!.file,
66
+ start: null,
67
+ length: null,
68
+ code: 0,
69
+ messageText: `[+${deduped.length - 25} additional unique errors omitted - focus on the above errors first]`,
70
+ category: "error",
71
+ });
72
+ return truncated;
73
+ }
74
+ return deduped;
75
+ };
76
+
77
+ /**
78
+ * Sanitize LLM-generated code by removing common artifacts:
79
+ *
80
+ * - Chain-of-thought text leaked into code output
81
+ * - Token truncation artifacts (e.g., standalone 'n' characters)
82
+ * - Markdown code fences
83
+ */
84
+ const sanitizeGeneratedCode = (code: string): string => {
85
+ let result = code;
86
+
87
+ // 1. Extract code from markdown fences if present
88
+ const codeBlockMatch = result.match(
89
+ /```(?:typescript|ts)?\s*\n([\s\S]*?)\n```/,
90
+ );
91
+ if (codeBlockMatch) {
92
+ result = codeBlockMatch[1]!;
93
+ }
94
+
95
+ // 2. Remove everything before the first export statement
96
+ const exportMatch = result.match(
97
+ /(export\s+(?:namespace|async\s+function|function|const)\s+[\s\S]*)/,
98
+ );
99
+ if (exportMatch) {
100
+ result = exportMatch[1]!;
101
+ }
102
+
103
+ // 3. Remove standalone 'n' token artifacts (minimax-m2.7 pattern)
104
+ // Only remove lines that are EXACTLY 'n' (with optional whitespace)
105
+ result = result.replace(/^\s*n\s*$/gm, "");
106
+
107
+ // 4. Remove trailing 'n' after commas (another truncation pattern)
108
+ result = result.replace(/,\s*n\s*\n/g, ",\n");
109
+
110
+ return result.trim();
111
+ };
112
+
23
113
  interface IProgrammer<
24
114
  RealizeFunction extends AutoBeRealizeFunction,
25
115
  PreliminaryKind extends AutoBePreliminaryKind,
@@ -171,6 +261,17 @@ const correct = async <
171
261
  const localFunction: RealizeFunction = props.functions.find(
172
262
  (f) => f.location === location,
173
263
  )!;
264
+ const rawDiagnostics = failure.diagnostics.filter(
265
+ (d) => d.file === localFunction.location,
266
+ );
267
+
268
+ // P2-5: Log when error count is very high (suggests regeneration may be better than correction)
269
+ if (rawDiagnostics.length > 20) {
270
+ console.warn(
271
+ `[realizeCorrectOverall] ${rawDiagnostics.length} errors in ${localFunction.location} — consider regeneration instead of correction`,
272
+ );
273
+ }
274
+
174
275
  const localFailures: IAutoBeRealizeFunctionFailure<RealizeFunction>[] =
175
276
  [
176
277
  ...props.previousFailures
@@ -183,9 +284,7 @@ const correct = async <
183
284
  .filter((x) => x !== null),
184
285
  {
185
286
  function: localFunction,
186
- diagnostics: failure.diagnostics.filter(
187
- (d) => d.file === localFunction.location,
188
- ),
287
+ diagnostics: deduplicateDiagnostics(rawDiagnostics),
189
288
  },
190
289
  ];
191
290
  try {
@@ -324,7 +423,9 @@ const process = async <
324
423
 
325
424
  const content: string = await props.programmer.replaceImportStatements({
326
425
  function: props.function,
327
- code: pointer.value.revise.final ?? pointer.value.draft,
426
+ code: sanitizeGeneratedCode(
427
+ pointer.value.revise.final ?? pointer.value.draft,
428
+ ),
328
429
  });
329
430
  ctx.dispatch({
330
431
  id: v7(),
@@ -381,11 +482,24 @@ const compileWithFiltering = async <
381
482
  });
382
483
  if (compiled.result.type !== "failure") return compiled;
383
484
 
384
- const functionLocations: string[] = props.functions.map((f) => f.location);
485
+ const functionLocations = new Set(props.functions.map((f) => f.location));
385
486
 
386
- compiled.result.diagnostics = compiled.result.diagnostics.filter(
387
- (d) => d.file !== null && functionLocations.includes(d.file),
487
+ const directErrors = compiled.result.diagnostics.filter(
488
+ (d) => d.file !== null && functionLocations.has(d.file),
489
+ );
490
+ const crossFileErrors = compiled.result.diagnostics.filter(
491
+ (d) => d.file !== null && !functionLocations.has(d.file),
388
492
  );
493
+
494
+ // Log cross-file errors for debugging (P1-4)
495
+ if (crossFileErrors.length > 0) {
496
+ console.warn(
497
+ `[realizeCorrectOverall] ${crossFileErrors.length} cross-file errors detected in: ` +
498
+ [...new Set(crossFileErrors.map((d) => d.file))].join(", "),
499
+ );
500
+ }
501
+
502
+ compiled.result.diagnostics = directErrors;
389
503
  if (compiled.result.diagnostics.length === 0) {
390
504
  compiled.result = { type: "success" };
391
505
  }
@@ -437,11 +551,13 @@ const separateCorrectionResults = <
437
551
  const failed: RealizeFunction[] = corrections
438
552
  .filter(
439
553
  (c) =>
440
- c.type === "success" && errorLocations.includes(c.function.location),
554
+ (c.type === "success" &&
555
+ errorLocations.includes(c.function.location)) ||
556
+ c.type === "exception",
441
557
  )
442
558
  .map((c) => c.function);
443
559
  const ignored: RealizeFunction[] = corrections
444
- .filter((c) => c.type === "ignore" || c.type === "exception")
560
+ .filter((c) => c.type === "ignore")
445
561
  .map((c) => c.function);
446
562
  return { success, failed, ignored };
447
563
  };
@@ -23,6 +23,7 @@ export const orchestrateRealizeTransformerCorrectCasting = (
23
23
  schema: ctx.state().interface!.document.components.schemas[
24
24
  func.plan.dtoTypeName
25
25
  ] as AutoBeOpenApi.IJsonSchemaDescriptive.IObject,
26
+ schemas: ctx.state().interface!.document.components.schemas,
26
27
  }),
27
28
  replaceImportStatements: (next) =>
28
29
  AutoBeRealizeTransformerProgrammer.replaceImportStatements(ctx, {