@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
|
@@ -24,6 +24,7 @@ import { validateEmptyCode } from "../../utils/validateEmptyCode";
|
|
|
24
24
|
import { IAutoBeCommonCorrectCastingApplication } from "../common/structures/IAutoBeCommonCorrectCastingApplication";
|
|
25
25
|
import { transformRealizeCorrectCastingHistories } from "./histories/transformRealizeCorrectCastingHistories";
|
|
26
26
|
import { compileRealizeFiles } from "./internal/compileRealizeFiles";
|
|
27
|
+
import { IAutoBeRealizeFunctionFailure } from "./structures/IAutoBeRealizeFunctionFailure";
|
|
27
28
|
import { IAutoBeRealizeScenarioResult } from "./structures/IAutoBeRealizeScenarioResult";
|
|
28
29
|
import { getRealizeWriteCodeTemplate } from "./utils/getRealizeWriteCodeTemplate";
|
|
29
30
|
import { replaceImportStatements } from "./utils/replaceImportStatements";
|
|
@@ -53,94 +54,103 @@ export const orchestrateRealizeCorrectCasting = async <
|
|
|
53
54
|
);
|
|
54
55
|
return predicate(
|
|
55
56
|
ctx,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
{
|
|
58
|
+
scenarios,
|
|
59
|
+
authorizations,
|
|
60
|
+
functions,
|
|
61
|
+
previousFailures: [],
|
|
62
|
+
progress,
|
|
63
|
+
event: validateEvent,
|
|
64
|
+
},
|
|
62
65
|
life,
|
|
63
66
|
);
|
|
64
67
|
};
|
|
65
68
|
|
|
66
69
|
const predicate = async <Model extends ILlmSchema.Model>(
|
|
67
70
|
ctx: AutoBeContext<Model>,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
props: {
|
|
72
|
+
scenarios: IAutoBeRealizeScenarioResult[];
|
|
73
|
+
authorizations: AutoBeRealizeAuthorization[];
|
|
74
|
+
functions: AutoBeRealizeFunction[];
|
|
75
|
+
previousFailures: IAutoBeRealizeFunctionFailure[][];
|
|
76
|
+
progress: AutoBeProgressEventBase;
|
|
77
|
+
event: AutoBeRealizeValidateEvent;
|
|
78
|
+
},
|
|
74
79
|
life: number,
|
|
75
80
|
): Promise<AutoBeRealizeFunction[]> => {
|
|
76
|
-
if (event.result.type === "failure") {
|
|
77
|
-
ctx.dispatch(event);
|
|
78
|
-
return await correct(
|
|
79
|
-
ctx,
|
|
80
|
-
scenarios,
|
|
81
|
-
authorizations,
|
|
82
|
-
functions,
|
|
83
|
-
[...failures, ...event.result.diagnostics],
|
|
84
|
-
progress,
|
|
85
|
-
event,
|
|
86
|
-
life,
|
|
87
|
-
);
|
|
81
|
+
if (props.event.result.type === "failure") {
|
|
82
|
+
ctx.dispatch(props.event);
|
|
83
|
+
return await correct(ctx, props, life);
|
|
88
84
|
}
|
|
89
|
-
return functions;
|
|
85
|
+
return props.functions;
|
|
90
86
|
};
|
|
91
87
|
|
|
92
88
|
const correct = async <Model extends ILlmSchema.Model>(
|
|
93
89
|
ctx: AutoBeContext<Model>,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
90
|
+
props: {
|
|
91
|
+
scenarios: IAutoBeRealizeScenarioResult[];
|
|
92
|
+
authorizations: AutoBeRealizeAuthorization[];
|
|
93
|
+
functions: AutoBeRealizeFunction[];
|
|
94
|
+
previousFailures: IAutoBeRealizeFunctionFailure[][];
|
|
95
|
+
progress: AutoBeProgressEventBase;
|
|
96
|
+
event: AutoBeRealizeValidateEvent;
|
|
97
|
+
},
|
|
100
98
|
life: number,
|
|
101
99
|
): Promise<AutoBeRealizeFunction[]> => {
|
|
102
100
|
// Early returns for non-correctable cases
|
|
103
|
-
if (event.result.type !== "failure" || life < 0) {
|
|
104
|
-
return functions;
|
|
101
|
+
if (props.event.result.type !== "failure" || life < 0) {
|
|
102
|
+
return props.functions;
|
|
105
103
|
}
|
|
106
104
|
|
|
107
|
-
const
|
|
108
|
-
|
|
105
|
+
const failure = props.event.result;
|
|
106
|
+
const locations: string[] = diagnose(props.event).filter((l) =>
|
|
107
|
+
props.functions.map((f) => f.location).includes(l),
|
|
109
108
|
);
|
|
110
109
|
|
|
111
110
|
// If no locations to correct, return original functions
|
|
112
111
|
if (locations.length === 0) {
|
|
113
|
-
return functions;
|
|
112
|
+
return props.functions;
|
|
114
113
|
}
|
|
115
114
|
|
|
116
|
-
progress.total += locations.length;
|
|
115
|
+
props.progress.total += locations.length;
|
|
117
116
|
|
|
118
117
|
const converted: CorrectionResult[] = await executeCachedBatch(
|
|
119
118
|
locations.map((location) => async (): Promise<CorrectionResult> => {
|
|
120
|
-
const func: AutoBeRealizeFunction = functions.find(
|
|
119
|
+
const func: AutoBeRealizeFunction = props.functions.find(
|
|
121
120
|
(f) => f.location === location,
|
|
122
121
|
)!;
|
|
123
|
-
const scenario: IAutoBeRealizeScenarioResult = scenarios.find(
|
|
122
|
+
const scenario: IAutoBeRealizeScenarioResult = props.scenarios.find(
|
|
124
123
|
(s) => s.location === func.location,
|
|
125
124
|
)!;
|
|
126
125
|
const operation: AutoBeOpenApi.IOperation = scenario.operation;
|
|
127
126
|
const authorization: AutoBeRealizeAuthorization | undefined =
|
|
128
|
-
authorizations.find(
|
|
127
|
+
props.authorizations.find(
|
|
128
|
+
(a) => a.actor.name === operation.authorizationActor,
|
|
129
|
+
);
|
|
129
130
|
|
|
130
131
|
const pointer: IPointer<
|
|
131
132
|
IAutoBeCommonCorrectCastingApplication.IProps | false | null
|
|
132
133
|
> = {
|
|
133
134
|
value: null,
|
|
134
135
|
};
|
|
135
|
-
|
|
136
|
-
const { tokenUsage } = await ctx.conversate({
|
|
136
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
137
137
|
source: "realizeCorrect",
|
|
138
|
-
histories: transformRealizeCorrectCastingHistories(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
histories: transformRealizeCorrectCastingHistories({
|
|
139
|
+
failures: [
|
|
140
|
+
...props.previousFailures
|
|
141
|
+
.map(
|
|
142
|
+
(pf) =>
|
|
143
|
+
pf.find((f) => f.function.location === func.location) ?? null,
|
|
144
|
+
)
|
|
145
|
+
.filter((x) => x !== null),
|
|
146
|
+
{
|
|
147
|
+
function: func,
|
|
148
|
+
diagnostics: failure.diagnostics.filter(
|
|
149
|
+
(d) => d.file === func.location,
|
|
150
|
+
),
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
}),
|
|
144
154
|
controller: createController({
|
|
145
155
|
model: ctx.model,
|
|
146
156
|
functionName: scenario.functionName,
|
|
@@ -155,13 +165,13 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
155
165
|
message: StringUtil.trim`
|
|
156
166
|
Fix the TypeScript casting problems to resolve the compilation error.
|
|
157
167
|
|
|
158
|
-
Most casting errors are caused by type mismatches between Date types and
|
|
168
|
+
Most casting errors are caused by type mismatches between Date types and
|
|
159
169
|
string & tags.Format<'date-time'>. To fix these:
|
|
160
170
|
- Use ONLY the pre-provided toISOStringSafe() function to convert Date to string
|
|
161
171
|
- Do NOT use .toISOString() method directly (use toISOStringSafe instead)
|
|
162
172
|
- Never use Date type directly in declarations or return values
|
|
163
173
|
|
|
164
|
-
You don't need to explain me anything, but just fix or give it up
|
|
174
|
+
You don't need to explain me anything, but just fix or give it up
|
|
165
175
|
immediately without any hesitation, explanation, and questions.
|
|
166
176
|
|
|
167
177
|
The instruction to write at first was as follows, and the code you received is the code you wrote according to this instruction.
|
|
@@ -185,16 +195,16 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
185
195
|
Also, never use typia.assert and typia.assertGuard like functions
|
|
186
196
|
to the Prisma types. Your mission is to fix the casting problem of
|
|
187
197
|
primitive types like string or number. Prisma type is not your scope.
|
|
188
|
-
|
|
198
|
+
|
|
189
199
|
If you take a mistake that casting the Prisma type with the typia.assert
|
|
190
200
|
function, it would be fallen into the infinite compilation due to extremely
|
|
191
|
-
complicated Prisma type. Note that, the typia.assert function is allowed
|
|
201
|
+
complicated Prisma type. Note that, the typia.assert function is allowed
|
|
192
202
|
only in the individual property level string or literal type.
|
|
193
203
|
|
|
194
204
|
I repeat that, never assert the Prisma type. It's not your mission.
|
|
195
205
|
`,
|
|
196
206
|
});
|
|
197
|
-
++progress.completed;
|
|
207
|
+
++props.progress.completed;
|
|
198
208
|
|
|
199
209
|
if (pointer.value === null)
|
|
200
210
|
return { result: "exception" as const, func: func };
|
|
@@ -218,13 +228,15 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
218
228
|
ctx.dispatch({
|
|
219
229
|
id: v7(),
|
|
220
230
|
type: "realizeCorrect",
|
|
231
|
+
kind: "casting",
|
|
221
232
|
content: pointer.value.revise.final ?? pointer.value.draft,
|
|
222
233
|
created_at: new Date().toISOString(),
|
|
223
234
|
location: func.location,
|
|
224
235
|
step: ctx.state().analyze?.step ?? 0,
|
|
236
|
+
metric,
|
|
225
237
|
tokenUsage,
|
|
226
|
-
completed: progress.completed,
|
|
227
|
-
total: progress.total,
|
|
238
|
+
completed: props.progress.completed,
|
|
239
|
+
total: props.progress.total,
|
|
228
240
|
});
|
|
229
241
|
return {
|
|
230
242
|
result: "success" as const,
|
|
@@ -237,7 +249,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
237
249
|
);
|
|
238
250
|
|
|
239
251
|
// Get functions that were not modified (not in locations array)
|
|
240
|
-
const unchangedFunctions: AutoBeRealizeFunction[] = functions.filter(
|
|
252
|
+
const unchangedFunctions: AutoBeRealizeFunction[] = props.functions.filter(
|
|
241
253
|
(f) => !locations.includes(f.location),
|
|
242
254
|
);
|
|
243
255
|
|
|
@@ -250,7 +262,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
250
262
|
const newValidate: AutoBeRealizeValidateEvent = await compileRealizeFiles(
|
|
251
263
|
ctx,
|
|
252
264
|
{
|
|
253
|
-
authorizations,
|
|
265
|
+
authorizations: props.authorizations,
|
|
254
266
|
functions: allFunctionsForValidation,
|
|
255
267
|
},
|
|
256
268
|
);
|
|
@@ -260,7 +272,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
260
272
|
return allFunctionsForValidation;
|
|
261
273
|
} else if (newResult.type === "exception") {
|
|
262
274
|
// Compilation exception, return current functions. because retrying won't help.
|
|
263
|
-
return functions;
|
|
275
|
+
return props.functions;
|
|
264
276
|
}
|
|
265
277
|
|
|
266
278
|
if (
|
|
@@ -283,27 +295,33 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
283
295
|
return [...success, ...ignored, ...unchangedFunctions];
|
|
284
296
|
}
|
|
285
297
|
|
|
286
|
-
// Collect diagnostics relevant to failed functions
|
|
287
|
-
const failedLocations: string[] = failed.map((f) => f.location);
|
|
288
|
-
const allDiagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[] = [
|
|
289
|
-
...failures,
|
|
290
|
-
...(newResult.type === "failure" ? newResult.diagnostics : []),
|
|
291
|
-
];
|
|
292
|
-
const relevantDiagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[] =
|
|
293
|
-
filterRelevantDiagnostics(allDiagnostics, failedLocations);
|
|
294
|
-
|
|
295
298
|
// Recursively retry failed functions
|
|
296
299
|
const retriedFunctions: AutoBeRealizeFunction[] = await predicate(
|
|
297
300
|
ctx,
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
301
|
+
{
|
|
302
|
+
scenarios: props.scenarios,
|
|
303
|
+
authorizations: props.authorizations,
|
|
304
|
+
functions: failed,
|
|
305
|
+
previousFailures: [
|
|
306
|
+
...props.previousFailures,
|
|
307
|
+
failed.map(
|
|
308
|
+
(f) =>
|
|
309
|
+
({
|
|
310
|
+
function: f,
|
|
311
|
+
diagnostics:
|
|
312
|
+
newValidate.result.type === "failure"
|
|
313
|
+
? newValidate.result.diagnostics.filter(
|
|
314
|
+
(d) => d.file === f.location,
|
|
315
|
+
)
|
|
316
|
+
: [],
|
|
317
|
+
}) satisfies IAutoBeRealizeFunctionFailure,
|
|
318
|
+
),
|
|
319
|
+
],
|
|
320
|
+
progress: props.progress,
|
|
321
|
+
event: newValidate,
|
|
322
|
+
},
|
|
304
323
|
life - 1,
|
|
305
324
|
);
|
|
306
|
-
|
|
307
325
|
return [...success, ...ignored, ...retriedFunctions, ...unchangedFunctions];
|
|
308
326
|
};
|
|
309
327
|
|
|
@@ -362,22 +380,6 @@ const separateCorrectionResults = (
|
|
|
362
380
|
return { success, failed, ignored };
|
|
363
381
|
};
|
|
364
382
|
|
|
365
|
-
/**
|
|
366
|
-
* Filter diagnostics to only include those relevant to specific functions
|
|
367
|
-
*
|
|
368
|
-
* @param diagnostics - All diagnostics
|
|
369
|
-
* @param functionLocations - Locations of functions to filter for
|
|
370
|
-
* @returns Filtered diagnostics
|
|
371
|
-
*/
|
|
372
|
-
const filterRelevantDiagnostics = (
|
|
373
|
-
diagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[],
|
|
374
|
-
functionLocations: string[],
|
|
375
|
-
): IAutoBeTypeScriptCompileResult.IDiagnostic[] => {
|
|
376
|
-
return diagnostics.filter(
|
|
377
|
-
(d) => d.file && functionLocations.includes(d.file),
|
|
378
|
-
);
|
|
379
|
-
};
|
|
380
|
-
|
|
381
383
|
const createController = <Model extends ILlmSchema.Model>(props: {
|
|
382
384
|
model: Model;
|
|
383
385
|
functionName: string;
|
|
@@ -40,7 +40,7 @@ export async function orchestrateRealizeWrite<Model extends ILlmSchema.Model>(
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
const dto = await getRealizeWriteDto(ctx, props.scenario.operation);
|
|
43
|
-
const { tokenUsage } = await ctx.conversate({
|
|
43
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
44
44
|
source: "realizeWrite",
|
|
45
45
|
histories: transformRealizeWriteHistories({
|
|
46
46
|
state: ctx.state(),
|
|
@@ -97,6 +97,7 @@ export async function orchestrateRealizeWrite<Model extends ILlmSchema.Model>(
|
|
|
97
97
|
id: v7(),
|
|
98
98
|
location: props.scenario.location,
|
|
99
99
|
content: pointer.value.revise.final ?? pointer.value.draft,
|
|
100
|
+
metric,
|
|
100
101
|
tokenUsage,
|
|
101
102
|
completed: ++props.progress.completed,
|
|
102
103
|
total: props.progress.total,
|
|
@@ -83,7 +83,7 @@ export namespace IAutoBeRealizeAuthorizationApplication {
|
|
|
83
83
|
|
|
84
84
|
export interface IDecorator {
|
|
85
85
|
/**
|
|
86
|
-
* The name of the Decorator to be generated in {
|
|
86
|
+
* The name of the Decorator to be generated in {Actor}Auth format (e.g.,
|
|
87
87
|
* AdminAuth, UserAuth). This decorator will be used as a parameter
|
|
88
88
|
* decorator in Controller methods to automatically authenticate and
|
|
89
89
|
* authorize users for the specific role, injecting the authenticated user
|
|
@@ -106,7 +106,7 @@ export namespace IAutoBeRealizeAuthorizationApplication {
|
|
|
106
106
|
|
|
107
107
|
export interface IPayloadType {
|
|
108
108
|
/**
|
|
109
|
-
* The name of the Payload type to be generated in {
|
|
109
|
+
* The name of the Payload type to be generated in {Actor}Payload format
|
|
110
110
|
* (e.g., AdminPayload, UserPayload). This type defines the structure of the
|
|
111
111
|
* authenticated user data that will be injected into Controller methods
|
|
112
112
|
* when using the decorator.
|
|
@@ -116,7 +116,7 @@ export namespace IAutoBeRealizeAuthorizationApplication {
|
|
|
116
116
|
name: string & PascalCasePattern;
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
|
-
* Complete TypeScript code for the Payload type interface in {
|
|
119
|
+
* Complete TypeScript code for the Payload type interface in {Actor}Payload
|
|
120
120
|
* format (e.g., AdminPayload, UserPayload). Must include: id field with
|
|
121
121
|
* UUID format validation, type field as role discriminator, and proper
|
|
122
122
|
* typia tags for validation. This interface defines the structure of the
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export namespace AutoBeRealizeAuthorizationReplaceImport {
|
|
2
|
-
export function replaceProviderImport(
|
|
2
|
+
export function replaceProviderImport(
|
|
3
|
+
actor: string,
|
|
4
|
+
content: string,
|
|
5
|
+
): string {
|
|
3
6
|
let updatedContent = content;
|
|
4
7
|
|
|
5
|
-
const
|
|
6
|
-
|
|
8
|
+
const actorCapitalized =
|
|
9
|
+
actor.charAt(0).toUpperCase() + actor.slice(1).toLowerCase();
|
|
7
10
|
|
|
8
11
|
const nestjsCommonPattern =
|
|
9
12
|
/import\s+{\s*[^}]*\s*}\s+from\s+"@nestjs\/common";/g;
|
|
@@ -19,7 +22,7 @@ export namespace AutoBeRealizeAuthorizationReplaceImport {
|
|
|
19
22
|
'import { jwtAuthorize } from "./jwtAuthorize";';
|
|
20
23
|
|
|
21
24
|
const payloadPattern = /import\s+{\s*\w*Payload\s*}\s+from\s+[^;]+;/g;
|
|
22
|
-
const payloadReplacement = `import { ${
|
|
25
|
+
const payloadReplacement = `import { ${actorCapitalized}Payload } from "../../decorators/payload/${actorCapitalized}Payload";`;
|
|
23
26
|
|
|
24
27
|
// 각 패턴을 순차적으로 적용
|
|
25
28
|
updatedContent = updatedContent.replace(
|
|
@@ -40,18 +43,18 @@ export namespace AutoBeRealizeAuthorizationReplaceImport {
|
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
export function replaceDecoratorImport(
|
|
43
|
-
|
|
46
|
+
actor: string,
|
|
44
47
|
content: string,
|
|
45
48
|
): string {
|
|
46
49
|
let updatedContent = content;
|
|
47
50
|
|
|
48
|
-
const
|
|
51
|
+
const actorLowercase = actor.toLowerCase();
|
|
49
52
|
|
|
50
53
|
// ~Authorize로 끝나는 import 구문을 특정 경로로 변경하는 정규표현식
|
|
51
54
|
const authorizePattern = /import\s+{\s*\w*Authorize\s*}\s+from\s+[^;]+;/g;
|
|
52
55
|
|
|
53
56
|
// role을 기반으로 동적으로 replacement 생성
|
|
54
|
-
const authorizeReplacement = `import { ${
|
|
57
|
+
const authorizeReplacement = `import { ${actorLowercase}Authorize } from "../providers/authorize/${actorLowercase}Authorize";`;
|
|
55
58
|
|
|
56
59
|
// 패턴 적용
|
|
57
60
|
updatedContent = updatedContent.replace(
|
|
@@ -34,7 +34,7 @@ export function generateRealizeScenario<Model extends ILlmSchema.Model>(
|
|
|
34
34
|
authorizations: AutoBeRealizeAuthorization[],
|
|
35
35
|
): IAutoBeRealizeScenarioResult {
|
|
36
36
|
const authorization = authorizations.find(
|
|
37
|
-
(el) => el.
|
|
37
|
+
(el) => el.actor.name === operation.authorizationActor,
|
|
38
38
|
);
|
|
39
39
|
|
|
40
40
|
const testFiles: AutoBeTestFile[] =
|
|
@@ -42,9 +42,9 @@ export function getRealizeWriteCodeTemplate(props: {
|
|
|
42
42
|
const functionParameters: string[] = [];
|
|
43
43
|
|
|
44
44
|
// Add authentication parameter if needed (e.g., user: IUser, admin: IAdmin)
|
|
45
|
-
if (props.authorization && props.authorization.
|
|
45
|
+
if (props.authorization && props.authorization.actor.name) {
|
|
46
46
|
// Debug: Log the values to check what's being used
|
|
47
|
-
const authParameter = `${props.authorization.
|
|
47
|
+
const authParameter = `${props.authorization.actor.name}: ${props.authorization.payload.name}`;
|
|
48
48
|
functionParameters.push(authParameter);
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -37,7 +37,7 @@ function filterDocument(
|
|
|
37
37
|
document: AutoBeOpenApi.IDocument,
|
|
38
38
|
): AutoBeOpenApi.IDocument {
|
|
39
39
|
const components: AutoBeOpenApi.IComponents = {
|
|
40
|
-
|
|
40
|
+
authorizations: document.components.authorizations,
|
|
41
41
|
schemas: {},
|
|
42
42
|
};
|
|
43
43
|
|
|
@@ -36,9 +36,9 @@ export function getRealizeWriteInputType(
|
|
|
36
36
|
const functionParameterFields: string[] = [];
|
|
37
37
|
|
|
38
38
|
// Add authentication field (user/admin/member) if endpoint requires auth
|
|
39
|
-
const hasAuthentication = authorization && operation.
|
|
39
|
+
const hasAuthentication = authorization && operation.authorizationActor;
|
|
40
40
|
if (hasAuthentication) {
|
|
41
|
-
const authFieldName = operation.
|
|
41
|
+
const authFieldName = operation.authorizationActor;
|
|
42
42
|
const authFieldType = authorization.payload.name;
|
|
43
43
|
functionParameterFields.push(`${authFieldName}: ${authFieldType};`);
|
|
44
44
|
}
|
|
@@ -4,96 +4,6 @@ import { ILlmSchema } from "@samchon/openapi";
|
|
|
4
4
|
import { AutoBeContext } from "../../../context/AutoBeContext";
|
|
5
5
|
import { getRealizeWriteImportStatements } from "./getRealizeWriteImportStatements";
|
|
6
6
|
|
|
7
|
-
// /**
|
|
8
|
-
// * Removes all import statements that LLM might have incorrectly added. This
|
|
9
|
-
// * includes standard library imports, auto-injected imports, and any API
|
|
10
|
-
// * structure imports with wrong paths.
|
|
11
|
-
// *
|
|
12
|
-
// * @param code - The code containing imports to remove
|
|
13
|
-
// * @param typeReferences - List of type names to specifically remove
|
|
14
|
-
// * @param decoratorType - Optional decorator type to remove
|
|
15
|
-
// * @returns Code with all imports removed
|
|
16
|
-
// */
|
|
17
|
-
// function removeAllImports(
|
|
18
|
-
// code: string,
|
|
19
|
-
// typeReferences: string[],
|
|
20
|
-
// decoratorType?: string,
|
|
21
|
-
// ): string {
|
|
22
|
-
// // Remove standard library and auto-injected imports
|
|
23
|
-
// let cleanedCode = code
|
|
24
|
-
// // MyGlobal - often with wrong path
|
|
25
|
-
// .replace(
|
|
26
|
-
// /import\s*{\s*MyGlobal\s*}\s*from\s*["']\.\.\/MyGlobal["']\s*;?\s*/gm,
|
|
27
|
-
// "",
|
|
28
|
-
// )
|
|
29
|
-
// // typia - various import patterns
|
|
30
|
-
// .replace(
|
|
31
|
-
// /import\s+typia\s*,\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm,
|
|
32
|
-
// "",
|
|
33
|
-
// )
|
|
34
|
-
// .replace(/import\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm, "")
|
|
35
|
-
// .replace(
|
|
36
|
-
// /import\s*{\s*tags\s*,\s*typia\s*}\s*from\s*["']typia["']\s*;?\s*/gm,
|
|
37
|
-
// "",
|
|
38
|
-
// )
|
|
39
|
-
// .replace(/import\s+typia\s*from\s*["']typia["']\s*;?\s*/gm, "")
|
|
40
|
-
// // Prisma client
|
|
41
|
-
// .replace(
|
|
42
|
-
// /import\s*{\s*Prisma\s*}\s*from\s*["']@prisma\/client["']\s*;?\s*/gm,
|
|
43
|
-
// "",
|
|
44
|
-
// )
|
|
45
|
-
// // uuid
|
|
46
|
-
// .replace(/import\s*{\s*v4\s*}\s*from\s*["']uuid["']\s*;?\s*/gm, "")
|
|
47
|
-
// // toISOStringSafe utility
|
|
48
|
-
// .replace(
|
|
49
|
-
// /import\s*{\s*toISOStringSafe\s*}\s*from\s*["']\.\.\/utils\/toISOStringSafe["']\s*;?\s*/gm,
|
|
50
|
-
// "",
|
|
51
|
-
// )
|
|
52
|
-
// // JWT imports (if LLM adds them)
|
|
53
|
-
// .replace(/import\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm, "")
|
|
54
|
-
// .replace(
|
|
55
|
-
// /import\s*\*\s*as\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm,
|
|
56
|
-
// "",
|
|
57
|
-
// )
|
|
58
|
-
// // NestJS HttpException
|
|
59
|
-
// .replace(
|
|
60
|
-
// /import\s*{\s*HttpException\s*}\s*from\s*["']@nestjs\/common["']\s*;?\s*/gm,
|
|
61
|
-
// "",
|
|
62
|
-
// );
|
|
63
|
-
|
|
64
|
-
// // Remove API structure imports with wrong paths
|
|
65
|
-
// // Pattern 1: ../api/structures path (LLM often uses this wrong path)
|
|
66
|
-
// cleanedCode = cleanedCode.replace(
|
|
67
|
-
// /import\s*(?:type\s*)?{\s*[^}]+\s*}\s*from\s*["']\.\.\/api\/structures\/[^"']+["']\s*;?\s*/gm,
|
|
68
|
-
// "",
|
|
69
|
-
// );
|
|
70
|
-
// // Pattern 2: @ORGANIZATION/PROJECT-api path (correct path but LLM shouldn't write it)
|
|
71
|
-
// cleanedCode = cleanedCode.replace(
|
|
72
|
-
// /import\s*(?:type\s*)?{\s*[^}]+\s*}\s*from\s*["']@ORGANIZATION\/PROJECT-api\/lib\/structures\/[^"']+["']\s*;?\s*/gm,
|
|
73
|
-
// "",
|
|
74
|
-
// );
|
|
75
|
-
|
|
76
|
-
// // Remove specific type imports that match our typeReferences
|
|
77
|
-
// for (const ref of typeReferences) {
|
|
78
|
-
// const typeImportRegex = new RegExp(
|
|
79
|
-
// `import\\s*(?:type\\s*)?{\\s*${ref}\\s*}\\s*from\\s*["'][^"']+["']\\s*;?\\s*`,
|
|
80
|
-
// "gm",
|
|
81
|
-
// );
|
|
82
|
-
// cleanedCode = cleanedCode.replace(typeImportRegex, "");
|
|
83
|
-
// }
|
|
84
|
-
|
|
85
|
-
// // Remove decorator type imports if LLM mistakenly added them
|
|
86
|
-
// if (decoratorType) {
|
|
87
|
-
// const decoratorTypeRegex = new RegExp(
|
|
88
|
-
// `import\\s*(?:type\\s*)?{\\s*${decoratorType}\\s*}\\s*from\\s*["']\\.\\.\/decorators\/payload\/${decoratorType}["']\\s*;?\\s*`,
|
|
89
|
-
// "gm",
|
|
90
|
-
// );
|
|
91
|
-
// cleanedCode = cleanedCode.replace(decoratorTypeRegex, "");
|
|
92
|
-
// }
|
|
93
|
-
|
|
94
|
-
// return cleanedCode;
|
|
95
|
-
// }
|
|
96
|
-
|
|
97
7
|
export async function replaceImportStatements<Model extends ILlmSchema.Model>(
|
|
98
8
|
ctx: AutoBeContext<Model>,
|
|
99
9
|
props: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
-
import { StringUtil } from "@autobe/utils";
|
|
3
2
|
import { ILlmSchema } from "@samchon/openapi";
|
|
4
3
|
import { v7 } from "uuid";
|
|
5
4
|
|
|
6
5
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
7
6
|
import { AutoBeContext } from "../../../context/AutoBeContext";
|
|
7
|
+
import { transformPreviousAndLatestCorrectHistories } from "../../common/histories/transformPreviousAndLatestCorrectHistories";
|
|
8
8
|
import { IAutoBeTestFunction } from "../structures/IAutoBeTestFunction";
|
|
9
9
|
import { IAutoBeTestFunctionFailure } from "../structures/IAutoBeTestFunctionFailure";
|
|
10
10
|
import { transformTestWriteHistories } from "./transformTestWriteHistories";
|
|
@@ -39,29 +39,11 @@ export const transformTestCorrectHistories = async <
|
|
|
39
39
|
text: AutoBeSystemPromptConstant.TEST_CORRECT,
|
|
40
40
|
},
|
|
41
41
|
previous.at(-1)!,
|
|
42
|
-
...
|
|
43
|
-
(f
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
type: "assistantMessage",
|
|
48
|
-
text: StringUtil.trim`
|
|
49
|
-
## ${i === array.length - 1 ? "Latest Failure" : "Previous Failure"}
|
|
50
|
-
### Generated TypeScript Code
|
|
51
|
-
|
|
52
|
-
\`\`\`typescript
|
|
53
|
-
${f.function.script}
|
|
54
|
-
\`\`\`
|
|
55
|
-
|
|
56
|
-
### Compile Errors
|
|
57
|
-
|
|
58
|
-
Fix the compilation error in the provided code.
|
|
59
|
-
|
|
60
|
-
\`\`\`json
|
|
61
|
-
${JSON.stringify(f.failure.diagnostics)}
|
|
62
|
-
\`\`\`
|
|
63
|
-
`,
|
|
64
|
-
}) satisfies IAgenticaHistoryJson.IAssistantMessage,
|
|
42
|
+
...transformPreviousAndLatestCorrectHistories(
|
|
43
|
+
props.failures.map((f) => ({
|
|
44
|
+
script: f.function.script,
|
|
45
|
+
diagnostics: f.failure.diagnostics,
|
|
46
|
+
})),
|
|
65
47
|
),
|
|
66
48
|
];
|
|
67
49
|
};
|
|
@@ -23,17 +23,17 @@ export const transformTestCorrectInvalidRequestHistories = (
|
|
|
23
23
|
created_at: new Date().toISOString(),
|
|
24
24
|
type: "assistantMessage",
|
|
25
25
|
text: StringUtil.trim`
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
## TypeScript Code
|
|
27
|
+
|
|
28
|
+
\`\`\`typescript
|
|
29
|
+
${func.script}
|
|
30
|
+
\`\`\`
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
## Compile Errors
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
\`\`\`json
|
|
35
|
+
${JSON.stringify(diagnostics)}
|
|
36
|
+
\`\`\`
|
|
37
|
+
`,
|
|
38
38
|
},
|
|
39
39
|
];
|