@autobe/agent 0.10.6 → 0.11.1

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 (147) hide show
  1. package/lib/AutoBeAgent.js +13 -46
  2. package/lib/AutoBeAgent.js.map +1 -1
  3. package/lib/constants/AutoBeSystemPromptConstant.d.ts +11 -6
  4. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  5. package/lib/context/AutoBeContext.d.ts +3 -2
  6. package/lib/factory/getAutoBeGenerated.d.ts +5 -0
  7. package/lib/factory/getAutoBeGenerated.js +307 -0
  8. package/lib/factory/getAutoBeGenerated.js.map +1 -0
  9. package/lib/index.mjs +1652 -1402
  10. package/lib/index.mjs.map +1 -1
  11. package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.d.ts +2 -7
  12. package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.js +1 -9
  13. package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.js.map +1 -1
  14. package/lib/orchestrate/analyze/AutoBeAnalyzeRole.d.ts +13 -0
  15. package/lib/orchestrate/analyze/AutoBeAnalyzeRole.js +3 -0
  16. package/lib/orchestrate/analyze/AutoBeAnalyzeRole.js.map +1 -0
  17. package/lib/orchestrate/analyze/orchestrateAnalyze.d.ts +0 -25
  18. package/lib/orchestrate/analyze/orchestrateAnalyze.js +22 -420
  19. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  20. package/lib/orchestrate/analyze/orchestrateAnalyzeComposer.d.ts +6 -0
  21. package/lib/orchestrate/analyze/orchestrateAnalyzeComposer.js +561 -0
  22. package/lib/orchestrate/analyze/orchestrateAnalyzeComposer.js.map +1 -0
  23. package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.d.ts +6 -0
  24. package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js +41 -0
  25. package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js.map +1 -0
  26. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +14 -0
  27. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +468 -0
  28. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -0
  29. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeComposerApplication.d.ts +68 -0
  30. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeComposerApplication.js +3 -0
  31. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeComposerApplication.js.map +1 -0
  32. package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.d.ts +5 -0
  33. package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.js +27 -0
  34. package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.js.map +1 -0
  35. package/lib/orchestrate/analyze/transformAnalyzeWriteHistories.d.ts +12 -0
  36. package/lib/orchestrate/analyze/transformAnalyzeWriteHistories.js +78 -0
  37. package/lib/orchestrate/analyze/transformAnalyzeWriteHistories.js.map +1 -0
  38. package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.d.ts +6 -0
  39. package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.js +58 -0
  40. package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.js.map +1 -0
  41. package/lib/orchestrate/interface/orchestrateInterface.js +0 -2
  42. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
  43. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +17 -137
  44. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
  45. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +92 -141
  46. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  47. package/lib/orchestrate/prisma/orchestratePrisma.js +9 -5
  48. package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  49. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +54 -25
  50. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  51. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +4 -3
  52. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  53. package/lib/orchestrate/prisma/{orchestratePrismaSchema.d.ts → orchestratePrismaSchemas.d.ts} +2 -4
  54. package/lib/orchestrate/prisma/{orchestratePrismaSchema.js → orchestratePrismaSchemas.js} +269 -203
  55. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -0
  56. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +1 -1
  57. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
  58. package/lib/orchestrate/prisma/transformPrismaCorrectHistories.js +1 -1
  59. package/lib/orchestrate/prisma/transformPrismaHistories.js +1 -1
  60. package/lib/orchestrate/prisma/transformPrismaHistories.js.map +1 -1
  61. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.d.ts +2 -6
  62. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +24 -32
  63. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
  64. package/lib/orchestrate/realize/RealizePipe.d.ts +5 -0
  65. package/lib/orchestrate/realize/RealizePipe.js +14 -0
  66. package/lib/orchestrate/realize/RealizePipe.js.map +1 -0
  67. package/lib/orchestrate/realize/orchestrateRealize.d.ts +0 -6
  68. package/lib/orchestrate/realize/orchestrateRealize.js +6 -43
  69. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
  70. package/lib/orchestrate/realize/orchestrateRealizeCoder.d.ts +3 -3
  71. package/lib/orchestrate/realize/orchestrateRealizeCoder.js +124 -59
  72. package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -1
  73. package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +188 -18
  74. package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.d.ts +23 -0
  75. package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.js +3 -0
  76. package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.js.map +1 -0
  77. package/lib/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.d.ts +2 -0
  78. package/lib/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.js +5 -0
  79. package/lib/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.js.map +1 -0
  80. package/lib/orchestrate/realize/transformRealizeCoderHistories.d.ts +2 -1
  81. package/lib/orchestrate/realize/transformRealizeCoderHistories.js +50 -36
  82. package/lib/orchestrate/realize/transformRealizeCoderHistories.js.map +1 -1
  83. package/lib/orchestrate/realize/writeCodeUntilCompilePassed.d.ts +5 -0
  84. package/lib/orchestrate/realize/writeCodeUntilCompilePassed.js +123 -0
  85. package/lib/orchestrate/realize/writeCodeUntilCompilePassed.js.map +1 -0
  86. package/lib/orchestrate/test/compile/getTestExternalDeclarations.js +4 -1
  87. package/lib/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
  88. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js +2 -1
  89. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
  90. package/lib/orchestrate/test/orchestrateTest.js +11 -5
  91. package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
  92. package/lib/orchestrate/test/orchestrateTestCorrect.js +3 -2
  93. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  94. package/lib/orchestrate/test/orchestrateTestWrite.js +22 -13
  95. package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  96. package/lib/structures/IAutoBeProps.d.ts +8 -8
  97. package/lib/utils/pipe.d.ts +5 -0
  98. package/lib/utils/pipe.js +14 -0
  99. package/lib/utils/pipe.js.map +1 -0
  100. package/package.json +6 -6
  101. package/src/AutoBeAgent.ts +22 -76
  102. package/src/constants/AutoBeSystemPromptConstant.ts +11 -6
  103. package/src/context/AutoBeContext.ts +3 -1
  104. package/src/factory/getAutoBeGenerated.ts +113 -0
  105. package/src/orchestrate/analyze/AutoBeAnalyzeFileSystem.ts +5 -13
  106. package/src/orchestrate/analyze/AutoBeAnalyzeRole.ts +14 -0
  107. package/src/orchestrate/analyze/orchestrateAnalyze.ts +30 -165
  108. package/src/orchestrate/analyze/orchestrateAnalyzeComposer.ts +115 -0
  109. package/src/orchestrate/analyze/orchestrateAnalyzeReviewer.ts +39 -0
  110. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +106 -0
  111. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeComposerApplication.ts +74 -0
  112. package/src/orchestrate/analyze/transformAnalyzeReviewerHistories.ts +31 -0
  113. package/src/orchestrate/analyze/transformAnalyzeWriteHistories.ts +94 -0
  114. package/src/orchestrate/analyze/writeDocumentUntilReviewPassed.ts +66 -0
  115. package/src/orchestrate/interface/orchestrateInterface.ts +0 -2
  116. package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +2 -3
  117. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +21 -0
  118. package/src/orchestrate/prisma/orchestratePrisma.ts +12 -5
  119. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +4 -13
  120. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +9 -4
  121. package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +265 -0
  122. package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +26 -37
  123. package/src/orchestrate/realize/RealizePipe.ts +39 -0
  124. package/src/orchestrate/realize/orchestrateRealize.ts +3 -91
  125. package/src/orchestrate/realize/orchestrateRealizeCoder.ts +60 -25
  126. package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +192 -18
  127. package/src/orchestrate/realize/structures/IAutoBeRealizeCompile.ts +34 -0
  128. package/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.ts +2 -0
  129. package/src/orchestrate/realize/transformRealizeCoderHistories.ts +58 -34
  130. package/src/orchestrate/realize/writeCodeUntilCompilePassed.ts +178 -0
  131. package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +5 -4
  132. package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +7 -2
  133. package/src/orchestrate/test/orchestrateTest.ts +14 -12
  134. package/src/orchestrate/test/orchestrateTestCorrect.ts +10 -9
  135. package/src/orchestrate/test/orchestrateTestWrite.ts +33 -27
  136. package/src/structures/IAutoBeProps.ts +10 -7
  137. package/src/utils/pipe.ts +39 -0
  138. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.d.ts +0 -20
  139. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js +0 -735
  140. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js.map +0 -1
  141. package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.d.ts +0 -15
  142. package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js +0 -44
  143. package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js.map +0 -1
  144. package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +0 -1
  145. package/src/orchestrate/analyze/AutoBeAnalyzeAgent.ts +0 -219
  146. package/src/orchestrate/analyze/AutoBeAnalyzeReviewer.ts +0 -62
  147. package/src/orchestrate/prisma/orchestratePrismaSchema.ts +0 -157
