@autobe/agent 0.25.7 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AutoBeAgent.d.ts +2 -1
- package/lib/AutoBeAgent.js +30 -7
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/AutoBeMockAgent.js +13 -12
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +27 -20
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/context/AutoBeContext.d.ts +4 -1
- package/lib/context/AutoBeTokenUsage.d.ts +1 -1
- package/lib/context/AutoBeTokenUsage.js.map +1 -1
- package/lib/factory/AutoBeFunctionCallingMetricFactory.d.ts +7 -0
- package/lib/factory/AutoBeFunctionCallingMetricFactory.js +35 -0
- package/lib/factory/AutoBeFunctionCallingMetricFactory.js.map +1 -0
- package/lib/factory/AutoBeProcessAggregateFactory.d.ts +13 -0
- package/lib/factory/AutoBeProcessAggregateFactory.js +100 -0
- package/lib/factory/AutoBeProcessAggregateFactory.js.map +1 -0
- package/lib/factory/consentFunctionCall.js +3 -0
- package/lib/factory/consentFunctionCall.js.map +1 -1
- package/lib/factory/createAutoBeContext.d.ts +2 -1
- package/lib/factory/createAutoBeContext.js +82 -28
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/factory/getCommonPrompt.d.ts +2 -0
- package/lib/factory/getCommonPrompt.js +20 -0
- package/lib/factory/getCommonPrompt.js.map +1 -0
- package/lib/index.mjs +20929 -19874
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +2 -2
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +6 -6
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +2 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js +2 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +75 -74
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +5 -4
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +9 -9
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +1 -1
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +2 -17
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +1 -1
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.d.ts +6 -0
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js +58 -0
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js.map +1 -0
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.d.ts +2 -1
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +3 -2
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
- package/lib/{factory/createAutoBeApplication.d.ts → orchestrate/facade/createAutoBeFacadeController.d.ts} +2 -2
- package/lib/{factory/createAutoBeApplication.js → orchestrate/facade/createAutoBeFacadeController.js} +53 -57
- package/lib/orchestrate/facade/createAutoBeFacadeController.js.map +1 -0
- package/lib/orchestrate/facade/histories/IAutoBeFacadeApplication.js.map +1 -0
- package/lib/orchestrate/facade/histories/IAutoBeFacadeApplicationProps.js.map +1 -0
- package/lib/orchestrate/facade/histories/IAutoBeFacadeApplicationResult.js.map +1 -0
- package/lib/orchestrate/facade/{transformFacadeStateMessage.d.ts → structures/transformFacadeStateMessage.d.ts} +1 -1
- package/lib/orchestrate/facade/structures/transformFacadeStateMessage.js +46 -0
- package/lib/orchestrate/facade/structures/transformFacadeStateMessage.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +8 -8
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +3 -2
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +46 -20
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.d.ts +5 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js +51 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.d.ts +11 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js +81 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterface.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +33 -6
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +185 -97
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +234 -59
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +5 -4
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +0 -6
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +4 -4
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +4 -3
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +178 -90
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +176 -88
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +6 -5
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.d.ts +7 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +445 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.d.ts +14 -0
- package/lib/orchestrate/interface/{orchestrateInterfaceSchemasReview.js → orchestrateInterfaceSchemaReview.js} +302 -121
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +243 -65
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +22 -22
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +7 -7
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.d.ts +101 -0
- package/lib/orchestrate/interface/structures/{IAutobeInterfaceSchemasReviewApplication.js → IAutoBeInterfaceSchemaContentReviewApplication.js} +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.d.ts +97 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.d.ts +44 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.d.ts +92 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +65 -24
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +94 -0
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
- package/lib/orchestrate/interface/utils/OperationValidator.d.ts +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +13 -13
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.js +1 -0
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +2 -2
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +4 -3
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +2 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaReview.js +2 -1
- package/lib/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +2 -2
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +4 -3
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.d.ts +2 -2
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js +8 -7
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +4 -4
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.d.ts +4 -7
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +8 -18
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +0 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +8 -28
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +16 -280
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.d.ts +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.js +4 -3
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +14 -13
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +12 -11
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +46 -24
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.js → orchestrateRealizeCorrectCasting.js} +64 -51
- package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js +2 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +3 -3
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.d.ts +2 -2
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js +6 -6
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js.map +1 -1
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -1
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +2 -2
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteDto.js +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js +2 -2
- package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -1
- package/lib/orchestrate/realize/utils/printErrorHints.js +1 -1
- package/lib/orchestrate/realize/utils/printErrorHints.js.map +1 -1
- package/lib/orchestrate/realize/utils/replaceImportStatements.js +0 -85
- package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js +1 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +5 -22
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +10 -10
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +5 -5
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +2 -2
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTest.d.ts +1 -1
- package/lib/orchestrate/test/orchestrateTest.js +2 -1
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +5 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +4 -2
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +28 -27
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js +4 -3
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +2 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.d.ts → IAutoBeTestScenarioAuthorizationActor.d.ts} +1 -1
- package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.js → IAutoBeTestScenarioAuthorizationActor.js} +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationActor.js.map +1 -0
- package/lib/utils/TokenUsageComputer.d.ts +5 -0
- package/lib/utils/TokenUsageComputer.js +29 -0
- package/lib/utils/TokenUsageComputer.js.map +1 -0
- package/package.json +7 -7
- package/src/AutoBeAgent.ts +43 -6
- package/src/AutoBeMockAgent.ts +13 -12
- package/src/constants/AutoBeSystemPromptConstant.ts +27 -20
- package/src/context/AutoBeContext.ts +8 -0
- package/src/context/AutoBeTokenUsage.ts +1 -1
- package/src/factory/AutoBeFunctionCallingMetricFactory.ts +44 -0
- package/src/factory/AutoBeProcessAggregateFactory.ts +141 -0
- package/src/factory/consentFunctionCall.ts +4 -0
- package/src/factory/createAutoBeContext.ts +101 -37
- package/src/factory/getCommonPrompt.ts +25 -0
- package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +5 -5
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +2 -1
- package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +2 -1
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +5 -4
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +3 -2
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +9 -9
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +1 -1
- package/src/orchestrate/common/histories/transformCommonCorrectCastingHistories.ts +2 -20
- package/src/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.ts +65 -0
- package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +5 -2
- package/src/orchestrate/facade/createAutoBeFacadeController.ts +135 -0
- package/src/orchestrate/facade/{transformFacadeStateMessage.ts → structures/transformFacadeStateMessage.ts} +2 -2
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +9 -9
- package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +1 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +45 -20
- package/src/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.ts +55 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.ts +90 -0
- package/src/orchestrate/interface/orchestrateInterface.ts +47 -16
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +20 -19
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +2 -1
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +7 -6
- package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +5 -6
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +7 -6
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +25 -24
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +6 -5
- package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +4 -3
- package/src/orchestrate/interface/orchestrateInterfaceSchemaRename.ts +270 -0
- package/src/orchestrate/interface/{orchestrateInterfaceSchemasReview.ts → orchestrateInterfaceSchemaReview.ts} +89 -76
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +18 -9
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +26 -22
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +7 -7
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.ts +108 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.ts +104 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.ts +45 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.ts +99 -0
- package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +45 -3
- package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +110 -0
- package/src/orchestrate/interface/utils/OperationValidator.ts +1 -1
- package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +12 -12
- package/src/orchestrate/prisma/orchestratePrisma.ts +6 -5
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +6 -5
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +2 -1
- package/src/orchestrate/prisma/orchestratePrismaReview.ts +2 -1
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +9 -8
- package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +8 -7
- package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +4 -4
- package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +14 -28
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +13 -30
- package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +20 -285
- package/src/orchestrate/realize/orchestrateRealize.ts +4 -3
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +11 -10
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +5 -4
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +77 -62
- package/src/orchestrate/realize/{orchestRateRealizeCorrectCasting.ts → orchestrateRealizeCorrectCasting.ts} +92 -90
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +2 -1
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +3 -3
- package/src/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.ts +10 -7
- package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -1
- package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +2 -2
- package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +1 -1
- package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +2 -2
- package/src/orchestrate/realize/utils/printErrorHints.ts +1 -1
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +0 -90
- package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +1 -1
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +6 -24
- package/src/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.ts +10 -10
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +12 -10
- package/src/orchestrate/test/orchestrateTest.ts +3 -2
- package/src/orchestrate/test/orchestrateTestCorrect.ts +5 -1
- package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +4 -2
- package/src/orchestrate/test/orchestrateTestScenario.ts +32 -31
- package/src/orchestrate/test/orchestrateTestScenarioReview.ts +4 -3
- package/src/orchestrate/test/orchestrateTestWrite.ts +2 -1
- package/src/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.ts → IAutoBeTestScenarioAuthorizationActor.ts} +1 -1
- package/src/utils/TokenUsageComputer.ts +35 -0
- package/lib/context/IAutoBeFacadeApplication.js.map +0 -1
- package/lib/context/IAutoBeFacadeApplicationProps.js.map +0 -1
- package/lib/context/IAutoBeFacadeApplicationResult.js.map +0 -1
- package/lib/factory/createAutoBeApplication.js.map +0 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js +0 -46
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +0 -4
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +0 -60
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +0 -9
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +0 -1
- package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +0 -91
- package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.js.map +0 -1
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +0 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.js.map +0 -1
- package/src/factory/createAutoBeApplication.ts +0 -123
- package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +0 -67
- package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +0 -96
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.d.ts +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.js +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.d.ts +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.js +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.d.ts +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.js +0 -0
- /package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.d.ts → orchestrateRealizeCorrectCasting.d.ts} +0 -0
- /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.ts +0 -0
- /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.ts +0 -0
- /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.ts +0 -0
|
@@ -10,9 +10,12 @@ import {
|
|
|
10
10
|
AutoBeAssistantMessageHistory,
|
|
11
11
|
AutoBeEvent,
|
|
12
12
|
AutoBeEventSource,
|
|
13
|
+
AutoBeFunctionCallingMetric,
|
|
13
14
|
AutoBeHistory,
|
|
14
15
|
AutoBeInterfaceHistory,
|
|
16
|
+
AutoBePhase,
|
|
15
17
|
AutoBePrismaHistory,
|
|
18
|
+
AutoBeProcessAggregateCollection,
|
|
16
19
|
AutoBeRealizeHistory,
|
|
17
20
|
AutoBeTestHistory,
|
|
18
21
|
IAutoBeCompiler,
|
|
@@ -33,12 +36,16 @@ export interface AutoBeContext<Model extends ILlmSchema.Model> {
|
|
|
33
36
|
retry: number;
|
|
34
37
|
|
|
35
38
|
// accessors
|
|
39
|
+
aggregates: AutoBeProcessAggregateCollection;
|
|
36
40
|
compilerListener: IAutoBeCompilerListener;
|
|
37
41
|
compiler: () => Promise<IAutoBeCompiler>;
|
|
38
42
|
files: (options: IAutoBeGetFilesOptions) => Promise<Record<string, string>>;
|
|
39
43
|
histories: () => Readonly<AutoBeHistory[]>;
|
|
40
44
|
state: () => Readonly<AutoBeState>;
|
|
41
45
|
usage: () => AutoBeTokenUsage;
|
|
46
|
+
getCurrentAggregates: (
|
|
47
|
+
phase: AutoBePhase,
|
|
48
|
+
) => AutoBeProcessAggregateCollection;
|
|
42
49
|
|
|
43
50
|
// events
|
|
44
51
|
dispatch: <Event extends Exclude<AutoBeEvent, AutoBeAssistantMessageEvent>>(
|
|
@@ -79,5 +86,6 @@ export namespace AutoBeContext {
|
|
|
79
86
|
export interface IResult<Model extends ILlmSchema.Model> {
|
|
80
87
|
histories: MicroAgenticaHistory<Model>[];
|
|
81
88
|
tokenUsage: IAutoBeTokenUsageJson.IComponent;
|
|
89
|
+
metric: AutoBeFunctionCallingMetric;
|
|
82
90
|
}
|
|
83
91
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IAutoBeTokenUsageJson } from "@autobe/interface";
|
|
2
2
|
|
|
3
|
+
import { IAutoBeFacadeApplication } from "../orchestrate/facade/histories/IAutoBeFacadeApplication";
|
|
3
4
|
import { AutoBeTokenUsageComponent } from "./AutoBeTokenUsageComponent";
|
|
4
|
-
import { IAutoBeFacadeApplication } from "./IAutoBeFacadeApplication";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Comprehensive token usage tracker for the AutoBe vibe coding system.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AutoBeFunctionCallingMetric } from "@autobe/interface";
|
|
2
|
+
|
|
3
|
+
export namespace AutoBeFunctionCallingMetricFactory {
|
|
4
|
+
export const create = (): AutoBeFunctionCallingMetric => ({
|
|
5
|
+
attempt: 0,
|
|
6
|
+
success: 0,
|
|
7
|
+
consent: 0,
|
|
8
|
+
validationFailure: 0,
|
|
9
|
+
invalidJson: 0,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const increment = (
|
|
13
|
+
x: AutoBeFunctionCallingMetric,
|
|
14
|
+
y: AutoBeFunctionCallingMetric,
|
|
15
|
+
): void => {
|
|
16
|
+
x.attempt += y.attempt;
|
|
17
|
+
x.success += y.success;
|
|
18
|
+
x.consent += y.consent;
|
|
19
|
+
x.validationFailure += y.validationFailure;
|
|
20
|
+
x.invalidJson += y.invalidJson;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const plus = (
|
|
24
|
+
x: AutoBeFunctionCallingMetric,
|
|
25
|
+
y: AutoBeFunctionCallingMetric,
|
|
26
|
+
): AutoBeFunctionCallingMetric => ({
|
|
27
|
+
attempt: x.attempt + y.attempt,
|
|
28
|
+
success: x.success + y.success,
|
|
29
|
+
consent: x.consent + y.consent,
|
|
30
|
+
validationFailure: x.validationFailure + y.validationFailure,
|
|
31
|
+
invalidJson: x.invalidJson + y.invalidJson,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export const minus = (
|
|
35
|
+
x: AutoBeFunctionCallingMetric,
|
|
36
|
+
y: AutoBeFunctionCallingMetric,
|
|
37
|
+
): AutoBeFunctionCallingMetric => ({
|
|
38
|
+
attempt: x.attempt - y.attempt,
|
|
39
|
+
success: x.success - y.success,
|
|
40
|
+
consent: x.consent - y.consent,
|
|
41
|
+
validationFailure: x.validationFailure - y.validationFailure,
|
|
42
|
+
invalidJson: x.invalidJson - y.invalidJson,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AutoBeAggregateEventBase,
|
|
3
|
+
AutoBePhase,
|
|
4
|
+
AutoBeProcessAggregate,
|
|
5
|
+
AutoBeProcessAggregateCollection,
|
|
6
|
+
} from "@autobe/interface";
|
|
7
|
+
|
|
8
|
+
import { AutoBeTokenUsageComponent } from "../context/AutoBeTokenUsageComponent";
|
|
9
|
+
import { TokenUsageComputer } from "../utils/TokenUsageComputer";
|
|
10
|
+
import { AutoBeFunctionCallingMetricFactory } from "./AutoBeFunctionCallingMetricFactory";
|
|
11
|
+
|
|
12
|
+
export namespace AutoBeProcessAggregateFactory {
|
|
13
|
+
export const createAggregate = (): AutoBeProcessAggregate => ({
|
|
14
|
+
metric: AutoBeFunctionCallingMetricFactory.create(),
|
|
15
|
+
tokenUsage: new AutoBeTokenUsageComponent().toJSON(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const createCollection = <
|
|
19
|
+
Phase extends AutoBePhase | "all",
|
|
20
|
+
>(): AutoBeProcessAggregateCollection<Phase> =>
|
|
21
|
+
({
|
|
22
|
+
total: createAggregate(),
|
|
23
|
+
}) satisfies AutoBeProcessAggregateCollection as AutoBeProcessAggregateCollection<Phase>;
|
|
24
|
+
|
|
25
|
+
export const computeTotal = <Phase extends AutoBePhase | "all">(
|
|
26
|
+
collection: AutoBeProcessAggregateCollection<Phase>,
|
|
27
|
+
): AutoBeProcessAggregate => {
|
|
28
|
+
const total: AutoBeProcessAggregate = createAggregate();
|
|
29
|
+
for (const [key, value] of Object.entries(collection)) {
|
|
30
|
+
if (key === "total") continue;
|
|
31
|
+
AutoBeFunctionCallingMetricFactory.increment(total.metric, value.metric);
|
|
32
|
+
TokenUsageComputer.increment(total.tokenUsage, value.tokenUsage);
|
|
33
|
+
}
|
|
34
|
+
return total;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const emplaceEvent = <
|
|
38
|
+
Event extends AutoBeAggregateEventBase & {
|
|
39
|
+
type: string;
|
|
40
|
+
},
|
|
41
|
+
>(
|
|
42
|
+
collection: AutoBeProcessAggregateCollection,
|
|
43
|
+
event: Event,
|
|
44
|
+
): void => {
|
|
45
|
+
(collection as any)[event.type] ??= createAggregate();
|
|
46
|
+
collection.total ??= computeTotal(collection);
|
|
47
|
+
|
|
48
|
+
const local: AutoBeProcessAggregate = (collection as any)[
|
|
49
|
+
event.type
|
|
50
|
+
] as AutoBeProcessAggregate;
|
|
51
|
+
const total: AutoBeProcessAggregate = collection.total;
|
|
52
|
+
|
|
53
|
+
AutoBeFunctionCallingMetricFactory.increment(local.metric, event.metric);
|
|
54
|
+
AutoBeFunctionCallingMetricFactory.increment(total.metric, event.metric);
|
|
55
|
+
TokenUsageComputer.increment(local.tokenUsage, event.tokenUsage);
|
|
56
|
+
TokenUsageComputer.increment(total.tokenUsage, event.tokenUsage);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const filterPhase = <Phase extends AutoBePhase>(
|
|
60
|
+
collection: AutoBeProcessAggregateCollection,
|
|
61
|
+
phase: Phase,
|
|
62
|
+
): AutoBeProcessAggregateCollection<Phase> => {
|
|
63
|
+
const result: AutoBeProcessAggregateCollection<Phase> = createCollection();
|
|
64
|
+
for (const [key, value] of Object.entries(collection)) {
|
|
65
|
+
if (key === "total") continue;
|
|
66
|
+
else if (key.startsWith(phase) === false) continue;
|
|
67
|
+
|
|
68
|
+
(result as any)[key] = value;
|
|
69
|
+
AutoBeFunctionCallingMetricFactory.increment(
|
|
70
|
+
result.total.metric,
|
|
71
|
+
value.metric,
|
|
72
|
+
);
|
|
73
|
+
TokenUsageComputer.increment(result.total.tokenUsage, value.tokenUsage);
|
|
74
|
+
}
|
|
75
|
+
return result;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const reduce = (
|
|
79
|
+
collections: AutoBeProcessAggregateCollection[],
|
|
80
|
+
): AutoBeProcessAggregateCollection => {
|
|
81
|
+
const result: AutoBeProcessAggregateCollection = createCollection();
|
|
82
|
+
for (const collection of collections) {
|
|
83
|
+
for (const [key, value] of Object.entries(collection)) {
|
|
84
|
+
if (key === "total") continue;
|
|
85
|
+
(result as any)[key] ??= createAggregate();
|
|
86
|
+
const local: AutoBeProcessAggregate = (result as any)[
|
|
87
|
+
key
|
|
88
|
+
] as AutoBeProcessAggregate;
|
|
89
|
+
AutoBeFunctionCallingMetricFactory.increment(
|
|
90
|
+
local.metric,
|
|
91
|
+
value.metric,
|
|
92
|
+
);
|
|
93
|
+
TokenUsageComputer.increment(local.tokenUsage, value.tokenUsage);
|
|
94
|
+
AutoBeFunctionCallingMetricFactory.increment(
|
|
95
|
+
result.total.metric,
|
|
96
|
+
value.metric,
|
|
97
|
+
);
|
|
98
|
+
TokenUsageComputer.increment(result.total.tokenUsage, value.tokenUsage);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
result.total ??= createAggregate();
|
|
102
|
+
Object.assign(result.total, computeTotal(result));
|
|
103
|
+
return result;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const increment = (
|
|
107
|
+
x: AutoBeProcessAggregateCollection,
|
|
108
|
+
y: AutoBeProcessAggregateCollection,
|
|
109
|
+
): void => {
|
|
110
|
+
for (const [key, value] of Object.entries(y)) {
|
|
111
|
+
if (key === "total") continue;
|
|
112
|
+
(x as any)[key] ??= createAggregate();
|
|
113
|
+
const local: AutoBeProcessAggregate = (x as any)[
|
|
114
|
+
key
|
|
115
|
+
] as AutoBeProcessAggregate;
|
|
116
|
+
AutoBeFunctionCallingMetricFactory.increment(local.metric, value.metric);
|
|
117
|
+
}
|
|
118
|
+
x.total ??= createAggregate();
|
|
119
|
+
Object.assign(x.total, computeTotal(x));
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const minus = (
|
|
123
|
+
x: AutoBeProcessAggregateCollection,
|
|
124
|
+
y: AutoBeProcessAggregateCollection,
|
|
125
|
+
): AutoBeProcessAggregateCollection => {
|
|
126
|
+
const result = JSON.parse(
|
|
127
|
+
JSON.stringify(x),
|
|
128
|
+
) as AutoBeProcessAggregateCollection;
|
|
129
|
+
for (const [key, value] of Object.entries(y)) {
|
|
130
|
+
if (key === "total") continue;
|
|
131
|
+
(result as any)[key] ??= createAggregate();
|
|
132
|
+
const local: AutoBeProcessAggregate = (result as any)[
|
|
133
|
+
key
|
|
134
|
+
] as AutoBeProcessAggregate;
|
|
135
|
+
AutoBeFunctionCallingMetricFactory.minus(local.metric, value.metric);
|
|
136
|
+
}
|
|
137
|
+
result.total ??= createAggregate();
|
|
138
|
+
Object.assign(result.total, computeTotal(result));
|
|
139
|
+
return result;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
@@ -16,6 +16,7 @@ import { AutoBeConfigConstant } from "../constants/AutoBeConfigConstant";
|
|
|
16
16
|
import { AutoBeSystemPromptConstant } from "../constants/AutoBeSystemPromptConstant";
|
|
17
17
|
import { IAutoBeConfig } from "../structures/IAutoBeConfig";
|
|
18
18
|
import { IAutoBeVendor } from "../structures/IAutoBeVendor";
|
|
19
|
+
import { getCommonPrompt } from "./getCommonPrompt";
|
|
19
20
|
import { supportMistral } from "./supportMistral";
|
|
20
21
|
|
|
21
22
|
export const consentFunctionCall = async (props: {
|
|
@@ -37,6 +38,9 @@ export const consentFunctionCall = async (props: {
|
|
|
37
38
|
executor: {
|
|
38
39
|
describe: null,
|
|
39
40
|
},
|
|
41
|
+
systemPrompt: {
|
|
42
|
+
common: () => getCommonPrompt(props.config),
|
|
43
|
+
},
|
|
40
44
|
},
|
|
41
45
|
histories: [
|
|
42
46
|
{
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
AutoBeAnalyzeStartEvent,
|
|
6
6
|
AutoBeAssistantMessageEvent,
|
|
7
7
|
AutoBeEvent,
|
|
8
|
+
AutoBeFunctionCallingMetric,
|
|
8
9
|
AutoBeHistory,
|
|
9
10
|
AutoBeInterfaceCompleteEvent,
|
|
10
11
|
AutoBeInterfaceHistory,
|
|
@@ -12,6 +13,8 @@ import {
|
|
|
12
13
|
AutoBePrismaCompleteEvent,
|
|
13
14
|
AutoBePrismaHistory,
|
|
14
15
|
AutoBePrismaStartEvent,
|
|
16
|
+
AutoBeProcessAggregate,
|
|
17
|
+
AutoBeProcessAggregateCollection,
|
|
15
18
|
AutoBeRealizeCompleteEvent,
|
|
16
19
|
AutoBeRealizeHistory,
|
|
17
20
|
AutoBeRealizeStartEvent,
|
|
@@ -34,12 +37,15 @@ import { AutoBeContext } from "../context/AutoBeContext";
|
|
|
34
37
|
import { AutoBeState } from "../context/AutoBeState";
|
|
35
38
|
import { AutoBeTokenUsage } from "../context/AutoBeTokenUsage";
|
|
36
39
|
import { AutoBeTokenUsageComponent } from "../context/AutoBeTokenUsageComponent";
|
|
37
|
-
import { IAutoBeFacadeApplication } from "../
|
|
40
|
+
import { IAutoBeFacadeApplication } from "../orchestrate/facade/histories/IAutoBeFacadeApplication";
|
|
38
41
|
import { IAutoBeConfig } from "../structures/IAutoBeConfig";
|
|
39
42
|
import { IAutoBeVendor } from "../structures/IAutoBeVendor";
|
|
40
43
|
import { AutoBeTimeoutError } from "../utils/AutoBeTimeoutError";
|
|
41
44
|
import { TimedConversation } from "../utils/TimedConversation";
|
|
45
|
+
import { TokenUsageComputer } from "../utils/TokenUsageComputer";
|
|
46
|
+
import { AutoBeProcessAggregateFactory } from "./AutoBeProcessAggregateFactory";
|
|
42
47
|
import { consentFunctionCall } from "./consentFunctionCall";
|
|
48
|
+
import { getCommonPrompt } from "./getCommonPrompt";
|
|
43
49
|
import { getCriticalCompiler } from "./getCriticalCompiler";
|
|
44
50
|
import { supportMistral } from "./supportMistral";
|
|
45
51
|
|
|
@@ -54,6 +60,7 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
|
|
|
54
60
|
histories: () => AutoBeHistory[];
|
|
55
61
|
usage: () => AutoBeTokenUsage;
|
|
56
62
|
dispatch: (event: AutoBeEvent) => Promise<void>;
|
|
63
|
+
aggregates: AutoBeProcessAggregateCollection;
|
|
57
64
|
}): AutoBeContext<Model> => {
|
|
58
65
|
const config: Required<Omit<IAutoBeConfig, "backoffStrategy" | "timezone">> =
|
|
59
66
|
{
|
|
@@ -67,6 +74,7 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
|
|
|
67
74
|
vendor: props.vendor,
|
|
68
75
|
retry: config.retry,
|
|
69
76
|
locale: config.locale,
|
|
77
|
+
aggregates: props.aggregates,
|
|
70
78
|
compilerListener: props.compilerListener,
|
|
71
79
|
compiler: async () => {
|
|
72
80
|
const compiler = await props.compiler();
|
|
@@ -85,7 +93,37 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
|
|
|
85
93
|
return message;
|
|
86
94
|
},
|
|
87
95
|
conversate: async (next, closure) => {
|
|
88
|
-
const
|
|
96
|
+
const aggregate: AutoBeProcessAggregate =
|
|
97
|
+
AutoBeProcessAggregateFactory.createAggregate();
|
|
98
|
+
const metric = (key: keyof AutoBeFunctionCallingMetric) => {
|
|
99
|
+
const accumulate = (collection: AutoBeProcessAggregateCollection) => {
|
|
100
|
+
++collection.total.metric[key];
|
|
101
|
+
collection[next.source as "analyzeWrite"] ??=
|
|
102
|
+
AutoBeProcessAggregateFactory.createAggregate();
|
|
103
|
+
++collection[next.source as "analyzeWrite"]!.metric[key];
|
|
104
|
+
};
|
|
105
|
+
++aggregate.metric[key];
|
|
106
|
+
accumulate(props.aggregates);
|
|
107
|
+
};
|
|
108
|
+
const consume = (tokenUsage: IAutoBeTokenUsageJson.IComponent) => {
|
|
109
|
+
const accumulate = (collection: AutoBeProcessAggregateCollection) => {
|
|
110
|
+
TokenUsageComputer.increment(collection.total.tokenUsage, tokenUsage);
|
|
111
|
+
collection[next.source as "analyzeWrite"] ??=
|
|
112
|
+
AutoBeProcessAggregateFactory.createAggregate();
|
|
113
|
+
TokenUsageComputer.increment(
|
|
114
|
+
collection[next.source as "analyzeWrite"]!.tokenUsage,
|
|
115
|
+
tokenUsage,
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
TokenUsageComputer.increment(aggregate.tokenUsage, tokenUsage);
|
|
119
|
+
accumulate(props.aggregates);
|
|
120
|
+
props
|
|
121
|
+
.usage()
|
|
122
|
+
.record(tokenUsage, [
|
|
123
|
+
STAGES.find((stage) => next.source.startsWith(stage)) ?? "analyze",
|
|
124
|
+
]);
|
|
125
|
+
};
|
|
126
|
+
const progress = {
|
|
89
127
|
request: 0,
|
|
90
128
|
response: 0,
|
|
91
129
|
timeout: 0,
|
|
@@ -101,6 +139,9 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
|
|
|
101
139
|
executor: {
|
|
102
140
|
describe: null,
|
|
103
141
|
},
|
|
142
|
+
systemPrompt: {
|
|
143
|
+
common: () => getCommonPrompt(props.config),
|
|
144
|
+
},
|
|
104
145
|
},
|
|
105
146
|
histories: next.histories,
|
|
106
147
|
controllers: [next.controller],
|
|
@@ -119,7 +160,7 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
|
|
|
119
160
|
...event,
|
|
120
161
|
type: "vendorRequest",
|
|
121
162
|
source: next.source,
|
|
122
|
-
retry:
|
|
163
|
+
retry: progress.request++,
|
|
123
164
|
});
|
|
124
165
|
});
|
|
125
166
|
agent.on("response", async (event) => {
|
|
@@ -128,11 +169,15 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
|
|
|
128
169
|
...event,
|
|
129
170
|
type: "vendorResponse",
|
|
130
171
|
source: next.source,
|
|
131
|
-
retry:
|
|
172
|
+
retry: progress.response++,
|
|
132
173
|
})
|
|
133
174
|
.catch(() => {});
|
|
134
175
|
});
|
|
176
|
+
agent.on("call", () => {
|
|
177
|
+
metric("attempt");
|
|
178
|
+
});
|
|
135
179
|
agent.on("jsonParseError", (event) => {
|
|
180
|
+
metric("invalidJson");
|
|
136
181
|
void props
|
|
137
182
|
.dispatch({
|
|
138
183
|
...event,
|
|
@@ -141,6 +186,7 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
|
|
|
141
186
|
.catch(() => {});
|
|
142
187
|
});
|
|
143
188
|
agent.on("validate", (event) => {
|
|
189
|
+
metric("validationFailure");
|
|
144
190
|
void props
|
|
145
191
|
.dispatch({
|
|
146
192
|
type: "jsonValidateError",
|
|
@@ -189,7 +235,16 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
|
|
|
189
235
|
.record(tokenUsage, [
|
|
190
236
|
STAGES.find((stage) => next.source.startsWith(stage)) ?? "analyze",
|
|
191
237
|
]);
|
|
238
|
+
consume(tokenUsage);
|
|
192
239
|
|
|
240
|
+
const success = (histories: MicroAgenticaHistory<Model>[]) => {
|
|
241
|
+
metric("success");
|
|
242
|
+
return {
|
|
243
|
+
histories,
|
|
244
|
+
tokenUsage: aggregate.tokenUsage,
|
|
245
|
+
metric: aggregate.metric,
|
|
246
|
+
};
|
|
247
|
+
};
|
|
193
248
|
if (result.type === "error") throw result.error;
|
|
194
249
|
else if (result.type === "timeout") {
|
|
195
250
|
void props
|
|
@@ -198,7 +253,7 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
|
|
|
198
253
|
id: v7(),
|
|
199
254
|
source: next.source,
|
|
200
255
|
timeout: config.timeout!,
|
|
201
|
-
retry:
|
|
256
|
+
retry: progress.timeout++,
|
|
202
257
|
created_at: new Date().toISOString(),
|
|
203
258
|
})
|
|
204
259
|
.catch(() => {});
|
|
@@ -229,6 +284,7 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
|
|
|
229
284
|
last?.type === "assistantMessage" &&
|
|
230
285
|
last.text.trim().length !== 0
|
|
231
286
|
) {
|
|
287
|
+
metric("consent");
|
|
232
288
|
const consent: string | null = await consentFunctionCall({
|
|
233
289
|
source: next.source,
|
|
234
290
|
dispatch: (e) => {
|
|
@@ -241,43 +297,46 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
|
|
|
241
297
|
if (consent !== null) {
|
|
242
298
|
const newHistories: MicroAgenticaHistory<Model>[] =
|
|
243
299
|
await agent.conversate(consent);
|
|
244
|
-
const newTokenUsage: IAutoBeTokenUsageJson.IComponent =
|
|
245
|
-
.
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
.usage()
|
|
249
|
-
.record(
|
|
250
|
-
AutoBeTokenUsageComponent.minus(
|
|
251
|
-
new AutoBeTokenUsageComponent(newTokenUsage),
|
|
252
|
-
new AutoBeTokenUsageComponent(tokenUsage),
|
|
300
|
+
const newTokenUsage: IAutoBeTokenUsageJson.IComponent =
|
|
301
|
+
AutoBeTokenUsageComponent.minus(
|
|
302
|
+
new AutoBeTokenUsageComponent(
|
|
303
|
+
agent.getTokenUsage().toJSON().aggregate,
|
|
253
304
|
),
|
|
254
|
-
|
|
255
|
-
STAGES.find((stage) => next.source.startsWith(stage)) ??
|
|
256
|
-
"analyze",
|
|
257
|
-
],
|
|
305
|
+
new AutoBeTokenUsageComponent(tokenUsage),
|
|
258
306
|
);
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
)
|
|
263
|
-
)
|
|
264
|
-
return {
|
|
265
|
-
histories: newHistories,
|
|
266
|
-
tokenUsage: newTokenUsage,
|
|
267
|
-
};
|
|
307
|
+
consume(newTokenUsage);
|
|
308
|
+
if (newHistories.some((h) => h.type === "execute" && h.success))
|
|
309
|
+
return success(newHistories);
|
|
268
310
|
}
|
|
269
311
|
}
|
|
270
312
|
failure();
|
|
271
313
|
}
|
|
272
|
-
return
|
|
273
|
-
histories: result.histories,
|
|
274
|
-
tokenUsage,
|
|
275
|
-
};
|
|
314
|
+
return success(result.histories);
|
|
276
315
|
};
|
|
277
316
|
if (next.enforceFunctionCall === true)
|
|
278
317
|
return await forceRetry(execute, config.retry);
|
|
279
318
|
else return await execute();
|
|
280
319
|
},
|
|
320
|
+
getCurrentAggregates: (phase) => {
|
|
321
|
+
const previous: AutoBeProcessAggregateCollection =
|
|
322
|
+
AutoBeProcessAggregateFactory.reduce(
|
|
323
|
+
props
|
|
324
|
+
.histories()
|
|
325
|
+
.filter(
|
|
326
|
+
(h) =>
|
|
327
|
+
h.type === "analyze" ||
|
|
328
|
+
h.type === "prisma" ||
|
|
329
|
+
h.type === "interface" ||
|
|
330
|
+
h.type === "test" ||
|
|
331
|
+
h.type === "realize",
|
|
332
|
+
)
|
|
333
|
+
.map((h) => h.aggregates),
|
|
334
|
+
);
|
|
335
|
+
return AutoBeProcessAggregateFactory.filterPhase(
|
|
336
|
+
AutoBeProcessAggregateFactory.minus(props.aggregates, previous),
|
|
337
|
+
phase,
|
|
338
|
+
);
|
|
339
|
+
},
|
|
281
340
|
};
|
|
282
341
|
};
|
|
283
342
|
|
|
@@ -311,11 +370,12 @@ const createDispatch = (props: {
|
|
|
311
370
|
type: "analyze",
|
|
312
371
|
id: v7(),
|
|
313
372
|
prefix: event.prefix,
|
|
314
|
-
|
|
373
|
+
actors: event.actors,
|
|
315
374
|
files: event.files,
|
|
375
|
+
aggregates: event.aggregates,
|
|
376
|
+
step: event.step,
|
|
316
377
|
created_at: analyzeStart?.created_at ?? new Date().toISOString(),
|
|
317
378
|
completed_at: event.created_at,
|
|
318
|
-
step: event.step,
|
|
319
379
|
} satisfies AutoBeAnalyzeHistory,
|
|
320
380
|
}) as AutoBeContext.DispatchHistory<Event>;
|
|
321
381
|
else if (event.type === "prismaComplete")
|
|
@@ -331,9 +391,10 @@ const createDispatch = (props: {
|
|
|
331
391
|
schemas: event.schemas,
|
|
332
392
|
result: event.result,
|
|
333
393
|
compiled: event.compiled,
|
|
394
|
+
aggregates: event.aggregates,
|
|
395
|
+
step: event.step,
|
|
334
396
|
created_at: prismaStart?.created_at ?? new Date().toISOString(),
|
|
335
397
|
completed_at: event.created_at,
|
|
336
|
-
step: event.step,
|
|
337
398
|
} satisfies AutoBePrismaHistory,
|
|
338
399
|
}) as AutoBeContext.DispatchHistory<Event>;
|
|
339
400
|
else if (event.type === "interfaceComplete")
|
|
@@ -349,9 +410,10 @@ const createDispatch = (props: {
|
|
|
349
410
|
authorizations: event.authorizations,
|
|
350
411
|
document: event.document,
|
|
351
412
|
missed: event.missed,
|
|
413
|
+
aggregates: event.aggregates,
|
|
414
|
+
step: event.step,
|
|
352
415
|
created_at: interfaceStart?.created_at ?? new Date().toISOString(),
|
|
353
416
|
completed_at: new Date().toISOString(),
|
|
354
|
-
step: event.step,
|
|
355
417
|
} satisfies AutoBeInterfaceHistory,
|
|
356
418
|
}) as AutoBeContext.DispatchHistory<Event>;
|
|
357
419
|
else if (event.type === "testComplete")
|
|
@@ -366,9 +428,10 @@ const createDispatch = (props: {
|
|
|
366
428
|
instruction: testStart?.reason ?? "",
|
|
367
429
|
files: event.files,
|
|
368
430
|
compiled: event.compiled,
|
|
431
|
+
aggregates: event.aggregates,
|
|
432
|
+
step: event.step,
|
|
369
433
|
created_at: testStart?.created_at ?? new Date().toISOString(),
|
|
370
434
|
completed_at: new Date().toISOString(),
|
|
371
|
-
step: event.step,
|
|
372
435
|
} satisfies AutoBeTestHistory,
|
|
373
436
|
}) as AutoBeContext.DispatchHistory<Event>;
|
|
374
437
|
else if (event.type === "realizeComplete")
|
|
@@ -385,9 +448,10 @@ const createDispatch = (props: {
|
|
|
385
448
|
functions: event.functions,
|
|
386
449
|
controllers: event.controllers,
|
|
387
450
|
compiled: event.compiled,
|
|
451
|
+
aggregates: event.aggregates,
|
|
452
|
+
step: event.step,
|
|
388
453
|
created_at: realizeStart?.created_at ?? new Date().toISOString(),
|
|
389
454
|
completed_at: new Date().toISOString(),
|
|
390
|
-
step: event.step,
|
|
391
455
|
} satisfies AutoBeRealizeHistory,
|
|
392
456
|
}) as AutoBeContext.DispatchHistory<Event>;
|
|
393
457
|
void props.dispatch(event).catch(() => {});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Singleton, is_node } from "tstl";
|
|
2
|
+
|
|
3
|
+
import { AutoBeSystemPromptConstant } from "../constants/AutoBeSystemPromptConstant";
|
|
4
|
+
import { IAutoBeConfig } from "../structures/IAutoBeConfig";
|
|
5
|
+
|
|
6
|
+
export const getCommonPrompt = (
|
|
7
|
+
config?: Pick<IAutoBeConfig, "locale" | "timezone"> | undefined,
|
|
8
|
+
) =>
|
|
9
|
+
AutoBeSystemPromptConstant.COMMON.replace(
|
|
10
|
+
"${locale}",
|
|
11
|
+
config?.locale ?? locale.get(),
|
|
12
|
+
)
|
|
13
|
+
.replace("${timezone}", config?.timezone ?? timezone.get())
|
|
14
|
+
.replace("${datetime}", new Date().toISOString());
|
|
15
|
+
|
|
16
|
+
const locale = new Singleton(() =>
|
|
17
|
+
is_node()
|
|
18
|
+
? // eslint-disable-next-line node/prefer-global/process
|
|
19
|
+
(process.env.LANG?.split(".")[0] ?? "en-US")
|
|
20
|
+
: navigator.language,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const timezone = new Singleton(
|
|
24
|
+
() => Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
25
|
+
);
|
|
@@ -53,14 +53,14 @@ export const transformAnalyzeWriteHistories = <Model extends ILlmSchema.Model>(
|
|
|
53
53
|
## Metadata
|
|
54
54
|
|
|
55
55
|
Prefix name of the service to create is ${props.scenario.prefix}
|
|
56
|
-
and here is the list of the
|
|
57
|
-
|
|
56
|
+
and here is the list of the actors to reference.
|
|
57
|
+
|
|
58
58
|
\`\`\`json
|
|
59
|
-
${JSON.stringify(props.scenario.
|
|
59
|
+
${JSON.stringify(props.scenario.actors)}
|
|
60
60
|
\`\`\`
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
Here is the entire list of the documents that would be published
|
|
63
|
-
in someday, and your
|
|
63
|
+
in someday, and your task is to write a document of them:
|
|
64
64
|
|
|
65
65
|
## The other documents that would be published in someday
|
|
66
66
|
|
|
@@ -89,9 +89,10 @@ export const orchestrateAnalyze = async <Model extends ILlmSchema.Model>(
|
|
|
89
89
|
return ctx.dispatch({
|
|
90
90
|
type: "analyzeComplete",
|
|
91
91
|
id: v7(),
|
|
92
|
-
|
|
92
|
+
actors: scenario.actors,
|
|
93
93
|
prefix: scenario.prefix,
|
|
94
94
|
files: newFiles,
|
|
95
|
+
aggregates: ctx.getCurrentAggregates("analyze"),
|
|
95
96
|
step,
|
|
96
97
|
elapsed: new Date().getTime() - startTime.getTime(),
|
|
97
98
|
created_at: new Date().toISOString(),
|
|
@@ -28,7 +28,7 @@ export const orchestrateAnalyzeReview = async <Model extends ILlmSchema.Model>(
|
|
|
28
28
|
const pointer: IPointer<IAutoBeAnalyzeReviewApplication.IProps | null> = {
|
|
29
29
|
value: null,
|
|
30
30
|
};
|
|
31
|
-
const { tokenUsage } = await ctx.conversate({
|
|
31
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
32
32
|
source: "analyzeReview",
|
|
33
33
|
controller: createController({
|
|
34
34
|
model: ctx.model,
|
|
@@ -57,6 +57,7 @@ export const orchestrateAnalyzeReview = async <Model extends ILlmSchema.Model>(
|
|
|
57
57
|
review: pointer.value.review,
|
|
58
58
|
content: pointer.value.content,
|
|
59
59
|
tokenUsage,
|
|
60
|
+
metric,
|
|
60
61
|
total: props.progress.total,
|
|
61
62
|
completed: ++props.progress.completed,
|
|
62
63
|
step: (ctx.state().analyze?.step ?? -1) + 1,
|
|
@@ -26,7 +26,7 @@ export const orchestrateAnalyzeScenario = async <
|
|
|
26
26
|
const pointer: IPointer<IAutoBeAnalyzeScenarioApplication.IProps | null> = {
|
|
27
27
|
value: null,
|
|
28
28
|
};
|
|
29
|
-
const { histories, tokenUsage } = await ctx.conversate({
|
|
29
|
+
const { histories, tokenUsage, metric } = await ctx.conversate({
|
|
30
30
|
source: "analyzeScenario",
|
|
31
31
|
controller: createController<Model>({
|
|
32
32
|
model: ctx.model,
|
|
@@ -35,8 +35,8 @@ export const orchestrateAnalyzeScenario = async <
|
|
|
35
35
|
histories: transformAnalyzeSceHistories(ctx),
|
|
36
36
|
enforceFunctionCall: false,
|
|
37
37
|
message: StringUtil.trim`
|
|
38
|
-
Design a complete list of documents and user
|
|
39
|
-
Define user
|
|
38
|
+
Design a complete list of documents and user actors for this project.
|
|
39
|
+
Define user actors that can authenticate via API and create appropriate documentation files.
|
|
40
40
|
You must respect the number of documents specified by the user.
|
|
41
41
|
Note that the user's locale is in ${ctx.locale}.
|
|
42
42
|
`,
|
|
@@ -57,8 +57,9 @@ export const orchestrateAnalyzeScenario = async <
|
|
|
57
57
|
id: v7(),
|
|
58
58
|
prefix: pointer.value.prefix,
|
|
59
59
|
language: pointer.value.language,
|
|
60
|
-
|
|
60
|
+
actors: pointer.value.actors,
|
|
61
61
|
files: pointer.value.files,
|
|
62
|
+
metric,
|
|
62
63
|
tokenUsage,
|
|
63
64
|
step: (ctx.state().analyze?.step ?? -1) + 1,
|
|
64
65
|
created_at: start.toISOString(),
|
|
@@ -28,7 +28,7 @@ export const orchestrateAnalyzeWrite = async <Model extends ILlmSchema.Model>(
|
|
|
28
28
|
const pointer: IPointer<IAutoBeAnalyzeWriteApplication.IProps | null> = {
|
|
29
29
|
value: null,
|
|
30
30
|
};
|
|
31
|
-
const { tokenUsage } = await ctx.conversate({
|
|
31
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
32
32
|
source: "analyzeWrite",
|
|
33
33
|
controller: createController<Model>({
|
|
34
34
|
model: ctx.model,
|
|
@@ -49,7 +49,8 @@ export const orchestrateAnalyzeWrite = async <Model extends ILlmSchema.Model>(
|
|
|
49
49
|
...file,
|
|
50
50
|
content: pointer.value.content,
|
|
51
51
|
},
|
|
52
|
-
tokenUsage
|
|
52
|
+
tokenUsage,
|
|
53
|
+
metric,
|
|
53
54
|
step: (ctx.state().analyze?.step ?? -1) + 1,
|
|
54
55
|
total: progress.total,
|
|
55
56
|
completed: ++progress.completed,
|