@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.
- package/lib/AutoBeAgent.js +13 -46
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +11 -6
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/context/AutoBeContext.d.ts +3 -2
- package/lib/factory/getAutoBeGenerated.d.ts +5 -0
- package/lib/factory/getAutoBeGenerated.js +307 -0
- package/lib/factory/getAutoBeGenerated.js.map +1 -0
- package/lib/index.mjs +1652 -1402
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.d.ts +2 -7
- package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.js +1 -9
- package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.js.map +1 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeRole.d.ts +13 -0
- package/lib/orchestrate/analyze/AutoBeAnalyzeRole.js +3 -0
- package/lib/orchestrate/analyze/AutoBeAnalyzeRole.js.map +1 -0
- package/lib/orchestrate/analyze/orchestrateAnalyze.d.ts +0 -25
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +22 -420
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeComposer.d.ts +6 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeComposer.js +561 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeComposer.js.map +1 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.d.ts +6 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js +41 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js.map +1 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +14 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +468 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -0
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeComposerApplication.d.ts +68 -0
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeComposerApplication.js +3 -0
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeComposerApplication.js.map +1 -0
- package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.d.ts +5 -0
- package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.js +27 -0
- package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.js.map +1 -0
- package/lib/orchestrate/analyze/transformAnalyzeWriteHistories.d.ts +12 -0
- package/lib/orchestrate/analyze/transformAnalyzeWriteHistories.js +78 -0
- package/lib/orchestrate/analyze/transformAnalyzeWriteHistories.js.map +1 -0
- package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.d.ts +6 -0
- package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.js +58 -0
- package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterface.js +0 -2
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +17 -137
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +92 -141
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.js +9 -5
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +54 -25
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +4 -3
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/{orchestratePrismaSchema.d.ts → orchestratePrismaSchemas.d.ts} +2 -4
- package/lib/orchestrate/prisma/{orchestratePrismaSchema.js → orchestratePrismaSchemas.js} +269 -203
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -0
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +1 -1
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaCorrectHistories.js +1 -1
- package/lib/orchestrate/prisma/transformPrismaHistories.js +1 -1
- package/lib/orchestrate/prisma/transformPrismaHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.d.ts +2 -6
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +24 -32
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/orchestrate/realize/RealizePipe.d.ts +5 -0
- package/lib/orchestrate/realize/RealizePipe.js +14 -0
- package/lib/orchestrate/realize/RealizePipe.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealize.d.ts +0 -6
- package/lib/orchestrate/realize/orchestrateRealize.js +6 -43
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCoder.d.ts +3 -3
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js +124 -59
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +188 -18
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.d.ts +23 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.js +3 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.js.map +1 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.d.ts +2 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.js +5 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.js.map +1 -0
- package/lib/orchestrate/realize/transformRealizeCoderHistories.d.ts +2 -1
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js +50 -36
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js.map +1 -1
- package/lib/orchestrate/realize/writeCodeUntilCompilePassed.d.ts +5 -0
- package/lib/orchestrate/realize/writeCodeUntilCompilePassed.js +123 -0
- package/lib/orchestrate/realize/writeCodeUntilCompilePassed.js.map +1 -0
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.js +4 -1
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js +2 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTest.js +11 -5
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +3 -2
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +22 -13
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/structures/IAutoBeProps.d.ts +8 -8
- package/lib/utils/pipe.d.ts +5 -0
- package/lib/utils/pipe.js +14 -0
- package/lib/utils/pipe.js.map +1 -0
- package/package.json +6 -6
- package/src/AutoBeAgent.ts +22 -76
- package/src/constants/AutoBeSystemPromptConstant.ts +11 -6
- package/src/context/AutoBeContext.ts +3 -1
- package/src/factory/getAutoBeGenerated.ts +113 -0
- package/src/orchestrate/analyze/AutoBeAnalyzeFileSystem.ts +5 -13
- package/src/orchestrate/analyze/AutoBeAnalyzeRole.ts +14 -0
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +30 -165
- package/src/orchestrate/analyze/orchestrateAnalyzeComposer.ts +115 -0
- package/src/orchestrate/analyze/orchestrateAnalyzeReviewer.ts +39 -0
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +106 -0
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeComposerApplication.ts +74 -0
- package/src/orchestrate/analyze/transformAnalyzeReviewerHistories.ts +31 -0
- package/src/orchestrate/analyze/transformAnalyzeWriteHistories.ts +94 -0
- package/src/orchestrate/analyze/writeDocumentUntilReviewPassed.ts +66 -0
- package/src/orchestrate/interface/orchestrateInterface.ts +0 -2
- package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +2 -3
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +21 -0
- package/src/orchestrate/prisma/orchestratePrisma.ts +12 -5
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +4 -13
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +9 -4
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +265 -0
- package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +26 -37
- package/src/orchestrate/realize/RealizePipe.ts +39 -0
- package/src/orchestrate/realize/orchestrateRealize.ts +3 -91
- package/src/orchestrate/realize/orchestrateRealizeCoder.ts +60 -25
- package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +192 -18
- package/src/orchestrate/realize/structures/IAutoBeRealizeCompile.ts +34 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.ts +2 -0
- package/src/orchestrate/realize/transformRealizeCoderHistories.ts +58 -34
- package/src/orchestrate/realize/writeCodeUntilCompilePassed.ts +178 -0
- package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +5 -4
- package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +7 -2
- package/src/orchestrate/test/orchestrateTest.ts +14 -12
- package/src/orchestrate/test/orchestrateTestCorrect.ts +10 -9
- package/src/orchestrate/test/orchestrateTestWrite.ts +33 -27
- package/src/structures/IAutoBeProps.ts +10 -7
- package/src/utils/pipe.ts +39 -0
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.d.ts +0 -20
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js +0 -735
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js.map +0 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.d.ts +0 -15
- package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js +0 -44
- package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js.map +0 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +0 -1
- package/src/orchestrate/analyze/AutoBeAnalyzeAgent.ts +0 -219
- package/src/orchestrate/analyze/AutoBeAnalyzeReviewer.ts +0 -62
- 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
|
|
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,
|
|
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.
|
|
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
|
|
106
|
+
return IAutoBeRealizeFailedSymbol_1.FAILED;
|
|
107
107
|
}
|
|
108
|
-
pointer.value.implementationCode = yield ctx
|
|
109
|
-
|
|
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
|
-
|
|
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: "
|
|
161
|
+
name: "programming",
|
|
150
162
|
parameters: {
|
|
151
|
-
description: "
|
|
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
|
-
|
|
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
|
-
"
|
|
172
|
+
"output"
|
|
160
173
|
],
|
|
161
174
|
additionalProperties: false,
|
|
162
175
|
$defs: {
|
|
163
176
|
"IAutoBeRealizeCoderApplication.RealizeCoderOutput": {
|
|
164
|
-
description: "
|
|
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
|
-
|
|
168
|
-
description: "The name of the
|
|
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: "
|
|
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
|
-
"
|
|
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.
|
|
184
|
-
path: _path + ".
|
|
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.
|
|
187
|
-
})) && _vo1(input.
|
|
188
|
-
path: _path + ".
|
|
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.
|
|
191
|
-
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.
|
|
192
|
-
path: _path + ".
|
|
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.
|
|
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: "
|
|
279
|
+
name: "programming",
|
|
241
280
|
parameters: {
|
|
242
|
-
description: "
|
|
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
|
-
|
|
284
|
+
output: {
|
|
246
285
|
$ref: "#/$defs/IAutoBeRealizeCoderApplication.RealizeCoderOutput"
|
|
247
286
|
}
|
|
248
287
|
},
|
|
249
288
|
required: [
|
|
250
|
-
"
|
|
289
|
+
"output"
|
|
251
290
|
],
|
|
252
291
|
additionalProperties: false,
|
|
253
292
|
$defs: {
|
|
254
293
|
"IAutoBeRealizeCoderApplication.RealizeCoderOutput": {
|
|
255
|
-
description: "
|
|
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
|
-
|
|
259
|
-
description: "The name of the
|
|
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: "
|
|
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
|
-
"
|
|
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.
|
|
275
|
-
path: _path + ".
|
|
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.
|
|
278
|
-
})) && _vo1(input.
|
|
279
|
-
path: _path + ".
|
|
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.
|
|
282
|
-
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.
|
|
283
|
-
path: _path + ".
|
|
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.
|
|
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;
|
|
1
|
+
{"version":3,"file":"orchestrateRealizeCoder.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizeCoder.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,34 +1,204 @@
|
|
|
1
1
|
import { AutoBeOpenApi } from "@autobe/interface";
|
|
2
|
-
import { FAILED } from "
|
|
2
|
+
import { FAILED } from "./IAutoBeRealizeFailedSymbol";
|
|
3
3
|
export interface IAutoBeRealizeCoderApplication {
|
|
4
|
-
|
|
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
|
-
|
|
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
|
-
*
|
|
12
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
19
|
-
*
|
|
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
|
-
|
|
113
|
+
plan: string;
|
|
22
114
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* -
|
|
31
|
-
*
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"IAutoBeRealizeCompile.js","sourceRoot":"","sources":["../../../../src/orchestrate/realize/structures/IAutoBeRealizeCompile.ts"],"names":[],"mappings":""}
|
|
@@ -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>;
|