@autobe/agent 0.25.3 → 0.25.5
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.js +2 -0
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/AutoBeMockAgent.js +1 -1
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/factory/consentFunctionCall.js +2 -0
- package/lib/factory/consentFunctionCall.js.map +1 -1
- package/lib/factory/createAutoBeContext.js +2 -0
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/factory/supportMistral.d.ts +4 -0
- package/lib/factory/supportMistral.js +112 -0
- package/lib/factory/supportMistral.js.map +1 -0
- package/lib/index.mjs +1997 -1422
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.d.ts +1 -0
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +370 -275
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +1 -1
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js +370 -275
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +304 -221
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js +303 -220
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +17 -22
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +372 -277
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +322 -350
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/utils/validateEmptyCode.d.ts +8 -0
- package/lib/utils/validateEmptyCode.js +35 -0
- package/lib/utils/validateEmptyCode.js.map +1 -0
- package/package.json +5 -5
- package/src/AutoBeAgent.ts +2 -0
- package/src/AutoBeMockAgent.ts +1 -1
- package/src/factory/consentFunctionCall.ts +3 -0
- package/src/factory/createAutoBeContext.ts +2 -0
- package/src/factory/supportMistral.ts +122 -0
- package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +52 -10
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +1 -1
- package/src/orchestrate/realize/orchestRateRealizeCorrectCasting.ts +58 -17
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +51 -15
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +46 -12
- package/src/orchestrate/test/orchestrateTestCorrect.ts +17 -24
- package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +57 -10
- package/src/orchestrate/test/orchestrateTestWrite.ts +41 -10
- package/src/utils/validateEmptyCode.ts +41 -0
|
@@ -47,9 +47,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
48
|
exports.orchestrateCommonCorrectCasting = void 0;
|
|
49
49
|
const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport.js"));
|
|
50
|
+
const __typia_transform__llmApplicationFinalize = __importStar(require("typia/lib/internal/_llmApplicationFinalize.js"));
|
|
50
51
|
const utils_1 = require("@autobe/utils");
|
|
51
52
|
const typia_1 = __importDefault(require("typia"));
|
|
52
53
|
const assertSchemaModel_1 = require("../../context/assertSchemaModel");
|
|
54
|
+
const validateEmptyCode_1 = require("../../utils/validateEmptyCode");
|
|
53
55
|
const transformCommonCorrectCastingHistories_1 = require("./histories/transformCommonCorrectCastingHistories");
|
|
54
56
|
const orchestrateCommonCorrectCasting = (ctx, factory, script) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
57
|
const event = yield factory.validate(script);
|
|
@@ -81,6 +83,7 @@ const correct = (ctx, factory, failures, script, event, life) => __awaiter(void
|
|
|
81
83
|
}))),
|
|
82
84
|
controller: createController({
|
|
83
85
|
model: ctx.model,
|
|
86
|
+
functionName: factory.functionName,
|
|
84
87
|
then: (next) => {
|
|
85
88
|
pointer.value = next;
|
|
86
89
|
},
|
|
@@ -112,7 +115,75 @@ const correct = (ctx, factory, failures, script, event, life) => __awaiter(void
|
|
|
112
115
|
});
|
|
113
116
|
const createController = (props) => {
|
|
114
117
|
(0, assertSchemaModel_1.assertSchemaModel)(props.model);
|
|
115
|
-
const
|
|
118
|
+
const validate = (input) => {
|
|
119
|
+
const result = (() => { const _io0 = input => "string" === typeof input.think && "string" === typeof input.draft && ("object" === typeof input.revise && null !== input.revise && _io1(input.revise)); const _io1 = input => "string" === typeof input.review && (null === input.final || "string" === typeof input.final); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.think || _report(_exceptionable, {
|
|
120
|
+
path: _path + ".think",
|
|
121
|
+
expected: "string",
|
|
122
|
+
value: input.think
|
|
123
|
+
}), "string" === typeof input.draft || _report(_exceptionable, {
|
|
124
|
+
path: _path + ".draft",
|
|
125
|
+
expected: "string",
|
|
126
|
+
value: input.draft
|
|
127
|
+
}), ("object" === typeof input.revise && null !== input.revise || _report(_exceptionable, {
|
|
128
|
+
path: _path + ".revise",
|
|
129
|
+
expected: "IAutoBeCommonCorrectCastingApplication.IReviseProps",
|
|
130
|
+
value: input.revise
|
|
131
|
+
})) && _vo1(input.revise, _path + ".revise", true && _exceptionable) || _report(_exceptionable, {
|
|
132
|
+
path: _path + ".revise",
|
|
133
|
+
expected: "IAutoBeCommonCorrectCastingApplication.IReviseProps",
|
|
134
|
+
value: input.revise
|
|
135
|
+
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.review || _report(_exceptionable, {
|
|
136
|
+
path: _path + ".review",
|
|
137
|
+
expected: "string",
|
|
138
|
+
value: input.review
|
|
139
|
+
}), null === input.final || "string" === typeof input.final || _report(_exceptionable, {
|
|
140
|
+
path: _path + ".final",
|
|
141
|
+
expected: "(null | string)",
|
|
142
|
+
value: input.final
|
|
143
|
+
})].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
|
|
144
|
+
if (false === __is(input)) {
|
|
145
|
+
errors = [];
|
|
146
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
147
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
148
|
+
path: _path + "",
|
|
149
|
+
expected: "IAutoBeCommonCorrectCastingApplication.IProps",
|
|
150
|
+
value: input
|
|
151
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
152
|
+
path: _path + "",
|
|
153
|
+
expected: "IAutoBeCommonCorrectCastingApplication.IProps",
|
|
154
|
+
value: input
|
|
155
|
+
}))(input, "$input", true);
|
|
156
|
+
const success = 0 === errors.length;
|
|
157
|
+
return success ? {
|
|
158
|
+
success,
|
|
159
|
+
data: input
|
|
160
|
+
} : {
|
|
161
|
+
success,
|
|
162
|
+
errors,
|
|
163
|
+
data: input
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
success: true,
|
|
168
|
+
data: input
|
|
169
|
+
};
|
|
170
|
+
}; })()(input);
|
|
171
|
+
if (result.success === false)
|
|
172
|
+
return result;
|
|
173
|
+
const errors = (0, validateEmptyCode_1.validateEmptyCode)({
|
|
174
|
+
functionName: props.functionName,
|
|
175
|
+
draft: result.data.draft,
|
|
176
|
+
revise: result.data.revise,
|
|
177
|
+
});
|
|
178
|
+
return errors.length
|
|
179
|
+
? {
|
|
180
|
+
success: false,
|
|
181
|
+
errors,
|
|
182
|
+
data: result.data,
|
|
183
|
+
}
|
|
184
|
+
: result;
|
|
185
|
+
};
|
|
186
|
+
const application = collection[props.model === "chatgpt" ? "chatgpt" : "claude"](validate);
|
|
116
187
|
return {
|
|
117
188
|
protocol: "class",
|
|
118
189
|
name: "correctInvalidRequest",
|
|
@@ -128,297 +199,321 @@ const createController = (props) => {
|
|
|
128
199
|
};
|
|
129
200
|
};
|
|
130
201
|
const collection = {
|
|
131
|
-
chatgpt: {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
202
|
+
chatgpt: (validate) => (() => {
|
|
203
|
+
const application = {
|
|
204
|
+
model: "chatgpt",
|
|
205
|
+
options: {
|
|
206
|
+
reference: true,
|
|
207
|
+
strict: false,
|
|
208
|
+
separate: null
|
|
209
|
+
},
|
|
210
|
+
functions: [
|
|
211
|
+
{
|
|
212
|
+
name: "rewrite",
|
|
213
|
+
parameters: {
|
|
214
|
+
description: " - The analysis and correction properties\n\n------------------------------\n\nCurrent Type: {@link IAutoBeCommonCorrectCastingApplication.IProps}\n\n### Description of {@link revise} property:\n\n> Review and finalization of type casting corrections.\n> \n> Contains the review of applied corrections and the final code with all\n> type casting issues resolved while preserving type safety and validation\n> intent.",
|
|
215
|
+
type: "object",
|
|
216
|
+
properties: {
|
|
217
|
+
think: {
|
|
218
|
+
description: "Initial analysis of the type casting or assignment error.\n\nContains the agent's analysis of the specific type mismatch pattern:\n\n- Type of casting error (tag incompatibility, nullable assignment, literal\n type conversion, etc.)\n- Whether nullable or undefined types are involved\n- If Date to string conversions are needed\n- The chosen fix strategy for the specific error type",
|
|
219
|
+
type: "string"
|
|
220
|
+
},
|
|
221
|
+
draft: {
|
|
222
|
+
description: "Draft correction with initial type casting fixes.\n\nThe code after applying the first round of fixes:\n\n- Satisfies patterns for tag stripping\n- Date.toISOString() conversions where needed\n- Nullable type narrowing checks\n- Literal type assertions\n- Optional chaining result handling",
|
|
223
|
+
type: "string"
|
|
224
|
+
},
|
|
225
|
+
revise: {
|
|
226
|
+
$ref: "#/$defs/IAutoBeCommonCorrectCastingApplication.IReviseProps"
|
|
227
|
+
}
|
|
152
228
|
},
|
|
153
|
-
|
|
154
|
-
|
|
229
|
+
required: [
|
|
230
|
+
"think",
|
|
231
|
+
"draft",
|
|
232
|
+
"revise"
|
|
233
|
+
],
|
|
234
|
+
additionalProperties: false,
|
|
235
|
+
$defs: {
|
|
236
|
+
"IAutoBeCommonCorrectCastingApplication.IReviseProps": {
|
|
237
|
+
type: "object",
|
|
238
|
+
properties: {
|
|
239
|
+
review: {
|
|
240
|
+
description: "Review of the type casting correction patterns applied.\n\nExplains which correction strategies were used:\n\n- Which satisfies patterns were applied for tag issues\n- Where typia.assert or assertGuard was used\n- How Date conversions were handled\n- What nullable type narrowing was applied\n- How literal type conversions were resolved\n- Confirmation that all type casting issues are resolved",
|
|
241
|
+
type: "string"
|
|
242
|
+
},
|
|
243
|
+
final: {
|
|
244
|
+
description: "Final corrected code with all type casting issues resolved.\n\nThe complete code ready for TypeScript compilation, with all type casting\nand assignment errors properly fixed using appropriate patterns while\nmaintaining type safety and the original validation logic. When the draft\nalready successfully resolves all type casting issues with no problems\nfound during review, this value can be null, indicating no further\nrefinements are necessary.\n\nA `null` value signifies the draft corrections were already optimal and\nrequire no additional modifications.",
|
|
245
|
+
anyOf: [
|
|
246
|
+
{
|
|
247
|
+
type: "null"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
type: "string"
|
|
251
|
+
}
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
required: [
|
|
256
|
+
"review",
|
|
257
|
+
"final"
|
|
258
|
+
]
|
|
259
|
+
}
|
|
155
260
|
}
|
|
156
261
|
},
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
262
|
+
description: "Rewrite function to fix type casting and assignment errors.\n\nThis function is called when the agent detects any type casting or\nassignment related compilation error patterns.\n\nThe agent applies various fix strategies based on the error type:\n\n- **Typia tag incompatibilities**: Uses `satisfies ... as ...` pattern to\n strip incompatible tags, or `typia.assert<T>()` as a last resort\n- **Date conversions**: Uses `.toISOString()` method for Date to string\n conversions\n- **Nullable type narrowing**: Applies exhaustive checks (e.g., !== null &&\n !== undefined)\n- **typia.assert vs assertGuard**: Uses assert for value assignment,\n assertGuard for type narrowing\n- **Literal type conversions**: Uses `typia.assert<T>()` for runtime\n validation\n- **Optional chaining results**: Uses `=== true` or `??` operators\n- **\"No overlap\" errors**: Removes redundant comparisons",
|
|
263
|
+
validate: (() => { const _io0 = input => "string" === typeof input.think && "string" === typeof input.draft && ("object" === typeof input.revise && null !== input.revise && _io1(input.revise)); const _io1 = input => "string" === typeof input.review && (null === input.final || "string" === typeof input.final); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.think || _report(_exceptionable, {
|
|
264
|
+
path: _path + ".think",
|
|
265
|
+
expected: "string",
|
|
266
|
+
value: input.think
|
|
267
|
+
}), "string" === typeof input.draft || _report(_exceptionable, {
|
|
268
|
+
path: _path + ".draft",
|
|
269
|
+
expected: "string",
|
|
270
|
+
value: input.draft
|
|
271
|
+
}), ("object" === typeof input.revise && null !== input.revise || _report(_exceptionable, {
|
|
272
|
+
path: _path + ".revise",
|
|
273
|
+
expected: "IAutoBeCommonCorrectCastingApplication.IReviseProps",
|
|
274
|
+
value: input.revise
|
|
275
|
+
})) && _vo1(input.revise, _path + ".revise", true && _exceptionable) || _report(_exceptionable, {
|
|
276
|
+
path: _path + ".revise",
|
|
277
|
+
expected: "IAutoBeCommonCorrectCastingApplication.IReviseProps",
|
|
278
|
+
value: input.revise
|
|
279
|
+
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.review || _report(_exceptionable, {
|
|
280
|
+
path: _path + ".review",
|
|
281
|
+
expected: "string",
|
|
282
|
+
value: input.review
|
|
283
|
+
}), null === input.final || "string" === typeof input.final || _report(_exceptionable, {
|
|
284
|
+
path: _path + ".final",
|
|
285
|
+
expected: "(null | string)",
|
|
286
|
+
value: input.final
|
|
287
|
+
})].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
|
|
288
|
+
if (false === __is(input)) {
|
|
289
|
+
errors = [];
|
|
290
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
291
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
292
|
+
path: _path + "",
|
|
293
|
+
expected: "IAutoBeCommonCorrectCastingApplication.IProps",
|
|
294
|
+
value: input
|
|
295
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
296
|
+
path: _path + "",
|
|
297
|
+
expected: "IAutoBeCommonCorrectCastingApplication.IProps",
|
|
298
|
+
value: input
|
|
299
|
+
}))(input, "$input", true);
|
|
300
|
+
const success = 0 === errors.length;
|
|
301
|
+
return success ? {
|
|
302
|
+
success,
|
|
303
|
+
data: input
|
|
304
|
+
} : {
|
|
305
|
+
success,
|
|
306
|
+
errors,
|
|
307
|
+
data: input
|
|
308
|
+
};
|
|
187
309
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
description: "Rewrite function to fix type casting and assignment errors.\n\nThis function is called when the agent detects any type casting or\nassignment related compilation error patterns.\n\nThe agent applies various fix strategies based on the error type:\n\n- **Typia tag incompatibilities**: Uses `satisfies ... as ...` pattern to\n strip incompatible tags, or `typia.assert<T>()` as a last resort\n- **Date conversions**: Uses `.toISOString()` method for Date to string\n conversions\n- **Nullable type narrowing**: Applies exhaustive checks (e.g., !== null &&\n !== undefined)\n- **typia.assert vs assertGuard**: Uses assert for value assignment,\n assertGuard for type narrowing\n- **Literal type conversions**: Uses `typia.assert<T>()` for runtime\n validation\n- **Optional chaining results**: Uses `=== true` or `??` operators\n- **\"No overlap\" errors**: Removes redundant comparisons",
|
|
191
|
-
validate: (() => { const _io0 = input => "string" === typeof input.think && "string" === typeof input.draft && ("object" === typeof input.revise && null !== input.revise && _io1(input.revise)); const _io1 = input => "string" === typeof input.review && (null === input.final || "string" === typeof input.final); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.think || _report(_exceptionable, {
|
|
192
|
-
path: _path + ".think",
|
|
193
|
-
expected: "string",
|
|
194
|
-
value: input.think
|
|
195
|
-
}), "string" === typeof input.draft || _report(_exceptionable, {
|
|
196
|
-
path: _path + ".draft",
|
|
197
|
-
expected: "string",
|
|
198
|
-
value: input.draft
|
|
199
|
-
}), ("object" === typeof input.revise && null !== input.revise || _report(_exceptionable, {
|
|
200
|
-
path: _path + ".revise",
|
|
201
|
-
expected: "IAutoBeCommonCorrectCastingApplication.IReviseProps",
|
|
202
|
-
value: input.revise
|
|
203
|
-
})) && _vo1(input.revise, _path + ".revise", true && _exceptionable) || _report(_exceptionable, {
|
|
204
|
-
path: _path + ".revise",
|
|
205
|
-
expected: "IAutoBeCommonCorrectCastingApplication.IReviseProps",
|
|
206
|
-
value: input.revise
|
|
207
|
-
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.review || _report(_exceptionable, {
|
|
208
|
-
path: _path + ".review",
|
|
209
|
-
expected: "string",
|
|
210
|
-
value: input.review
|
|
211
|
-
}), null === input.final || "string" === typeof input.final || _report(_exceptionable, {
|
|
212
|
-
path: _path + ".final",
|
|
213
|
-
expected: "(null | string)",
|
|
214
|
-
value: input.final
|
|
215
|
-
})].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
|
|
216
|
-
if (false === __is(input)) {
|
|
217
|
-
errors = [];
|
|
218
|
-
_report = __typia_transform__validateReport._validateReport(errors);
|
|
219
|
-
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
220
|
-
path: _path + "",
|
|
221
|
-
expected: "IAutoBeCommonCorrectCastingApplication.IProps",
|
|
222
|
-
value: input
|
|
223
|
-
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
224
|
-
path: _path + "",
|
|
225
|
-
expected: "IAutoBeCommonCorrectCastingApplication.IProps",
|
|
226
|
-
value: input
|
|
227
|
-
}))(input, "$input", true);
|
|
228
|
-
const success = 0 === errors.length;
|
|
229
|
-
return success ? {
|
|
230
|
-
success,
|
|
231
|
-
data: input
|
|
232
|
-
} : {
|
|
233
|
-
success,
|
|
234
|
-
errors,
|
|
310
|
+
return {
|
|
311
|
+
success: true,
|
|
235
312
|
data: input
|
|
236
313
|
};
|
|
237
|
-
}
|
|
238
|
-
return {
|
|
239
|
-
success: true,
|
|
240
|
-
data: input
|
|
241
|
-
};
|
|
242
|
-
}; })()
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
name: "reject",
|
|
246
|
-
parameters: {
|
|
247
|
-
type: "object",
|
|
248
|
-
properties: {},
|
|
249
|
-
additionalProperties: false,
|
|
250
|
-
required: [],
|
|
251
|
-
$defs: {}
|
|
314
|
+
}; })()
|
|
252
315
|
},
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
errors
|
|
316
|
+
{
|
|
317
|
+
name: "reject",
|
|
318
|
+
parameters: {
|
|
319
|
+
type: "object",
|
|
320
|
+
properties: {},
|
|
321
|
+
additionalProperties: false,
|
|
322
|
+
required: [],
|
|
323
|
+
$defs: {}
|
|
324
|
+
},
|
|
325
|
+
description: "Reject function when error is not related to type casting or assignment.\n\nThis function is called when the compilation error is unrelated to type\ncasting issues (e.g., missing imports, syntax errors, undefined variables),\nindicating the error should be handled by a different agent.",
|
|
326
|
+
validate: (() => { const __is = input => true; let errors; let _report; return input => {
|
|
327
|
+
if (false === __is(input)) {
|
|
328
|
+
errors = [];
|
|
329
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
330
|
+
((input, _path, _exceptionable = true) => true)(input, "$input", true);
|
|
331
|
+
const success = 0 === errors.length;
|
|
332
|
+
return success ? {
|
|
333
|
+
success,
|
|
334
|
+
data: input
|
|
335
|
+
} : {
|
|
336
|
+
success,
|
|
337
|
+
errors,
|
|
338
|
+
data: input
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
return {
|
|
342
|
+
success: true,
|
|
266
343
|
data: input
|
|
267
344
|
};
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
345
|
+
}; })()
|
|
346
|
+
}
|
|
347
|
+
]
|
|
348
|
+
};
|
|
349
|
+
__typia_transform__llmApplicationFinalize._llmApplicationFinalize(application, Object.assign(Object.assign({}, {
|
|
350
|
+
validate: {
|
|
351
|
+
rewrite: validate,
|
|
352
|
+
reject: () => ({
|
|
353
|
+
success: true,
|
|
354
|
+
data: undefined,
|
|
355
|
+
}),
|
|
356
|
+
},
|
|
357
|
+
}), { equals: false }));
|
|
358
|
+
return application;
|
|
359
|
+
})(),
|
|
360
|
+
claude: (validate) => (() => {
|
|
361
|
+
const application = {
|
|
362
|
+
model: "claude",
|
|
363
|
+
options: {
|
|
364
|
+
reference: true,
|
|
365
|
+
separate: null
|
|
366
|
+
},
|
|
367
|
+
functions: [
|
|
368
|
+
{
|
|
369
|
+
name: "rewrite",
|
|
370
|
+
parameters: {
|
|
371
|
+
description: " - The analysis and correction properties\n\n------------------------------\n\nCurrent Type: {@link IAutoBeCommonCorrectCastingApplication.IProps}",
|
|
372
|
+
type: "object",
|
|
373
|
+
properties: {
|
|
374
|
+
think: {
|
|
375
|
+
description: "Initial analysis of the type casting or assignment error.\n\nContains the agent's analysis of the specific type mismatch pattern:\n\n- Type of casting error (tag incompatibility, nullable assignment, literal\n type conversion, etc.)\n- Whether nullable or undefined types are involved\n- If Date to string conversions are needed\n- The chosen fix strategy for the specific error type",
|
|
376
|
+
type: "string"
|
|
377
|
+
},
|
|
378
|
+
draft: {
|
|
379
|
+
description: "Draft correction with initial type casting fixes.\n\nThe code after applying the first round of fixes:\n\n- Satisfies patterns for tag stripping\n- Date.toISOString() conversions where needed\n- Nullable type narrowing checks\n- Literal type assertions\n- Optional chaining result handling",
|
|
380
|
+
type: "string"
|
|
381
|
+
},
|
|
382
|
+
revise: {
|
|
383
|
+
description: "Review and finalization of type casting corrections.\n\nContains the review of applied corrections and the final code with all\ntype casting issues resolved while preserving type safety and validation\nintent.",
|
|
384
|
+
$ref: "#/$defs/IAutoBeCommonCorrectCastingApplication.IReviseProps"
|
|
385
|
+
}
|
|
297
386
|
},
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
387
|
+
required: [
|
|
388
|
+
"think",
|
|
389
|
+
"draft",
|
|
390
|
+
"revise"
|
|
391
|
+
],
|
|
392
|
+
additionalProperties: false,
|
|
393
|
+
$defs: {
|
|
394
|
+
"IAutoBeCommonCorrectCastingApplication.IReviseProps": {
|
|
395
|
+
type: "object",
|
|
396
|
+
properties: {
|
|
397
|
+
review: {
|
|
398
|
+
description: "Review of the type casting correction patterns applied.\n\nExplains which correction strategies were used:\n\n- Which satisfies patterns were applied for tag issues\n- Where typia.assert or assertGuard was used\n- How Date conversions were handled\n- What nullable type narrowing was applied\n- How literal type conversions were resolved\n- Confirmation that all type casting issues are resolved",
|
|
399
|
+
type: "string"
|
|
400
|
+
},
|
|
401
|
+
final: {
|
|
402
|
+
description: "Final corrected code with all type casting issues resolved.\n\nThe complete code ready for TypeScript compilation, with all type casting\nand assignment errors properly fixed using appropriate patterns while\nmaintaining type safety and the original validation logic. When the draft\nalready successfully resolves all type casting issues with no problems\nfound during review, this value can be null, indicating no further\nrefinements are necessary.\n\nA `null` value signifies the draft corrections were already optimal and\nrequire no additional modifications.",
|
|
403
|
+
oneOf: [
|
|
404
|
+
{
|
|
405
|
+
type: "null"
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
type: "string"
|
|
409
|
+
}
|
|
410
|
+
]
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
required: [
|
|
414
|
+
"review",
|
|
415
|
+
"final"
|
|
416
|
+
]
|
|
417
|
+
}
|
|
301
418
|
}
|
|
302
419
|
},
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
420
|
+
description: "Rewrite function to fix type casting and assignment errors.\n\nThis function is called when the agent detects any type casting or\nassignment related compilation error patterns.\n\nThe agent applies various fix strategies based on the error type:\n\n- **Typia tag incompatibilities**: Uses `satisfies ... as ...` pattern to\n strip incompatible tags, or `typia.assert<T>()` as a last resort\n- **Date conversions**: Uses `.toISOString()` method for Date to string\n conversions\n- **Nullable type narrowing**: Applies exhaustive checks (e.g., !== null &&\n !== undefined)\n- **typia.assert vs assertGuard**: Uses assert for value assignment,\n assertGuard for type narrowing\n- **Literal type conversions**: Uses `typia.assert<T>()` for runtime\n validation\n- **Optional chaining results**: Uses `=== true` or `??` operators\n- **\"No overlap\" errors**: Removes redundant comparisons",
|
|
421
|
+
validate: (() => { const _io0 = input => "string" === typeof input.think && "string" === typeof input.draft && ("object" === typeof input.revise && null !== input.revise && _io1(input.revise)); const _io1 = input => "string" === typeof input.review && (null === input.final || "string" === typeof input.final); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.think || _report(_exceptionable, {
|
|
422
|
+
path: _path + ".think",
|
|
423
|
+
expected: "string",
|
|
424
|
+
value: input.think
|
|
425
|
+
}), "string" === typeof input.draft || _report(_exceptionable, {
|
|
426
|
+
path: _path + ".draft",
|
|
427
|
+
expected: "string",
|
|
428
|
+
value: input.draft
|
|
429
|
+
}), ("object" === typeof input.revise && null !== input.revise || _report(_exceptionable, {
|
|
430
|
+
path: _path + ".revise",
|
|
431
|
+
expected: "IAutoBeCommonCorrectCastingApplication.IReviseProps",
|
|
432
|
+
value: input.revise
|
|
433
|
+
})) && _vo1(input.revise, _path + ".revise", true && _exceptionable) || _report(_exceptionable, {
|
|
434
|
+
path: _path + ".revise",
|
|
435
|
+
expected: "IAutoBeCommonCorrectCastingApplication.IReviseProps",
|
|
436
|
+
value: input.revise
|
|
437
|
+
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.review || _report(_exceptionable, {
|
|
438
|
+
path: _path + ".review",
|
|
439
|
+
expected: "string",
|
|
440
|
+
value: input.review
|
|
441
|
+
}), null === input.final || "string" === typeof input.final || _report(_exceptionable, {
|
|
442
|
+
path: _path + ".final",
|
|
443
|
+
expected: "(null | string)",
|
|
444
|
+
value: input.final
|
|
445
|
+
})].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
|
|
446
|
+
if (false === __is(input)) {
|
|
447
|
+
errors = [];
|
|
448
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
449
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
450
|
+
path: _path + "",
|
|
451
|
+
expected: "IAutoBeCommonCorrectCastingApplication.IProps",
|
|
452
|
+
value: input
|
|
453
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
454
|
+
path: _path + "",
|
|
455
|
+
expected: "IAutoBeCommonCorrectCastingApplication.IProps",
|
|
456
|
+
value: input
|
|
457
|
+
}))(input, "$input", true);
|
|
458
|
+
const success = 0 === errors.length;
|
|
459
|
+
return success ? {
|
|
460
|
+
success,
|
|
461
|
+
data: input
|
|
462
|
+
} : {
|
|
463
|
+
success,
|
|
464
|
+
errors,
|
|
465
|
+
data: input
|
|
466
|
+
};
|
|
333
467
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
description: "Rewrite function to fix type casting and assignment errors.\n\nThis function is called when the agent detects any type casting or\nassignment related compilation error patterns.\n\nThe agent applies various fix strategies based on the error type:\n\n- **Typia tag incompatibilities**: Uses `satisfies ... as ...` pattern to\n strip incompatible tags, or `typia.assert<T>()` as a last resort\n- **Date conversions**: Uses `.toISOString()` method for Date to string\n conversions\n- **Nullable type narrowing**: Applies exhaustive checks (e.g., !== null &&\n !== undefined)\n- **typia.assert vs assertGuard**: Uses assert for value assignment,\n assertGuard for type narrowing\n- **Literal type conversions**: Uses `typia.assert<T>()` for runtime\n validation\n- **Optional chaining results**: Uses `=== true` or `??` operators\n- **\"No overlap\" errors**: Removes redundant comparisons",
|
|
337
|
-
validate: (() => { const _io0 = input => "string" === typeof input.think && "string" === typeof input.draft && ("object" === typeof input.revise && null !== input.revise && _io1(input.revise)); const _io1 = input => "string" === typeof input.review && (null === input.final || "string" === typeof input.final); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.think || _report(_exceptionable, {
|
|
338
|
-
path: _path + ".think",
|
|
339
|
-
expected: "string",
|
|
340
|
-
value: input.think
|
|
341
|
-
}), "string" === typeof input.draft || _report(_exceptionable, {
|
|
342
|
-
path: _path + ".draft",
|
|
343
|
-
expected: "string",
|
|
344
|
-
value: input.draft
|
|
345
|
-
}), ("object" === typeof input.revise && null !== input.revise || _report(_exceptionable, {
|
|
346
|
-
path: _path + ".revise",
|
|
347
|
-
expected: "IAutoBeCommonCorrectCastingApplication.IReviseProps",
|
|
348
|
-
value: input.revise
|
|
349
|
-
})) && _vo1(input.revise, _path + ".revise", true && _exceptionable) || _report(_exceptionable, {
|
|
350
|
-
path: _path + ".revise",
|
|
351
|
-
expected: "IAutoBeCommonCorrectCastingApplication.IReviseProps",
|
|
352
|
-
value: input.revise
|
|
353
|
-
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.review || _report(_exceptionable, {
|
|
354
|
-
path: _path + ".review",
|
|
355
|
-
expected: "string",
|
|
356
|
-
value: input.review
|
|
357
|
-
}), null === input.final || "string" === typeof input.final || _report(_exceptionable, {
|
|
358
|
-
path: _path + ".final",
|
|
359
|
-
expected: "(null | string)",
|
|
360
|
-
value: input.final
|
|
361
|
-
})].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
|
|
362
|
-
if (false === __is(input)) {
|
|
363
|
-
errors = [];
|
|
364
|
-
_report = __typia_transform__validateReport._validateReport(errors);
|
|
365
|
-
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
366
|
-
path: _path + "",
|
|
367
|
-
expected: "IAutoBeCommonCorrectCastingApplication.IProps",
|
|
368
|
-
value: input
|
|
369
|
-
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
370
|
-
path: _path + "",
|
|
371
|
-
expected: "IAutoBeCommonCorrectCastingApplication.IProps",
|
|
372
|
-
value: input
|
|
373
|
-
}))(input, "$input", true);
|
|
374
|
-
const success = 0 === errors.length;
|
|
375
|
-
return success ? {
|
|
376
|
-
success,
|
|
377
|
-
data: input
|
|
378
|
-
} : {
|
|
379
|
-
success,
|
|
380
|
-
errors,
|
|
468
|
+
return {
|
|
469
|
+
success: true,
|
|
381
470
|
data: input
|
|
382
471
|
};
|
|
383
|
-
}
|
|
384
|
-
return {
|
|
385
|
-
success: true,
|
|
386
|
-
data: input
|
|
387
|
-
};
|
|
388
|
-
}; })()
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
name: "reject",
|
|
392
|
-
parameters: {
|
|
393
|
-
type: "object",
|
|
394
|
-
properties: {},
|
|
395
|
-
additionalProperties: false,
|
|
396
|
-
required: [],
|
|
397
|
-
$defs: {}
|
|
472
|
+
}; })()
|
|
398
473
|
},
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
errors
|
|
474
|
+
{
|
|
475
|
+
name: "reject",
|
|
476
|
+
parameters: {
|
|
477
|
+
type: "object",
|
|
478
|
+
properties: {},
|
|
479
|
+
additionalProperties: false,
|
|
480
|
+
required: [],
|
|
481
|
+
$defs: {}
|
|
482
|
+
},
|
|
483
|
+
description: "Reject function when error is not related to type casting or assignment.\n\nThis function is called when the compilation error is unrelated to type\ncasting issues (e.g., missing imports, syntax errors, undefined variables),\nindicating the error should be handled by a different agent.",
|
|
484
|
+
validate: (() => { const __is = input => true; let errors; let _report; return input => {
|
|
485
|
+
if (false === __is(input)) {
|
|
486
|
+
errors = [];
|
|
487
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
488
|
+
((input, _path, _exceptionable = true) => true)(input, "$input", true);
|
|
489
|
+
const success = 0 === errors.length;
|
|
490
|
+
return success ? {
|
|
491
|
+
success,
|
|
492
|
+
data: input
|
|
493
|
+
} : {
|
|
494
|
+
success,
|
|
495
|
+
errors,
|
|
496
|
+
data: input
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
return {
|
|
500
|
+
success: true,
|
|
412
501
|
data: input
|
|
413
502
|
};
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
503
|
+
}; })()
|
|
504
|
+
}
|
|
505
|
+
]
|
|
506
|
+
};
|
|
507
|
+
__typia_transform__llmApplicationFinalize._llmApplicationFinalize(application, Object.assign(Object.assign({}, {
|
|
508
|
+
validate: {
|
|
509
|
+
rewrite: validate,
|
|
510
|
+
reject: () => ({
|
|
511
|
+
success: true,
|
|
512
|
+
data: undefined,
|
|
513
|
+
}),
|
|
514
|
+
},
|
|
515
|
+
}), { equals: false }));
|
|
516
|
+
return application;
|
|
517
|
+
})(),
|
|
423
518
|
};
|
|
424
519
|
//# sourceMappingURL=orchestrateCommonCorrectCasting.js.map
|