@autobe/agent 0.18.0 → 0.20.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/AutoBeMockAgent.d.ts +2 -10
- package/lib/agent/src/AutoBeAgent.js +8 -2
- package/lib/agent/src/AutoBeAgent.js.map +1 -1
- package/lib/agent/src/AutoBeMockAgent.d.ts +2 -10
- package/lib/agent/src/AutoBeMockAgent.js +10 -5
- package/lib/agent/src/AutoBeMockAgent.js.map +1 -1
- package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +23 -29
- package/lib/agent/src/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/agent/src/context/AutoBeContext.d.ts +1 -0
- package/lib/agent/src/context/AutoBeTokenUsageComponent.d.ts +1 -0
- package/lib/agent/src/context/AutoBeTokenUsageComponent.js +14 -0
- package/lib/agent/src/context/AutoBeTokenUsageComponent.js.map +1 -1
- package/lib/agent/src/factory/consentFunctionCall.d.ts +10 -0
- package/lib/agent/src/factory/consentFunctionCall.js +213 -0
- package/lib/agent/src/factory/consentFunctionCall.js.map +1 -0
- package/lib/agent/src/factory/createAgenticaHistory.js +1 -0
- package/lib/agent/src/factory/createAgenticaHistory.js.map +1 -1
- package/lib/agent/src/factory/createAutoBeContext.js +79 -19
- package/lib/agent/src/factory/createAutoBeContext.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.d.ts +6 -0
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +41 -0
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -0
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +12 -9
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +3 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +45 -31
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js +25 -6
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +8 -3
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js +15 -12
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js +33 -44
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +6 -4
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js +10 -4
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +16 -16
- package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +5 -5
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js +45 -45
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +14 -14
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js +31 -30
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +24 -31
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js +4 -4
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js +27 -26
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +13 -12
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.js +4 -4
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +11 -10
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +36 -29
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterface.js +31 -9
- package/lib/agent/src/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +2 -2
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js +1571 -1144
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js +24 -4
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js +6 -2
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js +12 -14
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +103 -71
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.d.ts +2 -3
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +147 -116
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +401 -233
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +2 -5
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js +362 -178
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +38 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +16 -16
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +97 -14
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +75 -1
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +46 -14
- package/lib/agent/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +18 -24
- package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.d.ts +7 -0
- package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js +35 -0
- package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js.map +1 -0
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +60 -66
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +19 -30
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +38 -35
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +39 -26
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js +15 -4
- package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -2
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js +7 -9
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +38 -2
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js +61 -10
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js +68 -24
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +24 -21
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +59 -57
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +1 -0
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +17 -13
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +3 -0
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +287 -0
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -2
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +46 -49
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.d.ts +7 -0
- package/lib/agent/src/orchestrate/realize/internal/{compile.js → compileRealizeFiles.js} +12 -29
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +76 -45
- package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +15 -9
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +9 -7
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +9 -6
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +25 -20
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.d.ts +0 -66
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +8 -6
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +36 -27
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +3 -3
- package/lib/agent/src/orchestrate/{internal/IProgress.js → realize/structures/IAutoBeRealizeCorrectApplication.js} +1 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +19 -16
- package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js +5 -1
- package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/completeTestCode.js +13 -10
- package/lib/agent/src/orchestrate/test/compile/completeTestCode.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +17 -16
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js +33 -32
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.d.ts +2 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +97 -49
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +3 -3
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTest.js +17 -4
- package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +18 -9
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +138 -23
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +17 -17
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +7 -6
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +1 -1
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.d.ts +6 -0
- package/lib/agent/src/orchestrate/{realize/structures/IAutoBeRealizeCoderApplication.js → test/structures/IAutoBeTestScenarioAuthorizationRole.js} +1 -1
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.js.map +1 -0
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +2 -2
- package/lib/agent/src/utils/executeCachedBatch.d.ts +1 -0
- package/lib/agent/src/utils/executeCachedBatch.js +23 -0
- package/lib/agent/src/utils/executeCachedBatch.js.map +1 -0
- package/lib/agent/src/utils/predicateStateMessage.d.ts +4 -0
- package/lib/agent/src/utils/predicateStateMessage.js +87 -0
- package/lib/agent/src/utils/predicateStateMessage.js.map +1 -0
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +23 -29
- package/lib/context/AutoBeContext.d.ts +1 -0
- package/lib/context/AutoBeTokenUsageComponent.d.ts +1 -0
- package/lib/factory/consentFunctionCall.d.ts +10 -0
- package/lib/index.mjs +4799 -2637
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.d.ts +6 -0
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +3 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +8 -3
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +6 -4
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +16 -16
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +5 -5
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.d.ts +2 -3
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +2 -5
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +38 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +16 -16
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +97 -14
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +75 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +46 -14
- package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +18 -24
- package/lib/orchestrate/interface/utils/validateAuthorizationSchema.d.ts +7 -0
- package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -2
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +1 -0
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +3 -0
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -2
- package/lib/orchestrate/realize/internal/compileRealizeFiles.d.ts +7 -0
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +9 -6
- package/lib/orchestrate/realize/orchestrateRealizeScenario.d.ts +0 -66
- package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +8 -6
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +3 -3
- package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +19 -16
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.d.ts +2 -1
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +7 -6
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.d.ts +6 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +2 -2
- package/lib/utils/executeCachedBatch.d.ts +1 -0
- package/lib/utils/predicateStateMessage.d.ts +4 -0
- package/package.json +6 -6
- package/src/AutoBeAgent.ts +18 -3
- package/src/AutoBeMockAgent.ts +13 -15
- package/src/constants/AutoBeSystemPromptConstant.ts +23 -29
- package/src/context/AutoBeContext.ts +1 -0
- package/src/context/AutoBeTokenUsageComponent.ts +20 -0
- package/src/factory/consentFunctionCall.ts +129 -0
- package/src/factory/createAgenticaHistory.ts +1 -0
- package/src/factory/createAutoBeContext.ts +108 -20
- package/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.ts +53 -0
- package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +13 -10
- package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +68 -47
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +33 -21
- package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +21 -10
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +18 -40
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +15 -8
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.ts +16 -16
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +5 -5
- package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +47 -47
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +14 -14
- package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +31 -30
- package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +20 -29
- package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +3 -3
- package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +23 -22
- package/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.ts +12 -11
- package/src/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.ts +5 -5
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +11 -10
- package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +37 -30
- package/src/orchestrate/interface/orchestrateInterface.ts +53 -12
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +142 -32
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +2 -0
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +13 -9
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +8 -19
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +82 -74
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +51 -32
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +174 -56
- package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +149 -63
- package/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.ts +39 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +16 -16
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +101 -14
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +77 -1
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +47 -14
- package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +18 -24
- package/src/orchestrate/interface/utils/validateAuthorizationSchema.ts +41 -0
- package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +61 -66
- package/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.ts +19 -30
- package/src/orchestrate/prisma/histories/transformPrismaReviewHistories.ts +38 -35
- package/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts +36 -23
- package/src/orchestrate/prisma/orchestratePrisma.ts +17 -6
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +8 -19
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +3 -0
- package/src/orchestrate/prisma/orchestratePrismaReview.ts +37 -18
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +25 -17
- package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +24 -21
- package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +57 -59
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +20 -14
- package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +294 -0
- package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +62 -57
- package/src/orchestrate/realize/internal/compileRealizeFiles.ts +71 -0
- package/src/orchestrate/realize/orchestrateRealize.ts +109 -86
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +22 -13
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +3 -0
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +28 -24
- package/src/orchestrate/realize/orchestrateRealizeScenario.ts +0 -74
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +37 -28
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +3 -3
- package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +19 -16
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +7 -0
- package/src/orchestrate/test/compile/completeTestCode.ts +17 -13
- package/src/orchestrate/test/experimental/transformTestCorrectHistories.ast +4 -4
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +17 -16
- package/src/orchestrate/test/histories/transformTestHistories.ts +35 -34
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +116 -60
- package/src/orchestrate/test/histories/transformTestWriteHistories.ts +3 -3
- package/src/orchestrate/test/orchestrateTest.ts +18 -8
- package/src/orchestrate/test/orchestrateTestCorrect.ts +34 -24
- package/src/orchestrate/test/orchestrateTestScenario.ts +179 -36
- package/src/orchestrate/test/orchestrateTestWrite.ts +18 -19
- package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +7 -6
- package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +1 -1
- package/src/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.ts +7 -0
- package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +2 -2
- package/src/utils/executeCachedBatch.ts +15 -0
- package/src/utils/predicateStateMessage.ts +107 -0
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +0 -4
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.js +0 -46
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.js.map +0 -1
- package/lib/agent/src/orchestrate/internal/IProgress.d.ts +0 -4
- package/lib/agent/src/orchestrate/internal/IProgress.js.map +0 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCoderHistories.d.ts +0 -7
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCoderHistories.js +0 -213
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCoderHistories.js.map +0 -1
- package/lib/agent/src/orchestrate/realize/internal/compile.d.ts +0 -7
- package/lib/agent/src/orchestrate/realize/internal/compile.js.map +0 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +0 -345
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.js.map +0 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCompile.d.ts +0 -56
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCompile.js +0 -3
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCompile.js.map +0 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.d.ts +0 -2
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.js +0 -5
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.js.map +0 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeReviewApplication.js +0 -3
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeReviewApplication.js.map +0 -1
- package/lib/agent/src/utils/pipe.d.ts +0 -5
- package/lib/agent/src/utils/pipe.js +0 -14
- package/lib/agent/src/utils/pipe.js.map +0 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +0 -4
- package/lib/orchestrate/internal/IProgress.d.ts +0 -4
- package/lib/orchestrate/realize/histories/transformRealizeCoderHistories.d.ts +0 -7
- package/lib/orchestrate/realize/internal/compile.d.ts +0 -7
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +0 -345
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.d.ts +0 -56
- package/lib/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.d.ts +0 -2
- package/lib/utils/pipe.d.ts +0 -5
- package/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.ts +0 -53
- package/src/orchestrate/internal/IProgress.ts +0 -4
- package/src/orchestrate/realize/histories/transformRealizeCoderHistories.ts +0 -248
- package/src/orchestrate/realize/internal/compile.ts +0 -84
- package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +0 -358
- package/src/orchestrate/realize/structures/IAutoBeRealizeCompile.ts +0 -70
- package/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.ts +0 -2
- package/src/utils/pipe.ts +0 -39
- /package/lib/agent/src/orchestrate/realize/structures/{IAutoBeRealizeReviewApplication.d.ts → IAutoBeRealizeCorrectApplication.d.ts} +0 -0
- /package/lib/orchestrate/realize/structures/{IAutoBeRealizeReviewApplication.d.ts → IAutoBeRealizeCorrectApplication.d.ts} +0 -0
- /package/src/orchestrate/realize/structures/{IAutoBeRealizeReviewApplication.ts → IAutoBeRealizeCorrectApplication.ts} +0 -0
|
@@ -1,42 +1,56 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
AutoBeAnalyzeRole,
|
|
4
|
+
AutoBeInterfaceAuthorization,
|
|
5
|
+
AutoBeOpenApi,
|
|
6
|
+
AutoBeProgressEventBase,
|
|
7
|
+
} from "@autobe/interface";
|
|
3
8
|
import { AutoBeInterfaceAuthorizationEvent } from "@autobe/interface/src/events/AutoBeInterfaceAuthorizationEvent";
|
|
4
|
-
import {
|
|
9
|
+
import { StringUtil } from "@autobe/utils";
|
|
10
|
+
import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
|
|
5
11
|
import { IPointer } from "tstl";
|
|
6
12
|
import typia from "typia";
|
|
13
|
+
import { v7 } from "uuid";
|
|
7
14
|
|
|
8
15
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
9
16
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
10
|
-
import {
|
|
17
|
+
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
11
18
|
import { transformInterfaceAuthorizationsHistories } from "./histories/transformInterfaceAuthorizationsHistories";
|
|
12
19
|
import { IAutoBeInterfaceAuthorizationsApplication } from "./structures/IAutoBeInterfaceAuthorizationsApplication";
|
|
13
20
|
|
|
14
21
|
export async function orchestrateInterfaceAuthorizations<
|
|
15
22
|
Model extends ILlmSchema.Model,
|
|
16
|
-
>(ctx: AutoBeContext<Model>): Promise<
|
|
23
|
+
>(ctx: AutoBeContext<Model>): Promise<AutoBeInterfaceAuthorization[]> {
|
|
17
24
|
const roles: AutoBeAnalyzeRole[] = ctx.state().analyze?.roles ?? [];
|
|
18
|
-
const progress:
|
|
25
|
+
const progress: AutoBeProgressEventBase = {
|
|
19
26
|
total: roles.length,
|
|
20
27
|
completed: 0,
|
|
21
28
|
};
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
const authorizations: AutoBeInterfaceAuthorization[] =
|
|
30
|
+
await executeCachedBatch(
|
|
31
|
+
roles.map((role) => async (promptCacheKey) => {
|
|
32
|
+
const event: AutoBeInterfaceAuthorizationEvent = await process(
|
|
33
|
+
ctx,
|
|
34
|
+
role,
|
|
35
|
+
progress,
|
|
36
|
+
promptCacheKey,
|
|
37
|
+
);
|
|
38
|
+
ctx.dispatch(event);
|
|
39
|
+
return {
|
|
40
|
+
role: role.name,
|
|
41
|
+
operations: event.operations,
|
|
42
|
+
};
|
|
43
|
+
}),
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
return authorizations;
|
|
34
47
|
}
|
|
35
48
|
|
|
36
49
|
async function process<Model extends ILlmSchema.Model>(
|
|
37
50
|
ctx: AutoBeContext<Model>,
|
|
38
51
|
role: AutoBeAnalyzeRole,
|
|
39
|
-
progress:
|
|
52
|
+
progress: AutoBeProgressEventBase,
|
|
53
|
+
promptCacheKey: string,
|
|
40
54
|
): Promise<AutoBeInterfaceAuthorizationEvent> {
|
|
41
55
|
const pointer: IPointer<IAutoBeInterfaceAuthorizationsApplication.IProps | null> =
|
|
42
56
|
{
|
|
@@ -47,11 +61,13 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
47
61
|
histories: transformInterfaceAuthorizationsHistories(ctx.state(), role),
|
|
48
62
|
controller: createController({
|
|
49
63
|
model: ctx.model,
|
|
64
|
+
role: role.name,
|
|
50
65
|
build: (next) => {
|
|
51
66
|
pointer.value = next;
|
|
52
67
|
},
|
|
53
68
|
}),
|
|
54
69
|
enforceFunctionCall: true,
|
|
70
|
+
promptCacheKey,
|
|
55
71
|
message: "Create Authorization Operation for the given roles",
|
|
56
72
|
});
|
|
57
73
|
if (pointer.value === null)
|
|
@@ -59,6 +75,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
59
75
|
|
|
60
76
|
return {
|
|
61
77
|
type: "interfaceAuthorization",
|
|
78
|
+
id: v7(),
|
|
62
79
|
operations: pointer.value.operations,
|
|
63
80
|
completed: ++progress.completed,
|
|
64
81
|
tokenUsage,
|
|
@@ -70,13 +87,100 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
70
87
|
|
|
71
88
|
function createController<Model extends ILlmSchema.Model>(props: {
|
|
72
89
|
model: Model;
|
|
90
|
+
role: string;
|
|
73
91
|
build: (next: IAutoBeInterfaceAuthorizationsApplication.IProps) => void;
|
|
74
92
|
}): IAgenticaController.IClass<Model> {
|
|
75
93
|
assertSchemaModel(props.model);
|
|
76
94
|
|
|
95
|
+
const validate = (
|
|
96
|
+
next: unknown,
|
|
97
|
+
): IValidation<IAutoBeInterfaceAuthorizationsApplication.IProps> => {
|
|
98
|
+
const result: IValidation<IAutoBeInterfaceAuthorizationsApplication.IProps> =
|
|
99
|
+
typia.validate<IAutoBeInterfaceAuthorizationsApplication.IProps>(next);
|
|
100
|
+
if (result.success === false) return result;
|
|
101
|
+
|
|
102
|
+
const errors: IValidation.IError[] = [];
|
|
103
|
+
result.data.operations.forEach((op, i) => {
|
|
104
|
+
// validate authorizationRole
|
|
105
|
+
if (op.authorizationRole !== null) {
|
|
106
|
+
op.authorizationRole = props.role;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// validate responseBody.typeName -> must be ~.IAuthorized
|
|
110
|
+
if (op.authorizationType === null) return;
|
|
111
|
+
else if (op.responseBody === null)
|
|
112
|
+
errors.push({
|
|
113
|
+
path: `$input.operations.${i}.responseBody`,
|
|
114
|
+
expected:
|
|
115
|
+
"Response body with I{RoleName(PascalCase)}.IAuthorized type is required",
|
|
116
|
+
value: op.responseBody,
|
|
117
|
+
description: StringUtil.trim`
|
|
118
|
+
Response body is required for authentication operations.
|
|
119
|
+
|
|
120
|
+
The responseBody must contain description and typeName fields.
|
|
121
|
+
typeName must be I{Prefix(PascalCase)}{RoleName(PascalCase)}.IAuthorized
|
|
122
|
+
description must be a detailed description of the response body.
|
|
123
|
+
`,
|
|
124
|
+
});
|
|
125
|
+
else if (!op.responseBody.typeName.endsWith(".IAuthorized"))
|
|
126
|
+
errors.push({
|
|
127
|
+
path: `$input.operations.${i}.responseBody.typeName`,
|
|
128
|
+
expected: `Type name must be I{RoleName(PascalCase)}.IAuthorized`,
|
|
129
|
+
value: op.responseBody?.typeName,
|
|
130
|
+
description: StringUtil.trim`
|
|
131
|
+
Wrong response body type name: ${op.responseBody?.typeName}
|
|
132
|
+
|
|
133
|
+
For authentication operations (login, join, refresh), the response body type name must follow the convention "I{RoleName}.IAuthorized".
|
|
134
|
+
|
|
135
|
+
This standardized naming convention ensures consistency across all authentication endpoints and clearly identifies authorization response types.
|
|
136
|
+
The Role name should be in PascalCase format (e.g., IUser.IAuthorized, IAdmin.IAuthorized, ISeller.IAuthorized).
|
|
137
|
+
`,
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// validate authorization types' existence
|
|
142
|
+
type AuthorizationType = NonNullable<
|
|
143
|
+
AutoBeOpenApi.IOperation["authorizationType"]
|
|
144
|
+
>;
|
|
145
|
+
const authorizationTypes: Set<AuthorizationType> = new Set(
|
|
146
|
+
result.data.operations
|
|
147
|
+
.map((o) => o.authorizationType)
|
|
148
|
+
.filter((v) => v !== null),
|
|
149
|
+
);
|
|
150
|
+
for (const type of typia.misc.literals<AuthorizationType>())
|
|
151
|
+
if (authorizationTypes.has(type) === false)
|
|
152
|
+
errors.push({
|
|
153
|
+
path: "$input.operations[].authorizationType",
|
|
154
|
+
expected: StringUtil.trim`{
|
|
155
|
+
...(AutoBeOpenApi.IOperation data),
|
|
156
|
+
authorizationType: "${type}"
|
|
157
|
+
}`,
|
|
158
|
+
value: `No authorizationType "${type}" found in any operation`,
|
|
159
|
+
description: StringUtil.trim`
|
|
160
|
+
There must be an operation that has defined AutoBeOpenApi.IOperation.authorizationType := "${type}"
|
|
161
|
+
for the "${props.role}" role's authorization activity; "${type}".
|
|
162
|
+
|
|
163
|
+
However, none of the operations have the AutoBeOpenApi.IOperation.authorizationType := "${type}"
|
|
164
|
+
value, so that the "${props.role}" cannot perform the authorization ${type} activity.
|
|
165
|
+
|
|
166
|
+
Please make that operation at the next function calling. You have to do it.
|
|
167
|
+
`,
|
|
168
|
+
});
|
|
169
|
+
if (errors.length !== 0) {
|
|
170
|
+
return {
|
|
171
|
+
success: false,
|
|
172
|
+
errors,
|
|
173
|
+
data: next,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
return result;
|
|
177
|
+
};
|
|
178
|
+
|
|
77
179
|
const application: ILlmApplication<Model> = collection[
|
|
78
|
-
props.model
|
|
79
|
-
]
|
|
180
|
+
props.model === "chatgpt" ? "chatgpt" : "claude"
|
|
181
|
+
](
|
|
182
|
+
validate,
|
|
183
|
+
) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
|
|
80
184
|
|
|
81
185
|
return {
|
|
82
186
|
protocol: "class",
|
|
@@ -90,17 +194,23 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
90
194
|
};
|
|
91
195
|
}
|
|
92
196
|
|
|
93
|
-
const claude = typia.llm.application<
|
|
94
|
-
IAutoBeInterfaceAuthorizationsApplication,
|
|
95
|
-
"claude"
|
|
96
|
-
>();
|
|
97
197
|
const collection = {
|
|
98
|
-
chatgpt:
|
|
99
|
-
IAutoBeInterfaceAuthorizationsApplication,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
198
|
+
chatgpt: (validate: Validator) =>
|
|
199
|
+
typia.llm.application<IAutoBeInterfaceAuthorizationsApplication, "chatgpt">(
|
|
200
|
+
{
|
|
201
|
+
validate: {
|
|
202
|
+
makeOperations: validate,
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
),
|
|
206
|
+
claude: (validate: Validator) =>
|
|
207
|
+
typia.llm.application<IAutoBeInterfaceAuthorizationsApplication, "claude">({
|
|
208
|
+
validate: {
|
|
209
|
+
makeOperations: validate,
|
|
210
|
+
},
|
|
211
|
+
}),
|
|
106
212
|
};
|
|
213
|
+
|
|
214
|
+
type Validator = (
|
|
215
|
+
input: unknown,
|
|
216
|
+
) => IValidation<IAutoBeInterfaceAuthorizationsApplication.IProps>;
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import { OpenApiV3_1Emender } from "@samchon/openapi/lib/converters/OpenApiV3_1Emender";
|
|
9
9
|
import { IPointer } from "tstl";
|
|
10
10
|
import typia from "typia";
|
|
11
|
+
import { v7 } from "uuid";
|
|
11
12
|
|
|
12
13
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
13
14
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
@@ -70,6 +71,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
70
71
|
);
|
|
71
72
|
ctx.dispatch({
|
|
72
73
|
type: "interfaceComplement",
|
|
74
|
+
id: v7(),
|
|
73
75
|
missed,
|
|
74
76
|
schemas: pointer.value,
|
|
75
77
|
tokenUsage,
|
|
@@ -2,14 +2,17 @@ import { IAgenticaController } from "@agentica/core";
|
|
|
2
2
|
import {
|
|
3
3
|
AutoBeInterfaceEndpointsEvent,
|
|
4
4
|
AutoBeOpenApi,
|
|
5
|
+
AutoBeProgressEventBase,
|
|
5
6
|
} from "@autobe/interface";
|
|
6
7
|
import { AutoBeInterfaceGroup } from "@autobe/interface/src/histories/contents/AutoBeInterfaceGroup";
|
|
7
8
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
8
9
|
import { HashSet, IPointer } from "tstl";
|
|
9
10
|
import typia from "typia";
|
|
11
|
+
import { v7 } from "uuid";
|
|
10
12
|
|
|
11
13
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
12
14
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
15
|
+
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
13
16
|
import { transformInterfaceEndpointHistories } from "./histories/transformInterfaceEndpointHistories";
|
|
14
17
|
import { IAutoBeInterfaceEndpointApplication } from "./structures/IAutoBeInterfaceEndpointApplication";
|
|
15
18
|
import { OpenApiEndpointComparator } from "./utils/OpenApiEndpointComparator";
|
|
@@ -22,13 +25,16 @@ export async function orchestrateInterfaceEndpoints<
|
|
|
22
25
|
authorizations: AutoBeOpenApi.IOperation[],
|
|
23
26
|
content: string = `Make endpoints for the given assets`,
|
|
24
27
|
): Promise<AutoBeOpenApi.IEndpoint[]> {
|
|
25
|
-
const progress:
|
|
28
|
+
const progress: AutoBeProgressEventBase = {
|
|
26
29
|
total: groups.length,
|
|
27
30
|
completed: 0,
|
|
28
31
|
};
|
|
29
32
|
const endpoints: AutoBeOpenApi.IEndpoint[] = (
|
|
30
|
-
await
|
|
31
|
-
groups.map(
|
|
33
|
+
await executeCachedBatch(
|
|
34
|
+
groups.map(
|
|
35
|
+
(g) => (promptCacheKey) =>
|
|
36
|
+
process(ctx, g, content, progress, authorizations, promptCacheKey),
|
|
37
|
+
),
|
|
32
38
|
)
|
|
33
39
|
).flat();
|
|
34
40
|
return new HashSet(
|
|
@@ -42,8 +48,9 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
42
48
|
ctx: AutoBeContext<Model>,
|
|
43
49
|
group: AutoBeInterfaceGroup,
|
|
44
50
|
message: string,
|
|
45
|
-
progress:
|
|
51
|
+
progress: AutoBeProgressEventBase,
|
|
46
52
|
authorizations: AutoBeOpenApi.IOperation[],
|
|
53
|
+
promptCacheKey: string,
|
|
47
54
|
): Promise<AutoBeOpenApi.IEndpoint[]> {
|
|
48
55
|
const start: Date = new Date();
|
|
49
56
|
const pointer: IPointer<AutoBeOpenApi.IEndpoint[] | null> = {
|
|
@@ -64,12 +71,14 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
64
71
|
},
|
|
65
72
|
}),
|
|
66
73
|
enforceFunctionCall: true,
|
|
74
|
+
promptCacheKey,
|
|
67
75
|
message,
|
|
68
76
|
});
|
|
69
77
|
if (pointer.value === null) throw new Error("Failed to generate endpoints."); // unreachable
|
|
70
78
|
|
|
71
79
|
const event: AutoBeInterfaceEndpointsEvent = {
|
|
72
80
|
type: "interfaceEndpoints",
|
|
81
|
+
id: v7(),
|
|
73
82
|
endpoints: new HashSet(
|
|
74
83
|
pointer.value,
|
|
75
84
|
OpenApiEndpointComparator.hashCode,
|
|
@@ -120,8 +129,3 @@ const collection = {
|
|
|
120
129
|
deepseek: claude,
|
|
121
130
|
"3.1": claude,
|
|
122
131
|
};
|
|
123
|
-
|
|
124
|
-
interface IProgress {
|
|
125
|
-
total: number;
|
|
126
|
-
completed: number;
|
|
127
|
-
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { IAgenticaController
|
|
2
|
-
import {
|
|
3
|
-
AutoBeAssistantMessageHistory,
|
|
4
|
-
AutoBeInterfaceGroupsEvent,
|
|
5
|
-
} from "@autobe/interface";
|
|
1
|
+
import { IAgenticaController } from "@agentica/core";
|
|
2
|
+
import { AutoBeInterfaceGroupsEvent } from "@autobe/interface";
|
|
6
3
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
7
4
|
import { IPointer } from "tstl";
|
|
8
5
|
import typia from "typia";
|
|
9
|
-
import {
|
|
6
|
+
import { v7 } from "uuid";
|
|
10
7
|
|
|
11
8
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
12
9
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
@@ -18,12 +15,12 @@ export async function orchestrateInterfaceGroups<
|
|
|
18
15
|
>(
|
|
19
16
|
ctx: AutoBeContext<Model>,
|
|
20
17
|
message: string = "Design API operations for the given assets.",
|
|
21
|
-
): Promise<
|
|
18
|
+
): Promise<AutoBeInterfaceGroupsEvent> {
|
|
22
19
|
const start: Date = new Date();
|
|
23
20
|
const pointer: IPointer<IAutoBeInterfaceGroupApplication.IProps | null> = {
|
|
24
21
|
value: null,
|
|
25
22
|
};
|
|
26
|
-
const {
|
|
23
|
+
const { tokenUsage } = await ctx.conversate({
|
|
27
24
|
source: "interfaceGroups",
|
|
28
25
|
histories: transformInterfaceGroupHistories(ctx.state()),
|
|
29
26
|
controller: createController({
|
|
@@ -32,21 +29,13 @@ export async function orchestrateInterfaceGroups<
|
|
|
32
29
|
pointer.value = next;
|
|
33
30
|
},
|
|
34
31
|
}),
|
|
35
|
-
enforceFunctionCall:
|
|
32
|
+
enforceFunctionCall: true,
|
|
36
33
|
message,
|
|
37
34
|
});
|
|
38
|
-
|
|
39
|
-
if (last.type === "assistantMessage")
|
|
40
|
-
return {
|
|
41
|
-
...last,
|
|
42
|
-
created_at: start.toISOString(),
|
|
43
|
-
completed_at: new Date().toISOString(),
|
|
44
|
-
id: v4(),
|
|
45
|
-
} satisfies AutoBeAssistantMessageHistory;
|
|
46
|
-
else if (pointer.value === null)
|
|
47
|
-
throw new Error("Failed to generate groups."); // unreachable
|
|
35
|
+
if (pointer.value === null) throw new Error("Failed to generate groups."); // unreachable
|
|
48
36
|
return {
|
|
49
37
|
type: "interfaceGroups",
|
|
38
|
+
id: v7(),
|
|
50
39
|
created_at: start.toISOString(),
|
|
51
40
|
groups: pointer.value.groups,
|
|
52
41
|
tokenUsage,
|
|
@@ -2,6 +2,7 @@ import { IAgenticaController } from "@agentica/core";
|
|
|
2
2
|
import {
|
|
3
3
|
AutoBeInterfaceOperationsEvent,
|
|
4
4
|
AutoBeOpenApi,
|
|
5
|
+
AutoBeProgressEventBase,
|
|
5
6
|
} from "@autobe/interface";
|
|
6
7
|
import { AutoBeEndpointComparator, StringUtil } from "@autobe/utils";
|
|
7
8
|
import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
|
|
@@ -9,11 +10,13 @@ import { HashMap, HashSet, IPointer } from "tstl";
|
|
|
9
10
|
import typia from "typia";
|
|
10
11
|
import { Escaper } from "typia/lib/utils/Escaper";
|
|
11
12
|
import { NamingConvention } from "typia/lib/utils/NamingConvention";
|
|
13
|
+
import { v7 } from "uuid";
|
|
12
14
|
|
|
13
15
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
14
16
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
15
17
|
import { divideArray } from "../../utils/divideArray";
|
|
16
18
|
import { emplaceMap } from "../../utils/emplaceMap";
|
|
19
|
+
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
17
20
|
import { transformInterfaceOperationHistories } from "./histories/transformInterfaceOperationHistories";
|
|
18
21
|
import { orchestrateInterfaceOperationsReview } from "./orchestrateInterfaceOperationsReview";
|
|
19
22
|
import { IAutoBeInterfaceOperationApplication } from "./structures/IAutoBeInterfaceOperationApplication";
|
|
@@ -24,46 +27,43 @@ export async function orchestrateInterfaceOperations<
|
|
|
24
27
|
>(
|
|
25
28
|
ctx: AutoBeContext<Model>,
|
|
26
29
|
endpoints: AutoBeOpenApi.IEndpoint[],
|
|
27
|
-
capacity: number =
|
|
30
|
+
capacity: number = 8,
|
|
28
31
|
): Promise<AutoBeOpenApi.IOperation[]> {
|
|
29
32
|
const matrix: AutoBeOpenApi.IEndpoint[][] = divideArray({
|
|
30
33
|
array: endpoints,
|
|
31
34
|
capacity,
|
|
32
35
|
});
|
|
33
|
-
const operationsProgress: IProgress = {
|
|
34
|
-
total: endpoints.length,
|
|
35
|
-
completed: 0,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const operationsReviewProgress: IProgress = {
|
|
39
|
-
total: endpoints.length,
|
|
40
|
-
completed: 0,
|
|
41
|
-
};
|
|
42
36
|
|
|
43
|
-
|
|
44
|
-
await
|
|
45
|
-
matrix.map(async (
|
|
37
|
+
return (
|
|
38
|
+
await executeCachedBatch(
|
|
39
|
+
matrix.map((it) => async (promptCacheKey) => {
|
|
46
40
|
const row: AutoBeOpenApi.IOperation[] = await divideAndConquer(
|
|
47
41
|
ctx,
|
|
48
42
|
it,
|
|
49
43
|
3,
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
{
|
|
45
|
+
total: matrix.length,
|
|
46
|
+
completed: 0,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
total: matrix.length,
|
|
50
|
+
completed: 0,
|
|
51
|
+
},
|
|
52
|
+
promptCacheKey,
|
|
52
53
|
);
|
|
53
54
|
return row;
|
|
54
55
|
}),
|
|
55
56
|
)
|
|
56
57
|
).flat();
|
|
57
|
-
|
|
58
|
-
return operations;
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
62
61
|
ctx: AutoBeContext<Model>,
|
|
63
62
|
endpoints: AutoBeOpenApi.IEndpoint[],
|
|
64
63
|
retry: number,
|
|
65
|
-
operationsProgress:
|
|
66
|
-
operationsReviewProgress:
|
|
64
|
+
operationsProgress: AutoBeProgressEventBase,
|
|
65
|
+
operationsReviewProgress: AutoBeProgressEventBase,
|
|
66
|
+
promptCacheKey: string,
|
|
67
67
|
): Promise<AutoBeOpenApi.IOperation[]> {
|
|
68
68
|
const remained: HashSet<AutoBeOpenApi.IEndpoint> = new HashSet(
|
|
69
69
|
endpoints,
|
|
@@ -77,29 +77,30 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
|
77
77
|
);
|
|
78
78
|
for (let i: number = 0; i < retry; ++i) {
|
|
79
79
|
if (remained.empty() === true || unique.size() >= endpoints.length) break;
|
|
80
|
-
const operations: AutoBeOpenApi.IOperation[] =
|
|
81
|
-
ctx,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
)
|
|
85
|
-
const newbie: AutoBeOpenApi.IOperation[] =
|
|
86
|
-
await orchestrateInterfaceOperationsReview(
|
|
87
|
-
ctx,
|
|
88
|
-
operations,
|
|
89
|
-
operationsReviewProgress,
|
|
90
|
-
);
|
|
91
|
-
for (const item of newbie) {
|
|
80
|
+
const operations: AutoBeOpenApi.IOperation[] = remained.size()
|
|
81
|
+
? await process(ctx, remained, operationsProgress, promptCacheKey)
|
|
82
|
+
: [];
|
|
83
|
+
|
|
84
|
+
for (const item of operations) {
|
|
92
85
|
unique.set(item, item);
|
|
93
86
|
remained.erase(item);
|
|
94
87
|
}
|
|
95
88
|
}
|
|
89
|
+
const newbie: AutoBeOpenApi.IOperation[] =
|
|
90
|
+
await orchestrateInterfaceOperationsReview(
|
|
91
|
+
ctx,
|
|
92
|
+
unique.toJSON().map((it) => it.second),
|
|
93
|
+
operationsReviewProgress,
|
|
94
|
+
);
|
|
95
|
+
for (const item of newbie) unique.set(item, item);
|
|
96
96
|
return unique.toJSON().map((it) => it.second);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
async function process<Model extends ILlmSchema.Model>(
|
|
100
100
|
ctx: AutoBeContext<Model>,
|
|
101
|
-
endpoints: AutoBeOpenApi.IEndpoint
|
|
102
|
-
progress:
|
|
101
|
+
endpoints: HashSet<AutoBeOpenApi.IEndpoint>,
|
|
102
|
+
progress: AutoBeProgressEventBase,
|
|
103
|
+
promptCacheKey: string,
|
|
103
104
|
): Promise<AutoBeOpenApi.IOperation[]> {
|
|
104
105
|
const prefix: string = NamingConvention.camel(ctx.state().analyze!.prefix);
|
|
105
106
|
const pointer: IPointer<AutoBeOpenApi.IOperation[] | null> = {
|
|
@@ -107,7 +108,10 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
107
108
|
};
|
|
108
109
|
const { tokenUsage } = await ctx.conversate({
|
|
109
110
|
source: "interfaceOperations",
|
|
110
|
-
histories: transformInterfaceOperationHistories(
|
|
111
|
+
histories: transformInterfaceOperationHistories(
|
|
112
|
+
ctx.state(),
|
|
113
|
+
endpoints.toJSON(),
|
|
114
|
+
),
|
|
111
115
|
controller: createController({
|
|
112
116
|
model: ctx.model,
|
|
113
117
|
roles: ctx.state().analyze?.roles.map((it) => it.name) ?? [],
|
|
@@ -124,9 +128,9 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
124
128
|
.filter((it) => it !== "")
|
|
125
129
|
.join("/"),
|
|
126
130
|
authorizationRole: null,
|
|
131
|
+
authorizationType: null,
|
|
127
132
|
},
|
|
128
133
|
];
|
|
129
|
-
|
|
130
134
|
return op.authorizationRoles.map((role) => ({
|
|
131
135
|
...op,
|
|
132
136
|
path:
|
|
@@ -135,22 +139,31 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
135
139
|
.filter((it) => it !== "")
|
|
136
140
|
.join("/"),
|
|
137
141
|
authorizationRole: role,
|
|
142
|
+
authorizationType: null,
|
|
138
143
|
}));
|
|
139
144
|
});
|
|
145
|
+
pointer.value.push(...matrix.flat());
|
|
140
146
|
progress.completed += matrix.flat().length;
|
|
141
|
-
progress.total +=
|
|
142
|
-
.
|
|
143
|
-
|
|
147
|
+
progress.total += operations
|
|
148
|
+
.map((op) =>
|
|
149
|
+
endpoints.has({ path: op.path, method: op.method })
|
|
150
|
+
? op.authorizationRoles.length === 0
|
|
151
|
+
? 0
|
|
152
|
+
: op.authorizationRoles.length - 1
|
|
153
|
+
: op.authorizationRoles.length,
|
|
154
|
+
)
|
|
144
155
|
.reduce((a, b) => a + b, 0);
|
|
145
|
-
pointer.value.push(...matrix.flat());
|
|
146
156
|
},
|
|
147
157
|
}),
|
|
148
158
|
enforceFunctionCall: true,
|
|
159
|
+
promptCacheKey,
|
|
149
160
|
message: "Make API operations",
|
|
150
161
|
});
|
|
151
162
|
if (pointer.value === null) throw new Error("Failed to create operations."); // never be happened
|
|
163
|
+
|
|
152
164
|
ctx.dispatch({
|
|
153
165
|
type: "interfaceOperations",
|
|
166
|
+
id: v7(),
|
|
154
167
|
operations: pointer.value,
|
|
155
168
|
tokenUsage,
|
|
156
169
|
...progress,
|
|
@@ -212,13 +225,13 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
212
225
|
errors.push({
|
|
213
226
|
path: `$input.operations[${i}].authorizationRoles[${j}]`,
|
|
214
227
|
expected: `null | ${props.roles.map((str) => JSON.stringify(str)).join(" | ")}`,
|
|
215
|
-
description:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
228
|
+
description: StringUtil.trim`
|
|
229
|
+
Role "${role}" is not defined in the roles list.
|
|
230
|
+
|
|
231
|
+
Please select one of them below, or do not define (\`null\`):
|
|
232
|
+
|
|
233
|
+
${props.roles.map((role) => `- ${role}`).join("\n")}
|
|
234
|
+
`,
|
|
222
235
|
value: role,
|
|
223
236
|
});
|
|
224
237
|
});
|
|
@@ -241,15 +254,16 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
241
254
|
path: `$input.operations[${i}].{"path"|"method"}`,
|
|
242
255
|
expected: "Unique endpoint (path and method)",
|
|
243
256
|
value: key,
|
|
244
|
-
description:
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
257
|
+
description: StringUtil.trim`
|
|
258
|
+
Duplicated endpoint detected (method: ${op.method}, path: ${op.path}).
|
|
259
|
+
|
|
260
|
+
The duplicated endpoints of others are located in below accessors.
|
|
261
|
+
Check them, and consider which operation endpoint would be proper to modify.
|
|
262
|
+
|
|
263
|
+
${indexes
|
|
264
|
+
.map((idx) => `- $input.operations.[${idx}].{"path"|"method"}`)
|
|
265
|
+
.join("\n")}
|
|
266
|
+
`,
|
|
253
267
|
});
|
|
254
268
|
indexes.push(i);
|
|
255
269
|
} else endpoints.emplace(key, [i]);
|
|
@@ -270,25 +284,24 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
270
284
|
path: `$input.operations[${i}].name`,
|
|
271
285
|
expected: "Unique name in the same accessor scope.",
|
|
272
286
|
value: op.name,
|
|
273
|
-
description:
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
287
|
+
description: StringUtil.trim`
|
|
288
|
+
Duplicated operation accessor detected (name: ${op.name}, accessor: ${key}).
|
|
289
|
+
|
|
290
|
+
The operation name must be unique within the parent accessor.
|
|
291
|
+
In other worlds, the operation accessor determined by the name
|
|
292
|
+
must be unique in the OpenAPI document.
|
|
293
|
+
|
|
294
|
+
Here is the list of elements of duplicated operation names.
|
|
295
|
+
Check them, and consider which operation name would be proper to modify.
|
|
296
|
+
|
|
297
|
+
${indexes
|
|
284
298
|
.map((idx) => `- ${operations[idx].name} (accessor: ${key})`)
|
|
285
|
-
.join("\n")
|
|
286
|
-
|
|
299
|
+
.join("\n")}
|
|
300
|
+
`,
|
|
287
301
|
});
|
|
288
302
|
}
|
|
289
303
|
indexes.push(i);
|
|
290
304
|
});
|
|
291
|
-
|
|
292
305
|
if (errors.length !== 0)
|
|
293
306
|
return {
|
|
294
307
|
success: false,
|
|
@@ -330,11 +343,6 @@ const collection = {
|
|
|
330
343
|
}),
|
|
331
344
|
};
|
|
332
345
|
|
|
333
|
-
interface IProgress {
|
|
334
|
-
completed: number;
|
|
335
|
-
total: number;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
346
|
type Validator = (
|
|
339
347
|
input: unknown,
|
|
340
348
|
) => IValidation<IAutoBeInterfaceOperationApplication.IProps>;
|