@autobe/agent 0.21.0 → 0.22.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/agent/src/AutoBeAgent.js +2 -2
- package/lib/agent/src/AutoBeAgent.js.map +1 -1
- package/lib/agent/src/constants/AutoBeConfigConstant.d.ts +3 -0
- package/lib/agent/src/{orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js → constants/AutoBeConfigConstant.js} +1 -1
- package/lib/agent/src/constants/AutoBeConfigConstant.js.map +1 -0
- package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +27 -27
- package/lib/agent/src/context/AutoBeContext.d.ts +1 -0
- package/lib/agent/src/context/AutoBeTokenUsageComponent.js +4 -3
- package/lib/agent/src/context/AutoBeTokenUsageComponent.js.map +1 -1
- package/lib/agent/src/factory/consentFunctionCall.js +4 -4
- package/lib/agent/src/factory/consentFunctionCall.js.map +1 -1
- package/lib/agent/src/factory/createAutoBeContext.js +13 -10
- package/lib/agent/src/factory/createAutoBeContext.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +2 -2
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js +6 -6
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js +50 -8
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js +4 -4
- package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +6 -0
- package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +4 -0
- package/lib/agent/src/orchestrate/facade/transformFacadeStateMessage.js +1 -1
- package/lib/agent/src/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +19 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +2 -2
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +2 -2
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterface.js +5 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js +16 -10
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js +3731 -228
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js +2 -2
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +2 -2
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +43 -63
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +1261 -1628
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +3468 -105
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js +3674 -360
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -141
- package/lib/agent/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +29 -23
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.d.ts +9 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.js +1385 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.d.ts +5 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.js +78 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaValidator.d.ts +10 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaValidator.js +59 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.d.ts +2 -0
- package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js +81 -0
- package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js.map +1 -0
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +2 -2
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +2 -2
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +2 -2
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +22 -7
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +13 -29
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js +2 -8
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +6 -49
- package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +4 -2
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +5 -3
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +206 -118
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -2
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +24 -39
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +17 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +20 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +33 -73
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.d.ts +5 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.js +3 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.js.map +1 -0
- package/{src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.ts → lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts} +2 -13
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.js +3 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +33 -22
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +31 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +86 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.d.ts +4 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.js +55 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +2 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.js +20 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.d.ts +30 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.js +73 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.d.ts +6 -2
- package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js +63 -69
- package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/completeTestCode.d.ts +3 -1
- package/lib/agent/src/orchestrate/test/compile/completeTestCode.js +25 -18
- package/lib/agent/src/orchestrate/test/compile/completeTestCode.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js +5 -1
- package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
- package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js +19 -0
- package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js.map +1 -0
- package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js +2 -0
- package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
- package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js +21 -0
- package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js.map +1 -0
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.d.ts +2 -2
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +16 -17
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +5 -4
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +21 -2
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTest.js +6 -0
- package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.d.ts +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +123 -75
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +46 -40
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +117 -45
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +48 -45
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.d.ts +6 -0
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.js +3 -0
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.js.map +1 -0
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +1 -0
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +13 -0
- package/lib/agent/src/orchestrate/test/utils/getReferenceIds.d.ts +5 -0
- package/lib/agent/src/orchestrate/test/utils/getReferenceIds.js +28 -0
- package/lib/agent/src/orchestrate/test/utils/getReferenceIds.js.map +1 -0
- package/lib/agent/src/structures/IAutoBeConfig.d.ts +2 -0
- package/lib/constants/AutoBeConfigConstant.d.ts +3 -0
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +27 -27
- package/lib/context/AutoBeContext.d.ts +1 -0
- package/lib/index.mjs +13871 -3912
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +6 -0
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +4 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -141
- package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +29 -23
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.d.ts +9 -0
- package/lib/orchestrate/interface/utils/JsonSchemaNamingConvention.d.ts +5 -0
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.d.ts +10 -0
- package/lib/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.d.ts +2 -0
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
- package/lib/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
- package/lib/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
- package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -2
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +17 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +20 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +33 -73
- package/lib/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.d.ts +5 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts +36 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +33 -22
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +31 -0
- package/lib/orchestrate/realize/utils/getRealizeWriteDto.d.ts +4 -0
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +2 -0
- package/lib/orchestrate/realize/utils/getRealizeWriteInputType.d.ts +30 -0
- package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +6 -2
- package/lib/orchestrate/test/compile/completeTestCode.d.ts +3 -1
- package/lib/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
- package/lib/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +2 -2
- package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +48 -45
- package/lib/orchestrate/test/structures/IAutoBeTestFunctionFailure.d.ts +6 -0
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +13 -0
- package/lib/orchestrate/test/utils/getReferenceIds.d.ts +5 -0
- package/lib/structures/IAutoBeConfig.d.ts +2 -0
- package/package.json +6 -6
- package/src/AutoBeAgent.ts +2 -0
- package/src/constants/AutoBeConfigConstant.ts +3 -0
- package/src/constants/AutoBeSystemPromptConstant.ts +27 -27
- package/src/context/AutoBeContext.ts +1 -0
- package/src/context/AutoBeTokenUsageComponent.ts +3 -3
- package/src/factory/consentFunctionCall.ts +2 -0
- package/src/factory/createAutoBeContext.ts +145 -136
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.ts +6 -0
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +4 -0
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +19 -1
- package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +1 -4
- package/src/orchestrate/interface/orchestrateInterface.ts +15 -4
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +13 -5
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +58 -19
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +11 -11
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +13 -117
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +35 -93
- package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +74 -97
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +0 -39
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +50 -146
- package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +31 -27
- package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +171 -0
- package/src/orchestrate/interface/utils/JsonSchemaNamingConvention.ts +83 -0
- package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +66 -0
- package/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.ts +90 -0
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +1 -2
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +30 -15
- package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +27 -49
- package/src/orchestrate/realize/internal/compileRealizeFiles.ts +4 -11
- package/src/orchestrate/realize/orchestrateRealize.ts +19 -75
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +1 -1
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +114 -25
- package/src/orchestrate/realize/orchestrateRealizeScenario.ts +2 -2
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +11 -15
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +17 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +20 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +40 -74
- package/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.ts +9 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.ts +45 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +33 -22
- package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +97 -0
- package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +64 -0
- package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +29 -0
- package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +82 -0
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +101 -111
- package/src/orchestrate/test/compile/completeTestCode.ts +18 -31
- package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +12 -0
- package/src/orchestrate/test/compile/getTestImportStatements.ts +25 -0
- package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +6 -1
- package/src/orchestrate/test/compile/getTestTemplateCode.ts +25 -0
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +26 -26
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +6 -5
- package/src/orchestrate/test/histories/transformTestWriteHistories.ts +19 -0
- package/src/orchestrate/test/orchestrateTest.ts +6 -0
- package/src/orchestrate/test/orchestrateTestCorrect.ts +44 -20
- package/src/orchestrate/test/orchestrateTestScenario.ts +52 -48
- package/src/orchestrate/test/orchestrateTestWrite.ts +20 -10
- package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +49 -46
- package/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.ts +8 -0
- package/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.ts +1 -0
- package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +14 -0
- package/src/orchestrate/test/utils/getReferenceIds.ts +25 -0
- package/src/structures/IAutoBeConfig.ts +3 -0
- package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.d.ts +0 -7
- package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js +0 -35
- package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js.map +0 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js.map +0 -1
- package/lib/orchestrate/interface/utils/validateAuthorizationSchema.d.ts +0 -7
- package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
- package/src/orchestrate/interface/utils/validateAuthorizationSchema.ts +0 -41
|
@@ -51,27 +51,24 @@ const utils_1 = require("@autobe/utils");
|
|
|
51
51
|
const typia_1 = __importDefault(require("typia"));
|
|
52
52
|
const uuid_1 = require("uuid");
|
|
53
53
|
const assertSchemaModel_1 = require("../../context/assertSchemaModel");
|
|
54
|
-
const getTestScenarioArtifacts_1 = require("../test/compile/getTestScenarioArtifacts");
|
|
55
54
|
const transformRealizeWriteHistories_1 = require("./histories/transformRealizeWriteHistories");
|
|
55
|
+
const getRealizeWriteDto_1 = require("./utils/getRealizeWriteDto");
|
|
56
56
|
const replaceImportStatements_1 = require("./utils/replaceImportStatements");
|
|
57
57
|
function orchestrateRealizeWrite(ctx, props) {
|
|
58
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
59
59
|
var _a, _b, _c;
|
|
60
|
-
const artifacts = yield (0, getTestScenarioArtifacts_1.getTestScenarioArtifacts)(ctx, {
|
|
61
|
-
endpoint: props.scenario.operation,
|
|
62
|
-
dependencies: [],
|
|
63
|
-
});
|
|
64
60
|
const pointer = {
|
|
65
61
|
value: null,
|
|
66
62
|
};
|
|
63
|
+
const dto = yield (0, getRealizeWriteDto_1.getRealizeWriteDto)(ctx, props.scenario.operation);
|
|
67
64
|
const { tokenUsage } = yield ctx.conversate({
|
|
68
65
|
source: "realizeWrite",
|
|
69
66
|
histories: (0, transformRealizeWriteHistories_1.transformRealizeWriteHistories)({
|
|
70
67
|
state: ctx.state(),
|
|
71
68
|
scenario: props.scenario,
|
|
72
|
-
artifacts,
|
|
73
69
|
authorization: props.authorization,
|
|
74
70
|
totalAuthorizations: props.totalAuthorizations,
|
|
71
|
+
dto,
|
|
75
72
|
}),
|
|
76
73
|
controller: createController({
|
|
77
74
|
model: ctx.model,
|
|
@@ -101,7 +98,11 @@ function orchestrateRealizeWrite(ctx, props) {
|
|
|
101
98
|
});
|
|
102
99
|
if (pointer.value === null)
|
|
103
100
|
throw new Error("Failed to write code.");
|
|
104
|
-
pointer.value.implementationCode = yield (0, replaceImportStatements_1.replaceImportStatements)(ctx
|
|
101
|
+
pointer.value.implementationCode = yield (0, replaceImportStatements_1.replaceImportStatements)(ctx, {
|
|
102
|
+
operation: props.scenario.operation,
|
|
103
|
+
code: pointer.value.implementationCode,
|
|
104
|
+
decoratorType: (_a = props.authorization) === null || _a === void 0 ? void 0 : _a.payload.name,
|
|
105
|
+
});
|
|
105
106
|
const event = {
|
|
106
107
|
type: "realizeWrite",
|
|
107
108
|
id: (0, uuid_1.v7)(),
|
|
@@ -141,31 +142,27 @@ const claude = {
|
|
|
141
142
|
{
|
|
142
143
|
name: "coding",
|
|
143
144
|
parameters: {
|
|
144
|
-
description: "
|
|
145
|
+
description: " Properties containing the multi-phase implementation plan and code\n\n------------------------------\n\nDescription of the current {@link IAutoBeRealizeWriteApplication.IProps} type:\n\n> Properties for the Realize Write Application following Chain of Thinking (CoT).\n> \n> Each field represents a distinct phase in the reasoning and implementation process,\n> building upon the previous step to create a complete, error-free implementation.\n> This structured approach ensures clarity, debuggability, and systematic thinking.",
|
|
145
146
|
type: "object",
|
|
146
147
|
properties: {
|
|
147
148
|
plan: {
|
|
148
|
-
description: "Step 1
|
|
149
|
+
description: "Step 1 - Planning Phase (CoT: Initial Reasoning)\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 follows a SCHEMA-FIRST APPROACH:\n\n\uD83D\uDCCB STEP 1 - PRISMA SCHEMA VERIFICATION:\n\nDO:\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\n- Verify database compatibility (PostgreSQL AND SQLite)\n\nDO NOT:\n\n- Assume common fields exist without verification\n- Use fields like deleted_at, created_by, updated_by, is_deleted, is_active\n without checking\n- Use PostgreSQL-specific features like mode: \"insensitive\"\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",
|
|
149
150
|
type: "string"
|
|
150
151
|
},
|
|
151
152
|
prisma_schemas: {
|
|
152
|
-
description: "Step 2
|
|
153
|
+
description: "Step 2 - Schema Definition (CoT: Context Establishment)\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",
|
|
153
154
|
type: "string"
|
|
154
155
|
},
|
|
155
156
|
draft_without_date_type: {
|
|
156
|
-
description: "Step 3
|
|
157
|
+
description: "Step 3 - Initial Draft (CoT: First Implementation Attempt)\n\nDraft WITHOUT using native Date type.\n\nThis is the initial drafting phase where you outline the basic skeleton\nof the function.\n\nDO NOT: Use the native Date type.\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\nImport rules:\n\nDO NOT:\n\n- Add any new import statements manually\n- Write import statements directly (this causes compile errors)\n\nNote: All necessary imports are provided globally or by the system\nautomatically.\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.",
|
|
157
158
|
type: "string"
|
|
158
159
|
},
|
|
159
160
|
review: {
|
|
160
|
-
description: "Step 4
|
|
161
|
-
type: "string"
|
|
162
|
-
},
|
|
163
|
-
withCompilerFeedback: {
|
|
164
|
-
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'>`).\n- If no TypeScript errors exist, this field MUST contain the text: \"No\n TypeScript errors detected - skipping this phase\"",
|
|
161
|
+
description: "Step 4 - Review and Refinement (CoT: Self-Reflection)\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.\n- NEVER use `mode: \"insensitive\"` in string operations (breaks SQLite).",
|
|
165
162
|
type: "string"
|
|
166
163
|
},
|
|
167
164
|
implementationCode: {
|
|
168
|
-
description: "Step 5
|
|
165
|
+
description: "Step 5 - Complete Implementation (CoT: Final Synthesis)\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- NEVER uses `mode: \"insensitive\"` (PostgreSQL-only, breaks SQLite).\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.",
|
|
169
166
|
type: "string"
|
|
170
167
|
}
|
|
171
168
|
},
|
|
@@ -174,13 +171,13 @@ const claude = {
|
|
|
174
171
|
"prisma_schemas",
|
|
175
172
|
"draft_without_date_type",
|
|
176
173
|
"review",
|
|
177
|
-
"withCompilerFeedback",
|
|
178
174
|
"implementationCode"
|
|
179
175
|
],
|
|
180
176
|
additionalProperties: false,
|
|
181
177
|
$defs: {}
|
|
182
178
|
},
|
|
183
|
-
|
|
179
|
+
description: "Generates provider function implementation through multi-phase development.\n\nThis method implements a systematic approach to generate NestJS provider\nfunctions that handle business logic for API operations. It follows a\nschema-first approach with multiple refinement phases to ensure type-safe,\nerror-free code generation.\n\nThe generation process includes:\n1. Strategic planning based on Prisma schema analysis\n2. Initial draft without Date type usage\n3. Review and refinement for completeness\n4. Compiler feedback integration if errors detected\n5. Final implementation with all validations and type safety",
|
|
180
|
+
validate: (() => { const _io0 = input => "string" === typeof input.plan && "string" === typeof input.prisma_schemas && "string" === typeof input.draft_without_date_type && "string" === typeof input.review && "string" === typeof input.implementationCode; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.plan || _report(_exceptionable, {
|
|
184
181
|
path: _path + ".plan",
|
|
185
182
|
expected: "string",
|
|
186
183
|
value: input.plan
|
|
@@ -196,10 +193,6 @@ const claude = {
|
|
|
196
193
|
path: _path + ".review",
|
|
197
194
|
expected: "string",
|
|
198
195
|
value: input.review
|
|
199
|
-
}), "string" === typeof input.withCompilerFeedback || _report(_exceptionable, {
|
|
200
|
-
path: _path + ".withCompilerFeedback",
|
|
201
|
-
expected: "string",
|
|
202
|
-
value: input.withCompilerFeedback
|
|
203
196
|
}), "string" === typeof input.implementationCode || _report(_exceptionable, {
|
|
204
197
|
path: _path + ".implementationCode",
|
|
205
198
|
expected: "string",
|
|
@@ -247,31 +240,27 @@ const collection = {
|
|
|
247
240
|
{
|
|
248
241
|
name: "coding",
|
|
249
242
|
parameters: {
|
|
250
|
-
description: "
|
|
243
|
+
description: " Properties containing the multi-phase implementation plan and code\n\n------------------------------\n\nDescription of the current {@link IAutoBeRealizeWriteApplication.IProps} type:\n\n> Properties for the Realize Write Application following Chain of Thinking (CoT).\n> \n> Each field represents a distinct phase in the reasoning and implementation process,\n> building upon the previous step to create a complete, error-free implementation.\n> This structured approach ensures clarity, debuggability, and systematic thinking.",
|
|
251
244
|
type: "object",
|
|
252
245
|
properties: {
|
|
253
246
|
plan: {
|
|
254
|
-
description: "Step 1
|
|
247
|
+
description: "Step 1 - Planning Phase (CoT: Initial Reasoning)\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 follows a SCHEMA-FIRST APPROACH:\n\n\uD83D\uDCCB STEP 1 - PRISMA SCHEMA VERIFICATION:\n\nDO:\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\n- Verify database compatibility (PostgreSQL AND SQLite)\n\nDO NOT:\n\n- Assume common fields exist without verification\n- Use fields like deleted_at, created_by, updated_by, is_deleted, is_active\n without checking\n- Use PostgreSQL-specific features like mode: \"insensitive\"\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",
|
|
255
248
|
type: "string"
|
|
256
249
|
},
|
|
257
250
|
prisma_schemas: {
|
|
258
|
-
description: "Step 2
|
|
251
|
+
description: "Step 2 - Schema Definition (CoT: Context Establishment)\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",
|
|
259
252
|
type: "string"
|
|
260
253
|
},
|
|
261
254
|
draft_without_date_type: {
|
|
262
|
-
description: "Step 3
|
|
255
|
+
description: "Step 3 - Initial Draft (CoT: First Implementation Attempt)\n\nDraft WITHOUT using native Date type.\n\nThis is the initial drafting phase where you outline the basic skeleton\nof the function.\n\nDO NOT: Use the native Date type.\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\nImport rules:\n\nDO NOT:\n\n- Add any new import statements manually\n- Write import statements directly (this causes compile errors)\n\nNote: All necessary imports are provided globally or by the system\nautomatically.\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.",
|
|
263
256
|
type: "string"
|
|
264
257
|
},
|
|
265
258
|
review: {
|
|
266
|
-
description: "Step 4
|
|
267
|
-
type: "string"
|
|
268
|
-
},
|
|
269
|
-
withCompilerFeedback: {
|
|
270
|
-
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'>`).\n- If no TypeScript errors exist, this field MUST contain the text: \"No\n TypeScript errors detected - skipping this phase\"",
|
|
259
|
+
description: "Step 4 - Review and Refinement (CoT: Self-Reflection)\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.\n- NEVER use `mode: \"insensitive\"` in string operations (breaks SQLite).",
|
|
271
260
|
type: "string"
|
|
272
261
|
},
|
|
273
262
|
implementationCode: {
|
|
274
|
-
description: "Step 5
|
|
263
|
+
description: "Step 5 - Complete Implementation (CoT: Final Synthesis)\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- NEVER uses `mode: \"insensitive\"` (PostgreSQL-only, breaks SQLite).\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.",
|
|
275
264
|
type: "string"
|
|
276
265
|
}
|
|
277
266
|
},
|
|
@@ -280,13 +269,13 @@ const collection = {
|
|
|
280
269
|
"prisma_schemas",
|
|
281
270
|
"draft_without_date_type",
|
|
282
271
|
"review",
|
|
283
|
-
"withCompilerFeedback",
|
|
284
272
|
"implementationCode"
|
|
285
273
|
],
|
|
286
274
|
additionalProperties: false,
|
|
287
275
|
$defs: {}
|
|
288
276
|
},
|
|
289
|
-
|
|
277
|
+
description: "Generates provider function implementation through multi-phase development.\n\nThis method implements a systematic approach to generate NestJS provider\nfunctions that handle business logic for API operations. It follows a\nschema-first approach with multiple refinement phases to ensure type-safe,\nerror-free code generation.\n\nThe generation process includes:\n1. Strategic planning based on Prisma schema analysis\n2. Initial draft without Date type usage\n3. Review and refinement for completeness\n4. Compiler feedback integration if errors detected\n5. Final implementation with all validations and type safety",
|
|
278
|
+
validate: (() => { const _io0 = input => "string" === typeof input.plan && "string" === typeof input.prisma_schemas && "string" === typeof input.draft_without_date_type && "string" === typeof input.review && "string" === typeof input.implementationCode; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.plan || _report(_exceptionable, {
|
|
290
279
|
path: _path + ".plan",
|
|
291
280
|
expected: "string",
|
|
292
281
|
value: input.plan
|
|
@@ -302,10 +291,6 @@ const collection = {
|
|
|
302
291
|
path: _path + ".review",
|
|
303
292
|
expected: "string",
|
|
304
293
|
value: input.review
|
|
305
|
-
}), "string" === typeof input.withCompilerFeedback || _report(_exceptionable, {
|
|
306
|
-
path: _path + ".withCompilerFeedback",
|
|
307
|
-
expected: "string",
|
|
308
|
-
value: input.withCompilerFeedback
|
|
309
294
|
}), "string" === typeof input.implementationCode || _report(_exceptionable, {
|
|
310
295
|
path: _path + ".implementationCode",
|
|
311
296
|
expected: "string",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrateRealizeWrite.js","sourceRoot":"","sources":["../../../../../src/orchestrate/realize/orchestrateRealizeWrite.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"orchestrateRealizeWrite.js","sourceRoot":"","sources":["../../../../../src/orchestrate/realize/orchestrateRealizeWrite.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,0DAuEC;;AArFD,yCAA2C;AAG3C,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,+FAA4F;AAG5F,mEAAgE;AAChE,6EAA0E;AAE1E,SAAsB,uBAAuB,CAC3C,GAAyB,EACzB,KAMC;;;QAED,MAAM,OAAO,GAA2D;YACtE,KAAK,EAAE,IAAI;SACZ,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,IAAA,uCAAkB,EAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACpE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC;YAC1C,MAAM,EAAE,cAAc;YACtB,SAAS,EAAE,IAAA,+DAA8B,EAAC;gBACxC,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE;gBAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,aAAa,EAAE,KAAK,CAAC,aAAa;gBAClC,mBAAmB,EAAE,KAAK,CAAC,mBAAmB;gBAC9C,GAAG;aACJ,CAAC;YACF,UAAU,EAAE,gBAAgB,CAAC;gBAC3B,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;oBACd,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;gBACvB,CAAC;aACF,CAAC;YACF,mBAAmB,EAAE,IAAI;YACzB,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,OAAO,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;KAgBvB;SACF,CAAC,CAAC;QACH,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAErE,OAAO,CAAC,KAAK,CAAC,kBAAkB,GAAG,MAAM,IAAA,iDAAuB,EAAC,GAAG,EAAE;YACpE,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS;YACnC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,kBAAkB;YACtC,aAAa,EAAE,MAAA,KAAK,CAAC,aAAa,0CAAE,OAAO,CAAC,IAAI;SACjD,CAAC,CAAC;QAEH,MAAM,KAAK,GAA4B;YACrC,IAAI,EAAE,cAAc;YACpB,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,QAAQ;YACjC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,kBAAkB;YACzC,UAAU;YACV,SAAS,EAAE,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS;YACrC,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK;YAC3B,IAAI,EAAE,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,OAAO,0CAAE,IAAI,mCAAI,CAAC;YACpC,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACrC,CAAC;QACF,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACpB,OAAO,KAAK,CAAC;IACf,CAAC;CAAA;AAED,SAAS,gBAAgB,CAAiC,KAGzD;IACC,IAAA,qCAAiB,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAE/B,MAAM,WAAW,GAA2B,UAAU,CACpD,KAAK,CAAC,KAAK,CACwD,CAAC;IAEtE,OAAO;QACL,QAAQ,EAAE,OAAO;QACjB,IAAI,EAAE,YAAY;QAClB,WAAW;QACX,OAAO,EAAE;YACP,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBACf,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACpB,CAAC;SACuC;KAC3C,CAAC;AACJ,CAAC;AAED,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGT,CAAC;AACJ,MAAM,UAAU,GAAG;IACjB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAAoE;IAC3E,MAAM;IACN,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;CACd,CAAC"}
|
package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import { CamelPattern, PascalPattern } from "@autobe/interface";
|
|
2
2
|
export interface IAutoBeRealizeAuthorizationApplication {
|
|
3
|
+
/**
|
|
4
|
+
* Generates authentication provider, decorator, and payload type for role-based authorization.
|
|
5
|
+
*
|
|
6
|
+
* This method creates a complete authentication infrastructure for a specific
|
|
7
|
+
* role in the NestJS application. It generates three interconnected components
|
|
8
|
+
* that work together to provide JWT-based authentication and authorization.
|
|
9
|
+
*
|
|
10
|
+
* The generated components include:
|
|
11
|
+
* - **Provider Function**: Handles JWT verification and user validation from database
|
|
12
|
+
* - **Decorator**: NestJS parameter decorator for injecting authenticated user data
|
|
13
|
+
* - **Payload Type**: TypeScript interface defining the authenticated user structure
|
|
14
|
+
*
|
|
15
|
+
* All components follow strict naming conventions and integrate with the existing
|
|
16
|
+
* authentication architecture using the shared jwtAuthorize function.
|
|
17
|
+
*
|
|
18
|
+
* @param next Properties containing provider, decorator, and payload type configurations
|
|
19
|
+
*/
|
|
3
20
|
createDecorator: (next: IAutoBeRealizeAuthorizationApplication.IProps) => void;
|
|
4
21
|
}
|
|
5
22
|
export declare namespace IAutoBeRealizeAuthorizationApplication {
|
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
import { IAutoBeRealizeAuthorizationApplication } from "./IAutoBeRealizeAuthorizationApplication";
|
|
2
2
|
export interface IAutoBeRealizeAuthorizationCorrectApplication {
|
|
3
|
+
/**
|
|
4
|
+
* Corrects TypeScript compilation errors in authentication components.
|
|
5
|
+
*
|
|
6
|
+
* This method analyzes and fixes compilation errors in previously generated
|
|
7
|
+
* authentication provider, decorator, and payload type implementations. It
|
|
8
|
+
* performs systematic error diagnosis and generates corrected versions of
|
|
9
|
+
* all three components while maintaining their interconnected functionality.
|
|
10
|
+
*
|
|
11
|
+
* The correction process includes:
|
|
12
|
+
* - TypeScript error analysis and categorization by component
|
|
13
|
+
* - Identification of type mismatches, import issues, and syntax errors
|
|
14
|
+
* - Clear solution guidance for each identified problem
|
|
15
|
+
* - Regeneration of all components with fixes applied
|
|
16
|
+
*
|
|
17
|
+
* The corrected components maintain the same naming conventions and
|
|
18
|
+
* architectural patterns as the original generation while resolving all
|
|
19
|
+
* compilation issues.
|
|
20
|
+
*
|
|
21
|
+
* @param next Properties containing error analysis, solution guidance, and corrected components
|
|
22
|
+
*/
|
|
3
23
|
correctDecorator: (next: IAutoBeRealizeAuthorizationCorrectApplication.IProps) => void;
|
|
4
24
|
}
|
|
5
25
|
export declare namespace IAutoBeRealizeAuthorizationCorrectApplication {
|
|
@@ -1,79 +1,39 @@
|
|
|
1
|
-
import { IAutoBeRealizeWriteApplication } from "./IAutoBeRealizeWriteApplication";
|
|
2
1
|
export interface IAutoBeRealizeCorrectApplication {
|
|
2
|
+
/**
|
|
3
|
+
* Reviews and corrects TypeScript compilation errors.
|
|
4
|
+
*
|
|
5
|
+
* Fixes TypeScript compilation errors while preserving original business
|
|
6
|
+
* logic, applying minimal intervention principle.
|
|
7
|
+
*
|
|
8
|
+
* @param props Properties containing the multi-phase error correction process
|
|
9
|
+
*/
|
|
3
10
|
review: (props: IAutoBeRealizeCorrectApplication.IProps) => void;
|
|
4
11
|
}
|
|
5
12
|
export declare namespace IAutoBeRealizeCorrectApplication {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* - Specific fixes for each error type
|
|
32
|
-
* - Priority order for addressing errors (fix critical errors first)
|
|
33
|
-
* - Alternative approaches if the direct fix is not possible
|
|
34
|
-
*
|
|
35
|
-
* 📝 SCHEMA VERIFICATION:
|
|
36
|
-
*
|
|
37
|
-
* - Re-verification of Prisma schema fields actually available
|
|
38
|
-
* - Identification of assumed fields that don't exist
|
|
39
|
-
* - Correct field types and relationships
|
|
40
|
-
*
|
|
41
|
-
* ⚠️ COMMON ERROR PATTERNS TO CHECK:
|
|
42
|
-
*
|
|
43
|
-
* - Using non-existent fields (e.g., deleted_at, created_by)
|
|
44
|
-
* - Type mismatches in Prisma operations
|
|
45
|
-
* - Incorrect date handling (using Date instead of string)
|
|
46
|
-
* - Missing required fields in create/update operations
|
|
47
|
-
* - Incorrect relation handling in nested operations
|
|
48
|
-
*
|
|
49
|
-
* 🎯 CORRECTION APPROACH:
|
|
50
|
-
*
|
|
51
|
-
* - Remove references to non-existent fields
|
|
52
|
-
* - Fix type conversions (especially dates with toISOStringSafe())
|
|
53
|
-
* - Simplify complex nested operations into separate queries
|
|
54
|
-
* - Add missing required fields
|
|
55
|
-
* - Use correct Prisma input types
|
|
56
|
-
*
|
|
57
|
-
* Example structure:
|
|
58
|
-
*
|
|
59
|
-
* Errors Found:
|
|
60
|
-
* 1. TS2339: Property 'deleted_at' does not exist on type 'User'
|
|
61
|
-
* - Cause: Field assumed but not in schema
|
|
62
|
-
* - Fix: Remove all deleted_at references
|
|
63
|
-
*
|
|
64
|
-
* 2. TS2345: Type 'Date' is not assignable to type 'string'
|
|
65
|
-
* - Cause: Direct Date assignment without conversion
|
|
66
|
-
* - Fix: Use toISOStringSafe() for all date values
|
|
67
|
-
*
|
|
68
|
-
* Resolution Plan:
|
|
69
|
-
* 1. First, remove all non-existent field references
|
|
70
|
-
* 2. Then, fix all date type conversions
|
|
71
|
-
* 3. Finally, adjust Prisma query structures
|
|
72
|
-
*
|
|
73
|
-
* This analysis ensures the review process addresses all compilation errors
|
|
74
|
-
* systematically and produces error-free code in the corrected
|
|
75
|
-
* implementation.
|
|
76
|
-
*/
|
|
77
|
-
errorAnalysis: string;
|
|
13
|
+
/**
|
|
14
|
+
* Properties for error correction following Chain of Thinking (CoT).
|
|
15
|
+
*
|
|
16
|
+
* All phases are wrapped in a `revise` object for systematic error
|
|
17
|
+
* resolution.
|
|
18
|
+
*/
|
|
19
|
+
interface IProps {
|
|
20
|
+
/** Revision process containing all error correction phases. */
|
|
21
|
+
revise: IRevise;
|
|
22
|
+
}
|
|
23
|
+
interface IRevise {
|
|
24
|
+
/** Step 1: Compilation error analysis and resolution strategy. */
|
|
25
|
+
errorAnalysis?: string;
|
|
26
|
+
/** Step 2: Provider function implementation plan. */
|
|
27
|
+
plan?: string;
|
|
28
|
+
/** Step 3: Relevant Prisma schema definitions. */
|
|
29
|
+
prismaSchemas?: string;
|
|
30
|
+
/** Step 4: Initial draft without using native Date type. */
|
|
31
|
+
draftWithoutDateType?: string;
|
|
32
|
+
/** Step 5: Refined version with improved completeness. */
|
|
33
|
+
review?: string;
|
|
34
|
+
/** Step 6: Corrected implementation after compiler feedback. */
|
|
35
|
+
withCompilerFeedback?: string;
|
|
36
|
+
/** Step 7: Final complete TypeScript function implementation. */
|
|
37
|
+
implementationCode: string;
|
|
78
38
|
}
|
|
79
39
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAutoBeRealizeFunctionFailure.js","sourceRoot":"","sources":["../../../../../../src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.ts"],"names":[],"mappings":""}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
AutoBeRealizeAuthorization,
|
|
4
|
-
AutoBeTestFile,
|
|
5
|
-
} from "@autobe/interface";
|
|
6
|
-
|
|
7
|
-
export namespace IAutoBeRealizeScenarioApplication {
|
|
8
|
-
export interface IProps {
|
|
1
|
+
import { AutoBeOpenApi, AutoBeRealizeAuthorization, AutoBeTestFile } from "@autobe/interface";
|
|
2
|
+
export interface IAutoBeRealizeScenarioResult {
|
|
9
3
|
/** The OpenAPI operation to be realized. */
|
|
10
4
|
operation: AutoBeOpenApi.IOperation;
|
|
11
|
-
|
|
12
5
|
/**
|
|
13
6
|
* The name of the function to be generated.
|
|
14
7
|
*
|
|
@@ -21,10 +14,8 @@ export namespace IAutoBeRealizeScenarioApplication {
|
|
|
21
14
|
* `src/providers/${function_name}.ts`.
|
|
22
15
|
*/
|
|
23
16
|
functionName: string;
|
|
24
|
-
|
|
25
17
|
/** For example, `src/providers/${function_name}.ts`. */
|
|
26
18
|
location: string;
|
|
27
|
-
|
|
28
19
|
/**
|
|
29
20
|
* List of scenario descriptions for test code generation.
|
|
30
21
|
*
|
|
@@ -33,7 +24,6 @@ export namespace IAutoBeRealizeScenarioApplication {
|
|
|
33
24
|
* generation.
|
|
34
25
|
*/
|
|
35
26
|
testFiles: AutoBeTestFile[];
|
|
36
|
-
|
|
37
27
|
/**
|
|
38
28
|
* Optional decorator event for customizing code generation behavior.
|
|
39
29
|
*
|
|
@@ -43,5 +33,4 @@ export namespace IAutoBeRealizeScenarioApplication {
|
|
|
43
33
|
* final code output.
|
|
44
34
|
*/
|
|
45
35
|
decoratorEvent?: AutoBeRealizeAuthorization;
|
|
46
|
-
}
|
|
47
36
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAutoBeRealizeScenarioResult.js","sourceRoot":"","sources":["../../../../../../src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
export interface IAutoBeRealizeWriteApplication {
|
|
2
|
+
/**
|
|
3
|
+
* Generates provider function implementation through multi-phase development.
|
|
4
|
+
*
|
|
5
|
+
* This method implements a systematic approach to generate NestJS provider
|
|
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.
|
|
9
|
+
*
|
|
10
|
+
* The generation process includes:
|
|
11
|
+
* 1. Strategic planning based on Prisma schema analysis
|
|
12
|
+
* 2. Initial draft without Date type usage
|
|
13
|
+
* 3. Review and refinement for completeness
|
|
14
|
+
* 4. Compiler feedback integration if errors detected
|
|
15
|
+
* 5. Final implementation with all validations and type safety
|
|
16
|
+
*
|
|
17
|
+
* @param next Properties containing the multi-phase implementation plan and code
|
|
18
|
+
*/
|
|
2
19
|
coding: (next: IAutoBeRealizeWriteApplication.IProps) => void;
|
|
3
20
|
}
|
|
4
21
|
export declare namespace IAutoBeRealizeWriteApplication {
|
|
22
|
+
/**
|
|
23
|
+
* Properties for the Realize Write Application following Chain of Thinking (CoT).
|
|
24
|
+
*
|
|
25
|
+
* Each field represents a distinct phase in the reasoning and implementation process,
|
|
26
|
+
* building upon the previous step to create a complete, error-free implementation.
|
|
27
|
+
* This structured approach ensures clarity, debuggability, and systematic thinking.
|
|
28
|
+
*/
|
|
5
29
|
interface IProps {
|
|
6
30
|
/**
|
|
7
|
-
* Step 1
|
|
31
|
+
* Step 1 - Planning Phase (CoT: Initial Reasoning)
|
|
8
32
|
*
|
|
9
33
|
* 🧠 Provider Function Implementation Plan
|
|
10
34
|
*
|
|
@@ -21,12 +45,14 @@ export declare namespace IAutoBeRealizeWriteApplication {
|
|
|
21
45
|
* - Examine the actual Prisma schema model definition
|
|
22
46
|
* - List EVERY field that exists in the model with exact types
|
|
23
47
|
* - Explicitly note fields that DO NOT exist
|
|
48
|
+
* - Verify database compatibility (PostgreSQL AND SQLite)
|
|
24
49
|
*
|
|
25
50
|
* DO NOT:
|
|
26
51
|
*
|
|
27
52
|
* - Assume common fields exist without verification
|
|
28
53
|
* - Use fields like deleted_at, created_by, updated_by, is_deleted, is_active
|
|
29
54
|
* without checking
|
|
55
|
+
* - Use PostgreSQL-specific features like mode: "insensitive"
|
|
30
56
|
*
|
|
31
57
|
* 📋 STEP 2 - FIELD INVENTORY:
|
|
32
58
|
*
|
|
@@ -134,7 +160,7 @@ export declare namespace IAutoBeRealizeWriteApplication {
|
|
|
134
160
|
*/
|
|
135
161
|
plan: string;
|
|
136
162
|
/**
|
|
137
|
-
* Step 2
|
|
163
|
+
* Step 2 - Schema Definition (CoT: Context Establishment)
|
|
138
164
|
*
|
|
139
165
|
* The Prisma schema string that will be used to validate the implementation
|
|
140
166
|
* logic in this file.
|
|
@@ -155,7 +181,7 @@ export declare namespace IAutoBeRealizeWriteApplication {
|
|
|
155
181
|
*/
|
|
156
182
|
prisma_schemas: string;
|
|
157
183
|
/**
|
|
158
|
-
* Step 3
|
|
184
|
+
* Step 3 - Initial Draft (CoT: First Implementation Attempt)
|
|
159
185
|
*
|
|
160
186
|
* Draft WITHOUT using native Date type.
|
|
161
187
|
*
|
|
@@ -191,7 +217,7 @@ export declare namespace IAutoBeRealizeWriteApplication {
|
|
|
191
217
|
*/
|
|
192
218
|
draft_without_date_type: string;
|
|
193
219
|
/**
|
|
194
|
-
* Step 4
|
|
220
|
+
* Step 4 - Review and Refinement (CoT: Self-Reflection)
|
|
195
221
|
*
|
|
196
222
|
* A refined version of the draft with improved completeness.
|
|
197
223
|
*
|
|
@@ -205,27 +231,11 @@ export declare namespace IAutoBeRealizeWriteApplication {
|
|
|
205
231
|
* - Avoid unsafe `as` casts unless only for branding or literal narrowing.
|
|
206
232
|
* - Use `toISOStringSafe()` for all date conversions (NOT `.toISOString()`).
|
|
207
233
|
* - Ensure all object keys strictly conform to the expected type definitions.
|
|
234
|
+
* - NEVER use `mode: "insensitive"` in string operations (breaks SQLite).
|
|
208
235
|
*/
|
|
209
236
|
review: string;
|
|
210
237
|
/**
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* A correction pass that applies fixes for compile-time errors that arose
|
|
214
|
-
* during the review stage (if any).
|
|
215
|
-
*
|
|
216
|
-
* ✅ Must:
|
|
217
|
-
*
|
|
218
|
-
* - Only include this field if TypeScript errors are detected in the Review
|
|
219
|
-
* phase.
|
|
220
|
-
* - Resolve all TypeScript errors without using `as any`.
|
|
221
|
-
* - Provide safe brand casting only if required (e.g., `as string &
|
|
222
|
-
* tags.Format<'uuid'>`).
|
|
223
|
-
* - If no TypeScript errors exist, this field MUST contain the text: "No
|
|
224
|
-
* TypeScript errors detected - skipping this phase"
|
|
225
|
-
*/
|
|
226
|
-
withCompilerFeedback: string;
|
|
227
|
-
/**
|
|
228
|
-
* Step 5.
|
|
238
|
+
* Step 5 - Complete Implementation (CoT: Final Synthesis)
|
|
229
239
|
*
|
|
230
240
|
* The complete and fully correct TypeScript function implementation.
|
|
231
241
|
*
|
|
@@ -237,6 +247,7 @@ export declare namespace IAutoBeRealizeWriteApplication {
|
|
|
237
247
|
* - Uses only allowed imports (e.g., from `../api/structures` and
|
|
238
248
|
* `MyGlobal.prisma`).
|
|
239
249
|
* - NEVER creates intermediate variables for Prisma operations.
|
|
250
|
+
* - NEVER uses `mode: "insensitive"` (PostgreSQL-only, breaks SQLite).
|
|
240
251
|
*
|
|
241
252
|
* ⚠️ Fallback Behavior:
|
|
242
253
|
*
|