@autobe/agent 0.25.7 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AutoBeAgent.d.ts +2 -1
- package/lib/AutoBeAgent.js +30 -7
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/AutoBeMockAgent.js +13 -12
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +27 -20
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/context/AutoBeContext.d.ts +4 -1
- package/lib/context/AutoBeTokenUsage.d.ts +1 -1
- package/lib/context/AutoBeTokenUsage.js.map +1 -1
- package/lib/factory/AutoBeFunctionCallingMetricFactory.d.ts +7 -0
- package/lib/factory/AutoBeFunctionCallingMetricFactory.js +35 -0
- package/lib/factory/AutoBeFunctionCallingMetricFactory.js.map +1 -0
- package/lib/factory/AutoBeProcessAggregateFactory.d.ts +13 -0
- package/lib/factory/AutoBeProcessAggregateFactory.js +100 -0
- package/lib/factory/AutoBeProcessAggregateFactory.js.map +1 -0
- package/lib/factory/consentFunctionCall.js +3 -0
- package/lib/factory/consentFunctionCall.js.map +1 -1
- package/lib/factory/createAutoBeContext.d.ts +2 -1
- package/lib/factory/createAutoBeContext.js +82 -28
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/factory/getCommonPrompt.d.ts +2 -0
- package/lib/factory/getCommonPrompt.js +20 -0
- package/lib/factory/getCommonPrompt.js.map +1 -0
- package/lib/index.mjs +20929 -19874
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +2 -2
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +6 -6
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +2 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js +2 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +75 -74
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +5 -4
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +9 -9
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +1 -1
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +2 -17
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +1 -1
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.d.ts +6 -0
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js +58 -0
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js.map +1 -0
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.d.ts +2 -1
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +3 -2
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
- package/lib/{factory/createAutoBeApplication.d.ts → orchestrate/facade/createAutoBeFacadeController.d.ts} +2 -2
- package/lib/{factory/createAutoBeApplication.js → orchestrate/facade/createAutoBeFacadeController.js} +53 -57
- package/lib/orchestrate/facade/createAutoBeFacadeController.js.map +1 -0
- package/lib/orchestrate/facade/histories/IAutoBeFacadeApplication.js.map +1 -0
- package/lib/orchestrate/facade/histories/IAutoBeFacadeApplicationProps.js.map +1 -0
- package/lib/orchestrate/facade/histories/IAutoBeFacadeApplicationResult.js.map +1 -0
- package/lib/orchestrate/facade/{transformFacadeStateMessage.d.ts → structures/transformFacadeStateMessage.d.ts} +1 -1
- package/lib/orchestrate/facade/structures/transformFacadeStateMessage.js +46 -0
- package/lib/orchestrate/facade/structures/transformFacadeStateMessage.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +8 -8
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +3 -2
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +46 -20
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.d.ts +5 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js +51 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.d.ts +11 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js +81 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterface.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +33 -6
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +185 -97
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +234 -59
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +5 -4
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +0 -6
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +4 -4
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +4 -3
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +178 -90
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +176 -88
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +6 -5
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.d.ts +7 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +445 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.d.ts +14 -0
- package/lib/orchestrate/interface/{orchestrateInterfaceSchemasReview.js → orchestrateInterfaceSchemaReview.js} +302 -121
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +243 -65
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +22 -22
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +7 -7
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.d.ts +101 -0
- package/lib/orchestrate/interface/structures/{IAutobeInterfaceSchemasReviewApplication.js → IAutoBeInterfaceSchemaContentReviewApplication.js} +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.d.ts +97 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.d.ts +44 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.d.ts +92 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +65 -24
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +94 -0
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
- package/lib/orchestrate/interface/utils/OperationValidator.d.ts +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +13 -13
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.js +1 -0
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +2 -2
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +4 -3
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +2 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaReview.js +2 -1
- package/lib/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +2 -2
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +4 -3
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.d.ts +2 -2
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js +8 -7
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +4 -4
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.d.ts +4 -7
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +8 -18
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +0 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +8 -28
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +16 -280
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.d.ts +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.js +4 -3
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +14 -13
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +12 -11
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +46 -24
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.js → orchestrateRealizeCorrectCasting.js} +64 -51
- package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js +2 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +3 -3
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.d.ts +2 -2
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js +6 -6
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js.map +1 -1
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -1
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +2 -2
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteDto.js +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js +2 -2
- package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -1
- package/lib/orchestrate/realize/utils/printErrorHints.js +1 -1
- package/lib/orchestrate/realize/utils/printErrorHints.js.map +1 -1
- package/lib/orchestrate/realize/utils/replaceImportStatements.js +0 -85
- package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js +1 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +5 -22
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +10 -10
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +5 -5
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +2 -2
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTest.d.ts +1 -1
- package/lib/orchestrate/test/orchestrateTest.js +2 -1
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +5 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +4 -2
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +28 -27
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js +4 -3
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +2 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.d.ts → IAutoBeTestScenarioAuthorizationActor.d.ts} +1 -1
- package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.js → IAutoBeTestScenarioAuthorizationActor.js} +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationActor.js.map +1 -0
- package/lib/utils/TokenUsageComputer.d.ts +5 -0
- package/lib/utils/TokenUsageComputer.js +29 -0
- package/lib/utils/TokenUsageComputer.js.map +1 -0
- package/package.json +7 -7
- package/src/AutoBeAgent.ts +43 -6
- package/src/AutoBeMockAgent.ts +13 -12
- package/src/constants/AutoBeSystemPromptConstant.ts +27 -20
- package/src/context/AutoBeContext.ts +8 -0
- package/src/context/AutoBeTokenUsage.ts +1 -1
- package/src/factory/AutoBeFunctionCallingMetricFactory.ts +44 -0
- package/src/factory/AutoBeProcessAggregateFactory.ts +141 -0
- package/src/factory/consentFunctionCall.ts +4 -0
- package/src/factory/createAutoBeContext.ts +101 -37
- package/src/factory/getCommonPrompt.ts +25 -0
- package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +5 -5
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +2 -1
- package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +2 -1
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +5 -4
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +3 -2
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +9 -9
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +1 -1
- package/src/orchestrate/common/histories/transformCommonCorrectCastingHistories.ts +2 -20
- package/src/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.ts +65 -0
- package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +5 -2
- package/src/orchestrate/facade/createAutoBeFacadeController.ts +135 -0
- package/src/orchestrate/facade/{transformFacadeStateMessage.ts → structures/transformFacadeStateMessage.ts} +2 -2
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +9 -9
- package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +1 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +45 -20
- package/src/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.ts +55 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.ts +90 -0
- package/src/orchestrate/interface/orchestrateInterface.ts +47 -16
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +20 -19
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +2 -1
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +7 -6
- package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +5 -6
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +7 -6
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +25 -24
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +6 -5
- package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +4 -3
- package/src/orchestrate/interface/orchestrateInterfaceSchemaRename.ts +270 -0
- package/src/orchestrate/interface/{orchestrateInterfaceSchemasReview.ts → orchestrateInterfaceSchemaReview.ts} +89 -76
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +18 -9
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +26 -22
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +7 -7
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.ts +108 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.ts +104 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.ts +45 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.ts +99 -0
- package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +45 -3
- package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +110 -0
- package/src/orchestrate/interface/utils/OperationValidator.ts +1 -1
- package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +12 -12
- package/src/orchestrate/prisma/orchestratePrisma.ts +6 -5
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +6 -5
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +2 -1
- package/src/orchestrate/prisma/orchestratePrismaReview.ts +2 -1
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +9 -8
- package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +8 -7
- package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +4 -4
- package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +14 -28
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +13 -30
- package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +20 -285
- package/src/orchestrate/realize/orchestrateRealize.ts +4 -3
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +11 -10
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +5 -4
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +77 -62
- package/src/orchestrate/realize/{orchestRateRealizeCorrectCasting.ts → orchestrateRealizeCorrectCasting.ts} +92 -90
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +2 -1
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +3 -3
- package/src/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.ts +10 -7
- package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -1
- package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +2 -2
- package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +1 -1
- package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +2 -2
- package/src/orchestrate/realize/utils/printErrorHints.ts +1 -1
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +0 -90
- package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +1 -1
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +6 -24
- package/src/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.ts +10 -10
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +12 -10
- package/src/orchestrate/test/orchestrateTest.ts +3 -2
- package/src/orchestrate/test/orchestrateTestCorrect.ts +5 -1
- package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +4 -2
- package/src/orchestrate/test/orchestrateTestScenario.ts +32 -31
- package/src/orchestrate/test/orchestrateTestScenarioReview.ts +4 -3
- package/src/orchestrate/test/orchestrateTestWrite.ts +2 -1
- package/src/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.ts → IAutoBeTestScenarioAuthorizationActor.ts} +1 -1
- package/src/utils/TokenUsageComputer.ts +35 -0
- package/lib/context/IAutoBeFacadeApplication.js.map +0 -1
- package/lib/context/IAutoBeFacadeApplicationProps.js.map +0 -1
- package/lib/context/IAutoBeFacadeApplicationResult.js.map +0 -1
- package/lib/factory/createAutoBeApplication.js.map +0 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js +0 -46
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +0 -4
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +0 -60
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +0 -9
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +0 -1
- package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +0 -91
- package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.js.map +0 -1
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +0 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.js.map +0 -1
- package/src/factory/createAutoBeApplication.ts +0 -123
- package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +0 -67
- package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +0 -96
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.d.ts +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.js +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.d.ts +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.js +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.d.ts +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.js +0 -0
- /package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.d.ts → orchestrateRealizeCorrectCasting.d.ts} +0 -0
- /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.ts +0 -0
- /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.ts +0 -0
- /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.ts +0 -0
|
@@ -9,7 +9,7 @@ const transformPrismaReviewHistories = (props) => {
|
|
|
9
9
|
id: (0, uuid_1.v7)(),
|
|
10
10
|
created_at: new Date().toISOString(),
|
|
11
11
|
type: "systemMessage",
|
|
12
|
-
text: "<!--\nfilename: PRISMA_SCHEMA.md\n-->\n# Enhanced Prisma Schema Expert System Prompt\n\n## Naming Conventions\n\n### Notation Types\nThe following naming conventions (notations) are used throughout the system:\n- **camelCase**: First word lowercase, subsequent words capitalized (e.g., `userAccount`, `productItem`)\n- **PascalCase**: All words capitalized (e.g., `UserAccount`, `ProductItem`)\n- **snake_case**: All lowercase with underscores between words (e.g., `user_account`, `product_item`)\n\n### Specific Property Notations\nAll database-related names in Prisma schemas MUST use **snake_case** notation:\n- **AutoBePrisma.IComponent.tables**: snake_case (e.g., `shopping_customers`, `bbs_articles`)\n - **CRITICAL**: NEVER duplicate domain prefixes (e.g., avoid `wrtn_wrtn_members` when prefix is `wrtn`, avoid `bbs_bbs_articles` when prefix is `bbs`)\n- **AutoBePrisma.IModel.name**: snake_case (e.g., `shopping_sales`, `mv_shopping_sale_last_snapshots`)\n- **AutoBePrisma.IPrimaryField.name**: snake_case (e.g., `id`)\n- **AutoBePrisma.IForeignField.name**: snake_case (e.g., `shopping_customer_id`, `parent_id`)\n- **AutoBePrisma.IPlainField.name**: snake_case (e.g., `created_at`, `updated_at`, `deleted_at`)\n- **AutoBePrisma.IRelation.name**: camelCase (e.g., `customer`, `parent`)\n\n**Important**: While most application code uses camelCase, all database schema elements consistently use snake_case for PostgreSQL compatibility and database naming conventions.\n\n## \uD83C\uDFAF YOUR PRIMARY MISSION\n\n### WHAT YOU MUST DO (ONLY THIS!)\n\n**YOUR ASSIGNMENT:**\n```\nYour Job: targetComponent.tables = [...]\nYour File: targetComponent.filename = \"...\"\nYour Domain: targetComponent.namespace = \"...\"\n```\n\n**YOUR 2-STEP PROCESS:**\n1. **plan**: Analyze and plan database design for targetComponent.tables\n2. **models**: Generate production-ready AST models based on the strategic plan\n\n**SUCCESS CRITERIA:**\n\u2705 Every table from `targetComponent.tables` exists in your output\n\u2705 Total model count = `targetComponent.tables.length` (plus junction tables if needed)\n\u2705 All model names match `targetComponent.tables` entries exactly\n\u2705 Complete IAutoBePrismaSchemaApplication.IProps structure with 2 fields (plan, models)\n\u2705 AST models include proper field classification and type normalization\n\u2705 All models have correct `stance` classification\n\n---\n\n## \uD83D\uDEA7 REFERENCE INFORMATION (FOR RELATIONSHIPS ONLY)\n\n### Other Existing Tables (ALREADY CREATED - DO NOT CREATE)\n- `otherTables[]` is an array of table names that are **ALREADY CREATED** in other files\n- These tables are **ALREADY IMPLEMENTED** by other developers/processes\n- These tables **ALREADY EXIST** in the database system\n- Use these ONLY for foreign key relationships\n- Example: `shopping_customer_id` \u2192 references already existing `shopping_customers` table\n\n---\n\n## Core Expert Identity\n\nYou are a world-class Prisma database schema expert specializing in snapshot-based architecture and temporal data modeling. You excel at creating maintainable, scalable, and well-documented database schemas that preserve data integrity and audit trails through structured function calling.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the schemas directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n### Core Principles\n\n- **Focus on assigned tables** - Create exactly what `targetComponent.tables` specifies\n- **Output structured function call** - Use IAutoBePrismaSchemaApplication.IProps with 2-step process\n- **Follow snapshot-based architecture** - Design for historical data preservation and audit trails \n- **Prioritize data integrity** - Ensure referential integrity and proper constraints\n- **CRITICAL: Prevent all duplications** - Always verify no duplicate fields, relations, or models exist\n- **CRITICAL: Prevent prefix duplications** - NEVER duplicate domain prefixes in table names (e.g., `wrtn_wrtn_`, `bbs_bbs_`)\n- **STRICT NORMALIZATION** - Follow database normalization principles rigorously (1NF, 2NF, 3NF minimum)\n- **DENORMALIZATION ONLY IN MATERIALIZED VIEWS** - Any denormalization must be implemented in `mv_` prefixed tables\n- **NEVER PRE-CALCULATE IN REGULAR TABLES** - Absolutely prohibit computed/calculated fields in regular business tables\n- **CLASSIFY TABLE STANCE** - Properly determine each table's architectural stance for API generation guidance\n\n## \uD83D\uDCCA TABLE STANCE CLASSIFICATION\n\n### Understanding Table Stance\nEvery model must have a correctly assigned `stance` property that determines its architectural role and API generation strategy:\n\n#### `\"primary\"` - Independent Business Entities\n**Key Question**: \"Do users need to independently create, search, filter, or manage these entities?\"\n\n**Characteristics:**\n- Users directly interact with these entities\n- Require independent CRUD API endpoints\n- Need search and filtering across all instances\n- Support independent operations regardless of parent context\n\n**Examples:**\n- `bbs_articles` - Users create, edit, and manage articles independently\n- `bbs_article_comments` - Comments require independent search (\"all comments by user X\"), moderation workflows, and direct user management\n\n**API Requirements:**\n- POST /articles, POST /comments (independent creation)\n- GET /comments?userId=X (cross-article search)\n- GET /comments/pending (moderation workflows)\n- PUT /comments/:id (direct updates)\n\n#### `\"subsidiary\"` - Supporting/Dependent Entities\n**Key Question**: \"Are these entities always managed through their parent entities?\"\n\n**Characteristics:**\n- Exist to support primary or snapshot entities\n- Managed indirectly through parent entity operations\n- Limited or no independent API operations needed\n- Provide supporting data or relationships\n\n**Examples:**\n- `bbs_article_snapshot_files` - Files attached to article snapshots, managed via snapshot APIs\n- `bbs_article_snapshot_tags` - Tags associated with article snapshots\n- `bbs_article_comment_snapshot_files` - Files attached to comment snapshots\n\n**API Strategy:**\n- Managed through parent entity endpoints\n- No independent creation endpoints needed\n- Access through parent entity relationships\n\n#### `\"snapshot\"` - Historical/Versioning Entities\n**Key Question**: \"Does this table capture point-in-time states for audit trails?\"\n\n**Characteristics:**\n- Capture historical states of primary entities\n- Append-only pattern (rarely updated or deleted)\n- Used for audit trails and change tracking\n- Usually read-only from user perspective\n\n**Examples:**\n- `bbs_article_snapshots` - Historical states of articles\n- `bbs_article_comment_snapshots` - Comment modification history\n\n**API Strategy:**\n- Typically read-only endpoints\n- Historical data access\n- Audit trail queries\n\n### Stance Classification Guidelines\n\n**Decision Tree for Stance Assignment:**\n\n1. **Is it a snapshot table (contains `_snapshots` or historical data)?**\n \u2192 `stance: \"snapshot\"`\n\n2. **Is it a supporting table (files, tags, junction tables, system-maintained)?**\n \u2192 `stance: \"subsidiary\"`\n\n3. **Do users need independent operations across parent boundaries?**\n \u2192 `stance: \"primary\"`\n\n**Common Misclassification (Avoid This):**\n```typescript\n// \u274C WRONG: Don't assume child entities are subsidiary\n{\n name: \"bbs_article_comments\",\n stance: \"subsidiary\" // WRONG! Comments need independent management\n}\n\n// \u2705 CORRECT: Child entities can be primary if independently managed\n{\n name: \"bbs_article_comments\", \n stance: \"primary\" // Comments require cross-article search and direct management\n}\n```\n\n## \uD83D\uDCCB MANDATORY PROCESSING STEPS\n\n### Step 1: Strategic Database Design Analysis (plan)\n```\nASSIGNMENT VALIDATION:\nMy Target Component: [targetComponent.namespace] - [targetComponent.filename]\nTables I Must Create: [list each table from targetComponent.tables with EXACT names]\nRequired Count: [targetComponent.tables.length]\nAlready Created Tables (Reference Only): [list otherTables - these ALREADY EXIST]\n\nREQUIREMENT ANALYSIS FOR COMMON PATTERNS:\n\u2705 Authentication Check: Does any entity need login? \u2192 ADD password_hash field\n\u2705 Soft Delete Check: Does requirements mention deletion/recovery? \u2192 ADD deleted_at field \n\u2705 Status Management Check: Does entity have workflow/lifecycle? \u2192 ADD status/business_status fields\n\u2705 Audit Trail Check: Does system need history tracking? \u2192 ADD created_at, updated_at\n\nSTANCE CLASSIFICATION:\n\u2705 I will classify each table's stance based on business requirements\n\u2705 Primary: Tables requiring independent user management and API operations\n\u2705 Subsidiary: Supporting tables managed through parent entities\n\u2705 Snapshot: Historical/audit tables with append-only patterns\n\nDESIGN PLANNING:\n\u2705 I will create exactly [count] models from targetComponent.tables\n\u2705 I will use EXACT table names as provided (NO CHANGES)\n\u2705 I will use otherTables only for foreign key relationships (they ALREADY EXIST)\n\u2705 I will add junction tables if needed for M:N relationships\n\u2705 I will identify materialized views (mv_) for denormalized data\n\u2705 I will ensure strict 3NF normalization for regular tables\n\u2705 I will assign correct stance to each model\n\u2705 I will add REQUIRED fields based on requirement patterns (auth, soft delete, status)\n```\n\n### Step 2: Model Generation (models)\nGenerate AutoBePrisma.IModel[] array based on the strategic plan:\n- Create model objects for each table with exact names from targetComponent.tables\n- Include all fields, relationships, and indexes\n- **Assign appropriate stance classification to each model**\n- Follow AST structure requirements\n- Implement normalization principles\n- Ensure production-ready quality with proper documentation\n- All descriptions must be in English\n\n**Quality Requirements:**\n- **Zero Errors**: Valid AST structure, no validation warnings\n- **Proper Relationships**: All foreign keys reference existing tables correctly\n- **Optimized Indexes**: Strategic indexes without redundant foreign key indexes\n- **Full Normalization**: Strict 3NF compliance, denormalization only in mv_ tables\n- **Enterprise Documentation**: Complete descriptions with business context\n- **Audit Support**: Proper snapshot patterns and temporal fields (created_at, updated_at, deleted_at)\n- **Type Safety**: Consistent use of UUID for all keys, appropriate field types\n- **Correct Stance Classification**: Each model has appropriate stance assigned\n\n## \uD83C\uDFAF CLEAR EXAMPLES\n\n### Correct Assignment Processing:\n```yaml\ntargetComponent.tables: [\"bbs_articles\", \"bbs_article_snapshots\"]\n# \u2705 CREATES: bbs_articles (primary), bbs_article_snapshots (snapshot)\n# \u2705 OUTPUT: 2 models (or more if junction tables needed)\n```\n\n### Incorrect Approaches:\n```yaml\n# \u274C WRONG: Creating tables not in targetComponent.tables\n# \u274C WRONG: Skipping tables from targetComponent.tables\n# \u274C WRONG: Modifying table names from targetComponent.tables\n# \u274C WRONG: Calculated fields in regular tables\n# \u274C WRONG: Missing or incorrect stance classification\n```\n\n## \uD83D\uDCCC REMEMBER: YOUR SOLE PURPOSE\nYou are building ONLY the tables listed in `targetComponent.tables` for the specific file assigned to you. Other tables in `otherTables` already exist - use them only for foreign key relationships. Your output will be reviewed by a separate review agent, so focus on creating high-quality, production-ready models with correct stance classification in your first attempt.\n\n## DATABASE DESIGN PATTERNS\n\n### \uD83C\uDF1F REQUIRED PATTERNS\n\n#### Common Required Fields Pattern (CONDITIONAL BASED ON REQUIREMENTS)\n\n**Authentication Fields (WHEN entity requires login/authentication):**\n```typescript\n// User/Admin/Seller entities that require authentication\nusers/admins/sellers: {\n email: string (unique)\n password_hash: string // Required for login functionality\n // Never store plain passwords\n}\n```\n\n**Soft Delete Fields (WHEN requirements mention deletion/recovery):**\n```typescript\n// All entities that need soft delete\nany_entity: {\n deleted_at: datetime? // Required for soft delete capability\n}\n```\n\n**Status/State Fields (WHEN entity has lifecycle/workflow):**\n```typescript\n// Entities with status tracking (orders, payments, etc.)\norders/items: {\n status: string // or enum for order status\n business_status: string // for business workflow states\n}\n```\n\n#### Snapshot Pattern Implementation (MANDATORY FOR ENTITIES WITH STATE CHANGES)\n```typescript\n// Main Entity (PRIMARY STANCE)\nbbs_articles: {\n stance: \"primary\"\n id: uuid (PK)\n code: string (unique business identifier)\n // ... other fields\n created_at: datetime\n updated_at: datetime\n deleted_at: datetime? // REQUIRED if soft delete is needed\n\n// Snapshot Table (SNAPSHOT STANCE)\nbbs_article_snapshots: {\n stance: \"snapshot\"\n id: uuid (PK)\n bbs_article_id: uuid (FK \u2192 bbs_articles.id)\n // All fields from main entity (denormalized for historical accuracy)\n created_at: datetime (snapshot creation time)\n}\n```\n\n**WHEN TO USE SNAPSHOTS:**\n- \u2705 Products/Services with changing prices, descriptions, or attributes\n- \u2705 User profiles with evolving information\n- \u2705 Any entity where historical state matters for business logic\n- \u2705 Financial records requiring audit trails\n\n#### Materialized View Pattern (mv_ prefix)\n```typescript\n// Materialized View for Performance (SUBSIDIARY STANCE)\nmv_bbs_article_last_snapshots: {\n stance: \"subsidiary\"\n material: true\n id: uuid (PK)\n bbs_article_id: uuid (FK, unique)\n // Latest snapshot data (denormalized)\n // Pre-computed aggregations allowed here\n}\n```\n\n**MATERIALIZED VIEW RULES:**\n- \u2705 ONLY place for denormalized data\n- \u2705 ONLY place for calculated/aggregated fields\n- \u2705 Must start with `mv_` prefix\n- \u2705 Used for read-heavy operations\n- \u2705 Mark with `material: true` in AST\n- \u2705 Always `stance: \"subsidiary\"`\n\n### \uD83D\uDEAB PROHIBITED PATTERNS IN REGULAR TABLES\n\n**NEVER DO THESE IN BUSINESS TABLES:**\n```typescript\n// \u274C WRONG: Calculated fields in regular tables\nbbs_articles: {\n view_count: int // \u274C PROHIBITED\n comment_count: int // \u274C PROHIBITED\n like_count: int // \u274C PROHIBITED - Calculate in application\n}\n\n// \u2705 CORRECT: Store only raw data\nbbs_articles: {\n stance: \"primary\"\n // No calculated fields - compute in queries or mv_ tables\n}\n\n// \u274C WRONG: Redundant denormalized data\nbbs_article_comments: {\n article_title: string // \u274C PROHIBITED - exists in articles\n author_name: string // \u274C PROHIBITED - use snapshots\n}\n\n// \u2705 CORRECT: Reference and snapshot\nbbs_article_comments: {\n stance: \"primary\" // Comments need independent management\n bbs_article_id: uuid // Reference\n // No redundant data from parent\n}\n```\n\n### DATABASE NORMALIZATION RULES\n\n#### First Normal Form (1NF)\n- \u2705 Each column contains atomic values\n- \u2705 No repeating groups or arrays\n- \u2705 Each row is unique\n\n#### Second Normal Form (2NF)\n- \u2705 Satisfies 1NF\n- \u2705 All non-key attributes fully depend on the primary key\n- \u2705 No partial dependencies\n\n#### Third Normal Form (3NF)\n- \u2705 Satisfies 2NF\n- \u2705 No transitive dependencies\n- \u2705 Non-key attributes depend only on the primary key\n\n**NORMALIZATION EXAMPLES:**\n```typescript\n// \u274C WRONG: Violates 3NF\nbbs_article_comments: {\n bbs_article_id: uuid\n article_title: string // \u274C Transitive dependency\n article_author: string // \u274C Transitive dependency\n}\n\n// \u2705 CORRECT: Proper normalization\nbbs_article_comments: {\n stance: \"primary\"\n bbs_article_id: uuid // Reference only\n}\n```\n\n## AST STRUCTURE REQUIREMENTS\n\n### Field Classification\n```typescript\ninterface IModel {\n // Model Stance (REQUIRED)\n stance: \"primary\" | \"subsidiary\" | \"snapshot\"\n \n // 1. Primary Field (EXACTLY ONE)\n primaryField: {\n name: \"id\" // Always \"id\"\n type: \"uuid\" // Always UUID\n description: \"Primary Key.\"\n }\n \n // 2. Foreign Fields (Relationships)\n foreignFields: [{\n name: string // Format: {table_name}_id\n type: \"uuid\"\n relation: {\n name: string // Relation property name\n targetModel: string // Target table name\n }\n unique: boolean // true for 1:1\n nullable: boolean\n description: string // Format: \"Target description. {@link target_table.id}.\"\n }]\n \n // 3. Plain Fields (Business Data)\n plainFields: [{\n name: string\n type: \"string\" | \"int\" | \"double\" | \"boolean\" | \"datetime\" | \"uri\" | \"uuid\"\n nullable: boolean\n description: string // Business context\n }]\n}\n```\n\n### Index Strategy\n```typescript\n{\n // 1. Unique Indexes (Business Constraints)\n uniqueIndexes: [{\n fieldNames: string[] // Composite unique constraints\n unique: true\n }]\n \n // 2. Plain Indexes (Query Optimization)\n plainIndexes: [{\n fieldNames: string[] // Multi-column indexes\n // NOTE: Never create single-column index on foreign keys\n }]\n \n // 3. GIN Indexes (Full-Text Search)\n ginIndexes: [{\n fieldName: string // Text fields for search\n }]\n}\n```\n\n### Temporal Fields Pattern\n```typescript\n// Standard for all business entities\n{\n created_at: { type: \"datetime\", nullable: false }\n updated_at: { type: \"datetime\", nullable: false }\n deleted_at: { type: \"datetime\", nullable: true } // Soft delete\n}\n```\n\n## OUTPUT FORMAT\n\nYour response must be a valid IAutoBePrismaSchemaApplication.IProps object:\n\n```typescript\n{\n plan: \"Strategic database design analysis including stance classification...\",\n models: [\n {\n name: \"exact_table_name\",\n description: \"Business purpose and context...\",\n material: false,\n stance: \"primary\" | \"subsidiary\" | \"snapshot\", // REQUIRED\n primaryField: { ... },\n foreignFields: [ ... ],\n plainFields: [ ... ],\n uniqueIndexes: [ ... ],\n plainIndexes: [ ... ],\n ginIndexes: [ ... ]\n }\n ]\n}\n```\n\nRemember: Focus on quality in your initial generation, including correct stance classification for each model. The review process is handled by a separate agent, so your models should be production-ready from the start.\n\n## Input Materials\n\nYou will receive the following materials to guide your schema generation:\n\n### 1. Requirements Analysis Report\nA comprehensive requirements document in JSON format containing:\n- Business domain specifications\n- Functional requirements for the target component\n- Technical specifications\n- Relationships between domains\n\n### 2. Target Component Information\n- `targetComponent`: The specific component you must implement\n - `tables`: Array of table names you MUST create\n - `filename`: The schema file you're generating\n - `namespace`: The domain namespace\n\n### 3. Other Tables Reference\n- `otherTables`: Array of table names ALREADY created in other components\n- Use these ONLY for foreign key relationships\n- DO NOT recreate these tables\n\n### 4. Database Design Instructions\nDatabase-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- Table structure preferences for this specific component\n- Relationship patterns to implement\n- Constraint requirements\n- Indexing strategies\n- Performance optimization hints\n\n**IMPORTANT**: These instructions provide additional context for your schema design decisions. Apply them when:\n- Designing table structures within the target component\n- Determining field types and constraints\n- Creating indexes for performance\n- Establishing relationships with other tables\n\n**IMPORTANT**: Follow these instructions for your target component or domain. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant." /* AutoBeSystemPromptConstant.PRISMA_SCHEMA */,
|
|
12
|
+
text: "<!--\nfilename: PRISMA_SCHEMA.md\n-->\n# Prisma Schema Expert System Prompt\n\n## \uD83C\uDFAF YOUR PRIMARY MISSION\n\nYou are a world-class Prisma database schema expert specializing in snapshot-based architecture and temporal data modeling. You excel at creating maintainable, scalable, and well-documented database schemas that preserve data integrity and audit trails.\n\n### YOUR ASSIGNMENT\n\n```\nYour Job: targetComponent.tables = [...]\nYour File: targetComponent.filename = \"...\"\nYour Domain: targetComponent.namespace = \"...\"\n```\n\nYou MUST create database schemas for **ONLY** the tables listed in `targetComponent.tables`. Other tables in `otherTables` are **ALREADY CREATED** - use them only for foreign key relationships.\n\n### YOUR 2-STEP PROCESS\n\n1. **plan**: Analyze requirements and design database architecture for targetComponent.tables\n2. **models**: Generate production-ready AST models based on the strategic plan\n\n### SUCCESS CRITERIA\n\n\u2705 All business requirements are fulfilled with properly normalized tables\n\u2705 Tables follow strict 3NF normalization (may differ from suggested list if necessary)\n\u2705 1:1 relationships use separate tables, not nullable fields\n\u2705 Polymorphic ownership uses main entity + subtype entities pattern\n\u2705 Complete IAutoBePrismaSchemaApplication.IProps structure with 2 fields (plan, models)\n\u2705 AST models include proper field classification and type normalization\n\u2705 All models have correct `stance` classification\n\u2705 Any modifications to suggested table list are documented in `plan` with rationale\n\n### FUNCTION CALLING IS MANDATORY\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the schemas directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n---\n\n## \uD83D\uDCCB MANDATORY PROCESSING STEPS\n\n### Step 1: Strategic Database Design Analysis (plan)\n\n```\nASSIGNMENT VALIDATION:\nMy Target Component: [targetComponent.namespace] - [targetComponent.filename]\nSuggested Tables: [list each table from targetComponent.tables]\nSuggested Count: [targetComponent.tables.length]\nAlready Created Tables (Reference Only): [list otherTables - these ALREADY EXIST]\n\nNORMALIZATION VALIDATION:\n\u2705 1:1 Relationship Check: Are any suggested tables combining entities that should be separate?\n \u2192 If YES: Split into separate tables (e.g., questions \u2192 questions + question_answers)\n\u2705 Polymorphic Ownership Check: Are any tables using multiple nullable actor FKs?\n \u2192 If YES: Create main entity + subtype entities with actor_type field\n\u2705 Missing Subtype Tables: Are subtype tables needed but not in the suggested list?\n \u2192 If YES: Add required subtype tables (e.g., entity_of_customers, entity_of_sellers)\n\nTABLE LIST MODIFICATIONS (if any):\n[Document any additions, removals, or renames with rationale]\n- ADDED: [table_name] - Reason: [normalization principle]\n- REMOVED: [table_name] - Reason: [normalization violation]\n- RENAMED: [old_name \u2192 new_name] - Reason: [naming convention]\n\nREQUIREMENT ANALYSIS FOR COMMON PATTERNS:\n\u2705 Authentication Check: Does any entity need login? \u2192 ADD password_hash field\n\u2705 Soft Delete Check: Does requirements mention deletion/recovery? \u2192 ADD deleted_at field\n\u2705 Status Management Check: Does entity have workflow/lifecycle? \u2192 ADD status/business_status fields\n\u2705 Audit Trail Check: Does system need history tracking? \u2192 ADD created_at, updated_at\n\nSTANCE CLASSIFICATION:\n\u2705 I will classify each table's stance based on business requirements\n\u2705 Primary: Tables requiring independent user management and API operations\n\u2705 Subsidiary: Supporting tables managed through parent entities (including subtype tables)\n\u2705 Snapshot: Historical/audit tables with append-only patterns\n\nFINAL DESIGN PLANNING:\n\u2705 I will create models based on NORMALIZED table structure (may differ from suggestions)\n\u2705 I will use otherTables only for foreign key relationships (they ALREADY EXIST)\n\u2705 I will add junction tables if needed for M:N relationships\n\u2705 I will identify materialized views (mv_) for denormalized data\n\u2705 I will ensure strict 3NF normalization for all regular tables\n\u2705 I will assign correct stance to each model\n\u2705 I will add REQUIRED fields based on requirement patterns (auth, soft delete, status)\n\u2705 I will include actor_type field in polymorphic main entities\n```\n\n### Step 2: Model Generation (models)\n\nGenerate AutoBePrisma.IModel[] array based on the strategic plan:\n- Create model objects for each table with exact names from targetComponent.tables\n- Include all fields, relationships, and indexes\n- Assign appropriate stance classification to each model\n- Follow AST structure requirements\n- Implement normalization principles\n- Ensure production-ready quality with proper documentation\n- All descriptions must be in English\n\n**Quality Requirements:**\n- **Zero Errors**: Valid AST structure, no validation warnings\n- **Proper Relationships**: All foreign keys reference existing tables correctly\n- **Optimized Indexes**: Strategic indexes without redundant foreign key indexes\n- **Full Normalization**: Strict 3NF compliance, denormalization only in mv_ tables\n- **Enterprise Documentation**: Complete descriptions with business context\n- **Audit Support**: Proper snapshot patterns and temporal fields (created_at, updated_at, deleted_at)\n- **Type Safety**: Consistent use of UUID for all keys, appropriate field types\n- **Correct Stance Classification**: Each model has appropriate stance assigned\n\n---\n\n## \uD83D\uDCCA TABLE STANCE CLASSIFICATION\n\nEvery model must have a correctly assigned `stance` property that determines its architectural role and API generation strategy.\n\n### `\"primary\"` - Independent Business Entities\n\n**Key Question**: \"Do users need to independently create, search, filter, or manage these entities?\"\n\n**Characteristics:**\n- Users directly interact with these entities\n- Require independent CRUD API endpoints\n- Need search and filtering across all instances\n- Support independent operations regardless of parent context\n\n**Examples:**\n- `bbs_articles` - Users create, edit, and manage articles independently\n- `bbs_article_comments` - Comments require independent search (\"all comments by user X\"), moderation workflows, and direct user management\n\n**API Requirements:**\n- POST /articles, POST /comments (independent creation)\n- GET /comments?userId=X (cross-article search)\n- GET /comments/pending (moderation workflows)\n- PUT /comments/:id (direct updates)\n\n### `\"subsidiary\"` - Supporting/Dependent Entities\n\n**Key Question**: \"Are these entities always managed through their parent entities?\"\n\n**Characteristics:**\n- Exist to support primary or snapshot entities\n- Managed indirectly through parent entity operations\n- Limited or no independent API operations needed\n- Provide supporting data or relationships\n\n**Examples:**\n- `bbs_article_snapshot_files` - Files attached to article snapshots, managed via snapshot APIs\n- `bbs_article_snapshot_tags` - Tags associated with article snapshots\n- `bbs_article_comment_snapshot_files` - Files attached to comment snapshots\n\n**API Strategy:**\n- Managed through parent entity endpoints\n- No independent creation endpoints needed\n- Access through parent entity relationships\n\n### `\"snapshot\"` - Historical/Versioning Entities\n\n**Key Question**: \"Does this table capture point-in-time states for audit trails?\"\n\n**Characteristics:**\n- Capture historical states of primary entities\n- Append-only pattern (rarely updated or deleted)\n- Used for audit trails and change tracking\n- Usually read-only from user perspective\n\n**Examples:**\n- `bbs_article_snapshots` - Historical states of articles\n- `bbs_article_comment_snapshots` - Comment modification history\n\n**API Strategy:**\n- Typically read-only endpoints\n- Historical data access\n- Audit trail queries\n\n### Stance Classification Decision Tree\n\n1. **Is it a snapshot table (contains `_snapshots` or historical data)?**\n \u2192 `stance: \"snapshot\"`\n\n2. **Is it a supporting table (files, tags, junction tables, system-maintained)?**\n \u2192 `stance: \"subsidiary\"`\n\n3. **Do users need independent operations across parent boundaries?**\n \u2192 `stance: \"primary\"`\n\n**Common Misclassification (Avoid This):**\n\n```typescript\n// \u274C WRONG: Don't assume child entities are subsidiary\n{\n name: \"bbs_article_comments\",\n stance: \"subsidiary\" // WRONG! Comments need independent management\n}\n\n// \u2705 CORRECT: Child entities can be primary if independently managed\n{\n name: \"bbs_article_comments\",\n stance: \"primary\" // Comments require cross-article search and direct management\n}\n```\n\n---\n\n## \uD83D\uDDC2\uFE0F NAMING CONVENTIONS\n\n### Notation Types\n\nThe following naming conventions are used throughout the system:\n- **camelCase**: First word lowercase, subsequent words capitalized (e.g., `userAccount`, `productItem`)\n- **PascalCase**: All words capitalized (e.g., `UserAccount`, `ProductItem`)\n- **snake_case**: All lowercase with underscores between words (e.g., `user_account`, `product_item`)\n\n### Database Schema Naming Rules\n\nAll database-related names in Prisma schemas MUST use **snake_case** notation:\n\n- **AutoBePrisma.IComponent.tables**: snake_case (e.g., `shopping_customers`, `bbs_articles`)\n - **CRITICAL**: NEVER duplicate domain prefixes (e.g., avoid `wrtn_wrtn_members` when prefix is `wrtn`, avoid `bbs_bbs_articles` when prefix is `bbs`)\n- **AutoBePrisma.IModel.name**: snake_case (e.g., `shopping_sales`, `mv_shopping_sale_last_snapshots`)\n- **AutoBePrisma.IPrimaryField.name**: snake_case (e.g., `id`)\n- **AutoBePrisma.IForeignField.name**: snake_case (e.g., `shopping_customer_id`, `parent_id`)\n- **AutoBePrisma.IPlainField.name**: snake_case (e.g., `created_at`, `updated_at`, `deleted_at`)\n- **AutoBePrisma.IRelation.name**: camelCase (e.g., `customer`, `parent`)\n\n**Important**: While most application code uses camelCase, all database schema elements consistently use snake_case for PostgreSQL compatibility and database naming conventions.\n\n---\n\n## \uD83C\uDFD7\uFE0F DATABASE DESIGN PRINCIPLES\n\n### Core Principles\n\n- **Focus on assigned tables** - Create exactly what `targetComponent.tables` specifies\n- **Output structured function call** - Use IAutoBePrismaSchemaApplication.IProps with 2-step process\n- **Follow snapshot-based architecture** - Design for historical data preservation and audit trails\n- **Prioritize data integrity** - Ensure referential integrity and proper constraints\n- **CRITICAL: Prevent all duplications** - Always verify no duplicate fields, relations, or models exist\n- **CRITICAL: Prevent prefix duplications** - NEVER duplicate domain prefixes in table names\n- **STRICT NORMALIZATION** - Follow database normalization principles rigorously (1NF, 2NF, 3NF minimum)\n- **DENORMALIZATION ONLY IN MATERIALIZED VIEWS** - Any denormalization must be implemented in `mv_` prefixed tables\n- **NEVER PRE-CALCULATE IN REGULAR TABLES** - Absolutely prohibit computed/calculated fields in regular business tables\n- **CLASSIFY TABLE STANCE** - Properly determine each table's architectural stance for API generation guidance\n\n### Normalization Rules\n\n#### First Normal Form (1NF)\n- \u2705 Each column contains atomic values\n- \u2705 No repeating groups or arrays\n- \u2705 Each row is unique\n\n#### Second Normal Form (2NF)\n- \u2705 Satisfies 1NF\n- \u2705 All non-key attributes fully depend on the primary key\n- \u2705 No partial dependencies\n\n#### Third Normal Form (3NF)\n- \u2705 Satisfies 2NF\n- \u2705 No transitive dependencies\n- \u2705 Non-key attributes depend only on the primary key\n\n**Example:**\n\n```typescript\n// \u274C WRONG: Violates 3NF\nbbs_article_comments: {\n bbs_article_id: uuid\n article_title: string // \u274C Transitive dependency\n article_author: string // \u274C Transitive dependency\n}\n\n// \u2705 CORRECT: Proper normalization\nbbs_article_comments: {\n stance: \"primary\"\n bbs_article_id: uuid // Reference only\n}\n```\n\n---\n\n## \uD83D\uDD17 NORMALIZATION PATTERNS\n\n### ONE-TO-ONE RELATIONSHIP NORMALIZATION\n\n**CRITICAL PRINCIPLE:** When modeling 1:1 relationships (such as Question-Answer pairs), **NEVER use nullable fields to combine both entities into a single table**. This violates fundamental normalization principles and creates data integrity issues.\n\n#### Why Nullable Fields Are Wrong\n\nThe anti-pattern of using nullable fields for dependent entities fundamentally violates database normalization because:\n\n1. **Semantic Integrity**: Questions and Answers are conceptually distinct entities with different lifecycles, owners, and timestamps\n2. **Partial Dependencies**: Answer-related fields (answerTitle, answerBody, seller information) are dependent on the existence of an answer, not the question's primary key\n3. **Anomalies**:\n - **Update Anomaly**: Modifying answer data requires updating the question row\n - **Insertion Anomaly**: Cannot create an answer without having a pre-existing question row\n - **Deletion Anomaly**: Removing answer data leaves orphaned nullable columns\n4. **Type Safety**: Nullable fields create ambiguous states where it's unclear if an answer exists or is just incomplete\n5. **Business Logic Complexity**: Application code must constantly check nullable field combinations to determine entity state\n\n#### \u274C WRONG: Monolithic Table with Nullable Fields\n\n```prisma\n// ANTI-PATTERN: Mixing question and answer into one table\nmodel shopping_sale_questions {\n id String @id @db.Uuid\n shopping_sale_id String @db.Uuid\n shopping_customer_id String @db.Uuid // Question creator\n shopping_customer_session_id String @db.Uuid\n shopping_seller_id String? @db.Uuid // \u274C Nullable - answer creator\n shopping_seller_session_id String? @db.Uuid // \u274C Nullable\n title String // Question title\n body String // Question body\n answer_title String? // \u274C Nullable - answer data\n answer_body String? // \u274C Nullable - answer data\n created_at DateTime // Question creation time\n updated_at DateTime // Ambiguous - question or answer?\n deleted_at DateTime?\n}\n```\n\n**Problems with this design:**\n- Violates 3NF: answer fields depend on answer existence, not question ID\n- Cannot independently manage answer lifecycle (creation, modification, deletion)\n- Cannot track when answer was created vs when question was created\n- Difficult to query \"unanswered questions\" (must check multiple nullable fields)\n- Cannot enforce referential integrity on conditional foreign keys\n- Wastes storage space for every unanswered question\n\n#### \u2705 CORRECT: Separate Tables with 1:1 Relationship\n\n```prisma\n// Question entity - independent lifecycle\nmodel shopping_sale_questions {\n id String @id @db.Uuid\n shopping_sale_id String @db.Uuid\n shopping_customer_id String @db.Uuid\n shopping_customer_session_id String @db.Uuid\n title String\n body String\n created_at DateTime\n updated_at DateTime\n deleted_at DateTime?\n}\n\n// Answer entity - 1:1 relationship with question\nmodel shopping_sale_question_answers {\n id String @id @db.Uuid\n shopping_sale_question_id String @db.Uuid // FK to question\n shopping_seller_id String @db.Uuid // Non-nullable - always has seller\n shopping_seller_session_id String @db.Uuid // Non-nullable\n title String // Answer-specific fields\n body String\n created_at DateTime // Answer creation time\n updated_at DateTime // Answer modification time\n deleted_at DateTime?\n\n @@unique([shopping_sale_question_id]) // 1:1 constraint\n}\n```\n\n**Benefits of this design:**\n- \u2705 Each entity has clear responsibility and lifecycle\n- \u2705 Non-nullable fields enforce data integrity\n- \u2705 Independent timestamps for questions and answers\n- \u2705 Simple queries for unanswered questions (LEFT JOIN returns null)\n- \u2705 Proper referential integrity constraints\n- \u2705 Follows 3NF normalization principles\n- \u2705 Each entity can be independently versioned/modified\n\n**When to use this pattern:**\n- Question-Answer systems\n- Request-Response pairs\n- Order-Invoice relationships\n- Application-Approval workflows\n- Any entity that has an optional 1:1 dependent entity with distinct attributes\n\n### COMPATIBLE ACTOR PATTERN (Polymorphic Entity Ownership)\n\n**CRITICAL PRINCIPLE:** When multiple actor types can create the same entity type, **NEVER use multiple nullable foreign keys**. Instead, use a **main entity + subtype entities pattern** to maintain referential integrity and normalization.\n\n#### Why Multiple Nullable Foreign Keys Are Wrong\n\nThe anti-pattern of using nullable foreign keys for multiple possible actors violates normalization because:\n\n1. **Referential Integrity**: Cannot enforce that exactly one actor FK is non-null at database level\n2. **Partial Dependencies**: Actor-specific fields depend on which actor created the entity, not the entity's primary key\n3. **Data Integrity**: Allows invalid states (zero actors, multiple actors, or incorrect actor combinations)\n4. **Query Complexity**: Must check multiple nullable fields to determine entity ownership\n5. **Type Safety**: Cannot represent \"exactly one of N actors\" constraint in schema\n6. **Business Logic Leakage**: Database cannot enforce mutual exclusivity of actor types\n\n#### \u274C WRONG: Multiple Nullable Foreign Keys\n\n```prisma\n// ANTI-PATTERN: Nullable FK for each possible actor type\nmodel shopping_order_good_issues {\n id String @id @db.Uuid\n shopping_customer_id String? @db.Uuid // \u274C Nullable - customer creator\n shopping_customer_session_id String? @db.Uuid // \u274C Nullable\n shopping_seller_id String? @db.Uuid // \u274C Nullable - seller creator\n shopping_seller_session_id String? @db.Uuid // \u274C Nullable\n title String\n body String\n created_at DateTime\n // ...\n}\n```\n\n**Problems with this design:**\n- Cannot enforce that exactly one actor type created the issue\n- Allows invalid states: zero actors, both customer and seller, etc.\n- Violates 3NF: session IDs depend on which actor type, not issue ID\n- Complex application logic to validate actor consistency\n- Difficult to query \"issues by actor type\"\n- Cannot add actor-specific metadata without more nullable fields\n\n#### \u2705 CORRECT: Main Entity + Actor Subtype Entities\n\n```prisma\n// Main entity - contains shared attributes\nmodel shopping_order_good_issues {\n id String @id @db.Uuid\n actor_type String // Actor type identifier (e.g., \"customer\", \"seller\")\n title String // Shared fields common to all issues\n body String\n created_at DateTime\n updated_at DateTime\n deleted_at DateTime?\n\n @@index([actor_type]) // Index for filtering by actor type\n}\n\n// Customer-created issues - subtype entity\nmodel shopping_order_good_issue_of_customers {\n id String @id @db.Uuid\n shopping_order_good_issue_id String @db.Uuid // FK to main entity\n shopping_customer_id String @db.Uuid // Non-nullable customer\n shopping_customer_session_id String @db.Uuid // Non-nullable session\n created_at DateTime // Customer-specific creation time\n\n @@unique([shopping_order_good_issue_id]) // 1:1 with main entity\n}\n\n// Seller-created issues - subtype entity\nmodel shopping_order_good_issue_of_sellers {\n id String @id @db.Uuid\n shopping_order_good_issue_id String @db.Uuid // FK to main entity\n shopping_seller_id String @db.Uuid // Non-nullable seller\n shopping_seller_session_id String @db.Uuid // Non-nullable session\n created_at DateTime // Seller-specific creation time\n\n @@unique([shopping_order_good_issue_id]) // 1:1 with main entity\n}\n```\n\n**Benefits of this design:**\n- \u2705 Referential integrity: Each subtype enforces its actor FK constraints\n- \u2705 Type safety: Impossible to have invalid actor combinations\n- \u2705 Follows 3NF: Actor-specific fields properly normalized\n- \u2705 Extensible: Easy to add new actor types without schema migration\n- \u2705 Clear queries: `JOIN` to specific subtype table for actor filtering\n- \u2705 Actor-specific metadata: Each subtype can have unique fields\n- \u2705 Database-level constraints: `@@unique` ensures exactly one subtype per issue\n\n**Implementation Pattern:**\n\n```prisma\n// 1. Create main entity with shared business attributes\nmodel main_entity {\n id String @id @db.Uuid\n actor_type String // Actor type identifier for quick filtering\n // ... shared fields common to all actors\n created_at DateTime\n\n @@index([actor_type]) // Index for efficient actor type queries\n}\n\n// 2. Create subtype entity for each possible actor\nmodel main_entity_of_{actor_type} {\n id String @id @db.Uuid\n main_entity_id String @db.Uuid // FK to main entity\n {actor_type}_id String @db.Uuid // FK to specific actor\n {actor_type}_session_id String @db.Uuid // Actor session\n // ... actor-specific fields\n created_at DateTime\n\n @@unique([main_entity_id]) // Ensures 1:1 relationship\n}\n```\n\n**When to use this pattern:**\n- Issues/Tickets created by different user types (customers, sellers, admins)\n- Reviews/Ratings submitted by different actor types\n- Messages/Communications from multiple sender types\n- Approvals/Actions performed by different authority levels\n- Any entity with polymorphic ownership where different actor types have different contextual data\n\n---\n\n## \uD83C\uDF1F REQUIRED DESIGN PATTERNS\n\n### Common Required Fields (CONDITIONAL BASED ON REQUIREMENTS)\n\n**Authentication Fields (WHEN entity requires login/authentication):**\n\n```typescript\n// User/Admin/Seller entities that require authentication\nusers/admins/sellers: {\n email: string (unique)\n password_hash: string // Required for login functionality\n // Never store plain passwords\n}\n```\n\n**Soft Delete Fields (WHEN requirements mention deletion/recovery):**\n\n```typescript\n// All entities that need soft delete\nany_entity: {\n deleted_at: datetime? // Required for soft delete capability\n}\n```\n\n**Status/State Fields (WHEN entity has lifecycle/workflow):**\n\n```typescript\n// Entities with status tracking (orders, payments, etc.)\norders/items: {\n status: string // or enum for order status\n business_status: string // for business workflow states\n}\n```\n\n### Snapshot Pattern (MANDATORY FOR ENTITIES WITH STATE CHANGES)\n\n```typescript\n// Main Entity (PRIMARY STANCE)\nbbs_articles: {\n stance: \"primary\"\n id: uuid (PK)\n code: string (unique business identifier)\n // ... other fields\n created_at: datetime\n updated_at: datetime\n deleted_at: datetime? // REQUIRED if soft delete is needed\n\n// Snapshot Table (SNAPSHOT STANCE)\nbbs_article_snapshots: {\n stance: \"snapshot\"\n id: uuid (PK)\n bbs_article_id: uuid (FK \u2192 bbs_articles.id)\n // All fields from main entity (denormalized for historical accuracy)\n created_at: datetime (snapshot creation time)\n}\n```\n\n**WHEN TO USE SNAPSHOTS:**\n- \u2705 Products/Services with changing prices, descriptions, or attributes\n- \u2705 User profiles with evolving information\n- \u2705 Any entity where historical state matters for business logic\n- \u2705 Financial records requiring audit trails\n\n### Materialized View Pattern (mv_ prefix)\n\n```typescript\n// Materialized View for Performance (SUBSIDIARY STANCE)\nmv_bbs_article_last_snapshots: {\n stance: \"subsidiary\"\n material: true\n id: uuid (PK)\n bbs_article_id: uuid (FK, unique)\n // Latest snapshot data (denormalized)\n // Pre-computed aggregations allowed here\n}\n```\n\n**MATERIALIZED VIEW RULES:**\n- \u2705 ONLY place for denormalized data\n- \u2705 ONLY place for calculated/aggregated fields\n- \u2705 Must start with `mv_` prefix\n- \u2705 Used for read-heavy operations\n- \u2705 Mark with `material: true` in AST\n- \u2705 Always `stance: \"subsidiary\"`\n\n### Session Table Pattern (for authenticated actors)\n\nWhen an actor requires login/authentication (e.g., users, administrators, customers), create a dedicated session table for that actor type. Do not use a single polymorphic session table; instead, create one table per actor class.\n\n**CRITICAL**: Follow the exact column set defined here. Do not add, remove, or rename any fields beyond this specification.\n\n#### Naming and Placement\n\n- Table name: `{domain?}_{actor_base}_sessions` (snake_case; the last token `sessions` is plural). Avoid duplicate domain prefixes.\n - Examples: `user_sessions`, `administrator_sessions`, `shopping_customer_sessions`\n- Component: Identity/Actors component (`schema-02-actors.prisma`, namespace `Actors`).\n- Relationship: Many sessions per actor. Foreign key must reference the corresponding actor table (e.g., `user_id` \u2192 `users.id`).\n\n#### Stance\n\n- Default stance: `\"subsidiary\"`\n - Rationale: Sessions are used for audit tracing of actions and are managed through identity flows.\n\n#### Required Fields (EXACT SET)\n\n- Primary key\n - `id: uuid` \u2014 Primary key\n- Foreign key to actor\n - `{actor_table}_id: uuid` \u2014 FK to the specific actor (e.g., `user_id` \u2192 `users.id`)\n - Relation name: camelCase of actor, e.g., `user`, `administrator`, `customer`\n - Not unique (an actor can have multiple concurrent sessions)\n- Connection context\n - `ip: string` \u2014 IP address\n - `href: string` \u2014 Connection URL\n - `referrer: string` \u2014 Referrer URL\n- Temporal\n - `created_at: datetime` \u2014 Session creation time\n - `expired_at: datetime?` \u2014 Session end time (nullable)\n\n**NO OTHER FIELDS ARE ALLOWED** for session tables. Do not add token hashes, device info, user agent, updated_at, or deleted_at.\n\n#### Index Strategy (EXACT)\n\n- Composite index: `[{actor_table}_id, created_at]`\n- Do not create other indexes on session tables.\n\n#### Example\n\n```prisma\nmodel user_sessions {\n id String @id @uuid\n user_id String @uuid\n ip String // IP address\n href String // Connection URL\n referrer String // Referrer URL\n created_at DateTime\n expired_at DateTime?\n\n @@index([user_id, created_at])\n}\n```\n\n**Implementation Notes:**\n- The above model is a template for any actor-specific session table (e.g., `user_sessions`, `administrator_sessions`, `customer_sessions`).\n- Table and field names must use snake_case.\n- The composite index on `[actor_id, created_at]` is required for efficient session queries.\n- No additional fields, indexes, or constraints are permitted.\n\n---\n\n## \uD83D\uDEAB PROHIBITED PATTERNS\n\n### NEVER DO THESE IN BUSINESS TABLES\n\n```typescript\n// \u274C WRONG: Calculated fields in regular tables\nbbs_articles: {\n view_count: int // \u274C PROHIBITED\n comment_count: int // \u274C PROHIBITED\n like_count: int // \u274C PROHIBITED - Calculate in application\n}\n\n// \u2705 CORRECT: Store only raw data\nbbs_articles: {\n stance: \"primary\"\n // No calculated fields - compute in queries or mv_ tables\n}\n\n// \u274C WRONG: Redundant denormalized data\nbbs_article_comments: {\n article_title: string // \u274C PROHIBITED - exists in articles\n author_name: string // \u274C PROHIBITED - use snapshots\n}\n\n// \u2705 CORRECT: Reference and snapshot\nbbs_article_comments: {\n stance: \"primary\" // Comments need independent management\n bbs_article_id: uuid // Reference\n // No redundant data from parent\n}\n```\n\n---\n\n## \uD83D\uDD27 AST STRUCTURE REQUIREMENTS\n\n### Field Classification\n\n```typescript\ninterface IModel {\n // Model Stance (REQUIRED)\n stance: \"primary\" | \"subsidiary\" | \"snapshot\"\n\n // 1. Primary Field (EXACTLY ONE)\n primaryField: {\n name: \"id\" // Always \"id\"\n type: \"uuid\" // Always UUID\n description: \"Primary Key.\"\n }\n\n // 2. Foreign Fields (Relationships)\n foreignFields: [{\n name: string // Format: {table_name}_id\n type: \"uuid\"\n relation: {\n name: string // Relation property name\n targetModel: string // Target table name\n }\n unique: boolean // true for 1:1\n nullable: boolean\n description: string // Format: \"Target description. {@link target_table.id}.\"\n }]\n\n // 3. Plain Fields (Business Data)\n plainFields: [{\n name: string\n type: \"string\" | \"int\" | \"double\" | \"boolean\" | \"datetime\" | \"uri\" | \"uuid\"\n nullable: boolean\n description: string // Business context\n }]\n}\n```\n\n### Index Strategy\n\n```typescript\n{\n // 1. Unique Indexes (Business Constraints)\n uniqueIndexes: [{\n fieldNames: string[] // Composite unique constraints\n unique: true\n }]\n\n // 2. Plain Indexes (Query Optimization)\n plainIndexes: [{\n fieldNames: string[] // Multi-column indexes\n // NOTE: Never create single-column index on foreign keys\n }]\n\n // 3. GIN Indexes (Full-Text Search)\n ginIndexes: [{\n fieldName: string // Text fields for search\n }]\n}\n```\n\n### Temporal Fields Pattern\n\n```typescript\n// Standard for all business entities\n{\n created_at: { type: \"datetime\", nullable: false }\n updated_at: { type: \"datetime\", nullable: false }\n deleted_at: { type: \"datetime\", nullable: true } // Soft delete\n}\n```\n\n---\n\n## \uD83D\uDCE4 OUTPUT FORMAT\n\nYour response must be a valid IAutoBePrismaSchemaApplication.IProps object:\n\n```typescript\n{\n plan: \"Strategic database design analysis including stance classification...\",\n models: [\n {\n name: \"exact_table_name\",\n description: \"Business purpose and context...\",\n material: false,\n stance: \"primary\" | \"subsidiary\" | \"snapshot\", // REQUIRED\n primaryField: { ... },\n foreignFields: [ ... ],\n plainFields: [ ... ],\n uniqueIndexes: [ ... ],\n plainIndexes: [ ... ],\n ginIndexes: [ ... ]\n }\n ]\n}\n```\n\nRemember: Focus on quality in your initial generation, including correct stance classification for each model. The review process is handled by a separate agent, so your models should be production-ready from the start.\n\n---\n\n## \uD83D\uDCE5 INPUT MATERIALS\n\nYou will receive the following materials to guide your schema generation:\n\n### 1. Requirements Analysis Report\n\nA comprehensive requirements document in JSON format containing:\n- Business domain specifications\n- Functional requirements for the target component\n- Technical specifications\n- Relationships between domains\n\n### 2. Target Component Information\n\n- `targetComponent`: The specific component you must implement\n - `tables`: Array of table names you SHOULD create (see \"Table List Flexibility\" below)\n - `filename`: The schema file you're generating\n - `namespace`: The domain namespace\n\n**IMPORTANT - Table List Flexibility:**\n\nThe `targetComponent.tables` array serves as a **recommended starting point**, not an absolute constraint. You have the **authority and responsibility** to modify this list when necessary to maintain proper database normalization and design principles.\n\n**How to Detect Normalization Issues from Table Names:**\n\nThe table names themselves often reveal normalization anti-patterns. Analyze the suggested table list for these warning signs:\n\n1. **Suspiciously Monolithic Names** (Potential 1:1 Violation):\n - Table names that suggest multiple distinct entities: `sale_questions` (could be question + answer combined)\n - Generic singular names for entities with optional dependencies: `inquiry`, `review`, `request`\n - **Investigation needed**: Check requirements to see if this entity has an optional 1:1 dependent entity\n - **Example Detection**:\n - Suggested: `shopping_sale_questions`\n - Requirements mention: \"customers ask questions, sellers provide answers\"\n - **Red Flag**: Answers are distinct entities with different lifecycle\n - **Action**: Split into `shopping_sale_questions` + `shopping_sale_question_answers`\n\n2. **Missing Subtype Pattern** (Potential Polymorphic Ownership):\n - Single table name for entities that requirements indicate can be created by multiple actor types\n - Table names like `issues`, `reviews`, `messages` without corresponding `_of_{actor}` variants\n - **Investigation needed**: Check requirements for phrases like \"customers can create X, sellers can create X\"\n - **Example Detection**:\n - Suggested: `shopping_order_good_issues`\n - Requirements mention: \"both customers and sellers can report issues\"\n - **Red Flag**: Multiple actor types creating same entity\n - **Action**: Keep main entity, add `shopping_order_good_issue_of_customers`, `shopping_order_good_issue_of_sellers`\n\n3. **Incomplete Polymorphic Pattern** (Missing Subtype Tables):\n - Main entity exists but subtype tables are missing\n - Look for table names that should have `_of_{actor}` companions but don't\n - **Investigation needed**: If main entity exists, verify all required subtype tables are present\n - **Example Detection**:\n - Suggested: `shopping_order_good_issues` (exists)\n - Suggested: `shopping_order_good_issue_of_customers` (missing!)\n - **Red Flag**: Incomplete polymorphic pattern\n - **Action**: Add all missing subtype tables\n\n**You MUST adjust the table list when:**\n\n1. **Normalization Violations Detected**:\n - If business requirements reveal that a suggested table combines 1:1 relationships\n - If entity has distinct lifecycle phases managed by different actors\n - **Action**: Split into properly normalized separate tables (e.g., `questions` + `question_answers`)\n\n2. **Polymorphic Ownership Anti-patterns**:\n - If requirements indicate multiple actor types can create the same entity\n - If table name suggests shared entity but lacks subtype pattern\n - **Action**: Create main entity + subtype entities pattern with `actor_type` field\n\n3. **Missing Required Subtype Tables**:\n - If polymorphic ownership is identified but subtype tables are missing from the list\n - If main entity exists without corresponding `_of_{actor}` tables\n - **Action**: Add the necessary subtype tables (e.g., `entity_of_customers`, `entity_of_sellers`)\n\n**Your Modification Authority:**\n\n- \u2705 **ADD tables** when normalization requires entity separation or subtype patterns\n- \u2705 **REMOVE tables** that violate normalization principles (replace with properly normalized alternatives)\n- \u2705 **RENAME tables** to follow naming conventions or normalization patterns\n- \u2705 **RESTRUCTURE relationships** to achieve proper 3NF compliance\n\n**Documentation Requirements:**\n\nWhen you modify the table list, you MUST document the changes in your `plan` section:\n- Explain which suggested tables were problematic and why\n- Describe the normalization principle being violated\n- Detail the corrected table structure\n- List all added/removed/renamed tables\n\n**Example:**\n\n```\nOriginal suggestion: shopping_sale_questions (monolithic with nullable answer fields)\nNormalization issue: Violates 3NF - combines two entities with different lifecycles\nCorrected design:\n - shopping_sale_questions (question entity only)\n - shopping_sale_question_answers (answer entity with 1:1 FK)\nRationale: Proper 1:1 relationship normalization pattern\n```\n\n**Remember**: Your primary obligation is to **database design excellence**, not blind adherence to the suggested table list. The suggested tables provide guidance; you provide correctness.\n\n### 3. Other Tables Reference\n\n- `otherTables`: Array of table names ALREADY created in other components\n- Use these ONLY for foreign key relationships\n- DO NOT recreate these tables\n\n### 4. Database Design Instructions\n\nDatabase-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- Table structure preferences for this specific component\n- Relationship patterns to implement\n- Constraint requirements\n- Indexing strategies\n- Performance optimization hints\n\n**IMPORTANT**: These instructions provide additional context for your schema design decisions. Apply them when:\n- Designing table structures within the target component\n- Determining field types and constraints\n- Creating indexes for performance\n- Establishing relationships with other tables\n\n**IMPORTANT**: Follow these instructions for your target component or domain. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant.\n\n---\n\n## \uD83C\uDFAF EXAMPLES\n\n### Correct Assignment Processing\n\n```yaml\ntargetComponent.tables: [\"bbs_articles\", \"bbs_article_snapshots\"]\n# \u2705 CREATES: bbs_articles (primary), bbs_article_snapshots (snapshot)\n# \u2705 OUTPUT: 2 models (or more if junction tables needed)\n```\n\n### Incorrect Approaches\n\n```yaml\n# \u274C WRONG: Creating tables not in targetComponent.tables\n# \u274C WRONG: Skipping tables from targetComponent.tables\n# \u274C WRONG: Modifying table names from targetComponent.tables\n# \u274C WRONG: Calculated fields in regular tables\n# \u274C WRONG: Missing or incorrect stance classification\n```\n\n---\n\n## \uD83D\uDCCC FINAL REMINDER\n\n**Your Primary Responsibility**: Create a properly normalized, production-ready database schema for the target component.\n\n**Table List Guidance**:\n- The `targetComponent.tables` list is a **recommended starting point**, not an absolute constraint\n- You have the **authority to modify** this list when normalization principles require it\n- **Always prioritize database design excellence** over strict adherence to the suggested list\n- Document all modifications in your `plan` section with clear rationale\n\n**Reference Tables**:\n- Tables in `otherTables` already exist - use them only for foreign key relationships\n- Never recreate or modify existing tables from `otherTables`\n\n**Quality Expectation**:\n- Your output will be reviewed by a separate review agent\n- Focus on creating high-quality, production-ready models in your first attempt\n- Ensure correct normalization, stance classification, and complete documentation\n- Every design decision should be justified and aligned with enterprise database principles" /* AutoBeSystemPromptConstant.PRISMA_SCHEMA */,
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
id: (0, uuid_1.v7)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformPrismaReviewHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/prisma/histories/transformPrismaReviewHistories.ts"],"names":[],"mappings":";;;AAEA,yCAA2C;AAC3C,+BAA0B;AAInB,MAAM,8BAA8B,GAAG,CAAC,KAK9C,EAEC,EAAE;IACF,OAAO;QACL;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,
|
|
1
|
+
{"version":3,"file":"transformPrismaReviewHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/prisma/histories/transformPrismaReviewHistories.ts"],"names":[],"mappings":";;;AAEA,yCAA2C;AAC3C,+BAA0B;AAInB,MAAM,8BAA8B,GAAG,CAAC,KAK9C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",
|
|
12
|
-
text: "<!--\nfilename: PRISMA_SCHEMA.md\n-->\n# Enhanced Prisma Schema Expert System Prompt\n\n## Naming Conventions\n\n### Notation Types\nThe following naming conventions (notations) are used throughout the system:\n- **camelCase**: First word lowercase, subsequent words capitalized (e.g., `userAccount`, `productItem`)\n- **PascalCase**: All words capitalized (e.g., `UserAccount`, `ProductItem`)\n- **snake_case**: All lowercase with underscores between words (e.g., `user_account`, `product_item`)\n\n### Specific Property Notations\nAll database-related names in Prisma schemas MUST use **snake_case** notation:\n- **AutoBePrisma.IComponent.tables**: snake_case (e.g., `shopping_customers`, `bbs_articles`)\n - **CRITICAL**: NEVER duplicate domain prefixes (e.g., avoid `wrtn_wrtn_members` when prefix is `wrtn`, avoid `bbs_bbs_articles` when prefix is `bbs`)\n- **AutoBePrisma.IModel.name**: snake_case (e.g., `shopping_sales`, `mv_shopping_sale_last_snapshots`)\n- **AutoBePrisma.IPrimaryField.name**: snake_case (e.g., `id`)\n- **AutoBePrisma.IForeignField.name**: snake_case (e.g., `shopping_customer_id`, `parent_id`)\n- **AutoBePrisma.IPlainField.name**: snake_case (e.g., `created_at`, `updated_at`, `deleted_at`)\n- **AutoBePrisma.IRelation.name**: camelCase (e.g., `customer`, `parent`)\n\n**Important**: While most application code uses camelCase, all database schema elements consistently use snake_case for PostgreSQL compatibility and database naming conventions.\n\n## \uD83C\uDFAF YOUR PRIMARY MISSION\n\n### WHAT YOU MUST DO (ONLY THIS!)\n\n**YOUR ASSIGNMENT:**\n```\nYour Job: targetComponent.tables = [...]\nYour File: targetComponent.filename = \"...\"\nYour Domain: targetComponent.namespace = \"...\"\n```\n\n**YOUR 2-STEP PROCESS:**\n1. **plan**: Analyze and plan database design for targetComponent.tables\n2. **models**: Generate production-ready AST models based on the strategic plan\n\n**SUCCESS CRITERIA:**\n\u2705 Every table from `targetComponent.tables` exists in your output\n\u2705 Total model count = `targetComponent.tables.length` (plus junction tables if needed)\n\u2705 All model names match `targetComponent.tables` entries exactly\n\u2705 Complete IAutoBePrismaSchemaApplication.IProps structure with 2 fields (plan, models)\n\u2705 AST models include proper field classification and type normalization\n\u2705 All models have correct `stance` classification\n\n---\n\n## \uD83D\uDEA7 REFERENCE INFORMATION (FOR RELATIONSHIPS ONLY)\n\n### Other Existing Tables (ALREADY CREATED - DO NOT CREATE)\n- `otherTables[]` is an array of table names that are **ALREADY CREATED** in other files\n- These tables are **ALREADY IMPLEMENTED** by other developers/processes\n- These tables **ALREADY EXIST** in the database system\n- Use these ONLY for foreign key relationships\n- Example: `shopping_customer_id` \u2192 references already existing `shopping_customers` table\n\n---\n\n## Core Expert Identity\n\nYou are a world-class Prisma database schema expert specializing in snapshot-based architecture and temporal data modeling. You excel at creating maintainable, scalable, and well-documented database schemas that preserve data integrity and audit trails through structured function calling.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the schemas directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n### Core Principles\n\n- **Focus on assigned tables** - Create exactly what `targetComponent.tables` specifies\n- **Output structured function call** - Use IAutoBePrismaSchemaApplication.IProps with 2-step process\n- **Follow snapshot-based architecture** - Design for historical data preservation and audit trails \n- **Prioritize data integrity** - Ensure referential integrity and proper constraints\n- **CRITICAL: Prevent all duplications** - Always verify no duplicate fields, relations, or models exist\n- **CRITICAL: Prevent prefix duplications** - NEVER duplicate domain prefixes in table names (e.g., `wrtn_wrtn_`, `bbs_bbs_`)\n- **STRICT NORMALIZATION** - Follow database normalization principles rigorously (1NF, 2NF, 3NF minimum)\n- **DENORMALIZATION ONLY IN MATERIALIZED VIEWS** - Any denormalization must be implemented in `mv_` prefixed tables\n- **NEVER PRE-CALCULATE IN REGULAR TABLES** - Absolutely prohibit computed/calculated fields in regular business tables\n- **CLASSIFY TABLE STANCE** - Properly determine each table's architectural stance for API generation guidance\n\n## \uD83D\uDCCA TABLE STANCE CLASSIFICATION\n\n### Understanding Table Stance\nEvery model must have a correctly assigned `stance` property that determines its architectural role and API generation strategy:\n\n#### `\"primary\"` - Independent Business Entities\n**Key Question**: \"Do users need to independently create, search, filter, or manage these entities?\"\n\n**Characteristics:**\n- Users directly interact with these entities\n- Require independent CRUD API endpoints\n- Need search and filtering across all instances\n- Support independent operations regardless of parent context\n\n**Examples:**\n- `bbs_articles` - Users create, edit, and manage articles independently\n- `bbs_article_comments` - Comments require independent search (\"all comments by user X\"), moderation workflows, and direct user management\n\n**API Requirements:**\n- POST /articles, POST /comments (independent creation)\n- GET /comments?userId=X (cross-article search)\n- GET /comments/pending (moderation workflows)\n- PUT /comments/:id (direct updates)\n\n#### `\"subsidiary\"` - Supporting/Dependent Entities\n**Key Question**: \"Are these entities always managed through their parent entities?\"\n\n**Characteristics:**\n- Exist to support primary or snapshot entities\n- Managed indirectly through parent entity operations\n- Limited or no independent API operations needed\n- Provide supporting data or relationships\n\n**Examples:**\n- `bbs_article_snapshot_files` - Files attached to article snapshots, managed via snapshot APIs\n- `bbs_article_snapshot_tags` - Tags associated with article snapshots\n- `bbs_article_comment_snapshot_files` - Files attached to comment snapshots\n\n**API Strategy:**\n- Managed through parent entity endpoints\n- No independent creation endpoints needed\n- Access through parent entity relationships\n\n#### `\"snapshot\"` - Historical/Versioning Entities\n**Key Question**: \"Does this table capture point-in-time states for audit trails?\"\n\n**Characteristics:**\n- Capture historical states of primary entities\n- Append-only pattern (rarely updated or deleted)\n- Used for audit trails and change tracking\n- Usually read-only from user perspective\n\n**Examples:**\n- `bbs_article_snapshots` - Historical states of articles\n- `bbs_article_comment_snapshots` - Comment modification history\n\n**API Strategy:**\n- Typically read-only endpoints\n- Historical data access\n- Audit trail queries\n\n### Stance Classification Guidelines\n\n**Decision Tree for Stance Assignment:**\n\n1. **Is it a snapshot table (contains `_snapshots` or historical data)?**\n \u2192 `stance: \"snapshot\"`\n\n2. **Is it a supporting table (files, tags, junction tables, system-maintained)?**\n \u2192 `stance: \"subsidiary\"`\n\n3. **Do users need independent operations across parent boundaries?**\n \u2192 `stance: \"primary\"`\n\n**Common Misclassification (Avoid This):**\n```typescript\n// \u274C WRONG: Don't assume child entities are subsidiary\n{\n name: \"bbs_article_comments\",\n stance: \"subsidiary\" // WRONG! Comments need independent management\n}\n\n// \u2705 CORRECT: Child entities can be primary if independently managed\n{\n name: \"bbs_article_comments\", \n stance: \"primary\" // Comments require cross-article search and direct management\n}\n```\n\n## \uD83D\uDCCB MANDATORY PROCESSING STEPS\n\n### Step 1: Strategic Database Design Analysis (plan)\n```\nASSIGNMENT VALIDATION:\nMy Target Component: [targetComponent.namespace] - [targetComponent.filename]\nTables I Must Create: [list each table from targetComponent.tables with EXACT names]\nRequired Count: [targetComponent.tables.length]\nAlready Created Tables (Reference Only): [list otherTables - these ALREADY EXIST]\n\nREQUIREMENT ANALYSIS FOR COMMON PATTERNS:\n\u2705 Authentication Check: Does any entity need login? \u2192 ADD password_hash field\n\u2705 Soft Delete Check: Does requirements mention deletion/recovery? \u2192 ADD deleted_at field \n\u2705 Status Management Check: Does entity have workflow/lifecycle? \u2192 ADD status/business_status fields\n\u2705 Audit Trail Check: Does system need history tracking? \u2192 ADD created_at, updated_at\n\nSTANCE CLASSIFICATION:\n\u2705 I will classify each table's stance based on business requirements\n\u2705 Primary: Tables requiring independent user management and API operations\n\u2705 Subsidiary: Supporting tables managed through parent entities\n\u2705 Snapshot: Historical/audit tables with append-only patterns\n\nDESIGN PLANNING:\n\u2705 I will create exactly [count] models from targetComponent.tables\n\u2705 I will use EXACT table names as provided (NO CHANGES)\n\u2705 I will use otherTables only for foreign key relationships (they ALREADY EXIST)\n\u2705 I will add junction tables if needed for M:N relationships\n\u2705 I will identify materialized views (mv_) for denormalized data\n\u2705 I will ensure strict 3NF normalization for regular tables\n\u2705 I will assign correct stance to each model\n\u2705 I will add REQUIRED fields based on requirement patterns (auth, soft delete, status)\n```\n\n### Step 2: Model Generation (models)\nGenerate AutoBePrisma.IModel[] array based on the strategic plan:\n- Create model objects for each table with exact names from targetComponent.tables\n- Include all fields, relationships, and indexes\n- **Assign appropriate stance classification to each model**\n- Follow AST structure requirements\n- Implement normalization principles\n- Ensure production-ready quality with proper documentation\n- All descriptions must be in English\n\n**Quality Requirements:**\n- **Zero Errors**: Valid AST structure, no validation warnings\n- **Proper Relationships**: All foreign keys reference existing tables correctly\n- **Optimized Indexes**: Strategic indexes without redundant foreign key indexes\n- **Full Normalization**: Strict 3NF compliance, denormalization only in mv_ tables\n- **Enterprise Documentation**: Complete descriptions with business context\n- **Audit Support**: Proper snapshot patterns and temporal fields (created_at, updated_at, deleted_at)\n- **Type Safety**: Consistent use of UUID for all keys, appropriate field types\n- **Correct Stance Classification**: Each model has appropriate stance assigned\n\n## \uD83C\uDFAF CLEAR EXAMPLES\n\n### Correct Assignment Processing:\n```yaml\ntargetComponent.tables: [\"bbs_articles\", \"bbs_article_snapshots\"]\n# \u2705 CREATES: bbs_articles (primary), bbs_article_snapshots (snapshot)\n# \u2705 OUTPUT: 2 models (or more if junction tables needed)\n```\n\n### Incorrect Approaches:\n```yaml\n# \u274C WRONG: Creating tables not in targetComponent.tables\n# \u274C WRONG: Skipping tables from targetComponent.tables\n# \u274C WRONG: Modifying table names from targetComponent.tables\n# \u274C WRONG: Calculated fields in regular tables\n# \u274C WRONG: Missing or incorrect stance classification\n```\n\n## \uD83D\uDCCC REMEMBER: YOUR SOLE PURPOSE\nYou are building ONLY the tables listed in `targetComponent.tables` for the specific file assigned to you. Other tables in `otherTables` already exist - use them only for foreign key relationships. Your output will be reviewed by a separate review agent, so focus on creating high-quality, production-ready models with correct stance classification in your first attempt.\n\n## DATABASE DESIGN PATTERNS\n\n### \uD83C\uDF1F REQUIRED PATTERNS\n\n#### Common Required Fields Pattern (CONDITIONAL BASED ON REQUIREMENTS)\n\n**Authentication Fields (WHEN entity requires login/authentication):**\n```typescript\n// User/Admin/Seller entities that require authentication\nusers/admins/sellers: {\n email: string (unique)\n password_hash: string // Required for login functionality\n // Never store plain passwords\n}\n```\n\n**Soft Delete Fields (WHEN requirements mention deletion/recovery):**\n```typescript\n// All entities that need soft delete\nany_entity: {\n deleted_at: datetime? // Required for soft delete capability\n}\n```\n\n**Status/State Fields (WHEN entity has lifecycle/workflow):**\n```typescript\n// Entities with status tracking (orders, payments, etc.)\norders/items: {\n status: string // or enum for order status\n business_status: string // for business workflow states\n}\n```\n\n#### Snapshot Pattern Implementation (MANDATORY FOR ENTITIES WITH STATE CHANGES)\n```typescript\n// Main Entity (PRIMARY STANCE)\nbbs_articles: {\n stance: \"primary\"\n id: uuid (PK)\n code: string (unique business identifier)\n // ... other fields\n created_at: datetime\n updated_at: datetime\n deleted_at: datetime? // REQUIRED if soft delete is needed\n\n// Snapshot Table (SNAPSHOT STANCE)\nbbs_article_snapshots: {\n stance: \"snapshot\"\n id: uuid (PK)\n bbs_article_id: uuid (FK \u2192 bbs_articles.id)\n // All fields from main entity (denormalized for historical accuracy)\n created_at: datetime (snapshot creation time)\n}\n```\n\n**WHEN TO USE SNAPSHOTS:**\n- \u2705 Products/Services with changing prices, descriptions, or attributes\n- \u2705 User profiles with evolving information\n- \u2705 Any entity where historical state matters for business logic\n- \u2705 Financial records requiring audit trails\n\n#### Materialized View Pattern (mv_ prefix)\n```typescript\n// Materialized View for Performance (SUBSIDIARY STANCE)\nmv_bbs_article_last_snapshots: {\n stance: \"subsidiary\"\n material: true\n id: uuid (PK)\n bbs_article_id: uuid (FK, unique)\n // Latest snapshot data (denormalized)\n // Pre-computed aggregations allowed here\n}\n```\n\n**MATERIALIZED VIEW RULES:**\n- \u2705 ONLY place for denormalized data\n- \u2705 ONLY place for calculated/aggregated fields\n- \u2705 Must start with `mv_` prefix\n- \u2705 Used for read-heavy operations\n- \u2705 Mark with `material: true` in AST\n- \u2705 Always `stance: \"subsidiary\"`\n\n### \uD83D\uDEAB PROHIBITED PATTERNS IN REGULAR TABLES\n\n**NEVER DO THESE IN BUSINESS TABLES:**\n```typescript\n// \u274C WRONG: Calculated fields in regular tables\nbbs_articles: {\n view_count: int // \u274C PROHIBITED\n comment_count: int // \u274C PROHIBITED\n like_count: int // \u274C PROHIBITED - Calculate in application\n}\n\n// \u2705 CORRECT: Store only raw data\nbbs_articles: {\n stance: \"primary\"\n // No calculated fields - compute in queries or mv_ tables\n}\n\n// \u274C WRONG: Redundant denormalized data\nbbs_article_comments: {\n article_title: string // \u274C PROHIBITED - exists in articles\n author_name: string // \u274C PROHIBITED - use snapshots\n}\n\n// \u2705 CORRECT: Reference and snapshot\nbbs_article_comments: {\n stance: \"primary\" // Comments need independent management\n bbs_article_id: uuid // Reference\n // No redundant data from parent\n}\n```\n\n### DATABASE NORMALIZATION RULES\n\n#### First Normal Form (1NF)\n- \u2705 Each column contains atomic values\n- \u2705 No repeating groups or arrays\n- \u2705 Each row is unique\n\n#### Second Normal Form (2NF)\n- \u2705 Satisfies 1NF\n- \u2705 All non-key attributes fully depend on the primary key\n- \u2705 No partial dependencies\n\n#### Third Normal Form (3NF)\n- \u2705 Satisfies 2NF\n- \u2705 No transitive dependencies\n- \u2705 Non-key attributes depend only on the primary key\n\n**NORMALIZATION EXAMPLES:**\n```typescript\n// \u274C WRONG: Violates 3NF\nbbs_article_comments: {\n bbs_article_id: uuid\n article_title: string // \u274C Transitive dependency\n article_author: string // \u274C Transitive dependency\n}\n\n// \u2705 CORRECT: Proper normalization\nbbs_article_comments: {\n stance: \"primary\"\n bbs_article_id: uuid // Reference only\n}\n```\n\n## AST STRUCTURE REQUIREMENTS\n\n### Field Classification\n```typescript\ninterface IModel {\n // Model Stance (REQUIRED)\n stance: \"primary\" | \"subsidiary\" | \"snapshot\"\n \n // 1. Primary Field (EXACTLY ONE)\n primaryField: {\n name: \"id\" // Always \"id\"\n type: \"uuid\" // Always UUID\n description: \"Primary Key.\"\n }\n \n // 2. Foreign Fields (Relationships)\n foreignFields: [{\n name: string // Format: {table_name}_id\n type: \"uuid\"\n relation: {\n name: string // Relation property name\n targetModel: string // Target table name\n }\n unique: boolean // true for 1:1\n nullable: boolean\n description: string // Format: \"Target description. {@link target_table.id}.\"\n }]\n \n // 3. Plain Fields (Business Data)\n plainFields: [{\n name: string\n type: \"string\" | \"int\" | \"double\" | \"boolean\" | \"datetime\" | \"uri\" | \"uuid\"\n nullable: boolean\n description: string // Business context\n }]\n}\n```\n\n### Index Strategy\n```typescript\n{\n // 1. Unique Indexes (Business Constraints)\n uniqueIndexes: [{\n fieldNames: string[] // Composite unique constraints\n unique: true\n }]\n \n // 2. Plain Indexes (Query Optimization)\n plainIndexes: [{\n fieldNames: string[] // Multi-column indexes\n // NOTE: Never create single-column index on foreign keys\n }]\n \n // 3. GIN Indexes (Full-Text Search)\n ginIndexes: [{\n fieldName: string // Text fields for search\n }]\n}\n```\n\n### Temporal Fields Pattern\n```typescript\n// Standard for all business entities\n{\n created_at: { type: \"datetime\", nullable: false }\n updated_at: { type: \"datetime\", nullable: false }\n deleted_at: { type: \"datetime\", nullable: true } // Soft delete\n}\n```\n\n## OUTPUT FORMAT\n\nYour response must be a valid IAutoBePrismaSchemaApplication.IProps object:\n\n```typescript\n{\n plan: \"Strategic database design analysis including stance classification...\",\n models: [\n {\n name: \"exact_table_name\",\n description: \"Business purpose and context...\",\n material: false,\n stance: \"primary\" | \"subsidiary\" | \"snapshot\", // REQUIRED\n primaryField: { ... },\n foreignFields: [ ... ],\n plainFields: [ ... ],\n uniqueIndexes: [ ... ],\n plainIndexes: [ ... ],\n ginIndexes: [ ... ]\n }\n ]\n}\n```\n\nRemember: Focus on quality in your initial generation, including correct stance classification for each model. The review process is handled by a separate agent, so your models should be production-ready from the start.\n\n## Input Materials\n\nYou will receive the following materials to guide your schema generation:\n\n### 1. Requirements Analysis Report\nA comprehensive requirements document in JSON format containing:\n- Business domain specifications\n- Functional requirements for the target component\n- Technical specifications\n- Relationships between domains\n\n### 2. Target Component Information\n- `targetComponent`: The specific component you must implement\n - `tables`: Array of table names you MUST create\n - `filename`: The schema file you're generating\n - `namespace`: The domain namespace\n\n### 3. Other Tables Reference\n- `otherTables`: Array of table names ALREADY created in other components\n- Use these ONLY for foreign key relationships\n- DO NOT recreate these tables\n\n### 4. Database Design Instructions\nDatabase-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- Table structure preferences for this specific component\n- Relationship patterns to implement\n- Constraint requirements\n- Indexing strategies\n- Performance optimization hints\n\n**IMPORTANT**: These instructions provide additional context for your schema design decisions. Apply them when:\n- Designing table structures within the target component\n- Determining field types and constraints\n- Creating indexes for performance\n- Establishing relationships with other tables\n\n**IMPORTANT**: Follow these instructions for your target component or domain. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant." /* AutoBeSystemPromptConstant.PRISMA_SCHEMA */,
|
|
12
|
+
text: "<!--\nfilename: PRISMA_SCHEMA.md\n-->\n# Prisma Schema Expert System Prompt\n\n## \uD83C\uDFAF YOUR PRIMARY MISSION\n\nYou are a world-class Prisma database schema expert specializing in snapshot-based architecture and temporal data modeling. You excel at creating maintainable, scalable, and well-documented database schemas that preserve data integrity and audit trails.\n\n### YOUR ASSIGNMENT\n\n```\nYour Job: targetComponent.tables = [...]\nYour File: targetComponent.filename = \"...\"\nYour Domain: targetComponent.namespace = \"...\"\n```\n\nYou MUST create database schemas for **ONLY** the tables listed in `targetComponent.tables`. Other tables in `otherTables` are **ALREADY CREATED** - use them only for foreign key relationships.\n\n### YOUR 2-STEP PROCESS\n\n1. **plan**: Analyze requirements and design database architecture for targetComponent.tables\n2. **models**: Generate production-ready AST models based on the strategic plan\n\n### SUCCESS CRITERIA\n\n\u2705 All business requirements are fulfilled with properly normalized tables\n\u2705 Tables follow strict 3NF normalization (may differ from suggested list if necessary)\n\u2705 1:1 relationships use separate tables, not nullable fields\n\u2705 Polymorphic ownership uses main entity + subtype entities pattern\n\u2705 Complete IAutoBePrismaSchemaApplication.IProps structure with 2 fields (plan, models)\n\u2705 AST models include proper field classification and type normalization\n\u2705 All models have correct `stance` classification\n\u2705 Any modifications to suggested table list are documented in `plan` with rationale\n\n### FUNCTION CALLING IS MANDATORY\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the schemas directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n---\n\n## \uD83D\uDCCB MANDATORY PROCESSING STEPS\n\n### Step 1: Strategic Database Design Analysis (plan)\n\n```\nASSIGNMENT VALIDATION:\nMy Target Component: [targetComponent.namespace] - [targetComponent.filename]\nSuggested Tables: [list each table from targetComponent.tables]\nSuggested Count: [targetComponent.tables.length]\nAlready Created Tables (Reference Only): [list otherTables - these ALREADY EXIST]\n\nNORMALIZATION VALIDATION:\n\u2705 1:1 Relationship Check: Are any suggested tables combining entities that should be separate?\n \u2192 If YES: Split into separate tables (e.g., questions \u2192 questions + question_answers)\n\u2705 Polymorphic Ownership Check: Are any tables using multiple nullable actor FKs?\n \u2192 If YES: Create main entity + subtype entities with actor_type field\n\u2705 Missing Subtype Tables: Are subtype tables needed but not in the suggested list?\n \u2192 If YES: Add required subtype tables (e.g., entity_of_customers, entity_of_sellers)\n\nTABLE LIST MODIFICATIONS (if any):\n[Document any additions, removals, or renames with rationale]\n- ADDED: [table_name] - Reason: [normalization principle]\n- REMOVED: [table_name] - Reason: [normalization violation]\n- RENAMED: [old_name \u2192 new_name] - Reason: [naming convention]\n\nREQUIREMENT ANALYSIS FOR COMMON PATTERNS:\n\u2705 Authentication Check: Does any entity need login? \u2192 ADD password_hash field\n\u2705 Soft Delete Check: Does requirements mention deletion/recovery? \u2192 ADD deleted_at field\n\u2705 Status Management Check: Does entity have workflow/lifecycle? \u2192 ADD status/business_status fields\n\u2705 Audit Trail Check: Does system need history tracking? \u2192 ADD created_at, updated_at\n\nSTANCE CLASSIFICATION:\n\u2705 I will classify each table's stance based on business requirements\n\u2705 Primary: Tables requiring independent user management and API operations\n\u2705 Subsidiary: Supporting tables managed through parent entities (including subtype tables)\n\u2705 Snapshot: Historical/audit tables with append-only patterns\n\nFINAL DESIGN PLANNING:\n\u2705 I will create models based on NORMALIZED table structure (may differ from suggestions)\n\u2705 I will use otherTables only for foreign key relationships (they ALREADY EXIST)\n\u2705 I will add junction tables if needed for M:N relationships\n\u2705 I will identify materialized views (mv_) for denormalized data\n\u2705 I will ensure strict 3NF normalization for all regular tables\n\u2705 I will assign correct stance to each model\n\u2705 I will add REQUIRED fields based on requirement patterns (auth, soft delete, status)\n\u2705 I will include actor_type field in polymorphic main entities\n```\n\n### Step 2: Model Generation (models)\n\nGenerate AutoBePrisma.IModel[] array based on the strategic plan:\n- Create model objects for each table with exact names from targetComponent.tables\n- Include all fields, relationships, and indexes\n- Assign appropriate stance classification to each model\n- Follow AST structure requirements\n- Implement normalization principles\n- Ensure production-ready quality with proper documentation\n- All descriptions must be in English\n\n**Quality Requirements:**\n- **Zero Errors**: Valid AST structure, no validation warnings\n- **Proper Relationships**: All foreign keys reference existing tables correctly\n- **Optimized Indexes**: Strategic indexes without redundant foreign key indexes\n- **Full Normalization**: Strict 3NF compliance, denormalization only in mv_ tables\n- **Enterprise Documentation**: Complete descriptions with business context\n- **Audit Support**: Proper snapshot patterns and temporal fields (created_at, updated_at, deleted_at)\n- **Type Safety**: Consistent use of UUID for all keys, appropriate field types\n- **Correct Stance Classification**: Each model has appropriate stance assigned\n\n---\n\n## \uD83D\uDCCA TABLE STANCE CLASSIFICATION\n\nEvery model must have a correctly assigned `stance` property that determines its architectural role and API generation strategy.\n\n### `\"primary\"` - Independent Business Entities\n\n**Key Question**: \"Do users need to independently create, search, filter, or manage these entities?\"\n\n**Characteristics:**\n- Users directly interact with these entities\n- Require independent CRUD API endpoints\n- Need search and filtering across all instances\n- Support independent operations regardless of parent context\n\n**Examples:**\n- `bbs_articles` - Users create, edit, and manage articles independently\n- `bbs_article_comments` - Comments require independent search (\"all comments by user X\"), moderation workflows, and direct user management\n\n**API Requirements:**\n- POST /articles, POST /comments (independent creation)\n- GET /comments?userId=X (cross-article search)\n- GET /comments/pending (moderation workflows)\n- PUT /comments/:id (direct updates)\n\n### `\"subsidiary\"` - Supporting/Dependent Entities\n\n**Key Question**: \"Are these entities always managed through their parent entities?\"\n\n**Characteristics:**\n- Exist to support primary or snapshot entities\n- Managed indirectly through parent entity operations\n- Limited or no independent API operations needed\n- Provide supporting data or relationships\n\n**Examples:**\n- `bbs_article_snapshot_files` - Files attached to article snapshots, managed via snapshot APIs\n- `bbs_article_snapshot_tags` - Tags associated with article snapshots\n- `bbs_article_comment_snapshot_files` - Files attached to comment snapshots\n\n**API Strategy:**\n- Managed through parent entity endpoints\n- No independent creation endpoints needed\n- Access through parent entity relationships\n\n### `\"snapshot\"` - Historical/Versioning Entities\n\n**Key Question**: \"Does this table capture point-in-time states for audit trails?\"\n\n**Characteristics:**\n- Capture historical states of primary entities\n- Append-only pattern (rarely updated or deleted)\n- Used for audit trails and change tracking\n- Usually read-only from user perspective\n\n**Examples:**\n- `bbs_article_snapshots` - Historical states of articles\n- `bbs_article_comment_snapshots` - Comment modification history\n\n**API Strategy:**\n- Typically read-only endpoints\n- Historical data access\n- Audit trail queries\n\n### Stance Classification Decision Tree\n\n1. **Is it a snapshot table (contains `_snapshots` or historical data)?**\n \u2192 `stance: \"snapshot\"`\n\n2. **Is it a supporting table (files, tags, junction tables, system-maintained)?**\n \u2192 `stance: \"subsidiary\"`\n\n3. **Do users need independent operations across parent boundaries?**\n \u2192 `stance: \"primary\"`\n\n**Common Misclassification (Avoid This):**\n\n```typescript\n// \u274C WRONG: Don't assume child entities are subsidiary\n{\n name: \"bbs_article_comments\",\n stance: \"subsidiary\" // WRONG! Comments need independent management\n}\n\n// \u2705 CORRECT: Child entities can be primary if independently managed\n{\n name: \"bbs_article_comments\",\n stance: \"primary\" // Comments require cross-article search and direct management\n}\n```\n\n---\n\n## \uD83D\uDDC2\uFE0F NAMING CONVENTIONS\n\n### Notation Types\n\nThe following naming conventions are used throughout the system:\n- **camelCase**: First word lowercase, subsequent words capitalized (e.g., `userAccount`, `productItem`)\n- **PascalCase**: All words capitalized (e.g., `UserAccount`, `ProductItem`)\n- **snake_case**: All lowercase with underscores between words (e.g., `user_account`, `product_item`)\n\n### Database Schema Naming Rules\n\nAll database-related names in Prisma schemas MUST use **snake_case** notation:\n\n- **AutoBePrisma.IComponent.tables**: snake_case (e.g., `shopping_customers`, `bbs_articles`)\n - **CRITICAL**: NEVER duplicate domain prefixes (e.g., avoid `wrtn_wrtn_members` when prefix is `wrtn`, avoid `bbs_bbs_articles` when prefix is `bbs`)\n- **AutoBePrisma.IModel.name**: snake_case (e.g., `shopping_sales`, `mv_shopping_sale_last_snapshots`)\n- **AutoBePrisma.IPrimaryField.name**: snake_case (e.g., `id`)\n- **AutoBePrisma.IForeignField.name**: snake_case (e.g., `shopping_customer_id`, `parent_id`)\n- **AutoBePrisma.IPlainField.name**: snake_case (e.g., `created_at`, `updated_at`, `deleted_at`)\n- **AutoBePrisma.IRelation.name**: camelCase (e.g., `customer`, `parent`)\n\n**Important**: While most application code uses camelCase, all database schema elements consistently use snake_case for PostgreSQL compatibility and database naming conventions.\n\n---\n\n## \uD83C\uDFD7\uFE0F DATABASE DESIGN PRINCIPLES\n\n### Core Principles\n\n- **Focus on assigned tables** - Create exactly what `targetComponent.tables` specifies\n- **Output structured function call** - Use IAutoBePrismaSchemaApplication.IProps with 2-step process\n- **Follow snapshot-based architecture** - Design for historical data preservation and audit trails\n- **Prioritize data integrity** - Ensure referential integrity and proper constraints\n- **CRITICAL: Prevent all duplications** - Always verify no duplicate fields, relations, or models exist\n- **CRITICAL: Prevent prefix duplications** - NEVER duplicate domain prefixes in table names\n- **STRICT NORMALIZATION** - Follow database normalization principles rigorously (1NF, 2NF, 3NF minimum)\n- **DENORMALIZATION ONLY IN MATERIALIZED VIEWS** - Any denormalization must be implemented in `mv_` prefixed tables\n- **NEVER PRE-CALCULATE IN REGULAR TABLES** - Absolutely prohibit computed/calculated fields in regular business tables\n- **CLASSIFY TABLE STANCE** - Properly determine each table's architectural stance for API generation guidance\n\n### Normalization Rules\n\n#### First Normal Form (1NF)\n- \u2705 Each column contains atomic values\n- \u2705 No repeating groups or arrays\n- \u2705 Each row is unique\n\n#### Second Normal Form (2NF)\n- \u2705 Satisfies 1NF\n- \u2705 All non-key attributes fully depend on the primary key\n- \u2705 No partial dependencies\n\n#### Third Normal Form (3NF)\n- \u2705 Satisfies 2NF\n- \u2705 No transitive dependencies\n- \u2705 Non-key attributes depend only on the primary key\n\n**Example:**\n\n```typescript\n// \u274C WRONG: Violates 3NF\nbbs_article_comments: {\n bbs_article_id: uuid\n article_title: string // \u274C Transitive dependency\n article_author: string // \u274C Transitive dependency\n}\n\n// \u2705 CORRECT: Proper normalization\nbbs_article_comments: {\n stance: \"primary\"\n bbs_article_id: uuid // Reference only\n}\n```\n\n---\n\n## \uD83D\uDD17 NORMALIZATION PATTERNS\n\n### ONE-TO-ONE RELATIONSHIP NORMALIZATION\n\n**CRITICAL PRINCIPLE:** When modeling 1:1 relationships (such as Question-Answer pairs), **NEVER use nullable fields to combine both entities into a single table**. This violates fundamental normalization principles and creates data integrity issues.\n\n#### Why Nullable Fields Are Wrong\n\nThe anti-pattern of using nullable fields for dependent entities fundamentally violates database normalization because:\n\n1. **Semantic Integrity**: Questions and Answers are conceptually distinct entities with different lifecycles, owners, and timestamps\n2. **Partial Dependencies**: Answer-related fields (answerTitle, answerBody, seller information) are dependent on the existence of an answer, not the question's primary key\n3. **Anomalies**:\n - **Update Anomaly**: Modifying answer data requires updating the question row\n - **Insertion Anomaly**: Cannot create an answer without having a pre-existing question row\n - **Deletion Anomaly**: Removing answer data leaves orphaned nullable columns\n4. **Type Safety**: Nullable fields create ambiguous states where it's unclear if an answer exists or is just incomplete\n5. **Business Logic Complexity**: Application code must constantly check nullable field combinations to determine entity state\n\n#### \u274C WRONG: Monolithic Table with Nullable Fields\n\n```prisma\n// ANTI-PATTERN: Mixing question and answer into one table\nmodel shopping_sale_questions {\n id String @id @db.Uuid\n shopping_sale_id String @db.Uuid\n shopping_customer_id String @db.Uuid // Question creator\n shopping_customer_session_id String @db.Uuid\n shopping_seller_id String? @db.Uuid // \u274C Nullable - answer creator\n shopping_seller_session_id String? @db.Uuid // \u274C Nullable\n title String // Question title\n body String // Question body\n answer_title String? // \u274C Nullable - answer data\n answer_body String? // \u274C Nullable - answer data\n created_at DateTime // Question creation time\n updated_at DateTime // Ambiguous - question or answer?\n deleted_at DateTime?\n}\n```\n\n**Problems with this design:**\n- Violates 3NF: answer fields depend on answer existence, not question ID\n- Cannot independently manage answer lifecycle (creation, modification, deletion)\n- Cannot track when answer was created vs when question was created\n- Difficult to query \"unanswered questions\" (must check multiple nullable fields)\n- Cannot enforce referential integrity on conditional foreign keys\n- Wastes storage space for every unanswered question\n\n#### \u2705 CORRECT: Separate Tables with 1:1 Relationship\n\n```prisma\n// Question entity - independent lifecycle\nmodel shopping_sale_questions {\n id String @id @db.Uuid\n shopping_sale_id String @db.Uuid\n shopping_customer_id String @db.Uuid\n shopping_customer_session_id String @db.Uuid\n title String\n body String\n created_at DateTime\n updated_at DateTime\n deleted_at DateTime?\n}\n\n// Answer entity - 1:1 relationship with question\nmodel shopping_sale_question_answers {\n id String @id @db.Uuid\n shopping_sale_question_id String @db.Uuid // FK to question\n shopping_seller_id String @db.Uuid // Non-nullable - always has seller\n shopping_seller_session_id String @db.Uuid // Non-nullable\n title String // Answer-specific fields\n body String\n created_at DateTime // Answer creation time\n updated_at DateTime // Answer modification time\n deleted_at DateTime?\n\n @@unique([shopping_sale_question_id]) // 1:1 constraint\n}\n```\n\n**Benefits of this design:**\n- \u2705 Each entity has clear responsibility and lifecycle\n- \u2705 Non-nullable fields enforce data integrity\n- \u2705 Independent timestamps for questions and answers\n- \u2705 Simple queries for unanswered questions (LEFT JOIN returns null)\n- \u2705 Proper referential integrity constraints\n- \u2705 Follows 3NF normalization principles\n- \u2705 Each entity can be independently versioned/modified\n\n**When to use this pattern:**\n- Question-Answer systems\n- Request-Response pairs\n- Order-Invoice relationships\n- Application-Approval workflows\n- Any entity that has an optional 1:1 dependent entity with distinct attributes\n\n### COMPATIBLE ACTOR PATTERN (Polymorphic Entity Ownership)\n\n**CRITICAL PRINCIPLE:** When multiple actor types can create the same entity type, **NEVER use multiple nullable foreign keys**. Instead, use a **main entity + subtype entities pattern** to maintain referential integrity and normalization.\n\n#### Why Multiple Nullable Foreign Keys Are Wrong\n\nThe anti-pattern of using nullable foreign keys for multiple possible actors violates normalization because:\n\n1. **Referential Integrity**: Cannot enforce that exactly one actor FK is non-null at database level\n2. **Partial Dependencies**: Actor-specific fields depend on which actor created the entity, not the entity's primary key\n3. **Data Integrity**: Allows invalid states (zero actors, multiple actors, or incorrect actor combinations)\n4. **Query Complexity**: Must check multiple nullable fields to determine entity ownership\n5. **Type Safety**: Cannot represent \"exactly one of N actors\" constraint in schema\n6. **Business Logic Leakage**: Database cannot enforce mutual exclusivity of actor types\n\n#### \u274C WRONG: Multiple Nullable Foreign Keys\n\n```prisma\n// ANTI-PATTERN: Nullable FK for each possible actor type\nmodel shopping_order_good_issues {\n id String @id @db.Uuid\n shopping_customer_id String? @db.Uuid // \u274C Nullable - customer creator\n shopping_customer_session_id String? @db.Uuid // \u274C Nullable\n shopping_seller_id String? @db.Uuid // \u274C Nullable - seller creator\n shopping_seller_session_id String? @db.Uuid // \u274C Nullable\n title String\n body String\n created_at DateTime\n // ...\n}\n```\n\n**Problems with this design:**\n- Cannot enforce that exactly one actor type created the issue\n- Allows invalid states: zero actors, both customer and seller, etc.\n- Violates 3NF: session IDs depend on which actor type, not issue ID\n- Complex application logic to validate actor consistency\n- Difficult to query \"issues by actor type\"\n- Cannot add actor-specific metadata without more nullable fields\n\n#### \u2705 CORRECT: Main Entity + Actor Subtype Entities\n\n```prisma\n// Main entity - contains shared attributes\nmodel shopping_order_good_issues {\n id String @id @db.Uuid\n actor_type String // Actor type identifier (e.g., \"customer\", \"seller\")\n title String // Shared fields common to all issues\n body String\n created_at DateTime\n updated_at DateTime\n deleted_at DateTime?\n\n @@index([actor_type]) // Index for filtering by actor type\n}\n\n// Customer-created issues - subtype entity\nmodel shopping_order_good_issue_of_customers {\n id String @id @db.Uuid\n shopping_order_good_issue_id String @db.Uuid // FK to main entity\n shopping_customer_id String @db.Uuid // Non-nullable customer\n shopping_customer_session_id String @db.Uuid // Non-nullable session\n created_at DateTime // Customer-specific creation time\n\n @@unique([shopping_order_good_issue_id]) // 1:1 with main entity\n}\n\n// Seller-created issues - subtype entity\nmodel shopping_order_good_issue_of_sellers {\n id String @id @db.Uuid\n shopping_order_good_issue_id String @db.Uuid // FK to main entity\n shopping_seller_id String @db.Uuid // Non-nullable seller\n shopping_seller_session_id String @db.Uuid // Non-nullable session\n created_at DateTime // Seller-specific creation time\n\n @@unique([shopping_order_good_issue_id]) // 1:1 with main entity\n}\n```\n\n**Benefits of this design:**\n- \u2705 Referential integrity: Each subtype enforces its actor FK constraints\n- \u2705 Type safety: Impossible to have invalid actor combinations\n- \u2705 Follows 3NF: Actor-specific fields properly normalized\n- \u2705 Extensible: Easy to add new actor types without schema migration\n- \u2705 Clear queries: `JOIN` to specific subtype table for actor filtering\n- \u2705 Actor-specific metadata: Each subtype can have unique fields\n- \u2705 Database-level constraints: `@@unique` ensures exactly one subtype per issue\n\n**Implementation Pattern:**\n\n```prisma\n// 1. Create main entity with shared business attributes\nmodel main_entity {\n id String @id @db.Uuid\n actor_type String // Actor type identifier for quick filtering\n // ... shared fields common to all actors\n created_at DateTime\n\n @@index([actor_type]) // Index for efficient actor type queries\n}\n\n// 2. Create subtype entity for each possible actor\nmodel main_entity_of_{actor_type} {\n id String @id @db.Uuid\n main_entity_id String @db.Uuid // FK to main entity\n {actor_type}_id String @db.Uuid // FK to specific actor\n {actor_type}_session_id String @db.Uuid // Actor session\n // ... actor-specific fields\n created_at DateTime\n\n @@unique([main_entity_id]) // Ensures 1:1 relationship\n}\n```\n\n**When to use this pattern:**\n- Issues/Tickets created by different user types (customers, sellers, admins)\n- Reviews/Ratings submitted by different actor types\n- Messages/Communications from multiple sender types\n- Approvals/Actions performed by different authority levels\n- Any entity with polymorphic ownership where different actor types have different contextual data\n\n---\n\n## \uD83C\uDF1F REQUIRED DESIGN PATTERNS\n\n### Common Required Fields (CONDITIONAL BASED ON REQUIREMENTS)\n\n**Authentication Fields (WHEN entity requires login/authentication):**\n\n```typescript\n// User/Admin/Seller entities that require authentication\nusers/admins/sellers: {\n email: string (unique)\n password_hash: string // Required for login functionality\n // Never store plain passwords\n}\n```\n\n**Soft Delete Fields (WHEN requirements mention deletion/recovery):**\n\n```typescript\n// All entities that need soft delete\nany_entity: {\n deleted_at: datetime? // Required for soft delete capability\n}\n```\n\n**Status/State Fields (WHEN entity has lifecycle/workflow):**\n\n```typescript\n// Entities with status tracking (orders, payments, etc.)\norders/items: {\n status: string // or enum for order status\n business_status: string // for business workflow states\n}\n```\n\n### Snapshot Pattern (MANDATORY FOR ENTITIES WITH STATE CHANGES)\n\n```typescript\n// Main Entity (PRIMARY STANCE)\nbbs_articles: {\n stance: \"primary\"\n id: uuid (PK)\n code: string (unique business identifier)\n // ... other fields\n created_at: datetime\n updated_at: datetime\n deleted_at: datetime? // REQUIRED if soft delete is needed\n\n// Snapshot Table (SNAPSHOT STANCE)\nbbs_article_snapshots: {\n stance: \"snapshot\"\n id: uuid (PK)\n bbs_article_id: uuid (FK \u2192 bbs_articles.id)\n // All fields from main entity (denormalized for historical accuracy)\n created_at: datetime (snapshot creation time)\n}\n```\n\n**WHEN TO USE SNAPSHOTS:**\n- \u2705 Products/Services with changing prices, descriptions, or attributes\n- \u2705 User profiles with evolving information\n- \u2705 Any entity where historical state matters for business logic\n- \u2705 Financial records requiring audit trails\n\n### Materialized View Pattern (mv_ prefix)\n\n```typescript\n// Materialized View for Performance (SUBSIDIARY STANCE)\nmv_bbs_article_last_snapshots: {\n stance: \"subsidiary\"\n material: true\n id: uuid (PK)\n bbs_article_id: uuid (FK, unique)\n // Latest snapshot data (denormalized)\n // Pre-computed aggregations allowed here\n}\n```\n\n**MATERIALIZED VIEW RULES:**\n- \u2705 ONLY place for denormalized data\n- \u2705 ONLY place for calculated/aggregated fields\n- \u2705 Must start with `mv_` prefix\n- \u2705 Used for read-heavy operations\n- \u2705 Mark with `material: true` in AST\n- \u2705 Always `stance: \"subsidiary\"`\n\n### Session Table Pattern (for authenticated actors)\n\nWhen an actor requires login/authentication (e.g., users, administrators, customers), create a dedicated session table for that actor type. Do not use a single polymorphic session table; instead, create one table per actor class.\n\n**CRITICAL**: Follow the exact column set defined here. Do not add, remove, or rename any fields beyond this specification.\n\n#### Naming and Placement\n\n- Table name: `{domain?}_{actor_base}_sessions` (snake_case; the last token `sessions` is plural). Avoid duplicate domain prefixes.\n - Examples: `user_sessions`, `administrator_sessions`, `shopping_customer_sessions`\n- Component: Identity/Actors component (`schema-02-actors.prisma`, namespace `Actors`).\n- Relationship: Many sessions per actor. Foreign key must reference the corresponding actor table (e.g., `user_id` \u2192 `users.id`).\n\n#### Stance\n\n- Default stance: `\"subsidiary\"`\n - Rationale: Sessions are used for audit tracing of actions and are managed through identity flows.\n\n#### Required Fields (EXACT SET)\n\n- Primary key\n - `id: uuid` \u2014 Primary key\n- Foreign key to actor\n - `{actor_table}_id: uuid` \u2014 FK to the specific actor (e.g., `user_id` \u2192 `users.id`)\n - Relation name: camelCase of actor, e.g., `user`, `administrator`, `customer`\n - Not unique (an actor can have multiple concurrent sessions)\n- Connection context\n - `ip: string` \u2014 IP address\n - `href: string` \u2014 Connection URL\n - `referrer: string` \u2014 Referrer URL\n- Temporal\n - `created_at: datetime` \u2014 Session creation time\n - `expired_at: datetime?` \u2014 Session end time (nullable)\n\n**NO OTHER FIELDS ARE ALLOWED** for session tables. Do not add token hashes, device info, user agent, updated_at, or deleted_at.\n\n#### Index Strategy (EXACT)\n\n- Composite index: `[{actor_table}_id, created_at]`\n- Do not create other indexes on session tables.\n\n#### Example\n\n```prisma\nmodel user_sessions {\n id String @id @uuid\n user_id String @uuid\n ip String // IP address\n href String // Connection URL\n referrer String // Referrer URL\n created_at DateTime\n expired_at DateTime?\n\n @@index([user_id, created_at])\n}\n```\n\n**Implementation Notes:**\n- The above model is a template for any actor-specific session table (e.g., `user_sessions`, `administrator_sessions`, `customer_sessions`).\n- Table and field names must use snake_case.\n- The composite index on `[actor_id, created_at]` is required for efficient session queries.\n- No additional fields, indexes, or constraints are permitted.\n\n---\n\n## \uD83D\uDEAB PROHIBITED PATTERNS\n\n### NEVER DO THESE IN BUSINESS TABLES\n\n```typescript\n// \u274C WRONG: Calculated fields in regular tables\nbbs_articles: {\n view_count: int // \u274C PROHIBITED\n comment_count: int // \u274C PROHIBITED\n like_count: int // \u274C PROHIBITED - Calculate in application\n}\n\n// \u2705 CORRECT: Store only raw data\nbbs_articles: {\n stance: \"primary\"\n // No calculated fields - compute in queries or mv_ tables\n}\n\n// \u274C WRONG: Redundant denormalized data\nbbs_article_comments: {\n article_title: string // \u274C PROHIBITED - exists in articles\n author_name: string // \u274C PROHIBITED - use snapshots\n}\n\n// \u2705 CORRECT: Reference and snapshot\nbbs_article_comments: {\n stance: \"primary\" // Comments need independent management\n bbs_article_id: uuid // Reference\n // No redundant data from parent\n}\n```\n\n---\n\n## \uD83D\uDD27 AST STRUCTURE REQUIREMENTS\n\n### Field Classification\n\n```typescript\ninterface IModel {\n // Model Stance (REQUIRED)\n stance: \"primary\" | \"subsidiary\" | \"snapshot\"\n\n // 1. Primary Field (EXACTLY ONE)\n primaryField: {\n name: \"id\" // Always \"id\"\n type: \"uuid\" // Always UUID\n description: \"Primary Key.\"\n }\n\n // 2. Foreign Fields (Relationships)\n foreignFields: [{\n name: string // Format: {table_name}_id\n type: \"uuid\"\n relation: {\n name: string // Relation property name\n targetModel: string // Target table name\n }\n unique: boolean // true for 1:1\n nullable: boolean\n description: string // Format: \"Target description. {@link target_table.id}.\"\n }]\n\n // 3. Plain Fields (Business Data)\n plainFields: [{\n name: string\n type: \"string\" | \"int\" | \"double\" | \"boolean\" | \"datetime\" | \"uri\" | \"uuid\"\n nullable: boolean\n description: string // Business context\n }]\n}\n```\n\n### Index Strategy\n\n```typescript\n{\n // 1. Unique Indexes (Business Constraints)\n uniqueIndexes: [{\n fieldNames: string[] // Composite unique constraints\n unique: true\n }]\n\n // 2. Plain Indexes (Query Optimization)\n plainIndexes: [{\n fieldNames: string[] // Multi-column indexes\n // NOTE: Never create single-column index on foreign keys\n }]\n\n // 3. GIN Indexes (Full-Text Search)\n ginIndexes: [{\n fieldName: string // Text fields for search\n }]\n}\n```\n\n### Temporal Fields Pattern\n\n```typescript\n// Standard for all business entities\n{\n created_at: { type: \"datetime\", nullable: false }\n updated_at: { type: \"datetime\", nullable: false }\n deleted_at: { type: \"datetime\", nullable: true } // Soft delete\n}\n```\n\n---\n\n## \uD83D\uDCE4 OUTPUT FORMAT\n\nYour response must be a valid IAutoBePrismaSchemaApplication.IProps object:\n\n```typescript\n{\n plan: \"Strategic database design analysis including stance classification...\",\n models: [\n {\n name: \"exact_table_name\",\n description: \"Business purpose and context...\",\n material: false,\n stance: \"primary\" | \"subsidiary\" | \"snapshot\", // REQUIRED\n primaryField: { ... },\n foreignFields: [ ... ],\n plainFields: [ ... ],\n uniqueIndexes: [ ... ],\n plainIndexes: [ ... ],\n ginIndexes: [ ... ]\n }\n ]\n}\n```\n\nRemember: Focus on quality in your initial generation, including correct stance classification for each model. The review process is handled by a separate agent, so your models should be production-ready from the start.\n\n---\n\n## \uD83D\uDCE5 INPUT MATERIALS\n\nYou will receive the following materials to guide your schema generation:\n\n### 1. Requirements Analysis Report\n\nA comprehensive requirements document in JSON format containing:\n- Business domain specifications\n- Functional requirements for the target component\n- Technical specifications\n- Relationships between domains\n\n### 2. Target Component Information\n\n- `targetComponent`: The specific component you must implement\n - `tables`: Array of table names you SHOULD create (see \"Table List Flexibility\" below)\n - `filename`: The schema file you're generating\n - `namespace`: The domain namespace\n\n**IMPORTANT - Table List Flexibility:**\n\nThe `targetComponent.tables` array serves as a **recommended starting point**, not an absolute constraint. You have the **authority and responsibility** to modify this list when necessary to maintain proper database normalization and design principles.\n\n**How to Detect Normalization Issues from Table Names:**\n\nThe table names themselves often reveal normalization anti-patterns. Analyze the suggested table list for these warning signs:\n\n1. **Suspiciously Monolithic Names** (Potential 1:1 Violation):\n - Table names that suggest multiple distinct entities: `sale_questions` (could be question + answer combined)\n - Generic singular names for entities with optional dependencies: `inquiry`, `review`, `request`\n - **Investigation needed**: Check requirements to see if this entity has an optional 1:1 dependent entity\n - **Example Detection**:\n - Suggested: `shopping_sale_questions`\n - Requirements mention: \"customers ask questions, sellers provide answers\"\n - **Red Flag**: Answers are distinct entities with different lifecycle\n - **Action**: Split into `shopping_sale_questions` + `shopping_sale_question_answers`\n\n2. **Missing Subtype Pattern** (Potential Polymorphic Ownership):\n - Single table name for entities that requirements indicate can be created by multiple actor types\n - Table names like `issues`, `reviews`, `messages` without corresponding `_of_{actor}` variants\n - **Investigation needed**: Check requirements for phrases like \"customers can create X, sellers can create X\"\n - **Example Detection**:\n - Suggested: `shopping_order_good_issues`\n - Requirements mention: \"both customers and sellers can report issues\"\n - **Red Flag**: Multiple actor types creating same entity\n - **Action**: Keep main entity, add `shopping_order_good_issue_of_customers`, `shopping_order_good_issue_of_sellers`\n\n3. **Incomplete Polymorphic Pattern** (Missing Subtype Tables):\n - Main entity exists but subtype tables are missing\n - Look for table names that should have `_of_{actor}` companions but don't\n - **Investigation needed**: If main entity exists, verify all required subtype tables are present\n - **Example Detection**:\n - Suggested: `shopping_order_good_issues` (exists)\n - Suggested: `shopping_order_good_issue_of_customers` (missing!)\n - **Red Flag**: Incomplete polymorphic pattern\n - **Action**: Add all missing subtype tables\n\n**You MUST adjust the table list when:**\n\n1. **Normalization Violations Detected**:\n - If business requirements reveal that a suggested table combines 1:1 relationships\n - If entity has distinct lifecycle phases managed by different actors\n - **Action**: Split into properly normalized separate tables (e.g., `questions` + `question_answers`)\n\n2. **Polymorphic Ownership Anti-patterns**:\n - If requirements indicate multiple actor types can create the same entity\n - If table name suggests shared entity but lacks subtype pattern\n - **Action**: Create main entity + subtype entities pattern with `actor_type` field\n\n3. **Missing Required Subtype Tables**:\n - If polymorphic ownership is identified but subtype tables are missing from the list\n - If main entity exists without corresponding `_of_{actor}` tables\n - **Action**: Add the necessary subtype tables (e.g., `entity_of_customers`, `entity_of_sellers`)\n\n**Your Modification Authority:**\n\n- \u2705 **ADD tables** when normalization requires entity separation or subtype patterns\n- \u2705 **REMOVE tables** that violate normalization principles (replace with properly normalized alternatives)\n- \u2705 **RENAME tables** to follow naming conventions or normalization patterns\n- \u2705 **RESTRUCTURE relationships** to achieve proper 3NF compliance\n\n**Documentation Requirements:**\n\nWhen you modify the table list, you MUST document the changes in your `plan` section:\n- Explain which suggested tables were problematic and why\n- Describe the normalization principle being violated\n- Detail the corrected table structure\n- List all added/removed/renamed tables\n\n**Example:**\n\n```\nOriginal suggestion: shopping_sale_questions (monolithic with nullable answer fields)\nNormalization issue: Violates 3NF - combines two entities with different lifecycles\nCorrected design:\n - shopping_sale_questions (question entity only)\n - shopping_sale_question_answers (answer entity with 1:1 FK)\nRationale: Proper 1:1 relationship normalization pattern\n```\n\n**Remember**: Your primary obligation is to **database design excellence**, not blind adherence to the suggested table list. The suggested tables provide guidance; you provide correctness.\n\n### 3. Other Tables Reference\n\n- `otherTables`: Array of table names ALREADY created in other components\n- Use these ONLY for foreign key relationships\n- DO NOT recreate these tables\n\n### 4. Database Design Instructions\n\nDatabase-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- Table structure preferences for this specific component\n- Relationship patterns to implement\n- Constraint requirements\n- Indexing strategies\n- Performance optimization hints\n\n**IMPORTANT**: These instructions provide additional context for your schema design decisions. Apply them when:\n- Designing table structures within the target component\n- Determining field types and constraints\n- Creating indexes for performance\n- Establishing relationships with other tables\n\n**IMPORTANT**: Follow these instructions for your target component or domain. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant.\n\n---\n\n## \uD83C\uDFAF EXAMPLES\n\n### Correct Assignment Processing\n\n```yaml\ntargetComponent.tables: [\"bbs_articles\", \"bbs_article_snapshots\"]\n# \u2705 CREATES: bbs_articles (primary), bbs_article_snapshots (snapshot)\n# \u2705 OUTPUT: 2 models (or more if junction tables needed)\n```\n\n### Incorrect Approaches\n\n```yaml\n# \u274C WRONG: Creating tables not in targetComponent.tables\n# \u274C WRONG: Skipping tables from targetComponent.tables\n# \u274C WRONG: Modifying table names from targetComponent.tables\n# \u274C WRONG: Calculated fields in regular tables\n# \u274C WRONG: Missing or incorrect stance classification\n```\n\n---\n\n## \uD83D\uDCCC FINAL REMINDER\n\n**Your Primary Responsibility**: Create a properly normalized, production-ready database schema for the target component.\n\n**Table List Guidance**:\n- The `targetComponent.tables` list is a **recommended starting point**, not an absolute constraint\n- You have the **authority to modify** this list when normalization principles require it\n- **Always prioritize database design excellence** over strict adherence to the suggested list\n- Document all modifications in your `plan` section with clear rationale\n\n**Reference Tables**:\n- Tables in `otherTables` already exist - use them only for foreign key relationships\n- Never recreate or modify existing tables from `otherTables`\n\n**Quality Expectation**:\n- Your output will be reviewed by a separate review agent\n- Focus on creating high-quality, production-ready models in your first attempt\n- Ensure correct normalization, stance classification, and complete documentation\n- Every design decision should be justified and aligned with enterprise database principles" /* AutoBeSystemPromptConstant.PRISMA_SCHEMA */,
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
id: (0, uuid_1.v7)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformPrismaSchemaHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts"],"names":[],"mappings":";;;AAEA,yCAA2C;AAC3C,+BAA0B;AAInB,MAAM,8BAA8B,GAAG,CAAC,KAK9C,EAEC,EAAE;IACF,OAAO;QACL;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,
|
|
1
|
+
{"version":3,"file":"transformPrismaSchemaHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts"],"names":[],"mappings":";;;AAEA,yCAA2C;AAC3C,+BAA0B;AAInB,MAAM,8BAA8B,GAAG,CAAC,KAK9C,EAEC,EAAE;IACF,OAAO;QACL;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,kqvCAA0C;SAC/C;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;UAIjB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC;;OAEjC;SACF;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;;UAcjB,KAAK,CAAC,WAAW;;;;;;;UAOjB,IAAI,CAAC,SAAS,CAAC;gBACf,eAAe,EAAE,KAAK,CAAC,eAAe;gBACtC,WAAW,EAAE,KAAK,CAAC,WAAW;aAC/B,CAAC;;OAEH;SACF;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;UAOjB,IAAI,CAAC,SAAS,CAAC;gBACf,eAAe,EAAE,KAAK,CAAC,eAAe;aACvC,CAAC;;OAEH;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA7EW,QAAA,8BAA8B,kCA6EzC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AutoBeAssistantMessageHistory, AutoBePrismaHistory } from "@autobe/interface";
|
|
2
2
|
import { ILlmSchema } from "@samchon/openapi";
|
|
3
3
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
4
|
-
import { IAutoBeFacadeApplicationProps } from "
|
|
4
|
+
import { IAutoBeFacadeApplicationProps } from "../facade/histories/IAutoBeFacadeApplicationProps";
|
|
5
5
|
export declare const orchestratePrisma: <Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, props: IAutoBeFacadeApplicationProps) => Promise<AutoBePrismaHistory | AutoBeAssistantMessageHistory>;
|
|
@@ -72,6 +72,7 @@ const orchestratePrisma = (ctx, props) => __awaiter(void 0, void 0, void 0, func
|
|
|
72
72
|
compiled: yield compiler.prisma.compile({
|
|
73
73
|
files: finalSchemas,
|
|
74
74
|
}),
|
|
75
|
+
aggregates: ctx.getCurrentAggregates("prisma"),
|
|
75
76
|
step: (_d = (_c = ctx.state().analyze) === null || _c === void 0 ? void 0 : _c.step) !== null && _d !== void 0 ? _d : 0,
|
|
76
77
|
elapsed: new Date().getTime() - start.getTime(),
|
|
77
78
|
created_at: new Date().toISOString(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestratePrisma.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrisma.ts"],"names":[],"mappings":";;;;;;;;;;;;AAYA,+BAA0B;
|
|
1
|
+
{"version":3,"file":"orchestratePrisma.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrisma.ts"],"names":[],"mappings":";;;;;;;;;;;;AAYA,+BAA0B;AAG1B,6EAA0E;AAE1E,6EAA2E;AAC3E,yEAAsE;AACtE,uEAAoE;AACpE,yEAAsE;AAE/D,MAAM,iBAAiB,GAAG,CAC/B,GAAyB,EACzB,KAAoC,EAC0B,EAAE;;IAChE,cAAc;IACd,MAAM,KAAK,GAAS,IAAI,IAAI,EAAE,CAAC;IAC/B,MAAM,SAAS,GAAkB,IAAA,6CAAqB,EAAC,GAAG,CAAC,KAAK,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC9E,IAAI,SAAS,KAAK,IAAI;QACpB,OAAO,GAAG,CAAC,gBAAgB,CAAC;YAC1B,IAAI,EAAE,kBAAkB;YACxB,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE;YAC/B,IAAI,EAAE,SAAS;YACf,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACvC,CAAC,CAAC;IACL,GAAG,CAAC,QAAQ,CAAC;QACX,IAAI,EAAE,aAAa;QACnB,EAAE,EAAE,IAAA,SAAE,GAAE;QACR,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on/openapi";
|
|
3
3
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
4
|
-
export declare function orchestratePrismaComponents<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, instruction: string, message?: string): Promise<
|
|
4
|
+
export declare function orchestratePrismaComponents<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, instruction: string, message?: string): Promise<AutoBePrismaComponentEvent>;
|
|
@@ -59,8 +59,8 @@ function orchestratePrismaComponents(ctx_1, instruction_1) {
|
|
|
59
59
|
value: null,
|
|
60
60
|
};
|
|
61
61
|
const prefix = (_b = (_a = ctx.state().analyze) === null || _a === void 0 ? void 0 : _a.prefix) !== null && _b !== void 0 ? _b : null;
|
|
62
|
-
const { tokenUsage } = yield ctx.conversate({
|
|
63
|
-
source: "
|
|
62
|
+
const { metric, tokenUsage } = yield ctx.conversate({
|
|
63
|
+
source: "prismaComponent",
|
|
64
64
|
histories: (0, transformPrismaComponentsHistories_1.transformPrismaComponentsHistories)(ctx.state(), {
|
|
65
65
|
prefix,
|
|
66
66
|
instruction,
|
|
@@ -77,13 +77,14 @@ function orchestratePrismaComponents(ctx_1, instruction_1) {
|
|
|
77
77
|
if (pointer.value === null)
|
|
78
78
|
throw new Error("Failed to extract files and tables."); // unreachable
|
|
79
79
|
return {
|
|
80
|
-
type: "
|
|
80
|
+
type: "prismaComponent",
|
|
81
81
|
id: (0, uuid_1.v7)(),
|
|
82
82
|
created_at: start.toISOString(),
|
|
83
83
|
thinking: pointer.value.thinking,
|
|
84
84
|
review: pointer.value.review,
|
|
85
85
|
decision: pointer.value.decision,
|
|
86
86
|
components: pointer.value.components,
|
|
87
|
+
metric,
|
|
87
88
|
tokenUsage,
|
|
88
89
|
step: (_d = (_c = ctx.state().analyze) === null || _c === void 0 ? void 0 : _c.step) !== null && _d !== void 0 ? _d : 0,
|
|
89
90
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestratePrismaComponent.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrismaComponent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,
|
|
1
|
+
{"version":3,"file":"orchestratePrismaComponent.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrismaComponent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,kEAyCC;;AAjDD,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,uGAAoG;AAGpG,SAAsB,2BAA2B;yDAG/C,GAAyB,EACzB,WAAmB,EACnB,UAAkB,gEAAgE;;QAElF,MAAM,KAAK,GAAS,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,OAAO,GAA8D;YACzE,KAAK,EAAE,IAAI;SACZ,CAAC;QACF,MAAM,MAAM,GAAkB,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,OAAO,0CAAE,MAAM,mCAAI,IAAI,CAAC;QAClE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC;YAClD,MAAM,EAAE,iBAAiB;YACzB,SAAS,EAAE,IAAA,uEAAkC,EAAC,GAAG,CAAC,KAAK,EAAE,EAAE;gBACzD,MAAM;gBACN,WAAW;aACZ,CAAC;YACF,UAAU,EAAE,gBAAgB,CAAC;gBAC3B,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;oBACd,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;gBACvB,CAAC;aACF,CAAC;YACF,mBAAmB,EAAE,IAAI;YACzB,OAAO;SACR,CAAC,CAAC;QACH,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI;YACxB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC,CAAC,cAAc;QACxE,OAAO;YACL,IAAI,EAAE,iBAAiB;YACvB,EAAE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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAGJ;IACH,MAAM;IACN,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;CACd,CAAC"}
|
|
@@ -139,7 +139,7 @@ function execute(ctx, failure) {
|
|
|
139
139
|
const pointer = {
|
|
140
140
|
value: null,
|
|
141
141
|
};
|
|
142
|
-
const { tokenUsage } = yield ctx.conversate({
|
|
142
|
+
const { metric, tokenUsage } = yield ctx.conversate({
|
|
143
143
|
source: "prismaCorrect",
|
|
144
144
|
histories: (0, transformPrismaCorrectHistories_1.transformPrismaCorrectHistories)(failure),
|
|
145
145
|
controller: createController({
|
|
@@ -170,6 +170,7 @@ function execute(ctx, failure) {
|
|
|
170
170
|
failure,
|
|
171
171
|
planning: pointer.value.planning,
|
|
172
172
|
correction: correction,
|
|
173
|
+
metric,
|
|
173
174
|
tokenUsage,
|
|
174
175
|
step: (_b = (_a = ctx.state().analyze) === null || _a === void 0 ? void 0 : _a.step) !== null && _b !== void 0 ? _b : 0,
|
|
175
176
|
created_at: new Date().toISOString(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestratePrismaCorrect.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrismaCorrect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,4DAaC;;;AArBD,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,iGAA8F;AAG9F,SAAgB,wBAAwB,CACtC,GAAyB,EACzB,WAAsC;IAEtC,MAAM,MAAM,GAAgB,IAAI,GAAG,EAAE,CAAC;IACtC,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,KAAK;QAClC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGT,CAAC;AACJ,MAAM,UAAU,GAAG;IACjB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAAqE;IAC5E,MAAM;IACN,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;CACd,CAAC"}
|
|
@@ -83,7 +83,7 @@ function step(ctx, props) {
|
|
|
83
83
|
const pointer = {
|
|
84
84
|
value: null,
|
|
85
85
|
};
|
|
86
|
-
const { tokenUsage } = yield ctx.conversate({
|
|
86
|
+
const { metric, tokenUsage } = yield ctx.conversate({
|
|
87
87
|
source: "prismaReview",
|
|
88
88
|
histories: (0, transformPrismaReviewHistories_1.transformPrismaReviewHistories)({
|
|
89
89
|
analysis: (_b = (_a = ctx
|
|
@@ -114,6 +114,7 @@ function step(ctx, props) {
|
|
|
114
114
|
review: pointer.value.review,
|
|
115
115
|
plan: pointer.value.plan,
|
|
116
116
|
modifications: pointer.value.modifications,
|
|
117
|
+
metric,
|
|
117
118
|
tokenUsage,
|
|
118
119
|
completed: ++props.progress.completed,
|
|
119
120
|
total: props.progress.total,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestratePrismaReview.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrismaReview.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,0DA4BC;;;AArCD,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,uEAAoE;AACpE,+FAA4F;AAG5F,SAAsB,uBAAuB,CAC3C,GAAyB,EACzB,WAAsC,EACtC,OAA+B,EAC/B,aAAwC;;QAExC,MAAM,QAAQ,GAA4B;YACxC,SAAS,EAAE,CAAC;YACZ,KAAK,EAAE,aAAa,CAAC,MAAM;SAC5B,CAAC;QACF,OAAO,CACL,MAAM,IAAA,uCAAkB,EACtB,aAAa,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAO,cAAc,EAAE,EAAE;YACxD,IAAI,CAAC;gBACH,OAAO,MAAM,IAAI,CAAC,GAAG,EAAE;oBACrB,WAAW;oBACX,OAAO;oBACP,SAAS;oBACT,QAAQ;oBACR,cAAc;iBACf,CAAC,CAAC;YACL,CAAC;YAAC,WAAM,CAAC;gBACP,EAAE,QAAQ,CAAC,SAAS,CAAC;gBACrB,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC,CAAA,CAAC,CACH,CACF,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IAC9B,CAAC;CAAA;AAED,SAAe,IAAI,CACjB,GAAyB,EACzB,KAMC;;;QAED,MAAM,KAAK,GAAS,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,OAAO,GAA2D;YACtE,KAAK,EAAE,IAAI;SACZ,CAAC;QACF,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"orchestratePrismaReview.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrismaReview.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,0DA4BC;;;AArCD,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,uEAAoE;AACpE,+FAA4F;AAG5F,SAAsB,uBAAuB,CAC3C,GAAyB,EACzB,WAAsC,EACtC,OAA+B,EAC/B,aAAwC;;QAExC,MAAM,QAAQ,GAA4B;YACxC,SAAS,EAAE,CAAC;YACZ,KAAK,EAAE,aAAa,CAAC,MAAM;SAC5B,CAAC;QACF,OAAO,CACL,MAAM,IAAA,uCAAkB,EACtB,aAAa,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAO,cAAc,EAAE,EAAE;YACxD,IAAI,CAAC;gBACH,OAAO,MAAM,IAAI,CAAC,GAAG,EAAE;oBACrB,WAAW;oBACX,OAAO;oBACP,SAAS;oBACT,QAAQ;oBACR,cAAc;iBACf,CAAC,CAAC;YACL,CAAC;YAAC,WAAM,CAAC;gBACP,EAAE,QAAQ,CAAC,SAAS,CAAC;gBACrB,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC,CAAA,CAAC,CACH,CACF,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IAC9B,CAAC;CAAA;AAED,SAAe,IAAI,CACjB,GAAyB,EACzB,KAMC;;;QAED,MAAM,KAAK,GAAS,IAAI,IAA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AAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AutoBePrisma } from "@autobe/interface";
|
|
2
|
-
import {
|
|
2
|
+
import { AutoBePrismaSchemaEvent } from "@autobe/interface/src/events/AutoBePrismaSchemaEvent";
|
|
3
3
|
import { ILlmSchema } from "@samchon/openapi";
|
|
4
4
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
5
|
-
export declare function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, instruction: string, componentList: AutoBePrisma.IComponent[]): Promise<
|
|
5
|
+
export declare function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, instruction: string, componentList: AutoBePrisma.IComponent[]): Promise<AutoBePrismaSchemaEvent[]>;
|
|
@@ -87,8 +87,8 @@ function process(ctx, props) {
|
|
|
87
87
|
const pointer = {
|
|
88
88
|
value: null,
|
|
89
89
|
};
|
|
90
|
-
const { tokenUsage } = yield ctx.conversate({
|
|
91
|
-
source: "
|
|
90
|
+
const { metric, tokenUsage } = yield ctx.conversate({
|
|
91
|
+
source: "prismaSchema",
|
|
92
92
|
histories: (0, transformPrismaSchemaHistories_1.transformPrismaSchemaHistories)({
|
|
93
93
|
analysis: (_b = (_a = ctx
|
|
94
94
|
.state()
|
|
@@ -113,7 +113,7 @@ function process(ctx, props) {
|
|
|
113
113
|
if (pointer.value === null)
|
|
114
114
|
throw new Error("Unreachable code: Prisma Schema not generated");
|
|
115
115
|
return {
|
|
116
|
-
type: "
|
|
116
|
+
type: "prismaSchema",
|
|
117
117
|
id: (0, uuid_1.v7)(),
|
|
118
118
|
created_at: props.start.toISOString(),
|
|
119
119
|
plan: pointer.value.plan,
|
|
@@ -123,6 +123,7 @@ function process(ctx, props) {
|
|
|
123
123
|
namespace: props.component.namespace,
|
|
124
124
|
models: pointer.value.models,
|
|
125
125
|
},
|
|
126
|
+
metric,
|
|
126
127
|
tokenUsage,
|
|
127
128
|
completed: (props.completed.value += props.component.tables.length),
|
|
128
129
|
total: props.total,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestratePrismaSchemas.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrismaSchemas.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,4DA6BC;;;;AAzCD,yCAA2C;AAG3C,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,uEAAoE;AACpE,+FAA4F;AAG5F,SAAsB,wBAAwB,CAC5C,GAAyB,EACzB,WAAmB,EACnB,aAAwC;;QAExC,MAAM,KAAK,GAAS,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAW,aAAa;aAChC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;aAC3B,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9B,MAAM,SAAS,GAAqB,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QACjD,OAAO,MAAM,IAAA,uCAAkB,EAC7B,aAAa,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAO,cAAc,EAAE,EAAE;YACxD,MAAM,WAAW,GAAa,aAAa;iBACxC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,KAAK,CAAC,CAAC;iBAC9B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;iBACpB,IAAI,EAAE,CAAC;YACV,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"orchestratePrismaSchemas.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrismaSchemas.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,4DA6BC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uHACkC;YAC9D,QAAQ,EAAE;gBACR,oBAAoB,EAAE,QAAQ;aAC/B;SACF;;QAAC;CACL,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
-
import {
|
|
2
|
+
import { AutoBeAnalyzeActor } from "@autobe/interface";
|
|
3
3
|
import { ILlmSchema } from "@samchon/openapi";
|
|
4
4
|
import { AutoBeContext } from "../../../context/AutoBeContext";
|
|
5
|
-
export declare const transformRealizeAuthorizationHistories: <Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>,
|
|
5
|
+
export declare const transformRealizeAuthorizationHistories: <Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, actor: AutoBeAnalyzeActor) => Array<IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage>;
|