@autobe/agent 0.25.4 → 0.25.6

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 (148) hide show
  1. package/lib/AutoBeMockAgent.js +1 -1
  2. package/lib/AutoBeMockAgent.js.map +1 -1
  3. package/lib/constants/AutoBeSystemPromptConstant.d.ts +12 -13
  4. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  5. package/lib/context/AutoBeTokenUsage.d.ts +2 -2
  6. package/lib/context/AutoBeTokenUsage.js.map +1 -1
  7. package/lib/context/{IAutoBeApplication.d.ts → IAutoBeFacadeApplication.d.ts} +15 -83
  8. package/lib/context/{IAutoBeApplicationProps.js → IAutoBeFacadeApplication.js} +1 -1
  9. package/lib/context/IAutoBeFacadeApplication.js.map +1 -0
  10. package/lib/context/{IAutoBeApplicationProps.d.ts → IAutoBeFacadeApplicationProps.d.ts} +1 -1
  11. package/lib/context/{IAutoBeApplication.js → IAutoBeFacadeApplicationProps.js} +1 -1
  12. package/lib/context/IAutoBeFacadeApplicationProps.js.map +1 -0
  13. package/lib/context/{IAutoBeApplicationResult.d.ts → IAutoBeFacadeApplicationResult.d.ts} +1 -1
  14. package/lib/context/{IAutoBeApplicationResult.js → IAutoBeFacadeApplicationResult.js} +1 -1
  15. package/lib/context/IAutoBeFacadeApplicationResult.js.map +1 -0
  16. package/lib/factory/createAgenticaHistory.js +3 -1
  17. package/lib/factory/createAgenticaHistory.js.map +1 -1
  18. package/lib/factory/createAutoBeApplication.js +38 -76
  19. package/lib/factory/createAutoBeApplication.js.map +1 -1
  20. package/lib/factory/createAutoBeContext.js +10 -11
  21. package/lib/factory/createAutoBeContext.js.map +1 -1
  22. package/lib/index.mjs +2109 -1667
  23. package/lib/index.mjs.map +1 -1
  24. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +0 -1
  25. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
  26. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.d.ts +1 -1
  27. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +3 -18
  28. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  29. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +0 -1
  30. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +1 -13
  31. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  32. package/lib/orchestrate/analyze/orchestrateAnalyze.d.ts +1 -2
  33. package/lib/orchestrate/analyze/orchestrateAnalyze.js +2 -4
  34. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  35. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.d.ts +1 -1
  36. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +2 -2
  37. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  38. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +0 -1
  39. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
  40. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.d.ts +1 -0
  41. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +370 -275
  42. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
  43. package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
  44. package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
  45. package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js +0 -4
  46. package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
  47. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +10 -7
  48. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  49. package/lib/orchestrate/interface/histories/transformInterfaceCommonHistories.d.ts +3 -0
  50. package/lib/orchestrate/interface/histories/{transformInterfaceCommonPrerequisiteHistories.js → transformInterfaceCommonHistories.js} +4 -4
  51. package/lib/orchestrate/interface/histories/transformInterfaceCommonHistories.js.map +1 -0
  52. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +12 -9
  53. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  54. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +10 -7
  55. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  56. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +1 -1
  57. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
  58. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +13 -10
  59. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
  60. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +10 -7
  61. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  62. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +1 -1
  63. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  64. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +10 -7
  65. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  66. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +1 -1
  67. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
  68. package/lib/orchestrate/interface/orchestrateInterface.d.ts +2 -2
  69. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
  70. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +10 -5
  71. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  72. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +2 -2
  73. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  74. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +9 -6
  75. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  76. package/lib/orchestrate/prisma/orchestratePrisma.d.ts +2 -2
  77. package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  78. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js +370 -275
  79. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +1 -1
  80. package/lib/orchestrate/realize/orchestrateRealize.d.ts +2 -2
  81. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
  82. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +304 -221
  83. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  84. package/lib/orchestrate/realize/orchestrateRealizeWrite.js +303 -220
  85. package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  86. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +8 -5
  87. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  88. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +8 -5
  89. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
  90. package/lib/orchestrate/test/histories/transformTestWriteHistories.js +8 -5
  91. package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  92. package/lib/orchestrate/test/orchestrateTest.d.ts +2 -2
  93. package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
  94. package/lib/orchestrate/test/orchestrateTestCorrect.js +17 -22
  95. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  96. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +372 -277
  97. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
  98. package/lib/orchestrate/test/orchestrateTestWrite.js +322 -350
  99. package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  100. package/lib/utils/validateEmptyCode.d.ts +8 -0
  101. package/lib/utils/validateEmptyCode.js +35 -0
  102. package/lib/utils/validateEmptyCode.js.map +1 -0
  103. package/package.json +6 -6
  104. package/src/AutoBeMockAgent.ts +1 -1
  105. package/src/constants/AutoBeSystemPromptConstant.ts +12 -13
  106. package/src/context/AutoBeTokenUsage.ts +2 -2
  107. package/src/context/{IAutoBeApplication.ts → IAutoBeFacadeApplication.ts} +15 -83
  108. package/src/context/{IAutoBeApplicationProps.ts → IAutoBeFacadeApplicationProps.ts} +1 -1
  109. package/src/context/{IAutoBeApplicationResult.ts → IAutoBeFacadeApplicationResult.ts} +1 -1
  110. package/src/factory/createAgenticaHistory.ts +5 -4
  111. package/src/factory/createAutoBeApplication.ts +6 -6
  112. package/src/factory/createAutoBeContext.ts +2 -3
  113. package/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.ts +0 -1
  114. package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +0 -16
  115. package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +0 -13
  116. package/src/orchestrate/analyze/orchestrateAnalyze.ts +71 -74
  117. package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +1 -2
  118. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +0 -1
  119. package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +52 -10
  120. package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +0 -4
  121. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +9 -6
  122. package/src/orchestrate/interface/histories/{transformInterfaceCommonPrerequisiteHistories.ts → transformInterfaceCommonHistories.ts} +1 -1
  123. package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +9 -6
  124. package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +9 -6
  125. package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +11 -10
  126. package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +9 -6
  127. package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +9 -6
  128. package/src/orchestrate/interface/orchestrateInterface.ts +2 -2
  129. package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +9 -4
  130. package/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts +8 -5
  131. package/src/orchestrate/prisma/orchestratePrisma.ts +2 -2
  132. package/src/orchestrate/realize/orchestRateRealizeCorrectCasting.ts +58 -17
  133. package/src/orchestrate/realize/orchestrateRealize.ts +2 -2
  134. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +51 -15
  135. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +46 -12
  136. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +8 -5
  137. package/src/orchestrate/test/histories/transformTestScenarioReviewHistories.ts +8 -5
  138. package/src/orchestrate/test/histories/transformTestWriteHistories.ts +8 -5
  139. package/src/orchestrate/test/orchestrateTest.ts +2 -2
  140. package/src/orchestrate/test/orchestrateTestCorrect.ts +17 -24
  141. package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +57 -10
  142. package/src/orchestrate/test/orchestrateTestWrite.ts +41 -10
  143. package/src/utils/validateEmptyCode.ts +41 -0
  144. package/lib/context/IAutoBeApplication.js.map +0 -1
  145. package/lib/context/IAutoBeApplicationProps.js.map +0 -1
  146. package/lib/context/IAutoBeApplicationResult.js.map +0 -1
  147. package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.d.ts +0 -3
  148. package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.js.map +0 -1
