@autobe/agent 0.9.1 → 0.10.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 (185) hide show
  1. package/lib/AutoBeAgent.js +16 -5
  2. package/lib/AutoBeAgent.js.map +1 -1
  3. package/lib/constants/AutoBeSystemPromptConstant.d.ts +6 -4
  4. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  5. package/lib/context/AutoBeTokenUsage.d.ts +15 -1
  6. package/lib/context/AutoBeTokenUsage.js +56 -1
  7. package/lib/context/AutoBeTokenUsage.js.map +1 -1
  8. package/lib/context/IAutoBeApplicationProps.d.ts +0 -61
  9. package/lib/factory/createAutoBeApplication.js +298 -773
  10. package/lib/factory/createAutoBeApplication.js.map +1 -1
  11. package/lib/index.mjs +5116 -7271
  12. package/lib/index.mjs.map +1 -1
  13. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js +82 -319
  14. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js.map +1 -1
  15. package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js +0 -1
  16. package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js.map +1 -1
  17. package/lib/orchestrate/analyze/orchestrateAnalyze.js +97 -294
  18. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  19. package/lib/orchestrate/facade/transformFacadeStateMessage.js +2 -2
  20. package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
  21. package/lib/orchestrate/index.d.ts +2 -2
  22. package/lib/orchestrate/index.js +4 -4
  23. package/lib/orchestrate/index.js.map +1 -1
  24. package/lib/orchestrate/interface/orchestrateInterface.js +9 -3
  25. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
  26. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +56 -142
  27. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  28. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +195 -199
  29. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
  30. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +75 -172
  31. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  32. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +772 -1097
  33. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  34. package/lib/orchestrate/interface/transformInterfaceHistories.js +2 -0
  35. package/lib/orchestrate/interface/transformInterfaceHistories.js.map +1 -1
  36. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +64 -175
  37. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  38. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +552 -1073
  39. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  40. package/lib/orchestrate/prisma/orchestratePrismaSchema.js +571 -1119
  41. package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -1
  42. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +9 -0
  43. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
  44. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +8 -0
  45. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
  46. package/lib/orchestrate/realize/orchestrateRealize.d.ts +11 -0
  47. package/lib/orchestrate/realize/orchestrateRealize.js +109 -0
  48. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -0
  49. package/lib/orchestrate/realize/orchestrateRealizeCoder.d.ts +25 -0
  50. package/lib/orchestrate/realize/orchestrateRealizeCoder.js +337 -0
  51. package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -0
  52. package/lib/orchestrate/realize/orchestrateRealizeIntegrator.d.ts +52 -0
  53. package/lib/orchestrate/realize/orchestrateRealizeIntegrator.js +57 -0
  54. package/lib/orchestrate/realize/orchestrateRealizeIntegrator.js.map +1 -0
  55. package/lib/orchestrate/realize/orchestrateRealizePlanner.d.ts +80 -0
  56. package/lib/orchestrate/realize/orchestrateRealizePlanner.js +53 -0
  57. package/lib/orchestrate/realize/orchestrateRealizePlanner.js.map +1 -0
  58. package/lib/orchestrate/realize/orchestrateRealizeValidator.d.ts +46 -0
  59. package/lib/orchestrate/realize/orchestrateRealizeValidator.js +37 -0
  60. package/lib/orchestrate/realize/orchestrateRealizeValidator.js.map +1 -0
  61. package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +33 -0
  62. package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.js +3 -0
  63. package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.js.map +1 -0
  64. package/lib/orchestrate/realize/transformRealizeCoderHistories.d.ts +5 -0
  65. package/lib/orchestrate/realize/transformRealizeCoderHistories.js +127 -0
  66. package/lib/orchestrate/realize/transformRealizeCoderHistories.js.map +1 -0
  67. package/lib/orchestrate/test/compile/completeTestCode.d.ts +2 -0
  68. package/lib/orchestrate/test/compile/completeTestCode.js +21 -0
  69. package/lib/orchestrate/test/compile/completeTestCode.js.map +1 -0
  70. package/lib/orchestrate/test/{filterTestFileName.js → compile/filterTestFileName.js} +1 -1
  71. package/lib/orchestrate/test/compile/filterTestFileName.js.map +1 -0
  72. package/lib/orchestrate/test/compile/getTestExternalDeclarations.d.ts +3 -0
  73. package/lib/orchestrate/test/compile/getTestExternalDeclarations.js +27 -0
  74. package/lib/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -0
  75. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +5 -0
  76. package/lib/orchestrate/test/{compileTestScenario.js → compile/getTestScenarioArtifacts.js} +11 -5
  77. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -0
  78. package/lib/orchestrate/test/orchestrateTest.js +14 -9
  79. package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
  80. package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +3 -2
  81. package/lib/orchestrate/test/orchestrateTestCorrect.js +150 -349
  82. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  83. package/lib/orchestrate/test/orchestrateTestScenario.js +323 -566
  84. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  85. package/lib/orchestrate/test/orchestrateTestWrite.d.ts +3 -2
  86. package/lib/orchestrate/test/orchestrateTestWrite.js +139 -76
  87. package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  88. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +121 -0
  89. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.js +3 -0
  90. package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.js.map +1 -0
  91. package/lib/orchestrate/test/structures/IAutoBeTestFunction.d.ts +8 -0
  92. package/lib/{utils/types/BackoffOptions.js → orchestrate/test/structures/IAutoBeTestFunction.js} +1 -1
  93. package/lib/orchestrate/test/structures/IAutoBeTestFunction.js.map +1 -0
  94. package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +32 -22
  95. package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +2 -0
  96. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +112 -0
  97. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.js +3 -0
  98. package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.js.map +1 -0
  99. package/lib/orchestrate/test/structures/IAutoBeTestWriteResult.d.ts +7 -0
  100. package/lib/orchestrate/test/structures/IAutoBeTestWriteResult.js +3 -0
  101. package/lib/orchestrate/test/structures/IAutoBeTestWriteResult.js.map +1 -0
  102. package/lib/orchestrate/test/transformTestCorrectHistories.d.ts +3 -2
  103. package/lib/orchestrate/test/transformTestCorrectHistories.js +28 -41
  104. package/lib/orchestrate/test/transformTestCorrectHistories.js.map +1 -1
  105. package/lib/orchestrate/test/transformTestWriteHistories.d.ts +5 -4
  106. package/lib/orchestrate/test/transformTestWriteHistories.js +169 -32
  107. package/lib/orchestrate/test/transformTestWriteHistories.js.map +1 -1
  108. package/lib/structures/IAutoBeConfig.d.ts +11 -0
  109. package/lib/structures/IAutoBeProps.d.ts +12 -1
  110. package/lib/utils/backoffRetry.d.ts +4 -7
  111. package/lib/utils/backoffRetry.js +19 -37
  112. package/lib/utils/backoffRetry.js.map +1 -1
  113. package/lib/utils/forceRetry.d.ts +1 -0
  114. package/lib/{orchestrate/orchestrateRealize.js → utils/forceRetry.js} +15 -8
  115. package/lib/utils/forceRetry.js.map +1 -0
  116. package/package.json +8 -8
  117. package/src/AutoBeAgent.ts +26 -4
  118. package/src/constants/AutoBeSystemPromptConstant.ts +6 -4
  119. package/src/context/AutoBeTokenUsage.ts +85 -1
  120. package/src/context/IAutoBeApplicationProps.ts +0 -62
  121. package/src/factory/createAutoBeApplication.ts +2 -3
  122. package/src/orchestrate/analyze/AutoBeAnalyzeAgent.ts +8 -3
  123. package/src/orchestrate/analyze/AutoBeAnalyzeReviewer.ts +0 -1
  124. package/src/orchestrate/analyze/orchestrateAnalyze.ts +8 -37
  125. package/src/orchestrate/facade/transformFacadeStateMessage.ts +2 -1
  126. package/src/orchestrate/index.ts +2 -2
  127. package/src/orchestrate/interface/orchestrateInterface.ts +7 -0
  128. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +4 -3
  129. package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +26 -23
  130. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +6 -4
  131. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +14 -11
  132. package/src/orchestrate/interface/transformInterfaceHistories.ts +2 -0
  133. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +10 -5
  134. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +11 -5
  135. package/src/orchestrate/prisma/orchestratePrismaSchema.ts +16 -8
  136. package/src/orchestrate/prisma/transformPrismaComponentsHistories.ts +9 -0
  137. package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +8 -0
  138. package/src/orchestrate/realize/orchestrateRealize.ts +169 -0
  139. package/src/orchestrate/realize/orchestrateRealizeCoder.ts +156 -0
  140. package/src/orchestrate/realize/orchestrateRealizeIntegrator.ts +75 -0
  141. package/src/orchestrate/realize/orchestrateRealizePlanner.ts +115 -0
  142. package/src/orchestrate/realize/orchestrateRealizeValidator.ts +64 -0
  143. package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +36 -0
  144. package/src/orchestrate/realize/transformRealizeCoderHistories.ts +136 -0
  145. package/src/orchestrate/test/compile/completeTestCode.ts +35 -0
  146. package/src/orchestrate/test/{filterTestFileName.ts → compile/filterTestFileName.ts} +1 -1
  147. package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +24 -0
  148. package/src/orchestrate/test/{compileTestScenario.ts → compile/getTestScenarioArtifacts.ts} +17 -8
  149. package/src/orchestrate/test/experimental/orchestrateTestCorrect.ast +240 -0
  150. package/src/orchestrate/test/experimental/orchestrateTestWrite.ast +316 -0
  151. package/src/orchestrate/test/experimental/transformTestCorrectHistories.ast +52 -0
  152. package/src/orchestrate/test/orchestrateTest.ts +38 -16
  153. package/src/orchestrate/test/orchestrateTestCorrect.ts +111 -338
  154. package/src/orchestrate/test/orchestrateTestScenario.ts +114 -69
  155. package/src/orchestrate/test/orchestrateTestWrite.ts +55 -153
  156. package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +126 -0
  157. package/src/orchestrate/test/structures/IAutoBeTestFunction.ts +10 -0
  158. package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +32 -22
  159. package/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.ts +3 -0
  160. package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +117 -0
  161. package/src/orchestrate/test/structures/IAutoBeTestWriteResult.ts +9 -0
  162. package/src/orchestrate/test/transformTestCorrectHistories.ts +38 -43
  163. package/src/orchestrate/test/transformTestWriteHistories.ts +89 -35
  164. package/src/structures/IAutoBeConfig.ts +9 -0
  165. package/src/structures/IAutoBeProps.ts +17 -1
  166. package/src/utils/backoffRetry.ts +25 -36
  167. package/src/utils/forceRetry.ts +13 -0
  168. package/lib/factory/invertOpenApiDocument.d.ts +0 -3
  169. package/lib/factory/invertOpenApiDocument.js +0 -51
  170. package/lib/factory/invertOpenApiDocument.js.map +0 -1
  171. package/lib/orchestrate/orchestrateRealize.d.ts +0 -5
  172. package/lib/orchestrate/orchestrateRealize.js.map +0 -1
  173. package/lib/orchestrate/test/compileTestScenario.d.ts +0 -5
  174. package/lib/orchestrate/test/compileTestScenario.js.map +0 -1
  175. package/lib/orchestrate/test/filterTestFileName.js.map +0 -1
  176. package/lib/utils/StringUtil.d.ts +0 -4
  177. package/lib/utils/StringUtil.js +0 -43
  178. package/lib/utils/StringUtil.js.map +0 -1
  179. package/lib/utils/types/BackoffOptions.d.ts +0 -12
  180. package/lib/utils/types/BackoffOptions.js.map +0 -1
  181. package/src/factory/invertOpenApiDocument.ts +0 -63
  182. package/src/orchestrate/orchestrateRealize.ts +0 -18
  183. package/src/utils/StringUtil.ts +0 -45
  184. package/src/utils/types/BackoffOptions.ts +0 -15
  185. /package/lib/orchestrate/test/{filterTestFileName.d.ts → compile/filterTestFileName.d.ts} +0 -0
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.orchestrateRealizeIntegrator = void 0;
13
+ /**
14
+ * Integrates the generated function into an appropriate controller file,
15
+ * handling insertion, import, and static validation.
16
+ *
17
+ * This function performs the following steps:
18
+ *
19
+ * 1. **Locate appropriate controller file**
20
+ *
21
+ * - Usually matches `*.controller.ts`
22
+ * - May be based on inferred target (e.g., from functionName or folder structure)
23
+ * 2. **Insert the generated function into the file content**
24
+ *
25
+ * - Ensures proper placement, such as inside a class or export block
26
+ * - May replace or append to existing function stubs
27
+ * 3. **Inject required imports automatically**
28
+ *
29
+ * - Identifies any missing imports (e.g., DTOs, utility functions)
30
+ * - Ensures imports are added without duplication
31
+ * 4. **Check for compile-time safety**
32
+ *
33
+ * - Ensures TypeScript type-checking passes
34
+ * - Verifies that Nestia-generated routers still function without error
35
+ * - If compilation fails or static types are invalid, marks result as `"fail"`
36
+ *
37
+ * ⚠️ Note: This step **must not rely on runtime execution**. It only guarantees
38
+ * static, structural validity (i.e., valid TypeScript).
39
+ *
40
+ * @param ctx - AutoBE context including current source files and settings
41
+ * @param props - Output from the code generation step to be integrated
42
+ * @returns Integration status, indicating success or failure of insertion
43
+ */
44
+ const orchestrateRealizeIntegrator = (ctx, props) => __awaiter(void 0, void 0, void 0, function* () {
45
+ var _a, _b;
46
+ props;
47
+ const controllers = Object.entries((_b = (_a = ctx.state().interface) === null || _a === void 0 ? void 0 : _a.files) !== null && _b !== void 0 ? _b : {}).filter(([filename]) => {
48
+ return filename.endsWith("controller.ts");
49
+ });
50
+ // Placeholder: insert props.implementationCode into selected controller
51
+ // Inject necessary import statements for used types/functions
52
+ // Optionally run TypeScript compiler in dry-run mode to validate correctness
53
+ controllers;
54
+ return null;
55
+ });
56
+ exports.orchestrateRealizeIntegrator = orchestrateRealizeIntegrator;
57
+ //# sourceMappingURL=orchestrateRealizeIntegrator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrateRealizeIntegrator.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizeIntegrator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAuBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACI,MAAM,4BAA4B,GAAG,CAG1C,GAAyB,EACzB,KAAwD,EACtB,EAAE;;IACpC,KAAK,CAAC;IAEN,MAAM,WAAW,GAAuB,MAAM,CAAC,OAAO,CACpD,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,SAAS,0CAAE,KAAK,mCAAI,EAAE,CACnC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE;QACtB,OAAO,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,wEAAwE;IACxE,8DAA8D;IAC9D,6EAA6E;IAC7E,WAAW,CAAC;IAEZ,OAAO,IAAK,CAAC;AACf,CAAC,CAAA,CAAC;AApBW,QAAA,4BAA4B,gCAoBvC"}
@@ -0,0 +1,80 @@
1
+ import { AutoBeOpenApi } from "@autobe/interface";
2
+ import { ILlmSchema } from "@samchon/openapi";
3
+ import { AutoBeContext } from "../../context/AutoBeContext";
4
+ export interface RealizePlannerOutput {
5
+ /**
6
+ * The name of the function to be generated.
7
+ *
8
+ * Derived from the Swagger path and method. The function name must be written
9
+ * in snake_case. It serves as the entry point in both code generation and
10
+ * test code.
11
+ *
12
+ * Once the function is generated, the function name and file name will be the
13
+ * same. The generated file will be located at
14
+ * `src/providers/${function_name}.ts`.
15
+ */
16
+ functionName: string;
17
+ /**
18
+ * Definition of path and query parameters extracted from the OpenAPI spec.
19
+ *
20
+ * Includes input values passed via URL path or query string. Used for type
21
+ * definitions, validation, and function signature construction.
22
+ */
23
+ parameters: AutoBeOpenApi.IParameter[];
24
+ /**
25
+ * Schema definition for the request body input.
26
+ *
27
+ * Extracted from the requestBody section of Swagger. Represents the input
28
+ * data passed in the body (e.g., JSON). Used for generating function
29
+ * arguments or DTOs.
30
+ */
31
+ inputSchema: AutoBeOpenApi.IRequestBody | null;
32
+ /**
33
+ * Schema definition for the response body.
34
+ *
35
+ * Extracted from the responses section of Swagger. Used to define the return
36
+ * type and expected output in test code.
37
+ */
38
+ outputSchema: AutoBeOpenApi.IResponseBody | null;
39
+ /**
40
+ * Natural language description of the function’s purpose.
41
+ *
42
+ * Extracted from the summary or description field of Swagger. Used for code
43
+ * documentation, test scenario generation, and conveying function intent.
44
+ */
45
+ description: string;
46
+ /**
47
+ * HTTP method information.
48
+ *
49
+ * Extracted from the Swagger operation method. Used to define the request
50
+ * type during code and test generation.
51
+ */
52
+ operationType: "get" | "post" | "put" | "delete" | "patch";
53
+ /**
54
+ * List of scenario descriptions for test code generation.
55
+ *
56
+ * Each scenario describes the expected behavior of the function under certain
57
+ * conditions. Used as a basis for TDD-style automated test generation.
58
+ */
59
+ testScenarios: string[];
60
+ }
61
+ /**
62
+ * Generates a planning result that defines what kind of function should be
63
+ * created, based solely on the provided Swagger (OpenAPI) operation — without
64
+ * using an LLM.
65
+ *
66
+ * This function analyzes the structure of the OpenAPI operation (such as the
67
+ * path, method, parameters, request/response schema, and descriptions) to
68
+ * determine the appropriate function name, input/output types, and purpose of
69
+ * the function.
70
+ *
71
+ * The result of this function (`RealizePlannerOutput`) will be passed to the
72
+ * next step in the AutoBE pipeline, which is responsible for generating the
73
+ * actual implementation code.
74
+ *
75
+ * @param ctx - AutoBE context including model and configuration
76
+ * @param operation - A single OpenAPI operation object to analyze and plan
77
+ * @returns A planning object containing all structural information needed to
78
+ * generate the function
79
+ */
80
+ export declare const orchestrateRealizePlanner: <Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, operation: AutoBeOpenApi.IOperation) => Promise<RealizePlannerOutput>;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.orchestrateRealizePlanner = void 0;
13
+ /**
14
+ * Generates a planning result that defines what kind of function should be
15
+ * created, based solely on the provided Swagger (OpenAPI) operation — without
16
+ * using an LLM.
17
+ *
18
+ * This function analyzes the structure of the OpenAPI operation (such as the
19
+ * path, method, parameters, request/response schema, and descriptions) to
20
+ * determine the appropriate function name, input/output types, and purpose of
21
+ * the function.
22
+ *
23
+ * The result of this function (`RealizePlannerOutput`) will be passed to the
24
+ * next step in the AutoBE pipeline, which is responsible for generating the
25
+ * actual implementation code.
26
+ *
27
+ * @param ctx - AutoBE context including model and configuration
28
+ * @param operation - A single OpenAPI operation object to analyze and plan
29
+ * @returns A planning object containing all structural information needed to
30
+ * generate the function
31
+ */
32
+ const orchestrateRealizePlanner = (ctx, operation) => __awaiter(void 0, void 0, void 0, function* () {
33
+ var _a, _b;
34
+ const testScenarios = (_b = (_a = ctx
35
+ .state()
36
+ .test) === null || _a === void 0 ? void 0 : _a.files.filter((el) => el.scenario.endpoint.method === operation.method &&
37
+ el.scenario.endpoint.path === operation.path)) !== null && _b !== void 0 ? _b : [];
38
+ return {
39
+ description: operation.description,
40
+ parameters: operation.parameters,
41
+ inputSchema: operation.requestBody,
42
+ outputSchema: operation.responseBody,
43
+ operationType: operation.method,
44
+ testScenarios: testScenarios.map((el) => el.scenario.draft),
45
+ functionName: `${operation.method}_${operation.path
46
+ .replaceAll("/", "_")
47
+ .replaceAll("-", "_")
48
+ .replaceAll("{", "$")
49
+ .replaceAll("}", "")}`,
50
+ };
51
+ });
52
+ exports.orchestrateRealizePlanner = orchestrateRealizePlanner;
53
+ //# sourceMappingURL=orchestrateRealizePlanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrateRealizePlanner.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizePlanner.ts"],"names":[],"mappings":";;;;;;;;;;;;AAqEA;;;;;;;;;;;;;;;;;;GAkBG;AACI,MAAM,yBAAyB,GAAG,CACvC,GAAyB,EACzB,SAAmC,EACJ,EAAE;;IACjC,MAAM,aAAa,GACjB,MAAA,MAAA,GAAG;SACA,KAAK,EAAE;SACP,IAAI,0CAAE,KAAK,CAAC,MAAM,CACjB,CAAC,EAAE,EAAE,EAAE,CACL,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM;QAChD,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,CAC/C,mCAAI,EAAE,CAAC;IAEZ,OAAO;QACL,WAAW,EAAE,SAAS,CAAC,WAAW;QAClC,UAAU,EAAE,SAAS,CAAC,UAAU;QAChC,WAAW,EAAE,SAAS,CAAC,WAAW;QAClC,YAAY,EAAE,SAAS,CAAC,YAAY;QACpC,aAAa,EAAE,SAAS,CAAC,MAAM;QAC/B,aAAa,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC3D,YAAY,EAAE,GAAG,SAAS,CAAC,MAAM,IAAI,SAAS,CAAC,IAAI;aAChD,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;aACpB,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;aACpB,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;aACpB,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE;KACM,CAAC;AACnC,CAAC,CAAA,CAAC;AA1BW,QAAA,yBAAyB,6BA0BpC"}
@@ -0,0 +1,46 @@
1
+ import { ILlmSchema } from "@samchon/openapi";
2
+ import { AutoBeContext } from "../../context/AutoBeContext";
3
+ import { RealizeIntegratorOutput } from "./orchestrateRealizeIntegrator";
4
+ /**
5
+ * The result of validating the integrated code by running tests or static
6
+ * checks.
7
+ */
8
+ export interface RealizeValidatorOutput {
9
+ /** File path or location of the generated provider logic file. */
10
+ location: string;
11
+ /** The full TypeScript source code content of the generated provider file. */
12
+ content: string;
13
+ /**
14
+ * Overall result of the test execution.
15
+ *
16
+ * - "success": All tests passed successfully.
17
+ * - "fail": Some tests failed.
18
+ * - "exception": An unexpected error occurred during test execution.
19
+ */
20
+ result: "success" | "fail" | "exception";
21
+ /** Total number of test cases executed. */
22
+ total: number;
23
+ /** Number of tests that passed. */
24
+ success: number;
25
+ /** Number of tests that failed. */
26
+ fail: number;
27
+ }
28
+ /**
29
+ * Validates the integrated provider logic by returning the generated source
30
+ * code along with the summary of test execution results.
31
+ *
32
+ * This function serves as the final step to:
33
+ *
34
+ * - Provide the full TypeScript implementation files created/updated during
35
+ * integration.
36
+ * - Return a detailed summary of the automated test outcomes executed against
37
+ * that code.
38
+ *
39
+ * It does not throw errors; all failures or exceptions are reported via the
40
+ * `result` property.
41
+ *
42
+ * @param ctx - AutoBE execution context
43
+ * @param props - Result from the integration step
44
+ * @returns An object containing provider file content and test results
45
+ */
46
+ export declare const orchestrateRealizeValidator: <Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, props: RealizeIntegratorOutput) => Promise<RealizeValidatorOutput>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.orchestrateRealizeValidator = void 0;
13
+ /**
14
+ * Validates the integrated provider logic by returning the generated source
15
+ * code along with the summary of test execution results.
16
+ *
17
+ * This function serves as the final step to:
18
+ *
19
+ * - Provide the full TypeScript implementation files created/updated during
20
+ * integration.
21
+ * - Return a detailed summary of the automated test outcomes executed against
22
+ * that code.
23
+ *
24
+ * It does not throw errors; all failures or exceptions are reported via the
25
+ * `result` property.
26
+ *
27
+ * @param ctx - AutoBE execution context
28
+ * @param props - Result from the integration step
29
+ * @returns An object containing provider file content and test results
30
+ */
31
+ const orchestrateRealizeValidator = (ctx, props) => __awaiter(void 0, void 0, void 0, function* () {
32
+ ctx;
33
+ props;
34
+ return null;
35
+ });
36
+ exports.orchestrateRealizeValidator = orchestrateRealizeValidator;
37
+ //# sourceMappingURL=orchestrateRealizeValidator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrateRealizeValidator.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizeValidator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAmCA;;;;;;;;;;;;;;;;;GAiBG;AACI,MAAM,2BAA2B,GAAG,CAGzC,GAAyB,EACzB,KAA8B,EACG,EAAE;IACnC,GAAG,CAAC;IACJ,KAAK,CAAC;IAEN,OAAO,IAAK,CAAC;AACf,CAAC,CAAA,CAAC;AAVW,QAAA,2BAA2B,+BAUtC"}
@@ -0,0 +1,33 @@
1
+ export interface IAutoBeRealizeCoderApplication {
2
+ programing: (next: IAutoBeRealizeCoderApplication.IProps) => void;
3
+ }
4
+ export declare namespace IAutoBeRealizeCoderApplication {
5
+ interface IProps {
6
+ result: RealizeCoderOutput;
7
+ }
8
+ /**
9
+ * The result of the code generation step, representing a fully generated
10
+ * TypeScript function.
11
+ */
12
+ interface RealizeCoderOutput {
13
+ /**
14
+ * The name of the function to be generated.
15
+ *
16
+ * This name will be used as the function's identifier and as the export
17
+ * name in the provider file.
18
+ */
19
+ functionName: string;
20
+ /**
21
+ * The raw TypeScript code string implementing the function.
22
+ *
23
+ * - The implementation must be valid TypeScript code.
24
+ * - It should focus solely on the logic of the function.
25
+ * - Import statements do **not** need to be included. They will be
26
+ * automatically inserted by the system.
27
+ * - Any unused imports will be automatically removed by eslint.
28
+ * - Type annotations (e.g. for parameters and return types) should be omitted
29
+ * if they can be inferred.
30
+ */
31
+ implementationCode: string;
32
+ }
33
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IAutoBeRealizeCoderApplication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAutoBeRealizeCoderApplication.js","sourceRoot":"","sources":["../../../../src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { IAgenticaHistoryJson } from "@agentica/core";
2
+ import { AutoBeState } from "../../context/AutoBeState";
3
+ import { IAutoBeTestScenarioArtifacts } from "../test/structures/IAutoBeTestScenarioArtifacts";
4
+ import { RealizePlannerOutput } from "./orchestrateRealizePlanner";
5
+ export declare const transformRealizeCoderHistories: (state: AutoBeState, props: RealizePlannerOutput, artifacts: IAutoBeTestScenarioArtifacts) => Array<IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage>;
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformRealizeCoderHistories = void 0;
4
+ const uuid_1 = require("uuid");
5
+ const transformRealizeCoderHistories = (state, props, artifacts) => {
6
+ if (state.analyze === null)
7
+ return [
8
+ {
9
+ id: (0, uuid_1.v4)(),
10
+ created_at: new Date().toISOString(),
11
+ type: "systemMessage",
12
+ text: [
13
+ "Requirement analysis is not yet completed.",
14
+ "Don't call the any tool function,",
15
+ "but say to process the requirement analysis.",
16
+ ].join(" "),
17
+ },
18
+ ];
19
+ else if (state.prisma === null)
20
+ return [
21
+ {
22
+ id: (0, uuid_1.v4)(),
23
+ created_at: new Date().toISOString(),
24
+ type: "systemMessage",
25
+ text: [
26
+ "Prisma DB schema generation is not yet completed.",
27
+ "Don't call the any tool function,",
28
+ "but say to process the Prisma DB schema generation.",
29
+ ].join(" "),
30
+ },
31
+ ];
32
+ else if (state.analyze.step !== state.prisma.step)
33
+ return [
34
+ {
35
+ id: (0, uuid_1.v4)(),
36
+ created_at: new Date().toISOString(),
37
+ type: "systemMessage",
38
+ text: [
39
+ "Prisma DB schema generation has not been updated",
40
+ "for the latest requirement analysis.",
41
+ "Don't call the any tool function,",
42
+ "but say to re-process the Prisma DB schema generation.",
43
+ ].join(" "),
44
+ },
45
+ ];
46
+ else if (state.prisma.compiled.type !== "success")
47
+ return [
48
+ {
49
+ id: (0, uuid_1.v4)(),
50
+ created_at: new Date().toISOString(),
51
+ type: "systemMessage",
52
+ text: [
53
+ "Prisma DB schema generation has not been updated",
54
+ "for the latest requirement analysis.",
55
+ "Don't call the any tool function,",
56
+ "but say to re-process the Prisma DB schema generation.",
57
+ ].join(" "),
58
+ },
59
+ ];
60
+ else if (state.interface === null)
61
+ return [
62
+ {
63
+ id: (0, uuid_1.v4)(),
64
+ created_at: new Date().toISOString(),
65
+ type: "systemMessage",
66
+ text: [
67
+ "Interface generation is not yet completed.",
68
+ "Don't call the any tool function,",
69
+ "but say to process the interface generation.",
70
+ ].join(" "),
71
+ },
72
+ ];
73
+ return [
74
+ {
75
+ id: (0, uuid_1.v4)(),
76
+ created_at: new Date().toISOString(),
77
+ type: "systemMessage",
78
+ text: [
79
+ "# \uD83E\uDDE0 Realize Agent Role\n\nYou are the **Realize Coder Agent**. \nYour role is to write appropriate code based on the given inputs. \nAll code must be written as **provider logic**, and structured as a **single function**, not wrapped in a class or namespace.\n\n---\n\n## \uD83D\uDCCC Function Structure\n\nThe function must always take the following three arguments:\n\n```ts\nexport async function something(\n headers: Record<string, string>,\n parameters: Record<string, string>, // If you know exactly what DTO type is, make sure to import it and fill it out.\n body: Record<string, any> // If you know exactly what DTO type is, make sure to import it and fill it out.\n) {\n ...\n}\n````\n\n* Even for GET requests or when headers, parameters, or body are not required, the structure must remain the same.\n* In such cases, use the following empty types:\n `_headers: Record<string, never>`, `_parameters: Record<string, never>`, `_body: Record<string, never>`\n\n---\n\n## \u2757 Strictly Prohibited\n\n1. Use of the `any` type\n2. Assuming that certain fields exist, such as:\n\n * `headers['x-user-id']`, `body.user.id`, `parameters.id`, etc.\n3. Writing logic based on assumptions or inferences when required context (e.g., user/auth info) is missing\n\n\u2192 In such cases, do **not write any code**. Instead, leave the function body empty and write **clear and sufficient comments** explaining why.\n\n---\n\n### \uD83D\uDEAB Parameter Validation Not Required\n\n* The provider function does **not** need to perform any validation on incoming `headers`, `parameters`, or `body` values.\n* You can assume that **all DTO-defined values are present and valid**.\n* **Validation is not the provider's responsibility** \u2014 it is handled upstream (e.g., by the controller or framework-level validation logic).\n* Therefore, do **not** write any manual checks for missing or invalid fields in `headers`, `parameters`, or `body`.\n\n\u2705 Example\n\n```ts\n// \u274C Do not write this\nif (!parameters.id) throw new Error(\"Missing parameter: id\");\n\n// \u2705 Just use it directly\nconst { id } = parameters;\n```\n\n---\n\n## \uD83D\uDD10 When Authentication is Required\n\n* If authentication is required, extract the **Bearer token** from `headers.authorization` or `headers.Authorization`.\n\n* Decode the token and retrieve the following fields:\n\n * `id`: the user's unique ID\n * `type`: the user group (actor)\n\n* The `type` must exactly match the table name of the actor in the database.\n For example: `\"customer\"`, `\"seller\"`, `\"admin\"`\n\n* The **actor** represents the user's role group, and each actor must correspond to an actual table name in the database.\n\n---\n\n## \u2705 Type Assertion Rules\n\n* You are allowed to use `as` for type assertions in clearly safe cases, such as decoding a token:\n\n```ts\nconst decoded = jwtDecode(token) as { id: string; type: 'customer' | 'seller' | 'admin' };\n```\n\n* You may also use `as` for:\n\n * Literal values (e.g., `1 as 1`, `-1 as -1`)\n * Enumerated string or number values\n\n* For object literals, **prefer using `satisfies`** instead of `as`:\n\n```ts\nconst result = {\n status: 'ok',\n count: 5,\n} satisfies { status: string; count: number };\n```\n\n## \u270D\uFE0F Example (when code should not be written)\n\n```ts\n// \u274C No code written\n// \uD83D\uDD12 Reason: Authentication info is missing; user ID or type cannot be confirmed.\n// \uD83D\uDCDD Required: Extract the Bearer token from headers.authorization or Authorization.\n// Decode the token to retrieve the user's `id` and `type`.\n// `type` must exactly match one of the actor table names (e.g., customer, seller, admin).\n```\n\n---\n\n## \uD83D\uDCCC Function Structure\n\nThe function **must always** take exactly three arguments: `headers`, `parameters`, and `body`.\nThe structure is as follows:\n\n```ts\nexport async function something(\n headers: Record<string, string>,\n parameters: Record<string, string>,\n body: SomeDto\n) {\n ...\n}\n```\n\n* Even if the request is a GET request or doesn't require any headers, parameters, or body, the function signature **must remain the same**.\n* In such cases, use empty objects:\n\n * `headers: Record<string, never>`\n * `parameters: Record<string, never>`\n * `body: Record<string, never>`\n\n---\n\n## \uD83D\uDD27 Fallback Logic for Incomplete Context\n\nIf it is **not possible to implement the actual logic** (e.g., required tables, fields, or external SDKs are clearly missing), follow this fallback guideline:\n\n```ts\n/**\n * \u26A0\uFE0F Placeholder Implementation\n *\n * The actual logic could not be implemented because:\n * - [List missing schema, tables, fields, or SDK elements]\n * - This information is required to properly implement the provider logic.\n * \n * Therefore, this function currently returns a random object matching the expected return type using `typia.random<T>()`.\n * \n * Please revisit this function after the missing elements are available.\n */\nreturn typia.random<ReturnType>();\n```\n\n* This fallback must **only be used if a real implementation is genuinely impossible**.\n* You **must still write the correct function signature**, define types, and use the proper structure.\n* Ensure the `ReturnType` exactly matches the controller's expected return type.\n* Do **not leave the function body empty**, even for placeholders \u2014 always return a valid structure using `typia.random`.\n\n---\n\n## \uD83E\uDDE0 Purpose\n\nThe purpose of the function is to:\n\n* Receive **inputs as-is from the controller**\n* Return **outputs matching the controller's return type**\n* Supplement **logic to satisfy the user\u2019s requirements**\n\n---\n\n## \uD83E\uDDFE Parameter & Body Types\n\n* You must **explicitly define types** for both `parameters` and `body`.\n\n* The types must match those used in the **SDK or controller DTOs**.\n\n > \"Match\" means either:\n >\n > 1. The type has the **same shape** as the SDK/DTO (TypeScript duck typing).\n > 2. The **exact same type is imported and used**.\n\n* You **must not use `any` or implicit typing**.\n\n---\n\n## \uD83D\uDD10 When Authentication is Required\n\n* If authentication is required, extract the **Bearer token** from `headers.authorization` or `headers.Authorization`.\n\n* Decode the token using the globally available function:\n\n ```ts\n const decoded = jwtDecode(token) as { id: string; type: 'customer' | 'seller' | 'admin' };\n ```\n\n* The decoded token must include:\n\n * `id`: the user's unique ID\n * `type`: the user group, which **must exactly match a table name** in your Prisma schema (e.g., `\"customer\"`, `\"seller\"`, `\"admin\"`)\n\n* The `type` is used to identify the **actor**, and should be treated as the name of the actor's table.\n\n* Do **not assume** these values exist. You must **decode and validate** them properly before use.\n\n---\n\n## \uD83D\uDEE0 SDK & DB Access\n\nTo access the database using Prisma, use the global instance provided:\n\n```ts\nMyGlobal.prisma.users.findMany()\n```\n\n* You **must always include the `.prisma` property** explicitly.\n\n* \u2757 **Do NOT write `MyGlobal.users` or omit `.prisma`** \u2014 this will break tests and violate the global access convention.\n\n\u2705 Allowed:\n\n```ts\nMyGlobal.prisma.logs.create({ data: { ... } });\n```\n\n\u274C Not allowed:\n\n```ts\nMyGlobal.logs.create({ data: { ... } }); // \u274C Incorrect\nMyGlobal.currentUsers(); // \u274C Incorrect\n```\n\n---\n\n### \uD83D\uDD0D Additional Prisma Rule: Writing `where` Conditions\n\n* When writing Prisma `where` clauses, do **not use `any`** under any circumstances.\n\n* Prefer **direct inline construction** of the `where` condition **inside** the Prisma method call:\n\n ```ts\n const user = await MyGlobal.prisma.users.findFirst({\n where: {\n id: actor.id,\n },\n });\n ```\n\n* If the `where` condition is built outside the method (e.g., stored in a variable), use `satisfies` with a proper Prisma type:\n\n ```ts\n const condition = {\n id: actor.id,\n isActive: true,\n } satisfies Prisma.UsersWhereInput;\n\n const user = await MyGlobal.prisma.users.findFirst({ where: condition });\n ```\n\n* You **must not use `as any`** to bypass type checks for `where` clauses. Using `satisfies` ensures the safety of your Prisma query.\n\n---\n\n## \u2757 Error Handling Rules\n\n* You **must always use** `new Error()` when throwing errors.\n* Do **not** throw:\n\n * custom error classes\n * `HttpException`\n * plain strings\n\n\u2705 Allowed:\n\n```ts\nthrow new Error(\"User not found\");\n```\n\n\u274C Not allowed:\n\n```ts\nthrow \"User not found\";\nthrow new NotFoundException();\n```\n\n---\n\n## \uD83D\uDEAB Import Rules\n\n* **Do not use any `import` statements**, unless the import is for **SDK types or DTOs**.\n\n \u2705 Allowed:\n\n ```ts\n import { IVote } from \"../api/structures/IVote\";\n ```\n\n \u274C Not allowed:\n\n ```ts\n import _ from 'lodash';\n import { format } from 'date-fns';\n import { IVote } from \"@/api/structures/IVote\";\n ```\n\n* All logic, constants, and utilities must be **self-contained within the function** unless clearly provided via the SDK/DTO layer.\n\n### \uD83D\uDEAB Default Import Rules\n\nPlease skip the import statement below because it is automatically entered. Adding it will cause a \"Duplicated\" error. This import statement is automatically inserted, so it should not be added manually.\n\n```ts\nimport { MyGlobal } from \"../MyGlobal\";,\nimport typia, { tags } from \"typia\";,\nimport { Prisma } from \"@prisma/client\";,\nimport { jwtDecode } from \"./jwtDecode\",\n\n```" /* AutoBeSystemPromptConstant.REALIZE_CODER */,
80
+ "",
81
+ "# Prisma Schemas",
82
+ "```json",
83
+ JSON.stringify(state.prisma.schemas),
84
+ "```",
85
+ "",
86
+ // "# Prisma Types",
87
+ // "```json",
88
+ // JSON.stringify(state.prisma.compiled.nodeModules),
89
+ // "```",
90
+ "# SDK",
91
+ "",
92
+ "The following is the SDK for the API. Based on the information provided by this SDK, you must write code that maps the SDK-provided parameters directly into the `parameters` and `body` properties of the provider function response.",
93
+ "If there are no parameters, define `parameters` as `Record<string, never>`. Similarly, if there is no body, define `body` as `Record<string, never>`.",
94
+ "**Every function must be implemented to accept both `parameters` and `body`, without exception.**",
95
+ "If any required type information is referenced in the SDK, refer to the definitions in the DTO section.",
96
+ "",
97
+ "```json",
98
+ JSON.stringify(artifacts.sdk),
99
+ "```",
100
+ "",
101
+ "# DTO",
102
+ "if you want to import this files, write this: 'import { something } from '../api/structures/something';'",
103
+ "",
104
+ "```json",
105
+ JSON.stringify(artifacts.dto),
106
+ "```",
107
+ "# Document",
108
+ "```json",
109
+ JSON.stringify(artifacts.document),
110
+ "```",
111
+ ].join("\n"),
112
+ },
113
+ {
114
+ id: (0, uuid_1.v4)(),
115
+ created_at: new Date().toISOString(),
116
+ type: "systemMessage",
117
+ text: [
118
+ "write code by following information of operation.",
119
+ "```json",
120
+ JSON.stringify(props),
121
+ "```",
122
+ ].join("\n"),
123
+ },
124
+ ];
125
+ };
126
+ exports.transformRealizeCoderHistories = transformRealizeCoderHistories;
127
+ //# sourceMappingURL=transformRealizeCoderHistories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformRealizeCoderHistories.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/transformRealizeCoderHistories.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ import { IAutoBeTestScenarioArtifacts } from "../structures/IAutoBeTestScenarioArtifacts";
2
+ export declare function completeTestCode(artifacts: IAutoBeTestScenarioArtifacts, code: string): string;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.completeTestCode = completeTestCode;
4
+ function completeTestCode(artifacts, code) {
5
+ const typeReferences = Array.from(new Set(Object.keys(artifacts.document.components.schemas).map((key) => key.split(".")[0])));
6
+ code = code.replace(/^[ \t]*import\b[\s\S]*?;[ \t]*$/gm, "").trim();
7
+ code = code.replace(/^[ \t]*import\b[\s\S]*?;[ \t]*$/gm, "").trim();
8
+ code = code.replaceAll('string & Format<"uuid">', 'string & tags.Format<"uuid">');
9
+ code = [
10
+ `import { ArrayUtil, RandomGenerator, TestValidator } from "@nestia/e2e";`,
11
+ `import { IConnection } from "@nestia/fetcher";`,
12
+ `import typia, { tags } from "typia";`,
13
+ "",
14
+ `import api from "@ORGANIZATION/PROJECT-api";`,
15
+ ...typeReferences.map((ref) => `import type { ${ref} } from "@ORGANIZATION/PROJECT-api/lib/structures/${ref}";`),
16
+ "",
17
+ code,
18
+ ].join("\n");
19
+ return code;
20
+ }
21
+ //# sourceMappingURL=completeTestCode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completeTestCode.js","sourceRoot":"","sources":["../../../../src/orchestrate/test/compile/completeTestCode.ts"],"names":[],"mappings":";;AAEA,4CAgCC;AAhCD,SAAgB,gBAAgB,CAC9B,SAAuC,EACvC,IAAY;IAEZ,MAAM,cAAc,GAAa,KAAK,CAAC,IAAI,CACzC,IAAI,GAAG,CACL,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,CACpD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAC5B,CACF,CACF,CAAC;IAEF,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,mCAAmC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACpE,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,mCAAmC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACpE,IAAI,GAAG,IAAI,CAAC,UAAU,CACpB,yBAAyB,EACzB,8BAA8B,CAC/B,CAAC;IACF,IAAI,GAAG;QACL,0EAA0E;QAC1E,gDAAgD;QAChD,sCAAsC;QACtC,EAAE;QACF,8CAA8C;QAC9C,GAAG,cAAc,CAAC,GAAG,CACnB,CAAC,GAAG,EAAE,EAAE,CACN,iBAAiB,GAAG,qDAAqD,GAAG,IAAI,CACnF;QACD,EAAE;QACF,IAAI;KACL,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACb,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -7,7 +7,7 @@ function filterTestFileName(key) {
7
7
  else if (key.startsWith("src/") === true)
8
8
  return true;
9
9
  return (key.startsWith("test/") === true &&
10
- key.startsWith("test/features/") === false &&
10
+ key.startsWith("test/features/") === true &&
11
11
  key.startsWith("test/benchmark/") === false);
12
12
  }
