@autobe/agent 0.12.0 → 0.14.2

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 (65) hide show
  1. package/lib/AutoBeMockAgent.js +14 -12
  2. package/lib/AutoBeMockAgent.js.map +1 -1
  3. package/lib/constants/AutoBeSystemPromptConstant.d.ts +7 -9
  4. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  5. package/lib/factory/getAutoBeGenerated.js +11 -1
  6. package/lib/factory/getAutoBeGenerated.js.map +1 -1
  7. package/lib/index.mjs +409 -248
  8. package/lib/index.mjs.map +1 -1
  9. package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.js +2 -1
  10. package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.js.map +1 -1
  11. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +1 -1
  12. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
  13. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +1 -1
  14. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  15. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +107 -110
  16. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  17. package/lib/orchestrate/interface/transformInterfaceHistories.js +10 -0
  18. package/lib/orchestrate/interface/transformInterfaceHistories.js.map +1 -1
  19. package/lib/orchestrate/realize/orchestrateRealize.js +30 -8
  20. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
  21. package/lib/orchestrate/realize/{orchestrateRealizeDecorator.d.ts → orchestrateRealizeAuthorization.d.ts} +2 -2
  22. package/lib/orchestrate/realize/{orchestrateRealizeDecorator.js → orchestrateRealizeAuthorization.js} +104 -67
  23. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -0
  24. package/lib/orchestrate/realize/orchestrateRealizeCoder.js +51 -40
  25. package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -1
  26. package/lib/orchestrate/realize/orchestrateRealizePlanner.d.ts +11 -2
  27. package/lib/orchestrate/realize/orchestrateRealizePlanner.js +2 -1
  28. package/lib/orchestrate/realize/orchestrateRealizePlanner.js.map +1 -1
  29. package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +148 -17
  30. package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.d.ts +10 -2
  31. package/lib/orchestrate/realize/structures/IAutoBeRealizeDecoratorApplication.d.ts +4 -4
  32. package/lib/orchestrate/realize/transformRealizeCoderHistories.js +58 -11
  33. package/lib/orchestrate/realize/transformRealizeCoderHistories.js.map +1 -1
  34. package/lib/orchestrate/realize/transformRealizeDecoratorCorrectHistories.d.ts +2 -3
  35. package/lib/orchestrate/realize/transformRealizeDecoratorCorrectHistories.js +15 -2
  36. package/lib/orchestrate/realize/transformRealizeDecoratorCorrectHistories.js.map +1 -1
  37. package/lib/orchestrate/realize/utils/AuthorizationFileSystem.d.ts +5 -0
  38. package/lib/orchestrate/realize/utils/AuthorizationFileSystem.js +10 -0
  39. package/lib/orchestrate/realize/utils/AuthorizationFileSystem.js.map +1 -0
  40. package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +3 -0
  41. package/lib/orchestrate/realize/utils/replaceImportStatements.js +65 -0
  42. package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -0
  43. package/lib/orchestrate/realize/writeCodeUntilCompilePassed.d.ts +2 -3
  44. package/lib/orchestrate/realize/writeCodeUntilCompilePassed.js +45 -24
  45. package/lib/orchestrate/realize/writeCodeUntilCompilePassed.js.map +1 -1
  46. package/package.json +5 -5
  47. package/src/AutoBeMockAgent.ts +15 -13
  48. package/src/constants/AutoBeSystemPromptConstant.ts +7 -9
  49. package/src/factory/getAutoBeGenerated.ts +20 -5
  50. package/src/orchestrate/analyze/writeDocumentUntilReviewPassed.ts +6 -1
  51. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +26 -18
  52. package/src/orchestrate/interface/transformInterfaceHistories.ts +10 -0
  53. package/src/orchestrate/realize/orchestrateRealize.ts +32 -7
  54. package/src/orchestrate/realize/{orchestrateRealizeDecorator.ts → orchestrateRealizeAuthorization.ts} +90 -80
  55. package/src/orchestrate/realize/orchestrateRealizeCoder.ts +9 -30
  56. package/src/orchestrate/realize/orchestrateRealizePlanner.ts +13 -1
  57. package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +150 -17
  58. package/src/orchestrate/realize/structures/IAutoBeRealizeCompile.ts +13 -2
  59. package/src/orchestrate/realize/structures/IAutoBeRealizeDecoratorApplication.ts +4 -4
  60. package/src/orchestrate/realize/transformRealizeCoderHistories.ts +55 -8
  61. package/src/orchestrate/realize/transformRealizeDecoratorCorrectHistories.ts +23 -3
  62. package/src/orchestrate/realize/utils/AuthorizationFileSystem.ts +10 -0
  63. package/src/orchestrate/realize/utils/replaceImportStatements.ts +85 -0
  64. package/src/orchestrate/realize/writeCodeUntilCompilePassed.ts +58 -33
  65. package/lib/orchestrate/realize/orchestrateRealizeDecorator.js.map +0 -1
@@ -55,6 +55,7 @@ const enforceToolCall_1 = require("../../utils/enforceToolCall");
55
55
  const getTestScenarioArtifacts_1 = require("../test/compile/getTestScenarioArtifacts");
56
56
  const IAutoBeRealizeFailedSymbol_1 = require("./structures/IAutoBeRealizeFailedSymbol");
57
57
  const transformRealizeCoderHistories_1 = require("./transformRealizeCoderHistories");
58
+ const replaceImportStatements_1 = require("./utils/replaceImportStatements");
58
59
  /**
59
60
  * Generates a TypeScript function implementation based on the given plan.
60
61
  *
@@ -74,6 +75,7 @@ const transformRealizeCoderHistories_1 = require("./transformRealizeCoderHistori
74
75
  * @returns The generated function name and TypeScript code
75
76
  */
