@autobe/agent 0.15.1 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -21
- package/lib/AutoBeAgent.js +2 -2
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/AutoBeMockAgent.d.ts +1 -0
- package/lib/AutoBeMockAgent.js +18 -4
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +3 -3
- package/lib/factory/getAutoBeGenerated.js +2 -1
- package/lib/factory/getAutoBeGenerated.js.map +1 -1
- package/lib/index.mjs +739 -577
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.d.ts +0 -15
- package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.js +0 -3
- package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +19 -12
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeComposer.d.ts +1 -2
- package/lib/orchestrate/analyze/orchestrateAnalyzeComposer.js +3 -5
- package/lib/orchestrate/analyze/orchestrateAnalyzeComposer.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.d.ts +7 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js +363 -4
- package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +3 -3
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +3 -118
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.js +1 -1
- package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.js.map +1 -1
- package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.d.ts +11 -4
- package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.js +61 -45
- package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +17 -10
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/realize/ProviderCodeComparator.d.ts +5 -0
- package/lib/orchestrate/realize/ProviderCodeComparator.js +16 -0
- package/lib/orchestrate/realize/ProviderCodeComparator.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealize.js +41 -53
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +13 -87
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +32 -43
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCoder.d.ts +3 -2
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js +25 -39
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +15 -15
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +11 -17
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +4 -2
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.d.ts +21 -17
- package/lib/orchestrate/realize/transformRealizeAuthorization.js +5 -9
- package/lib/orchestrate/realize/transformRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/transformRealizeAuthorizationCorrectHistories.js +9 -0
- package/lib/orchestrate/realize/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/transformRealizeCoderHistories.d.ts +3 -2
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js +58 -27
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js.map +1 -1
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationFileSystem.d.ts +5 -0
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationFileSystem.js +10 -0
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationFileSystem.js.map +1 -0
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.d.ts +4 -0
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js +38 -0
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js.map +1 -0
- package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +2 -1
- package/lib/orchestrate/realize/utils/replaceImportStatements.js +15 -2
- package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/orchestrate/realize/writeCodeUntilCompilePassed.d.ts +9 -2
- package/lib/orchestrate/realize/writeCodeUntilCompilePassed.js +158 -100
- package/lib/orchestrate/realize/writeCodeUntilCompilePassed.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTest.js +1 -1
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/package.json +7 -7
- package/src/AutoBeAgent.ts +1 -1
- package/src/AutoBeMockAgent.ts +20 -6
- package/src/constants/AutoBeSystemPromptConstant.ts +3 -3
- package/src/factory/getAutoBeGenerated.ts +2 -1
- package/src/orchestrate/analyze/AutoBeAnalyzeFileSystem.ts +0 -15
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +17 -17
- package/src/orchestrate/analyze/orchestrateAnalyzeComposer.ts +4 -7
- package/src/orchestrate/analyze/orchestrateAnalyzeReviewer.ts +100 -6
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +5 -21
- package/src/orchestrate/analyze/writeDocumentUntilReviewPassed.ts +76 -59
- package/src/orchestrate/prisma/transformPrismaComponentsHistories.ts +17 -10
- package/src/orchestrate/realize/ProviderCodeComparator.ts +15 -0
- package/src/orchestrate/realize/orchestrateRealize.ts +54 -59
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +12 -120
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +21 -5
- package/src/orchestrate/realize/orchestrateRealizeCoder.ts +10 -9
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +15 -15
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +11 -18
- package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +4 -2
- package/src/orchestrate/realize/structures/IAutoBeRealizeCompile.ts +24 -17
- package/src/orchestrate/realize/transformRealizeAuthorization.ts +5 -9
- package/src/orchestrate/realize/transformRealizeAuthorizationCorrectHistories.ts +9 -0
- package/src/orchestrate/realize/transformRealizeCoderHistories.ts +73 -25
- package/src/orchestrate/realize/utils/AutoBeRealizeAuthorizationFileSystem.ts +9 -0
- package/src/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.ts +64 -0
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +41 -2
- package/src/orchestrate/realize/writeCodeUntilCompilePassed.ts +219 -145
- package/src/orchestrate/test/orchestrateTest.ts +1 -1
|
@@ -5,115 +5,158 @@ import {
|
|
|
5
5
|
IAutoBeTypeScriptCompileResult,
|
|
6
6
|
} from "@autobe/interface";
|
|
7
7
|
import { ILlmSchema } from "@samchon/openapi";
|
|
8
|
+
import { HashMap } from "tstl";
|
|
8
9
|
|
|
9
10
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
10
|
-
import {
|
|
11
|
+
import { ProviderCodeComparator } from "./ProviderCodeComparator";
|
|
11
12
|
import { pipe } from "./RealizePipe";
|
|
12
13
|
import { orchestrateRealizeCoder } from "./orchestrateRealizeCoder";
|
|
13
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
RealizePlannerOutput,
|
|
16
|
+
orchestrateRealizePlanner,
|
|
17
|
+
} from "./orchestrateRealizePlanner";
|
|
14
18
|
import { IAutoBeRealizeCompile } from "./structures/IAutoBeRealizeCompile";
|
|
15
19
|
import { FAILED } from "./structures/IAutoBeRealizeFailedSymbol";
|
|
16
20
|
import { RealizeFileSystem } from "./utils/ProviderFileSystem";
|
|
17
21
|
|
|
18
|
-
export
|
|
19
|
-
Model extends ILlmSchema.Model,
|
|
20
|
-
>(
|
|
22
|
+
export function writeCodeUntilCompilePassed<Model extends ILlmSchema.Model>(
|
|
21
23
|
ctx: AutoBeContext<Model>,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
) {
|
|
25
|
+
return async function (props: {
|
|
26
|
+
operations: AutoBeOpenApi.IOperation[];
|
|
27
|
+
authorizations: AutoBeRealizeAuthorization[];
|
|
28
|
+
retry: number;
|
|
29
|
+
}): Promise<{
|
|
30
|
+
compiled: IAutoBeTypeScriptCompileResult;
|
|
31
|
+
functions: AutoBeRealizeFunction[];
|
|
32
|
+
}> {
|
|
33
|
+
const payloads: Record<string, string> = Object.fromEntries(
|
|
34
|
+
props.authorizations.map((el) => [
|
|
35
|
+
el.payload.location,
|
|
36
|
+
el.payload.content,
|
|
37
|
+
]),
|
|
38
|
+
);
|
|
31
39
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
const files: Record<string, string> = Object.fromEntries(
|
|
41
|
+
Object.entries(await ctx.files({ dbms: "postgres" })).filter(([key]) =>
|
|
42
|
+
key.startsWith("src"),
|
|
43
|
+
),
|
|
44
|
+
);
|
|
37
45
|
|
|
38
|
-
|
|
39
|
-
...(await loadTemplateFiles(ctx)),
|
|
40
|
-
};
|
|
46
|
+
const templateFiles = await getTemplates(ctx);
|
|
41
47
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
for (let i = 0; i < retry; i++) {
|
|
48
|
-
const targets = ops.filter((op) =>
|
|
49
|
-
shouldProcessOperation(op, diagnostics.current),
|
|
50
|
-
);
|
|
48
|
+
let diagnostics: IAutoBeRealizeCompile.CompileDiagnostics = {
|
|
49
|
+
current: [],
|
|
50
|
+
total: [],
|
|
51
|
+
};
|
|
51
52
|
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const role = op.authorizationRole;
|
|
59
|
-
const decorator = authorizations.find((el) => el.role === role);
|
|
60
|
-
|
|
61
|
-
return process(ctx, metadata, op, diagnostics, entireCodes, decorator);
|
|
62
|
-
}),
|
|
53
|
+
const histories: HashMap<
|
|
54
|
+
AutoBeOpenApi.IEndpoint,
|
|
55
|
+
IAutoBeRealizeCompile.Success[]
|
|
56
|
+
> = new HashMap(
|
|
57
|
+
ProviderCodeComparator.hashCode,
|
|
58
|
+
ProviderCodeComparator.equals,
|
|
63
59
|
);
|
|
64
60
|
|
|
65
|
-
for (const
|
|
66
|
-
|
|
67
|
-
entireCodes[c.result.filename] = {
|
|
68
|
-
content: c.result.implementationCode,
|
|
69
|
-
result: "success",
|
|
70
|
-
endpoint: {
|
|
71
|
-
method: c.op.method,
|
|
72
|
-
path: c.op.path,
|
|
73
|
-
},
|
|
74
|
-
location: c.result.filename,
|
|
75
|
-
name: c.result.name,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
61
|
+
for (const operation of props.operations) {
|
|
62
|
+
histories.set(operation, []);
|
|
78
63
|
}
|
|
79
64
|
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
diagnostics.current = compiled.diagnostics;
|
|
104
|
-
diagnostics.total = [...diagnostics.total, ...compiled.diagnostics];
|
|
105
|
-
|
|
106
|
-
console.log(
|
|
107
|
-
JSON.stringify(diagnostics.current, null, 2),
|
|
108
|
-
`현재 에러의 수: ${diagnostics.current.length}\n`,
|
|
109
|
-
`현재 시도 수: ${i + 1}`,
|
|
65
|
+
let compiled: IAutoBeTypeScriptCompileResult | null = null;
|
|
66
|
+
const entireCodes: IAutoBeRealizeCompile.FileContentMap = {};
|
|
67
|
+
for (let i = 0; i < props.retry; i++) {
|
|
68
|
+
const targets = props.operations.filter((op) =>
|
|
69
|
+
shouldProcessOperation(op, diagnostics.current),
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const metadata = { total: targets.length, count: 0 } as const;
|
|
73
|
+
const generatedCodes = await Promise.all(
|
|
74
|
+
targets.map((operation) => {
|
|
75
|
+
const role: string | null = operation.authorizationRole;
|
|
76
|
+
const authorization: AutoBeRealizeAuthorization | undefined =
|
|
77
|
+
props.authorizations.find((el) => el.role === role);
|
|
78
|
+
|
|
79
|
+
return process(ctx)({
|
|
80
|
+
metadata,
|
|
81
|
+
operation,
|
|
82
|
+
previousCodes: histories.get(operation),
|
|
83
|
+
diagnostics,
|
|
84
|
+
entireCodes,
|
|
85
|
+
authorization,
|
|
86
|
+
});
|
|
87
|
+
}),
|
|
110
88
|
);
|
|
89
|
+
|
|
90
|
+
for (const code of generatedCodes) {
|
|
91
|
+
if (code.type === "success") {
|
|
92
|
+
const response = histories.get(code.operation);
|
|
93
|
+
response.push(code);
|
|
94
|
+
histories.set(code.operation, response);
|
|
95
|
+
|
|
96
|
+
entireCodes[code.result.filename] = {
|
|
97
|
+
content: code.result.implementationCode,
|
|
98
|
+
result: "success",
|
|
99
|
+
endpoint: {
|
|
100
|
+
method: code.operation.method,
|
|
101
|
+
path: code.operation.path,
|
|
102
|
+
},
|
|
103
|
+
location: code.result.filename,
|
|
104
|
+
name: code.result.name,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const prisma = ctx.state().prisma?.compiled;
|
|
110
|
+
const nodeModules = prisma?.type === "success" ? prisma.nodeModules : {};
|
|
111
|
+
const compiler = await ctx.compiler();
|
|
112
|
+
compiled = await compiler.typescript.compile({
|
|
113
|
+
files: {
|
|
114
|
+
...payloads,
|
|
115
|
+
...files,
|
|
116
|
+
...nodeModules,
|
|
117
|
+
...Object.fromEntries(
|
|
118
|
+
templateFiles.map((file) => [file.location, file.content]),
|
|
119
|
+
),
|
|
120
|
+
...Object.fromEntries(
|
|
121
|
+
Object.entries(entireCodes).map(([filename, { content }]) => [
|
|
122
|
+
filename,
|
|
123
|
+
content,
|
|
124
|
+
]),
|
|
125
|
+
),
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
if (compiled && compiled.type !== "success") {
|
|
130
|
+
ctx.dispatch({
|
|
131
|
+
type: "realizeValidate",
|
|
132
|
+
created_at: new Date().toISOString(),
|
|
133
|
+
files:
|
|
134
|
+
compiled.type === "failure"
|
|
135
|
+
? Object.fromEntries(
|
|
136
|
+
compiled.diagnostics.map((diagnostic) => [
|
|
137
|
+
diagnostic.file,
|
|
138
|
+
diagnostic.code,
|
|
139
|
+
]),
|
|
140
|
+
)
|
|
141
|
+
: {},
|
|
142
|
+
result: compiled,
|
|
143
|
+
step: ctx.state().analyze?.step ?? 0,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (
|
|
148
|
+
compiled.type === "success" &&
|
|
149
|
+
generatedCodes.every((c) => c.type === "success")
|
|
150
|
+
) {
|
|
151
|
+
break;
|
|
152
|
+
} else if (compiled.type === "failure") {
|
|
153
|
+
diagnostics.current = compiled.diagnostics;
|
|
154
|
+
diagnostics.total = [...diagnostics.total, ...compiled.diagnostics];
|
|
155
|
+
}
|
|
111
156
|
}
|
|
112
|
-
}
|
|
113
157
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
// .filter(([filename]) => filename.startsWith("src/providers")) // filter only provider files
|
|
158
|
+
const functions = Object.entries(entireCodes)
|
|
159
|
+
.filter(([filename]) => filename.startsWith("src/providers")) // filter only provider files
|
|
117
160
|
.map(([filename, value]) => {
|
|
118
161
|
return {
|
|
119
162
|
filename,
|
|
@@ -121,75 +164,106 @@ export async function writeCodeUntilCompilePassed<
|
|
|
121
164
|
endpoint: value.endpoint!,
|
|
122
165
|
location: value.location!,
|
|
123
166
|
name: value.name!,
|
|
124
|
-
role: value.role
|
|
167
|
+
role: value.role ?? null,
|
|
125
168
|
};
|
|
126
|
-
})
|
|
127
|
-
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
return { functions, compiled: compiled ? compiled : { type: "success" } };
|
|
172
|
+
};
|
|
128
173
|
}
|
|
129
174
|
|
|
130
|
-
|
|
175
|
+
/**
|
|
176
|
+
* Loads template files for the realize agent These files are essential for the
|
|
177
|
+
* realize coder to pass compilation
|
|
178
|
+
*
|
|
179
|
+
* @param ctx Context of agent
|
|
180
|
+
* @returns Template file infomations
|
|
181
|
+
*/
|
|
182
|
+
async function getTemplates<Model extends ILlmSchema.Model>(
|
|
131
183
|
ctx: AutoBeContext<Model>,
|
|
132
|
-
): Promise<IAutoBeRealizeCompile.
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
const result: IAutoBeRealizeCompile.FileContentMap = {};
|
|
184
|
+
): Promise<IAutoBeRealizeCompile.CodeArtifact[]> {
|
|
185
|
+
const compiler = await ctx.compiler();
|
|
186
|
+
const templateFiles = await compiler.realize.getTemplate();
|
|
187
|
+
const pathnames = ["src/MyGlobal.ts", "src/util/toISOStringSafe.ts"] as const;
|
|
137
188
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
content: templateFiles[
|
|
189
|
+
return pathnames.map((pathname): IAutoBeRealizeCompile.CodeArtifact => {
|
|
190
|
+
return {
|
|
191
|
+
content: templateFiles[pathname],
|
|
141
192
|
result: "success",
|
|
142
|
-
location:
|
|
143
|
-
role: null,
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return result;
|
|
193
|
+
location: pathname,
|
|
194
|
+
role: null, // template files doesn't have role.
|
|
195
|
+
} as const;
|
|
196
|
+
});
|
|
148
197
|
}
|
|
149
198
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
199
|
+
function process<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>) {
|
|
200
|
+
return async function (props: {
|
|
201
|
+
metadata: { total: number; count: number };
|
|
202
|
+
operation: AutoBeOpenApi.IOperation;
|
|
203
|
+
previousCodes: IAutoBeRealizeCompile.Success[];
|
|
204
|
+
diagnostics: IAutoBeRealizeCompile.CompileDiagnostics;
|
|
205
|
+
entireCodes: IAutoBeRealizeCompile.FileContentMap;
|
|
206
|
+
authorization?: AutoBeRealizeAuthorization;
|
|
207
|
+
}) {
|
|
208
|
+
const result = await pipe(
|
|
209
|
+
props.operation,
|
|
210
|
+
(operation: AutoBeOpenApi.IOperation) =>
|
|
211
|
+
orchestrateRealizePlanner(ctx, operation, props.authorization),
|
|
212
|
+
async (plan: RealizePlannerOutput) => {
|
|
213
|
+
const filename = RealizeFileSystem.providerPath(plan.functionName);
|
|
214
|
+
const totalDiagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[] =
|
|
215
|
+
props.diagnostics.total.filter((el) => el.file === filename);
|
|
216
|
+
const currentDiagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[] =
|
|
217
|
+
props.diagnostics.current.filter((el) => el.file === filename);
|
|
218
|
+
const code = props.entireCodes[filename]?.content ?? null;
|
|
167
219
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
220
|
+
return orchestrateRealizeCoder(
|
|
221
|
+
ctx,
|
|
222
|
+
props.operation,
|
|
223
|
+
props.previousCodes,
|
|
224
|
+
plan,
|
|
225
|
+
code,
|
|
226
|
+
totalDiagnostics,
|
|
227
|
+
currentDiagnostics,
|
|
228
|
+
props.authorization,
|
|
229
|
+
).then((res) => {
|
|
230
|
+
if (props.previousCodes.length === 0) {
|
|
231
|
+
ctx.dispatch({
|
|
232
|
+
type: "realizeWrite",
|
|
233
|
+
filename: filename,
|
|
234
|
+
content: res === FAILED ? "FAILED" : res.implementationCode,
|
|
235
|
+
completed: ++props.metadata.count,
|
|
236
|
+
created_at: new Date().toISOString(),
|
|
237
|
+
step: ctx.state().analyze?.step ?? 0,
|
|
238
|
+
total: props.metadata.total,
|
|
239
|
+
});
|
|
240
|
+
} else {
|
|
241
|
+
ctx.dispatch({
|
|
242
|
+
type: "realizeCorrect",
|
|
243
|
+
filename: filename,
|
|
244
|
+
content: res === FAILED ? "FAILED" : res.implementationCode,
|
|
245
|
+
completed: ++props.metadata.count,
|
|
246
|
+
created_at: new Date().toISOString(),
|
|
247
|
+
step: ctx.state().analyze?.step ?? 0,
|
|
248
|
+
total: props.metadata.total,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
178
251
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
252
|
+
if (res === FAILED) {
|
|
253
|
+
return res;
|
|
254
|
+
}
|
|
182
255
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
256
|
+
return { ...res, name: plan.functionName };
|
|
257
|
+
});
|
|
258
|
+
},
|
|
259
|
+
);
|
|
187
260
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
261
|
+
if (result === FAILED) {
|
|
262
|
+
return { type: "failed", operation: props.operation, result } as const;
|
|
263
|
+
}
|
|
191
264
|
|
|
192
|
-
|
|
265
|
+
return { type: "success", operation: props.operation, result } as const;
|
|
266
|
+
};
|
|
193
267
|
}
|
|
194
268
|
|
|
195
269
|
/**
|
|
@@ -95,7 +95,7 @@ export const orchestrateTest =
|
|
|
95
95
|
ctx.dispatch({
|
|
96
96
|
type: "testComplete",
|
|
97
97
|
created_at: start.toISOString(),
|
|
98
|
-
files:
|
|
98
|
+
files: result,
|
|
99
99
|
compiled,
|
|
100
100
|
step: ctx.state().interface?.step ?? 0,
|
|
101
101
|
});
|