@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
|
@@ -1,294 +1,29 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
2
|
import { AutoBeOpenApi } from "@autobe/interface";
|
|
3
|
-
import { StringUtil } from "@autobe/utils";
|
|
4
3
|
import { v7 } from "uuid";
|
|
5
4
|
|
|
5
|
+
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
6
|
+
|
|
6
7
|
export const transformRealizeWriteAuthorizationsHistories = (
|
|
7
8
|
operation: AutoBeOpenApi.IOperation,
|
|
8
|
-
|
|
9
|
+
payload: Record<string, string>,
|
|
9
10
|
): Array<IAgenticaHistoryJson.ISystemMessage> => {
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
## Implementation Guidelines for Login:
|
|
24
|
-
|
|
25
|
-
### Login Operation Requirements
|
|
26
|
-
- This is a login endpoint that authenticates users
|
|
27
|
-
- Must validate credentials (username/email and password)
|
|
28
|
-
- Should return authentication tokens (access and refresh tokens)
|
|
29
|
-
- Must NOT require authentication decorator (this endpoint creates authentication)
|
|
30
|
-
- Should check if user exists and password matches
|
|
31
|
-
|
|
32
|
-
### MANDATORY: Use PasswordUtil for Password Verification
|
|
33
|
-
|
|
34
|
-
**CRITICAL**: You MUST use PasswordUtil utilities for password verification to ensure consistency with the join operation:
|
|
35
|
-
|
|
36
|
-
\`\`\`typescript
|
|
37
|
-
// Example: Password verification in login
|
|
38
|
-
const isValid = await PasswordUtil.verify(
|
|
39
|
-
body.password, // plain password from request
|
|
40
|
-
user.password_hash // hashed password from database
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
if (!isValid) {
|
|
44
|
-
throw new Error("Invalid credentials");
|
|
45
|
-
}
|
|
46
|
-
\`\`\`
|
|
47
|
-
|
|
48
|
-
### JWT Token Generation
|
|
49
|
-
|
|
50
|
-
**NOTE**: The jsonwebtoken library is automatically imported as jwt. Use it to generate tokens with the EXACT payload structure:
|
|
51
|
-
|
|
52
|
-
**CRITICAL**: Use the predefined payload structures for consistency:
|
|
53
|
-
|
|
54
|
-
\`\`\`json
|
|
55
|
-
${JSON.stringify(payloads)}
|
|
56
|
-
\`\`\`
|
|
57
|
-
|
|
58
|
-
// JWT is already imported: import jwt from "jsonwebtoken";
|
|
59
|
-
|
|
60
|
-
// Generate access token with the EXACT payload structure for the user type
|
|
61
|
-
// DO NOT use type annotations like: const payload: MemberPayload = {...}
|
|
62
|
-
// Just create the payload object directly
|
|
63
|
-
|
|
64
|
-
const accessToken = jwt.sign(
|
|
65
|
-
{
|
|
66
|
-
userId: user.id,
|
|
67
|
-
email: user.email,
|
|
68
|
-
// ... other required fields from the payload structure above
|
|
69
|
-
},
|
|
70
|
-
MyGlobal.env.JWT_SECRET_KEY,
|
|
71
|
-
{
|
|
72
|
-
expiresIn: '1h',
|
|
73
|
-
issuer: 'autobe' // MUST use 'autobe' as issuer
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
// Generate refresh token (optional)
|
|
78
|
-
const refreshToken = jwt.sign(
|
|
79
|
-
{
|
|
80
|
-
userId: user.id,
|
|
81
|
-
tokenType: 'refresh'
|
|
82
|
-
},
|
|
83
|
-
MyGlobal.env.JWT_SECRET_KEY,
|
|
84
|
-
{
|
|
85
|
-
expiresIn: '7d',
|
|
86
|
-
issuer: 'autobe' // MUST use 'autobe' as issuer
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
// Decode tokens if needed (e.g., for verification)
|
|
91
|
-
const decoded = jwt.verify(token, MyGlobal.env.JWT_SECRET_KEY, {
|
|
92
|
-
issuer: 'autobe' // Verify issuer is 'autobe'
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
**DO NOT**:
|
|
96
|
-
- Implement your own password hashing logic
|
|
97
|
-
- Use bcrypt, argon2, or any other hashing library directly
|
|
98
|
-
- Try to hash and compare manually
|
|
99
|
-
|
|
100
|
-
**IMPORTANT**: Since this is a login operation, it must be publicly accessible without authentication.
|
|
101
|
-
`,
|
|
102
|
-
},
|
|
103
|
-
]
|
|
104
|
-
: [];
|
|
105
|
-
|
|
106
|
-
// Join (registration) operation 가이드
|
|
107
|
-
const joinGuide =
|
|
108
|
-
operation.authorizationType === "join"
|
|
109
|
-
? [
|
|
110
|
-
{
|
|
111
|
-
id: v7(),
|
|
112
|
-
created_at: new Date().toISOString(),
|
|
113
|
-
type: "systemMessage" as const,
|
|
114
|
-
text: StringUtil.trim`
|
|
115
|
-
# Authorization Type: Join (Registration)
|
|
116
|
-
|
|
117
|
-
This is a **join** operation for user registration.
|
|
118
|
-
|
|
119
|
-
## Implementation Guidelines for Join:
|
|
120
|
-
|
|
121
|
-
### Join (Registration) Operation Requirements
|
|
122
|
-
- This is a user registration endpoint
|
|
123
|
-
- Must validate all required user information
|
|
124
|
-
- Should check for duplicate accounts (email, username, etc.)
|
|
125
|
-
- Must hash passwords before storing (NEVER store plain passwords)
|
|
126
|
-
- Should create a new user record in the database
|
|
127
|
-
- Must NOT require authentication decorator (public endpoint)
|
|
128
|
-
|
|
129
|
-
### MANDATORY: Use PasswordUtil for Password Hashing
|
|
130
|
-
|
|
131
|
-
**CRITICAL**: You MUST use PasswordUtil utilities for password hashing to ensure consistency across all authentication operations:
|
|
132
|
-
|
|
133
|
-
\`\`\`typescript
|
|
134
|
-
// Example: Password hashing in join/registration
|
|
135
|
-
const hashedPassword = await PasswordUtil.hash(body.password);
|
|
136
|
-
|
|
137
|
-
// Store the hashed password in database
|
|
138
|
-
await MyGlobal.prisma.users.create({
|
|
139
|
-
data: {
|
|
140
|
-
email: body.email,
|
|
141
|
-
password_hash: hashedPassword, // Store the hash, never plain password
|
|
142
|
-
// ... other fields
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
\`\`\`
|
|
146
|
-
|
|
147
|
-
**DO NOT**:
|
|
148
|
-
- Store plain passwords in the database
|
|
149
|
-
- Use bcrypt, argon2, or any other hashing library directly
|
|
150
|
-
- Implement your own hashing logic
|
|
151
|
-
|
|
152
|
-
### JWT Token Generation After Registration
|
|
153
|
-
|
|
154
|
-
**NOTE**: The jsonwebtoken library is automatically imported as jwt. After successful registration, generate tokens with the EXACT payload structure:
|
|
155
|
-
|
|
156
|
-
**CRITICAL**: Use the predefined payload structures for consistency:
|
|
157
|
-
|
|
158
|
-
\`\`\`json
|
|
159
|
-
${JSON.stringify(payloads)}
|
|
160
|
-
\`\`\`
|
|
161
|
-
|
|
162
|
-
// JWT is already imported: import jwt from "jsonwebtoken";
|
|
163
|
-
|
|
164
|
-
// After creating the user, generate tokens with EXACT payload structure
|
|
165
|
-
// DO NOT use type annotations like: const payload: UserPayload = {...}
|
|
166
|
-
// Just create the payload object directly in jwt.sign()
|
|
167
|
-
|
|
168
|
-
const accessToken = jwt.sign(
|
|
169
|
-
{
|
|
170
|
-
userId: newUser.id,
|
|
171
|
-
email: newUser.email,
|
|
172
|
-
// ... other required fields from the payload structure above
|
|
173
|
-
},
|
|
174
|
-
MyGlobal.env.JWT_SECRET_KEY,
|
|
175
|
-
{
|
|
176
|
-
expiresIn: '1h',
|
|
177
|
-
issuer: 'autobe' // MUST use 'autobe' as issuer
|
|
178
|
-
}
|
|
179
|
-
);
|
|
180
|
-
|
|
181
|
-
const refreshToken = jwt.sign(
|
|
182
|
-
{
|
|
183
|
-
userId: newUser.id,
|
|
184
|
-
tokenType: 'refresh'
|
|
185
|
-
},
|
|
186
|
-
MyGlobal.env.JWT_SECRET_KEY,
|
|
187
|
-
{
|
|
188
|
-
expiresIn: '7d',
|
|
189
|
-
issuer: 'autobe' // MUST use 'autobe' as issuer
|
|
190
|
-
}
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
**IMPORTANT**: Since this is a registration operation, it must be publicly accessible. Always hash passwords before storing.
|
|
194
|
-
`,
|
|
195
|
-
},
|
|
196
|
-
]
|
|
197
|
-
: [];
|
|
198
|
-
|
|
199
|
-
// Refresh token operation 가이드
|
|
200
|
-
const refreshGuide =
|
|
201
|
-
operation.authorizationType === "refresh"
|
|
202
|
-
? [
|
|
203
|
-
{
|
|
204
|
-
id: v7(),
|
|
205
|
-
created_at: new Date().toISOString(),
|
|
206
|
-
type: "systemMessage" as const,
|
|
207
|
-
text: StringUtil.trim`
|
|
208
|
-
# Authorization Type: Refresh Token
|
|
209
|
-
|
|
210
|
-
This is a **refresh** token operation for renewing expired access tokens.
|
|
211
|
-
|
|
212
|
-
## Implementation Guidelines for Refresh:
|
|
213
|
-
|
|
214
|
-
### Refresh Token Operation Requirements
|
|
215
|
-
- This endpoint refreshes expired access tokens
|
|
216
|
-
- Must validate the refresh token first
|
|
217
|
-
- Should check if refresh token is not expired or revoked
|
|
218
|
-
- Must generate a new access token with THE SAME payload structure
|
|
219
|
-
- May also rotate the refresh token for security
|
|
220
|
-
- Should handle invalid/expired refresh tokens gracefully
|
|
221
|
-
- Typically requires the refresh token in request body or headers
|
|
222
|
-
- Must NOT require standard authentication (uses refresh token instead)
|
|
223
|
-
|
|
224
|
-
### CRITICAL: Refresh Token Implementation
|
|
225
|
-
|
|
226
|
-
**IMPORTANT**: When refreshing tokens, you MUST:
|
|
227
|
-
1. Decode and verify the refresh token
|
|
228
|
-
2. Extract the user information from the decoded token
|
|
229
|
-
3. Generate a new access token with THE SAME payload structure as the original
|
|
230
|
-
|
|
231
|
-
**CRITICAL**: Use the predefined payload structures for consistency:
|
|
232
|
-
|
|
233
|
-
\`\`\`json
|
|
234
|
-
${JSON.stringify(payloads)}
|
|
235
|
-
\`\`\`
|
|
236
|
-
|
|
237
|
-
// JWT is already imported: import jwt from "jsonwebtoken";
|
|
238
|
-
|
|
239
|
-
// Step 1: Verify and decode the refresh token
|
|
240
|
-
const decoded = jwt.verify(body.refreshToken, MyGlobal.env.JWT_SECRET_KEY, {
|
|
241
|
-
issuer: 'autobe'
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
// Step 2: Get user data (from decoded token or database)
|
|
245
|
-
const user = await MyGlobal.prisma.users.findUnique({
|
|
246
|
-
where: { id: decoded.userId }
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
if (!user) {
|
|
250
|
-
throw new Error("User not found");
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// Step 3: Generate new access token with SAME payload structure as login/join
|
|
254
|
-
const newAccessToken = jwt.sign(
|
|
255
|
-
{
|
|
256
|
-
userId: user.id,
|
|
257
|
-
email: user.email,
|
|
258
|
-
// ... other required fields from the payload structure above
|
|
259
|
-
// MUST match the structure used in login/join operations
|
|
260
|
-
},
|
|
261
|
-
MyGlobal.env.JWT_SECRET_KEY,
|
|
262
|
-
{
|
|
263
|
-
expiresIn: '1h',
|
|
264
|
-
issuer: 'autobe'
|
|
265
|
-
}
|
|
266
|
-
);
|
|
267
|
-
|
|
268
|
-
// Optional: Rotate refresh token
|
|
269
|
-
const newRefreshToken = jwt.sign(
|
|
270
|
-
{
|
|
271
|
-
userId: user.id,
|
|
272
|
-
tokenType: 'refresh'
|
|
273
|
-
},
|
|
274
|
-
MyGlobal.env.JWT_SECRET_KEY,
|
|
275
|
-
{
|
|
276
|
-
expiresIn: '7d',
|
|
277
|
-
issuer: 'autobe'
|
|
278
|
-
}
|
|
279
|
-
);
|
|
280
|
-
|
|
281
|
-
**DO NOT**:
|
|
282
|
-
- Generate new access tokens with different payload structures
|
|
283
|
-
- Use random IDs like v4() in the payload
|
|
284
|
-
- Create tokens without verifying the refresh token first
|
|
285
|
-
- Use type annotations like: const payload: UserPayload = {...}
|
|
286
|
-
|
|
287
|
-
**IMPORTANT**: The new access token MUST have the same payload structure as the original token from login/join operations.
|
|
288
|
-
`,
|
|
289
|
-
},
|
|
290
|
-
]
|
|
291
|
-
: [];
|
|
11
|
+
if (operation.authorizationType === null) return [];
|
|
12
|
+
const text: string = PROMPTS[operation.authorizationType].replace(
|
|
13
|
+
"${PAYLOAD}",
|
|
14
|
+
JSON.stringify(payload),
|
|
15
|
+
);
|
|
16
|
+
const history: IAgenticaHistoryJson.ISystemMessage = {
|
|
17
|
+
id: v7(),
|
|
18
|
+
created_at: new Date().toISOString(),
|
|
19
|
+
type: "systemMessage" as const,
|
|
20
|
+
text,
|
|
21
|
+
};
|
|
22
|
+
return [history];
|
|
23
|
+
};
|
|
292
24
|
|
|
293
|
-
|
|
25
|
+
const PROMPTS = {
|
|
26
|
+
login: AutoBeSystemPromptConstant.REALIZE_MEMBERSHIP_LOGIN,
|
|
27
|
+
join: AutoBeSystemPromptConstant.REALIZE_MEMBERSHIP_JOIN,
|
|
28
|
+
refresh: AutoBeSystemPromptConstant.REALIZE_MEMBERSHIP_REFRESH,
|
|
294
29
|
};
|
|
@@ -13,13 +13,13 @@ 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 { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
18
17
|
import { predicateStateMessage } from "../../utils/predicateStateMessage";
|
|
18
|
+
import { IAutoBeFacadeApplicationProps } from "../facade/histories/IAutoBeFacadeApplicationProps";
|
|
19
19
|
import { compileRealizeFiles } from "./internal/compileRealizeFiles";
|
|
20
|
-
import { orchestrateRealizeCorrectCasting } from "./orchestRateRealizeCorrectCasting";
|
|
21
20
|
import { orchestrateRealizeAuthorization } from "./orchestrateRealizeAuthorization";
|
|
22
21
|
import { orchestrateRealizeCorrect } from "./orchestrateRealizeCorrect";
|
|
22
|
+
import { orchestrateRealizeCorrectCasting } from "./orchestrateRealizeCorrectCasting";
|
|
23
23
|
import { orchestrateRealizeWrite } from "./orchestrateRealizeWrite";
|
|
24
24
|
import { IAutoBeRealizeScenarioResult } from "./structures/IAutoBeRealizeScenarioResult";
|
|
25
25
|
import { generateRealizeScenario } from "./utils/generateRealizeScenario";
|
|
@@ -189,13 +189,14 @@ export const orchestrateRealize =
|
|
|
189
189
|
return ctx.dispatch({
|
|
190
190
|
type: "realizeComplete",
|
|
191
191
|
id: v7(),
|
|
192
|
-
created_at: new Date().toISOString(),
|
|
193
192
|
functions: bucket.corrected,
|
|
194
193
|
authorizations,
|
|
195
194
|
controllers,
|
|
196
195
|
compiled: bucket.validate.result,
|
|
196
|
+
aggregates: ctx.getCurrentAggregates("realize"),
|
|
197
197
|
step: ctx.state().analyze?.step ?? 0,
|
|
198
198
|
elapsed: new Date().getTime() - start.getTime(),
|
|
199
|
+
created_at: new Date().toISOString(),
|
|
199
200
|
});
|
|
200
201
|
};
|
|
201
202
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
AutoBeAnalyzeActor,
|
|
4
4
|
AutoBeProgressEventBase,
|
|
5
5
|
AutoBeRealizeAuthorization,
|
|
6
6
|
AutoBeRealizeAuthorizationWriteEvent,
|
|
@@ -36,9 +36,9 @@ export async function orchestrateRealizeAuthorization<
|
|
|
36
36
|
created_at: new Date().toISOString(),
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
const
|
|
39
|
+
const actors: AutoBeAnalyzeActor[] = ctx.state().analyze?.actors ?? [];
|
|
40
40
|
const progress: AutoBeProgressEventBase = {
|
|
41
|
-
total:
|
|
41
|
+
total: actors.length,
|
|
42
42
|
completed: 0,
|
|
43
43
|
};
|
|
44
44
|
const templateFiles = await (
|
|
@@ -47,11 +47,11 @@ export async function orchestrateRealizeAuthorization<
|
|
|
47
47
|
dbms: "sqlite",
|
|
48
48
|
});
|
|
49
49
|
const authorizations: AutoBeRealizeAuthorization[] = await executeCachedBatch(
|
|
50
|
-
|
|
51
|
-
(
|
|
50
|
+
actors.map(
|
|
51
|
+
(a) => (promptCacheKey) =>
|
|
52
52
|
process(
|
|
53
53
|
ctx,
|
|
54
|
-
|
|
54
|
+
a,
|
|
55
55
|
InternalFileSystem.DEFAULT.map((el) => ({
|
|
56
56
|
[el]: templateFiles[el],
|
|
57
57
|
})).reduce((acc, cur) => Object.assign(acc, cur), {}),
|
|
@@ -71,7 +71,7 @@ export async function orchestrateRealizeAuthorization<
|
|
|
71
71
|
|
|
72
72
|
async function process<Model extends ILlmSchema.Model>(
|
|
73
73
|
ctx: AutoBeContext<Model>,
|
|
74
|
-
|
|
74
|
+
actor: AutoBeAnalyzeActor,
|
|
75
75
|
templateFiles: Record<string, string>,
|
|
76
76
|
progress: AutoBeProgressEventBase,
|
|
77
77
|
promptCacheKey: string,
|
|
@@ -80,9 +80,9 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
80
80
|
{
|
|
81
81
|
value: null,
|
|
82
82
|
};
|
|
83
|
-
const { tokenUsage } = await ctx.conversate({
|
|
83
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
84
84
|
source: "realizeAuthorizationWrite",
|
|
85
|
-
histories: transformRealizeAuthorizationHistories(ctx,
|
|
85
|
+
histories: transformRealizeAuthorizationHistories(ctx, actor),
|
|
86
86
|
controller: createController({
|
|
87
87
|
model: ctx.model,
|
|
88
88
|
build: (next) => {
|
|
@@ -97,7 +97,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
97
97
|
|
|
98
98
|
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
99
99
|
const authorization: AutoBeRealizeAuthorization = {
|
|
100
|
-
|
|
100
|
+
actor: actor,
|
|
101
101
|
decorator: {
|
|
102
102
|
location: AuthorizationFileSystem.decoratorPath(
|
|
103
103
|
pointer.value.decorator.name,
|
|
@@ -129,6 +129,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
129
129
|
id: v7(),
|
|
130
130
|
created_at: new Date().toISOString(),
|
|
131
131
|
authorization: authorization,
|
|
132
|
+
metric,
|
|
132
133
|
tokenUsage,
|
|
133
134
|
completed: ++progress.completed,
|
|
134
135
|
total: progress.total,
|
|
@@ -29,13 +29,13 @@ export async function orchestrateRealizeAuthorizationCorrect<
|
|
|
29
29
|
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
30
30
|
const providerContent: string = await compiler.typescript.beautify(
|
|
31
31
|
AutoBeRealizeAuthorizationReplaceImport.replaceProviderImport(
|
|
32
|
-
authorization.
|
|
32
|
+
authorization.actor.name,
|
|
33
33
|
authorization.provider.content,
|
|
34
34
|
),
|
|
35
35
|
);
|
|
36
36
|
const decoratorContent: string = await compiler.typescript.beautify(
|
|
37
37
|
AutoBeRealizeAuthorizationReplaceImport.replaceDecoratorImport(
|
|
38
|
-
authorization.
|
|
38
|
+
authorization.actor.name,
|
|
39
39
|
authorization.decorator.content,
|
|
40
40
|
),
|
|
41
41
|
);
|
|
@@ -76,7 +76,7 @@ export async function orchestrateRealizeAuthorizationCorrect<
|
|
|
76
76
|
{
|
|
77
77
|
value: null,
|
|
78
78
|
};
|
|
79
|
-
const { tokenUsage } = await ctx.conversate({
|
|
79
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
80
80
|
source: "realizeAuthorizationCorrect",
|
|
81
81
|
histories: transformRealizeAuthorizationCorrectHistories(
|
|
82
82
|
ctx,
|
|
@@ -116,7 +116,7 @@ export async function orchestrateRealizeAuthorizationCorrect<
|
|
|
116
116
|
pointer.value.payload.content,
|
|
117
117
|
),
|
|
118
118
|
},
|
|
119
|
-
|
|
119
|
+
actor: authorization.actor,
|
|
120
120
|
};
|
|
121
121
|
|
|
122
122
|
ctx.dispatch({
|
|
@@ -126,6 +126,7 @@ export async function orchestrateRealizeAuthorizationCorrect<
|
|
|
126
126
|
created_at: new Date().toISOString(),
|
|
127
127
|
authorization: result,
|
|
128
128
|
result: compiled,
|
|
129
|
+
metric,
|
|
129
130
|
tokenUsage,
|
|
130
131
|
step: ctx.state().test?.step ?? 0,
|
|
131
132
|
});
|
|
@@ -34,7 +34,7 @@ export async function orchestrateRealizeCorrect<Model extends ILlmSchema.Model>(
|
|
|
34
34
|
scenarios: IAutoBeRealizeScenarioResult[],
|
|
35
35
|
authorizations: AutoBeRealizeAuthorization[],
|
|
36
36
|
functions: AutoBeRealizeFunction[],
|
|
37
|
-
|
|
37
|
+
previousFailures: IAutoBeRealizeFunctionFailure[][],
|
|
38
38
|
progress: AutoBeProgressEventBase,
|
|
39
39
|
life: number = ctx.retry,
|
|
40
40
|
): Promise<AutoBeRealizeFunction[]> {
|
|
@@ -92,32 +92,26 @@ export async function orchestrateRealizeCorrect<Model extends ILlmSchema.Model>(
|
|
|
92
92
|
diagnosticsByFile[location].diagnostics.push(diagnostic);
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
-
const newFailures: IAutoBeRealizeFunctionFailure[] =
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
];
|
|
99
|
-
|
|
100
|
-
const corrected: AutoBeRealizeFunction[] = await correct(
|
|
101
|
-
ctx,
|
|
95
|
+
const newFailures: IAutoBeRealizeFunctionFailure[] =
|
|
96
|
+
Object.values(diagnosticsByFile);
|
|
97
|
+
const corrected: AutoBeRealizeFunction[] = await correct(ctx, {
|
|
102
98
|
locations,
|
|
103
99
|
scenarios,
|
|
104
100
|
authorizations,
|
|
105
101
|
functions,
|
|
106
|
-
|
|
102
|
+
previousFailures,
|
|
103
|
+
failures: filterDiagnostics(
|
|
107
104
|
newFailures,
|
|
108
105
|
functions.map((fn) => fn.location),
|
|
109
106
|
),
|
|
110
107
|
progress,
|
|
111
|
-
);
|
|
108
|
+
});
|
|
112
109
|
return orchestrateRealizeCorrect(
|
|
113
110
|
ctx,
|
|
114
111
|
scenarios,
|
|
115
112
|
authorizations,
|
|
116
113
|
corrected,
|
|
117
|
-
|
|
118
|
-
newFailures,
|
|
119
|
-
corrected.map((c) => c.location),
|
|
120
|
-
),
|
|
114
|
+
[...previousFailures, newFailures],
|
|
121
115
|
progress,
|
|
122
116
|
life - 1,
|
|
123
117
|
);
|
|
@@ -125,61 +119,82 @@ export async function orchestrateRealizeCorrect<Model extends ILlmSchema.Model>(
|
|
|
125
119
|
|
|
126
120
|
async function correct<Model extends ILlmSchema.Model>(
|
|
127
121
|
ctx: AutoBeContext<Model>,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
122
|
+
props: {
|
|
123
|
+
locations: string[];
|
|
124
|
+
scenarios: IAutoBeRealizeScenarioResult[];
|
|
125
|
+
authorizations: AutoBeRealizeAuthorization[];
|
|
126
|
+
functions: AutoBeRealizeFunction[];
|
|
127
|
+
previousFailures: IAutoBeRealizeFunctionFailure[][];
|
|
128
|
+
failures: IAutoBeRealizeFunctionFailure[];
|
|
129
|
+
progress: AutoBeProgressEventBase;
|
|
130
|
+
},
|
|
134
131
|
): Promise<AutoBeRealizeFunction[]> {
|
|
135
|
-
if (locations.length === 0) {
|
|
136
|
-
return functions;
|
|
132
|
+
if (props.locations.length === 0) {
|
|
133
|
+
return props.functions;
|
|
137
134
|
}
|
|
138
135
|
|
|
139
136
|
const corrected: AutoBeRealizeFunction[] = await executeCachedBatch(
|
|
140
|
-
locations.map(
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
props.locations.map(
|
|
138
|
+
(location) => async (): Promise<AutoBeRealizeFunction> => {
|
|
139
|
+
const scenario = props.scenarios.find((el) => el.location === location);
|
|
140
|
+
const func = props.functions.find((el) => el.location === location);
|
|
143
141
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
if (!func) {
|
|
143
|
+
throw new Error("No function found for location: " + location);
|
|
144
|
+
}
|
|
147
145
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
146
|
+
const failures: IAutoBeRealizeFunctionFailure[] = props.failures.filter(
|
|
147
|
+
(f) => f.function?.location === location,
|
|
148
|
+
);
|
|
149
|
+
if (failures.length && scenario) {
|
|
150
|
+
try {
|
|
151
|
+
const correctEvent: AutoBeRealizeCorrectEvent | null = await step(
|
|
152
|
+
ctx,
|
|
153
|
+
{
|
|
154
|
+
totalAuthorizations: props.authorizations,
|
|
155
|
+
authorization: scenario.decoratorEvent ?? null,
|
|
156
|
+
scenario,
|
|
157
|
+
function: func,
|
|
158
|
+
previousFailures: props.previousFailures
|
|
159
|
+
.map((pf) => {
|
|
160
|
+
const previousFailures: IAutoBeRealizeFunctionFailure[] =
|
|
161
|
+
pf.filter((f) => f.function.location === location);
|
|
162
|
+
if (previousFailures.length === 0) return null;
|
|
163
|
+
return {
|
|
164
|
+
function: previousFailures[0].function,
|
|
165
|
+
diagnostics: previousFailures
|
|
166
|
+
.map((f) => f.diagnostics)
|
|
167
|
+
.flat(),
|
|
168
|
+
};
|
|
169
|
+
})
|
|
170
|
+
.filter((f) => f !== null),
|
|
171
|
+
failure: {
|
|
172
|
+
function: failures[0].function,
|
|
173
|
+
diagnostics: failures.map((f) => f.diagnostics).flat(),
|
|
174
|
+
},
|
|
175
|
+
progress: props.progress,
|
|
176
|
+
},
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
...func,
|
|
181
|
+
content: correctEvent === null ? "" : correctEvent.content,
|
|
182
|
+
};
|
|
183
|
+
} catch (err) {
|
|
184
|
+
return func;
|
|
185
|
+
}
|
|
171
186
|
}
|
|
172
|
-
}
|
|
173
187
|
|
|
174
|
-
|
|
175
|
-
|
|
188
|
+
return func;
|
|
189
|
+
},
|
|
190
|
+
),
|
|
176
191
|
);
|
|
177
192
|
|
|
178
193
|
// Create a map of corrected functions for efficient lookup
|
|
179
194
|
const correctedMap = new Map(corrected.map((f) => [f.location, f]));
|
|
180
195
|
|
|
181
196
|
// Return all functions, with corrected ones replaced
|
|
182
|
-
return functions.map((func) => correctedMap.get(func.location) || func);
|
|
197
|
+
return props.functions.map((func) => correctedMap.get(func.location) || func);
|
|
183
198
|
}
|
|
184
199
|
|
|
185
200
|
async function step<Model extends ILlmSchema.Model>(
|
|
@@ -189,7 +204,8 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
189
204
|
totalAuthorizations: AutoBeRealizeAuthorization[];
|
|
190
205
|
scenario: IAutoBeRealizeScenarioResult;
|
|
191
206
|
function: AutoBeRealizeFunction;
|
|
192
|
-
|
|
207
|
+
previousFailures: IAutoBeRealizeFunctionFailure[];
|
|
208
|
+
failure: IAutoBeRealizeFunctionFailure;
|
|
193
209
|
progress: AutoBeProgressEventBase;
|
|
194
210
|
},
|
|
195
211
|
): Promise<AutoBeRealizeCorrectEvent | null> {
|
|
@@ -198,7 +214,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
198
214
|
};
|
|
199
215
|
|
|
200
216
|
const dto = await getRealizeWriteDto(ctx, props.scenario.operation);
|
|
201
|
-
const { tokenUsage } = await ctx.conversate({
|
|
217
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
202
218
|
source: "realizeCorrect",
|
|
203
219
|
controller: createController({
|
|
204
220
|
model: ctx.model,
|
|
@@ -211,11 +227,8 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
211
227
|
state: ctx.state(),
|
|
212
228
|
scenario: props.scenario,
|
|
213
229
|
authorization: props.authorization,
|
|
214
|
-
code: props.function.content,
|
|
215
230
|
dto,
|
|
216
|
-
failures: props.
|
|
217
|
-
(f) => f.function.location === props.function.location,
|
|
218
|
-
),
|
|
231
|
+
failures: [...props.previousFailures, props.failure],
|
|
219
232
|
totalAuthorizations: props.totalAuthorizations,
|
|
220
233
|
}),
|
|
221
234
|
enforceFunctionCall: true,
|
|
@@ -226,7 +239,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
226
239
|
When modifying, modify the entire code, but not the import statement.
|
|
227
240
|
|
|
228
241
|
Below is template code you wrote:
|
|
229
|
-
|
|
242
|
+
|
|
230
243
|
${getRealizeWriteCodeTemplate({
|
|
231
244
|
scenario: props.scenario,
|
|
232
245
|
schemas: ctx.state().interface!.document.components.schemas,
|
|
@@ -261,9 +274,11 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
261
274
|
|
|
262
275
|
const event: AutoBeRealizeCorrectEvent = {
|
|
263
276
|
type: "realizeCorrect",
|
|
277
|
+
kind: "overall",
|
|
264
278
|
id: v7(),
|
|
265
279
|
location: props.scenario.location,
|
|
266
280
|
content: pointer.value.revise.final ?? pointer.value.draft,
|
|
281
|
+
metric,
|
|
267
282
|
tokenUsage,
|
|
268
283
|
completed: ++props.progress.completed,
|
|
269
284
|
total: props.progress.total,
|