@autobe/agent 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/agent/src/AutoBeMockAgent.js +1 -0
- package/lib/agent/src/AutoBeMockAgent.js.map +1 -1
- package/lib/agent/src/constants/AutoBeSystemPromptConstant.d.ts +10 -9
- package/lib/agent/src/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/agent/src/context/AutoBeContext.d.ts +2 -2
- package/lib/agent/src/factory/createAutoBeContext.js +3 -1
- package/lib/agent/src/factory/createAutoBeContext.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +4 -0
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +33 -0
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +2 -2
- package/lib/agent/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceAuthorizations.js +6 -6
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js +5 -3
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +365 -0
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperations.js +6 -6
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js +1633 -1198
- package/lib/agent/src/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js +3 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js.map +1 -0
- package/lib/agent/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +40 -0
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js +1 -1
- package/lib/agent/src/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeCorrect.js +4 -4
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js +2 -2
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeScenario.js.map +1 -1
- package/lib/agent/src/orchestrate/realize/orchestrateRealizeWrite.js +4 -4
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +2 -2
- package/lib/agent/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +7 -2
- package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js +1 -1
- package/lib/agent/src/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.d.ts +3 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js +41 -25
- package/lib/agent/src/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js +118 -96
- package/lib/agent/src/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestScenario.js +10 -10
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js +1 -1
- package/lib/agent/src/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/agent/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +28 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +10 -9
- package/lib/context/AutoBeContext.d.ts +2 -2
- package/lib/index.mjs +2315 -1526
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +4 -0
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +10 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +60 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +40 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.d.ts +2 -2
- package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +7 -2
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +3 -1
- package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +3 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +28 -1
- package/package.json +6 -6
- package/src/AutoBeMockAgent.ts +1 -0
- package/src/constants/AutoBeSystemPromptConstant.ts +10 -9
- package/src/context/AutoBeContext.ts +2 -0
- package/src/factory/createAutoBeContext.ts +2 -1
- package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +39 -0
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +5 -1
- package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +95 -0
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +118 -10
- package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.ts +65 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +42 -0
- package/src/orchestrate/realize/orchestrateRealizeScenario.ts +7 -3
- package/src/orchestrate/realize/structures/IAutoBeRealizeScenarioApplication.ts +6 -2
- package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +10 -5
- package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +2 -0
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +46 -34
- package/src/orchestrate/test/histories/transformTestWriteHistories.ts +24 -4
- package/src/orchestrate/test/orchestrateTestCorrect.ts +5 -1
- package/src/orchestrate/test/orchestrateTestWrite.ts +1 -1
- package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +28 -1
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js +0 -75
- package/lib/agent/src/orchestrate/test/histories/transformTestHistories.js.map +0 -1
- package/lib/orchestrate/test/histories/transformTestHistories.d.ts +0 -3
- package/src/orchestrate/test/histories/transformTestHistories.ts +0 -78
|
@@ -4,18 +4,28 @@ import { StringUtil, transformOpenApiDocument } from "@autobe/utils";
|
|
|
4
4
|
import {
|
|
5
5
|
HttpMigration,
|
|
6
6
|
IHttpMigrateApplication,
|
|
7
|
+
ILlmSchema,
|
|
7
8
|
OpenApi,
|
|
8
9
|
} from "@samchon/openapi";
|
|
9
10
|
import typia from "typia";
|
|
10
11
|
import { v7 } from "uuid";
|
|
11
12
|
|
|
12
13
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
14
|
+
import { AutoBeContext } from "../../../context/AutoBeContext";
|
|
15
|
+
import { getTestExternalDeclarations } from "../compile/getTestExternalDeclarations";
|
|
13
16
|
import { IAutoBeTestScenarioArtifacts } from "../structures/IAutoBeTestScenarioArtifacts";
|
|
14
17
|
|
|
15
|
-
export function transformTestWriteHistories
|
|
18
|
+
export async function transformTestWriteHistories<
|
|
19
|
+
Model extends ILlmSchema.Model,
|
|
20
|
+
>(
|
|
21
|
+
ctx: AutoBeContext<Model>,
|
|
16
22
|
scenario: AutoBeTestScenario,
|
|
17
23
|
artifacts: IAutoBeTestScenarioArtifacts,
|
|
18
|
-
):
|
|
24
|
+
): Promise<
|
|
25
|
+
Array<
|
|
26
|
+
IAgenticaHistoryJson.ISystemMessage | IAgenticaHistoryJson.IAssistantMessage
|
|
27
|
+
>
|
|
28
|
+
> {
|
|
19
29
|
return [
|
|
20
30
|
{
|
|
21
31
|
id: v7(),
|
|
@@ -24,17 +34,21 @@ export function transformTestWriteHistories(
|
|
|
24
34
|
text: AutoBeSystemPromptConstant.TEST_WRITE.replace(
|
|
25
35
|
"{{AutoBeTestScenario}}",
|
|
26
36
|
JSON.stringify(typia.llm.parameters<AutoBeTestScenario, "llama">()),
|
|
27
|
-
)
|
|
37
|
+
),
|
|
28
38
|
},
|
|
29
39
|
{
|
|
30
40
|
id: v7(),
|
|
31
41
|
created_at: new Date().toISOString(),
|
|
32
|
-
type: "
|
|
42
|
+
type: "assistantMessage",
|
|
33
43
|
text: StringUtil.trim`
|
|
34
44
|
Here is the list of input material composition.
|
|
35
45
|
|
|
36
46
|
Make e2e test functions based on the following information.
|
|
37
47
|
|
|
48
|
+
## Function Name
|
|
49
|
+
|
|
50
|
+
The e2e test function name must be ${JSON.stringify(scenario.functionName)}.
|
|
51
|
+
|
|
38
52
|
## Scenario Plan
|
|
39
53
|
|
|
40
54
|
Here is the scenario plan what you have to implement.
|
|
@@ -66,6 +80,12 @@ export function transformTestWriteHistories(
|
|
|
66
80
|
\`\`\`json
|
|
67
81
|
${JSON.stringify(artifacts.e2e)}
|
|
68
82
|
\`\`\`
|
|
83
|
+
|
|
84
|
+
## External Definitions
|
|
85
|
+
|
|
86
|
+
\`\`\`json
|
|
87
|
+
${JSON.stringify(await getTestExternalDeclarations(ctx))}
|
|
88
|
+
\`\`\`
|
|
69
89
|
`,
|
|
70
90
|
},
|
|
71
91
|
];
|
|
@@ -106,7 +106,11 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
106
106
|
};
|
|
107
107
|
const { tokenUsage } = await ctx.conversate({
|
|
108
108
|
source: "testCorrect",
|
|
109
|
-
histories: transformTestCorrectHistories(
|
|
109
|
+
histories: await transformTestCorrectHistories(
|
|
110
|
+
ctx,
|
|
111
|
+
content,
|
|
112
|
+
validate.result,
|
|
113
|
+
),
|
|
110
114
|
controller: createController({
|
|
111
115
|
model: ctx.model,
|
|
112
116
|
artifacts: content.artifacts,
|
|
@@ -73,7 +73,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
73
73
|
};
|
|
74
74
|
const { tokenUsage } = await ctx.conversate({
|
|
75
75
|
source: "testWrite",
|
|
76
|
-
histories: transformTestWriteHistories(scenario, artifacts),
|
|
76
|
+
histories: await transformTestWriteHistories(ctx, scenario, artifacts),
|
|
77
77
|
controller: createController({
|
|
78
78
|
model: ctx.model,
|
|
79
79
|
artifacts,
|
|
@@ -32,6 +32,18 @@ export namespace IAutoBeTestScenarioApplication {
|
|
|
32
32
|
*
|
|
33
33
|
* Each scenario represents a specific test case for the same `path` and
|
|
34
34
|
* `method`.
|
|
35
|
+
*
|
|
36
|
+
* IMPORTANT: Each scenario must be actually implementable. A scenario's
|
|
37
|
+
* implementability is determined by the existence of ALL APIs (endpoints)
|
|
38
|
+
* required to test it. This includes not only the primary endpoint being
|
|
39
|
+
* tested, but also ALL dependency endpoints needed for setup,
|
|
40
|
+
* authentication, and data preparation. If even one required dependency API
|
|
41
|
+
* is missing from the available operations, the scenario cannot be
|
|
42
|
+
* implemented and should not be generated.
|
|
43
|
+
*
|
|
44
|
+
* Example: A "test banned user login" scenario requires both a login API
|
|
45
|
+
* AND a ban user API. If the ban API doesn't exist, this scenario is not
|
|
46
|
+
* implementable regardless of database schema fields.
|
|
35
47
|
*/
|
|
36
48
|
scenarios: IScenario[] & tags.MinItems<1>;
|
|
37
49
|
}
|
|
@@ -42,6 +54,11 @@ export namespace IAutoBeTestScenarioApplication {
|
|
|
42
54
|
* This interface defines a structured, user-centric test draft that includes
|
|
43
55
|
* a descriptive function name, a detailed scenario draft, and logical
|
|
44
56
|
* dependencies on other endpoints required for context or setup.
|
|
57
|
+
*
|
|
58
|
+
* CRITICAL: All referenced endpoints MUST exist in the provided API
|
|
59
|
+
* operations. Do NOT create scenarios for non-existent APIs, even if database
|
|
60
|
+
* schema fields suggest their existence. Test scenarios must be implementable
|
|
61
|
+
* with available APIs only.
|
|
45
62
|
*/
|
|
46
63
|
export interface IScenario {
|
|
47
64
|
/**
|
|
@@ -120,12 +137,22 @@ export namespace IAutoBeTestScenarioApplication {
|
|
|
120
137
|
* authentication, resource creation, or data setup, that are relevant to
|
|
121
138
|
* the test. This list is not a strict execution order — if ordering is
|
|
122
139
|
* important, it must be described explicitly in the `purpose`.
|
|
140
|
+
*
|
|
141
|
+
* WARNING: Every endpoint referenced here MUST exist in the provided API
|
|
142
|
+
* operations. Do NOT reference endpoints that are not explicitly available,
|
|
143
|
+
* even if they seem logically necessary based on database schema or
|
|
144
|
+
* business logic.
|
|
123
145
|
*/
|
|
124
146
|
dependencies: IDependencies[];
|
|
125
147
|
}
|
|
126
148
|
|
|
127
149
|
export interface IDependencies {
|
|
128
|
-
/**
|
|
150
|
+
/**
|
|
151
|
+
* Target API endpoint that this scenario depends on.
|
|
152
|
+
*
|
|
153
|
+
* This endpoint MUST exist in the available API operations list.
|
|
154
|
+
* Non-existent endpoints will cause test implementation failures.
|
|
155
|
+
*/
|
|
129
156
|
endpoint: AutoBeOpenApi.IEndpoint;
|
|
130
157
|
|
|
131
158
|
/**
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformTestHistories = void 0;
|
|
4
|
-
const utils_1 = require("@autobe/utils");
|
|
5
|
-
const uuid_1 = require("uuid");
|
|
6
|
-
const transformTestHistories = (state) => {
|
|
7
|
-
if (state.analyze === null)
|
|
8
|
-
return [
|
|
9
|
-
{
|
|
10
|
-
id: (0, uuid_1.v7)(),
|
|
11
|
-
created_at: new Date().toISOString(),
|
|
12
|
-
type: "systemMessage",
|
|
13
|
-
text: utils_1.StringUtil.trim `
|
|
14
|
-
Requirement analysis is not yet completed.
|
|
15
|
-
Don't call the any tool function,
|
|
16
|
-
but say to process the requirement analysis.
|
|
17
|
-
`,
|
|
18
|
-
},
|
|
19
|
-
];
|
|
20
|
-
else if (state.prisma === null)
|
|
21
|
-
return [
|
|
22
|
-
{
|
|
23
|
-
id: (0, uuid_1.v7)(),
|
|
24
|
-
created_at: new Date().toISOString(),
|
|
25
|
-
type: "systemMessage",
|
|
26
|
-
text: utils_1.StringUtil.trim `
|
|
27
|
-
Prisma DB schema generation is not yet completed.
|
|
28
|
-
Don't call the any tool function,
|
|
29
|
-
but say to process the Prisma DB schema generation.
|
|
30
|
-
`,
|
|
31
|
-
},
|
|
32
|
-
];
|
|
33
|
-
else if (state.analyze.step !== state.prisma.step)
|
|
34
|
-
return [
|
|
35
|
-
{
|
|
36
|
-
id: (0, uuid_1.v7)(),
|
|
37
|
-
created_at: new Date().toISOString(),
|
|
38
|
-
type: "systemMessage",
|
|
39
|
-
text: utils_1.StringUtil.trim `
|
|
40
|
-
Prisma DB schema generation has not been updated
|
|
41
|
-
for the latest requirement analysis.
|
|
42
|
-
Don't call the any tool function,
|
|
43
|
-
but say to re-process the Prisma DB schema generation.
|
|
44
|
-
`,
|
|
45
|
-
},
|
|
46
|
-
];
|
|
47
|
-
else if (state.prisma.compiled.type !== "success")
|
|
48
|
-
return [
|
|
49
|
-
{
|
|
50
|
-
id: (0, uuid_1.v7)(),
|
|
51
|
-
created_at: new Date().toISOString(),
|
|
52
|
-
type: "systemMessage",
|
|
53
|
-
text: utils_1.StringUtil.trim `
|
|
54
|
-
Prisma DB schema generation has not been updated
|
|
55
|
-
for the latest requirement analysis.
|
|
56
|
-
Don't call the any tool function,
|
|
57
|
-
but say to re-process the Prisma DB schema generation.
|
|
58
|
-
`,
|
|
59
|
-
},
|
|
60
|
-
];
|
|
61
|
-
return [
|
|
62
|
-
{
|
|
63
|
-
id: (0, uuid_1.v7)(),
|
|
64
|
-
created_at: new Date().toISOString(),
|
|
65
|
-
type: "systemMessage",
|
|
66
|
-
text: utils_1.StringUtil.trim `
|
|
67
|
-
Interface generation is not yet completed.
|
|
68
|
-
Don't call the any tool function,
|
|
69
|
-
but say to process the interface generation.
|
|
70
|
-
`,
|
|
71
|
-
},
|
|
72
|
-
];
|
|
73
|
-
};
|
|
74
|
-
exports.transformTestHistories = transformTestHistories;
|
|
75
|
-
//# sourceMappingURL=transformTestHistories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transformTestHistories.js","sourceRoot":"","sources":["../../../../../../src/orchestrate/test/histories/transformTestHistories.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAC3C,+BAA0B;AAInB,MAAM,sBAAsB,GAAG,CACpC,KAAkB,EAGlB,EAAE;IACF,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI;QACxB,OAAO;YACL;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;SAIpB;aACF;SACF,CAAC;SACC,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI;QAC5B,OAAO;YACL;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;SAIpB;aACF;SACF,CAAC;SACC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM,CAAC,IAAI;QAC/C,OAAO;YACL;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;SAKpB;aACF;SACF,CAAC;SACC,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS;QAC/C,OAAO;YACL;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;SAKpB;aACF;SACF,CAAC;IACJ,OAAO;QACL;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;OAIpB;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AAvEW,QAAA,sBAAsB,0BAuEjC"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
-
import { StringUtil } from "@autobe/utils";
|
|
3
|
-
import { v7 } from "uuid";
|
|
4
|
-
|
|
5
|
-
import { AutoBeState } from "../../../context/AutoBeState";
|
|
6
|
-
|
|
7
|
-
export const transformTestHistories = (
|
|
8
|
-
state: AutoBeState,
|
|
9
|
-
): Array<
|
|
10
|
-
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
11
|
-
> => {
|
|
12
|
-
if (state.analyze === null)
|
|
13
|
-
return [
|
|
14
|
-
{
|
|
15
|
-
id: v7(),
|
|
16
|
-
created_at: new Date().toISOString(),
|
|
17
|
-
type: "systemMessage",
|
|
18
|
-
text: StringUtil.trim`
|
|
19
|
-
Requirement analysis is not yet completed.
|
|
20
|
-
Don't call the any tool function,
|
|
21
|
-
but say to process the requirement analysis.
|
|
22
|
-
`,
|
|
23
|
-
},
|
|
24
|
-
];
|
|
25
|
-
else if (state.prisma === null)
|
|
26
|
-
return [
|
|
27
|
-
{
|
|
28
|
-
id: v7(),
|
|
29
|
-
created_at: new Date().toISOString(),
|
|
30
|
-
type: "systemMessage",
|
|
31
|
-
text: StringUtil.trim`
|
|
32
|
-
Prisma DB schema generation is not yet completed.
|
|
33
|
-
Don't call the any tool function,
|
|
34
|
-
but say to process the Prisma DB schema generation.
|
|
35
|
-
`,
|
|
36
|
-
},
|
|
37
|
-
];
|
|
38
|
-
else if (state.analyze.step !== state.prisma.step)
|
|
39
|
-
return [
|
|
40
|
-
{
|
|
41
|
-
id: v7(),
|
|
42
|
-
created_at: new Date().toISOString(),
|
|
43
|
-
type: "systemMessage",
|
|
44
|
-
text: StringUtil.trim`
|
|
45
|
-
Prisma DB schema generation has not been updated
|
|
46
|
-
for the latest requirement analysis.
|
|
47
|
-
Don't call the any tool function,
|
|
48
|
-
but say to re-process the Prisma DB schema generation.
|
|
49
|
-
`,
|
|
50
|
-
},
|
|
51
|
-
];
|
|
52
|
-
else if (state.prisma.compiled.type !== "success")
|
|
53
|
-
return [
|
|
54
|
-
{
|
|
55
|
-
id: v7(),
|
|
56
|
-
created_at: new Date().toISOString(),
|
|
57
|
-
type: "systemMessage",
|
|
58
|
-
text: StringUtil.trim`
|
|
59
|
-
Prisma DB schema generation has not been updated
|
|
60
|
-
for the latest requirement analysis.
|
|
61
|
-
Don't call the any tool function,
|
|
62
|
-
but say to re-process the Prisma DB schema generation.
|
|
63
|
-
`,
|
|
64
|
-
},
|
|
65
|
-
];
|
|
66
|
-
return [
|
|
67
|
-
{
|
|
68
|
-
id: v7(),
|
|
69
|
-
created_at: new Date().toISOString(),
|
|
70
|
-
type: "systemMessage",
|
|
71
|
-
text: StringUtil.trim`
|
|
72
|
-
Interface generation is not yet completed.
|
|
73
|
-
Don't call the any tool function,
|
|
74
|
-
but say to process the interface generation.
|
|
75
|
-
`,
|
|
76
|
-
},
|
|
77
|
-
];
|
|
78
|
-
};
|