@@ -52,7 +52,7 @@ const typia_1 = __importDefault(require("typia"));
52
52
  const assertSchemaModel_1 = require("../../context/assertSchemaModel");
53
53
  const enforceToolCall_1 = require("../../utils/enforceToolCall");
54
54
  const getTestScenarioArtifacts_1 = require("../test/compile/getTestScenarioArtifacts");
55
- const orchestrateRealize_1 = require("./orchestrateRealize");
55
+ const IAutoBeRealizeFailedSymbol_1 = require("./structures/IAutoBeRealizeFailedSymbol");
56
56
  const transformRealizeCoderHistories_1 = require("./transformRealizeCoderHistories");
57
57
  /**
58
58
  * Generates a TypeScript function implementation based on the given plan.
@@ -72,7 +72,7 @@ const transformRealizeCoderHistories_1 = require("./transformRealizeCoderHistori
72
72
  * @param props - Planning result describing what function to generate
73
73
  * @returns The generated function name and TypeScript code
74
74
  */
75
- const orchestrateRealizeCoder = (ctx, operation, props, files) => __awaiter(void 0, void 0, void 0, function* () {
75
+ const orchestrateRealizeCoder = (ctx, operation, props, previous, total, diagnostics) => __awaiter(void 0, void 0, void 0, function* () {
76
76
  const artifacts = yield (0, getTestScenarioArtifacts_1.getTestScenarioArtifacts)(ctx, {
77
77
  endpoint: {
78
78
  method: operation.method,
@@ -86,7 +86,7 @@ const orchestrateRealizeCoder = (ctx, operation, props, files) => __awaiter(void
86
86
  const controller = createApplication({
87
87
  model: ctx.model,
88
88
  build: (props) => {
89
- pointer.value = props.result;
89
+ pointer.value = props.output;
90
90
  },
91
91
  });
92
92
  const agent = new core_1.MicroAgentica({
@@ -96,34 +96,46 @@ const orchestrateRealizeCoder = (ctx, operation, props, files) => __awaiter(void
96
96
  config: Object.assign(Object.assign({}, ctx.config), { executor: {
97
97
  describe: null,
98
98
  } }),
99
- histories: (0, transformRealizeCoderHistories_1.transformRealizeCoderHistories)(ctx.state(), props, artifacts),
99
+ histories: (0, transformRealizeCoderHistories_1.transformRealizeCoderHistories)(ctx.state(), props, artifacts, previous, total, diagnostics),
100
100
  });
101
101
  (0, enforceToolCall_1.enforceToolCall)(agent);
102
102
  yield agent.conversate("Write code.");
103
103
  const tokenUsage = agent.getTokenUsage();
104
104
  ctx.usage().record(tokenUsage, ["realize"]);
105
105
  if (pointer.value === null) {
106
- return orchestrateRealize_1.FAILED;
106
+ return IAutoBeRealizeFailedSymbol_1.FAILED;
107
107
  }
108
- pointer.value.implementationCode = yield ctx.compiler.typescript.beautify(pointer.value.implementationCode);
109
- pointer.value.implementationCode = pointer.value.implementationCode
110
- .replaceAll('import { MyGlobal } from "../MyGlobal";', "")
111
- .replaceAll('import typia, { tags } from "typia";', "")
112
- .replaceAll('import { Prisma } from "@prisma/client";', "")
113
- .replaceAll('import { jwtDecode } from "./jwtDecode"', "");
114
- pointer.value.implementationCode = [
115
- 'import { MyGlobal } from "../MyGlobal";',
116
- 'import typia, { tags } from "typia";',
117
- 'import { Prisma } from "@prisma/client";',
118
- 'import { jwtDecode } from "./jwtDecode"',
119
- "",
120
- pointer.value.implementationCode,
121
- ].join("\n");
122
- files[`src/providers/${props.functionName}.ts`] =
123
- pointer.value.implementationCode;
124
- return Object.assign(Object.assign({}, pointer.value), { functionName: props.functionName });
108
+ pointer.value.implementationCode = yield replaceImportStatements(ctx)(pointer.value.implementationCode);
109
+ return Object.assign(Object.assign({}, pointer.value), { filename: `src/providers/${props.functionName}.ts` });
125
110
  });
126
111
  exports.orchestrateRealizeCoder = orchestrateRealizeCoder;
112
+ function replaceImportStatements(ctx) {
113
+ return function (code) {
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ const compiler = yield ctx.compiler();
116
+ code = yield compiler.typescript.beautify(code);
117
+ code = code
118
+ .replaceAll('import { MyGlobal } from "../MyGlobal";', "")
119
+ .replaceAll('import typia, { tags } from "typia";', "")
120
+ .replaceAll('import { tags } from "typia";', "")
121
+ .replaceAll('import { tags, typia } from "typia";', "")
122
+ .replaceAll('import typia from "typia";', "")
123
+ .replaceAll('import { Prisma } from "@prisma/client";', "")
124
+ .replaceAll('import { jwtDecode } from "./jwtDecode"', "")
125
+ .replaceAll('import { v4 } from "uuid"', "");
126
+ code = [
127
+ 'import { MyGlobal } from "../MyGlobal";',
128
+ 'import typia, { tags } from "typia";',
129
+ 'import { Prisma } from "@prisma/client";',
130
+ 'import { jwtDecode } from "./jwtDecode";',
131
+ 'import { v4 } from "uuid";',
132
+ "",
133
+ code,
134
+ ].join("\n");
135
+ return code;
136
+ });
137
+ };
138
+ }
127
139
  function createApplication(props) {
128
140
  (0, assertSchemaModel_1.assertSchemaModel)(props.model);
129
141
  const application = collection[props.model];
@@ -132,7 +144,7 @@ function createApplication(props) {
132
144
  name: "Write code",
133
145
  application,
134
146
  execute: {
135
- programing: (next) => {
147
+ programming: (next) => {
136
148
  props.build(next);
137
149
  },
138
150
  },
@@ -146,52 +158,79 @@ const claude = {
146
158
  },
147
159
  functions: [
148
160
  {
149
- name: "programing",
161
+ name: "programming",
150
162
  parameters: {
151
- description: "Current Type: {@link IAutoBeRealizeCoderApplication.IProps}",
163
+ description: "Description of the current {@link IAutoBeRealizeCoderApplication.IProps} type:\n\n> Properties for the component or function that consumes the output of the\n> code generation pipeline.",
152
164
  type: "object",
153
165
  properties: {
154
- result: {
166
+ output: {
167
+ description: "The detailed output of the code generation process, containing all phases\nfrom planning to final implementation of a TypeScript provider function.",
155
168
  $ref: "#/$defs/IAutoBeRealizeCoderApplication.RealizeCoderOutput"
156
169
  }
157
170
  },
158
171
  required: [
159
- "result"
172
+ "output"
160
173
  ],
161
174
  additionalProperties: false,
162
175
  $defs: {
163
176
  "IAutoBeRealizeCoderApplication.RealizeCoderOutput": {
164
- description: "The result of the code generation step, representing a fully generated\nTypeScript function.",
177
+ description: "Represents the complete output of a code generation pipeline. Each field\ncorresponds to a stage in the Chain of Thought (CoT) process for generating\na production-quality TypeScript function.\n\nAll fields contain TypeScript code strings and follow these rules:\n\n- All code must be valid TypeScript or structurally valid even if incomplete.\n- Each phase builds upon the previous one and must resolve specific concerns.\n- All phases must follow system conventions around structure, typing, and\n logic.",
165
178
  type: "object",
166
179
  properties: {
167
- functionName: {
168
- description: "The name of the function to be generated.\n\nThis name will be used as the function's identifier and as the export\nname in the provider file.",
180
+ filename: {
181
+ description: "The name of the file to be generated (e.g., \"user.create.ts\")",
182
+ type: "string"
183
+ },
184
+ plan: {
185
+ description: "\uD83E\uDDE0 Provider Function Implementation Plan\n\nThis field outlines the strategic plan for implementing the provider\nfunction according to the Realize Coder Agent specification. Before\nwriting the actual code, think through the logic and structure.\n\nThe plan must consider:\n\n- \uD83E\uDDE9 Required business entities (e.g., users, posts, logs) and their\n relationships\n- \uD83D\uDEE0 Operations needed to fulfill the business scenario (e.g., fetch,\n create, update)\n- \uD83D\uDD04 Data dependencies between steps (e.g., use userId to fetch related\n data)\n- \u2705 Validation points (based on business rules, not field presence)\n- \uD83D\uDEA7 Error and edge cases that must be handled explicitly (e.g., missing\n records)\n- \uD83C\uDFD7 Structure: always a single `async function`, using only `parameters`\n and `body`\n\n\u26A0\uFE0F Important Constraints:\n\n- Do NOT perform input validation \u2014 assume `parameters` and `body` are\n already valid\n- Use `typia.random<T>()` with an explanatory comment if logic can't be\n implemented\n- Never use `any` or make assumptions without sufficient context\n- Use only allowed imports \u2014 DTOs and Prisma types\n- Use `MyGlobal.prisma` for DB access and respect Prisma typing rules\n\n\u26A0\uFE0F TypeScript-specific considerations:\n\n- Do **not** use native `Date` objects directly; convert all dates with\n `.toISOString()`\n- Use `string & tags.Format<'date-time'>` for all date/time typed fields\n- Prefer `satisfies` for DTO conformance instead of unsafe `as` casts\n- Avoid weak typing such as `any`, `as any`, or `satisfies any`\n- Use branded types (e.g., `tags.Format<'uuid'>`) and literal unions where\n applicable\n\n\u2705 Example Structure:\n\n```ts\nexport async function doSomething(\n user: { id: string & tags.Format<\"uuid\">; type: string },\n parameters: IParams,\n body: IBody\n): Promise<IReturn> {\n const { id } = parameters;\n const { name } = body;\n const user = await MyGlobal.prisma.users.findFirst({ where: { id } });\n if (!user) throw new Error(\"User not found\");\n ...\n return result;\n}\n```\n\n\uD83D\uDD25 Error Handling Plan:\n\nIf an error is expected or encountered during implementation:\n\n- Clearly document the error message(s) and TypeScript error codes.\n- Analyze the root cause (e.g., type mismatch, missing field, nullability\n issue).\n- Define concrete steps to resolve the issue, such as:\n\n - Adjusting type declarations or using Prisma-generated input types.\n - Using `?? undefined` to normalize nullable fields.\n - Applying correct relation handling (e.g., `connect` instead of direct\n foreign key assignment).\n - Ensuring `Date` fields use `.toISOString()` and branded types.\n- Include fallback or workaround plans if a direct fix is complex.\n- If no error is present, simply omit this section.\n\nThis plan ensures the function will:\n\n- Respect the global architecture and coding conventions\n- Be safe, predictable, and aligned with upstream logic",
186
+ type: "string"
187
+ },
188
+ review: {
189
+ description: "\uD83D\uDD0D Phase 2: Review code\n\nA refined version of the draft with improved completeness.\n\n- Replace placeholder logic with real DTO-conformant operations.\n- Add error handling (`throw new Error(...)`) where necessary.\n- Begin resolving structural or type mismatches.\n\n\u2705 Requirements:\n\n- Use `satisfies` to ensure DTO conformity.\n- Avoid unsafe `as` casts unless only for branding or literal narrowing.\n- Include `.toISOString()` for all date fields.\n- Ensure all object keys strictly conform to the expected type definitions.",
190
+ type: "string"
191
+ },
192
+ withCompilerFeedback: {
193
+ description: "\uD83D\uDEE0 Phase 3: With compiler feedback (optional)\n\nA correction pass that applies fixes for compile-time errors that arose\nduring the review stage (if any).\n\n\u2705 Must:\n\n- Resolve all TypeScript errors without using `as any`\n- Provide safe brand casting only if required (e.g., `as string &\n tags.Format<'uuid'>`)",
169
194
  type: "string"
170
195
  },
171
196
  implementationCode: {
172
- description: "The raw TypeScript code string implementing the function.\n\n- The implementation must be valid TypeScript code.\n- It should focus solely on the logic of the function.\n- Import statements do **not** need to be included. They will be\n automatically inserted by the system.\n- Any unused imports will be automatically removed by eslint.\n- Type annotations (e.g. for parameters and return types) should be omitted\n if they can be inferred.",
197
+ description: "\u2705 Phase 4: Final implementation\n\nThe complete and fully correct TypeScript function implementation.\n\n- Passes strict type checking without errors.\n- Uses only safe branding or literal type assertions.\n- Converts all Date values properly to ISO string format.\n- Follows DTO structures using `satisfies`.\n- Avoids any weak typing such as `any`, `as any`, or `satisfies any`.\n- Uses only allowed imports (e.g., from `src/api/structures` and\n `MyGlobal.prisma`).\n\n\u26A0\uFE0F Prohibited Practices:\n\n- Do NOT add or modify import statements manually. Imports are handled\n automatically by the system.\n- Do NOT use `any`, `as any`, or `satisfies any` to bypass type checking.\n- Do NOT assign native `Date` objects directly; always convert them to ISO\n strings with `.toISOString()`.\n- Do NOT use unsafe type assertions except for safe branding or literal\n narrowing.\n- Do NOT write code outside the single async function structure (e.g., no\n classes or multiple functions).\n- Do NOT perform any input validation \u2014 assume all inputs are already\n validated.\n- Do NOT use dynamic import expressions (`import()`); all imports must be\n static.\n- Do NOT rely on DTO types for database update input; always use\n Prisma-generated input types.",
173
198
  type: "string"
174
199
  }
175
200
  },
176
201
  required: [
177
- "functionName",
202
+ "filename",
203
+ "plan",
204
+ "review",
178
205
  "implementationCode"
179
206
  ]
180
207
  }
181
208
  }
182
209
  },
183
- validate: (() => { const _io0 = input => "object" === typeof input.result && null !== input.result && _io1(input.result); const _io1 = input => "string" === typeof input.functionName && "string" === typeof input.implementationCode; const _vo0 = (input, _path, _exceptionable = true) => [("object" === typeof input.result && null !== input.result || _report(_exceptionable, {
184
- path: _path + ".result",
210
+ validate: (() => { const _io0 = input => "object" === typeof input.output && null !== input.output && _io1(input.output); const _io1 = input => "string" === typeof input.filename && "string" === typeof input.plan && "string" === typeof input.review && (undefined === input.withCompilerFeedback || "string" === typeof input.withCompilerFeedback) && "string" === typeof input.implementationCode; const _vo0 = (input, _path, _exceptionable = true) => [("object" === typeof input.output && null !== input.output || _report(_exceptionable, {
211
+ path: _path + ".output",
185
212
  expected: "IAutoBeRealizeCoderApplication.RealizeCoderOutput",
186
- value: input.result
187
- })) && _vo1(input.result, _path + ".result", true && _exceptionable) || _report(_exceptionable, {
188
- path: _path + ".result",
213
+ value: input.output
214
+ })) && _vo1(input.output, _path + ".output", true && _exceptionable) || _report(_exceptionable, {
215
+ path: _path + ".output",
189
216
  expected: "IAutoBeRealizeCoderApplication.RealizeCoderOutput",
190
- value: input.result
191
- })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.functionName || _report(_exceptionable, {
192
- path: _path + ".functionName",
217
+ value: input.output
218
+ })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.filename || _report(_exceptionable, {
219
+ path: _path + ".filename",
220
+ expected: "string",
221
+ value: input.filename
222
+ }), "string" === typeof input.plan || _report(_exceptionable, {
223
+ path: _path + ".plan",
193
224
  expected: "string",
194
- value: input.functionName
225
+ value: input.plan
226
+ }), "string" === typeof input.review || _report(_exceptionable, {
227
+ path: _path + ".review",
228
+ expected: "string",
229
+ value: input.review
230
+ }), undefined === input.withCompilerFeedback || "string" === typeof input.withCompilerFeedback || _report(_exceptionable, {
231
+ path: _path + ".withCompilerFeedback",
232
+ expected: "(string | undefined)",
233
+ value: input.withCompilerFeedback
195
234
  }), "string" === typeof input.implementationCode || _report(_exceptionable, {
196
235
  path: _path + ".implementationCode",
197
236
  expected: "string",
@@ -237,52 +276,78 @@ const collection = {
237
276
  },
238
277
  functions: [
239
278
  {
240
- name: "programing",
279
+ name: "programming",
241
280
  parameters: {
242
- description: "Current Type: {@link IAutoBeRealizeCoderApplication.IProps}",
281
+ description: "Description of the current {@link IAutoBeRealizeCoderApplication.IProps} type:\n\n> Properties for the component or function that consumes the output of the\n> code generation pipeline.\n\n### Description of {@link output} property:\n\n> The detailed output of the code generation process, containing all phases\n> from planning to final implementation of a TypeScript provider function.",
243
282
  type: "object",
244
283
  properties: {
245
- result: {
284
+ output: {
246
285
  $ref: "#/$defs/IAutoBeRealizeCoderApplication.RealizeCoderOutput"
247
286
  }
248
287
  },
249
288
  required: [
250
- "result"
289
+ "output"
251
290
  ],
252
291
  additionalProperties: false,
253
292
  $defs: {
254
293
  "IAutoBeRealizeCoderApplication.RealizeCoderOutput": {
255
- description: "The result of the code generation step, representing a fully generated\nTypeScript function.",
294
+ description: "Represents the complete output of a code generation pipeline. Each field\ncorresponds to a stage in the Chain of Thought (CoT) process for generating\na production-quality TypeScript function.\n\nAll fields contain TypeScript code strings and follow these rules:\n\n- All code must be valid TypeScript or structurally valid even if incomplete.\n- Each phase builds upon the previous one and must resolve specific concerns.\n- All phases must follow system conventions around structure, typing, and\n logic.",
256
295
  type: "object",
257
296
  properties: {
258
- functionName: {
259
- description: "The name of the function to be generated.\n\nThis name will be used as the function's identifier and as the export\nname in the provider file.",
297
+ filename: {
298
+ description: "The name of the file to be generated (e.g., \"user.create.ts\")",
299
+ type: "string"
300
+ },
301
+ plan: {
302
+ description: "\uD83E\uDDE0 Provider Function Implementation Plan\n\nThis field outlines the strategic plan for implementing the provider\nfunction according to the Realize Coder Agent specification. Before\nwriting the actual code, think through the logic and structure.\n\nThe plan must consider:\n\n- \uD83E\uDDE9 Required business entities (e.g., users, posts, logs) and their\n relationships\n- \uD83D\uDEE0 Operations needed to fulfill the business scenario (e.g., fetch,\n create, update)\n- \uD83D\uDD04 Data dependencies between steps (e.g., use userId to fetch related\n data)\n- \u2705 Validation points (based on business rules, not field presence)\n- \uD83D\uDEA7 Error and edge cases that must be handled explicitly (e.g., missing\n records)\n- \uD83C\uDFD7 Structure: always a single `async function`, using only `parameters`\n and `body`\n\n\u26A0\uFE0F Important Constraints:\n\n- Do NOT perform input validation \u2014 assume `parameters` and `body` are\n already valid\n- Use `typia.random<T>()` with an explanatory comment if logic can't be\n implemented\n- Never use `any` or make assumptions without sufficient context\n- Use only allowed imports \u2014 DTOs and Prisma types\n- Use `MyGlobal.prisma` for DB access and respect Prisma typing rules\n\n\u26A0\uFE0F TypeScript-specific considerations:\n\n- Do **not** use native `Date` objects directly; convert all dates with\n `.toISOString()`\n- Use `string & tags.Format<'date-time'>` for all date/time typed fields\n- Prefer `satisfies` for DTO conformance instead of unsafe `as` casts\n- Avoid weak typing such as `any`, `as any`, or `satisfies any`\n- Use branded types (e.g., `tags.Format<'uuid'>`) and literal unions where\n applicable\n\n\u2705 Example Structure:\n\n```ts\nexport async function doSomething(\n user: { id: string & tags.Format<\"uuid\">; type: string },\n parameters: IParams,\n body: IBody\n): Promise<IReturn> {\n const { id } = parameters;\n const { name } = body;\n const user = await MyGlobal.prisma.users.findFirst({ where: { id } });\n if (!user) throw new Error(\"User not found\");\n ...\n return result;\n}\n```\n\n\uD83D\uDD25 Error Handling Plan:\n\nIf an error is expected or encountered during implementation:\n\n- Clearly document the error message(s) and TypeScript error codes.\n- Analyze the root cause (e.g., type mismatch, missing field, nullability\n issue).\n- Define concrete steps to resolve the issue, such as:\n\n - Adjusting type declarations or using Prisma-generated input types.\n - Using `?? undefined` to normalize nullable fields.\n - Applying correct relation handling (e.g., `connect` instead of direct\n foreign key assignment).\n - Ensuring `Date` fields use `.toISOString()` and branded types.\n- Include fallback or workaround plans if a direct fix is complex.\n- If no error is present, simply omit this section.\n\nThis plan ensures the function will:\n\n- Respect the global architecture and coding conventions\n- Be safe, predictable, and aligned with upstream logic",
303
+ type: "string"
304
+ },
305
+ review: {
306
+ description: "\uD83D\uDD0D Phase 2: Review code\n\nA refined version of the draft with improved completeness.\n\n- Replace placeholder logic with real DTO-conformant operations.\n- Add error handling (`throw new Error(...)`) where necessary.\n- Begin resolving structural or type mismatches.\n\n\u2705 Requirements:\n\n- Use `satisfies` to ensure DTO conformity.\n- Avoid unsafe `as` casts unless only for branding or literal narrowing.\n- Include `.toISOString()` for all date fields.\n- Ensure all object keys strictly conform to the expected type definitions.",
307
+ type: "string"
308
+ },
309
+ withCompilerFeedback: {
310
+ description: "\uD83D\uDEE0 Phase 3: With compiler feedback (optional)\n\nA correction pass that applies fixes for compile-time errors that arose\nduring the review stage (if any).\n\n\u2705 Must:\n\n- Resolve all TypeScript errors without using `as any`\n- Provide safe brand casting only if required (e.g., `as string &\n tags.Format<'uuid'>`)",
260
311
  type: "string"
261
312
  },
262
313
  implementationCode: {
263
- description: "The raw TypeScript code string implementing the function.\n\n- The implementation must be valid TypeScript code.\n- It should focus solely on the logic of the function.\n- Import statements do **not** need to be included. They will be\n automatically inserted by the system.\n- Any unused imports will be automatically removed by eslint.\n- Type annotations (e.g. for parameters and return types) should be omitted\n if they can be inferred.",
314
+ description: "\u2705 Phase 4: Final implementation\n\nThe complete and fully correct TypeScript function implementation.\n\n- Passes strict type checking without errors.\n- Uses only safe branding or literal type assertions.\n- Converts all Date values properly to ISO string format.\n- Follows DTO structures using `satisfies`.\n- Avoids any weak typing such as `any`, `as any`, or `satisfies any`.\n- Uses only allowed imports (e.g., from `src/api/structures` and\n `MyGlobal.prisma`).\n\n\u26A0\uFE0F Prohibited Practices:\n\n- Do NOT add or modify import statements manually. Imports are handled\n automatically by the system.\n- Do NOT use `any`, `as any`, or `satisfies any` to bypass type checking.\n- Do NOT assign native `Date` objects directly; always convert them to ISO\n strings with `.toISOString()`.\n- Do NOT use unsafe type assertions except for safe branding or literal\n narrowing.\n- Do NOT write code outside the single async function structure (e.g., no\n classes or multiple functions).\n- Do NOT perform any input validation \u2014 assume all inputs are already\n validated.\n- Do NOT use dynamic import expressions (`import()`); all imports must be\n static.\n- Do NOT rely on DTO types for database update input; always use\n Prisma-generated input types.",
264
315
  type: "string"
265
316
  }
266
317
  },
267
318
  required: [
268
- "functionName",
319
+ "filename",
320
+ "plan",
321
+ "review",
269
322
  "implementationCode"
270
323
  ]
271
324
  }
272
325
  }
273
326
  },
274
- validate: (() => { const _io0 = input => "object" === typeof input.result && null !== input.result && _io1(input.result); const _io1 = input => "string" === typeof input.functionName && "string" === typeof input.implementationCode; const _vo0 = (input, _path, _exceptionable = true) => [("object" === typeof input.result && null !== input.result || _report(_exceptionable, {
275
- path: _path + ".result",
327
+ validate: (() => { const _io0 = input => "object" === typeof input.output && null !== input.output && _io1(input.output); const _io1 = input => "string" === typeof input.filename && "string" === typeof input.plan && "string" === typeof input.review && (undefined === input.withCompilerFeedback || "string" === typeof input.withCompilerFeedback) && "string" === typeof input.implementationCode; const _vo0 = (input, _path, _exceptionable = true) => [("object" === typeof input.output && null !== input.output || _report(_exceptionable, {
328
+ path: _path + ".output",
276
329
  expected: "IAutoBeRealizeCoderApplication.RealizeCoderOutput",
277
- value: input.result
278
- })) && _vo1(input.result, _path + ".result", true && _exceptionable) || _report(_exceptionable, {
279
- path: _path + ".result",
330
+ value: input.output
331
+ })) && _vo1(input.output, _path + ".output", true && _exceptionable) || _report(_exceptionable, {
332
+ path: _path + ".output",
280
333
  expected: "IAutoBeRealizeCoderApplication.RealizeCoderOutput",
281
- value: input.result
282
- })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.functionName || _report(_exceptionable, {
283
- path: _path + ".functionName",
334
+ value: input.output
335
+ })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.filename || _report(_exceptionable, {
336
+ path: _path + ".filename",
337
+ expected: "string",
338
+ value: input.filename
339
+ }), "string" === typeof input.plan || _report(_exceptionable, {
340
+ path: _path + ".plan",
341
+ expected: "string",
342
+ value: input.plan
343
+ }), "string" === typeof input.review || _report(_exceptionable, {
344
+ path: _path + ".review",
284
345
  expected: "string",
285
- value: input.functionName
346
+ value: input.review
347
+ }), undefined === input.withCompilerFeedback || "string" === typeof input.withCompilerFeedback || _report(_exceptionable, {
348
+ path: _path + ".withCompilerFeedback",
349
+ expected: "(string | undefined)",
350
+ value: input.withCompilerFeedback
286
351
  }), "string" === typeof input.implementationCode || _report(_exceptionable, {
287
352
  path: _path + ".implementationCode",
288
353
  expected: "string",
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrateRealizeCoder.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizeCoder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAoE;AAIpE,kDAA0B;AAG1B,uEAAoE;AACpE,iEAA8D;AAC9D,uFAAoF;AAEpF,6DAA8C;AAG9C,qFAAkF;AAElF;;;;;;;;;;;;;;;;;GAiBG;AACI,MAAM,uBAAuB,GAAG,CACrC,GAAyB,EACzB,SAAmC,EACnC,KAA2B,EAC3B,KAA6B,EACwC,EAAE;IACvE,MAAM,SAAS,GACb,MAAM,IAAA,mDAAwB,EAAC,GAAG,EAAE;QAClC,QAAQ,EAAE;YACR,MAAM,EAAE,SAAS,CAAC,MAAM;YACxB,IAAI,EAAE,SAAS,CAAC,IAAI;SACrB;QACD,YAAY,EAAE,EAAE;KACjB,CAAC,CAAC;IAEL,MAAM,OAAO,GAGD;QACV,KAAK,EAAE,IAAI;KACZ,CAAC;IAEF,MAAM,UAAU,GAAG,iBAAiB,CAAC;QACnC,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;YACf,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;QAC/B,CAAC;KACF,CAAC,CAAC;I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AAC;QACd,CAAC;KAAA,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAiC,KAG1D;IACC,IAAA,qCAAiB,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAE/B,MAAM,WAAW,GAA2B,UAAU,CACpD,KAAK,CAAC,KAAK,CACyB,CAAC;IAEvC,OAAO;QACL,QAAQ,EAAE,OAAO;QACjB,IAAI,EAAE,YAAY;QAClB,WAAW;QACX,OAAO,EAAE;YACP,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE;gBACpB,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACpB,CAAC;SACuC;KAC3C,CAAC;AACJ,CAAC;AAED,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMT,CAAC;AACJ,MAAM,UAAU,GAAG;IACjB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIJ;IACH,MAAM;IACN,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;CACd,CAAC"}
@@ -1,34 +1,204 @@
1
1
  import { AutoBeOpenApi } from "@autobe/interface";
2
- import { FAILED } from "../orchestrateRealize";
2
+ import { FAILED } from "./IAutoBeRealizeFailedSymbol";
3
3
  export interface IAutoBeRealizeCoderApplication {
4
- programing: (next: IAutoBeRealizeCoderApplication.IProps) => void;
4
+ programming: (input: IAutoBeRealizeCoderApplication.IProps) => void;
5
5
  }
6
6
  export declare namespace IAutoBeRealizeCoderApplication {
7
+ /**
8
+ * Properties for the component or function that consumes the output of the
9
+ * code generation pipeline.
10
+ */
7
11
  interface IProps {
8
- result: RealizeCoderOutput;
12
+ /**
13
+ * The detailed output of the code generation process, containing all phases
14
+ * from planning to final implementation of a TypeScript provider function.
15
+ */
16
+ output: RealizeCoderOutput;
9
17
  }
10
18
  /**
11
- * The result of the code generation step, representing a fully generated
12
- * TypeScript function.
19
+ * Represents the complete output of a code generation pipeline. Each field
20
+ * corresponds to a stage in the Chain of Thought (CoT) process for generating
21
+ * a production-quality TypeScript function.
22
+ *
23
+ * All fields contain TypeScript code strings and follow these rules:
24
+ *
25
+ * - All code must be valid TypeScript or structurally valid even if incomplete.
26
+ * - Each phase builds upon the previous one and must resolve specific concerns.
27
+ * - All phases must follow system conventions around structure, typing, and
28
+ * logic.
13
29
  */
14
30
  interface RealizeCoderOutput {
31
+ /** The name of the file to be generated (e.g., "user.create.ts") */
32
+ filename: string;
15
33
  /**
16
- * The name of the function to be generated.
34
+ * 🧠 Provider Function Implementation Plan
35
+ *
36
+ * This field outlines the strategic plan for implementing the provider
37
+ * function according to the Realize Coder Agent specification. Before
38
+ * writing the actual code, think through the logic and structure.
39
+ *
40
+ * The plan must consider:
41
+ *
42
+ * - 🧩 Required business entities (e.g., users, posts, logs) and their
43
+ * relationships
44
+ * - 🛠 Operations needed to fulfill the business scenario (e.g., fetch,
45
+ * create, update)
46
+ * - 🔄 Data dependencies between steps (e.g., use userId to fetch related
47
+ * data)
48
+ * - ✅ Validation points (based on business rules, not field presence)
49
+ * - 🚧 Error and edge cases that must be handled explicitly (e.g., missing
50
+ * records)
51
+ * - 🏗 Structure: always a single `async function`, using only `parameters`
52
+ * and `body`
53
+ *
54
+ * ⚠️ Important Constraints:
55
+ *
56
+ * - Do NOT perform input validation — assume `parameters` and `body` are
57
+ * already valid
58
+ * - Use `typia.random<T>()` with an explanatory comment if logic can't be
59
+ * implemented
60
+ * - Never use `any` or make assumptions without sufficient context
61
+ * - Use only allowed imports — DTOs and Prisma types
62
+ * - Use `MyGlobal.prisma` for DB access and respect Prisma typing rules
63
+ *
64
+ * ⚠️ TypeScript-specific considerations:
65
+ *
66
+ * - Do **not** use native `Date` objects directly; convert all dates with
67
+ * `.toISOString()`
68
+ * - Use `string & tags.Format<'date-time'>` for all date/time typed fields
69
+ * - Prefer `satisfies` for DTO conformance instead of unsafe `as` casts
70
+ * - Avoid weak typing such as `any`, `as any`, or `satisfies any`
71
+ * - Use branded types (e.g., `tags.Format<'uuid'>`) and literal unions where
72
+ * applicable
17
73
  *
18
- * This name will be used as the function's identifier and as the export
19
- * name in the provider file.
74
+ * Example Structure:
75
+ *
76
+ * ```ts
77
+ * export async function doSomething(
78
+ * user: { id: string & tags.Format<"uuid">; type: string },
79
+ * parameters: IParams,
80
+ * body: IBody
81
+ * ): Promise<IReturn> {
82
+ * const { id } = parameters;
83
+ * const { name } = body;
84
+ * const user = await MyGlobal.prisma.users.findFirst({ where: { id } });
85
+ * if (!user) throw new Error("User not found");
86
+ * ...
87
+ * return result;
88
+ * }
89
+ * ```
90
+ *
91
+ * 🔥 Error Handling Plan:
92
+ *
93
+ * If an error is expected or encountered during implementation:
94
+ *
95
+ * - Clearly document the error message(s) and TypeScript error codes.
96
+ * - Analyze the root cause (e.g., type mismatch, missing field, nullability
97
+ * issue).
98
+ * - Define concrete steps to resolve the issue, such as:
99
+ *
100
+ * - Adjusting type declarations or using Prisma-generated input types.
101
+ * - Using `?? undefined` to normalize nullable fields.
102
+ * - Applying correct relation handling (e.g., `connect` instead of direct
103
+ * foreign key assignment).
104
+ * - Ensuring `Date` fields use `.toISOString()` and branded types.
105
+ * - Include fallback or workaround plans if a direct fix is complex.
106
+ * - If no error is present, simply omit this section.
107
+ *
108
+ * This plan ensures the function will:
109
+ *
110
+ * - Respect the global architecture and coding conventions
111
+ * - Be safe, predictable, and aligned with upstream logic
20
112
  */
21
- functionName: string;
113
+ plan: string;
22
114
  /**
23
- * The raw TypeScript code string implementing the function.
24
- *
25
- * - The implementation must be valid TypeScript code.
26
- * - It should focus solely on the logic of the function.
27
- * - Import statements do **not** need to be included. They will be
28
- * automatically inserted by the system.
29
- * - Any unused imports will be automatically removed by eslint.
30
- * - Type annotations (e.g. for parameters and return types) should be omitted
31
- * if they can be inferred.
115
+ * ✏️ Phase 1: Draft code
116
+ *
117
+ * This is the initial drafting phase where you outline the basic skeleton
118
+ * of the function.
119
+ *
120
+ * - The function signature must correctly include `user`, `parameters`, and
121
+ * `body` arguments.
122
+ * - Design the main flow of business logic, such as DB fetches and early
123
+ * returns based on conditions.
124
+ * - Mark any incomplete or missing parts clearly with placeholders (e.g.,
125
+ * comments or temporary values).
126
+ *
127
+ * ⚠️ Import rules:
128
+ *
129
+ * - Do NOT add any new import statements manually.
130
+ * - All necessary imports are provided globally or by the system
131
+ * automatically.
132
+ * - Writing import statements directly is prohibited and may cause compile
133
+ * errors. If import errors occur, check your environment configuration.
134
+ *
135
+ * ✅ Requirements:
136
+ *
137
+ * - Avoid using the `any` type at all costs to ensure type safety.
138
+ * - Do NOT assign native `Date` objects directly; always convert dates using
139
+ * `.toISOString()` before assignment.
140
+ * - Maintain a single-function structure; avoid using classes.
141
+ */
142
+ /**
143
+ * 🔍 Phase 2: Review code
144
+ *
145
+ * A refined version of the draft with improved completeness.
146
+ *
147
+ * - Replace placeholder logic with real DTO-conformant operations.
148
+ * - Add error handling (`throw new Error(...)`) where necessary.
149
+ * - Begin resolving structural or type mismatches.
150
+ *
151
+ * ✅ Requirements:
152
+ *
153
+ * - Use `satisfies` to ensure DTO conformity.
154
+ * - Avoid unsafe `as` casts unless only for branding or literal narrowing.
155
+ * - Include `.toISOString()` for all date fields.
156
+ * - Ensure all object keys strictly conform to the expected type definitions.
157
+ */
158
+ review: string;
159
+ /**
160
+ * 🛠 Phase 3: With compiler feedback (optional)
161
+ *
162
+ * A correction pass that applies fixes for compile-time errors that arose
163
+ * during the review stage (if any).
164
+ *
165
+ * ✅ Must:
166
+ *
167
+ * - Resolve all TypeScript errors without using `as any`
168
+ * - Provide safe brand casting only if required (e.g., `as string &
169
+ * tags.Format<'uuid'>`)
170
+ */
171
+ withCompilerFeedback?: string;
172
+ /**
173
+ * ✅ Phase 4: Final implementation
174
+ *
175
+ * The complete and fully correct TypeScript function implementation.
176
+ *
177
+ * - Passes strict type checking without errors.
178
+ * - Uses only safe branding or literal type assertions.
179
+ * - Converts all Date values properly to ISO string format.
180
+ * - Follows DTO structures using `satisfies`.
181
+ * - Avoids any weak typing such as `any`, `as any`, or `satisfies any`.
182
+ * - Uses only allowed imports (e.g., from `src/api/structures` and
183
+ * `MyGlobal.prisma`).
184
+ *
185
+ * ⚠️ Prohibited Practices:
186
+ *
187
+ * - Do NOT add or modify import statements manually. Imports are handled
188
+ * automatically by the system.
189
+ * - Do NOT use `any`, `as any`, or `satisfies any` to bypass type checking.
190
+ * - Do NOT assign native `Date` objects directly; always convert them to ISO
191
+ * strings with `.toISOString()`.
192
+ * - Do NOT use unsafe type assertions except for safe branding or literal
193
+ * narrowing.
194
+ * - Do NOT write code outside the single async function structure (e.g., no
195
+ * classes or multiple functions).
196
+ * - Do NOT perform any input validation — assume all inputs are already
197
+ * validated.
198
+ * - Do NOT use dynamic import expressions (`import()`); all imports must be
199
+ * static.
200
+ * - Do NOT rely on DTO types for database update input; always use
201
+ * Prisma-generated input types.
32
202
  */
33
203
  implementationCode: string;
34
204
  }
@@ -0,0 +1,23 @@
1
+ import { AutoBeOpenApi, IAutoBeTypeScriptCompileResult } from "@autobe/interface";
2
+ import { IAutoBeRealizeCoderApplication } from "./IAutoBeRealizeCoderApplication";
3
+ import { FAILED } from "./IAutoBeRealizeFailedSymbol";
4
+ export declare namespace IAutoBeRealizeCompile {
5
+ interface Success {
6
+ type: "success";
7
+ op: AutoBeOpenApi.IOperation;
8
+ result: Pick<IAutoBeRealizeCoderApplication.RealizeCoderOutput, "filename" | "implementationCode">;
9
+ }
10
+ interface Fail {
11
+ type: "failed";
12
+ op: AutoBeOpenApi.IOperation;
13
+ result: FAILED;
14
+ }
15
+ type FileContentMap = Record<string, {
16
+ content: string;
17
+ result: "failed" | "success";
18
+ }>;
19
+ interface CompileDiagnostics {
20
+ total: IAutoBeTypeScriptCompileResult.IDiagnostic[];
21
+ current: IAutoBeTypeScriptCompileResult.IDiagnostic[];
22
+ }
23
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IAutoBeRealizeCompile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAutoBeRealizeCompile.js","sourceRoot":"","sources":["../../../../src/orchestrate/realize/structures/IAutoBeRealizeCompile.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export declare const FAILED: unique symbol;
2
+ export type FAILED = typeof FAILED;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FAILED = void 0;
4
+ exports.FAILED = Symbol("FAILED");
5
+ //# sourceMappingURL=IAutoBeRealizeFailedSymbol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAutoBeRealizeFailedSymbol.js","sourceRoot":"","sources":["../../../../src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { IAgenticaHistoryJson } from "@agentica/core";
2
+ import { IAutoBeTypeScriptCompileResult } from "@autobe/interface";
2
3
  import { AutoBeState } from "../../context/AutoBeState";
3
4
  import { IAutoBeTestScenarioArtifacts } from "../test/structures/IAutoBeTestScenarioArtifacts";
4
5
  import { RealizePlannerOutput } from "./orchestrateRealizePlanner";
5
- export declare const transformRealizeCoderHistories: (state: AutoBeState, props: RealizePlannerOutput, artifacts: IAutoBeTestScenarioArtifacts) => Array<IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage>;
6
+ export declare const transformRealizeCoderHistories: (state: AutoBeState, props: RealizePlannerOutput, artifacts: IAutoBeTestScenarioArtifacts, previous: string | null, total: IAutoBeTypeScriptCompileResult.IDiagnostic[], diagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[]) => Array<IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage>;