@autobe/agent 0.25.4 → 0.25.6
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 +12 -13
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/context/AutoBeTokenUsage.d.ts +2 -2
- package/lib/context/AutoBeTokenUsage.js.map +1 -1
- package/lib/context/{IAutoBeApplication.d.ts → IAutoBeFacadeApplication.d.ts} +15 -83
- package/lib/context/{IAutoBeApplicationProps.js → IAutoBeFacadeApplication.js} +1 -1
- package/lib/context/IAutoBeFacadeApplication.js.map +1 -0
- package/lib/context/{IAutoBeApplicationProps.d.ts → IAutoBeFacadeApplicationProps.d.ts} +1 -1
- package/lib/context/{IAutoBeApplication.js → IAutoBeFacadeApplicationProps.js} +1 -1
- package/lib/context/IAutoBeFacadeApplicationProps.js.map +1 -0
- package/lib/context/{IAutoBeApplicationResult.d.ts → IAutoBeFacadeApplicationResult.d.ts} +1 -1
- package/lib/context/{IAutoBeApplicationResult.js → IAutoBeFacadeApplicationResult.js} +1 -1
- package/lib/context/IAutoBeFacadeApplicationResult.js.map +1 -0
- package/lib/factory/createAgenticaHistory.js +3 -1
- package/lib/factory/createAgenticaHistory.js.map +1 -1
- package/lib/factory/createAutoBeApplication.js +38 -76
- package/lib/factory/createAutoBeApplication.js.map +1 -1
- package/lib/factory/createAutoBeContext.js +10 -11
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/index.mjs +2109 -1667
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +0 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.d.ts +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +3 -18
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +0 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +1 -13
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.d.ts +1 -2
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +2 -4
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.d.ts +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +2 -2
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +0 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.d.ts +1 -0
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +370 -275
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js +0 -4
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +10 -7
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceCommonHistories.d.ts +3 -0
- package/lib/orchestrate/interface/histories/{transformInterfaceCommonPrerequisiteHistories.js → transformInterfaceCommonHistories.js} +4 -4
- package/lib/orchestrate/interface/histories/transformInterfaceCommonHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +12 -9
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +10 -7
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +13 -10
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +10 -7
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +10 -7
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.d.ts +2 -2
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +10 -5
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +2 -2
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +9 -6
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.d.ts +2 -2
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js +370 -275
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.d.ts +2 -2
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +304 -221
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js +303 -220
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +8 -5
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +8 -5
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestWriteHistories.js +8 -5
- package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTest.d.ts +2 -2
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +17 -22
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +372 -277
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +322 -350
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/utils/validateEmptyCode.d.ts +8 -0
- package/lib/utils/validateEmptyCode.js +35 -0
- package/lib/utils/validateEmptyCode.js.map +1 -0
- package/package.json +6 -6
- package/src/AutoBeMockAgent.ts +1 -1
- package/src/constants/AutoBeSystemPromptConstant.ts +12 -13
- package/src/context/AutoBeTokenUsage.ts +2 -2
- package/src/context/{IAutoBeApplication.ts → IAutoBeFacadeApplication.ts} +15 -83
- package/src/context/{IAutoBeApplicationProps.ts → IAutoBeFacadeApplicationProps.ts} +1 -1
- package/src/context/{IAutoBeApplicationResult.ts → IAutoBeFacadeApplicationResult.ts} +1 -1
- package/src/factory/createAgenticaHistory.ts +5 -4
- package/src/factory/createAutoBeApplication.ts +6 -6
- package/src/factory/createAutoBeContext.ts +2 -3
- package/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.ts +0 -1
- package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +0 -16
- package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +0 -13
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +71 -74
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +1 -2
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +0 -1
- package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +52 -10
- package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +0 -4
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +9 -6
- package/src/orchestrate/interface/histories/{transformInterfaceCommonPrerequisiteHistories.ts → transformInterfaceCommonHistories.ts} +1 -1
- package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +9 -6
- package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +9 -6
- package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +11 -10
- package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +9 -6
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +9 -6
- package/src/orchestrate/interface/orchestrateInterface.ts +2 -2
- package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +9 -4
- package/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts +8 -5
- package/src/orchestrate/prisma/orchestratePrisma.ts +2 -2
- package/src/orchestrate/realize/orchestRateRealizeCorrectCasting.ts +58 -17
- package/src/orchestrate/realize/orchestrateRealize.ts +2 -2
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +51 -15
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +46 -12
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +8 -5
- package/src/orchestrate/test/histories/transformTestScenarioReviewHistories.ts +8 -5
- package/src/orchestrate/test/histories/transformTestWriteHistories.ts +8 -5
- package/src/orchestrate/test/orchestrateTest.ts +2 -2
- package/src/orchestrate/test/orchestrateTestCorrect.ts +17 -24
- package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +57 -10
- package/src/orchestrate/test/orchestrateTestWrite.ts +41 -10
- package/src/utils/validateEmptyCode.ts +41 -0
- package/lib/context/IAutoBeApplication.js.map +0 -1
- package/lib/context/IAutoBeApplicationProps.js.map +0 -1
- package/lib/context/IAutoBeApplicationResult.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.d.ts +0 -3
- package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IAutoBeTokenUsageJson } from "@autobe/interface";
|
|
2
2
|
|
|
3
3
|
import { AutoBeTokenUsageComponent } from "./AutoBeTokenUsageComponent";
|
|
4
|
-
import {
|
|
4
|
+
import { IAutoBeFacadeApplication } from "./IAutoBeFacadeApplication";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Comprehensive token usage tracker for the AutoBe vibe coding system.
|
|
@@ -218,7 +218,7 @@ export class AutoBeTokenUsage implements IAutoBeTokenUsageJson {
|
|
|
218
218
|
*/
|
|
219
219
|
public record(
|
|
220
220
|
usage: IAutoBeTokenUsageJson.IComponent,
|
|
221
|
-
additionalStages: (keyof
|
|
221
|
+
additionalStages: (keyof IAutoBeFacadeApplication)[] = [],
|
|
222
222
|
) {
|
|
223
223
|
additionalStages.forEach((stage) => {
|
|
224
224
|
this[stage].increment(usage);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IAutoBeFacadeApplicationResult } from "./IAutoBeFacadeApplicationResult";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Application for AutoBE function calling.
|
|
5
5
|
*
|
|
6
6
|
* @author Samchon
|
|
7
7
|
*/
|
|
8
|
-
export interface
|
|
8
|
+
export interface IAutoBeFacadeApplication {
|
|
9
9
|
/**
|
|
10
10
|
* Run Analyze Agent.
|
|
11
11
|
*
|
|
@@ -25,26 +25,7 @@ export interface IAutoBeApplication {
|
|
|
25
25
|
* conversation. When executed after other agents have generated code, it can
|
|
26
26
|
* also interpret change requests in the context of existing implementations.
|
|
27
27
|
*/
|
|
28
|
-
analyze(
|
|
29
|
-
/**
|
|
30
|
-
* Requirements-focused instructions extracted from user utterances.
|
|
31
|
-
*
|
|
32
|
-
* Contains AI-interpreted guidance specifically for the requirements
|
|
33
|
-
* analysis phase. Should focus ONLY on features, business rules, user
|
|
34
|
-
* stories, and functional specifications. Must NOT include database design,
|
|
35
|
-
* API patterns, or implementation details which belong to other phases.
|
|
36
|
-
*
|
|
37
|
-
* **CRITICAL**: Only include what the user actually said. NEVER fabricate
|
|
38
|
-
* or invent requirements the user didn't mention.
|
|
39
|
-
*
|
|
40
|
-
* Examples:
|
|
41
|
-
*
|
|
42
|
-
* - "Focus on inventory management with real-time stock tracking"
|
|
43
|
-
* - "Prioritize user authentication with role-based permissions"
|
|
44
|
-
* - "Emphasize order processing workflow with approval stages"
|
|
45
|
-
*/
|
|
46
|
-
instruction: string;
|
|
47
|
-
}): Promise<IAutoBeApplicationResult>;
|
|
28
|
+
analyze(): Promise<IAutoBeFacadeApplicationResult>;
|
|
48
29
|
|
|
49
30
|
/**
|
|
50
31
|
* Run prisma agent.
|
|
@@ -67,24 +48,12 @@ export interface IAutoBeApplication {
|
|
|
67
48
|
*/
|
|
68
49
|
prisma(props: {
|
|
69
50
|
/**
|
|
70
|
-
* Database design instructions
|
|
71
|
-
*
|
|
72
|
-
* Contains AI-interpreted guidance specifically for the database schema
|
|
73
|
-
* design phase. Should focus ONLY on schema structure, relationships,
|
|
74
|
-
* constraints, and indexing strategies. Must NOT include API design or
|
|
75
|
-
* business logic implementation details.
|
|
76
|
-
*
|
|
77
|
-
* **CRITICAL**: Only include what the user actually said. NEVER fabricate
|
|
78
|
-
* or invent requirements the user didn't mention.
|
|
79
|
-
*
|
|
80
|
-
* Examples:
|
|
51
|
+
* Database design instructions from user conversation.
|
|
81
52
|
*
|
|
82
|
-
*
|
|
83
|
-
* - "Optimize for high-volume transaction queries"
|
|
84
|
-
* - "Implement strict referential integrity for financial data"
|
|
53
|
+
* Pass empty string "" if no database-specific instructions exist.
|
|
85
54
|
*/
|
|
86
55
|
instruction: string;
|
|
87
|
-
}): Promise<
|
|
56
|
+
}): Promise<IAutoBeFacadeApplicationResult>;
|
|
88
57
|
|
|
89
58
|
/**
|
|
90
59
|
* Run interface agent.
|
|
@@ -101,24 +70,12 @@ export interface IAutoBeApplication {
|
|
|
101
70
|
*/
|
|
102
71
|
interface(props: {
|
|
103
72
|
/**
|
|
104
|
-
* API design instructions
|
|
73
|
+
* API design instructions from user conversation.
|
|
105
74
|
*
|
|
106
|
-
*
|
|
107
|
-
* design phase. Should focus ONLY on endpoint patterns, request/response
|
|
108
|
-
* formats, DTO schemas, and operation specifications. Must NOT include
|
|
109
|
-
* database details or implementation logic.
|
|
110
|
-
*
|
|
111
|
-
* **CRITICAL**: Only include what the user actually said. NEVER fabricate
|
|
112
|
-
* or invent requirements the user didn't mention.
|
|
113
|
-
*
|
|
114
|
-
* Examples:
|
|
115
|
-
*
|
|
116
|
-
* - "Create RESTful endpoints with pagination for all list operations"
|
|
117
|
-
* - "Design mobile-friendly APIs with minimal response payloads"
|
|
118
|
-
* - "Follow OpenAPI 3.0 patterns with comprehensive error responses"
|
|
75
|
+
* Pass empty string "" if no API-specific instructions exist.
|
|
119
76
|
*/
|
|
120
77
|
instruction: string;
|
|
121
|
-
}): Promise<
|
|
78
|
+
}): Promise<IAutoBeFacadeApplicationResult>;
|
|
122
79
|
|
|
123
80
|
/**
|
|
124
81
|
* Run test program agent.
|
|
@@ -143,24 +100,12 @@ export interface IAutoBeApplication {
|
|
|
143
100
|
*/
|
|
144
101
|
test(props: {
|
|
145
102
|
/**
|
|
146
|
-
* Testing strategy instructions
|
|
147
|
-
*
|
|
148
|
-
* Contains AI-interpreted guidance specifically for the test code
|
|
149
|
-
* generation phase. Should focus ONLY on test scenarios, coverage
|
|
150
|
-
* priorities, edge cases, and validation strategies. Must NOT include
|
|
151
|
-
* implementation or API design details.
|
|
152
|
-
*
|
|
153
|
-
* **CRITICAL**: Only include what the user actually said. NEVER fabricate
|
|
154
|
-
* or invent requirements the user didn't mention.
|
|
103
|
+
* Testing strategy instructions from user conversation.
|
|
155
104
|
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
* - "Prioritize payment flow testing with failure scenarios"
|
|
159
|
-
* - "Generate comprehensive tests for concurrent user operations"
|
|
160
|
-
* - "Focus on data integrity validation across all endpoints"
|
|
105
|
+
* Pass empty string "" if no test-specific instructions exist.
|
|
161
106
|
*/
|
|
162
107
|
instruction: string;
|
|
163
|
-
}): Promise<
|
|
108
|
+
}): Promise<IAutoBeFacadeApplicationResult>;
|
|
164
109
|
|
|
165
110
|
/**
|
|
166
111
|
* Run realize agent.
|
|
@@ -185,23 +130,10 @@ export interface IAutoBeApplication {
|
|
|
185
130
|
*/
|
|
186
131
|
realize(props: {
|
|
187
132
|
/**
|
|
188
|
-
* Implementation instructions
|
|
189
|
-
*
|
|
190
|
-
* Contains AI-interpreted guidance specifically for the business logic
|
|
191
|
-
* implementation phase. Should focus ONLY on architectural patterns,
|
|
192
|
-
* performance requirements, business logic details, and service layer
|
|
193
|
-
* decisions. Must NOT include database schema or API interface
|
|
194
|
-
* specifications.
|
|
195
|
-
*
|
|
196
|
-
* **CRITICAL**: Only include what the user actually said. NEVER fabricate
|
|
197
|
-
* or invent requirements the user didn't mention.
|
|
198
|
-
*
|
|
199
|
-
* Examples:
|
|
133
|
+
* Implementation instructions from user conversation.
|
|
200
134
|
*
|
|
201
|
-
*
|
|
202
|
-
* - "Use transaction patterns for financial operations"
|
|
203
|
-
* - "Optimize for 10K concurrent users with rate limiting"
|
|
135
|
+
* Pass empty string "" if no implementation-specific instructions exist.
|
|
204
136
|
*/
|
|
205
137
|
instruction: string;
|
|
206
|
-
}): Promise<
|
|
138
|
+
}): Promise<IAutoBeFacadeApplicationResult>;
|
|
207
139
|
}
|
|
@@ -10,8 +10,6 @@ import {
|
|
|
10
10
|
} from "@autobe/interface";
|
|
11
11
|
import { ILlmSchema } from "@samchon/openapi";
|
|
12
12
|
|
|
13
|
-
import { IAutoBeApplicationProps } from "../context/IAutoBeApplicationProps";
|
|
14
|
-
|
|
15
13
|
export function createAgenticaHistory<Model extends ILlmSchema.Model>(props: {
|
|
16
14
|
operations: readonly AgenticaOperation<Model>[];
|
|
17
15
|
history: AutoBeHistory;
|
|
@@ -36,8 +34,11 @@ export function createAgenticaHistory<Model extends ILlmSchema.Model>(props: {
|
|
|
36
34
|
created_at: props.history.created_at,
|
|
37
35
|
type: "execute" as const,
|
|
38
36
|
arguments: {
|
|
39
|
-
instruction:
|
|
40
|
-
|
|
37
|
+
instruction:
|
|
38
|
+
props.history.type === "analyze"
|
|
39
|
+
? undefined
|
|
40
|
+
: props.history.instruction,
|
|
41
|
+
},
|
|
41
42
|
value: {
|
|
42
43
|
success:
|
|
43
44
|
props.history.type === "analyze" || props.history.type === "interface"
|
|
@@ -4,7 +4,7 @@ import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
|
4
4
|
import typia from "typia";
|
|
5
5
|
|
|
6
6
|
import { AutoBeContext } from "../context/AutoBeContext";
|
|
7
|
-
import {
|
|
7
|
+
import { IAutoBeFacadeApplication } from "../context/IAutoBeFacadeApplication";
|
|
8
8
|
import { assertSchemaModel } from "../context/assertSchemaModel";
|
|
9
9
|
import { orchestrateAnalyze } from "../orchestrate/analyze/orchestrateAnalyze";
|
|
10
10
|
import { orchestrateInterface } from "../orchestrate/interface/orchestrateInterface";
|
|
@@ -25,8 +25,8 @@ export const createAutoBeController = <Model extends ILlmSchema.Model>(props: {
|
|
|
25
25
|
name: "autobe",
|
|
26
26
|
application,
|
|
27
27
|
execute: {
|
|
28
|
-
analyze: async (
|
|
29
|
-
const r = await orchestrateAnalyze(props.context)
|
|
28
|
+
analyze: async () => {
|
|
29
|
+
const r = await orchestrateAnalyze(props.context);
|
|
30
30
|
if (r.type === "analyze")
|
|
31
31
|
return {
|
|
32
32
|
type: "success",
|
|
@@ -109,13 +109,13 @@ export const createAutoBeController = <Model extends ILlmSchema.Model>(props: {
|
|
|
109
109
|
description: "API interfaces are not yet completed.",
|
|
110
110
|
};
|
|
111
111
|
},
|
|
112
|
-
} satisfies
|
|
112
|
+
} satisfies IAutoBeFacadeApplication,
|
|
113
113
|
};
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
-
const claude = typia.llm.application<
|
|
116
|
+
const claude = typia.llm.application<IAutoBeFacadeApplication, "claude">();
|
|
117
117
|
const collection = {
|
|
118
|
-
chatgpt: typia.llm.application<
|
|
118
|
+
chatgpt: typia.llm.application<IAutoBeFacadeApplication, "chatgpt">(),
|
|
119
119
|
claude,
|
|
120
120
|
llama: claude,
|
|
121
121
|
deepseek: claude,
|
|
@@ -34,7 +34,7 @@ import { AutoBeContext } from "../context/AutoBeContext";
|
|
|
34
34
|
import { AutoBeState } from "../context/AutoBeState";
|
|
35
35
|
import { AutoBeTokenUsage } from "../context/AutoBeTokenUsage";
|
|
36
36
|
import { AutoBeTokenUsageComponent } from "../context/AutoBeTokenUsageComponent";
|
|
37
|
-
import {
|
|
37
|
+
import { IAutoBeFacadeApplication } from "../context/IAutoBeFacadeApplication";
|
|
38
38
|
import { IAutoBeConfig } from "../structures/IAutoBeConfig";
|
|
39
39
|
import { IAutoBeVendor } from "../structures/IAutoBeVendor";
|
|
40
40
|
import { AutoBeTimeoutError } from "../utils/AutoBeTimeoutError";
|
|
@@ -310,7 +310,6 @@ const createDispatch = (props: {
|
|
|
310
310
|
history: {
|
|
311
311
|
type: "analyze",
|
|
312
312
|
id: v7(),
|
|
313
|
-
instruction: analyzeStart?.reason ?? "",
|
|
314
313
|
prefix: event.prefix,
|
|
315
314
|
roles: event.roles,
|
|
316
315
|
files: event.files,
|
|
@@ -431,4 +430,4 @@ const forceRetry = async <T>(
|
|
|
431
430
|
throw error;
|
|
432
431
|
};
|
|
433
432
|
|
|
434
|
-
const STAGES = typia.misc.literals<keyof
|
|
433
|
+
const STAGES = typia.misc.literals<keyof IAutoBeFacadeApplication>();
|
|
@@ -8,7 +8,6 @@ import { AutoBeContext } from "../../../context/AutoBeContext";
|
|
|
8
8
|
|
|
9
9
|
export function transformAnalyzeSceHistories<Model extends ILlmSchema.Model>(
|
|
10
10
|
ctx: AutoBeContext<Model>,
|
|
11
|
-
instruction: string,
|
|
12
11
|
): Array<IMicroAgenticaHistoryJson> {
|
|
13
12
|
return [
|
|
14
13
|
...ctx
|
|
@@ -34,20 +33,5 @@ export function transformAnalyzeSceHistories<Model extends ILlmSchema.Model>(
|
|
|
34
33
|
`,
|
|
35
34
|
created_at: new Date().toISOString(),
|
|
36
35
|
},
|
|
37
|
-
{
|
|
38
|
-
id: v7(),
|
|
39
|
-
type: "assistantMessage",
|
|
40
|
-
text: StringUtil.trim`
|
|
41
|
-
## Instructions from Requirements Discussion
|
|
42
|
-
|
|
43
|
-
The following instructions were extracted by AI from
|
|
44
|
-
the discussion with the user about requirements.
|
|
45
|
-
Use these to guide document structure planning and
|
|
46
|
-
scenario definitions.
|
|
47
|
-
|
|
48
|
-
${instruction}
|
|
49
|
-
`,
|
|
50
|
-
created_at: new Date().toISOString(),
|
|
51
|
-
},
|
|
52
36
|
];
|
|
53
37
|
}
|
|
@@ -13,7 +13,6 @@ export const transformAnalyzeWriteHistories = <Model extends ILlmSchema.Model>(
|
|
|
13
13
|
props: {
|
|
14
14
|
scenario: AutoBeAnalyzeScenarioEvent;
|
|
15
15
|
file: AutoBeAnalyzeFile.Scenario;
|
|
16
|
-
instruction: string;
|
|
17
16
|
},
|
|
18
17
|
): Array<
|
|
19
18
|
| IAgenticaHistoryJson.IUserMessage
|
|
@@ -75,18 +74,6 @@ export const transformAnalyzeWriteHistories = <Model extends ILlmSchema.Model>(
|
|
|
75
74
|
\`\`\`json
|
|
76
75
|
${JSON.stringify(props.file)}
|
|
77
76
|
\`\`\`
|
|
78
|
-
|
|
79
|
-
## Instructions from Requirements Discussion
|
|
80
|
-
|
|
81
|
-
The following instructions were extracted by AI from
|
|
82
|
-
the discussion with the user about requirements.
|
|
83
|
-
If these instructions are relevant to the document you're
|
|
84
|
-
currently writing (${props.file.filename}), incorporate
|
|
85
|
-
them appropriately.
|
|
86
|
-
|
|
87
|
-
If not relevant to this specific document, ignore them.
|
|
88
|
-
|
|
89
|
-
${props.instruction}
|
|
90
77
|
`,
|
|
91
78
|
},
|
|
92
79
|
];
|
|
@@ -11,92 +11,89 @@ import { ILlmSchema } from "@samchon/openapi";
|
|
|
11
11
|
import { v7 } from "uuid";
|
|
12
12
|
|
|
13
13
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
14
|
-
import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
|
|
15
14
|
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
16
15
|
import { orchestrateAnalyzeReview } from "./orchestrateAnalyzeReview";
|
|
17
16
|
import { orchestrateAnalyzeScenario } from "./orchestrateAnalyzeScenario";
|
|
18
17
|
import { orchestrateAnalyzeWrite } from "./orchestrateAnalyzeWrite";
|
|
19
18
|
|
|
20
|
-
export const orchestrateAnalyze =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const step: number = (ctx.state().analyze?.step ?? -1) + 1;
|
|
27
|
-
const startTime: Date = new Date();
|
|
19
|
+
export const orchestrateAnalyze = async <Model extends ILlmSchema.Model>(
|
|
20
|
+
ctx: AutoBeContext<Model>,
|
|
21
|
+
): Promise<AutoBeAssistantMessageHistory | AutoBeAnalyzeHistory> => {
|
|
22
|
+
// Initialize analysis state
|
|
23
|
+
const step: number = (ctx.state().analyze?.step ?? -1) + 1;
|
|
24
|
+
const startTime: Date = new Date();
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
26
|
+
ctx.dispatch({
|
|
27
|
+
type: "analyzeStart",
|
|
28
|
+
id: v7(),
|
|
29
|
+
step,
|
|
30
|
+
created_at: startTime.toISOString(),
|
|
31
|
+
});
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
// Generate analysis scenario
|
|
34
|
+
const scenario: AutoBeAnalyzeScenarioEvent | AutoBeAssistantMessageHistory =
|
|
35
|
+
await orchestrateAnalyzeScenario(ctx);
|
|
36
|
+
if (scenario.type === "assistantMessage")
|
|
37
|
+
return ctx.assistantMessage(scenario);
|
|
38
|
+
else ctx.dispatch(scenario);
|
|
43
39
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
// write documents
|
|
41
|
+
const writeProgress: AutoBeProgressEventBase = {
|
|
42
|
+
total: scenario.files.length,
|
|
43
|
+
completed: 0,
|
|
44
|
+
};
|
|
45
|
+
const fileList: AutoBeAnalyzeFile[] = await executeCachedBatch(
|
|
46
|
+
scenario.files.map((file) => async (promptCacheKey) => {
|
|
47
|
+
const event: AutoBeAnalyzeWriteEvent = await orchestrateAnalyzeWrite(
|
|
48
|
+
ctx,
|
|
49
|
+
{
|
|
50
|
+
scenario,
|
|
51
|
+
file,
|
|
52
|
+
progress: writeProgress,
|
|
53
|
+
promptCacheKey,
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
return event.file;
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
// review documents
|
|
61
|
+
const reviewProgress: AutoBeProgressEventBase = {
|
|
62
|
+
total: fileList.length,
|
|
63
|
+
completed: 0,
|
|
64
|
+
};
|
|
65
|
+
const newFiles: AutoBeAnalyzeFile[] = await executeCachedBatch(
|
|
66
|
+
fileList.map((file) => async (promptCacheKey) => {
|
|
67
|
+
try {
|
|
68
|
+
const event: AutoBeAnalyzeReviewEvent = await orchestrateAnalyzeReview(
|
|
52
69
|
ctx,
|
|
53
70
|
{
|
|
54
71
|
scenario,
|
|
55
|
-
|
|
56
|
-
|
|
72
|
+
allFiles: fileList, // all files
|
|
73
|
+
myFile: file,
|
|
74
|
+
progress: reviewProgress,
|
|
57
75
|
promptCacheKey,
|
|
58
|
-
instruction: props.instruction,
|
|
59
76
|
},
|
|
60
77
|
);
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
|
|
78
|
+
return {
|
|
79
|
+
...event.file,
|
|
80
|
+
content: event.content,
|
|
81
|
+
};
|
|
82
|
+
} catch {
|
|
83
|
+
return file;
|
|
84
|
+
}
|
|
85
|
+
}),
|
|
86
|
+
);
|
|
64
87
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
myFile: file,
|
|
78
|
-
progress: reviewProgress,
|
|
79
|
-
promptCacheKey,
|
|
80
|
-
});
|
|
81
|
-
return {
|
|
82
|
-
...event.file,
|
|
83
|
-
content: event.content,
|
|
84
|
-
};
|
|
85
|
-
} catch {
|
|
86
|
-
return file;
|
|
87
|
-
}
|
|
88
|
-
}),
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
// Complete the analysis
|
|
92
|
-
return ctx.dispatch({
|
|
93
|
-
type: "analyzeComplete",
|
|
94
|
-
id: v7(),
|
|
95
|
-
roles: scenario.roles,
|
|
96
|
-
prefix: scenario.prefix,
|
|
97
|
-
files: newFiles,
|
|
98
|
-
step,
|
|
99
|
-
elapsed: new Date().getTime() - startTime.getTime(),
|
|
100
|
-
created_at: new Date().toISOString(),
|
|
101
|
-
}) satisfies AutoBeAnalyzeHistory;
|
|
102
|
-
};
|
|
88
|
+
// Complete the analysis
|
|
89
|
+
return ctx.dispatch({
|
|
90
|
+
type: "analyzeComplete",
|
|
91
|
+
id: v7(),
|
|
92
|
+
roles: scenario.roles,
|
|
93
|
+
prefix: scenario.prefix,
|
|
94
|
+
files: newFiles,
|
|
95
|
+
step,
|
|
96
|
+
elapsed: new Date().getTime() - startTime.getTime(),
|
|
97
|
+
created_at: new Date().toISOString(),
|
|
98
|
+
}) satisfies AutoBeAnalyzeHistory;
|
|
99
|
+
};
|
|
@@ -21,7 +21,6 @@ export const orchestrateAnalyzeScenario = async <
|
|
|
21
21
|
Model extends ILlmSchema.Model,
|
|
22
22
|
>(
|
|
23
23
|
ctx: AutoBeContext<Model>,
|
|
24
|
-
instruction: string,
|
|
25
24
|
): Promise<AutoBeAnalyzeScenarioEvent | AutoBeAssistantMessageHistory> => {
|
|
26
25
|
const start: Date = new Date();
|
|
27
26
|
const pointer: IPointer<IAutoBeAnalyzeScenarioApplication.IProps | null> = {
|
|
@@ -33,7 +32,7 @@ export const orchestrateAnalyzeScenario = async <
|
|
|
33
32
|
model: ctx.model,
|
|
34
33
|
build: (value) => (pointer.value = value),
|
|
35
34
|
}),
|
|
36
|
-
histories: transformAnalyzeSceHistories(ctx
|
|
35
|
+
histories: transformAnalyzeSceHistories(ctx),
|
|
37
36
|
enforceFunctionCall: false,
|
|
38
37
|
message: StringUtil.trim`
|
|
39
38
|
Design a complete list of documents and user roles for this project.
|
|
@@ -20,7 +20,6 @@ export const orchestrateAnalyzeWrite = async <Model extends ILlmSchema.Model>(
|
|
|
20
20
|
props: {
|
|
21
21
|
scenario: AutoBeAnalyzeScenarioEvent;
|
|
22
22
|
file: AutoBeAnalyzeFile.Scenario;
|
|
23
|
-
instruction: string;
|
|
24
23
|
progress: AutoBeProgressEventBase;
|
|
25
24
|
promptCacheKey: string;
|
|
26
25
|
},
|
|
@@ -7,12 +7,18 @@ import {
|
|
|
7
7
|
IAutoBeTypeScriptCompileResult,
|
|
8
8
|
} from "@autobe/interface";
|
|
9
9
|
import { StringUtil } from "@autobe/utils";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
ILlmApplication,
|
|
12
|
+
ILlmController,
|
|
13
|
+
ILlmSchema,
|
|
14
|
+
IValidation,
|
|
15
|
+
} from "@samchon/openapi";
|
|
11
16
|
import { IPointer } from "tstl";
|
|
12
17
|
import typia from "typia";
|
|
13
18
|
|
|
14
19
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
15
20
|
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
21
|
+
import { validateEmptyCode } from "../../utils/validateEmptyCode";
|
|
16
22
|
import { transformCommonCorrectCastingHistories } from "./histories/transformCommonCorrectCastingHistories";
|
|
17
23
|
import { IAutoBeCommonCorrectCastingApplication } from "./structures/IAutoBeCommonCorrectCastingApplication";
|
|
18
24
|
|
|
@@ -31,6 +37,7 @@ interface IFactoryProps<
|
|
|
31
37
|
}): CorrectEvent;
|
|
32
38
|
script(event: ValidateEvent): string;
|
|
33
39
|
source: "testCorrect" | "realizeCorrect";
|
|
40
|
+
functionName: string;
|
|
34
41
|
}
|
|
35
42
|
|
|
36
43
|
export const orchestrateCommonCorrectCasting = async <
|
|
@@ -96,6 +103,7 @@ const correct = async <
|
|
|
96
103
|
),
|
|
97
104
|
controller: createController({
|
|
98
105
|
model: ctx.model,
|
|
106
|
+
functionName: factory.functionName,
|
|
99
107
|
then: (next) => {
|
|
100
108
|
pointer.value = next;
|
|
101
109
|
},
|
|
@@ -136,13 +144,31 @@ const correct = async <
|
|
|
136
144
|
|
|
137
145
|
const createController = <Model extends ILlmSchema.Model>(props: {
|
|
138
146
|
model: Model;
|
|
147
|
+
functionName: string;
|
|
139
148
|
then: (next: IAutoBeCommonCorrectCastingApplication.IProps) => void;
|
|
140
149
|
reject: () => void;
|
|
141
150
|
}): ILlmController<Model> => {
|
|
142
151
|
assertSchemaModel(props.model);
|
|
152
|
+
const validate: Validator = (input) => {
|
|
153
|
+
const result: IValidation<IAutoBeCommonCorrectCastingApplication.IProps> =
|
|
154
|
+
typia.validate<IAutoBeCommonCorrectCastingApplication.IProps>(input);
|
|
155
|
+
if (result.success === false) return result;
|
|
156
|
+
const errors: IValidation.IError[] = validateEmptyCode({
|
|
157
|
+
functionName: props.functionName,
|
|
158
|
+
draft: result.data.draft,
|
|
159
|
+
revise: result.data.revise,
|
|
160
|
+
});
|
|
161
|
+
return errors.length
|
|
162
|
+
? {
|
|
163
|
+
success: false,
|
|
164
|
+
errors,
|
|
165
|
+
data: result.data,
|
|
166
|
+
}
|
|
167
|
+
: result;
|
|
168
|
+
};
|
|
143
169
|
const application = collection[
|
|
144
170
|
props.model === "chatgpt" ? "chatgpt" : "claude"
|
|
145
|
-
] satisfies ILlmApplication<any> as any as ILlmApplication<Model>;
|
|
171
|
+
](validate) satisfies ILlmApplication<any> as any as ILlmApplication<Model>;
|
|
146
172
|
return {
|
|
147
173
|
protocol: "class",
|
|
148
174
|
name: "correctInvalidRequest",
|
|
@@ -159,12 +185,28 @@ const createController = <Model extends ILlmSchema.Model>(props: {
|
|
|
159
185
|
};
|
|
160
186
|
|
|
161
187
|
const collection = {
|
|
162
|
-
chatgpt:
|
|
163
|
-
IAutoBeCommonCorrectCastingApplication,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
188
|
+
chatgpt: (validate: Validator) =>
|
|
189
|
+
typia.llm.application<IAutoBeCommonCorrectCastingApplication, "chatgpt">({
|
|
190
|
+
validate: {
|
|
191
|
+
rewrite: validate,
|
|
192
|
+
reject: () => ({
|
|
193
|
+
success: true,
|
|
194
|
+
data: undefined,
|
|
195
|
+
}),
|
|
196
|
+
},
|
|
197
|
+
}),
|
|
198
|
+
claude: (validate: Validator) =>
|
|
199
|
+
typia.llm.application<IAutoBeCommonCorrectCastingApplication, "claude">({
|
|
200
|
+
validate: {
|
|
201
|
+
rewrite: validate,
|
|
202
|
+
reject: () => ({
|
|
203
|
+
success: true,
|
|
204
|
+
data: undefined,
|
|
205
|
+
}),
|
|
206
|
+
},
|
|
207
|
+
}),
|
|
170
208
|
};
|
|
209
|
+
|
|
210
|
+
type Validator = (
|
|
211
|
+
input: unknown,
|
|
212
|
+
) => IValidation<IAutoBeCommonCorrectCastingApplication.IProps>;
|
|
@@ -27,10 +27,6 @@ export const transformInterfaceAssetHistories = (
|
|
|
27
27
|
Call the provided tool function to generate the OpenAPI document
|
|
28
28
|
referencing below requirement analysis and Prisma DB schema.
|
|
29
29
|
|
|
30
|
-
## User Request
|
|
31
|
-
|
|
32
|
-
${analyze.instruction}
|
|
33
|
-
|
|
34
30
|
## Requirement Analysis Report
|
|
35
31
|
|
|
36
32
|
\`\`\`json
|
|
@@ -47,15 +47,18 @@ export const transformInterfaceAuthorizationsHistories = (props: {
|
|
|
47
47
|
text: StringUtil.trim`
|
|
48
48
|
## API Design Instructions
|
|
49
49
|
|
|
50
|
-
The following API-specific instructions were extracted
|
|
51
|
-
the user's
|
|
50
|
+
The following API-specific instructions were extracted from
|
|
51
|
+
the user's requirements. These focus on API interface design aspects
|
|
52
52
|
such as endpoint patterns, request/response formats, DTO schemas,
|
|
53
53
|
and operation specifications.
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
Follow these instructions when designing authorization operations for ${props.role.name}.
|
|
56
|
+
Carefully distinguish between:
|
|
57
|
+
- Suggestions or recommendations (consider these as guidance)
|
|
58
|
+
- Direct specifications or explicit commands (these must be followed exactly)
|
|
59
|
+
|
|
60
|
+
When instructions contain direct specifications or explicit design decisions,
|
|
61
|
+
follow them precisely even if you believe you have better alternatives.
|
|
59
62
|
|
|
60
63
|
${props.instruction}
|
|
61
64
|
|