@autobe/agent 0.19.1 → 0.21.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/agent/src/AutoBeAgent.js +3 -2
- package/lib/agent/src/AutoBeAgent.js.map +1 -1
- package/lib/agent/src/AutoBeMockAgent.js +4 -3
- package/lib/agent/src/AutoBeMockAgent.js.map +1 -1
- package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +12 -11
- package/lib/agent/src/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/agent/src/context/AutoBeContext.d.ts +3 -2
- package/lib/agent/src/factory/consentFunctionCall.js +3 -2
- package/lib/agent/src/factory/consentFunctionCall.js.map +1 -1
- package/lib/agent/src/factory/createAutoBeContext.js +11 -6
- 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/{transformAnalyzeReviewerHistories.js → transformAnalyzeReviewHistories.js} +24 -29
- 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.js +31 -29
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js +19 -5
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +7 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js +9 -6
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeScenario.js +11 -9
- 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 +5 -1
- package/lib/agent/src/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js +45 -46
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +13 -13
- 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 +23 -22
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +4 -0
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +33 -0
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
- 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 +32 -31
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterface.js +3 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js +28 -24
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js +2 -0
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js +11 -5
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +365 -0
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js +2 -0
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +80 -54
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +1635 -1180
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemas.js +30 -24
- 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 +178 -0
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js +3 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +38 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +78 -0
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +54 -54
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +18 -29
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js +37 -34
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +38 -25
- package/lib/agent/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js +3 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js +2 -0
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js +3 -0
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js +19 -9
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
- package/lib/agent/src/orchestrate/prisma/orchestratePrismaSchemas.js +28 -21
- 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 +58 -56
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
- 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.js +12 -3
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +35 -30
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/{orchestrate/realize/internal/compile.d.ts → agent/src/orchestrate/realize/internal/compileRealizeFiles.d.ts} +1 -1
- package/lib/agent/src/orchestrate/realize/internal/{compile.js → compileRealizeFiles.js} +6 -6
- package/lib/agent/src/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -0
- package/lib/agent/src/orchestrate/realize/orchestrateRealize.js +26 -12
- package/lib/agent/src/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js +9 -3
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +3 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.d.ts +2 -6
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +12 -8
- 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 +2 -2
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +3 -6
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +25 -21
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +2 -2
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +7 -2
- 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/compile/getTestExternalDeclarations.js +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.d.ts +3 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +44 -27
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +63 -60
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +118 -96
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTest.js +6 -5
- package/lib/agent/src/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +17 -8
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +30 -18
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +18 -18
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +2 -2
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +28 -1
- 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/constants/AutoBeSystemPromptConstant.d.ts +12 -11
- package/lib/context/AutoBeContext.d.ts +3 -2
- package/lib/index.mjs +3265 -1702
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.d.ts +6 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.d.ts +7 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +6 -4
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +4 -0
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +2 -5
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +38 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +78 -0
- package/lib/{agent/src/orchestrate/realize/internal/compile.d.ts → orchestrate/realize/internal/compileRealizeFiles.d.ts} +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +2 -6
- package/lib/orchestrate/realize/orchestrateRealizeScenario.d.ts +0 -66
- package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +3 -6
- package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +2 -2
- package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +7 -2
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +3 -1
- package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +2 -2
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +28 -1
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +2 -2
- package/lib/utils/executeCachedBatch.d.ts +1 -0
- package/package.json +7 -7
- package/src/AutoBeAgent.ts +4 -3
- package/src/AutoBeMockAgent.ts +5 -4
- package/src/constants/AutoBeSystemPromptConstant.ts +12 -11
- package/src/context/AutoBeContext.ts +3 -0
- package/src/factory/consentFunctionCall.ts +4 -3
- package/src/factory/createAutoBeContext.ts +11 -7
- package/src/orchestrate/analyze/histories/{transformAnalyzeReviewerHistories.ts → transformAnalyzeReviewHistories.ts} +23 -30
- package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +13 -10
- package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +60 -61
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +20 -13
- package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +20 -9
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +13 -11
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +10 -5
- package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +47 -48
- 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 -19
- package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +39 -0
- 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 +31 -30
- package/src/orchestrate/interface/orchestrateInterface.ts +4 -2
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +36 -29
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +2 -0
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +18 -10
- package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +95 -0
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +2 -0
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +53 -50
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +120 -10
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +47 -23
- package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +85 -1
- package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.ts +65 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +39 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +82 -1
- package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +57 -55
- 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 +4 -2
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +2 -0
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +3 -0
- package/src/orchestrate/prisma/orchestratePrismaReview.ts +26 -13
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +25 -17
- package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +24 -21
- package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +42 -40
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +17 -13
- package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +14 -5
- package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +35 -30
- package/src/orchestrate/realize/internal/{compile.ts → compileRealizeFiles.ts} +15 -11
- package/src/orchestrate/realize/orchestrateRealize.ts +59 -40
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +19 -10
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +3 -0
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +10 -10
- package/src/orchestrate/realize/orchestrateRealizeScenario.ts +7 -77
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +24 -23
- package/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.ts +6 -2
- package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +10 -5
- package/src/orchestrate/test/compile/completeTestCode.ts +17 -13
- package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +2 -0
- package/src/orchestrate/test/experimental/transformTestCorrectHistories.ast +4 -4
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +50 -37
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +62 -57
- package/src/orchestrate/test/histories/transformTestWriteHistories.ts +27 -7
- package/src/orchestrate/test/orchestrateTest.ts +7 -9
- package/src/orchestrate/test/orchestrateTestCorrect.ts +39 -25
- package/src/orchestrate/test/orchestrateTestScenario.ts +28 -21
- package/src/orchestrate/test/orchestrateTestWrite.ts +17 -18
- package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +3 -3
- package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +28 -1
- package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +2 -2
- package/src/utils/executeCachedBatch.ts +15 -0
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +0 -6
- package/lib/agent/src/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.js.map +0 -1
- package/lib/agent/src/orchestrate/realize/internal/compile.js.map +0 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js +0 -74
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js.map +0 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +0 -6
- package/lib/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
- package/src/orchestrate/test/histories/transformTestHistories.ts +0 -77
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
2
|
import { AutoBeOpenApi } from "@autobe/interface";
|
|
3
|
-
import {
|
|
3
|
+
import { StringUtil } from "@autobe/utils";
|
|
4
|
+
import { v7 } from "uuid";
|
|
4
5
|
|
|
5
6
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
6
7
|
import { AutoBeState } from "../../../context/AutoBeState";
|
|
@@ -19,51 +20,51 @@ export const transformInterfaceSchemasReviewHistories = (
|
|
|
19
20
|
return [
|
|
20
21
|
{
|
|
21
22
|
type: "systemMessage",
|
|
22
|
-
id:
|
|
23
|
+
id: v7(),
|
|
23
24
|
created_at: new Date().toISOString(),
|
|
24
25
|
text: AutoBeSystemPromptConstant.INTERFACE_SCHEMA,
|
|
25
26
|
},
|
|
26
27
|
...transformInterfaceAssetHistories(state),
|
|
27
28
|
{
|
|
28
29
|
type: "systemMessage",
|
|
29
|
-
id:
|
|
30
|
+
id: v7(),
|
|
30
31
|
created_at: new Date().toISOString(),
|
|
31
32
|
text: AutoBeSystemPromptConstant.INTERFACE_SCHEMA_REVIEW,
|
|
32
33
|
},
|
|
33
34
|
{
|
|
34
35
|
type: "assistantMessage",
|
|
35
|
-
id:
|
|
36
|
+
id: v7(),
|
|
36
37
|
created_at: new Date().toISOString(),
|
|
37
|
-
text:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
JSON.stringify(operations)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
text: StringUtil.trim`
|
|
39
|
+
The Schema Agent has generated schemas for the following API operations.
|
|
40
|
+
These operations define what endpoints exist and what request/response types they use:
|
|
41
|
+
|
|
42
|
+
\`\`\`json
|
|
43
|
+
${JSON.stringify(operations)}
|
|
44
|
+
\`\`\`
|
|
45
|
+
|
|
46
|
+
All schema types referenced in these operations (in requestBody and responses) must exist in the schemas.
|
|
47
|
+
`,
|
|
47
48
|
},
|
|
48
49
|
{
|
|
49
|
-
id:
|
|
50
|
+
id: v7(),
|
|
50
51
|
type: "assistantMessage",
|
|
51
52
|
created_at: new Date().toISOString(),
|
|
52
|
-
text:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
JSON.stringify(schemaDescriptive)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
text: StringUtil.trim`
|
|
54
|
+
Here are the schemas generated by the Schema Agent that need your review:
|
|
55
|
+
|
|
56
|
+
\`\`\`json
|
|
57
|
+
${JSON.stringify(schemaDescriptive)}
|
|
58
|
+
\`\`\`
|
|
59
|
+
|
|
60
|
+
Please review these schemas for:
|
|
61
|
+
1. Security vulnerabilities (passwords in responses, actor IDs in requests)
|
|
62
|
+
2. Missing entities or variants referenced by the operations
|
|
63
|
+
3. Type accuracy and format specifications
|
|
64
|
+
4. Alignment with Prisma schema and business requirements
|
|
65
|
+
|
|
66
|
+
Fix all critical issues and return the enhanced schemas in the content field.
|
|
67
|
+
`,
|
|
67
68
|
},
|
|
68
69
|
];
|
|
69
70
|
};
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import { AutoBeEndpointComparator } from "@autobe/utils";
|
|
10
10
|
import { ILlmSchema } from "@samchon/openapi";
|
|
11
11
|
import { HashMap, Pair } from "tstl";
|
|
12
|
-
import {
|
|
12
|
+
import { v7 } from "uuid";
|
|
13
13
|
|
|
14
14
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
15
15
|
import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
|
|
@@ -35,13 +35,14 @@ export const orchestrateInterface =
|
|
|
35
35
|
if (predicate !== null)
|
|
36
36
|
return ctx.assistantMessage({
|
|
37
37
|
type: "assistantMessage",
|
|
38
|
-
id:
|
|
38
|
+
id: v7(),
|
|
39
39
|
created_at: start.toISOString(),
|
|
40
40
|
text: predicate,
|
|
41
41
|
completed_at: new Date().toISOString(),
|
|
42
42
|
});
|
|
43
43
|
ctx.dispatch({
|
|
44
44
|
type: "interfaceStart",
|
|
45
|
+
id: v7(),
|
|
45
46
|
created_at: start.toISOString(),
|
|
46
47
|
reason: props.reason,
|
|
47
48
|
step: ctx.state().analyze?.step ?? 0,
|
|
@@ -101,6 +102,7 @@ export const orchestrateInterface =
|
|
|
101
102
|
// DO COMPILE
|
|
102
103
|
return ctx.dispatch({
|
|
103
104
|
type: "interfaceComplete",
|
|
105
|
+
id: v7(),
|
|
104
106
|
document,
|
|
105
107
|
authorizations,
|
|
106
108
|
created_at: new Date().toISOString(),
|
|
@@ -10,9 +10,11 @@ import { StringUtil } from "@autobe/utils";
|
|
|
10
10
|
import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
|
|
11
11
|
import { IPointer } from "tstl";
|
|
12
12
|
import typia from "typia";
|
|
13
|
+
import { v7 } from "uuid";
|
|
13
14
|
|
|
14
15
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
15
16
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
17
|
+
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
16
18
|
import { transformInterfaceAuthorizationsHistories } from "./histories/transformInterfaceAuthorizationsHistories";
|
|
17
19
|
import { IAutoBeInterfaceAuthorizationsApplication } from "./structures/IAutoBeInterfaceAuthorizationsApplication";
|
|
18
20
|
|
|
@@ -24,20 +26,22 @@ export async function orchestrateInterfaceAuthorizations<
|
|
|
24
26
|
total: roles.length,
|
|
25
27
|
completed: 0,
|
|
26
28
|
};
|
|
27
|
-
const authorizations: AutoBeInterfaceAuthorization[] =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
29
|
+
const authorizations: AutoBeInterfaceAuthorization[] =
|
|
30
|
+
await executeCachedBatch(
|
|
31
|
+
roles.map((role) => async (promptCacheKey) => {
|
|
32
|
+
const event: AutoBeInterfaceAuthorizationEvent = await process(
|
|
33
|
+
ctx,
|
|
34
|
+
role,
|
|
35
|
+
progress,
|
|
36
|
+
promptCacheKey,
|
|
37
|
+
);
|
|
38
|
+
ctx.dispatch(event);
|
|
39
|
+
return {
|
|
40
|
+
role: role.name,
|
|
41
|
+
operations: event.operations,
|
|
42
|
+
};
|
|
43
|
+
}),
|
|
44
|
+
);
|
|
41
45
|
|
|
42
46
|
return authorizations;
|
|
43
47
|
}
|
|
@@ -46,6 +50,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
46
50
|
ctx: AutoBeContext<Model>,
|
|
47
51
|
role: AutoBeAnalyzeRole,
|
|
48
52
|
progress: AutoBeProgressEventBase,
|
|
53
|
+
promptCacheKey: string,
|
|
49
54
|
): Promise<AutoBeInterfaceAuthorizationEvent> {
|
|
50
55
|
const pointer: IPointer<IAutoBeInterfaceAuthorizationsApplication.IProps | null> =
|
|
51
56
|
{
|
|
@@ -62,6 +67,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
62
67
|
},
|
|
63
68
|
}),
|
|
64
69
|
enforceFunctionCall: true,
|
|
70
|
+
promptCacheKey,
|
|
65
71
|
message: "Create Authorization Operation for the given roles",
|
|
66
72
|
});
|
|
67
73
|
if (pointer.value === null)
|
|
@@ -69,6 +75,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
69
75
|
|
|
70
76
|
return {
|
|
71
77
|
type: "interfaceAuthorization",
|
|
78
|
+
id: v7(),
|
|
72
79
|
operations: pointer.value.operations,
|
|
73
80
|
completed: ++progress.completed,
|
|
74
81
|
tokenUsage,
|
|
@@ -107,27 +114,27 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
107
114
|
expected:
|
|
108
115
|
"Response body with I{RoleName(PascalCase)}.IAuthorized type is required",
|
|
109
116
|
value: op.responseBody,
|
|
110
|
-
description:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
description: StringUtil.trim`
|
|
118
|
+
Response body is required for authentication operations.
|
|
119
|
+
|
|
120
|
+
The responseBody must contain description and typeName fields.
|
|
121
|
+
typeName must be I{Prefix(PascalCase)}{RoleName(PascalCase)}.IAuthorized
|
|
122
|
+
description must be a detailed description of the response body.
|
|
123
|
+
`,
|
|
117
124
|
});
|
|
118
125
|
else if (!op.responseBody.typeName.endsWith(".IAuthorized"))
|
|
119
126
|
errors.push({
|
|
120
127
|
path: `$input.operations.${i}.responseBody.typeName`,
|
|
121
128
|
expected: `Type name must be I{RoleName(PascalCase)}.IAuthorized`,
|
|
122
129
|
value: op.responseBody?.typeName,
|
|
123
|
-
description:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
130
|
+
description: StringUtil.trim`
|
|
131
|
+
Wrong response body type name: ${op.responseBody?.typeName}
|
|
132
|
+
|
|
133
|
+
For authentication operations (login, join, refresh), the response body type name must follow the convention "I{RoleName}.IAuthorized".
|
|
134
|
+
|
|
135
|
+
This standardized naming convention ensures consistency across all authentication endpoints and clearly identifies authorization response types.
|
|
136
|
+
The Role name should be in PascalCase format (e.g., IUser.IAuthorized, IAdmin.IAuthorized, ISeller.IAuthorized).
|
|
137
|
+
`,
|
|
131
138
|
});
|
|
132
139
|
});
|
|
133
140
|
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import { OpenApiV3_1Emender } from "@samchon/openapi/lib/converters/OpenApiV3_1Emender";
|
|
9
9
|
import { IPointer } from "tstl";
|
|
10
10
|
import typia from "typia";
|
|
11
|
+
import { v7 } from "uuid";
|
|
11
12
|
|
|
12
13
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
13
14
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
@@ -70,6 +71,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
70
71
|
);
|
|
71
72
|
ctx.dispatch({
|
|
72
73
|
type: "interfaceComplement",
|
|
74
|
+
id: v7(),
|
|
73
75
|
missed,
|
|
74
76
|
schemas: pointer.value,
|
|
75
77
|
tokenUsage,
|
|
@@ -2,15 +2,19 @@ import { IAgenticaController } from "@agentica/core";
|
|
|
2
2
|
import {
|
|
3
3
|
AutoBeInterfaceEndpointsEvent,
|
|
4
4
|
AutoBeOpenApi,
|
|
5
|
+
AutoBeProgressEventBase,
|
|
5
6
|
} from "@autobe/interface";
|
|
6
7
|
import { AutoBeInterfaceGroup } from "@autobe/interface/src/histories/contents/AutoBeInterfaceGroup";
|
|
7
8
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
8
9
|
import { HashSet, IPointer } from "tstl";
|
|
9
10
|
import typia from "typia";
|
|
11
|
+
import { v7 } from "uuid";
|
|
10
12
|
|
|
11
13
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
12
14
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
15
|
+
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
13
16
|
import { transformInterfaceEndpointHistories } from "./histories/transformInterfaceEndpointHistories";
|
|
17
|
+
import { orchestrateInterfaceEndpointsReview } from "./orchestrateInterfaceEndpointsReview";
|
|
14
18
|
import { IAutoBeInterfaceEndpointApplication } from "./structures/IAutoBeInterfaceEndpointApplication";
|
|
15
19
|
import { OpenApiEndpointComparator } from "./utils/OpenApiEndpointComparator";
|
|
16
20
|
|
|
@@ -22,28 +26,35 @@ export async function orchestrateInterfaceEndpoints<
|
|
|
22
26
|
authorizations: AutoBeOpenApi.IOperation[],
|
|
23
27
|
content: string = `Make endpoints for the given assets`,
|
|
24
28
|
): Promise<AutoBeOpenApi.IEndpoint[]> {
|
|
25
|
-
const progress:
|
|
29
|
+
const progress: AutoBeProgressEventBase = {
|
|
26
30
|
total: groups.length,
|
|
27
31
|
completed: 0,
|
|
28
32
|
};
|
|
29
33
|
const endpoints: AutoBeOpenApi.IEndpoint[] = (
|
|
30
|
-
await
|
|
31
|
-
groups.map(
|
|
34
|
+
await executeCachedBatch(
|
|
35
|
+
groups.map(
|
|
36
|
+
(g) => (promptCacheKey) =>
|
|
37
|
+
process(ctx, g, content, progress, authorizations, promptCacheKey),
|
|
38
|
+
),
|
|
32
39
|
)
|
|
33
40
|
).flat();
|
|
34
|
-
|
|
41
|
+
|
|
42
|
+
const deduplicated: AutoBeOpenApi.IEndpoint[] = new HashSet(
|
|
35
43
|
endpoints,
|
|
36
44
|
OpenApiEndpointComparator.hashCode,
|
|
37
45
|
OpenApiEndpointComparator.equals,
|
|
38
46
|
).toJSON();
|
|
47
|
+
|
|
48
|
+
return orchestrateInterfaceEndpointsReview(ctx, deduplicated);
|
|
39
49
|
}
|
|
40
50
|
|
|
41
51
|
async function process<Model extends ILlmSchema.Model>(
|
|
42
52
|
ctx: AutoBeContext<Model>,
|
|
43
53
|
group: AutoBeInterfaceGroup,
|
|
44
54
|
message: string,
|
|
45
|
-
progress:
|
|
55
|
+
progress: AutoBeProgressEventBase,
|
|
46
56
|
authorizations: AutoBeOpenApi.IOperation[],
|
|
57
|
+
promptCacheKey: string,
|
|
47
58
|
): Promise<AutoBeOpenApi.IEndpoint[]> {
|
|
48
59
|
const start: Date = new Date();
|
|
49
60
|
const pointer: IPointer<AutoBeOpenApi.IEndpoint[] | null> = {
|
|
@@ -64,12 +75,14 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
64
75
|
},
|
|
65
76
|
}),
|
|
66
77
|
enforceFunctionCall: true,
|
|
78
|
+
promptCacheKey,
|
|
67
79
|
message,
|
|
68
80
|
});
|
|
69
81
|
if (pointer.value === null) throw new Error("Failed to generate endpoints."); // unreachable
|
|
70
82
|
|
|
71
83
|
const event: AutoBeInterfaceEndpointsEvent = {
|
|
72
84
|
type: "interfaceEndpoints",
|
|
85
|
+
id: v7(),
|
|
73
86
|
endpoints: new HashSet(
|
|
74
87
|
pointer.value,
|
|
75
88
|
OpenApiEndpointComparator.hashCode,
|
|
@@ -120,8 +133,3 @@ const collection = {
|
|
|
120
133
|
deepseek: claude,
|
|
121
134
|
"3.1": claude,
|
|
122
135
|
};
|
|
123
|
-
|
|
124
|
-
interface IProgress {
|
|
125
|
-
total: number;
|
|
126
|
-
completed: number;
|
|
127
|
-
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { IAgenticaController } from "@agentica/core";
|
|
2
|
+
import { AutoBeOpenApi } from "@autobe/interface";
|
|
3
|
+
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
4
|
+
import { IPointer } from "tstl";
|
|
5
|
+
import typia from "typia";
|
|
6
|
+
import { v7 } from "uuid";
|
|
7
|
+
|
|
8
|
+
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
9
|
+
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
10
|
+
import { transformInterfaceEndpointsReviewHistories } from "./histories/transformInterfaceEndpointsReviewHistories";
|
|
11
|
+
import { IAutoBeInterfaceEndpointsReviewApplication } from "./structures/IAutoBeInterfaceEndpointsReviewApplication";
|
|
12
|
+
|
|
13
|
+
export async function orchestrateInterfaceEndpointsReview<
|
|
14
|
+
Model extends ILlmSchema.Model,
|
|
15
|
+
>(
|
|
16
|
+
ctx: AutoBeContext<Model>,
|
|
17
|
+
endpoints: AutoBeOpenApi.IEndpoint[],
|
|
18
|
+
message: string = `Review the generated endpoints`,
|
|
19
|
+
): Promise<AutoBeOpenApi.IEndpoint[]> {
|
|
20
|
+
const pointer: IPointer<IAutoBeInterfaceEndpointsReviewApplication.IProps | null> =
|
|
21
|
+
{
|
|
22
|
+
value: null,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const { tokenUsage } = await ctx.conversate({
|
|
26
|
+
source: "interfaceEndpointsReview",
|
|
27
|
+
histories: transformInterfaceEndpointsReviewHistories(
|
|
28
|
+
ctx.state(),
|
|
29
|
+
endpoints,
|
|
30
|
+
),
|
|
31
|
+
controller: createController({
|
|
32
|
+
model: ctx.model,
|
|
33
|
+
build: (props) => {
|
|
34
|
+
pointer.value = props;
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
enforceFunctionCall: true,
|
|
38
|
+
message,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
if (pointer.value === null) {
|
|
42
|
+
return endpoints;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const response = pointer.value?.endpoints ?? [];
|
|
46
|
+
|
|
47
|
+
ctx.dispatch({
|
|
48
|
+
id: v7(),
|
|
49
|
+
type: "interfaceEndpointsReview",
|
|
50
|
+
endpoints,
|
|
51
|
+
content: response,
|
|
52
|
+
created_at: new Date().toISOString(),
|
|
53
|
+
review: pointer.value?.review,
|
|
54
|
+
step: ctx.state().analyze?.step ?? 0,
|
|
55
|
+
tokenUsage,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
return response;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function createController<Model extends ILlmSchema.Model>(props: {
|
|
62
|
+
model: Model;
|
|
63
|
+
build: (props: IAutoBeInterfaceEndpointsReviewApplication.IProps) => void;
|
|
64
|
+
}): IAgenticaController.IClass<Model> {
|
|
65
|
+
assertSchemaModel(props.model);
|
|
66
|
+
|
|
67
|
+
const application: ILlmApplication<Model> = collection[
|
|
68
|
+
props.model
|
|
69
|
+
] satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
|
|
70
|
+
return {
|
|
71
|
+
protocol: "class",
|
|
72
|
+
name: "interface",
|
|
73
|
+
application,
|
|
74
|
+
execute: {
|
|
75
|
+
reviewEndpoints: (next) => {
|
|
76
|
+
props.build(next);
|
|
77
|
+
},
|
|
78
|
+
} satisfies IAutoBeInterfaceEndpointsReviewApplication,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const claude = typia.llm.application<
|
|
83
|
+
IAutoBeInterfaceEndpointsReviewApplication,
|
|
84
|
+
"claude"
|
|
85
|
+
>();
|
|
86
|
+
const collection = {
|
|
87
|
+
chatgpt: typia.llm.application<
|
|
88
|
+
IAutoBeInterfaceEndpointsReviewApplication,
|
|
89
|
+
"chatgpt"
|
|
90
|
+
>(),
|
|
91
|
+
claude,
|
|
92
|
+
llama: claude,
|
|
93
|
+
deepseek: claude,
|
|
94
|
+
"3.1": claude,
|
|
95
|
+
};
|
|
@@ -3,6 +3,7 @@ import { AutoBeInterfaceGroupsEvent } from "@autobe/interface";
|
|
|
3
3
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
4
4
|
import { IPointer } from "tstl";
|
|
5
5
|
import typia from "typia";
|
|
6
|
+
import { v7 } from "uuid";
|
|
6
7
|
|
|
7
8
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
8
9
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
@@ -34,6 +35,7 @@ export async function orchestrateInterfaceGroups<
|
|
|
34
35
|
if (pointer.value === null) throw new Error("Failed to generate groups."); // unreachable
|
|
35
36
|
return {
|
|
36
37
|
type: "interfaceGroups",
|
|
38
|
+
id: v7(),
|
|
37
39
|
created_at: start.toISOString(),
|
|
38
40
|
groups: pointer.value.groups,
|
|
39
41
|
tokenUsage,
|
|
@@ -2,6 +2,7 @@ import { IAgenticaController } from "@agentica/core";
|
|
|
2
2
|
import {
|
|
3
3
|
AutoBeInterfaceOperationsEvent,
|
|
4
4
|
AutoBeOpenApi,
|
|
5
|
+
AutoBeProgressEventBase,
|
|
5
6
|
} from "@autobe/interface";
|
|
6
7
|
import { AutoBeEndpointComparator, StringUtil } from "@autobe/utils";
|
|
7
8
|
import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
|
|
@@ -9,11 +10,13 @@ import { HashMap, HashSet, IPointer } from "tstl";
|
|
|
9
10
|
import typia from "typia";
|
|
10
11
|
import { Escaper } from "typia/lib/utils/Escaper";
|
|
11
12
|
import { NamingConvention } from "typia/lib/utils/NamingConvention";
|
|
13
|
+
import { v7 } from "uuid";
|
|
12
14
|
|
|
13
15
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
14
16
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
15
17
|
import { divideArray } from "../../utils/divideArray";
|
|
16
18
|
import { emplaceMap } from "../../utils/emplaceMap";
|
|
19
|
+
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
17
20
|
import { transformInterfaceOperationHistories } from "./histories/transformInterfaceOperationHistories";
|
|
18
21
|
import { orchestrateInterfaceOperationsReview } from "./orchestrateInterfaceOperationsReview";
|
|
19
22
|
import { IAutoBeInterfaceOperationApplication } from "./structures/IAutoBeInterfaceOperationApplication";
|
|
@@ -30,23 +33,23 @@ export async function orchestrateInterfaceOperations<
|
|
|
30
33
|
array: endpoints,
|
|
31
34
|
capacity,
|
|
32
35
|
});
|
|
33
|
-
|
|
34
|
-
total: endpoints.length,
|
|
35
|
-
completed: 0,
|
|
36
|
-
};
|
|
37
|
-
const operationsReviewProgress: IProgress = {
|
|
38
|
-
total: matrix.length,
|
|
39
|
-
completed: 0,
|
|
40
|
-
};
|
|
36
|
+
|
|
41
37
|
return (
|
|
42
|
-
await
|
|
43
|
-
matrix.map(async (
|
|
38
|
+
await executeCachedBatch(
|
|
39
|
+
matrix.map((it) => async (promptCacheKey) => {
|
|
44
40
|
const row: AutoBeOpenApi.IOperation[] = await divideAndConquer(
|
|
45
41
|
ctx,
|
|
46
42
|
it,
|
|
47
43
|
3,
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
{
|
|
45
|
+
total: matrix.length,
|
|
46
|
+
completed: 0,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
total: matrix.length,
|
|
50
|
+
completed: 0,
|
|
51
|
+
},
|
|
52
|
+
promptCacheKey,
|
|
50
53
|
);
|
|
51
54
|
return row;
|
|
52
55
|
}),
|
|
@@ -58,8 +61,9 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
|
58
61
|
ctx: AutoBeContext<Model>,
|
|
59
62
|
endpoints: AutoBeOpenApi.IEndpoint[],
|
|
60
63
|
retry: number,
|
|
61
|
-
operationsProgress:
|
|
62
|
-
operationsReviewProgress:
|
|
64
|
+
operationsProgress: AutoBeProgressEventBase,
|
|
65
|
+
operationsReviewProgress: AutoBeProgressEventBase,
|
|
66
|
+
promptCacheKey: string,
|
|
63
67
|
): Promise<AutoBeOpenApi.IOperation[]> {
|
|
64
68
|
const remained: HashSet<AutoBeOpenApi.IEndpoint> = new HashSet(
|
|
65
69
|
endpoints,
|
|
@@ -74,7 +78,7 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
|
74
78
|
for (let i: number = 0; i < retry; ++i) {
|
|
75
79
|
if (remained.empty() === true || unique.size() >= endpoints.length) break;
|
|
76
80
|
const operations: AutoBeOpenApi.IOperation[] = remained.size()
|
|
77
|
-
? await process(ctx, remained, operationsProgress)
|
|
81
|
+
? await process(ctx, remained, operationsProgress, promptCacheKey)
|
|
78
82
|
: [];
|
|
79
83
|
|
|
80
84
|
for (const item of operations) {
|
|
@@ -95,7 +99,8 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
|
95
99
|
async function process<Model extends ILlmSchema.Model>(
|
|
96
100
|
ctx: AutoBeContext<Model>,
|
|
97
101
|
endpoints: HashSet<AutoBeOpenApi.IEndpoint>,
|
|
98
|
-
progress:
|
|
102
|
+
progress: AutoBeProgressEventBase,
|
|
103
|
+
promptCacheKey: string,
|
|
99
104
|
): Promise<AutoBeOpenApi.IOperation[]> {
|
|
100
105
|
const prefix: string = NamingConvention.camel(ctx.state().analyze!.prefix);
|
|
101
106
|
const pointer: IPointer<AutoBeOpenApi.IOperation[] | null> = {
|
|
@@ -151,12 +156,14 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
151
156
|
},
|
|
152
157
|
}),
|
|
153
158
|
enforceFunctionCall: true,
|
|
159
|
+
promptCacheKey,
|
|
154
160
|
message: "Make API operations",
|
|
155
161
|
});
|
|
156
162
|
if (pointer.value === null) throw new Error("Failed to create operations."); // never be happened
|
|
157
163
|
|
|
158
164
|
ctx.dispatch({
|
|
159
165
|
type: "interfaceOperations",
|
|
166
|
+
id: v7(),
|
|
160
167
|
operations: pointer.value,
|
|
161
168
|
tokenUsage,
|
|
162
169
|
...progress,
|
|
@@ -218,13 +225,13 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
218
225
|
errors.push({
|
|
219
226
|
path: `$input.operations[${i}].authorizationRoles[${j}]`,
|
|
220
227
|
expected: `null | ${props.roles.map((str) => JSON.stringify(str)).join(" | ")}`,
|
|
221
|
-
description:
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
+
description: StringUtil.trim`
|
|
229
|
+
Role "${role}" is not defined in the roles list.
|
|
230
|
+
|
|
231
|
+
Please select one of them below, or do not define (\`null\`):
|
|
232
|
+
|
|
233
|
+
${props.roles.map((role) => `- ${role}`).join("\n")}
|
|
234
|
+
`,
|
|
228
235
|
value: role,
|
|
229
236
|
});
|
|
230
237
|
});
|
|
@@ -247,15 +254,16 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
247
254
|
path: `$input.operations[${i}].{"path"|"method"}`,
|
|
248
255
|
expected: "Unique endpoint (path and method)",
|
|
249
256
|
value: key,
|
|
250
|
-
description:
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
257
|
+
description: StringUtil.trim`
|
|
258
|
+
Duplicated endpoint detected (method: ${op.method}, path: ${op.path}).
|
|
259
|
+
|
|
260
|
+
The duplicated endpoints of others are located in below accessors.
|
|
261
|
+
Check them, and consider which operation endpoint would be proper to modify.
|
|
262
|
+
|
|
263
|
+
${indexes
|
|
264
|
+
.map((idx) => `- $input.operations.[${idx}].{"path"|"method"}`)
|
|
265
|
+
.join("\n")}
|
|
266
|
+
`,
|
|
259
267
|
});
|
|
260
268
|
indexes.push(i);
|
|
261
269
|
} else endpoints.emplace(key, [i]);
|
|
@@ -276,20 +284,20 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
276
284
|
path: `$input.operations[${i}].name`,
|
|
277
285
|
expected: "Unique name in the same accessor scope.",
|
|
278
286
|
value: op.name,
|
|
279
|
-
description:
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
287
|
+
description: StringUtil.trim`
|
|
288
|
+
Duplicated operation accessor detected (name: ${op.name}, accessor: ${key}).
|
|
289
|
+
|
|
290
|
+
The operation name must be unique within the parent accessor.
|
|
291
|
+
In other worlds, the operation accessor determined by the name
|
|
292
|
+
must be unique in the OpenAPI document.
|
|
293
|
+
|
|
294
|
+
Here is the list of elements of duplicated operation names.
|
|
295
|
+
Check them, and consider which operation name would be proper to modify.
|
|
296
|
+
|
|
297
|
+
${indexes
|
|
290
298
|
.map((idx) => `- ${operations[idx].name} (accessor: ${key})`)
|
|
291
|
-
.join("\n")
|
|
292
|
-
|
|
299
|
+
.join("\n")}
|
|
300
|
+
`,
|
|
293
301
|
});
|
|
294
302
|
}
|
|
295
303
|
indexes.push(i);
|
|
@@ -335,11 +343,6 @@ const collection = {
|
|
|
335
343
|
}),
|
|
336
344
|
};
|
|
337
345
|
|
|
338
|
-
interface IProgress {
|
|
339
|
-
completed: number;
|
|
340
|
-
total: number;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
346
|
type Validator = (
|
|
344
347
|
input: unknown,
|
|
345
348
|
) => IValidation<IAutoBeInterfaceOperationApplication.IProps>;
|