@autobe/agent 0.21.0 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/agent/src/AutoBeAgent.js +2 -2
- package/lib/agent/src/AutoBeAgent.js.map +1 -1
- package/lib/agent/src/constants/AutoBeConfigConstant.d.ts +3 -0
- package/lib/agent/src/{orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js → constants/AutoBeConfigConstant.js} +1 -1
- package/lib/agent/src/constants/AutoBeConfigConstant.js.map +1 -0
- package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +27 -27
- package/lib/agent/src/context/AutoBeContext.d.ts +1 -0
- package/lib/agent/src/context/AutoBeTokenUsageComponent.js +4 -3
- package/lib/agent/src/context/AutoBeTokenUsageComponent.js.map +1 -1
- package/lib/agent/src/factory/consentFunctionCall.js +4 -4
- package/lib/agent/src/factory/consentFunctionCall.js.map +1 -1
- package/lib/agent/src/factory/createAutoBeContext.js +13 -10
- package/lib/agent/src/factory/createAutoBeContext.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +2 -2
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js +6 -6
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js +50 -8
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js +4 -4
- package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +6 -0
- package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +4 -0
- package/lib/agent/src/orchestrate/facade/transformFacadeStateMessage.js +1 -1
- package/lib/agent/src/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +19 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +2 -2
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +2 -2
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterface.js +5 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js +16 -10
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js +3731 -228
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js +2 -2
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +2 -2
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +43 -63
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +1261 -1628
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +3468 -105
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js +3674 -360
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -141
- package/lib/agent/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +29 -23
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.d.ts +9 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.js +1385 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.d.ts +5 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.js +78 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaValidator.d.ts +10 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaValidator.js +59 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.d.ts +2 -0
- package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js +81 -0
- package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js.map +1 -0
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +2 -2
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +2 -2
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +2 -2
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +22 -7
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +13 -29
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js +2 -8
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +6 -49
- package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +4 -2
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +5 -3
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +206 -118
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -2
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +24 -39
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +17 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +20 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +33 -73
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.d.ts +5 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.js +3 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.js.map +1 -0
- package/{src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.ts → lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts} +2 -13
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.js +3 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +33 -22
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +31 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +86 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.d.ts +4 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.js +55 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +2 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.js +20 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.d.ts +30 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.js +73 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.d.ts +6 -2
- package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js +63 -69
- package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/completeTestCode.d.ts +3 -1
- package/lib/agent/src/orchestrate/test/compile/completeTestCode.js +25 -18
- package/lib/agent/src/orchestrate/test/compile/completeTestCode.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js +5 -1
- package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
- package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js +19 -0
- package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js.map +1 -0
- package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js +2 -0
- package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
- package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js +21 -0
- package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js.map +1 -0
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.d.ts +2 -2
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +16 -17
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +5 -4
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +21 -2
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTest.js +6 -0
- package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.d.ts +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +123 -75
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +46 -40
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +117 -45
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +48 -45
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.d.ts +6 -0
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.js +3 -0
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.js.map +1 -0
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +1 -0
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +13 -0
- package/lib/agent/src/orchestrate/test/utils/getReferenceIds.d.ts +5 -0
- package/lib/agent/src/orchestrate/test/utils/getReferenceIds.js +28 -0
- package/lib/agent/src/orchestrate/test/utils/getReferenceIds.js.map +1 -0
- package/lib/agent/src/structures/IAutoBeConfig.d.ts +2 -0
- package/lib/constants/AutoBeConfigConstant.d.ts +3 -0
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +27 -27
- package/lib/context/AutoBeContext.d.ts +1 -0
- package/lib/index.mjs +13871 -3912
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +6 -0
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +4 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -141
- package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +29 -23
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.d.ts +9 -0
- package/lib/orchestrate/interface/utils/JsonSchemaNamingConvention.d.ts +5 -0
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.d.ts +10 -0
- package/lib/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.d.ts +2 -0
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
- package/lib/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
- package/lib/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
- package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -2
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +17 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +20 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +33 -73
- package/lib/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.d.ts +5 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts +36 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +33 -22
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +31 -0
- package/lib/orchestrate/realize/utils/getRealizeWriteDto.d.ts +4 -0
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +2 -0
- package/lib/orchestrate/realize/utils/getRealizeWriteInputType.d.ts +30 -0
- package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +6 -2
- package/lib/orchestrate/test/compile/completeTestCode.d.ts +3 -1
- package/lib/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
- package/lib/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +2 -2
- package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +48 -45
- package/lib/orchestrate/test/structures/IAutoBeTestFunctionFailure.d.ts +6 -0
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +13 -0
- package/lib/orchestrate/test/utils/getReferenceIds.d.ts +5 -0
- package/lib/structures/IAutoBeConfig.d.ts +2 -0
- package/package.json +6 -6
- package/src/AutoBeAgent.ts +2 -0
- package/src/constants/AutoBeConfigConstant.ts +3 -0
- package/src/constants/AutoBeSystemPromptConstant.ts +27 -27
- package/src/context/AutoBeContext.ts +1 -0
- package/src/context/AutoBeTokenUsageComponent.ts +3 -3
- package/src/factory/consentFunctionCall.ts +2 -0
- package/src/factory/createAutoBeContext.ts +145 -136
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.ts +6 -0
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +4 -0
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +19 -1
- package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +1 -4
- package/src/orchestrate/interface/orchestrateInterface.ts +15 -4
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +13 -5
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +58 -19
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +11 -11
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +13 -117
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +35 -93
- package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +74 -97
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +0 -39
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +50 -146
- package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +31 -27
- package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +171 -0
- package/src/orchestrate/interface/utils/JsonSchemaNamingConvention.ts +83 -0
- package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +66 -0
- package/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.ts +90 -0
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +1 -2
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +30 -15
- package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +27 -49
- package/src/orchestrate/realize/internal/compileRealizeFiles.ts +4 -11
- package/src/orchestrate/realize/orchestrateRealize.ts +19 -75
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +1 -1
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +114 -25
- package/src/orchestrate/realize/orchestrateRealizeScenario.ts +2 -2
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +11 -15
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +17 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +20 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +40 -74
- package/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.ts +9 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.ts +45 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +33 -22
- package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +97 -0
- package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +64 -0
- package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +29 -0
- package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +82 -0
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +101 -111
- package/src/orchestrate/test/compile/completeTestCode.ts +18 -31
- package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +12 -0
- package/src/orchestrate/test/compile/getTestImportStatements.ts +25 -0
- package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +6 -1
- package/src/orchestrate/test/compile/getTestTemplateCode.ts +25 -0
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +26 -26
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +6 -5
- package/src/orchestrate/test/histories/transformTestWriteHistories.ts +19 -0
- package/src/orchestrate/test/orchestrateTest.ts +6 -0
- package/src/orchestrate/test/orchestrateTestCorrect.ts +44 -20
- package/src/orchestrate/test/orchestrateTestScenario.ts +52 -48
- package/src/orchestrate/test/orchestrateTestWrite.ts +20 -10
- package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +49 -46
- package/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.ts +8 -0
- package/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.ts +1 -0
- package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +14 -0
- package/src/orchestrate/test/utils/getReferenceIds.ts +25 -0
- package/src/structures/IAutoBeConfig.ts +3 -0
- package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.d.ts +0 -7
- package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js +0 -35
- package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js.map +0 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js.map +0 -1
- package/lib/orchestrate/interface/utils/validateAuthorizationSchema.d.ts +0 -7
- package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
- package/src/orchestrate/interface/utils/validateAuthorizationSchema.ts +0 -41
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { AutoBeOpenApi, AutoBeRealizeAuthorization } from "@autobe/interface";
|
|
2
|
+
import { StringUtil } from "@autobe/utils";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generate TypeScript type definition string for provider function props
|
|
6
|
+
*
|
|
7
|
+
* This utility creates the exact props interface that the Realize Agent's
|
|
8
|
+
* generated provider functions must accept. It combines:
|
|
9
|
+
*
|
|
10
|
+
* - Authentication context (user/admin/member from authorization)
|
|
11
|
+
* - URL path parameters (e.g., id, boardId, postId)
|
|
12
|
+
* - Request body type (if applicable)
|
|
13
|
+
*
|
|
14
|
+
* The output is injected into REALIZE_WRITE_ARTIFACT.md template to tell the AI
|
|
15
|
+
* exactly what parameter type the function should accept.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // For DELETE /posts/:id (authenticated)
|
|
19
|
+
* // Returns: "props: { user: IUser; id: string & tags.Format<'uuid'>; }"
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // For GET /public/info (no auth, no params)
|
|
23
|
+
* // Returns: "// No props parameter needed - function should have no parameters"
|
|
24
|
+
*
|
|
25
|
+
* @param operation - OpenAPI operation definition containing parameters and
|
|
26
|
+
* auth requirements
|
|
27
|
+
* @param authorization - Authorization context with user/role information (if
|
|
28
|
+
* authenticated endpoint)
|
|
29
|
+
* @returns TypeScript interface string like "props: { user: IUser; id: string;
|
|
30
|
+
* body: IRequest; }"
|
|
31
|
+
*/
|
|
32
|
+
export function getRealizeWriteInputType(
|
|
33
|
+
operation: AutoBeOpenApi.IOperation,
|
|
34
|
+
authorization: AutoBeRealizeAuthorization | null,
|
|
35
|
+
): string {
|
|
36
|
+
const functionParameterFields: string[] = [];
|
|
37
|
+
|
|
38
|
+
// Add authentication field (user/admin/member) if endpoint requires auth
|
|
39
|
+
const hasAuthentication = authorization && operation.authorizationRole;
|
|
40
|
+
if (hasAuthentication) {
|
|
41
|
+
const authFieldName = operation.authorizationRole;
|
|
42
|
+
const authFieldType = authorization.payload.name;
|
|
43
|
+
functionParameterFields.push(`${authFieldName}: ${authFieldType};`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Add URL path parameters (e.g., /posts/:id → id parameter)
|
|
47
|
+
const pathParameters = operation.parameters;
|
|
48
|
+
pathParameters.forEach((pathParam) => {
|
|
49
|
+
const paramName = pathParam.name;
|
|
50
|
+
const paramType = pathParam.schema.type;
|
|
51
|
+
const paramFormat =
|
|
52
|
+
"format" in pathParam.schema
|
|
53
|
+
? ` & tags.Format<'${pathParam.schema.format}'>`
|
|
54
|
+
: "";
|
|
55
|
+
|
|
56
|
+
const parameterField = `${paramName}: ${paramType}${paramFormat};`;
|
|
57
|
+
functionParameterFields.push(parameterField);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Add request body if present (POST/PUT/PATCH operations)
|
|
61
|
+
const hasRequestBody = operation.requestBody?.typeName;
|
|
62
|
+
if (hasRequestBody) {
|
|
63
|
+
const bodyTypeName = operation.requestBody?.typeName;
|
|
64
|
+
functionParameterFields.push(`body: ${bodyTypeName};`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Format as TypeScript props interface or indicate no parameters needed
|
|
68
|
+
const hasParameters = functionParameterFields.length > 0;
|
|
69
|
+
|
|
70
|
+
if (!hasParameters) {
|
|
71
|
+
return `// No props parameter needed - function should have no parameters`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const formattedFields = functionParameterFields
|
|
75
|
+
.map((field) => ` ${field}`)
|
|
76
|
+
.join("\n");
|
|
77
|
+
|
|
78
|
+
return StringUtil.trim`
|
|
79
|
+
props: {
|
|
80
|
+
${formattedFields}
|
|
81
|
+
}`;
|
|
82
|
+
}
|
|
@@ -1,133 +1,123 @@
|
|
|
1
|
-
import { IAutoBeCompiler } from "@autobe/interface";
|
|
1
|
+
import { AutoBeOpenApi, IAutoBeCompiler } from "@autobe/interface";
|
|
2
2
|
import { ILlmSchema } from "@samchon/openapi";
|
|
3
3
|
|
|
4
4
|
import { AutoBeContext } from "../../../context/AutoBeContext";
|
|
5
|
-
import {
|
|
5
|
+
import { getRealizeWriteImportStatements } from "./getRealizeWriteImportStatements";
|
|
6
6
|
|
|
7
|
-
export function replaceImportStatements<Model extends ILlmSchema.Model>(
|
|
7
|
+
export async function replaceImportStatements<Model extends ILlmSchema.Model>(
|
|
8
8
|
ctx: AutoBeContext<Model>,
|
|
9
|
+
props: {
|
|
10
|
+
operation: AutoBeOpenApi.IOperation;
|
|
11
|
+
code: string;
|
|
12
|
+
decoratorType?: string;
|
|
13
|
+
},
|
|
9
14
|
) {
|
|
10
|
-
|
|
11
|
-
artifacts: IAutoBeTestScenarioArtifacts,
|
|
12
|
-
code: string,
|
|
13
|
-
decoratorType?: string,
|
|
14
|
-
) {
|
|
15
|
-
const typeReferences: string[] = Array.from(
|
|
16
|
-
new Set(
|
|
17
|
-
Object.keys(artifacts.document.components.schemas).map(
|
|
18
|
-
(key) => key.split(".")[0]!,
|
|
19
|
-
),
|
|
20
|
-
),
|
|
21
|
-
);
|
|
15
|
+
let { operation, code, decoratorType } = props;
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
)
|
|
31
|
-
.replace(
|
|
32
|
-
/import\s+typia\s*,\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm,
|
|
33
|
-
"",
|
|
34
|
-
)
|
|
35
|
-
.replace(/import\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm, "")
|
|
36
|
-
.replace(
|
|
37
|
-
/import\s*{\s*tags\s*,\s*typia\s*}\s*from\s*["']typia["']\s*;?\s*/gm,
|
|
38
|
-
"",
|
|
39
|
-
)
|
|
40
|
-
.replace(/import\s+typia\s*from\s*["']typia["']\s*;?\s*/gm, "")
|
|
41
|
-
.replace(
|
|
42
|
-
/import\s*{\s*Prisma\s*}\s*from\s*["']@prisma\/client["']\s*;?\s*/gm,
|
|
43
|
-
"",
|
|
44
|
-
)
|
|
45
|
-
.replace(/import\s*{\s*v4\s*}\s*from\s*["']uuid["']\s*;?\s*/gm, "")
|
|
46
|
-
.replace(
|
|
47
|
-
/import\s*{\s*toISOStringSafe\s*}\s*from\s*["']\.\.\/util\/toISOStringSafe["']\s*;?\s*/gm,
|
|
48
|
-
"",
|
|
49
|
-
)
|
|
50
|
-
// Remove JWT import if it exists (to prevent duplication)
|
|
51
|
-
.replace(/import\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm, "")
|
|
52
|
-
.replace(
|
|
53
|
-
/import\s*\*\s*as\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm,
|
|
54
|
-
"",
|
|
55
|
-
);
|
|
17
|
+
const typeReferences: string[] = Array.from(
|
|
18
|
+
new Set(
|
|
19
|
+
[operation.requestBody, operation.responseBody]
|
|
20
|
+
.filter((el) => el !== null)
|
|
21
|
+
.map((el) => el.typeName.split(".")[0]!),
|
|
22
|
+
),
|
|
23
|
+
);
|
|
56
24
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
25
|
+
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
26
|
+
code = await compiler.typescript.beautify(code);
|
|
27
|
+
// Remove existing import statements using flexible regex patterns
|
|
28
|
+
code = code
|
|
29
|
+
.replace(
|
|
30
|
+
/import\s*{\s*MyGlobal\s*}\s*from\s*["']\.\.\/MyGlobal["']\s*;?\s*/gm,
|
|
61
31
|
"",
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
32
|
+
)
|
|
33
|
+
.replace(
|
|
34
|
+
/import\s+typia\s*,\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm,
|
|
35
|
+
"",
|
|
36
|
+
)
|
|
37
|
+
.replace(/import\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm, "")
|
|
38
|
+
.replace(
|
|
39
|
+
/import\s*{\s*tags\s*,\s*typia\s*}\s*from\s*["']typia["']\s*;?\s*/gm,
|
|
40
|
+
"",
|
|
41
|
+
)
|
|
42
|
+
.replace(/import\s+typia\s*from\s*["']typia["']\s*;?\s*/gm, "")
|
|
43
|
+
.replace(
|
|
44
|
+
/import\s*{\s*Prisma\s*}\s*from\s*["']@prisma\/client["']\s*;?\s*/gm,
|
|
45
|
+
"",
|
|
46
|
+
)
|
|
47
|
+
.replace(/import\s*{\s*v4\s*}\s*from\s*["']uuid["']\s*;?\s*/gm, "")
|
|
48
|
+
.replace(
|
|
49
|
+
/import\s*{\s*toISOStringSafe\s*}\s*from\s*["']\.\.\/util\/toISOStringSafe["']\s*;?\s*/gm,
|
|
50
|
+
"",
|
|
51
|
+
)
|
|
52
|
+
// Remove JWT import if it exists (to prevent duplication)
|
|
53
|
+
.replace(/import\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm, "")
|
|
54
|
+
.replace(
|
|
55
|
+
/import\s*\*\s*as\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm,
|
|
66
56
|
"",
|
|
67
57
|
);
|
|
68
58
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
59
|
+
// Remove any existing API structure imports
|
|
60
|
+
// Pattern 1: ../api/structures path
|
|
61
|
+
code = code.replace(
|
|
62
|
+
/import\s*(?:type\s*)?{\s*[^}]+\s*}\s*from\s*["']\.\.\/api\/structures\/[^"']+["']\s*;?\s*/gm,
|
|
63
|
+
"",
|
|
64
|
+
);
|
|
65
|
+
// Pattern 2: @ORGANIZATION/PROJECT-api/lib/structures path
|
|
66
|
+
code = code.replace(
|
|
67
|
+
/import\s*(?:type\s*)?{\s*[^}]+\s*}\s*from\s*["']@ORGANIZATION\/PROJECT-api\/lib\/structures\/[^"']+["']\s*;?\s*/gm,
|
|
68
|
+
"",
|
|
69
|
+
);
|
|
78
70
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
71
|
+
// Remove specific type imports that match our typeReferences
|
|
72
|
+
for (const ref of typeReferences) {
|
|
73
|
+
// Remove any import of this specific type from any path
|
|
74
|
+
const typeImportRegex = new RegExp(
|
|
75
|
+
`import\\s*(?:type\\s*)?{\\s*${ref}\\s*}\\s*from\\s*["'][^"']+["']\\s*;?\\s*`,
|
|
76
|
+
"gm",
|
|
77
|
+
);
|
|
78
|
+
code = code.replace(typeImportRegex, "");
|
|
79
|
+
}
|
|
87
80
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
...typeReferences.map(
|
|
97
|
-
(ref) =>
|
|
98
|
-
`import { ${ref} } from "@ORGANIZATION/PROJECT-api/lib/structures/${ref}";`,
|
|
99
|
-
),
|
|
100
|
-
];
|
|
81
|
+
// Remove any existing decoratorType imports if LLM mistakenly added them
|
|
82
|
+
if (decoratorType) {
|
|
83
|
+
const decoratorTypeRegex = new RegExp(
|
|
84
|
+
`import\\s*(?:type\\s*)?{\\s*${decoratorType}\\s*}\\s*from\\s*["']\\.\\.\/decorators\/payload\/${decoratorType}["']\\s*;?\\s*`,
|
|
85
|
+
"gm",
|
|
86
|
+
);
|
|
87
|
+
code = code.replace(decoratorTypeRegex, "");
|
|
88
|
+
}
|
|
101
89
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
90
|
+
// Build the standard imports
|
|
91
|
+
const imports = getRealizeWriteImportStatements(operation);
|
|
92
|
+
|
|
93
|
+
// Only add decoratorType import if it exists
|
|
94
|
+
if (decoratorType) {
|
|
95
|
+
imports.push(
|
|
96
|
+
`import { ${decoratorType} } from "../decorators/payload/${decoratorType}"`,
|
|
97
|
+
);
|
|
98
|
+
}
|
|
108
99
|
|
|
109
|
-
|
|
100
|
+
code = [...imports, "", code].join("\n");
|
|
110
101
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
102
|
+
// Clean up formatting issues
|
|
103
|
+
code =
|
|
104
|
+
code
|
|
105
|
+
// Remove lines with only whitespace
|
|
106
|
+
.replace(/^\s+$/gm, "")
|
|
107
|
+
// Replace 3+ consecutive newlines with exactly 2 newlines
|
|
108
|
+
.replace(/\n{3,}/g, "\n\n")
|
|
109
|
+
// Ensure proper spacing after import section
|
|
110
|
+
.replace(/(import.*?;)(\s*)(\n(?!import|\s*$))/g, "$1\n\n$3")
|
|
111
|
+
// Trim and ensure single trailing newline
|
|
112
|
+
.trim() + "\n";
|
|
122
113
|
|
|
123
|
-
|
|
124
|
-
|
|
114
|
+
// fix escaped codes
|
|
115
|
+
code = code.replace(/\\n/g, "\n").replace(/\\"/g, '"').replace(/\\'/g, "'");
|
|
125
116
|
|
|
126
|
-
|
|
127
|
-
|
|
117
|
+
// Apply final beautification
|
|
118
|
+
code = await compiler.typescript.beautify(code);
|
|
128
119
|
|
|
129
|
-
|
|
120
|
+
code = code.replaceAll("typia.tags.assert", "typia.assert");
|
|
130
121
|
|
|
131
|
-
|
|
132
|
-
};
|
|
122
|
+
return code;
|
|
133
123
|
}
|
|
@@ -1,39 +1,26 @@
|
|
|
1
1
|
import { StringUtil } from "@autobe/utils";
|
|
2
|
+
import { ILlmSchema } from "@samchon/openapi";
|
|
2
3
|
|
|
4
|
+
import { AutoBeContext } from "../../../context/AutoBeContext";
|
|
3
5
|
import { IAutoBeTestScenarioArtifacts } from "../structures/IAutoBeTestScenarioArtifacts";
|
|
6
|
+
import { getTestImportStatements } from "./getTestImportStatements";
|
|
4
7
|
|
|
5
|
-
export
|
|
8
|
+
export const completeTestCode = async <Model extends ILlmSchema.Model>(
|
|
9
|
+
ctx: AutoBeContext<Model>,
|
|
6
10
|
artifacts: IAutoBeTestScenarioArtifacts,
|
|
7
11
|
code: string,
|
|
8
|
-
): string {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
code = code.replaceAll(
|
|
20
|
-
'string & Format<"uuid">',
|
|
21
|
-
'string & tags.Format<"uuid">',
|
|
22
|
-
);
|
|
23
|
-
code = StringUtil.trim`
|
|
24
|
-
import { ArrayUtil, RandomGenerator, TestValidator } from "@nestia/e2e";
|
|
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")}
|
|
12
|
+
): Promise<string> => {
|
|
13
|
+
const compiler = await ctx.compiler();
|
|
14
|
+
code = await compiler.typescript.beautify(code);
|
|
15
|
+
code = code
|
|
16
|
+
.split("\r\n")
|
|
17
|
+
.join("\n")
|
|
18
|
+
.split("\n")
|
|
19
|
+
.filter((str) => str.trim().startsWith("import") === false)
|
|
20
|
+
.join("\n");
|
|
21
|
+
return await compiler.typescript.beautify(StringUtil.trim`
|
|
22
|
+
${getTestImportStatements(artifacts.document)}
|
|
35
23
|
|
|
36
24
|
${code}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
25
|
+
`);
|
|
26
|
+
};
|
|
@@ -18,10 +18,22 @@ const singleton = new Singleton(async (compiler: IAutoBeTestCompiler) => {
|
|
|
18
18
|
if (content === undefined) throw new Error(`File not found: ${location}`);
|
|
19
19
|
return { [location]: content };
|
|
20
20
|
};
|
|
21
|
+
const filter = (
|
|
22
|
+
closure: (key: string) => boolean,
|
|
23
|
+
): Record<string, string> => {
|
|
24
|
+
const entries = Object.entries(records).filter(([key]) => closure(key));
|
|
25
|
+
return Object.fromEntries(entries);
|
|
26
|
+
};
|
|
21
27
|
return {
|
|
22
28
|
...external("node_modules/@nestia/e2e/lib/ArrayUtil.d.ts"),
|
|
23
29
|
...external("node_modules/@nestia/e2e/lib/RandomGenerator.d.ts"),
|
|
24
30
|
...external("node_modules/@nestia/e2e/lib/TestValidator.d.ts"),
|
|
25
31
|
...external("node_modules/@nestia/fetcher/lib/IConnection.d.ts"),
|
|
32
|
+
...external("node_modules/@samchon/openapi/lib/http/HttpError.d.ts"),
|
|
33
|
+
...external("node_modules/typia/lib/module.d.ts"),
|
|
34
|
+
...filter(
|
|
35
|
+
(key) =>
|
|
36
|
+
key.startsWith("node_modules/typia/lib/tags") && key.endsWith(".d.ts"),
|
|
37
|
+
),
|
|
26
38
|
} satisfies Record<string, string>;
|
|
27
39
|
});
|
|
@@ -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,12 +1,12 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
-
import { IAutoBeTypeScriptCompileResult } from "@autobe/interface";
|
|
3
2
|
import { StringUtil } from "@autobe/utils";
|
|
4
3
|
import { ILlmSchema } from "@samchon/openapi";
|
|
5
|
-
import { v7 } from "uuid";
|
|
4
|
+
import { v4, v7 } from "uuid";
|
|
6
5
|
|
|
7
6
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
8
7
|
import { AutoBeContext } from "../../../context/AutoBeContext";
|
|
9
8
|
import { IAutoBeTestFunction } from "../structures/IAutoBeTestFunction";
|
|
9
|
+
import { IAutoBeTestFunctionFailure } from "../structures/IAutoBeTestFunctionFailure";
|
|
10
10
|
import { transformTestWriteHistories } from "./transformTestWriteHistories";
|
|
11
11
|
|
|
12
12
|
export const transformTestCorrectHistories = async <
|
|
@@ -14,17 +14,15 @@ export const transformTestCorrectHistories = async <
|
|
|
14
14
|
>(
|
|
15
15
|
ctx: AutoBeContext<Model>,
|
|
16
16
|
func: IAutoBeTestFunction,
|
|
17
|
-
|
|
17
|
+
failures: IAutoBeTestFunctionFailure[],
|
|
18
18
|
): Promise<
|
|
19
19
|
Array<
|
|
20
20
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
21
21
|
>
|
|
22
22
|
> => {
|
|
23
|
-
const previous
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
func.artifacts,
|
|
27
|
-
);
|
|
23
|
+
const previous: Array<
|
|
24
|
+
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
25
|
+
> = await transformTestWriteHistories(ctx, func.scenario, func.artifacts);
|
|
28
26
|
return [
|
|
29
27
|
...previous.slice(0, -1),
|
|
30
28
|
{
|
|
@@ -33,27 +31,29 @@ export const transformTestCorrectHistories = async <
|
|
|
33
31
|
type: "systemMessage",
|
|
34
32
|
text: AutoBeSystemPromptConstant.TEST_CORRECT,
|
|
35
33
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
\`\`\`typescript
|
|
45
|
+
${f.function.script}
|
|
46
|
+
\`\`\`
|
|
44
47
|
|
|
45
|
-
|
|
46
|
-
${func.script}
|
|
47
|
-
\`\`\`
|
|
48
|
+
## Compile Errors
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
Fix the compilation error in the provided code.
|
|
50
|
+
Fix the compilation error in the provided code.
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
\`\`\`json
|
|
53
|
+
${JSON.stringify(f.failure.diagnostics)}
|
|
54
|
+
\`\`\`
|
|
55
|
+
`,
|
|
56
|
+
}) satisfies IAgenticaHistoryJson.IAssistantMessage,
|
|
57
|
+
),
|
|
58
58
|
];
|
|
59
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
|
};
|
|
@@ -83,9 +83,28 @@ export async function transformTestWriteHistories<
|
|
|
83
83
|
|
|
84
84
|
## External Definitions
|
|
85
85
|
|
|
86
|
+
Here is the external declaration files (d.ts) you can reference.
|
|
87
|
+
|
|
86
88
|
\`\`\`json
|
|
87
89
|
${JSON.stringify(await getTestExternalDeclarations(ctx))}
|
|
88
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
|
+
\`\`\`
|
|
89
108
|
`,
|
|
90
109
|
},
|
|
91
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();
|