@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
@@ -3,26 +3,18 @@ import { IAutoBePreliminaryGetDatabaseSchemas } from "../../common/structures/IA
3
3
  import { IAutoBePreliminaryGetInterfaceSchemas } from "../../common/structures/IAutoBePreliminaryGetInterfaceSchemas";
4
4
 
5
5
  /**
6
- * Function calling interface for planning transformer DTO generation.
6
+ * Plans whether a single DTO needs a transformer. Sets databaseSchemaName to
7
+ * null for non-transformable DTOs.
7
8
  *
8
- * Guides the AI agent through analyzing a single DTO type and determining
9
- * whether it needs a transformer. Each DTO is analyzed independently, enabling
10
- * parallel processing across all DTOs.
11
- *
12
- * The planning follows a structured RAG workflow: preliminary context gathering
13
- * (database schemas, DTO schemas) → eligibility analysis → plan generation.
14
- *
15
- * **Key Decisions**: Not all DTOs require transformers. The agent must
16
- * distinguish transformable DTOs (Read DTO + DB-backed + Direct mapping) from
9
+ * **Key Decisions**: Not all DTOs require transformers. Distinguish
10
+ * transformable DTOs (Read DTO + DB-backed + direct mapping) from
17
11
  * non-transformable DTOs (request params, pagination wrappers, business logic
18
- * types) and set databaseSchemaName to null for non-transformable ones.
12
+ * types).
19
13
  */
