@autobe/agent 0.24.2 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/lib/constants/AutoBeSystemPromptConstant.d.ts +16 -16
  2. package/lib/context/IAutoBeApplication.d.ts +101 -6
  3. package/lib/context/IAutoBeApplicationProps.d.ts +6 -2
  4. package/lib/factory/createAgenticaHistory.js +1 -1
  5. package/lib/factory/createAgenticaHistory.js.map +1 -1
  6. package/lib/factory/createAutoBeApplication.js +80 -90
  7. package/lib/factory/createAutoBeApplication.js.map +1 -1
  8. package/lib/factory/createAutoBeContext.js +5 -5
  9. package/lib/factory/createAutoBeContext.js.map +1 -1
  10. package/lib/index.mjs +941 -1065
  11. package/lib/index.mjs.map +1 -1
  12. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +5 -1
  13. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
  14. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.d.ts +1 -1
  15. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +18 -3
  16. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  17. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +5 -1
  18. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +19 -7
  19. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  20. package/lib/orchestrate/analyze/orchestrateAnalyze.js +3 -2
  21. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  22. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.d.ts +1 -1
  23. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +2 -2
  24. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  25. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +1 -0
  26. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +2 -2
  27. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
  28. package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
  29. package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
  30. package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js +2 -1
  31. package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
  32. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +5 -1
  33. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +20 -7
  34. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  35. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.d.ts +6 -1
  36. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +31 -23
  37. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  38. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.d.ts +6 -1
  39. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +22 -6
  40. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  41. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +1 -1
  42. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
  43. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.d.ts +4 -1
  44. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +26 -5
  45. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
  46. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.d.ts +5 -1
  47. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +21 -5
  48. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  49. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +1 -1
  50. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  51. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +5 -1
  52. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +20 -4
  53. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  54. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +1 -1
  55. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
  56. package/lib/orchestrate/interface/orchestrateInterface.js +25 -7
  57. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
  58. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +1 -1
  59. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +17 -8
  60. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  61. package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +4 -1
  62. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +18 -11
  63. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  64. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.d.ts +6 -1
  65. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +25 -10
  66. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  67. package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +4 -1
  68. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +9 -6
  69. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
  70. package/lib/orchestrate/interface/orchestrateInterfaceOperations.d.ts +5 -1
  71. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +33 -17
  72. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  73. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.d.ts +5 -1
  74. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +36 -18
  75. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  76. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.d.ts +4 -1
  77. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +19 -8
  78. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  79. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +1 -1
  80. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  81. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.d.ts +6 -1
  82. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +20 -6
  83. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  84. package/lib/orchestrate/prisma/orchestratePrisma.js +3 -3
  85. package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  86. package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -1
  87. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +6 -3
  88. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  89. package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +1 -1
  90. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +12 -6
  91. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
  92. package/lib/orchestrate/{common/histories/transformCommonCorrectDateHistories.d.ts → realize/histories/transformRealizeCorrectCastingHistories.d.ts} +1 -2
  93. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +33 -0
  94. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -0
  95. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js +21 -7
  96. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +1 -1
  97. package/lib/orchestrate/realize/orchestrateRealize.js +3 -9
  98. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
  99. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +12 -2
  100. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  101. package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -5
  102. package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
  103. package/lib/orchestrate/realize/utils/replaceImportStatements.js +3 -1
  104. package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
  105. package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +5 -1
  106. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +11 -7
  107. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  108. package/lib/orchestrate/test/histories/transformTestScenarioHistories.d.ts +7 -1
  109. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +39 -31
  110. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  111. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.d.ts +6 -3
  112. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +32 -26
  113. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
  114. package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +5 -1
  115. package/lib/orchestrate/test/histories/transformTestWriteHistories.js +111 -94
  116. package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  117. package/lib/orchestrate/test/orchestrateTest.js +20 -14
  118. package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
  119. package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +4 -1
  120. package/lib/orchestrate/test/orchestrateTestCorrect.js +51 -35
  121. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  122. package/lib/orchestrate/test/orchestrateTestScenario.d.ts +1 -1
  123. package/lib/orchestrate/test/orchestrateTestScenario.js +14 -3
  124. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  125. package/lib/orchestrate/test/orchestrateTestScenarioReview.d.ts +5 -1
  126. package/lib/orchestrate/test/orchestrateTestScenarioReview.js +19 -11
  127. package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
  128. package/lib/orchestrate/test/orchestrateTestWrite.d.ts +4 -1
  129. package/lib/orchestrate/test/orchestrateTestWrite.js +9 -4
  130. package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  131. package/package.json +5 -5
  132. package/src/constants/AutoBeSystemPromptConstant.ts +16 -16
  133. package/src/context/IAutoBeApplication.ts +101 -6
  134. package/src/context/IAutoBeApplicationProps.ts +6 -2
  135. package/src/factory/createAgenticaHistory.ts +11 -5
  136. package/src/factory/createAutoBeContext.ts +5 -5
  137. package/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.ts +5 -1
  138. package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +16 -0
  139. package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +22 -7
  140. package/src/orchestrate/analyze/orchestrateAnalyze.ts +3 -2
  141. package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +2 -1
  142. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +3 -2
  143. package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +2 -1
  144. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +23 -9
  145. package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +33 -24
  146. package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +26 -9
  147. package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +27 -5
  148. package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +24 -7
  149. package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +23 -6
  150. package/src/orchestrate/interface/orchestrateInterface.ts +29 -10
  151. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +22 -12
  152. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +25 -17
  153. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +35 -23
  154. package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +9 -3
  155. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +44 -29
  156. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +51 -32
  157. package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +20 -6
  158. package/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts +24 -9
  159. package/src/orchestrate/prisma/orchestratePrisma.ts +7 -3
  160. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +5 -1
  161. package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +15 -10
  162. package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +45 -0
  163. package/src/orchestrate/realize/orchestRateRealizeCorrectCasting.ts +26 -7
  164. package/src/orchestrate/realize/orchestrateRealize.ts +6 -17
  165. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +18 -2
  166. package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -5
  167. package/src/orchestrate/realize/utils/replaceImportStatements.ts +5 -0
  168. package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +14 -7
  169. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +44 -36
  170. package/src/orchestrate/test/histories/transformTestScenarioReviewHistories.ts +74 -71
  171. package/src/orchestrate/test/histories/transformTestWriteHistories.ts +35 -12
  172. package/src/orchestrate/test/orchestrateTest.ts +19 -13
  173. package/src/orchestrate/test/orchestrateTestCorrect.ts +65 -46
  174. package/src/orchestrate/test/orchestrateTestScenario.ts +15 -11
  175. package/src/orchestrate/test/orchestrateTestScenarioReview.ts +29 -16
  176. package/src/orchestrate/test/orchestrateTestWrite.ts +13 -4
  177. package/lib/orchestrate/common/histories/transformCommonCorrectDateHistories.js +0 -48
  178. package/lib/orchestrate/common/histories/transformCommonCorrectDateHistories.js.map +0 -1
  179. package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.d.ts +0 -35
  180. package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.js +0 -3
  181. package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.js.map +0 -1
  182. package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.d.ts +0 -4
  183. package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.js +0 -540
  184. package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.js.map +0 -1
  185. package/src/orchestrate/common/histories/transformCommonCorrectDateHistories.ts +0 -60
  186. package/src/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.ts +0 -40
  187. package/src/orchestrate/realize/orchestrateRealizeCorrectDate.ts +0 -372
