@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
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
2
|
import { AutoBeOpenApi } from "@autobe/interface";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
ILlmSchema,
|
|
6
|
-
IValidation,
|
|
7
|
-
OpenApiTypeChecker,
|
|
8
|
-
} from "@samchon/openapi";
|
|
3
|
+
import { missedOpenApiSchemas } from "@autobe/utils";
|
|
4
|
+
import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
|
|
9
5
|
import { OpenApiV3_1Emender } from "@samchon/openapi/lib/converters/OpenApiV3_1Emender";
|
|
10
6
|
import { IPointer } from "tstl";
|
|
11
7
|
import typia from "typia";
|
|
@@ -22,20 +18,24 @@ import { fulfillJsonSchemaErrorMessages } from "./utils/fulfillJsonSchemaErrorMe
|
|
|
22
18
|
|
|
23
19
|
export function orchestrateInterfaceComplement<Model extends ILlmSchema.Model>(
|
|
24
20
|
ctx: AutoBeContext<Model>,
|
|
25
|
-
|
|
21
|
+
props: {
|
|
22
|
+
instruction: string;
|
|
23
|
+
document: AutoBeOpenApi.IDocument;
|
|
24
|
+
},
|
|
26
25
|
): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
|
|
27
|
-
return step(ctx,
|
|
26
|
+
return step(ctx, props, false);
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
async function step<Model extends ILlmSchema.Model>(
|
|
31
30
|
ctx: AutoBeContext<Model>,
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
props: {
|
|
32
|
+
instruction: string;
|
|
33
|
+
document: AutoBeOpenApi.IDocument;
|
|
34
|
+
},
|
|
35
|
+
wasEmpty: boolean,
|
|
34
36
|
): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
|
|
35
|
-
const missed: string[] =
|
|
36
|
-
if (missed.length === 0
|
|
37
|
-
return document.components.schemas;
|
|
38
|
-
}
|
|
37
|
+
const missed: string[] = missedOpenApiSchemas(props.document);
|
|
38
|
+
if (missed.length === 0) return props.document.components.schemas;
|
|
39
39
|
|
|
40
40
|
const pointer: IPointer<Record<
|
|
41
41
|
string,
|
|
@@ -45,11 +45,12 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
45
45
|
};
|
|
46
46
|
const { tokenUsage } = await ctx.conversate({
|
|
47
47
|
source: "interfaceComplement",
|
|
48
|
-
histories: transformInterfaceComplementHistories(
|
|
49
|
-
ctx.state(),
|
|
50
|
-
|
|
48
|
+
histories: transformInterfaceComplementHistories({
|
|
49
|
+
state: ctx.state(),
|
|
50
|
+
instruction: props.instruction,
|
|
51
|
+
document: props.document,
|
|
51
52
|
missed,
|
|
52
|
-
),
|
|
53
|
+
}),
|
|
53
54
|
controller: createController({
|
|
54
55
|
model: ctx.model,
|
|
55
56
|
build: (next) => {
|
|
@@ -83,45 +84,31 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
83
84
|
created_at: new Date().toISOString(),
|
|
84
85
|
});
|
|
85
86
|
|
|
87
|
+
const empty: boolean = Object.keys(pointer.value).length === 0;
|
|
88
|
+
if (empty === true && wasEmpty === true)
|
|
89
|
+
return props.document.components.schemas;
|
|
90
|
+
|
|
86
91
|
const newSchemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {
|
|
87
92
|
...pointer.value,
|
|
88
|
-
...document.components.schemas,
|
|
93
|
+
...props.document.components.schemas,
|
|
89
94
|
};
|
|
90
|
-
JsonSchemaNamingConvention.schemas(document.operations, newSchemas);
|
|
95
|
+
JsonSchemaNamingConvention.schemas(props.document.operations, newSchemas);
|
|
91
96
|
return step(
|
|
92
97
|
ctx,
|
|
93
98
|
{
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
...document
|
|
97
|
-
|
|
99
|
+
instruction: props.instruction,
|
|
100
|
+
document: {
|
|
101
|
+
...props.document,
|
|
102
|
+
components: {
|
|
103
|
+
...props.document.components,
|
|
104
|
+
schemas: newSchemas,
|
|
105
|
+
},
|
|
98
106
|
},
|
|
99
107
|
},
|
|
100
|
-
|
|
108
|
+
empty,
|
|
101
109
|
);
|
|
102
110
|
}
|
|
103
111
|
|
|
104
|
-
const getMissed = (document: AutoBeOpenApi.IDocument): string[] => {
|
|
105
|
-
const missed: Set<string> = new Set();
|
|
106
|
-
const check = (name: string) => {
|
|
107
|
-
if (document.components.schemas[name] === undefined) missed.add(name);
|
|
108
|
-
};
|
|
109
|
-
for (const op of document.operations) {
|
|
110
|
-
if (op.requestBody !== null) check(op.requestBody.typeName);
|
|
111
|
-
if (op.responseBody !== null) check(op.responseBody.typeName);
|
|
112
|
-
}
|
|
113
|
-
for (const value of Object.values(document.components.schemas))
|
|
114
|
-
OpenApiTypeChecker.visit({
|
|
115
|
-
components: document.components,
|
|
116
|
-
schema: value,
|
|
117
|
-
closure: (next) => {
|
|
118
|
-
if (OpenApiTypeChecker.isReference(next))
|
|
119
|
-
check(next.$ref.split("/").pop()!);
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
return Array.from(missed);
|
|
123
|
-
};
|
|
124
|
-
|
|
125
112
|
function createController<Model extends ILlmSchema.Model>(props: {
|
|
126
113
|
model: Model;
|
|
127
114
|
build: (
|
|
@@ -133,7 +120,7 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
133
120
|
const validate = (
|
|
134
121
|
next: unknown,
|
|
135
122
|
): IValidation<IAutoBeInterfaceComplementApplication.IProps> => {
|
|
136
|
-
JsonSchemaFactory.
|
|
123
|
+
JsonSchemaFactory.fixPage("schemas", next);
|
|
137
124
|
|
|
138
125
|
const result: IValidation<IAutoBeInterfaceComplementApplication.IProps> =
|
|
139
126
|
typia.validate<IAutoBeInterfaceComplementApplication.IProps>(next);
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
AutoBeProgressEventBase,
|
|
6
6
|
} from "@autobe/interface";
|
|
7
7
|
import { AutoBeInterfaceGroup } from "@autobe/interface/src/histories/contents/AutoBeInterfaceGroup";
|
|
8
|
+
import { AutoBeOpenApiEndpointComparator } from "@autobe/utils";
|
|
8
9
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
9
10
|
import { HashSet, IPointer } from "tstl";
|
|
10
11
|
import typia from "typia";
|
|
@@ -16,45 +17,55 @@ import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
|
16
17
|
import { transformInterfaceEndpointHistories } from "./histories/transformInterfaceEndpointHistories";
|
|
17
18
|
import { orchestrateInterfaceEndpointsReview } from "./orchestrateInterfaceEndpointsReview";
|
|
18
19
|
import { IAutoBeInterfaceEndpointApplication } from "./structures/IAutoBeInterfaceEndpointApplication";
|
|
19
|
-
import { OpenApiEndpointComparator } from "./utils/OpenApiEndpointComparator";
|
|
20
20
|
|
|
21
21
|
export async function orchestrateInterfaceEndpoints<
|
|
22
22
|
Model extends ILlmSchema.Model,
|
|
23
23
|
>(
|
|
24
24
|
ctx: AutoBeContext<Model>,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
props: {
|
|
26
|
+
groups: AutoBeInterfaceGroup[];
|
|
27
|
+
authorizations: AutoBeOpenApi.IOperation[];
|
|
28
|
+
instruction: string;
|
|
29
|
+
message?: string;
|
|
30
|
+
},
|
|
28
31
|
): Promise<AutoBeOpenApi.IEndpoint[]> {
|
|
29
32
|
const progress: AutoBeProgressEventBase = {
|
|
30
|
-
total: groups.length,
|
|
33
|
+
total: props.groups.length,
|
|
31
34
|
completed: 0,
|
|
32
35
|
};
|
|
33
36
|
const endpoints: AutoBeOpenApi.IEndpoint[] = (
|
|
34
37
|
await executeCachedBatch(
|
|
35
|
-
groups.map(
|
|
36
|
-
(
|
|
37
|
-
process(ctx,
|
|
38
|
+
props.groups.map(
|
|
39
|
+
(group) => (promptCacheKey) =>
|
|
40
|
+
process(ctx, {
|
|
41
|
+
group,
|
|
42
|
+
authorizations: props.authorizations,
|
|
43
|
+
instruction: props.instruction,
|
|
44
|
+
message: props.message ?? "Make endpoints for the given assets.",
|
|
45
|
+
progress,
|
|
46
|
+
promptCacheKey,
|
|
47
|
+
}),
|
|
38
48
|
),
|
|
39
49
|
)
|
|
40
50
|
).flat();
|
|
41
|
-
|
|
42
51
|
const deduplicated: AutoBeOpenApi.IEndpoint[] = new HashSet(
|
|
43
52
|
endpoints,
|
|
44
|
-
|
|
45
|
-
|
|
53
|
+
AutoBeOpenApiEndpointComparator.hashCode,
|
|
54
|
+
AutoBeOpenApiEndpointComparator.equals,
|
|
46
55
|
).toJSON();
|
|
47
|
-
|
|
48
56
|
return orchestrateInterfaceEndpointsReview(ctx, deduplicated);
|
|
49
57
|
}
|
|
50
58
|
|
|
51
59
|
async function process<Model extends ILlmSchema.Model>(
|
|
52
60
|
ctx: AutoBeContext<Model>,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
props: {
|
|
62
|
+
group: AutoBeInterfaceGroup;
|
|
63
|
+
message: string;
|
|
64
|
+
progress: AutoBeProgressEventBase;
|
|
65
|
+
authorizations: AutoBeOpenApi.IOperation[];
|
|
66
|
+
promptCacheKey: string;
|
|
67
|
+
instruction: string;
|
|
68
|
+
},
|
|
58
69
|
): Promise<AutoBeOpenApi.IEndpoint[]> {
|
|
59
70
|
const start: Date = new Date();
|
|
60
71
|
const pointer: IPointer<AutoBeOpenApi.IEndpoint[] | null> = {
|
|
@@ -62,11 +73,12 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
62
73
|
};
|
|
63
74
|
const { tokenUsage } = await ctx.conversate({
|
|
64
75
|
source: "interfaceEndpoints",
|
|
65
|
-
histories: transformInterfaceEndpointHistories(
|
|
66
|
-
ctx.state(),
|
|
67
|
-
group,
|
|
68
|
-
authorizations,
|
|
69
|
-
|
|
76
|
+
histories: transformInterfaceEndpointHistories({
|
|
77
|
+
state: ctx.state(),
|
|
78
|
+
group: props.group,
|
|
79
|
+
authorizations: props.authorizations,
|
|
80
|
+
instruction: props.instruction,
|
|
81
|
+
}),
|
|
70
82
|
controller: createController({
|
|
71
83
|
model: ctx.model,
|
|
72
84
|
build: (endpoints) => {
|
|
@@ -75,8 +87,8 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
75
87
|
},
|
|
76
88
|
}),
|
|
77
89
|
enforceFunctionCall: true,
|
|
78
|
-
promptCacheKey,
|
|
79
|
-
message,
|
|
90
|
+
promptCacheKey: props.promptCacheKey,
|
|
91
|
+
message: props.message,
|
|
80
92
|
});
|
|
81
93
|
if (pointer.value === null) throw new Error("Failed to generate endpoints."); // unreachable
|
|
82
94
|
|
|
@@ -85,14 +97,14 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
85
97
|
id: v7(),
|
|
86
98
|
endpoints: new HashSet(
|
|
87
99
|
pointer.value,
|
|
88
|
-
|
|
89
|
-
|
|
100
|
+
AutoBeOpenApiEndpointComparator.hashCode,
|
|
101
|
+
AutoBeOpenApiEndpointComparator.equals,
|
|
90
102
|
).toJSON(),
|
|
91
103
|
tokenUsage,
|
|
92
104
|
created_at: start.toISOString(),
|
|
93
105
|
step: ctx.state().analyze?.step ?? 0,
|
|
94
|
-
completed: ++progress.completed,
|
|
95
|
-
total: progress.total,
|
|
106
|
+
completed: ++props.progress.completed,
|
|
107
|
+
total: props.progress.total,
|
|
96
108
|
};
|
|
97
109
|
ctx.dispatch(event);
|
|
98
110
|
return pointer.value;
|
|
@@ -14,7 +14,10 @@ export async function orchestrateInterfaceGroups<
|
|
|
14
14
|
Model extends ILlmSchema.Model,
|
|
15
15
|
>(
|
|
16
16
|
ctx: AutoBeContext<Model>,
|
|
17
|
-
|
|
17
|
+
props: {
|
|
18
|
+
instruction: string;
|
|
19
|
+
message?: string;
|
|
20
|
+
},
|
|
18
21
|
): Promise<AutoBeInterfaceGroupsEvent> {
|
|
19
22
|
const start: Date = new Date();
|
|
20
23
|
const pointer: IPointer<IAutoBeInterfaceGroupApplication.IProps | null> = {
|
|
@@ -22,7 +25,10 @@ export async function orchestrateInterfaceGroups<
|
|
|
22
25
|
};
|
|
23
26
|
const { tokenUsage } = await ctx.conversate({
|
|
24
27
|
source: "interfaceGroups",
|
|
25
|
-
histories: transformInterfaceGroupHistories(
|
|
28
|
+
histories: transformInterfaceGroupHistories({
|
|
29
|
+
state: ctx.state(),
|
|
30
|
+
instruction: props.instruction,
|
|
31
|
+
}),
|
|
26
32
|
controller: createController({
|
|
27
33
|
model: ctx.model,
|
|
28
34
|
build: (next) => {
|
|
@@ -30,7 +36,7 @@ export async function orchestrateInterfaceGroups<
|
|
|
30
36
|
},
|
|
31
37
|
}),
|
|
32
38
|
enforceFunctionCall: true,
|
|
33
|
-
message,
|
|
39
|
+
message: props.message ?? "Design API operations for the given assets.",
|
|
34
40
|
});
|
|
35
41
|
if (pointer.value === null) throw new Error("Failed to generate groups."); // unreachable
|
|
36
42
|
return {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
AutoBeOpenApi,
|
|
5
5
|
AutoBeProgressEventBase,
|
|
6
6
|
} from "@autobe/interface";
|
|
7
|
-
import { StringUtil } from "@autobe/utils";
|
|
7
|
+
import { AutoBeOpenApiEndpointComparator, StringUtil } from "@autobe/utils";
|
|
8
8
|
import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
|
|
9
9
|
import { HashMap, HashSet, IPointer } from "tstl";
|
|
10
10
|
import typia from "typia";
|
|
@@ -19,21 +19,22 @@ import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
|
19
19
|
import { transformInterfaceOperationHistories } from "./histories/transformInterfaceOperationHistories";
|
|
20
20
|
import { orchestrateInterfaceOperationsReview } from "./orchestrateInterfaceOperationsReview";
|
|
21
21
|
import { IAutoBeInterfaceOperationApplication } from "./structures/IAutoBeInterfaceOperationApplication";
|
|
22
|
-
import { OpenApiEndpointComparator } from "./utils/OpenApiEndpointComparator";
|
|
23
22
|
import { OperationValidator } from "./utils/OperationValidator";
|
|
24
23
|
|
|
25
24
|
export async function orchestrateInterfaceOperations<
|
|
26
25
|
Model extends ILlmSchema.Model,
|
|
27
26
|
>(
|
|
28
27
|
ctx: AutoBeContext<Model>,
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
props: {
|
|
29
|
+
instruction: string;
|
|
30
|
+
endpoints: AutoBeOpenApi.IEndpoint[];
|
|
31
|
+
capacity?: number;
|
|
32
|
+
},
|
|
31
33
|
): Promise<AutoBeOpenApi.IOperation[]> {
|
|
32
34
|
const matrix: AutoBeOpenApi.IEndpoint[][] = divideArray({
|
|
33
|
-
array: endpoints,
|
|
34
|
-
capacity,
|
|
35
|
+
array: props.endpoints,
|
|
36
|
+
capacity: props.capacity ?? AutoBeConfigConstant.INTERFACE_CAPACITY,
|
|
35
37
|
});
|
|
36
|
-
|
|
37
38
|
const progress: AutoBeProgressEventBase = {
|
|
38
39
|
total: matrix.flat().length,
|
|
39
40
|
completed: 0,
|
|
@@ -45,13 +46,13 @@ export async function orchestrateInterfaceOperations<
|
|
|
45
46
|
return (
|
|
46
47
|
await executeCachedBatch(
|
|
47
48
|
matrix.map((it) => async (promptCacheKey) => {
|
|
48
|
-
const row: AutoBeOpenApi.IOperation[] = await divideAndConquer(
|
|
49
|
-
|
|
50
|
-
it,
|
|
49
|
+
const row: AutoBeOpenApi.IOperation[] = await divideAndConquer(ctx, {
|
|
50
|
+
endpoints: it,
|
|
51
51
|
progress,
|
|
52
52
|
reviewProgress,
|
|
53
53
|
promptCacheKey,
|
|
54
|
-
|
|
54
|
+
instruction: props.instruction,
|
|
55
|
+
});
|
|
55
56
|
return row;
|
|
56
57
|
}),
|
|
57
58
|
)
|
|
@@ -60,25 +61,34 @@ export async function orchestrateInterfaceOperations<
|
|
|
60
61
|
|
|
61
62
|
async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
62
63
|
ctx: AutoBeContext<Model>,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
props: {
|
|
65
|
+
endpoints: AutoBeOpenApi.IEndpoint[];
|
|
66
|
+
progress: AutoBeProgressEventBase;
|
|
67
|
+
reviewProgress: AutoBeProgressEventBase;
|
|
68
|
+
promptCacheKey: string;
|
|
69
|
+
instruction: string;
|
|
70
|
+
},
|
|
67
71
|
): Promise<AutoBeOpenApi.IOperation[]> {
|
|
68
72
|
const remained: HashSet<AutoBeOpenApi.IEndpoint> = new HashSet(
|
|
69
|
-
endpoints,
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
props.endpoints,
|
|
74
|
+
AutoBeOpenApiEndpointComparator.hashCode,
|
|
75
|
+
AutoBeOpenApiEndpointComparator.equals,
|
|
72
76
|
);
|
|
73
77
|
const unique: HashMap<AutoBeOpenApi.IEndpoint, AutoBeOpenApi.IOperation> =
|
|
74
78
|
new HashMap(
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
AutoBeOpenApiEndpointComparator.hashCode,
|
|
80
|
+
AutoBeOpenApiEndpointComparator.equals,
|
|
77
81
|
);
|
|
78
82
|
for (let i: number = 0; i < ctx.retry; ++i) {
|
|
79
|
-
if (remained.empty() === true || unique.size() >= endpoints.length)
|
|
83
|
+
if (remained.empty() === true || unique.size() >= props.endpoints.length)
|
|
84
|
+
break;
|
|
80
85
|
const operations: AutoBeOpenApi.IOperation[] = remained.size()
|
|
81
|
-
? await process(ctx,
|
|
86
|
+
? await process(ctx, {
|
|
87
|
+
endpoints: remained,
|
|
88
|
+
progress: props.progress,
|
|
89
|
+
promptCacheKey: props.promptCacheKey,
|
|
90
|
+
instruction: props.instruction,
|
|
91
|
+
})
|
|
82
92
|
: [];
|
|
83
93
|
|
|
84
94
|
for (const item of operations) {
|
|
@@ -90,7 +100,7 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
|
90
100
|
await orchestrateInterfaceOperationsReview(
|
|
91
101
|
ctx,
|
|
92
102
|
unique.toJSON().map((it) => it.second),
|
|
93
|
-
|
|
103
|
+
props.reviewProgress,
|
|
94
104
|
);
|
|
95
105
|
for (const item of newbie) unique.set(item, item);
|
|
96
106
|
return unique.toJSON().map((it) => it.second);
|
|
@@ -98,9 +108,12 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
|
98
108
|
|
|
99
109
|
async function process<Model extends ILlmSchema.Model>(
|
|
100
110
|
ctx: AutoBeContext<Model>,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
111
|
+
props: {
|
|
112
|
+
endpoints: HashSet<AutoBeOpenApi.IEndpoint>;
|
|
113
|
+
progress: AutoBeProgressEventBase;
|
|
114
|
+
promptCacheKey: string;
|
|
115
|
+
instruction: string;
|
|
116
|
+
},
|
|
104
117
|
): Promise<AutoBeOpenApi.IOperation[]> {
|
|
105
118
|
const prefix: string = NamingConvention.camel(ctx.state().analyze!.prefix);
|
|
106
119
|
const pointer: IPointer<AutoBeOpenApi.IOperation[] | null> = {
|
|
@@ -108,10 +121,11 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
108
121
|
};
|
|
109
122
|
const { tokenUsage } = await ctx.conversate({
|
|
110
123
|
source: "interfaceOperations",
|
|
111
|
-
histories: transformInterfaceOperationHistories(
|
|
112
|
-
ctx.state(),
|
|
113
|
-
endpoints.toJSON(),
|
|
114
|
-
|
|
124
|
+
histories: transformInterfaceOperationHistories({
|
|
125
|
+
state: ctx.state(),
|
|
126
|
+
endpoints: props.endpoints.toJSON(),
|
|
127
|
+
instruction: props.instruction,
|
|
128
|
+
}),
|
|
115
129
|
controller: createController({
|
|
116
130
|
model: ctx.model,
|
|
117
131
|
roles: ctx.state().analyze?.roles.map((it) => it.name) ?? [],
|
|
@@ -129,6 +143,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
129
143
|
.join("/"),
|
|
130
144
|
authorizationRole: null,
|
|
131
145
|
authorizationType: null,
|
|
146
|
+
prerequisites: [],
|
|
132
147
|
},
|
|
133
148
|
];
|
|
134
149
|
return op.authorizationRoles.map((role) => ({
|
|
@@ -140,13 +155,14 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
140
155
|
.join("/"),
|
|
141
156
|
authorizationRole: role,
|
|
142
157
|
authorizationType: null,
|
|
158
|
+
prerequisites: [],
|
|
143
159
|
}));
|
|
144
160
|
});
|
|
145
161
|
pointer.value.push(...matrix.flat());
|
|
146
|
-
progress.completed += matrix.flat().length;
|
|
147
|
-
progress.total += operations
|
|
162
|
+
props.progress.completed += matrix.flat().length;
|
|
163
|
+
props.progress.total += operations
|
|
148
164
|
.map((op) =>
|
|
149
|
-
endpoints.has({ path: op.path, method: op.method })
|
|
165
|
+
props.endpoints.has({ path: op.path, method: op.method })
|
|
150
166
|
? op.authorizationRoles.length === 0
|
|
151
167
|
? 0
|
|
152
168
|
: op.authorizationRoles.length - 1
|
|
@@ -156,7 +172,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
156
172
|
},
|
|
157
173
|
}),
|
|
158
174
|
enforceFunctionCall: true,
|
|
159
|
-
promptCacheKey,
|
|
175
|
+
promptCacheKey: props.promptCacheKey,
|
|
160
176
|
message: "Make API operations",
|
|
161
177
|
});
|
|
162
178
|
if (pointer.value === null) throw new Error("Failed to create operations."); // never be happened
|
|
@@ -166,7 +182,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
166
182
|
id: v7(),
|
|
167
183
|
operations: pointer.value,
|
|
168
184
|
tokenUsage,
|
|
169
|
-
...progress,
|
|
185
|
+
...props.progress,
|
|
170
186
|
step: ctx.state().analyze?.step ?? 0,
|
|
171
187
|
created_at: new Date().toISOString(),
|
|
172
188
|
} satisfies AutoBeInterfaceOperationsEvent);
|