@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.
Files changed (98) hide show
  1. package/LICENSE +661 -21
  2. package/lib/AutoBeAgent.js +2 -2
  3. package/lib/AutoBeAgent.js.map +1 -1
  4. package/lib/AutoBeMockAgent.d.ts +1 -0
  5. package/lib/AutoBeMockAgent.js +18 -4
  6. package/lib/AutoBeMockAgent.js.map +1 -1
  7. package/lib/constants/AutoBeSystemPromptConstant.d.ts +3 -3
  8. package/lib/factory/getAutoBeGenerated.js +2 -1
  9. package/lib/factory/getAutoBeGenerated.js.map +1 -1
  10. package/lib/index.mjs +739 -577
  11. package/lib/index.mjs.map +1 -1
  12. package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.d.ts +0 -15
  13. package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.js +0 -3
  14. package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.js.map +1 -1
  15. package/lib/orchestrate/analyze/orchestrateAnalyze.js +19 -12
  16. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  17. package/lib/orchestrate/analyze/orchestrateAnalyzeComposer.d.ts +1 -2
  18. package/lib/orchestrate/analyze/orchestrateAnalyzeComposer.js +3 -5
  19. package/lib/orchestrate/analyze/orchestrateAnalyzeComposer.js.map +1 -1
  20. package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.d.ts +7 -1
  21. package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js +363 -4
  22. package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js.map +1 -1
  23. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +3 -3
  24. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +3 -118
  25. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
  26. package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.js +1 -1
  27. package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.js.map +1 -1
  28. package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.d.ts +11 -4
  29. package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.js +61 -45
  30. package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.js.map +1 -1
  31. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +17 -10
  32. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
  33. package/lib/orchestrate/realize/ProviderCodeComparator.d.ts +5 -0
  34. package/lib/orchestrate/realize/ProviderCodeComparator.js +16 -0
  35. package/lib/orchestrate/realize/ProviderCodeComparator.js.map +1 -0
  36. package/lib/orchestrate/realize/orchestrateRealize.js +41 -53
  37. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
  38. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +13 -87
  39. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  40. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +32 -43
  41. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
  42. package/lib/orchestrate/realize/orchestrateRealizeCoder.d.ts +3 -2
  43. package/lib/orchestrate/realize/orchestrateRealizeCoder.js +25 -39
  44. package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -1
  45. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +15 -15
  46. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +11 -17
  47. package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +4 -2
  48. package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.d.ts +21 -17
  49. package/lib/orchestrate/realize/transformRealizeAuthorization.js +5 -9
  50. package/lib/orchestrate/realize/transformRealizeAuthorization.js.map +1 -1
  51. package/lib/orchestrate/realize/transformRealizeAuthorizationCorrectHistories.js +9 -0
  52. package/lib/orchestrate/realize/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
  53. package/lib/orchestrate/realize/transformRealizeCoderHistories.d.ts +3 -2
  54. package/lib/orchestrate/realize/transformRealizeCoderHistories.js +58 -27
  55. package/lib/orchestrate/realize/transformRealizeCoderHistories.js.map +1 -1
  56. package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationFileSystem.d.ts +5 -0
  57. package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationFileSystem.js +10 -0
  58. package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationFileSystem.js.map +1 -0
  59. package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.d.ts +4 -0
  60. package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js +38 -0
  61. package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js.map +1 -0
  62. package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +2 -1
  63. package/lib/orchestrate/realize/utils/replaceImportStatements.js +15 -2
  64. package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
  65. package/lib/orchestrate/realize/writeCodeUntilCompilePassed.d.ts +9 -2
  66. package/lib/orchestrate/realize/writeCodeUntilCompilePassed.js +158 -100
  67. package/lib/orchestrate/realize/writeCodeUntilCompilePassed.js.map +1 -1
  68. package/lib/orchestrate/test/orchestrateTest.js +1 -1
  69. package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
  70. package/package.json +7 -7
  71. package/src/AutoBeAgent.ts +1 -1
  72. package/src/AutoBeMockAgent.ts +20 -6
  73. package/src/constants/AutoBeSystemPromptConstant.ts +3 -3
  74. package/src/factory/getAutoBeGenerated.ts +2 -1
  75. package/src/orchestrate/analyze/AutoBeAnalyzeFileSystem.ts +0 -15
  76. package/src/orchestrate/analyze/orchestrateAnalyze.ts +17 -17
  77. package/src/orchestrate/analyze/orchestrateAnalyzeComposer.ts +4 -7
  78. package/src/orchestrate/analyze/orchestrateAnalyzeReviewer.ts +100 -6
  79. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +5 -21
  80. package/src/orchestrate/analyze/writeDocumentUntilReviewPassed.ts +76 -59
  81. package/src/orchestrate/prisma/transformPrismaComponentsHistories.ts +17 -10
  82. package/src/orchestrate/realize/ProviderCodeComparator.ts +15 -0
  83. package/src/orchestrate/realize/orchestrateRealize.ts +54 -59
  84. package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +12 -120
  85. package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +21 -5
  86. package/src/orchestrate/realize/orchestrateRealizeCoder.ts +10 -9
  87. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +15 -15
  88. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +11 -18
  89. package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +4 -2
  90. package/src/orchestrate/realize/structures/IAutoBeRealizeCompile.ts +24 -17
  91. package/src/orchestrate/realize/transformRealizeAuthorization.ts +5 -9
  92. package/src/orchestrate/realize/transformRealizeAuthorizationCorrectHistories.ts +9 -0
  93. package/src/orchestrate/realize/transformRealizeCoderHistories.ts +73 -25
  94. package/src/orchestrate/realize/utils/AutoBeRealizeAuthorizationFileSystem.ts +9 -0
  95. package/src/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.ts +64 -0
  96. package/src/orchestrate/realize/utils/replaceImportStatements.ts +41 -2
  97. package/src/orchestrate/realize/writeCodeUntilCompilePassed.ts +219 -145
  98. 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 { arrayToRecord } from "../../utils/arrayToRecord";