13
13
  //# sourceMappingURL=filterTestFileName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterTestFileName.js","sourceRoot":"","sources":["../../../../src/orchestrate/test/compile/filterTestFileName.ts"],"names":[],"mappings":";;AAAA,gDAQC;AARD,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;SAC3C,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACtD,OAAO,CACL,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,IAAI;QAChC,GAAG,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI;QACzC,GAAG,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,KAAK,CAC5C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ILlmSchema } from "@samchon/openapi";
2
+ import { AutoBeContext } from "../../../context/AutoBeContext";
3
+ export declare function getTestExternalDeclarations<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>): Promise<Record<string, string>>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.getTestExternalDeclarations = getTestExternalDeclarations;
13
+ const tstl_1 = require("tstl");
14
+ function getTestExternalDeclarations(ctx) {
15
+ return singleton.get(ctx.compiler.test);
16
+ }
17
+ const singleton = new tstl_1.Singleton((compiler) => __awaiter(void 0, void 0, void 0, function* () {
18
+ const records = yield compiler.getExternal();
19
+ const external = (location) => {
20
+ const content = records[location];
21
+ if (content === undefined)
22
+ throw new Error(`File not found: ${location}`);
23
+ return { [location]: content };
24
+ };
25
+ return Object.assign(Object.assign({}, external("node_modules/@nestia/e2e/lib/TestValidator.d.ts")), external("node_modules/@nestia/fetcher/lib/IConnection.d.ts"));
26
+ }));
27
+ //# sourceMappingURL=getTestExternalDeclarations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTestExternalDeclarations.js","sourceRoot":"","sources":["../../../../src/orchestrate/test/compile/getTestExternalDeclarations.ts"],"names":[],"mappings":";;;;;;;;;;;AAMA,kEAIC;AARD,+BAAiC;AAIjC,SAAgB,2BAA2B,CACzC,GAAyB;IAEzB,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,SAAS,GAAG,IAAI,gBAAS,CAAC,CAAO,QAA6B,EAAE,EAAE;IACtE,MAAM,OAAO,GAA2B,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC;IACrE,MAAM,QAAQ,GAAG,CAAC,QAAgB,EAA0B,EAAE;QAC5D,MAAM,OAAO,GAAuB,OAAO,CAAC,QAAQ,CAAC,CAAC;QACtD,IAAI,OAAO,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC;QAC1E,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACjC,CAAC,CAAC;IACF,OAAO,gCACF,QAAQ,CAAC,iDAAiD,CAAC,GAC3D,QAAQ,CAAC,mDAAmD,CAAC,CAChC,CAAC;AACrC,CAAC,CAAA,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { AutoBeTestScenario } from "@autobe/interface";
2
+ import { ILlmSchema } from "@samchon/openapi";
3
+ import { AutoBeContext } from "../../../context/AutoBeContext";
4
+ import { IAutoBeTestScenarioArtifacts } from "../structures/IAutoBeTestScenarioArtifacts";
5
+ export declare function getTestScenarioArtifacts<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, scenario: Pick<AutoBeTestScenario, "endpoint" | "dependencies">): Promise<IAutoBeTestScenarioArtifacts>;
@@ -9,15 +9,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.compileTestScenario = compileTestScenario;
12
+ exports.getTestScenarioArtifacts = getTestScenarioArtifacts;
13
13
  const openapi_1 = require("@samchon/openapi");
