@autobe/agent 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/agent/src/AutoBeAgent.js +2 -2
- package/lib/agent/src/AutoBeAgent.js.map +1 -1
- package/lib/agent/src/AutoBeMockAgent.js +1 -0
- package/lib/agent/src/AutoBeMockAgent.js.map +1 -1
- package/lib/agent/src/constants/AutoBeConfigConstant.d.ts +3 -0
- package/lib/agent/src/{orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js → constants/AutoBeConfigConstant.js} +1 -1
- package/lib/agent/src/constants/AutoBeConfigConstant.js.map +1 -0
- package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +27 -26
- package/lib/agent/src/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/agent/src/context/AutoBeContext.d.ts +3 -2
- package/lib/agent/src/context/AutoBeTokenUsageComponent.js +4 -3
- package/lib/agent/src/context/AutoBeTokenUsageComponent.js.map +1 -1
- package/lib/agent/src/factory/consentFunctionCall.js +4 -4
- package/lib/agent/src/factory/consentFunctionCall.js.map +1 -1
- package/lib/agent/src/factory/createAutoBeContext.js +16 -11
- package/lib/agent/src/factory/createAutoBeContext.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +2 -2
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js +6 -6
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js +50 -8
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js +4 -4
- package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +6 -0
- package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +4 -0
- package/lib/agent/src/orchestrate/facade/transformFacadeStateMessage.js +1 -1
- package/lib/agent/src/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +19 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +4 -0
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +33 -0
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +2 -2
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterface.js +5 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js +16 -10
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js +3731 -228
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js +5 -3
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +365 -0
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +43 -63
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +244 -176
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +3466 -103
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js +3672 -358
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js +3 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -101
- package/lib/agent/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +29 -23
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.d.ts +9 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.js +1385 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.d.ts +5 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.js +78 -0
- package/lib/agent/src/orchestrate/interface/utils/JsonSchemaNamingConvention.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.d.ts +2 -0
- package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js +81 -0
- package/lib/agent/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +2 -2
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +2 -2
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +2 -2
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +22 -7
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +13 -29
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js +2 -8
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +6 -49
- package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +4 -2
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +5 -3
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +206 -118
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js +2 -2
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -2
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +24 -39
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +17 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +20 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +33 -73
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.d.ts +5 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.js +3 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.js.map +1 -0
- package/{src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.ts → lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts} +3 -10
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.js +3 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +40 -24
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +31 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +86 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.d.ts +4 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.js +55 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +2 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.js +20 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.d.ts +30 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.js +73 -0
- package/lib/agent/src/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.d.ts +6 -2
- package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js +63 -69
- package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/completeTestCode.js +15 -14
- package/lib/agent/src/orchestrate/test/compile/completeTestCode.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
- package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js +19 -0
- package/lib/agent/src/orchestrate/test/compile/getTestImportStatements.js.map +1 -0
- package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js +2 -0
- package/lib/agent/src/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
- package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js +21 -0
- package/lib/agent/src/orchestrate/test/compile/getTestTemplateCode.js.map +1 -0
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.d.ts +4 -2
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +40 -25
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +5 -4
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +137 -96
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTest.js +6 -0
- package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.d.ts +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +126 -72
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +54 -48
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +122 -43
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +48 -45
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.d.ts +6 -0
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.js +3 -0
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.js.map +1 -0
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +28 -1
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +1 -0
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +13 -0
- package/lib/agent/src/orchestrate/test/utils/getReferenceIds.d.ts +5 -0
- package/lib/agent/src/orchestrate/test/utils/getReferenceIds.js +28 -0
- package/lib/agent/src/orchestrate/test/utils/getReferenceIds.js.map +1 -0
- package/lib/agent/src/structures/IAutoBeConfig.d.ts +2 -0
- package/lib/constants/AutoBeConfigConstant.d.ts +3 -0
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +27 -26
- package/lib/context/AutoBeContext.d.ts +3 -2
- package/lib/index.mjs +13778 -3055
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +6 -0
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +4 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +4 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +6 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +0 -38
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +48 -101
- package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +29 -23
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.d.ts +9 -0
- package/lib/orchestrate/interface/utils/JsonSchemaNamingConvention.d.ts +5 -0
- package/lib/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.d.ts +2 -0
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.d.ts +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +6 -6
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -8
- package/lib/orchestrate/realize/internal/compileRealizeFiles.d.ts +2 -2
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +13 -6
- package/lib/orchestrate/realize/orchestrateRealizeScenario.d.ts +2 -2
- package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -2
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +17 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +20 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +33 -73
- package/lib/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.d.ts +5 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts +36 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +40 -24
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +31 -0
- package/lib/orchestrate/realize/utils/getRealizeWriteDto.d.ts +4 -0
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +2 -0
- package/lib/orchestrate/realize/utils/getRealizeWriteInputType.d.ts +30 -0
- package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +6 -2
- package/lib/orchestrate/test/compile/getTestImportStatements.d.ts +2 -0
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +1 -1
- package/lib/orchestrate/test/compile/getTestTemplateCode.d.ts +2 -0
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +4 -2
- package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +48 -45
- package/lib/orchestrate/test/structures/IAutoBeTestFunctionFailure.d.ts +6 -0
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +28 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +13 -0
- package/lib/orchestrate/test/utils/getReferenceIds.d.ts +5 -0
- package/lib/structures/IAutoBeConfig.d.ts +2 -0
- package/package.json +6 -6
- package/src/AutoBeAgent.ts +2 -0
- package/src/AutoBeMockAgent.ts +1 -0
- package/src/constants/AutoBeConfigConstant.ts +3 -0
- package/src/constants/AutoBeSystemPromptConstant.ts +27 -26
- package/src/context/AutoBeContext.ts +3 -0
- package/src/context/AutoBeTokenUsageComponent.ts +3 -3
- package/src/factory/consentFunctionCall.ts +2 -0
- package/src/factory/createAutoBeContext.ts +145 -135
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.ts +6 -0
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +4 -0
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +19 -1
- package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +39 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +1 -4
- package/src/orchestrate/interface/orchestrateInterface.ts +15 -4
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +13 -5
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +58 -19
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +5 -1
- package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +95 -0
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +11 -11
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +7 -3
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +33 -91
- package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +72 -95
- package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.ts +65 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +0 -39
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +50 -104
- package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +31 -27
- package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +171 -0
- package/src/orchestrate/interface/utils/JsonSchemaNamingConvention.ts +83 -0
- package/src/orchestrate/interface/utils/fulfillJsonSchemaErrorMessages.ts +90 -0
- package/src/orchestrate/interface/utils/validateAuthorizationSchema.ts +2 -2
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +1 -2
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +30 -15
- package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +27 -49
- package/src/orchestrate/realize/internal/compileRealizeFiles.ts +4 -11
- package/src/orchestrate/realize/orchestrateRealize.ts +19 -75
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +1 -1
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +114 -25
- package/src/orchestrate/realize/orchestrateRealizeScenario.ts +9 -5
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +11 -15
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +17 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +20 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +40 -74
- package/src/orchestrate/realize/structures/IAutoBeRealizeFunctionFailure.ts +9 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.ts +45 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +43 -27
- package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +97 -0
- package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +64 -0
- package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +29 -0
- package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +82 -0
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +101 -111
- package/src/orchestrate/test/compile/completeTestCode.ts +15 -26
- package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +3 -0
- package/src/orchestrate/test/compile/getTestImportStatements.ts +25 -0
- package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +6 -1
- package/src/orchestrate/test/compile/getTestTemplateCode.ts +25 -0
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +48 -36
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +6 -5
- package/src/orchestrate/test/histories/transformTestWriteHistories.ts +43 -4
- package/src/orchestrate/test/orchestrateTest.ts +6 -0
- package/src/orchestrate/test/orchestrateTestCorrect.ts +46 -11
- package/src/orchestrate/test/orchestrateTestScenario.ts +52 -48
- package/src/orchestrate/test/orchestrateTestWrite.ts +24 -6
- package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +49 -46
- package/src/orchestrate/test/structures/IAutoBeTestFunctionFailure.ts +8 -0
- package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +28 -1
- package/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.ts +1 -0
- package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +14 -0
- package/src/orchestrate/test/utils/getReferenceIds.ts +25 -0
- package/src/structures/IAutoBeConfig.ts +3 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.js.map +0 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js +0 -75
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js.map +0 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +0 -38
- package/lib/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
- package/src/orchestrate/test/histories/transformTestHistories.ts +0 -78
|
@@ -3,6 +3,7 @@ import { AutoBeOpenApi } from "@autobe/interface";
|
|
|
3
3
|
import {
|
|
4
4
|
ILlmApplication,
|
|
5
5
|
ILlmSchema,
|
|
6
|
+
IValidation,
|
|
6
7
|
OpenApiTypeChecker,
|
|
7
8
|
} from "@samchon/openapi";
|
|
8
9
|
import { OpenApiV3_1Emender } from "@samchon/openapi/lib/converters/OpenApiV3_1Emender";
|
|
@@ -14,22 +15,25 @@ import { AutoBeContext } from "../../context/AutoBeContext";
|
|
|
14
15
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
15
16
|
import { transformInterfaceComplementHistories } from "./histories/transformInterfaceComplementHistories";
|
|
16
17
|
import { IAutoBeInterfaceComplementApplication } from "./structures/IAutoBeInterfaceComplementApplication";
|
|
18
|
+
import { JsonSchemaFactory } from "./utils/JsonSchemaFactory";
|
|
19
|
+
import { JsonSchemaNamingConvention } from "./utils/JsonSchemaNamingConvention";
|
|
20
|
+
import { fulfillJsonSchemaErrorMessages } from "./utils/fulfillJsonSchemaErrorMessages";
|
|
21
|
+
import { validateAuthorizationSchema } from "./utils/validateAuthorizationSchema";
|
|
17
22
|
|
|
18
23
|
export function orchestrateInterfaceComplement<Model extends ILlmSchema.Model>(
|
|
19
24
|
ctx: AutoBeContext<Model>,
|
|
20
25
|
document: AutoBeOpenApi.IDocument,
|
|
21
|
-
life: number = 8,
|
|
22
26
|
): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
|
|
23
|
-
return step(ctx, document,
|
|
27
|
+
return step(ctx, document, 8);
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
async function step<Model extends ILlmSchema.Model>(
|
|
27
31
|
ctx: AutoBeContext<Model>,
|
|
28
32
|
document: AutoBeOpenApi.IDocument,
|
|
29
|
-
|
|
33
|
+
life: number,
|
|
30
34
|
): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
|
|
31
35
|
const missed: string[] = getMissed(document);
|
|
32
|
-
if (missed.length === 0 ||
|
|
36
|
+
if (missed.length === 0 || life <= 0) {
|
|
33
37
|
return document.components.schemas;
|
|
34
38
|
}
|
|
35
39
|
|
|
@@ -83,6 +87,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
83
87
|
...pointer.value,
|
|
84
88
|
...document.components.schemas,
|
|
85
89
|
};
|
|
90
|
+
JsonSchemaNamingConvention.schemas(document.operations, newSchemas);
|
|
86
91
|
return step(
|
|
87
92
|
ctx,
|
|
88
93
|
{
|
|
@@ -92,7 +97,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
92
97
|
schemas: newSchemas,
|
|
93
98
|
},
|
|
94
99
|
},
|
|
95
|
-
|
|
100
|
+
life - 1,
|
|
96
101
|
);
|
|
97
102
|
}
|
|
98
103
|
|
|
@@ -124,9 +129,39 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
124
129
|
) => void;
|
|
125
130
|
}): IAgenticaController.IClass<Model> {
|
|
126
131
|
assertSchemaModel(props.model);
|
|
132
|
+
|
|
133
|
+
const validate = (
|
|
134
|
+
next: unknown,
|
|
135
|
+
): IValidation<IAutoBeInterfaceComplementApplication.IProps> => {
|
|
136
|
+
JsonSchemaFactory.fix("schemas", next);
|
|
137
|
+
|
|
138
|
+
const result: IValidation<IAutoBeInterfaceComplementApplication.IProps> =
|
|
139
|
+
typia.validate<IAutoBeInterfaceComplementApplication.IProps>(next);
|
|
140
|
+
if (result.success === false) {
|
|
141
|
+
fulfillJsonSchemaErrorMessages(result.errors);
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const errors: IValidation.IError[] = [];
|
|
146
|
+
validateAuthorizationSchema({
|
|
147
|
+
errors,
|
|
148
|
+
schemas: result.data.schemas,
|
|
149
|
+
path: "$input.schemas",
|
|
150
|
+
});
|
|
151
|
+
if (errors.length !== 0)
|
|
152
|
+
return {
|
|
153
|
+
success: false,
|
|
154
|
+
errors,
|
|
155
|
+
data: next,
|
|
156
|
+
};
|
|
157
|
+
return result;
|
|
158
|
+
};
|
|
159
|
+
|
|
127
160
|
const application: ILlmApplication<Model> = collection[
|
|
128
|
-
props.model
|
|
129
|
-
]
|
|
161
|
+
props.model === "chatgpt" ? "chatgpt" : "claude"
|
|
162
|
+
](
|
|
163
|
+
validate,
|
|
164
|
+
) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
|
|
130
165
|
return {
|
|
131
166
|
protocol: "class",
|
|
132
167
|
name: "interface",
|
|
@@ -139,17 +174,21 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
139
174
|
};
|
|
140
175
|
}
|
|
141
176
|
|
|
142
|
-
const claude = typia.llm.application<
|
|
143
|
-
IAutoBeInterfaceComplementApplication,
|
|
144
|
-
"claude"
|
|
145
|
-
>();
|
|
146
177
|
const collection = {
|
|
147
|
-
chatgpt:
|
|
148
|
-
IAutoBeInterfaceComplementApplication,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
178
|
+
chatgpt: (validate: Validator) =>
|
|
179
|
+
typia.llm.application<IAutoBeInterfaceComplementApplication, "chatgpt">({
|
|
180
|
+
validate: {
|
|
181
|
+
complementComponents: validate,
|
|
182
|
+
},
|
|
183
|
+
}),
|
|
184
|
+
claude: (validate: Validator) =>
|
|
185
|
+
typia.llm.application<IAutoBeInterfaceComplementApplication, "claude">({
|
|
186
|
+
validate: {
|
|
187
|
+
complementComponents: validate,
|
|
188
|
+
},
|
|
189
|
+
}),
|
|
155
190
|
};
|
|
191
|
+
|
|
192
|
+
type Validator = (
|
|
193
|
+
input: unknown,
|
|
194
|
+
) => IValidation<IAutoBeInterfaceComplementApplication.IProps>;
|
|
@@ -14,6 +14,7 @@ import { AutoBeContext } from "../../context/AutoBeContext";
|
|
|
14
14
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
15
15
|
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
16
16
|
import { transformInterfaceEndpointHistories } from "./histories/transformInterfaceEndpointHistories";
|
|
17
|
+
import { orchestrateInterfaceEndpointsReview } from "./orchestrateInterfaceEndpointsReview";
|
|
17
18
|
import { IAutoBeInterfaceEndpointApplication } from "./structures/IAutoBeInterfaceEndpointApplication";
|
|
18
19
|
import { OpenApiEndpointComparator } from "./utils/OpenApiEndpointComparator";
|
|
19
20
|
|
|
@@ -37,11 +38,14 @@ export async function orchestrateInterfaceEndpoints<
|
|
|
37
38
|
),
|
|
38
39
|
)
|
|
39
40
|
).flat();
|
|
40
|
-
|
|
41
|
+
|
|
42
|
+
const deduplicated: AutoBeOpenApi.IEndpoint[] = new HashSet(
|
|
41
43
|
endpoints,
|
|
42
44
|
OpenApiEndpointComparator.hashCode,
|
|
43
45
|
OpenApiEndpointComparator.equals,
|
|
44
46
|
).toJSON();
|
|
47
|
+
|
|
48
|
+
return orchestrateInterfaceEndpointsReview(ctx, deduplicated);
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
async function process<Model extends ILlmSchema.Model>(
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { IAgenticaController } from "@agentica/core";
|
|
2
|
+
import { AutoBeOpenApi } from "@autobe/interface";
|
|
3
|
+
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
4
|
+
import { IPointer } from "tstl";
|
|
5
|
+
import typia from "typia";
|
|
6
|
+
import { v7 } from "uuid";
|
|
7
|
+
|
|
8
|
+
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
9
|
+
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
10
|
+
import { transformInterfaceEndpointsReviewHistories } from "./histories/transformInterfaceEndpointsReviewHistories";
|
|
11
|
+
import { IAutoBeInterfaceEndpointsReviewApplication } from "./structures/IAutoBeInterfaceEndpointsReviewApplication";
|
|
12
|
+
|
|
13
|
+
export async function orchestrateInterfaceEndpointsReview<
|
|
14
|
+
Model extends ILlmSchema.Model,
|
|
15
|
+
>(
|
|
16
|
+
ctx: AutoBeContext<Model>,
|
|
17
|
+
endpoints: AutoBeOpenApi.IEndpoint[],
|
|
18
|
+
message: string = `Review the generated endpoints`,
|
|
19
|
+
): Promise<AutoBeOpenApi.IEndpoint[]> {
|
|
20
|
+
const pointer: IPointer<IAutoBeInterfaceEndpointsReviewApplication.IProps | null> =
|
|
21
|
+
{
|
|
22
|
+
value: null,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const { tokenUsage } = await ctx.conversate({
|
|
26
|
+
source: "interfaceEndpointsReview",
|
|
27
|
+
histories: transformInterfaceEndpointsReviewHistories(
|
|
28
|
+
ctx.state(),
|
|
29
|
+
endpoints,
|
|
30
|
+
),
|
|
31
|
+
controller: createController({
|
|
32
|
+
model: ctx.model,
|
|
33
|
+
build: (props) => {
|
|
34
|
+
pointer.value = props;
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
enforceFunctionCall: true,
|
|
38
|
+
message,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
if (pointer.value === null) {
|
|
42
|
+
return endpoints;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const response = pointer.value?.endpoints ?? [];
|
|
46
|
+
|
|
47
|
+
ctx.dispatch({
|
|
48
|
+
id: v7(),
|
|
49
|
+
type: "interfaceEndpointsReview",
|
|
50
|
+
endpoints,
|
|
51
|
+
content: response,
|
|
52
|
+
created_at: new Date().toISOString(),
|
|
53
|
+
review: pointer.value?.review,
|
|
54
|
+
step: ctx.state().analyze?.step ?? 0,
|
|
55
|
+
tokenUsage,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
return response;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function createController<Model extends ILlmSchema.Model>(props: {
|
|
62
|
+
model: Model;
|
|
63
|
+
build: (props: IAutoBeInterfaceEndpointsReviewApplication.IProps) => void;
|
|
64
|
+
}): IAgenticaController.IClass<Model> {
|
|
65
|
+
assertSchemaModel(props.model);
|
|
66
|
+
|
|
67
|
+
const application: ILlmApplication<Model> = collection[
|
|
68
|
+
props.model
|
|
69
|
+
] satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
|
|
70
|
+
return {
|
|
71
|
+
protocol: "class",
|
|
72
|
+
name: "interface",
|
|
73
|
+
application,
|
|
74
|
+
execute: {
|
|
75
|
+
reviewEndpoints: (next) => {
|
|
76
|
+
props.build(next);
|
|
77
|
+
},
|
|
78
|
+
} satisfies IAutoBeInterfaceEndpointsReviewApplication,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const claude = typia.llm.application<
|
|
83
|
+
IAutoBeInterfaceEndpointsReviewApplication,
|
|
84
|
+
"claude"
|
|
85
|
+
>();
|
|
86
|
+
const collection = {
|
|
87
|
+
chatgpt: typia.llm.application<
|
|
88
|
+
IAutoBeInterfaceEndpointsReviewApplication,
|
|
89
|
+
"chatgpt"
|
|
90
|
+
>(),
|
|
91
|
+
claude,
|
|
92
|
+
llama: claude,
|
|
93
|
+
deepseek: claude,
|
|
94
|
+
"3.1": claude,
|
|
95
|
+
};
|
|
@@ -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)
|
|
@@ -2,6 +2,7 @@ import { IAgenticaController } from "@agentica/core";
|
|
|
2
2
|
import {
|
|
3
3
|
AutoBeInterfaceOperationsReviewEvent,
|
|
4
4
|
AutoBeOpenApi,
|
|
5
|
+
AutoBePrisma,
|
|
5
6
|
AutoBeProgressEventBase,
|
|
6
7
|
} from "@autobe/interface";
|
|
7
8
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
@@ -21,6 +22,7 @@ export async function orchestrateInterfaceOperationsReview<
|
|
|
21
22
|
progress: AutoBeProgressEventBase,
|
|
22
23
|
): Promise<AutoBeOpenApi.IOperation[]> {
|
|
23
24
|
try {
|
|
25
|
+
const files: AutoBePrisma.IFile[] = ctx.state().prisma?.result.data.files!;
|
|
24
26
|
const pointer: IPointer<IAutoBeInterfaceOperationsReviewApplication.IProps | null> =
|
|
25
27
|
{
|
|
26
28
|
value: null,
|
|
@@ -30,6 +32,7 @@ export async function orchestrateInterfaceOperationsReview<
|
|
|
30
32
|
histories: transformInterfaceOperationsReviewHistories(ctx, operations),
|
|
31
33
|
controller: createReviewController({
|
|
32
34
|
model: ctx.model,
|
|
35
|
+
prismaSchemas: files,
|
|
33
36
|
build: (next: IAutoBeInterfaceOperationsReviewApplication.IProps) => {
|
|
34
37
|
pointer.value = next;
|
|
35
38
|
},
|
|
@@ -39,7 +42,7 @@ export async function orchestrateInterfaceOperationsReview<
|
|
|
39
42
|
});
|
|
40
43
|
if (pointer.value === null) {
|
|
41
44
|
console.error("Failed to review operations.");
|
|
42
|
-
progress.completed
|
|
45
|
+
++progress.completed;
|
|
43
46
|
return [];
|
|
44
47
|
}
|
|
45
48
|
|
|
@@ -54,8 +57,8 @@ export async function orchestrateInterfaceOperationsReview<
|
|
|
54
57
|
type: "interfaceOperationsReview",
|
|
55
58
|
id: v7(),
|
|
56
59
|
operations: content,
|
|
57
|
-
review: pointer.value.review,
|
|
58
|
-
plan: pointer.value.plan,
|
|
60
|
+
review: pointer.value.think.review,
|
|
61
|
+
plan: pointer.value.think.plan,
|
|
59
62
|
content,
|
|
60
63
|
tokenUsage,
|
|
61
64
|
created_at: new Date().toISOString(),
|
|
@@ -73,6 +76,7 @@ export async function orchestrateInterfaceOperationsReview<
|
|
|
73
76
|
|
|
74
77
|
function createReviewController<Model extends ILlmSchema.Model>(props: {
|
|
75
78
|
model: Model;
|
|
79
|
+
prismaSchemas: AutoBePrisma.IFile[];
|
|
76
80
|
build: (reviews: IAutoBeInterfaceOperationsReviewApplication.IProps) => void;
|
|
77
81
|
}): IAgenticaController.IClass<Model> {
|
|
78
82
|
const application: ILlmApplication<Model> = collection[
|
|
@@ -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;
|