@@ -1,4 +1,3 @@
1
- import { IAutoBeApplicationProps } from "./IAutoBeApplicationProps";
2
1
  import { IAutoBeApplicationResult } from "./IAutoBeApplicationResult";
3
2
 
4
3
  /**
@@ -26,7 +25,26 @@ export interface IAutoBeApplication {
26
25
  * conversation. When executed after other agents have generated code, it can
27
26
  * also interpret change requests in the context of existing implementations.
28
27
  */
29
- analyze(props: IAutoBeApplicationProps): Promise<IAutoBeApplicationResult>;
28
+ analyze(props: {
29
+ /**
30
+ * Requirements-focused instructions extracted from user utterances.
31
+ *
32
+ * Contains AI-interpreted guidance specifically for the requirements
33
+ * analysis phase. Should focus ONLY on features, business rules, user
34
+ * stories, and functional specifications. Must NOT include database design,
35
+ * API patterns, or implementation details which belong to other phases.
36
+ *
37
+ * **CRITICAL**: Only include what the user actually said. NEVER fabricate
38
+ * or invent requirements the user didn't mention.
39
+ *
40
+ * Examples:
41
+ *
42
+ * - "Focus on inventory management with real-time stock tracking"
43
+ * - "Prioritize user authentication with role-based permissions"
44
+ * - "Emphasize order processing workflow with approval stages"
45
+ */
46
+ instruction: string;
47
+ }): Promise<IAutoBeApplicationResult>;
30
48
 