@@ -3,7 +3,7 @@ import { v7 } from "uuid";
3
3
 
4
4
  import { AutoBeState } from "../../../context/AutoBeState";
5
5
 
6
- export const transformInterfaceCommonPrerequisiteHistories = (
6
+ export const transformInterfaceCommonHistories = (
7
7
  state: AutoBeState,
8
8
  ): Array<
9
9
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
@@ -41,15 +41,18 @@ export const transformInterfaceComplementHistories = (props: {
41
41
  text: StringUtil.trim`
42
42
  ## API Design Instructions
43
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
44
+ The following API-specific instructions were extracted from
45
+ the user's requirements. These focus on API interface design aspects
46
46
  such as endpoint patterns, request/response formats, DTO schemas,
47
47
  and operation specifications.
48
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.
49
+ Follow these instructions when completing missing schema types.
50
+ Carefully distinguish between:
51
+ - Suggestions or recommendations (consider these as guidance)
52
+ - Direct specifications or explicit commands (these must be followed exactly)
53
+
54
+ When instructions contain direct specifications or explicit design decisions,
55
+ follow them precisely even if you believe you have better alternatives.
53
56
 
54
57
  ${props.instruction}
55
58
 
@@ -30,15 +30,18 @@ export const transformInterfaceEndpointHistories = (props: {
30
30
  text: StringUtil.trim`
31
31
  ## API Design Instructions
32
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
33
+ The following API-specific instructions were extracted from
34
+ the user's requirements. These focus on API interface design aspects
35
35
  such as endpoint patterns, request/response formats, DTO schemas,
36
36
  and operation specifications.
37
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.
38
+ Follow these instructions when designing endpoints for the ${props.group.name} group.
39
+ Carefully distinguish between:
40
+ - Suggestions or recommendations (consider these as guidance)
41
+ - Direct specifications or explicit commands (these must be followed exactly)
42
+
43
+ When instructions contain direct specifications or explicit design decisions,
44
+ follow them precisely even if you believe you have better alternatives.
42
45
 
43
46
  ${props.instruction}
44
47
 
@@ -5,7 +5,7 @@ import { v7 } from "uuid";
5
5
  import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
6
6
  import { AutoBeState } from "../../../context/AutoBeState";
7
7
  import { transformInterfaceAssetHistories } from "./transformInterfaceAssetHistories";
8
- import { transformInterfaceCommonPrerequisiteHistories } from "./transformInterfaceCommonPrerequisiteHistories";
8
+ import { transformInterfaceCommonHistories } from "./transformInterfaceCommonHistories";
9
9
 
10
10
  export const transformInterfaceGroupHistories = (props: {
11
11
  state: AutoBeState;
@@ -13,9 +13,7 @@ export const transformInterfaceGroupHistories = (props: {
13
13
  }): Array<
14
14
  IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
15
15
  > => {
16
- const prerequisite = transformInterfaceCommonPrerequisiteHistories(
17
- props.state,
18
- );
16
+ const prerequisite = transformInterfaceCommonHistories(props.state);
19
17
  if (prerequisite !== null) return prerequisite;
20
18
 
21
19
  return [
@@ -39,15 +37,18 @@ export const transformInterfaceGroupHistories = (props: {
39
37
  text: StringUtil.trim`
40
38
  ## API Design Instructions
41
39
 
42
- The following API-specific instructions were extracted by AI from
43
- the user's utterances. These focus ONLY on API interface design aspects
40
+ The following API-specific instructions were extracted from
41
+ the user's requirements. These focus on API interface design aspects
44
42
  such as endpoint patterns, request/response formats, DTO schemas,
45
43
  and operation specifications.
46
44
 
47
- Apply these instructions when organizing API endpoints into logical groups.
48
- Consider how to structure and categorize endpoints based on business domains,
49
- resource types, or functional areas. If the instructions are not relevant
50
- to endpoint grouping and organization, you may ignore them.
45
+ Follow these instructions when organizing API endpoints.
46
+ Carefully distinguish between:
47
+ - Suggestions or recommendations (consider these as guidance)
48
+ - Direct specifications or explicit commands (these must be followed exactly)
49
+
50
+ When instructions contain direct specifications or explicit design decisions,
51
+ follow them precisely even if you believe you have better alternatives.
51
52
 
52
53
  ${props.instruction}
53
54
  `,
@@ -47,15 +47,18 @@ export const transformInterfaceOperationHistories = (props: {
47
47
  text: StringUtil.trim`
48
48
  ## API Design Instructions
49
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
50
+ The following API-specific instructions were extracted from
51
+ the user's requirements. These focus on API interface design aspects
52
52
  such as endpoint patterns, request/response formats, DTO schemas,
53
53
  and operation specifications.
54
54
 
55
- Apply these instructions when designing the detailed operation specifications
56
- for each endpoint. Consider parameter types, request/response structures,
57
- error handling, and API behavior patterns. If the instructions are not
58
- relevant to the operations you need to implement, you may ignore them.
55
+ Follow these instructions when designing operation specifications.
56
+ Carefully distinguish between:
57
+ - Suggestions or recommendations (consider these as guidance)
58
+ - Direct specifications or explicit commands (these must be followed exactly)
59
+
60
+ When instructions contain direct specifications or explicit design decisions,
61
+ follow them precisely even if you believe you have better alternatives.
59
62
 
60
63
  ${props.instruction}
61
64
 
@@ -28,15 +28,18 @@ export const transformInterfaceSchemaHistories = (props: {
28
28
  text: StringUtil.trim`
29
29
  ## API Design Instructions
30
30
 
31
- The following API-specific instructions were extracted by AI from
32
- the user's utterances. These focus ONLY on API interface design aspects
31
+ The following API-specific instructions were extracted from
32
+ the user's requirements. These focus on API interface design aspects
33
33
  such as endpoint patterns, request/response formats, DTO schemas,
34
34
  and operation specifications.
35
35
 
36
- Apply these instructions when creating JSON schema components for the operations.
37
- Focus on data structure design, field naming conventions, validation rules,
38
- and type definitions. If the instructions are not relevant to the schema
39
- components you need to create, you may ignore them.
36
+ Follow these instructions when creating JSON schema components.
37
+ Carefully distinguish between:
38
+ - Suggestions or recommendations (consider these as guidance)
39
+ - Direct specifications or explicit commands (these must be followed exactly)
40
+
41
+ When instructions contain direct specifications or explicit design decisions,
42
+ follow them precisely even if you believe you have better alternatives.
40
43
 
41
44
  ${props.instruction}
42
45
 
@@ -17,7 +17,7 @@ import { HashMap, Pair } from "tstl";
17
17
  import { v7 } from "uuid";
18
18
 
19
19
  import { AutoBeContext } from "../../context/AutoBeContext";
20
- import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
20
+ import { IAutoBeFacadeApplicationProps } from "../../context/IAutoBeFacadeApplicationProps";
21
21
  import { predicateStateMessage } from "../../utils/predicateStateMessage";
22
22
  import { orchestrateInterfaceAuthorizations } from "./orchestrateInterfaceAuthorizations";
23
23
  import { orchestrateInterfaceComplement } from "./orchestrateInterfaceComplement";
@@ -32,7 +32,7 @@ import { JsonSchemaFactory } from "./utils/JsonSchemaFactory";
32
32
  export const orchestrateInterface =
33
33
  <Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>) =>
34
34
  async (
35
- props: IAutoBeApplicationProps,
35
+ props: IAutoBeFacadeApplicationProps,
36
36
  ): Promise<AutoBeAssistantMessageHistory | AutoBeInterfaceHistory> => {
37
37
  // PREDICATION
38
38
  const start: Date = new Date();
@@ -85,12 +85,17 @@ export const transformPrismaComponentsHistories = (
85
85
 
86
86
  ## Database Design Instructions
87
87
 
88
- The following database-specific instructions were extracted by AI from
89
- the user's utterances. These focus ONLY on database schema design aspects
88
+ The following database-specific instructions were extracted from
89
+ the user's requirements. These focus on database schema design aspects
90
90
  such as table structure, relationships, constraints, and indexing strategies.
91
91
 
92
- Reference these instructions when designing namespace components and
93
- DB table names.
92
+ Follow these instructions when designing namespace components and DB table names.
93
+ Carefully distinguish between:
94
+ - Suggestions or recommendations (consider these as guidance)
95
+ - Direct specifications or explicit commands (these must be followed exactly)
96
+
97
+ When instructions contain direct specifications or explicit design decisions,
98
+ follow them precisely even if you believe you have better alternatives.
94
99
 
95
100
  ${props.instruction}
96
101
  `,
@@ -39,13 +39,16 @@ export const transformPrismaSchemaHistories = (props: {
39
39
  text: StringUtil.trim`
40
40
  ## Database Design Instructions
41
41
 
42
- The following database-specific instructions were extracted by AI from
43
- the user's utterances. These focus ONLY on database schema design aspects
42
+ The following database-specific instructions were extracted from
43
+ the user's requirements. These focus on database schema design aspects
44
44
  such as table structure, relationships, constraints, and indexing strategies.
45
45
 
46
- Reference these instructions when designing the DB schema for this specific
47
- component. If the instruction is not related to the current domain or
48
- component, you may ignore it.
46
+ Follow these instructions when designing the DB schema. Carefully distinguish between:
47
+ - Suggestions or recommendations (consider these as guidance)
48
+ - Direct specifications or explicit commands (these must be followed exactly)
49
+
50
+ When instructions contain direct specifications or explicit design decisions,
51
+ follow them precisely even if you believe you have better alternatives.
49
52
 
50
53
  ${props.instruction}
51
54
 
@@ -13,7 +13,7 @@ import { ILlmSchema } from "@samchon/openapi";
13
13
  import { v7 } from "uuid";
14
14
 
15
15
  import { AutoBeContext } from "../../context/AutoBeContext";
16
- import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
16
+ import { IAutoBeFacadeApplicationProps } from "../../context/IAutoBeFacadeApplicationProps";
17
17
  import { predicateStateMessage } from "../../utils/predicateStateMessage";
18
18
  import { orchestratePrismaComponents } from "./orchestratePrismaComponent";
19
19
  import { orchestratePrismaCorrect } from "./orchestratePrismaCorrect";
@@ -22,7 +22,7 @@ import { orchestratePrismaSchemas } from "./orchestratePrismaSchemas";
22
22
 
23
23
  export const orchestratePrisma = async <Model extends ILlmSchema.Model>(
24
24
  ctx: AutoBeContext<Model>,
25
- props: IAutoBeApplicationProps,
25
+ props: IAutoBeFacadeApplicationProps,
26
26
  ): Promise<AutoBePrismaHistory | AutoBeAssistantMessageHistory> => {
27
27
  // PREDICATION
28
28
  const start: Date = new Date();
@@ -1,4 +1,5 @@
1
1
  import {
2
+ AutoBeOpenApi,
2
3
  AutoBeProgressEventBase,
3
4
  AutoBeRealizeAuthorization,
4
5
  AutoBeRealizeFunction,
@@ -6,7 +7,12 @@ import {
6
7
  IAutoBeTypeScriptCompileResult,
7
8
  } from "@autobe/interface";
8
9
  import { StringUtil } from "@autobe/utils";
9
- import { ILlmApplication, ILlmController, ILlmSchema } from "@samchon/openapi";
10
+ import {
11
+ ILlmApplication,
12
+ ILlmController,
13
+ ILlmSchema,
14
+ IValidation,
15
+ } from "@samchon/openapi";
10
16
  import { IPointer } from "tstl";
11
17
  import typia from "typia";
12
18
  import { v7 } from "uuid";
@@ -14,6 +20,7 @@ import { v7 } from "uuid";
14
20
  import { AutoBeContext } from "../../context/AutoBeContext";
15
21
  import { assertSchemaModel } from "../../context/assertSchemaModel";
16
22
  import { executeCachedBatch } from "../../utils/executeCachedBatch";
23
+ import { validateEmptyCode } from "../../utils/validateEmptyCode";
17
24
  import { IAutoBeCommonCorrectCastingApplication } from "../common/structures/IAutoBeCommonCorrectCastingApplication";
18
25
  import { transformRealizeCorrectCastingHistories } from "./histories/transformRealizeCorrectCastingHistories";
19
26
  import { compileRealizeFiles } from "./internal/compileRealizeFiles";
@@ -113,13 +120,12 @@ const correct = async <Model extends ILlmSchema.Model>(
113
120
  const func: AutoBeRealizeFunction = functions.find(
114
121
  (f) => f.location === location,
115
122
  )!;
116
-
117
- const scenario = scenarios.find((s) => s.location === func.location)!;
118
-
119
- const operation = scenario.operation;
120
- const authorization = authorizations.find(
121
- (a) => a.role.name === operation.authorizationRole,
122
- );
123
+ const scenario: IAutoBeRealizeScenarioResult = scenarios.find(
124
+ (s) => s.location === func.location,
125
+ )!;
126
+ const operation: AutoBeOpenApi.IOperation = scenario.operation;
127
+ const authorization: AutoBeRealizeAuthorization | undefined =
128
+ authorizations.find((a) => a.role.name === operation.authorizationRole);
123
129
 
124
130
  const pointer: IPointer<
125
131
  IAutoBeCommonCorrectCastingApplication.IProps | false | null
@@ -137,6 +143,7 @@ const correct = async <Model extends ILlmSchema.Model>(
137
143
  ]),
138
144
  controller: createController({
139
145
  model: ctx.model,
146
+ functionName: scenario.functionName,
140
147
  then: (next) => {
141
148
  pointer.value = next;
142
149
  },
@@ -373,13 +380,31 @@ const filterRelevantDiagnostics = (
373
380
 
374
381
  const createController = <Model extends ILlmSchema.Model>(props: {
375
382
  model: Model;
383
+ functionName: string;
376
384
  then: (next: IAutoBeCommonCorrectCastingApplication.IProps) => void;
377
385
  reject: () => void;
378
386
  }): ILlmController<Model> => {
379
387
  assertSchemaModel(props.model);
388
+ const validate: Validator = (input) => {
389
+ const result: IValidation<IAutoBeCommonCorrectCastingApplication.IProps> =
390
+ typia.validate<IAutoBeCommonCorrectCastingApplication.IProps>(input);
391
+ if (result.success === false) return result;
392
+ const errors: IValidation.IError[] = validateEmptyCode({
393
+ functionName: props.functionName,
394
+ draft: result.data.draft,
395
+ revise: result.data.revise,
396
+ });
397
+ return errors.length
398
+ ? {
399
+ success: false,
400
+ errors,
401
+ data: result.data,
402
+ }
403
+ : result;
404
+ };
380
405
  const application = collection[
381
406
  props.model === "chatgpt" ? "chatgpt" : "claude"
382
- ] satisfies ILlmApplication<any> as any as ILlmApplication<Model>;
407
+ ](validate) satisfies ILlmApplication<any> as any as ILlmApplication<Model>;
383
408
  return {
384
409
  protocol: "class",
385
410
  name: "correctInvalidRequest",
@@ -396,12 +421,28 @@ const createController = <Model extends ILlmSchema.Model>(props: {
396
421
  };
397
422
 
398
423
  const collection = {
399
- chatgpt: typia.llm.application<
400
- IAutoBeCommonCorrectCastingApplication,
401
- "chatgpt"
402
- >(),
403
- claude: typia.llm.application<
404
- IAutoBeCommonCorrectCastingApplication,
405
- "claude"
406
- >(),
424
+ chatgpt: (validate: Validator) =>
425
+ typia.llm.application<IAutoBeCommonCorrectCastingApplication, "chatgpt">({
426
+ validate: {
427
+ rewrite: validate,
428
+ reject: () => ({
429
+ success: true,
430
+ data: undefined,
431
+ }),
432
+ },
433
+ }),
434
+ claude: (validate: Validator) =>
435
+ typia.llm.application<IAutoBeCommonCorrectCastingApplication, "claude">({
436
+ validate: {
437
+ rewrite: validate,
438
+ reject: () => ({
439
+ success: true,
440
+ data: undefined,
441
+ }),
442
+ },
443
+ }),
407
444
  };
445
+
446
+ type Validator = (
447
+ input: unknown,
448
+ ) => IValidation<IAutoBeCommonCorrectCastingApplication.IProps>;
@@ -13,7 +13,7 @@ import { ILlmSchema } from "@samchon/openapi";
13
13
  import { v7 } from "uuid";
14
14
 
15
15
  import { AutoBeContext } from "../../context/AutoBeContext";
16
- import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
16
+ import { IAutoBeFacadeApplicationProps } from "../../context/IAutoBeFacadeApplicationProps";
17
17
  import { executeCachedBatch } from "../../utils/executeCachedBatch";
18
18
  import { predicateStateMessage } from "../../utils/predicateStateMessage";
19
19
  import { compileRealizeFiles } from "./internal/compileRealizeFiles";
@@ -27,7 +27,7 @@ import { generateRealizeScenario } from "./utils/generateRealizeScenario";
27
27
  export const orchestrateRealize =
28
28
  <Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>) =>
29
29
  async (
30
- props: IAutoBeApplicationProps,
30
+ props: IAutoBeFacadeApplicationProps,
31
31
  ): Promise<AutoBeAssistantMessageHistory | AutoBeRealizeHistory> => {
32
32
  // PREDICATION
33
33
  const document: AutoBeOpenApi.IDocument | undefined =
@@ -5,7 +5,12 @@ import {
5
5
  AutoBeRealizeFunction,
6
6
  } from "@autobe/interface";
7
7
  import { StringUtil } from "@autobe/utils";
8
- import { ILlmApplication, ILlmController, ILlmSchema } from "@samchon/openapi";
8
+ import {
9
+ ILlmApplication,
10
+ ILlmController,
11
+ ILlmSchema,
12
+ IValidation,
13
+ } from "@samchon/openapi";
9
14
  import { IPointer } from "tstl";
10
15
  import typia from "typia";
11
16
  import { v7 } from "uuid";
@@ -13,6 +18,7 @@ import { v7 } from "uuid";
13
18
  import { AutoBeContext } from "../../context/AutoBeContext";
14
19
  import { assertSchemaModel } from "../../context/assertSchemaModel";
15
20
  import { executeCachedBatch } from "../../utils/executeCachedBatch";
21
+ import { validateEmptyCode } from "../../utils/validateEmptyCode";
16
22
  import { transformRealizeCorrectHistories } from "./histories/transformRealizeCorrectHistories";
17
23
  import { compileRealizeFiles } from "./internal/compileRealizeFiles";
18
24
  import { IAutoBeRealizeCorrectApplication } from "./structures/IAutoBeRealizeCorrectApplication";
@@ -70,9 +76,10 @@ export async function orchestrateRealizeCorrect<Model extends ILlmSchema.Model>(
70
76
  if (!location.startsWith("src/providers")) return;
71
77
 
72
78
  if (!diagnosticsByFile[location]) {
73
- const func = functions.find((f) => f.location === location);
74
-
75
- if (!func) {
79
+ const func: AutoBeRealizeFunction | undefined = functions.find(
80
+ (f) => f.location === location,
81
+ );
82
+ if (func === undefined) {
76
83
  return;
77
84
  }
78
85
 
@@ -195,6 +202,7 @@ async function step<Model extends ILlmSchema.Model>(
195
202
  source: "realizeCorrect",
196
203
  controller: createController({
197
204
  model: ctx.model,
205
+ functionName: props.scenario.functionName,
198
206
  build: (next) => {
199
207
  pointer.value = next;
200
208
  },
@@ -268,12 +276,33 @@ async function step<Model extends ILlmSchema.Model>(
268
276
 
269
277
  function createController<Model extends ILlmSchema.Model>(props: {
270
278
  model: Model;
279
+ functionName: string;
271
280
  build: (next: IAutoBeRealizeCorrectApplication.IProps) => void;
272
281
  }): ILlmController<Model> {
273
282
  assertSchemaModel(props.model);
283
+
284
+ const validate: Validator = (input) => {
285
+ const result: IValidation<IAutoBeRealizeCorrectApplication.IProps> =
286
+ typia.validate<IAutoBeRealizeCorrectApplication.IProps>(input);
287
+ if (result.success === false) return result;
288
+ const errors: IValidation.IError[] = validateEmptyCode({
289
+ functionName: props.functionName,
290
+ draft: result.data.draft,
291
+ revise: result.data.revise,
292
+ });
293
+ return errors.length
294
+ ? {
295
+ success: false,
296
+ errors,
297
+ data: result.data,
298
+ }
299
+ : result;
300
+ };
274
301
  const application: ILlmApplication<Model> = collection[
275
- props.model
276
- ] satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
302
+ props.model === "chatgpt" ? "chatgpt" : "claude"
303
+ ](
304
+ validate,
305
+ ) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
277
306
 
278
307
  return {
279
308
  protocol: "class",
@@ -287,14 +316,21 @@ function createController<Model extends ILlmSchema.Model>(props: {
287
316
  };
288
317
  }
289
318
 
290
- const claude = typia.llm.application<
291
- IAutoBeRealizeCorrectApplication,
292
- "claude"
293
- >();
294
319
  const collection = {
295
- chatgpt: typia.llm.application<IAutoBeRealizeCorrectApplication, "chatgpt">(),
296
- claude,
297
- llama: claude,
298
- deepseek: claude,
299
- "3.1": claude,
320
+ chatgpt: (validate: Validator) =>
321
+ typia.llm.application<IAutoBeRealizeCorrectApplication, "chatgpt">({
322
+ validate: {
323
+ correct: validate,
324
+ },
325
+ }),
326
+ claude: (validate: Validator) =>
327
+ typia.llm.application<IAutoBeRealizeCorrectApplication, "claude">({
328
+ validate: {
329
+ correct: validate,
330
+ },
331
+ }),
300
332
  };
333
+
334
+ type Validator = (
335
+ input: unknown,
336
+ ) => IValidation<IAutoBeRealizeCorrectApplication.IProps>;
@@ -5,13 +5,19 @@ import {
5
5
  AutoBeRealizeWriteEvent,
6
6
  } from "@autobe/interface";
7
7
  import { StringUtil } from "@autobe/utils";
8
- import { ILlmApplication, ILlmController, ILlmSchema } from "@samchon/openapi";
8
+ import {
9
+ ILlmApplication,
10
+ ILlmController,
11
+ ILlmSchema,
12
+ IValidation,
13
+ } from "@samchon/openapi";
9
14
  import { IPointer } from "tstl";
10
15
  import typia from "typia";
11
16
  import { v7 } from "uuid";
12
17
 
13
18
  import { AutoBeContext } from "../../context/AutoBeContext";
14
19
  import { assertSchemaModel } from "../../context/assertSchemaModel";
20
+ import { validateEmptyCode } from "../../utils/validateEmptyCode";
15
21
  import { transformRealizeWriteHistories } from "./histories/transformRealizeWriteHistories";
16
22
  import { IAutoBeRealizeScenarioResult } from "./structures/IAutoBeRealizeScenarioResult";
17
23
  import { IAutoBeRealizeWriteApplication } from "./structures/IAutoBeRealizeWriteApplication";
@@ -45,6 +51,7 @@ export async function orchestrateRealizeWrite<Model extends ILlmSchema.Model>(
45
51
  }),
46
52
  controller: createController({
47
53
  model: ctx.model,
54
+ functionName: props.scenario.functionName,
48
55
  build: (next) => {
49
56
  pointer.value = next;
50
57
  },
@@ -102,13 +109,33 @@ export async function orchestrateRealizeWrite<Model extends ILlmSchema.Model>(
102
109
 
103
110
  function createController<Model extends ILlmSchema.Model>(props: {
104
111
  model: Model;
112
+ functionName: string;
105
113
  build: (next: IAutoBeRealizeWriteApplication.IProps) => void;
106
114
  }): ILlmController<Model> {
107
115
  assertSchemaModel(props.model);
108
116
 
117
+ const validate: Validator = (input) => {
118
+ const result: IValidation<IAutoBeRealizeWriteApplication.IProps> =
119
+ typia.validate<IAutoBeRealizeWriteApplication.IProps>(input);
120
+ if (result.success === false) return result;
121
+ const errors: IValidation.IError[] = validateEmptyCode({
122
+ functionName: props.functionName,
123
+ draft: result.data.draft,
124
+ revise: result.data.revise,
125
+ });
126
+ return errors.length
127
+ ? {
128
+ success: false,
129
+ errors,
130
+ data: result.data,
131
+ }
132
+ : result;
133
+ };
109
134
  const application: ILlmApplication<Model> = collection[
110
- props.model
111
- ] satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
135
+ props.model === "chatgpt" ? "chatgpt" : "claude"
136
+ ](
137
+ validate,
138
+ ) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
112
139
 
113
140
  return {
114
141
  protocol: "class",
@@ -122,14 +149,21 @@ function createController<Model extends ILlmSchema.Model>(props: {
122
149
  };
123
150
  }
124
151
 
125
- const claude = typia.llm.application<
126
- IAutoBeRealizeWriteApplication,
127
- "claude"
128
- >();
129
152
  const collection = {
130
- chatgpt: typia.llm.application<IAutoBeRealizeWriteApplication, "chatgpt">(),
131
- claude,
132
- llama: claude,
133
- deepseek: claude,
134
- "3.1": claude,
153
+ chatgpt: (validate: Validator) =>
154
+ typia.llm.application<IAutoBeRealizeWriteApplication, "chatgpt">({
155
+ validate: {
156
+ write: validate,
157
+ },
158
+ }),
159
+ claude: (validate: Validator) =>
160
+ typia.llm.application<IAutoBeRealizeWriteApplication, "claude">({
161
+ validate: {
162
+ write: validate,
163
+ },
164
+ }),
135
165
  };
166
+
167
+ type Validator = (
168
+ input: unknown,
169
+ ) => IValidation<IAutoBeRealizeWriteApplication.IProps>;
@@ -53,16 +53,19 @@ export const transformTestScenarioHistories = (props: {
53
53
  text: StringUtil.trim`
54
54
  ## Instructions
55
55
 
56
- The following e2e-test-specific instructions were extracted by AI from
56
+ The following e2e-test-specific instructions were extracted from
57
57
  the user's requirements and conversations. These instructions focus
58
58
  exclusively on test-related aspects such as test coverage priorities,
59
59
  specific edge cases to validate, business logic verification strategies,
60
60
  and critical user workflows that must be tested.
61
61
 
62
- Apply these instructions when generating test scenarios to ensure the
63
- tests align with the user's testing requirements and expectations.
64
- If any instructions are not relevant to the target API operations,
65
- you may ignore them.
62
+ Follow these instructions when generating test scenarios.
63
+ Carefully distinguish between:
64
+ - Suggestions or recommendations (consider these as guidance)
65
+ - Direct specifications or explicit commands (these must be followed exactly)
66
+
67
+ When instructions contain direct specifications or explicit design decisions,
68
+ follow them precisely even if you believe you have better alternatives.
66
69
 
67
70
  ${props.instruction}
68
71
 
@@ -43,16 +43,19 @@ export function transformTestScenarioReviewHistories(props: {
43
43
  text: StringUtil.trim`
44
44
  ## Instructions
45
45
 
46
- The following e2e-test-specific instructions were extracted by AI from
46
+ The following e2e-test-specific instructions were extracted from
47
47
  the user's requirements and conversations. These instructions focus
48
48
  exclusively on test-related aspects such as test coverage priorities,
49
49
  specific edge cases to validate, business logic verification strategies,
50
50
  and critical user workflows that must be tested.
51
51
 
52
- Apply these instructions when reviewing test scenarios to ensure the
53
- tests align with the user's testing requirements and expectations.
54
- If any instructions are not relevant to the target API operations,
55
- you may ignore them.
52
+ Follow these instructions when reviewing test scenarios.
53
+ Carefully distinguish between:
54
+ - Suggestions or recommendations (consider these as guidance)
55
+ - Direct specifications or explicit commands (these must be followed exactly)
56
+
57
+ When instructions contain direct specifications or explicit design decisions,
58
+ follow them precisely even if you believe you have better alternatives.
56
59
 
57
60
  ${props.instruction}
58
61