@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
|
@@ -2,9 +2,10 @@ import {
|
|
|
2
2
|
AutoBeAssistantMessageHistory,
|
|
3
3
|
AutoBeInterfaceAuthorization,
|
|
4
4
|
AutoBeInterfaceCompleteEvent,
|
|
5
|
-
|
|
5
|
+
AutoBeInterfaceGroupEvent,
|
|
6
6
|
AutoBeInterfaceHistory,
|
|
7
7
|
AutoBeOpenApi,
|
|
8
|
+
AutoBeProgressEventBase,
|
|
8
9
|
} from "@autobe/interface";
|
|
9
10
|
import { AutoBeInterfacePrerequisite } from "@autobe/interface/src/histories/contents/AutoBeInterfacePrerequisite";
|
|
10
11
|
import {
|
|
@@ -16,17 +17,20 @@ import { ILlmSchema } from "@samchon/openapi";
|
|
|
16
17
|
import { HashMap, Pair } from "tstl";
|
|
17
18
|
import { v7 } from "uuid";
|
|
18
19
|
|
|
20
|
+
import { AutoBeConfigConstant } from "../../constants/AutoBeConfigConstant";
|
|
21
|
+
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
19
22
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
20
|
-
import { IAutoBeFacadeApplicationProps } from "../../context/IAutoBeFacadeApplicationProps";
|
|
21
23
|
import { predicateStateMessage } from "../../utils/predicateStateMessage";
|
|
24
|
+
import { IAutoBeFacadeApplicationProps } from "../facade/histories/IAutoBeFacadeApplicationProps";
|
|
22
25
|
import { orchestrateInterfaceAuthorizations } from "./orchestrateInterfaceAuthorizations";
|
|
23
26
|
import { orchestrateInterfaceComplement } from "./orchestrateInterfaceComplement";
|
|
24
27
|
import { orchestrateInterfaceEndpoints } from "./orchestrateInterfaceEndpoints";
|
|
25
28
|
import { orchestrateInterfaceGroups } from "./orchestrateInterfaceGroups";
|
|
26
29
|
import { orchestrateInterfaceOperations } from "./orchestrateInterfaceOperations";
|
|
27
30
|
import { orchestrateInterfacePrerequisites } from "./orchestrateInterfacePrerequisites";
|
|
31
|
+
import { orchestrateInterfaceSchemaRename } from "./orchestrateInterfaceSchemaRename";
|
|
32
|
+
import { orchestrateInterfaceSchemaReview } from "./orchestrateInterfaceSchemaReview";
|
|
28
33
|
import { orchestrateInterfaceSchemas } from "./orchestrateInterfaceSchemas";
|
|
29
|
-
import { orchestrateInterfaceSchemasReview } from "./orchestrateInterfaceSchemasReview";
|
|
30
34
|
import { JsonSchemaFactory } from "./utils/JsonSchemaFactory";
|
|
31
35
|
|
|
32
36
|
export const orchestrateInterface =
|
|
@@ -57,7 +61,7 @@ export const orchestrateInterface =
|
|
|
57
61
|
});
|
|
58
62
|
|
|
59
63
|
// ENDPOINTS
|
|
60
|
-
const init:
|
|
64
|
+
const init: AutoBeInterfaceGroupEvent = await orchestrateInterfaceGroups(
|
|
61
65
|
ctx,
|
|
62
66
|
{
|
|
63
67
|
instruction: props.instruction,
|
|
@@ -108,7 +112,7 @@ export const orchestrateInterface =
|
|
|
108
112
|
const document: AutoBeOpenApi.IDocument = {
|
|
109
113
|
operations,
|
|
110
114
|
components: {
|
|
111
|
-
|
|
115
|
+
authorizations: ctx.state().analyze?.actors ?? [],
|
|
112
116
|
schemas: await orchestrateInterfaceSchemas(ctx, {
|
|
113
117
|
instruction: props.instruction,
|
|
114
118
|
operations,
|
|
@@ -116,9 +120,11 @@ export const orchestrateInterface =
|
|
|
116
120
|
},
|
|
117
121
|
};
|
|
118
122
|
|
|
123
|
+
const assign = (
|
|
124
|
+
schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>,
|
|
125
|
+
) => Object.assign(document.components.schemas, schemas);
|
|
119
126
|
const complement = async () =>
|
|
120
|
-
|
|
121
|
-
document.components.schemas,
|
|
127
|
+
assign(
|
|
122
128
|
await orchestrateInterfaceComplement(ctx, {
|
|
123
129
|
instruction: props.instruction,
|
|
124
130
|
document,
|
|
@@ -126,16 +132,40 @@ export const orchestrateInterface =
|
|
|
126
132
|
);
|
|
127
133
|
await complement();
|
|
128
134
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
document.components.schemas,
|
|
135
|
+
const reviewProgress: AutoBeProgressEventBase = {
|
|
136
|
+
completed: 0,
|
|
137
|
+
total: Math.ceil(
|
|
138
|
+
Object.keys(document.components.schemas).length /
|
|
139
|
+
AutoBeConfigConstant.INTERFACE_CAPACITY,
|
|
135
140
|
),
|
|
136
|
-
|
|
141
|
+
};
|
|
142
|
+
for (const config of [
|
|
143
|
+
{
|
|
144
|
+
kind: "security" as const,
|
|
145
|
+
systemPrompt:
|
|
146
|
+
AutoBeSystemPromptConstant.INTERFACE_SCHEMA_SECURITY_REVIEW,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
kind: "relation" as const,
|
|
150
|
+
systemPrompt:
|
|
151
|
+
AutoBeSystemPromptConstant.INTERFACE_SCHEMA_RELATION_REVIEW,
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
kind: "content" as const,
|
|
155
|
+
systemPrompt:
|
|
156
|
+
AutoBeSystemPromptConstant.INTERFACE_SCHEMA_CONTENT_REVIEW,
|
|
157
|
+
},
|
|
158
|
+
])
|
|
159
|
+
assign(
|
|
160
|
+
await orchestrateInterfaceSchemaReview(ctx, config, {
|
|
161
|
+
instruction: props.instruction,
|
|
162
|
+
document,
|
|
163
|
+
progress: reviewProgress,
|
|
164
|
+
}),
|
|
165
|
+
);
|
|
137
166
|
if (missedOpenApiSchemas(document).length !== 0) await complement();
|
|
138
167
|
|
|
168
|
+
await orchestrateInterfaceSchemaRename(ctx, document);
|
|
139
169
|
JsonSchemaFactory.finalize({
|
|
140
170
|
document,
|
|
141
171
|
application: ctx.state().prisma!.result.data,
|
|
@@ -161,8 +191,9 @@ export const orchestrateInterface =
|
|
|
161
191
|
document,
|
|
162
192
|
missed: missedOpenApiSchemas(document),
|
|
163
193
|
authorizations,
|
|
164
|
-
|
|
165
|
-
elapsed: new Date().getTime() - start.getTime(),
|
|
194
|
+
aggregates: ctx.getCurrentAggregates("interface"),
|
|
166
195
|
step: ctx.state().analyze?.step ?? 0,
|
|
196
|
+
elapsed: new Date().getTime() - start.getTime(),
|
|
197
|
+
created_at: new Date().toISOString(),
|
|
167
198
|
} satisfies AutoBeInterfaceCompleteEvent);
|
|
168
199
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
AutoBeAnalyzeActor,
|
|
4
4
|
AutoBeInterfaceAuthorization,
|
|
5
5
|
AutoBeOpenApi,
|
|
6
6
|
AutoBeProgressEventBase,
|
|
@@ -24,23 +24,23 @@ export async function orchestrateInterfaceAuthorizations<
|
|
|
24
24
|
ctx: AutoBeContext<Model>,
|
|
25
25
|
instruction: string,
|
|
26
26
|
): Promise<AutoBeInterfaceAuthorization[]> {
|
|
27
|
-
const
|
|
27
|
+
const actors: AutoBeAnalyzeActor[] = ctx.state().analyze?.actors ?? [];
|
|
28
28
|
const progress: AutoBeProgressEventBase = {
|
|
29
|
-
total:
|
|
29
|
+
total: actors.length,
|
|
30
30
|
completed: 0,
|
|
31
31
|
};
|
|
32
32
|
const authorizations: AutoBeInterfaceAuthorization[] =
|
|
33
33
|
await executeCachedBatch(
|
|
34
|
-
|
|
34
|
+
actors.map((a) => async (promptCacheKey) => {
|
|
35
35
|
const event: AutoBeInterfaceAuthorizationEvent = await process(ctx, {
|
|
36
|
-
|
|
36
|
+
actor: a,
|
|
37
37
|
progress,
|
|
38
38
|
promptCacheKey,
|
|
39
39
|
instruction,
|
|
40
40
|
});
|
|
41
41
|
ctx.dispatch(event);
|
|
42
42
|
return {
|
|
43
|
-
|
|
43
|
+
name: a.name,
|
|
44
44
|
operations: event.operations,
|
|
45
45
|
};
|
|
46
46
|
}),
|
|
@@ -53,7 +53,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
53
53
|
ctx: AutoBeContext<Model>,
|
|
54
54
|
props: {
|
|
55
55
|
instruction: string;
|
|
56
|
-
|
|
56
|
+
actor: AutoBeAnalyzeActor;
|
|
57
57
|
progress: AutoBeProgressEventBase;
|
|
58
58
|
promptCacheKey: string;
|
|
59
59
|
},
|
|
@@ -62,16 +62,16 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
62
62
|
{
|
|
63
63
|
value: null,
|
|
64
64
|
};
|
|
65
|
-
const { tokenUsage } = await ctx.conversate({
|
|
65
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
66
66
|
source: "interfaceAuthorization",
|
|
67
67
|
histories: transformInterfaceAuthorizationsHistories({
|
|
68
68
|
state: ctx.state(),
|
|
69
69
|
instruction: props.instruction,
|
|
70
|
-
|
|
70
|
+
actor: props.actor,
|
|
71
71
|
}),
|
|
72
72
|
controller: createController({
|
|
73
73
|
model: ctx.model,
|
|
74
|
-
|
|
74
|
+
actor: props.actor,
|
|
75
75
|
build: (next) => {
|
|
76
76
|
pointer.value = next;
|
|
77
77
|
},
|
|
@@ -88,6 +88,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
88
88
|
id: v7(),
|
|
89
89
|
operations: pointer.value.operations,
|
|
90
90
|
completed: ++props.progress.completed,
|
|
91
|
+
metric,
|
|
91
92
|
tokenUsage,
|
|
92
93
|
created_at: new Date().toISOString(),
|
|
93
94
|
step: ctx.state().analyze?.step ?? 0,
|
|
@@ -97,7 +98,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
97
98
|
|
|
98
99
|
function createController<Model extends ILlmSchema.Model>(props: {
|
|
99
100
|
model: Model;
|
|
100
|
-
|
|
101
|
+
actor: AutoBeAnalyzeActor;
|
|
101
102
|
build: (next: IAutoBeInterfaceAuthorizationsApplication.IProps) => void;
|
|
102
103
|
}): IAgenticaController.IClass<Model> {
|
|
103
104
|
assertSchemaModel(props.model);
|
|
@@ -110,7 +111,7 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
110
111
|
if (result.success === false) return result;
|
|
111
112
|
|
|
112
113
|
// remove login operation for guest role
|
|
113
|
-
if (props.
|
|
114
|
+
if (props.actor.kind === "guest") {
|
|
114
115
|
result.data.operations = result.data.operations.filter(
|
|
115
116
|
(op) => op.authorizationType !== "login",
|
|
116
117
|
);
|
|
@@ -118,9 +119,9 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
118
119
|
|
|
119
120
|
const errors: IValidation.IError[] = [];
|
|
120
121
|
result.data.operations.forEach((op, i) => {
|
|
121
|
-
// validate
|
|
122
|
-
if (op.
|
|
123
|
-
op.
|
|
122
|
+
// validate authorizationActor
|
|
123
|
+
if (op.authorizationActor !== null) {
|
|
124
|
+
op.authorizationActor = props.actor.name;
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
// validate responseBody.typeName -> must be ~.IAuthorized
|
|
@@ -150,7 +151,7 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
150
151
|
For authentication operations (login, join, refresh), the response body type name must follow the convention "I{RoleName}.IAuthorized".
|
|
151
152
|
|
|
152
153
|
This standardized naming convention ensures consistency across all authentication endpoints and clearly identifies authorization response types.
|
|
153
|
-
The
|
|
154
|
+
The actor name should be in PascalCase format (e.g., IUser.IAuthorized, IAdmin.IAuthorized, ISeller.IAuthorized).
|
|
154
155
|
`,
|
|
155
156
|
});
|
|
156
157
|
});
|
|
@@ -165,7 +166,7 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
165
166
|
.filter((v) => v !== null),
|
|
166
167
|
);
|
|
167
168
|
for (const type of typia.misc.literals<AuthorizationType>())
|
|
168
|
-
if (props.
|
|
169
|
+
if (props.actor.kind === "guest" && type === "login") continue;
|
|
169
170
|
else if (authorizationTypes.has(type) === false)
|
|
170
171
|
errors.push({
|
|
171
172
|
path: "$input.operations[].authorizationType",
|
|
@@ -176,10 +177,10 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
176
177
|
value: `No authorizationType "${type}" found in any operation`,
|
|
177
178
|
description: StringUtil.trim`
|
|
178
179
|
There must be an operation that has defined AutoBeOpenApi.IOperation.authorizationType := "${type}"
|
|
179
|
-
for the "${props.
|
|
180
|
+
for the "${props.actor}" role's authorization activity; "${type}".
|
|
180
181
|
|
|
181
182
|
However, none of the operations have the AutoBeOpenApi.IOperation.authorizationType := "${type}"
|
|
182
|
-
value, so that the "${props.
|
|
183
|
+
value, so that the "${props.actor}" cannot perform the authorization ${type} activity.
|
|
183
184
|
|
|
184
185
|
Please make that operation at the next function calling. You have to do it.
|
|
185
186
|
`,
|
|
@@ -50,7 +50,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
50
50
|
> | null> = {
|
|
51
51
|
value: null,
|
|
52
52
|
};
|
|
53
|
-
const { tokenUsage } = await ctx.conversate({
|
|
53
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
54
54
|
source: "interfaceComplement",
|
|
55
55
|
histories: transformInterfaceComplementHistories({
|
|
56
56
|
state: ctx.state(),
|
|
@@ -86,6 +86,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
86
86
|
id: v7(),
|
|
87
87
|
missed,
|
|
88
88
|
schemas: pointer.value,
|
|
89
|
+
metric,
|
|
89
90
|
tokenUsage,
|
|
90
91
|
step: ctx.state().analyze?.step ?? 0,
|
|
91
92
|
created_at: new Date().toISOString(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
AutoBeInterfaceEndpointEvent,
|
|
4
4
|
AutoBeOpenApi,
|
|
5
5
|
AutoBeProgressEventBase,
|
|
6
6
|
} from "@autobe/interface";
|
|
@@ -53,7 +53,7 @@ export async function orchestrateInterfaceEndpoints<
|
|
|
53
53
|
AutoBeOpenApiEndpointComparator.hashCode,
|
|
54
54
|
AutoBeOpenApiEndpointComparator.equals,
|
|
55
55
|
).toJSON();
|
|
56
|
-
return orchestrateInterfaceEndpointsReview(ctx, deduplicated);
|
|
56
|
+
return await orchestrateInterfaceEndpointsReview(ctx, deduplicated);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
async function process<Model extends ILlmSchema.Model>(
|
|
@@ -71,8 +71,8 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
71
71
|
const pointer: IPointer<AutoBeOpenApi.IEndpoint[] | null> = {
|
|
72
72
|
value: null,
|
|
73
73
|
};
|
|
74
|
-
const { tokenUsage } = await ctx.conversate({
|
|
75
|
-
source: "
|
|
74
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
75
|
+
source: "interfaceEndpoint",
|
|
76
76
|
histories: transformInterfaceEndpointHistories({
|
|
77
77
|
state: ctx.state(),
|
|
78
78
|
group: props.group,
|
|
@@ -92,14 +92,15 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
92
92
|
});
|
|
93
93
|
if (pointer.value === null) throw new Error("Failed to generate endpoints."); // unreachable
|
|
94
94
|
|
|
95
|
-
const event:
|
|
96
|
-
type: "
|
|
95
|
+
const event: AutoBeInterfaceEndpointEvent = {
|
|
96
|
+
type: "interfaceEndpoint",
|
|
97
97
|
id: v7(),
|
|
98
98
|
endpoints: new HashSet(
|
|
99
99
|
pointer.value,
|
|
100
100
|
AutoBeOpenApiEndpointComparator.hashCode,
|
|
101
101
|
AutoBeOpenApiEndpointComparator.equals,
|
|
102
102
|
).toJSON(),
|
|
103
|
+
metric,
|
|
103
104
|
tokenUsage,
|
|
104
105
|
created_at: start.toISOString(),
|
|
105
106
|
step: ctx.state().analyze?.step ?? 0,
|
|
@@ -22,8 +22,8 @@ export async function orchestrateInterfaceEndpointsReview<
|
|
|
22
22
|
value: null,
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
const { tokenUsage } = await ctx.conversate({
|
|
26
|
-
source: "
|
|
25
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
26
|
+
source: "interfaceEndpointReview",
|
|
27
27
|
histories: transformInterfaceEndpointsReviewHistories(
|
|
28
28
|
ctx.state(),
|
|
29
29
|
endpoints,
|
|
@@ -43,22 +43,21 @@ export async function orchestrateInterfaceEndpointsReview<
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
const response = pointer.value?.endpoints ?? [];
|
|
46
|
-
|
|
47
46
|
ctx.dispatch({
|
|
48
47
|
id: v7(),
|
|
49
|
-
type: "
|
|
48
|
+
type: "interfaceEndpointReview",
|
|
50
49
|
endpoints,
|
|
51
50
|
content: response,
|
|
52
51
|
created_at: new Date().toISOString(),
|
|
53
52
|
review: pointer.value?.review,
|
|
54
53
|
step: ctx.state().analyze?.step ?? 0,
|
|
54
|
+
metric,
|
|
55
55
|
tokenUsage,
|
|
56
56
|
});
|
|
57
|
-
|
|
58
57
|
return response;
|
|
59
58
|
}
|
|
60
59
|
|
|
61
|
-
|
|
60
|
+
function createController<Model extends ILlmSchema.Model>(props: {
|
|
62
61
|
model: Model;
|
|
63
62
|
build: (props: IAutoBeInterfaceEndpointsReviewApplication.IProps) => void;
|
|
64
63
|
}): IAgenticaController.IClass<Model> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
|
-
import {
|
|
2
|
+
import { AutoBeInterfaceGroupEvent } from "@autobe/interface";
|
|
3
3
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
4
4
|
import { IPointer } from "tstl";
|
|
5
5
|
import typia from "typia";
|
|
@@ -18,13 +18,13 @@ export async function orchestrateInterfaceGroups<
|
|
|
18
18
|
instruction: string;
|
|
19
19
|
message?: string;
|
|
20
20
|
},
|
|
21
|
-
): Promise<
|
|
21
|
+
): Promise<AutoBeInterfaceGroupEvent> {
|
|
22
22
|
const start: Date = new Date();
|
|
23
23
|
const pointer: IPointer<IAutoBeInterfaceGroupApplication.IProps | null> = {
|
|
24
24
|
value: null,
|
|
25
25
|
};
|
|
26
|
-
const { tokenUsage } = await ctx.conversate({
|
|
27
|
-
source: "
|
|
26
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
27
|
+
source: "interfaceGroup",
|
|
28
28
|
histories: transformInterfaceGroupHistories({
|
|
29
29
|
state: ctx.state(),
|
|
30
30
|
instruction: props.instruction,
|
|
@@ -40,13 +40,14 @@ export async function orchestrateInterfaceGroups<
|
|
|
40
40
|
});
|
|
41
41
|
if (pointer.value === null) throw new Error("Failed to generate groups."); // unreachable
|
|
42
42
|
return {
|
|
43
|
-
type: "
|
|
43
|
+
type: "interfaceGroup",
|
|
44
44
|
id: v7(),
|
|
45
45
|
created_at: start.toISOString(),
|
|
46
46
|
groups: pointer.value.groups,
|
|
47
|
+
metric,
|
|
47
48
|
tokenUsage,
|
|
48
49
|
step: ctx.state().analyze?.step ?? 0,
|
|
49
|
-
} satisfies
|
|
50
|
+
} satisfies AutoBeInterfaceGroupEvent;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
function createController<Model extends ILlmSchema.Model>(props: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
AutoBeInterfaceOperationEvent,
|
|
4
4
|
AutoBeOpenApi,
|
|
5
5
|
AutoBeProgressEventBase,
|
|
6
6
|
} from "@autobe/interface";
|
|
@@ -119,8 +119,8 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
119
119
|
const pointer: IPointer<AutoBeOpenApi.IOperation[] | null> = {
|
|
120
120
|
value: null,
|
|
121
121
|
};
|
|
122
|
-
const { tokenUsage } = await ctx.conversate({
|
|
123
|
-
source: "
|
|
122
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
123
|
+
source: "interfaceOperation",
|
|
124
124
|
histories: transformInterfaceOperationHistories({
|
|
125
125
|
state: ctx.state(),
|
|
126
126
|
endpoints: props.endpoints.toJSON(),
|
|
@@ -128,11 +128,11 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
128
128
|
}),
|
|
129
129
|
controller: createController({
|
|
130
130
|
model: ctx.model,
|
|
131
|
-
|
|
131
|
+
actors: ctx.state().analyze?.actors.map((it) => it.name) ?? [],
|
|
132
132
|
build: (operations) => {
|
|
133
133
|
pointer.value ??= [];
|
|
134
134
|
const matrix: AutoBeOpenApi.IOperation[][] = operations.map((op) => {
|
|
135
|
-
if (op.
|
|
135
|
+
if (op.authorizationActors.length === 0)
|
|
136
136
|
return [
|
|
137
137
|
{
|
|
138
138
|
...op,
|
|
@@ -141,19 +141,19 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
141
141
|
[prefix, ...op.path.split("/")]
|
|
142
142
|
.filter((it) => it !== "")
|
|
143
143
|
.join("/"),
|
|
144
|
-
|
|
144
|
+
authorizationActor: null,
|
|
145
145
|
authorizationType: null,
|
|
146
146
|
prerequisites: [],
|
|
147
147
|
},
|
|
148
148
|
];
|
|
149
|
-
return op.
|
|
149
|
+
return op.authorizationActors.map((actor) => ({
|
|
150
150
|
...op,
|
|
151
151
|
path:
|
|
152
152
|
"/" +
|
|
153
|
-
[prefix,
|
|
153
|
+
[prefix, actor, ...op.path.split("/")]
|
|
154
154
|
.filter((it) => it !== "")
|
|
155
155
|
.join("/"),
|
|
156
|
-
|
|
156
|
+
authorizationActor: actor,
|
|
157
157
|
authorizationType: null,
|
|
158
158
|
prerequisites: [],
|
|
159
159
|
}));
|
|
@@ -163,10 +163,10 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
163
163
|
props.progress.total += operations
|
|
164
164
|
.map((op) =>
|
|
165
165
|
props.endpoints.has({ path: op.path, method: op.method })
|
|
166
|
-
? op.
|
|
166
|
+
? op.authorizationActors.length === 0
|
|
167
167
|
? 0
|
|
168
|
-
: op.
|
|
169
|
-
: op.
|
|
168
|
+
: op.authorizationActors.length - 1
|
|
169
|
+
: op.authorizationActors.length,
|
|
170
170
|
)
|
|
171
171
|
.reduce((a, b) => a + b, 0);
|
|
172
172
|
},
|
|
@@ -178,20 +178,21 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
178
178
|
if (pointer.value === null) throw new Error("Failed to create operations."); // never be happened
|
|
179
179
|
|
|
180
180
|
ctx.dispatch({
|
|
181
|
-
type: "
|
|
181
|
+
type: "interfaceOperation",
|
|
182
182
|
id: v7(),
|
|
183
183
|
operations: pointer.value,
|
|
184
|
+
metric,
|
|
184
185
|
tokenUsage,
|
|
185
186
|
...props.progress,
|
|
186
187
|
step: ctx.state().analyze?.step ?? 0,
|
|
187
188
|
created_at: new Date().toISOString(),
|
|
188
|
-
} satisfies
|
|
189
|
+
} satisfies AutoBeInterfaceOperationEvent);
|
|
189
190
|
return pointer.value;
|
|
190
191
|
}
|
|
191
192
|
|
|
192
193
|
function createController<Model extends ILlmSchema.Model>(props: {
|
|
193
194
|
model: Model;
|
|
194
|
-
|
|
195
|
+
actors: string[];
|
|
195
196
|
build: (
|
|
196
197
|
operations: IAutoBeInterfaceOperationApplication.IOperation[],
|
|
197
198
|
) => void;
|
|
@@ -216,21 +217,21 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
216
217
|
|
|
217
218
|
operations.forEach((op, i) => {
|
|
218
219
|
// validate roles
|
|
219
|
-
if (props.
|
|
220
|
-
else if (op.
|
|
221
|
-
op.
|
|
222
|
-
if (props.
|
|
220
|
+
if (props.actors.length === 0) op.authorizationActors = [];
|
|
221
|
+
else if (op.authorizationActors.length !== 0 && props.actors.length !== 0)
|
|
222
|
+
op.authorizationActors.forEach((actor, j) => {
|
|
223
|
+
if (props.actors.includes(actor) === true) return;
|
|
223
224
|
errors.push({
|
|
224
|
-
path: `$input.operations[${i}].
|
|
225
|
-
expected: `null | ${props.
|
|
225
|
+
path: `$input.operations[${i}].authorizationActors[${j}]`,
|
|
226
|
+
expected: `null | ${props.actors.map((str) => JSON.stringify(str)).join(" | ")}`,
|
|
226
227
|
description: StringUtil.trim`
|
|
227
|
-
|
|
228
|
+
Actor "${actor}" is not defined in the roles list.
|
|
228
229
|
|
|
229
230
|
Please select one of them below, or do not define (\`null\`):
|
|
230
231
|
|
|
231
|
-
${props.
|
|
232
|
+
${props.actors.map((role) => `- ${role}`).join("\n")}
|
|
232
233
|
`,
|
|
233
|
-
value:
|
|
234
|
+
value: actor,
|
|
234
235
|
});
|
|
235
236
|
});
|
|
236
237
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
AutoBeInterfaceOperationReviewEvent,
|
|
4
4
|
AutoBeOpenApi,
|
|
5
5
|
AutoBePrisma,
|
|
6
6
|
AutoBeProgressEventBase,
|
|
@@ -28,8 +28,8 @@ export async function orchestrateInterfaceOperationsReview<
|
|
|
28
28
|
{
|
|
29
29
|
value: null,
|
|
30
30
|
};
|
|
31
|
-
const { tokenUsage } = await ctx.conversate({
|
|
32
|
-
source: "
|
|
31
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
32
|
+
source: "interfaceOperationReview",
|
|
33
33
|
histories: transformInterfaceOperationsReviewHistories(ctx, operations),
|
|
34
34
|
controller: createReviewController({
|
|
35
35
|
model: ctx.model,
|
|
@@ -54,18 +54,19 @@ export async function orchestrateInterfaceOperationsReview<
|
|
|
54
54
|
);
|
|
55
55
|
|
|
56
56
|
ctx.dispatch({
|
|
57
|
-
type: "
|
|
57
|
+
type: "interfaceOperationReview",
|
|
58
58
|
id: v7(),
|
|
59
59
|
operations: content,
|
|
60
60
|
review: pointer.value.think.review,
|
|
61
61
|
plan: pointer.value.think.plan,
|
|
62
62
|
content,
|
|
63
|
+
metric,
|
|
63
64
|
tokenUsage,
|
|
64
65
|
created_at: new Date().toISOString(),
|
|
65
66
|
step: ctx.state().analyze?.step ?? 0,
|
|
66
67
|
total: progress.total,
|
|
67
68
|
completed: ++progress.completed,
|
|
68
|
-
} satisfies
|
|
69
|
+
} satisfies AutoBeInterfaceOperationReviewEvent);
|
|
69
70
|
return content;
|
|
70
71
|
} catch {
|
|
71
72
|
++progress.completed;
|
|
@@ -107,8 +107,8 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
try {
|
|
110
|
-
const { tokenUsage } = await ctx.conversate({
|
|
111
|
-
source: "
|
|
110
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
111
|
+
source: "interfacePrerequisite",
|
|
112
112
|
controller: createController({
|
|
113
113
|
model: ctx.model,
|
|
114
114
|
document: props.document,
|
|
@@ -131,9 +131,10 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
|
131
131
|
|
|
132
132
|
props.progress.completed += pointer.value.length;
|
|
133
133
|
ctx.dispatch({
|
|
134
|
-
type: "
|
|
134
|
+
type: "interfacePrerequisite",
|
|
135
135
|
id: v7(),
|
|
136
136
|
created_at: new Date().toISOString(),
|
|
137
|
+
metric,
|
|
137
138
|
tokenUsage,
|
|
138
139
|
operations: pointer.value,
|
|
139
140
|
total: props.progress.total,
|