11
+ import { ProviderCodeComparator } from "./ProviderCodeComparator";
11
12
  import { pipe } from "./RealizePipe";
12
13
  import { orchestrateRealizeCoder } from "./orchestrateRealizeCoder";
13
- import { orchestrateRealizePlanner } from "./orchestrateRealizePlanner";
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 async function writeCodeUntilCompilePassed<
19
- Model extends ILlmSchema.Model,
20
- >(
22
+ export function writeCodeUntilCompilePassed<Model extends ILlmSchema.Model>(
21
23
  ctx: AutoBeContext<Model>,
22
- ops: AutoBeOpenApi.IOperation[],
23
- authorizations: AutoBeRealizeAuthorization[],
24
- retry: number,
25
- ): Promise<AutoBeRealizeFunction[]> {
26
- const payloads = arrayToRecord(
27
- authorizations.map((el) => el.payload),
28
- "location",
29
- "content",
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
- const files = arrayToRecord(
33
- Object.entries(await ctx.files({ dbms: "postgres" })).filter(([key]) =>
34
- key.startsWith("src"),
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
- const entireCodes: IAutoBeRealizeCompile.FileContentMap = {
39
- ...(await loadTemplateFiles(ctx)),
40
- };
46
+ const templateFiles = await getTemplates(ctx);
41
47
 
42
- let diagnostics: IAutoBeRealizeCompile.CompileDiagnostics = {
43
- current: [],
44
- total: [],
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 metadata = { total: targets.length, count: 0 };
53
- const generatedCodes: (
54
- | IAutoBeRealizeCompile.Success
55
- | IAutoBeRealizeCompile.Fail
56
- )[] = await Promise.all(
57
- targets.map((op) => {
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 c of generatedCodes) {
66
- if (c.type === "success") {
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
- const prisma = ctx.state().prisma?.compiled;
81
- const nodeModules = prisma?.type === "success" ? prisma.nodeModules : {};
82
- const compiler = await ctx.compiler();
83
- const compiled = await compiler.typescript.compile({
84
- files: {
85
- ...payloads,
86
- ...files,
87
- ...nodeModules,
88
- ...arrayToRecord(
89
- Object.entries(entireCodes).map(([filename, { content }]) => [
90
- filename,
91
- content,
92
- ]),
93
- ),
94
- },
95
- });
96
-
97
- if (
98
- compiled.type === "success" &&
99
- generatedCodes.every((c) => c.type === "success")
100
- ) {
101
- break;
102
- } else if (compiled.type === "failure") {
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
- return (
115
- Object.entries(entireCodes)
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
- async function loadTemplateFiles<Model extends ILlmSchema.Model>(
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.FileContentMap> {
133
- const templateFiles = await (await ctx.compiler()).realize.getTemplate();
134
- const targets = ["src/MyGlobal.ts", "src/util/toISOStringSafe.ts"];
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
- for (const filePath of targets) {
139
- result[filePath] = {
140
- content: templateFiles[filePath],
189
+ return pathnames.map((pathname): IAutoBeRealizeCompile.CodeArtifact => {
190
+ return {
191
+ content: templateFiles[pathname],
141
192
  result: "success",
142
- location: filePath,
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
- async function process<Model extends ILlmSchema.Model>(
151
- ctx: AutoBeContext<Model>,
152
- metadata: { total: number; count: number },
153
- op: AutoBeOpenApi.IOperation,
154
- diagnostics: IAutoBeRealizeCompile.CompileDiagnostics,
155
- entireCodes: IAutoBeRealizeCompile.FileContentMap,
156
- decorator?: AutoBeRealizeAuthorization,
157
- ) {
158
- const result = await pipe(
159
- op,
160
- (op) => orchestrateRealizePlanner(ctx, op, decorator),
161
- async (p) => {
162
- const filename = RealizeFileSystem.providerPath(p.functionName);
163
- const t = diagnostics.total.filter((el) => el.file === filename);
164
-
165
- const d = diagnostics.current.filter((el) => el.file === filename);
166
- const c = entireCodes[filename]?.content ?? null;
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
- return orchestrateRealizeCoder(ctx, op, p, c, t, d).then((res) => {
169
- ctx.dispatch({
170
- type: "realizeProgress",
171
- filename: filename,
172
- content: res === FAILED ? "FAILED" : res.implementationCode,
173
- completed: ++metadata.count,
174
- created_at: new Date().toISOString(),
175
- step: ctx.state().analyze?.step ?? 0,
176
- total: metadata.total,
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
- if (res === FAILED) {
180
- return res;
181
- }
252
+ if (res === FAILED) {
253
+ return res;
254
+ }
182
255
 
183
- return { ...res, name: p.functionName };
184
- });
185
- },
186
- );
256
+ return { ...res, name: plan.functionName };
257
+ });
258
+ },
259
+ );
187
260
 
188
- if (result === FAILED) {
189
- return { type: "failed", op: op, result } as const;
190
- }
261
+ if (result === FAILED) {
262
+ return { type: "failed", operation: props.operation, result } as const;
263
+ }
191
264
 
192
- return { type: "success", op: op, result } as const;
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: Object.fromEntries(result.map((f) => [f.location, f.content])),
98
+ files: result,
99
99
  compiled,
100
100
  step: ctx.state().interface?.step ?? 0,
101
101
  });