@autobe/agent 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AutoBeMockAgent.d.ts +2 -10
- package/lib/agent/src/AutoBeAgent.js +8 -2
- package/lib/agent/src/AutoBeAgent.js.map +1 -1
- package/lib/agent/src/AutoBeMockAgent.d.ts +2 -10
- package/lib/agent/src/AutoBeMockAgent.js +10 -5
- package/lib/agent/src/AutoBeMockAgent.js.map +1 -1
- package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +23 -29
- package/lib/agent/src/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/agent/src/context/AutoBeContext.d.ts +1 -0
- package/lib/agent/src/context/AutoBeTokenUsageComponent.d.ts +1 -0
- package/lib/agent/src/context/AutoBeTokenUsageComponent.js +14 -0
- package/lib/agent/src/context/AutoBeTokenUsageComponent.js.map +1 -1
- package/lib/agent/src/factory/consentFunctionCall.d.ts +10 -0
- package/lib/agent/src/factory/consentFunctionCall.js +213 -0
- package/lib/agent/src/factory/consentFunctionCall.js.map +1 -0
- package/lib/agent/src/factory/createAgenticaHistory.js +1 -0
- package/lib/agent/src/factory/createAgenticaHistory.js.map +1 -1
- package/lib/agent/src/factory/createAutoBeContext.js +79 -19
- package/lib/agent/src/factory/createAutoBeContext.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.d.ts +6 -0
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +41 -0
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -0
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +12 -9
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +3 -1
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +45 -31
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js +25 -6
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +8 -3
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js +15 -12
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js +33 -44
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +6 -4
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js +10 -4
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +16 -16
- package/lib/agent/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +5 -5
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js +45 -45
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +14 -14
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js +31 -30
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +24 -31
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js +4 -4
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js +27 -26
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +13 -12
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.js +4 -4
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +11 -10
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +36 -29
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterface.js +31 -9
- package/lib/agent/src/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +2 -2
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js +1571 -1144
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js +24 -4
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js +6 -2
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js +12 -14
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +103 -71
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.d.ts +2 -3
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +147 -116
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +401 -233
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +2 -5
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js +362 -178
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +38 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +16 -16
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +97 -14
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +75 -1
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +46 -14
- package/lib/agent/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +18 -24
- package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.d.ts +7 -0
- package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js +35 -0
- package/lib/agent/src/orchestrate/interface/utils/validateAuthorizationSchema.js.map +1 -0
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +60 -66
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +19 -30
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +38 -35
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +39 -26
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js +15 -4
- package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -2
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js +7 -9
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +38 -2
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js +61 -10
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js +68 -24
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js +24 -21
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +59 -57
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +1 -0
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +17 -13
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +3 -0
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +287 -0
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -2
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +46 -49
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.d.ts +7 -0
- package/lib/agent/src/orchestrate/realize/internal/{compile.js → compileRealizeFiles.js} +12 -29
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +76 -45
- package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +15 -9
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +9 -7
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +9 -6
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +25 -20
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.d.ts +0 -66
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +8 -6
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +36 -27
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +3 -3
- package/lib/agent/src/orchestrate/{internal/IProgress.js → realize/structures/IAutoBeRealizeCorrectApplication.js} +1 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +19 -16
- package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js +5 -1
- package/lib/agent/src/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/completeTestCode.js +13 -10
- package/lib/agent/src/orchestrate/test/compile/completeTestCode.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +17 -16
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js +33 -32
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.d.ts +2 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +97 -49
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +3 -3
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTest.js +17 -4
- package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +18 -9
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +138 -23
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +17 -17
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +7 -6
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +1 -1
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.d.ts +6 -0
- package/lib/agent/src/orchestrate/{realize/structures/IAutoBeRealizeCoderApplication.js → test/structures/IAutoBeTestScenarioAuthorizationRole.js} +1 -1
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.js.map +1 -0
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +2 -2
- package/lib/agent/src/utils/executeCachedBatch.d.ts +1 -0
- package/lib/agent/src/utils/executeCachedBatch.js +23 -0
- package/lib/agent/src/utils/executeCachedBatch.js.map +1 -0
- package/lib/agent/src/utils/predicateStateMessage.d.ts +4 -0
- package/lib/agent/src/utils/predicateStateMessage.js +87 -0
- package/lib/agent/src/utils/predicateStateMessage.js.map +1 -0
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +23 -29
- package/lib/context/AutoBeContext.d.ts +1 -0
- package/lib/context/AutoBeTokenUsageComponent.d.ts +1 -0
- package/lib/factory/consentFunctionCall.d.ts +10 -0
- package/lib/index.mjs +4799 -2637
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.d.ts +6 -0
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +3 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +8 -3
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +6 -4
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +16 -16
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +5 -5
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.d.ts +2 -3
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +2 -5
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +38 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +16 -16
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +97 -14
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +75 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +46 -14
- package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +18 -24
- package/lib/orchestrate/interface/utils/validateAuthorizationSchema.d.ts +7 -0
- package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -2
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +1 -0
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +3 -0
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +5 -2
- package/lib/orchestrate/realize/internal/compileRealizeFiles.d.ts +7 -0
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +9 -6
- package/lib/orchestrate/realize/orchestrateRealizeScenario.d.ts +0 -66
- package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +8 -6
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +3 -3
- package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +19 -16
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.d.ts +2 -1
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +7 -6
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.d.ts +6 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +2 -2
- package/lib/utils/executeCachedBatch.d.ts +1 -0
- package/lib/utils/predicateStateMessage.d.ts +4 -0
- package/package.json +6 -6
- package/src/AutoBeAgent.ts +18 -3
- package/src/AutoBeMockAgent.ts +13 -15
- package/src/constants/AutoBeSystemPromptConstant.ts +23 -29
- package/src/context/AutoBeContext.ts +1 -0
- package/src/context/AutoBeTokenUsageComponent.ts +20 -0
- package/src/factory/consentFunctionCall.ts +129 -0
- package/src/factory/createAgenticaHistory.ts +1 -0
- package/src/factory/createAutoBeContext.ts +108 -20
- package/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.ts +53 -0
- package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +13 -10
- package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +68 -47
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +33 -21
- package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +21 -10
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +18 -40
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +15 -8
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.ts +16 -16
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +5 -5
- package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +47 -47
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +14 -14
- package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +31 -30
- package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +20 -29
- package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +3 -3
- package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +23 -22
- package/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.ts +12 -11
- package/src/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.ts +5 -5
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +11 -10
- package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +37 -30
- package/src/orchestrate/interface/orchestrateInterface.ts +53 -12
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +142 -32
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +2 -0
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +13 -9
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +8 -19
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +82 -74
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +51 -32
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +174 -56
- package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +149 -63
- package/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.ts +39 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +16 -16
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +101 -14
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +77 -1
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +47 -14
- package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +18 -24
- package/src/orchestrate/interface/utils/validateAuthorizationSchema.ts +41 -0
- package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +61 -66
- package/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.ts +19 -30
- package/src/orchestrate/prisma/histories/transformPrismaReviewHistories.ts +38 -35
- package/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts +36 -23
- package/src/orchestrate/prisma/orchestratePrisma.ts +17 -6
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +8 -19
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +3 -0
- package/src/orchestrate/prisma/orchestratePrismaReview.ts +37 -18
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +25 -17
- package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +24 -21
- package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +57 -59
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +20 -14
- package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +294 -0
- package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +62 -57
- package/src/orchestrate/realize/internal/compileRealizeFiles.ts +71 -0
- package/src/orchestrate/realize/orchestrateRealize.ts +109 -86
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +22 -13
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +3 -0
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +28 -24
- package/src/orchestrate/realize/orchestrateRealizeScenario.ts +0 -74
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +37 -28
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +3 -3
- package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +19 -16
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +7 -0
- package/src/orchestrate/test/compile/completeTestCode.ts +17 -13
- package/src/orchestrate/test/experimental/transformTestCorrectHistories.ast +4 -4
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +17 -16
- package/src/orchestrate/test/histories/transformTestHistories.ts +35 -34
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +116 -60
- package/src/orchestrate/test/histories/transformTestWriteHistories.ts +3 -3
- package/src/orchestrate/test/orchestrateTest.ts +18 -8
- package/src/orchestrate/test/orchestrateTestCorrect.ts +34 -24
- package/src/orchestrate/test/orchestrateTestScenario.ts +179 -36
- package/src/orchestrate/test/orchestrateTestWrite.ts +18 -19
- package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +7 -6
- package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +1 -1
- package/src/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.ts +7 -0
- package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +2 -2
- package/src/utils/executeCachedBatch.ts +15 -0
- package/src/utils/predicateStateMessage.ts +107 -0
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +0 -4
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.js +0 -46
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.js.map +0 -1
- package/lib/agent/src/orchestrate/internal/IProgress.d.ts +0 -4
- package/lib/agent/src/orchestrate/internal/IProgress.js.map +0 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCoderHistories.d.ts +0 -7
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCoderHistories.js +0 -213
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCoderHistories.js.map +0 -1
- package/lib/agent/src/orchestrate/realize/internal/compile.d.ts +0 -7
- package/lib/agent/src/orchestrate/realize/internal/compile.js.map +0 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +0 -345
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.js.map +0 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCompile.d.ts +0 -56
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCompile.js +0 -3
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeCompile.js.map +0 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.d.ts +0 -2
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.js +0 -5
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.js.map +0 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeReviewApplication.js +0 -3
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeReviewApplication.js.map +0 -1
- package/lib/agent/src/utils/pipe.d.ts +0 -5
- package/lib/agent/src/utils/pipe.js +0 -14
- package/lib/agent/src/utils/pipe.js.map +0 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +0 -4
- package/lib/orchestrate/internal/IProgress.d.ts +0 -4
- package/lib/orchestrate/realize/histories/transformRealizeCoderHistories.d.ts +0 -7
- package/lib/orchestrate/realize/internal/compile.d.ts +0 -7
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +0 -345
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.d.ts +0 -56
- package/lib/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.d.ts +0 -2
- package/lib/utils/pipe.d.ts +0 -5
- package/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.ts +0 -53
- package/src/orchestrate/internal/IProgress.ts +0 -4
- package/src/orchestrate/realize/histories/transformRealizeCoderHistories.ts +0 -248
- package/src/orchestrate/realize/internal/compile.ts +0 -84
- package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +0 -358
- package/src/orchestrate/realize/structures/IAutoBeRealizeCompile.ts +0 -70
- package/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.ts +0 -2
- package/src/utils/pipe.ts +0 -39
- /package/lib/agent/src/orchestrate/realize/structures/{IAutoBeRealizeReviewApplication.d.ts → IAutoBeRealizeCorrectApplication.d.ts} +0 -0
- /package/lib/orchestrate/realize/structures/{IAutoBeRealizeReviewApplication.d.ts → IAutoBeRealizeCorrectApplication.d.ts} +0 -0
- /package/src/orchestrate/realize/structures/{IAutoBeRealizeReviewApplication.ts → IAutoBeRealizeCorrectApplication.ts} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AutoBeAssistantMessageHistory,
|
|
3
3
|
AutoBeOpenApi,
|
|
4
|
+
AutoBeProgressEventBase,
|
|
4
5
|
AutoBeRealizeAuthorization,
|
|
5
6
|
AutoBeRealizeFunction,
|
|
6
7
|
AutoBeRealizeHistory,
|
|
@@ -9,12 +10,13 @@ import {
|
|
|
9
10
|
IAutoBeTypeScriptCompileResult,
|
|
10
11
|
} from "@autobe/interface";
|
|
11
12
|
import { ILlmSchema } from "@samchon/openapi";
|
|
13
|
+
import { v7 } from "uuid";
|
|
12
14
|
|
|
13
15
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
14
16
|
import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
17
|
+
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
18
|
+
import { predicateStateMessage } from "../../utils/predicateStateMessage";
|
|
19
|
+
import { compileRealizeFiles } from "./internal/compileRealizeFiles";
|
|
18
20
|
import { orchestrateRealizeAuthorization } from "./orchestrateRealizeAuthorization";
|
|
19
21
|
import { orchestrateRealizeCorrect } from "./orchestrateRealizeCorrect";
|
|
20
22
|
import { orchestrateRealizeScenario } from "./orchestrateRealizeScenario";
|
|
@@ -26,116 +28,152 @@ export const orchestrateRealize =
|
|
|
26
28
|
async (
|
|
27
29
|
props: IAutoBeApplicationProps,
|
|
28
30
|
): Promise<AutoBeAssistantMessageHistory | AutoBeRealizeHistory> => {
|
|
31
|
+
// PREDICATION
|
|
29
32
|
const operations: AutoBeOpenApi.IOperation[] | undefined =
|
|
30
33
|
ctx.state().interface?.document.operations;
|
|
31
|
-
if (!operations)
|
|
34
|
+
if (!operations)
|
|
32
35
|
throw new Error("Can't do realize agent because operations are nothing.");
|
|
33
|
-
}
|
|
34
36
|
|
|
35
37
|
const start: Date = new Date();
|
|
38
|
+
const predicate: string | null = predicateStateMessage(
|
|
39
|
+
ctx.state(),
|
|
40
|
+
"realize",
|
|
41
|
+
);
|
|
42
|
+
if (predicate !== null)
|
|
43
|
+
return ctx.assistantMessage({
|
|
44
|
+
type: "assistantMessage",
|
|
45
|
+
id: v7(),
|
|
46
|
+
created_at: start.toISOString(),
|
|
47
|
+
text: predicate,
|
|
48
|
+
completed_at: new Date().toISOString(),
|
|
49
|
+
});
|
|
36
50
|
ctx.dispatch({
|
|
37
51
|
type: "realizeStart",
|
|
52
|
+
id: v7(),
|
|
38
53
|
created_at: start.toISOString(),
|
|
39
54
|
reason: props.reason,
|
|
40
55
|
step: ctx.state().test?.step ?? 0,
|
|
41
56
|
});
|
|
42
57
|
|
|
58
|
+
// AUTHORIZATIONS
|
|
43
59
|
const authorizations: AutoBeRealizeAuthorization[] =
|
|
44
60
|
await orchestrateRealizeAuthorization(ctx);
|
|
45
61
|
|
|
62
|
+
// SCENARIOS
|
|
46
63
|
const scenarios: IAutoBeRealizeScenarioApplication.IProps[] =
|
|
47
|
-
operations.map((operation) =>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const writeEvents: AutoBeRealizeWriteEvent[] = await Promise.all(
|
|
51
|
-
scenarios.map(async (scenario) => {
|
|
52
|
-
const code = orchestrateRealizeWrite(
|
|
53
|
-
ctx,
|
|
54
|
-
scenario.decoratorEvent ?? null,
|
|
55
|
-
scenario,
|
|
56
|
-
writeProgress,
|
|
64
|
+
operations.map((operation) => {
|
|
65
|
+
const authorization = authorizations.find(
|
|
66
|
+
(el) => el.role.name === operation.authorizationRole,
|
|
57
67
|
);
|
|
68
|
+
|
|
69
|
+
return orchestrateRealizeScenario(ctx, operation, authorization);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const writeProgress: AutoBeProgressEventBase = {
|
|
73
|
+
total: scenarios.length,
|
|
74
|
+
completed: 0,
|
|
75
|
+
};
|
|
76
|
+
const writeEvents: AutoBeRealizeWriteEvent[] = await executeCachedBatch(
|
|
77
|
+
scenarios.map((scenario) => async (promptCacheKey) => {
|
|
78
|
+
const code = await orchestrateRealizeWrite(ctx, {
|
|
79
|
+
totalAuthorizations: authorizations,
|
|
80
|
+
authorization: scenario.decoratorEvent ?? null,
|
|
81
|
+
scenario,
|
|
82
|
+
progress: writeProgress,
|
|
83
|
+
promptCacheKey,
|
|
84
|
+
});
|
|
58
85
|
return code;
|
|
59
86
|
}),
|
|
60
87
|
);
|
|
61
88
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
89
|
+
const functions: AutoBeRealizeFunction[] = Object.entries(
|
|
90
|
+
Object.fromEntries(
|
|
91
|
+
writeEvents.map((event) => [event.location, event.content]),
|
|
92
|
+
),
|
|
93
|
+
).map(([location, content]) => {
|
|
94
|
+
const scenario = scenarios.find((el) => el.location === location)!;
|
|
95
|
+
return {
|
|
96
|
+
location,
|
|
97
|
+
content,
|
|
98
|
+
endpoint: {
|
|
99
|
+
method: scenario.operation.method,
|
|
100
|
+
path: scenario.operation.path,
|
|
101
|
+
},
|
|
102
|
+
name: scenario.functionName,
|
|
103
|
+
};
|
|
104
|
+
});
|
|
65
105
|
|
|
66
|
-
let
|
|
106
|
+
let compilation = await compileRealizeFiles(ctx, {
|
|
67
107
|
authorizations,
|
|
68
|
-
|
|
108
|
+
functions,
|
|
69
109
|
});
|
|
70
110
|
|
|
71
|
-
if (
|
|
72
|
-
const MAX_CORRECTION_ATTEMPTS =
|
|
111
|
+
if (compilation.type !== "success") {
|
|
112
|
+
const MAX_CORRECTION_ATTEMPTS = 5 as const;
|
|
73
113
|
|
|
74
114
|
const reviewProgress = {
|
|
115
|
+
id: v7(),
|
|
75
116
|
total: writeEvents.length,
|
|
76
117
|
completed: writeEvents.length,
|
|
77
118
|
};
|
|
78
119
|
|
|
79
120
|
for (let attempt = 0; attempt < MAX_CORRECTION_ATTEMPTS; attempt++) {
|
|
80
|
-
if (
|
|
81
|
-
const failedFiles: Record<string, string> =
|
|
82
|
-
|
|
121
|
+
if (compilation.type === "failure") {
|
|
122
|
+
const failedFiles: Record<string, string> = Object.fromEntries(
|
|
123
|
+
compilation.type === "failure"
|
|
124
|
+
? compilation.diagnostics.map((d) => [d.file, d.code])
|
|
125
|
+
: [],
|
|
126
|
+
);
|
|
83
127
|
|
|
84
128
|
reviewProgress.total += Object.keys(failedFiles).length;
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
scenario
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
129
|
+
const failure: IAutoBeTypeScriptCompileResult.IFailure = compilation;
|
|
130
|
+
|
|
131
|
+
await executeCachedBatch(
|
|
132
|
+
Object.entries(failedFiles).map(
|
|
133
|
+
([location, content]) =>
|
|
134
|
+
async () => {
|
|
135
|
+
const diagnostic:
|
|
136
|
+
| IAutoBeTypeScriptCompileResult.IDiagnostic
|
|
137
|
+
| undefined = failure.diagnostics.find(
|
|
138
|
+
(el) => el.file === location,
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
const scenario = scenarios.find(
|
|
142
|
+
(el) => el.location === location,
|
|
143
|
+
);
|
|
144
|
+
if (diagnostic && scenario) {
|
|
145
|
+
const correctEvent = await orchestrateRealizeCorrect(ctx, {
|
|
146
|
+
totalAuthorizations: authorizations,
|
|
147
|
+
authorization: scenario.decoratorEvent ?? null,
|
|
148
|
+
scenario,
|
|
149
|
+
code: content,
|
|
150
|
+
diagnostic,
|
|
151
|
+
progress: reviewProgress,
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
const corrected = functions.find(
|
|
155
|
+
(el) => el.location === correctEvent.location,
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
if (corrected) {
|
|
159
|
+
corrected.content = correctEvent.content;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
),
|
|
110
164
|
);
|
|
111
165
|
|
|
112
|
-
|
|
166
|
+
compilation = await compileRealizeFiles(ctx, {
|
|
113
167
|
authorizations,
|
|
114
|
-
|
|
168
|
+
functions,
|
|
115
169
|
});
|
|
116
|
-
|
|
117
|
-
if (finalCompilationResult.type === "success") {
|
|
170
|
+
if (compilation.type === "success") {
|
|
118
171
|
break;
|
|
119
172
|
}
|
|
120
173
|
}
|
|
121
174
|
}
|
|
122
175
|
}
|
|
123
176
|
|
|
124
|
-
const functions: AutoBeRealizeFunction[] = Object.entries(providers).map(
|
|
125
|
-
([location, content]) => {
|
|
126
|
-
const scenario = scenarios.find((el) => el.location === location)!;
|
|
127
|
-
return {
|
|
128
|
-
location,
|
|
129
|
-
content,
|
|
130
|
-
endpoint: {
|
|
131
|
-
method: scenario.operation.method,
|
|
132
|
-
path: scenario.operation.path,
|
|
133
|
-
},
|
|
134
|
-
name: scenario.functionName,
|
|
135
|
-
};
|
|
136
|
-
},
|
|
137
|
-
);
|
|
138
|
-
|
|
139
177
|
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
140
178
|
const controllers: Record<string, string> =
|
|
141
179
|
await compiler.realize.controller({
|
|
@@ -143,29 +181,14 @@ export const orchestrateRealize =
|
|
|
143
181
|
functions,
|
|
144
182
|
authorizations,
|
|
145
183
|
});
|
|
146
|
-
|
|
147
184
|
return ctx.dispatch({
|
|
148
185
|
type: "realizeComplete",
|
|
186
|
+
id: v7(),
|
|
149
187
|
created_at: new Date().toISOString(),
|
|
150
188
|
functions,
|
|
151
189
|
authorizations,
|
|
152
190
|
controllers,
|
|
153
|
-
compiled: await
|
|
154
|
-
files: {
|
|
155
|
-
...(await getAutoBeGenerated(
|
|
156
|
-
compiler,
|
|
157
|
-
ctx.state(),
|
|
158
|
-
ctx.histories(),
|
|
159
|
-
ctx.usage(),
|
|
160
|
-
)),
|
|
161
|
-
...(await getAutoBeRealizeGenerated({
|
|
162
|
-
document: ctx.state().interface!.document,
|
|
163
|
-
authorizations,
|
|
164
|
-
functions,
|
|
165
|
-
compiler,
|
|
166
|
-
})),
|
|
167
|
-
},
|
|
168
|
-
}),
|
|
191
|
+
compiled: await compileRealizeFiles(ctx, { authorizations, functions }),
|
|
169
192
|
step: ctx.state().analyze?.step ?? 0,
|
|
170
193
|
elapsed: new Date().getTime() - start.getTime(),
|
|
171
194
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
2
|
import {
|
|
3
3
|
AutoBeAnalyzeRole,
|
|
4
|
+
AutoBeProgressEventBase,
|
|
4
5
|
AutoBeRealizeAuthorization,
|
|
5
6
|
AutoBeRealizeAuthorizationWriteEvent,
|
|
6
7
|
IAutoBeCompiler,
|
|
@@ -8,10 +9,11 @@ import {
|
|
|
8
9
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
9
10
|
import { IPointer } from "tstl";
|
|
10
11
|
import typia from "typia";
|
|
12
|
+
import { v7 } from "uuid";
|
|
11
13
|
|
|
12
14
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
13
15
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
14
|
-
import {
|
|
16
|
+
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
15
17
|
import { transformRealizeAuthorizationHistories } from "./histories/transformRealizeAuthorization";
|
|
16
18
|
import { orchestrateRealizeAuthorizationCorrect } from "./orchestrateRealizeAuthorizationCorrect";
|
|
17
19
|
import { IAutoBeRealizeAuthorizationApplication } from "./structures/IAutoBeRealizeAuthorizationApplication";
|
|
@@ -29,30 +31,34 @@ export async function orchestrateRealizeAuthorization<
|
|
|
29
31
|
>(ctx: AutoBeContext<Model>): Promise<AutoBeRealizeAuthorization[]> {
|
|
30
32
|
ctx.dispatch({
|
|
31
33
|
type: "realizeAuthorizationStart",
|
|
34
|
+
id: v7(),
|
|
32
35
|
step: ctx.state().test?.step ?? 0,
|
|
33
36
|
created_at: new Date().toISOString(),
|
|
34
37
|
});
|
|
35
38
|
|
|
36
39
|
const roles: AutoBeAnalyzeRole[] = ctx.state().analyze?.roles ?? [];
|
|
37
|
-
const progress:
|
|
40
|
+
const progress: AutoBeProgressEventBase = {
|
|
38
41
|
total: roles.length,
|
|
39
42
|
completed: 0,
|
|
40
43
|
};
|
|
41
44
|
const templateFiles = await (await ctx.compiler()).realize.getTemplate();
|
|
42
|
-
const authorizations: AutoBeRealizeAuthorization[] = await
|
|
43
|
-
roles.map(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
const authorizations: AutoBeRealizeAuthorization[] = await executeCachedBatch(
|
|
46
|
+
roles.map(
|
|
47
|
+
(role) => (promptCacheKey) =>
|
|
48
|
+
process(
|
|
49
|
+
ctx,
|
|
50
|
+
role,
|
|
51
|
+
InternalFileSystem.DEFAULT.map((el) => ({
|
|
52
|
+
[el]: templateFiles[el],
|
|
53
|
+
})).reduce((acc, cur) => Object.assign(acc, cur), {}),
|
|
54
|
+
progress,
|
|
55
|
+
promptCacheKey,
|
|
56
|
+
),
|
|
52
57
|
),
|
|
53
58
|
);
|
|
54
59
|
ctx.dispatch({
|
|
55
60
|
type: "realizeAuthorizationComplete",
|
|
61
|
+
id: v7(),
|
|
56
62
|
created_at: new Date().toISOString(),
|
|
57
63
|
step: ctx.state().test?.step ?? 0,
|
|
58
64
|
});
|
|
@@ -63,7 +69,8 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
63
69
|
ctx: AutoBeContext<Model>,
|
|
64
70
|
role: AutoBeAnalyzeRole,
|
|
65
71
|
templateFiles: Record<string, string>,
|
|
66
|
-
progress:
|
|
72
|
+
progress: AutoBeProgressEventBase,
|
|
73
|
+
promptCacheKey: string,
|
|
67
74
|
): Promise<AutoBeRealizeAuthorization> {
|
|
68
75
|
const pointer: IPointer<IAutoBeRealizeAuthorizationApplication.IProps | null> =
|
|
69
76
|
{
|
|
@@ -79,6 +86,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
79
86
|
},
|
|
80
87
|
}),
|
|
81
88
|
enforceFunctionCall: true,
|
|
89
|
+
promptCacheKey,
|
|
82
90
|
message: "Create Authorization Provider and Decorator.",
|
|
83
91
|
});
|
|
84
92
|
if (pointer.value === null) throw new Error("Failed to create decorator.");
|
|
@@ -114,6 +122,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
114
122
|
|
|
115
123
|
ctx.dispatch({
|
|
116
124
|
type: "realizeAuthorizationWrite",
|
|
125
|
+
id: v7(),
|
|
117
126
|
created_at: new Date().toISOString(),
|
|
118
127
|
authorization: authorization,
|
|
119
128
|
tokenUsage,
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
9
9
|
import { IPointer } from "tstl";
|
|
10
10
|
import typia from "typia";
|
|
11
|
+
import { v7 } from "uuid";
|
|
11
12
|
|
|
12
13
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
13
14
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
@@ -58,6 +59,7 @@ export async function orchestrateRealizeAuthorizationCorrect<
|
|
|
58
59
|
|
|
59
60
|
ctx.dispatch({
|
|
60
61
|
type: "realizeAuthorizationValidate",
|
|
62
|
+
id: v7(),
|
|
61
63
|
created_at: new Date().toISOString(),
|
|
62
64
|
authorization: authorization,
|
|
63
65
|
result: compiled,
|
|
@@ -120,6 +122,7 @@ export async function orchestrateRealizeAuthorizationCorrect<
|
|
|
120
122
|
ctx.dispatch({
|
|
121
123
|
...pointer.value,
|
|
122
124
|
type: "realizeAuthorizationCorrect",
|
|
125
|
+
id: v7(),
|
|
123
126
|
created_at: new Date().toISOString(),
|
|
124
127
|
authorization: result,
|
|
125
128
|
result: compiled,
|
|
@@ -1,32 +1,38 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AutoBeProgressEventBase,
|
|
2
3
|
AutoBeRealizeAuthorization,
|
|
3
4
|
AutoBeRealizeCorrectEvent,
|
|
4
5
|
IAutoBeTypeScriptCompileResult,
|
|
5
6
|
} from "@autobe/interface";
|
|
7
|
+
import { StringUtil } from "@autobe/utils";
|
|
6
8
|
import { ILlmApplication, ILlmController, ILlmSchema } from "@samchon/openapi";
|
|
7
9
|
import { IPointer } from "tstl";
|
|
8
10
|
import typia from "typia";
|
|
11
|
+
import { v7 } from "uuid";
|
|
9
12
|
|
|
10
13
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
11
14
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
12
15
|
import { getTestScenarioArtifacts } from "../test/compile/getTestScenarioArtifacts";
|
|
13
16
|
import { IAutoBeTestScenarioArtifacts } from "../test/structures/IAutoBeTestScenarioArtifacts";
|
|
14
17
|
import { transformRealizeCorrectHistories } from "./histories/transformRealizeCorrectHistories";
|
|
15
|
-
import { IAutoBeRealizeCorrectApplication } from "./structures/
|
|
18
|
+
import { IAutoBeRealizeCorrectApplication } from "./structures/IAutoBeRealizeCorrectApplication";
|
|
16
19
|
import { IAutoBeRealizeScenarioApplication } from "./structures/IAutoBeRealizeScenarioApplication";
|
|
17
20
|
import { replaceImportStatements } from "./utils/replaceImportStatements";
|
|
18
21
|
|
|
19
22
|
export async function orchestrateRealizeCorrect<Model extends ILlmSchema.Model>(
|
|
20
23
|
ctx: AutoBeContext<Model>,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
props: {
|
|
25
|
+
authorization: AutoBeRealizeAuthorization | null;
|
|
26
|
+
totalAuthorizations: AutoBeRealizeAuthorization[];
|
|
27
|
+
scenario: IAutoBeRealizeScenarioApplication.IProps;
|
|
28
|
+
code: string;
|
|
29
|
+
diagnostic: IAutoBeTypeScriptCompileResult.IDiagnostic;
|
|
30
|
+
progress: AutoBeProgressEventBase;
|
|
31
|
+
},
|
|
26
32
|
): Promise<AutoBeRealizeCorrectEvent> {
|
|
27
33
|
const artifacts: IAutoBeTestScenarioArtifacts =
|
|
28
34
|
await getTestScenarioArtifacts(ctx, {
|
|
29
|
-
endpoint: scenario.operation,
|
|
35
|
+
endpoint: props.scenario.operation,
|
|
30
36
|
dependencies: [],
|
|
31
37
|
});
|
|
32
38
|
|
|
@@ -43,17 +49,19 @@ export async function orchestrateRealizeCorrect<Model extends ILlmSchema.Model>(
|
|
|
43
49
|
}),
|
|
44
50
|
histories: transformRealizeCorrectHistories({
|
|
45
51
|
state: ctx.state(),
|
|
46
|
-
scenario,
|
|
52
|
+
scenario: props.scenario,
|
|
47
53
|
artifacts,
|
|
48
|
-
authorization,
|
|
49
|
-
code,
|
|
50
|
-
diagnostic,
|
|
54
|
+
authorization: props.authorization,
|
|
55
|
+
code: props.code,
|
|
56
|
+
diagnostic: props.diagnostic,
|
|
57
|
+
totalAuthorizations: props.totalAuthorizations,
|
|
51
58
|
}),
|
|
52
59
|
enforceFunctionCall: true,
|
|
53
|
-
message:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
message: StringUtil.trim`
|
|
61
|
+
Correct the TypeScript code implementation to strictly follow these rules:
|
|
62
|
+
|
|
63
|
+
1. Ensure that the code is production-ready and follows best practices.
|
|
64
|
+
`,
|
|
57
65
|
});
|
|
58
66
|
|
|
59
67
|
if (pointer.value === null)
|
|
@@ -62,16 +70,17 @@ export async function orchestrateRealizeCorrect<Model extends ILlmSchema.Model>(
|
|
|
62
70
|
pointer.value.implementationCode = await replaceImportStatements(ctx)(
|
|
63
71
|
artifacts,
|
|
64
72
|
pointer.value.implementationCode,
|
|
65
|
-
authorization?.payload.name,
|
|
73
|
+
props.authorization?.payload.name,
|
|
66
74
|
);
|
|
67
75
|
|
|
68
76
|
const event: AutoBeRealizeCorrectEvent = {
|
|
69
77
|
type: "realizeCorrect",
|
|
70
|
-
|
|
78
|
+
id: v7(),
|
|
79
|
+
location: props.scenario.location,
|
|
71
80
|
content: pointer.value.implementationCode,
|
|
72
81
|
tokenUsage,
|
|
73
|
-
completed: ++progress.completed,
|
|
74
|
-
total: progress.total,
|
|
82
|
+
completed: ++props.progress.completed,
|
|
83
|
+
total: props.progress.total,
|
|
75
84
|
step: ctx.state().analyze?.step ?? 0,
|
|
76
85
|
created_at: new Date().toISOString(),
|
|
77
86
|
};
|
|
@@ -111,8 +120,3 @@ const collection = {
|
|
|
111
120
|
deepseek: claude,
|
|
112
121
|
"3.1": claude,
|
|
113
122
|
};
|
|
114
|
-
|
|
115
|
-
export interface IProgress {
|
|
116
|
-
total: number;
|
|
117
|
-
completed: number;
|
|
118
|
-
}
|
|
@@ -4,80 +4,6 @@ import { ILlmSchema } from "@samchon/openapi";
|
|
|
4
4
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
5
5
|
import { IAutoBeRealizeScenarioApplication } from "./structures/IAutoBeRealizeScenarioApplication";
|
|
6
6
|
|
|
7
|
-
export interface IAutoBeRealizeScenario {
|
|
8
|
-
/**
|
|
9
|
-
* The name of the function to be generated.
|
|
10
|
-
*
|
|
11
|
-
* Derived from the Swagger path and method. The function name must be written
|
|
12
|
-
* in snake_case. It serves as the entry point in both code generation and
|
|
13
|
-
* test code.
|
|
14
|
-
*
|
|
15
|
-
* Once the function is generated, the function name and file name will be the
|
|
16
|
-
* same. The generated file will be located at
|
|
17
|
-
* `src/providers/${function_name}.ts`.
|
|
18
|
-
*/
|
|
19
|
-
functionName: string;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Definition of path and query parameters extracted from the OpenAPI spec.
|
|
23
|
-
*
|
|
24
|
-
* Includes input values passed via URL path or query string. Used for type
|
|
25
|
-
* definitions, validation, and function signature construction.
|
|
26
|
-
*/
|
|
27
|
-
parameters: AutoBeOpenApi.IParameter[];
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Schema definition for the request body input.
|
|
31
|
-
*
|
|
32
|
-
* Extracted from the requestBody section of Swagger. Represents the input
|
|
33
|
-
* data passed in the body (e.g., JSON). Used for generating function
|
|
34
|
-
* arguments or DTOs.
|
|
35
|
-
*/
|
|
36
|
-
inputSchema: AutoBeOpenApi.IRequestBody | null;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Schema definition for the response body.
|
|
40
|
-
*
|
|
41
|
-
* Extracted from the responses section of Swagger. Used to define the return
|
|
42
|
-
* type and expected output in test code.
|
|
43
|
-
*/
|
|
44
|
-
outputSchema: AutoBeOpenApi.IResponseBody | null;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Natural language description of the function’s purpose.
|
|
48
|
-
*
|
|
49
|
-
* Extracted from the summary or description field of Swagger. Used for code
|
|
50
|
-
* documentation, test scenario generation, and conveying function intent.
|
|
51
|
-
*/
|
|
52
|
-
description: string;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* HTTP method information.
|
|
56
|
-
*
|
|
57
|
-
* Extracted from the Swagger operation method. Used to define the request
|
|
58
|
-
* type during code and test generation.
|
|
59
|
-
*/
|
|
60
|
-
method: "get" | "post" | "put" | "delete" | "patch";
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* List of scenario descriptions for test code generation.
|
|
64
|
-
*
|
|
65
|
-
* Each scenario describes the expected behavior of the function under certain
|
|
66
|
-
* conditions. Used as a basis for TDD-style automated test generation.
|
|
67
|
-
*/
|
|
68
|
-
testScenarios: string[];
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Optional decorator event for customizing code generation behavior.
|
|
72
|
-
*
|
|
73
|
-
* Provides additional metadata or instructions that can modify how the
|
|
74
|
-
* function implementation is generated. Can include custom annotations,
|
|
75
|
-
* middleware configurations, or special handling directives that affect the
|
|
76
|
-
* final code output.
|
|
77
|
-
*/
|
|
78
|
-
decoratorEvent?: AutoBeRealizeAuthorization;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
7
|
/**
|
|
82
8
|
* Generates a planning result that defines what kind of function should be
|
|
83
9
|
* created, based solely on the provided Swagger (OpenAPI) operation — without
|