76
77
  const orchestrateRealizeCoder = (ctx, operation, props, previous, total, diagnostics) => __awaiter(void 0, void 0, void 0, function* () {
78
+ var _a;
77
79
  total;
78
80
  const artifacts = yield (0, getTestScenarioArtifacts_1.getTestScenarioArtifacts)(ctx, {
79
81
  endpoint: {
@@ -120,37 +122,12 @@ const orchestrateRealizeCoder = (ctx, operation, props, previous, total, diagnos
120
122
  if (pointer.value === null) {
121
123
  return IAutoBeRealizeFailedSymbol_1.FAILED;
122
124
  }
123
- pointer.value.implementationCode = yield replaceImportStatements(ctx)(pointer.value.implementationCode);
125
+ pointer.value.implementationCode = yield (0, replaceImportStatements_1.replaceImportStatements)(ctx)(pointer.value.implementationCode, (_a = props.decoratorEvent) === null || _a === void 0 ? void 0 : _a.payload.name);
126
+ pointer.value.implementationCode =
127
+ pointer.value.implementationCode.replaceAll("typia.tags.assert", "typia.assert");
124
128
  return Object.assign(Object.assign({}, pointer.value), { filename: `src/providers/${props.functionName}.ts` });
125
129
  });
126
130
  exports.orchestrateRealizeCoder = orchestrateRealizeCoder;
127
- function replaceImportStatements(ctx) {
128
- return function (code) {
129
- return __awaiter(this, void 0, void 0, function* () {
130
- const compiler = yield ctx.compiler();
131
- code = yield compiler.typescript.beautify(code);
132
- code = code
133
- .replaceAll('import { MyGlobal } from "../MyGlobal";', "")
134
- .replaceAll('import typia, { tags } from "typia";', "")
135
- .replaceAll('import { tags } from "typia";', "")
136
- .replaceAll('import { tags, typia } from "typia";', "")
137
- .replaceAll('import typia from "typia";', "")
138
- .replaceAll('import { Prisma } from "@prisma/client";', "")
139
- .replaceAll('import { jwtDecode } from "./jwtDecode"', "")
140
- .replaceAll('import { v4 } from "uuid"', "");
141
- code = [
142
- 'import { MyGlobal } from "../MyGlobal";',
143
- 'import typia, { tags } from "typia";',
144
- 'import { Prisma } from "@prisma/client";',
145
- 'import { jwtDecode } from "./jwtDecode";',
146
- 'import { v4 } from "uuid";',
147
- "",
148
- code,
149
- ].join("\n");
150
- return code;
151
- });
152
- };
153
- }
154
131
  function createApplication(props) {
155
132
  (0, assertSchemaModel_1.assertSchemaModel)(props.model);
156
133
  const application = collection[props.model];
@@ -195,30 +172,39 @@ const claude = {
195
172
  filename: {
196
173
  type: "string"
197
174
  },
175
+ errorAnalysis: {
176
+ description: "Error Analysis Phase (Optional)\n\n\uD83D\uDD0D Analyzes TypeScript compilation errors from previous attempts.\n\nThis field should contain a detailed analysis of any TypeScript errors\nencountered, with root cause identification and resolution strategies:\n\nCommon Error Patterns to Analyze:\n\n1. **\"Property does not exist\" (TS2353)**:\n\n - Root Cause: Using fields that don't exist in Prisma schema\n - Example: Using `deleted_at` when the field doesn't exist in the model\n - Resolution: Remove the non-existent field or use hard delete instead\n2. **\"Type 'void' is not assignable\" (TS2322)**:\n\n - Root Cause: Using `typia.assertGuard` instead of `typia.assert`\n - `assertGuard` returns void, `assert` returns the validated value\n - Resolution: Change `typia.assertGuard<T>()` to `typia.assert<T>()`\n3. **\"Type 'Date' is not assignable to type 'string &\n Format<'date-time'>'\"**:\n\n - Root Cause: Assigning native Date objects to string fields\n - Resolution: Use `toISOStringSafe(dateValue)` for all date conversions\n4. **Complex Prisma Type Errors**:\n\n - Root Cause: Nested operations with incompatible types\n - Resolution: Use separate queries and application-level joins\n\nAnalysis Format:\n\n- List each error with its TypeScript error code\n- Identify the root cause (schema mismatch, wrong function usage, etc.)\n- Provide specific resolution steps\n- Note any schema limitations discovered",
177
+ type: "string"
178
+ },
198
179
  plan: {
199
- 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; always convert all dates\n to ISO strings with `.toISOString()` and brand as `string &\n tags.Format<'date-time'>`. This rule applies throughout all phases.\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 all date fields use `.toISOString()` and proper branding.\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",
180
+ description: "Step 1.\n\n\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 follow MANDATORY SCHEMA-FIRST APPROACH:\n\n\uD83D\uDCCB STEP 1 - PRISMA SCHEMA VERIFICATION (MOST CRITICAL):\n\n- EXAMINE the actual Prisma schema model definition\n- LIST EVERY field that exists in the model with exact types\n- EXPLICITLY NOTE fields that DO NOT exist (e.g., \"Note: deleted_at field\n DOES NOT EXIST\")\n- Common assumption errors to avoid: `deleted_at`, `created_by`,\n `updated_by`, `is_deleted`, `is_active`\n\n\uD83D\uDCCB STEP 2 - FIELD INVENTORY:\n\n- List ONLY fields confirmed to exist in schema\n- Example: \"Verified fields in user model: id (String), email (String),\n created_at (DateTime), updated_at (DateTime)\"\n- Example: \"Fields that DO NOT exist: deleted_at, is_active, created_by\"\n\n\uD83D\uDCCB STEP 3 - FIELD ACCESS STRATEGY:\n\n- Plan which verified fields will be used in select, update, create\n operations\n- For complex operations with type errors, plan to use separate queries\n instead of nested operations\n\n\uD83D\uDCCB STEP 4 - TYPE COMPATIBILITY:\n\n- Plan DateTime to ISO string conversions using toISOStringSafe()\n- Plan handling of nullable vs required fields\n\n\uD83D\uDCCB STEP 5 - IMPLEMENTATION APPROACH:\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) using ONLY verified fields\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; always convert all dates\n using `toISOStringSafe()` and brand as `string &\n tags.Format<'date-time'>`. This rule applies throughout all phases.\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\uDD0D Feasibility Analysis Requirement:\n\n- Before generating any code, the agent **must analyze** whether the\n requested implementation is **feasible based on the given Prisma schema\n and DTO types**.\n- If required fields or relationships are **missing or incompatible**, the\n plan should explicitly state that the implementation is **not\n possible** with the current schema/DTO, and no code should be generated\n in later stages.\n- In such cases, only a detailed **comment in the `implementationCode`**\n should be returned explaining why the logic cannot be implemented.\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 all date fields use `.toISOString()` and proper branding.\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",
181
+ type: "string"
182
+ },
183
+ prisma_schemas: {
184
+ description: "Step 2.\n\nThe Prisma schema string that will be used to validate the implementation\nlogic in this file.\n\nYou must **explicitly specify only the relevant models and fields** from\nyour full schema that are used in this implementation. This ensures that\nyour logic is aligned with the expected database structure without\naccidentally introducing unrelated fields or models.\n\n\u26A0\uFE0F Important: The value of this field must be a valid Prisma schema\nstring containing only the models used in this code \u2014 not the entire\nschema.\n\nThis acts as a safeguard against:\n\n- Forgetting required fields used in this implementation\n- Including fields or models that are not actually used",
200
185
  type: "string"
201
186
  },
202
187
  draft_without_date_type: {
203
- description: "\u270F\uFE0F Phase 1: Draft code\n\nThis is the initial drafting phase where you outline the basic skeleton\nof the function.\n\n- The function signature must correctly include `user`, `parameters`, and\n `body` arguments.\n- Design the main flow of business logic, such as DB fetches and early\n returns based on conditions.\n- Mark any incomplete or missing parts clearly with placeholders (e.g.,\n comments or temporary values).\n\n\u26A0\uFE0F Import rules:\n\n- Do NOT add any new import statements manually.\n- All necessary imports are provided globally or by the system\n automatically.\n- Writing import statements directly is prohibited and may cause compile\n errors. If import errors occur, check your environment configuration.\n\n\u2705 Requirements:\n\n- Avoid using the `any` type at all costs to ensure type safety.\n- Do NOT assign native `Date` objects directly; always convert dates using\n `.toISOString()` before assignment and apply proper branding.\n- Maintain a single-function structure; avoid using classes.",
188
+ description: "Step 3.\n\nDraft WITHOUT using native Date type.\n\nThis is the initial drafting phase where you outline the basic skeleton\nof the function. CRITICAL: This draft must NEVER use the native Date\ntype.\n\n- The function signature must correctly include `user`, `parameters`, and\n `body` arguments.\n- Design the main flow of business logic, such as DB fetches and early\n returns based on conditions.\n- Mark any incomplete or missing parts clearly with placeholders (e.g.,\n comments or temporary values).\n\n\u26A0\uFE0F Import rules:\n\n- Do NOT add any new import statements manually.\n- All necessary imports are provided globally or by the system\n automatically.\n- Writing import statements directly is prohibited and may cause compile\n errors. If import errors occur, check your environment configuration.\n\n\u2705 Requirements:\n\n- Avoid using the `any` type at all costs to ensure type safety.\n- NEVER declare variables with `: Date` type\n- ALWAYS use `string & tags.Format<'date-time'>` for date values\n- Use `toISOStringSafe(new Date())` for current timestamps\n- Maintain a single-function structure; avoid using classes.",
204
189
  type: "string"
205
190
  },
206
191
  review: {
207
- 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.",
192
+ description: "Step 4.\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- Use `toISOStringSafe()` for all date conversions (NOT `.toISOString()`).\n- Ensure all object keys strictly conform to the expected type definitions.",
208
193
  type: "string"
209
194
  },
210
195
  withCompilerFeedback: {
211
- 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- Only include this field if TypeScript errors are detected in the Review\n phase.\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'>`).",
196
+ description: "\uD83D\uDEE0 Phase 4-2: 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- Only include this field if TypeScript errors are detected in the Review\n phase.\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'>`).",
212
197
  type: "string"
213
198
  },
214
199
  implementationCode: {
215
- 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.",
200
+ description: "Step 5.\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 using `toISOStringSafe()`.\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 `../api/structures` and\n `MyGlobal.prisma`).\n- NEVER creates intermediate variables for Prisma operations.\n\n\u26A0\uFE0F Fallback Behavior:\n\n- If the `plan` phase explicitly determines that the requested logic is\n **not feasible** due to mismatches or limitations in the provided\n Prisma schema and DTO types:\n\n - The implementation must still return a syntactically valid function.\n - In such cases, return mock data using `typia.random<T>()` wrapped in the\n correct structure, along with a comment explaining the limitation.\n\n Example fallback:\n\n```ts\n // \u26A0\uFE0F Cannot implement logic due to missing relation between A and B\n export async function someFunction(...) {\n return typia.random<IReturn>(); // mocked output\n }\n```\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 using\n `toISOStringSafe()`.\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 use Prisma-generated input types; always use types from\n `../api/structures`.\n- Do NOT use `Object.prototype.hasOwnProperty.call()` for field checks.\n- Do NOT escape newlines or quotes in the implementation string (e.g., no\n `\\\\n` or `\\\"`); use a properly formatted template literal with actual\n line breaks instead.",
216
201
  type: "string"
217
202
  }
218
203
  },
219
204
  required: [
220
205
  "filename",
221
206
  "plan",
207
+ "prisma_schemas",
222
208
  "draft_without_date_type",
223
209
  "review",
224
210
  "implementationCode"
@@ -226,7 +212,7 @@ const claude = {
226
212
  }
227
213
  }
228
214
  },
229
- 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.draft_without_date_type && "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, {
215
+ validate: (() => { const _io0 = input => "object" === typeof input.output && null !== input.output && _io1(input.output); const _io1 = input => "string" === typeof input.filename && (undefined === input.errorAnalysis || "string" === typeof input.errorAnalysis) && "string" === typeof input.plan && "string" === typeof input.prisma_schemas && "string" === typeof input.draft_without_date_type && "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, {
230
216
  path: _path + ".output",
231
217
  expected: "IAutoBeRealizeCoderApplication.RealizeCoderOutput",
232
218
  value: input.output
@@ -238,10 +224,18 @@ const claude = {
238
224
  path: _path + ".filename",
239
225
  expected: "string",
240
226
  value: input.filename
227
+ }), undefined === input.errorAnalysis || "string" === typeof input.errorAnalysis || _report(_exceptionable, {
228
+ path: _path + ".errorAnalysis",
229
+ expected: "(string | undefined)",
230
+ value: input.errorAnalysis
241
231
  }), "string" === typeof input.plan || _report(_exceptionable, {
242
232
  path: _path + ".plan",
243
233
  expected: "string",
244
234
  value: input.plan
235
+ }), "string" === typeof input.prisma_schemas || _report(_exceptionable, {
236
+ path: _path + ".prisma_schemas",
237
+ expected: "string",
238
+ value: input.prisma_schemas
245
239
  }), "string" === typeof input.draft_without_date_type || _report(_exceptionable, {
246
240
  path: _path + ".draft_without_date_type",
247
241
  expected: "string",
@@ -320,30 +314,39 @@ const collection = {
320
314
  filename: {
321
315
  type: "string"
322
316
  },
317
+ errorAnalysis: {
318
+ description: "Error Analysis Phase (Optional)\n\n\uD83D\uDD0D Analyzes TypeScript compilation errors from previous attempts.\n\nThis field should contain a detailed analysis of any TypeScript errors\nencountered, with root cause identification and resolution strategies:\n\nCommon Error Patterns to Analyze:\n\n1. **\"Property does not exist\" (TS2353)**:\n\n - Root Cause: Using fields that don't exist in Prisma schema\n - Example: Using `deleted_at` when the field doesn't exist in the model\n - Resolution: Remove the non-existent field or use hard delete instead\n2. **\"Type 'void' is not assignable\" (TS2322)**:\n\n - Root Cause: Using `typia.assertGuard` instead of `typia.assert`\n - `assertGuard` returns void, `assert` returns the validated value\n - Resolution: Change `typia.assertGuard<T>()` to `typia.assert<T>()`\n3. **\"Type 'Date' is not assignable to type 'string &\n Format<'date-time'>'\"**:\n\n - Root Cause: Assigning native Date objects to string fields\n - Resolution: Use `toISOStringSafe(dateValue)` for all date conversions\n4. **Complex Prisma Type Errors**:\n\n - Root Cause: Nested operations with incompatible types\n - Resolution: Use separate queries and application-level joins\n\nAnalysis Format:\n\n- List each error with its TypeScript error code\n- Identify the root cause (schema mismatch, wrong function usage, etc.)\n- Provide specific resolution steps\n- Note any schema limitations discovered",
319
+ type: "string"
320
+ },
323
321
  plan: {
324
- 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; always convert all dates\n to ISO strings with `.toISOString()` and brand as `string &\n tags.Format<'date-time'>`. This rule applies throughout all phases.\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 all date fields use `.toISOString()` and proper branding.\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",
322
+ description: "Step 1.\n\n\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 follow MANDATORY SCHEMA-FIRST APPROACH:\n\n\uD83D\uDCCB STEP 1 - PRISMA SCHEMA VERIFICATION (MOST CRITICAL):\n\n- EXAMINE the actual Prisma schema model definition\n- LIST EVERY field that exists in the model with exact types\n- EXPLICITLY NOTE fields that DO NOT exist (e.g., \"Note: deleted_at field\n DOES NOT EXIST\")\n- Common assumption errors to avoid: `deleted_at`, `created_by`,\n `updated_by`, `is_deleted`, `is_active`\n\n\uD83D\uDCCB STEP 2 - FIELD INVENTORY:\n\n- List ONLY fields confirmed to exist in schema\n- Example: \"Verified fields in user model: id (String), email (String),\n created_at (DateTime), updated_at (DateTime)\"\n- Example: \"Fields that DO NOT exist: deleted_at, is_active, created_by\"\n\n\uD83D\uDCCB STEP 3 - FIELD ACCESS STRATEGY:\n\n- Plan which verified fields will be used in select, update, create\n operations\n- For complex operations with type errors, plan to use separate queries\n instead of nested operations\n\n\uD83D\uDCCB STEP 4 - TYPE COMPATIBILITY:\n\n- Plan DateTime to ISO string conversions using toISOStringSafe()\n- Plan handling of nullable vs required fields\n\n\uD83D\uDCCB STEP 5 - IMPLEMENTATION APPROACH:\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) using ONLY verified fields\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; always convert all dates\n using `toISOStringSafe()` and brand as `string &\n tags.Format<'date-time'>`. This rule applies throughout all phases.\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\uDD0D Feasibility Analysis Requirement:\n\n- Before generating any code, the agent **must analyze** whether the\n requested implementation is **feasible based on the given Prisma schema\n and DTO types**.\n- If required fields or relationships are **missing or incompatible**, the\n plan should explicitly state that the implementation is **not\n possible** with the current schema/DTO, and no code should be generated\n in later stages.\n- In such cases, only a detailed **comment in the `implementationCode`**\n should be returned explaining why the logic cannot be implemented.\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 all date fields use `.toISOString()` and proper branding.\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",
323
+ type: "string"
324
+ },
325
+ prisma_schemas: {
326
+ description: "Step 2.\n\nThe Prisma schema string that will be used to validate the implementation\nlogic in this file.\n\nYou must **explicitly specify only the relevant models and fields** from\nyour full schema that are used in this implementation. This ensures that\nyour logic is aligned with the expected database structure without\naccidentally introducing unrelated fields or models.\n\n\u26A0\uFE0F Important: The value of this field must be a valid Prisma schema\nstring containing only the models used in this code \u2014 not the entire\nschema.\n\nThis acts as a safeguard against:\n\n- Forgetting required fields used in this implementation\n- Including fields or models that are not actually used",
325
327
  type: "string"
326
328
  },
327
329
  draft_without_date_type: {
328
- description: "\u270F\uFE0F Phase 1: Draft code\n\nThis is the initial drafting phase where you outline the basic skeleton\nof the function.\n\n- The function signature must correctly include `user`, `parameters`, and\n `body` arguments.\n- Design the main flow of business logic, such as DB fetches and early\n returns based on conditions.\n- Mark any incomplete or missing parts clearly with placeholders (e.g.,\n comments or temporary values).\n\n\u26A0\uFE0F Import rules:\n\n- Do NOT add any new import statements manually.\n- All necessary imports are provided globally or by the system\n automatically.\n- Writing import statements directly is prohibited and may cause compile\n errors. If import errors occur, check your environment configuration.\n\n\u2705 Requirements:\n\n- Avoid using the `any` type at all costs to ensure type safety.\n- Do NOT assign native `Date` objects directly; always convert dates using\n `.toISOString()` before assignment and apply proper branding.\n- Maintain a single-function structure; avoid using classes.",
330
+ description: "Step 3.\n\nDraft WITHOUT using native Date type.\n\nThis is the initial drafting phase where you outline the basic skeleton\nof the function. CRITICAL: This draft must NEVER use the native Date\ntype.\n\n- The function signature must correctly include `user`, `parameters`, and\n `body` arguments.\n- Design the main flow of business logic, such as DB fetches and early\n returns based on conditions.\n- Mark any incomplete or missing parts clearly with placeholders (e.g.,\n comments or temporary values).\n\n\u26A0\uFE0F Import rules:\n\n- Do NOT add any new import statements manually.\n- All necessary imports are provided globally or by the system\n automatically.\n- Writing import statements directly is prohibited and may cause compile\n errors. If import errors occur, check your environment configuration.\n\n\u2705 Requirements:\n\n- Avoid using the `any` type at all costs to ensure type safety.\n- NEVER declare variables with `: Date` type\n- ALWAYS use `string & tags.Format<'date-time'>` for date values\n- Use `toISOStringSafe(new Date())` for current timestamps\n- Maintain a single-function structure; avoid using classes.",
329
331
  type: "string"
330
332
  },
331
333
  review: {
332
- 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.",
334
+ description: "Step 4.\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- Use `toISOStringSafe()` for all date conversions (NOT `.toISOString()`).\n- Ensure all object keys strictly conform to the expected type definitions.",
333
335
  type: "string"
334
336
  },
335
337
  withCompilerFeedback: {
336
- 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- Only include this field if TypeScript errors are detected in the Review\n phase.\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'>`).",
338
+ description: "\uD83D\uDEE0 Phase 4-2: 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- Only include this field if TypeScript errors are detected in the Review\n phase.\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'>`).",
337
339
  type: "string"
338
340
  },
339
341
  implementationCode: {
340
- 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.",
342
+ description: "Step 5.\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 using `toISOStringSafe()`.\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 `../api/structures` and\n `MyGlobal.prisma`).\n- NEVER creates intermediate variables for Prisma operations.\n\n\u26A0\uFE0F Fallback Behavior:\n\n- If the `plan` phase explicitly determines that the requested logic is\n **not feasible** due to mismatches or limitations in the provided\n Prisma schema and DTO types:\n\n - The implementation must still return a syntactically valid function.\n - In such cases, return mock data using `typia.random<T>()` wrapped in the\n correct structure, along with a comment explaining the limitation.\n\n Example fallback:\n\n```ts\n // \u26A0\uFE0F Cannot implement logic due to missing relation between A and B\n export async function someFunction(...) {\n return typia.random<IReturn>(); // mocked output\n }\n```\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 using\n `toISOStringSafe()`.\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 use Prisma-generated input types; always use types from\n `../api/structures`.\n- Do NOT use `Object.prototype.hasOwnProperty.call()` for field checks.\n- Do NOT escape newlines or quotes in the implementation string (e.g., no\n `\\\\n` or `\\\"`); use a properly formatted template literal with actual\n line breaks instead.",
341
343
  type: "string"
342
344
  }
343
345
  },
344
346
  required: [
345
347
  "filename",
346
348
  "plan",
349
+ "prisma_schemas",
347
350
  "draft_without_date_type",
348
351
  "review",
349
352
  "implementationCode"
@@ -351,7 +354,7 @@ const collection = {
351
354
  }
352
355
  }
353
356
  },
354
- 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.draft_without_date_type && "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, {
357
+ validate: (() => { const _io0 = input => "object" === typeof input.output && null !== input.output && _io1(input.output); const _io1 = input => "string" === typeof input.filename && (undefined === input.errorAnalysis || "string" === typeof input.errorAnalysis) && "string" === typeof input.plan && "string" === typeof input.prisma_schemas && "string" === typeof input.draft_without_date_type && "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, {
355
358
  path: _path + ".output",
356
359
  expected: "IAutoBeRealizeCoderApplication.RealizeCoderOutput",
357
360
  value: input.output
@@ -363,10 +366,18 @@ const collection = {
363
366
  path: _path + ".filename",
364
367
  expected: "string",
365
368
  value: input.filename
369
+ }), undefined === input.errorAnalysis || "string" === typeof input.errorAnalysis || _report(_exceptionable, {
370
+ path: _path + ".errorAnalysis",
371
+ expected: "(string | undefined)",
372
+ value: input.errorAnalysis
366
373
  }), "string" === typeof input.plan || _report(_exceptionable, {
367
374
  path: _path + ".plan",
368
375
  expected: "string",
369
376
  value: input.plan
377
+ }), "string" === typeof input.prisma_schemas || _report(_exceptionable, {
378
+ path: _path + ".prisma_schemas",
379
+ expected: "string",
380
+ value: input.prisma_schemas
370
381
  }), "string" === typeof input.draft_without_date_type || _report(_exceptionable, {
371
382
  path: _path + ".draft_without_date_type",
372
383
  expected: "string",
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrateRealizeCoder.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizeCoder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAoE;AAQpE,kDAA0B;AAG1B,uEAAoE;AACpE,2DAGkC;AAClC,iEAA8D;AAC9D,uFAAoF;AAIpF,wFAAiE;AACjE,qFAAkF;AAElF;;;;;;;;;;;;;;;;;GAiBG;AACI,MAAM,uBAAuB,GAAG,CACrC,GAAyB,EACzB,SAAmC,EACnC,KAA2B,EAC3B,QAAuB,EACvB,KAAmD,EACnD,WAAyD,EAOzD,EAAE;IACF,KAAK,CAAC;IACN,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,OAA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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
+ {"version":3,"file":"orchestrateRealizeCoder.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizeCoder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAoE;AAOpE,kDAA0B;AAG1B,uEAAoE;AACpE,2DAGkC;AAClC,iEAA8D;AAC9D,uFAAoF;AAIpF,wFAAiE;AACjE,qFAAkF;AAClF,6EAA0E;AAE1E;;;;;;;;;;;;;;;;;GAiBG;AACI,MAAM,uBAAuB,GAAG,CACrC,GAAyB,EACzB,SAAmC,EACnC,KAA2B,EAC3B,QAAuB,EACvB,KAAmD,EACnD,WAAyD,EAOzD,EAAE;;IACF,KAAK,CAAC;IAEN,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,MAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIJ;IACH,MAAM;IACN,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;CACd,CAAC"}
@@ -1,4 +1,4 @@
1
- import { AutoBeOpenApi } from "@autobe/interface";
1
+ import { AutoBeOpenApi, AutoBeRealizeAuthorization } from "@autobe/interface";
2
2
  import { ILlmSchema } from "@samchon/openapi";
3
3
  import { AutoBeContext } from "../../context/AutoBeContext";
4
4
  export interface RealizePlannerOutput {
@@ -57,6 +57,15 @@ export interface RealizePlannerOutput {
57
57
  * conditions. Used as a basis for TDD-style automated test generation.
58
58
  */
59
59
  testScenarios: string[];
60
+ /**
61
+ * Optional decorator event for customizing code generation behavior.
62
+ *
63
+ * Provides additional metadata or instructions that can modify how the
64
+ * function implementation is generated. Can include custom annotations,
65
+ * middleware configurations, or special handling directives that affect the
66
+ * final code output.
67
+ */
68
+ decoratorEvent?: AutoBeRealizeAuthorization;
60
69
  }
61
70
  /**
62
71
  * Generates a planning result that defines what kind of function should be
@@ -77,4 +86,4 @@ export interface RealizePlannerOutput {
77
86
  * @returns A planning object containing all structural information needed to
78
87
  * generate the function
79
88
  */
80
- export declare const orchestrateRealizePlanner: <Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, operation: AutoBeOpenApi.IOperation) => Promise<RealizePlannerOutput>;
89
+ export declare const orchestrateRealizePlanner: <Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, operation: AutoBeOpenApi.IOperation, authorization?: AutoBeRealizeAuthorization) => Promise<RealizePlannerOutput>;
@@ -29,7 +29,7 @@ exports.orchestrateRealizePlanner = void 0;
29
29
  * @returns A planning object containing all structural information needed to
30
30
  * generate the function
31
31
  */
32
- const orchestrateRealizePlanner = (ctx, operation) => __awaiter(void 0, void 0, void 0, function* () {
32
+ const orchestrateRealizePlanner = (ctx, operation, authorization) => __awaiter(void 0, void 0, void 0, function* () {
33
33
  var _a, _b;
34
34
  const testScenarios = (_b = (_a = ctx
35
35
  .state()
@@ -47,6 +47,7 @@ const orchestrateRealizePlanner = (ctx, operation) => __awaiter(void 0, void 0,
47
47
  .replaceAll("-", "_")
48
48
  .replaceAll("{", "$")
49
49
  .replaceAll("}", "")}`,
50
+ decoratorEvent: authorization,
50
51
  };
51
52
  });
52
53
  exports.orchestrateRealizePlanner = orchestrateRealizePlanner;
@@ -1 +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"}
1
+ {"version":3,"file":"orchestrateRealizePlanner.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizePlanner.ts"],"names":[],"mappings":";;;;;;;;;;;;AA+EA;;;;;;;;;;;;;;;;;;GAkBG;AACI,MAAM,yBAAyB,GAAG,CACvC,GAAyB,EACzB,SAAmC,EACnC,aAA0C,EACX,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;QACxB,cAAc,EAAE,aAAa;KACC,CAAC;AACnC,CAAC,CAAA,CAAC;AA5BW,QAAA,yBAAyB,6BA4BpC"}
@@ -31,18 +31,88 @@ export declare namespace IAutoBeRealizeCoderApplication {
31
31
  /** @ignore */
32
32
  filename: string;
33
33
  /**
34
+ * Error Analysis Phase (Optional)
35
+ *
36
+ * 🔍 Analyzes TypeScript compilation errors from previous attempts.
37
+ *
38
+ * This field should contain a detailed analysis of any TypeScript errors
39
+ * encountered, with root cause identification and resolution strategies:
40
+ *
41
+ * Common Error Patterns to Analyze:
42
+ *
43
+ * 1. **"Property does not exist" (TS2353)**:
44
+ *
45
+ * - Root Cause: Using fields that don't exist in Prisma schema
46
+ * - Example: Using `deleted_at` when the field doesn't exist in the model
47
+ * - Resolution: Remove the non-existent field or use hard delete instead
48
+ * 2. **"Type 'void' is not assignable" (TS2322)**:
49
+ *
50
+ * - Root Cause: Using `typia.assertGuard` instead of `typia.assert`
51
+ * - `assertGuard` returns void, `assert` returns the validated value
52
+ * - Resolution: Change `typia.assertGuard<T>()` to `typia.assert<T>()`
53
+ * 3. **"Type 'Date' is not assignable to type 'string &
54
+ * Format<'date-time'>'"**:
55
+ *
56
+ * - Root Cause: Assigning native Date objects to string fields
57
+ * - Resolution: Use `toISOStringSafe(dateValue)` for all date conversions
58
+ * 4. **Complex Prisma Type Errors**:
59
+ *
60
+ * - Root Cause: Nested operations with incompatible types
61
+ * - Resolution: Use separate queries and application-level joins
62
+ *
63
+ * Analysis Format:
64
+ *
65
+ * - List each error with its TypeScript error code
66
+ * - Identify the root cause (schema mismatch, wrong function usage, etc.)
67
+ * - Provide specific resolution steps
68
+ * - Note any schema limitations discovered
69
+ */
70
+ errorAnalysis?: string;
71
+ /**
72
+ * Step 1.
73
+ *
34
74
  * 🧠 Provider Function Implementation Plan
35
75
  *
36
76
  * This field outlines the strategic plan for implementing the provider
37
77
  * function according to the Realize Coder Agent specification. Before
38
78
  * writing the actual code, think through the logic and structure.
39
79
  *
40
- * The plan must consider:
80
+ * The plan MUST follow MANDATORY SCHEMA-FIRST APPROACH:
81
+ *
82
+ * 📋 STEP 1 - PRISMA SCHEMA VERIFICATION (MOST CRITICAL):
83
+ *
84
+ * - EXAMINE the actual Prisma schema model definition
85
+ * - LIST EVERY field that exists in the model with exact types
86
+ * - EXPLICITLY NOTE fields that DO NOT exist (e.g., "Note: deleted_at field
87
+ * DOES NOT EXIST")
88
+ * - Common assumption errors to avoid: `deleted_at`, `created_by`,
89
+ * `updated_by`, `is_deleted`, `is_active`
90
+ *
91
+ * 📋 STEP 2 - FIELD INVENTORY:
92
+ *
93
+ * - List ONLY fields confirmed to exist in schema
94
+ * - Example: "Verified fields in user model: id (String), email (String),
95
+ * created_at (DateTime), updated_at (DateTime)"
96
+ * - Example: "Fields that DO NOT exist: deleted_at, is_active, created_by"
97
+ *
98
+ * 📋 STEP 3 - FIELD ACCESS STRATEGY:
99
+ *
100
+ * - Plan which verified fields will be used in select, update, create
101
+ * operations
102
+ * - For complex operations with type errors, plan to use separate queries
103
+ * instead of nested operations
104
+ *
105
+ * 📋 STEP 4 - TYPE COMPATIBILITY:
106
+ *
107
+ * - Plan DateTime to ISO string conversions using toISOStringSafe()
108
+ * - Plan handling of nullable vs required fields
109
+ *
110
+ * 📋 STEP 5 - IMPLEMENTATION APPROACH:
41
111
  *
42
112
  * - 🧩 Required business entities (e.g., users, posts, logs) and their
43
113
  * relationships
44
114
  * - 🛠 Operations needed to fulfill the business scenario (e.g., fetch,
45
- * create, update)
115
+ * create, update) using ONLY verified fields
46
116
  * - 🔄 Data dependencies between steps (e.g., use userId to fetch related
47
117
  * data)
48
118
  * - ✅ Validation points (based on business rules, not field presence)
@@ -64,7 +134,7 @@ export declare namespace IAutoBeRealizeCoderApplication {
64
134
  * ⚠️ TypeScript-specific considerations:
65
135
  *
66
136
  * - Do **not** use native `Date` objects directly; always convert all dates
67
- * to ISO strings with `.toISOString()` and brand as `string &
137
+ * using `toISOStringSafe()` and brand as `string &
68
138
  * tags.Format<'date-time'>`. This rule applies throughout all phases.
69
139
  * - Prefer `satisfies` for DTO conformance instead of unsafe `as` casts
70
140
  * - Avoid weak typing such as `any`, `as any`, or `satisfies any`
@@ -88,6 +158,18 @@ export declare namespace IAutoBeRealizeCoderApplication {
88
158
  * }
89
159
  * ```
90
160
  *
161
+ * 🔍 Feasibility Analysis Requirement:
162
+ *
163
+ * - Before generating any code, the agent **must analyze** whether the
164
+ * requested implementation is **feasible based on the given Prisma schema
165
+ * and DTO types**.
166
+ * - If required fields or relationships are **missing or incompatible**, the
167
+ * plan should explicitly state that the implementation is **not
168
+ * possible** with the current schema/DTO, and no code should be generated
169
+ * in later stages.
170
+ * - In such cases, only a detailed **comment in the `implementationCode`**
171
+ * should be returned explaining why the logic cannot be implemented.
172
+ *
91
173
  * 🔥 Error Handling Plan:
92
174
  *
93
175
  * If an error is expected or encountered during implementation:
@@ -112,10 +194,34 @@ export declare namespace IAutoBeRealizeCoderApplication {
112
194
  */
113
195
  plan: string;
114
196
  /**
115
- * ✏️ Phase 1: Draft code
197
+ * Step 2.
198
+ *
199
+ * The Prisma schema string that will be used to validate the implementation
200
+ * logic in this file.
201
+ *
202
+ * You must **explicitly specify only the relevant models and fields** from
203
+ * your full schema that are used in this implementation. This ensures that
204
+ * your logic is aligned with the expected database structure without
205
+ * accidentally introducing unrelated fields or models.
206
+ *
207
+ * ⚠️ Important: The value of this field must be a valid Prisma schema
208
+ * string containing only the models used in this code — not the entire
209
+ * schema.
210
+ *
211
+ * This acts as a safeguard against:
212
+ *
213
+ * - Forgetting required fields used in this implementation
214
+ * - Including fields or models that are not actually used
215
+ */
216
+ prisma_schemas: string;
217
+ /**
218
+ * Step 3.
219
+ *
220
+ * Draft WITHOUT using native Date type.
116
221
  *
117
222
  * This is the initial drafting phase where you outline the basic skeleton
118
- * of the function.
223
+ * of the function. CRITICAL: This draft must NEVER use the native Date
224
+ * type.
119
225
  *
120
226
  * - The function signature must correctly include `user`, `parameters`, and
121
227
  * `body` arguments.
@@ -135,13 +241,14 @@ export declare namespace IAutoBeRealizeCoderApplication {
135
241
  * ✅ Requirements:
136
242
  *
137
243
  * - 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 and apply proper branding.
244
+ * - NEVER declare variables with `: Date` type
245
+ * - ALWAYS use `string & tags.Format<'date-time'>` for date values
246
+ * - Use `toISOStringSafe(new Date())` for current timestamps
140
247
  * - Maintain a single-function structure; avoid using classes.
141
248
  */
142
249
  draft_without_date_type: string;
143
250
  /**
144
- * 🔍 Phase 2: Review code
251
+ * Step 4.
145
252
  *
146
253
  * A refined version of the draft with improved completeness.
147
254
  *
@@ -153,12 +260,12 @@ export declare namespace IAutoBeRealizeCoderApplication {
153
260
  *
154
261
  * - Use `satisfies` to ensure DTO conformity.
155
262
  * - Avoid unsafe `as` casts unless only for branding or literal narrowing.
156
- * - Include `.toISOString()` for all date fields.
263
+ * - Use `toISOStringSafe()` for all date conversions (NOT `.toISOString()`).
157
264
  * - Ensure all object keys strictly conform to the expected type definitions.
158
265
  */
159
266
  review: string;
160
267
  /**
161
- * 🛠 Phase 3: With compiler feedback (optional)
268
+ * 🛠 Phase 4-2: With compiler feedback (optional)
162
269
  *
163
270
  * A correction pass that applies fixes for compile-time errors that arose
164
271
  * during the review stage (if any).
@@ -173,25 +280,45 @@ export declare namespace IAutoBeRealizeCoderApplication {
173
280
  */
174
281
  withCompilerFeedback?: string;
175
282
  /**
176
- * Phase 4: Final implementation
283
+ * Step 5.
177
284
  *
178
285
  * The complete and fully correct TypeScript function implementation.
179
286
  *
180
287
  * - Passes strict type checking without errors.
181
288
  * - Uses only safe branding or literal type assertions.
182
- * - Converts all date values properly to ISO string format.
289
+ * - Converts all date values properly using `toISOStringSafe()`.
183
290
  * - Follows DTO structures using `satisfies`.
184
291
  * - Avoids any weak typing such as `any`, `as any`, or `satisfies any`.
185
- * - Uses only allowed imports (e.g., from `src/api/structures` and
292
+ * - Uses only allowed imports (e.g., from `../api/structures` and
186
293
  * `MyGlobal.prisma`).
294
+ * - NEVER creates intermediate variables for Prisma operations.
295
+ *
296
+ * ⚠️ Fallback Behavior:
297
+ *
298
+ * - If the `plan` phase explicitly determines that the requested logic is
299
+ * **not feasible** due to mismatches or limitations in the provided
300
+ * Prisma schema and DTO types:
301
+ *
302
+ * - The implementation must still return a syntactically valid function.
303
+ * - In such cases, return mock data using `typia.random<T>()` wrapped in the
304
+ * correct structure, along with a comment explaining the limitation.
305
+ *
306
+ * Example fallback:
307
+ *
308
+ * ```ts
309
+ * // ⚠️ Cannot implement logic due to missing relation between A and B
310
+ * export async function someFunction(...) {
311
+ * return typia.random<IReturn>(); // mocked output
312
+ * }
313
+ * ```
187
314
  *
188
315
  * ⚠️ Prohibited Practices:
189
316
  *
190
317
  * - Do NOT add or modify import statements manually. Imports are handled
191
318
  * automatically by the system.
192
319
  * - Do NOT use `any`, `as any`, or `satisfies any` to bypass type checking.
193
- * - Do NOT assign native `Date` objects directly; always convert them to ISO
194
- * strings with `.toISOString()`.
320
+ * - Do NOT assign native `Date` objects directly; always convert them using
321
+ * `toISOStringSafe()`.
195
322
  * - Do NOT use unsafe type assertions except for safe branding or literal
196
323
  * narrowing.
197
324
  * - Do NOT write code outside the single async function structure (e.g., no
@@ -200,8 +327,12 @@ export declare namespace IAutoBeRealizeCoderApplication {
200
327
  * validated.
201
328
  * - Do NOT use dynamic import expressions (`import()`); all imports must be
202
329
  * static.
203
- * - Do NOT rely on DTO types for database update input; always use
204
- * Prisma-generated input types.
330
+ * - Do NOT use Prisma-generated input types; always use types from
331
+ * `../api/structures`.
332
+ * - Do NOT use `Object.prototype.hasOwnProperty.call()` for field checks.
333
+ * - Do NOT escape newlines or quotes in the implementation string (e.g., no
334
+ * `\\n` or `\"`); use a properly formatted template literal with actual
335
+ * line breaks instead.
205
336
  */
206
337
  implementationCode: string;
207
338
  }