@autobe/agent 0.18.0 → 0.19.1
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 +5 -0
- package/lib/agent/src/AutoBeAgent.js.map +1 -1
- package/lib/agent/src/AutoBeMockAgent.d.ts +2 -10
- package/lib/agent/src/AutoBeMockAgent.js +7 -2
- 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/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 +212 -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 +71 -14
- package/lib/agent/src/factory/createAutoBeContext.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +3 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.js +4 -4
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +3 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +16 -4
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js +8 -3
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +2 -3
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js +7 -7
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js +24 -37
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js +5 -3
- 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 +1 -0
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +2 -10
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +3 -3
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +9 -3
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterface.js +29 -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 +1565 -1142
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js +22 -4
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js +11 -15
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +32 -26
- 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 +135 -124
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +371 -209
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js +185 -179
- 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 +59 -14
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +37 -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 +11 -17
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +2 -2
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js +13 -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 +6 -10
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +35 -2
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js +44 -3
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js +40 -3
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +2 -2
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +5 -5
- 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 +2 -2
- 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 +278 -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 +12 -20
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/internal/compile.d.ts +3 -3
- package/lib/agent/src/orchestrate/realize/internal/compile.js +9 -26
- package/lib/agent/src/orchestrate/realize/internal/compile.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +59 -42
- package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +6 -6
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +6 -6
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +8 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +17 -16
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +6 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +24 -19
- 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/realize/structures/{IAutoBeRealizeCoderApplication.js → 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/histories/transformTestCorrectHistories.js +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.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 +95 -50
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTest.js +12 -0
- package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +4 -4
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +119 -16
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +6 -5
- 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/{internal/IProgress.js → test/structures/IAutoBeTestScenarioAuthorizationRole.js} +1 -1
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.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/AutoBeTokenUsageComponent.d.ts +1 -0
- package/lib/factory/consentFunctionCall.d.ts +10 -0
- package/lib/index.mjs +3036 -1648
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +3 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +3 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +2 -3
- 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/structures/IAutoBeInterfaceComplementApplication.d.ts +38 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +16 -16
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +59 -14
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +37 -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/compile.d.ts +3 -3
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +8 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +6 -1
- 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 +6 -5
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.d.ts +6 -0
- package/lib/utils/predicateStateMessage.d.ts +4 -0
- package/package.json +6 -6
- package/src/AutoBeAgent.ts +14 -0
- package/src/AutoBeMockAgent.ts +9 -11
- package/src/constants/AutoBeSystemPromptConstant.ts +23 -29
- package/src/context/AutoBeTokenUsageComponent.ts +20 -0
- package/src/factory/consentFunctionCall.ts +128 -0
- package/src/factory/createAgenticaHistory.ts +1 -0
- package/src/factory/createAutoBeContext.ts +99 -14
- package/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.ts +11 -4
- package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +26 -4
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +19 -14
- package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +3 -3
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +8 -32
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +5 -3
- 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 +1 -0
- package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +0 -10
- package/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.ts +1 -1
- package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +9 -3
- package/src/orchestrate/interface/orchestrateInterface.ts +51 -12
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +126 -23
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +6 -19
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +32 -27
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +49 -32
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +127 -33
- package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +67 -65
- 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 +62 -14
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +38 -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 +9 -16
- package/src/orchestrate/prisma/orchestratePrisma.ts +15 -6
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +6 -19
- package/src/orchestrate/prisma/orchestratePrismaReview.ts +15 -9
- package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +1 -1
- package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +19 -23
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +4 -2
- package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +285 -0
- package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +27 -27
- package/src/orchestrate/realize/internal/compile.ts +28 -45
- package/src/orchestrate/realize/orchestrateRealize.ts +71 -67
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +3 -3
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +19 -15
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +23 -15
- 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/histories/transformTestScenarioHistories.ts +110 -59
- package/src/orchestrate/test/orchestrateTest.ts +12 -0
- package/src/orchestrate/test/orchestrateTestScenario.ts +155 -19
- package/src/orchestrate/test/orchestrateTestWrite.ts +3 -3
- package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +6 -5
- package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +1 -1
- package/src/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.ts +7 -0
- package/src/utils/predicateStateMessage.ts +107 -0
- 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/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/internal/IProgress.d.ts +0 -4
- package/lib/orchestrate/realize/histories/transformRealizeCoderHistories.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/internal/IProgress.ts +0 -4
- package/src/orchestrate/realize/histories/transformRealizeCoderHistories.ts +0 -248
- 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,5 +1,6 @@
|
|
|
1
1
|
import { AutoBeAnalyzeRole, CamelPattern } from "@autobe/interface";
|
|
2
2
|
import { AutoBeAnalyzeFile } from "@autobe/interface/src/histories/contents/AutoBeAnalyzeFile";
|
|
3
|
+
import { tags } from "typia";
|
|
3
4
|
|
|
4
5
|
export interface IAutoBeAnalyzeScenarioApplication {
|
|
5
6
|
/**
|
|
@@ -28,7 +29,7 @@ export namespace IAutoBeAnalyzeScenarioApplication {
|
|
|
28
29
|
* Prefix for file names and variable names. This will be used for
|
|
29
30
|
* organizing documentation files.
|
|
30
31
|
*
|
|
31
|
-
*
|
|
32
|
+
* DO: Use camelCase naming convention.
|
|
32
33
|
*/
|
|
33
34
|
prefix: string & CamelPattern;
|
|
34
35
|
|
|
@@ -64,9 +65,8 @@ export namespace IAutoBeAnalyzeScenarioApplication {
|
|
|
64
65
|
* - Service overview and business model description
|
|
65
66
|
* - User roles and permission requirements (described in natural language)
|
|
66
67
|
* - Business logic and validation rules
|
|
67
|
-
* -
|
|
68
|
-
*
|
|
69
|
-
* - All requirements must be written in natural language for clarity
|
|
68
|
+
* - DO NOT: Include database schemas, ERD, or API specifications
|
|
69
|
+
* - DO: Write all requirements in natural language for clarity
|
|
70
70
|
*
|
|
71
71
|
* Generate files based on actual requirements gathered from conversation.
|
|
72
72
|
* Do not create unnecessary documentation - only generate what is needed to
|
|
@@ -80,6 +80,6 @@ export namespace IAutoBeAnalyzeScenarioApplication {
|
|
|
80
80
|
* user does not specify a number, generate a sufficient number of documents
|
|
81
81
|
* to adequately support the service.
|
|
82
82
|
*/
|
|
83
|
-
files: Array<AutoBeAnalyzeFile.Scenario>;
|
|
83
|
+
files: Array<AutoBeAnalyzeFile.Scenario> & tags.MinItems<1>;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -44,18 +44,8 @@ export const transformInterfaceEndpointHistories = (
|
|
|
44
44
|
name: op.name,
|
|
45
45
|
summary: op.summary,
|
|
46
46
|
})),
|
|
47
|
-
null,
|
|
48
|
-
2,
|
|
49
47
|
),
|
|
50
48
|
"```",
|
|
51
|
-
"",
|
|
52
|
-
"**DO NOT CREATE:**",
|
|
53
|
-
"- User creation endpoints (POST /users, POST /admins)",
|
|
54
|
-
"- Authentication endpoints (handled separately)",
|
|
55
|
-
"- Focus only on business data operations",
|
|
56
|
-
"",
|
|
57
|
-
"Create operations for DIFFERENT paths and DIFFERENT purposes only.",
|
|
58
|
-
"",
|
|
59
49
|
].join("\n"),
|
|
60
50
|
},
|
|
61
51
|
];
|
|
@@ -21,9 +21,15 @@ export const transformInterfaceSchemasReviewHistories = (
|
|
|
21
21
|
type: "systemMessage",
|
|
22
22
|
id: v4(),
|
|
23
23
|
created_at: new Date().toISOString(),
|
|
24
|
-
text: AutoBeSystemPromptConstant.
|
|
24
|
+
text: AutoBeSystemPromptConstant.INTERFACE_SCHEMA,
|
|
25
25
|
},
|
|
26
26
|
...transformInterfaceAssetHistories(state),
|
|
27
|
+
{
|
|
28
|
+
type: "systemMessage",
|
|
29
|
+
id: v4(),
|
|
30
|
+
created_at: new Date().toISOString(),
|
|
31
|
+
text: AutoBeSystemPromptConstant.INTERFACE_SCHEMA_REVIEW,
|
|
32
|
+
},
|
|
27
33
|
{
|
|
28
34
|
type: "assistantMessage",
|
|
29
35
|
id: v4(),
|
|
@@ -33,7 +39,7 @@ export const transformInterfaceSchemasReviewHistories = (
|
|
|
33
39
|
"These operations define what endpoints exist and what request/response types they use:",
|
|
34
40
|
"",
|
|
35
41
|
"```json",
|
|
36
|
-
JSON.stringify(operations
|
|
42
|
+
JSON.stringify(operations),
|
|
37
43
|
"```",
|
|
38
44
|
"",
|
|
39
45
|
"All schema types referenced in these operations (in requestBody and responses) must exist in the schemas.",
|
|
@@ -47,7 +53,7 @@ export const transformInterfaceSchemasReviewHistories = (
|
|
|
47
53
|
"Here are the schemas generated by the Schema Agent that need your review:",
|
|
48
54
|
"",
|
|
49
55
|
"```json",
|
|
50
|
-
JSON.stringify(schemaDescriptive
|
|
56
|
+
JSON.stringify(schemaDescriptive),
|
|
51
57
|
"```",
|
|
52
58
|
"",
|
|
53
59
|
"Please review these schemas for:",
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AutoBeAssistantMessageHistory,
|
|
3
|
+
AutoBeInterfaceAuthorization,
|
|
3
4
|
AutoBeInterfaceCompleteEvent,
|
|
4
5
|
AutoBeInterfaceGroupsEvent,
|
|
5
6
|
AutoBeInterfaceHistory,
|
|
6
7
|
AutoBeOpenApi,
|
|
7
8
|
} from "@autobe/interface";
|
|
9
|
+
import { AutoBeEndpointComparator } from "@autobe/utils";
|
|
8
10
|
import { ILlmSchema } from "@samchon/openapi";
|
|
11
|
+
import { HashMap, Pair } from "tstl";
|
|
12
|
+
import { v4 } from "uuid";
|
|
9
13
|
|
|
10
14
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
11
15
|
import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
|
|
16
|
+
import { predicateStateMessage } from "../../utils/predicateStateMessage";
|
|
12
17
|
import { orchestrateInterfaceAuthorizations } from "./orchestrateInterfaceAuthorizations";
|
|
13
18
|
import { orchestrateInterfaceComplement } from "./orchestrateInterfaceComplement";
|
|
14
19
|
import { orchestrateInterfaceEndpoints } from "./orchestrateInterfaceEndpoints";
|
|
@@ -21,8 +26,20 @@ export const orchestrateInterface =
|
|
|
21
26
|
async (
|
|
22
27
|
props: IAutoBeApplicationProps,
|
|
23
28
|
): Promise<AutoBeAssistantMessageHistory | AutoBeInterfaceHistory> => {
|
|
24
|
-
//
|
|
29
|
+
// PREDICATION
|
|
25
30
|
const start: Date = new Date();
|
|
31
|
+
const predicate: string | null = predicateStateMessage(
|
|
32
|
+
ctx.state(),
|
|
33
|
+
"interface",
|
|
34
|
+
);
|
|
35
|
+
if (predicate !== null)
|
|
36
|
+
return ctx.assistantMessage({
|
|
37
|
+
type: "assistantMessage",
|
|
38
|
+
id: v4(),
|
|
39
|
+
created_at: start.toISOString(),
|
|
40
|
+
text: predicate,
|
|
41
|
+
completed_at: new Date().toISOString(),
|
|
42
|
+
});
|
|
26
43
|
ctx.dispatch({
|
|
27
44
|
type: "interfaceStart",
|
|
28
45
|
created_at: start.toISOString(),
|
|
@@ -30,22 +47,43 @@ export const orchestrateInterface =
|
|
|
30
47
|
step: ctx.state().analyze?.step ?? 0,
|
|
31
48
|
});
|
|
32
49
|
|
|
33
|
-
|
|
50
|
+
// ENDPOINTS
|
|
51
|
+
const init: AutoBeInterfaceGroupsEvent =
|
|
34
52
|
await orchestrateInterfaceGroups(ctx);
|
|
35
|
-
|
|
36
|
-
else ctx.dispatch(init);
|
|
53
|
+
ctx.dispatch(init);
|
|
37
54
|
|
|
38
55
|
// AUTHORIZATION
|
|
39
|
-
const authorizations:
|
|
56
|
+
const authorizations: AutoBeInterfaceAuthorization[] =
|
|
40
57
|
await orchestrateInterfaceAuthorizations(ctx);
|
|
41
58
|
|
|
59
|
+
const authOperations = authorizations
|
|
60
|
+
.map((authorization) => authorization.operations)
|
|
61
|
+
.flat();
|
|
62
|
+
|
|
42
63
|
// ENDPOINTS & OPERATIONS
|
|
43
64
|
const endpoints: AutoBeOpenApi.IEndpoint[] =
|
|
44
|
-
await orchestrateInterfaceEndpoints(ctx, init.groups,
|
|
45
|
-
const
|
|
65
|
+
await orchestrateInterfaceEndpoints(ctx, init.groups, authOperations);
|
|
66
|
+
const firstOperations: AutoBeOpenApi.IOperation[] =
|
|
46
67
|
await orchestrateInterfaceOperations(ctx, endpoints);
|
|
47
|
-
|
|
48
|
-
|
|
68
|
+
const operations: AutoBeOpenApi.IOperation[] = new HashMap<
|
|
69
|
+
AutoBeOpenApi.IEndpoint,
|
|
70
|
+
AutoBeOpenApi.IOperation
|
|
71
|
+
>(
|
|
72
|
+
[...authOperations, ...firstOperations].map(
|
|
73
|
+
(o) =>
|
|
74
|
+
new Pair(
|
|
75
|
+
{
|
|
76
|
+
path: o.path,
|
|
77
|
+
method: o.method,
|
|
78
|
+
},
|
|
79
|
+
o, // early inserted be kept
|
|
80
|
+
),
|
|
81
|
+
),
|
|
82
|
+
AutoBeEndpointComparator.hashCode,
|
|
83
|
+
AutoBeEndpointComparator.equals,
|
|
84
|
+
)
|
|
85
|
+
.toJSON()
|
|
86
|
+
.map((it) => it.second);
|
|
49
87
|
|
|
50
88
|
// TYPE SCHEMAS
|
|
51
89
|
const document: AutoBeOpenApi.IDocument = {
|
|
@@ -55,15 +93,16 @@ export const orchestrateInterface =
|
|
|
55
93
|
schemas: await orchestrateInterfaceSchemas(ctx, operations),
|
|
56
94
|
},
|
|
57
95
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
document,
|
|
96
|
+
Object.assign(
|
|
97
|
+
document.components.schemas,
|
|
98
|
+
await orchestrateInterfaceComplement(ctx, document),
|
|
61
99
|
);
|
|
62
100
|
|
|
63
101
|
// DO COMPILE
|
|
64
102
|
return ctx.dispatch({
|
|
65
103
|
type: "interfaceComplete",
|
|
66
104
|
document,
|
|
105
|
+
authorizations,
|
|
67
106
|
created_at: new Date().toISOString(),
|
|
68
107
|
elapsed: new Date().getTime() - start.getTime(),
|
|
69
108
|
step: ctx.state().analyze?.step ?? 0,
|
|
@@ -1,25 +1,30 @@
|
|
|
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";
|
|
7
13
|
|
|
8
14
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
9
15
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
10
|
-
import { IProgress } from "../internal/IProgress";
|
|
11
16
|
import { transformInterfaceAuthorizationsHistories } from "./histories/transformInterfaceAuthorizationsHistories";
|
|
12
17
|
import { IAutoBeInterfaceAuthorizationsApplication } from "./structures/IAutoBeInterfaceAuthorizationsApplication";
|
|
13
18
|
|
|
14
19
|
export async function orchestrateInterfaceAuthorizations<
|
|
15
20
|
Model extends ILlmSchema.Model,
|
|
16
|
-
>(ctx: AutoBeContext<Model>): Promise<
|
|
21
|
+
>(ctx: AutoBeContext<Model>): Promise<AutoBeInterfaceAuthorization[]> {
|
|
17
22
|
const roles: AutoBeAnalyzeRole[] = ctx.state().analyze?.roles ?? [];
|
|
18
|
-
const progress:
|
|
23
|
+
const progress: AutoBeProgressEventBase = {
|
|
19
24
|
total: roles.length,
|
|
20
25
|
completed: 0,
|
|
21
26
|
};
|
|
22
|
-
const
|
|
27
|
+
const authorizations: AutoBeInterfaceAuthorization[] = await Promise.all(
|
|
23
28
|
roles.map(async (role) => {
|
|
24
29
|
const event: AutoBeInterfaceAuthorizationEvent = await process(
|
|
25
30
|
ctx,
|
|
@@ -27,16 +32,20 @@ export async function orchestrateInterfaceAuthorizations<
|
|
|
27
32
|
progress,
|
|
28
33
|
);
|
|
29
34
|
ctx.dispatch(event);
|
|
30
|
-
return
|
|
35
|
+
return {
|
|
36
|
+
role: role.name,
|
|
37
|
+
operations: event.operations,
|
|
38
|
+
};
|
|
31
39
|
}),
|
|
32
40
|
);
|
|
33
|
-
|
|
41
|
+
|
|
42
|
+
return authorizations;
|
|
34
43
|
}
|
|
35
44
|
|
|
36
45
|
async function process<Model extends ILlmSchema.Model>(
|
|
37
46
|
ctx: AutoBeContext<Model>,
|
|
38
47
|
role: AutoBeAnalyzeRole,
|
|
39
|
-
progress:
|
|
48
|
+
progress: AutoBeProgressEventBase,
|
|
40
49
|
): Promise<AutoBeInterfaceAuthorizationEvent> {
|
|
41
50
|
const pointer: IPointer<IAutoBeInterfaceAuthorizationsApplication.IProps | null> =
|
|
42
51
|
{
|
|
@@ -47,6 +56,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
47
56
|
histories: transformInterfaceAuthorizationsHistories(ctx.state(), role),
|
|
48
57
|
controller: createController({
|
|
49
58
|
model: ctx.model,
|
|
59
|
+
role: role.name,
|
|
50
60
|
build: (next) => {
|
|
51
61
|
pointer.value = next;
|
|
52
62
|
},
|
|
@@ -70,13 +80,100 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
70
80
|
|
|
71
81
|
function createController<Model extends ILlmSchema.Model>(props: {
|
|
72
82
|
model: Model;
|
|
83
|
+
role: string;
|
|
73
84
|
build: (next: IAutoBeInterfaceAuthorizationsApplication.IProps) => void;
|
|
74
85
|
}): IAgenticaController.IClass<Model> {
|
|
75
86
|
assertSchemaModel(props.model);
|
|
76
87
|
|
|
88
|
+
const validate = (
|
|
89
|
+
next: unknown,
|
|
90
|
+
): IValidation<IAutoBeInterfaceAuthorizationsApplication.IProps> => {
|
|
91
|
+
const result: IValidation<IAutoBeInterfaceAuthorizationsApplication.IProps> =
|
|
92
|
+
typia.validate<IAutoBeInterfaceAuthorizationsApplication.IProps>(next);
|
|
93
|
+
if (result.success === false) return result;
|
|
94
|
+
|
|
95
|
+
const errors: IValidation.IError[] = [];
|
|
96
|
+
result.data.operations.forEach((op, i) => {
|
|
97
|
+
// validate authorizationRole
|
|
98
|
+
if (op.authorizationRole !== null) {
|
|
99
|
+
op.authorizationRole = props.role;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// validate responseBody.typeName -> must be ~.IAuthorized
|
|
103
|
+
if (op.authorizationType === null) return;
|
|
104
|
+
else if (op.responseBody === null)
|
|
105
|
+
errors.push({
|
|
106
|
+
path: `$input.operations.${i}.responseBody`,
|
|
107
|
+
expected:
|
|
108
|
+
"Response body with I{RoleName(PascalCase)}.IAuthorized type is required",
|
|
109
|
+
value: op.responseBody,
|
|
110
|
+
description: [
|
|
111
|
+
"Response body is required for authentication operations.",
|
|
112
|
+
"",
|
|
113
|
+
"The responseBody must contain description and typeName fields.",
|
|
114
|
+
"typeName must be I{Prefix(PascalCase)}{RoleName(PascalCase)}.IAuthorized",
|
|
115
|
+
"description must be a detailed description of the response body.",
|
|
116
|
+
].join("\n"),
|
|
117
|
+
});
|
|
118
|
+
else if (!op.responseBody.typeName.endsWith(".IAuthorized"))
|
|
119
|
+
errors.push({
|
|
120
|
+
path: `$input.operations.${i}.responseBody.typeName`,
|
|
121
|
+
expected: `Type name must be I{RoleName(PascalCase)}.IAuthorized`,
|
|
122
|
+
value: op.responseBody?.typeName,
|
|
123
|
+
description: [
|
|
124
|
+
`Wrong response body type name: ${op.responseBody?.typeName}`,
|
|
125
|
+
"",
|
|
126
|
+
`For authentication operations (login, join, refresh), the response body type name must follow the convention "I{RoleName}.IAuthorized".`,
|
|
127
|
+
``,
|
|
128
|
+
`This standardized naming convention ensures consistency across all authentication endpoints and clearly identifies authorization response types.`,
|
|
129
|
+
`The Role name should be in PascalCase format (e.g., IUser.IAuthorized, IAdmin.IAuthorized, ISeller.IAuthorized).`,
|
|
130
|
+
].join("\n"),
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// validate authorization types' existence
|
|
135
|
+
type AuthorizationType = NonNullable<
|
|
136
|
+
AutoBeOpenApi.IOperation["authorizationType"]
|
|
137
|
+
>;
|
|
138
|
+
const authorizationTypes: Set<AuthorizationType> = new Set(
|
|
139
|
+
result.data.operations
|
|
140
|
+
.map((o) => o.authorizationType)
|
|
141
|
+
.filter((v) => v !== null),
|
|
142
|
+
);
|
|
143
|
+
for (const type of typia.misc.literals<AuthorizationType>())
|
|
144
|
+
if (authorizationTypes.has(type) === false)
|
|
145
|
+
errors.push({
|
|
146
|
+
path: "$input.operations[].authorizationType",
|
|
147
|
+
expected: StringUtil.trim`{
|
|
148
|
+
...(AutoBeOpenApi.IOperation data),
|
|
149
|
+
authorizationType: "${type}"
|
|
150
|
+
}`,
|
|
151
|
+
value: `No authorizationType "${type}" found in any operation`,
|
|
152
|
+
description: StringUtil.trim`
|
|
153
|
+
There must be an operation that has defined AutoBeOpenApi.IOperation.authorizationType := "${type}"
|
|
154
|
+
for the "${props.role}" role's authorization activity; "${type}".
|
|
155
|
+
|
|
156
|
+
However, none of the operations have the AutoBeOpenApi.IOperation.authorizationType := "${type}"
|
|
157
|
+
value, so that the "${props.role}" cannot perform the authorization ${type} activity.
|
|
158
|
+
|
|
159
|
+
Please make that operation at the next function calling. You have to do it.
|
|
160
|
+
`,
|
|
161
|
+
});
|
|
162
|
+
if (errors.length !== 0) {
|
|
163
|
+
return {
|
|
164
|
+
success: false,
|
|
165
|
+
errors,
|
|
166
|
+
data: next,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
return result;
|
|
170
|
+
};
|
|
171
|
+
|
|
77
172
|
const application: ILlmApplication<Model> = collection[
|
|
78
|
-
props.model
|
|
79
|
-
]
|
|
173
|
+
props.model === "chatgpt" ? "chatgpt" : "claude"
|
|
174
|
+
](
|
|
175
|
+
validate,
|
|
176
|
+
) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
|
|
80
177
|
|
|
81
178
|
return {
|
|
82
179
|
protocol: "class",
|
|
@@ -90,17 +187,23 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
90
187
|
};
|
|
91
188
|
}
|
|
92
189
|
|
|
93
|
-
const claude = typia.llm.application<
|
|
94
|
-
IAutoBeInterfaceAuthorizationsApplication,
|
|
95
|
-
"claude"
|
|
96
|
-
>();
|
|
97
190
|
const collection = {
|
|
98
|
-
chatgpt:
|
|
99
|
-
IAutoBeInterfaceAuthorizationsApplication,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
191
|
+
chatgpt: (validate: Validator) =>
|
|
192
|
+
typia.llm.application<IAutoBeInterfaceAuthorizationsApplication, "chatgpt">(
|
|
193
|
+
{
|
|
194
|
+
validate: {
|
|
195
|
+
makeOperations: validate,
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
),
|
|
199
|
+
claude: (validate: Validator) =>
|
|
200
|
+
typia.llm.application<IAutoBeInterfaceAuthorizationsApplication, "claude">({
|
|
201
|
+
validate: {
|
|
202
|
+
makeOperations: validate,
|
|
203
|
+
},
|
|
204
|
+
}),
|
|
106
205
|
};
|
|
206
|
+
|
|
207
|
+
type Validator = (
|
|
208
|
+
input: unknown,
|
|
209
|
+
) => IValidation<IAutoBeInterfaceAuthorizationsApplication.IProps>;
|
|
@@ -1,12 +1,8 @@
|
|
|
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 { v4 } from "uuid";
|
|
10
6
|
|
|
11
7
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
12
8
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
@@ -18,12 +14,12 @@ export async function orchestrateInterfaceGroups<
|
|
|
18
14
|
>(
|
|
19
15
|
ctx: AutoBeContext<Model>,
|
|
20
16
|
message: string = "Design API operations for the given assets.",
|
|
21
|
-
): Promise<
|
|
17
|
+
): Promise<AutoBeInterfaceGroupsEvent> {
|
|
22
18
|
const start: Date = new Date();
|
|
23
19
|
const pointer: IPointer<IAutoBeInterfaceGroupApplication.IProps | null> = {
|
|
24
20
|
value: null,
|
|
25
21
|
};
|
|
26
|
-
const {
|
|
22
|
+
const { tokenUsage } = await ctx.conversate({
|
|
27
23
|
source: "interfaceGroups",
|
|
28
24
|
histories: transformInterfaceGroupHistories(ctx.state()),
|
|
29
25
|
controller: createController({
|
|
@@ -32,19 +28,10 @@ export async function orchestrateInterfaceGroups<
|
|
|
32
28
|
pointer.value = next;
|
|
33
29
|
},
|
|
34
30
|
}),
|
|
35
|
-
enforceFunctionCall:
|
|
31
|
+
enforceFunctionCall: true,
|
|
36
32
|
message,
|
|
37
33
|
});
|
|
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
|
|
34
|
+
if (pointer.value === null) throw new Error("Failed to generate groups."); // unreachable
|
|
48
35
|
return {
|
|
49
36
|
type: "interfaceGroups",
|
|
50
37
|
created_at: start.toISOString(),
|
|
@@ -24,7 +24,7 @@ export async function orchestrateInterfaceOperations<
|
|
|
24
24
|
>(
|
|
25
25
|
ctx: AutoBeContext<Model>,
|
|
26
26
|
endpoints: AutoBeOpenApi.IEndpoint[],
|
|
27
|
-
capacity: number =
|
|
27
|
+
capacity: number = 8,
|
|
28
28
|
): Promise<AutoBeOpenApi.IOperation[]> {
|
|
29
29
|
const matrix: AutoBeOpenApi.IEndpoint[][] = divideArray({
|
|
30
30
|
array: endpoints,
|
|
@@ -34,13 +34,11 @@ export async function orchestrateInterfaceOperations<
|
|
|
34
34
|
total: endpoints.length,
|
|
35
35
|
completed: 0,
|
|
36
36
|
};
|
|
37
|
-
|
|
38
37
|
const operationsReviewProgress: IProgress = {
|
|
39
|
-
total:
|
|
38
|
+
total: matrix.length,
|
|
40
39
|
completed: 0,
|
|
41
40
|
};
|
|
42
|
-
|
|
43
|
-
const operations: AutoBeOpenApi.IOperation[] = (
|
|
41
|
+
return (
|
|
44
42
|
await Promise.all(
|
|
45
43
|
matrix.map(async (it) => {
|
|
46
44
|
const row: AutoBeOpenApi.IOperation[] = await divideAndConquer(
|
|
@@ -54,8 +52,6 @@ export async function orchestrateInterfaceOperations<
|
|
|
54
52
|
}),
|
|
55
53
|
)
|
|
56
54
|
).flat();
|
|
57
|
-
|
|
58
|
-
return operations;
|
|
59
55
|
}
|
|
60
56
|
|
|
61
57
|
async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
@@ -77,28 +73,28 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
|
77
73
|
);
|
|
78
74
|
for (let i: number = 0; i < retry; ++i) {
|
|
79
75
|
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) {
|
|
76
|
+
const operations: AutoBeOpenApi.IOperation[] = remained.size()
|
|
77
|
+
? await process(ctx, remained, operationsProgress)
|
|
78
|
+
: [];
|
|
79
|
+
|
|
80
|
+
for (const item of operations) {
|
|
92
81
|
unique.set(item, item);
|
|
93
82
|
remained.erase(item);
|
|
94
83
|
}
|
|
95
84
|
}
|
|
85
|
+
const newbie: AutoBeOpenApi.IOperation[] =
|
|
86
|
+
await orchestrateInterfaceOperationsReview(
|
|
87
|
+
ctx,
|
|
88
|
+
unique.toJSON().map((it) => it.second),
|
|
89
|
+
operationsReviewProgress,
|
|
90
|
+
);
|
|
91
|
+
for (const item of newbie) unique.set(item, item);
|
|
96
92
|
return unique.toJSON().map((it) => it.second);
|
|
97
93
|
}
|
|
98
94
|
|
|
99
95
|
async function process<Model extends ILlmSchema.Model>(
|
|
100
96
|
ctx: AutoBeContext<Model>,
|
|
101
|
-
endpoints: AutoBeOpenApi.IEndpoint
|
|
97
|
+
endpoints: HashSet<AutoBeOpenApi.IEndpoint>,
|
|
102
98
|
progress: IProgress,
|
|
103
99
|
): Promise<AutoBeOpenApi.IOperation[]> {
|
|
104
100
|
const prefix: string = NamingConvention.camel(ctx.state().analyze!.prefix);
|
|
@@ -107,7 +103,10 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
107
103
|
};
|
|
108
104
|
const { tokenUsage } = await ctx.conversate({
|
|
109
105
|
source: "interfaceOperations",
|
|
110
|
-
histories: transformInterfaceOperationHistories(
|
|
106
|
+
histories: transformInterfaceOperationHistories(
|
|
107
|
+
ctx.state(),
|
|
108
|
+
endpoints.toJSON(),
|
|
109
|
+
),
|
|
111
110
|
controller: createController({
|
|
112
111
|
model: ctx.model,
|
|
113
112
|
roles: ctx.state().analyze?.roles.map((it) => it.name) ?? [],
|
|
@@ -124,9 +123,9 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
124
123
|
.filter((it) => it !== "")
|
|
125
124
|
.join("/"),
|
|
126
125
|
authorizationRole: null,
|
|
126
|
+
authorizationType: null,
|
|
127
127
|
},
|
|
128
128
|
];
|
|
129
|
-
|
|
130
129
|
return op.authorizationRoles.map((role) => ({
|
|
131
130
|
...op,
|
|
132
131
|
path:
|
|
@@ -135,20 +134,27 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
135
134
|
.filter((it) => it !== "")
|
|
136
135
|
.join("/"),
|
|
137
136
|
authorizationRole: role,
|
|
137
|
+
authorizationType: null,
|
|
138
138
|
}));
|
|
139
139
|
});
|
|
140
|
+
pointer.value.push(...matrix.flat());
|
|
140
141
|
progress.completed += matrix.flat().length;
|
|
141
|
-
progress.total +=
|
|
142
|
-
.
|
|
143
|
-
|
|
142
|
+
progress.total += operations
|
|
143
|
+
.map((op) =>
|
|
144
|
+
endpoints.has({ path: op.path, method: op.method })
|
|
145
|
+
? op.authorizationRoles.length === 0
|
|
146
|
+
? 0
|
|
147
|
+
: op.authorizationRoles.length - 1
|
|
148
|
+
: op.authorizationRoles.length,
|
|
149
|
+
)
|
|
144
150
|
.reduce((a, b) => a + b, 0);
|
|
145
|
-
pointer.value.push(...matrix.flat());
|
|
146
151
|
},
|
|
147
152
|
}),
|
|
148
153
|
enforceFunctionCall: true,
|
|
149
154
|
message: "Make API operations",
|
|
150
155
|
});
|
|
151
156
|
if (pointer.value === null) throw new Error("Failed to create operations."); // never be happened
|
|
157
|
+
|
|
152
158
|
ctx.dispatch({
|
|
153
159
|
type: "interfaceOperations",
|
|
154
160
|
operations: pointer.value,
|
|
@@ -288,7 +294,6 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
288
294
|
}
|
|
289
295
|
indexes.push(i);
|
|
290
296
|
});
|
|
291
|
-
|
|
292
297
|
if (errors.length !== 0)
|
|
293
298
|
return {
|
|
294
299
|
success: false,
|