@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
|
@@ -2,11 +2,13 @@ import { IAgenticaController } from "@agentica/core";
|
|
|
2
2
|
import {
|
|
3
3
|
AutoBeInterfaceOperationsReviewEvent,
|
|
4
4
|
AutoBeOpenApi,
|
|
5
|
+
AutoBePrisma,
|
|
5
6
|
AutoBeProgressEventBase,
|
|
6
7
|
} from "@autobe/interface";
|
|
7
|
-
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
8
|
+
import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
|
|
8
9
|
import { 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 { transformInterfaceOperationsReviewHistories } from "./histories/transformInterfaceOperationsReviewHistories";
|
|
@@ -20,6 +22,7 @@ export async function orchestrateInterfaceOperationsReview<
|
|
|
20
22
|
progress: AutoBeProgressEventBase,
|
|
21
23
|
): Promise<AutoBeOpenApi.IOperation[]> {
|
|
22
24
|
try {
|
|
25
|
+
const files: AutoBePrisma.IFile[] = ctx.state().prisma?.result.data.files!;
|
|
23
26
|
const pointer: IPointer<IAutoBeInterfaceOperationsReviewApplication.IProps | null> =
|
|
24
27
|
{
|
|
25
28
|
value: null,
|
|
@@ -29,6 +32,7 @@ export async function orchestrateInterfaceOperationsReview<
|
|
|
29
32
|
histories: transformInterfaceOperationsReviewHistories(ctx, operations),
|
|
30
33
|
controller: createReviewController({
|
|
31
34
|
model: ctx.model,
|
|
35
|
+
prismaSchemas: files,
|
|
32
36
|
build: (next: IAutoBeInterfaceOperationsReviewApplication.IProps) => {
|
|
33
37
|
pointer.value = next;
|
|
34
38
|
},
|
|
@@ -51,6 +55,7 @@ export async function orchestrateInterfaceOperationsReview<
|
|
|
51
55
|
|
|
52
56
|
ctx.dispatch({
|
|
53
57
|
type: "interfaceOperationsReview",
|
|
58
|
+
id: v7(),
|
|
54
59
|
operations: content,
|
|
55
60
|
review: pointer.value.review,
|
|
56
61
|
plan: pointer.value.plan,
|
|
@@ -71,11 +76,102 @@ export async function orchestrateInterfaceOperationsReview<
|
|
|
71
76
|
|
|
72
77
|
function createReviewController<Model extends ILlmSchema.Model>(props: {
|
|
73
78
|
model: Model;
|
|
79
|
+
prismaSchemas: AutoBePrisma.IFile[];
|
|
74
80
|
build: (reviews: IAutoBeInterfaceOperationsReviewApplication.IProps) => void;
|
|
75
81
|
}): IAgenticaController.IClass<Model> {
|
|
82
|
+
const validate = (
|
|
83
|
+
next: unknown,
|
|
84
|
+
): IValidation<IAutoBeInterfaceOperationsReviewApplication.IProps> => {
|
|
85
|
+
const result: IValidation<IAutoBeInterfaceOperationsReviewApplication.IProps> =
|
|
86
|
+
typia.validate<IAutoBeInterfaceOperationsReviewApplication.IProps>(next);
|
|
87
|
+
if (result.success === false) return result;
|
|
88
|
+
const errors: IValidation.IError[] = [];
|
|
89
|
+
|
|
90
|
+
const models: AutoBePrisma.IModel[] = props.prismaSchemas.flatMap(
|
|
91
|
+
(schema) => schema.models,
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
result.data.content.forEach((op, index) => {
|
|
95
|
+
// Check if summary or description mentions soft delete
|
|
96
|
+
const mentionsSoftDelete =
|
|
97
|
+
(op.summary && /soft[\s-]?delet/i.test(op.summary)) ||
|
|
98
|
+
(op.description && /soft[\s-]?delet/i.test(op.description));
|
|
99
|
+
|
|
100
|
+
if (op.method === "delete") {
|
|
101
|
+
const model = models.find((model) => model.name === op.model_name);
|
|
102
|
+
|
|
103
|
+
if (mentionsSoftDelete) {
|
|
104
|
+
// If soft delete is mentioned but no soft_delete_column is specified
|
|
105
|
+
if (!op.soft_delete_column) {
|
|
106
|
+
// Check if any soft-delete capable column exists in the model
|
|
107
|
+
const hasSoftDeleteCapableColumn = model?.plainFields.some(
|
|
108
|
+
(field) =>
|
|
109
|
+
/delete|deleted|deleted_at|deletedAt|is_deleted|isDeleted/i.test(
|
|
110
|
+
field.name,
|
|
111
|
+
),
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
if (hasSoftDeleteCapableColumn) {
|
|
115
|
+
errors.push({
|
|
116
|
+
expected: `Soft delete column to be specified or summary/description to not mention soft delete`,
|
|
117
|
+
value: "null",
|
|
118
|
+
description: `Mismatch: Operation mentions soft delete but soft_delete_column is not specified, while model has soft-delete capable columns`,
|
|
119
|
+
path: `$input.content[${index}].soft_delete_column`,
|
|
120
|
+
});
|
|
121
|
+
} else {
|
|
122
|
+
errors.push({
|
|
123
|
+
expected: `Summary/description to not mention soft delete when model lacks soft-delete capability`,
|
|
124
|
+
value: `${op.summary || ""} ${op.description || ""}`,
|
|
125
|
+
description: `Mismatch: Operation mentions soft delete but model '${op.model_name}' has no soft-delete capable columns`,
|
|
126
|
+
path: `$input.content[${index}].summary || $input.content[${index}].description`,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
// If soft_delete_column is specified, check if it exists in the model
|
|
131
|
+
const column = model?.plainFields.find(
|
|
132
|
+
(el) => el.name === op.soft_delete_column,
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
if (!column) {
|
|
136
|
+
errors.push({
|
|
137
|
+
expected: `Field '${op.soft_delete_column}' to exist in model or operation to not mention soft delete`,
|
|
138
|
+
value: "undefined",
|
|
139
|
+
description: `Mismatch: Either the field '${op.soft_delete_column}' should exist in model '${op.model_name}', or the operation should not mention soft delete`,
|
|
140
|
+
path: `$input.content[${index}].soft_delete_column || $input.content[${index}].summary || $input.content[${index}].description`,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Also check if soft_delete_column is specified without mentioning soft delete
|
|
147
|
+
if (op.soft_delete_column && !mentionsSoftDelete) {
|
|
148
|
+
errors.push({
|
|
149
|
+
expected: `Consistency between soft_delete_column and operation description`,
|
|
150
|
+
value: `soft_delete_column: ${op.soft_delete_column}`,
|
|
151
|
+
description: `Mismatch: soft_delete_column is specified but soft delete is not mentioned in summary/description`,
|
|
152
|
+
path: `$input.content[${index}]`,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// not implemented
|
|
159
|
+
if (errors.length !== 0) {
|
|
160
|
+
console.log(JSON.stringify(errors, null, 2));
|
|
161
|
+
return {
|
|
162
|
+
success: false,
|
|
163
|
+
errors,
|
|
164
|
+
data: next,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
return result;
|
|
168
|
+
};
|
|
169
|
+
|
|
76
170
|
const application: ILlmApplication<Model> = collection[
|
|
77
171
|
props.model === "chatgpt" ? "chatgpt" : "claude"
|
|
78
|
-
]
|
|
172
|
+
](
|
|
173
|
+
validate,
|
|
174
|
+
) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
|
|
79
175
|
|
|
80
176
|
return {
|
|
81
177
|
protocol: "class",
|
|
@@ -90,12 +186,26 @@ function createReviewController<Model extends ILlmSchema.Model>(props: {
|
|
|
90
186
|
}
|
|
91
187
|
|
|
92
188
|
const collection = {
|
|
93
|
-
chatgpt:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
189
|
+
chatgpt: (validate: Validator) =>
|
|
190
|
+
typia.llm.application<
|
|
191
|
+
IAutoBeInterfaceOperationsReviewApplication,
|
|
192
|
+
"chatgpt"
|
|
193
|
+
>({
|
|
194
|
+
validate: {
|
|
195
|
+
reviewOperations: validate,
|
|
196
|
+
},
|
|
197
|
+
}),
|
|
198
|
+
claude: (validate: Validator) =>
|
|
199
|
+
typia.llm.application<
|
|
200
|
+
IAutoBeInterfaceOperationsReviewApplication,
|
|
201
|
+
"claude"
|
|
202
|
+
>({
|
|
203
|
+
validate: {
|
|
204
|
+
reviewOperations: validate,
|
|
205
|
+
},
|
|
206
|
+
}),
|
|
101
207
|
};
|
|
208
|
+
|
|
209
|
+
type Validator = (
|
|
210
|
+
input: unknown,
|
|
211
|
+
) => IValidation<IAutoBeInterfaceOperationsReviewApplication.IProps>;
|
|
@@ -4,14 +4,17 @@ import {
|
|
|
4
4
|
AutoBeOpenApi,
|
|
5
5
|
AutoBeProgressEventBase,
|
|
6
6
|
} from "@autobe/interface";
|
|
7
|
+
import { StringUtil } from "@autobe/utils";
|
|
7
8
|
import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
|
|
8
9
|
import { OpenApiV3_1Emender } from "@samchon/openapi/lib/converters/OpenApiV3_1Emender";
|
|
9
10
|
import { IPointer } from "tstl";
|
|
10
11
|
import typia, { tags } from "typia";
|
|
12
|
+
import { v7 } from "uuid";
|
|
11
13
|
|
|
12
14
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
13
15
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
14
16
|
import { divideArray } from "../../utils/divideArray";
|
|
17
|
+
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
15
18
|
import { transformInterfaceSchemaHistories } from "./histories/transformInterfaceSchemaHistories";
|
|
16
19
|
import { orchestrateInterfaceSchemasReview } from "./orchestrateInterfaceSchemasReview";
|
|
17
20
|
import { IAutoBeInterfaceSchemaApplication } from "./structures/IAutoBeInterfaceSchemaApplication";
|
|
@@ -50,10 +53,17 @@ export async function orchestrateInterfaceSchemas<
|
|
|
50
53
|
IAuthorizationToken: authTokenSchema,
|
|
51
54
|
}
|
|
52
55
|
: {};
|
|
53
|
-
for (const y of await
|
|
54
|
-
matrix.map(async (
|
|
56
|
+
for (const y of await executeCachedBatch(
|
|
57
|
+
matrix.map((it) => async (promptCacheKey) => {
|
|
55
58
|
const row: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
|
|
56
|
-
await divideAndConquer(
|
|
59
|
+
await divideAndConquer(
|
|
60
|
+
ctx,
|
|
61
|
+
operations,
|
|
62
|
+
it,
|
|
63
|
+
3,
|
|
64
|
+
progress,
|
|
65
|
+
promptCacheKey,
|
|
66
|
+
);
|
|
57
67
|
const newbie: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
|
|
58
68
|
await orchestrateInterfaceSchemasReview(
|
|
59
69
|
ctx,
|
|
@@ -76,13 +86,21 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
|
76
86
|
typeNames: string[],
|
|
77
87
|
retry: number,
|
|
78
88
|
progress: AutoBeProgressEventBase,
|
|
89
|
+
promptCacheKey: string,
|
|
79
90
|
): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
|
|
80
91
|
const remained: Set<string> = new Set(typeNames);
|
|
81
92
|
const schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {};
|
|
82
93
|
for (let i: number = 0; i < retry; ++i) {
|
|
83
94
|
if (remained.size === 0) break;
|
|
84
95
|
const newbie: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
|
|
85
|
-
await process(
|
|
96
|
+
await process(
|
|
97
|
+
ctx,
|
|
98
|
+
operations,
|
|
99
|
+
schemas,
|
|
100
|
+
remained,
|
|
101
|
+
progress,
|
|
102
|
+
promptCacheKey,
|
|
103
|
+
);
|
|
86
104
|
for (const key of Object.keys(newbie)) {
|
|
87
105
|
schemas[key] = newbie[key];
|
|
88
106
|
remained.delete(key);
|
|
@@ -97,6 +115,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
97
115
|
oldbie: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>,
|
|
98
116
|
remained: Set<string>,
|
|
99
117
|
progress: AutoBeProgressEventBase,
|
|
118
|
+
promptCacheKey: string,
|
|
100
119
|
): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
|
|
101
120
|
const already: string[] = Object.keys(oldbie);
|
|
102
121
|
const pointer: IPointer<Record<
|
|
@@ -117,25 +136,29 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
117
136
|
pointer,
|
|
118
137
|
}),
|
|
119
138
|
enforceFunctionCall: true,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
promptCacheKey,
|
|
140
|
+
message: StringUtil.trim`
|
|
141
|
+
Make type components please.
|
|
142
|
+
|
|
143
|
+
Here is the list of request/response bodies' type names from
|
|
144
|
+
OpenAPI operations. Make type components of them. If more object
|
|
145
|
+
types are required during making the components, please make them
|
|
146
|
+
too.
|
|
147
|
+
|
|
148
|
+
${Array.from(remained)
|
|
149
|
+
.map((k) => ` - \`${k}\``)
|
|
150
|
+
.join("\n")}${
|
|
151
|
+
already.length !== 0
|
|
152
|
+
? StringUtil.trim`
|
|
153
|
+
|
|
154
|
+
> By the way, here is the list of components schemas what you've
|
|
155
|
+
> already made. So, you don't need to make them again.
|
|
156
|
+
>
|
|
157
|
+
${already.map((k) => `> - \`${k}\``).join("\n")}
|
|
158
|
+
`
|
|
159
|
+
: ""
|
|
160
|
+
}
|
|
161
|
+
`,
|
|
139
162
|
});
|
|
140
163
|
if (pointer.value === null) throw new Error("Failed to create components.");
|
|
141
164
|
|
|
@@ -147,6 +170,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
147
170
|
).schemas ?? {};
|
|
148
171
|
ctx.dispatch({
|
|
149
172
|
type: "interfaceSchemas",
|
|
173
|
+
id: v7(),
|
|
150
174
|
schemas,
|
|
151
175
|
tokenUsage,
|
|
152
176
|
completed: (progress.completed += Object.keys(schemas).length),
|
|
@@ -2,11 +2,13 @@ import { IAgenticaController } from "@agentica/core";
|
|
|
2
2
|
import {
|
|
3
3
|
AutoBeInterfaceSchemasReviewEvent,
|
|
4
4
|
AutoBeOpenApi,
|
|
5
|
+
AutoBeProgressEventBase,
|
|
5
6
|
} from "@autobe/interface";
|
|
6
7
|
import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
|
|
7
8
|
import { OpenApiV3_1Emender } from "@samchon/openapi/lib/converters/OpenApiV3_1Emender";
|
|
8
9
|
import { 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";
|
|
@@ -23,7 +25,7 @@ export async function orchestrateInterfaceSchemasReview<
|
|
|
23
25
|
string,
|
|
24
26
|
AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>
|
|
25
27
|
>,
|
|
26
|
-
progress:
|
|
28
|
+
progress: AutoBeProgressEventBase,
|
|
27
29
|
): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
|
|
28
30
|
try {
|
|
29
31
|
const pointer: IPointer<IAutoBeInterfaceSchemasReviewApplication.IProps | null> =
|
|
@@ -35,6 +37,7 @@ export async function orchestrateInterfaceSchemasReview<
|
|
|
35
37
|
controller: createController({
|
|
36
38
|
model: ctx.model,
|
|
37
39
|
pointer,
|
|
40
|
+
operations,
|
|
38
41
|
schemas,
|
|
39
42
|
}),
|
|
40
43
|
histories: transformInterfaceSchemasReviewHistories(
|
|
@@ -59,6 +62,7 @@ export async function orchestrateInterfaceSchemasReview<
|
|
|
59
62
|
).schemas ?? {};
|
|
60
63
|
ctx.dispatch({
|
|
61
64
|
type: "interfaceSchemasReview",
|
|
65
|
+
id: v7(),
|
|
62
66
|
schemas: schemas,
|
|
63
67
|
review: pointer.value.review,
|
|
64
68
|
plan: pointer.value.plan,
|
|
@@ -80,6 +84,7 @@ export async function orchestrateInterfaceSchemasReview<
|
|
|
80
84
|
function createController<Model extends ILlmSchema.Model>(props: {
|
|
81
85
|
model: Model;
|
|
82
86
|
pointer: IPointer<IAutoBeInterfaceSchemasReviewApplication.IProps | null>;
|
|
87
|
+
operations: AutoBeOpenApi.IOperation[];
|
|
83
88
|
schemas: Record<
|
|
84
89
|
string,
|
|
85
90
|
AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>
|
|
@@ -100,14 +105,93 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
100
105
|
schemas: result.data.content,
|
|
101
106
|
path: "$input.content",
|
|
102
107
|
});
|
|
108
|
+
|
|
109
|
+
Object.entries(result.data.content).forEach(
|
|
110
|
+
([tagName, jsonDescriptive]) => {
|
|
111
|
+
const index: AutoBeOpenApi.IOperation | undefined =
|
|
112
|
+
props.operations.find(
|
|
113
|
+
(op) =>
|
|
114
|
+
op.responseBody?.typeName === tagName &&
|
|
115
|
+
op.method === "patch" &&
|
|
116
|
+
op.name === "index",
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
// The index API should return the `IPage<T>` type.
|
|
120
|
+
if (index) {
|
|
121
|
+
// First check if the schema has the correct object structure
|
|
122
|
+
if (
|
|
123
|
+
!("type" in jsonDescriptive) ||
|
|
124
|
+
jsonDescriptive.type !== "object"
|
|
125
|
+
) {
|
|
126
|
+
errors.push({
|
|
127
|
+
path: `$input.content.${tagName}`,
|
|
128
|
+
expected: `{ type: "object", properties: { ... } }`,
|
|
129
|
+
value: jsonDescriptive,
|
|
130
|
+
description: `IPage schema must have type: "object". Found: ${JSON.stringify(jsonDescriptive)}`,
|
|
131
|
+
});
|
|
132
|
+
} else if (!("properties" in jsonDescriptive)) {
|
|
133
|
+
errors.push({
|
|
134
|
+
path: `$input.content.${tagName}`,
|
|
135
|
+
expected: `Schema with "properties" field`,
|
|
136
|
+
value: jsonDescriptive,
|
|
137
|
+
description: `IPage schema must have a "properties" field containing "pagination" and "data" properties.`,
|
|
138
|
+
});
|
|
139
|
+
} else if (
|
|
140
|
+
typia.is<AutoBeOpenApi.IJsonSchema.IObject>(jsonDescriptive)
|
|
141
|
+
) {
|
|
142
|
+
jsonDescriptive.properties ??= {};
|
|
143
|
+
|
|
144
|
+
// Check pagination property
|
|
145
|
+
const pagination = jsonDescriptive.properties["pagination"];
|
|
146
|
+
if (!pagination || !("$ref" in pagination)) {
|
|
147
|
+
errors.push({
|
|
148
|
+
path: `$input.content.${tagName}.properties.pagination`,
|
|
149
|
+
expected: `{ $ref: "#/components/schemas/IPage.IPagination" }`,
|
|
150
|
+
value: pagination,
|
|
151
|
+
description: `IPage must have a "pagination" property with $ref to IPage.IPagination.`,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Check data property
|
|
156
|
+
const data = jsonDescriptive.properties["data"];
|
|
157
|
+
if (!typia.is<AutoBeOpenApi.IJsonSchema.IArray>(data)) {
|
|
158
|
+
errors.push({
|
|
159
|
+
path: `$input.content.${tagName}.properties.data`,
|
|
160
|
+
expected: `AutoBeOpenApi.IJsonSchema.IArray`,
|
|
161
|
+
value: data,
|
|
162
|
+
description: `The 'data' property must be an array for the index operation.`,
|
|
163
|
+
});
|
|
164
|
+
} else {
|
|
165
|
+
// Check if array items have proper type reference (not 'any')
|
|
166
|
+
const arraySchema: AutoBeOpenApi.IJsonSchema.IArray = data;
|
|
167
|
+
if (
|
|
168
|
+
!arraySchema.items ||
|
|
169
|
+
!("$ref" in arraySchema.items) ||
|
|
170
|
+
arraySchema.items.$ref === "#/components/schemas/any"
|
|
171
|
+
) {
|
|
172
|
+
errors.push({
|
|
173
|
+
path: `$input.content.${tagName}.properties.data.items`,
|
|
174
|
+
expected: `Reference to a specific type (e.g., $ref to ISummary type)`,
|
|
175
|
+
value: arraySchema.items,
|
|
176
|
+
description: `The 'data' array must have a specific item type, not 'any[]'. Use a proper type reference like '{Entity}.ISummary' for paginated results.`,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
);
|
|
184
|
+
|
|
103
185
|
if (errors.length !== 0)
|
|
104
186
|
return {
|
|
105
187
|
success: false,
|
|
106
188
|
errors,
|
|
107
189
|
data: next,
|
|
108
190
|
};
|
|
191
|
+
|
|
109
192
|
return result;
|
|
110
193
|
};
|
|
194
|
+
|
|
111
195
|
const application: ILlmApplication<Model> = collection[
|
|
112
196
|
props.model === "chatgpt" ? "chatgpt" : "claude"
|
|
113
197
|
](
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { AutoBeOpenApi } from "@autobe/interface";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Interface for reviewing and refining API endpoints through holistic analysis.
|
|
5
|
+
*
|
|
6
|
+
* This application performs comprehensive review of all endpoints generated
|
|
7
|
+
* through divide-and-conquer strategy, ensuring consistency, eliminating
|
|
8
|
+
* redundancy, and preventing over-engineering across the entire API surface.
|
|
9
|
+
*/
|
|
10
|
+
export interface IAutoBeInterfaceEndpointsReviewApplication {
|
|
11
|
+
/**
|
|
12
|
+
* Reviews and refines the complete collection of API endpoints.
|
|
13
|
+
*
|
|
14
|
+
* This method consolidates all endpoints generated independently by different
|
|
15
|
+
* groups and performs holistic review to:
|
|
16
|
+
* - Ensure naming consistency across all endpoints
|
|
17
|
+
* - Remove duplicate or overlapping endpoints
|
|
18
|
+
* - Eliminate over-engineered solutions
|
|
19
|
+
* - Standardize path structures and HTTP methods
|
|
20
|
+
* - Verify REST API design principles
|
|
21
|
+
*
|
|
22
|
+
* The review process examines the entire API as a cohesive system rather
|
|
23
|
+
* than individual endpoints, ensuring the final API is intuitive, maintainable,
|
|
24
|
+
* and follows best practices.
|
|
25
|
+
*
|
|
26
|
+
* @param next - The review results and refined endpoint collection
|
|
27
|
+
*/
|
|
28
|
+
reviewEndpoints(
|
|
29
|
+
next: IAutoBeInterfaceEndpointsReviewApplication.IProps,
|
|
30
|
+
): void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export namespace IAutoBeInterfaceEndpointsReviewApplication {
|
|
34
|
+
export interface IProps {
|
|
35
|
+
/**
|
|
36
|
+
* Comprehensive review analysis of all collected endpoints.
|
|
37
|
+
*
|
|
38
|
+
* Contains detailed findings from the holistic review including:
|
|
39
|
+
* - Identified inconsistencies in naming conventions
|
|
40
|
+
* - Duplicate endpoints that serve the same purpose
|
|
41
|
+
* - Over-engineered solutions that add unnecessary complexity
|
|
42
|
+
* - Violations of REST API design principles
|
|
43
|
+
* - Recommendations for improvement and standardization
|
|
44
|
+
*
|
|
45
|
+
* The review provides actionable feedback for creating a clean,
|
|
46
|
+
* consistent, and maintainable API structure.
|
|
47
|
+
*/
|
|
48
|
+
review: string;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Refined collection of API endpoints after review and cleanup.
|
|
52
|
+
*
|
|
53
|
+
* The final optimized set of endpoints after:
|
|
54
|
+
* - Removing duplicates and redundant endpoints
|
|
55
|
+
* - Standardizing naming conventions across all paths
|
|
56
|
+
* - Simplifying over-engineered solutions
|
|
57
|
+
* - Ensuring consistent REST patterns
|
|
58
|
+
* - Aligning HTTP methods with their semantic meanings
|
|
59
|
+
*
|
|
60
|
+
* This collection represents the production-ready API structure
|
|
61
|
+
* that balances functionality with simplicity and maintainability.
|
|
62
|
+
*/
|
|
63
|
+
endpoints: AutoBeOpenApi.IEndpoint[];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -91,6 +91,45 @@ export namespace IAutoBeInterfaceOperationApplication {
|
|
|
91
91
|
AutoBeOpenApi.IOperation,
|
|
92
92
|
"authorizationRole" | "authorizationType"
|
|
93
93
|
> {
|
|
94
|
+
/**
|
|
95
|
+
* Prisma schema models relevant to this operation.
|
|
96
|
+
*
|
|
97
|
+
* Contains the complete Prisma schema definitions for all entities involved
|
|
98
|
+
* in this operation, including their fields, relations, and database
|
|
99
|
+
* constraints. This enables comprehensive validation and schema-aware
|
|
100
|
+
* operation design.
|
|
101
|
+
*
|
|
102
|
+
* The schema information serves multiple critical purposes:
|
|
103
|
+
*
|
|
104
|
+
* - **Field Verification**: Ensures all referenced fields actually exist in
|
|
105
|
+
* the database schema and have the correct types
|
|
106
|
+
* - **Relationship Validation**: Confirms that entity relationships are
|
|
107
|
+
* properly defined and can support the operation's data access patterns
|
|
108
|
+
* - **Soft-Delete Detection**: For DELETE operations, identifies whether
|
|
109
|
+
* entities have soft-delete fields (deleted_at, is_deleted, etc.) to
|
|
110
|
+
* determine if the operation should perform logical deletion instead of
|
|
111
|
+
* physical removal
|
|
112
|
+
* - **Constraint Awareness**: Understands unique constraints, required
|
|
113
|
+
* fields, and default values to generate accurate request/response
|
|
114
|
+
* schemas
|
|
115
|
+
*
|
|
116
|
+
* Example content might include:
|
|
117
|
+
*
|
|
118
|
+
* ```prisma
|
|
119
|
+
* model User {
|
|
120
|
+
* id String @id @default(uuid())
|
|
121
|
+
* email String @unique
|
|
122
|
+
* name String
|
|
123
|
+
* deleted_at DateTime? // Indicates soft-delete capability
|
|
124
|
+
* posts Post[]
|
|
125
|
+
* }
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* This schema context ensures operations are fully aligned with the actual
|
|
129
|
+
* database structure and business logic requirements.
|
|
130
|
+
*/
|
|
131
|
+
prisma_schemas: string;
|
|
132
|
+
|
|
94
133
|
/**
|
|
95
134
|
* Authorization roles required to access this API operation.
|
|
96
135
|
*
|
|
@@ -135,5 +135,86 @@ export namespace IAutoBeInterfaceOperationsReviewApplication {
|
|
|
135
135
|
* ```
|
|
136
136
|
*/
|
|
137
137
|
export interface IOperation
|
|
138
|
-
extends Omit<AutoBeOpenApi.IOperation, "authorizationType"> {
|
|
138
|
+
extends Omit<AutoBeOpenApi.IOperation, "authorizationType"> {
|
|
139
|
+
/**
|
|
140
|
+
* Prisma schema models relevant to this operation.
|
|
141
|
+
*
|
|
142
|
+
* Contains the complete Prisma schema definitions for all entities involved
|
|
143
|
+
* in this operation, including their fields, relations, and database
|
|
144
|
+
* constraints. This enables comprehensive validation and schema-aware
|
|
145
|
+
* operation design.
|
|
146
|
+
*
|
|
147
|
+
* The schema information serves multiple critical purposes:
|
|
148
|
+
*
|
|
149
|
+
* - **Field Verification**: Ensures all referenced fields actually exist in
|
|
150
|
+
* the database schema and have the correct types
|
|
151
|
+
* - **Relationship Validation**: Confirms that entity relationships are
|
|
152
|
+
* properly defined and can support the operation's data access patterns
|
|
153
|
+
* - **Soft-Delete Detection**: For DELETE operations, identifies whether
|
|
154
|
+
* entities have soft-delete fields (deleted_at, is_deleted, etc.) to
|
|
155
|
+
* determine if the operation should perform logical deletion instead of
|
|
156
|
+
* physical removal
|
|
157
|
+
* - **Constraint Awareness**: Understands unique constraints, required
|
|
158
|
+
* fields, and default values to generate accurate request/response
|
|
159
|
+
* schemas
|
|
160
|
+
*
|
|
161
|
+
* Example content might include:
|
|
162
|
+
*
|
|
163
|
+
* ```prisma
|
|
164
|
+
* model User {
|
|
165
|
+
* id String @id @default(uuid())
|
|
166
|
+
* email String @unique
|
|
167
|
+
* name String
|
|
168
|
+
* deleted_at DateTime? // Indicates soft-delete capability
|
|
169
|
+
* posts Post[]
|
|
170
|
+
* }
|
|
171
|
+
* ```
|
|
172
|
+
*
|
|
173
|
+
* This schema context ensures operations are fully aligned with the actual
|
|
174
|
+
* database structure and business logic requirements.
|
|
175
|
+
*/
|
|
176
|
+
prisma_schemas: string;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Primary Prisma model name for this operation.
|
|
180
|
+
*
|
|
181
|
+
* Identifies the main database table/model that this operation targets.
|
|
182
|
+
* This must match exactly with the Prisma model name defined in the schema.
|
|
183
|
+
* When soft deletion is specified, this model name indicates which table
|
|
184
|
+
* should be soft-deleted.
|
|
185
|
+
*
|
|
186
|
+
* For example:
|
|
187
|
+
* - In a "GET /users/:id" operation, this would be "User"
|
|
188
|
+
* - In a "POST /articles" operation, this would be "Article"
|
|
189
|
+
* - In a "DELETE /comments/:id" with soft delete, this specifies the "Comment" model to soft-delete
|
|
190
|
+
*
|
|
191
|
+
* This property is essential for:
|
|
192
|
+
* - Determining the primary entity for CRUD operations
|
|
193
|
+
* - Identifying which table to apply soft deletion to
|
|
194
|
+
* - Validating operations against the correct Prisma model
|
|
195
|
+
* - Generating appropriate database queries and validations
|
|
196
|
+
*/
|
|
197
|
+
model_name: string;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Soft delete column name for the Prisma models.
|
|
201
|
+
*
|
|
202
|
+
* Specifies the column name used for soft deletion in the database tables
|
|
203
|
+
* associated with this operation. When set to a non-null value, it indicates
|
|
204
|
+
* that the related entities support soft deletion through this column
|
|
205
|
+
* (typically a timestamp field like `deleted_at` or `deletedAt`).
|
|
206
|
+
*
|
|
207
|
+
* When null, it means the entities involved in this operation use hard
|
|
208
|
+
* deletion or don't support deletion at all. This information is crucial
|
|
209
|
+
* for generating appropriate CRUD operations and ensuring data integrity
|
|
210
|
+
* policies are correctly implemented.
|
|
211
|
+
*
|
|
212
|
+
* Common soft delete patterns:
|
|
213
|
+
* - `"deleted_at"`: Records deletion timestamp
|
|
214
|
+
* - `"deletedAt"`: Camel-cased deletion timestamp
|
|
215
|
+
* - `"is_deleted"`: Boolean flag for deletion status
|
|
216
|
+
* - `null`: No soft deletion (hard delete only)
|
|
217
|
+
*/
|
|
218
|
+
soft_delete_column: string | null;
|
|
219
|
+
}
|
|
139
220
|
}
|