@autobe/agent 0.25.7 → 0.27.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/AutoBeAgent.d.ts +2 -1
- package/lib/AutoBeAgent.js +30 -7
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/AutoBeMockAgent.js +13 -12
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +27 -20
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/context/AutoBeContext.d.ts +4 -1
- package/lib/context/AutoBeTokenUsage.d.ts +1 -1
- package/lib/context/AutoBeTokenUsage.js.map +1 -1
- package/lib/factory/AutoBeFunctionCallingMetricFactory.d.ts +7 -0
- package/lib/factory/AutoBeFunctionCallingMetricFactory.js +35 -0
- package/lib/factory/AutoBeFunctionCallingMetricFactory.js.map +1 -0
- package/lib/factory/AutoBeProcessAggregateFactory.d.ts +13 -0
- package/lib/factory/AutoBeProcessAggregateFactory.js +100 -0
- package/lib/factory/AutoBeProcessAggregateFactory.js.map +1 -0
- package/lib/factory/consentFunctionCall.js +3 -0
- package/lib/factory/consentFunctionCall.js.map +1 -1
- package/lib/factory/createAutoBeContext.d.ts +2 -1
- package/lib/factory/createAutoBeContext.js +82 -28
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/factory/getCommonPrompt.d.ts +2 -0
- package/lib/factory/getCommonPrompt.js +20 -0
- package/lib/factory/getCommonPrompt.js.map +1 -0
- package/lib/index.mjs +20929 -19874
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +2 -2
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +6 -6
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +2 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js +2 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +75 -74
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +5 -4
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +9 -9
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +1 -1
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +2 -17
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +1 -1
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.d.ts +6 -0
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js +58 -0
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js.map +1 -0
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.d.ts +2 -1
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +3 -2
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
- package/lib/{factory/createAutoBeApplication.d.ts → orchestrate/facade/createAutoBeFacadeController.d.ts} +2 -2
- package/lib/{factory/createAutoBeApplication.js → orchestrate/facade/createAutoBeFacadeController.js} +53 -57
- package/lib/orchestrate/facade/createAutoBeFacadeController.js.map +1 -0
- package/lib/orchestrate/facade/histories/IAutoBeFacadeApplication.js.map +1 -0
- package/lib/orchestrate/facade/histories/IAutoBeFacadeApplicationProps.js.map +1 -0
- package/lib/orchestrate/facade/histories/IAutoBeFacadeApplicationResult.js.map +1 -0
- package/lib/orchestrate/facade/{transformFacadeStateMessage.d.ts → structures/transformFacadeStateMessage.d.ts} +1 -1
- package/lib/orchestrate/facade/structures/transformFacadeStateMessage.js +46 -0
- package/lib/orchestrate/facade/structures/transformFacadeStateMessage.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +8 -8
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +3 -2
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +46 -20
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.d.ts +5 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js +51 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.d.ts +11 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js +81 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterface.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +33 -6
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +185 -97
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +234 -59
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +5 -4
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +0 -6
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +4 -4
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +4 -3
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +178 -90
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +176 -88
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +6 -5
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.d.ts +7 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +445 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.d.ts +14 -0
- package/lib/orchestrate/interface/{orchestrateInterfaceSchemasReview.js → orchestrateInterfaceSchemaReview.js} +302 -121
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +243 -65
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +22 -22
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +7 -7
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.d.ts +101 -0
- package/lib/orchestrate/interface/structures/{IAutobeInterfaceSchemasReviewApplication.js → IAutoBeInterfaceSchemaContentReviewApplication.js} +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.d.ts +97 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.d.ts +44 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.d.ts +92 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +65 -24
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +94 -0
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
- package/lib/orchestrate/interface/utils/OperationValidator.d.ts +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +13 -13
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.js +1 -0
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +2 -2
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +4 -3
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +2 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaReview.js +2 -1
- package/lib/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +2 -2
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +4 -3
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.d.ts +2 -2
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js +8 -7
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +4 -4
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.d.ts +4 -7
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +8 -18
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +0 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +8 -28
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +16 -280
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.d.ts +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.js +4 -3
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +14 -13
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +12 -11
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +46 -24
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.js → orchestrateRealizeCorrectCasting.js} +64 -51
- package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js +2 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +3 -3
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.d.ts +2 -2
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js +6 -6
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js.map +1 -1
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -1
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +2 -2
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteDto.js +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js +2 -2
- package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -1
- package/lib/orchestrate/realize/utils/printErrorHints.js +1 -1
- package/lib/orchestrate/realize/utils/printErrorHints.js.map +1 -1
- package/lib/orchestrate/realize/utils/replaceImportStatements.js +0 -85
- package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js +1 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +5 -22
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +10 -10
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +5 -5
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +2 -2
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTest.d.ts +1 -1
- package/lib/orchestrate/test/orchestrateTest.js +2 -1
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +5 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +4 -2
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +28 -27
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js +4 -3
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +2 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.d.ts → IAutoBeTestScenarioAuthorizationActor.d.ts} +1 -1
- package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.js → IAutoBeTestScenarioAuthorizationActor.js} +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationActor.js.map +1 -0
- package/lib/utils/TokenUsageComputer.d.ts +5 -0
- package/lib/utils/TokenUsageComputer.js +29 -0
- package/lib/utils/TokenUsageComputer.js.map +1 -0
- package/package.json +7 -7
- package/src/AutoBeAgent.ts +43 -6
- package/src/AutoBeMockAgent.ts +13 -12
- package/src/constants/AutoBeSystemPromptConstant.ts +27 -20
- package/src/context/AutoBeContext.ts +8 -0
- package/src/context/AutoBeTokenUsage.ts +1 -1
- package/src/factory/AutoBeFunctionCallingMetricFactory.ts +44 -0
- package/src/factory/AutoBeProcessAggregateFactory.ts +141 -0
- package/src/factory/consentFunctionCall.ts +4 -0
- package/src/factory/createAutoBeContext.ts +101 -37
- package/src/factory/getCommonPrompt.ts +25 -0
- package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +5 -5
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +2 -1
- package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +2 -1
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +5 -4
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +3 -2
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +9 -9
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +1 -1
- package/src/orchestrate/common/histories/transformCommonCorrectCastingHistories.ts +2 -20
- package/src/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.ts +65 -0
- package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +5 -2
- package/src/orchestrate/facade/createAutoBeFacadeController.ts +135 -0
- package/src/orchestrate/facade/{transformFacadeStateMessage.ts → structures/transformFacadeStateMessage.ts} +2 -2
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +9 -9
- package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +1 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +45 -20
- package/src/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.ts +55 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.ts +90 -0
- package/src/orchestrate/interface/orchestrateInterface.ts +47 -16
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +20 -19
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +2 -1
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +7 -6
- package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +5 -6
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +7 -6
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +25 -24
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +6 -5
- package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +4 -3
- package/src/orchestrate/interface/orchestrateInterfaceSchemaRename.ts +270 -0
- package/src/orchestrate/interface/{orchestrateInterfaceSchemasReview.ts → orchestrateInterfaceSchemaReview.ts} +89 -76
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +18 -9
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +26 -22
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +7 -7
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.ts +108 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.ts +104 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.ts +45 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.ts +99 -0
- package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +45 -3
- package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +110 -0
- package/src/orchestrate/interface/utils/OperationValidator.ts +1 -1
- package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +12 -12
- package/src/orchestrate/prisma/orchestratePrisma.ts +6 -5
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +6 -5
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +2 -1
- package/src/orchestrate/prisma/orchestratePrismaReview.ts +2 -1
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +9 -8
- package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +8 -7
- package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +4 -4
- package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +14 -28
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +13 -30
- package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +20 -285
- package/src/orchestrate/realize/orchestrateRealize.ts +4 -3
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +11 -10
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +5 -4
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +77 -62
- package/src/orchestrate/realize/{orchestRateRealizeCorrectCasting.ts → orchestrateRealizeCorrectCasting.ts} +92 -90
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +2 -1
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +3 -3
- package/src/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.ts +10 -7
- package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -1
- package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +2 -2
- package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +1 -1
- package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +2 -2
- package/src/orchestrate/realize/utils/printErrorHints.ts +1 -1
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +0 -90
- package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +1 -1
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +6 -24
- package/src/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.ts +10 -10
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +12 -10
- package/src/orchestrate/test/orchestrateTest.ts +3 -2
- package/src/orchestrate/test/orchestrateTestCorrect.ts +5 -1
- package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +4 -2
- package/src/orchestrate/test/orchestrateTestScenario.ts +32 -31
- package/src/orchestrate/test/orchestrateTestScenarioReview.ts +4 -3
- package/src/orchestrate/test/orchestrateTestWrite.ts +2 -1
- package/src/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.ts → IAutoBeTestScenarioAuthorizationActor.ts} +1 -1
- package/src/utils/TokenUsageComputer.ts +35 -0
- package/lib/context/IAutoBeFacadeApplication.js.map +0 -1
- package/lib/context/IAutoBeFacadeApplicationProps.js.map +0 -1
- package/lib/context/IAutoBeFacadeApplicationResult.js.map +0 -1
- package/lib/factory/createAutoBeApplication.js.map +0 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js +0 -46
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +0 -4
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +0 -60
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +0 -9
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +0 -1
- package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +0 -91
- package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.js.map +0 -1
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +0 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.js.map +0 -1
- package/src/factory/createAutoBeApplication.ts +0 -123
- package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +0 -67
- package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +0 -96
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.d.ts +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.js +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.d.ts +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.js +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.d.ts +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.js +0 -0
- /package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.d.ts → orchestrateRealizeCorrectCasting.d.ts} +0 -0
- /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.ts +0 -0
- /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.ts +0 -0
- /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.ts +0 -0
|
@@ -13,6 +13,7 @@ export namespace JsonSchemaValidator {
|
|
|
13
13
|
export const validateSchemas = (props: IProps): void => {
|
|
14
14
|
validateAuthorization(props);
|
|
15
15
|
validatePrismaSchema(props.errors);
|
|
16
|
+
validateRecursive(props);
|
|
16
17
|
for (const key of Object.keys(props.schemas))
|
|
17
18
|
validateKey({
|
|
18
19
|
errors: props.errors,
|
|
@@ -174,4 +175,113 @@ export namespace JsonSchemaValidator {
|
|
|
174
175
|
`;
|
|
175
176
|
}
|
|
176
177
|
};
|
|
178
|
+
|
|
179
|
+
const validateRecursive = (props: IProps): void => {
|
|
180
|
+
for (const [key, value] of Object.entries(props.schemas)) {
|
|
181
|
+
const report = (description: string) =>
|
|
182
|
+
props.errors.push({
|
|
183
|
+
path: `${props.path}[${JSON.stringify(key)}]`,
|
|
184
|
+
expected: "Non-infinite recursive schema definition",
|
|
185
|
+
value,
|
|
186
|
+
description,
|
|
187
|
+
});
|
|
188
|
+
if (
|
|
189
|
+
AutoBeOpenApiTypeChecker.isReference(value) &&
|
|
190
|
+
value.$ref === `#/components/schemas/${key}`
|
|
191
|
+
)
|
|
192
|
+
report(StringUtil.trim`
|
|
193
|
+
You have defined a nonsensible type like below:
|
|
194
|
+
|
|
195
|
+
\`\`\`typescript
|
|
196
|
+
type ${key} = ${key};
|
|
197
|
+
\`\`\`
|
|
198
|
+
|
|
199
|
+
This is an infinite recursive type definition that cannot exist in any
|
|
200
|
+
programming language. A type cannot be defined as itself - this creates
|
|
201
|
+
a circular definition with no base case, making the type impossible to
|
|
202
|
+
instantiate or validate.
|
|
203
|
+
|
|
204
|
+
If you need tree or graph structures, use explicit relationships with
|
|
205
|
+
ID references (e.g., parentId: string) instead of recursive type definitions.
|
|
206
|
+
Remove the self-reference and redesign the schema at the next time.
|
|
207
|
+
`);
|
|
208
|
+
else if (
|
|
209
|
+
AutoBeOpenApiTypeChecker.isArray(value) &&
|
|
210
|
+
AutoBeOpenApiTypeChecker.isReference(value.items) &&
|
|
211
|
+
value.items.$ref === `#/components/schemas/${key}`
|
|
212
|
+
)
|
|
213
|
+
report(StringUtil.trim`
|
|
214
|
+
You have defined a nonsensible type like below:
|
|
215
|
+
|
|
216
|
+
\`\`\`typescript
|
|
217
|
+
type ${key} = Array<${key}>;
|
|
218
|
+
\`\`\`
|
|
219
|
+
|
|
220
|
+
This is an infinite recursive array type that cannot exist in any
|
|
221
|
+
programming language. An array of itself creates a circular definition
|
|
222
|
+
with no base case, making the type impossible to instantiate or validate.
|
|
223
|
+
|
|
224
|
+
If you need nested structures, define explicit depth levels with separate
|
|
225
|
+
types, or use parent-child relationships with ID references.
|
|
226
|
+
Remove the self-reference and redesign the schema at the next time.
|
|
227
|
+
`);
|
|
228
|
+
else if (
|
|
229
|
+
AutoBeOpenApiTypeChecker.isOneOf(value) &&
|
|
230
|
+
value.oneOf.some(
|
|
231
|
+
(v) =>
|
|
232
|
+
AutoBeOpenApiTypeChecker.isReference(v) &&
|
|
233
|
+
v.$ref === `#/components/schemas/${key}`,
|
|
234
|
+
) === true
|
|
235
|
+
)
|
|
236
|
+
report(StringUtil.trim`
|
|
237
|
+
You have defined a nonsensible type like below:
|
|
238
|
+
|
|
239
|
+
\`\`\`typescript
|
|
240
|
+
type ${key} = ${key} | ...;
|
|
241
|
+
\`\`\`
|
|
242
|
+
|
|
243
|
+
This is an infinite recursive union type that cannot exist in any
|
|
244
|
+
programming language. A union that includes itself as a variant creates
|
|
245
|
+
a circular definition with no base case, making the type impossible to
|
|
246
|
+
instantiate or validate.
|
|
247
|
+
|
|
248
|
+
If you need polymorphic hierarchies, define separate concrete types for
|
|
249
|
+
each variant without including the union type itself as a variant.
|
|
250
|
+
Remove the self-reference and redesign the schema at the next time.
|
|
251
|
+
`);
|
|
252
|
+
else if (
|
|
253
|
+
AutoBeOpenApiTypeChecker.isObject(value) &&
|
|
254
|
+
value.properties &&
|
|
255
|
+
value.required &&
|
|
256
|
+
Object.entries(value.properties).some(
|
|
257
|
+
([k, v]) =>
|
|
258
|
+
AutoBeOpenApiTypeChecker.isReference(v) &&
|
|
259
|
+
v.$ref === `#/components/schemas/${key}` &&
|
|
260
|
+
value.required.includes(k),
|
|
261
|
+
)
|
|
262
|
+
)
|
|
263
|
+
report(StringUtil.trim`
|
|
264
|
+
You have defined a nonsensible type like below:
|
|
265
|
+
|
|
266
|
+
\`\`\`typescript
|
|
267
|
+
interface ${key} {
|
|
268
|
+
someProperty: ${key}; // required, non-nullable
|
|
269
|
+
}
|
|
270
|
+
\`\`\`
|
|
271
|
+
|
|
272
|
+
This is an infinite recursive object type that cannot exist in any
|
|
273
|
+
programming language. A required non-nullable property referencing its
|
|
274
|
+
own type creates a circular definition with no base case, making the
|
|
275
|
+
type impossible to instantiate.
|
|
276
|
+
|
|
277
|
+
To create an instance of ${key}, you would need an instance of ${key},
|
|
278
|
+
which requires another instance of ${key}, infinitely. This is logically
|
|
279
|
+
impossible.
|
|
280
|
+
|
|
281
|
+
If you need parent-child or graph relationships, make the self-referencing
|
|
282
|
+
property either nullable or optional, or use ID references (e.g., parentId: string).
|
|
283
|
+
Remove the required self-reference and redesign the schema at the next time.
|
|
284
|
+
`);
|
|
285
|
+
}
|
|
286
|
+
};
|
|
177
287
|
}
|
|
@@ -65,19 +65,19 @@ export const transformPrismaComponentsHistories = (
|
|
|
65
65
|
- \`mv_shopping_daily_stats\`
|
|
66
66
|
|
|
67
67
|
${
|
|
68
|
-
state.analyze.
|
|
68
|
+
state.analyze.actors.length > 0
|
|
69
69
|
? StringUtil.trim`
|
|
70
|
-
## User
|
|
71
|
-
|
|
72
|
-
The Requirement Analysis Report contains the following user
|
|
73
|
-
|
|
74
|
-
**Do not normalize** user
|
|
75
|
-
Instead, create separate tables for each distinct
|
|
76
|
-
|
|
77
|
-
Create separate tables for each
|
|
78
|
-
|
|
79
|
-
${state.analyze.
|
|
80
|
-
.map((
|
|
70
|
+
## User Actor Handling
|
|
71
|
+
|
|
72
|
+
The Requirement Analysis Report contains the following user actors: ${state.analyze.actors.join(", ")}
|
|
73
|
+
|
|
74
|
+
**Do not normalize** user actors into a single table.
|
|
75
|
+
Instead, create separate tables for each distinct actor mentioned in the requirements.
|
|
76
|
+
|
|
77
|
+
Create separate tables for each actor:
|
|
78
|
+
|
|
79
|
+
${state.analyze.actors
|
|
80
|
+
.map((actor) => `- ${props.prefix}_${actor.name.toLowerCase()}`)
|
|
81
81
|
.join("\n")}
|
|
82
82
|
`
|
|
83
83
|
: ""
|
|
@@ -2,19 +2,19 @@ import {
|
|
|
2
2
|
AutoBeAssistantMessageHistory,
|
|
3
3
|
AutoBePrisma,
|
|
4
4
|
AutoBePrismaCompleteEvent,
|
|
5
|
-
|
|
5
|
+
AutoBePrismaComponentEvent,
|
|
6
6
|
AutoBePrismaHistory,
|
|
7
7
|
AutoBePrismaReviewEvent,
|
|
8
8
|
IAutoBeCompiler,
|
|
9
9
|
IAutoBePrismaValidation,
|
|
10
10
|
} from "@autobe/interface";
|
|
11
|
-
import {
|
|
11
|
+
import { AutoBePrismaSchemaEvent } from "@autobe/interface/src/events/AutoBePrismaSchemaEvent";
|
|
12
12
|
import { ILlmSchema } from "@samchon/openapi";
|
|
13
13
|
import { v7 } from "uuid";
|
|
14
14
|
|
|
15
15
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
16
|
-
import { IAutoBeFacadeApplicationProps } from "../../context/IAutoBeFacadeApplicationProps";
|
|
17
16
|
import { predicateStateMessage } from "../../utils/predicateStateMessage";
|
|
17
|
+
import { IAutoBeFacadeApplicationProps } from "../facade/histories/IAutoBeFacadeApplicationProps";
|
|
18
18
|
import { orchestratePrismaComponents } from "./orchestratePrismaComponent";
|
|
19
19
|
import { orchestratePrismaCorrect } from "./orchestratePrismaCorrect";
|
|
20
20
|
import { orchestratePrismaReview } from "./orchestratePrismaReview";
|
|
@@ -44,12 +44,12 @@ export const orchestratePrisma = async <Model extends ILlmSchema.Model>(
|
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
// COMPONENTS
|
|
47
|
-
const componentEvent:
|
|
47
|
+
const componentEvent: AutoBePrismaComponentEvent =
|
|
48
48
|
await orchestratePrismaComponents(ctx, props.instruction);
|
|
49
49
|
ctx.dispatch(componentEvent);
|
|
50
50
|
|
|
51
51
|
// CONSTRUCT AST DATA
|
|
52
|
-
const schemaEvents:
|
|
52
|
+
const schemaEvents: AutoBePrismaSchemaEvent[] =
|
|
53
53
|
await orchestratePrismaSchemas(
|
|
54
54
|
ctx,
|
|
55
55
|
props.instruction,
|
|
@@ -104,6 +104,7 @@ export const orchestratePrisma = async <Model extends ILlmSchema.Model>(
|
|
|
104
104
|
compiled: await compiler.prisma.compile({
|
|
105
105
|
files: finalSchemas,
|
|
106
106
|
}),
|
|
107
|
+
aggregates: ctx.getCurrentAggregates("prisma"),
|
|
107
108
|
step: ctx.state().analyze?.step ?? 0,
|
|
108
109
|
elapsed: new Date().getTime() - start.getTime(),
|
|
109
110
|
created_at: new Date().toISOString(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
|
-
import {
|
|
2
|
+
import { AutoBePrismaComponentEvent } from "@autobe/interface/src/events/AutoBePrismaComponentEvent";
|
|
3
3
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
4
4
|
import { IPointer } from "tstl";
|
|
5
5
|
import typia from "typia";
|
|
@@ -16,14 +16,14 @@ export async function orchestratePrismaComponents<
|
|
|
16
16
|
ctx: AutoBeContext<Model>,
|
|
17
17
|
instruction: string,
|
|
18
18
|
message: string = "Design database from the given requirement analysis documents.",
|
|
19
|
-
): Promise<
|
|
19
|
+
): Promise<AutoBePrismaComponentEvent> {
|
|
20
20
|
const start: Date = new Date();
|
|
21
21
|
const pointer: IPointer<IAutoBePrismaComponentApplication.IProps | null> = {
|
|
22
22
|
value: null,
|
|
23
23
|
};
|
|
24
24
|
const prefix: string | null = ctx.state().analyze?.prefix ?? null;
|
|
25
|
-
const { tokenUsage } = await ctx.conversate({
|
|
26
|
-
source: "
|
|
25
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
26
|
+
source: "prismaComponent",
|
|
27
27
|
histories: transformPrismaComponentsHistories(ctx.state(), {
|
|
28
28
|
prefix,
|
|
29
29
|
instruction,
|
|
@@ -40,13 +40,14 @@ export async function orchestratePrismaComponents<
|
|
|
40
40
|
if (pointer.value === null)
|
|
41
41
|
throw new Error("Failed to extract files and tables."); // unreachable
|
|
42
42
|
return {
|
|
43
|
-
type: "
|
|
43
|
+
type: "prismaComponent",
|
|
44
44
|
id: v7(),
|
|
45
45
|
created_at: start.toISOString(),
|
|
46
46
|
thinking: pointer.value.thinking,
|
|
47
47
|
review: pointer.value.review,
|
|
48
48
|
decision: pointer.value.decision,
|
|
49
49
|
components: pointer.value.components,
|
|
50
|
+
metric,
|
|
50
51
|
tokenUsage,
|
|
51
52
|
step: ctx.state().analyze?.step ?? 0,
|
|
52
53
|
};
|
|
@@ -116,7 +116,7 @@ async function execute<Model extends ILlmSchema.Model>(
|
|
|
116
116
|
const pointer: IPointer<IAutoBePrismaCorrectApplication.IProps | null> = {
|
|
117
117
|
value: null,
|
|
118
118
|
};
|
|
119
|
-
const { tokenUsage } = await ctx.conversate({
|
|
119
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
120
120
|
source: "prismaCorrect",
|
|
121
121
|
histories: transformPrismaCorrectHistories(failure),
|
|
122
122
|
controller: createController({
|
|
@@ -149,6 +149,7 @@ async function execute<Model extends ILlmSchema.Model>(
|
|
|
149
149
|
failure,
|
|
150
150
|
planning: pointer.value.planning,
|
|
151
151
|
correction: correction,
|
|
152
|
+
metric,
|
|
152
153
|
tokenUsage,
|
|
153
154
|
step: ctx.state().analyze?.step ?? 0,
|
|
154
155
|
created_at: new Date().toISOString(),
|
|
@@ -56,7 +56,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
56
56
|
const pointer: IPointer<IAutoBePrismaReviewApplication.IProps | null> = {
|
|
57
57
|
value: null,
|
|
58
58
|
};
|
|
59
|
-
const { tokenUsage } = await ctx.conversate({
|
|
59
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
60
60
|
source: "prismaReview",
|
|
61
61
|
histories: transformPrismaReviewHistories({
|
|
62
62
|
analysis:
|
|
@@ -90,6 +90,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
90
90
|
review: pointer.value.review,
|
|
91
91
|
plan: pointer.value.plan,
|
|
92
92
|
modifications: pointer.value.modifications,
|
|
93
|
+
metric,
|
|
93
94
|
tokenUsage,
|
|
94
95
|
completed: ++props.progress.completed,
|
|
95
96
|
total: props.progress.total,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
2
|
import { AutoBePrisma } from "@autobe/interface";
|
|
3
|
-
import {
|
|
3
|
+
import { AutoBePrismaSchemaEvent } from "@autobe/interface/src/events/AutoBePrismaSchemaEvent";
|
|
4
4
|
import { StringUtil } from "@autobe/utils";
|
|
5
5
|
import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
|
|
6
6
|
import { IPointer } from "tstl";
|
|
@@ -17,7 +17,7 @@ export async function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(
|
|
|
17
17
|
ctx: AutoBeContext<Model>,
|
|
18
18
|
instruction: string,
|
|
19
19
|
componentList: AutoBePrisma.IComponent[],
|
|
20
|
-
): Promise<
|
|
20
|
+
): Promise<AutoBePrismaSchemaEvent[]> {
|
|
21
21
|
const start: Date = new Date();
|
|
22
22
|
const total: number = componentList
|
|
23
23
|
.map((c) => c.tables.length)
|
|
@@ -29,7 +29,7 @@ export async function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(
|
|
|
29
29
|
.filter((y) => component !== y)
|
|
30
30
|
.map((c) => c.tables)
|
|
31
31
|
.flat();
|
|
32
|
-
const event:
|
|
32
|
+
const event: AutoBePrismaSchemaEvent = await process(ctx, {
|
|
33
33
|
instruction,
|
|
34
34
|
component,
|
|
35
35
|
otherTables,
|
|
@@ -55,12 +55,12 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
55
55
|
completed: IPointer<number>;
|
|
56
56
|
promptCacheKey: string;
|
|
57
57
|
},
|
|
58
|
-
): Promise<
|
|
58
|
+
): Promise<AutoBePrismaSchemaEvent> {
|
|
59
59
|
const pointer: IPointer<IAutoBePrismaSchemaApplication.IProps | null> = {
|
|
60
60
|
value: null,
|
|
61
61
|
};
|
|
62
|
-
const { tokenUsage } = await ctx.conversate({
|
|
63
|
-
source: "
|
|
62
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
63
|
+
source: "prismaSchema",
|
|
64
64
|
histories: transformPrismaSchemaHistories({
|
|
65
65
|
analysis:
|
|
66
66
|
ctx
|
|
@@ -87,7 +87,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
87
87
|
if (pointer.value === null)
|
|
88
88
|
throw new Error("Unreachable code: Prisma Schema not generated");
|
|
89
89
|
return {
|
|
90
|
-
type: "
|
|
90
|
+
type: "prismaSchema",
|
|
91
91
|
id: v7(),
|
|
92
92
|
created_at: props.start.toISOString(),
|
|
93
93
|
plan: pointer.value.plan,
|
|
@@ -97,11 +97,12 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
97
97
|
namespace: props.component.namespace,
|
|
98
98
|
models: pointer.value.models,
|
|
99
99
|
},
|
|
100
|
+
metric,
|
|
100
101
|
tokenUsage,
|
|
101
102
|
completed: (props.completed.value += props.component.tables.length),
|
|
102
103
|
total: props.total,
|
|
103
104
|
step: ctx.state().analyze?.step ?? 0,
|
|
104
|
-
} satisfies
|
|
105
|
+
} satisfies AutoBePrismaSchemaEvent;
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
function createController<Model extends ILlmSchema.Model>(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
-
import {
|
|
2
|
+
import { AutoBeAnalyzeActor } from "@autobe/interface";
|
|
3
3
|
import { StringUtil } from "@autobe/utils";
|
|
4
4
|
import { ILlmSchema } from "@samchon/openapi";
|
|
5
5
|
import { v7 } from "uuid";
|
|
@@ -11,7 +11,7 @@ export const transformRealizeAuthorizationHistories = <
|
|
|
11
11
|
Model extends ILlmSchema.Model,
|
|
12
12
|
>(
|
|
13
13
|
ctx: AutoBeContext<Model>,
|
|
14
|
-
|
|
14
|
+
actor: AutoBeAnalyzeActor,
|
|
15
15
|
): Array<
|
|
16
16
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
17
17
|
> => {
|
|
@@ -27,9 +27,10 @@ export const transformRealizeAuthorizationHistories = <
|
|
|
27
27
|
created_at: new Date().toISOString(),
|
|
28
28
|
type: "systemMessage",
|
|
29
29
|
text: StringUtil.trim`
|
|
30
|
-
##
|
|
30
|
+
## Actor
|
|
31
|
+
|
|
31
32
|
\`\`\`json
|
|
32
|
-
${JSON.stringify(
|
|
33
|
+
${JSON.stringify(actor)}
|
|
33
34
|
\`\`\`
|
|
34
35
|
|
|
35
36
|
## Prisma Schema
|
|
@@ -42,9 +43,9 @@ export const transformRealizeAuthorizationHistories = <
|
|
|
42
43
|
|
|
43
44
|
Please follow this naming convention for the authorization components:
|
|
44
45
|
|
|
45
|
-
- Provider Name: ${
|
|
46
|
-
- Decorator Name: ${
|
|
47
|
-
- Payload Name: ${
|
|
46
|
+
- Provider Name: ${actor.name}Authorize (e.g. ${actor.name}Authorize)
|
|
47
|
+
- Decorator Name: ${actor.name.charAt(0).toUpperCase() + actor.name.slice(1)}Auth (e.g. ${actor.name.charAt(0).toUpperCase() + actor.name.slice(1)}Auth)
|
|
48
|
+
- Payload Name: ${actor.name.charAt(0).toUpperCase() + actor.name.slice(1)}Payload (e.g. ${actor.name.charAt(0).toUpperCase() + actor.name.slice(1)}Payload)
|
|
48
49
|
`,
|
|
49
50
|
},
|
|
50
51
|
];
|
|
@@ -57,7 +57,7 @@ export const transformRealizeAuthorizationCorrectHistories = <
|
|
|
57
57
|
name: auth.payload.name,
|
|
58
58
|
content: auth.payload.content,
|
|
59
59
|
},
|
|
60
|
-
} satisfies Omit<AutoBeRealizeAuthorization, "
|
|
60
|
+
} satisfies Omit<AutoBeRealizeAuthorization, "actor">)}
|
|
61
61
|
\`\`\`
|
|
62
62
|
|
|
63
63
|
## Prisma Schema
|
|
@@ -86,9 +86,9 @@ export const transformRealizeAuthorizationCorrectHistories = <
|
|
|
86
86
|
|
|
87
87
|
Please follow this naming convention for the authorization components:
|
|
88
88
|
|
|
89
|
-
- Provider Name: ${auth.
|
|
90
|
-
- Decorator Name: ${auth.
|
|
91
|
-
- Payload Name: ${auth.
|
|
89
|
+
- Provider Name: ${auth.actor.name.toLowerCase()}Authorize (e.g. ${auth.actor.name.toLowerCase()}Authorize)
|
|
90
|
+
- Decorator Name: ${auth.actor.name.charAt(0).toUpperCase() + auth.actor.name.slice(1).toLowerCase()}Auth (e.g. ${auth.actor.name.charAt(0).toUpperCase() + auth.actor.name.slice(1).toLowerCase()}Auth)
|
|
91
|
+
- Payload Name: ${auth.actor.name.charAt(0).toUpperCase() + auth.actor.name.slice(1).toLowerCase()}Payload (e.g. ${auth.actor.name.charAt(0).toUpperCase() + auth.actor.name.slice(1).toLowerCase()}Payload)
|
|
92
92
|
`,
|
|
93
93
|
},
|
|
94
94
|
];
|
|
@@ -1,44 +1,30 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
-
import { IAutoBeTypeScriptCompileResult } from "@autobe/interface";
|
|
3
|
-
import { StringUtil } from "@autobe/utils";
|
|
4
2
|
import { v7 } from "uuid";
|
|
5
3
|
|
|
6
4
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
7
|
-
import {
|
|
5
|
+
import { transformPreviousAndLatestCorrectHistories } from "../../common/histories/transformPreviousAndLatestCorrectHistories";
|
|
6
|
+
import { IAutoBeRealizeFunctionFailure } from "../structures/IAutoBeRealizeFunctionFailure";
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const transformRealizeCorrectCastingHistories = (
|
|
15
|
-
failures: IFailure[],
|
|
16
|
-
): Array<
|
|
8
|
+
export const transformRealizeCorrectCastingHistories = (props: {
|
|
9
|
+
failures: IAutoBeRealizeFunctionFailure[];
|
|
10
|
+
}): Array<
|
|
17
11
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
18
12
|
> => {
|
|
19
|
-
|
|
13
|
+
const histories: Array<
|
|
14
|
+
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
15
|
+
> = [
|
|
20
16
|
{
|
|
21
17
|
id: v7(),
|
|
22
18
|
created_at: new Date().toISOString(),
|
|
23
19
|
type: "systemMessage",
|
|
24
20
|
text: AutoBeSystemPromptConstant.COMMON_CORRECT_CASTING,
|
|
25
21
|
},
|
|
26
|
-
...
|
|
27
|
-
(f) =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
type: "assistantMessage",
|
|
32
|
-
text: StringUtil.trim`
|
|
33
|
-
# Errors
|
|
34
|
-
|
|
35
|
-
This is a past code and an error with the code.
|
|
36
|
-
Please refer to the annotation for the location of the error.
|
|
37
|
-
|
|
38
|
-
${printErrorHints(f.script, f.diagnostics)}
|
|
39
|
-
\`\`\`
|
|
40
|
-
`,
|
|
41
|
-
}) satisfies IAgenticaHistoryJson.IAssistantMessage,
|
|
22
|
+
...transformPreviousAndLatestCorrectHistories(
|
|
23
|
+
props.failures.map((f) => ({
|
|
24
|
+
script: f.function.content,
|
|
25
|
+
diagnostics: f.diagnostics,
|
|
26
|
+
})),
|
|
42
27
|
),
|
|
43
28
|
];
|
|
29
|
+
return histories;
|
|
44
30
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
2
|
import { AutoBeRealizeAuthorization } from "@autobe/interface";
|
|
3
|
-
import { StringUtil } from "@autobe/utils";
|
|
4
3
|
import { v7 } from "uuid";
|
|
5
4
|
|
|
6
5
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
7
6
|
import { AutoBeState } from "../../../context/AutoBeState";
|
|
7
|
+
import { transformPreviousAndLatestCorrectHistories } from "../../common/histories/transformPreviousAndLatestCorrectHistories";
|
|
8
8
|
import { IAutoBeRealizeFunctionFailure } from "../structures/IAutoBeRealizeFunctionFailure";
|
|
9
9
|
import { IAutoBeRealizeScenarioResult } from "../structures/IAutoBeRealizeScenarioResult";
|
|
10
|
-
import { printErrorHints } from "../utils/printErrorHints";
|
|
11
10
|
import { transformRealizeWriteHistories } from "./transformRealizeWriteHistories";
|
|
12
11
|
|
|
13
12
|
export function transformRealizeCorrectHistories(props: {
|
|
@@ -15,49 +14,33 @@ export function transformRealizeCorrectHistories(props: {
|
|
|
15
14
|
scenario: IAutoBeRealizeScenarioResult;
|
|
16
15
|
authorization: AutoBeRealizeAuthorization | null;
|
|
17
16
|
totalAuthorizations: AutoBeRealizeAuthorization[];
|
|
18
|
-
code: string;
|
|
19
17
|
dto: Record<string, string>;
|
|
20
18
|
failures: IAutoBeRealizeFunctionFailure[];
|
|
21
19
|
}): Array<
|
|
22
20
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
23
21
|
> {
|
|
24
|
-
|
|
22
|
+
const histories: Array<
|
|
23
|
+
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
24
|
+
> = [
|
|
25
25
|
...transformRealizeWriteHistories(props),
|
|
26
26
|
{
|
|
27
27
|
id: v7(),
|
|
28
28
|
created_at: new Date().toISOString(),
|
|
29
29
|
type: "systemMessage",
|
|
30
30
|
text: AutoBeSystemPromptConstant.COMMON_CORRECT_CASTING,
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
id: v7(),
|
|
34
|
-
type: "assistantMessage",
|
|
35
|
-
text: StringUtil.trim`
|
|
36
|
-
Below is the code you made before. It's also something to review.
|
|
37
|
-
|
|
38
|
-
\`\`\`typescript
|
|
39
|
-
${props.code}
|
|
40
|
-
\`\`\`
|
|
41
|
-
`,
|
|
42
|
-
created_at: new Date().toISOString(),
|
|
43
|
-
},
|
|
44
|
-
...props.failures.map((f) => {
|
|
45
|
-
return {
|
|
46
|
-
id: v7(),
|
|
47
|
-
type: "assistantMessage",
|
|
48
|
-
text: StringUtil.trim`
|
|
49
|
-
This is a past code and an error with the code. Please refer to the annotation for the location of the error.
|
|
50
|
-
|
|
51
|
-
${printErrorHints(f.function.content, f.diagnostics)}
|
|
52
|
-
`,
|
|
53
|
-
created_at: new Date().toISOString(),
|
|
54
|
-
} satisfies IAgenticaHistoryJson.IAssistantMessage;
|
|
55
|
-
}),
|
|
31
|
+
} as IAgenticaHistoryJson.ISystemMessage,
|
|
56
32
|
{
|
|
57
33
|
id: v7(),
|
|
58
34
|
type: "systemMessage",
|
|
59
35
|
text: AutoBeSystemPromptConstant.REALIZE_CORRECT,
|
|
60
36
|
created_at: new Date().toISOString(),
|
|
61
|
-
},
|
|
37
|
+
} as IAgenticaHistoryJson.ISystemMessage,
|
|
38
|
+
...transformPreviousAndLatestCorrectHistories(
|
|
39
|
+
props.failures.map((f) => ({
|
|
40
|
+
script: f.function.content,
|
|
41
|
+
diagnostics: f.diagnostics,
|
|
42
|
+
})),
|
|
43
|
+
),
|
|
62
44
|
];
|
|
45
|
+
return histories;
|
|
63
46
|
}
|