@autobe/agent 0.19.1 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/agent/src/AutoBeAgent.js +3 -2
- package/lib/agent/src/AutoBeAgent.js.map +1 -1
- package/lib/agent/src/AutoBeMockAgent.js +3 -3
- package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +6 -6
- package/lib/agent/src/context/AutoBeContext.d.ts +1 -0
- 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 +8 -5
- 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/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 +31 -30
- 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 +22 -18
- 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 +6 -2
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- 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 +74 -48
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +24 -4
- 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/IAutoBeInterfaceOperationApplication.d.ts +38 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +38 -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 +8 -4
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.d.ts +0 -66
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.d.ts +3 -6
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +21 -17
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/test/compile/completeTestCode.js +13 -10
- package/lib/agent/src/orchestrate/test/compile/completeTestCode.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +16 -15
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js +33 -32
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +62 -59
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +2 -2
- 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 +16 -7
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +20 -8
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +17 -17
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +2 -2
- 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 +6 -6
- package/lib/context/AutoBeContext.d.ts +1 -0
- package/lib/index.mjs +1044 -270
- 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/orchestrateInterfaceSchemasReview.d.ts +2 -5
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +38 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +38 -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/test/structures/IAutoBeTestCorrectApplication.d.ts +2 -2
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +2 -2
- package/lib/utils/executeCachedBatch.d.ts +1 -0
- package/package.json +6 -6
- package/src/AutoBeAgent.ts +4 -3
- package/src/AutoBeMockAgent.ts +4 -4
- package/src/constants/AutoBeSystemPromptConstant.ts +6 -6
- package/src/context/AutoBeContext.ts +1 -0
- package/src/factory/consentFunctionCall.ts +4 -3
- package/src/factory/createAutoBeContext.ts +9 -6
- 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/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 +13 -9
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +2 -0
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +53 -50
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +2 -0
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +47 -23
- package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +85 -1
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +39 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +40 -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 +0 -74
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +24 -23
- package/src/orchestrate/test/compile/completeTestCode.ts +17 -13
- package/src/orchestrate/test/experimental/transformTestCorrectHistories.ast +4 -4
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +17 -16
- package/src/orchestrate/test/histories/transformTestHistories.ts +35 -34
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +62 -57
- package/src/orchestrate/test/histories/transformTestWriteHistories.ts +3 -3
- package/src/orchestrate/test/orchestrateTest.ts +7 -9
- package/src/orchestrate/test/orchestrateTestCorrect.ts +34 -24
- package/src/orchestrate/test/orchestrateTestScenario.ts +28 -21
- package/src/orchestrate/test/orchestrateTestWrite.ts +16 -17
- package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +3 -3
- 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/orchestrate/analyze/histories/transformAnalyzeReviewerHistories.d.ts +0 -6
|
@@ -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,14 +2,17 @@ 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";
|
|
14
17
|
import { IAutoBeInterfaceEndpointApplication } from "./structures/IAutoBeInterfaceEndpointApplication";
|
|
15
18
|
import { OpenApiEndpointComparator } from "./utils/OpenApiEndpointComparator";
|
|
@@ -22,13 +25,16 @@ export async function orchestrateInterfaceEndpoints<
|
|
|
22
25
|
authorizations: AutoBeOpenApi.IOperation[],
|
|
23
26
|
content: string = `Make endpoints for the given assets`,
|
|
24
27
|
): Promise<AutoBeOpenApi.IEndpoint[]> {
|
|
25
|
-
const progress:
|
|
28
|
+
const progress: AutoBeProgressEventBase = {
|
|
26
29
|
total: groups.length,
|
|
27
30
|
completed: 0,
|
|
28
31
|
};
|
|
29
32
|
const endpoints: AutoBeOpenApi.IEndpoint[] = (
|
|
30
|
-
await
|
|
31
|
-
groups.map(
|
|
33
|
+
await executeCachedBatch(
|
|
34
|
+
groups.map(
|
|
35
|
+
(g) => (promptCacheKey) =>
|
|
36
|
+
process(ctx, g, content, progress, authorizations, promptCacheKey),
|
|
37
|
+
),
|
|
32
38
|
)
|
|
33
39
|
).flat();
|
|
34
40
|
return new HashSet(
|
|
@@ -42,8 +48,9 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
42
48
|
ctx: AutoBeContext<Model>,
|
|
43
49
|
group: AutoBeInterfaceGroup,
|
|
44
50
|
message: string,
|
|
45
|
-
progress:
|
|
51
|
+
progress: AutoBeProgressEventBase,
|
|
46
52
|
authorizations: AutoBeOpenApi.IOperation[],
|
|
53
|
+
promptCacheKey: string,
|
|
47
54
|
): Promise<AutoBeOpenApi.IEndpoint[]> {
|
|
48
55
|
const start: Date = new Date();
|
|
49
56
|
const pointer: IPointer<AutoBeOpenApi.IEndpoint[] | null> = {
|
|
@@ -64,12 +71,14 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
64
71
|
},
|
|
65
72
|
}),
|
|
66
73
|
enforceFunctionCall: true,
|
|
74
|
+
promptCacheKey,
|
|
67
75
|
message,
|
|
68
76
|
});
|
|
69
77
|
if (pointer.value === null) throw new Error("Failed to generate endpoints."); // unreachable
|
|
70
78
|
|
|
71
79
|
const event: AutoBeInterfaceEndpointsEvent = {
|
|
72
80
|
type: "interfaceEndpoints",
|
|
81
|
+
id: v7(),
|
|
73
82
|
endpoints: new HashSet(
|
|
74
83
|
pointer.value,
|
|
75
84
|
OpenApiEndpointComparator.hashCode,
|
|
@@ -120,8 +129,3 @@ const collection = {
|
|
|
120
129
|
deepseek: claude,
|
|
121
130
|
"3.1": claude,
|
|
122
131
|
};
|
|
123
|
-
|
|
124
|
-
interface IProgress {
|
|
125
|
-
total: number;
|
|
126
|
-
completed: number;
|
|
127
|
-
}
|
|
@@ -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>;
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
8
8
|
import { IPointer } from "tstl";
|
|
9
9
|
import typia from "typia";
|
|
10
|
+
import { v7 } from "uuid";
|
|
10
11
|
|
|
11
12
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
12
13
|
import { transformInterfaceOperationsReviewHistories } from "./histories/transformInterfaceOperationsReviewHistories";
|
|
@@ -51,6 +52,7 @@ export async function orchestrateInterfaceOperationsReview<
|
|
|
51
52
|
|
|
52
53
|
ctx.dispatch({
|
|
53
54
|
type: "interfaceOperationsReview",
|
|
55
|
+
id: v7(),
|
|
54
56
|
operations: content,
|
|
55
57
|
review: pointer.value.review,
|
|
56
58
|
plan: pointer.value.plan,
|
|
@@ -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),
|