@autobe/agent 0.25.0 → 0.25.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.
- package/lib/AutoBeAgent.js +11 -1
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/AutoBeMockAgent.js +1 -0
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeConfigConstant.d.ts +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +13 -13
- package/lib/factory/createAutoBeContext.js +32 -3
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/index.mjs +2585 -1009
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +8 -8
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +2 -2
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +1 -1
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +1 -1
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +36 -23
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
- package/lib/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.d.ts +22 -42
- package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.d.ts +3 -0
- package/lib/orchestrate/interface/histories/{transformInterfacePrerequisiteHistories.js → transformInterfaceCommonPrerequisiteHistories.js} +4 -4
- package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +3 -3
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.d.ts +3 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js +102 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +25 -9
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +278 -47
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +96 -70
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +3 -3
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +29 -30
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +278 -47
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.d.ts +5 -0
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +713 -0
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +88 -42
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js +82 -14
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +0 -38
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +6 -10
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +3 -3
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.d.ts +52 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +0 -33
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.d.ts +6 -2
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +114 -9
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +46 -3
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
- package/lib/orchestrate/interface/utils/OperationValidator.d.ts +3 -4
- package/lib/orchestrate/interface/utils/OperationValidator.js +1 -1
- package/lib/orchestrate/interface/utils/OperationValidator.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +8 -8
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +20 -20
- package/lib/orchestrate/prisma/orchestratePrismaReview.js +20 -20
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +30 -30
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +9 -10
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +14 -22
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +6 -6
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +8 -2
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/orchestrate/realize/internal/compileRealizeFiles.js +1 -2
- package/lib/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.d.ts +2 -1
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js +103 -40
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.js +79 -45
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +16 -16
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +12 -12
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +117 -87
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js +117 -54
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +21 -13
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +52 -26
- package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +44 -34
- package/lib/orchestrate/realize/utils/InternalFileSystem.js +1 -1
- package/lib/orchestrate/realize/utils/InternalFileSystem.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +8 -3
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +44 -17
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +4 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js +24 -9
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -1
- package/lib/orchestrate/realize/utils/printErrorHints.d.ts +8 -0
- package/lib/orchestrate/realize/utils/printErrorHints.js +48 -0
- package/lib/orchestrate/realize/utils/printErrorHints.js.map +1 -0
- package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +1 -0
- package/lib/orchestrate/realize/utils/replaceImportStatements.js +93 -55
- package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +10 -79
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +15 -65
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestWriteHistories.js +1 -1
- package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +32 -17
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +31 -13
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.d.ts +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +5 -5
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +37 -21
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +9 -5
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectInvalidRequestApplication.d.ts +8 -2
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +11 -7
- package/lib/orchestrate/test/utils/getPrerequisites.d.ts +5 -0
- package/lib/orchestrate/test/utils/getPrerequisites.js +36 -0
- package/lib/orchestrate/test/utils/getPrerequisites.js.map +1 -0
- package/lib/orchestrate/test/utils/getReferenceIds.js +1 -1
- package/lib/orchestrate/test/utils/getReferenceIds.js.map +1 -1
- package/package.json +5 -5
- package/src/AutoBeAgent.ts +17 -1
- package/src/AutoBeMockAgent.ts +1 -0
- package/src/constants/AutoBeConfigConstant.ts +1 -1
- package/src/constants/AutoBeSystemPromptConstant.ts +13 -13
- package/src/factory/createAutoBeContext.ts +33 -3
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +2 -2
- package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +2 -2
- package/src/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.ts +25 -45
- package/src/orchestrate/interface/histories/{transformInterfacePrerequisiteHistories.ts → transformInterfaceCommonPrerequisiteHistories.ts} +1 -1
- package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +4 -2
- package/src/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.ts +118 -0
- package/src/orchestrate/interface/orchestrateInterface.ts +43 -17
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +12 -33
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +5 -5
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +7 -6
- package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +274 -0
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +1 -1
- package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +1 -1
- package/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.ts +0 -39
- package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +6 -10
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +4 -5
- package/src/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.ts +58 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +0 -34
- package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +92 -4
- package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +49 -3
- package/src/orchestrate/interface/utils/OperationValidator.ts +9 -7
- package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +9 -10
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +13 -24
- package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +6 -6
- package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +6 -4
- package/src/orchestrate/realize/internal/compileRealizeFiles.ts +1 -5
- package/src/orchestrate/realize/orchestRateRealizeCorrectCasting.ts +84 -17
- package/src/orchestrate/realize/orchestrateRealize.ts +123 -74
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +33 -6
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +14 -4
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +21 -13
- package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +54 -29
- package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +46 -35
- package/src/orchestrate/realize/utils/InternalFileSystem.ts +1 -1
- package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +54 -22
- package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +28 -16
- package/src/orchestrate/realize/utils/printErrorHints.ts +55 -0
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +99 -102
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +18 -91
- package/src/orchestrate/test/histories/transformTestScenarioReviewHistories.ts +17 -90
- package/src/orchestrate/test/orchestrateTestCorrect.ts +7 -6
- package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +13 -1
- package/src/orchestrate/test/orchestrateTestScenario.ts +12 -6
- package/src/orchestrate/test/orchestrateTestScenarioReview.ts +3 -3
- package/src/orchestrate/test/orchestrateTestWrite.ts +7 -6
- package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +9 -228
- package/src/orchestrate/test/structures/IAutoBeTestCorrectInvalidRequestApplication.ts +8 -2
- package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +11 -78
- package/src/orchestrate/test/utils/getPrerequisites.ts +51 -0
- package/src/orchestrate/test/utils/getReferenceIds.ts +2 -1
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.d.ts +0 -3
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.js.map +0 -1
- package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.d.ts +0 -6
- package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.js +0 -22
- package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.js.map +0 -1
- package/src/orchestrate/interface/utils/OpenApiEndpointComparator.ts +0 -23
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
AutoBeRealizeAuthorization,
|
|
6
6
|
AutoBeRealizeFunction,
|
|
7
7
|
AutoBeRealizeHistory,
|
|
8
|
+
AutoBeRealizeValidateEvent,
|
|
8
9
|
AutoBeRealizeWriteEvent,
|
|
9
10
|
IAutoBeCompiler,
|
|
10
11
|
} from "@autobe/interface";
|
|
@@ -29,9 +30,9 @@ export const orchestrateRealize =
|
|
|
29
30
|
props: IAutoBeApplicationProps,
|
|
30
31
|
): Promise<AutoBeAssistantMessageHistory | AutoBeRealizeHistory> => {
|
|
31
32
|
// PREDICATION
|
|
32
|
-
const
|
|
33
|
-
ctx.state().interface?.document
|
|
34
|
-
if (
|
|
33
|
+
const document: AutoBeOpenApi.IDocument | undefined =
|
|
34
|
+
ctx.state().interface?.document;
|
|
35
|
+
if (document === undefined)
|
|
35
36
|
throw new Error("Can't do realize agent because operations are nothing.");
|
|
36
37
|
|
|
37
38
|
const start: Date = new Date();
|
|
@@ -55,102 +56,150 @@ export const orchestrateRealize =
|
|
|
55
56
|
step: ctx.state().test?.step ?? 0,
|
|
56
57
|
});
|
|
57
58
|
|
|
58
|
-
//
|
|
59
|
+
// PREPARE ASSETS
|
|
60
|
+
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
59
61
|
const authorizations: AutoBeRealizeAuthorization[] =
|
|
60
62
|
await orchestrateRealizeAuthorization(ctx);
|
|
61
63
|
|
|
62
|
-
// SCENARIOS
|
|
63
|
-
const scenarios: IAutoBeRealizeScenarioResult[] = operations.map(
|
|
64
|
-
(operation) => generateRealizeScenario(ctx, operation, authorizations),
|
|
65
|
-
);
|
|
66
|
-
|
|
67
64
|
const writeProgress: AutoBeProgressEventBase = {
|
|
68
|
-
total:
|
|
65
|
+
total: document.operations.length,
|
|
66
|
+
completed: 0,
|
|
67
|
+
};
|
|
68
|
+
const correctProgress: AutoBeProgressEventBase = {
|
|
69
|
+
total: document.operations.length,
|
|
69
70
|
completed: 0,
|
|
70
71
|
};
|
|
71
|
-
const writeEvents: (AutoBeRealizeWriteEvent | null)[] =
|
|
72
|
-
await executeCachedBatch(
|
|
73
|
-
scenarios.map((scenario) => async (promptCacheKey) => {
|
|
74
|
-
const props = {
|
|
75
|
-
totalAuthorizations: authorizations,
|
|
76
|
-
authorization: scenario.decoratorEvent ?? null,
|
|
77
|
-
scenario,
|
|
78
|
-
progress: writeProgress,
|
|
79
|
-
promptCacheKey,
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const code: AutoBeRealizeWriteEvent | null =
|
|
83
|
-
await orchestrateRealizeWrite(ctx, props).catch(() => {
|
|
84
|
-
return orchestrateRealizeWrite(ctx, props).catch(() => null);
|
|
85
|
-
});
|
|
86
72
|
|
|
87
|
-
|
|
88
|
-
|
|
73
|
+
const process = async (
|
|
74
|
+
artifacts: IAutoBeRealizeScenarioResult[],
|
|
75
|
+
): Promise<IBucket> => {
|
|
76
|
+
const writes: AutoBeRealizeWriteEvent[] = (
|
|
77
|
+
await executeCachedBatch(
|
|
78
|
+
artifacts.map((art) => async (promptCacheKey) => {
|
|
79
|
+
const write = async (): Promise<AutoBeRealizeWriteEvent | null> => {
|
|
80
|
+
try {
|
|
81
|
+
return await orchestrateRealizeWrite(ctx, {
|
|
82
|
+
totalAuthorizations: authorizations,
|
|
83
|
+
authorization: art.decoratorEvent ?? null,
|
|
84
|
+
scenario: art,
|
|
85
|
+
document,
|
|
86
|
+
progress: writeProgress,
|
|
87
|
+
promptCacheKey,
|
|
88
|
+
});
|
|
89
|
+
} catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
return (await write()) ?? (await write());
|
|
94
|
+
}),
|
|
95
|
+
)
|
|
96
|
+
).filter((w) => w !== null);
|
|
97
|
+
const functions: AutoBeRealizeFunction[] = Object.entries(
|
|
98
|
+
Object.fromEntries(writes.map((w) => [w.location, w.content])),
|
|
99
|
+
).map(([location, content]) => {
|
|
100
|
+
const scenario: IAutoBeRealizeScenarioResult = artifacts.find(
|
|
101
|
+
(el) => el.location === location,
|
|
102
|
+
)!;
|
|
103
|
+
return {
|
|
104
|
+
location,
|
|
105
|
+
content,
|
|
106
|
+
endpoint: {
|
|
107
|
+
method: scenario.operation.method,
|
|
108
|
+
path: scenario.operation.path,
|
|
109
|
+
},
|
|
110
|
+
name: scenario.functionName,
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
const corrected: AutoBeRealizeFunction[] =
|
|
114
|
+
await orchestrateRealizeCorrectCasting(
|
|
115
|
+
ctx,
|
|
116
|
+
artifacts,
|
|
117
|
+
authorizations,
|
|
118
|
+
functions,
|
|
119
|
+
correctProgress,
|
|
120
|
+
).then(async (res) => {
|
|
121
|
+
return await orchestrateRealizeCorrect(
|
|
122
|
+
ctx,
|
|
123
|
+
artifacts,
|
|
124
|
+
authorizations,
|
|
125
|
+
res,
|
|
126
|
+
[],
|
|
127
|
+
correctProgress,
|
|
128
|
+
);
|
|
129
|
+
});
|
|
130
|
+
const validate: AutoBeRealizeValidateEvent = await compileRealizeFiles(
|
|
131
|
+
ctx,
|
|
132
|
+
{
|
|
133
|
+
authorizations,
|
|
134
|
+
functions: corrected,
|
|
135
|
+
},
|
|
89
136
|
);
|
|
90
|
-
|
|
91
|
-
const functions: AutoBeRealizeFunction[] = Object.entries(
|
|
92
|
-
Object.fromEntries(
|
|
93
|
-
writeEvents
|
|
94
|
-
.filter((w) => w !== null)
|
|
95
|
-
.map((event) => [event.location, event.content]),
|
|
96
|
-
),
|
|
97
|
-
).map(([location, content]) => {
|
|
98
|
-
const scenario = scenarios.find((el) => el.location === location)!;
|
|
99
137
|
return {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
endpoint: {
|
|
103
|
-
method: scenario.operation.method,
|
|
104
|
-
path: scenario.operation.path,
|
|
105
|
-
},
|
|
106
|
-
name: scenario.functionName,
|
|
138
|
+
corrected,
|
|
139
|
+
validate,
|
|
107
140
|
};
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
const reviewProgress: AutoBeProgressEventBase = {
|
|
111
|
-
total: writeEvents.length,
|
|
112
|
-
completed: writeEvents.length,
|
|
113
141
|
};
|
|
114
142
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
authorizations,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
)
|
|
130
|
-
|
|
143
|
+
// SCENARIOS
|
|
144
|
+
const entireScenarios: IAutoBeRealizeScenarioResult[] =
|
|
145
|
+
document.operations.map((operation) =>
|
|
146
|
+
generateRealizeScenario(ctx, operation, authorizations),
|
|
147
|
+
);
|
|
148
|
+
let bucket: IBucket = await process(entireScenarios);
|
|
149
|
+
for (let i: number = 0; i < 2; ++i) {
|
|
150
|
+
if (bucket.validate.result.type !== "failure") break;
|
|
151
|
+
|
|
152
|
+
const failedScenarios: IAutoBeRealizeScenarioResult[] = Array.from(
|
|
153
|
+
new Set(bucket.validate.result.diagnostics.map((f) => f.file)),
|
|
154
|
+
)
|
|
155
|
+
.map((location) =>
|
|
156
|
+
bucket.corrected.find((f) => f.location === location),
|
|
157
|
+
)
|
|
158
|
+
.filter((f) => f !== undefined)
|
|
159
|
+
.map((f) =>
|
|
160
|
+
entireScenarios.find(
|
|
161
|
+
(s) =>
|
|
162
|
+
s.operation.path === f.endpoint.path &&
|
|
163
|
+
s.operation.method === f.endpoint.method,
|
|
164
|
+
),
|
|
165
|
+
)
|
|
166
|
+
.filter((o) => o !== undefined);
|
|
167
|
+
if (failedScenarios.length === 0) break;
|
|
168
|
+
|
|
169
|
+
writeProgress.total += failedScenarios.length;
|
|
170
|
+
correctProgress.total += failedScenarios.length;
|
|
171
|
+
|
|
172
|
+
const newBucket: IBucket = await process(failedScenarios);
|
|
173
|
+
const corrected: Map<string, AutoBeRealizeFunction> = new Map([
|
|
174
|
+
...bucket.corrected.map((f) => [f.location, f] as const),
|
|
175
|
+
...newBucket.corrected.map((f) => [f.location, f] as const),
|
|
176
|
+
]);
|
|
177
|
+
bucket = {
|
|
178
|
+
corrected: Array.from(corrected.values()),
|
|
179
|
+
validate: newBucket.validate,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
131
182
|
|
|
132
|
-
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
133
183
|
const controllers: Record<string, string> =
|
|
134
184
|
await compiler.realize.controller({
|
|
135
185
|
document: ctx.state().interface!.document,
|
|
136
|
-
functions:
|
|
186
|
+
functions: bucket.corrected,
|
|
137
187
|
authorizations,
|
|
138
188
|
});
|
|
139
|
-
|
|
140
|
-
const { result } = await compileRealizeFiles(ctx, {
|
|
141
|
-
authorizations,
|
|
142
|
-
functions: totalCorrected,
|
|
143
|
-
});
|
|
144
|
-
|
|
145
189
|
return ctx.dispatch({
|
|
146
190
|
type: "realizeComplete",
|
|
147
191
|
id: v7(),
|
|
148
192
|
created_at: new Date().toISOString(),
|
|
149
|
-
functions:
|
|
193
|
+
functions: bucket.corrected,
|
|
150
194
|
authorizations,
|
|
151
195
|
controllers,
|
|
152
|
-
compiled: result,
|
|
196
|
+
compiled: bucket.validate.result,
|
|
153
197
|
step: ctx.state().analyze?.step ?? 0,
|
|
154
198
|
elapsed: new Date().getTime() - start.getTime(),
|
|
155
199
|
});
|
|
156
200
|
};
|
|
201
|
+
|
|
202
|
+
interface IBucket {
|
|
203
|
+
corrected: AutoBeRealizeFunction[];
|
|
204
|
+
validate: AutoBeRealizeValidateEvent;
|
|
205
|
+
}
|
|
@@ -19,6 +19,7 @@ import { IAutoBeRealizeCorrectApplication } from "./structures/IAutoBeRealizeCor
|
|
|
19
19
|
import { IAutoBeRealizeFunctionFailure } from "./structures/IAutoBeRealizeFunctionFailure";
|
|
20
20
|
import { IAutoBeRealizeScenarioResult } from "./structures/IAutoBeRealizeScenarioResult";
|
|
21
21
|
import { filterDiagnostics } from "./utils/filterDiagnostics";
|
|
22
|
+
import { getRealizeWriteCodeTemplate } from "./utils/getRealizeWriteCodeTemplate";
|
|
22
23
|
import { getRealizeWriteDto } from "./utils/getRealizeWriteDto";
|
|
23
24
|
import { replaceImportStatements } from "./utils/replaceImportStatements";
|
|
24
25
|
|
|
@@ -42,7 +43,9 @@ export async function orchestrateRealizeCorrect<Model extends ILlmSchema.Model>(
|
|
|
42
43
|
const diagnostics = event.result.diagnostics;
|
|
43
44
|
|
|
44
45
|
if (
|
|
45
|
-
event.result.diagnostics.every(
|
|
46
|
+
event.result.diagnostics.every(
|
|
47
|
+
(d) => !d.file?.startsWith("src/providers"),
|
|
48
|
+
) === true
|
|
46
49
|
) {
|
|
47
50
|
// No diagnostics related to provider functions, stop correcting
|
|
48
51
|
return functions;
|
|
@@ -99,7 +102,6 @@ export async function orchestrateRealizeCorrect<Model extends ILlmSchema.Model>(
|
|
|
99
102
|
),
|
|
100
103
|
progress,
|
|
101
104
|
);
|
|
102
|
-
|
|
103
105
|
return orchestrateRealizeCorrect(
|
|
104
106
|
ctx,
|
|
105
107
|
scenarios,
|
|
@@ -211,6 +213,23 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
211
213
|
enforceFunctionCall: true,
|
|
212
214
|
message: StringUtil.trim`
|
|
213
215
|
Correct the TypeScript code implementation.
|
|
216
|
+
|
|
217
|
+
The instruction to write at first was as follows, and the code you received is the code you wrote according to this instruction.
|
|
218
|
+
When modifying, modify the entire code, but not the import statement.
|
|
219
|
+
|
|
220
|
+
Below is template code you wrote:
|
|
221
|
+
|
|
222
|
+
${getRealizeWriteCodeTemplate({
|
|
223
|
+
scenario: props.scenario,
|
|
224
|
+
schemas: ctx.state().interface!.document.components.schemas,
|
|
225
|
+
operation: props.scenario.operation,
|
|
226
|
+
authorization: props.authorization ?? null,
|
|
227
|
+
})}
|
|
228
|
+
|
|
229
|
+
Current code is as follows:
|
|
230
|
+
\`\`\`typescript
|
|
231
|
+
${props.function.content}
|
|
232
|
+
\`\`\`
|
|
214
233
|
`,
|
|
215
234
|
});
|
|
216
235
|
|
|
@@ -218,17 +237,25 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
218
237
|
return null;
|
|
219
238
|
}
|
|
220
239
|
|
|
221
|
-
pointer.value.
|
|
240
|
+
pointer.value.draft = await replaceImportStatements(ctx, {
|
|
222
241
|
operation: props.scenario.operation,
|
|
223
|
-
|
|
242
|
+
schemas: ctx.state().interface!.document.components.schemas,
|
|
243
|
+
code: pointer.value.draft,
|
|
224
244
|
decoratorType: props.authorization?.payload.name,
|
|
225
245
|
});
|
|
246
|
+
if (pointer.value.revise.final)
|
|
247
|
+
pointer.value.revise.final = await replaceImportStatements(ctx, {
|
|
248
|
+
operation: props.scenario.operation,
|
|
249
|
+
schemas: ctx.state().interface!.document.components.schemas,
|
|
250
|
+
code: pointer.value.revise.final,
|
|
251
|
+
decoratorType: props.authorization?.payload.name,
|
|
252
|
+
});
|
|
226
253
|
|
|
227
254
|
const event: AutoBeRealizeCorrectEvent = {
|
|
228
255
|
type: "realizeCorrect",
|
|
229
256
|
id: v7(),
|
|
230
257
|
location: props.scenario.location,
|
|
231
|
-
content: pointer.value.revise.final,
|
|
258
|
+
content: pointer.value.revise.final ?? pointer.value.draft,
|
|
232
259
|
tokenUsage,
|
|
233
260
|
completed: ++props.progress.completed,
|
|
234
261
|
total: props.progress.total,
|
|
@@ -253,7 +280,7 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
253
280
|
name: "Write code",
|
|
254
281
|
application,
|
|
255
282
|
execute: {
|
|
256
|
-
|
|
283
|
+
correct: (next) => {
|
|
257
284
|
props.build(next);
|
|
258
285
|
},
|
|
259
286
|
} satisfies IAutoBeRealizeCorrectApplication,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AutoBeOpenApi,
|
|
2
3
|
AutoBeProgressEventBase,
|
|
3
4
|
AutoBeRealizeAuthorization,
|
|
4
5
|
AutoBeRealizeWriteEvent,
|
|
@@ -20,6 +21,7 @@ import { replaceImportStatements } from "./utils/replaceImportStatements";
|
|
|
20
21
|
export async function orchestrateRealizeWrite<Model extends ILlmSchema.Model>(
|
|
21
22
|
ctx: AutoBeContext<Model>,
|
|
22
23
|
props: {
|
|
24
|
+
document: AutoBeOpenApi.IDocument;
|
|
23
25
|
totalAuthorizations: AutoBeRealizeAuthorization[];
|
|
24
26
|
authorization: AutoBeRealizeAuthorization | null;
|
|
25
27
|
scenario: IAutoBeRealizeScenarioResult;
|
|
@@ -69,17 +71,25 @@ export async function orchestrateRealizeWrite<Model extends ILlmSchema.Model>(
|
|
|
69
71
|
});
|
|
70
72
|
if (pointer.value === null) throw new Error("Failed to write code.");
|
|
71
73
|
|
|
72
|
-
pointer.value.
|
|
74
|
+
pointer.value.draft = await replaceImportStatements(ctx, {
|
|
73
75
|
operation: props.scenario.operation,
|
|
74
|
-
|
|
76
|
+
schemas: props.document.components.schemas,
|
|
77
|
+
code: pointer.value.draft,
|
|
75
78
|
decoratorType: props.authorization?.payload.name,
|
|
76
79
|
});
|
|
80
|
+
if (pointer.value.revise.final)
|
|
81
|
+
pointer.value.revise.final = await replaceImportStatements(ctx, {
|
|
82
|
+
operation: props.scenario.operation,
|
|
83
|
+
schemas: props.document.components.schemas,
|
|
84
|
+
code: pointer.value.revise.final,
|
|
85
|
+
decoratorType: props.authorization?.payload.name,
|
|
86
|
+
});
|
|
77
87
|
|
|
78
88
|
const event: AutoBeRealizeWriteEvent = {
|
|
79
89
|
type: "realizeWrite",
|
|
80
90
|
id: v7(),
|
|
81
91
|
location: props.scenario.location,
|
|
82
|
-
content: pointer.value.final,
|
|
92
|
+
content: pointer.value.revise.final ?? pointer.value.draft,
|
|
83
93
|
tokenUsage,
|
|
84
94
|
completed: ++props.progress.completed,
|
|
85
95
|
total: props.progress.total,
|
|
@@ -105,7 +115,7 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
105
115
|
name: "Write code",
|
|
106
116
|
application,
|
|
107
117
|
execute: {
|
|
108
|
-
|
|
118
|
+
write: (next) => {
|
|
109
119
|
props.build(next);
|
|
110
120
|
},
|
|
111
121
|
} satisfies IAutoBeRealizeWriteApplication,
|
|
@@ -1,22 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CamelCasePattern, PascalCasePattern } from "@autobe/interface";
|
|
2
2
|
|
|
3
3
|
export interface IAutoBeRealizeAuthorizationApplication {
|
|
4
4
|
/**
|
|
5
|
-
* Generates authentication provider, decorator, and payload type for
|
|
5
|
+
* Generates authentication provider, decorator, and payload type for
|
|
6
|
+
* role-based authorization.
|
|
6
7
|
*
|
|
7
8
|
* This method creates a complete authentication infrastructure for a specific
|
|
8
|
-
* role in the NestJS application. It generates three interconnected
|
|
9
|
-
* that work together to provide JWT-based authentication and
|
|
9
|
+
* role in the NestJS application. It generates three interconnected
|
|
10
|
+
* components that work together to provide JWT-based authentication and
|
|
11
|
+
* authorization.
|
|
10
12
|
*
|
|
11
13
|
* The generated components include:
|
|
12
|
-
* - **Provider Function**: Handles JWT verification and user validation from database
|
|
13
|
-
* - **Decorator**: NestJS parameter decorator for injecting authenticated user data
|
|
14
|
-
* - **Payload Type**: TypeScript interface defining the authenticated user structure
|
|
15
14
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* - **Provider Function**: Handles JWT verification and user validation from
|
|
16
|
+
* database
|
|
17
|
+
* - **Decorator**: NestJS parameter decorator for injecting authenticated user
|
|
18
|
+
* data
|
|
19
|
+
* - **Payload Type**: TypeScript interface defining the authenticated user
|
|
20
|
+
* structure
|
|
18
21
|
*
|
|
19
|
-
*
|
|
22
|
+
* All components follow strict naming conventions and integrate with the
|
|
23
|
+
* existing authentication architecture using the shared jwtAuthorize
|
|
24
|
+
* function.
|
|
25
|
+
*
|
|
26
|
+
* @param next Properties containing provider, decorator, and payload type
|
|
27
|
+
* configurations
|
|
20
28
|
*/
|
|
21
29
|
createDecorator: (
|
|
22
30
|
next: IAutoBeRealizeAuthorizationApplication.IProps,
|
|
@@ -60,7 +68,7 @@ export namespace IAutoBeRealizeAuthorizationApplication {
|
|
|
60
68
|
*
|
|
61
69
|
* DO: Use camelCase naming convention.
|
|
62
70
|
*/
|
|
63
|
-
name: string &
|
|
71
|
+
name: string & CamelCasePattern;
|
|
64
72
|
|
|
65
73
|
/**
|
|
66
74
|
* Complete TypeScript code for the authentication Provider function. Must
|
|
@@ -83,7 +91,7 @@ export namespace IAutoBeRealizeAuthorizationApplication {
|
|
|
83
91
|
*
|
|
84
92
|
* DO: Use PascalCase naming convention.
|
|
85
93
|
*/
|
|
86
|
-
name: string &
|
|
94
|
+
name: string & PascalCasePattern;
|
|
87
95
|
|
|
88
96
|
/**
|
|
89
97
|
* Complete TypeScript code for the authentication Decorator implementation.
|
|
@@ -105,7 +113,7 @@ export namespace IAutoBeRealizeAuthorizationApplication {
|
|
|
105
113
|
*
|
|
106
114
|
* DO: Use PascalCase naming convention.
|
|
107
115
|
*/
|
|
108
|
-
name: string &
|
|
116
|
+
name: string & PascalCasePattern;
|
|
109
117
|
|
|
110
118
|
/**
|
|
111
119
|
* Complete TypeScript code for the Payload type interface in {Role}Payload
|
|
@@ -1,45 +1,70 @@
|
|
|
1
1
|
export interface IAutoBeRealizeCorrectApplication {
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Systematically analyze and correct TypeScript compilation errors.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Implements a three-phase workflow (think → draft → revise) that balances
|
|
6
|
+
* efficiency for simple errors with thoroughness for complex problems.
|
|
7
7
|
*
|
|
8
|
-
* @param props
|
|
8
|
+
* @param props Three-phase correction properties
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
correct(props: IAutoBeRealizeCorrectApplication.IProps): void;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export namespace IAutoBeRealizeCorrectApplication {
|
|
14
|
-
/**
|
|
15
|
-
* Properties for error correction following Chain of Thinking (CoT).
|
|
16
|
-
*
|
|
17
|
-
* All phases are wrapped in a `revise` object for systematic error
|
|
18
|
-
* resolution.
|
|
19
|
-
*/
|
|
20
14
|
export interface IProps {
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
15
|
+
/**
|
|
16
|
+
* Initial error analysis and correction strategy.
|
|
17
|
+
*
|
|
18
|
+
* Analyzes TypeScript compilation errors to understand:
|
|
19
|
+
*
|
|
20
|
+
* - Error patterns and root causes
|
|
21
|
+
* - Required fixes and their impact
|
|
22
|
+
* - Whether quick fixes or deep refactoring is needed
|
|
23
|
+
* - Prisma schema and API contract constraints
|
|
30
24
|
*/
|
|
31
|
-
|
|
25
|
+
think: string;
|
|
32
26
|
|
|
33
|
-
/**
|
|
34
|
-
|
|
27
|
+
/**
|
|
28
|
+
* First correction attempt.
|
|
29
|
+
*
|
|
30
|
+
* Implements the initial fixes identified in the think phase. For simple
|
|
31
|
+
* errors (typos, missing imports), this may be the final solution. Complex
|
|
32
|
+
* errors may require further refinement.
|
|
33
|
+
*/
|
|
34
|
+
draft: string;
|
|
35
35
|
|
|
36
|
-
/**
|
|
37
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Revision and finalization phase.
|
|
38
|
+
*
|
|
39
|
+
* Reviews the draft corrections and produces the final, error-free code
|
|
40
|
+
* that maintains all business requirements.
|
|
41
|
+
*/
|
|
42
|
+
revise: IReviseProps;
|
|
43
|
+
}
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
export interface IReviseProps {
|
|
46
|
+
/**
|
|
47
|
+
* Correction review and validation.
|
|
48
|
+
*
|
|
49
|
+
* Analyzes the draft corrections to ensure:
|
|
50
|
+
*
|
|
51
|
+
* - All TypeScript errors are resolved
|
|
52
|
+
* - Business logic remains intact
|
|
53
|
+
* - AutoBE coding standards are maintained
|
|
54
|
+
* - No new errors are introduced
|
|
55
|
+
* - Performance and security are preserved
|
|
56
|
+
*/
|
|
57
|
+
review: string;
|
|
41
58
|
|
|
42
|
-
/**
|
|
43
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Final error-free implementation.
|
|
61
|
+
*
|
|
62
|
+
* The complete, corrected code that passes all TypeScript compilation
|
|
63
|
+
* checks.
|
|
64
|
+
*
|
|
65
|
+
* Returns `null` if the draft corrections are sufficient and need no
|
|
66
|
+
* further changes.
|
|
67
|
+
*/
|
|
68
|
+
final: string | null;
|
|
44
69
|
}
|
|
45
70
|
}
|
|
@@ -1,55 +1,66 @@
|
|
|
1
1
|
export interface IAutoBeRealizeWriteApplication {
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Generate complete provider function implementation using Chain of Thinking.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* functions that handle business logic for API operations. It follows a
|
|
7
|
-
* schema-first approach with multiple refinement phases to ensure type-safe,
|
|
8
|
-
* error-free code generation.
|
|
5
|
+
* Follows a 3-phase process: plan → draft → revise.
|
|
9
6
|
*
|
|
10
|
-
*
|
|
7
|
+
* Ensures type safety, proper Prisma usage, and API contract compliance.
|
|
11
8
|
*
|
|
12
|
-
*
|
|
13
|
-
* 2. Schema definition for relevant models
|
|
14
|
-
* 3. Review and refinement for completeness
|
|
15
|
-
* 4. Final implementation with all validations and type safety
|
|
16
|
-
*
|
|
17
|
-
* @param next Properties containing the multi-phase implementation plan and
|
|
18
|
-
* code
|
|
9
|
+
* @param props Chain of Thinking properties for implementation
|
|
19
10
|
*/
|
|
20
|
-
|
|
11
|
+
write(props: IAutoBeRealizeWriteApplication.IProps): void;
|
|
21
12
|
}
|
|
22
13
|
|
|
23
14
|
export namespace IAutoBeRealizeWriteApplication {
|
|
24
|
-
/**
|
|
25
|
-
* Properties for the Realize Write Application following Chain of Thinking
|
|
26
|
-
* (CoT).
|
|
27
|
-
*
|
|
28
|
-
* Each field represents a distinct phase in the implementation process.
|
|
29
|
-
* Detailed guidelines are in REALIZE_WRITE.md.
|
|
30
|
-
*/
|
|
31
15
|
export interface IProps {
|
|
32
16
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* Strategic plan following SCHEMA-FIRST APPROACH:
|
|
36
|
-
*
|
|
37
|
-
* 1. Verify Prisma schema fields (list existing and non-existing)
|
|
38
|
-
* 2. Plan field usage in operations
|
|
39
|
-
* 3. Plan type conversions and nullable handling
|
|
40
|
-
* 4. Define implementation approach with error handling
|
|
17
|
+
* Implementation plan and strategy.
|
|
41
18
|
*
|
|
42
|
-
*
|
|
19
|
+
* Analyzes the provider function requirements, identifies related Prisma
|
|
20
|
+
* schemas, and outlines the implementation approach. Includes schema
|
|
21
|
+
* validation and API contract verification.
|
|
43
22
|
*/
|
|
44
23
|
plan: string;
|
|
45
24
|
|
|
46
|
-
/**
|
|
47
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Initial implementation draft.
|
|
27
|
+
*
|
|
28
|
+
* The first complete implementation attempt based on the plan. May contain
|
|
29
|
+
* areas that need refinement in the review phase.
|
|
30
|
+
*/
|
|
31
|
+
draft: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Revision and finalization phase.
|
|
35
|
+
*
|
|
36
|
+
* Reviews the draft implementation and produces the final code with all
|
|
37
|
+
* improvements and corrections applied.
|
|
38
|
+
*/
|
|
39
|
+
revise: IReviseProps;
|
|
40
|
+
}
|
|
48
41
|
|
|
49
|
-
|
|
42
|
+
export interface IReviseProps {
|
|
43
|
+
/**
|
|
44
|
+
* Review and improvement suggestions.
|
|
45
|
+
*
|
|
46
|
+
* Identifies areas for improvement in the draft code, including:
|
|
47
|
+
*
|
|
48
|
+
* - Type safety enhancements
|
|
49
|
+
* - Prisma query optimizations
|
|
50
|
+
* - Null/undefined handling corrections
|
|
51
|
+
* - Authentication/authorization improvements
|
|
52
|
+
* - Error handling refinements
|
|
53
|
+
*/
|
|
50
54
|
review: string;
|
|
51
55
|
|
|
52
|
-
/**
|
|
53
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Final implementation code.
|
|
58
|
+
*
|
|
59
|
+
* The complete, production-ready implementation with all review suggestions
|
|
60
|
+
* applied.
|
|
61
|
+
*
|
|
62
|
+
* Returns `null` if the draft is already perfect and needs no changes.
|
|
63
|
+
*/
|
|
64
|
+
final: string | null;
|
|
54
65
|
}
|
|
55
66
|
}
|