31
49
  /**
32
50
  * Run prisma agent.
@@ -47,7 +65,26 @@ export interface IAutoBeApplication {
47
65
  * generate ERD documentation using prisma-markdown. An internal review
48
66
  * process ensures schema quality and optimization.
49
67
  */
50
- prisma(props: IAutoBeApplicationProps): Promise<IAutoBeApplicationResult>;
68
+ prisma(props: {
69
+ /**
70
+ * Database design instructions extracted from user utterances.
71
+ *
72
+ * Contains AI-interpreted guidance specifically for the database schema
73
+ * design phase. Should focus ONLY on schema structure, relationships,
74
+ * constraints, and indexing strategies. Must NOT include API design or
75
+ * business logic implementation details.
76
+ *
77
+ * **CRITICAL**: Only include what the user actually said. NEVER fabricate
78
+ * or invent requirements the user didn't mention.
79
+ *
80
+ * Examples:
81
+ *
82
+ * - "Design flexible product catalog with variant support"
83
+ * - "Optimize for high-volume transaction queries"
84
+ * - "Implement strict referential integrity for financial data"
85
+ */
86
+ instruction: string;
87
+ }): Promise<IAutoBeApplicationResult>;
51
88
 
52
89
  /**
53
90
  * Run interface agent.
@@ -62,7 +99,26 @@ export interface IAutoBeApplication {
62
99
  * generated interface includes comprehensive JSDoc comments and undergoes
63
100
  * internal review for consistency.
64
101
  */
65
- interface(props: IAutoBeApplicationProps): Promise<IAutoBeApplicationResult>;
102
+ interface(props: {
103
+ /**
104
+ * API design instructions extracted from user utterances.
105
+ *
106
+ * Contains AI-interpreted guidance specifically for the API interface
107
+ * design phase. Should focus ONLY on endpoint patterns, request/response
108
+ * formats, DTO schemas, and operation specifications. Must NOT include
109
+ * database details or implementation logic.
110
+ *
111
+ * **CRITICAL**: Only include what the user actually said. NEVER fabricate
112
+ * or invent requirements the user didn't mention.
113
+ *
114
+ * Examples:
115
+ *
116
+ * - "Create RESTful endpoints with pagination for all list operations"
117
+ * - "Design mobile-friendly APIs with minimal response payloads"
118
+ * - "Follow OpenAPI 3.0 patterns with comprehensive error responses"
119
+ */
120
+ instruction: string;
121
+ }): Promise<IAutoBeApplicationResult>;
66
122
 
67
123
  /**
68
124
  * Run test program agent.
@@ -85,7 +141,26 @@ export interface IAutoBeApplication {
85
141
  * TypeScript compiler validation and internal review ensure test quality and
86
142
  * optimal coverage.
87
143
  */
88
- test(props: IAutoBeApplicationProps): Promise<IAutoBeApplicationResult>;
144
+ test(props: {
145
+ /**
146
+ * Testing strategy instructions extracted from user utterances.
147
+ *
148
+ * Contains AI-interpreted guidance specifically for the test code
149
+ * generation phase. Should focus ONLY on test scenarios, coverage
150
+ * priorities, edge cases, and validation strategies. Must NOT include
151
+ * implementation or API design details.
152
+ *
153
+ * **CRITICAL**: Only include what the user actually said. NEVER fabricate
154
+ * or invent requirements the user didn't mention.
155
+ *
156
+ * Examples:
157
+ *
158
+ * - "Prioritize payment flow testing with failure scenarios"
159
+ * - "Generate comprehensive tests for concurrent user operations"
160
+ * - "Focus on data integrity validation across all endpoints"
161
+ */
162
+ instruction: string;
163
+ }): Promise<IAutoBeApplicationResult>;
89
164
 
90
165
  /**
91
166
  * Run realize agent.
@@ -108,5 +183,25 @@ export interface IAutoBeApplication {
108
183
  * validation checks, and processes business rules according to
109
184
  * specifications.
110
185
  */
