@autobe/agent 0.24.2 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AutoBeAgent.js +11 -1
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/AutoBeMockAgent.js +1 -0
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +21 -21
- package/lib/context/IAutoBeApplication.d.ts +101 -6
- package/lib/context/IAutoBeApplicationProps.d.ts +6 -2
- package/lib/factory/createAgenticaHistory.js +1 -1
- package/lib/factory/createAgenticaHistory.js.map +1 -1
- package/lib/factory/createAutoBeApplication.js +80 -90
- package/lib/factory/createAutoBeApplication.js.map +1 -1
- package/lib/factory/createAutoBeContext.js +6 -5
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/index.mjs +3914 -2594
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +5 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.d.ts +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +18 -3
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +5 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +19 -7
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +3 -2
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.d.ts +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +2 -2
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +1 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +2 -2
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +1 -1
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +1 -1
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +36 -23
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
- package/lib/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.d.ts +22 -42
- package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js +2 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +5 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +20 -7
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.d.ts +3 -0
- package/lib/orchestrate/interface/histories/{transformInterfacePrerequisiteHistories.js → transformInterfaceCommonPrerequisiteHistories.js} +4 -4
- package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.d.ts +6 -1
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +31 -23
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.d.ts +6 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +22 -6
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.d.ts +4 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +27 -6
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.d.ts +5 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +21 -5
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.d.ts +3 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js +102 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +5 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +20 -4
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +45 -11
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +277 -37
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +4 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +69 -70
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.d.ts +6 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +28 -13
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +4 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +11 -8
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.d.ts +5 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +36 -21
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +260 -29
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.d.ts +5 -0
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +713 -0
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.d.ts +5 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +83 -53
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js +41 -7
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +0 -38
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +6 -10
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.d.ts +52 -0
- package/lib/orchestrate/{common/structures/IAutoBeCommonCorrectDateApplication.js → interface/structures/IAutoBeInterfacePrerequisitesApplication.js} +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +0 -33
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.d.ts +6 -2
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +105 -5
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +20 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
- package/lib/orchestrate/interface/utils/OperationValidator.d.ts +3 -4
- package/lib/orchestrate/interface/utils/OperationValidator.js +1 -1
- package/lib/orchestrate/interface/utils/OperationValidator.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.d.ts +4 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +19 -8
- 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.d.ts +6 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +20 -6
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.js +3 -3
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +6 -3
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +12 -6
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
- package/lib/orchestrate/{common/histories/transformCommonCorrectDateHistories.d.ts → realize/histories/transformRealizeCorrectCastingHistories.d.ts} +1 -2
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +32 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +14 -22
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +6 -6
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +8 -2
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/orchestrate/realize/internal/compileRealizeFiles.js +1 -2
- package/lib/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.d.ts +2 -1
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js +119 -42
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.js +82 -52
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +128 -88
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js +117 -54
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +52 -26
- package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +44 -34
- package/lib/orchestrate/realize/utils/InternalFileSystem.js +1 -1
- package/lib/orchestrate/realize/utils/InternalFileSystem.js.map +1 -1
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -5
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +8 -3
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +44 -17
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +4 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js +24 -9
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -1
- package/lib/orchestrate/realize/utils/printErrorHints.d.ts +8 -0
- package/lib/orchestrate/realize/utils/printErrorHints.js +48 -0
- package/lib/orchestrate/realize/utils/printErrorHints.js.map +1 -0
- package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +1 -0
- package/lib/orchestrate/realize/utils/replaceImportStatements.js +93 -53
- package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +5 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +11 -7
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.d.ts +7 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +35 -96
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.d.ts +6 -3
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +33 -77
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +5 -1
- package/lib/orchestrate/test/histories/transformTestWriteHistories.js +111 -94
- package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTest.js +20 -14
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +4 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +81 -50
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +31 -13
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.d.ts +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +18 -7
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.d.ts +5 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js +20 -12
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.d.ts +4 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +46 -25
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +9 -5
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectInvalidRequestApplication.d.ts +8 -2
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +11 -7
- package/lib/orchestrate/test/utils/getPrerequisites.d.ts +5 -0
- package/lib/orchestrate/test/utils/getPrerequisites.js +36 -0
- package/lib/orchestrate/test/utils/getPrerequisites.js.map +1 -0
- package/lib/orchestrate/test/utils/getReferenceIds.js +1 -1
- package/lib/orchestrate/test/utils/getReferenceIds.js.map +1 -1
- package/package.json +5 -5
- package/src/AutoBeAgent.ts +17 -1
- package/src/AutoBeMockAgent.ts +1 -0
- package/src/constants/AutoBeSystemPromptConstant.ts +21 -21
- package/src/context/IAutoBeApplication.ts +101 -6
- package/src/context/IAutoBeApplicationProps.ts +6 -2
- package/src/factory/createAgenticaHistory.ts +11 -5
- package/src/factory/createAutoBeContext.ts +6 -5
- package/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.ts +5 -1
- package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +16 -0
- package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +22 -7
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +3 -2
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +2 -1
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +3 -2
- package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +2 -2
- package/src/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.ts +25 -45
- package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +2 -1
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +23 -9
- package/src/orchestrate/interface/histories/{transformInterfacePrerequisiteHistories.ts → transformInterfaceCommonPrerequisiteHistories.ts} +1 -1
- package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +33 -24
- package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +26 -9
- package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +30 -6
- package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +24 -7
- package/src/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.ts +118 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +23 -6
- package/src/orchestrate/interface/orchestrateInterface.ts +65 -20
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +22 -12
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +34 -47
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +40 -28
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +9 -3
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +51 -35
- package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +274 -0
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +52 -33
- package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +1 -1
- package/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.ts +0 -39
- package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +6 -10
- package/src/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.ts +58 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +0 -34
- package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +92 -4
- package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +19 -1
- package/src/orchestrate/interface/utils/OperationValidator.ts +9 -7
- package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +20 -6
- package/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts +24 -9
- package/src/orchestrate/prisma/orchestratePrisma.ts +7 -3
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +5 -1
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +15 -10
- package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +44 -0
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +13 -24
- package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +6 -6
- package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +6 -4
- package/src/orchestrate/realize/internal/compileRealizeFiles.ts +1 -5
- package/src/orchestrate/realize/orchestRateRealizeCorrectCasting.ts +102 -16
- package/src/orchestrate/realize/orchestrateRealize.ts +121 -81
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +50 -7
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +14 -4
- package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +54 -29
- package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +46 -35
- package/src/orchestrate/realize/utils/InternalFileSystem.ts +1 -1
- package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -5
- package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +54 -22
- package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +28 -16
- package/src/orchestrate/realize/utils/printErrorHints.ts +55 -0
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +99 -97
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +14 -7
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +50 -115
- package/src/orchestrate/test/histories/transformTestScenarioReviewHistories.ts +41 -111
- package/src/orchestrate/test/histories/transformTestWriteHistories.ts +35 -12
- package/src/orchestrate/test/orchestrateTest.ts +19 -13
- package/src/orchestrate/test/orchestrateTestCorrect.ts +71 -51
- package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +13 -1
- package/src/orchestrate/test/orchestrateTestScenario.ts +27 -17
- package/src/orchestrate/test/orchestrateTestScenarioReview.ts +32 -19
- package/src/orchestrate/test/orchestrateTestWrite.ts +20 -10
- package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +9 -228
- package/src/orchestrate/test/structures/IAutoBeTestCorrectInvalidRequestApplication.ts +8 -2
- package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +11 -78
- package/src/orchestrate/test/utils/getPrerequisites.ts +51 -0
- package/src/orchestrate/test/utils/getReferenceIds.ts +2 -1
- package/lib/orchestrate/common/histories/transformCommonCorrectDateHistories.js +0 -48
- package/lib/orchestrate/common/histories/transformCommonCorrectDateHistories.js.map +0 -1
- package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.d.ts +0 -35
- package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.d.ts +0 -3
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.js.map +0 -1
- package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.d.ts +0 -6
- package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.js +0 -22
- package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.js.map +0 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.d.ts +0 -4
- package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.js +0 -540
- package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.js.map +0 -1
- package/src/orchestrate/common/histories/transformCommonCorrectDateHistories.ts +0 -60
- package/src/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.ts +0 -40
- package/src/orchestrate/interface/utils/OpenApiEndpointComparator.ts +0 -23
- package/src/orchestrate/realize/orchestrateRealizeCorrectDate.ts +0 -372
|
@@ -7,11 +7,12 @@ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromp
|
|
|
7
7
|
import { AutoBeState } from "../../../context/AutoBeState";
|
|
8
8
|
import { transformInterfaceAssetHistories } from "./transformInterfaceAssetHistories";
|
|
9
9
|
|
|
10
|
-
export const transformInterfaceComplementHistories = (
|
|
11
|
-
state: AutoBeState
|
|
12
|
-
|
|
13
|
-
missed: string[]
|
|
14
|
-
|
|
10
|
+
export const transformInterfaceComplementHistories = (props: {
|
|
11
|
+
state: AutoBeState;
|
|
12
|
+
instruction: string;
|
|
13
|
+
missed: string[];
|
|
14
|
+
document: AutoBeOpenApi.IDocument;
|
|
15
|
+
}): Array<
|
|
15
16
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
16
17
|
> => [
|
|
17
18
|
{
|
|
@@ -20,7 +21,7 @@ export const transformInterfaceComplementHistories = (
|
|
|
20
21
|
created_at: new Date().toISOString(),
|
|
21
22
|
text: AutoBeSystemPromptConstant.INTERFACE_OPERATION,
|
|
22
23
|
},
|
|
23
|
-
...transformInterfaceAssetHistories(state),
|
|
24
|
+
...transformInterfaceAssetHistories(props.state),
|
|
24
25
|
{
|
|
25
26
|
type: "systemMessage",
|
|
26
27
|
id: v7(),
|
|
@@ -38,33 +39,41 @@ export const transformInterfaceComplementHistories = (
|
|
|
38
39
|
id: v7(),
|
|
39
40
|
created_at: new Date().toISOString(),
|
|
40
41
|
text: StringUtil.trim`
|
|
42
|
+
## API Design Instructions
|
|
43
|
+
|
|
44
|
+
The following API-specific instructions were extracted by AI from
|
|
45
|
+
the user's utterances. These focus ONLY on API interface design aspects
|
|
46
|
+
such as endpoint patterns, request/response formats, DTO schemas,
|
|
47
|
+
and operation specifications.
|
|
48
|
+
|
|
49
|
+
Apply these instructions when completing the missing schema types.
|
|
50
|
+
Focus on ensuring the schemas align with the overall API design patterns
|
|
51
|
+
and data structure requirements. If the instructions are not relevant
|
|
52
|
+
to the specific schemas you need to create, you may ignore them.
|
|
53
|
+
|
|
54
|
+
${props.instruction}
|
|
55
|
+
|
|
56
|
+
## Operations
|
|
57
|
+
|
|
41
58
|
Here is the OpenAPI operations what you AI have made:
|
|
42
59
|
|
|
43
60
|
\`\`\`json
|
|
44
|
-
${JSON.stringify(document.operations)}
|
|
61
|
+
${JSON.stringify(props.document.operations)}
|
|
45
62
|
\`\`\`
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
type: "assistantMessage",
|
|
50
|
-
id: v7(),
|
|
51
|
-
created_at: new Date().toISOString(),
|
|
52
|
-
text: StringUtil.trim`
|
|
63
|
+
|
|
64
|
+
## Schemas
|
|
65
|
+
|
|
53
66
|
Here is the OpenAPI schemas what you AI have made:
|
|
54
67
|
|
|
55
68
|
\`\`\`json
|
|
56
|
-
${JSON.stringify(document.components.schemas)}
|
|
69
|
+
${JSON.stringify(props.document.components.schemas)}
|
|
57
70
|
\`\`\`
|
|
58
|
-
`,
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
type: "assistantMessage",
|
|
62
|
-
id: v7(),
|
|
63
|
-
created_at: new Date().toISOString(),
|
|
64
|
-
text: StringUtil.trim`
|
|
65
|
-
You AI have missed below schema types:
|
|
66
71
|
|
|
67
|
-
|
|
72
|
+
## Missed Types
|
|
73
|
+
|
|
74
|
+
However, you AI have missed below schema types:
|
|
75
|
+
|
|
76
|
+
${props.missed.map((s) => `- ${s}`).join("\n")}
|
|
68
77
|
`,
|
|
69
78
|
},
|
|
70
79
|
];
|
|
@@ -8,11 +8,12 @@ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromp
|
|
|
8
8
|
import { AutoBeState } from "../../../context/AutoBeState";
|
|
9
9
|
import { transformInterfaceAssetHistories } from "./transformInterfaceAssetHistories";
|
|
10
10
|
|
|
11
|
-
export const transformInterfaceEndpointHistories = (
|
|
12
|
-
state: AutoBeState
|
|
13
|
-
group: AutoBeInterfaceGroup
|
|
14
|
-
authorizations: AutoBeOpenApi.IOperation[]
|
|
15
|
-
|
|
11
|
+
export const transformInterfaceEndpointHistories = (props: {
|
|
12
|
+
state: AutoBeState;
|
|
13
|
+
group: AutoBeInterfaceGroup;
|
|
14
|
+
authorizations: AutoBeOpenApi.IOperation[];
|
|
15
|
+
instruction: string;
|
|
16
|
+
}): Array<
|
|
16
17
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
17
18
|
> => [
|
|
18
19
|
{
|
|
@@ -21,25 +22,41 @@ export const transformInterfaceEndpointHistories = (
|
|
|
21
22
|
created_at: new Date().toISOString(),
|
|
22
23
|
text: AutoBeSystemPromptConstant.INTERFACE_ENDPOINT,
|
|
23
24
|
},
|
|
24
|
-
...transformInterfaceAssetHistories(state),
|
|
25
|
+
...transformInterfaceAssetHistories(props.state),
|
|
25
26
|
{
|
|
26
27
|
type: "assistantMessage",
|
|
27
28
|
id: v7(),
|
|
28
29
|
created_at: new Date().toISOString(),
|
|
29
30
|
text: StringUtil.trim`
|
|
31
|
+
## API Design Instructions
|
|
32
|
+
|
|
33
|
+
The following API-specific instructions were extracted by AI from
|
|
34
|
+
the user's utterances. These focus ONLY on API interface design aspects
|
|
35
|
+
such as endpoint patterns, request/response formats, DTO schemas,
|
|
36
|
+
and operation specifications.
|
|
37
|
+
|
|
38
|
+
Apply these instructions when designing endpoints for the ${props.group.name} group.
|
|
39
|
+
Consider the specified URL patterns, HTTP methods, parameter structures,
|
|
40
|
+
and response formats. If the instructions are not relevant to this specific
|
|
41
|
+
endpoint group, you may ignore them.
|
|
42
|
+
|
|
43
|
+
${props.instruction}
|
|
44
|
+
|
|
45
|
+
## Group Information
|
|
46
|
+
|
|
30
47
|
Here is the target group for the endpoints:
|
|
31
48
|
|
|
32
49
|
\`\`\`json
|
|
33
|
-
${JSON.stringify(group)}
|
|
50
|
+
${JSON.stringify(props.group)}
|
|
34
51
|
\`\`\`
|
|
35
52
|
|
|
36
|
-
|
|
53
|
+
## Already Existing Operations
|
|
37
54
|
|
|
38
55
|
These operations already exist. Do NOT create similar endpoints:
|
|
39
56
|
|
|
40
57
|
\`\`\`json
|
|
41
58
|
${JSON.stringify(
|
|
42
|
-
authorizations.map((op) => ({
|
|
59
|
+
props.authorizations.map((op) => ({
|
|
43
60
|
path: op.path,
|
|
44
61
|
method: op.method,
|
|
45
62
|
name: op.name,
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
+
import { StringUtil } from "@autobe/utils";
|
|
2
3
|
import { v7 } from "uuid";
|
|
3
4
|
|
|
4
5
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
5
6
|
import { AutoBeState } from "../../../context/AutoBeState";
|
|
6
7
|
import { transformInterfaceAssetHistories } from "./transformInterfaceAssetHistories";
|
|
7
|
-
import {
|
|
8
|
+
import { transformInterfaceCommonPrerequisiteHistories } from "./transformInterfaceCommonPrerequisiteHistories";
|
|
8
9
|
|
|
9
|
-
export const transformInterfaceGroupHistories = (
|
|
10
|
-
state: AutoBeState
|
|
11
|
-
|
|
10
|
+
export const transformInterfaceGroupHistories = (props: {
|
|
11
|
+
state: AutoBeState;
|
|
12
|
+
instruction: string;
|
|
13
|
+
}): Array<
|
|
12
14
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
13
15
|
> => {
|
|
14
|
-
const prerequisite =
|
|
16
|
+
const prerequisite = transformInterfaceCommonPrerequisiteHistories(
|
|
17
|
+
props.state,
|
|
18
|
+
);
|
|
15
19
|
if (prerequisite !== null) return prerequisite;
|
|
16
20
|
|
|
17
21
|
return [
|
|
@@ -21,12 +25,32 @@ export const transformInterfaceGroupHistories = (
|
|
|
21
25
|
type: "systemMessage",
|
|
22
26
|
text: AutoBeSystemPromptConstant.INTERFACE_ENDPOINT,
|
|
23
27
|
},
|
|
24
|
-
...transformInterfaceAssetHistories(state),
|
|
28
|
+
...transformInterfaceAssetHistories(props.state),
|
|
25
29
|
{
|
|
26
30
|
id: v7(),
|
|
27
31
|
created_at: new Date().toISOString(),
|
|
28
32
|
type: "systemMessage",
|
|
29
33
|
text: AutoBeSystemPromptConstant.INTERFACE_GROUP,
|
|
30
34
|
},
|
|
35
|
+
{
|
|
36
|
+
id: v7(),
|
|
37
|
+
created_at: new Date().toISOString(),
|
|
38
|
+
type: "assistantMessage",
|
|
39
|
+
text: StringUtil.trim`
|
|
40
|
+
## API Design Instructions
|
|
41
|
+
|
|
42
|
+
The following API-specific instructions were extracted by AI from
|
|
43
|
+
the user's utterances. These focus ONLY on API interface design aspects
|
|
44
|
+
such as endpoint patterns, request/response formats, DTO schemas,
|
|
45
|
+
and operation specifications.
|
|
46
|
+
|
|
47
|
+
Apply these instructions when organizing API endpoints into logical groups.
|
|
48
|
+
Consider how to structure and categorize endpoints based on business domains,
|
|
49
|
+
resource types, or functional areas. If the instructions are not relevant
|
|
50
|
+
to endpoint grouping and organization, you may ignore them.
|
|
51
|
+
|
|
52
|
+
${props.instruction}
|
|
53
|
+
`,
|
|
54
|
+
},
|
|
31
55
|
];
|
|
32
56
|
};
|
|
@@ -7,13 +7,14 @@ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromp
|
|
|
7
7
|
import { AutoBeState } from "../../../context/AutoBeState";
|
|
8
8
|
import { transformInterfaceAssetHistories } from "./transformInterfaceAssetHistories";
|
|
9
9
|
|
|
10
|
-
export const transformInterfaceOperationHistories = (
|
|
11
|
-
state: AutoBeState
|
|
12
|
-
endpoints: AutoBeOpenApi.IEndpoint[]
|
|
13
|
-
|
|
10
|
+
export const transformInterfaceOperationHistories = (props: {
|
|
11
|
+
state: AutoBeState;
|
|
12
|
+
endpoints: AutoBeOpenApi.IEndpoint[];
|
|
13
|
+
instruction: string;
|
|
14
|
+
}): Array<
|
|
14
15
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
15
16
|
> => {
|
|
16
|
-
const analyze: AutoBeAnalyzeHistory = state.analyze!;
|
|
17
|
+
const analyze: AutoBeAnalyzeHistory = props.state.analyze!;
|
|
17
18
|
return [
|
|
18
19
|
{
|
|
19
20
|
type: "systemMessage",
|
|
@@ -21,7 +22,7 @@ export const transformInterfaceOperationHistories = (
|
|
|
21
22
|
created_at: new Date().toISOString(),
|
|
22
23
|
text: AutoBeSystemPromptConstant.INTERFACE_OPERATION,
|
|
23
24
|
},
|
|
24
|
-
...transformInterfaceAssetHistories(state),
|
|
25
|
+
...transformInterfaceAssetHistories(props.state),
|
|
25
26
|
{
|
|
26
27
|
type: "systemMessage",
|
|
27
28
|
id: v7(),
|
|
@@ -44,10 +45,26 @@ export const transformInterfaceOperationHistories = (
|
|
|
44
45
|
id: v7(),
|
|
45
46
|
created_at: new Date().toISOString(),
|
|
46
47
|
text: StringUtil.trim`
|
|
48
|
+
## API Design Instructions
|
|
49
|
+
|
|
50
|
+
The following API-specific instructions were extracted by AI from
|
|
51
|
+
the user's utterances. These focus ONLY on API interface design aspects
|
|
52
|
+
such as endpoint patterns, request/response formats, DTO schemas,
|
|
53
|
+
and operation specifications.
|
|
54
|
+
|
|
55
|
+
Apply these instructions when designing the detailed operation specifications
|
|
56
|
+
for each endpoint. Consider parameter types, request/response structures,
|
|
57
|
+
error handling, and API behavior patterns. If the instructions are not
|
|
58
|
+
relevant to the operations you need to implement, you may ignore them.
|
|
59
|
+
|
|
60
|
+
${props.instruction}
|
|
61
|
+
|
|
62
|
+
## Operations
|
|
63
|
+
|
|
47
64
|
You have to make API operations for the given endpoints:
|
|
48
65
|
|
|
49
66
|
\`\`\`json
|
|
50
|
-
${JSON.stringify(endpoints)}
|
|
67
|
+
${JSON.stringify(props.endpoints)}
|
|
51
68
|
\`\`\`
|
|
52
69
|
|
|
53
70
|
If there is a content in the failure, it is to explain why it failed before.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
+
import { AutoBeOpenApi } from "@autobe/interface";
|
|
3
|
+
import { StringUtil } from "@autobe/utils";
|
|
4
|
+
import { OpenApiTypeChecker } from "@samchon/openapi";
|
|
5
|
+
import { v7 } from "uuid";
|
|
6
|
+
|
|
7
|
+
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
8
|
+
import { getReferenceIds } from "../../test/utils/getReferenceIds";
|
|
9
|
+
|
|
10
|
+
export const transformInterfacePrerequisitesHistories = (
|
|
11
|
+
document: AutoBeOpenApi.IDocument,
|
|
12
|
+
include: AutoBeOpenApi.IOperation[],
|
|
13
|
+
): Array<
|
|
14
|
+
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
15
|
+
> => {
|
|
16
|
+
const domainSchemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
|
|
17
|
+
{};
|
|
18
|
+
const visit = (key: string) =>
|
|
19
|
+
OpenApiTypeChecker.visit({
|
|
20
|
+
schema: {
|
|
21
|
+
$ref: `#/components/schemas/${key}`,
|
|
22
|
+
},
|
|
23
|
+
components: document.components,
|
|
24
|
+
closure: (next) => {
|
|
25
|
+
if (OpenApiTypeChecker.isReference(next))
|
|
26
|
+
domainSchemas[next.$ref.split("/").pop()!] =
|
|
27
|
+
document.components.schemas[next.$ref.split("/").pop()!];
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
for (const op of include) {
|
|
31
|
+
if (op.requestBody) visit(op.requestBody.typeName);
|
|
32
|
+
if (op.responseBody) visit(op.responseBody.typeName);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return [
|
|
36
|
+
{
|
|
37
|
+
type: "systemMessage",
|
|
38
|
+
id: v7(),
|
|
39
|
+
created_at: new Date().toISOString(),
|
|
40
|
+
text: AutoBeSystemPromptConstant.INTERFACE_PREREQUISITE,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: "assistantMessage",
|
|
44
|
+
id: v7(),
|
|
45
|
+
created_at: new Date().toISOString(),
|
|
46
|
+
text: StringUtil.trim`
|
|
47
|
+
## Document Overview
|
|
48
|
+
|
|
49
|
+
### Entire API Operations
|
|
50
|
+
|
|
51
|
+
All operations in this project for prerequisite references.
|
|
52
|
+
|
|
53
|
+
These are the complete list of API endpoints that can be used
|
|
54
|
+
as prerequisites. You should select appropriate operations from
|
|
55
|
+
this list when establishing dependency chains.
|
|
56
|
+
|
|
57
|
+
\`\`\`json
|
|
58
|
+
${JSON.stringify({
|
|
59
|
+
operations: document.operations
|
|
60
|
+
.filter(
|
|
61
|
+
(op) => op.authorizationType === null && op.method === "post",
|
|
62
|
+
)
|
|
63
|
+
.map((op) => {
|
|
64
|
+
return {
|
|
65
|
+
...op,
|
|
66
|
+
prerequisites: undefined,
|
|
67
|
+
};
|
|
68
|
+
}),
|
|
69
|
+
})}
|
|
70
|
+
\`\`\`
|
|
71
|
+
|
|
72
|
+
### Entire Schema Definitions
|
|
73
|
+
|
|
74
|
+
Data structure definitions to understand entity relationships.
|
|
75
|
+
|
|
76
|
+
Use these schemas to identify parent-child relationships and
|
|
77
|
+
data dependencies between operations.
|
|
78
|
+
|
|
79
|
+
\`\`\`json
|
|
80
|
+
${JSON.stringify({
|
|
81
|
+
components: {
|
|
82
|
+
schemas: document.components.schemas,
|
|
83
|
+
},
|
|
84
|
+
})}
|
|
85
|
+
\`\`\`
|
|
86
|
+
|
|
87
|
+
## Target Operations and Schemas
|
|
88
|
+
|
|
89
|
+
### Target Operations
|
|
90
|
+
|
|
91
|
+
Operations requiring prerequisite analysis.
|
|
92
|
+
|
|
93
|
+
For each of these operations, analyze if they need any prerequisites
|
|
94
|
+
from the available operations above. Add prerequisites only when there
|
|
95
|
+
are genuine dependencies like resource existence checks or state validations.
|
|
96
|
+
|
|
97
|
+
\`\`\`json
|
|
98
|
+
${JSON.stringify(
|
|
99
|
+
include.map((op) => {
|
|
100
|
+
return {
|
|
101
|
+
...op,
|
|
102
|
+
requiredIds: getReferenceIds({ document, operation: op }),
|
|
103
|
+
};
|
|
104
|
+
}),
|
|
105
|
+
)}
|
|
106
|
+
\`\`\`
|
|
107
|
+
|
|
108
|
+
### Domain Schemas
|
|
109
|
+
|
|
110
|
+
Schema definitions for the target operations.
|
|
111
|
+
|
|
112
|
+
\`\`\`json
|
|
113
|
+
${JSON.stringify(domainSchemas)}
|
|
114
|
+
\`\`\`
|
|
115
|
+
`,
|
|
116
|
+
},
|
|
117
|
+
];
|
|
118
|
+
};
|
|
@@ -7,10 +7,11 @@ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromp
|
|
|
7
7
|
import { AutoBeState } from "../../../context/AutoBeState";
|
|
8
8
|
import { transformInterfaceAssetHistories } from "./transformInterfaceAssetHistories";
|
|
9
9
|
|
|
10
|
-
export const transformInterfaceSchemaHistories = (
|
|
11
|
-
state: AutoBeState
|
|
12
|
-
operations: AutoBeOpenApi.IOperation[]
|
|
13
|
-
|
|
10
|
+
export const transformInterfaceSchemaHistories = (props: {
|
|
11
|
+
state: AutoBeState;
|
|
12
|
+
operations: AutoBeOpenApi.IOperation[];
|
|
13
|
+
instruction: string;
|
|
14
|
+
}): Array<
|
|
14
15
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
15
16
|
> => [
|
|
16
17
|
{
|
|
@@ -19,16 +20,32 @@ export const transformInterfaceSchemaHistories = (
|
|
|
19
20
|
created_at: new Date().toISOString(),
|
|
20
21
|
text: AutoBeSystemPromptConstant.INTERFACE_SCHEMA,
|
|
21
22
|
},
|
|
22
|
-
...transformInterfaceAssetHistories(state),
|
|
23
|
+
...transformInterfaceAssetHistories(props.state),
|
|
23
24
|
{
|
|
24
25
|
type: "assistantMessage",
|
|
25
26
|
id: v7(),
|
|
26
27
|
created_at: new Date().toISOString(),
|
|
27
28
|
text: StringUtil.trim`
|
|
29
|
+
## API Design Instructions
|
|
30
|
+
|
|
31
|
+
The following API-specific instructions were extracted by AI from
|
|
32
|
+
the user's utterances. These focus ONLY on API interface design aspects
|
|
33
|
+
such as endpoint patterns, request/response formats, DTO schemas,
|
|
34
|
+
and operation specifications.
|
|
35
|
+
|
|
36
|
+
Apply these instructions when creating JSON schema components for the operations.
|
|
37
|
+
Focus on data structure design, field naming conventions, validation rules,
|
|
38
|
+
and type definitions. If the instructions are not relevant to the schema
|
|
39
|
+
components you need to create, you may ignore them.
|
|
40
|
+
|
|
41
|
+
${props.instruction}
|
|
42
|
+
|
|
43
|
+
## Operations
|
|
44
|
+
|
|
28
45
|
Here is the list of API operations you have to implement its types:
|
|
29
46
|
|
|
30
47
|
\`\`\`json
|
|
31
|
-
${JSON.stringify(operations)}
|
|
48
|
+
${JSON.stringify(props.operations)}
|
|
32
49
|
\`\`\`
|
|
33
50
|
`,
|
|
34
51
|
},
|
|
@@ -6,7 +6,12 @@ import {
|
|
|
6
6
|
AutoBeInterfaceHistory,
|
|
7
7
|
AutoBeOpenApi,
|
|
8
8
|
} from "@autobe/interface";
|
|
9
|
-
import {
|
|
9
|
+
import { AutoBeInterfacePrerequisite } from "@autobe/interface/src/histories/contents/AutoBeInterfacePrerequisite";
|
|
10
|
+
import {
|
|
11
|
+
AutoBeOpenApiEndpointComparator,
|
|
12
|
+
missedOpenApiSchemas,
|
|
13
|
+
revertOpenApiAccessor,
|
|
14
|
+
} from "@autobe/utils";
|
|
10
15
|
import { ILlmSchema } from "@samchon/openapi";
|
|
11
16
|
import { HashMap, Pair } from "tstl";
|
|
12
17
|
import { v7 } from "uuid";
|
|
@@ -19,8 +24,10 @@ import { orchestrateInterfaceComplement } from "./orchestrateInterfaceComplement
|
|
|
19
24
|
import { orchestrateInterfaceEndpoints } from "./orchestrateInterfaceEndpoints";
|
|
20
25
|
import { orchestrateInterfaceGroups } from "./orchestrateInterfaceGroups";
|
|
21
26
|
import { orchestrateInterfaceOperations } from "./orchestrateInterfaceOperations";
|
|
27
|
+
import { orchestrateInterfacePrerequisites } from "./orchestrateInterfacePrerequisites";
|
|
22
28
|
import { orchestrateInterfaceSchemas } from "./orchestrateInterfaceSchemas";
|
|
23
29
|
import { orchestrateInterfaceSchemasReview } from "./orchestrateInterfaceSchemasReview";
|
|
30
|
+
import { JsonSchemaFactory } from "./utils/JsonSchemaFactory";
|
|
24
31
|
|
|
25
32
|
export const orchestrateInterface =
|
|
26
33
|
<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>) =>
|
|
@@ -45,28 +52,38 @@ export const orchestrateInterface =
|
|
|
45
52
|
type: "interfaceStart",
|
|
46
53
|
id: v7(),
|
|
47
54
|
created_at: start.toISOString(),
|
|
48
|
-
reason: props.
|
|
55
|
+
reason: props.instruction,
|
|
49
56
|
step: ctx.state().analyze?.step ?? 0,
|
|
50
57
|
});
|
|
51
58
|
|
|
52
59
|
// ENDPOINTS
|
|
53
|
-
const init: AutoBeInterfaceGroupsEvent =
|
|
54
|
-
|
|
60
|
+
const init: AutoBeInterfaceGroupsEvent = await orchestrateInterfaceGroups(
|
|
61
|
+
ctx,
|
|
62
|
+
{
|
|
63
|
+
instruction: props.instruction,
|
|
64
|
+
},
|
|
65
|
+
);
|
|
55
66
|
ctx.dispatch(init);
|
|
56
67
|
|
|
57
68
|
// AUTHORIZATION
|
|
58
69
|
const authorizations: AutoBeInterfaceAuthorization[] =
|
|
59
|
-
await orchestrateInterfaceAuthorizations(ctx);
|
|
60
|
-
|
|
61
|
-
const authOperations = authorizations
|
|
70
|
+
await orchestrateInterfaceAuthorizations(ctx, props.instruction);
|
|
71
|
+
const authOperations: AutoBeOpenApi.IOperation[] = authorizations
|
|
62
72
|
.map((authorization) => authorization.operations)
|
|
63
73
|
.flat();
|
|
64
74
|
|
|
65
75
|
// ENDPOINTS & OPERATIONS
|
|
66
76
|
const endpoints: AutoBeOpenApi.IEndpoint[] =
|
|
67
|
-
await orchestrateInterfaceEndpoints(ctx,
|
|
77
|
+
await orchestrateInterfaceEndpoints(ctx, {
|
|
78
|
+
groups: init.groups,
|
|
79
|
+
authorizations: authOperations,
|
|
80
|
+
instruction: props.instruction,
|
|
81
|
+
});
|
|
68
82
|
const firstOperations: AutoBeOpenApi.IOperation[] =
|
|
69
|
-
await orchestrateInterfaceOperations(ctx,
|
|
83
|
+
await orchestrateInterfaceOperations(ctx, {
|
|
84
|
+
endpoints,
|
|
85
|
+
instruction: props.instruction,
|
|
86
|
+
});
|
|
70
87
|
const operations: AutoBeOpenApi.IOperation[] = new HashMap<
|
|
71
88
|
AutoBeOpenApi.IEndpoint,
|
|
72
89
|
AutoBeOpenApi.IOperation
|
|
@@ -81,8 +98,8 @@ export const orchestrateInterface =
|
|
|
81
98
|
o, // early inserted be kept
|
|
82
99
|
),
|
|
83
100
|
),
|
|
84
|
-
|
|
85
|
-
|
|
101
|
+
AutoBeOpenApiEndpointComparator.hashCode,
|
|
102
|
+
AutoBeOpenApiEndpointComparator.equals,
|
|
86
103
|
)
|
|
87
104
|
.toJSON()
|
|
88
105
|
.map((it) => it.second);
|
|
@@ -92,29 +109,57 @@ export const orchestrateInterface =
|
|
|
92
109
|
operations,
|
|
93
110
|
components: {
|
|
94
111
|
authorization: ctx.state().analyze?.roles ?? [],
|
|
95
|
-
schemas: await orchestrateInterfaceSchemas(ctx,
|
|
112
|
+
schemas: await orchestrateInterfaceSchemas(ctx, {
|
|
113
|
+
instruction: props.instruction,
|
|
114
|
+
operations,
|
|
115
|
+
}),
|
|
96
116
|
},
|
|
97
117
|
};
|
|
98
118
|
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
119
|
+
const complement = async () =>
|
|
120
|
+
Object.assign(
|
|
121
|
+
document.components.schemas,
|
|
122
|
+
await orchestrateInterfaceComplement(ctx, {
|
|
123
|
+
instruction: props.instruction,
|
|
124
|
+
document,
|
|
125
|
+
}),
|
|
126
|
+
);
|
|
127
|
+
await complement();
|
|
104
128
|
|
|
105
|
-
|
|
129
|
+
Object.assign(
|
|
130
|
+
document.components.schemas,
|
|
106
131
|
await orchestrateInterfaceSchemasReview(
|
|
107
132
|
ctx,
|
|
108
133
|
operations,
|
|
109
134
|
document.components.schemas,
|
|
110
|
-
)
|
|
111
|
-
|
|
135
|
+
),
|
|
136
|
+
);
|
|
137
|
+
if (missedOpenApiSchemas(document).length !== 0) await complement();
|
|
138
|
+
|
|
139
|
+
JsonSchemaFactory.finalize({
|
|
140
|
+
document,
|
|
141
|
+
application: ctx.state().prisma!.result.data,
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// CONNECT PRE-REQUISITES
|
|
145
|
+
const prerequisites: AutoBeInterfacePrerequisite[] =
|
|
146
|
+
await orchestrateInterfacePrerequisites(ctx, document);
|
|
147
|
+
document.operations.forEach((op) => {
|
|
148
|
+
op.prerequisites =
|
|
149
|
+
prerequisites.find(
|
|
150
|
+
(p) => p.endpoint.method === op.method && p.endpoint.path === op.path,
|
|
151
|
+
)?.prerequisites ?? [];
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// NORMALIZE ACCESSORS
|
|
155
|
+
revertOpenApiAccessor(document);
|
|
112
156
|
|
|
113
157
|
// DO COMPILE
|
|
114
158
|
return ctx.dispatch({
|
|
115
159
|
type: "interfaceComplete",
|
|
116
160
|
id: v7(),
|
|
117
161
|
document,
|
|
162
|
+
missed: missedOpenApiSchemas(document),
|
|
118
163
|
authorizations,
|
|
119
164
|
created_at: new Date().toISOString(),
|
|
120
165
|
elapsed: new Date().getTime() - start.getTime(),
|
|
@@ -20,7 +20,10 @@ import { IAutoBeInterfaceAuthorizationsApplication } from "./structures/IAutoBeI
|
|
|
20
20
|
|
|
21
21
|
export async function orchestrateInterfaceAuthorizations<
|
|
22
22
|
Model extends ILlmSchema.Model,
|
|
23
|
-
>(
|
|
23
|
+
>(
|
|
24
|
+
ctx: AutoBeContext<Model>,
|
|
25
|
+
instruction: string,
|
|
26
|
+
): Promise<AutoBeInterfaceAuthorization[]> {
|
|
24
27
|
const roles: AutoBeAnalyzeRole[] = ctx.state().analyze?.roles ?? [];
|
|
25
28
|
const progress: AutoBeProgressEventBase = {
|
|
26
29
|
total: roles.length,
|
|
@@ -29,12 +32,12 @@ export async function orchestrateInterfaceAuthorizations<
|
|
|
29
32
|
const authorizations: AutoBeInterfaceAuthorization[] =
|
|
30
33
|
await executeCachedBatch(
|
|
31
34
|
roles.map((role) => async (promptCacheKey) => {
|
|
32
|
-
const event: AutoBeInterfaceAuthorizationEvent = await process(
|
|
33
|
-
ctx,
|
|
35
|
+
const event: AutoBeInterfaceAuthorizationEvent = await process(ctx, {
|
|
34
36
|
role,
|
|
35
37
|
progress,
|
|
36
38
|
promptCacheKey,
|
|
37
|
-
|
|
39
|
+
instruction,
|
|
40
|
+
});
|
|
38
41
|
ctx.dispatch(event);
|
|
39
42
|
return {
|
|
40
43
|
role: role.name,
|
|
@@ -48,9 +51,12 @@ export async function orchestrateInterfaceAuthorizations<
|
|
|
48
51
|
|
|
49
52
|
async function process<Model extends ILlmSchema.Model>(
|
|
50
53
|
ctx: AutoBeContext<Model>,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
props: {
|
|
55
|
+
instruction: string;
|
|
56
|
+
role: AutoBeAnalyzeRole;
|
|
57
|
+
progress: AutoBeProgressEventBase;
|
|
58
|
+
promptCacheKey: string;
|
|
59
|
+
},
|
|
54
60
|
): Promise<AutoBeInterfaceAuthorizationEvent> {
|
|
55
61
|
const pointer: IPointer<IAutoBeInterfaceAuthorizationsApplication.IProps | null> =
|
|
56
62
|
{
|
|
@@ -58,16 +64,20 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
58
64
|
};
|
|
59
65
|
const { tokenUsage } = await ctx.conversate({
|
|
60
66
|
source: "interfaceAuthorization",
|
|
61
|
-
histories: transformInterfaceAuthorizationsHistories(
|
|
67
|
+
histories: transformInterfaceAuthorizationsHistories({
|
|
68
|
+
state: ctx.state(),
|
|
69
|
+
instruction: props.instruction,
|
|
70
|
+
role: props.role,
|
|
71
|
+
}),
|
|
62
72
|
controller: createController({
|
|
63
73
|
model: ctx.model,
|
|
64
|
-
role,
|
|
74
|
+
role: props.role,
|
|
65
75
|
build: (next) => {
|
|
66
76
|
pointer.value = next;
|
|
67
77
|
},
|
|
68
78
|
}),
|
|
69
79
|
enforceFunctionCall: true,
|
|
70
|
-
promptCacheKey,
|
|
80
|
+
promptCacheKey: props.promptCacheKey,
|
|
71
81
|
message: "Create Authorization Operation for the given roles",
|
|
72
82
|
});
|
|
73
83
|
if (pointer.value === null)
|
|
@@ -77,11 +87,11 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
77
87
|
type: "interfaceAuthorization",
|
|
78
88
|
id: v7(),
|
|
79
89
|
operations: pointer.value.operations,
|
|
80
|
-
completed: ++progress.completed,
|
|
90
|
+
completed: ++props.progress.completed,
|
|
81
91
|
tokenUsage,
|
|
82
92
|
created_at: new Date().toISOString(),
|
|
83
93
|
step: ctx.state().analyze?.step ?? 0,
|
|
84
|
-
total: progress.total,
|
|
94
|
+
total: props.progress.total,
|
|
85
95
|
} satisfies AutoBeInterfaceAuthorizationEvent;
|
|
86
96
|
}
|
|
87
97
|
|