@autobe/agent 0.26.0 → 0.27.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/AutoBeAgent.d.ts +2 -1
- package/lib/AutoBeAgent.js +27 -7
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/AutoBeMockAgent.js +2 -4
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +10 -10
- package/lib/context/AutoBeContext.d.ts +4 -1
- package/lib/context/AutoBeTokenUsage.d.ts +1 -1
- package/lib/context/AutoBeTokenUsage.js.map +1 -1
- package/lib/factory/AutoBeFunctionCallingMetricFactory.d.ts +7 -0
- package/lib/factory/AutoBeFunctionCallingMetricFactory.js +35 -0
- package/lib/factory/AutoBeFunctionCallingMetricFactory.js.map +1 -0
- package/lib/factory/AutoBeProcessAggregateFactory.d.ts +13 -0
- package/lib/factory/AutoBeProcessAggregateFactory.js +100 -0
- package/lib/factory/AutoBeProcessAggregateFactory.js.map +1 -0
- package/lib/factory/createAutoBeContext.d.ts +2 -1
- package/lib/factory/createAutoBeContext.js +78 -27
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/index.mjs +1891 -1214
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +1 -0
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js +2 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +2 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +3 -2
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.d.ts +2 -1
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +3 -2
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
- package/lib/{factory/createAutoBeApplication.d.ts → orchestrate/facade/createAutoBeFacadeController.d.ts} +2 -2
- package/lib/{factory/createAutoBeApplication.js → orchestrate/facade/createAutoBeFacadeController.js} +53 -57
- package/lib/orchestrate/facade/createAutoBeFacadeController.js.map +1 -0
- package/lib/orchestrate/facade/histories/IAutoBeFacadeApplication.js.map +1 -0
- package/lib/orchestrate/facade/histories/IAutoBeFacadeApplicationProps.js.map +1 -0
- package/lib/orchestrate/facade/histories/IAutoBeFacadeApplicationResult.js.map +1 -0
- package/lib/orchestrate/facade/{transformFacadeStateMessage.d.ts → structures/transformFacadeStateMessage.d.ts} +1 -1
- package/lib/orchestrate/facade/structures/transformFacadeStateMessage.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +3 -2
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +15 -8
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +136 -48
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +234 -59
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +3 -2
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +0 -6
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +2 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +137 -49
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +136 -48
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +2 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +2 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.d.ts +5 -3
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js +241 -69
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +234 -59
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +23 -23
- package/lib/orchestrate/prisma/orchestratePrisma.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.js +1 -0
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +2 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +2 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaReview.js +2 -1
- package/lib/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +2 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +2 -2
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.d.ts +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.js +2 -1
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +2 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +3 -2
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +3 -2
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js +6 -5
- package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js +2 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/orchestrate/realize/utils/replaceImportStatements.js +0 -85
- package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTest.d.ts +1 -1
- package/lib/orchestrate/test/orchestrateTest.js +2 -1
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +3 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +3 -2
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +2 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js +2 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +2 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/utils/TokenUsageComputer.d.ts +5 -0
- package/lib/utils/TokenUsageComputer.js +29 -0
- package/lib/utils/TokenUsageComputer.js.map +1 -0
- package/package.json +7 -7
- package/src/AutoBeAgent.ts +40 -6
- package/src/AutoBeMockAgent.ts +2 -4
- package/src/constants/AutoBeSystemPromptConstant.ts +10 -10
- package/src/context/AutoBeContext.ts +8 -0
- package/src/context/AutoBeTokenUsage.ts +1 -1
- package/src/factory/AutoBeFunctionCallingMetricFactory.ts +44 -0
- package/src/factory/AutoBeProcessAggregateFactory.ts +141 -0
- package/src/factory/createAutoBeContext.ts +96 -36
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +1 -0
- package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +2 -1
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +2 -1
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +3 -2
- package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +5 -2
- package/src/orchestrate/facade/createAutoBeFacadeController.ts +135 -0
- package/src/orchestrate/facade/{transformFacadeStateMessage.ts → structures/transformFacadeStateMessage.ts} +2 -2
- package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +1 -0
- package/src/orchestrate/interface/orchestrateInterface.ts +17 -6
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +2 -1
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +2 -1
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +3 -2
- package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +3 -4
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +2 -1
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +2 -1
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +2 -1
- package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +2 -1
- package/src/orchestrate/interface/orchestrateInterfaceSchemaRename.ts +2 -1
- package/src/orchestrate/interface/orchestrateInterfaceSchemaReview.ts +10 -15
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +2 -1
- package/src/orchestrate/prisma/orchestratePrisma.ts +2 -1
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +2 -1
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +2 -1
- package/src/orchestrate/prisma/orchestratePrismaReview.ts +2 -1
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +2 -1
- package/src/orchestrate/realize/orchestrateRealize.ts +3 -2
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +2 -1
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +2 -1
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +3 -2
- package/src/orchestrate/realize/orchestrateRealizeCorrectCasting.ts +6 -5
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +2 -1
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +0 -90
- package/src/orchestrate/test/orchestrateTest.ts +3 -2
- package/src/orchestrate/test/orchestrateTestCorrect.ts +3 -1
- package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +3 -2
- package/src/orchestrate/test/orchestrateTestScenario.ts +2 -1
- package/src/orchestrate/test/orchestrateTestScenarioReview.ts +2 -1
- package/src/orchestrate/test/orchestrateTestWrite.ts +2 -1
- package/src/utils/TokenUsageComputer.ts +35 -0
- package/lib/context/IAutoBeFacadeApplication.js.map +0 -1
- package/lib/context/IAutoBeFacadeApplicationProps.js.map +0 -1
- package/lib/context/IAutoBeFacadeApplicationResult.js.map +0 -1
- package/lib/factory/createAutoBeApplication.js.map +0 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +0 -1
- package/src/factory/createAutoBeApplication.ts +0 -123
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.d.ts +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.js +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.d.ts +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.js +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.d.ts +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.js +0 -0
- /package/lib/orchestrate/facade/{transformFacadeStateMessage.js → structures/transformFacadeStateMessage.js} +0 -0
- /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.ts +0 -0
- /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.ts +0 -0
- /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.ts +0 -0
|
@@ -214,7 +214,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
214
214
|
};
|
|
215
215
|
|
|
216
216
|
const dto = await getRealizeWriteDto(ctx, props.scenario.operation);
|
|
217
|
-
const { tokenUsage } = await ctx.conversate({
|
|
217
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
218
218
|
source: "realizeCorrect",
|
|
219
219
|
controller: createController({
|
|
220
220
|
model: ctx.model,
|
|
@@ -239,7 +239,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
239
239
|
When modifying, modify the entire code, but not the import statement.
|
|
240
240
|
|
|
241
241
|
Below is template code you wrote:
|
|
242
|
-
|
|
242
|
+
|
|
243
243
|
${getRealizeWriteCodeTemplate({
|
|
244
244
|
scenario: props.scenario,
|
|
245
245
|
schemas: ctx.state().interface!.document.components.schemas,
|
|
@@ -278,6 +278,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
278
278
|
id: v7(),
|
|
279
279
|
location: props.scenario.location,
|
|
280
280
|
content: pointer.value.revise.final ?? pointer.value.draft,
|
|
281
|
+
metric,
|
|
281
282
|
tokenUsage,
|
|
282
283
|
completed: ++props.progress.completed,
|
|
283
284
|
total: props.progress.total,
|
|
@@ -133,7 +133,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
133
133
|
> = {
|
|
134
134
|
value: null,
|
|
135
135
|
};
|
|
136
|
-
const { tokenUsage } = await ctx.conversate({
|
|
136
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
137
137
|
source: "realizeCorrect",
|
|
138
138
|
histories: transformRealizeCorrectCastingHistories({
|
|
139
139
|
failures: [
|
|
@@ -165,13 +165,13 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
165
165
|
message: StringUtil.trim`
|
|
166
166
|
Fix the TypeScript casting problems to resolve the compilation error.
|
|
167
167
|
|
|
168
|
-
Most casting errors are caused by type mismatches between Date types and
|
|
168
|
+
Most casting errors are caused by type mismatches between Date types and
|
|
169
169
|
string & tags.Format<'date-time'>. To fix these:
|
|
170
170
|
- Use ONLY the pre-provided toISOStringSafe() function to convert Date to string
|
|
171
171
|
- Do NOT use .toISOString() method directly (use toISOStringSafe instead)
|
|
172
172
|
- Never use Date type directly in declarations or return values
|
|
173
173
|
|
|
174
|
-
You don't need to explain me anything, but just fix or give it up
|
|
174
|
+
You don't need to explain me anything, but just fix or give it up
|
|
175
175
|
immediately without any hesitation, explanation, and questions.
|
|
176
176
|
|
|
177
177
|
The instruction to write at first was as follows, and the code you received is the code you wrote according to this instruction.
|
|
@@ -195,10 +195,10 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
195
195
|
Also, never use typia.assert and typia.assertGuard like functions
|
|
196
196
|
to the Prisma types. Your mission is to fix the casting problem of
|
|
197
197
|
primitive types like string or number. Prisma type is not your scope.
|
|
198
|
-
|
|
198
|
+
|
|
199
199
|
If you take a mistake that casting the Prisma type with the typia.assert
|
|
200
200
|
function, it would be fallen into the infinite compilation due to extremely
|
|
201
|
-
complicated Prisma type. Note that, the typia.assert function is allowed
|
|
201
|
+
complicated Prisma type. Note that, the typia.assert function is allowed
|
|
202
202
|
only in the individual property level string or literal type.
|
|
203
203
|
|
|
204
204
|
I repeat that, never assert the Prisma type. It's not your mission.
|
|
@@ -233,6 +233,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
233
233
|
created_at: new Date().toISOString(),
|
|
234
234
|
location: func.location,
|
|
235
235
|
step: ctx.state().analyze?.step ?? 0,
|
|
236
|
+
metric,
|
|
236
237
|
tokenUsage,
|
|
237
238
|
completed: props.progress.completed,
|
|
238
239
|
total: props.progress.total,
|
|
@@ -40,7 +40,7 @@ export async function orchestrateRealizeWrite<Model extends ILlmSchema.Model>(
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
const dto = await getRealizeWriteDto(ctx, props.scenario.operation);
|
|
43
|
-
const { tokenUsage } = await ctx.conversate({
|
|
43
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
44
44
|
source: "realizeWrite",
|
|
45
45
|
histories: transformRealizeWriteHistories({
|
|
46
46
|
state: ctx.state(),
|
|
@@ -97,6 +97,7 @@ export async function orchestrateRealizeWrite<Model extends ILlmSchema.Model>(
|
|
|
97
97
|
id: v7(),
|
|
98
98
|
location: props.scenario.location,
|
|
99
99
|
content: pointer.value.revise.final ?? pointer.value.draft,
|
|
100
|
+
metric,
|
|
100
101
|
tokenUsage,
|
|
101
102
|
completed: ++props.progress.completed,
|
|
102
103
|
total: props.progress.total,
|
|
@@ -4,96 +4,6 @@ import { ILlmSchema } from "@samchon/openapi";
|
|
|
4
4
|
import { AutoBeContext } from "../../../context/AutoBeContext";
|
|
5
5
|
import { getRealizeWriteImportStatements } from "./getRealizeWriteImportStatements";
|
|
6
6
|
|
|
7
|
-
// /**
|
|
8
|
-
// * Removes all import statements that LLM might have incorrectly added. This
|
|
9
|
-
// * includes standard library imports, auto-injected imports, and any API
|
|
10
|
-
// * structure imports with wrong paths.
|
|
11
|
-
// *
|
|
12
|
-
// * @param code - The code containing imports to remove
|
|
13
|
-
// * @param typeReferences - List of type names to specifically remove
|
|
14
|
-
// * @param decoratorType - Optional decorator type to remove
|
|
15
|
-
// * @returns Code with all imports removed
|
|
16
|
-
// */
|
|
17
|
-
// function removeAllImports(
|
|
18
|
-
// code: string,
|
|
19
|
-
// typeReferences: string[],
|
|
20
|
-
// decoratorType?: string,
|
|
21
|
-
// ): string {
|
|
22
|
-
// // Remove standard library and auto-injected imports
|
|
23
|
-
// let cleanedCode = code
|
|
24
|
-
// // MyGlobal - often with wrong path
|
|
25
|
-
// .replace(
|
|
26
|
-
// /import\s*{\s*MyGlobal\s*}\s*from\s*["']\.\.\/MyGlobal["']\s*;?\s*/gm,
|
|
27
|
-
// "",
|
|
28
|
-
// )
|
|
29
|
-
// // typia - various import patterns
|
|
30
|
-
// .replace(
|
|
31
|
-
// /import\s+typia\s*,\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm,
|
|
32
|
-
// "",
|
|
33
|
-
// )
|
|
34
|
-
// .replace(/import\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm, "")
|
|
35
|
-
// .replace(
|
|
36
|
-
// /import\s*{\s*tags\s*,\s*typia\s*}\s*from\s*["']typia["']\s*;?\s*/gm,
|
|
37
|
-
// "",
|
|
38
|
-
// )
|
|
39
|
-
// .replace(/import\s+typia\s*from\s*["']typia["']\s*;?\s*/gm, "")
|
|
40
|
-
// // Prisma client
|
|
41
|
-
// .replace(
|
|
42
|
-
// /import\s*{\s*Prisma\s*}\s*from\s*["']@prisma\/client["']\s*;?\s*/gm,
|
|
43
|
-
// "",
|
|
44
|
-
// )
|
|
45
|
-
// // uuid
|
|
46
|
-
// .replace(/import\s*{\s*v4\s*}\s*from\s*["']uuid["']\s*;?\s*/gm, "")
|
|
47
|
-
// // toISOStringSafe utility
|
|
48
|
-
// .replace(
|
|
49
|
-
// /import\s*{\s*toISOStringSafe\s*}\s*from\s*["']\.\.\/utils\/toISOStringSafe["']\s*;?\s*/gm,
|
|
50
|
-
// "",
|
|
51
|
-
// )
|
|
52
|
-
// // JWT imports (if LLM adds them)
|
|
53
|
-
// .replace(/import\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm, "")
|
|
54
|
-
// .replace(
|
|
55
|
-
// /import\s*\*\s*as\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm,
|
|
56
|
-
// "",
|
|
57
|
-
// )
|
|
58
|
-
// // NestJS HttpException
|
|
59
|
-
// .replace(
|
|
60
|
-
// /import\s*{\s*HttpException\s*}\s*from\s*["']@nestjs\/common["']\s*;?\s*/gm,
|
|
61
|
-
// "",
|
|
62
|
-
// );
|
|
63
|
-
|
|
64
|
-
// // Remove API structure imports with wrong paths
|
|
65
|
-
// // Pattern 1: ../api/structures path (LLM often uses this wrong path)
|
|
66
|
-
// cleanedCode = cleanedCode.replace(
|
|
67
|
-
// /import\s*(?:type\s*)?{\s*[^}]+\s*}\s*from\s*["']\.\.\/api\/structures\/[^"']+["']\s*;?\s*/gm,
|
|
68
|
-
// "",
|
|
69
|
-
// );
|
|
70
|
-
// // Pattern 2: @ORGANIZATION/PROJECT-api path (correct path but LLM shouldn't write it)
|
|
71
|
-
// cleanedCode = cleanedCode.replace(
|
|
72
|
-
// /import\s*(?:type\s*)?{\s*[^}]+\s*}\s*from\s*["']@ORGANIZATION\/PROJECT-api\/lib\/structures\/[^"']+["']\s*;?\s*/gm,
|
|
73
|
-
// "",
|
|
74
|
-
// );
|
|
75
|
-
|
|
76
|
-
// // Remove specific type imports that match our typeReferences
|
|
77
|
-
// for (const ref of typeReferences) {
|
|
78
|
-
// const typeImportRegex = new RegExp(
|
|
79
|
-
// `import\\s*(?:type\\s*)?{\\s*${ref}\\s*}\\s*from\\s*["'][^"']+["']\\s*;?\\s*`,
|
|
80
|
-
// "gm",
|
|
81
|
-
// );
|
|
82
|
-
// cleanedCode = cleanedCode.replace(typeImportRegex, "");
|
|
83
|
-
// }
|
|
84
|
-
|
|
85
|
-
// // Remove decorator type imports if LLM mistakenly added them
|
|
86
|
-
// if (decoratorType) {
|
|
87
|
-
// const decoratorTypeRegex = new RegExp(
|
|
88
|
-
// `import\\s*(?:type\\s*)?{\\s*${decoratorType}\\s*}\\s*from\\s*["']\\.\\.\/decorators\/payload\/${decoratorType}["']\\s*;?\\s*`,
|
|
89
|
-
// "gm",
|
|
90
|
-
// );
|
|
91
|
-
// cleanedCode = cleanedCode.replace(decoratorTypeRegex, "");
|
|
92
|
-
// }
|
|
93
|
-
|
|
94
|
-
// return cleanedCode;
|
|
95
|
-
// }
|
|
96
|
-
|
|
97
7
|
export async function replaceImportStatements<Model extends ILlmSchema.Model>(
|
|
98
8
|
ctx: AutoBeContext<Model>,
|
|
99
9
|
props: {
|
|
@@ -11,8 +11,8 @@ import { ILlmSchema } from "@samchon/openapi";
|
|
|
11
11
|
import { v7 } from "uuid";
|
|
12
12
|
|
|
13
13
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
14
|
-
import { IAutoBeFacadeApplicationProps } from "../../context/IAutoBeFacadeApplicationProps";
|
|
15
14
|
import { predicateStateMessage } from "../../utils/predicateStateMessage";
|
|
15
|
+
import { IAutoBeFacadeApplicationProps } from "../facade/histories/IAutoBeFacadeApplicationProps";
|
|
16
16
|
import { orchestrateTestCorrect } from "./orchestrateTestCorrect";
|
|
17
17
|
import { orchestrateTestScenario } from "./orchestrateTestScenario";
|
|
18
18
|
import { orchestrateTestWrite } from "./orchestrateTestWrite";
|
|
@@ -101,10 +101,11 @@ export const orchestrateTest =
|
|
|
101
101
|
return ctx.dispatch({
|
|
102
102
|
type: "testComplete",
|
|
103
103
|
id: v7(),
|
|
104
|
-
created_at: new Date().toISOString(),
|
|
105
104
|
files: corrects.map((s) => s.file),
|
|
106
105
|
compiled: compileResult,
|
|
106
|
+
aggregates: ctx.getCurrentAggregates("test"),
|
|
107
107
|
step: ctx.state().interface?.step ?? 0,
|
|
108
108
|
elapsed: new Date().getTime() - start.getTime(),
|
|
109
|
+
created_at: new Date().toISOString(),
|
|
109
110
|
});
|
|
110
111
|
};
|
|
@@ -61,6 +61,7 @@ export const orchestrateTestCorrect = async <Model extends ILlmSchema.Model>(
|
|
|
61
61
|
},
|
|
62
62
|
result: next.failure,
|
|
63
63
|
tokenUsage: next.tokenUsage,
|
|
64
|
+
metric: next.metric,
|
|
64
65
|
think: next.think,
|
|
65
66
|
draft: next.draft,
|
|
66
67
|
review: next.review,
|
|
@@ -151,7 +152,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
151
152
|
const pointer: IPointer<IAutoBeTestCorrectApplication.IProps | null> = {
|
|
152
153
|
value: null,
|
|
153
154
|
};
|
|
154
|
-
const { tokenUsage } = await ctx.conversate({
|
|
155
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
155
156
|
source: "testCorrect",
|
|
156
157
|
histories: await transformTestCorrectHistories(ctx, {
|
|
157
158
|
instruction: props.instruction,
|
|
@@ -202,6 +203,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
202
203
|
created_at: new Date().toISOString(),
|
|
203
204
|
file: props.validate.file,
|
|
204
205
|
result: props.validate.result,
|
|
206
|
+
metric,
|
|
205
207
|
tokenUsage,
|
|
206
208
|
step: ctx.state().analyze?.step ?? 0,
|
|
207
209
|
think: pointer.value.think,
|
|
@@ -63,7 +63,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
63
63
|
> = {
|
|
64
64
|
value: null,
|
|
65
65
|
};
|
|
66
|
-
const { tokenUsage } = await ctx.conversate({
|
|
66
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
67
67
|
source: "testCorrect",
|
|
68
68
|
histories: await transformTestCorrectInvalidRequestHistories(
|
|
69
69
|
null!,
|
|
@@ -83,7 +83,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
83
83
|
message: StringUtil.trim`
|
|
84
84
|
Fix the AutoBeTest.IFunction data to resolve the compilation error.
|
|
85
85
|
|
|
86
|
-
You don't need to explain me anything, but just fix or give it up
|
|
86
|
+
You don't need to explain me anything, but just fix or give it up
|
|
87
87
|
immediately without any hesitation, explanation, and questions.
|
|
88
88
|
`,
|
|
89
89
|
});
|
|
@@ -112,6 +112,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
112
112
|
content: write.script,
|
|
113
113
|
},
|
|
114
114
|
result: event.result,
|
|
115
|
+
metric,
|
|
115
116
|
tokenUsage,
|
|
116
117
|
step: ctx.state().analyze?.step ?? 0,
|
|
117
118
|
think: pointer.value.think,
|
|
@@ -147,7 +147,7 @@ const divideAndConquer = async <Model extends ILlmSchema.Model>(
|
|
|
147
147
|
ctx.state().interface?.authorizations ?? [];
|
|
148
148
|
|
|
149
149
|
try {
|
|
150
|
-
const { tokenUsage } = await ctx.conversate({
|
|
150
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
151
151
|
source: "testScenario",
|
|
152
152
|
histories: transformTestScenarioHistories({
|
|
153
153
|
state: ctx.state(),
|
|
@@ -184,6 +184,7 @@ const divideAndConquer = async <Model extends ILlmSchema.Model>(
|
|
|
184
184
|
ctx.dispatch({
|
|
185
185
|
type: "testScenario",
|
|
186
186
|
id: v7(),
|
|
187
|
+
metric,
|
|
187
188
|
tokenUsage,
|
|
188
189
|
scenarios: pointer.value
|
|
189
190
|
.map((v) =>
|
|
@@ -42,7 +42,7 @@ async function review<Model extends ILlmSchema.Model>(
|
|
|
42
42
|
{
|
|
43
43
|
value: null,
|
|
44
44
|
};
|
|
45
|
-
const { tokenUsage } = await ctx.conversate({
|
|
45
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
46
46
|
source: "testScenarioReview",
|
|
47
47
|
controller: createController({
|
|
48
48
|
model: ctx.model,
|
|
@@ -70,6 +70,7 @@ async function review<Model extends ILlmSchema.Model>(
|
|
|
70
70
|
ctx.dispatch({
|
|
71
71
|
type: "testScenarioReview",
|
|
72
72
|
id: v7(),
|
|
73
|
+
metric,
|
|
73
74
|
tokenUsage,
|
|
74
75
|
total: props.progress.total,
|
|
75
76
|
completed: props.progress.completed,
|
|
@@ -77,7 +77,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
77
77
|
const pointer: IPointer<IAutoBeTestWriteApplication.IProps | null> = {
|
|
78
78
|
value: null,
|
|
79
79
|
};
|
|
80
|
-
const { tokenUsage } = await ctx.conversate({
|
|
80
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
81
81
|
source: "testWrite",
|
|
82
82
|
histories: await transformTestWriteHistories(ctx, {
|
|
83
83
|
scenario,
|
|
@@ -122,6 +122,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
122
122
|
draft: pointer.value.draft,
|
|
123
123
|
review: pointer.value.revise?.review,
|
|
124
124
|
final: pointer.value.revise?.final ?? undefined,
|
|
125
|
+
metric,
|
|
125
126
|
tokenUsage,
|
|
126
127
|
completed: ++progress.completed,
|
|
127
128
|
total: progress.total,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IAutoBeTokenUsageJson } from "@autobe/interface";
|
|
2
|
+
|
|
3
|
+
export namespace TokenUsageComputer {
|
|
4
|
+
export const plus = (
|
|
5
|
+
x: IAutoBeTokenUsageJson.IComponent,
|
|
6
|
+
y: IAutoBeTokenUsageJson.IComponent,
|
|
7
|
+
): IAutoBeTokenUsageJson.IComponent => ({
|
|
8
|
+
total: x.total + y.total,
|
|
9
|
+
input: {
|
|
10
|
+
total: x.input.total + y.input.total,
|
|
11
|
+
cached: x.input.cached + y.input.cached,
|
|
12
|
+
},
|
|
13
|
+
output: {
|
|
14
|
+
total: x.output.total + y.output.total,
|
|
15
|
+
reasoning: x.output.reasoning + y.output.reasoning,
|
|
16
|
+
accepted_prediction:
|
|
17
|
+
x.output.accepted_prediction + y.output.accepted_prediction,
|
|
18
|
+
rejected_prediction:
|
|
19
|
+
x.output.rejected_prediction + y.output.rejected_prediction,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const increment = (
|
|
24
|
+
x: IAutoBeTokenUsageJson.IComponent,
|
|
25
|
+
y: IAutoBeTokenUsageJson.IComponent,
|
|
26
|
+
): void => {
|
|
27
|
+
x.total += y.total;
|
|
28
|
+
x.input.total += y.input.total;
|
|
29
|
+
x.input.cached += y.input.cached;
|
|
30
|
+
x.output.total += y.output.total;
|
|
31
|
+
x.output.reasoning += y.output.reasoning;
|
|
32
|
+
x.output.accepted_prediction += y.output.accepted_prediction;
|
|
33
|
+
x.output.rejected_prediction += y.output.rejected_prediction;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IAutoBeFacadeApplication.js","sourceRoot":"","sources":["../../src/context/IAutoBeFacadeApplication.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IAutoBeFacadeApplicationProps.js","sourceRoot":"","sources":["../../src/context/IAutoBeFacadeApplicationProps.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IAutoBeFacadeApplicationResult.js","sourceRoot":"","sources":["../../src/context/IAutoBeFacadeApplicationResult.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createAutoBeApplication.js","sourceR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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA8D;IACrE,MAAM;IACN,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;CACd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transformFacadeStateMessage.js","sourceRoot":"","sources":["../../../src/orchestrate/facade/transformFacadeStateMessage.ts"],"names":[],"mappings":";;AAKA,kEA0BC;AA/BD,yCAA2C;AAK3C,SAAgB,2BAA2B,CAAC,KAAkB;IAC5D,MAAM,YAAY,GAAkB,eAAe,CAAC,KAAK,CAAC,CAAC;IAC3D,OAAO,s8iBAAkC,OAAO,CAC9C,aAAa,EACb,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;mBAeA,YAAY,CAAC,OAAO;kBACrB,YAAY,CAAC,MAAM;qBAChB,YAAY,CAAC,SAAS;gBAC3B,YAAY,CAAC,IAAI;mBACd,YAAY,CAAC,OAAO;KAClC,CACF,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,KAAkB;IACzC,MAAM,KAAK,GAAG,CACZ,GAEQ,EACR,EAAE;QACF,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,MAAM,CAAC;aACrD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI;YAAE,OAAO,YAAY,CAAC;;YACzD,OAAO,aAAa,CAAC;IAC5B,CAAC,CAAC;IACF,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY;QACvD,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;QAC3B,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC;QACvB,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC;KAC9B,CAAC;AACJ,CAAC"}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { IAgenticaController } from "@agentica/core";
|
|
2
|
-
import { StringUtil } from "@autobe/utils";
|
|
3
|
-
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
4
|
-
import typia from "typia";
|
|
5
|
-
|
|
6
|
-
import { AutoBeContext } from "../context/AutoBeContext";
|
|
7
|
-
import { IAutoBeFacadeApplication } from "../context/IAutoBeFacadeApplication";
|
|
8
|
-
import { assertSchemaModel } from "../context/assertSchemaModel";
|
|
9
|
-
import { orchestrateAnalyze } from "../orchestrate/analyze/orchestrateAnalyze";
|
|
10
|
-
import { orchestrateInterface } from "../orchestrate/interface/orchestrateInterface";
|
|
11
|
-
import { orchestratePrisma } from "../orchestrate/prisma/orchestratePrisma";
|
|
12
|
-
import { orchestrateRealize } from "../orchestrate/realize/orchestrateRealize";
|
|
13
|
-
import { orchestrateTest } from "../orchestrate/test/orchestrateTest";
|
|
14
|
-
|
|
15
|
-
export const createAutoBeController = <Model extends ILlmSchema.Model>(props: {
|
|
16
|
-
model: Model;
|
|
17
|
-
context: AutoBeContext<Model>;
|
|
18
|
-
}): IAgenticaController.IClass<Model> => {
|
|
19
|
-
assertSchemaModel(props.model);
|
|
20
|
-
const application: ILlmApplication<Model> = collection[
|
|
21
|
-
props.model
|
|
22
|
-
] satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
|
|
23
|
-
return {
|
|
24
|
-
protocol: "class",
|
|
25
|
-
name: "autobe",
|
|
26
|
-
application,
|
|
27
|
-
execute: {
|
|
28
|
-
analyze: async () => {
|
|
29
|
-
const r = await orchestrateAnalyze(props.context);
|
|
30
|
-
if (r.type === "analyze")
|
|
31
|
-
return {
|
|
32
|
-
type: "success",
|
|
33
|
-
description:
|
|
34
|
-
"Analysis completed successfully, and report has been published.",
|
|
35
|
-
};
|
|
36
|
-
else
|
|
37
|
-
return {
|
|
38
|
-
type: "in-progress",
|
|
39
|
-
description: StringUtil.trim`
|
|
40
|
-
Requirements are not yet fully elicited,
|
|
41
|
-
therefore additional questions will be made to the user.
|
|
42
|
-
`,
|
|
43
|
-
};
|
|
44
|
-
},
|
|
45
|
-
prisma: async (next) => {
|
|
46
|
-
const r = await orchestratePrisma(props.context, next);
|
|
47
|
-
if (r.type === "prisma")
|
|
48
|
-
return {
|
|
49
|
-
type: r.compiled.type,
|
|
50
|
-
description:
|
|
51
|
-
r.compiled.type === "success"
|
|
52
|
-
? "Prisma schemas have been generated successfully."
|
|
53
|
-
: r.result.success === false || r.compiled.type === "failure"
|
|
54
|
-
? "Prisma schemas are generated, but compilation failed."
|
|
55
|
-
: "Unexpected error occurred while generating Prisma schemas.",
|
|
56
|
-
};
|
|
57
|
-
else
|
|
58
|
-
return {
|
|
59
|
-
type: "prerequisites-not-satisfied",
|
|
60
|
-
description: "Requirement analysis is not yet completed.",
|
|
61
|
-
};
|
|
62
|
-
},
|
|
63
|
-
interface: async (next) => {
|
|
64
|
-
const r = await orchestrateInterface(props.context)(next);
|
|
65
|
-
if (r.type === "interface")
|
|
66
|
-
return {
|
|
67
|
-
type: "success",
|
|
68
|
-
description: "API interfaces have been designed successfully.",
|
|
69
|
-
};
|
|
70
|
-
else
|
|
71
|
-
return {
|
|
72
|
-
type: "prerequisites-not-satisfied",
|
|
73
|
-
description: "Prisma schemas are not yet completed.",
|
|
74
|
-
};
|
|
75
|
-
},
|
|
76
|
-
test: async (next) => {
|
|
77
|
-
const r = await orchestrateTest(props.context)(next);
|
|
78
|
-
if (r.type === "test")
|
|
79
|
-
return {
|
|
80
|
-
type: r.compiled.type,
|
|
81
|
-
description:
|
|
82
|
-
r.compiled.type === "success"
|
|
83
|
-
? "Test functions have been generated successfully."
|
|
84
|
-
: r.compiled.type === "failure"
|
|
85
|
-
? "Test functions are written, but compilation failed."
|
|
86
|
-
: "Unexpected error occurred while writing test functions.",
|
|
87
|
-
};
|
|
88
|
-
else
|
|
89
|
-
return {
|
|
90
|
-
type: "prerequisites-not-satisfied",
|
|
91
|
-
description: "API interfaces are not yet completed.",
|
|
92
|
-
};
|
|
93
|
-
},
|
|
94
|
-
realize: async (next) => {
|
|
95
|
-
const r = await orchestrateRealize(props.context)(next);
|
|
96
|
-
if (r.type === "realize")
|
|
97
|
-
return {
|
|
98
|
-
type: r.compiled.type,
|
|
99
|
-
description:
|
|
100
|
-
r.compiled.type === "success"
|
|
101
|
-
? "API implementation codes have been generated successfully."
|
|
102
|
-
: r.compiled.type === "failure"
|
|
103
|
-
? "Implementation codes are composed, but compilation failed."
|
|
104
|
-
: "Unexpected error occurred while writing implementation codes.",
|
|
105
|
-
};
|
|
106
|
-
else
|
|
107
|
-
return {
|
|
108
|
-
type: "prerequisites-not-satisfied",
|
|
109
|
-
description: "API interfaces are not yet completed.",
|
|
110
|
-
};
|
|
111
|
-
},
|
|
112
|
-
} satisfies IAutoBeFacadeApplication,
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const claude = typia.llm.application<IAutoBeFacadeApplication, "claude">();
|
|
117
|
-
const collection = {
|
|
118
|
-
chatgpt: typia.llm.application<IAutoBeFacadeApplication, "chatgpt">(),
|
|
119
|
-
claude,
|
|
120
|
-
llama: claude,
|
|
121
|
-
deepseek: claude,
|
|
122
|
-
"3.1": claude,
|
|
123
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|