111
- realize(props: IAutoBeApplicationProps): Promise<IAutoBeApplicationResult>;
186
+ realize(props: {
187
+ /**
188
+ * Implementation instructions extracted from user utterances.
189
+ *
190
+ * Contains AI-interpreted guidance specifically for the business logic
191
+ * implementation phase. Should focus ONLY on architectural patterns,
192
+ * performance requirements, business logic details, and service layer
193
+ * decisions. Must NOT include database schema or API interface
194
+ * specifications.
195
+ *
196
+ * **CRITICAL**: Only include what the user actually said. NEVER fabricate
197
+ * or invent requirements the user didn't mention.
198
+ *
199
+ * Examples:
200
+ *
201
+ * - "Implement with caching for frequently accessed data"
202
+ * - "Use transaction patterns for financial operations"
203
+ * - "Optimize for 10K concurrent users with rate limiting"
204
+ */
205
+ instruction: string;
206
+ }): Promise<IAutoBeApplicationResult>;
112
207
  }
@@ -1,4 +1,8 @@
1
1
  export interface IAutoBeApplicationProps {
2
- /** The reason of the function call. */
3
- reason: string;
2
+ /**
3
+ * Instructions for each agent phase redefined by AI from user's utterance.
4
+ * Contains specific guidance for analyze/prisma/interface/test/realize
5
+ * agents.
6
+ */
7
+ instruction: string;
4
8
  }
