@autobe/agent 0.9.2 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AutoBeAgent.js +11 -4
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +7 -6
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/context/AutoBeTokenUsage.d.ts +15 -1
- package/lib/context/AutoBeTokenUsage.js +56 -1
- package/lib/context/AutoBeTokenUsage.js.map +1 -1
- package/lib/factory/createAutoBeApplication.js +288 -653
- package/lib/factory/createAutoBeApplication.js.map +1 -1
- package/lib/index.mjs +4225 -6681
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js +80 -321
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js.map +1 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js +0 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +93 -266
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js +2 -2
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
- package/lib/orchestrate/index.d.ts +2 -2
- package/lib/orchestrate/index.js +4 -4
- package/lib/orchestrate/index.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +54 -142
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +189 -201
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +71 -174
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +706 -1099
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/transformInterfaceHistories.js +2 -0
- package/lib/orchestrate/interface/transformInterfaceHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +60 -177
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +502 -1073
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js +519 -1125
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +9 -0
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +8 -0
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.d.ts +11 -0
- package/lib/orchestrate/realize/orchestrateRealize.js +78 -0
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeCoder.d.ts +25 -0
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js +326 -0
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizePlanner.d.ts +80 -0
- package/lib/orchestrate/realize/orchestrateRealizePlanner.js +53 -0
- package/lib/orchestrate/realize/orchestrateRealizePlanner.js.map +1 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +39 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.js +3 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.js.map +1 -0
- package/lib/orchestrate/realize/transformRealizeCoderHistories.d.ts +5 -0
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js +127 -0
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js.map +1 -0
- package/lib/orchestrate/test/compile/completeTestCode.d.ts +2 -0
- package/lib/orchestrate/test/compile/completeTestCode.js +21 -0
- package/lib/orchestrate/test/compile/completeTestCode.js.map +1 -0
- package/lib/orchestrate/test/{filterTestFileName.js → compile/filterTestFileName.js} +1 -1
- package/lib/orchestrate/test/compile/filterTestFileName.js.map +1 -0
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.d.ts +3 -0
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.js +27 -0
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -0
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +5 -0
- package/lib/orchestrate/test/{compileTestScenario.js → compile/getTestScenarioArtifacts.js} +10 -5
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -0
- package/lib/orchestrate/test/orchestrateTest.js +14 -9
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +3 -2
- package/lib/orchestrate/test/orchestrateTestCorrect.js +142 -448
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +258 -532
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.d.ts +3 -2
- package/lib/orchestrate/test/orchestrateTestWrite.js +124 -90
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +121 -0
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.js +3 -0
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.js.map +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestFunction.d.ts +8 -0
- package/lib/{utils/types/BackoffOptions.js → orchestrate/test/structures/IAutoBeTestFunction.js} +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestFunction.js.map +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +14 -2
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +112 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.js +3 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.js.map +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteResult.d.ts +7 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteResult.js +3 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteResult.js.map +1 -0
- package/lib/orchestrate/test/transformTestCorrectHistories.d.ts +3 -2
- package/lib/orchestrate/test/transformTestCorrectHistories.js +28 -67
- package/lib/orchestrate/test/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/transformTestWriteHistories.d.ts +5 -4
- package/lib/orchestrate/test/transformTestWriteHistories.js +161 -43
- package/lib/orchestrate/test/transformTestWriteHistories.js.map +1 -1
- package/lib/structures/IAutoBeConfig.d.ts +11 -0
- package/lib/utils/backoffRetry.d.ts +4 -7
- package/lib/utils/backoffRetry.js +19 -37
- package/lib/utils/backoffRetry.js.map +1 -1
- package/lib/utils/forceRetry.d.ts +1 -0
- package/lib/{orchestrate/orchestrateRealize.js → utils/forceRetry.js} +15 -8
- package/lib/utils/forceRetry.js.map +1 -0
- package/package.json +9 -12
- package/src/AutoBeAgent.ts +17 -3
- package/src/constants/AutoBeSystemPromptConstant.ts +7 -6
- package/src/context/AutoBeTokenUsage.ts +85 -1
- package/src/factory/createAutoBeApplication.ts +2 -3
- package/src/orchestrate/analyze/AutoBeAnalyzeAgent.ts +8 -3
- package/src/orchestrate/analyze/AutoBeAnalyzeReviewer.ts +0 -1
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +6 -5
- package/src/orchestrate/facade/transformFacadeStateMessage.ts +2 -1
- package/src/orchestrate/index.ts +2 -2
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +4 -3
- package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +26 -23
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +6 -4
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +14 -11
- package/src/orchestrate/interface/transformInterfaceHistories.ts +2 -0
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +10 -5
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +11 -5
- package/src/orchestrate/prisma/orchestratePrismaSchema.ts +16 -8
- package/src/orchestrate/prisma/transformPrismaComponentsHistories.ts +9 -0
- package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +8 -0
- package/src/orchestrate/realize/orchestrateRealize.ts +129 -0
- package/src/orchestrate/realize/orchestrateRealizeCoder.ts +148 -0
- package/src/orchestrate/realize/orchestrateRealizePlanner.ts +115 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +46 -0
- package/src/orchestrate/realize/transformRealizeCoderHistories.ts +136 -0
- package/src/orchestrate/test/compile/completeTestCode.ts +35 -0
- package/src/orchestrate/test/{filterTestFileName.ts → compile/filterTestFileName.ts} +1 -1
- package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +24 -0
- package/src/orchestrate/test/{compileTestScenario.ts → compile/getTestScenarioArtifacts.ts} +16 -8
- package/src/orchestrate/test/experimental/orchestrateTestCorrect.ast +240 -0
- package/src/orchestrate/test/experimental/orchestrateTestWrite.ast +316 -0
- package/src/orchestrate/test/experimental/transformTestCorrectHistories.ast +52 -0
- package/src/orchestrate/test/orchestrateTest.ts +33 -16
- package/src/orchestrate/test/orchestrateTestCorrect.ts +109 -497
- package/src/orchestrate/test/orchestrateTestScenario.ts +102 -71
- package/src/orchestrate/test/orchestrateTestWrite.ts +55 -181
- package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +126 -0
- package/src/orchestrate/test/structures/IAutoBeTestFunction.ts +10 -0
- package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +14 -2
- package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +117 -0
- package/src/orchestrate/test/structures/IAutoBeTestWriteResult.ts +9 -0
- package/src/orchestrate/test/transformTestCorrectHistories.ts +38 -71
- package/src/orchestrate/test/transformTestWriteHistories.ts +88 -46
- package/src/structures/IAutoBeConfig.ts +9 -0
- package/src/utils/backoffRetry.ts +25 -36
- package/src/utils/forceRetry.ts +13 -0
- package/lib/factory/invertOpenApiDocument.d.ts +0 -3
- package/lib/factory/invertOpenApiDocument.js +0 -51
- package/lib/factory/invertOpenApiDocument.js.map +0 -1
- package/lib/orchestrate/orchestrateRealize.d.ts +0 -5
- package/lib/orchestrate/orchestrateRealize.js.map +0 -1
- package/lib/orchestrate/test/compileTestScenario.d.ts +0 -5
- package/lib/orchestrate/test/compileTestScenario.js.map +0 -1
- package/lib/orchestrate/test/filterTestFileName.js.map +0 -1
- package/lib/utils/StringUtil.d.ts +0 -4
- package/lib/utils/StringUtil.js +0 -43
- package/lib/utils/StringUtil.js.map +0 -1
- package/lib/utils/types/BackoffOptions.d.ts +0 -12
- package/lib/utils/types/BackoffOptions.js.map +0 -1
- package/src/factory/invertOpenApiDocument.ts +0 -63
- package/src/orchestrate/orchestrateRealize.ts +0 -18
- package/src/utils/StringUtil.ts +0 -45
- package/src/utils/types/BackoffOptions.ts +0 -15
- /package/lib/orchestrate/test/{filterTestFileName.d.ts → compile/filterTestFileName.d.ts} +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.orchestrateRealizePlanner = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* Generates a planning result that defines what kind of function should be
|
|
15
|
+
* created, based solely on the provided Swagger (OpenAPI) operation — without
|
|
16
|
+
* using an LLM.
|
|
17
|
+
*
|
|
18
|
+
* This function analyzes the structure of the OpenAPI operation (such as the
|
|
19
|
+
* path, method, parameters, request/response schema, and descriptions) to
|
|
20
|
+
* determine the appropriate function name, input/output types, and purpose of
|
|
21
|
+
* the function.
|
|
22
|
+
*
|
|
23
|
+
* The result of this function (`RealizePlannerOutput`) will be passed to the
|
|
24
|
+
* next step in the AutoBE pipeline, which is responsible for generating the
|
|
25
|
+
* actual implementation code.
|
|
26
|
+
*
|
|
27
|
+
* @param ctx - AutoBE context including model and configuration
|
|
28
|
+
* @param operation - A single OpenAPI operation object to analyze and plan
|
|
29
|
+
* @returns A planning object containing all structural information needed to
|
|
30
|
+
* generate the function
|
|
31
|
+
*/
|
|
32
|
+
const orchestrateRealizePlanner = (ctx, operation) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
const testScenarios = (_b = (_a = ctx
|
|
35
|
+
.state()
|
|
36
|
+
.test) === null || _a === void 0 ? void 0 : _a.files.filter((el) => el.scenario.endpoint.method === operation.method &&
|
|
37
|
+
el.scenario.endpoint.path === operation.path)) !== null && _b !== void 0 ? _b : [];
|
|
38
|
+
return {
|
|
39
|
+
description: operation.description,
|
|
40
|
+
parameters: operation.parameters,
|
|
41
|
+
inputSchema: operation.requestBody,
|
|
42
|
+
outputSchema: operation.responseBody,
|
|
43
|
+
operationType: operation.method,
|
|
44
|
+
testScenarios: testScenarios.map((el) => el.scenario.draft),
|
|
45
|
+
functionName: `${operation.method}_${operation.path
|
|
46
|
+
.replaceAll("/", "_")
|
|
47
|
+
.replaceAll("-", "_")
|
|
48
|
+
.replaceAll("{", "$")
|
|
49
|
+
.replaceAll("}", "")}`,
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
exports.orchestrateRealizePlanner = orchestrateRealizePlanner;
|
|
53
|
+
//# sourceMappingURL=orchestrateRealizePlanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrateRealizePlanner.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/orchestrateRealizePlanner.ts"],"names":[],"mappings":";;;;;;;;;;;;AAqEA;;;;;;;;;;;;;;;;;;GAkBG;AACI,MAAM,yBAAyB,GAAG,CACvC,GAAyB,EACzB,SAAmC,EACJ,EAAE;;IACjC,MAAM,aAAa,GACjB,MAAA,MAAA,GAAG;SACA,KAAK,EAAE;SACP,IAAI,0CAAE,KAAK,CAAC,MAAM,CACjB,CAAC,EAAE,EAAE,EAAE,CACL,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM;QAChD,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,CAC/C,mCAAI,EAAE,CAAC;IAEZ,OAAO;QACL,WAAW,EAAE,SAAS,CAAC,WAAW;QAClC,UAAU,EAAE,SAAS,CAAC,UAAU;QAChC,WAAW,EAAE,SAAS,CAAC,WAAW;QAClC,YAAY,EAAE,SAAS,CAAC,YAAY;QACpC,aAAa,EAAE,SAAS,CAAC,MAAM;QAC/B,aAAa,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC3D,YAAY,EAAE,GAAG,SAAS,CAAC,MAAM,IAAI,SAAS,CAAC,IAAI;aAChD,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;aACpB,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;aACpB,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;aACpB,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE;KACM,CAAC;AACnC,CAAC,CAAA,CAAC;AA1BW,QAAA,yBAAyB,6BA0BpC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AutoBeOpenApi } from "@autobe/interface";
|
|
2
|
+
import { FAILED } from "../orchestrateRealize";
|
|
3
|
+
export interface IAutoBeRealizeCoderApplication {
|
|
4
|
+
programing: (next: IAutoBeRealizeCoderApplication.IProps) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare namespace IAutoBeRealizeCoderApplication {
|
|
7
|
+
interface IProps {
|
|
8
|
+
result: RealizeCoderOutput;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The result of the code generation step, representing a fully generated
|
|
12
|
+
* TypeScript function.
|
|
13
|
+
*/
|
|
14
|
+
interface RealizeCoderOutput {
|
|
15
|
+
/**
|
|
16
|
+
* The name of the function to be generated.
|
|
17
|
+
*
|
|
18
|
+
* This name will be used as the function's identifier and as the export
|
|
19
|
+
* name in the provider file.
|
|
20
|
+
*/
|
|
21
|
+
functionName: string;
|
|
22
|
+
/**
|
|
23
|
+
* The raw TypeScript code string implementing the function.
|
|
24
|
+
*
|
|
25
|
+
* - The implementation must be valid TypeScript code.
|
|
26
|
+
* - It should focus solely on the logic of the function.
|
|
27
|
+
* - Import statements do **not** need to be included. They will be
|
|
28
|
+
* automatically inserted by the system.
|
|
29
|
+
* - Any unused imports will be automatically removed by eslint.
|
|
30
|
+
* - Type annotations (e.g. for parameters and return types) should be omitted
|
|
31
|
+
* if they can be inferred.
|
|
32
|
+
*/
|
|
33
|
+
implementationCode: string;
|
|
34
|
+
}
|
|
35
|
+
interface IPipeOutput {
|
|
36
|
+
result: RealizeCoderOutput | FAILED;
|
|
37
|
+
operation: AutoBeOpenApi.IOperation;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAutoBeRealizeCoderApplication.js","sourceRoot":"","sources":["../../../../src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
+
import { AutoBeState } from "../../context/AutoBeState";
|
|
3
|
+
import { IAutoBeTestScenarioArtifacts } from "../test/structures/IAutoBeTestScenarioArtifacts";
|
|
4
|
+
import { RealizePlannerOutput } from "./orchestrateRealizePlanner";
|
|
5
|
+
export declare const transformRealizeCoderHistories: (state: AutoBeState, props: RealizePlannerOutput, artifacts: IAutoBeTestScenarioArtifacts) => Array<IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage>;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformRealizeCoderHistories = void 0;
|
|
4
|
+
const uuid_1 = require("uuid");
|
|
5
|
+
const transformRealizeCoderHistories = (state, props, artifacts) => {
|
|
6
|
+
if (state.analyze === null)
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
id: (0, uuid_1.v4)(),
|
|
10
|
+
created_at: new Date().toISOString(),
|
|
11
|
+
type: "systemMessage",
|
|
12
|
+
text: [
|
|
13
|
+
"Requirement analysis is not yet completed.",
|
|
14
|
+
"Don't call the any tool function,",
|
|
15
|
+
"but say to process the requirement analysis.",
|
|
16
|
+
].join(" "),
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
else if (state.prisma === null)
|
|
20
|
+
return [
|
|
21
|
+
{
|
|
22
|
+
id: (0, uuid_1.v4)(),
|
|
23
|
+
created_at: new Date().toISOString(),
|
|
24
|
+
type: "systemMessage",
|
|
25
|
+
text: [
|
|
26
|
+
"Prisma DB schema generation is not yet completed.",
|
|
27
|
+
"Don't call the any tool function,",
|
|
28
|
+
"but say to process the Prisma DB schema generation.",
|
|
29
|
+
].join(" "),
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
else if (state.analyze.step !== state.prisma.step)
|
|
33
|
+
return [
|
|
34
|
+
{
|
|
35
|
+
id: (0, uuid_1.v4)(),
|
|
36
|
+
created_at: new Date().toISOString(),
|
|
37
|
+
type: "systemMessage",
|
|
38
|
+
text: [
|
|
39
|
+
"Prisma DB schema generation has not been updated",
|
|
40
|
+
"for the latest requirement analysis.",
|
|
41
|
+
"Don't call the any tool function,",
|
|
42
|
+
"but say to re-process the Prisma DB schema generation.",
|
|
43
|
+
].join(" "),
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
else if (state.prisma.compiled.type !== "success")
|
|
47
|
+
return [
|
|
48
|
+
{
|
|
49
|
+
id: (0, uuid_1.v4)(),
|
|
50
|
+
created_at: new Date().toISOString(),
|
|
51
|
+
type: "systemMessage",
|
|
52
|
+
text: [
|
|
53
|
+
"Prisma DB schema generation has not been updated",
|
|
54
|
+
"for the latest requirement analysis.",
|
|
55
|
+
"Don't call the any tool function,",
|
|
56
|
+
"but say to re-process the Prisma DB schema generation.",
|
|
57
|
+
].join(" "),
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
else if (state.interface === null)
|
|
61
|
+
return [
|
|
62
|
+
{
|
|
63
|
+
id: (0, uuid_1.v4)(),
|
|
64
|
+
created_at: new Date().toISOString(),
|
|
65
|
+
type: "systemMessage",
|
|
66
|
+
text: [
|
|
67
|
+
"Interface generation is not yet completed.",
|
|
68
|
+
"Don't call the any tool function,",
|
|
69
|
+
"but say to process the interface generation.",
|
|
70
|
+
].join(" "),
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
return [
|
|
74
|
+
{
|
|
75
|
+
id: (0, uuid_1.v4)(),
|
|
76
|
+
created_at: new Date().toISOString(),
|
|
77
|
+
type: "systemMessage",
|
|
78
|
+
text: [
|
|
79
|
+
"# \uD83E\uDDE0 Realize Agent Role\n\nYou are the **Realize Coder Agent**. \nYour role is to write appropriate code based on the given inputs. \nAll code must be written as **provider logic**, and structured as a **single function**, not wrapped in a class or namespace.\n\n---\n\n## \uD83D\uDCCC Function Structure\n\nThe function must always take the following three arguments:\n\n```ts\nexport async function something(\n headers: Record<string, string>,\n parameters: Record<string, string>, // If you know exactly what DTO type is, make sure to import it and fill it out.\n body: Record<string, any> // If you know exactly what DTO type is, make sure to import it and fill it out.\n) {\n ...\n}\n````\n\n* Even for GET requests or when headers, parameters, or body are not required, the structure must remain the same.\n* In such cases, use the following empty types:\n `_headers: Record<string, never>`, `_parameters: Record<string, never>`, `_body: Record<string, never>`\n\n---\n\n## \u2757 Strictly Prohibited\n\n1. Use of the `any` type\n2. Assuming that certain fields exist, such as:\n\n * `headers['x-user-id']`, `body.user.id`, `parameters.id`, etc.\n3. Writing logic based on assumptions or inferences when required context (e.g., user/auth info) is missing\n\n\u2192 In such cases, do **not write any code**. Instead, leave the function body empty and write **clear and sufficient comments** explaining why.\n\n---\n\n### \uD83D\uDEAB Parameter Validation Not Required\n\n* The provider function does **not** need to perform any validation on incoming `headers`, `parameters`, or `body` values.\n* You can assume that **all DTO-defined values are present and valid**.\n* **Validation is not the provider's responsibility** \u2014 it is handled upstream (e.g., by the controller or framework-level validation logic).\n* Therefore, do **not** write any manual checks for missing or invalid fields in `headers`, `parameters`, or `body`.\n\n\u2705 Example\n\n```ts\n// \u274C Do not write this\nif (!parameters.id) throw new Error(\"Missing parameter: id\");\n\n// \u2705 Just use it directly\nconst { id } = parameters;\n```\n\n---\n\n## \uD83D\uDD10 When Authentication is Required\n\n* If authentication is required, extract the **Bearer token** from `headers.authorization` or `headers.Authorization`.\n\n* Decode the token and retrieve the following fields:\n\n * `id`: the user's unique ID\n * `type`: the user group (actor)\n\n* The `type` must exactly match the table name of the actor in the database.\n For example: `\"customer\"`, `\"seller\"`, `\"admin\"`\n\n* The **actor** represents the user's role group, and each actor must correspond to an actual table name in the database.\n\n---\n\n## \u2705 Type Assertion Rules\n\n* You are allowed to use `as` for type assertions in clearly safe cases, such as decoding a token:\n\n```ts\nconst decoded = jwtDecode(token) as { id: string; type: 'customer' | 'seller' | 'admin' };\n```\n\n* You may also use `as` for:\n\n * Literal values (e.g., `1 as 1`, `-1 as -1`)\n * Enumerated string or number values\n\n* For object literals, **prefer using `satisfies`** instead of `as`:\n\n```ts\nconst result = {\n status: 'ok',\n count: 5,\n} satisfies { status: string; count: number };\n```\n\n## \u270D\uFE0F Example (when code should not be written)\n\n```ts\n// \u274C No code written\n// \uD83D\uDD12 Reason: Authentication info is missing; user ID or type cannot be confirmed.\n// \uD83D\uDCDD Required: Extract the Bearer token from headers.authorization or Authorization.\n// Decode the token to retrieve the user's `id` and `type`.\n// `type` must exactly match one of the actor table names (e.g., customer, seller, admin).\n```\n\n---\n\n## \uD83D\uDCCC Function Structure\n\nThe function **must always** take exactly three arguments: `headers`, `parameters`, and `body`.\nThe structure is as follows:\n\n```ts\nexport async function something(\n headers: Record<string, string>,\n parameters: Record<string, string>,\n body: SomeDto\n) {\n ...\n}\n```\n\n* Even if the request is a GET request or doesn't require any headers, parameters, or body, the function signature **must remain the same**.\n* In such cases, use empty objects:\n\n * `headers: Record<string, never>`\n * `parameters: Record<string, never>`\n * `body: Record<string, never>`\n\n---\n\n## \uD83D\uDD27 Fallback Logic for Incomplete Context\n\nIf it is **not possible to implement the actual logic** (e.g., required tables, fields, or external SDKs are clearly missing), follow this fallback guideline:\n\n```ts\n/**\n * \u26A0\uFE0F Placeholder Implementation\n *\n * The actual logic could not be implemented because:\n * - [List missing schema, tables, fields, or SDK elements]\n * - This information is required to properly implement the provider logic.\n * \n * Therefore, this function currently returns a random object matching the expected return type using `typia.random<T>()`.\n * \n * Please revisit this function after the missing elements are available.\n */\nreturn typia.random<ReturnType>();\n```\n\n* This fallback must **only be used if a real implementation is genuinely impossible**.\n* You **must still write the correct function signature**, define types, and use the proper structure.\n* Ensure the `ReturnType` exactly matches the controller's expected return type.\n* Do **not leave the function body empty**, even for placeholders \u2014 always return a valid structure using `typia.random`.\n\n---\n\n## \uD83E\uDDE0 Purpose\n\nThe purpose of the function is to:\n\n* Receive **inputs as-is from the controller**\n* Return **outputs matching the controller's return type**\n* Supplement **logic to satisfy the user\u2019s requirements**\n\n---\n\n## \uD83E\uDDFE Parameter & Body Types\n\n* You must **explicitly define types** for both `parameters` and `body`.\n\n* The types must match those used in the **SDK or controller DTOs**.\n\n > \"Match\" means either:\n >\n > 1. The type has the **same shape** as the SDK/DTO (TypeScript duck typing).\n > 2. The **exact same type is imported and used**.\n\n* You **must not use `any` or implicit typing**.\n\n---\n\n## \uD83D\uDD10 When Authentication is Required\n\n* If authentication is required, extract the **Bearer token** from `headers.authorization` or `headers.Authorization`.\n\n* Decode the token using the globally available function:\n\n ```ts\n const decoded = jwtDecode(token) as { id: string; type: 'customer' | 'seller' | 'admin' };\n ```\n\n* The decoded token must include:\n\n * `id`: the user's unique ID\n * `type`: the user group, which **must exactly match a table name** in your Prisma schema (e.g., `\"customer\"`, `\"seller\"`, `\"admin\"`)\n\n* The `type` is used to identify the **actor**, and should be treated as the name of the actor's table.\n\n* Do **not assume** these values exist. You must **decode and validate** them properly before use.\n\n---\n\n## \uD83D\uDEE0 SDK & DB Access\n\nTo access the database using Prisma, use the global instance provided:\n\n```ts\nMyGlobal.prisma.users.findMany()\n```\n\n* You **must always include the `.prisma` property** explicitly.\n\n* \u2757 **Do NOT write `MyGlobal.users` or omit `.prisma`** \u2014 this will break tests and violate the global access convention.\n\n\u2705 Allowed:\n\n```ts\nMyGlobal.prisma.logs.create({ data: { ... } });\n```\n\n\u274C Not allowed:\n\n```ts\nMyGlobal.logs.create({ data: { ... } }); // \u274C Incorrect\nMyGlobal.currentUsers(); // \u274C Incorrect\n```\n\n---\n\n### \uD83D\uDD0D Additional Prisma Rule: Writing `where` Conditions\n\n* When writing Prisma `where` clauses, do **not use `any`** under any circumstances.\n\n* Prefer **direct inline construction** of the `where` condition **inside** the Prisma method call:\n\n ```ts\n const user = await MyGlobal.prisma.users.findFirst({\n where: {\n id: actor.id,\n },\n });\n ```\n\n* If the `where` condition is built outside the method (e.g., stored in a variable), use `satisfies` with a proper Prisma type:\n\n ```ts\n const condition = {\n id: actor.id,\n isActive: true,\n } satisfies Prisma.UsersWhereInput;\n\n const user = await MyGlobal.prisma.users.findFirst({ where: condition });\n ```\n\n* You **must not use `as any`** to bypass type checks for `where` clauses. Using `satisfies` ensures the safety of your Prisma query.\n\n---\n\n## \u2757 Error Handling Rules\n\n* You **must always use** `new Error()` when throwing errors.\n* Do **not** throw:\n\n * custom error classes\n * `HttpException`\n * plain strings\n\n\u2705 Allowed:\n\n```ts\nthrow new Error(\"User not found\");\n```\n\n\u274C Not allowed:\n\n```ts\nthrow \"User not found\";\nthrow new NotFoundException();\n```\n\n---\n\n## \uD83D\uDEAB Import Rules\n\n* **Do not use any `import` statements**, unless the import is for **SDK types or DTOs**.\n\n \u2705 Allowed:\n\n ```ts\n import { IVote } from \"../api/structures/IVote\";\n ```\n\n \u274C Not allowed:\n\n ```ts\n import _ from 'lodash';\n import { format } from 'date-fns';\n import { IVote } from \"@/api/structures/IVote\";\n ```\n\n* All logic, constants, and utilities must be **self-contained within the function** unless clearly provided via the SDK/DTO layer.\n\n### \uD83D\uDEAB Default Import Rules\n\nPlease skip the import statement below because it is automatically entered. Adding it will cause a \"Duplicated\" error. This import statement is automatically inserted, so it should not be added manually.\n\n```ts\nimport { MyGlobal } from \"../MyGlobal\";,\nimport typia, { tags } from \"typia\";,\nimport { Prisma } from \"@prisma/client\";,\nimport { jwtDecode } from \"./jwtDecode\",\n\n```" /* AutoBeSystemPromptConstant.REALIZE_CODER */,
|
|
80
|
+
"",
|
|
81
|
+
"# Prisma Schemas",
|
|
82
|
+
"```json",
|
|
83
|
+
JSON.stringify(state.prisma.schemas),
|
|
84
|
+
"```",
|
|
85
|
+
"",
|
|
86
|
+
// "# Prisma Types",
|
|
87
|
+
// "```json",
|
|
88
|
+
// JSON.stringify(state.prisma.compiled.nodeModules),
|
|
89
|
+
// "```",
|
|
90
|
+
"# SDK",
|
|
91
|
+
"",
|
|
92
|
+
"The following is the SDK for the API. Based on the information provided by this SDK, you must write code that maps the SDK-provided parameters directly into the `parameters` and `body` properties of the provider function response.",
|
|
93
|
+
"If there are no parameters, define `parameters` as `Record<string, never>`. Similarly, if there is no body, define `body` as `Record<string, never>`.",
|
|
94
|
+
"**Every function must be implemented to accept both `parameters` and `body`, without exception.**",
|
|
95
|
+
"If any required type information is referenced in the SDK, refer to the definitions in the DTO section.",
|
|
96
|
+
"",
|
|
97
|
+
"```json",
|
|
98
|
+
JSON.stringify(artifacts.sdk),
|
|
99
|
+
"```",
|
|
100
|
+
"",
|
|
101
|
+
"# DTO",
|
|
102
|
+
"if you want to import this files, write this: 'import { something } from '../api/structures/something';'",
|
|
103
|
+
"",
|
|
104
|
+
"```json",
|
|
105
|
+
JSON.stringify(artifacts.dto),
|
|
106
|
+
"```",
|
|
107
|
+
"# Document",
|
|
108
|
+
"```json",
|
|
109
|
+
JSON.stringify(artifacts.document),
|
|
110
|
+
"```",
|
|
111
|
+
].join("\n"),
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: (0, uuid_1.v4)(),
|
|
115
|
+
created_at: new Date().toISOString(),
|
|
116
|
+
type: "systemMessage",
|
|
117
|
+
text: [
|
|
118
|
+
"write code by following information of operation.",
|
|
119
|
+
"```json",
|
|
120
|
+
JSON.stringify(props),
|
|
121
|
+
"```",
|
|
122
|
+
].join("\n"),
|
|
123
|
+
},
|
|
124
|
+
];
|
|
125
|
+
};
|
|
126
|
+
exports.transformRealizeCoderHistories = transformRealizeCoderHistories;
|
|
127
|
+
//# sourceMappingURL=transformRealizeCoderHistories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformRealizeCoderHistories.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/transformRealizeCoderHistories.ts"],"names":[],"mappings":";;;AACA,+BAA0B;AAOnB,MAAM,8BAA8B,GAAG,CAC5C,KAAkB,EAClB,KAA2B,EAC3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W,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE;gBACJ,mDAAmD;gBACnD,SAAS;gBACT,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;gBACrB,KAAK;aACN,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF,CAAC;AACJ,CAAC,CAAC;AA/HW,QAAA,8BAA8B,kCA+HzC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.completeTestCode = completeTestCode;
|
|
4
|
+
function completeTestCode(artifacts, code) {
|
|
5
|
+
const typeReferences = Array.from(new Set(Object.keys(artifacts.document.components.schemas).map((key) => key.split(".")[0])));
|
|
6
|
+
code = code.replace(/^[ \t]*import\b[\s\S]*?;[ \t]*$/gm, "").trim();
|
|
7
|
+
code = code.replace(/^[ \t]*import\b[\s\S]*?;[ \t]*$/gm, "").trim();
|
|
8
|
+
code = code.replaceAll('string & Format<"uuid">', 'string & tags.Format<"uuid">');
|
|
9
|
+
code = [
|
|
10
|
+
`import { ArrayUtil, RandomGenerator, TestValidator } from "@nestia/e2e";`,
|
|
11
|
+
`import { IConnection } from "@nestia/fetcher";`,
|
|
12
|
+
`import typia, { tags } from "typia";`,
|
|
13
|
+
"",
|
|
14
|
+
`import api from "@ORGANIZATION/PROJECT-api";`,
|
|
15
|
+
...typeReferences.map((ref) => `import type { ${ref} } from "@ORGANIZATION/PROJECT-api/lib/structures/${ref}";`),
|
|
16
|
+
"",
|
|
17
|
+
code,
|
|
18
|
+
].join("\n");
|
|
19
|
+
return code;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=completeTestCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completeTestCode.js","sourceRoot":"","sources":["../../../../src/orchestrate/test/compile/completeTestCode.ts"],"names":[],"mappings":";;AAEA,4CAgCC;AAhCD,SAAgB,gBAAgB,CAC9B,SAAuC,EACvC,IAAY;IAEZ,MAAM,cAAc,GAAa,KAAK,CAAC,IAAI,CACzC,IAAI,GAAG,CACL,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,CACpD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAC5B,CACF,CACF,CAAC;IAEF,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,mCAAmC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACpE,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,mCAAmC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACpE,IAAI,GAAG,IAAI,CAAC,UAAU,CACpB,yBAAyB,EACzB,8BAA8B,CAC/B,CAAC;IACF,IAAI,GAAG;QACL,0EAA0E;QAC1E,gDAAgD;QAChD,sCAAsC;QACtC,EAAE;QACF,8CAA8C;QAC9C,GAAG,cAAc,CAAC,GAAG,CACnB,CAAC,GAAG,EAAE,EAAE,CACN,iBAAiB,GAAG,qDAAqD,GAAG,IAAI,CACnF;QACD,EAAE;QACF,IAAI;KACL,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACb,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -7,7 +7,7 @@ function filterTestFileName(key) {
|
|
|
7
7
|
else if (key.startsWith("src/") === true)
|
|
8
8
|
return true;
|
|
9
9
|
return (key.startsWith("test/") === true &&
|
|
10
|
-
key.startsWith("test/features/") ===
|
|
10
|
+
key.startsWith("test/features/") === true &&
|
|
11
11
|
key.startsWith("test/benchmark/") === false);
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=filterTestFileName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterTestFileName.js","sourceRoot":"","sources":["../../../../src/orchestrate/test/compile/filterTestFileName.ts"],"names":[],"mappings":";;AAAA,gDAQC;AARD,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;SAC3C,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACtD,OAAO,CACL,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,IAAI;QAChC,GAAG,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI;QACzC,GAAG,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,KAAK,CAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getTestExternalDeclarations = getTestExternalDeclarations;
|
|
13
|
+
const tstl_1 = require("tstl");
|
|
14
|
+
function getTestExternalDeclarations(ctx) {
|
|
15
|
+
return singleton.get(ctx.compiler.test);
|
|
16
|
+
}
|
|
17
|
+
const singleton = new tstl_1.Singleton((compiler) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
const records = yield compiler.getExternal();
|
|
19
|
+
const external = (location) => {
|
|
20
|
+
const content = records[location];
|
|
21
|
+
if (content === undefined)
|
|
22
|
+
throw new Error(`File not found: ${location}`);
|
|
23
|
+
return { [location]: content };
|
|
24
|
+
};
|
|
25
|
+
return Object.assign(Object.assign({}, external("node_modules/@nestia/e2e/lib/TestValidator.d.ts")), external("node_modules/@nestia/fetcher/lib/IConnection.d.ts"));
|
|
26
|
+
}));
|
|
27
|
+
//# sourceMappingURL=getTestExternalDeclarations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTestExternalDeclarations.js","sourceRoot":"","sources":["../../../../src/orchestrate/test/compile/getTestExternalDeclarations.ts"],"names":[],"mappings":";;;;;;;;;;;AAMA,kEAIC;AARD,+BAAiC;AAIjC,SAAgB,2BAA2B,CACzC,GAAyB;IAEzB,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,SAAS,GAAG,IAAI,gBAAS,CAAC,CAAO,QAA6B,EAAE,EAAE;IACtE,MAAM,OAAO,GAA2B,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC;IACrE,MAAM,QAAQ,GAAG,CAAC,QAAgB,EAA0B,EAAE;QAC5D,MAAM,OAAO,GAAuB,OAAO,CAAC,QAAQ,CAAC,CAAC;QACtD,IAAI,OAAO,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC;QAC1E,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACjC,CAAC,CAAC;IACF,OAAO,gCACF,QAAQ,CAAC,iDAAiD,CAAC,GAC3D,QAAQ,CAAC,mDAAmD,CAAC,CAChC,CAAC;AACrC,CAAC,CAAA,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AutoBeTestScenario } from "@autobe/interface";
|
|
2
|
+
import { ILlmSchema } from "@samchon/openapi";
|
|
3
|
+
import { AutoBeContext } from "../../../context/AutoBeContext";
|
|
4
|
+
import { IAutoBeTestScenarioArtifacts } from "../structures/IAutoBeTestScenarioArtifacts";
|
|
5
|
+
export declare function getTestScenarioArtifacts<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, scenario: Pick<AutoBeTestScenario, "endpoint" | "dependencies">): Promise<IAutoBeTestScenarioArtifacts>;
|
|
@@ -9,16 +9,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.getTestScenarioArtifacts = getTestScenarioArtifacts;
|
|
13
13
|
const openapi_1 = require("@samchon/openapi");
|
|
14
|
-
function
|
|
14
|
+
function getTestScenarioArtifacts(ctx, scenario) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
16
|
const document = filterDocument(scenario, ctx.state().interface.document);
|
|
17
17
|
const entries = Object.entries(yield ctx.compiler.interface.compile(document));
|
|
18
|
-
const filter = (prefix
|
|
18
|
+
const filter = (prefix, exclude) => {
|
|
19
|
+
const result = entries.filter(([key]) => key.startsWith(prefix) === true);
|
|
20
|
+
return Object.fromEntries(exclude
|
|
21
|
+
? result.filter(([key]) => key.startsWith(exclude) === false)
|
|
22
|
+
: result);
|
|
23
|
+
};
|
|
19
24
|
return {
|
|
20
25
|
document,
|
|
21
|
-
sdk: filter("src/api/
|
|
26
|
+
sdk: filter("src/api", "src/api/structures"),
|
|
22
27
|
dto: filter("src/api/structures"),
|
|
23
28
|
e2e: filter("test/features"),
|
|
24
29
|
};
|
|
@@ -54,4 +59,4 @@ function filterDocument(scenario, document) {
|
|
|
54
59
|
components,
|
|
55
60
|
};
|
|
56
61
|
}
|
|
57
|
-
//# sourceMappingURL=
|
|
62
|
+
//# sourceMappingURL=getTestScenarioArtifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTestScenarioArtifacts.js","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const orchestrateTest = (ctx) => (props) => __awaiter(void 0, void 0, void 0, fu
|
|
|
38
38
|
return history;
|
|
39
39
|
}
|
|
40
40
|
// PLAN
|
|
41
|
-
const
|
|
41
|
+
const scenarioEvent = yield (0, orchestrateTestScenario_1.orchestrateTestScenario)(ctx);
|
|
42
|
+
ctx.dispatch(scenarioEvent);
|
|
42
43
|
// TEST CODE
|
|
43
|
-
const
|
|
44
|
-
const
|
|
44
|
+
const written = yield (0, orchestrateTestWrite_1.orchestrateTestWrite)(ctx, scenarioEvent.scenarios);
|
|
45
|
+
const corrects = yield (0, orchestrateTestCorrect_1.orchestrateTestCorrect)(ctx, written);
|
|
46
|
+
const success = corrects.filter((c) => c.result.type === "success");
|
|
47
|
+
// DO COMPILE
|
|
48
|
+
const files = success.map((c) => c.file);
|
|
49
|
+
const compiled = yield ctx.compiler.test.compile({
|
|
50
|
+
files: Object.assign(Object.assign({}, Object.fromEntries(Object.entries(ctx.state().interface.files).filter(([key]) => key.startsWith("src/api") === true))), Object.fromEntries(files.map((f) => [f.location, f.content]))),
|
|
51
|
+
});
|
|
45
52
|
const history = {
|
|
46
53
|
type: "test",
|
|
47
54
|
id: (0, uuid_1.v4)(),
|
|
48
55
|
completed_at: new Date().toISOString(),
|
|
49
56
|
created_at: start.toISOString(),
|
|
50
|
-
files
|
|
51
|
-
compiled
|
|
57
|
+
files,
|
|
58
|
+
compiled,
|
|
52
59
|
reason: "Step to the test generation referencing the interface",
|
|
53
60
|
step: (_f = (_e = ctx.state().interface) === null || _e === void 0 ? void 0 : _e.step) !== null && _f !== void 0 ? _f : 0,
|
|
54
61
|
};
|
|
55
62
|
ctx.dispatch({
|
|
56
63
|
type: "testComplete",
|
|
57
64
|
created_at: start.toISOString(),
|
|
58
|
-
files:
|
|
59
|
-
|
|
60
|
-
.reduce((acc, cur) => Object.assign(acc, cur), {}),
|
|
61
|
-
compiled: correct.result,
|
|
65
|
+
files: Object.fromEntries(files.map((f) => [f.location, f.content])),
|
|
66
|
+
compiled,
|
|
62
67
|
step: (_h = (_g = ctx.state().interface) === null || _g === void 0 ? void 0 : _g.step) !== null && _h !== void 0 ? _h : 0,
|
|
63
68
|
});
|
|
64
69
|
ctx.state().test = history;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrateTest.js","sourceRoot":"","sources":["../../../src/orchestrate/test/orchestrateTest.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"orchestrateTest.js","sourceRoot":"","sources":["../../../src/orchestrate/test/orchestrateTest.ts"],"names":[],"mappings":";;;;;;;;;;;;AAUA,+BAA0B;AAI1B,qEAAkE;AAClE,uEAAoE;AACpE,iEAA8D;AAGvD,MAAM,eAAe,GAC1B,CAAiC,GAAyB,EAAE,EAAE,CAC9D,CACE,KAA8B,EAC8B,EAAE;;IAC9D,MAAM,KAAK,GAAS,IAAI,IAAI,EAAE,CAAC;IAC/B,GAAG,CAAC,QAAQ,CAAC;QACX,IAAI,EAAE,WAAW;QACjB,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE;QAC/B,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,OAAO,0CAAE,IAAI,mCAAI,CAAC;KACrC,CAAC,CAAC;IAEH,MAAM,UAAU,GACd,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,SAAS,0CAAE,QAAQ,CAAC,UAAU,mCAAI,EAAE,CAAC;IACnD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAkC;YAC7C,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,IAAI,EAAE,kBAAkB;YACxB,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE;YAC/B,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACtC,IAAI,EACF,6DAA6D;gBAC7D,gDAAgD;SACnD,CAAC;QACF,GAA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QACjC,IAAI,EAAE,MAAM;QACZ,EAAE,EAAE,IAAA,SAAE,GAAE;QACR,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACtC,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE;QAC/B,KAAK;QACL,QAAQ;QACR,MAAM,EAAE,uDAAuD;QAC/D,IAAI,EAAE,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,SAAS,0CAAE,IAAI,mCAAI,CAAC;KACvC,CAAC;IACF,GAAG,CAAC,QAAQ,CAAC;QACX,IAAI,EAAE,cAAc;QACpB,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE;QAC/B,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QACpE,QAAQ;QACR,IAAI,EAAE,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,SAAS,0CAAE,IAAI,mCAAI,CAAC;KACvC,CAAC,CAAC;IACH,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,GAAG,OAAO,CAAC;IAC3B,GAAG,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC,CAAA,CAAC;AAlFS,QAAA,eAAe,mBAkFxB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AutoBeTestValidateEvent } from "@autobe/interface";
|
|
2
2
|
import { ILlmSchema } from "@samchon/openapi";
|
|
3
3
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
4
|
-
|
|
4
|
+
import { IAutoBeTestWriteResult } from "./structures/IAutoBeTestWriteResult";
|
|
5
|
+
export declare const orchestrateTestCorrect: <Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, writeResult: IAutoBeTestWriteResult[], life?: number) => Promise<AutoBeTestValidateEvent[]>;
|