@autobe/agent 0.20.0 → 0.22.0
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/AutoBeMockAgent.js +1 -0
- package/lib/agent/src/AutoBeMockAgent.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 -26
- package/lib/agent/src/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/agent/src/context/AutoBeContext.d.ts +3 -2
- 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 +16 -11
- 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.d.ts +4 -0
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +33 -0
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -0
- 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 +5 -3
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +365 -0
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -0
- 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 +244 -176
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +3466 -103
- 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 +3672 -358
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js +3 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -101
- 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/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/interface/utils/validateAuthorizationSchema.js.map +1 -1
- 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 +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} +3 -10
- 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 +40 -24
- 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.js +15 -14
- package/lib/agent/src/orchestrate/test/compile/completeTestCode.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js +1 -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 +4 -2
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +40 -25
- 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.d.ts +3 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +137 -96
- 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 +126 -72
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +54 -48
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +122 -43
- 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/IAutoBeTestScenarioApplication.d.ts +28 -1
- 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 -26
- package/lib/context/AutoBeContext.d.ts +3 -2
- package/lib/index.mjs +13778 -3055
- 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/transformInterfaceEndpointsReviewHistories.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/orchestrateInterfaceEndpointsReview.d.ts +10 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -101
- 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/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 +40 -24
- 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/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 +4 -2
- package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
- 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/IAutoBeTestScenarioApplication.d.ts +28 -1
- 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/AutoBeMockAgent.ts +1 -0
- package/src/constants/AutoBeConfigConstant.ts +3 -0
- package/src/constants/AutoBeSystemPromptConstant.ts +27 -26
- package/src/context/AutoBeContext.ts +3 -0
- package/src/context/AutoBeTokenUsageComponent.ts +3 -3
- package/src/factory/consentFunctionCall.ts +2 -0
- package/src/factory/createAutoBeContext.ts +145 -135
- 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/transformInterfaceEndpointsReviewHistories.ts +39 -0
- 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/orchestrateInterfaceEndpoints.ts +5 -1
- package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +95 -0
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +11 -11
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +7 -3
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +33 -91
- package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +72 -95
- package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.ts +65 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +0 -39
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +50 -104
- 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/fulfillJsonSchemaErrorMessages.ts +90 -0
- package/src/orchestrate/interface/utils/validateAuthorizationSchema.ts +2 -2
- 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 +9 -5
- 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 +43 -27
- 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 +15 -26
- package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +3 -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 +48 -36
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +6 -5
- package/src/orchestrate/test/histories/transformTestWriteHistories.ts +43 -4
- package/src/orchestrate/test/orchestrateTest.ts +6 -0
- package/src/orchestrate/test/orchestrateTestCorrect.ts +46 -11
- package/src/orchestrate/test/orchestrateTestScenario.ts +52 -48
- package/src/orchestrate/test/orchestrateTestWrite.ts +24 -6
- package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +49 -46
- package/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.ts +8 -0
- package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +28 -1
- 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/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js.map +0 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js +0 -75
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js.map +0 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
- package/lib/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
- package/src/orchestrate/test/histories/transformTestHistories.ts +0 -78
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
AutoBeRealizeHistory,
|
|
8
8
|
AutoBeRealizeWriteEvent,
|
|
9
9
|
IAutoBeCompiler,
|
|
10
|
-
IAutoBeTypeScriptCompileResult,
|
|
11
10
|
} from "@autobe/interface";
|
|
12
11
|
import { ILlmSchema } from "@samchon/openapi";
|
|
13
12
|
import { v7 } from "uuid";
|
|
@@ -16,12 +15,11 @@ import { AutoBeContext } from "../../context/AutoBeContext";
|
|
|
16
15
|
import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
|
|
17
16
|
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
18
17
|
import { predicateStateMessage } from "../../utils/predicateStateMessage";
|
|
19
|
-
import { compileRealizeFiles } from "./internal/compileRealizeFiles";
|
|
20
18
|
import { orchestrateRealizeAuthorization } from "./orchestrateRealizeAuthorization";
|
|
21
19
|
import { orchestrateRealizeCorrect } from "./orchestrateRealizeCorrect";
|
|
22
20
|
import { orchestrateRealizeScenario } from "./orchestrateRealizeScenario";
|
|
23
21
|
import { orchestrateRealizeWrite } from "./orchestrateRealizeWrite";
|
|
24
|
-
import {
|
|
22
|
+
import { IAutoBeRealizeScenarioResult } from "./structures/IAutoBeRealizeScenarioResult";
|
|
25
23
|
|
|
26
24
|
export const orchestrateRealize =
|
|
27
25
|
<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>) =>
|
|
@@ -60,14 +58,15 @@ export const orchestrateRealize =
|
|
|
60
58
|
await orchestrateRealizeAuthorization(ctx);
|
|
61
59
|
|
|
62
60
|
// SCENARIOS
|
|
63
|
-
const scenarios:
|
|
64
|
-
|
|
61
|
+
const scenarios: IAutoBeRealizeScenarioResult[] = operations.map(
|
|
62
|
+
(operation) => {
|
|
65
63
|
const authorization = authorizations.find(
|
|
66
64
|
(el) => el.role.name === operation.authorizationRole,
|
|
67
65
|
);
|
|
68
66
|
|
|
69
67
|
return orchestrateRealizeScenario(ctx, operation, authorization);
|
|
70
|
-
}
|
|
68
|
+
},
|
|
69
|
+
);
|
|
71
70
|
|
|
72
71
|
const writeProgress: AutoBeProgressEventBase = {
|
|
73
72
|
total: scenarios.length,
|
|
@@ -103,76 +102,20 @@ export const orchestrateRealize =
|
|
|
103
102
|
};
|
|
104
103
|
});
|
|
105
104
|
|
|
106
|
-
|
|
105
|
+
const reviewProgress = {
|
|
106
|
+
total: writeEvents.length,
|
|
107
|
+
completed: writeEvents.length,
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const result = await orchestrateRealizeCorrect(
|
|
111
|
+
ctx,
|
|
112
|
+
scenarios,
|
|
107
113
|
authorizations,
|
|
108
114
|
functions,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const reviewProgress = {
|
|
115
|
-
id: v7(),
|
|
116
|
-
total: writeEvents.length,
|
|
117
|
-
completed: writeEvents.length,
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
for (let attempt = 0; attempt < MAX_CORRECTION_ATTEMPTS; attempt++) {
|
|
121
|
-
if (compilation.type === "failure") {
|
|
122
|
-
const failedFiles: Record<string, string> = Object.fromEntries(
|
|
123
|
-
compilation.type === "failure"
|
|
124
|
-
? compilation.diagnostics.map((d) => [d.file, d.code])
|
|
125
|
-
: [],
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
reviewProgress.total += Object.keys(failedFiles).length;
|
|
129
|
-
const failure: IAutoBeTypeScriptCompileResult.IFailure = compilation;
|
|
130
|
-
|
|
131
|
-
await executeCachedBatch(
|
|
132
|
-
Object.entries(failedFiles).map(
|
|
133
|
-
([location, content]) =>
|
|
134
|
-
async () => {
|
|
135
|
-
const diagnostic:
|
|
136
|
-
| IAutoBeTypeScriptCompileResult.IDiagnostic
|
|
137
|
-
| undefined = failure.diagnostics.find(
|
|
138
|
-
(el) => el.file === location,
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
const scenario = scenarios.find(
|
|
142
|
-
(el) => el.location === location,
|
|
143
|
-
);
|
|
144
|
-
if (diagnostic && scenario) {
|
|
145
|
-
const correctEvent = await orchestrateRealizeCorrect(ctx, {
|
|
146
|
-
totalAuthorizations: authorizations,
|
|
147
|
-
authorization: scenario.decoratorEvent ?? null,
|
|
148
|
-
scenario,
|
|
149
|
-
code: content,
|
|
150
|
-
diagnostic,
|
|
151
|
-
progress: reviewProgress,
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
const corrected = functions.find(
|
|
155
|
-
(el) => el.location === correctEvent.location,
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
if (corrected) {
|
|
159
|
-
corrected.content = correctEvent.content;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
),
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
compilation = await compileRealizeFiles(ctx, {
|
|
167
|
-
authorizations,
|
|
168
|
-
functions,
|
|
169
|
-
});
|
|
170
|
-
if (compilation.type === "success") {
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
115
|
+
[],
|
|
116
|
+
reviewProgress,
|
|
117
|
+
5,
|
|
118
|
+
);
|
|
176
119
|
|
|
177
120
|
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
178
121
|
const controllers: Record<string, string> =
|
|
@@ -181,6 +124,7 @@ export const orchestrateRealize =
|
|
|
181
124
|
functions,
|
|
182
125
|
authorizations,
|
|
183
126
|
});
|
|
127
|
+
|
|
184
128
|
return ctx.dispatch({
|
|
185
129
|
type: "realizeComplete",
|
|
186
130
|
id: v7(),
|
|
@@ -188,7 +132,7 @@ export const orchestrateRealize =
|
|
|
188
132
|
functions,
|
|
189
133
|
authorizations,
|
|
190
134
|
controllers,
|
|
191
|
-
compiled:
|
|
135
|
+
compiled: result.result,
|
|
192
136
|
step: ctx.state().analyze?.step ?? 0,
|
|
193
137
|
elapsed: new Date().getTime() - start.getTime(),
|
|
194
138
|
});
|
|
@@ -24,7 +24,7 @@ export async function orchestrateRealizeAuthorizationCorrect<
|
|
|
24
24
|
authorization: AutoBeRealizeAuthorization,
|
|
25
25
|
prismaClients: Record<string, string>,
|
|
26
26
|
templateFiles: Record<string, string>,
|
|
27
|
-
life: number =
|
|
27
|
+
life: number = ctx.retry,
|
|
28
28
|
): Promise<AutoBeRealizeAuthorization> {
|
|
29
29
|
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
30
30
|
const providerContent: string = await compiler.typescript.beautify(
|
|
@@ -2,7 +2,8 @@ import {
|
|
|
2
2
|
AutoBeProgressEventBase,
|
|
3
3
|
AutoBeRealizeAuthorization,
|
|
4
4
|
AutoBeRealizeCorrectEvent,
|
|
5
|
-
|
|
5
|
+
AutoBeRealizeFunction,
|
|
6
|
+
AutoBeRealizeValidateEvent,
|
|
6
7
|
} from "@autobe/interface";
|
|
7
8
|
import { StringUtil } from "@autobe/utils";
|
|
8
9
|
import { ILlmApplication, ILlmController, ILlmSchema } from "@samchon/openapi";
|
|
@@ -12,33 +13,116 @@ import { v7 } from "uuid";
|
|
|
12
13
|
|
|
13
14
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
14
15
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
15
|
-
import {
|
|
16
|
-
import { IAutoBeTestScenarioArtifacts } from "../test/structures/IAutoBeTestScenarioArtifacts";
|
|
16
|
+
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
17
17
|
import { transformRealizeCorrectHistories } from "./histories/transformRealizeCorrectHistories";
|
|
18
|
+
import { compileRealizeFiles } from "./internal/compileRealizeFiles";
|
|
18
19
|
import { IAutoBeRealizeCorrectApplication } from "./structures/IAutoBeRealizeCorrectApplication";
|
|
19
|
-
import {
|
|
20
|
+
import { IAutoBeRealizeFunctionFailure } from "./structures/IAutoBeRealizeFunctionFailure";
|
|
21
|
+
import { IAutoBeRealizeScenarioResult } from "./structures/IAutoBeRealizeScenarioResult";
|
|
22
|
+
import { getRealizeWriteDto } from "./utils/getRealizeWriteDto";
|
|
20
23
|
import { replaceImportStatements } from "./utils/replaceImportStatements";
|
|
21
24
|
|
|
22
25
|
export async function orchestrateRealizeCorrect<Model extends ILlmSchema.Model>(
|
|
26
|
+
ctx: AutoBeContext<Model>,
|
|
27
|
+
scenarios: IAutoBeRealizeScenarioResult[],
|
|
28
|
+
authorizations: AutoBeRealizeAuthorization[],
|
|
29
|
+
functions: AutoBeRealizeFunction[],
|
|
30
|
+
failures: IAutoBeRealizeFunctionFailure[],
|
|
31
|
+
progress: IProgress,
|
|
32
|
+
life: number = 5,
|
|
33
|
+
): Promise<AutoBeRealizeValidateEvent> {
|
|
34
|
+
const event = await compileRealizeFiles(ctx, { authorizations, functions });
|
|
35
|
+
if (event.result.type === "failure") ctx.dispatch(event);
|
|
36
|
+
|
|
37
|
+
if (event.result.type === "success") {
|
|
38
|
+
console.debug("compilation success!");
|
|
39
|
+
return event;
|
|
40
|
+
} else if (--life <= 0) return event;
|
|
41
|
+
|
|
42
|
+
const locations: string[] =
|
|
43
|
+
(event.result.type === "failure"
|
|
44
|
+
? Array.from(new Set(event.result.diagnostics.map((d) => d.file)))
|
|
45
|
+
: null
|
|
46
|
+
)?.filter((el) => el !== null) ?? [];
|
|
47
|
+
|
|
48
|
+
progress.total += Object.keys(locations).length;
|
|
49
|
+
|
|
50
|
+
const diagnostics =
|
|
51
|
+
event.result.type === "failure" ? event.result.diagnostics : [];
|
|
52
|
+
|
|
53
|
+
const diagnosticsByFile = diagnostics.reduce<
|
|
54
|
+
Record<string, typeof diagnostics>
|
|
55
|
+
>((acc, diagnostic) => {
|
|
56
|
+
const location = diagnostic.file!;
|
|
57
|
+
if (!acc[location]) {
|
|
58
|
+
acc[location] = [];
|
|
59
|
+
}
|
|
60
|
+
acc[location].push(diagnostic);
|
|
61
|
+
return acc;
|
|
62
|
+
}, {});
|
|
63
|
+
|
|
64
|
+
for (const [location, diagnostics] of Object.entries(diagnosticsByFile)) {
|
|
65
|
+
const func = functions.find((el) => el.location === location);
|
|
66
|
+
|
|
67
|
+
if (func) {
|
|
68
|
+
failures.push({
|
|
69
|
+
function: func,
|
|
70
|
+
diagnostics,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
await executeCachedBatch(
|
|
76
|
+
locations.map((location) => async (): Promise<AutoBeRealizeFunction> => {
|
|
77
|
+
const scenario = scenarios.find((el) => el.location === location);
|
|
78
|
+
const func = functions.find((el) => el.location === location)!;
|
|
79
|
+
const ReailzeFunctionFailures: IAutoBeRealizeFunctionFailure[] =
|
|
80
|
+
failures.filter((f) => f.function.location === location);
|
|
81
|
+
|
|
82
|
+
if (ReailzeFunctionFailures.length && scenario) {
|
|
83
|
+
const correctEvent = await correct(ctx, {
|
|
84
|
+
totalAuthorizations: authorizations,
|
|
85
|
+
authorization: scenario.decoratorEvent ?? null,
|
|
86
|
+
scenario,
|
|
87
|
+
function: func,
|
|
88
|
+
failures: ReailzeFunctionFailures,
|
|
89
|
+
progress: progress,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
func.content = correctEvent.content;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return func;
|
|
96
|
+
}),
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
return orchestrateRealizeCorrect(
|
|
100
|
+
ctx,
|
|
101
|
+
scenarios,
|
|
102
|
+
authorizations,
|
|
103
|
+
functions,
|
|
104
|
+
failures,
|
|
105
|
+
progress,
|
|
106
|
+
life,
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export async function correct<Model extends ILlmSchema.Model>(
|
|
23
111
|
ctx: AutoBeContext<Model>,
|
|
24
112
|
props: {
|
|
25
113
|
authorization: AutoBeRealizeAuthorization | null;
|
|
26
114
|
totalAuthorizations: AutoBeRealizeAuthorization[];
|
|
27
|
-
scenario:
|
|
28
|
-
|
|
29
|
-
|
|
115
|
+
scenario: IAutoBeRealizeScenarioResult;
|
|
116
|
+
function: AutoBeRealizeFunction;
|
|
117
|
+
failures: IAutoBeRealizeFunctionFailure[];
|
|
30
118
|
progress: AutoBeProgressEventBase;
|
|
31
119
|
},
|
|
32
120
|
): Promise<AutoBeRealizeCorrectEvent> {
|
|
33
|
-
const artifacts: IAutoBeTestScenarioArtifacts =
|
|
34
|
-
await getTestScenarioArtifacts(ctx, {
|
|
35
|
-
endpoint: props.scenario.operation,
|
|
36
|
-
dependencies: [],
|
|
37
|
-
});
|
|
38
|
-
|
|
39
121
|
const pointer: IPointer<IAutoBeRealizeCorrectApplication.IProps | null> = {
|
|
40
122
|
value: null,
|
|
41
123
|
};
|
|
124
|
+
|
|
125
|
+
const dto = await getRealizeWriteDto(ctx, props.scenario.operation);
|
|
42
126
|
const { tokenUsage } = await ctx.conversate({
|
|
43
127
|
source: "realizeCorrect",
|
|
44
128
|
controller: createController({
|
|
@@ -50,34 +134,34 @@ export async function orchestrateRealizeCorrect<Model extends ILlmSchema.Model>(
|
|
|
50
134
|
histories: transformRealizeCorrectHistories({
|
|
51
135
|
state: ctx.state(),
|
|
52
136
|
scenario: props.scenario,
|
|
53
|
-
artifacts,
|
|
54
137
|
authorization: props.authorization,
|
|
55
|
-
code: props.
|
|
56
|
-
|
|
138
|
+
code: props.function.content,
|
|
139
|
+
dto,
|
|
140
|
+
failures: props.failures.filter(
|
|
141
|
+
(f) => f.function.location === props.function.location,
|
|
142
|
+
),
|
|
57
143
|
totalAuthorizations: props.totalAuthorizations,
|
|
58
144
|
}),
|
|
59
145
|
enforceFunctionCall: true,
|
|
60
146
|
message: StringUtil.trim`
|
|
61
|
-
Correct the TypeScript code implementation
|
|
62
|
-
|
|
63
|
-
1. Ensure that the code is production-ready and follows best practices.
|
|
147
|
+
Correct the TypeScript code implementation.
|
|
64
148
|
`,
|
|
65
149
|
});
|
|
66
150
|
|
|
67
151
|
if (pointer.value === null)
|
|
68
152
|
throw new Error("Failed to correct implementation code.");
|
|
69
153
|
|
|
70
|
-
pointer.value.implementationCode = await replaceImportStatements(ctx
|
|
71
|
-
|
|
72
|
-
pointer.value.implementationCode,
|
|
73
|
-
props.authorization?.payload.name,
|
|
74
|
-
);
|
|
154
|
+
pointer.value.revise.implementationCode = await replaceImportStatements(ctx, {
|
|
155
|
+
operation: props.scenario.operation,
|
|
156
|
+
code: pointer.value.revise.implementationCode,
|
|
157
|
+
decoratorType: props.authorization?.payload.name,
|
|
158
|
+
});
|
|
75
159
|
|
|
76
160
|
const event: AutoBeRealizeCorrectEvent = {
|
|
77
161
|
type: "realizeCorrect",
|
|
78
162
|
id: v7(),
|
|
79
163
|
location: props.scenario.location,
|
|
80
|
-
content: pointer.value.implementationCode,
|
|
164
|
+
content: pointer.value.revise.implementationCode,
|
|
81
165
|
tokenUsage,
|
|
82
166
|
completed: ++props.progress.completed,
|
|
83
167
|
total: props.progress.total,
|
|
@@ -120,3 +204,8 @@ const collection = {
|
|
|
120
204
|
deepseek: claude,
|
|
121
205
|
"3.1": claude,
|
|
122
206
|
};
|
|
207
|
+
|
|
208
|
+
interface IProgress {
|
|
209
|
+
total: number;
|
|
210
|
+
completed: number;
|
|
211
|
+
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
AutoBeOpenApi,
|
|
3
|
+
AutoBeRealizeAuthorization,
|
|
4
|
+
AutoBeTestFile,
|
|
5
|
+
} from "@autobe/interface";
|
|
2
6
|
import { ILlmSchema } from "@samchon/openapi";
|
|
3
7
|
|
|
4
8
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
5
|
-
import {
|
|
9
|
+
import { IAutoBeRealizeScenarioResult } from "./structures/IAutoBeRealizeScenarioResult";
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
12
|
* Generates a planning result that defines what kind of function should be
|
|
@@ -28,8 +32,8 @@ export const orchestrateRealizeScenario = <Model extends ILlmSchema.Model>(
|
|
|
28
32
|
ctx: AutoBeContext<Model>,
|
|
29
33
|
operation: AutoBeOpenApi.IOperation,
|
|
30
34
|
authorization?: AutoBeRealizeAuthorization,
|
|
31
|
-
):
|
|
32
|
-
const
|
|
35
|
+
): IAutoBeRealizeScenarioResult => {
|
|
36
|
+
const testFiles: AutoBeTestFile[] =
|
|
33
37
|
ctx
|
|
34
38
|
.state()
|
|
35
39
|
.test?.files.filter(
|
|
@@ -47,7 +51,7 @@ export const orchestrateRealizeScenario = <Model extends ILlmSchema.Model>(
|
|
|
47
51
|
operation: operation,
|
|
48
52
|
functionName: functionName,
|
|
49
53
|
location: `src/providers/${functionName}.ts`,
|
|
50
|
-
|
|
54
|
+
testFiles: testFiles,
|
|
51
55
|
decoratorEvent: authorization,
|
|
52
56
|
};
|
|
53
57
|
};
|
|
@@ -11,11 +11,10 @@ import { v7 } from "uuid";
|
|
|
11
11
|
|
|
12
12
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
13
13
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
14
|
-
import { getTestScenarioArtifacts } from "../test/compile/getTestScenarioArtifacts";
|
|
15
|
-
import { IAutoBeTestScenarioArtifacts } from "../test/structures/IAutoBeTestScenarioArtifacts";
|
|
16
14
|
import { transformRealizeWriteHistories } from "./histories/transformRealizeWriteHistories";
|
|
17
|
-
import {
|
|
15
|
+
import { IAutoBeRealizeScenarioResult } from "./structures/IAutoBeRealizeScenarioResult";
|
|
18
16
|
import { IAutoBeRealizeWriteApplication } from "./structures/IAutoBeRealizeWriteApplication";
|
|
17
|
+
import { getRealizeWriteDto } from "./utils/getRealizeWriteDto";
|
|
19
18
|
import { replaceImportStatements } from "./utils/replaceImportStatements";
|
|
20
19
|
|
|
21
20
|
export async function orchestrateRealizeWrite<Model extends ILlmSchema.Model>(
|
|
@@ -23,27 +22,24 @@ export async function orchestrateRealizeWrite<Model extends ILlmSchema.Model>(
|
|
|
23
22
|
props: {
|
|
24
23
|
totalAuthorizations: AutoBeRealizeAuthorization[];
|
|
25
24
|
authorization: AutoBeRealizeAuthorization | null;
|
|
26
|
-
scenario:
|
|
25
|
+
scenario: IAutoBeRealizeScenarioResult;
|
|
27
26
|
progress: AutoBeProgressEventBase;
|
|
28
27
|
promptCacheKey: string;
|
|
29
28
|
},
|
|
30
29
|
): Promise<AutoBeRealizeWriteEvent> {
|
|
31
|
-
const artifacts: IAutoBeTestScenarioArtifacts =
|
|
32
|
-
await getTestScenarioArtifacts(ctx, {
|
|
33
|
-
endpoint: props.scenario.operation,
|
|
34
|
-
dependencies: [],
|
|
35
|
-
});
|
|
36
30
|
const pointer: IPointer<IAutoBeRealizeWriteApplication.IProps | null> = {
|
|
37
31
|
value: null,
|
|
38
32
|
};
|
|
33
|
+
|
|
34
|
+
const dto = await getRealizeWriteDto(ctx, props.scenario.operation);
|
|
39
35
|
const { tokenUsage } = await ctx.conversate({
|
|
40
36
|
source: "realizeWrite",
|
|
41
37
|
histories: transformRealizeWriteHistories({
|
|
42
38
|
state: ctx.state(),
|
|
43
39
|
scenario: props.scenario,
|
|
44
|
-
artifacts,
|
|
45
40
|
authorization: props.authorization,
|
|
46
41
|
totalAuthorizations: props.totalAuthorizations,
|
|
42
|
+
dto,
|
|
47
43
|
}),
|
|
48
44
|
controller: createController({
|
|
49
45
|
model: ctx.model,
|
|
@@ -73,11 +69,11 @@ export async function orchestrateRealizeWrite<Model extends ILlmSchema.Model>(
|
|
|
73
69
|
});
|
|
74
70
|
if (pointer.value === null) throw new Error("Failed to write code.");
|
|
75
71
|
|
|
76
|
-
pointer.value.implementationCode = await replaceImportStatements(ctx
|
|
77
|
-
|
|
78
|
-
pointer.value.implementationCode,
|
|
79
|
-
props.authorization?.payload.name,
|
|
80
|
-
);
|
|
72
|
+
pointer.value.implementationCode = await replaceImportStatements(ctx, {
|
|
73
|
+
operation: props.scenario.operation,
|
|
74
|
+
code: pointer.value.implementationCode,
|
|
75
|
+
decoratorType: props.authorization?.payload.name,
|
|
76
|
+
});
|
|
81
77
|
|
|
82
78
|
const event: AutoBeRealizeWriteEvent = {
|
|
83
79
|
type: "realizeWrite",
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import { CamelPattern, PascalPattern } from "@autobe/interface";
|
|
2
2
|
|
|
3
3
|
export interface IAutoBeRealizeAuthorizationApplication {
|
|
4
|
+
/**
|
|
5
|
+
* Generates authentication provider, decorator, and payload type for role-based authorization.
|
|
6
|
+
*
|
|
7
|
+
* This method creates a complete authentication infrastructure for a specific
|
|
8
|
+
* role in the NestJS application. It generates three interconnected components
|
|
9
|
+
* that work together to provide JWT-based authentication and authorization.
|
|
10
|
+
*
|
|
11
|
+
* 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
|
+
*
|
|
16
|
+
* All components follow strict naming conventions and integrate with the existing
|
|
17
|
+
* authentication architecture using the shared jwtAuthorize function.
|
|
18
|
+
*
|
|
19
|
+
* @param next Properties containing provider, decorator, and payload type configurations
|
|
20
|
+
*/
|
|
4
21
|
createDecorator: (
|
|
5
22
|
next: IAutoBeRealizeAuthorizationApplication.IProps,
|
|
6
23
|
) => void;
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
import { IAutoBeRealizeAuthorizationApplication } from "./IAutoBeRealizeAuthorizationApplication";
|
|
2
2
|
|
|
3
3
|
export interface IAutoBeRealizeAuthorizationCorrectApplication {
|
|
4
|
+
/**
|
|
5
|
+
* Corrects TypeScript compilation errors in authentication components.
|
|
6
|
+
*
|
|
7
|
+
* This method analyzes and fixes compilation errors in previously generated
|
|
8
|
+
* authentication provider, decorator, and payload type implementations. It
|
|
9
|
+
* performs systematic error diagnosis and generates corrected versions of
|
|
10
|
+
* all three components while maintaining their interconnected functionality.
|
|
11
|
+
*
|
|
12
|
+
* The correction process includes:
|
|
13
|
+
* - TypeScript error analysis and categorization by component
|
|
14
|
+
* - Identification of type mismatches, import issues, and syntax errors
|
|
15
|
+
* - Clear solution guidance for each identified problem
|
|
16
|
+
* - Regeneration of all components with fixes applied
|
|
17
|
+
*
|
|
18
|
+
* The corrected components maintain the same naming conventions and
|
|
19
|
+
* architectural patterns as the original generation while resolving all
|
|
20
|
+
* compilation issues.
|
|
21
|
+
*
|
|
22
|
+
* @param next Properties containing error analysis, solution guidance, and corrected components
|
|
23
|
+
*/
|
|
4
24
|
correctDecorator: (
|
|
5
25
|
next: IAutoBeRealizeAuthorizationCorrectApplication.IProps,
|
|
6
26
|
) => void;
|
|
@@ -1,81 +1,47 @@
|
|
|
1
|
-
import { IAutoBeRealizeWriteApplication } from "./IAutoBeRealizeWriteApplication";
|
|
2
|
-
|
|
3
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
|
+
*/
|
|
4
10
|
review: (props: IAutoBeRealizeCorrectApplication.IProps) => void;
|
|
5
11
|
}
|
|
6
12
|
|
|
7
13
|
export namespace IAutoBeRealizeCorrectApplication {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* - Identification of assumed fields that don't exist
|
|
41
|
-
* - Correct field types and relationships
|
|
42
|
-
*
|
|
43
|
-
* ⚠️ COMMON ERROR PATTERNS TO CHECK:
|
|
44
|
-
*
|
|
45
|
-
* - Using non-existent fields (e.g., deleted_at, created_by)
|
|
46
|
-
* - Type mismatches in Prisma operations
|
|
47
|
-
* - Incorrect date handling (using Date instead of string)
|
|
48
|
-
* - Missing required fields in create/update operations
|
|
49
|
-
* - Incorrect relation handling in nested operations
|
|
50
|
-
*
|
|
51
|
-
* 🎯 CORRECTION APPROACH:
|
|
52
|
-
*
|
|
53
|
-
* - Remove references to non-existent fields
|
|
54
|
-
* - Fix type conversions (especially dates with toISOStringSafe())
|
|
55
|
-
* - Simplify complex nested operations into separate queries
|
|
56
|
-
* - Add missing required fields
|
|
57
|
-
* - Use correct Prisma input types
|
|
58
|
-
*
|
|
59
|
-
* Example structure:
|
|
60
|
-
*
|
|
61
|
-
* Errors Found:
|
|
62
|
-
* 1. TS2339: Property 'deleted_at' does not exist on type 'User'
|
|
63
|
-
* - Cause: Field assumed but not in schema
|
|
64
|
-
* - Fix: Remove all deleted_at references
|
|
65
|
-
*
|
|
66
|
-
* 2. TS2345: Type 'Date' is not assignable to type 'string'
|
|
67
|
-
* - Cause: Direct Date assignment without conversion
|
|
68
|
-
* - Fix: Use toISOStringSafe() for all date values
|
|
69
|
-
*
|
|
70
|
-
* Resolution Plan:
|
|
71
|
-
* 1. First, remove all non-existent field references
|
|
72
|
-
* 2. Then, fix all date type conversions
|
|
73
|
-
* 3. Finally, adjust Prisma query structures
|
|
74
|
-
*
|
|
75
|
-
* This analysis ensures the review process addresses all compilation errors
|
|
76
|
-
* systematically and produces error-free code in the corrected
|
|
77
|
-
* implementation.
|
|
78
|
-
*/
|
|
79
|
-
errorAnalysis: string;
|
|
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
|
+
export interface IProps {
|
|
21
|
+
/** Revision process containing all error correction phases. */
|
|
22
|
+
revise: IRevise;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface IRevise {
|
|
26
|
+
/** Step 1: Compilation error analysis and resolution strategy. */
|
|
27
|
+
errorAnalysis?: string;
|
|
28
|
+
|
|
29
|
+
/** Step 2: Provider function implementation plan. */
|
|
30
|
+
plan?: string;
|
|
31
|
+
|
|
32
|
+
/** Step 3: Relevant Prisma schema definitions. */
|
|
33
|
+
prismaSchemas?: string;
|
|
34
|
+
|
|
35
|
+
/** Step 4: Initial draft without using native Date type. */
|
|
36
|
+
draftWithoutDateType?: string;
|
|
37
|
+
|
|
38
|
+
/** Step 5: Refined version with improved completeness. */
|
|
39
|
+
review?: string;
|
|
40
|
+
|
|
41
|
+
/** Step 6: Corrected implementation after compiler feedback. */
|
|
42
|
+
withCompilerFeedback?: string;
|
|
43
|
+
|
|
44
|
+
/** Step 7: Final complete TypeScript function implementation. */
|
|
45
|
+
implementationCode: string;
|
|
80
46
|
}
|
|
81
47
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AutoBeOpenApi,
|
|
3
|
+
AutoBeRealizeAuthorization,
|
|
4
|
+
AutoBeTestFile,
|
|
5
|
+
} from "@autobe/interface";
|
|
6
|
+
|
|
7
|
+
export interface IAutoBeRealizeScenarioResult {
|
|
8
|
+
/** The OpenAPI operation to be realized. */
|
|
9
|
+
operation: AutoBeOpenApi.IOperation;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The name of the function to be generated.
|
|
13
|
+
*
|
|
14
|
+
* Derived from the Swagger path and method. The function name must be
|
|
15
|
+
* written in snake_case. It serves as the entry point in both code
|
|
16
|
+
* generation and test code.
|
|
17
|
+
*
|
|
18
|
+
* Once the function is generated, the function name and file name will be
|
|
19
|
+
* the same. The generated file will be located at
|
|
20
|
+
* `src/providers/${function_name}.ts`.
|
|
21
|
+
*/
|
|
22
|
+
functionName: string;
|
|
23
|
+
|
|
24
|
+
/** For example, `src/providers/${function_name}.ts`. */
|
|
25
|
+
location: string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* List of scenario descriptions for test code generation.
|
|
29
|
+
*
|
|
30
|
+
* Each scenario describes the expected behavior of the function under
|
|
31
|
+
* certain conditions. Used as a basis for TDD-style automated test
|
|
32
|
+
* generation.
|
|
33
|
+
*/
|
|
34
|
+
testFiles: AutoBeTestFile[];
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Optional decorator event for customizing code generation behavior.
|
|
38
|
+
*
|
|
39
|
+
* Provides additional metadata or instructions that can modify how the
|
|
40
|
+
* function implementation is generated. Can include custom annotations,
|
|
41
|
+
* middleware configurations, or special handling directives that affect the
|
|
42
|
+
* final code output.
|
|
43
|
+
*/
|
|
44
|
+
decoratorEvent?: AutoBeRealizeAuthorization;
|
|
45
|
+
}
|