14
- function compileTestScenario(ctx, scenario) {
14
+ function getTestScenarioArtifacts(ctx, scenario) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
16
16
  const document = filterDocument(scenario, ctx.state().interface.document);
17
17
  const entries = Object.entries(yield ctx.compiler.interface.compile(document));
18
- const filter = (prefix) => Object.fromEntries(entries.filter(([key]) => key.startsWith(prefix)));
18
+ const filter = (prefix, exclude) => {
19
+ const result = entries.filter(([key]) => key.startsWith(prefix) === true);
20
+ return Object.fromEntries(exclude
21
+ ? result.filter(([key]) => key.startsWith(exclude) === false)
22
+ : result);
23
+ };
19
24
  return {
20
- sdk: filter("src/api/functional"),
25
+ document,
26
+ sdk: filter("src/api", "src/api/structures"),
21
27
  dto: filter("src/api/structures"),
22
28
  e2e: filter("test/features"),
23
29
  };
@@ -53,4 +59,4 @@ function filterDocument(scenario, document) {
53
59
  components,
54
60
  };
55
61
  }
56
- //# sourceMappingURL=compileTestScenario.js.map
62
+ //# sourceMappingURL=getTestScenarioArtifacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTestScenarioArtifacts.js","sourceRoot":"","sources":["../../../../src/orchestrate/test/compile/getTestScenarioArtifacts.ts"],"names":[],"mappings":";;;;;;;;;;;AAMA,4DA2BC;AAhCD,8CAAkE;AAKlE,SAAsB,wBAAwB,CAC5C,GAAyB,EACzB,QAA+D;;QAE/D,MAAM,QAAQ,GAA4B,cAAc,CACtD,QAAQ,EACR,GAAG,CAAC,KAAK,EAAE,CAAC,SAAU,CAAC,QAAQ,CAChC,CAAC;QACF,MAAM,OAAO,GAAuB,MAAM,CAAC,OAAO,CAChD,MAAM,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAC/C,CAAC;QACF,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,OAAgB,EAAE,EAAE;YAClD,MAAM,MAAM,GAAuB,OAAO,CAAC,MAAM,CAC/C,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,IAAI,CAC3C,CAAC;YACF,OAAO,MAAM,CAAC,WAAW,CACvB,OAAO;gBACL,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,KAAK,CAAC;gBAC7D,CAAC,CAAC,MAAM,CACX,CAAC;QACJ,CAAC,CAAC;QACF,OAAO;YACL,QAAQ;YACR,GAAG,EAAE,MAAM,CAAC,SAAS,EAAE,oBAAoB,CAAC;YAC5C,GAAG,EAAE,MAAM,CAAC,oBAAoB,CAAC;YACjC,GAAG,EAAE,MAAM,CAAC,eAAe,CAAC;SAC7B,CAAC;IACJ,CAAC;CAAA;AAED,SAAS,cAAc,CACrB,QAA+D,EAC/D,QAAiC;IAEjC,MAAM,UAAU,GAA+B,QAAQ,CAAC,UAAU,CAAC,MAAM,CACvE,CAAC,EAAE,EAAE,EAAE,CACL,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,KAAK,EAAE,CAAC,MAAM;QACrC,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI,CAAC;QACrC,QAAQ,CAAC,YAAY,CAAC,IAAI,CACxB,CAAC,EAAE,EAAE,EAAE,CACL,EAAE,CAAC,QAAQ,CAAC,MAAM,KAAK,EAAE,CAAC,MAAM,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI,CACnE,CACJ,CAAC;IACF,MAAM,UAAU,GAA8B;QAC5C,OAAO,EAAE,EAAE;KACZ,CAAC;IACF,MAAM,KAAK,GAAG,CAAC,QAAgB,EAAE,EAAE;QACjC,4BAAkB,CAAC,KAAK,CAAC;YACvB,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,MAAM,EAAE,EAAE,IAAI,EAAE,wBAAwB,QAAQ,EAAE,EAAE;YACpD,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gBACb,IAAI,4BAAkB,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;oBACtC,MAAM,GAAG,GAAW,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAG,CAAC;oBAC7C,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;gBAC7D,CAAC;YACH,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC;IACF,KAAK,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;QAC5B,IAAI,EAAE,CAAC,WAAW;YAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAI,EAAE,CAAC,YAAY;YAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACvD,CAAC;IACD,OAAO;QACL,UAAU;QACV,UAAU;KACX,CAAC;AACJ,CAAC"}