@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
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
-
import {
|
|
3
|
-
AutoBeRealizeAuthorization,
|
|
4
|
-
IAutoBeTypeScriptCompileResult,
|
|
5
|
-
} from "@autobe/interface";
|
|
2
|
+
import { AutoBeRealizeAuthorization } from "@autobe/interface";
|
|
6
3
|
import { StringUtil } from "@autobe/utils";
|
|
7
4
|
import { v7 } from "uuid";
|
|
8
5
|
|
|
9
6
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
10
7
|
import { AutoBeState } from "../../../context/AutoBeState";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
8
|
+
import { IAutoBeRealizeFunctionFailure } from "../structures/IAutoBeRealizeFunctionFailure";
|
|
9
|
+
import { IAutoBeRealizeScenarioResult } from "../structures/IAutoBeRealizeScenarioResult";
|
|
13
10
|
import { transformRealizeWriteHistories } from "./transformRealizeWriteHistories";
|
|
14
11
|
|
|
15
12
|
export function transformRealizeCorrectHistories(props: {
|
|
16
13
|
state: AutoBeState;
|
|
17
|
-
scenario:
|
|
18
|
-
artifacts: IAutoBeTestScenarioArtifacts;
|
|
14
|
+
scenario: IAutoBeRealizeScenarioResult;
|
|
19
15
|
authorization: AutoBeRealizeAuthorization | null;
|
|
20
16
|
totalAuthorizations: AutoBeRealizeAuthorization[];
|
|
21
17
|
code: string;
|
|
22
|
-
|
|
18
|
+
dto: Record<string, string>;
|
|
19
|
+
failures: IAutoBeRealizeFunctionFailure[];
|
|
23
20
|
}): Array<
|
|
24
21
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
25
22
|
> {
|
|
@@ -34,15 +31,33 @@ export function transformRealizeCorrectHistories(props: {
|
|
|
34
31
|
\`\`\`typescript
|
|
35
32
|
${props.code}
|
|
36
33
|
\`\`\`
|
|
37
|
-
|
|
38
|
-
The code has a compilation error:
|
|
39
|
-
|
|
40
|
-
\`\`\`json
|
|
41
|
-
${JSON.stringify(props.diagnostic)}
|
|
42
|
-
\`\`\`
|
|
43
34
|
`,
|
|
44
35
|
created_at: new Date().toISOString(),
|
|
45
36
|
},
|
|
37
|
+
...props.failures.map(
|
|
38
|
+
(f) =>
|
|
39
|
+
({
|
|
40
|
+
id: v7(),
|
|
41
|
+
type: "assistantMessage",
|
|
42
|
+
text: StringUtil.trim`
|
|
43
|
+
|
|
44
|
+
## Generated Typescript Code
|
|
45
|
+
|
|
46
|
+
\`\`\`typescript
|
|
47
|
+
${f.function.content}
|
|
48
|
+
\`\`\`
|
|
49
|
+
|
|
50
|
+
## Compile Errors
|
|
51
|
+
|
|
52
|
+
Fix the comilation error in the provided code.
|
|
53
|
+
|
|
54
|
+
\`\`\`typescript
|
|
55
|
+
${JSON.stringify(f.diagnostics)}
|
|
56
|
+
\`\`\`
|
|
57
|
+
`,
|
|
58
|
+
created_at: new Date().toISOString(),
|
|
59
|
+
}) satisfies IAgenticaHistoryJson.IAssistantMessage,
|
|
60
|
+
),
|
|
46
61
|
{
|
|
47
62
|
id: v7(),
|
|
48
63
|
type: "systemMessage",
|
|
@@ -5,13 +5,18 @@ import { v7 } from "uuid";
|
|
|
5
5
|
|
|
6
6
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
7
7
|
import { AutoBeState } from "../../../context/AutoBeState";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { IAutoBeRealizeScenarioResult } from "../structures/IAutoBeRealizeScenarioResult";
|
|
9
|
+
import { getRealizeWriteCodeTemplate } from "../utils/getRealizeWriteCodeTemplate";
|
|
10
|
+
import { getRealizeWriteInputType } from "../utils/getRealizeWriteInputType";
|
|
10
11
|
import { transformRealizeWriteAuthorizationsHistories } from "./transformRealizeWriteAuthorizationsHistories";
|
|
11
12
|
|
|
12
|
-
export const transformRealizeWriteHistories = (
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
export const transformRealizeWriteHistories = (props: {
|
|
14
|
+
state: AutoBeState;
|
|
15
|
+
scenario: IAutoBeRealizeScenarioResult;
|
|
16
|
+
authorization: AutoBeRealizeAuthorization | null;
|
|
17
|
+
totalAuthorizations: AutoBeRealizeAuthorization[];
|
|
18
|
+
dto: Record<string, string>;
|
|
19
|
+
}): Array<
|
|
15
20
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
16
21
|
> => {
|
|
17
22
|
const payloads = Object.fromEntries(
|
|
@@ -21,38 +26,7 @@ export const transformRealizeWriteHistories = (
|
|
|
21
26
|
]),
|
|
22
27
|
);
|
|
23
28
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const propsFields: string[] = [];
|
|
27
|
-
|
|
28
|
-
// payload 추가
|
|
29
|
-
if (props.authorization && operation.authorizationRole) {
|
|
30
|
-
propsFields.push(
|
|
31
|
-
`${operation.authorizationRole}: ${props.authorization.payload.name};`,
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// parameters 추가
|
|
36
|
-
operation.parameters.forEach((parameter) => {
|
|
37
|
-
const format =
|
|
38
|
-
"format" in parameter.schema
|
|
39
|
-
? ` & tags.Format<'${parameter.schema.format}'>`
|
|
40
|
-
: "";
|
|
41
|
-
propsFields.push(`${parameter.name}: ${parameter.schema.type}${format};`);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
// body 추가
|
|
45
|
-
if (operation.requestBody?.typeName) {
|
|
46
|
-
propsFields.push(`body: ${operation.requestBody.typeName};`);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const input =
|
|
50
|
-
propsFields.length > 0
|
|
51
|
-
? StringUtil.trim`
|
|
52
|
-
props: {
|
|
53
|
-
${propsFields.map((field) => ` ${field},`).join("\n")}
|
|
54
|
-
}`
|
|
55
|
-
: `// No props parameter needed - function should have no parameters`;
|
|
29
|
+
const operation = props.scenario.operation;
|
|
56
30
|
|
|
57
31
|
if (props.state.analyze === null)
|
|
58
32
|
return [
|
|
@@ -132,7 +106,7 @@ export const transformRealizeWriteHistories = (
|
|
|
132
106
|
id: v7(),
|
|
133
107
|
created_at: new Date().toISOString(),
|
|
134
108
|
type: "systemMessage",
|
|
135
|
-
text: AutoBeSystemPromptConstant.
|
|
109
|
+
text: AutoBeSystemPromptConstant.REALIZE_WRITE,
|
|
136
110
|
},
|
|
137
111
|
...authorizationHistories,
|
|
138
112
|
{
|
|
@@ -143,14 +117,26 @@ export const transformRealizeWriteHistories = (
|
|
|
143
117
|
`{prisma_schemas}`,
|
|
144
118
|
JSON.stringify(props.state.prisma.schemas),
|
|
145
119
|
)
|
|
146
|
-
.replaceAll(
|
|
147
|
-
|
|
148
|
-
|
|
120
|
+
.replaceAll(
|
|
121
|
+
`{input}`,
|
|
122
|
+
getRealizeWriteInputType(operation, props.authorization),
|
|
123
|
+
)
|
|
124
|
+
.replaceAll(`{artifacts_dto}`, JSON.stringify(props.dto)),
|
|
149
125
|
},
|
|
150
126
|
{
|
|
151
127
|
id: v7(),
|
|
128
|
+
type: "systemMessage",
|
|
152
129
|
created_at: new Date().toISOString(),
|
|
130
|
+
text: getRealizeWriteCodeTemplate(
|
|
131
|
+
props.scenario,
|
|
132
|
+
operation,
|
|
133
|
+
props.authorization,
|
|
134
|
+
),
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: v7(),
|
|
153
138
|
type: "systemMessage",
|
|
139
|
+
created_at: new Date().toISOString(),
|
|
154
140
|
text: StringUtil.trim`
|
|
155
141
|
Write new code based on the following operation.
|
|
156
142
|
|
|
@@ -179,11 +165,3 @@ export const transformRealizeWriteHistories = (
|
|
|
179
165
|
},
|
|
180
166
|
];
|
|
181
167
|
};
|
|
182
|
-
|
|
183
|
-
interface IProps {
|
|
184
|
-
state: AutoBeState;
|
|
185
|
-
scenario: IAutoBeRealizeScenarioApplication.IProps;
|
|
186
|
-
artifacts: IAutoBeTestScenarioArtifacts;
|
|
187
|
-
authorization: AutoBeRealizeAuthorization | null;
|
|
188
|
-
totalAuthorizations: AutoBeRealizeAuthorization[];
|
|
189
|
-
}
|
|
@@ -16,7 +16,7 @@ export async function compileRealizeFiles<Model extends ILlmSchema.Model>(
|
|
|
16
16
|
authorizations: AutoBeRealizeAuthorization[];
|
|
17
17
|
functions: AutoBeRealizeFunction[];
|
|
18
18
|
},
|
|
19
|
-
): Promise<
|
|
19
|
+
): Promise<AutoBeRealizeValidateEvent> {
|
|
20
20
|
const prisma = ctx.state().prisma?.compiled;
|
|
21
21
|
const payloads: Record<string, string> = Object.fromEntries(
|
|
22
22
|
props.authorizations.map((el) => [el.payload.location, el.payload.content]),
|
|
@@ -50,22 +50,15 @@ export async function compileRealizeFiles<Model extends ILlmSchema.Model>(
|
|
|
50
50
|
await compiler.typescript.compile({
|
|
51
51
|
files: files,
|
|
52
52
|
});
|
|
53
|
-
if (compiled.type === "success") {
|
|
54
|
-
return compiled;
|
|
55
|
-
}
|
|
56
53
|
|
|
57
54
|
const event: AutoBeRealizeValidateEvent = {
|
|
58
55
|
type: "realizeValidate",
|
|
59
56
|
id: v7(),
|
|
57
|
+
files: files,
|
|
60
58
|
result: compiled,
|
|
61
|
-
files: Object.fromEntries(
|
|
62
|
-
compiled.type === "failure"
|
|
63
|
-
? compiled.diagnostics.map((d) => [d.file, d.code])
|
|
64
|
-
: [],
|
|
65
|
-
),
|
|
66
59
|
step: ctx.state().analyze?.step ?? 0,
|
|
67
60
|
created_at: new Date().toISOString(),
|
|
68
61
|
};
|
|
69
|
-
|
|
70
|
-
return
|
|
62
|
+
|
|
63
|
+
return event;
|
|
71
64
|
}
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
AutoBeRealizeHistory,
|
|
8
8
|
AutoBeRealizeWriteEvent,
|
|
9
9
|
IAutoBeCompiler,
|
|
10
|
-
IAutoBeTypeScriptCompileResult,
|
|
11
10
|
} from "@autobe/interface";
|
|
12
11
|
import { ILlmSchema } from "@samchon/openapi";
|
|
13
12
|
import { v7 } from "uuid";
|
|
@@ -16,12 +15,11 @@ import { AutoBeContext } from "../../context/AutoBeContext";
|
|
|
16
15
|
import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
|
|
17
16
|
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
18
17
|
import { predicateStateMessage } from "../../utils/predicateStateMessage";
|
|
19
|
-
import { compileRealizeFiles } from "./internal/compileRealizeFiles";
|
|
20
18
|
import { orchestrateRealizeAuthorization } from "./orchestrateRealizeAuthorization";
|
|
21
19
|
import { orchestrateRealizeCorrect } from "./orchestrateRealizeCorrect";
|
|
22
20
|
import { orchestrateRealizeScenario } from "./orchestrateRealizeScenario";
|
|
23
21
|
import { orchestrateRealizeWrite } from "./orchestrateRealizeWrite";
|
|
24
|
-
import {
|
|
22
|
+
import { IAutoBeRealizeScenarioResult } from "./structures/IAutoBeRealizeScenarioResult";
|
|
25
23
|
|
|
26
24
|
export const orchestrateRealize =
|
|
27
25
|
<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>) =>
|
|
@@ -60,14 +58,15 @@ export const orchestrateRealize =
|
|
|
60
58
|
await orchestrateRealizeAuthorization(ctx);
|
|
61
59
|
|
|
62
60
|
// SCENARIOS
|
|
63
|
-
const scenarios:
|
|
64
|
-
|
|
61
|
+
const scenarios: IAutoBeRealizeScenarioResult[] = operations.map(
|
|
62
|
+
(operation) => {
|
|
65
63
|
const authorization = authorizations.find(
|
|
66
64
|
(el) => el.role.name === operation.authorizationRole,
|
|
67
65
|
);
|
|
68
66
|
|
|
69
67
|
return orchestrateRealizeScenario(ctx, operation, authorization);
|
|
70
|
-
}
|
|
68
|
+
},
|
|
69
|
+
);
|
|
71
70
|
|
|
72
71
|
const writeProgress: AutoBeProgressEventBase = {
|
|
73
72
|
total: scenarios.length,
|
|
@@ -103,76 +102,20 @@ export const orchestrateRealize =
|
|
|
103
102
|
};
|
|
104
103
|
});
|
|
105
104
|
|
|
106
|
-
|
|
105
|
+
const reviewProgress = {
|
|
106
|
+
total: writeEvents.length,
|
|
107
|
+
completed: writeEvents.length,
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const result = await orchestrateRealizeCorrect(
|
|
111
|
+
ctx,
|
|
112
|
+
scenarios,
|
|
107
113
|
authorizations,
|
|
108
114
|
functions,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const reviewProgress = {
|
|
115
|
-
id: v7(),
|
|
116
|
-
total: writeEvents.length,
|
|
117
|
-
completed: writeEvents.length,
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
for (let attempt = 0; attempt < MAX_CORRECTION_ATTEMPTS; attempt++) {
|
|
121
|
-
if (compilation.type === "failure") {
|
|
122
|
-
const failedFiles: Record<string, string> = Object.fromEntries(
|
|
123
|
-
compilation.type === "failure"
|
|
124
|
-
? compilation.diagnostics.map((d) => [d.file, d.code])
|
|
125
|
-
: [],
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
reviewProgress.total += Object.keys(failedFiles).length;
|
|
129
|
-
const failure: IAutoBeTypeScriptCompileResult.IFailure = compilation;
|
|
130
|
-
|
|
131
|
-
await executeCachedBatch(
|
|
132
|
-
Object.entries(failedFiles).map(
|
|
133
|
-
([location, content]) =>
|
|
134
|
-
async () => {
|
|
135
|
-
const diagnostic:
|
|
136
|
-
| IAutoBeTypeScriptCompileResult.IDiagnostic
|
|
137
|
-
| undefined = failure.diagnostics.find(
|
|
138
|
-
(el) => el.file === location,
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
const scenario = scenarios.find(
|
|
142
|
-
(el) => el.location === location,
|
|
143
|
-
);
|
|
144
|
-
if (diagnostic && scenario) {
|
|
145
|
-
const correctEvent = await orchestrateRealizeCorrect(ctx, {
|
|
146
|
-
totalAuthorizations: authorizations,
|
|
147
|
-
authorization: scenario.decoratorEvent ?? null,
|
|
148
|
-
scenario,
|
|
149
|
-
code: content,
|
|
150
|
-
diagnostic,
|
|
151
|
-
progress: reviewProgress,
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
const corrected = functions.find(
|
|
155
|
-
(el) => el.location === correctEvent.location,
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
if (corrected) {
|
|
159
|
-
corrected.content = correctEvent.content;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
),
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
compilation = await compileRealizeFiles(ctx, {
|
|
167
|
-
authorizations,
|
|
168
|
-
functions,
|
|
169
|
-
});
|
|
170
|
-
if (compilation.type === "success") {
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
115
|
+
[],
|
|
116
|
+
reviewProgress,
|
|
117
|
+
5,
|
|
118
|
+
);
|
|
176
119
|
|
|
177
120
|
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
178
121
|
const controllers: Record<string, string> =
|
|
@@ -181,6 +124,7 @@ export const orchestrateRealize =
|
|
|
181
124
|
functions,
|
|
182
125
|
authorizations,
|
|
183
126
|
});
|
|
127
|
+
|
|
184
128
|
return ctx.dispatch({
|
|
185
129
|
type: "realizeComplete",
|
|
186
130
|
id: v7(),
|
|
@@ -188,7 +132,7 @@ export const orchestrateRealize =
|
|
|
188
132
|
functions,
|
|
189
133
|
authorizations,
|
|
190
134
|
controllers,
|
|
191
|
-
compiled:
|
|
135
|
+
compiled: result.result,
|
|
192
136
|
step: ctx.state().analyze?.step ?? 0,
|
|
193
137
|
elapsed: new Date().getTime() - start.getTime(),
|
|
194
138
|
});
|
|
@@ -24,7 +24,7 @@ export async function orchestrateRealizeAuthorizationCorrect<
|
|
|
24
24
|
authorization: AutoBeRealizeAuthorization,
|
|
25
25
|
prismaClients: Record<string, string>,
|
|
26
26
|
templateFiles: Record<string, string>,
|
|
27
|
-
life: number =
|
|
27
|
+
life: number = ctx.retry,
|
|
28
28
|
): Promise<AutoBeRealizeAuthorization> {
|
|
29
29
|
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
30
30
|
const providerContent: string = await compiler.typescript.beautify(
|
|
@@ -2,7 +2,8 @@ import {
|
|
|
2
2
|
AutoBeProgressEventBase,
|
|
3
3
|
AutoBeRealizeAuthorization,
|
|
4
4
|
AutoBeRealizeCorrectEvent,
|
|
5
|
-
|
|
5
|
+
AutoBeRealizeFunction,
|
|
6
|
+
AutoBeRealizeValidateEvent,
|
|
6
7
|
} from "@autobe/interface";
|
|
7
8
|
import { StringUtil } from "@autobe/utils";
|
|
8
9
|
import { ILlmApplication, ILlmController, ILlmSchema } from "@samchon/openapi";
|
|
@@ -12,33 +13,116 @@ import { v7 } from "uuid";
|
|
|
12
13
|
|
|
13
14
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
14
15
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
15
|
-
import {
|
|
16
|
-
import { IAutoBeTestScenarioArtifacts } from "../test/structures/IAutoBeTestScenarioArtifacts";
|
|
16
|
+
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
17
17
|
import { transformRealizeCorrectHistories } from "./histories/transformRealizeCorrectHistories";
|
|
18
|
+
import { compileRealizeFiles } from "./internal/compileRealizeFiles";
|
|
18
19
|
import { IAutoBeRealizeCorrectApplication } from "./structures/IAutoBeRealizeCorrectApplication";
|
|
19
|
-
import {
|
|
20
|
+
import { IAutoBeRealizeFunctionFailure } from "./structures/IAutoBeRealizeFunctionFailure";
|
|
21
|
+
import { IAutoBeRealizeScenarioResult } from "./structures/IAutoBeRealizeScenarioResult";
|
|
22
|
+
import { getRealizeWriteDto } from "./utils/getRealizeWriteDto";
|
|
20
23
|
import { replaceImportStatements } from "./utils/replaceImportStatements";
|
|
21
24
|
|
|
22
25
|
export async function orchestrateRealizeCorrect<Model extends ILlmSchema.Model>(
|
|
26
|
+
ctx: AutoBeContext<Model>,
|
|
27
|
+
scenarios: IAutoBeRealizeScenarioResult[],
|
|
28
|
+
authorizations: AutoBeRealizeAuthorization[],
|
|
29
|
+
functions: AutoBeRealizeFunction[],
|
|
30
|
+
failures: IAutoBeRealizeFunctionFailure[],
|
|
31
|
+
progress: IProgress,
|
|
32
|
+
life: number = 5,
|
|
33
|
+
): Promise<AutoBeRealizeValidateEvent> {
|
|
34
|
+
const event = await compileRealizeFiles(ctx, { authorizations, functions });
|
|
35
|
+
if (event.result.type === "failure") ctx.dispatch(event);
|
|
36
|
+
|
|
37
|
+
if (event.result.type === "success") {
|
|
38
|
+
console.debug("compilation success!");
|
|
39
|
+
return event;
|
|
40
|
+
} else if (--life <= 0) return event;
|
|
41
|
+
|
|
42
|
+
const locations: string[] =
|
|
43
|
+
(event.result.type === "failure"
|
|
44
|
+
? Array.from(new Set(event.result.diagnostics.map((d) => d.file)))
|
|
45
|
+
: null
|
|
46
|
+
)?.filter((el) => el !== null) ?? [];
|
|
47
|
+
|
|
48
|
+
progress.total += Object.keys(locations).length;
|
|
49
|
+
|
|
50
|
+
const diagnostics =
|
|
51
|
+
event.result.type === "failure" ? event.result.diagnostics : [];
|
|
52
|
+
|
|
53
|
+
const diagnosticsByFile = diagnostics.reduce<
|
|
54
|
+
Record<string, typeof diagnostics>
|
|
55
|
+
>((acc, diagnostic) => {
|
|
56
|
+
const location = diagnostic.file!;
|
|
57
|
+
if (!acc[location]) {
|
|
58
|
+
acc[location] = [];
|
|
59
|
+
}
|
|
60
|
+
acc[location].push(diagnostic);
|
|
61
|
+
return acc;
|
|
62
|
+
}, {});
|
|
63
|
+
|
|
64
|
+
for (const [location, diagnostics] of Object.entries(diagnosticsByFile)) {
|
|
65
|
+
const func = functions.find((el) => el.location === location);
|
|
66
|
+
|
|
67
|
+
if (func) {
|
|
68
|
+
failures.push({
|
|
69
|
+
function: func,
|
|
70
|
+
diagnostics,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
await executeCachedBatch(
|
|
76
|
+
locations.map((location) => async (): Promise<AutoBeRealizeFunction> => {
|
|
77
|
+
const scenario = scenarios.find((el) => el.location === location);
|
|
78
|
+
const func = functions.find((el) => el.location === location)!;
|
|
79
|
+
const ReailzeFunctionFailures: IAutoBeRealizeFunctionFailure[] =
|
|
80
|
+
failures.filter((f) => f.function.location === location);
|
|
81
|
+
|
|
82
|
+
if (ReailzeFunctionFailures.length && scenario) {
|
|
83
|
+
const correctEvent = await correct(ctx, {
|
|
84
|
+
totalAuthorizations: authorizations,
|
|
85
|
+
authorization: scenario.decoratorEvent ?? null,
|
|
86
|
+
scenario,
|
|
87
|
+
function: func,
|
|
88
|
+
failures: ReailzeFunctionFailures,
|
|
89
|
+
progress: progress,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
func.content = correctEvent.content;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return func;
|
|
96
|
+
}),
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
return orchestrateRealizeCorrect(
|
|
100
|
+
ctx,
|
|
101
|
+
scenarios,
|
|
102
|
+
authorizations,
|
|
103
|
+
functions,
|
|
104
|
+
failures,
|
|
105
|
+
progress,
|
|
106
|
+
life,
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export async function correct<Model extends ILlmSchema.Model>(
|
|
23
111
|
ctx: AutoBeContext<Model>,
|
|
24
112
|
props: {
|
|
25
113
|
authorization: AutoBeRealizeAuthorization | null;
|
|
26
114
|
totalAuthorizations: AutoBeRealizeAuthorization[];
|
|
27
|
-
scenario:
|
|
28
|
-
|
|
29
|
-
|
|
115
|
+
scenario: IAutoBeRealizeScenarioResult;
|
|
116
|
+
function: AutoBeRealizeFunction;
|
|
117
|
+
failures: IAutoBeRealizeFunctionFailure[];
|
|
30
118
|
progress: AutoBeProgressEventBase;
|
|
31
119
|
},
|
|
32
120
|
): Promise<AutoBeRealizeCorrectEvent> {
|
|
33
|
-
const artifacts: IAutoBeTestScenarioArtifacts =
|
|
34
|
-
await getTestScenarioArtifacts(ctx, {
|
|
35
|
-
endpoint: props.scenario.operation,
|
|
36
|
-
dependencies: [],
|
|
37
|
-
});
|
|
38
|
-
|
|
39
121
|
const pointer: IPointer<IAutoBeRealizeCorrectApplication.IProps | null> = {
|
|
40
122
|
value: null,
|
|
41
123
|
};
|
|
124
|
+
|
|
125
|
+
const dto = await getRealizeWriteDto(ctx, props.scenario.operation);
|
|
42
126
|
const { tokenUsage } = await ctx.conversate({
|
|
43
127
|
source: "realizeCorrect",
|
|
44
128
|
controller: createController({
|
|
@@ -50,34 +134,34 @@ export async function orchestrateRealizeCorrect<Model extends ILlmSchema.Model>(
|
|
|
50
134
|
histories: transformRealizeCorrectHistories({
|
|
51
135
|
state: ctx.state(),
|
|
52
136
|
scenario: props.scenario,
|
|
53
|
-
artifacts,
|
|
54
137
|
authorization: props.authorization,
|
|
55
|
-
code: props.
|
|
56
|
-
|
|
138
|
+
code: props.function.content,
|
|
139
|
+
dto,
|
|
140
|
+
failures: props.failures.filter(
|
|
141
|
+
(f) => f.function.location === props.function.location,
|
|
142
|
+
),
|
|
57
143
|
totalAuthorizations: props.totalAuthorizations,
|
|
58
144
|
}),
|
|
59
145
|
enforceFunctionCall: true,
|
|
60
146
|
message: StringUtil.trim`
|
|
61
|
-
Correct the TypeScript code implementation
|
|
62
|
-
|
|
63
|
-
1. Ensure that the code is production-ready and follows best practices.
|
|
147
|
+
Correct the TypeScript code implementation.
|
|
64
148
|
`,
|
|
65
149
|
});
|
|
66
150
|
|
|
67
151
|
if (pointer.value === null)
|
|
68
152
|
throw new Error("Failed to correct implementation code.");
|
|
69
153
|
|
|
70
|
-
pointer.value.implementationCode = await replaceImportStatements(ctx
|
|
71
|
-
|
|
72
|
-
pointer.value.implementationCode,
|
|
73
|
-
props.authorization?.payload.name,
|
|
74
|
-
);
|
|
154
|
+
pointer.value.revise.implementationCode = await replaceImportStatements(ctx, {
|
|
155
|
+
operation: props.scenario.operation,
|
|
156
|
+
code: pointer.value.revise.implementationCode,
|
|
157
|
+
decoratorType: props.authorization?.payload.name,
|
|
158
|
+
});
|
|
75
159
|
|
|
76
160
|
const event: AutoBeRealizeCorrectEvent = {
|
|
77
161
|
type: "realizeCorrect",
|
|
78
162
|
id: v7(),
|
|
79
163
|
location: props.scenario.location,
|
|
80
|
-
content: pointer.value.implementationCode,
|
|
164
|
+
content: pointer.value.revise.implementationCode,
|
|
81
165
|
tokenUsage,
|
|
82
166
|
completed: ++props.progress.completed,
|
|
83
167
|
total: props.progress.total,
|
|
@@ -120,3 +204,8 @@ const collection = {
|
|
|
120
204
|
deepseek: claude,
|
|
121
205
|
"3.1": claude,
|
|
122
206
|
};
|
|
207
|
+
|
|
208
|
+
interface IProgress {
|
|
209
|
+
total: number;
|
|
210
|
+
completed: number;
|
|
211
|
+
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import { ILlmSchema } from "@samchon/openapi";
|
|
7
7
|
|
|
8
8
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
9
|
-
import {
|
|
9
|
+
import { IAutoBeRealizeScenarioResult } from "./structures/IAutoBeRealizeScenarioResult";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Generates a planning result that defines what kind of function should be
|
|
@@ -32,7 +32,7 @@ export const orchestrateRealizeScenario = <Model extends ILlmSchema.Model>(
|
|
|
32
32
|
ctx: AutoBeContext<Model>,
|
|
33
33
|
operation: AutoBeOpenApi.IOperation,
|
|
34
34
|
authorization?: AutoBeRealizeAuthorization,
|
|
35
|
-
):
|
|
35
|
+
): IAutoBeRealizeScenarioResult => {
|
|
36
36
|
const testFiles: AutoBeTestFile[] =
|
|
37
37
|
ctx
|
|
38
38
|
.state()
|
|
@@ -11,11 +11,10 @@ import { v7 } from "uuid";
|
|
|
11
11
|
|
|
12
12
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
13
13
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
14
|
-
import { getTestScenarioArtifacts } from "../test/compile/getTestScenarioArtifacts";
|
|
15
|
-
import { IAutoBeTestScenarioArtifacts } from "../test/structures/IAutoBeTestScenarioArtifacts";
|
|
16
14
|
import { transformRealizeWriteHistories } from "./histories/transformRealizeWriteHistories";
|
|
17
|
-
import {
|
|
15
|
+
import { IAutoBeRealizeScenarioResult } from "./structures/IAutoBeRealizeScenarioResult";
|
|
18
16
|
import { IAutoBeRealizeWriteApplication } from "./structures/IAutoBeRealizeWriteApplication";
|
|
17
|
+
import { getRealizeWriteDto } from "./utils/getRealizeWriteDto";
|
|
19
18
|
import { replaceImportStatements } from "./utils/replaceImportStatements";
|
|
20
19
|
|
|
21
20
|
export async function orchestrateRealizeWrite<Model extends ILlmSchema.Model>(
|
|
@@ -23,27 +22,24 @@ export async function orchestrateRealizeWrite<Model extends ILlmSchema.Model>(
|
|
|
23
22
|
props: {
|
|
24
23
|
totalAuthorizations: AutoBeRealizeAuthorization[];
|
|
25
24
|
authorization: AutoBeRealizeAuthorization | null;
|
|
26
|
-
scenario:
|
|
25
|
+
scenario: IAutoBeRealizeScenarioResult;
|
|
27
26
|
progress: AutoBeProgressEventBase;
|
|
28
27
|
promptCacheKey: string;
|
|
29
28
|
},
|
|
30
29
|
): Promise<AutoBeRealizeWriteEvent> {
|
|
31
|
-
const artifacts: IAutoBeTestScenarioArtifacts =
|
|
32
|
-
await getTestScenarioArtifacts(ctx, {
|
|
33
|
-
endpoint: props.scenario.operation,
|
|
34
|
-
dependencies: [],
|
|
35
|
-
});
|
|
36
30
|
const pointer: IPointer<IAutoBeRealizeWriteApplication.IProps | null> = {
|
|
37
31
|
value: null,
|
|
38
32
|
};
|
|
33
|
+
|
|
34
|
+
const dto = await getRealizeWriteDto(ctx, props.scenario.operation);
|
|
39
35
|
const { tokenUsage } = await ctx.conversate({
|
|
40
36
|
source: "realizeWrite",
|
|
41
37
|
histories: transformRealizeWriteHistories({
|
|
42
38
|
state: ctx.state(),
|
|
43
39
|
scenario: props.scenario,
|
|
44
|
-
artifacts,
|
|
45
40
|
authorization: props.authorization,
|
|
46
41
|
totalAuthorizations: props.totalAuthorizations,
|
|
42
|
+
dto,
|
|
47
43
|
}),
|
|
48
44
|
controller: createController({
|
|
49
45
|
model: ctx.model,
|
|
@@ -73,11 +69,11 @@ export async function orchestrateRealizeWrite<Model extends ILlmSchema.Model>(
|
|
|
73
69
|
});
|
|
74
70
|
if (pointer.value === null) throw new Error("Failed to write code.");
|
|
75
71
|
|
|
76
|
-
pointer.value.implementationCode = await replaceImportStatements(ctx
|
|
77
|
-
|
|
78
|
-
pointer.value.implementationCode,
|
|
79
|
-
props.authorization?.payload.name,
|
|
80
|
-
);
|
|
72
|
+
pointer.value.implementationCode = await replaceImportStatements(ctx, {
|
|
73
|
+
operation: props.scenario.operation,
|
|
74
|
+
code: pointer.value.implementationCode,
|
|
75
|
+
decoratorType: props.authorization?.payload.name,
|
|
76
|
+
});
|
|
81
77
|
|
|
82
78
|
const event: AutoBeRealizeWriteEvent = {
|
|
83
79
|
type: "realizeWrite",
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import { CamelPattern, PascalPattern } from "@autobe/interface";
|
|
2
2
|
|
|
3
3
|
export interface IAutoBeRealizeAuthorizationApplication {
|
|
4
|
+
/**
|
|
5
|
+
* Generates authentication provider, decorator, and payload type for role-based authorization.
|
|
6
|
+
*
|
|
7
|
+
* This method creates a complete authentication infrastructure for a specific
|
|
8
|
+
* role in the NestJS application. It generates three interconnected components
|
|
9
|
+
* that work together to provide JWT-based authentication and authorization.
|
|
10
|
+
*
|
|
11
|
+
* The generated components include:
|
|
12
|
+
* - **Provider Function**: Handles JWT verification and user validation from database
|
|
13
|
+
* - **Decorator**: NestJS parameter decorator for injecting authenticated user data
|
|
14
|
+
* - **Payload Type**: TypeScript interface defining the authenticated user structure
|
|
15
|
+
*
|
|
16
|
+
* All components follow strict naming conventions and integrate with the existing
|
|
17
|
+
* authentication architecture using the shared jwtAuthorize function.
|
|
18
|
+
*
|
|
19
|
+
* @param next Properties containing provider, decorator, and payload type configurations
|
|
20
|
+
*/
|
|
4
21
|
createDecorator: (
|
|
5
22
|
next: IAutoBeRealizeAuthorizationApplication.IProps,
|
|
6
23
|
) => void;
|