@@ -1,4 +1,8 @@
1
- import { AgenticaOperation, MicroAgenticaHistory } from "@agentica/core";
1
+ import {
2
+ AgenticaExecuteHistory,
3
+ AgenticaOperation,
4
+ MicroAgenticaHistory,
5
+ } from "@agentica/core";
2
6
  import {
3
7
  AutoBeAssistantMessageHistory,
4
8
  AutoBeHistory,
@@ -6,6 +10,8 @@ import {
6
10
  } from "@autobe/interface";
7
11
  import { ILlmSchema } from "@samchon/openapi";
8
12
 
13
+ import { IAutoBeApplicationProps } from "../context/IAutoBeApplicationProps";
14
+
9
15
  export function createAgenticaHistory<Model extends ILlmSchema.Model>(props: {
10
16
  operations: readonly AgenticaOperation<Model>[];
11
17
  history: AutoBeHistory;
@@ -30,8 +36,8 @@ export function createAgenticaHistory<Model extends ILlmSchema.Model>(props: {
30
36
  created_at: props.history.created_at,
31
37
  type: "execute" as const,
32
38
  arguments: {
33
- reason: props.history.reason,
34
- },
39
+ instruction: props.history.instruction,
40
+ } satisfies IAutoBeApplicationProps,
35
41
  value: {
36
42
  success:
37
43
  props.history.type === "analyze" || props.history.type === "interface"
@@ -39,7 +45,7 @@ export function createAgenticaHistory<Model extends ILlmSchema.Model>(props: {
39
45
  : props.history.compiled.type === "success",
40
46
  },
41
47
  success: true,
42
- };
48
+ } satisfies Partial<AgenticaExecuteHistory<Model>>;
43
49
  return {
44
50
  ...partial,
45
51
  protocol: operation.protocol as "class",
@@ -49,5 +55,5 @@ export function createAgenticaHistory<Model extends ILlmSchema.Model>(props: {
49
55
  protocol: operation.protocol as "class",
50
56
  operation: operation.toJSON(),
51
57
  }),
52
- };
58
+ } satisfies AgenticaExecuteHistory<Model>;
53
59
  }
@@ -279,7 +279,7 @@ const createDispatch = (props: {
279
279
  history: {
280
280
  type: "analyze",
281
281
  id: v7(),
282
- reason: analyzeStart?.reason ?? "",
282
+ instruction: analyzeStart?.reason ?? "",
283
283
  prefix: event.prefix,
284
284
  roles: event.roles,
285
285
  files: event.files,
@@ -297,7 +297,7 @@ const createDispatch = (props: {
297
297
  history: {
298
298
  type: "prisma",
299
299
  id: v7(),
300
- reason: prismaStart?.reason ?? "",
300
+ instruction: prismaStart?.reason ?? "",
301
301
  schemas: event.schemas,
302
302
  result: event.result,
303
303
  compiled: event.compiled,
@@ -315,7 +315,7 @@ const createDispatch = (props: {
315
315
  history: {
316
316
  type: "interface",
317
317
  id: v7(),
318
- reason: interfaceStart?.reason ?? "",
318
+ instruction: interfaceStart?.reason ?? "",
319
319
  authorizations: event.authorizations,
320
320
  document: event.document,
321
321
  created_at: interfaceStart?.created_at ?? new Date().toISOString(),
@@ -332,7 +332,7 @@ const createDispatch = (props: {
332
332
  history: {
333
333
  type: "test",
334
334
  id: v7(),
335
- reason: testStart?.reason ?? "",
335
+ instruction: testStart?.reason ?? "",
336
336
  files: event.files,
337
337
  compiled: event.compiled,
338
338
  created_at: testStart?.created_at ?? new Date().toISOString(),
@@ -349,7 +349,7 @@ const createDispatch = (props: {
349
349
  history: {
350
350
  type: "realize",
351
351
  id: v7(),
352
- reason: realizeStart?.reason ?? "",
352
+ instruction: realizeStart?.reason ?? "",
353
353
  authorizations: event.authorizations,
354
354
  functions: event.functions,
355
355
  controllers: event.controllers,
@@ -20,7 +20,11 @@ export const transformAnalyzeReviewHistories = <Model extends ILlmSchema.Model>(
20
20
  | IAgenticaHistoryJson.ISystemMessage
21
21
  > => {
22
22
  return [
23
- ...transformAnalyzeWriteHistories(ctx, scenario, myFile).slice(0, -1),
23
+ ...transformAnalyzeWriteHistories(ctx, {
24
+ scenario,
25
+ file: myFile,
26
+ instruction: "",
27
+ }).slice(0, -2),
24
28
  {
25
29
  id: v7(),
26
30
  created_at: new Date().toISOString(),
@@ -8,6 +8,7 @@ import { AutoBeContext } from "../../../context/AutoBeContext";
8
8
 
9
9
  export function transformAnalyzeSceHistories<Model extends ILlmSchema.Model>(
10
10
  ctx: AutoBeContext<Model>,
11
+ instruction: string,
11
12
  ): Array<IMicroAgenticaHistoryJson> {
12
13
  return [
13
14
  ...ctx
@@ -33,5 +34,20 @@ export function transformAnalyzeSceHistories<Model extends ILlmSchema.Model>(
33
34
  `,
34
35
  created_at: new Date().toISOString(),
35
36
  },
37
+ {
38
+ id: v7(),
39
+ type: "assistantMessage",
40
+ text: StringUtil.trim`
41
+ ## Instructions from Requirements Discussion
42
+
43
+ The following instructions were extracted by AI from
44
+ the discussion with the user about requirements.
45
+ Use these to guide document structure planning and
46
+ scenario definitions.
47
+
48
+ ${instruction}
49
+ `,
50
+ created_at: new Date().toISOString(),
51
+ },
36
52
  ];
37
53
  }
@@ -10,8 +10,11 @@ import { AutoBeContext } from "../../../context/AutoBeContext";
10
10
 
11
11
  export const transformAnalyzeWriteHistories = <Model extends ILlmSchema.Model>(
12
12
  ctx: AutoBeContext<Model>,
13
- scenario: AutoBeAnalyzeScenarioEvent,
14
- file: AutoBeAnalyzeFile.Scenario,
13
+ props: {
14
+ scenario: AutoBeAnalyzeScenarioEvent;
15
+ file: AutoBeAnalyzeFile.Scenario;
16
+ instruction: string;
17
+ },
15
18
  ): Array<
16
19
  | IAgenticaHistoryJson.IUserMessage
17
20
  | IAgenticaHistoryJson.IAssistantMessage
@@ -46,15 +49,15 @@ export const transformAnalyzeWriteHistories = <Model extends ILlmSchema.Model>(
46
49
  text: StringUtil.trim`
47
50
  ## Language
48
51
 
49
- The language of the document is ${JSON.stringify(scenario.language ?? "en-US")}.
52
+ The language of the document is ${JSON.stringify(props.scenario.language ?? "en-US")}.
50
53
 
51
54
  ## Metadata
52
55
 
53
- Prefix name of the service to create is ${scenario.prefix}
56
+ Prefix name of the service to create is ${props.scenario.prefix}
54
57
  and here is the list of the roles to reference.
55
58
 
56
59
  \`\`\`json
57
- ${JSON.stringify(scenario.roles)}
60
+ ${JSON.stringify(props.scenario.roles)}
58
61
  \`\`\`
59
62
 
60
63
  Here is the entire list of the documents that would be published
@@ -64,14 +67,26 @@ export const transformAnalyzeWriteHistories = <Model extends ILlmSchema.Model>(
64
67
 
65
68
  \`\`\`json
66
69
  ${JSON.stringify(
67
- scenario.files.filter((f) => f.filename !== file.filename),
70
+ props.scenario.files.filter((f) => f.filename !== props.file.filename),
68
71
  )}
69
72
  \`\`\`
70
73
 
71
74
  ## The document to write
72
75
  \`\`\`json
73
- ${JSON.stringify(file)}
76
+ ${JSON.stringify(props.file)}
74
77
  \`\`\`
78
+
79
+ ## Instructions from Requirements Discussion
80
+
81
+ The following instructions were extracted by AI from
82
+ the discussion with the user about requirements.
83
+ If these instructions are relevant to the document you're
84
+ currently writing (${props.file.filename}), incorporate
85
+ them appropriately.
86
+
87
+ If not relevant to this specific document, ignore them.
88
+
89
+ ${props.instruction}
75
90
  `,
76
91
  },
77
92
  ];
@@ -29,14 +29,14 @@ export const orchestrateAnalyze =
29
29
  ctx.dispatch({
30
30
  type: "analyzeStart",
31
31
  id: v7(),
32
- reason: props.reason,
32
+ reason: props.instruction,
33
33
  step,
34
34
  created_at: startTime.toISOString(),
35
35
  });
36
36
 
37
37
  // Generate analysis scenario
38
38
  const scenario: AutoBeAnalyzeScenarioEvent | AutoBeAssistantMessageHistory =
39
- await orchestrateAnalyzeScenario(ctx);
39
+ await orchestrateAnalyzeScenario(ctx, props.instruction);
40
40
  if (scenario.type === "assistantMessage")
41
41
  return ctx.assistantMessage(scenario);
42
42
  else ctx.dispatch(scenario);
@@ -55,6 +55,7 @@ export const orchestrateAnalyze =
55
55
  file,
56
56
  progress: writeProgress,
57
57
  promptCacheKey,
58
+ instruction: props.instruction,
58
59
  },
59
60
  );
60
61
  return event.file;
@@ -21,6 +21,7 @@ export const orchestrateAnalyzeScenario = async <
21
21
  Model extends ILlmSchema.Model,
22
22
  >(
23
23
  ctx: AutoBeContext<Model>,
24
+ instruction: string,
24
25
  ): Promise<AutoBeAnalyzeScenarioEvent | AutoBeAssistantMessageHistory> => {
25
26
  const start: Date = new Date();
26
27
  const pointer: IPointer<IAutoBeAnalyzeScenarioApplication.IProps | null> = {
@@ -32,7 +33,7 @@ export const orchestrateAnalyzeScenario = async <
32
33
  model: ctx.model,
33
34
  build: (value) => (pointer.value = value),
34
35
  }),
35
- histories: transformAnalyzeSceHistories(ctx),
36
+ histories: transformAnalyzeSceHistories(ctx, instruction),
36
37
  enforceFunctionCall: false,
37
38
  message: StringUtil.trim`
38
39
  Design a complete list of documents and user roles for this project.
@@ -20,11 +20,12 @@ export const orchestrateAnalyzeWrite = async <Model extends ILlmSchema.Model>(
20
20
  props: {
21
21
  scenario: AutoBeAnalyzeScenarioEvent;
22
22
  file: AutoBeAnalyzeFile.Scenario;
23
+ instruction: string;
23
24
  progress: AutoBeProgressEventBase;
24
25
  promptCacheKey: string;
25
26
  },
26
27
  ): Promise<AutoBeAnalyzeWriteEvent> => {
27
- const { scenario, file, progress, promptCacheKey } = props;
28
+ const { file, progress, promptCacheKey } = props;
28
29
  const pointer: IPointer<IAutoBeAnalyzeWriteApplication.IProps | null> = {
29
30
  value: null,
30
31
  };
@@ -34,7 +35,7 @@ export const orchestrateAnalyzeWrite = async <Model extends ILlmSchema.Model>(
34
35
  model: ctx.model,
35
36
  pointer,
36
37
  }),
37
- histories: transformAnalyzeWriteHistories(ctx, scenario, file),
38
+ histories: transformAnalyzeWriteHistories(ctx, props),
38
39
  enforceFunctionCall: true,
39
40
  promptCacheKey,
40
41
  message: "Write requirement analysis report.",
@@ -29,7 +29,7 @@ export const transformInterfaceAssetHistories = (
29
29
 
30
30
  ## User Request
31
31
 
32
- ${analyze.reason}
32
+ ${analyze.instruction}
33
33
 
34
34
  ## Requirement Analysis Report
35
35
 
@@ -64,6 +64,7 @@ export const transformInterfaceAssetHistories = (
64
64
  \`\`\`
65
65
 
66
66
  ## Entity Relationship Diagrams
67
+
67
68
  \`\`\`json
68
69
  ${JSON.stringify(
69
70
  (prisma.compiled as IAutoBePrismaCompileResult.ISuccess).diagrams,
@@ -7,13 +7,14 @@ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromp
7
7
  import { AutoBeState } from "../../../context/AutoBeState";
8
8
  import { transformInterfaceAssetHistories } from "./transformInterfaceAssetHistories";
9
9
 
10
- export const transformInterfaceAuthorizationsHistories = (
11
- state: AutoBeState,
12
- role: AutoBeAnalyzeRole,
13
- ): Array<
10
+ export const transformInterfaceAuthorizationsHistories = (props: {
11
+ state: AutoBeState;
12
+ role: AutoBeAnalyzeRole;
13
+ instruction: string;
14
+ }): Array<
14
15
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
15
16
  > => {
16
- const analyze: AutoBeAnalyzeHistory = state.analyze!;
17
+ const analyze: AutoBeAnalyzeHistory = props.state.analyze!;
17
18
  return [
18
19
  {
19
20
  type: "systemMessage",
@@ -21,7 +22,7 @@ export const transformInterfaceAuthorizationsHistories = (
21
22
  created_at: new Date().toISOString(),
22
23
  text: AutoBeSystemPromptConstant.INTERFACE_AUTHORIZATION,
23
24
  },
24
- ...transformInterfaceAssetHistories(state),
25
+ ...transformInterfaceAssetHistories(props.state),
25
26
  {
26
27
  type: "systemMessage",
27
28
  id: v7(),
@@ -44,14 +45,27 @@ export const transformInterfaceAuthorizationsHistories = (
44
45
  id: v7(),
45
46
  created_at: new Date().toISOString(),
46
47
  text: StringUtil.trim`
47
- You have to make API operations for the given role:
48
+ ## API Design Instructions
49
+
50
+ The following API-specific instructions were extracted by AI from
51
+ the user's utterances. These focus ONLY on API interface design aspects
52
+ such as endpoint patterns, request/response formats, DTO schemas,
53
+ and operation specifications.
54
+
55
+ Apply these instructions when designing authorization-related API operations
56
+ for the ${props.role.name} role. Focus particularly on authentication endpoints,
57
+ token management, and security patterns. If the instructions are not relevant
58
+ to authorization operations for this specific role, you may ignore them.
59
+
60
+ ${props.instruction}
48
61
 
49
62
  ## Role
63
+
64
+ You have to make API operations for the given role:
50
65
 
51
66
  \`\`\`json
52
- ${JSON.stringify(role)}
67
+ ${JSON.stringify(props.role)}
53
68
  \`\`\`
54
-
55
69
  `,
56
70
  },
57
71
  ];
@@ -7,11 +7,12 @@ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromp
7
7
  import { AutoBeState } from "../../../context/AutoBeState";
8
8
  import { transformInterfaceAssetHistories } from "./transformInterfaceAssetHistories";
9
9
 
10
- export const transformInterfaceComplementHistories = (
11
- state: AutoBeState,
12
- document: AutoBeOpenApi.IDocument,
13
- missed: string[],
14
- ): Array<
10
+ export const transformInterfaceComplementHistories = (props: {
11
+ state: AutoBeState;
12
+ instruction: string;
13
+ missed: string[];
14
+ document: AutoBeOpenApi.IDocument;
15
+ }): Array<
15
16
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
16
17
  > => [
17
18
  {
@@ -20,7 +21,7 @@ export const transformInterfaceComplementHistories = (
20
21
  created_at: new Date().toISOString(),
21
22
  text: AutoBeSystemPromptConstant.INTERFACE_OPERATION,
22
23
  },
23
- ...transformInterfaceAssetHistories(state),
24
+ ...transformInterfaceAssetHistories(props.state),
24
25
  {
25
26
  type: "systemMessage",
26
27
  id: v7(),
@@ -38,33 +39,41 @@ export const transformInterfaceComplementHistories = (
38
39
  id: v7(),
39
40
  created_at: new Date().toISOString(),
40
41
  text: StringUtil.trim`
42
+ ## API Design Instructions
43
+
44
+ The following API-specific instructions were extracted by AI from
45
+ the user's utterances. These focus ONLY on API interface design aspects
46
+ such as endpoint patterns, request/response formats, DTO schemas,
47
+ and operation specifications.
48
+
49
+ Apply these instructions when completing the missing schema types.
50
+ Focus on ensuring the schemas align with the overall API design patterns
51
+ and data structure requirements. If the instructions are not relevant
52
+ to the specific schemas you need to create, you may ignore them.
53
+
54
+ ${props.instruction}
55
+
56
+ ## Operations
57
+
41
58
  Here is the OpenAPI operations what you AI have made:
42
59
 
43
60
  \`\`\`json
44
- ${JSON.stringify(document.operations)}
61
+ ${JSON.stringify(props.document.operations)}
45
62
  \`\`\`
46
- `,
47
- },
48
- {
49
- type: "assistantMessage",
50
- id: v7(),
51
- created_at: new Date().toISOString(),
52
- text: StringUtil.trim`
63
+
64
+ ## Schemas
65
+
53
66
  Here is the OpenAPI schemas what you AI have made:
54
67
 
55
68
  \`\`\`json
56
- ${JSON.stringify(document.components.schemas)}
69
+ ${JSON.stringify(props.document.components.schemas)}
57
70
  \`\`\`
58
- `,
59
- },
60
- {
61
- type: "assistantMessage",
62
- id: v7(),
63
- created_at: new Date().toISOString(),
64
- text: StringUtil.trim`
65
- You AI have missed below schema types:
66
71
 
67
- ${missed.map((s) => `- ${s}`).join("\n")}
72
+ ## Missed Types
73
+
74
+ However, you AI have missed below schema types:
75
+
76
+ ${props.missed.map((s) => `- ${s}`).join("\n")}
68
77
  `,
69
78
  },
70
79
  ];
@@ -8,11 +8,12 @@ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromp
8
8
  import { AutoBeState } from "../../../context/AutoBeState";
9
9
  import { transformInterfaceAssetHistories } from "./transformInterfaceAssetHistories";
10
10
 
11
- export const transformInterfaceEndpointHistories = (
12
- state: AutoBeState,
13
- group: AutoBeInterfaceGroup,
14
- authorizations: AutoBeOpenApi.IOperation[],
15
- ): Array<
11
+ export const transformInterfaceEndpointHistories = (props: {
12
+ state: AutoBeState;
13
+ group: AutoBeInterfaceGroup;
14
+ authorizations: AutoBeOpenApi.IOperation[];
15
+ instruction: string;
16
+ }): Array<
16
17
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
17
18
  > => [
18
19
  {
@@ -21,25 +22,41 @@ export const transformInterfaceEndpointHistories = (
21
22
  created_at: new Date().toISOString(),
22
23
  text: AutoBeSystemPromptConstant.INTERFACE_ENDPOINT,
23
24
  },
24
- ...transformInterfaceAssetHistories(state),
25
+ ...transformInterfaceAssetHistories(props.state),
25
26
  {
26
27
  type: "assistantMessage",
27
28
  id: v7(),
28
29
  created_at: new Date().toISOString(),
29
30
  text: StringUtil.trim`
31
+ ## API Design Instructions
32
+
33
+ The following API-specific instructions were extracted by AI from
34
+ the user's utterances. These focus ONLY on API interface design aspects
35
+ such as endpoint patterns, request/response formats, DTO schemas,
36
+ and operation specifications.
37
+
38
+ Apply these instructions when designing endpoints for the ${props.group.name} group.
39
+ Consider the specified URL patterns, HTTP methods, parameter structures,
40
+ and response formats. If the instructions are not relevant to this specific
41
+ endpoint group, you may ignore them.
42
+
43
+ ${props.instruction}
44
+
45
+ ## Group Information
46
+
30
47
  Here is the target group for the endpoints:
31
48
 
32
49
  \`\`\`json
33
- ${JSON.stringify(group)}
50
+ ${JSON.stringify(props.group)}
34
51
  \`\`\`
35
52
 
36
- **IMPORTANT: DO NOT DUPLICATE EXISTING OPERATIONS**
53
+ ## Already Existing Operations
37
54
 
38
55
  These operations already exist. Do NOT create similar endpoints:
39
56
 
40
57
  \`\`\`json
41
58
  ${JSON.stringify(
42
- authorizations.map((op) => ({
59
+ props.authorizations.map((op) => ({
43
60
  path: op.path,
44
61
  method: op.method,
45
62
  name: op.name,