@autobe/agent 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/agent/src/AutoBeAgent.js +2 -2
- package/lib/agent/src/AutoBeAgent.js.map +1 -1
- package/lib/agent/src/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 +3466 -103
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js +3672 -358
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/structures/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/fulfillJsonSchemaErrorMessages.d.ts +2 -0
- package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js +81 -0
- package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +2 -2
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +2 -2
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +2 -2
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +22 -7
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +13 -29
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js +2 -8
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +6 -49
- package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +4 -2
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +5 -3
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +206 -118
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.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.js +15 -14
- package/lib/agent/src/orchestrate/test/compile/completeTestCode.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
- package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js +19 -0
- package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js.map +1 -0
- package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js +2 -0
- package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
- package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js +21 -0
- package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js.map +1 -0
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.d.ts +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 +126 -72
- 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 +121 -42
- 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 +13805 -3871
- 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/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/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 +5 -5
- 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 +33 -91
- package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +72 -95
- 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/fulfillJsonSchemaErrorMessages.ts +90 -0
- package/src/orchestrate/interface/utils/validateAuthorizationSchema.ts +2 -2
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +1 -2
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +30 -15
- package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +27 -49
- package/src/orchestrate/realize/internal/compileRealizeFiles.ts +4 -11
- package/src/orchestrate/realize/orchestrateRealize.ts +19 -75
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +1 -1
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +114 -25
- package/src/orchestrate/realize/orchestrateRealizeScenario.ts +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 +15 -26
- package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +1 -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 +46 -15
- package/src/orchestrate/test/orchestrateTestScenario.ts +52 -48
- package/src/orchestrate/test/orchestrateTestWrite.ts +23 -5
- 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/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js.map +0 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
|
@@ -34,21 +34,22 @@ export async function orchestrateInterfaceOperations<
|
|
|
34
34
|
capacity,
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
+
const progress: AutoBeProgressEventBase = {
|
|
38
|
+
total: matrix.flat().length,
|
|
39
|
+
completed: 0,
|
|
40
|
+
};
|
|
41
|
+
const reviewProgress: AutoBeProgressEventBase = {
|
|
42
|
+
total: matrix.length,
|
|
43
|
+
completed: 0,
|
|
44
|
+
};
|
|
37
45
|
return (
|
|
38
46
|
await executeCachedBatch(
|
|
39
47
|
matrix.map((it) => async (promptCacheKey) => {
|
|
40
48
|
const row: AutoBeOpenApi.IOperation[] = await divideAndConquer(
|
|
41
49
|
ctx,
|
|
42
50
|
it,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
total: matrix.length,
|
|
46
|
-
completed: 0,
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
total: matrix.length,
|
|
50
|
-
completed: 0,
|
|
51
|
-
},
|
|
51
|
+
progress,
|
|
52
|
+
reviewProgress,
|
|
52
53
|
promptCacheKey,
|
|
53
54
|
);
|
|
54
55
|
return row;
|
|
@@ -60,7 +61,6 @@ export async function orchestrateInterfaceOperations<
|
|
|
60
61
|
async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
61
62
|
ctx: AutoBeContext<Model>,
|
|
62
63
|
endpoints: AutoBeOpenApi.IEndpoint[],
|
|
63
|
-
retry: number,
|
|
64
64
|
operationsProgress: AutoBeProgressEventBase,
|
|
65
65
|
operationsReviewProgress: AutoBeProgressEventBase,
|
|
66
66
|
promptCacheKey: string,
|
|
@@ -75,7 +75,7 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
|
75
75
|
OpenApiEndpointComparator.hashCode,
|
|
76
76
|
OpenApiEndpointComparator.equals,
|
|
77
77
|
);
|
|
78
|
-
for (let i: number = 0; i < retry; ++i) {
|
|
78
|
+
for (let i: number = 0; i < ctx.retry; ++i) {
|
|
79
79
|
if (remained.empty() === true || unique.size() >= endpoints.length) break;
|
|
80
80
|
const operations: AutoBeOpenApi.IOperation[] = remained.size()
|
|
81
81
|
? await process(ctx, remained, operationsProgress, promptCacheKey)
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
AutoBePrisma,
|
|
6
6
|
AutoBeProgressEventBase,
|
|
7
7
|
} from "@autobe/interface";
|
|
8
|
-
import { ILlmApplication, ILlmSchema
|
|
8
|
+
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
9
9
|
import { IPointer } from "tstl";
|
|
10
10
|
import typia from "typia";
|
|
11
11
|
import { v7 } from "uuid";
|
|
@@ -42,7 +42,7 @@ export async function orchestrateInterfaceOperationsReview<
|
|
|
42
42
|
});
|
|
43
43
|
if (pointer.value === null) {
|
|
44
44
|
console.error("Failed to review operations.");
|
|
45
|
-
progress.completed
|
|
45
|
+
++progress.completed;
|
|
46
46
|
return [];
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -57,8 +57,8 @@ export async function orchestrateInterfaceOperationsReview<
|
|
|
57
57
|
type: "interfaceOperationsReview",
|
|
58
58
|
id: v7(),
|
|
59
59
|
operations: content,
|
|
60
|
-
review: pointer.value.review,
|
|
61
|
-
plan: pointer.value.plan,
|
|
60
|
+
review: pointer.value.think.review,
|
|
61
|
+
plan: pointer.value.think.plan,
|
|
62
62
|
content,
|
|
63
63
|
tokenUsage,
|
|
64
64
|
created_at: new Date().toISOString(),
|
|
@@ -79,99 +79,9 @@ function createReviewController<Model extends ILlmSchema.Model>(props: {
|
|
|
79
79
|
prismaSchemas: AutoBePrisma.IFile[];
|
|
80
80
|
build: (reviews: IAutoBeInterfaceOperationsReviewApplication.IProps) => void;
|
|
81
81
|
}): IAgenticaController.IClass<Model> {
|
|
82
|
-
const validate = (
|
|
83
|
-
next: unknown,
|
|
84
|
-
): IValidation<IAutoBeInterfaceOperationsReviewApplication.IProps> => {
|
|
85
|
-
const result: IValidation<IAutoBeInterfaceOperationsReviewApplication.IProps> =
|
|
86
|
-
typia.validate<IAutoBeInterfaceOperationsReviewApplication.IProps>(next);
|
|
87
|
-
if (result.success === false) return result;
|
|
88
|
-
const errors: IValidation.IError[] = [];
|
|
89
|
-
|
|
90
|
-
const models: AutoBePrisma.IModel[] = props.prismaSchemas.flatMap(
|
|
91
|
-
(schema) => schema.models,
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
result.data.content.forEach((op, index) => {
|
|
95
|
-
// Check if summary or description mentions soft delete
|
|
96
|
-
const mentionsSoftDelete =
|
|
97
|
-
(op.summary && /soft[\s-]?delet/i.test(op.summary)) ||
|
|
98
|
-
(op.description && /soft[\s-]?delet/i.test(op.description));
|
|
99
|
-
|
|
100
|
-
if (op.method === "delete") {
|
|
101
|
-
const model = models.find((model) => model.name === op.model_name);
|
|
102
|
-
|
|
103
|
-
if (mentionsSoftDelete) {
|
|
104
|
-
// If soft delete is mentioned but no soft_delete_column is specified
|
|
105
|
-
if (!op.soft_delete_column) {
|
|
106
|
-
// Check if any soft-delete capable column exists in the model
|
|
107
|
-
const hasSoftDeleteCapableColumn = model?.plainFields.some(
|
|
108
|
-
(field) =>
|
|
109
|
-
/delete|deleted|deleted_at|deletedAt|is_deleted|isDeleted/i.test(
|
|
110
|
-
field.name,
|
|
111
|
-
),
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
if (hasSoftDeleteCapableColumn) {
|
|
115
|
-
errors.push({
|
|
116
|
-
expected: `Soft delete column to be specified or summary/description to not mention soft delete`,
|
|
117
|
-
value: "null",
|
|
118
|
-
description: `Mismatch: Operation mentions soft delete but soft_delete_column is not specified, while model has soft-delete capable columns`,
|
|
119
|
-
path: `$input.content[${index}].soft_delete_column`,
|
|
120
|
-
});
|
|
121
|
-
} else {
|
|
122
|
-
errors.push({
|
|
123
|
-
expected: `Summary/description to not mention soft delete when model lacks soft-delete capability`,
|
|
124
|
-
value: `${op.summary || ""} ${op.description || ""}`,
|
|
125
|
-
description: `Mismatch: Operation mentions soft delete but model '${op.model_name}' has no soft-delete capable columns`,
|
|
126
|
-
path: `$input.content[${index}].summary || $input.content[${index}].description`,
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
} else {
|
|
130
|
-
// If soft_delete_column is specified, check if it exists in the model
|
|
131
|
-
const column = model?.plainFields.find(
|
|
132
|
-
(el) => el.name === op.soft_delete_column,
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
if (!column) {
|
|
136
|
-
errors.push({
|
|
137
|
-
expected: `Field '${op.soft_delete_column}' to exist in model or operation to not mention soft delete`,
|
|
138
|
-
value: "undefined",
|
|
139
|
-
description: `Mismatch: Either the field '${op.soft_delete_column}' should exist in model '${op.model_name}', or the operation should not mention soft delete`,
|
|
140
|
-
path: `$input.content[${index}].soft_delete_column || $input.content[${index}].summary || $input.content[${index}].description`,
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Also check if soft_delete_column is specified without mentioning soft delete
|
|
147
|
-
if (op.soft_delete_column && !mentionsSoftDelete) {
|
|
148
|
-
errors.push({
|
|
149
|
-
expected: `Consistency between soft_delete_column and operation description`,
|
|
150
|
-
value: `soft_delete_column: ${op.soft_delete_column}`,
|
|
151
|
-
description: `Mismatch: soft_delete_column is specified but soft delete is not mentioned in summary/description`,
|
|
152
|
-
path: `$input.content[${index}]`,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
// not implemented
|
|
159
|
-
if (errors.length !== 0) {
|
|
160
|
-
console.log(JSON.stringify(errors, null, 2));
|
|
161
|
-
return {
|
|
162
|
-
success: false,
|
|
163
|
-
errors,
|
|
164
|
-
data: next,
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
return result;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
82
|
const application: ILlmApplication<Model> = collection[
|
|
171
83
|
props.model === "chatgpt" ? "chatgpt" : "claude"
|
|
172
|
-
]
|
|
173
|
-
validate,
|
|
174
|
-
) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
|
|
84
|
+
] satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
|
|
175
85
|
|
|
176
86
|
return {
|
|
177
87
|
protocol: "class",
|
|
@@ -186,26 +96,12 @@ function createReviewController<Model extends ILlmSchema.Model>(props: {
|
|
|
186
96
|
}
|
|
187
97
|
|
|
188
98
|
const collection = {
|
|
189
|
-
chatgpt:
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}),
|
|
198
|
-
claude: (validate: Validator) =>
|
|
199
|
-
typia.llm.application<
|
|
200
|
-
IAutoBeInterfaceOperationsReviewApplication,
|
|
201
|
-
"claude"
|
|
202
|
-
>({
|
|
203
|
-
validate: {
|
|
204
|
-
reviewOperations: validate,
|
|
205
|
-
},
|
|
206
|
-
}),
|
|
99
|
+
chatgpt: typia.llm.application<
|
|
100
|
+
IAutoBeInterfaceOperationsReviewApplication,
|
|
101
|
+
"chatgpt"
|
|
102
|
+
>(),
|
|
103
|
+
claude: typia.llm.application<
|
|
104
|
+
IAutoBeInterfaceOperationsReviewApplication,
|
|
105
|
+
"claude"
|
|
106
|
+
>(),
|
|
207
107
|
};
|
|
208
|
-
|
|
209
|
-
type Validator = (
|
|
210
|
-
input: unknown,
|
|
211
|
-
) => IValidation<IAutoBeInterfaceOperationsReviewApplication.IProps>;
|
|
@@ -8,7 +8,7 @@ import { StringUtil } from "@autobe/utils";
|
|
|
8
8
|
import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
|
|
9
9
|
import { OpenApiV3_1Emender } from "@samchon/openapi/lib/converters/OpenApiV3_1Emender";
|
|
10
10
|
import { IPointer } from "tstl";
|
|
11
|
-
import typia
|
|
11
|
+
import typia from "typia";
|
|
12
12
|
import { v7 } from "uuid";
|
|
13
13
|
|
|
14
14
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
@@ -16,8 +16,10 @@ import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
|
16
16
|
import { divideArray } from "../../utils/divideArray";
|
|
17
17
|
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
18
18
|
import { transformInterfaceSchemaHistories } from "./histories/transformInterfaceSchemaHistories";
|
|
19
|
-
import { orchestrateInterfaceSchemasReview } from "./orchestrateInterfaceSchemasReview";
|
|
20
19
|
import { IAutoBeInterfaceSchemaApplication } from "./structures/IAutoBeInterfaceSchemaApplication";
|
|
20
|
+
import { JsonSchemaFactory } from "./utils/JsonSchemaFactory";
|
|
21
|
+
import { JsonSchemaNamingConvention } from "./utils/JsonSchemaNamingConvention";
|
|
22
|
+
import { fulfillJsonSchemaErrorMessages } from "./utils/fulfillJsonSchemaErrorMessages";
|
|
21
23
|
import { validateAuthorizationSchema } from "./utils/validateAuthorizationSchema";
|
|
22
24
|
|
|
23
25
|
export async function orchestrateInterfaceSchemas<
|
|
@@ -25,13 +27,21 @@ export async function orchestrateInterfaceSchemas<
|
|
|
25
27
|
>(
|
|
26
28
|
ctx: AutoBeContext<Model>,
|
|
27
29
|
operations: AutoBeOpenApi.IOperation[],
|
|
28
|
-
capacity: number =
|
|
30
|
+
capacity: number = 5,
|
|
29
31
|
): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
|
|
32
|
+
// fix operation type names
|
|
33
|
+
JsonSchemaNamingConvention.operations(operations);
|
|
34
|
+
|
|
35
|
+
// gather type names
|
|
30
36
|
const typeNames: Set<string> = new Set();
|
|
31
37
|
for (const op of operations) {
|
|
32
38
|
if (op.requestBody !== null) typeNames.add(op.requestBody.typeName);
|
|
33
39
|
if (op.responseBody !== null) typeNames.add(op.responseBody.typeName);
|
|
34
40
|
}
|
|
41
|
+
const presets: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
|
|
42
|
+
JsonSchemaFactory.presets(typeNames);
|
|
43
|
+
|
|
44
|
+
// divide and conquer
|
|
35
45
|
const matrix: string[][] = divideArray({
|
|
36
46
|
array: Array.from(typeNames),
|
|
37
47
|
capacity,
|
|
@@ -40,43 +50,22 @@ export async function orchestrateInterfaceSchemas<
|
|
|
40
50
|
total: typeNames.size,
|
|
41
51
|
completed: 0,
|
|
42
52
|
};
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
completed: 0,
|
|
53
|
+
const x: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {
|
|
54
|
+
...presets,
|
|
46
55
|
};
|
|
47
|
-
const roles: string[] =
|
|
48
|
-
ctx.state().analyze?.roles.map((role) => role.name) ?? [];
|
|
49
|
-
|
|
50
|
-
const x: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
|
|
51
|
-
roles.length > 0
|
|
52
|
-
? {
|
|
53
|
-
IAuthorizationToken: authTokenSchema,
|
|
54
|
-
}
|
|
55
|
-
: {};
|
|
56
56
|
for (const y of await executeCachedBatch(
|
|
57
57
|
matrix.map((it) => async (promptCacheKey) => {
|
|
58
58
|
const row: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
|
|
59
|
-
await divideAndConquer(
|
|
60
|
-
|
|
61
|
-
operations,
|
|
62
|
-
it,
|
|
63
|
-
3,
|
|
64
|
-
progress,
|
|
65
|
-
promptCacheKey,
|
|
66
|
-
);
|
|
67
|
-
const newbie: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
|
|
68
|
-
await orchestrateInterfaceSchemasReview(
|
|
69
|
-
ctx,
|
|
70
|
-
operations,
|
|
71
|
-
row,
|
|
72
|
-
reviewProgress,
|
|
73
|
-
);
|
|
74
|
-
return { ...row, ...newbie };
|
|
59
|
+
await divideAndConquer(ctx, operations, it, progress, promptCacheKey);
|
|
60
|
+
return row;
|
|
75
61
|
}),
|
|
76
62
|
)) {
|
|
63
|
+
JsonSchemaNamingConvention.schemas(operations, x, y);
|
|
77
64
|
Object.assign(x, y);
|
|
78
65
|
}
|
|
79
|
-
|
|
66
|
+
Object.assign(x, presets);
|
|
67
|
+
JsonSchemaNamingConvention.schemas(operations, x);
|
|
68
|
+
JsonSchemaFactory.authorize(x);
|
|
80
69
|
return x;
|
|
81
70
|
}
|
|
82
71
|
|
|
@@ -84,13 +73,12 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
|
84
73
|
ctx: AutoBeContext<Model>,
|
|
85
74
|
operations: AutoBeOpenApi.IOperation[],
|
|
86
75
|
typeNames: string[],
|
|
87
|
-
retry: number,
|
|
88
76
|
progress: AutoBeProgressEventBase,
|
|
89
77
|
promptCacheKey: string,
|
|
90
78
|
): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
|
|
91
79
|
const remained: Set<string> = new Set(typeNames);
|
|
92
80
|
const schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {};
|
|
93
|
-
for (let i: number = 0; i < retry; ++i) {
|
|
81
|
+
for (let i: number = 0; i < ctx.retry; ++i) {
|
|
94
82
|
if (remained.size === 0) break;
|
|
95
83
|
const newbie: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
|
|
96
84
|
await process(
|
|
@@ -162,12 +150,11 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
162
150
|
});
|
|
163
151
|
if (pointer.value === null) throw new Error("Failed to create components.");
|
|
164
152
|
|
|
165
|
-
const schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
|
|
166
|
-
(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
).schemas ?? {};
|
|
153
|
+
const schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = ((
|
|
154
|
+
OpenApiV3_1Emender.convertComponents({
|
|
155
|
+
schemas: pointer.value,
|
|
156
|
+
}) as AutoBeOpenApi.IComponents
|
|
157
|
+
).schemas ?? {}) as Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
|
|
171
158
|
ctx.dispatch({
|
|
172
159
|
type: "interfaceSchemas",
|
|
173
160
|
id: v7(),
|
|
@@ -198,9 +185,14 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
198
185
|
const validate = (
|
|
199
186
|
next: unknown,
|
|
200
187
|
): IValidation<IAutoBeInterfaceSchemaApplication.IProps> => {
|
|
188
|
+
JsonSchemaFactory.fix("schemas", next);
|
|
189
|
+
|
|
201
190
|
const result: IValidation<IAutoBeInterfaceSchemaApplication.IProps> =
|
|
202
191
|
typia.validate<IAutoBeInterfaceSchemaApplication.IProps>(next);
|
|
203
|
-
if (result.success === false)
|
|
192
|
+
if (result.success === false) {
|
|
193
|
+
fulfillJsonSchemaErrorMessages(result.errors);
|
|
194
|
+
return result;
|
|
195
|
+
}
|
|
204
196
|
|
|
205
197
|
// Check all IAuthorized types
|
|
206
198
|
const errors: IValidation.IError[] = [];
|
|
@@ -253,53 +245,3 @@ const collection = {
|
|
|
253
245
|
type Validator = (
|
|
254
246
|
input: unknown,
|
|
255
247
|
) => IValidation<IAutoBeInterfaceSchemaApplication.IProps>;
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Authorization token response structure.
|
|
259
|
-
*
|
|
260
|
-
* This interface defines the structure of the authorization token response
|
|
261
|
-
* returned after successful user authentication. It contains both access and
|
|
262
|
-
* refresh tokens along with their expiration information.
|
|
263
|
-
*
|
|
264
|
-
* This token structure is automatically included in API schemas when the system
|
|
265
|
-
* detects authorization roles in the requirements analysis phase. It provides a
|
|
266
|
-
* standard format for JWT-based authentication across the generated backend
|
|
267
|
-
* applications.
|
|
268
|
-
*/
|
|
269
|
-
interface IAuthorizationToken {
|
|
270
|
-
/**
|
|
271
|
-
* JWT access token for authenticated requests.
|
|
272
|
-
*
|
|
273
|
-
* This token should be included in the Authorization header for subsequent
|
|
274
|
-
* authenticated API requests as `Bearer {token}`.
|
|
275
|
-
*/
|
|
276
|
-
access: string;
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Refresh token for obtaining new access tokens.
|
|
280
|
-
*
|
|
281
|
-
* This token can be used to request new access tokens when the current access
|
|
282
|
-
* token expires, extending the user's session.
|
|
283
|
-
*/
|
|
284
|
-
refresh: string;
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Access token expiration timestamp.
|
|
288
|
-
*
|
|
289
|
-
* ISO 8601 date-time string indicating when the access token will expire and
|
|
290
|
-
* can no longer be used for authentication.
|
|
291
|
-
*/
|
|
292
|
-
expired_at: string & tags.Format<"date-time">;
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Refresh token expiration timestamp.
|
|
296
|
-
*
|
|
297
|
-
* ISO 8601 date-time string indicating the latest time until which the
|
|
298
|
-
* refresh token can be used to obtain new access tokens.
|
|
299
|
-
*/
|
|
300
|
-
refreshable_until: string & tags.Format<"date-time">;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
const authTokenSchema: AutoBeOpenApi.IJsonSchemaDescriptive =
|
|
304
|
-
typia.json.schema<IAuthorizationToken>().components.schemas!
|
|
305
|
-
.IAuthorizationToken as AutoBeOpenApi.IJsonSchemaDescriptive;
|
|
@@ -12,8 +12,13 @@ import { v7 } from "uuid";
|
|
|
12
12
|
|
|
13
13
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
14
14
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
15
|
+
import { divideArray } from "../../utils/divideArray";
|
|
16
|
+
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
15
17
|
import { transformInterfaceSchemasReviewHistories } from "./histories/transformInterfaceSchemasReviewHistories";
|
|
16
18
|
import { IAutoBeInterfaceSchemasReviewApplication } from "./structures/IAutobeInterfaceSchemasReviewApplication";
|
|
19
|
+
import { JsonSchemaFactory } from "./utils/JsonSchemaFactory";
|
|
20
|
+
import { JsonSchemaNamingConvention } from "./utils/JsonSchemaNamingConvention";
|
|
21
|
+
import { fulfillJsonSchemaErrorMessages } from "./utils/fulfillJsonSchemaErrorMessages";
|
|
17
22
|
import { validateAuthorizationSchema } from "./utils/validateAuthorizationSchema";
|
|
18
23
|
|
|
19
24
|
export async function orchestrateInterfaceSchemasReview<
|
|
@@ -21,11 +26,53 @@ export async function orchestrateInterfaceSchemasReview<
|
|
|
21
26
|
>(
|
|
22
27
|
ctx: AutoBeContext<Model>,
|
|
23
28
|
operations: AutoBeOpenApi.IOperation[],
|
|
24
|
-
schemas: Record<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>,
|
|
30
|
+
): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
|
|
31
|
+
const a = Object.entries(schemas).map(([key, schema]) => {
|
|
32
|
+
return { [key]: schema };
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const matrix: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>[][] =
|
|
36
|
+
divideArray({
|
|
37
|
+
array: a,
|
|
38
|
+
capacity: 8,
|
|
39
|
+
});
|
|
40
|
+
const progress: IProgress = {
|
|
41
|
+
total: matrix.length,
|
|
42
|
+
completed: 0,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const x: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {};
|
|
46
|
+
for (const y of await executeCachedBatch(
|
|
47
|
+
matrix.map((it) => async (promptCacheKey) => {
|
|
48
|
+
const row: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
|
|
49
|
+
await divideAndConquer(ctx, operations, it, progress, promptCacheKey);
|
|
50
|
+
return row;
|
|
51
|
+
}),
|
|
52
|
+
)) {
|
|
53
|
+
JsonSchemaNamingConvention.schemas(operations, x, y);
|
|
54
|
+
Object.assign(x, y);
|
|
55
|
+
}
|
|
56
|
+
return x;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
60
|
+
ctx: AutoBeContext<Model>,
|
|
61
|
+
operations: AutoBeOpenApi.IOperation[],
|
|
62
|
+
schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>[],
|
|
63
|
+
progress: AutoBeProgressEventBase,
|
|
64
|
+
promptCacheKey: string,
|
|
65
|
+
): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
|
|
66
|
+
const schema = schemas.reduce((acc, cur) => Object.assign(acc, cur), {});
|
|
67
|
+
return step(ctx, operations, schema, progress, promptCacheKey);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export async function step<Model extends ILlmSchema.Model>(
|
|
71
|
+
ctx: AutoBeContext<Model>,
|
|
72
|
+
operations: AutoBeOpenApi.IOperation[],
|
|
73
|
+
schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>,
|
|
28
74
|
progress: AutoBeProgressEventBase,
|
|
75
|
+
promptCacheKey: string,
|
|
29
76
|
): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
|
|
30
77
|
try {
|
|
31
78
|
const pointer: IPointer<IAutoBeInterfaceSchemasReviewApplication.IProps | null> =
|
|
@@ -46,6 +93,7 @@ export async function orchestrateInterfaceSchemasReview<
|
|
|
46
93
|
schemas,
|
|
47
94
|
),
|
|
48
95
|
enforceFunctionCall: true,
|
|
96
|
+
promptCacheKey,
|
|
49
97
|
message: "Review type schemas.",
|
|
50
98
|
});
|
|
51
99
|
if (pointer.value === null) {
|
|
@@ -54,18 +102,18 @@ export async function orchestrateInterfaceSchemasReview<
|
|
|
54
102
|
return {};
|
|
55
103
|
}
|
|
56
104
|
|
|
57
|
-
const content: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
|
|
58
|
-
(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
105
|
+
const content: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = ((
|
|
106
|
+
OpenApiV3_1Emender.convertComponents({
|
|
107
|
+
schemas: pointer.value.content,
|
|
108
|
+
}) as AutoBeOpenApi.IComponents
|
|
109
|
+
).schemas ?? {}) as Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
|
|
110
|
+
|
|
63
111
|
ctx.dispatch({
|
|
64
112
|
type: "interfaceSchemasReview",
|
|
65
113
|
id: v7(),
|
|
66
114
|
schemas: schemas,
|
|
67
|
-
review: pointer.value.review,
|
|
68
|
-
plan: pointer.value.plan,
|
|
115
|
+
review: pointer.value.think.review,
|
|
116
|
+
plan: pointer.value.think.plan,
|
|
69
117
|
content,
|
|
70
118
|
tokenUsage,
|
|
71
119
|
step: ctx.state().analyze?.step ?? 0,
|
|
@@ -85,19 +133,21 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
85
133
|
model: Model;
|
|
86
134
|
pointer: IPointer<IAutoBeInterfaceSchemasReviewApplication.IProps | null>;
|
|
87
135
|
operations: AutoBeOpenApi.IOperation[];
|
|
88
|
-
schemas: Record<
|
|
89
|
-
string,
|
|
90
|
-
AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>
|
|
91
|
-
>;
|
|
136
|
+
schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
|
|
92
137
|
}): IAgenticaController.IClass<Model> {
|
|
93
138
|
assertSchemaModel(props.model);
|
|
94
139
|
|
|
95
140
|
const validate = (
|
|
96
141
|
next: unknown,
|
|
97
142
|
): IValidation<IAutoBeInterfaceSchemasReviewApplication.IProps> => {
|
|
143
|
+
JsonSchemaFactory.fix("content", next);
|
|
144
|
+
|
|
98
145
|
const result: IValidation<IAutoBeInterfaceSchemasReviewApplication.IProps> =
|
|
99
146
|
typia.validate<IAutoBeInterfaceSchemasReviewApplication.IProps>(next);
|
|
100
|
-
if (result.success === false)
|
|
147
|
+
if (result.success === false) {
|
|
148
|
+
fulfillJsonSchemaErrorMessages(result.errors);
|
|
149
|
+
return result;
|
|
150
|
+
}
|
|
101
151
|
|
|
102
152
|
const errors: IValidation.IError[] = [];
|
|
103
153
|
validateAuthorizationSchema({
|
|
@@ -105,90 +155,12 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
105
155
|
schemas: result.data.content,
|
|
106
156
|
path: "$input.content",
|
|
107
157
|
});
|
|
108
|
-
|
|
109
|
-
Object.entries(result.data.content).forEach(
|
|
110
|
-
([tagName, jsonDescriptive]) => {
|
|
111
|
-
const index: AutoBeOpenApi.IOperation | undefined =
|
|
112
|
-
props.operations.find(
|
|
113
|
-
(op) =>
|
|
114
|
-
op.responseBody?.typeName === tagName &&
|
|
115
|
-
op.method === "patch" &&
|
|
116
|
-
op.name === "index",
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
// The index API should return the `IPage<T>` type.
|
|
120
|
-
if (index) {
|
|
121
|
-
// First check if the schema has the correct object structure
|
|
122
|
-
if (
|
|
123
|
-
!("type" in jsonDescriptive) ||
|
|
124
|
-
jsonDescriptive.type !== "object"
|
|
125
|
-
) {
|
|
126
|
-
errors.push({
|
|
127
|
-
path: `$input.content.${tagName}`,
|
|
128
|
-
expected: `{ type: "object", properties: { ... } }`,
|
|
129
|
-
value: jsonDescriptive,
|
|
130
|
-
description: `IPage schema must have type: "object". Found: ${JSON.stringify(jsonDescriptive)}`,
|
|
131
|
-
});
|
|
132
|
-
} else if (!("properties" in jsonDescriptive)) {
|
|
133
|
-
errors.push({
|
|
134
|
-
path: `$input.content.${tagName}`,
|
|
135
|
-
expected: `Schema with "properties" field`,
|
|
136
|
-
value: jsonDescriptive,
|
|
137
|
-
description: `IPage schema must have a "properties" field containing "pagination" and "data" properties.`,
|
|
138
|
-
});
|
|
139
|
-
} else if (
|
|
140
|
-
typia.is<AutoBeOpenApi.IJsonSchema.IObject>(jsonDescriptive)
|
|
141
|
-
) {
|
|
142
|
-
jsonDescriptive.properties ??= {};
|
|
143
|
-
|
|
144
|
-
// Check pagination property
|
|
145
|
-
const pagination = jsonDescriptive.properties["pagination"];
|
|
146
|
-
if (!pagination || !("$ref" in pagination)) {
|
|
147
|
-
errors.push({
|
|
148
|
-
path: `$input.content.${tagName}.properties.pagination`,
|
|
149
|
-
expected: `{ $ref: "#/components/schemas/IPage.IPagination" }`,
|
|
150
|
-
value: pagination,
|
|
151
|
-
description: `IPage must have a "pagination" property with $ref to IPage.IPagination.`,
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Check data property
|
|
156
|
-
const data = jsonDescriptive.properties["data"];
|
|
157
|
-
if (!typia.is<AutoBeOpenApi.IJsonSchema.IArray>(data)) {
|
|
158
|
-
errors.push({
|
|
159
|
-
path: `$input.content.${tagName}.properties.data`,
|
|
160
|
-
expected: `AutoBeOpenApi.IJsonSchema.IArray`,
|
|
161
|
-
value: data,
|
|
162
|
-
description: `The 'data' property must be an array for the index operation.`,
|
|
163
|
-
});
|
|
164
|
-
} else {
|
|
165
|
-
// Check if array items have proper type reference (not 'any')
|
|
166
|
-
const arraySchema: AutoBeOpenApi.IJsonSchema.IArray = data;
|
|
167
|
-
if (
|
|
168
|
-
!arraySchema.items ||
|
|
169
|
-
!("$ref" in arraySchema.items) ||
|
|
170
|
-
arraySchema.items.$ref === "#/components/schemas/any"
|
|
171
|
-
) {
|
|
172
|
-
errors.push({
|
|
173
|
-
path: `$input.content.${tagName}.properties.data.items`,
|
|
174
|
-
expected: `Reference to a specific type (e.g., $ref to ISummary type)`,
|
|
175
|
-
value: arraySchema.items,
|
|
176
|
-
description: `The 'data' array must have a specific item type, not 'any[]'. Use a proper type reference like '{Entity}.ISummary' for paginated results.`,
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
);
|
|
184
|
-
|
|
185
158
|
if (errors.length !== 0)
|
|
186
159
|
return {
|
|
187
160
|
success: false,
|
|
188
161
|
errors,
|
|
189
162
|
data: next,
|
|
190
163
|
};
|
|
191
|
-
|
|
192
164
|
return result;
|
|
193
165
|
};
|
|
194
166
|
|
|
@@ -227,3 +199,8 @@ const collection = {
|
|
|
227
199
|
type Validator = (
|
|
228
200
|
input: unknown,
|
|
229
201
|
) => IValidation<IAutoBeInterfaceSchemasReviewApplication.IProps>;
|
|
202
|
+
|
|
203
|
+
export interface IProgress {
|
|
204
|
+
total: number;
|
|
205
|
+
completed: number;
|
|
206
|
+
}
|
|
@@ -91,45 +91,6 @@ export namespace IAutoBeInterfaceOperationApplication {
|
|
|
91
91
|
AutoBeOpenApi.IOperation,
|
|
92
92
|
"authorizationRole" | "authorizationType"
|
|
93
93
|
> {
|
|
94
|
-
/**
|
|
95
|
-
* Prisma schema models relevant to this operation.
|
|
96
|
-
*
|
|
97
|
-
* Contains the complete Prisma schema definitions for all entities involved
|
|
98
|
-
* in this operation, including their fields, relations, and database
|
|
99
|
-
* constraints. This enables comprehensive validation and schema-aware
|
|
100
|
-
* operation design.
|
|
101
|
-
*
|
|
102
|
-
* The schema information serves multiple critical purposes:
|
|
103
|
-
*
|
|
104
|
-
* - **Field Verification**: Ensures all referenced fields actually exist in
|
|
105
|
-
* the database schema and have the correct types
|
|
106
|
-
* - **Relationship Validation**: Confirms that entity relationships are
|
|
107
|
-
* properly defined and can support the operation's data access patterns
|
|
108
|
-
* - **Soft-Delete Detection**: For DELETE operations, identifies whether
|
|
109
|
-
* entities have soft-delete fields (deleted_at, is_deleted, etc.) to
|
|
110
|
-
* determine if the operation should perform logical deletion instead of
|
|
111
|
-
* physical removal
|
|
112
|
-
* - **Constraint Awareness**: Understands unique constraints, required
|
|
113
|
-
* fields, and default values to generate accurate request/response
|
|
114
|
-
* schemas
|
|
115
|
-
*
|
|
116
|
-
* Example content might include:
|
|
117
|
-
*
|
|
118
|
-
* ```prisma
|
|
119
|
-
* model User {
|
|
120
|
-
* id String @id @default(uuid())
|
|
121
|
-
* email String @unique
|
|
122
|
-
* name String
|
|
123
|
-
* deleted_at DateTime? // Indicates soft-delete capability
|
|
124
|
-
* posts Post[]
|
|
125
|
-
* }
|
|
126
|
-
* ```
|
|
127
|
-
*
|
|
128
|
-
* This schema context ensures operations are fully aligned with the actual
|
|
129
|
-
* database structure and business logic requirements.
|
|
130
|
-
*/
|
|
131
|
-
prisma_schemas: string;
|
|
132
|
-
|
|
133
94
|
/**
|
|
134
95
|
* Authorization roles required to access this API operation.
|
|
135
96
|
*
|