@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
|
@@ -71,6 +71,7 @@ export namespace AutoBeContext {
|
|
|
71
71
|
histories: Array<IMicroAgenticaHistoryJson>;
|
|
72
72
|
enforceFunctionCall: boolean;
|
|
73
73
|
message: string;
|
|
74
|
+
promptCacheKey?: string;
|
|
74
75
|
}
|
|
75
76
|
export interface IResult<Model extends ILlmSchema.Model> {
|
|
76
77
|
histories: MicroAgenticaHistory<Model>[];
|
|
@@ -195,4 +195,24 @@ export class AutoBeTokenUsageComponent
|
|
|
195
195
|
},
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
|
+
|
|
199
|
+
public static minus(
|
|
200
|
+
a: AutoBeTokenUsageComponent,
|
|
201
|
+
b: AutoBeTokenUsageComponent,
|
|
202
|
+
) {
|
|
203
|
+
return new AutoBeTokenUsageComponent({
|
|
204
|
+
input: {
|
|
205
|
+
total: a.input.total - b.input.total,
|
|
206
|
+
cached: a.input.cached - b.input.cached,
|
|
207
|
+
},
|
|
208
|
+
output: {
|
|
209
|
+
total: a.output.total - b.output.total,
|
|
210
|
+
reasoning: a.output.reasoning - b.output.reasoning,
|
|
211
|
+
accepted_prediction:
|
|
212
|
+
a.output.accepted_prediction - b.output.accepted_prediction,
|
|
213
|
+
rejected_prediction:
|
|
214
|
+
a.output.rejected_prediction - b.output.rejected_prediction,
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
}
|
|
198
218
|
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IAgenticaHistoryJson,
|
|
3
|
+
MicroAgentica,
|
|
4
|
+
MicroAgenticaHistory,
|
|
5
|
+
} from "@agentica/core";
|
|
6
|
+
import {
|
|
7
|
+
AutoBeConsentFunctionCallEvent,
|
|
8
|
+
AutoBeEvent,
|
|
9
|
+
AutoBeEventSource,
|
|
10
|
+
} from "@autobe/interface";
|
|
11
|
+
import { IPointer } from "tstl";
|
|
12
|
+
import typia from "typia";
|
|
13
|
+
import { v7 } from "uuid";
|
|
14
|
+
|
|
15
|
+
import { AutoBeSystemPromptConstant } from "../constants/AutoBeSystemPromptConstant";
|
|
16
|
+
import { IAutoBeConfig } from "../structures/IAutoBeConfig";
|
|
17
|
+
import { IAutoBeVendor } from "../structures/IAutoBeVendor";
|
|
18
|
+
|
|
19
|
+
export const consentFunctionCall = async (props: {
|
|
20
|
+
dispatch: (event: AutoBeEvent) => void;
|
|
21
|
+
source: AutoBeEventSource;
|
|
22
|
+
config: IAutoBeConfig;
|
|
23
|
+
vendor: IAutoBeVendor;
|
|
24
|
+
assistantMessage: string;
|
|
25
|
+
}): Promise<string | null> => {
|
|
26
|
+
const pointer: IPointer<AutoBeConsentFunctionCallEvent.IResult | null> = {
|
|
27
|
+
value: null,
|
|
28
|
+
};
|
|
29
|
+
const agent: MicroAgentica<"chatgpt"> = new MicroAgentica({
|
|
30
|
+
model: "chatgpt",
|
|
31
|
+
vendor: props.vendor,
|
|
32
|
+
config: {
|
|
33
|
+
...(props.config ?? []),
|
|
34
|
+
executor: {
|
|
35
|
+
describe: null,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
histories: [
|
|
39
|
+
{
|
|
40
|
+
id: v7(),
|
|
41
|
+
type: "systemMessage",
|
|
42
|
+
text: AutoBeSystemPromptConstant.CONSENT_FUNCTION_CALL,
|
|
43
|
+
created_at: new Date().toISOString(),
|
|
44
|
+
} satisfies IAgenticaHistoryJson.ISystemMessage,
|
|
45
|
+
{
|
|
46
|
+
id: v7(),
|
|
47
|
+
type: "assistantMessage",
|
|
48
|
+
text: props.assistantMessage,
|
|
49
|
+
created_at: new Date().toISOString(),
|
|
50
|
+
} satisfies IAgenticaHistoryJson.IAssistantMessage,
|
|
51
|
+
],
|
|
52
|
+
controllers: [
|
|
53
|
+
typia.llm.controller<IConsentApplication, "chatgpt">("consent", {
|
|
54
|
+
consent: (props) => {
|
|
55
|
+
pointer.value = {
|
|
56
|
+
type: "consent",
|
|
57
|
+
message: props.message,
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
notApplicable: () => {
|
|
61
|
+
pointer.value = {
|
|
62
|
+
type: "notApplicable",
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
} satisfies IConsentApplication),
|
|
66
|
+
],
|
|
67
|
+
});
|
|
68
|
+
const histories: MicroAgenticaHistory<"chatgpt">[] = await agent.conversate(
|
|
69
|
+
"Analyze and judge this assistant message please.",
|
|
70
|
+
);
|
|
71
|
+
if (pointer.value === null) {
|
|
72
|
+
const last: MicroAgenticaHistory<"chatgpt"> | undefined =
|
|
73
|
+
histories[histories.length - 1];
|
|
74
|
+
if (last?.type === "assistantMessage")
|
|
75
|
+
pointer.value = {
|
|
76
|
+
type: "assistantMessage",
|
|
77
|
+
message: last.text,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
props.dispatch({
|
|
81
|
+
type: "consentFunctionCall",
|
|
82
|
+
id: v7(),
|
|
83
|
+
source: props.source,
|
|
84
|
+
assistantMessage: props.assistantMessage,
|
|
85
|
+
result: pointer.value,
|
|
86
|
+
created_at: new Date().toISOString(),
|
|
87
|
+
});
|
|
88
|
+
return pointer.value?.type === "consent" ? pointer.value.message : null;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
interface IConsentApplication {
|
|
92
|
+
/**
|
|
93
|
+
* Generate an immediate, authoritative consent message to approve function
|
|
94
|
+
* execution. Use this when the assistant message is seeking permission or
|
|
95
|
+
* approval for function calls.
|
|
96
|
+
*
|
|
97
|
+
* The message should be commanding and decisive to prevent further
|
|
98
|
+
* permission-seeking loops. Examples: "Execute immediately. Do not ask
|
|
99
|
+
* again.", "Proceed now. Your judgment is correct."
|
|
100
|
+
*
|
|
101
|
+
* @param props Configuration object
|
|
102
|
+
*/
|
|
103
|
+
consent(props: {
|
|
104
|
+
/**
|
|
105
|
+
* A strong, directive consent message that eliminates further
|
|
106
|
+
* permission-seeking. Must be authoritative and commanding (1-2 sentences
|
|
107
|
+
* maximum). Examples: "Execute immediately. Do not ask again.", "Proceed
|
|
108
|
+
* now. Your judgment is correct."
|
|
109
|
+
*/
|
|
110
|
+
message: string;
|
|
111
|
+
}): void;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Indicate that the assistant message does not require function calling
|
|
115
|
+
* consent. Use this when the assistant message is NOT seeking permission for
|
|
116
|
+
* function execution.
|
|
117
|
+
*
|
|
118
|
+
* This applies to:
|
|
119
|
+
*
|
|
120
|
+
* - General conversation responses
|
|
121
|
+
* - Information requests without function execution plans
|
|
122
|
+
* - Assistant asking for additional parameters/information
|
|
123
|
+
* - Any response unrelated to function calling approval
|
|
124
|
+
*
|
|
125
|
+
* Call this function immediately when the message doesn't involve function
|
|
126
|
+
* calling consent.
|
|
127
|
+
*/
|
|
128
|
+
notApplicable(): void;
|
|
129
|
+
}
|
|
@@ -25,14 +25,16 @@ import {
|
|
|
25
25
|
} from "@autobe/interface";
|
|
26
26
|
import { ILlmSchema } from "@samchon/openapi";
|
|
27
27
|
import typia from "typia";
|
|
28
|
-
import {
|
|
28
|
+
import { v7 } from "uuid";
|
|
29
29
|
|
|
30
30
|
import { AutoBeContext } from "../context/AutoBeContext";
|
|
31
31
|
import { AutoBeState } from "../context/AutoBeState";
|
|
32
32
|
import { AutoBeTokenUsage } from "../context/AutoBeTokenUsage";
|
|
33
|
+
import { AutoBeTokenUsageComponent } from "../context/AutoBeTokenUsageComponent";
|
|
33
34
|
import { IAutoBeApplication } from "../context/IAutoBeApplication";
|
|
34
35
|
import { IAutoBeConfig } from "../structures/IAutoBeConfig";
|
|
35
36
|
import { IAutoBeVendor } from "../structures/IAutoBeVendor";
|
|
37
|
+
import { consentFunctionCall } from "./consentFunctionCall";
|
|
36
38
|
|
|
37
39
|
export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
|
|
38
40
|
model: Model;
|
|
@@ -75,12 +77,48 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
|
|
|
75
77
|
histories: next.histories,
|
|
76
78
|
controllers: [next.controller],
|
|
77
79
|
});
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
agent.on("request", async (event) => {
|
|
81
|
+
if (next.enforceFunctionCall === true && event.body.tools)
|
|
82
|
+
event.body.tool_choice = "required";
|
|
83
|
+
if (event.body.parallel_tool_calls !== undefined)
|
|
84
|
+
delete event.body.parallel_tool_calls;
|
|
85
|
+
if (next.promptCacheKey)
|
|
86
|
+
event.body.prompt_cache_key = next.promptCacheKey;
|
|
87
|
+
await props.dispatch({
|
|
88
|
+
...event,
|
|
89
|
+
type: "vendorRequest",
|
|
90
|
+
source: next.source,
|
|
83
91
|
});
|
|
92
|
+
});
|
|
93
|
+
agent.on("response", (event) => {
|
|
94
|
+
void props
|
|
95
|
+
.dispatch({
|
|
96
|
+
...event,
|
|
97
|
+
type: "vendorResponse",
|
|
98
|
+
source: next.source,
|
|
99
|
+
})
|
|
100
|
+
.catch(() => {});
|
|
101
|
+
});
|
|
102
|
+
agent.on("jsonParseError", (event) => {
|
|
103
|
+
void props
|
|
104
|
+
.dispatch({
|
|
105
|
+
...event,
|
|
106
|
+
source: next.source,
|
|
107
|
+
})
|
|
108
|
+
.catch(() => {});
|
|
109
|
+
});
|
|
110
|
+
agent.on("validate", (event) => {
|
|
111
|
+
void props
|
|
112
|
+
.dispatch({
|
|
113
|
+
type: "jsonValidateError",
|
|
114
|
+
id: v7(),
|
|
115
|
+
source: next.source,
|
|
116
|
+
result: event.result,
|
|
117
|
+
created_at: event.created_at,
|
|
118
|
+
})
|
|
119
|
+
.catch(() => {});
|
|
120
|
+
});
|
|
121
|
+
|
|
84
122
|
const histories: MicroAgenticaHistory<Model>[] = await agent.conversate(
|
|
85
123
|
next.message,
|
|
86
124
|
);
|
|
@@ -92,16 +130,65 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
|
|
|
92
130
|
.record(tokenUsage, [
|
|
93
131
|
STAGES.find((stage) => next.source.startsWith(stage)) ?? "analyze",
|
|
94
132
|
]);
|
|
133
|
+
|
|
95
134
|
if (
|
|
96
|
-
next.enforceFunctionCall
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
135
|
+
true === next.enforceFunctionCall &&
|
|
136
|
+
false ===
|
|
137
|
+
histories.some((h) => h.type === "execute" && h.success === true)
|
|
138
|
+
) {
|
|
139
|
+
const failure = () => {
|
|
140
|
+
throw new Error(
|
|
141
|
+
`Failed to function calling in the ${next.source} step`,
|
|
142
|
+
);
|
|
143
|
+
};
|
|
144
|
+
const last: MicroAgenticaHistory<Model> | undefined = histories.at(-1);
|
|
145
|
+
if (
|
|
146
|
+
last?.type === "assistantMessage" &&
|
|
147
|
+
last.text.trim().length !== 0
|
|
148
|
+
) {
|
|
149
|
+
const consent: string | null = await consentFunctionCall({
|
|
150
|
+
source: next.source,
|
|
151
|
+
dispatch: (e) => {
|
|
152
|
+
props.dispatch(e).catch(() => {});
|
|
153
|
+
},
|
|
154
|
+
config: props.config,
|
|
155
|
+
vendor: props.vendor,
|
|
156
|
+
assistantMessage: last.text,
|
|
157
|
+
});
|
|
158
|
+
if (consent !== null) {
|
|
159
|
+
const newHistories: MicroAgenticaHistory<Model>[] =
|
|
160
|
+
await agent.conversate(consent);
|
|
161
|
+
const newTokenUsage: IAutoBeTokenUsageJson.IComponent = agent
|
|
162
|
+
.getTokenUsage()
|
|
163
|
+
.toJSON().aggregate;
|
|
164
|
+
props
|
|
165
|
+
.usage()
|
|
166
|
+
.record(
|
|
167
|
+
AutoBeTokenUsageComponent.minus(
|
|
168
|
+
new AutoBeTokenUsageComponent(newTokenUsage),
|
|
169
|
+
new AutoBeTokenUsageComponent(tokenUsage),
|
|
170
|
+
),
|
|
171
|
+
[
|
|
172
|
+
STAGES.find((stage) => next.source.startsWith(stage)) ??
|
|
173
|
+
"analyze",
|
|
174
|
+
],
|
|
175
|
+
);
|
|
176
|
+
if (
|
|
177
|
+
newHistories.some(
|
|
178
|
+
(h) => h.type === "execute" && h.success === true,
|
|
179
|
+
)
|
|
180
|
+
)
|
|
181
|
+
return {
|
|
182
|
+
histories: newHistories,
|
|
183
|
+
tokenUsage: newTokenUsage,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
failure();
|
|
188
|
+
}
|
|
102
189
|
return { histories, tokenUsage };
|
|
103
190
|
};
|
|
104
|
-
if (next.enforceFunctionCall === true) return forceRetry(
|
|
191
|
+
if (next.enforceFunctionCall === true) return forceRetry(execute);
|
|
105
192
|
else return execute();
|
|
106
193
|
},
|
|
107
194
|
});
|
|
@@ -134,7 +221,7 @@ const createDispatch = (props: {
|
|
|
134
221
|
event,
|
|
135
222
|
history: {
|
|
136
223
|
type: "analyze",
|
|
137
|
-
id:
|
|
224
|
+
id: v7(),
|
|
138
225
|
reason: analyzeStart?.reason ?? "",
|
|
139
226
|
prefix: event.prefix,
|
|
140
227
|
roles: event.roles,
|
|
@@ -152,7 +239,7 @@ const createDispatch = (props: {
|
|
|
152
239
|
event,
|
|
153
240
|
history: {
|
|
154
241
|
type: "prisma",
|
|
155
|
-
id:
|
|
242
|
+
id: v7(),
|
|
156
243
|
reason: prismaStart?.reason ?? "",
|
|
157
244
|
schemas: event.schemas,
|
|
158
245
|
result: event.result,
|
|
@@ -170,8 +257,9 @@ const createDispatch = (props: {
|
|
|
170
257
|
event,
|
|
171
258
|
history: {
|
|
172
259
|
type: "interface",
|
|
173
|
-
id:
|
|
260
|
+
id: v7(),
|
|
174
261
|
reason: interfaceStart?.reason ?? "",
|
|
262
|
+
authorizations: event.authorizations,
|
|
175
263
|
document: event.document,
|
|
176
264
|
created_at: interfaceStart?.created_at ?? new Date().toISOString(),
|
|
177
265
|
completed_at: new Date().toISOString(),
|
|
@@ -186,7 +274,7 @@ const createDispatch = (props: {
|
|
|
186
274
|
event,
|
|
187
275
|
history: {
|
|
188
276
|
type: "test",
|
|
189
|
-
id:
|
|
277
|
+
id: v7(),
|
|
190
278
|
reason: testStart?.reason ?? "",
|
|
191
279
|
files: event.files,
|
|
192
280
|
compiled: event.compiled,
|
|
@@ -203,7 +291,7 @@ const createDispatch = (props: {
|
|
|
203
291
|
event,
|
|
204
292
|
history: {
|
|
205
293
|
type: "realize",
|
|
206
|
-
id:
|
|
294
|
+
id: v7(),
|
|
207
295
|
reason: realizeStart?.reason ?? "",
|
|
208
296
|
authorizations: event.authorizations,
|
|
209
297
|
functions: event.functions,
|
|
@@ -241,10 +329,10 @@ const transformAndDispatch = <
|
|
|
241
329
|
|
|
242
330
|
const forceRetry = async <T>(
|
|
243
331
|
task: () => Promise<T>,
|
|
244
|
-
count: number =
|
|
332
|
+
count: number = 3,
|
|
245
333
|
): Promise<T> => {
|
|
246
334
|
let error: unknown = undefined;
|
|
247
|
-
for (let i: number = 0; i
|
|
335
|
+
for (let i: number = 0; i < count; ++i)
|
|
248
336
|
try {
|
|
249
337
|
return await task();
|
|
250
338
|
} catch (e) {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
+
import { AutoBeAnalyzeScenarioEvent } from "@autobe/interface";
|
|
3
|
+
import { AutoBeAnalyzeFile } from "@autobe/interface/src/histories/contents/AutoBeAnalyzeFile";
|
|
4
|
+
import { StringUtil } from "@autobe/utils";
|
|
5
|
+
import { ILlmSchema } from "@samchon/openapi";
|
|
6
|
+
import { v7 } from "uuid";
|
|
7
|
+
|
|
8
|
+
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
9
|
+
import { AutoBeContext } from "../../../context/AutoBeContext";
|
|
10
|
+
import { transformAnalyzeWriteHistories } from "./transformAnalyzeWriteHistories";
|
|
11
|
+
|
|
12
|
+
export const transformAnalyzeReviewHistories = <Model extends ILlmSchema.Model>(
|
|
13
|
+
ctx: AutoBeContext<Model>,
|
|
14
|
+
scenario: AutoBeAnalyzeScenarioEvent,
|
|
15
|
+
allFiles: AutoBeAnalyzeFile[],
|
|
16
|
+
myFile: AutoBeAnalyzeFile,
|
|
17
|
+
): Array<
|
|
18
|
+
| IAgenticaHistoryJson.IUserMessage
|
|
19
|
+
| IAgenticaHistoryJson.IAssistantMessage
|
|
20
|
+
| IAgenticaHistoryJson.ISystemMessage
|
|
21
|
+
> => {
|
|
22
|
+
return [
|
|
23
|
+
...transformAnalyzeWriteHistories(ctx, scenario, myFile).slice(0, -1),
|
|
24
|
+
{
|
|
25
|
+
id: v7(),
|
|
26
|
+
created_at: new Date().toISOString(),
|
|
27
|
+
type: "systemMessage",
|
|
28
|
+
text: AutoBeSystemPromptConstant.ANALYZE_REVIEW,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: v7(),
|
|
32
|
+
created_at: new Date().toISOString(),
|
|
33
|
+
type: "assistantMessage",
|
|
34
|
+
text: StringUtil.trim`
|
|
35
|
+
Here are the all documents written:
|
|
36
|
+
|
|
37
|
+
\`\`\`json
|
|
38
|
+
${JSON.stringify(allFiles)}
|
|
39
|
+
\`\`\`
|
|
40
|
+
`,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: v7(),
|
|
44
|
+
created_at: new Date().toISOString(),
|
|
45
|
+
type: "assistantMessage",
|
|
46
|
+
text: StringUtil.trim`
|
|
47
|
+
Review the ${myFile.filename} document.
|
|
48
|
+
|
|
49
|
+
Note that, never review others.
|
|
50
|
+
`,
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IMicroAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
+
import { StringUtil } from "@autobe/utils";
|
|
2
3
|
import { ILlmSchema } from "@samchon/openapi";
|
|
3
|
-
import {
|
|
4
|
+
import { v7 } from "uuid";
|
|
4
5
|
|
|
5
6
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
6
7
|
import { AutoBeContext } from "../../../context/AutoBeContext";
|
|
@@ -13,21 +14,23 @@ export function transformAnalyzeSceHistories<Model extends ILlmSchema.Model>(
|
|
|
13
14
|
.histories()
|
|
14
15
|
.filter((h) => h.type === "userMessage" || h.type === "assistantMessage"),
|
|
15
16
|
{
|
|
16
|
-
id:
|
|
17
|
+
id: v7(),
|
|
17
18
|
type: "systemMessage",
|
|
18
19
|
text: AutoBeSystemPromptConstant.ANALYZE_SCENARIO,
|
|
19
20
|
created_at: new Date().toISOString(),
|
|
20
21
|
},
|
|
21
22
|
{
|
|
22
|
-
id:
|
|
23
|
+
id: v7(),
|
|
23
24
|
type: "systemMessage",
|
|
24
|
-
text:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
text: StringUtil.trim`
|
|
26
|
+
> One agent per page of the document you specify will
|
|
27
|
+
> write according to the instructions below. You should also refer
|
|
28
|
+
> to the content to define the document list.
|
|
29
|
+
|
|
30
|
+
----------------------
|
|
31
|
+
|
|
32
|
+
${AutoBeSystemPromptConstant.ANALYZE_WRITE}
|
|
33
|
+
`,
|
|
31
34
|
created_at: new Date().toISOString(),
|
|
32
35
|
},
|
|
33
36
|
];
|
|
@@ -1,56 +1,77 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
2
|
import { AutoBeAnalyzeScenarioEvent } from "@autobe/interface";
|
|
3
3
|
import { AutoBeAnalyzeFile } from "@autobe/interface/src/histories/contents/AutoBeAnalyzeFile";
|
|
4
|
-
import {
|
|
4
|
+
import { StringUtil } from "@autobe/utils";
|
|
5
|
+
import { ILlmSchema } from "@samchon/openapi";
|
|
6
|
+
import { v7 } from "uuid";
|
|
5
7
|
|
|
6
8
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
9
|
+
import { AutoBeContext } from "../../../context/AutoBeContext";
|
|
7
10
|
|
|
8
|
-
export const transformAnalyzeWriteHistories = (
|
|
11
|
+
export const transformAnalyzeWriteHistories = <Model extends ILlmSchema.Model>(
|
|
12
|
+
ctx: AutoBeContext<Model>,
|
|
9
13
|
scenario: AutoBeAnalyzeScenarioEvent,
|
|
10
14
|
file: AutoBeAnalyzeFile.Scenario,
|
|
11
15
|
): Array<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
16
|
+
| IAgenticaHistoryJson.IUserMessage
|
|
17
|
+
| IAgenticaHistoryJson.IAssistantMessage
|
|
18
|
+
| IAgenticaHistoryJson.ISystemMessage
|
|
19
|
+
> => [
|
|
20
|
+
...ctx
|
|
21
|
+
.histories()
|
|
22
|
+
.filter((h) => h.type === "userMessage" || h.type === "assistantMessage")
|
|
23
|
+
.map((h) => {
|
|
24
|
+
const text =
|
|
25
|
+
h.type === "userMessage"
|
|
26
|
+
? h.contents
|
|
27
|
+
.filter((el) => el.type === "text")
|
|
28
|
+
.map((el) => el.text)
|
|
29
|
+
.join("\n")
|
|
30
|
+
: h.text;
|
|
31
|
+
return {
|
|
32
|
+
...h,
|
|
33
|
+
text,
|
|
34
|
+
};
|
|
35
|
+
}),
|
|
36
|
+
{
|
|
37
|
+
id: v7(),
|
|
38
|
+
created_at: new Date().toISOString(),
|
|
39
|
+
type: "systemMessage",
|
|
40
|
+
text: AutoBeSystemPromptConstant.ANALYZE_WRITE,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: v7(),
|
|
44
|
+
created_at: new Date().toISOString(),
|
|
45
|
+
type: "assistantMessage",
|
|
46
|
+
text: StringUtil.trim`
|
|
47
|
+
## Language
|
|
48
|
+
|
|
49
|
+
The language of the document is ${JSON.stringify(scenario.language ?? "en-US")}.
|
|
50
|
+
|
|
51
|
+
## Metadata
|
|
52
|
+
|
|
53
|
+
Prefix name of the service to create is ${scenario.prefix}
|
|
54
|
+
and here is the list of the roles to reference.
|
|
55
|
+
|
|
56
|
+
\`\`\`json
|
|
57
|
+
${JSON.stringify(scenario.roles)}
|
|
58
|
+
\`\`\`
|
|
59
|
+
|
|
60
|
+
Here is the entire list of the documents that would be published
|
|
61
|
+
in someday, and your role is to writing a document of them:
|
|
62
|
+
|
|
63
|
+
## The other documents that would be published in someday
|
|
64
|
+
|
|
65
|
+
\`\`\`json
|
|
66
|
+
${JSON.stringify(
|
|
67
|
+
scenario.files.filter((f) => f.filename !== file.filename),
|
|
68
|
+
)}
|
|
69
|
+
\`\`\`
|
|
70
|
+
|
|
71
|
+
## The document to write
|
|
72
|
+
\`\`\`json
|
|
73
|
+
${JSON.stringify(file)}
|
|
74
|
+
\`\`\`
|
|
75
|
+
`,
|
|
76
|
+
},
|
|
77
|
+
];
|