@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
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { AutoBeOpenApi } from "@autobe/interface";
|
|
2
|
+
import { AutoBeOpenApiTypeChecker, StringUtil } from "@autobe/utils";
|
|
3
|
+
import typia, { tags } from "typia";
|
|
4
|
+
|
|
5
|
+
export namespace JsonSchemaFactory {
|
|
6
|
+
export const presets = (
|
|
7
|
+
typeNames: Set<string>,
|
|
8
|
+
): Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> => {
|
|
9
|
+
const schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {};
|
|
10
|
+
for (const [key, value] of Object.entries(DEFAULT_SCHEMAS)) {
|
|
11
|
+
schemas[key] = value;
|
|
12
|
+
typeNames.delete(key);
|
|
13
|
+
}
|
|
14
|
+
for (const key of typeNames)
|
|
15
|
+
if (isPage(key)) {
|
|
16
|
+
const data: string = getPageName(key);
|
|
17
|
+
schemas[key] = page(data);
|
|
18
|
+
typeNames.delete(key);
|
|
19
|
+
typeNames.add(data);
|
|
20
|
+
}
|
|
21
|
+
return schemas;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const authorize = (
|
|
25
|
+
schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>,
|
|
26
|
+
): void => {
|
|
27
|
+
for (const [key, value] of Object.entries(schemas)) {
|
|
28
|
+
if (key.endsWith(".IAuthorized") === false) continue;
|
|
29
|
+
else if (AutoBeOpenApiTypeChecker.isObject(value) === false) continue;
|
|
30
|
+
|
|
31
|
+
const parent: AutoBeOpenApi.IJsonSchemaDescriptive | undefined =
|
|
32
|
+
schemas[key.substring(0, key.length - ".IAuthorized".length)];
|
|
33
|
+
if (parent === undefined) continue;
|
|
34
|
+
else if (AutoBeOpenApiTypeChecker.isObject(parent) === false) continue;
|
|
35
|
+
|
|
36
|
+
value.properties = {
|
|
37
|
+
...parent.properties,
|
|
38
|
+
...value.properties,
|
|
39
|
+
};
|
|
40
|
+
value.required = [...parent.required];
|
|
41
|
+
if (value.required.includes("id") === false) value.required.push("id");
|
|
42
|
+
if (value.required.includes("token") === false)
|
|
43
|
+
value.required.push("token");
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const page = (
|
|
48
|
+
key: string,
|
|
49
|
+
): AutoBeOpenApi.IJsonSchemaDescriptive.IObject => ({
|
|
50
|
+
type: "object",
|
|
51
|
+
properties: {
|
|
52
|
+
pagination: {
|
|
53
|
+
$ref: "#/components/schemas/IPage.IPagination",
|
|
54
|
+
description: "Page information.",
|
|
55
|
+
},
|
|
56
|
+
data: {
|
|
57
|
+
type: "array",
|
|
58
|
+
items: {
|
|
59
|
+
$ref: `#/components/schemas/${key}`,
|
|
60
|
+
},
|
|
61
|
+
description: "List of records.",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
required: ["pagination", "data"],
|
|
65
|
+
description: StringUtil.trim`
|
|
66
|
+
A page.
|
|
67
|
+
|
|
68
|
+
Collection of records with pagination information.
|
|
69
|
+
`,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export const fix = (path: string, input: unknown): void => {
|
|
73
|
+
if (isRecord(input) === false || isRecord(input[path]) === false) return;
|
|
74
|
+
|
|
75
|
+
if (input[path].description) delete input[path].description;
|
|
76
|
+
if (input[path].required) delete input[path].required;
|
|
77
|
+
|
|
78
|
+
for (const key of Object.keys(input[path]))
|
|
79
|
+
if (DEFAULT_SCHEMAS[key] !== undefined)
|
|
80
|
+
input[path][key] = DEFAULT_SCHEMAS[key];
|
|
81
|
+
else if (isPage(key) === true) {
|
|
82
|
+
const data: string = key.substring("IPage".length);
|
|
83
|
+
input[path][key] = page(data);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const isPage = (key: string): boolean =>
|
|
88
|
+
key.startsWith("IPage") === true &&
|
|
89
|
+
key.startsWith("IPage.") === false &&
|
|
90
|
+
key !== "IPage";
|
|
91
|
+
|
|
92
|
+
export const getPageName = (key: string): string =>
|
|
93
|
+
key.substring("IPage".length);
|
|
94
|
+
|
|
95
|
+
const isRecord = (input: unknown): input is Record<string, unknown> =>
|
|
96
|
+
typeof input === "object" && input !== null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const DEFAULT_SCHEMAS = typia.assertEquals<
|
|
100
|
+
Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>
|
|
101
|
+
>(
|
|
102
|
+
typia.json.schemas<[IPage.IPagination, IAuthorizationToken]>().components
|
|
103
|
+
?.schemas,
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
namespace IPage {
|
|
107
|
+
/** Page information. */
|
|
108
|
+
export interface IPagination {
|
|
109
|
+
/** Current page number. */
|
|
110
|
+
current: number & tags.Type<"uint32">;
|
|
111
|
+
|
|
112
|
+
/** Limitation of records per a page. */
|
|
113
|
+
limit: number & tags.Type<"uint32">;
|
|
114
|
+
|
|
115
|
+
/** Total records in the database. */
|
|
116
|
+
records: number & tags.Type<"uint32">;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Total pages.
|
|
120
|
+
*
|
|
121
|
+
* Equal to {@link records} / {@link limit} with ceiling.
|
|
122
|
+
*/
|
|
123
|
+
pages: number & tags.Type<"uint32">;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Authorization token response structure.
|
|
129
|
+
*
|
|
130
|
+
* This interface defines the structure of the authorization token response
|
|
131
|
+
* returned after successful user authentication. It contains both access and
|
|
132
|
+
* refresh tokens along with their expiration information.
|
|
133
|
+
*
|
|
134
|
+
* This token structure is automatically included in API schemas when the system
|
|
135
|
+
* detects authorization roles in the requirements analysis phase. It provides a
|
|
136
|
+
* standard format for JWT-based authentication across the generated backend
|
|
137
|
+
* applications.
|
|
138
|
+
*/
|
|
139
|
+
interface IAuthorizationToken {
|
|
140
|
+
/**
|
|
141
|
+
* JWT access token for authenticated requests.
|
|
142
|
+
*
|
|
143
|
+
* This token should be included in the Authorization header for subsequent
|
|
144
|
+
* authenticated API requests as `Bearer {token}`.
|
|
145
|
+
*/
|
|
146
|
+
access: string;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Refresh token for obtaining new access tokens.
|
|
150
|
+
*
|
|
151
|
+
* This token can be used to request new access tokens when the current access
|
|
152
|
+
* token expires, extending the user's session.
|
|
153
|
+
*/
|
|
154
|
+
refresh: string;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Access token expiration timestamp.
|
|
158
|
+
*
|
|
159
|
+
* ISO 8601 date-time string indicating when the access token will expire and
|
|
160
|
+
* can no longer be used for authentication.
|
|
161
|
+
*/
|
|
162
|
+
expired_at: string & tags.Format<"date-time">;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Refresh token expiration timestamp.
|
|
166
|
+
*
|
|
167
|
+
* ISO 8601 date-time string indicating the latest time until which the
|
|
168
|
+
* refresh token can be used to obtain new access tokens.
|
|
169
|
+
*/
|
|
170
|
+
refreshable_until: string & tags.Format<"date-time">;
|
|
171
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { AutoBeOpenApi } from "@autobe/interface";
|
|
2
|
+
import { MapUtil } from "@autobe/utils";
|
|
3
|
+
import { OpenApiTypeChecker } from "@samchon/openapi";
|
|
4
|
+
|
|
5
|
+
export namespace JsonSchemaNamingConvention {
|
|
6
|
+
export const operations = (operations: AutoBeOpenApi.IOperation[]): void => {
|
|
7
|
+
const typeNames: Set<string> = new Set();
|
|
8
|
+
operate(typeNames, operations);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const schemas = (
|
|
12
|
+
operations: AutoBeOpenApi.IOperation[],
|
|
13
|
+
...componentSchemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>[]
|
|
14
|
+
): void => {
|
|
15
|
+
const typeNames: Set<string> = new Set();
|
|
16
|
+
for (const schemas of componentSchemas)
|
|
17
|
+
for (const key of Object.keys(schemas)) typeNames.add(key);
|
|
18
|
+
const answer = operate(typeNames, operations);
|
|
19
|
+
|
|
20
|
+
for (const dict of componentSchemas)
|
|
21
|
+
for (const x of Object.keys(dict)) {
|
|
22
|
+
const y: string = answer(x);
|
|
23
|
+
if (x === y) continue;
|
|
24
|
+
dict[y] = dict[x]!;
|
|
25
|
+
delete dict[x];
|
|
26
|
+
}
|
|
27
|
+
for (const dict of componentSchemas)
|
|
28
|
+
for (const x of Object.values(dict)) {
|
|
29
|
+
OpenApiTypeChecker.visit({
|
|
30
|
+
components: { schemas: dict },
|
|
31
|
+
schema: x,
|
|
32
|
+
closure: (s) => {
|
|
33
|
+
if (OpenApiTypeChecker.isReference(s) === false) return;
|
|
34
|
+
s.$ref = `#/components/schemas/${answer(s.$ref.split("/").pop()!)}`;
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const operate = (
|
|
41
|
+
typeNames: Set<string>,
|
|
42
|
+
operations: AutoBeOpenApi.IOperation[],
|
|
43
|
+
): ((v: string) => string) => {
|
|
44
|
+
for (const op of operations) {
|
|
45
|
+
if (op.requestBody) typeNames.add(op.requestBody.typeName);
|
|
46
|
+
if (op.responseBody) typeNames.add(op.responseBody.typeName);
|
|
47
|
+
}
|
|
48
|
+
const answer = prepare(typeNames);
|
|
49
|
+
for (const op of operations) {
|
|
50
|
+
if (op.requestBody)
|
|
51
|
+
op.requestBody.typeName = answer(op.requestBody.typeName);
|
|
52
|
+
if (op.responseBody)
|
|
53
|
+
op.responseBody.typeName = answer(op.responseBody.typeName);
|
|
54
|
+
}
|
|
55
|
+
return answer;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const prepare = (typeNames: Set<string>): ((v: string) => string) => {
|
|
59
|
+
const similar: Map<string, string[]> = new Map();
|
|
60
|
+
const getKey = (v: string) => v.split(".")[0]!.toLowerCase();
|
|
61
|
+
const getValue = (v: string) => v.split(".")[0]!;
|
|
62
|
+
const emplace = (v: string) =>
|
|
63
|
+
MapUtil.take(similar, getKey(v), () => []).push(getValue(v));
|
|
64
|
+
|
|
65
|
+
for (const v of typeNames) emplace(v);
|
|
66
|
+
|
|
67
|
+
const solution: Map<string, string> = new Map();
|
|
68
|
+
for (const [key, values] of similar) {
|
|
69
|
+
if (values.length === 1) continue;
|
|
70
|
+
const winner: string = values.sort(
|
|
71
|
+
(a, b) => countCapitalLetters(b) - countCapitalLetters(a),
|
|
72
|
+
)[0]!;
|
|
73
|
+
solution.set(key, winner);
|
|
74
|
+
}
|
|
75
|
+
return (v: string) => {
|
|
76
|
+
const key: string = getKey(v);
|
|
77
|
+
if (solution.has(key) === false) return v;
|
|
78
|
+
return [solution.get(key), ...v.split(".").slice(1)].join(".");
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const countCapitalLetters = (str: string) => (str.match(/[A-Z]/g) || []).length;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { StringUtil } from "@autobe/utils";
|
|
2
|
+
import { IValidation } from "typia";
|
|
3
|
+
|
|
4
|
+
export const fulfillJsonSchemaErrorMessages = (
|
|
5
|
+
errors: IValidation.IError[],
|
|
6
|
+
): void => {
|
|
7
|
+
for (const e of errors)
|
|
8
|
+
if (
|
|
9
|
+
// type := ["number", "string", ...] case
|
|
10
|
+
isInvalidJsonSchema(e) &&
|
|
11
|
+
typeof e.value === "object" &&
|
|
12
|
+
e.value !== null &&
|
|
13
|
+
"type" in e.value &&
|
|
14
|
+
Array.isArray(e.value.type)
|
|
15
|
+
)
|
|
16
|
+
e.description = StringUtil.trim`
|
|
17
|
+
You have defined the JSON schema's type property value as an
|
|
18
|
+
array type listing up the every types what you want, but it is not
|
|
19
|
+
allowed in the JSON schema.
|
|
20
|
+
|
|
21
|
+
The JSON schema's type property value must be a single string type.
|
|
22
|
+
In your case, you have to change it to an "oneOf" type which
|
|
23
|
+
represents an union type.
|
|
24
|
+
|
|
25
|
+
So, please change the value as below:
|
|
26
|
+
|
|
27
|
+
\`\`\`
|
|
28
|
+
{
|
|
29
|
+
oneOf: [
|
|
30
|
+
${e.value.type.map((t) => ` { "type": ${JSON.stringify(t)}, ... },`).join("\n")}
|
|
31
|
+
],${"description" in e.value ? `\n description: ${JSON.stringify(e.value.description)},` : ""}
|
|
32
|
+
}
|
|
33
|
+
\`\`\`
|
|
34
|
+
`;
|
|
35
|
+
else if (
|
|
36
|
+
isInvalidJsonSchema(e) &&
|
|
37
|
+
typeof e.value === "object" &&
|
|
38
|
+
e.value !== null &&
|
|
39
|
+
"enum" in e.value &&
|
|
40
|
+
Array.isArray(e.value.enum)
|
|
41
|
+
)
|
|
42
|
+
e.description = StringUtil.trim`
|
|
43
|
+
You have defined only enum property, but it is not allowed in the
|
|
44
|
+
JSON schema. You have to define it as oneOf type containing multiple
|
|
45
|
+
const types like below:
|
|
46
|
+
|
|
47
|
+
\`\`\`
|
|
48
|
+
{
|
|
49
|
+
oneOf: [
|
|
50
|
+
${e.value.enum.map((t) => ` { "const": ${JSON.stringify(t)} },`).join("\n")}
|
|
51
|
+
],${"description" in e.value ? `\n description: ${JSON.stringify(e.value.description)},` : ""}
|
|
52
|
+
}
|
|
53
|
+
\`\`\`
|
|
54
|
+
`;
|
|
55
|
+
else if (e.value === undefined && e.path.endsWith(".description"))
|
|
56
|
+
// no description
|
|
57
|
+
e.description = StringUtil.trim`
|
|
58
|
+
You have missed the "description" property in the JSON schema.
|
|
59
|
+
|
|
60
|
+
Please fill it with detailed description about the type.
|
|
61
|
+
`;
|
|
62
|
+
else if (
|
|
63
|
+
e.value === undefined &&
|
|
64
|
+
e.path.endsWith(".required") &&
|
|
65
|
+
e.expected === "Array<string>"
|
|
66
|
+
)
|
|
67
|
+
e.description = StringUtil.trim`
|
|
68
|
+
You have missed the "required" property in the JSON schema of object type.
|
|
69
|
+
|
|
70
|
+
When defining the object type, you have to fill the "required" property
|
|
71
|
+
which lists up the every required property names.
|
|
72
|
+
|
|
73
|
+
Please fill it with the required fields. If you think that there is
|
|
74
|
+
not any required fields at all, you still have to fill the
|
|
75
|
+
"required" property even though it becomes an empty array.
|
|
76
|
+
`;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const isInvalidJsonSchema = (e: IValidation.IError): boolean =>
|
|
80
|
+
e.expected.startsWith("(") &&
|
|
81
|
+
e.expected.endsWith(")") &&
|
|
82
|
+
e.expected.includes("|") &&
|
|
83
|
+
e.expected
|
|
84
|
+
.split("|")
|
|
85
|
+
.map((s) => s.trim())
|
|
86
|
+
.every(
|
|
87
|
+
(s) =>
|
|
88
|
+
s.startsWith("AutoBeOpenApi.IJsonSchema.") ||
|
|
89
|
+
s.startsWith("AutoBeOpenApi.IJsonSchemaDescriptive."),
|
|
90
|
+
);
|
|
@@ -25,7 +25,7 @@ export const validateAuthorizationSchema = (props: {
|
|
|
25
25
|
value.properties["token"] = {
|
|
26
26
|
$ref: "#/components/schemas/IAuthorizationToken",
|
|
27
27
|
description: "JWT token information for authentication",
|
|
28
|
-
} as AutoBeOpenApi.IJsonSchemaDescriptive
|
|
28
|
+
} as AutoBeOpenApi.IJsonSchemaDescriptive.IReference;
|
|
29
29
|
|
|
30
30
|
value.required ??= [];
|
|
31
31
|
if (value.required.includes("token") === false) {
|
|
@@ -36,6 +36,6 @@ export const validateAuthorizationSchema = (props: {
|
|
|
36
36
|
|
|
37
37
|
const isObjectSchema = (
|
|
38
38
|
schema: AutoBeOpenApi.IJsonSchemaDescriptive,
|
|
39
|
-
): schema is AutoBeOpenApi.IJsonSchemaDescriptive
|
|
39
|
+
): schema is AutoBeOpenApi.IJsonSchemaDescriptive.IObject => {
|
|
40
40
|
return "type" in schema && schema.type === "object";
|
|
41
41
|
};
|
|
@@ -18,7 +18,6 @@ import { IAutoBePrismaCorrectApplication } from "./structures/IAutoBePrismaCorre
|
|
|
18
18
|
export function orchestratePrismaCorrect<Model extends ILlmSchema.Model>(
|
|
19
19
|
ctx: AutoBeContext<Model>,
|
|
20
20
|
application: AutoBePrisma.IApplication,
|
|
21
|
-
life: number = 4,
|
|
22
21
|
): Promise<IAutoBePrismaValidation> {
|
|
23
22
|
const unique: Set<string> = new Set();
|
|
24
23
|
for (const file of application.files)
|
|
@@ -28,7 +27,7 @@ export function orchestratePrismaCorrect<Model extends ILlmSchema.Model>(
|
|
|
28
27
|
return true;
|
|
29
28
|
});
|
|
30
29
|
application.files = application.files.filter((f) => f.models.length !== 0);
|
|
31
|
-
return iterate(ctx, application,
|
|
30
|
+
return iterate(ctx, application, ctx.retry);
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
async function iterate<Model extends ILlmSchema.Model>(
|
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
-
import {
|
|
3
|
-
AutoBeRealizeAuthorization,
|
|
4
|
-
IAutoBeTypeScriptCompileResult,
|
|
5
|
-
} from "@autobe/interface";
|
|
2
|
+
import { AutoBeRealizeAuthorization } from "@autobe/interface";
|
|
6
3
|
import { StringUtil } from "@autobe/utils";
|
|
7
4
|
import { v7 } from "uuid";
|
|
8
5
|
|
|
9
6
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
10
7
|
import { AutoBeState } from "../../../context/AutoBeState";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
8
|
+
import { IAutoBeRealizeFunctionFailure } from "../structures/IAutoBeRealizeFunctionFailure";
|
|
9
|
+
import { IAutoBeRealizeScenarioResult } from "../structures/IAutoBeRealizeScenarioResult";
|
|
13
10
|
import { transformRealizeWriteHistories } from "./transformRealizeWriteHistories";
|
|
14
11
|
|
|
15
12
|
export function transformRealizeCorrectHistories(props: {
|
|
16
13
|
state: AutoBeState;
|
|
17
|
-
scenario:
|
|
18
|
-
artifacts: IAutoBeTestScenarioArtifacts;
|
|
14
|
+
scenario: IAutoBeRealizeScenarioResult;
|
|
19
15
|
authorization: AutoBeRealizeAuthorization | null;
|
|
20
16
|
totalAuthorizations: AutoBeRealizeAuthorization[];
|
|
21
17
|
code: string;
|
|
22
|
-
|
|
18
|
+
dto: Record<string, string>;
|
|
19
|
+
failures: IAutoBeRealizeFunctionFailure[];
|
|
23
20
|
}): Array<
|
|
24
21
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
25
22
|
> {
|
|
@@ -34,15 +31,33 @@ export function transformRealizeCorrectHistories(props: {
|
|
|
34
31
|
\`\`\`typescript
|
|
35
32
|
${props.code}
|
|
36
33
|
\`\`\`
|
|
37
|
-
|
|
38
|
-
The code has a compilation error:
|
|
39
|
-
|
|
40
|
-
\`\`\`json
|
|
41
|
-
${JSON.stringify(props.diagnostic)}
|
|
42
|
-
\`\`\`
|
|
43
34
|
`,
|
|
44
35
|
created_at: new Date().toISOString(),
|
|
45
36
|
},
|
|
37
|
+
...props.failures.map(
|
|
38
|
+
(f) =>
|
|
39
|
+
({
|
|
40
|
+
id: v7(),
|
|
41
|
+
type: "assistantMessage",
|
|
42
|
+
text: StringUtil.trim`
|
|
43
|
+
|
|
44
|
+
## Generated Typescript Code
|
|
45
|
+
|
|
46
|
+
\`\`\`typescript
|
|
47
|
+
${f.function.content}
|
|
48
|
+
\`\`\`
|
|
49
|
+
|
|
50
|
+
## Compile Errors
|
|
51
|
+
|
|
52
|
+
Fix the comilation error in the provided code.
|
|
53
|
+
|
|
54
|
+
\`\`\`typescript
|
|
55
|
+
${JSON.stringify(f.diagnostics)}
|
|
56
|
+
\`\`\`
|
|
57
|
+
`,
|
|
58
|
+
created_at: new Date().toISOString(),
|
|
59
|
+
}) satisfies IAgenticaHistoryJson.IAssistantMessage,
|
|
60
|
+
),
|
|
46
61
|
{
|
|
47
62
|
id: v7(),
|
|
48
63
|
type: "systemMessage",
|
|
@@ -5,13 +5,18 @@ import { v7 } from "uuid";
|
|
|
5
5
|
|
|
6
6
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
7
7
|
import { AutoBeState } from "../../../context/AutoBeState";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { IAutoBeRealizeScenarioResult } from "../structures/IAutoBeRealizeScenarioResult";
|
|
9
|
+
import { getRealizeWriteCodeTemplate } from "../utils/getRealizeWriteCodeTemplate";
|
|
10
|
+
import { getRealizeWriteInputType } from "../utils/getRealizeWriteInputType";
|
|
10
11
|
import { transformRealizeWriteAuthorizationsHistories } from "./transformRealizeWriteAuthorizationsHistories";
|
|
11
12
|
|
|
12
|
-
export const transformRealizeWriteHistories = (
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
export const transformRealizeWriteHistories = (props: {
|
|
14
|
+
state: AutoBeState;
|
|
15
|
+
scenario: IAutoBeRealizeScenarioResult;
|
|
16
|
+
authorization: AutoBeRealizeAuthorization | null;
|
|
17
|
+
totalAuthorizations: AutoBeRealizeAuthorization[];
|
|
18
|
+
dto: Record<string, string>;
|
|
19
|
+
}): Array<
|
|
15
20
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
16
21
|
> => {
|
|
17
22
|
const payloads = Object.fromEntries(
|
|
@@ -21,38 +26,7 @@ export const transformRealizeWriteHistories = (
|
|
|
21
26
|
]),
|
|
22
27
|
);
|
|
23
28
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const propsFields: string[] = [];
|
|
27
|
-
|
|
28
|
-
// payload 추가
|
|
29
|
-
if (props.authorization && operation.authorizationRole) {
|
|
30
|
-
propsFields.push(
|
|
31
|
-
`${operation.authorizationRole}: ${props.authorization.payload.name};`,
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// parameters 추가
|
|
36
|
-
operation.parameters.forEach((parameter) => {
|
|
37
|
-
const format =
|
|
38
|
-
"format" in parameter.schema
|
|
39
|
-
? ` & tags.Format<'${parameter.schema.format}'>`
|
|
40
|
-
: "";
|
|
41
|
-
propsFields.push(`${parameter.name}: ${parameter.schema.type}${format};`);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
// body 추가
|
|
45
|
-
if (operation.requestBody?.typeName) {
|
|
46
|
-
propsFields.push(`body: ${operation.requestBody.typeName};`);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const input =
|
|
50
|
-
propsFields.length > 0
|
|
51
|
-
? StringUtil.trim`
|
|
52
|
-
props: {
|
|
53
|
-
${propsFields.map((field) => ` ${field},`).join("\n")}
|
|
54
|
-
}`
|
|
55
|
-
: `// No props parameter needed - function should have no parameters`;
|
|
29
|
+
const operation = props.scenario.operation;
|
|
56
30
|
|
|
57
31
|
if (props.state.analyze === null)
|
|
58
32
|
return [
|
|
@@ -132,7 +106,7 @@ export const transformRealizeWriteHistories = (
|
|
|
132
106
|
id: v7(),
|
|
133
107
|
created_at: new Date().toISOString(),
|
|
134
108
|
type: "systemMessage",
|
|
135
|
-
text: AutoBeSystemPromptConstant.
|
|
109
|
+
text: AutoBeSystemPromptConstant.REALIZE_WRITE,
|
|
136
110
|
},
|
|
137
111
|
...authorizationHistories,
|
|
138
112
|
{
|
|
@@ -143,14 +117,26 @@ export const transformRealizeWriteHistories = (
|
|
|
143
117
|
`{prisma_schemas}`,
|
|
144
118
|
JSON.stringify(props.state.prisma.schemas),
|
|
145
119
|
)
|
|
146
|
-
.replaceAll(
|
|
147
|
-
|
|
148
|
-
|
|
120
|
+
.replaceAll(
|
|
121
|
+
`{input}`,
|
|
122
|
+
getRealizeWriteInputType(operation, props.authorization),
|
|
123
|
+
)
|
|
124
|
+
.replaceAll(`{artifacts_dto}`, JSON.stringify(props.dto)),
|
|
149
125
|
},
|
|
150
126
|
{
|
|
151
127
|
id: v7(),
|
|
128
|
+
type: "systemMessage",
|
|
152
129
|
created_at: new Date().toISOString(),
|
|
130
|
+
text: getRealizeWriteCodeTemplate(
|
|
131
|
+
props.scenario,
|
|
132
|
+
operation,
|
|
133
|
+
props.authorization,
|
|
134
|
+
),
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: v7(),
|
|
153
138
|
type: "systemMessage",
|
|
139
|
+
created_at: new Date().toISOString(),
|
|
154
140
|
text: StringUtil.trim`
|
|
155
141
|
Write new code based on the following operation.
|
|
156
142
|
|
|
@@ -179,11 +165,3 @@ export const transformRealizeWriteHistories = (
|
|
|
179
165
|
},
|
|
180
166
|
];
|
|
181
167
|
};
|
|
182
|
-
|
|
183
|
-
interface IProps {
|
|
184
|
-
state: AutoBeState;
|
|
185
|
-
scenario: IAutoBeRealizeScenarioApplication.IProps;
|
|
186
|
-
artifacts: IAutoBeTestScenarioArtifacts;
|
|
187
|
-
authorization: AutoBeRealizeAuthorization | null;
|
|
188
|
-
totalAuthorizations: AutoBeRealizeAuthorization[];
|
|
189
|
-
}
|
|
@@ -16,7 +16,7 @@ export async function compileRealizeFiles<Model extends ILlmSchema.Model>(
|
|
|
16
16
|
authorizations: AutoBeRealizeAuthorization[];
|
|
17
17
|
functions: AutoBeRealizeFunction[];
|
|
18
18
|
},
|
|
19
|
-
): Promise<
|
|
19
|
+
): Promise<AutoBeRealizeValidateEvent> {
|
|
20
20
|
const prisma = ctx.state().prisma?.compiled;
|
|
21
21
|
const payloads: Record<string, string> = Object.fromEntries(
|
|
22
22
|
props.authorizations.map((el) => [el.payload.location, el.payload.content]),
|
|
@@ -50,22 +50,15 @@ export async function compileRealizeFiles<Model extends ILlmSchema.Model>(
|
|
|
50
50
|
await compiler.typescript.compile({
|
|
51
51
|
files: files,
|
|
52
52
|
});
|
|
53
|
-
if (compiled.type === "success") {
|
|
54
|
-
return compiled;
|
|
55
|
-
}
|
|
56
53
|
|
|
57
54
|
const event: AutoBeRealizeValidateEvent = {
|
|
58
55
|
type: "realizeValidate",
|
|
59
56
|
id: v7(),
|
|
57
|
+
files: files,
|
|
60
58
|
result: compiled,
|
|
61
|
-
files: Object.fromEntries(
|
|
62
|
-
compiled.type === "failure"
|
|
63
|
-
? compiled.diagnostics.map((d) => [d.file, d.code])
|
|
64
|
-
: [],
|
|
65
|
-
),
|
|
66
59
|
step: ctx.state().analyze?.step ?? 0,
|
|
67
60
|
created_at: new Date().toISOString(),
|
|
68
61
|
};
|
|
69
|
-
|
|
70
|
-
return
|
|
62
|
+
|
|
63
|
+
return event;
|
|
71
64
|
}
|