@autobe/agent 0.14.5 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AutoBeMockAgent.js +1 -1
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +11 -9
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/index.mjs +3557 -2635
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js +4 -9
- package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +2 -8
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.js +1 -1
- package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.js.map +1 -1
- package/lib/orchestrate/analyze/transformAnalyzeWriteHistories.js +1 -1
- package/lib/orchestrate/analyze/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.d.ts +3 -0
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js +65 -0
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.d.ts +4 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +62 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.d.ts +4 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +28 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.d.ts +3 -0
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +28 -0
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.d.ts +4 -0
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +28 -0
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.d.ts +3 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.js +63 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +4 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +28 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterface.js +14 -9
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +13 -40
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.d.ts +3 -2
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +52 -32
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +4 -0
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +350 -0
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +252 -226
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.d.ts +4 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +411 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +55 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointApplication.d.ts +23 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +108 -0
- package/lib/orchestrate/{realize/structures/IAutoBeRealizeDecoratorApplication.js → interface/structures/IAutoBeInterfaceGroupApplication.js} +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +122 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +75 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.js.map +1 -0
- package/lib/orchestrate/interface/{OpenApiEndpointComparator.d.ts → utils/OpenApiEndpointComparator.d.ts} +1 -0
- package/lib/orchestrate/interface/{OpenApiEndpointComparator.js → utils/OpenApiEndpointComparator.js} +6 -0
- package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealize.js +17 -3
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +81 -88
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.d.ts +4 -0
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +513 -0
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js +3 -2
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -1
- package/lib/orchestrate/realize/structures/{IAutoBeRealizeDecoratorApplication.d.ts → IAutoBeRealizeAuthorizationApplication.d.ts} +9 -9
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.js +3 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.js.map +1 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +33 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.js +3 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.js.map +1 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.d.ts +34 -13
- package/lib/orchestrate/realize/transformRealizeAuthorization.d.ts +4 -0
- package/lib/orchestrate/realize/transformRealizeAuthorization.js +43 -0
- package/lib/orchestrate/realize/transformRealizeAuthorization.js.map +1 -0
- package/lib/orchestrate/realize/transformRealizeAuthorizationCorrectHistories.d.ts +5 -0
- package/lib/orchestrate/realize/transformRealizeAuthorizationCorrectHistories.js +71 -0
- package/lib/orchestrate/realize/transformRealizeAuthorizationCorrectHistories.js.map +1 -0
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js +5 -5
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js.map +1 -1
- package/lib/orchestrate/realize/utils/InternalFileSystem.d.ts +8 -0
- package/lib/orchestrate/realize/utils/InternalFileSystem.js +17 -0
- package/lib/orchestrate/realize/utils/InternalFileSystem.js.map +1 -0
- package/lib/orchestrate/realize/utils/ProviderFileSystem.d.ts +3 -0
- package/lib/orchestrate/realize/utils/ProviderFileSystem.js +8 -0
- package/lib/orchestrate/realize/utils/ProviderFileSystem.js.map +1 -0
- package/lib/orchestrate/realize/utils/replaceImportStatements.js +2 -2
- package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/orchestrate/realize/writeCodeUntilCompilePassed.js +36 -36
- package/lib/orchestrate/realize/writeCodeUntilCompilePassed.js.map +1 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js +1 -0
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +2 -0
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +29 -13
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +2 -0
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/orchestrate/test/transformTestWriteHistories.js +3 -2
- package/lib/orchestrate/test/transformTestWriteHistories.js.map +1 -1
- package/lib/utils/arrayToRecord.d.ts +17 -0
- package/lib/utils/arrayToRecord.js +19 -0
- package/lib/utils/arrayToRecord.js.map +1 -0
- package/lib/utils/backoffRetry.js +0 -1
- package/lib/utils/backoffRetry.js.map +1 -1
- package/package.json +6 -5
- package/src/AutoBeMockAgent.ts +1 -1
- package/src/constants/AutoBeSystemPromptConstant.ts +11 -9
- package/src/orchestrate/analyze/orchestrateAnalyzeReviewer.ts +1 -3
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +1 -3
- package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +75 -0
- package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +69 -0
- package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +34 -0
- package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +32 -0
- package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +34 -0
- package/src/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.ts +66 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +34 -0
- package/src/orchestrate/interface/orchestrateInterface.ts +17 -8
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +22 -97
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +48 -55
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +109 -0
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +83 -120
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +197 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.ts +58 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointApplication.ts +24 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +112 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +125 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +76 -0
- package/src/orchestrate/interface/{OpenApiEndpointComparator.ts → utils/OpenApiEndpointComparator.ts} +8 -0
- package/src/orchestrate/realize/orchestrateRealize.ts +25 -3
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +45 -54
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +179 -0
- package/src/orchestrate/realize/orchestrateRealizeCoder.ts +3 -6
- package/src/orchestrate/realize/structures/{IAutoBeRealizeDecoratorApplication.ts → IAutoBeRealizeAuthorizationApplication.ts} +11 -9
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +40 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeCompile.ts +42 -24
- package/src/orchestrate/realize/{transformRealizeDecorator.ts → transformRealizeAuthorization.ts} +13 -2
- package/src/orchestrate/realize/{transformRealizeDecoratorCorrectHistories.ts → transformRealizeAuthorizationCorrectHistories.ts} +15 -7
- package/src/orchestrate/realize/transformRealizeCoderHistories.ts +4 -4
- package/src/orchestrate/realize/utils/InternalFileSystem.ts +12 -0
- package/src/orchestrate/realize/utils/ProviderFileSystem.ts +4 -0
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +2 -2
- package/src/orchestrate/realize/writeCodeUntilCompilePassed.ts +59 -53
- package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +1 -0
- package/src/orchestrate/test/orchestrateTestCorrect.ts +3 -0
- package/src/orchestrate/test/orchestrateTestScenario.ts +4 -2
- package/src/orchestrate/test/orchestrateTestWrite.ts +8 -1
- package/src/utils/arrayToRecord.ts +49 -0
- package/src/utils/backoffRetry.ts +0 -1
- package/lib/orchestrate/interface/OpenApiEndpointComparator.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.d.ts +0 -4
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +0 -473
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +0 -1
- package/lib/orchestrate/interface/transformInterfaceHistories.d.ts +0 -3
- package/lib/orchestrate/interface/transformInterfaceHistories.js +0 -149
- package/lib/orchestrate/interface/transformInterfaceHistories.js.map +0 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeDecoratorApplication.js.map +0 -1
- package/lib/orchestrate/realize/transformRealizeDecorator.d.ts +0 -4
- package/lib/orchestrate/realize/transformRealizeDecorator.js +0 -32
- package/lib/orchestrate/realize/transformRealizeDecorator.js.map +0 -1
- package/lib/orchestrate/realize/transformRealizeDecoratorCorrectHistories.d.ts +0 -5
- package/lib/orchestrate/realize/transformRealizeDecoratorCorrectHistories.js +0 -62
- package/lib/orchestrate/realize/transformRealizeDecoratorCorrectHistories.js.map +0 -1
- package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +0 -292
- package/src/orchestrate/interface/transformInterfaceHistories.ts +0 -152
|
@@ -8,9 +8,8 @@ import { v4 } from "uuid";
|
|
|
8
8
|
|
|
9
9
|
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
10
10
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
11
|
-
import { IAutoBeRealizeDecoratorApplication } from "./structures/IAutoBeRealizeDecoratorApplication";
|
|
12
11
|
|
|
13
|
-
export const
|
|
12
|
+
export const transformRealizeAuthorizationCorrectHistories = (
|
|
14
13
|
ctx: AutoBeContext<ILlmSchema.Model>,
|
|
15
14
|
auth: AutoBeRealizeAuthorization,
|
|
16
15
|
templateFiles: Record<string, string>,
|
|
@@ -23,7 +22,13 @@ export const transformRealizeDecoratorCorrectHistories = (
|
|
|
23
22
|
id: v4(),
|
|
24
23
|
created_at: new Date().toISOString(),
|
|
25
24
|
type: "systemMessage",
|
|
26
|
-
text: AutoBeSystemPromptConstant.
|
|
25
|
+
text: AutoBeSystemPromptConstant.REALIZE_AUTHORIZATION,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: v4(),
|
|
29
|
+
created_at: new Date().toISOString(),
|
|
30
|
+
type: "systemMessage",
|
|
31
|
+
text: AutoBeSystemPromptConstant.REALIZE_AUTHORIZATION_CORRECT,
|
|
27
32
|
},
|
|
28
33
|
{
|
|
29
34
|
id: v4(),
|
|
@@ -36,18 +41,21 @@ export const transformRealizeDecoratorCorrectHistories = (
|
|
|
36
41
|
`${JSON.stringify(
|
|
37
42
|
{
|
|
38
43
|
provider: {
|
|
44
|
+
location: auth.provider.location,
|
|
39
45
|
name: auth.provider.name,
|
|
40
|
-
|
|
46
|
+
content: auth.provider.content,
|
|
41
47
|
},
|
|
42
48
|
decorator: {
|
|
49
|
+
location: auth.decorator.location,
|
|
43
50
|
name: auth.decorator.name,
|
|
44
|
-
|
|
51
|
+
content: auth.decorator.content,
|
|
45
52
|
},
|
|
46
53
|
payload: {
|
|
54
|
+
location: auth.payload.location,
|
|
47
55
|
name: auth.payload.name,
|
|
48
|
-
|
|
56
|
+
content: auth.payload.content,
|
|
49
57
|
},
|
|
50
|
-
} satisfies
|
|
58
|
+
} satisfies Omit<AutoBeRealizeAuthorization, "role">,
|
|
51
59
|
null,
|
|
52
60
|
2,
|
|
53
61
|
)}`,
|
|
@@ -101,12 +101,12 @@ export const transformRealizeCoderHistories = (
|
|
|
101
101
|
`- Decorator implementation: decorators/${props.decoratorEvent.decorator.name}.ts`,
|
|
102
102
|
` - NestJS parameter decorator`,
|
|
103
103
|
` - When importing from providers folder, use: '../decorators/${props.decoratorEvent.decorator.name}'`,
|
|
104
|
-
`- Authentication provider:
|
|
104
|
+
`- Authentication provider: decorators/${props.decoratorEvent.provider.name}.ts`,
|
|
105
105
|
` - Contains JWT validation, role checking, and authorization logic`,
|
|
106
|
-
` - When importing from providers folder, use: '../
|
|
107
|
-
`- Type definition:
|
|
106
|
+
` - When importing from providers folder, use: '../decorators/${props.decoratorEvent.provider.name}'`,
|
|
107
|
+
`- Type definition: decorators/payload/${props.decoratorEvent.payload.name}.ts`,
|
|
108
108
|
` - TypeScript interface for authenticated user payload`,
|
|
109
|
-
` - When importing from providers folder, use: '../
|
|
109
|
+
` - When importing from providers folder, use: '../decorators/payload/${props.decoratorEvent.payload.name}'`,
|
|
110
110
|
].join("\n")
|
|
111
111
|
: "",
|
|
112
112
|
},
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export namespace InternalFileSystem {
|
|
2
|
+
/**
|
|
3
|
+
* Get template files for all of realize agents
|
|
4
|
+
*
|
|
5
|
+
* @returns Template file paths
|
|
6
|
+
*/
|
|
7
|
+
export const DEFAULT = [
|
|
8
|
+
"src/providers/authorize/jwtAuthorize.ts",
|
|
9
|
+
"src/MyGlobal.ts",
|
|
10
|
+
"src/util/toISOStringSafe.ts",
|
|
11
|
+
];
|
|
12
|
+
}
|
|
@@ -38,7 +38,7 @@ export function replaceImportStatements<Model extends ILlmSchema.Model>(
|
|
|
38
38
|
// Remove any existing decoratorType imports if LLM mistakenly added them
|
|
39
39
|
if (decoratorType) {
|
|
40
40
|
const decoratorTypeRegex = new RegExp(
|
|
41
|
-
`import\\s*{\\s*${decoratorType}\\s*}\\s*from\\s*["']\\.\\.\/
|
|
41
|
+
`import\\s*{\\s*${decoratorType}\\s*}\\s*from\\s*["']\\.\\.\/decorators\/payload\/${decoratorType}["']\\s*;?\\s*`,
|
|
42
42
|
"gm",
|
|
43
43
|
);
|
|
44
44
|
code = code.replace(decoratorTypeRegex, "");
|
|
@@ -56,7 +56,7 @@ export function replaceImportStatements<Model extends ILlmSchema.Model>(
|
|
|
56
56
|
// Only add decoratorType import if it exists
|
|
57
57
|
if (decoratorType) {
|
|
58
58
|
imports.push(
|
|
59
|
-
`import { ${decoratorType} } from "../
|
|
59
|
+
`import { ${decoratorType} } from "../decorators/payload/${decoratorType}"`,
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
IAutoBeTypeScriptCompileResult,
|
|
6
6
|
} from "@autobe/interface";
|
|
7
7
|
import { ILlmSchema } from "@samchon/openapi";
|
|
8
|
-
import { readFile } from "fs/promises";
|
|
9
|
-
import path from "path";
|
|
10
8
|
|
|
11
9
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
10
|
+
import { arrayToRecord } from "../../utils/arrayToRecord";
|
|
12
11
|
import { pipe } from "./RealizePipe";
|
|
13
12
|
import { orchestrateRealizeCoder } from "./orchestrateRealizeCoder";
|
|
14
13
|
import { orchestrateRealizePlanner } from "./orchestrateRealizePlanner";
|
|
15
14
|
import { IAutoBeRealizeCompile } from "./structures/IAutoBeRealizeCompile";
|
|
16
15
|
import { FAILED } from "./structures/IAutoBeRealizeFailedSymbol";
|
|
16
|
+
import { RealizeFileSystem } from "./utils/ProviderFileSystem";
|
|
17
17
|
|
|
18
18
|
export async function writeCodeUntilCompilePassed<
|
|
19
19
|
Model extends ILlmSchema.Model,
|
|
@@ -23,26 +23,20 @@ export async function writeCodeUntilCompilePassed<
|
|
|
23
23
|
authorizations: AutoBeRealizeAuthorization[],
|
|
24
24
|
retry: number,
|
|
25
25
|
): Promise<AutoBeRealizeFunction[]> {
|
|
26
|
-
const payloads =
|
|
27
|
-
.map((el) =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
})
|
|
38
|
-
.reduce(
|
|
39
|
-
(acc, [filename, content]) => Object.assign(acc, { [filename]: content }),
|
|
40
|
-
{},
|
|
41
|
-
);
|
|
26
|
+
const payloads = arrayToRecord(
|
|
27
|
+
authorizations.map((el) => el.payload),
|
|
28
|
+
"location",
|
|
29
|
+
"content",
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const files = arrayToRecord(
|
|
33
|
+
Object.entries(await ctx.files({ dbms: "postgres" })).filter(([key]) =>
|
|
34
|
+
key.startsWith("src"),
|
|
35
|
+
),
|
|
36
|
+
);
|
|
42
37
|
|
|
43
|
-
const templateFiles = ["src/MyGlobal.ts", "src/util/toISOStringSafe.ts"];
|
|
44
38
|
const entireCodes: IAutoBeRealizeCompile.FileContentMap = {
|
|
45
|
-
...(await loadTemplateFiles(
|
|
39
|
+
...(await loadTemplateFiles(ctx)),
|
|
46
40
|
};
|
|
47
41
|
|
|
48
42
|
let diagnostics: IAutoBeRealizeCompile.CompileDiagnostics = {
|
|
@@ -91,16 +85,12 @@ export async function writeCodeUntilCompilePassed<
|
|
|
91
85
|
...payloads,
|
|
92
86
|
...files,
|
|
93
87
|
...nodeModules,
|
|
94
|
-
...
|
|
95
|
-
.map(([filename, { content }]) =>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
.reduce<Record<string, string>>(
|
|
101
|
-
(acc, cur) => Object.assign(acc, cur),
|
|
102
|
-
{},
|
|
103
|
-
),
|
|
88
|
+
...arrayToRecord(
|
|
89
|
+
Object.entries(entireCodes).map(([filename, { content }]) => [
|
|
90
|
+
filename,
|
|
91
|
+
content,
|
|
92
|
+
]),
|
|
93
|
+
),
|
|
104
94
|
},
|
|
105
95
|
});
|
|
106
96
|
|
|
@@ -121,35 +111,33 @@ export async function writeCodeUntilCompilePassed<
|
|
|
121
111
|
}
|
|
122
112
|
}
|
|
123
113
|
|
|
124
|
-
return
|
|
125
|
-
.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
114
|
+
return (
|
|
115
|
+
Object.entries(entireCodes)
|
|
116
|
+
// .filter(([filename]) => filename.startsWith("src/providers")) // filter only provider files
|
|
117
|
+
.map(([filename, value]) => {
|
|
118
|
+
return {
|
|
119
|
+
filename,
|
|
120
|
+
content: value.content,
|
|
121
|
+
endpoint: value.endpoint!,
|
|
122
|
+
location: value.location!,
|
|
123
|
+
name: value.name!,
|
|
124
|
+
role: value.role!,
|
|
125
|
+
};
|
|
126
|
+
})
|
|
127
|
+
);
|
|
136
128
|
}
|
|
137
129
|
|
|
138
|
-
async function loadTemplateFiles(
|
|
139
|
-
|
|
130
|
+
async function loadTemplateFiles<Model extends ILlmSchema.Model>(
|
|
131
|
+
ctx: AutoBeContext<Model>,
|
|
140
132
|
): Promise<IAutoBeRealizeCompile.FileContentMap> {
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
"../../../../../internals/template/realize",
|
|
144
|
-
);
|
|
133
|
+
const templateFiles = await (await ctx.compiler()).realize.getTemplate();
|
|
134
|
+
const targets = ["src/MyGlobal.ts", "src/util/toISOStringSafe.ts"];
|
|
145
135
|
|
|
146
136
|
const result: IAutoBeRealizeCompile.FileContentMap = {};
|
|
147
137
|
|
|
148
|
-
for (const filePath of
|
|
138
|
+
for (const filePath of targets) {
|
|
149
139
|
result[filePath] = {
|
|
150
|
-
content:
|
|
151
|
-
encoding: "utf-8",
|
|
152
|
-
}),
|
|
140
|
+
content: templateFiles[filePath],
|
|
153
141
|
result: "success",
|
|
154
142
|
location: filePath,
|
|
155
143
|
role: null,
|
|
@@ -171,7 +159,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
171
159
|
op,
|
|
172
160
|
(op) => orchestrateRealizePlanner(ctx, op, decorator),
|
|
173
161
|
async (p) => {
|
|
174
|
-
const filename =
|
|
162
|
+
const filename = RealizeFileSystem.providerPath(p.functionName);
|
|
175
163
|
const t = diagnostics.total.filter((el) => el.file === filename);
|
|
176
164
|
|
|
177
165
|
const d = diagnostics.current.filter((el) => el.file === filename);
|
|
@@ -204,6 +192,16 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
204
192
|
return { type: "success", op: op, result } as const;
|
|
205
193
|
}
|
|
206
194
|
|
|
195
|
+
/**
|
|
196
|
+
* Determines whether an operation should be processed in the current iteration.
|
|
197
|
+
* In the initial case (no errors), all operations are processed. When errors
|
|
198
|
+
* exist, only operations with compilation errors are targeted for reprocessing
|
|
199
|
+
* in the next iteration.
|
|
200
|
+
*
|
|
201
|
+
* @param op - The operation to check
|
|
202
|
+
* @param currentDiagnostics - Current compilation errors
|
|
203
|
+
* @returns True if the operation should be processed
|
|
204
|
+
*/
|
|
207
205
|
function shouldProcessOperation(
|
|
208
206
|
op: AutoBeOpenApi.IOperation,
|
|
209
207
|
currentDiagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[],
|
|
@@ -219,6 +217,14 @@ function shouldProcessOperation(
|
|
|
219
217
|
);
|
|
220
218
|
}
|
|
221
219
|
|
|
220
|
+
/**
|
|
221
|
+
* Generates a provider filename for an operation. Converts the operation's HTTP
|
|
222
|
+
* method and path into a valid TypeScript filename. The filename serves as both
|
|
223
|
+
* the function name and the file identifier.
|
|
224
|
+
*
|
|
225
|
+
* @param op - The operation to generate a filename for
|
|
226
|
+
* @returns The generated provider filename with path
|
|
227
|
+
*/
|
|
222
228
|
function generateProviderFilename(op: AutoBeOpenApi.IOperation): string {
|
|
223
229
|
return `src/providers/${op.method}_${op.path
|
|
224
230
|
.replaceAll("/", "_")
|
|
@@ -136,6 +136,9 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
136
136
|
});
|
|
137
137
|
if (pointer.value === null) throw new Error("Failed to modify test code.");
|
|
138
138
|
|
|
139
|
+
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
140
|
+
pointer.value.final = await compiler.typescript.beautify(pointer.value.final);
|
|
141
|
+
|
|
139
142
|
ctx.dispatch({
|
|
140
143
|
type: "testCorrect",
|
|
141
144
|
created_at: new Date().toISOString(),
|
|
@@ -150,9 +150,11 @@ const execute = async <Model extends ILlmSchema.Model>(
|
|
|
150
150
|
ctx.usage().record(tokenUsage, ["test"]);
|
|
151
151
|
});
|
|
152
152
|
if (pointer.value.length === 0) {
|
|
153
|
-
|
|
153
|
+
console.error("Failed to create test plans. No function called.");
|
|
154
|
+
return [];
|
|
155
|
+
// @todo
|
|
156
|
+
// throw new Error("Failed to create test plans.");
|
|
154
157
|
}
|
|
155
|
-
|
|
156
158
|
return pointer.value;
|
|
157
159
|
};
|
|
158
160
|
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { IAgenticaController, MicroAgentica } from "@agentica/core";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
AutoBeTestScenario,
|
|
4
|
+
AutoBeTestWriteEvent,
|
|
5
|
+
IAutoBeCompiler,
|
|
6
|
+
} from "@autobe/interface";
|
|
3
7
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
4
8
|
import { IPointer } from "tstl";
|
|
5
9
|
import typia from "typia";
|
|
@@ -106,6 +110,9 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
106
110
|
ctx.usage().record(tokenUsage, ["test"]);
|
|
107
111
|
});
|
|
108
112
|
if (pointer.value === null) throw new Error("Failed to create test code.");
|
|
113
|
+
|
|
114
|
+
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
115
|
+
pointer.value.final = await compiler.typescript.beautify(pointer.value.final);
|
|
109
116
|
return pointer.value;
|
|
110
117
|
}
|
|
111
118
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts an array of key-value pairs (entries) into a Record.
|
|
3
|
+
*
|
|
4
|
+
* @param entries - Array of [key, value] tuples
|
|
5
|
+
* @returns Record object from the entries
|
|
6
|
+
*/
|
|
7
|
+
export function arrayToRecord<V>(
|
|
8
|
+
entries: Array<[string, V]>,
|
|
9
|
+
): Record<string, V>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Converts an array of objects into a Record using specified key and value
|
|
13
|
+
* properties.
|
|
14
|
+
*
|
|
15
|
+
* @param items - Array of items to convert
|
|
16
|
+
* @param keyProp - Property name to use as the key
|
|
17
|
+
* @param valueProp - Property name to use as the value
|
|
18
|
+
* @returns Record object with the extracted key-value pairs
|
|
19
|
+
*/
|
|
20
|
+
export function arrayToRecord<T, K extends keyof T, V extends keyof T>(
|
|
21
|
+
items: T[],
|
|
22
|
+
keyProp: K,
|
|
23
|
+
valueProp: V,
|
|
24
|
+
): Record<string, T[V]>;
|
|
25
|
+
|
|
26
|
+
export function arrayToRecord<T, K extends keyof T, V extends keyof T>(
|
|
27
|
+
items: T[] | Array<[string, any]>,
|
|
28
|
+
keyProp?: K,
|
|
29
|
+
valueProp?: V,
|
|
30
|
+
): Record<string, any> {
|
|
31
|
+
// Handle entries format [string, value][]
|
|
32
|
+
if (items.length > 0 && Array.isArray(items[0]) && items[0].length === 2) {
|
|
33
|
+
return (items as Array<[string, any]>).reduce(
|
|
34
|
+
(acc, [key, value]) => Object.assign(acc, { [key]: value }),
|
|
35
|
+
{},
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Handle object array format with key and value properties
|
|
40
|
+
if (keyProp !== undefined && valueProp !== undefined) {
|
|
41
|
+
return (items as T[])
|
|
42
|
+
.map((item) => ({
|
|
43
|
+
[String(item[keyProp])]: item[valueProp],
|
|
44
|
+
}))
|
|
45
|
+
.reduce((acc, cur) => Object.assign(acc, cur), {});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
throw new Error("Invalid arguments for arrayToRecord");
|
|
49
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OpenApiEndpointComparator.js","sourceRoot":"","sources":["../../../src/orchestrate/interface/OpenApiEndpointComparator.ts"],"names":[],"mappings":";;;AACA,+BAA4B;AAE5B,IAAiB,yBAAyB,CAWzC;AAXD,WAAiB,yBAAyB;IACxC,SAAgB,QAAQ,CAAC,CAA0B;QACjD,OAAO,IAAA,WAAI,EAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAFe,kCAAQ,WAEvB,CAAA;IAED,SAAgB,MAAM,CACpB,CAA0B,EAC1B,CAA0B;QAE1B,OAAO,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,CAAC;IACpD,CAAC;IALe,gCAAM,SAKrB,CAAA;AACH,CAAC,EAXgB,yBAAyB,yCAAzB,yBAAyB,QAWzC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { AutoBeOpenApi } from "@autobe/interface";
|
|
2
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
3
|
-
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
4
|
-
export declare function orchestrateInterfaceComponents<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, operations: AutoBeOpenApi.IOperation[], capacity?: number): Promise<AutoBeOpenApi.IComponents>;
|