@autobe/agent 0.24.2 → 0.25.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/AutoBeAgent.js +11 -1
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/AutoBeMockAgent.js +1 -0
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +21 -21
- package/lib/context/IAutoBeApplication.d.ts +101 -6
- package/lib/context/IAutoBeApplicationProps.d.ts +6 -2
- package/lib/factory/createAgenticaHistory.js +1 -1
- package/lib/factory/createAgenticaHistory.js.map +1 -1
- package/lib/factory/createAutoBeApplication.js +80 -90
- package/lib/factory/createAutoBeApplication.js.map +1 -1
- package/lib/factory/createAutoBeContext.js +6 -5
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/index.mjs +3914 -2594
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +5 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.d.ts +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +18 -3
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +5 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +19 -7
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +3 -2
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.d.ts +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +2 -2
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +1 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +2 -2
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +1 -1
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +1 -1
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +36 -23
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
- package/lib/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.d.ts +22 -42
- package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js +2 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +5 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +20 -7
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.d.ts +3 -0
- package/lib/orchestrate/interface/histories/{transformInterfacePrerequisiteHistories.js → transformInterfaceCommonPrerequisiteHistories.js} +4 -4
- package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.d.ts +6 -1
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +31 -23
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.d.ts +6 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +22 -6
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.d.ts +4 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +27 -6
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.d.ts +5 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +21 -5
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.d.ts +3 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js +102 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +5 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +20 -4
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +45 -11
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +277 -37
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +4 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +69 -70
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.d.ts +6 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +28 -13
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +4 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +11 -8
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.d.ts +5 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +36 -21
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +260 -29
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.d.ts +5 -0
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +713 -0
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.d.ts +5 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +83 -53
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js +41 -7
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +0 -38
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +6 -10
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.d.ts +52 -0
- package/lib/orchestrate/{common/structures/IAutoBeCommonCorrectDateApplication.js → interface/structures/IAutoBeInterfacePrerequisitesApplication.js} +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +0 -33
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.d.ts +6 -2
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +105 -5
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +20 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
- package/lib/orchestrate/interface/utils/OperationValidator.d.ts +3 -4
- package/lib/orchestrate/interface/utils/OperationValidator.js +1 -1
- package/lib/orchestrate/interface/utils/OperationValidator.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.d.ts +4 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +19 -8
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.d.ts +6 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +20 -6
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.js +3 -3
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +6 -3
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +12 -6
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
- package/lib/orchestrate/{common/histories/transformCommonCorrectDateHistories.d.ts → realize/histories/transformRealizeCorrectCastingHistories.d.ts} +1 -2
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +32 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +14 -22
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +6 -6
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +8 -2
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/orchestrate/realize/internal/compileRealizeFiles.js +1 -2
- package/lib/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.d.ts +2 -1
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js +119 -42
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.js +82 -52
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +128 -88
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js +117 -54
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +52 -26
- package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +44 -34
- package/lib/orchestrate/realize/utils/InternalFileSystem.js +1 -1
- package/lib/orchestrate/realize/utils/InternalFileSystem.js.map +1 -1
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -5
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +8 -3
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +44 -17
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +4 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js +24 -9
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -1
- package/lib/orchestrate/realize/utils/printErrorHints.d.ts +8 -0
- package/lib/orchestrate/realize/utils/printErrorHints.js +48 -0
- package/lib/orchestrate/realize/utils/printErrorHints.js.map +1 -0
- package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +1 -0
- package/lib/orchestrate/realize/utils/replaceImportStatements.js +93 -53
- package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +5 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +11 -7
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.d.ts +7 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +35 -96
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.d.ts +6 -3
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +33 -77
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +5 -1
- package/lib/orchestrate/test/histories/transformTestWriteHistories.js +111 -94
- package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTest.js +20 -14
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +4 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +81 -50
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +31 -13
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.d.ts +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +18 -7
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.d.ts +5 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js +20 -12
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.d.ts +4 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +46 -25
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +9 -5
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectInvalidRequestApplication.d.ts +8 -2
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +11 -7
- package/lib/orchestrate/test/utils/getPrerequisites.d.ts +5 -0
- package/lib/orchestrate/test/utils/getPrerequisites.js +36 -0
- package/lib/orchestrate/test/utils/getPrerequisites.js.map +1 -0
- package/lib/orchestrate/test/utils/getReferenceIds.js +1 -1
- package/lib/orchestrate/test/utils/getReferenceIds.js.map +1 -1
- package/package.json +5 -5
- package/src/AutoBeAgent.ts +17 -1
- package/src/AutoBeMockAgent.ts +1 -0
- package/src/constants/AutoBeSystemPromptConstant.ts +21 -21
- package/src/context/IAutoBeApplication.ts +101 -6
- package/src/context/IAutoBeApplicationProps.ts +6 -2
- package/src/factory/createAgenticaHistory.ts +11 -5
- package/src/factory/createAutoBeContext.ts +6 -5
- package/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.ts +5 -1
- package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +16 -0
- package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +22 -7
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +3 -2
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +2 -1
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +3 -2
- package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +2 -2
- package/src/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.ts +25 -45
- package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +2 -1
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +23 -9
- package/src/orchestrate/interface/histories/{transformInterfacePrerequisiteHistories.ts → transformInterfaceCommonPrerequisiteHistories.ts} +1 -1
- package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +33 -24
- package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +26 -9
- package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +30 -6
- package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +24 -7
- package/src/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.ts +118 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +23 -6
- package/src/orchestrate/interface/orchestrateInterface.ts +65 -20
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +22 -12
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +34 -47
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +40 -28
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +9 -3
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +51 -35
- package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +274 -0
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +52 -33
- package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +1 -1
- package/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.ts +0 -39
- package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +6 -10
- package/src/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.ts +58 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +0 -34
- package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +92 -4
- package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +19 -1
- package/src/orchestrate/interface/utils/OperationValidator.ts +9 -7
- package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +20 -6
- package/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts +24 -9
- package/src/orchestrate/prisma/orchestratePrisma.ts +7 -3
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +5 -1
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +15 -10
- package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +44 -0
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +13 -24
- package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +6 -6
- package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +6 -4
- package/src/orchestrate/realize/internal/compileRealizeFiles.ts +1 -5
- package/src/orchestrate/realize/orchestRateRealizeCorrectCasting.ts +102 -16
- package/src/orchestrate/realize/orchestrateRealize.ts +121 -81
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +50 -7
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +14 -4
- package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +54 -29
- package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +46 -35
- package/src/orchestrate/realize/utils/InternalFileSystem.ts +1 -1
- package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -5
- package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +54 -22
- package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +28 -16
- package/src/orchestrate/realize/utils/printErrorHints.ts +55 -0
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +99 -97
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +14 -7
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +50 -115
- package/src/orchestrate/test/histories/transformTestScenarioReviewHistories.ts +41 -111
- package/src/orchestrate/test/histories/transformTestWriteHistories.ts +35 -12
- package/src/orchestrate/test/orchestrateTest.ts +19 -13
- package/src/orchestrate/test/orchestrateTestCorrect.ts +71 -51
- package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +13 -1
- package/src/orchestrate/test/orchestrateTestScenario.ts +27 -17
- package/src/orchestrate/test/orchestrateTestScenarioReview.ts +32 -19
- package/src/orchestrate/test/orchestrateTestWrite.ts +20 -10
- package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +9 -228
- package/src/orchestrate/test/structures/IAutoBeTestCorrectInvalidRequestApplication.ts +8 -2
- package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +11 -78
- package/src/orchestrate/test/utils/getPrerequisites.ts +51 -0
- package/src/orchestrate/test/utils/getReferenceIds.ts +2 -1
- package/lib/orchestrate/common/histories/transformCommonCorrectDateHistories.js +0 -48
- package/lib/orchestrate/common/histories/transformCommonCorrectDateHistories.js.map +0 -1
- package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.d.ts +0 -35
- package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.d.ts +0 -3
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.js.map +0 -1
- package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.d.ts +0 -6
- package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.js +0 -22
- package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.js.map +0 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.d.ts +0 -4
- package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.js +0 -540
- package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.js.map +0 -1
- package/src/orchestrate/common/histories/transformCommonCorrectDateHistories.ts +0 -60
- package/src/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.ts +0 -40
- package/src/orchestrate/interface/utils/OpenApiEndpointComparator.ts +0 -23
- package/src/orchestrate/realize/orchestrateRealizeCorrectDate.ts +0 -372
|
@@ -4,119 +4,121 @@ import { ILlmSchema } from "@samchon/openapi";
|
|
|
4
4
|
import { AutoBeContext } from "../../../context/AutoBeContext";
|
|
5
5
|
import { getRealizeWriteImportStatements } from "./getRealizeWriteImportStatements";
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function removeAllImports(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
): string {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
7
|
+
// /**
|
|
8
|
+
// * Removes all import statements that LLM might have incorrectly added. This
|
|
9
|
+
// * includes standard library imports, auto-injected imports, and any API
|
|
10
|
+
// * structure imports with wrong paths.
|
|
11
|
+
// *
|
|
12
|
+
// * @param code - The code containing imports to remove
|
|
13
|
+
// * @param typeReferences - List of type names to specifically remove
|
|
14
|
+
// * @param decoratorType - Optional decorator type to remove
|
|
15
|
+
// * @returns Code with all imports removed
|
|
16
|
+
// */
|
|
17
|
+
// function removeAllImports(
|
|
18
|
+
// code: string,
|
|
19
|
+
// typeReferences: string[],
|
|
20
|
+
// decoratorType?: string,
|
|
21
|
+
// ): string {
|
|
22
|
+
// // Remove standard library and auto-injected imports
|
|
23
|
+
// let cleanedCode = code
|
|
24
|
+
// // MyGlobal - often with wrong path
|
|
25
|
+
// .replace(
|
|
26
|
+
// /import\s*{\s*MyGlobal\s*}\s*from\s*["']\.\.\/MyGlobal["']\s*;?\s*/gm,
|
|
27
|
+
// "",
|
|
28
|
+
// )
|
|
29
|
+
// // typia - various import patterns
|
|
30
|
+
// .replace(
|
|
31
|
+
// /import\s+typia\s*,\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm,
|
|
32
|
+
// "",
|
|
33
|
+
// )
|
|
34
|
+
// .replace(/import\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm, "")
|
|
35
|
+
// .replace(
|
|
36
|
+
// /import\s*{\s*tags\s*,\s*typia\s*}\s*from\s*["']typia["']\s*;?\s*/gm,
|
|
37
|
+
// "",
|
|
38
|
+
// )
|
|
39
|
+
// .replace(/import\s+typia\s*from\s*["']typia["']\s*;?\s*/gm, "")
|
|
40
|
+
// // Prisma client
|
|
41
|
+
// .replace(
|
|
42
|
+
// /import\s*{\s*Prisma\s*}\s*from\s*["']@prisma\/client["']\s*;?\s*/gm,
|
|
43
|
+
// "",
|
|
44
|
+
// )
|
|
45
|
+
// // uuid
|
|
46
|
+
// .replace(/import\s*{\s*v4\s*}\s*from\s*["']uuid["']\s*;?\s*/gm, "")
|
|
47
|
+
// // toISOStringSafe utility
|
|
48
|
+
// .replace(
|
|
49
|
+
// /import\s*{\s*toISOStringSafe\s*}\s*from\s*["']\.\.\/utils\/toISOStringSafe["']\s*;?\s*/gm,
|
|
50
|
+
// "",
|
|
51
|
+
// )
|
|
52
|
+
// // JWT imports (if LLM adds them)
|
|
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,
|
|
56
|
+
// "",
|
|
57
|
+
// )
|
|
58
|
+
// // NestJS HttpException
|
|
59
|
+
// .replace(
|
|
60
|
+
// /import\s*{\s*HttpException\s*}\s*from\s*["']@nestjs\/common["']\s*;?\s*/gm,
|
|
61
|
+
// "",
|
|
62
|
+
// );
|
|
63
|
+
|
|
64
|
+
// // Remove API structure imports with wrong paths
|
|
65
|
+
// // Pattern 1: ../api/structures path (LLM often uses this wrong path)
|
|
66
|
+
// cleanedCode = cleanedCode.replace(
|
|
67
|
+
// /import\s*(?:type\s*)?{\s*[^}]+\s*}\s*from\s*["']\.\.\/api\/structures\/[^"']+["']\s*;?\s*/gm,
|
|
68
|
+
// "",
|
|
69
|
+
// );
|
|
70
|
+
// // Pattern 2: @ORGANIZATION/PROJECT-api path (correct path but LLM shouldn't write it)
|
|
71
|
+
// cleanedCode = cleanedCode.replace(
|
|
72
|
+
// /import\s*(?:type\s*)?{\s*[^}]+\s*}\s*from\s*["']@ORGANIZATION\/PROJECT-api\/lib\/structures\/[^"']+["']\s*;?\s*/gm,
|
|
73
|
+
// "",
|
|
74
|
+
// );
|
|
75
|
+
|
|
76
|
+
// // Remove specific type imports that match our typeReferences
|
|
77
|
+
// for (const ref of typeReferences) {
|
|
78
|
+
// const typeImportRegex = new RegExp(
|
|
79
|
+
// `import\\s*(?:type\\s*)?{\\s*${ref}\\s*}\\s*from\\s*["'][^"']+["']\\s*;?\\s*`,
|
|
80
|
+
// "gm",
|
|
81
|
+
// );
|
|
82
|
+
// cleanedCode = cleanedCode.replace(typeImportRegex, "");
|
|
83
|
+
// }
|
|
84
|
+
|
|
85
|
+
// // Remove decorator type imports if LLM mistakenly added them
|
|
86
|
+
// if (decoratorType) {
|
|
87
|
+
// const decoratorTypeRegex = new RegExp(
|
|
88
|
+
// `import\\s*(?:type\\s*)?{\\s*${decoratorType}\\s*}\\s*from\\s*["']\\.\\.\/decorators\/payload\/${decoratorType}["']\\s*;?\\s*`,
|
|
89
|
+
// "gm",
|
|
90
|
+
// );
|
|
91
|
+
// cleanedCode = cleanedCode.replace(decoratorTypeRegex, "");
|
|
92
|
+
// }
|
|
93
|
+
|
|
94
|
+
// return cleanedCode;
|
|
95
|
+
// }
|
|
91
96
|
|
|
92
97
|
export async function replaceImportStatements<Model extends ILlmSchema.Model>(
|
|
93
98
|
ctx: AutoBeContext<Model>,
|
|
94
99
|
props: {
|
|
95
100
|
operation: AutoBeOpenApi.IOperation;
|
|
101
|
+
schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
|
|
96
102
|
code: string;
|
|
97
103
|
decoratorType?: string;
|
|
98
104
|
},
|
|
99
|
-
) {
|
|
100
|
-
let {
|
|
101
|
-
|
|
102
|
-
// Extract type references from operation
|
|
103
|
-
const typeReferences: string[] = Array.from(
|
|
104
|
-
new Set(
|
|
105
|
-
[operation.requestBody, operation.responseBody]
|
|
106
|
-
.filter((el) => el !== null)
|
|
107
|
-
.map((el) => el.typeName.split(".")[0]!),
|
|
108
|
-
),
|
|
109
|
-
);
|
|
105
|
+
): Promise<string> {
|
|
106
|
+
let { code, decoratorType } = props;
|
|
110
107
|
|
|
111
108
|
// Beautify code first for consistent formatting
|
|
112
109
|
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
113
110
|
code = await compiler.typescript.beautify(code);
|
|
114
111
|
|
|
115
112
|
// Remove all LLM-generated imports
|
|
116
|
-
code =
|
|
113
|
+
code = code
|
|
114
|
+
.split("\r\n")
|
|
115
|
+
.join("\n")
|
|
116
|
+
.split("\n")
|
|
117
|
+
.filter((str) => str.trim().startsWith("import") === false)
|
|
118
|
+
.join("\n");
|
|
117
119
|
|
|
118
120
|
// Build the standard imports
|
|
119
|
-
const imports = getRealizeWriteImportStatements(
|
|
121
|
+
const imports = getRealizeWriteImportStatements(props);
|
|
120
122
|
|
|
121
123
|
// Only add decoratorType import if it exists
|
|
122
124
|
if (decoratorType) {
|
|
@@ -13,8 +13,11 @@ export const transformTestCorrectHistories = async <
|
|
|
13
13
|
Model extends ILlmSchema.Model,
|
|
14
14
|
>(
|
|
15
15
|
ctx: AutoBeContext<Model>,
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
props: {
|
|
17
|
+
instruction: string;
|
|
18
|
+
function: IAutoBeTestFunction;
|
|
19
|
+
failures: IAutoBeTestFunctionFailure[];
|
|
20
|
+
},
|
|
18
21
|
): Promise<
|
|
19
22
|
Array<
|
|
20
23
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
@@ -22,7 +25,11 @@ export const transformTestCorrectHistories = async <
|
|
|
22
25
|
> => {
|
|
23
26
|
const previous: Array<
|
|
24
27
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
25
|
-
> = await transformTestWriteHistories(ctx,
|
|
28
|
+
> = await transformTestWriteHistories(ctx, {
|
|
29
|
+
instruction: props.instruction,
|
|
30
|
+
scenario: props.function.scenario,
|
|
31
|
+
artifacts: props.function.artifacts,
|
|
32
|
+
});
|
|
26
33
|
return [
|
|
27
34
|
...previous.slice(0, -1),
|
|
28
35
|
{
|
|
@@ -32,21 +39,21 @@ export const transformTestCorrectHistories = async <
|
|
|
32
39
|
text: AutoBeSystemPromptConstant.TEST_CORRECT,
|
|
33
40
|
},
|
|
34
41
|
previous.at(-1)!,
|
|
35
|
-
...failures.map(
|
|
42
|
+
...props.failures.map(
|
|
36
43
|
(f, i, array) =>
|
|
37
44
|
({
|
|
38
45
|
id: v7(),
|
|
39
46
|
created_at: new Date().toISOString(),
|
|
40
47
|
type: "assistantMessage",
|
|
41
48
|
text: StringUtil.trim`
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
## ${i === array.length - 1 ? "Latest Failure" : "Previous Failure"}
|
|
50
|
+
### Generated TypeScript Code
|
|
44
51
|
|
|
45
52
|
\`\`\`typescript
|
|
46
53
|
${f.function.script}
|
|
47
54
|
\`\`\`
|
|
48
55
|
|
|
49
|
-
|
|
56
|
+
### Compile Errors
|
|
50
57
|
|
|
51
58
|
Fix the compilation error in the provided code.
|
|
52
59
|
|
|
@@ -6,36 +6,21 @@ import { v7 } from "uuid";
|
|
|
6
6
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
7
7
|
import { AutoBeState } from "../../../context/AutoBeState";
|
|
8
8
|
import { IAutoBeTestScenarioAuthorizationRole } from "../structures/IAutoBeTestScenarioAuthorizationRole";
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
export const transformTestScenarioHistories = (
|
|
12
|
-
state: AutoBeState
|
|
13
|
-
document: AutoBeOpenApi.IDocument
|
|
14
|
-
include: AutoBeOpenApi.IOperation[]
|
|
15
|
-
exclude: Pick<AutoBeOpenApi.IOperation, "method" | "path">[]
|
|
16
|
-
|
|
9
|
+
import { getPrerequisites } from "../utils/getPrerequisites";
|
|
10
|
+
|
|
11
|
+
export const transformTestScenarioHistories = (props: {
|
|
12
|
+
state: AutoBeState;
|
|
13
|
+
document: AutoBeOpenApi.IDocument;
|
|
14
|
+
include: AutoBeOpenApi.IOperation[];
|
|
15
|
+
exclude: Pick<AutoBeOpenApi.IOperation, "method" | "path">[];
|
|
16
|
+
instruction: string;
|
|
17
|
+
}): Array<
|
|
17
18
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
18
19
|
> => {
|
|
19
|
-
interface IRelationship {
|
|
20
|
-
endpoint: AutoBeOpenApi.IEndpoint;
|
|
21
|
-
ids: string[];
|
|
22
|
-
}
|
|
23
20
|
const authorizations: AutoBeInterfaceAuthorization[] =
|
|
24
|
-
state.interface?.authorizations ?? [];
|
|
21
|
+
props.state.interface?.authorizations ?? [];
|
|
25
22
|
const authorizationRoles: Map<string, IAutoBeTestScenarioAuthorizationRole> =
|
|
26
23
|
new Map();
|
|
27
|
-
const relationships: IRelationship[] = document.operations
|
|
28
|
-
.map((o) => ({
|
|
29
|
-
endpoint: {
|
|
30
|
-
method: o.method,
|
|
31
|
-
path: o.path,
|
|
32
|
-
},
|
|
33
|
-
ids: getReferenceIds({
|
|
34
|
-
document,
|
|
35
|
-
operation: o,
|
|
36
|
-
}),
|
|
37
|
-
}))
|
|
38
|
-
.filter((v) => v.ids.length !== 0);
|
|
39
24
|
|
|
40
25
|
for (const authorization of authorizations) {
|
|
41
26
|
for (const op of authorization.operations) {
|
|
@@ -66,7 +51,22 @@ export const transformTestScenarioHistories = (
|
|
|
66
51
|
created_at: new Date().toISOString(),
|
|
67
52
|
type: "assistantMessage",
|
|
68
53
|
text: StringUtil.trim`
|
|
69
|
-
|
|
54
|
+
## Instructions
|
|
55
|
+
|
|
56
|
+
The following e2e-test-specific instructions were extracted by AI from
|
|
57
|
+
the user's requirements and conversations. These instructions focus
|
|
58
|
+
exclusively on test-related aspects such as test coverage priorities,
|
|
59
|
+
specific edge cases to validate, business logic verification strategies,
|
|
60
|
+
and critical user workflows that must be tested.
|
|
61
|
+
|
|
62
|
+
Apply these instructions when generating test scenarios to ensure the
|
|
63
|
+
tests align with the user's testing requirements and expectations.
|
|
64
|
+
If any instructions are not relevant to the target API operations,
|
|
65
|
+
you may ignore them.
|
|
66
|
+
|
|
67
|
+
${props.instruction}
|
|
68
|
+
|
|
69
|
+
## API Operations
|
|
70
70
|
|
|
71
71
|
Below are the complete API operations.
|
|
72
72
|
Use this information to understand capabilities and dependency relationships.
|
|
@@ -76,109 +76,44 @@ export const transformTestScenarioHistories = (
|
|
|
76
76
|
You may write multiple scenarios for a single included endpoint.
|
|
77
77
|
Focus on business-logic-oriented E2E flows rather than trivial CRUD.
|
|
78
78
|
|
|
79
|
-
Please analyze the operations to identify all dependencies required for testing.
|
|
80
|
-
Pay close attention to IDs and related values in the API,
|
|
81
|
-
and ensure you identify all dependencies between endpoints.
|
|
82
|
-
|
|
83
79
|
\`\`\`json
|
|
84
|
-
${JSON.stringify({
|
|
80
|
+
${JSON.stringify({
|
|
81
|
+
operations: props.document.operations,
|
|
82
|
+
})}
|
|
85
83
|
\`\`\`
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
{
|
|
89
|
-
id: v7(),
|
|
90
|
-
created_at: new Date().toISOString(),
|
|
91
|
-
type: "assistantMessage",
|
|
92
|
-
text: StringUtil.trim`
|
|
93
|
-
# Included in Test Plan
|
|
84
|
+
|
|
85
|
+
## Included in Test Plan
|
|
94
86
|
|
|
95
87
|
Below are the endpoints that have been included in the test plan.
|
|
96
88
|
Each endpoint shows its authentication requirements and related authentication APIs.
|
|
97
89
|
When testing endpoints that require authentication, ensure you include the corresponding
|
|
98
90
|
join/login operations in your test scenario to establish proper authentication context.
|
|
99
91
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
92
|
+
\`\`\`json
|
|
93
|
+
${JSON.stringify(
|
|
94
|
+
props.include.map((el) => ({
|
|
95
|
+
...el,
|
|
96
|
+
prerequisites: getPrerequisites({
|
|
97
|
+
document: props.document,
|
|
98
|
+
endpoint: el,
|
|
99
|
+
}),
|
|
100
|
+
authorizationRoles: Array.from(authorizationRoles.values()).filter(
|
|
105
101
|
(role) => role.name === el.authorizationRole,
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
Related Authentication APIs:
|
|
114
|
-
|
|
115
|
-
${
|
|
116
|
-
roles.length > 0
|
|
117
|
-
? roles
|
|
118
|
-
.map((role) => {
|
|
119
|
-
return StringUtil.trim`
|
|
120
|
-
- ${role.join?.method.toUpperCase()}: ${role.join?.path}
|
|
121
|
-
- ${role.login?.method.toUpperCase()}: ${role.login?.path}
|
|
122
|
-
`;
|
|
123
|
-
})
|
|
124
|
-
.join("\n")
|
|
125
|
-
: "- None"
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
Required IDs:
|
|
129
|
-
|
|
130
|
-
- ${
|
|
131
|
-
requiredIds.length > 0
|
|
132
|
-
? requiredIds.map((id) => `\`${id}\``).join(", ")
|
|
133
|
-
: "None"
|
|
134
|
-
}
|
|
135
|
-
`;
|
|
136
|
-
})
|
|
137
|
-
.join("\n")}
|
|
138
|
-
|
|
139
|
-
# Excluded from Test Plan
|
|
102
|
+
),
|
|
103
|
+
})),
|
|
104
|
+
)}
|
|
105
|
+
\`\`\`
|
|
106
|
+
|
|
107
|
+
## Excluded from Test Plan
|
|
140
108
|
|
|
141
109
|
These are the endpoints that have already been used in test codes generated as part of a plan group.
|
|
142
110
|
These endpoints do not need to be tested again.
|
|
143
111
|
However, it is allowed to reference or depend on these endpoints when writing test codes for other purposes.
|
|
144
112
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
} satisfies IAgenticaHistoryJson.IAssistantMessage,
|
|
150
|
-
{
|
|
151
|
-
id: v7(),
|
|
152
|
-
created_at: new Date().toISOString(),
|
|
153
|
-
type: "assistantMessage",
|
|
154
|
-
text: StringUtil.trim`
|
|
155
|
-
# Candidate Dependencies
|
|
156
|
-
|
|
157
|
-
List of candidate dependencies extracted from path parameters and request bodies.
|
|
158
|
-
|
|
159
|
-
Apply dependency resolution to the target endpoint from "Included in Test Plan" and to dependencies found recursively from it.
|
|
160
|
-
For each required ID, locate the operation that creates the resource. Include the creator only if that operation exists in the provided operations list. Do not assume or invent operations. If no creator exists, treat the ID as an external or pre-existing input.
|
|
161
|
-
|
|
162
|
-
Dependency resolution steps:
|
|
163
|
-
1. Starting from the target endpoint, collect required IDs.
|
|
164
|
-
2. For each ID, search for a creator operation (typically POST).
|
|
165
|
-
3. If found, add it to the dependency chain in execution order and repeat for its own required IDs.
|
|
166
|
-
4. Stop when no further creators exist or are needed.
|
|
167
|
-
|
|
168
|
-
For each some_entity_id pattern, use the same approach: include a creator only when it is present in the operations list.
|
|
169
|
-
|
|
170
|
-
Endpoint | Required IDs (MUST be created by other APIs)
|
|
171
|
-
---------|---------------------------------------------------
|
|
172
|
-
${relationships
|
|
173
|
-
.map((r) =>
|
|
174
|
-
[
|
|
175
|
-
`\`${r.endpoint.method} ${r.endpoint.path}\``,
|
|
176
|
-
r.ids.map((id) => `\`${id}\``).join(", "),
|
|
177
|
-
].join(" | "),
|
|
178
|
-
)
|
|
179
|
-
.join("\n")}
|
|
180
|
-
|
|
181
|
-
Example: If an endpoint requires \`articleId\` and \`POST /articles\` exists, include it in dependencies
|
|
113
|
+
\`\`\`json
|
|
114
|
+
${JSON.stringify(props.exclude)}
|
|
115
|
+
\`\`\`
|
|
116
|
+
|
|
182
117
|
`,
|
|
183
118
|
} satisfies IAgenticaHistoryJson.IAssistantMessage,
|
|
184
119
|
];
|
|
@@ -1,50 +1,35 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
2
|
import { AutoBeOpenApi } from "@autobe/interface";
|
|
3
3
|
import { StringUtil } from "@autobe/utils";
|
|
4
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
5
4
|
import { v7 } from "uuid";
|
|
6
5
|
|
|
7
6
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
8
|
-
import {
|
|
7
|
+
import { AutoBeState } from "../../../context/AutoBeState";
|
|
9
8
|
import { IAutoBeTestScenarioApplication } from "../structures/IAutoBeTestScenarioApplication";
|
|
10
|
-
import {
|
|
9
|
+
import { getPrerequisites } from "../utils/getPrerequisites";
|
|
11
10
|
|
|
12
|
-
export function transformTestScenarioReviewHistories
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
): Array<
|
|
11
|
+
export function transformTestScenarioReviewHistories(props: {
|
|
12
|
+
state: AutoBeState;
|
|
13
|
+
instruction: string;
|
|
14
|
+
groups: IAutoBeTestScenarioApplication.IScenarioGroup[];
|
|
15
|
+
}): Array<
|
|
18
16
|
IAgenticaHistoryJson.ISystemMessage | IAgenticaHistoryJson.IAssistantMessage
|
|
19
17
|
> {
|
|
20
|
-
interface IRelationship {
|
|
21
|
-
endpoint: AutoBeOpenApi.IEndpoint;
|
|
22
|
-
ids: string[];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
18
|
const document: AutoBeOpenApi.IDocument | undefined =
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
props.state.interface?.document;
|
|
28
20
|
if (document === undefined) {
|
|
29
21
|
throw new Error(
|
|
30
22
|
"Cannot review test scenarios because there are no operations.",
|
|
31
23
|
);
|
|
32
24
|
}
|
|
33
25
|
|
|
34
|
-
const relationships: IRelationship[] = document.operations
|
|
35
|
-
.map((o) => ({
|
|
36
|
-
endpoint: {
|
|
37
|
-
method: o.method,
|
|
38
|
-
path: o.path,
|
|
39
|
-
},
|
|
40
|
-
ids: getReferenceIds({
|
|
41
|
-
document,
|
|
42
|
-
operation: o,
|
|
43
|
-
}),
|
|
44
|
-
}))
|
|
45
|
-
.filter((v) => v.ids.length !== 0);
|
|
46
|
-
|
|
47
26
|
return [
|
|
27
|
+
{
|
|
28
|
+
id: v7(),
|
|
29
|
+
created_at: new Date().toISOString(),
|
|
30
|
+
type: "systemMessage",
|
|
31
|
+
text: AutoBeSystemPromptConstant.TEST_SCENARIO,
|
|
32
|
+
},
|
|
48
33
|
{
|
|
49
34
|
id: v7(),
|
|
50
35
|
created_at: new Date().toISOString(),
|
|
@@ -56,7 +41,22 @@ export function transformTestScenarioReviewHistories<
|
|
|
56
41
|
created_at: new Date().toISOString(),
|
|
57
42
|
type: "assistantMessage",
|
|
58
43
|
text: StringUtil.trim`
|
|
59
|
-
|
|
44
|
+
## Instructions
|
|
45
|
+
|
|
46
|
+
The following e2e-test-specific instructions were extracted by AI from
|
|
47
|
+
the user's requirements and conversations. These instructions focus
|
|
48
|
+
exclusively on test-related aspects such as test coverage priorities,
|
|
49
|
+
specific edge cases to validate, business logic verification strategies,
|
|
50
|
+
and critical user workflows that must be tested.
|
|
51
|
+
|
|
52
|
+
Apply these instructions when reviewing test scenarios to ensure the
|
|
53
|
+
tests align with the user's testing requirements and expectations.
|
|
54
|
+
If any instructions are not relevant to the target API operations,
|
|
55
|
+
you may ignore them.
|
|
56
|
+
|
|
57
|
+
${props.instruction}
|
|
58
|
+
|
|
59
|
+
## Available API Operations for Reference
|
|
60
60
|
|
|
61
61
|
Below are all available API operations and interface schemas for validation purposes.
|
|
62
62
|
Match each operation with its corresponding schema.
|
|
@@ -64,93 +64,23 @@ export function transformTestScenarioReviewHistories<
|
|
|
64
64
|
\`\`\`json
|
|
65
65
|
${JSON.stringify({ operations: document.operations })}
|
|
66
66
|
\`\`\`
|
|
67
|
-
`,
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
id: v7(),
|
|
71
|
-
created_at: new Date().toISOString(),
|
|
72
|
-
type: "assistantMessage",
|
|
73
|
-
text: StringUtil.trim`
|
|
74
67
|
|
|
75
|
-
|
|
68
|
+
## Test Scenario Groups to Review
|
|
76
69
|
|
|
77
|
-
|
|
70
|
+
Each scenario group includes the target endpoint and its prerequisite endpoints.
|
|
78
71
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return {
|
|
72
|
+
\`\`\`json
|
|
73
|
+
${JSON.stringify(
|
|
74
|
+
props.groups.map((g) => ({
|
|
83
75
|
...g,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
s.dependencies.forEach((dep) => {
|
|
88
|
-
document.operations.forEach((op) => {
|
|
89
|
-
if (
|
|
90
|
-
g.endpoint.method === op.method &&
|
|
91
|
-
g.endpoint.path === op.path
|
|
92
|
-
) {
|
|
93
|
-
requiredId.push(
|
|
94
|
-
...getReferenceIds({ document, operation: op }),
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (
|
|
99
|
-
op.method === dep.endpoint.method &&
|
|
100
|
-
op.path === dep.endpoint.path
|
|
101
|
-
) {
|
|
102
|
-
requiredId.push(
|
|
103
|
-
...getReferenceIds({ document, operation: op }),
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
return {
|
|
110
|
-
...s,
|
|
111
|
-
requiredIds:
|
|
112
|
-
requiredId.length > 0 ? Array.from(new Set(requiredId)) : [],
|
|
113
|
-
};
|
|
76
|
+
prerequisites: getPrerequisites({
|
|
77
|
+
document,
|
|
78
|
+
endpoint: g.endpoint,
|
|
114
79
|
}),
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
\`\`\`
|
|
80
|
+
})),
|
|
81
|
+
)}
|
|
82
|
+
\`\`\`
|
|
119
83
|
`,
|
|
120
84
|
},
|
|
121
|
-
{
|
|
122
|
-
id: v7(),
|
|
123
|
-
created_at: new Date().toISOString(),
|
|
124
|
-
type: "assistantMessage",
|
|
125
|
-
text: StringUtil.trim`
|
|
126
|
-
# Candidate Dependencies
|
|
127
|
-
|
|
128
|
-
List of candidate dependencies extracted from path parameters and request bodies.
|
|
129
|
-
|
|
130
|
-
Apply dependency resolution to the target endpoint from "Included in Test Plan" and to dependencies found recursively from it.
|
|
131
|
-
For each required ID, locate the operation that creates the resource. Include the creator only if that operation exists in the provided operations list. Do not assume or invent operations. If no creator exists, treat the ID as an external or pre-existing input.
|
|
132
|
-
|
|
133
|
-
Dependency resolution steps:
|
|
134
|
-
1. Starting from the target endpoint, collect required IDs.
|
|
135
|
-
2. For each ID, search for a creator operation (typically POST).
|
|
136
|
-
3. If found, add it to the dependency chain in execution order and repeat for its own required IDs.
|
|
137
|
-
4. Stop when no further creators exist or are needed.
|
|
138
|
-
|
|
139
|
-
For each some_entity_id pattern, use the same approach: include a creator only when it is present in the operations list.
|
|
140
|
-
|
|
141
|
-
Endpoint | Required IDs (MUST be created by other APIs)
|
|
142
|
-
---------|---------------------------------------------------
|
|
143
|
-
${relationships
|
|
144
|
-
.map((r) =>
|
|
145
|
-
[
|
|
146
|
-
`\`${r.endpoint.method} ${r.endpoint.path}\``,
|
|
147
|
-
r.ids.map((id) => `\`${id}\``).join(", "),
|
|
148
|
-
].join(" | "),
|
|
149
|
-
)
|
|
150
|
-
.join("\n")}
|
|
151
|
-
|
|
152
|
-
Example: If an endpoint requires \`articleId\` and \`POST /articles\` exists, include it in dependencies
|
|
153
|
-
`,
|
|
154
|
-
} satisfies IAgenticaHistoryJson.IAssistantMessage,
|
|
155
85
|
];
|
|
156
86
|
}
|