@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
|
@@ -23,7 +23,7 @@ export namespace IAutoBeInterfaceOperationApplication {
|
|
|
23
23
|
/**
|
|
24
24
|
* Array of API operations to generate.
|
|
25
25
|
*
|
|
26
|
-
* Each operation in this array
|
|
26
|
+
* Each operation in this array includes:
|
|
27
27
|
*
|
|
28
28
|
* - Specification: Detailed API specification with clear purpose and
|
|
29
29
|
* functionality
|
|
@@ -38,7 +38,7 @@ export namespace IAutoBeInterfaceOperationApplication {
|
|
|
38
38
|
* components.schemas
|
|
39
39
|
* - ResponseBody: With typeName referencing appropriate response type
|
|
40
40
|
*
|
|
41
|
-
* All operations
|
|
41
|
+
* All operations follow strict quality standards:
|
|
42
42
|
*
|
|
43
43
|
* 1. Detailed descriptions referencing Prisma schema comments
|
|
44
44
|
* 2. Accurate parameter definitions matching path parameters
|
|
@@ -66,11 +66,10 @@ export namespace IAutoBeInterfaceOperationApplication {
|
|
|
66
66
|
* reason and description fields, making it clear why the API was designed and
|
|
67
67
|
* how it should be used.
|
|
68
68
|
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* content-type
|
|
72
|
-
*
|
|
73
|
-
* instead of binary data formats.
|
|
69
|
+
* DO: Use object types for all request bodies and responses. DO: Reference
|
|
70
|
+
* named types defined in the components section. DO: Use `application/json`
|
|
71
|
+
* as the content-type. DO: Use `string & tags.Format<"uri">` in the schema
|
|
72
|
+
* for file upload/download operations instead of binary data formats.
|
|
74
73
|
*
|
|
75
74
|
* In OpenAPI, this might represent:
|
|
76
75
|
*
|
|
@@ -88,7 +87,10 @@ export namespace IAutoBeInterfaceOperationApplication {
|
|
|
88
87
|
* ```
|
|
89
88
|
*/
|
|
90
89
|
export interface IOperation
|
|
91
|
-
extends Omit<
|
|
90
|
+
extends Omit<
|
|
91
|
+
AutoBeOpenApi.IOperation,
|
|
92
|
+
"authorizationRole" | "authorizationType"
|
|
93
|
+
> {
|
|
92
94
|
/**
|
|
93
95
|
* Authorization roles required to access this API operation.
|
|
94
96
|
*
|
|
@@ -96,16 +98,47 @@ export namespace IAutoBeInterfaceOperationApplication {
|
|
|
96
98
|
* endpoint. Multiple roles can be specified to allow different types of
|
|
97
99
|
* users to access the same endpoint.
|
|
98
100
|
*
|
|
101
|
+
* ## ⚠️ CRITICAL: Role Multiplication Effect
|
|
102
|
+
*
|
|
103
|
+
* **EACH ROLE IN THIS ARRAY GENERATES A SEPARATE ENDPOINT**
|
|
104
|
+
*
|
|
105
|
+
* - If you specify `["admin", "moderator", "member"]`, this creates 3
|
|
106
|
+
* separate endpoints
|
|
107
|
+
* - Total generated endpoints = operations × average roles.length
|
|
108
|
+
* - Example: 100 operations with 3 roles each = 300 actual endpoints
|
|
109
|
+
*
|
|
110
|
+
* ## 🔴 AVOID OVER-GENERATION
|
|
111
|
+
*
|
|
112
|
+
* **DO NOT create role-specific endpoints when a public endpoint would
|
|
113
|
+
* suffice:**
|
|
114
|
+
*
|
|
115
|
+
* - ❌ BAD: Separate GET endpoints for admin, member, moderator to view the
|
|
116
|
+
* same public data
|
|
117
|
+
* - ✅ GOOD: Single public endpoint `[]` with role-based filtering in business
|
|
118
|
+
* logic
|
|
119
|
+
*
|
|
120
|
+
* **DO NOT enumerate all possible roles when the Prisma schema uses a
|
|
121
|
+
* single User table:**
|
|
122
|
+
*
|
|
123
|
+
* - If Prisma has a User table with role/permission fields, you likely only
|
|
124
|
+
* need `["user"]`
|
|
125
|
+
* - Avoid listing `["admin", "seller", "buyer", "moderator", ...]`
|
|
126
|
+
* unnecessarily
|
|
127
|
+
* - The actual role checking happens in business logic, not at the endpoint
|
|
128
|
+
* level
|
|
129
|
+
*
|
|
99
130
|
* ## Naming Convention
|
|
100
131
|
*
|
|
101
|
-
*
|
|
132
|
+
* DO: Use camelCase for all role names.
|
|
102
133
|
*
|
|
103
134
|
* ## Important Guidelines
|
|
104
135
|
*
|
|
105
136
|
* - Set to empty array `[]` for public endpoints that require no
|
|
106
137
|
* authentication
|
|
107
138
|
* - Set to array with role strings for role-restricted endpoints
|
|
108
|
-
* -
|
|
139
|
+
* - **MINIMIZE the number of roles per endpoint to prevent explosion**
|
|
140
|
+
* - Consider if the endpoint can be public with role-based filtering instead
|
|
141
|
+
* - The role names match exactly with the user type/role defined in the
|
|
109
142
|
* database
|
|
110
143
|
* - This will be used by the Realize Agent to generate appropriate decorator
|
|
111
144
|
* and authorization logic in the provider functions
|
|
@@ -114,11 +147,26 @@ export namespace IAutoBeInterfaceOperationApplication {
|
|
|
114
147
|
*
|
|
115
148
|
* ## Examples
|
|
116
149
|
*
|
|
117
|
-
* - `[]` - Public endpoint, no authentication required
|
|
118
|
-
*
|
|
119
|
-
* - `["
|
|
150
|
+
* - `[]` - Public endpoint, no authentication required (PREFERRED for read
|
|
151
|
+
* operations)
|
|
152
|
+
* - `["user"]` - Any authenticated user can access (PREFERRED for
|
|
153
|
+
* user-specific operations)
|
|
154
|
+
* - `["admin"]` - Only admin users can access (USE SPARINGLY)
|
|
120
155
|
* - `["admin", "moderator"]` - Both admin and moderator users can access
|
|
121
|
-
*
|
|
156
|
+
* (AVOID if possible)
|
|
157
|
+
* - `["seller"]` - Only seller users can access (ONLY if Seller is a separate
|
|
158
|
+
* table)
|
|
159
|
+
*
|
|
160
|
+
* ## Best Practices
|
|
161
|
+
*
|
|
162
|
+
* 1. **Start with public `[]` for all read operations** unless sensitive data
|
|
163
|
+
* is involved
|
|
164
|
+
* 2. **Use single role `["user"]` for authenticated operations** and handle
|
|
165
|
+
* permissions in business logic
|
|
166
|
+
* 3. **Only use multiple roles when absolutely necessary** for different
|
|
167
|
+
* business logic paths
|
|
168
|
+
* 4. **Remember: Fewer roles = Fewer endpoints = Better performance and
|
|
169
|
+
* maintainability**
|
|
122
170
|
*
|
|
123
171
|
* Note: The actual authentication/authorization implementation will be
|
|
124
172
|
* handled by decorators at the controller level, and the provider function
|
|
@@ -97,6 +97,43 @@ export namespace IAutoBeInterfaceOperationsReviewApplication {
|
|
|
97
97
|
* operations unchanged. These operations are validated and ready for schema
|
|
98
98
|
* generation and subsequent implementation phases.
|
|
99
99
|
*/
|
|
100
|
-
content:
|
|
100
|
+
content: IOperation[];
|
|
101
101
|
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Operation of the Restful API.
|
|
105
|
+
*
|
|
106
|
+
* This interface defines a single API endpoint with its HTTP {@link method},
|
|
107
|
+
* {@link path}, {@link parameters path parameters},
|
|
108
|
+
* {@link requestBody request body}, and {@link responseBody} structure. It
|
|
109
|
+
* corresponds to an individual operation in the paths section of an OpenAPI
|
|
110
|
+
* document.
|
|
111
|
+
*
|
|
112
|
+
* Each operation requires a detailed explanation of its purpose through the
|
|
113
|
+
* reason and description fields, making it clear why the API was designed and
|
|
114
|
+
* how it should be used.
|
|
115
|
+
*
|
|
116
|
+
* All request bodies and responses for this operation must be object types
|
|
117
|
+
* and must reference named types defined in the components section. The
|
|
118
|
+
* content-type is always `application/json`. For file upload/download
|
|
119
|
+
* operations, use `string & tags.Format<"uri">` in the appropriate schema
|
|
120
|
+
* instead of binary data formats.
|
|
121
|
+
*
|
|
122
|
+
* In OpenAPI, this might represent:
|
|
123
|
+
*
|
|
124
|
+
* ```json
|
|
125
|
+
* {
|
|
126
|
+
* "/shoppings/customers/orders": {
|
|
127
|
+
* "post": {
|
|
128
|
+
* "description": "Create a new order application from shopping cart...",
|
|
129
|
+
* "parameters": [...],
|
|
130
|
+
* "requestBody": {...},
|
|
131
|
+
* "responses": {...}
|
|
132
|
+
* }
|
|
133
|
+
* }
|
|
134
|
+
* }
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
export interface IOperation
|
|
138
|
+
extends Omit<AutoBeOpenApi.IOperation, "authorizationType"> {}
|
|
102
139
|
}
|
|
@@ -14,10 +14,9 @@ export interface IAutoBeInterfaceSchemaApplication {
|
|
|
14
14
|
* creation. This ensures that the final OpenAPI document has complete type
|
|
15
15
|
* coverage for all operations.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* comments.
|
|
17
|
+
* DO: Follow established naming conventions (IEntityName,
|
|
18
|
+
* IEntityName.ICreate, etc.) DO: Document thoroughly with descriptions that
|
|
19
|
+
* reference the original Prisma schema comments.
|
|
21
20
|
*
|
|
22
21
|
* @param props Properties containing components to generate.
|
|
23
22
|
*/
|
|
@@ -25,6 +24,40 @@ export interface IAutoBeInterfaceSchemaApplication {
|
|
|
25
24
|
}
|
|
26
25
|
export namespace IAutoBeInterfaceSchemaApplication {
|
|
27
26
|
export interface IProps {
|
|
27
|
+
/**
|
|
28
|
+
* TypeScript draft code for schema definitions.
|
|
29
|
+
*
|
|
30
|
+
* This property contains TypeScript interface definitions that serve as a
|
|
31
|
+
* preliminary draft before generating the final JSON schema components.
|
|
32
|
+
* The draft allows for initial design and validation of the schema structure
|
|
33
|
+
* using TypeScript's type system before converting to OpenAPI/JSON Schema format.
|
|
34
|
+
*
|
|
35
|
+
* The draft typically includes:
|
|
36
|
+
* - Entity interfaces matching the Prisma models
|
|
37
|
+
* - Operation-specific variants (ICreate, IUpdate, etc.)
|
|
38
|
+
* - Utility types and enumerations
|
|
39
|
+
* - Type relationships and constraints
|
|
40
|
+
*
|
|
41
|
+
* This TypeScript draft serves as the foundation for the subsequent schema
|
|
42
|
+
* generation, ensuring type safety and consistency. The final schemas in the
|
|
43
|
+
* `schemas` property should be derived from and validated against this draft.
|
|
44
|
+
*
|
|
45
|
+
* Example draft structure:
|
|
46
|
+
* ```typescript
|
|
47
|
+
* interface IUser {
|
|
48
|
+
* id: string;
|
|
49
|
+
* email: string;
|
|
50
|
+
* profile: IUserProfile;
|
|
51
|
+
* }
|
|
52
|
+
*
|
|
53
|
+
* namespace IUser {
|
|
54
|
+
* interface ICreate extends Omit<IUser, "id"> {}
|
|
55
|
+
* interface IUpdate extends Partial<ICreate> {}
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
draft: string;
|
|
60
|
+
|
|
28
61
|
/**
|
|
29
62
|
* Complete set of schema components for the OpenAPI specification.
|
|
30
63
|
*
|
|
@@ -32,23 +65,23 @@ export namespace IAutoBeInterfaceSchemaApplication {
|
|
|
32
65
|
* the system. It is the central repository of all named schema types that
|
|
33
66
|
* will be used throughout the API specification.
|
|
34
67
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* strictly prohibited.
|
|
68
|
+
* DO: Define all object types as named types in the components.schemas
|
|
69
|
+
* section. DO NOT: Use inline anonymous object definitions.
|
|
38
70
|
*
|
|
39
|
-
* This components object
|
|
71
|
+
* This components object includes:
|
|
40
72
|
*
|
|
41
73
|
* - Main entity types (IEntityName)
|
|
42
74
|
* - Operation-specific variants (.ICreate, .IUpdate, .ISummary, etc.)
|
|
43
75
|
* - Container types (IPage<T> for pagination)
|
|
44
76
|
* - Enumeration types
|
|
45
77
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
78
|
+
* DO: Include detailed descriptions that reference the original Prisma
|
|
79
|
+
* schema comments and thoroughly document each property. DO: Use a $ref to
|
|
80
|
+
* a named type in the components.schemas section for every property that
|
|
81
|
+
* references an object.
|
|
82
|
+
*
|
|
83
|
+
* This applies to all objects in request bodies, response bodies, and
|
|
84
|
+
* properties that are objects or arrays of objects.
|
|
52
85
|
*
|
|
53
86
|
* Example structure:
|
|
54
87
|
*
|
|
@@ -32,19 +32,16 @@ export namespace IAutoBeInterfaceSchemasReviewApplication {
|
|
|
32
32
|
/**
|
|
33
33
|
* Issues and problems found during schema analysis.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* - Positive feedback about what's already correct
|
|
38
|
-
* - Compliments about well-structured schemas
|
|
39
|
-
* - Confirmation that certain aspects meet standards
|
|
35
|
+
* DO: Document only problems that need fixing.
|
|
36
|
+
* DO NOT: Include positive feedback, compliments, or confirmations
|
|
40
37
|
*
|
|
41
38
|
* Focus exclusively on issues organized by severity:
|
|
42
39
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* -
|
|
46
|
-
* -
|
|
47
|
-
* -
|
|
40
|
+
* Severity levels:
|
|
41
|
+
* - Security vulnerabilities (exposed passwords, missing auth boundaries)
|
|
42
|
+
* - Missing required variants, incorrect type mappings
|
|
43
|
+
* - Missing format specifications, incomplete relationships
|
|
44
|
+
* - Documentation improvements, style consistency
|
|
48
45
|
*
|
|
49
46
|
* Each issue must include the specific schema name and what needs to be
|
|
50
47
|
* fixed. If there are no issues at all, simply state: "No issues found."
|
|
@@ -70,21 +67,18 @@ export namespace IAutoBeInterfaceSchemasReviewApplication {
|
|
|
70
67
|
/**
|
|
71
68
|
* Final validated and enhanced schemas ready for production use.
|
|
72
69
|
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* -
|
|
76
|
-
* -
|
|
77
|
-
* -
|
|
78
|
-
* -
|
|
79
|
-
* - If entity names are wrong, MUST contain renamed correct versions
|
|
80
|
-
* - If schemas are missing variants, MUST include the created variants
|
|
81
|
-
*
|
|
82
|
-
* FORBIDDEN:
|
|
70
|
+
* DO:
|
|
71
|
+
* - Include valid OpenAPI schema definitions
|
|
72
|
+
* - Include all entities that were in the original input
|
|
73
|
+
* - Provide fixed versions if original schemas have issues
|
|
74
|
+
* - Rename entities correctly if names are wrong
|
|
75
|
+
* - Include created variants if schemas are missing them
|
|
83
76
|
*
|
|
84
|
-
*
|
|
85
|
-
* -
|
|
86
|
-
* -
|
|
87
|
-
* -
|
|
77
|
+
* DO NOT:
|
|
78
|
+
* - Return an empty object {} (this will delete all schemas)
|
|
79
|
+
* - Return undefined or null
|
|
80
|
+
* - Include explanations or excuses in schema descriptions
|
|
81
|
+
* - Leave broken schemas unfixed
|
|
88
82
|
*
|
|
89
83
|
* When original schemas are beyond repair, recreate them properly based on
|
|
90
84
|
* entity names and context. This field becomes the final schemas used by
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AutoBeOpenApi } from "@autobe/interface";
|
|
2
|
+
import { IValidation } from "typia";
|
|
3
|
+
|
|
4
|
+
export const validateAuthorizationSchema = (props: {
|
|
5
|
+
errors: IValidation.IError[];
|
|
6
|
+
schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
|
|
7
|
+
path: string;
|
|
8
|
+
}): void => {
|
|
9
|
+
for (const [key, value] of Object.entries(props.schemas)) {
|
|
10
|
+
if (!key.endsWith(".IAuthorized")) continue;
|
|
11
|
+
|
|
12
|
+
// Check if it's an object type
|
|
13
|
+
if (!isObjectSchema(value)) {
|
|
14
|
+
props.errors.push({
|
|
15
|
+
path: `${props.path}.${key}`,
|
|
16
|
+
expected: `AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema.IObject>`,
|
|
17
|
+
value: value,
|
|
18
|
+
description: `${key} must be an object type for authorization responses`,
|
|
19
|
+
});
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Check if token property exists
|
|
24
|
+
value.properties ??= {};
|
|
25
|
+
value.properties["token"] = {
|
|
26
|
+
$ref: "#/components/schemas/IAuthorizationToken",
|
|
27
|
+
description: "JWT token information for authentication",
|
|
28
|
+
} as AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema.IReference>;
|
|
29
|
+
|
|
30
|
+
value.required ??= [];
|
|
31
|
+
if (value.required.includes("token") === false) {
|
|
32
|
+
value.required.push("token");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const isObjectSchema = (
|
|
38
|
+
schema: AutoBeOpenApi.IJsonSchemaDescriptive,
|
|
39
|
+
): schema is AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema.IObject> => {
|
|
40
|
+
return "type" in schema && schema.type === "object";
|
|
41
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
+
import { NamingConvention } from "typia/lib/utils/NamingConvention";
|
|
2
3
|
import { v4 } from "uuid";
|
|
3
4
|
|
|
4
5
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
@@ -11,18 +12,9 @@ export const transformPrismaComponentsHistories = (
|
|
|
11
12
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
12
13
|
> => {
|
|
13
14
|
if (state.analyze === null)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
created_at: new Date().toISOString(),
|
|
18
|
-
type: "systemMessage",
|
|
19
|
-
text: [
|
|
20
|
-
"Requirement analysis is not yet completed.",
|
|
21
|
-
"Don't call any tool function,",
|
|
22
|
-
"but say to process the requirement analysis.",
|
|
23
|
-
].join(" "),
|
|
24
|
-
},
|
|
25
|
-
];
|
|
15
|
+
// unreachable
|
|
16
|
+
throw new Error("Analyze state is not set.");
|
|
17
|
+
if (prefix) prefix = NamingConvention.snake(prefix);
|
|
26
18
|
return [
|
|
27
19
|
{
|
|
28
20
|
id: v4(),
|
|
@@ -50,13 +42,14 @@ export const transformPrismaComponentsHistories = (
|
|
|
50
42
|
`* Prefix provided by the user: ${prefix}`,
|
|
51
43
|
"",
|
|
52
44
|
"The user wants all database schema (table) names to start with the prefix provided below.",
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
45
|
+
"",
|
|
46
|
+
"DO: Use the provided prefix for all table names",
|
|
47
|
+
"DO: Place special-purpose prefixes like `mv` (for materialized views) before the given prefix",
|
|
48
|
+
"DO NOT: Apply prefix if it is `null`",
|
|
56
49
|
"",
|
|
57
50
|
"## Prefix Example",
|
|
58
51
|
"",
|
|
59
|
-
"If the prefix is `shopping`, then table names
|
|
52
|
+
"If the prefix is `shopping`, then table names are like:",
|
|
60
53
|
"",
|
|
61
54
|
"* `shopping_sales`",
|
|
62
55
|
"* `shopping_sale_options`",
|
|
@@ -10,9 +10,11 @@ import {
|
|
|
10
10
|
} from "@autobe/interface";
|
|
11
11
|
import { AutoBePrismaSchemasEvent } from "@autobe/interface/src/events/AutoBePrismaSchemasEvent";
|
|
12
12
|
import { ILlmSchema } from "@samchon/openapi";
|
|
13
|
+
import { v4 } from "uuid";
|
|
13
14
|
|
|
14
15
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
15
16
|
import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
|
|
17
|
+
import { predicateStateMessage } from "../../utils/predicateStateMessage";
|
|
16
18
|
import { orchestratePrismaComponents } from "./orchestratePrismaComponent";
|
|
17
19
|
import { orchestratePrismaCorrect } from "./orchestratePrismaCorrect";
|
|
18
20
|
import { orchestratePrismaReview } from "./orchestratePrismaReview";
|
|
@@ -22,7 +24,17 @@ export const orchestratePrisma = async <Model extends ILlmSchema.Model>(
|
|
|
22
24
|
ctx: AutoBeContext<Model>,
|
|
23
25
|
props: IAutoBeApplicationProps,
|
|
24
26
|
): Promise<AutoBePrismaHistory | AutoBeAssistantMessageHistory> => {
|
|
27
|
+
// PREDICATION
|
|
25
28
|
const start: Date = new Date();
|
|
29
|
+
const predicate: string | null = predicateStateMessage(ctx.state(), "prisma");
|
|
30
|
+
if (predicate !== null)
|
|
31
|
+
return ctx.assistantMessage({
|
|
32
|
+
type: "assistantMessage",
|
|
33
|
+
id: v4(),
|
|
34
|
+
created_at: start.toISOString(),
|
|
35
|
+
text: predicate,
|
|
36
|
+
completed_at: new Date().toISOString(),
|
|
37
|
+
});
|
|
26
38
|
ctx.dispatch({
|
|
27
39
|
type: "prismaStart",
|
|
28
40
|
created_at: start.toISOString(),
|
|
@@ -31,12 +43,9 @@ export const orchestratePrisma = async <Model extends ILlmSchema.Model>(
|
|
|
31
43
|
});
|
|
32
44
|
|
|
33
45
|
// COMPONENTS
|
|
34
|
-
const componentEvent:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (componentEvent.type === "assistantMessage")
|
|
38
|
-
return ctx.assistantMessage(componentEvent);
|
|
39
|
-
else ctx.dispatch(componentEvent);
|
|
46
|
+
const componentEvent: AutoBePrismaComponentsEvent =
|
|
47
|
+
await orchestratePrismaComponents(ctx);
|
|
48
|
+
ctx.dispatch(componentEvent);
|
|
40
49
|
|
|
41
50
|
// CONSTRUCT AST DATA
|
|
42
51
|
const schemaEvents: AutoBePrismaSchemasEvent[] =
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AgenticaAssistantMessageHistory,
|
|
3
|
-
IAgenticaController,
|
|
4
|
-
} from "@agentica/core";
|
|
5
|
-
import { AutoBeAssistantMessageHistory } from "@autobe/interface";
|
|
1
|
+
import { IAgenticaController } from "@agentica/core";
|
|
6
2
|
import { AutoBePrismaComponentsEvent } from "@autobe/interface/src/events/AutoBePrismaComponentsEvent";
|
|
7
3
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
8
4
|
import { IPointer } from "tstl";
|
|
9
5
|
import typia from "typia";
|
|
10
|
-
import { v4 } from "uuid";
|
|
11
6
|
|
|
12
7
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
13
8
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
@@ -18,14 +13,14 @@ export async function orchestratePrismaComponents<
|
|
|
18
13
|
Model extends ILlmSchema.Model,
|
|
19
14
|
>(
|
|
20
15
|
ctx: AutoBeContext<Model>,
|
|
21
|
-
message: string = "
|
|
22
|
-
): Promise<
|
|
16
|
+
message: string = "Design database from the given requirement analysis documents.",
|
|
17
|
+
): Promise<AutoBePrismaComponentsEvent> {
|
|
23
18
|
const start: Date = new Date();
|
|
24
19
|
const pointer: IPointer<IAutoBePrismaComponentApplication.IProps | null> = {
|
|
25
20
|
value: null,
|
|
26
21
|
};
|
|
27
22
|
const prefix: string | null = ctx.state().analyze?.prefix ?? null;
|
|
28
|
-
const {
|
|
23
|
+
const { tokenUsage } = await ctx.conversate({
|
|
29
24
|
source: "prismaComponents",
|
|
30
25
|
histories: transformPrismaComponentsHistories(ctx.state(), prefix),
|
|
31
26
|
controller: createController({
|
|
@@ -34,19 +29,11 @@ export async function orchestratePrismaComponents<
|
|
|
34
29
|
pointer.value = next;
|
|
35
30
|
},
|
|
36
31
|
}),
|
|
37
|
-
enforceFunctionCall:
|
|
32
|
+
enforceFunctionCall: true,
|
|
38
33
|
message,
|
|
39
34
|
});
|
|
40
|
-
if (
|
|
41
|
-
return {
|
|
42
|
-
...(histories.at(-1)! as AgenticaAssistantMessageHistory),
|
|
43
|
-
created_at: start.toISOString(),
|
|
44
|
-
completed_at: new Date().toISOString(),
|
|
45
|
-
id: v4(),
|
|
46
|
-
} satisfies AutoBeAssistantMessageHistory;
|
|
47
|
-
else if (pointer.value === null) {
|
|
35
|
+
if (pointer.value === null)
|
|
48
36
|
throw new Error("Failed to extract files and tables."); // unreachable
|
|
49
|
-
}
|
|
50
37
|
return {
|
|
51
38
|
type: "prismaComponents",
|
|
52
39
|
created_at: start.toISOString(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
|
-
import { AutoBePrisma } from "@autobe/interface";
|
|
2
|
+
import { AutoBePrisma, AutoBeProgressEventBase } from "@autobe/interface";
|
|
3
3
|
import { AutoBePrismaReviewEvent } from "@autobe/interface/src/events/AutoBePrismaReviewEvent";
|
|
4
4
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
5
5
|
import { IPointer } from "tstl";
|
|
@@ -7,7 +7,6 @@ import typia from "typia";
|
|
|
7
7
|
|
|
8
8
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
9
9
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
10
|
-
import { IProgress } from "../internal/IProgress";
|
|
11
10
|
import { transformPrismaReviewHistories } from "./histories/transformPrismaReviewHistories";
|
|
12
11
|
import { IAutoBePrismaReviewApplication } from "./structures/IAutoBePrismaReviewApplication";
|
|
13
12
|
|
|
@@ -17,15 +16,22 @@ export async function orchestratePrismaReview<Model extends ILlmSchema.Model>(
|
|
|
17
16
|
schemas: Record<string, string>,
|
|
18
17
|
componentList: AutoBePrisma.IComponent[],
|
|
19
18
|
): Promise<AutoBePrismaReviewEvent[]> {
|
|
20
|
-
const progress:
|
|
19
|
+
const progress: AutoBeProgressEventBase = {
|
|
21
20
|
completed: 0,
|
|
22
21
|
total: componentList.length,
|
|
23
22
|
};
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
return (
|
|
24
|
+
await Promise.all(
|
|
25
|
+
componentList.map(async (component) => {
|
|
26
|
+
try {
|
|
27
|
+
return await step(ctx, application, schemas, component, progress);
|
|
28
|
+
} catch {
|
|
29
|
+
++progress.completed;
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}),
|
|
33
|
+
)
|
|
34
|
+
).filter((v) => v !== null);
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
async function step<Model extends ILlmSchema.Model>(
|
|
@@ -33,7 +39,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
33
39
|
application: AutoBePrisma.IApplication,
|
|
34
40
|
schemas: Record<string, string>,
|
|
35
41
|
component: AutoBePrisma.IComponent,
|
|
36
|
-
progress:
|
|
42
|
+
progress: AutoBeProgressEventBase,
|
|
37
43
|
): Promise<AutoBePrismaReviewEvent> {
|
|
38
44
|
const start: Date = new Date();
|
|
39
45
|
const pointer: IPointer<IAutoBePrismaReviewApplication.IProps | null> = {
|
|
@@ -40,33 +40,29 @@ export const transformRealizeAuthorizationCorrectHistories = <
|
|
|
40
40
|
"## Generated TypeScript Code",
|
|
41
41
|
"",
|
|
42
42
|
"```json",
|
|
43
|
-
`${JSON.stringify(
|
|
44
|
-
{
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
} satisfies Omit<AutoBeRealizeAuthorization, "role">,
|
|
61
|
-
null,
|
|
62
|
-
2,
|
|
63
|
-
)}`,
|
|
43
|
+
`${JSON.stringify({
|
|
44
|
+
provider: {
|
|
45
|
+
location: auth.provider.location,
|
|
46
|
+
name: auth.provider.name,
|
|
47
|
+
content: auth.provider.content,
|
|
48
|
+
},
|
|
49
|
+
decorator: {
|
|
50
|
+
location: auth.decorator.location,
|
|
51
|
+
name: auth.decorator.name,
|
|
52
|
+
content: auth.decorator.content,
|
|
53
|
+
},
|
|
54
|
+
payload: {
|
|
55
|
+
location: auth.payload.location,
|
|
56
|
+
name: auth.payload.name,
|
|
57
|
+
content: auth.payload.content,
|
|
58
|
+
},
|
|
59
|
+
} satisfies Omit<AutoBeRealizeAuthorization, "role">)}`,
|
|
64
60
|
"```",
|
|
65
61
|
"",
|
|
66
62
|
"## Prisma Schema",
|
|
67
63
|
"",
|
|
68
64
|
"```json",
|
|
69
|
-
`${JSON.stringify(ctx.state().prisma?.schemas
|
|
65
|
+
`${JSON.stringify(ctx.state().prisma?.schemas)}`,
|
|
70
66
|
"```",
|
|
71
67
|
"",
|
|
72
68
|
"## File Paths",
|
|
@@ -80,7 +76,7 @@ export const transformRealizeAuthorizationCorrectHistories = <
|
|
|
80
76
|
"Fix the compilation error in the provided code.",
|
|
81
77
|
"",
|
|
82
78
|
"```json",
|
|
83
|
-
JSON.stringify(diagnostics
|
|
79
|
+
JSON.stringify(diagnostics),
|
|
84
80
|
"```",
|
|
85
81
|
"## Component Naming Convention",
|
|
86
82
|
"",
|