20
14
  export interface IAutoBeRealizeTransformerPlanApplication {
21
15
  /**
22
- * Process transformer planning task or preliminary data requests.
23
- *
24
16
  * Analyzes the given DTO type and generates a plan entry determining whether
25
- * a transformer is needed. Returns exactly ONE plan entry for the given DTO.
17
+ * a transformer is needed. Returns exactly ONE plan entry.
26
18
  *
27
19
  * @param props Request containing either preliminary data request or complete
28
20
  * plan
@@ -34,37 +26,16 @@ export namespace IAutoBeRealizeTransformerPlanApplication {
34
26
  /**
35
27
  * Think before you act.
36
28
  *
37
- * Before requesting preliminary data or completing your plan, reflect on
38
- * your current state and explain your reasoning:
39
- *
40
- * For preliminary requests:
41
- *
42
- * - What schemas (database or DTO) are missing that you need?
43
- * - Why do you need them for planning?
44
- * - Be brief - state the gap, don't list everything you have.
45
- *
46
- * For completion:
29
+ * For preliminary requests: what schemas (database or DTO) are missing?
47
30
  *
48
- * - Is this DTO transformable or non-transformable?
49
- * - What database table does it map to (if transformable)?
50
- * - Why is it non-transformable (if applicable)?
51
- *
52
- * This reflection helps you avoid duplicate requests and premature
53
- * completion.
31
+ * For completion: is this DTO transformable or non-transformable? What
32
+ * database table does it map to (if transformable)?
54
33
  */
55
34
  thinking: string;
56
35
 
57
36
  /**
58
- * Type discriminator for the request.
59
- *
60
- * Determines which action to perform:
61
- *
62
- * - "getDatabaseSchemas": Retrieve database table schemas for DB structure
63
- * - "getInterfaceSchemas": Retrieve DTO type definitions for API contracts
64
- * - "complete": Generate final transformer plan
65
- *
66
- * The preliminary types are removed from the union after their respective
67
- * data has been provided, physically preventing repeated calls.
37
+ * Action to perform. Exhausted preliminary types are removed from the
38
+ * union, physically preventing repeated calls.
68
39
  */
69
40
  request:
70
41
  | IComplete
@@ -74,76 +45,42 @@ export namespace IAutoBeRealizeTransformerPlanApplication {
74
45
  }
75
46
 
76
47
  /**
77
- * Request to complete transformer planning.
78
- *
79
- * Generates a plan with exactly ONE entry for the given DTO, indicating
80
- * whether it is transformable (has database schema name) or non-transformable
81
- * (null).
48
+ * Generates exactly ONE plan entry indicating transformable (has DB schema
49
+ * name) or not (null).
82
50
  */
83
51
  export interface IComplete {
84
52
  /** Type discriminator for completion request. */
85
53
  type: "complete";
86
54
 
87
55
  /**
88
- * Plan entry for the given DTO.
89
- *
90
- * Must contain exactly ONE entry with:
91
- *
92
- * - DTO type name matching the given DTO
93
- * - Chain of thought explaining the analysis
94
- * - Database schema name if transformable, or null if not
95
- *
96
- * Use databaseSchemaName to distinguish:
97
- *
98
- * - Non-null: Transformable DTO, transformer will be generated
99
- * - Null: Non-transformable DTO, no transformer needed
56
+ * Exactly ONE entry. databaseSchemaName non-null = transformable, null = no
57
+ * transformer needed.
100
58
  */
101
59
  plans: IPlan[];
102
60
  }
103
61
 
104
- /**
105
- * Plan for a single DTO analysis result.
106
- *
107
- * Records the planning decision for one DTO from the operation response.
108
- */
62
+ /** Planning decision for one DTO. */
109
63
  export interface IPlan {
110
64
  /**
111
- * DTO type name being analyzed.
112
- *
113
- * The TypeScript interface type from the operation response.
114
- *
115
- * Example: "IShoppingSaleUnitStock", "IShoppingCategory", "IPage.IRequest"
65
+ * TypeScript interface type from the operation response (e.g.,
66
+ * "IShoppingSaleUnitStock").
116
67
  */
117
68
  dtoTypeName: string;
118
69
 
119
70
  /**
120
- * Chain of thought for this DTO's planning decision.
121
- *
122
- * Explains the agent's reasoning:
71
+ * Reasoning for this DTO's planning decision.
123
72
  *
124
- * - For transformable DTOs: Why a transformer is needed, which database table
125
- * it maps to
126
- * - For non-transformable DTOs: Why no transformer is needed (request param,
127
- * pagination wrapper, business logic, etc.)
73
+ * Transformable: "Transforms shopping_sales to IShoppingSale with nested
74
+ * category and tags".
128
75
  *
129
- * Example (transformable): "Transforms shopping_sales to IShoppingSale with
130
- * nested category and tags"
131
- *
132
- * Example (non-transformable): "IPage.IRequest is pagination parameter, not
133
- * database-backed"
76
+ * Non-transformable: "IPage.IRequest is pagination parameter, not
77
+ * DB-backed".
134
78
  */
135
79
  thinking: string;
136
80
 
137
81
  /**
138
- * Database schema name if transformable, null if not.
139
- *
140
- * - **Non-null**: The database table name this DTO maps to. A transformer
141
- * will be generated for this DTO.
142
- * - **Null**: This DTO is non-transformable (request param, pagination
143
- * wrapper, business logic type). No transformer will be generated.
144
- *
145
- * Example (transformable): "shopping_sales", "shopping_categories" Example
146
- * (non-transformable): null
82
+ * Database table name if transformable (e.g., "shopping_sales"), null if
83
+ * non-transformable (request param, pagination wrapper, business logic).
147
84
  */
148
85
  databaseSchemaName: string | null;
149
86
  }
@@ -6,31 +6,13 @@ import {
6
6
  import { IAutoBePreliminaryGetDatabaseSchemas } from "../../common/structures/IAutoBePreliminaryGetDatabaseSchemas";
7
7
 
8
8
  /**
9
- * Function calling interface for generating DTO transformer functions.
10
- *
11
- * Guides the AI agent through creating reusable transformer modules that
12
- * convert database query results to API response DTOs (DB → API). Each
13
- * transformer includes type-safe conversion logic and Prisma select
14
- * specifications for efficient data loading.
15
- *
16
- * The generation follows a structured RAG workflow: preliminary context
17
- * gathering (database schemas only) → implementation planning → code generation
18
- * → review and refinement. All necessary DTO type information is obtained
19
- * transitively from the DTO type names provided in the plan
20
- * (AutoBeRealizeTransformerPlan).
21
- *
22
- * The planning phase has already filtered out incompatible DTO types (e.g.,
23
- * IPage*, *.IRequest, *.ICreate, *.IUpdate), so the write phase only receives
24
- * DTOs that require transformers.
9
+ * Generates transformer functions that convert Prisma query results to API
10
+ * response DTOs (DB → API) via plan/draft/revise workflow.
25
11
  */
26
12
  export interface IAutoBeRealizeTransformerWriteApplication {
27
13
  /**
28
14
  * Process transformer generation task or preliminary data requests.
29
15
  *
30
- * Generates complete transformer module through three-phase workflow (plan →
31
- * draft → revise). Ensures type safety, proper Prisma payload types, and
32
- * correct DTO mapping.
33
- *
34
16
  * @param props Request containing either preliminary data request or complete
35
17
  * task
36
18
  */
@@ -42,80 +24,40 @@ export namespace IAutoBeRealizeTransformerWriteApplication {
42
24
  /**
43
25
  * Think before you act.
44
26
  *
45
- * Before requesting preliminary data or completing your task, reflect on
46
- * your current state and explain your reasoning:
47
- *
48
- * For preliminary requests:
49
- *
50
- * - What database schemas are missing that you need?
51
- * - Why do you need them for transformer generation?
52
- * - Be brief - state the gap, don't list everything you have.
53
- *
54
- * For completion:
55
- *
56
- * - What schemas did you acquire?
57
- * - What transformer patterns did you implement?
58
- * - Why is it sufficient to complete?
59
- * - Summarize - don't enumerate every field mapping.
27
+ * For preliminary requests: what database schemas are missing and why?
60
28
  *
61
- * Note: All necessary DTO type information is available transitively from
62
- * the DTO type names in the plan. You only need to request database
63
- * schemas.
29
+ * For completion: what schemas did you acquire, what patterns did you
30
+ * implement, and why is it sufficient? Summarize don't enumerate every
31
+ * field.
64
32
  *
65
- * This reflection helps you avoid duplicate requests and premature
66
- * completion.
33
+ * Note: All DTO type information is available transitively from the plan's
34
+ * DTO type names. You only need to request database schemas.
67
35
  */
68
36
  thinking: string;
69
37
 
70
38
  /**
71
- * Type discriminator for the request.
72
- *
73
- * Determines which action to perform:
74
- *
75
- * - "getDatabaseSchemas": Retrieve database table schemas for DB structure
76
- * - "complete": Generate final transformer implementation
77
- *
78
- * All necessary DTO type information is obtained transitively from the DTO
79
- * type names provided in the plan (AutoBeRealizeTransformerPlan). Each DTO
80
- * type name allows the system to recursively fetch all referenced types,
81
- * providing complete type information without requiring explicit schema
82
- * requests.
83
- *
84
- * The preliminary types are removed from the union after their respective
85
- * data has been provided, physically preventing repeated calls.
39
+ * Action to perform. Exhausted preliminary types are removed from the
40
+ * union, physically preventing repeated calls.
86
41
  */
87
42
  request: IComplete | IAutoBePreliminaryGetDatabaseSchemas;
88
43
  }
89
44
 
90
45
  /**
91
- * Request to generate transformer module implementation.
92
- *
93
- * Executes three-phase generation to create complete transformer with:
94
- *
95
- * - `select()` function: Returns Prisma include/select specification
96
- * - `transform()` function: Converts Prisma payload to DTO
97
- *
98
- * Follows plan → draft → revise pattern to ensure type safety and correct
99
- * field mappings.
100
- *
101
- * Note: The database schema name is provided as input from the planning
102
- * phase, so it doesn't need to be returned in the response.
46
+ * Generate transformer module (select + transform functions) via
47
+ * plan/draft/revise.
103
48
  */
104
49
  export interface IComplete {
105
50
  /** Type discriminator for completion request. */
106
51
  type: "complete";
107
52
 
108
53
  /**
109
- * Transformer implementation plan and strategy.
54
+ * Transformer implementation plan. MUST contain four sections:
110
55
  *
111
- * MUST contain thorough analysis with these four mandatory sections:
112
- *
113
- * 1. Database Schema Field Inventory - List ALL fields with exact names from
114
- * schema
115
- * 2. DTO Property Inventory - List ALL properties with types
116
- * 3. Field-by-Field Mapping Strategy - Explicit table for BOTH select() and
56
+ * 1. Database Schema Field Inventory — ALL fields with exact names from schema
57
+ * 2. DTO Property Inventory — ALL properties with types
58
+ * 3. Field-by-Field Mapping Strategy explicit table for BOTH select() and
117
59
  * transform()
118
- * 4. Edge Cases and Special Handling - Type casts (Decimal, DateTime),
60
+ * 4. Edge Cases and Special Handling type casts (Decimal, DateTime),
119
61
  * nullables
120
62
  *
121
63
  * This forces you to READ the actual schema (not imagine it) and creates an
@@ -124,107 +66,49 @@ export namespace IAutoBeRealizeTransformerWriteApplication {
124
66
  plan: string;
125
67
 
126
68
  /**
127
- * Database field-by-field selection mapping for the select() function.
128
- *
129
- * Documents which database fields/relations must be selected from the
130
- * database to enable the transform() function. This ensures no required
131
- * data is missing from the query.
69
+ * Database field-by-field selection mapping for select().
132
70
  *
133
- * MUST include EVERY database field needed by transform() - no exceptions.
71
+ * MUST include EVERY database field needed by transform() no exceptions.
134
72
  * Each mapping specifies:
135
73
  *
136
- * - `member`: Exact database field/relation name (snake_case)
137
- * - `kind`: Whether it's a scalar field, belongsTo, hasOne, or hasMany
138
- * relation
139
- * - `nullable`: Whether the field/relation is nullable (true/false for
140
- * scalar/belongsTo, null for hasMany/hasOne)
141
- * - `how`: Why this field is being selected (which DTO property needs it)
74
+ * - `member`: Exact Prisma field/relation name (snake_case) — read from the
75
+ * Relation Mapping Table and member list, NOT from DTO property names
76
+ * - `kind`: scalar, belongsTo, hasOne, or hasMany
77
+ * - `nullable`: true/false for scalar/belongsTo, null for hasMany/hasOne
78
+ * - `how`: Which DTO property needs it
142
79
  *
143
80
  * The `kind` property forces explicit classification of each member BEFORE
144
- * deciding what to select, preventing confusion between scalars and
145
- * relations, and ensuring correct select syntax.
146
- *
147
- * The `nullable` property documents schema constraints that affect how
148
- * transform() will handle the data, enabling proper null handling in
149
- * transformations.
150
- *
151
- * Missing even a single required field will cause validation failure and
152
- * trigger regeneration.
81
+ * deciding select syntax, preventing confusion between scalars and
82
+ * relations.
153
83
  *
154
- * This structured approach:
155
- *
156
- * - Prevents missing field selections through systematic coverage
157
- * - Forces explicit decision-making for each database field (kind + nullable
158
- *
159
- * - How)
160
- * - Ensures select() and transform() are perfectly aligned
161
- * - Documents what data to load from database
162
- * - Prevents confusion between scalar fields and relations
163
- * - Documents nullability constraints for transform() planning
164
- * - Enables validation before code generation
165
- *
166
- * **Common selection patterns by kind**:
167
- *
168
- * - **Scalar fields (nullable: true/false)**: For direct mapping or type
169
- * conversion
170
- * - **Computation sources (nullable: true/false)**: Fields needed for
171
- * computed DTO properties
172
- * - **Aggregations (nullable: false)**: _count, _sum, _avg for DTO statistics
173
- * - **BelongsTo relations (nullable: true/false)**: For nested object
174
- * transformers
175
- * - **HasMany relations (nullable: null)**: For array transformers
176
- *
177
- * The validator will cross-check this list against the database schema and
178
- * DTO requirements to ensure complete coverage.
84
+ * Missing even a single required field will cause validation failure.
179
85
  */
180
86
  selectMappings: AutoBeRealizeTransformerSelectMapping[];
181
87
 
182
88
  /**
183
- * DTO property-by-property transformation mapping for the transform()
184
- * function.
185
- *
186
- * Documents how to transform database payload data into each DTO property.
187
- * This ensures complete DTO coverage and correct transformation logic.
89
+ * DTO property-by-property transformation mapping for transform().
188
90
  *
189
- * MUST include EVERY property from the DTO type definition - no exceptions.
91
+ * MUST include EVERY property from the DTO type definition no exceptions.
190
92
  * Each mapping specifies:
191
93
  *
192
94
  * - `property`: Exact DTO property name (camelCase)
193
- * - `how`: How to obtain this property value from Prisma payload
194
- *
195
- * Missing even a single property will cause validation failure and trigger
196
- * regeneration.
197
- *
198
- * This structured approach:
199
- *
200
- * - Prevents property omissions through systematic coverage
201
- * - Forces explicit decision-making for each property transformation
202
- * - Documents transformation logic (direct mapping, type conversion,
203
- * computation, nested transformation)
204
- * - Ensures select() and transform() are aligned
205
- * - Enables validation before code generation
95
+ * - `how`: How to obtain from Prisma payload
206
96
  *
207
97
  * **Common transformation patterns**:
208
98
  *
209
- * - **Direct mapping**: Simple field renaming (snake_case → camelCase)
210
- * - **Type conversion**: Decimal → Number, DateTime → ISO string
211
- * - **Nullable handling**: DateTime? → string | null
212
- * - **Computed properties**: Calculate from multiple database fields
213
- * - **Aggregation**: Use _count, _sum, _avg from database
214
- * - **Nested objects**: Reuse neighbor transformers
215
- * - **Arrays**: Map with ArrayUtil.asyncMap + neighbor transformer
99
+ * - Direct mapping: snake_case → camelCase
100
+ * - Type conversion: Decimal → Number, DateTime → ISO string
101
+ * - Nullable: DateTime? → string | null
102
+ * - Nested objects: Reuse neighbor transformers
103
+ * - Arrays: ArrayUtil.asyncMap + neighbor transformer
216
104
  *
217
- * The validator will cross-check this list against the actual DTO type
218
- * definition and reject incomplete mappings.
105
+ * Missing even a single property will cause validation failure.
219
106
  */
220
107
  transformMappings: AutoBeRealizeTransformerTransformMapping[];
221
108
 
222
109
  /**
223
- * Initial transformer implementation draft.
224
- *
225
- * Complete implementation that strictly follows the plan's mapping table.
226
- * EVERY field in the plan's Section 3 MUST appear in BOTH select() and
227
- * transform(). Implement:
110
+ * Complete implementation following plan's mapping table. EVERY field from
111
+ * plan Section 3 MUST appear in BOTH select() and transform(). Implement:
228
112
  *
229
113
  * - Transform() first, select() second, Payload last (correct order)
230
114
  * - All field mappings from plan with correct transformations
@@ -233,45 +117,28 @@ export namespace IAutoBeRealizeTransformerWriteApplication {
233
117
  */
234
118
  draft: string;
235
119
 
236
- /**
237
- * Revision and finalization phase.
238
- *
239
- * Reviews the draft implementation and produces the final code with all
240
- * improvements and corrections applied.
241
- */
120
+ /** Reviews draft and produces final code. */
242
121
  revise: IReviseProps;
243
122
  }
244
123
 
245
124
  export interface IReviseProps {
246
125
  /**
247
- * Critical review and improvement analysis.
248
- *
249
- * MUST systematically verify using four checklists:
126
+ * MUST systematically verify four checklists:
250
127
  *
251
- * 1. Schema Fidelity - Cross-check EVERY field name against plan Section 1
252
- * inventory
253
- * 2. Plan Adherence - Verify EVERY mapping from Section 3 in BOTH select() and
128
+ * 1. Schema Fidelity cross-check EVERY field name against plan Section 1
129
+ * 2. Plan Adherence — verify EVERY mapping from Section 3 in BOTH select() and
254
130
  * transform()
255
- * 3. System Rules - Mandatory neighbor reuse, function order, select (not
256
- * include)
257
- * 4. Type Safety - Type casts (Decimal→Number, DateTime→ISO), nullable
258
- * handling
131
+ * 3. System Rules neighbor reuse, function order, select (not include)
132
+ * 4. Type Safety — Decimal→Number, DateTime→ISO, nullable handling
259
133
  *
260
- * Identify specific issues with line numbers and provide clear reasoning.
261
- * This catches hallucinated fields, missing transformations, and rule
262
- * violations.
134
+ * Identify issues with line numbers. This catches hallucinated fields,
135
+ * missing transformations, and rule violations.
263
136
  */
264
137
  review: string;
265
138
 
266
139
  /**
267
- * Final transformer code with all review improvements applied.
268
- *
269
- * Apply ALL fixes identified in the review to produce production-ready
270
- * code. If review found issues, this MUST contain the corrected
271
- * implementation.
272
- *
273
- * Return `null` ONLY if the draft is already perfect and review found zero
274
- * issues.
140
+ * Final transformer code with all review improvements applied, or null if
141
+ * draft needs no changes.
275
142
  */
276
143
  final: string | null;
277
144
  }
@@ -5,16 +5,20 @@ import { IAutoBeTypeScriptCompileResult } from "@autobe/interface";
5
5
  * errors.
6
6
  *
7
7
  * Parses TS2339 "Property 'X' does not exist on type 'Y'" diagnostics,
8
- * deduplicates by (property, type) pair, and returns a short explanation when Y
9
- * appears to be a Prisma model type (snake_case naming).
8
+ * deduplicates by property name, and returns a short explanation.
10
9
  *
11
- * Returns empty string if no TS2339 diagnostics on Prisma-like types are found.
10
+ * Handles both simple type names (e.g., `shopping_sales`) and inline Prisma
11
+ * GetPayload types (e.g., `{ id: string; body: string; ... }`).
12
+ *
13
+ * Returns empty string if no TS2339 diagnostics are found.
12
14
  */
13
15
  export function generateTS2339Hints(
14
16
  diagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[],
15
17
  ): string {
16
- const TS2339_PATTERN = /^Property '(\w+)' does not exist on type '(\w+)'\.?$/;
17
- const PRISMA_MODEL_PATTERN = /^[a-z][a-z0-9]*(_[a-z][a-z0-9]*)+$/;
18
+ // Match both simple types and inline object types
19
+ const TS2339_SIMPLE = /^Property '(\w+)' does not exist on type '(\w+)'\.?$/;
20
+ const TS2339_INLINE =
21
+ /^Property '(\w+)' does not exist on type '\{[^}]*\}'\.?$/;
18
22
 
19
23
  const seen = new Set<string>();
20
24
  const hints: Array<{ property: string; modelType: string }> = [];
@@ -22,17 +26,28 @@ export function generateTS2339Hints(
22
26
  for (const diag of diagnostics) {
23
27
  if (Number(diag.code) !== 2339) continue;
24
28
 
25
- const match = diag.messageText.match(TS2339_PATTERN);
26
- if (match === null) continue;
27
-
28
- const [, property, typeName] = match;
29
- if (!PRISMA_MODEL_PATTERN.test(typeName)) continue;
29
+ // Try simple type match first
30
+ const simpleMatch = diag.messageText.match(TS2339_SIMPLE);
31
+ if (simpleMatch !== null) {
32
+ const [, property, typeName] = simpleMatch;
33
+ const key = `${property}`;
34
+ if (!seen.has(key)) {
35
+ seen.add(key);
36
+ hints.push({ property: property!, modelType: typeName! });
37
+ }
38
+ continue;
39
+ }
30
40
 
31
- const key = `${property}::${typeName}`;
32
- if (seen.has(key)) continue;
33
- seen.add(key);
34
-
35
- hints.push({ property, modelType: typeName });
41
+ // Try inline object type match (Prisma GetPayload output)
42
+ const inlineMatch = diag.messageText.match(TS2339_INLINE);
43
+ if (inlineMatch !== null) {
44
+ const [, property] = inlineMatch;
45
+ const key = `${property}`;
46
+ if (!seen.has(key)) {
47
+ seen.add(key);
48
+ hints.push({ property: property!, modelType: "(Prisma Payload)" });
49
+ }
50
+ }
36
51
  }
37
52
 
38
53
  if (hints.length === 0) return "";
@@ -44,11 +59,16 @@ export function generateTS2339Hints(
44
59
  return [
45
60
  "## TS2339 Relation Field Hints",
46
61
  "",
47
- "These TS2339 errors are caused by accessing **Prisma relation fields** not available on the base model type.",
48
- "- For transformers: add the missing relation to `select()` using `NeighborTransformer.select()`",
49
- "- For collectors: use the **relation property name** (left side of schema definition) with `{ connect }` syntax",
62
+ "These TS2339 errors are caused by accessing fields not available on the Prisma Payload type.",
63
+ "This usually means the field is MISSING from your `select()` object.",
64
+ "",
65
+ "**Fix**: For each property below, add it to `select()`:",
66
+ "- Scalar field → `fieldName: true`",
67
+ "- Relation (has neighbor transformer) → `relation: NeighborTransformer.select()`",
68
+ "- Relation (no transformer) → `relation: { select: { ... } }`",
69
+ "- Aggregate count → `_count: { select: { relation: true } }`",
50
70
  "",
51
- "Affected:",
71
+ "Affected properties:",
52
72
  lines,
53
73
  ].join("\n");
54
74
  }