@autobe/agent 0.30.3 → 0.30.4-dev.20260324

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.
@@ -1,309 +1,309 @@
1
- import { IAgenticaController } from "@agentica/core";
2
- import {
3
- AutoBeDatabase,
4
- AutoBeEventSource,
5
- AutoBeInterfaceSchemaReviewEvent,
6
- // AutoBeInterfaceSchemaReviewEvent,
7
- AutoBeOpenApi,
8
- AutoBeProgressEventBase,
9
- } from "@autobe/interface";
10
- import { AutoBeOpenApiTypeChecker } from "@autobe/utils";
11
- import { IPointer } from "tstl";
12
- import typia, { ILlmApplication, IValidation } from "typia";
13
- import { v7 } from "uuid";
14
-
15
- import { AutoBeContext } from "../../context/AutoBeContext";
16
- import { buildAnalysisContextSections } from "../../utils/RAGRetrieval";
17
- import { executeCachedBatch } from "../../utils/executeCachedBatch";
18
- import { getEmbedder } from "../../utils/getEmbedder";
19
- import { AutoBePreliminaryController } from "../common/AutoBePreliminaryController";
20
- import { convertToSectionEntries } from "../common/internal/convertToSectionEntries";
21
- import { IAnalysisSectionEntry } from "../common/structures/IAnalysisSectionEntry";
22
- import { AutoBeDatabaseModelProgrammer } from "../prisma/programmers/AutoBeDatabaseModelProgrammer";
23
- import { transformInterfaceSchemaReviewHistory } from "./histories/transformInterfaceSchemaReviewHistory";
24
- import { AutoBeInterfaceSchemaProgrammer } from "./programmers/AutoBeInterfaceSchemaProgrammer";
25
- import { AutoBeInterfaceSchemaReviewProgrammer } from "./programmers/AutoBeInterfaceSchemaReviewProgrammer";
26
- import { IAutoBeInterfaceSchemaReviewApplication } from "./structures/IAutoBeInterfaceSchemaReviewApplication";
27
- import { AutoBeJsonSchemaFactory } from "./utils/AutoBeJsonSchemaFactory";
28
- import { AutoBeJsonSchemaValidator } from "./utils/AutoBeJsonSchemaValidator";
29
- import { fulfillJsonSchemaErrorMessages } from "./utils/fulfillJsonSchemaErrorMessages";
30
-
31
- export async function orchestrateInterfaceSchemaReview(
32
- ctx: AutoBeContext,
33
- props: {
34
- document: AutoBeOpenApi.IDocument;
35
- schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
36
- instruction: string;
37
- progress: AutoBeProgressEventBase;
38
- },
39
- ): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
40
- // Filter to only process object-type schemas (non-preset and object type)
41
- const typeNames: string[] = Object.entries(props.schemas)
42
- .filter(
43
- ([k, v]) =>
44
- AutoBeJsonSchemaValidator.isPreset(k) === false &&
45
- AutoBeOpenApiTypeChecker.isObject(v),
46
- )
47
- .map(([k]) => k);
48
- const x: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {};
49
- await executeCachedBatch(
50
- ctx,
51
- typeNames.map((it) => async (promptCacheKey) => {
52
- const predicate = (key: string) =>
53
- key === it ||
54
- (AutoBeJsonSchemaValidator.isPage(key) &&
55
- AutoBeJsonSchemaFactory.getPageName(key) === it);
56
- const reviewOperations: AutoBeOpenApi.IOperation[] =
57
- props.document.operations.filter(
58
- (op) =>
59
- (op.requestBody && predicate(op.requestBody.typeName)) ||
60
- (op.responseBody && predicate(op.responseBody.typeName)),
61
- );
62
- try {
63
- const value: AutoBeOpenApi.IJsonSchemaDescriptive = props.schemas[it];
64
- if (AutoBeOpenApiTypeChecker.isObject(value) === false) {
65
- ++props.progress.completed;
66
- return;
67
- }
68
- const reviewed: AutoBeOpenApi.IJsonSchemaDescriptive.IObject =
69
- await process(ctx, {
70
- instruction: props.instruction,
71
- document: props.document,
72
- typeName: it,
73
- reviewOperations,
74
- reviewSchema: value,
75
- progress: props.progress,
76
- promptCacheKey,
77
- });
78
- x[it] = reviewed;
79
- } catch (error) {
80
- console.log("interfaceSchemaReview failure", it, error);
81
- --props.progress.total;
82
- }
83
- }),
84
- );
85
- return x;
86
- }
87
-
88
- async function process(
89
- ctx: AutoBeContext,
90
- props: {
91
- instruction: string;
92
- document: AutoBeOpenApi.IDocument;
93
- typeName: string;
94
- reviewOperations: AutoBeOpenApi.IOperation[];
95
- reviewSchema: AutoBeOpenApi.IJsonSchemaDescriptive.IObject;
96
- progress: AutoBeProgressEventBase;
97
- promptCacheKey: string;
98
- },
99
- ): Promise<AutoBeOpenApi.IJsonSchemaDescriptive.IObject> {
100
- const allSections: IAnalysisSectionEntry[] = convertToSectionEntries(
101
- ctx.state().analyze?.files ?? [],
102
- );
103
-
104
- const schemaNames = [props.typeName];
105
- const opSummaries = props.reviewOperations
106
- .map((op) => `${op.method} ${op.path}: ${op.name}`)
107
- .join("\n");
108
- const queryText: string = `${schemaNames.join(", ")}\n${opSummaries}\n${props.instruction}`;
109
-
110
- const ragSections: IAnalysisSectionEntry[] =
111
- await buildAnalysisContextSections(
112
- getEmbedder(),
113
- allSections,
114
- queryText,
115
- "TOPK",
116
- { log: false, logPrefix: "interfaceSchemaReview" },
117
- );
118
-
119
- const preliminary: AutoBePreliminaryController<
120
- | "analysisSections"
121
- | "databaseSchemas"
122
- | "interfaceOperations"
123
- | "interfaceSchemas"
124
- | "previousAnalysisSections"
125
- | "previousDatabaseSchemas"
126
- | "previousInterfaceOperations"
127
- | "previousInterfaceSchemas"
128
- > = new AutoBePreliminaryController({
129
- application:
130
- typia.json.application<IAutoBeInterfaceSchemaReviewApplication>(),
131
- source: SOURCE,
132
- kinds: [
133
- "analysisSections",
134
- "previousAnalysisSections",
135
- "databaseSchemas",
136
- "previousDatabaseSchemas",
137
- "interfaceOperations",
138
- "previousInterfaceOperations",
139
- "interfaceSchemas",
140
- "previousInterfaceSchemas",
141
- ],
142
- config: {
143
- database: "text",
144
- databaseProperty: true,
145
- },
146
- state: ctx.state(),
147
- all: {
148
- interfaceOperations: props.document.operations,
149
- interfaceSchemas: props.document.components.schemas,
150
- },
151
- local: {
152
- analysisSections: ragSections,
153
- interfaceOperations: props.reviewOperations,
154
- interfaceSchemas: { [props.typeName]: props.reviewSchema },
155
- databaseSchemas: (() => {
156
- const expected: string =
157
- props.reviewSchema["x-autobe-database-schema"] ??
158
- AutoBeInterfaceSchemaProgrammer.getDatabaseSchemaName(props.typeName);
159
- const model: AutoBeDatabase.IModel | undefined = ctx
160
- .state()
161
- .database?.result.data.files.flatMap((f) => f.models)
162
- .find((m) => m.name === expected);
163
- if (model === undefined) return [];
164
- return AutoBeDatabaseModelProgrammer.getNeighbors({
165
- application: ctx.state().database!.result.data,
166
- model,
167
- });
168
- })(),
169
- },
170
- });
171
- return await preliminary.orchestrate(ctx, async (out) => {
172
- const pointer: IPointer<IAutoBeInterfaceSchemaReviewApplication.IComplete | null> =
173
- {
174
- value: null,
175
- };
176
- const result: AutoBeContext.IResult = await ctx.conversate({
177
- source: SOURCE,
178
- controller: createController(ctx, {
179
- typeName: props.typeName,
180
- operations: props.document.operations,
181
- schema: props.reviewSchema,
182
- preliminary,
183
- pointer,
184
- }),
185
- enforceFunctionCall: true,
186
- promptCacheKey: props.promptCacheKey,
187
- ...transformInterfaceSchemaReviewHistory({
188
- state: ctx.state(),
189
- instruction: props.instruction,
190
- typeName: props.typeName,
191
- reviewOperations: props.reviewOperations,
192
- reviewSchema: props.reviewSchema,
193
- preliminary,
194
- }),
195
- });
196
- if (pointer.value === null) return out(result)(null);
197
-
198
- // Apply revises to generate the modified schema content
199
- const content: AutoBeOpenApi.IJsonSchemaDescriptive.IObject =
200
- AutoBeInterfaceSchemaReviewProgrammer.execute({
201
- schema: props.reviewSchema,
202
- revises: pointer.value.revises,
203
- });
204
- ctx.dispatch({
205
- type: SOURCE,
206
- id: v7(),
207
- typeName: props.typeName,
208
- schema: props.reviewSchema,
209
- review: pointer.value.review,
210
- excludes: pointer.value.excludes,
211
- revises: pointer.value.revises,
212
- acquisition: preliminary.getAcquisition(),
213
- metric: result.metric,
214
- tokenUsage: result.tokenUsage,
215
- step: ctx.state().analyze?.step ?? 0,
216
- total: props.progress.total,
217
- completed: ++props.progress.completed,
218
- created_at: new Date().toISOString(),
219
- } satisfies AutoBeInterfaceSchemaReviewEvent);
220
- return out(result)(content);
221
- });
222
- }
223
-
224
- function createController(
225
- ctx: AutoBeContext,
226
- props: {
227
- typeName: string;
228
- schema: AutoBeOpenApi.IJsonSchemaDescriptive.IObject;
229
- operations: AutoBeOpenApi.IOperation[];
230
- pointer: IPointer<
231
- IAutoBeInterfaceSchemaReviewApplication.IComplete | null | false
232
- >;
233
- preliminary: AutoBePreliminaryController<
234
- | "analysisSections"
235
- | "databaseSchemas"
236
- | "interfaceOperations"
237
- | "interfaceSchemas"
238
- | "previousAnalysisSections"
239
- | "previousDatabaseSchemas"
240
- | "previousInterfaceOperations"
241
- | "previousInterfaceSchemas"
242
- >;
243
- },
244
- ): IAgenticaController.IClass {
245
- const validate: Validator = (next) => {
246
- const result: IValidation<IAutoBeInterfaceSchemaReviewApplication.IProps> =
247
- typia.validate<IAutoBeInterfaceSchemaReviewApplication.IProps>(next);
248
- if (result.success === false) {
249
- fulfillJsonSchemaErrorMessages(result.errors);
250
- return result;
251
- } else if (result.data.request.type !== "complete")
252
- return props.preliminary.validate({
253
- thinking: result.data.thinking,
254
- request: result.data.request,
255
- });
256
-
257
- const errors: IValidation.IError[] = [];
258
- AutoBeInterfaceSchemaReviewProgrammer.validate({
259
- typeName: props.typeName,
260
- schema: props.schema,
261
- excludes: result.data.request.excludes,
262
- revises: result.data.request.revises,
263
- errors,
264
- path: `$input.request`,
265
- everyModels:
266
- ctx.state().database?.result.data.files.flatMap((f) => f.models) ?? [],
267
- });
268
- return errors.length
269
- ? {
270
- success: false,
271
- errors,
272
- data: result.data,
273
- }
274
- : result;
275
- };
276
-
277
- const application: ILlmApplication = props.preliminary.fixApplication(
278
- typia.llm.application<IAutoBeInterfaceSchemaReviewApplication>({
279
- validate: {
280
- process: validate,
281
- },
282
- }),
283
- );
284
- AutoBeInterfaceSchemaReviewProgrammer.fixApplication({
285
- everyModels:
286
- ctx.state().database?.result.data.files.flatMap((f) => f.models) ?? [],
287
- application,
288
- typeName: props.typeName,
289
- schema: props.schema,
290
- });
291
-
292
- return {
293
- protocol: "class",
294
- name: SOURCE,
295
- application,
296
- execute: {
297
- process: (input) => {
298
- if (input.request.type === "complete")
299
- props.pointer.value = input.request;
300
- },
301
- } satisfies IAutoBeInterfaceSchemaReviewApplication,
302
- };
303
- }
304
-
305
- type Validator = (
306
- input: unknown,
307
- ) => IValidation<IAutoBeInterfaceSchemaReviewApplication.IProps>;
308
-
309
- const SOURCE = "interfaceSchemaReview" satisfies AutoBeEventSource;
1
+ import { IAgenticaController } from "@agentica/core";
2
+ import {
3
+ AutoBeDatabase,
4
+ AutoBeEventSource,
5
+ AutoBeInterfaceSchemaReviewEvent,
6
+ // AutoBeInterfaceSchemaReviewEvent,
7
+ AutoBeOpenApi,
8
+ AutoBeProgressEventBase,
9
+ } from "@autobe/interface";
10
+ import { AutoBeOpenApiTypeChecker } from "@autobe/utils";
11
+ import { IPointer } from "tstl";
12
+ import typia, { ILlmApplication, IValidation } from "typia";
13
+ import { v7 } from "uuid";
14
+
15
+ import { AutoBeContext } from "../../context/AutoBeContext";
16
+ import { buildAnalysisContextSections } from "../../utils/RAGRetrieval";
17
+ import { executeCachedBatch } from "../../utils/executeCachedBatch";
18
+ import { getEmbedder } from "../../utils/getEmbedder";
19
+ import { AutoBePreliminaryController } from "../common/AutoBePreliminaryController";
20
+ import { convertToSectionEntries } from "../common/internal/convertToSectionEntries";
21
+ import { IAnalysisSectionEntry } from "../common/structures/IAnalysisSectionEntry";
22
+ import { AutoBeDatabaseModelProgrammer } from "../prisma/programmers/AutoBeDatabaseModelProgrammer";
23
+ import { transformInterfaceSchemaReviewHistory } from "./histories/transformInterfaceSchemaReviewHistory";
24
+ import { AutoBeInterfaceSchemaProgrammer } from "./programmers/AutoBeInterfaceSchemaProgrammer";
25
+ import { AutoBeInterfaceSchemaReviewProgrammer } from "./programmers/AutoBeInterfaceSchemaReviewProgrammer";
26
+ import { IAutoBeInterfaceSchemaReviewApplication } from "./structures/IAutoBeInterfaceSchemaReviewApplication";
27
+ import { AutoBeJsonSchemaFactory } from "./utils/AutoBeJsonSchemaFactory";
28
+ import { AutoBeJsonSchemaValidator } from "./utils/AutoBeJsonSchemaValidator";
29
+ import { fulfillJsonSchemaErrorMessages } from "./utils/fulfillJsonSchemaErrorMessages";
30
+
31
+ export async function orchestrateInterfaceSchemaReview(
32
+ ctx: AutoBeContext,
33
+ props: {
34
+ document: AutoBeOpenApi.IDocument;
35
+ schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
36
+ instruction: string;
37
+ progress: AutoBeProgressEventBase;
38
+ },
39
+ ): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
40
+ // Filter to only process object-type schemas (non-preset and object type)
41
+ const typeNames: string[] = Object.entries(props.schemas)
42
+ .filter(
43
+ ([k, v]) =>
44
+ AutoBeJsonSchemaValidator.isPreset(k) === false &&
45
+ AutoBeOpenApiTypeChecker.isObject(v),
46
+ )
47
+ .map(([k]) => k);
48
+ const x: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {};
49
+ await executeCachedBatch(
50
+ ctx,
51
+ typeNames.map((it) => async (promptCacheKey) => {
52
+ const predicate = (key: string) =>
53
+ key === it ||
54
+ (AutoBeJsonSchemaValidator.isPage(key) &&
55
+ AutoBeJsonSchemaFactory.getPageName(key) === it);
56
+ const reviewOperations: AutoBeOpenApi.IOperation[] =
57
+ props.document.operations.filter(
58
+ (op) =>
59
+ (op.requestBody && predicate(op.requestBody.typeName)) ||
60
+ (op.responseBody && predicate(op.responseBody.typeName)),
61
+ );
62
+ try {
63
+ const value: AutoBeOpenApi.IJsonSchemaDescriptive = props.schemas[it];
64
+ if (AutoBeOpenApiTypeChecker.isObject(value) === false) {
65
+ ++props.progress.completed;
66
+ return;
67
+ }
68
+ const reviewed: AutoBeOpenApi.IJsonSchemaDescriptive.IObject =
69
+ await process(ctx, {
70
+ instruction: props.instruction,
71
+ document: props.document,
72
+ typeName: it,
73
+ reviewOperations,
74
+ reviewSchema: value,
75
+ progress: props.progress,
76
+ promptCacheKey,
77
+ });
78
+ x[it] = reviewed;
79
+ } catch (error) {
80
+ console.log("interfaceSchemaReview failure", it, error);
81
+ --props.progress.total;
82
+ }
83
+ }),
84
+ );
85
+ return x;
86
+ }
87
+
88
+ async function process(
89
+ ctx: AutoBeContext,
90
+ props: {
91
+ instruction: string;
92
+ document: AutoBeOpenApi.IDocument;
93
+ typeName: string;
94
+ reviewOperations: AutoBeOpenApi.IOperation[];
95
+ reviewSchema: AutoBeOpenApi.IJsonSchemaDescriptive.IObject;
96
+ progress: AutoBeProgressEventBase;
97
+ promptCacheKey: string;
98
+ },
99
+ ): Promise<AutoBeOpenApi.IJsonSchemaDescriptive.IObject> {
100
+ const allSections: IAnalysisSectionEntry[] = convertToSectionEntries(
101
+ ctx.state().analyze?.files ?? [],
102
+ );
103
+
104
+ const schemaNames = [props.typeName];
105
+ const opSummaries = props.reviewOperations
106
+ .map((op) => `${op.method} ${op.path}: ${op.name}`)
107
+ .join("\n");
108
+ const queryText: string = `${schemaNames.join(", ")}\n${opSummaries}\n${props.instruction}`;
109
+
110
+ const ragSections: IAnalysisSectionEntry[] =
111
+ await buildAnalysisContextSections(
112
+ getEmbedder(),
113
+ allSections,
114
+ queryText,
115
+ "TOPK",
116
+ { log: false, logPrefix: "interfaceSchemaReview" },
117
+ );
118
+
119
+ const preliminary: AutoBePreliminaryController<
120
+ | "analysisSections"
121
+ | "databaseSchemas"
122
+ | "interfaceOperations"
123
+ | "interfaceSchemas"
124
+ | "previousAnalysisSections"
125
+ | "previousDatabaseSchemas"
126
+ | "previousInterfaceOperations"
127
+ | "previousInterfaceSchemas"
128
+ > = new AutoBePreliminaryController({
129
+ application:
130
+ typia.json.application<IAutoBeInterfaceSchemaReviewApplication>(),
131
+ source: SOURCE,
132
+ kinds: [
133
+ "analysisSections",
134
+ "previousAnalysisSections",
135
+ "databaseSchemas",
136
+ "previousDatabaseSchemas",
137
+ "interfaceOperations",
138
+ "previousInterfaceOperations",
139
+ "interfaceSchemas",
140
+ "previousInterfaceSchemas",
141
+ ],
142
+ config: {
143
+ database: "text",
144
+ databaseProperty: true,
145
+ },
146
+ state: ctx.state(),
147
+ all: {
148
+ interfaceOperations: props.document.operations,
149
+ interfaceSchemas: props.document.components.schemas,
150
+ },
151
+ local: {
152
+ analysisSections: ragSections,
153
+ interfaceOperations: props.reviewOperations,
154
+ interfaceSchemas: { [props.typeName]: props.reviewSchema },
155
+ databaseSchemas: (() => {
156
+ const expected: string =
157
+ props.reviewSchema["x-autobe-database-schema"] ??
158
+ AutoBeInterfaceSchemaProgrammer.getDatabaseSchemaName(props.typeName);
159
+ const model: AutoBeDatabase.IModel | undefined = ctx
160
+ .state()
161
+ .database?.result.data.files.flatMap((f) => f.models)
162
+ .find((m) => m.name === expected);
163
+ if (model === undefined) return [];
164
+ return AutoBeDatabaseModelProgrammer.getNeighbors({
165
+ application: ctx.state().database!.result.data,
166
+ model,
167
+ });
168
+ })(),
169
+ },
170
+ });
171
+ return await preliminary.orchestrate(ctx, async (out) => {
172
+ const pointer: IPointer<IAutoBeInterfaceSchemaReviewApplication.IComplete | null> =
173
+ {
174
+ value: null,
175
+ };
176
+ const result: AutoBeContext.IResult = await ctx.conversate({
177
+ source: SOURCE,
178
+ controller: createController(ctx, {
179
+ typeName: props.typeName,
180
+ operations: props.document.operations,
181
+ schema: props.reviewSchema,
182
+ preliminary,
183
+ pointer,
184
+ }),
185
+ enforceFunctionCall: true,
186
+ promptCacheKey: props.promptCacheKey,
187
+ ...transformInterfaceSchemaReviewHistory({
188
+ state: ctx.state(),
189
+ instruction: props.instruction,
190
+ typeName: props.typeName,
191
+ reviewOperations: props.reviewOperations,
192
+ reviewSchema: props.reviewSchema,
193
+ preliminary,
194
+ }),
195
+ });
196
+ if (pointer.value === null) return out(result)(null);
197
+
198
+ // Apply revises to generate the modified schema content
199
+ const content: AutoBeOpenApi.IJsonSchemaDescriptive.IObject =
200
+ AutoBeInterfaceSchemaReviewProgrammer.execute({
201
+ schema: props.reviewSchema,
202
+ revises: pointer.value.revises,
203
+ });
204
+ ctx.dispatch({
205
+ type: SOURCE,
206
+ id: v7(),
207
+ typeName: props.typeName,
208
+ schema: props.reviewSchema,
209
+ review: pointer.value.review,
210
+ excludes: pointer.value.excludes,
211
+ revises: pointer.value.revises,
212
+ acquisition: preliminary.getAcquisition(),
213
+ metric: result.metric,
214
+ tokenUsage: result.tokenUsage,
215
+ step: ctx.state().analyze?.step ?? 0,
216
+ total: props.progress.total,
217
+ completed: ++props.progress.completed,
218
+ created_at: new Date().toISOString(),
219
+ } satisfies AutoBeInterfaceSchemaReviewEvent);
220
+ return out(result)(content);
221
+ });
222
+ }
223
+
224
+ function createController(
225
+ ctx: AutoBeContext,
226
+ props: {
227
+ typeName: string;
228
+ schema: AutoBeOpenApi.IJsonSchemaDescriptive.IObject;
229
+ operations: AutoBeOpenApi.IOperation[];
230
+ pointer: IPointer<
231
+ IAutoBeInterfaceSchemaReviewApplication.IComplete | null | false
232
+ >;
233
+ preliminary: AutoBePreliminaryController<
234
+ | "analysisSections"
235
+ | "databaseSchemas"
236
+ | "interfaceOperations"
237
+ | "interfaceSchemas"
238
+ | "previousAnalysisSections"
239
+ | "previousDatabaseSchemas"
240
+ | "previousInterfaceOperations"
241
+ | "previousInterfaceSchemas"
242
+ >;
243
+ },
244
+ ): IAgenticaController.IClass {
245
+ const validate: Validator = (next) => {
246
+ const result: IValidation<IAutoBeInterfaceSchemaReviewApplication.IProps> =
247
+ typia.validate<IAutoBeInterfaceSchemaReviewApplication.IProps>(next);
248
+ if (result.success === false) {
249
+ fulfillJsonSchemaErrorMessages(result.errors);
250
+ return result;
251
+ } else if (result.data.request.type !== "complete")
252
+ return props.preliminary.validate({
253
+ thinking: result.data.thinking,
254
+ request: result.data.request,
255
+ });
256
+
257
+ const errors: IValidation.IError[] = [];
258
+ AutoBeInterfaceSchemaReviewProgrammer.validate({
259
+ typeName: props.typeName,
260
+ schema: props.schema,
261
+ excludes: result.data.request.excludes,
262
+ revises: result.data.request.revises,
263
+ errors,
264
+ path: `$input.request`,
265
+ everyModels:
266
+ ctx.state().database?.result.data.files.flatMap((f) => f.models) ?? [],
267
+ });
268
+ return errors.length
269
+ ? {
270
+ success: false,
271
+ errors,
272
+ data: result.data,
273
+ }
274
+ : result;
275
+ };
276
+
277
+ const application: ILlmApplication = props.preliminary.fixApplication(
278
+ typia.llm.application<IAutoBeInterfaceSchemaReviewApplication>({
279
+ validate: {
280
+ process: validate,
281
+ },
282
+ }),
283
+ );
284
+ AutoBeInterfaceSchemaReviewProgrammer.fixApplication({
285
+ everyModels:
286
+ ctx.state().database?.result.data.files.flatMap((f) => f.models) ?? [],
287
+ application,
288
+ typeName: props.typeName,
289
+ schema: props.schema,
290
+ });
291
+
292
+ return {
293
+ protocol: "class",
294
+ name: SOURCE,
295
+ application,
296
+ execute: {
297
+ process: (input) => {
298
+ if (input.request.type === "complete")
299
+ props.pointer.value = input.request;
300
+ },
301
+ } satisfies IAutoBeInterfaceSchemaReviewApplication,
302
+ };
303
+ }
304
+
305
+ type Validator = (
306
+ input: unknown,
307
+ ) => IValidation<IAutoBeInterfaceSchemaReviewApplication.IProps>;
308
+
309
+ const SOURCE = "interfaceSchemaReview" satisfies AutoBeEventSource;