@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
|
@@ -1,39 +1,28 @@
|
|
|
1
1
|
import { StringUtil } from "@autobe/utils";
|
|
2
2
|
|
|
3
3
|
import { IAutoBeTestScenarioArtifacts } from "../structures/IAutoBeTestScenarioArtifacts";
|
|
4
|
+
import { getTestImportStatements } from "./getTestImportStatements";
|
|
4
5
|
|
|
5
6
|
export function completeTestCode(
|
|
6
7
|
artifacts: IAutoBeTestScenarioArtifacts,
|
|
7
8
|
code: string,
|
|
8
9
|
): string {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
)
|
|
15
|
-
);
|
|
10
|
+
code = code
|
|
11
|
+
.split("\r\n")
|
|
12
|
+
.join("\n")
|
|
13
|
+
.split("\n")
|
|
14
|
+
.filter((str) => str.trim().startsWith("import") === false)
|
|
15
|
+
.join("\n");
|
|
16
16
|
|
|
17
|
-
code = code.replace(/^[ \t]*import\b[\s\S]*?;[ \t]*$/gm, "").trim();
|
|
18
|
-
code = code.replace(/^[ \t]*import\b[\s\S]*?;[ \t]*$/gm, "").trim();
|
|
19
|
-
code = code.replaceAll(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
import { IConnection } from "@nestia/fetcher";
|
|
26
|
-
import typia, { tags } from "typia";
|
|
27
|
-
|
|
28
|
-
import api from "@ORGANIZATION/PROJECT-api";
|
|
29
|
-
${typeReferences
|
|
30
|
-
.map(
|
|
31
|
-
(ref) =>
|
|
32
|
-
`import type { ${ref} } from "@ORGANIZATION/PROJECT-api/lib/structures/${ref}";`,
|
|
33
|
-
)
|
|
34
|
-
.join("\n")}
|
|
17
|
+
// code = code.replace(/^[ \t]*import\b[\s\S]*?;[ \t]*$/gm, "").trim();
|
|
18
|
+
// code = code.replace(/^[ \t]*import\b[\s\S]*?;[ \t]*$/gm, "").trim();
|
|
19
|
+
// code = code.replaceAll(
|
|
20
|
+
// 'string & Format<"uuid">',
|
|
21
|
+
// 'string & tags.Format<"uuid">',
|
|
22
|
+
// );
|
|
23
|
+
return StringUtil.trim`
|
|
24
|
+
${getTestImportStatements(artifacts.document)}
|
|
35
25
|
|
|
36
26
|
${code}
|
|
37
27
|
`;
|
|
38
|
-
return code;
|
|
39
28
|
}
|
|
@@ -19,7 +19,10 @@ const singleton = new Singleton(async (compiler: IAutoBeTestCompiler) => {
|
|
|
19
19
|
return { [location]: content };
|
|
20
20
|
};
|
|
21
21
|
return {
|
|
22
|
+
...external("node_modules/@nestia/e2e/lib/ArrayUtil.d.ts"),
|
|
23
|
+
...external("node_modules/@nestia/e2e/lib/RandomGenerator.d.ts"),
|
|
22
24
|
...external("node_modules/@nestia/e2e/lib/TestValidator.d.ts"),
|
|
23
25
|
...external("node_modules/@nestia/fetcher/lib/IConnection.d.ts"),
|
|
26
|
+
...external("node_modules/typia/lib/module.d.ts"),
|
|
24
27
|
} satisfies Record<string, string>;
|
|
25
28
|
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AutoBeOpenApi } from "@autobe/interface";
|
|
2
|
+
import { StringUtil } from "@autobe/utils";
|
|
3
|
+
|
|
4
|
+
export const getTestImportStatements = (
|
|
5
|
+
document: AutoBeOpenApi.IDocument,
|
|
6
|
+
): string => {
|
|
7
|
+
const typeReferences: string[] = Array.from(
|
|
8
|
+
new Set(
|
|
9
|
+
Object.keys(document.components.schemas).map((key) => key.split(".")[0]!),
|
|
10
|
+
),
|
|
11
|
+
).sort();
|
|
12
|
+
return StringUtil.trim`
|
|
13
|
+
import { ArrayUtil, RandomGenerator, TestValidator } from "@nestia/e2e";
|
|
14
|
+
import { IConnection } from "@nestia/fetcher";
|
|
15
|
+
import typia, { tags } from "typia";
|
|
16
|
+
|
|
17
|
+
import api from "@ORGANIZATION/PROJECT-api";
|
|
18
|
+
${typeReferences
|
|
19
|
+
.map(
|
|
20
|
+
(ref) =>
|
|
21
|
+
`import type { ${ref} } from "@ORGANIZATION/PROJECT-api/lib/structures/${ref}";`,
|
|
22
|
+
)
|
|
23
|
+
.join("\n")}
|
|
24
|
+
`;
|
|
25
|
+
};
|
|
@@ -7,10 +7,14 @@ import { ILlmSchema, OpenApiTypeChecker } from "@samchon/openapi";
|
|
|
7
7
|
|
|
8
8
|
import { AutoBeContext } from "../../../context/AutoBeContext";
|
|
9
9
|
import { IAutoBeTestScenarioArtifacts } from "../structures/IAutoBeTestScenarioArtifacts";
|
|
10
|
+
import { getTestTemplateCode } from "./getTestTemplateCode";
|
|
10
11
|
|
|
11
12
|
export async function getTestScenarioArtifacts<Model extends ILlmSchema.Model>(
|
|
12
13
|
ctx: AutoBeContext<Model>,
|
|
13
|
-
scenario: Pick<
|
|
14
|
+
scenario: Pick<
|
|
15
|
+
AutoBeTestScenario,
|
|
16
|
+
"endpoint" | "dependencies" | "functionName"
|
|
17
|
+
>,
|
|
14
18
|
): Promise<IAutoBeTestScenarioArtifacts> {
|
|
15
19
|
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
16
20
|
const document: AutoBeOpenApi.IDocument = filterDocument(
|
|
@@ -35,6 +39,7 @@ export async function getTestScenarioArtifacts<Model extends ILlmSchema.Model>(
|
|
|
35
39
|
sdk: filter("src/api", "src/api/structures"),
|
|
36
40
|
dto: filter("src/api/structures"),
|
|
37
41
|
e2e: filter("test/features"),
|
|
42
|
+
template: getTestTemplateCode(scenario, document),
|
|
38
43
|
};
|
|
39
44
|
}
|
|
40
45
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AutoBeOpenApi, AutoBeTestScenario } from "@autobe/interface";
|
|
2
|
+
import { StringUtil } from "@autobe/utils";
|
|
3
|
+
|
|
4
|
+
import { getTestImportStatements } from "./getTestImportStatements";
|
|
5
|
+
|
|
6
|
+
export const getTestTemplateCode = (
|
|
7
|
+
scenario: Pick<
|
|
8
|
+
AutoBeTestScenario,
|
|
9
|
+
"endpoint" | "dependencies" | "functionName"
|
|
10
|
+
>,
|
|
11
|
+
document: AutoBeOpenApi.IDocument,
|
|
12
|
+
): string => {
|
|
13
|
+
return StringUtil.trim`
|
|
14
|
+
${getTestImportStatements(document)}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* <SCENARIO DESCRIPTION HERE>
|
|
18
|
+
*/
|
|
19
|
+
export async function ${scenario.functionName}(
|
|
20
|
+
connection: api.IConnection,
|
|
21
|
+
) {
|
|
22
|
+
// <E2E TEST CODE HERE>
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
};
|
|
@@ -1,47 +1,59 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
-
import { IAutoBeTypeScriptCompileResult } from "@autobe/interface";
|
|
3
2
|
import { StringUtil } from "@autobe/utils";
|
|
4
|
-
import {
|
|
3
|
+
import { ILlmSchema } from "@samchon/openapi";
|
|
4
|
+
import { v4, v7 } from "uuid";
|
|
5
5
|
|
|
6
6
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
7
|
+
import { AutoBeContext } from "../../../context/AutoBeContext";
|
|
7
8
|
import { IAutoBeTestFunction } from "../structures/IAutoBeTestFunction";
|
|
9
|
+
import { IAutoBeTestFunctionFailure } from "../structures/IAutoBeTestFunctionFailure";
|
|
8
10
|
import { transformTestWriteHistories } from "./transformTestWriteHistories";
|
|
9
11
|
|
|
10
|
-
export const transformTestCorrectHistories =
|
|
12
|
+
export const transformTestCorrectHistories = async <
|
|
13
|
+
Model extends ILlmSchema.Model,
|
|
14
|
+
>(
|
|
15
|
+
ctx: AutoBeContext<Model>,
|
|
11
16
|
func: IAutoBeTestFunction,
|
|
12
|
-
|
|
13
|
-
):
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
failures: IAutoBeTestFunctionFailure[],
|
|
18
|
+
): Promise<
|
|
19
|
+
Array<
|
|
20
|
+
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
21
|
+
>
|
|
22
|
+
> => {
|
|
23
|
+
const previous: Array<
|
|
24
|
+
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
25
|
+
> = await transformTestWriteHistories(ctx, func.scenario, func.artifacts);
|
|
26
|
+
return [
|
|
27
|
+
...previous.slice(0, -1),
|
|
28
|
+
{
|
|
29
|
+
id: v7(),
|
|
30
|
+
created_at: new Date().toISOString(),
|
|
31
|
+
type: "systemMessage",
|
|
32
|
+
text: AutoBeSystemPromptConstant.TEST_CORRECT,
|
|
33
|
+
},
|
|
34
|
+
previous.at(-1)!,
|
|
35
|
+
...failures.map(
|
|
36
|
+
(f) =>
|
|
37
|
+
({
|
|
38
|
+
id: v4(),
|
|
39
|
+
created_at: new Date().toISOString(),
|
|
40
|
+
type: "assistantMessage",
|
|
41
|
+
text: StringUtil.trim`
|
|
42
|
+
## Generated TypeScript Code
|
|
26
43
|
|
|
27
|
-
|
|
28
|
-
|
|
44
|
+
\`\`\`typescript
|
|
45
|
+
${f.function.script}
|
|
46
|
+
\`\`\`
|
|
29
47
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
text: AutoBeSystemPromptConstant.TEST_CORRECT.replace(
|
|
40
|
-
"{{API_DTO_SCHEMAS}}",
|
|
41
|
-
transformTestWriteHistories.structures(func.artifacts),
|
|
42
|
-
).replace(
|
|
43
|
-
"{{API_SDK_FUNCTIONS}}",
|
|
44
|
-
transformTestWriteHistories.functional(func.artifacts),
|
|
48
|
+
## Compile Errors
|
|
49
|
+
|
|
50
|
+
Fix the compilation error in the provided code.
|
|
51
|
+
|
|
52
|
+
\`\`\`json
|
|
53
|
+
${JSON.stringify(f.failure.diagnostics)}
|
|
54
|
+
\`\`\`
|
|
55
|
+
`,
|
|
56
|
+
}) satisfies IAgenticaHistoryJson.IAssistantMessage,
|
|
45
57
|
),
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
];
|
|
59
|
+
};
|
|
@@ -48,7 +48,7 @@ export const transformTestScenarioHistories = (
|
|
|
48
48
|
{
|
|
49
49
|
id: v7(),
|
|
50
50
|
created_at: new Date().toISOString(),
|
|
51
|
-
type: "
|
|
51
|
+
type: "assistantMessage",
|
|
52
52
|
text: StringUtil.trim`
|
|
53
53
|
# Operations
|
|
54
54
|
|
|
@@ -73,17 +73,18 @@ export const transformTestScenarioHistories = (
|
|
|
73
73
|
)}
|
|
74
74
|
\`\`\`
|
|
75
75
|
`,
|
|
76
|
-
} satisfies IAgenticaHistoryJson.
|
|
76
|
+
} satisfies IAgenticaHistoryJson.IAssistantMessage,
|
|
77
77
|
{
|
|
78
78
|
id: v7(),
|
|
79
79
|
created_at: new Date().toISOString(),
|
|
80
|
-
type: "
|
|
80
|
+
type: "assistantMessage",
|
|
81
81
|
text: StringUtil.trim`
|
|
82
82
|
# Included in Test Plan
|
|
83
83
|
|
|
84
84
|
Below are the endpoints that have been included in the test plan.
|
|
85
85
|
Each endpoint shows its authentication requirements and related authentication APIs.
|
|
86
|
-
When testing endpoints that require authentication, ensure you include the corresponding
|
|
86
|
+
When testing endpoints that require authentication, ensure you include the corresponding
|
|
87
|
+
join/login operations in your test scenario to establish proper authentication context.
|
|
87
88
|
|
|
88
89
|
${include
|
|
89
90
|
.map((el, i) => {
|
|
@@ -121,6 +122,6 @@ export const transformTestScenarioHistories = (
|
|
|
121
122
|
.map((el) => `- ${el.method.toUpperCase()}: ${el.path}`)
|
|
122
123
|
.join("\n")}
|
|
123
124
|
`,
|
|
124
|
-
} satisfies IAgenticaHistoryJson.
|
|
125
|
+
} satisfies IAgenticaHistoryJson.IAssistantMessage,
|
|
125
126
|
];
|
|
126
127
|
};
|
|
@@ -4,18 +4,28 @@ import { StringUtil, transformOpenApiDocument } from "@autobe/utils";
|
|
|
4
4
|
import {
|
|
5
5
|
HttpMigration,
|
|
6
6
|
IHttpMigrateApplication,
|
|
7
|
+
ILlmSchema,
|
|
7
8
|
OpenApi,
|
|
8
9
|
} from "@samchon/openapi";
|
|
9
10
|
import typia from "typia";
|
|
10
11
|
import { v7 } from "uuid";
|
|
11
12
|
|
|
12
13
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
14
|
+
import { AutoBeContext } from "../../../context/AutoBeContext";
|
|
15
|
+
import { getTestExternalDeclarations } from "../compile/getTestExternalDeclarations";
|
|
13
16
|
import { IAutoBeTestScenarioArtifacts } from "../structures/IAutoBeTestScenarioArtifacts";
|
|
14
17
|
|
|
15
|
-
export function transformTestWriteHistories
|
|
18
|
+
export async function transformTestWriteHistories<
|
|
19
|
+
Model extends ILlmSchema.Model,
|
|
20
|
+
>(
|
|
21
|
+
ctx: AutoBeContext<Model>,
|
|
16
22
|
scenario: AutoBeTestScenario,
|
|
17
23
|
artifacts: IAutoBeTestScenarioArtifacts,
|
|
18
|
-
):
|
|
24
|
+
): Promise<
|
|
25
|
+
Array<
|
|
26
|
+
IAgenticaHistoryJson.ISystemMessage | IAgenticaHistoryJson.IAssistantMessage
|
|
27
|
+
>
|
|
28
|
+
> {
|
|
19
29
|
return [
|
|
20
30
|
{
|
|
21
31
|
id: v7(),
|
|
@@ -24,17 +34,21 @@ export function transformTestWriteHistories(
|
|
|
24
34
|
text: AutoBeSystemPromptConstant.TEST_WRITE.replace(
|
|
25
35
|
"{{AutoBeTestScenario}}",
|
|
26
36
|
JSON.stringify(typia.llm.parameters<AutoBeTestScenario, "llama">()),
|
|
27
|
-
)
|
|
37
|
+
),
|
|
28
38
|
},
|
|
29
39
|
{
|
|
30
40
|
id: v7(),
|
|
31
41
|
created_at: new Date().toISOString(),
|
|
32
|
-
type: "
|
|
42
|
+
type: "assistantMessage",
|
|
33
43
|
text: StringUtil.trim`
|
|
34
44
|
Here is the list of input material composition.
|
|
35
45
|
|
|
36
46
|
Make e2e test functions based on the following information.
|
|
37
47
|
|
|
48
|
+
## Function Name
|
|
49
|
+
|
|
50
|
+
The e2e test function name must be ${JSON.stringify(scenario.functionName)}.
|
|
51
|
+
|
|
38
52
|
## Scenario Plan
|
|
39
53
|
|
|
40
54
|
Here is the scenario plan what you have to implement.
|
|
@@ -66,6 +80,31 @@ export function transformTestWriteHistories(
|
|
|
66
80
|
\`\`\`json
|
|
67
81
|
${JSON.stringify(artifacts.e2e)}
|
|
68
82
|
\`\`\`
|
|
83
|
+
|
|
84
|
+
## External Definitions
|
|
85
|
+
|
|
86
|
+
Here is the external declaration files (d.ts) you can reference.
|
|
87
|
+
|
|
88
|
+
\`\`\`json
|
|
89
|
+
${JSON.stringify(await getTestExternalDeclarations(ctx))}
|
|
90
|
+
\`\`\`
|
|
91
|
+
|
|
92
|
+
## Template Code
|
|
93
|
+
|
|
94
|
+
Here is the template e2e test code what you must follow.
|
|
95
|
+
|
|
96
|
+
You're only allowed to modify the "<SCENARIO DESCRIPTION HERE>" and
|
|
97
|
+
code inside the function block marked as "// <E2E TEST CODE HERE>".
|
|
98
|
+
Change the template code by writing your scenario description to the
|
|
99
|
+
comment, and filling your implementation logic into the function.
|
|
100
|
+
|
|
101
|
+
Note that, you don't need to add any "import" statement more than
|
|
102
|
+
this template code. Everything you need is already imported, so
|
|
103
|
+
make your implementation code in the import scope.
|
|
104
|
+
|
|
105
|
+
\`\`\`typescript
|
|
106
|
+
${artifacts.template}
|
|
107
|
+
\`\`\`
|
|
69
108
|
`,
|
|
70
109
|
},
|
|
71
110
|
];
|
|
@@ -68,6 +68,12 @@ export const orchestrateTest =
|
|
|
68
68
|
ctx,
|
|
69
69
|
written,
|
|
70
70
|
);
|
|
71
|
+
// for (const c of corrects)
|
|
72
|
+
// if (c.result.type !== "success")
|
|
73
|
+
// c.file.content = c.file.content
|
|
74
|
+
// .split("\n")
|
|
75
|
+
// .map((s) => `// ${s}`)
|
|
76
|
+
// .join("\n");
|
|
71
77
|
|
|
72
78
|
// DO COMPILE
|
|
73
79
|
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
@@ -17,13 +17,13 @@ import { completeTestCode } from "./compile/completeTestCode";
|
|
|
17
17
|
import { transformTestCorrectHistories } from "./histories/transformTestCorrectHistories";
|
|
18
18
|
import { IAutoBeTestCorrectApplication } from "./structures/IAutoBeTestCorrectApplication";
|
|
19
19
|
import { IAutoBeTestFunction } from "./structures/IAutoBeTestFunction";
|
|
20
|
+
import { IAutoBeTestFunctionFailure } from "./structures/IAutoBeTestFunctionFailure";
|
|
20
21
|
import { IAutoBeTestScenarioArtifacts } from "./structures/IAutoBeTestScenarioArtifacts";
|
|
21
22
|
import { IAutoBeTestWriteResult } from "./structures/IAutoBeTestWriteResult";
|
|
22
23
|
|
|
23
24
|
export const orchestrateTestCorrect = async <Model extends ILlmSchema.Model>(
|
|
24
25
|
ctx: AutoBeContext<Model>,
|
|
25
26
|
writeResult: IAutoBeTestWriteResult[],
|
|
26
|
-
life: number = 4,
|
|
27
27
|
): Promise<AutoBeTestValidateEvent[]> => {
|
|
28
28
|
const result: Array<AutoBeTestValidateEvent | null> =
|
|
29
29
|
await executeCachedBatch(
|
|
@@ -33,7 +33,7 @@ export const orchestrateTestCorrect = async <Model extends ILlmSchema.Model>(
|
|
|
33
33
|
artifacts: w.artifacts,
|
|
34
34
|
scenario: w.scenario,
|
|
35
35
|
location: w.event.location,
|
|
36
|
-
script: w.event.final,
|
|
36
|
+
script: w.event.final ?? w.event.draft,
|
|
37
37
|
});
|
|
38
38
|
return await predicate(
|
|
39
39
|
ctx,
|
|
@@ -41,10 +41,11 @@ export const orchestrateTestCorrect = async <Model extends ILlmSchema.Model>(
|
|
|
41
41
|
artifacts: w.artifacts,
|
|
42
42
|
scenario: w.scenario,
|
|
43
43
|
location: w.event.location,
|
|
44
|
-
script: w.event.final,
|
|
44
|
+
script: w.event.final ?? w.event.draft,
|
|
45
45
|
},
|
|
46
|
+
[],
|
|
46
47
|
event,
|
|
47
|
-
|
|
48
|
+
ctx.retry,
|
|
48
49
|
);
|
|
49
50
|
} catch {
|
|
50
51
|
return null;
|
|
@@ -83,18 +84,20 @@ const compile = async <Model extends ILlmSchema.Model>(
|
|
|
83
84
|
const predicate = async <Model extends ILlmSchema.Model>(
|
|
84
85
|
ctx: AutoBeContext<Model>,
|
|
85
86
|
content: IAutoBeTestFunction,
|
|
87
|
+
failures: IAutoBeTestFunctionFailure[],
|
|
86
88
|
event: AutoBeTestValidateEvent,
|
|
87
89
|
life: number,
|
|
88
90
|
): Promise<AutoBeTestValidateEvent> => {
|
|
89
91
|
if (event.result.type === "failure") ctx.dispatch(event);
|
|
90
92
|
return event.result.type === "failure"
|
|
91
|
-
? await correct(ctx, content, event, life - 1)
|
|
93
|
+
? await correct(ctx, content, failures, event, life - 1)
|
|
92
94
|
: event;
|
|
93
95
|
};
|
|
94
96
|
|
|
95
97
|
const correct = async <Model extends ILlmSchema.Model>(
|
|
96
98
|
ctx: AutoBeContext<Model>,
|
|
97
99
|
content: IAutoBeTestFunction,
|
|
100
|
+
failures: IAutoBeTestFunctionFailure[],
|
|
98
101
|
validate: AutoBeTestValidateEvent,
|
|
99
102
|
life: number,
|
|
100
103
|
): Promise<AutoBeTestValidateEvent> => {
|
|
@@ -106,7 +109,13 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
106
109
|
};
|
|
107
110
|
const { tokenUsage } = await ctx.conversate({
|
|
108
111
|
source: "testCorrect",
|
|
109
|
-
histories: transformTestCorrectHistories(content,
|
|
112
|
+
histories: await transformTestCorrectHistories(ctx, content, [
|
|
113
|
+
...failures,
|
|
114
|
+
{
|
|
115
|
+
function: content,
|
|
116
|
+
failure: validate.result,
|
|
117
|
+
},
|
|
118
|
+
]),
|
|
110
119
|
controller: createController({
|
|
111
120
|
model: ctx.model,
|
|
112
121
|
artifacts: content.artifacts,
|
|
@@ -125,7 +134,14 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
125
134
|
if (pointer.value === null) throw new Error("Failed to modify test code.");
|
|
126
135
|
|
|
127
136
|
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
128
|
-
|
|
137
|
+
if (pointer.value.revise)
|
|
138
|
+
pointer.value.revise.final = await compiler.typescript.beautify(
|
|
139
|
+
pointer.value.revise.final,
|
|
140
|
+
);
|
|
141
|
+
else
|
|
142
|
+
pointer.value.draft = await compiler.typescript.beautify(
|
|
143
|
+
pointer.value.draft,
|
|
144
|
+
);
|
|
129
145
|
|
|
130
146
|
ctx.dispatch({
|
|
131
147
|
type: "testCorrect",
|
|
@@ -135,14 +151,29 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
135
151
|
result: validate.result,
|
|
136
152
|
tokenUsage,
|
|
137
153
|
step: ctx.state().analyze?.step ?? 0,
|
|
138
|
-
|
|
154
|
+
think: pointer.value.think,
|
|
155
|
+
draft: pointer.value.draft,
|
|
156
|
+
review: pointer.value.revise?.review,
|
|
157
|
+
final: pointer.value.revise?.final,
|
|
139
158
|
});
|
|
140
159
|
const newContent: IAutoBeTestFunction = {
|
|
141
160
|
...content,
|
|
142
|
-
script: pointer.value.final,
|
|
161
|
+
script: pointer.value.revise?.final ?? pointer.value.draft,
|
|
143
162
|
};
|
|
144
163
|
const newValidate: AutoBeTestValidateEvent = await compile(ctx, newContent);
|
|
145
|
-
return predicate(
|
|
164
|
+
return predicate(
|
|
165
|
+
ctx,
|
|
166
|
+
newContent,
|
|
167
|
+
[
|
|
168
|
+
...failures,
|
|
169
|
+
{
|
|
170
|
+
function: content,
|
|
171
|
+
failure: validate.result,
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
newValidate,
|
|
175
|
+
life,
|
|
176
|
+
);
|
|
146
177
|
};
|
|
147
178
|
|
|
148
179
|
const createController = <Model extends ILlmSchema.Model>(props: {
|
|
@@ -162,7 +193,11 @@ const createController = <Model extends ILlmSchema.Model>(props: {
|
|
|
162
193
|
execute: {
|
|
163
194
|
rewrite: (next) => {
|
|
164
195
|
next.draft = completeTestCode(props.artifacts, next.draft);
|
|
165
|
-
|
|
196
|
+
if (next.revise)
|
|
197
|
+
next.revise.final = completeTestCode(
|
|
198
|
+
props.artifacts,
|
|
199
|
+
next.revise.final,
|
|
200
|
+
);
|
|
166
201
|
props.build(next);
|
|
167
202
|
},
|
|
168
203
|
} satisfies IAutoBeTestCorrectApplication,
|
|
@@ -64,7 +64,7 @@ export async function orchestrateTestScenario<Model extends ILlmSchema.Model>(
|
|
|
64
64
|
do {
|
|
65
65
|
const matrix: AutoBeOpenApi.IOperation[][] = divideArray({
|
|
66
66
|
array: include,
|
|
67
|
-
capacity:
|
|
67
|
+
capacity: 4,
|
|
68
68
|
});
|
|
69
69
|
await executeCachedBatch(
|
|
70
70
|
matrix.map((include) => async (promptCacheKey) => {
|
|
@@ -121,56 +121,60 @@ const divideAndConquer = async <Model extends ILlmSchema.Model>(
|
|
|
121
121
|
const pointer: IPointer<IAutoBeTestScenarioApplication.IScenarioGroup[]> = {
|
|
122
122
|
value: [],
|
|
123
123
|
};
|
|
124
|
-
|
|
125
124
|
const authorizations: AutoBeInterfaceAuthorization[] =
|
|
126
125
|
ctx.state().interface?.authorizations ?? [];
|
|
127
126
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
.
|
|
157
|
-
|
|
158
|
-
(
|
|
159
|
-
(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
127
|
+
try {
|
|
128
|
+
const { tokenUsage } = await ctx.conversate({
|
|
129
|
+
source: "testScenarios",
|
|
130
|
+
histories: transformTestScenarioHistories(
|
|
131
|
+
ctx.state(),
|
|
132
|
+
props.entire,
|
|
133
|
+
props.include,
|
|
134
|
+
props.exclude,
|
|
135
|
+
),
|
|
136
|
+
controller: createController({
|
|
137
|
+
model: ctx.model,
|
|
138
|
+
endpointNotFound: props.endpointNotFound,
|
|
139
|
+
dict: props.dict,
|
|
140
|
+
authorizations,
|
|
141
|
+
build: (next) => {
|
|
142
|
+
pointer.value ??= [];
|
|
143
|
+
pointer.value.push(...next.scenarioGroups);
|
|
144
|
+
},
|
|
145
|
+
}),
|
|
146
|
+
enforceFunctionCall: true,
|
|
147
|
+
promptCacheKey: props.promptCacheKey,
|
|
148
|
+
message: `Create e2e test scenarios.`,
|
|
149
|
+
});
|
|
150
|
+
if (pointer.value.length === 0) return [];
|
|
151
|
+
ctx.dispatch({
|
|
152
|
+
type: "testScenarios",
|
|
153
|
+
id: v7(),
|
|
154
|
+
tokenUsage,
|
|
155
|
+
scenarios: pointer.value
|
|
156
|
+
.map((v) =>
|
|
157
|
+
v.scenarios.map(
|
|
158
|
+
(s) =>
|
|
159
|
+
({
|
|
160
|
+
endpoint: v.endpoint,
|
|
161
|
+
draft: s.draft,
|
|
162
|
+
functionName: s.functionName,
|
|
163
|
+
dependencies: s.dependencies,
|
|
164
|
+
}) satisfies AutoBeTestScenario,
|
|
165
|
+
),
|
|
166
|
+
)
|
|
167
|
+
.flat(),
|
|
168
|
+
completed: (props.progress.completed += pointer.value.length),
|
|
169
|
+
total: props.progress.total,
|
|
170
|
+
step: ctx.state().interface?.step ?? 0,
|
|
171
|
+
created_at: new Date().toISOString(),
|
|
172
|
+
});
|
|
173
|
+
return pointer.value;
|
|
174
|
+
} catch {
|
|
175
|
+
console.log("test scenario, failed to function call", props.include);
|
|
176
|
+
return [];
|
|
177
|
+
}
|
|
174
178
|
};
|
|
175
179
|
|
|
176
180
|
function createController<Model extends ILlmSchema.Model>(props: {
|