@autobe/agent 0.24.1 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AutoBeMockAgent.js +1 -0
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +19 -18
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/context/IAutoBeApplication.d.ts +101 -6
- package/lib/context/IAutoBeApplicationProps.d.ts +6 -2
- package/lib/factory/createAgenticaHistory.js +1 -1
- package/lib/factory/createAgenticaHistory.js.map +1 -1
- package/lib/factory/createAutoBeApplication.js +80 -90
- package/lib/factory/createAutoBeApplication.js.map +1 -1
- package/lib/factory/createAutoBeContext.js +8 -8
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/factory/getAutoBeGenerated.js +4 -1
- package/lib/factory/getAutoBeGenerated.js.map +1 -1
- package/lib/factory/getAutoBeRealizeGenerated.d.ts +2 -1
- package/lib/factory/getAutoBeRealizeGenerated.js +1 -1
- package/lib/factory/getAutoBeRealizeGenerated.js.map +1 -1
- package/lib/factory/getCriticalCompiler.js +1 -1
- package/lib/factory/getCriticalCompiler.js.map +1 -1
- package/lib/index.mjs +2222 -1393
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +5 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.d.ts +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +18 -3
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +5 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +19 -7
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +3 -2
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.d.ts +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +2 -2
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +1 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +2 -2
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js +2 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +5 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +20 -7
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.d.ts +6 -1
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +31 -23
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.d.ts +6 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +22 -6
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.d.ts +4 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +26 -5
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.d.ts +5 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +21 -5
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +5 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +20 -4
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +25 -7
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +17 -8
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +4 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +18 -11
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.d.ts +6 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +25 -10
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +4 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +9 -6
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.d.ts +5 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +33 -17
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.d.ts +5 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +36 -18
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +67 -8
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
- package/lib/orchestrate/interface/utils/OperationValidator.js +2 -1
- package/lib/orchestrate/interface/utils/OperationValidator.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.d.ts +4 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +19 -8
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.d.ts +6 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +20 -6
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.js +3 -3
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +6 -3
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +12 -6
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
- package/lib/orchestrate/{common/histories/transformCommonCorrectDateHistories.d.ts → realize/histories/transformRealizeCorrectCastingHistories.d.ts} +1 -2
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +33 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/orchestrate/realize/internal/compileRealizeFiles.js +3 -1
- package/lib/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js +25 -8
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.js +12 -8
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +3 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +16 -5
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -5
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js +1 -0
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -1
- package/lib/orchestrate/realize/utils/replaceImportStatements.js +3 -1
- package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +5 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +11 -7
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.d.ts +7 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +39 -31
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.d.ts +8 -0
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +119 -0
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -0
- package/lib/orchestrate/test/histories/transformTestWriteHistories.d.ts +5 -1
- package/lib/orchestrate/test/histories/transformTestWriteHistories.js +111 -94
- package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTest.js +20 -14
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +4 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +51 -35
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.d.ts +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +21 -4
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.d.ts +9 -0
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js +855 -0
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -0
- package/lib/orchestrate/test/orchestrateTestWrite.d.ts +4 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +9 -4
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioReviewApplication.d.ts +47 -0
- package/lib/orchestrate/{common/structures/IAutoBeCommonCorrectDateApplication.js → test/structures/IAutoBeTestScenarioReviewApplication.js} +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioReviewApplication.js.map +1 -0
- package/package.json +6 -6
- package/src/AutoBeMockAgent.ts +1 -0
- package/src/constants/AutoBeSystemPromptConstant.ts +19 -18
- package/src/context/IAutoBeApplication.ts +101 -6
- package/src/context/IAutoBeApplicationProps.ts +6 -2
- package/src/factory/createAgenticaHistory.ts +11 -5
- package/src/factory/createAutoBeContext.ts +5 -5
- package/src/factory/getAutoBeGenerated.ts +3 -0
- package/src/factory/getAutoBeRealizeGenerated.ts +3 -1
- package/src/factory/getCriticalCompiler.ts +2 -1
- package/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.ts +5 -1
- package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +16 -0
- package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +22 -7
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +3 -2
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +2 -1
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +3 -2
- package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +2 -1
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +23 -9
- package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +33 -24
- package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +26 -9
- package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +27 -5
- package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +24 -7
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +23 -6
- package/src/orchestrate/interface/orchestrateInterface.ts +29 -10
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +22 -12
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +25 -17
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +35 -23
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +9 -3
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +44 -29
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +51 -32
- package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +68 -8
- package/src/orchestrate/interface/utils/OperationValidator.ts +2 -1
- package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +20 -6
- package/src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts +24 -9
- package/src/orchestrate/prisma/orchestratePrisma.ts +7 -3
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +5 -1
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +15 -10
- package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +45 -0
- package/src/orchestrate/realize/internal/compileRealizeFiles.ts +3 -1
- package/src/orchestrate/realize/orchestRateRealizeCorrectCasting.ts +30 -8
- package/src/orchestrate/realize/orchestrateRealize.ts +36 -40
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +5 -1
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +38 -16
- package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -5
- package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +1 -0
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +5 -0
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +14 -7
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +44 -36
- package/src/orchestrate/test/histories/transformTestScenarioReviewHistories.ts +159 -0
- package/src/orchestrate/test/histories/transformTestWriteHistories.ts +35 -12
- package/src/orchestrate/test/orchestrateTest.ts +19 -13
- package/src/orchestrate/test/orchestrateTestCorrect.ts +65 -46
- package/src/orchestrate/test/orchestrateTestScenario.ts +23 -9
- package/src/orchestrate/test/orchestrateTestScenarioReview.ts +198 -0
- package/src/orchestrate/test/orchestrateTestWrite.ts +13 -4
- package/src/orchestrate/test/structures/IAutoBeTestScenarioReviewApplication.ts +52 -0
- package/lib/orchestrate/common/histories/transformCommonCorrectDateHistories.js +0 -48
- package/lib/orchestrate/common/histories/transformCommonCorrectDateHistories.js.map +0 -1
- package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.d.ts +0 -35
- package/lib/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.js.map +0 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.d.ts +0 -4
- package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.js +0 -540
- package/lib/orchestrate/realize/orchestrateRealizeCorrectDate.js.map +0 -1
- package/src/orchestrate/common/histories/transformCommonCorrectDateHistories.ts +0 -60
- package/src/orchestrate/common/structures/IAutoBeCommonCorrectDateApplication.ts +0 -40
- package/src/orchestrate/realize/orchestrateRealizeCorrectDate.ts +0 -372
|
@@ -1,372 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AutoBeProgressEventBase,
|
|
3
|
-
AutoBeRealizeAuthorization,
|
|
4
|
-
AutoBeRealizeFunction,
|
|
5
|
-
AutoBeRealizeValidateEvent,
|
|
6
|
-
IAutoBeTypeScriptCompileResult,
|
|
7
|
-
} from "@autobe/interface";
|
|
8
|
-
import { StringUtil } from "@autobe/utils";
|
|
9
|
-
import { ILlmApplication, ILlmController, ILlmSchema } from "@samchon/openapi";
|
|
10
|
-
import { IPointer } from "tstl";
|
|
11
|
-
import typia from "typia";
|
|
12
|
-
import { v7 } from "uuid";
|
|
13
|
-
|
|
14
|
-
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
15
|
-
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
16
|
-
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
17
|
-
import { transformCommonCorrectDateHistories } from "../common/histories/transformCommonCorrectDateHistories";
|
|
18
|
-
import { IAutoBeCommonCorrectDateApplication } from "../common/structures/IAutoBeCommonCorrectDateApplication";
|
|
19
|
-
import { compileRealizeFiles } from "./internal/compileRealizeFiles";
|
|
20
|
-
|
|
21
|
-
/** Result of attempting to correct a single function */
|
|
22
|
-
type CorrectionResult = {
|
|
23
|
-
result: "success" | "ignore" | "exception";
|
|
24
|
-
func: AutoBeRealizeFunction;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const orchestrateRealizeCorrectDate = async <
|
|
28
|
-
Model extends ILlmSchema.Model,
|
|
29
|
-
>(
|
|
30
|
-
ctx: AutoBeContext<Model>,
|
|
31
|
-
authorizations: AutoBeRealizeAuthorization[],
|
|
32
|
-
functions: AutoBeRealizeFunction[],
|
|
33
|
-
progress: AutoBeProgressEventBase,
|
|
34
|
-
life: number = ctx.retry,
|
|
35
|
-
): Promise<AutoBeRealizeFunction[]> => {
|
|
36
|
-
const validateEvent: AutoBeRealizeValidateEvent = await compileRealizeFiles(
|
|
37
|
-
ctx,
|
|
38
|
-
{
|
|
39
|
-
authorizations,
|
|
40
|
-
functions,
|
|
41
|
-
},
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
return predicate(
|
|
45
|
-
ctx,
|
|
46
|
-
authorizations,
|
|
47
|
-
functions,
|
|
48
|
-
[],
|
|
49
|
-
progress,
|
|
50
|
-
validateEvent,
|
|
51
|
-
life,
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const predicate = async <Model extends ILlmSchema.Model>(
|
|
56
|
-
ctx: AutoBeContext<Model>,
|
|
57
|
-
authorizations: AutoBeRealizeAuthorization[],
|
|
58
|
-
functions: AutoBeRealizeFunction[],
|
|
59
|
-
failures: IAutoBeTypeScriptCompileResult.IDiagnostic[],
|
|
60
|
-
progress: AutoBeProgressEventBase,
|
|
61
|
-
event: AutoBeRealizeValidateEvent,
|
|
62
|
-
life: number,
|
|
63
|
-
): Promise<AutoBeRealizeFunction[]> => {
|
|
64
|
-
if (event.result.type === "failure") {
|
|
65
|
-
ctx.dispatch(event);
|
|
66
|
-
|
|
67
|
-
return await correct(
|
|
68
|
-
ctx,
|
|
69
|
-
authorizations,
|
|
70
|
-
functions,
|
|
71
|
-
[...failures, ...event.result.diagnostics],
|
|
72
|
-
progress,
|
|
73
|
-
event,
|
|
74
|
-
life,
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
return functions;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const correct = async <Model extends ILlmSchema.Model>(
|
|
81
|
-
ctx: AutoBeContext<Model>,
|
|
82
|
-
authorizations: AutoBeRealizeAuthorization[],
|
|
83
|
-
functions: AutoBeRealizeFunction[],
|
|
84
|
-
failures: IAutoBeTypeScriptCompileResult.IDiagnostic[],
|
|
85
|
-
progress: AutoBeProgressEventBase,
|
|
86
|
-
event: AutoBeRealizeValidateEvent,
|
|
87
|
-
life: number,
|
|
88
|
-
): Promise<AutoBeRealizeFunction[]> => {
|
|
89
|
-
// Early returns for non-correctable cases
|
|
90
|
-
if (event.result.type !== "failure" || life < 0) {
|
|
91
|
-
return functions;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Filter only Date-related errors
|
|
95
|
-
const dateErrors = filterDateErrors(failures);
|
|
96
|
-
const locations: string[] = diagnose(event).filter(
|
|
97
|
-
(l) =>
|
|
98
|
-
functions.map((f) => f.location).includes(l) &&
|
|
99
|
-
dateErrors.some((e) => e.file === l),
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
// If no date errors found, return original functions
|
|
103
|
-
if (locations.length === 0) {
|
|
104
|
-
return functions;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
progress.total += locations.length;
|
|
108
|
-
|
|
109
|
-
const converted: CorrectionResult[] = await executeCachedBatch(
|
|
110
|
-
locations.map((location) => async (): Promise<CorrectionResult> => {
|
|
111
|
-
const func: AutoBeRealizeFunction = functions.find(
|
|
112
|
-
(f) => f.location === location,
|
|
113
|
-
)!;
|
|
114
|
-
|
|
115
|
-
const pointer: IPointer<
|
|
116
|
-
IAutoBeCommonCorrectDateApplication.IProps | false | null
|
|
117
|
-
> = {
|
|
118
|
-
value: null,
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const { tokenUsage } = await ctx.conversate({
|
|
122
|
-
source: "realizeCorrect",
|
|
123
|
-
histories: transformCommonCorrectDateHistories([
|
|
124
|
-
{
|
|
125
|
-
script: func.content,
|
|
126
|
-
diagnostics: dateErrors.filter((d) => d.file === location),
|
|
127
|
-
},
|
|
128
|
-
]),
|
|
129
|
-
controller: createController({
|
|
130
|
-
model: ctx.model,
|
|
131
|
-
then: (next) => {
|
|
132
|
-
pointer.value = next;
|
|
133
|
-
},
|
|
134
|
-
reject: () => {
|
|
135
|
-
pointer.value = false;
|
|
136
|
-
},
|
|
137
|
-
}),
|
|
138
|
-
enforceFunctionCall: true,
|
|
139
|
-
message: StringUtil.trim`
|
|
140
|
-
Fix ALL Date type problems in this code following these ABSOLUTE RULES:
|
|
141
|
-
|
|
142
|
-
🔴 CRITICAL DATE TYPE RULES:
|
|
143
|
-
1. NEVER declare variables with ': Date' type
|
|
144
|
-
2. NEVER use 'Date' as return type or parameter type
|
|
145
|
-
3. ALWAYS use 'string & tags.Format<"date-time">' for date type declarations
|
|
146
|
-
4. Use toISOStringSafe() to convert Date or string to ISO format
|
|
147
|
-
5. toISOStringSafe() REQUIRES a parameter - it's NOT optional
|
|
148
|
-
|
|
149
|
-
📅 toISOStringSafe FUNCTION SIGNATURE:
|
|
150
|
-
function toISOStringSafe(
|
|
151
|
-
value: Date | (string & tags.Format<"date-time">)
|
|
152
|
-
): string & tags.Format<"date-time">
|
|
153
|
-
|
|
154
|
-
Note: This function CANNOT accept null or undefined!
|
|
155
|
-
|
|
156
|
-
📅 CORRECT PATTERNS:
|
|
157
|
-
- Creating timestamps: toISOStringSafe(new Date())
|
|
158
|
-
- Converting nullable dates: value ? toISOStringSafe(value) : null
|
|
159
|
-
- Converting strings: toISOStringSafe(dateString)
|
|
160
|
-
- Type declarations: string & tags.Format<'date-time'>
|
|
161
|
-
- Never store Date in variables: const now = new Date() is FORBIDDEN
|
|
162
|
-
|
|
163
|
-
🚨 COMMON ERRORS TO FIX:
|
|
164
|
-
- Type 'Date' is not assignable → Use toISOStringSafe()
|
|
165
|
-
- Direct Date assignment → Wrap with toISOStringSafe()
|
|
166
|
-
- Date type in function signature → Change to string & tags.Format<'date-time'>
|
|
167
|
-
- For nullable values → Check null BEFORE calling toISOStringSafe()
|
|
168
|
-
|
|
169
|
-
Fix these Date type issues immediately. If you cannot fix them, reject the task.
|
|
170
|
-
Do not explain, just fix the code or give up.
|
|
171
|
-
`,
|
|
172
|
-
});
|
|
173
|
-
++progress.completed;
|
|
174
|
-
if (pointer.value === null)
|
|
175
|
-
return { result: "exception" as const, func: func };
|
|
176
|
-
else if (pointer.value === false)
|
|
177
|
-
return { result: "ignore" as const, func: func };
|
|
178
|
-
|
|
179
|
-
ctx.dispatch({
|
|
180
|
-
id: v7(),
|
|
181
|
-
type: "realizeCorrect",
|
|
182
|
-
content: pointer.value.revise.final,
|
|
183
|
-
created_at: new Date().toISOString(),
|
|
184
|
-
location: func.location,
|
|
185
|
-
step: ctx.state().analyze?.step ?? 0,
|
|
186
|
-
tokenUsage,
|
|
187
|
-
completed: progress.completed,
|
|
188
|
-
total: progress.total,
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
return {
|
|
192
|
-
result: "success" as const,
|
|
193
|
-
func: { ...func, content: pointer.value.revise.final },
|
|
194
|
-
};
|
|
195
|
-
}),
|
|
196
|
-
);
|
|
197
|
-
|
|
198
|
-
const newValidate: AutoBeRealizeValidateEvent = await compileRealizeFiles(
|
|
199
|
-
ctx,
|
|
200
|
-
{ authorizations, functions: converted.map((c) => c.func) },
|
|
201
|
-
);
|
|
202
|
-
|
|
203
|
-
if (newValidate.result.type === "success") {
|
|
204
|
-
return converted.map((c) => c.func);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const newLocations: string[] = diagnose(newValidate);
|
|
208
|
-
|
|
209
|
-
// Separate successful, failed, and ignored corrections
|
|
210
|
-
const { success, failed, ignored } = separateCorrectionResults(
|
|
211
|
-
converted,
|
|
212
|
-
newLocations,
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
// If no failures to retry, return success and ignored functions
|
|
216
|
-
if (failed.length === 0) {
|
|
217
|
-
return [...success, ...ignored];
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// Collect diagnostics relevant to failed functions
|
|
221
|
-
const failedLocations: string[] = failed.map((f) => f.location);
|
|
222
|
-
const allDiagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[] = [
|
|
223
|
-
...failures,
|
|
224
|
-
...(newValidate.result.type === "failure"
|
|
225
|
-
? newValidate.result.diagnostics
|
|
226
|
-
: []),
|
|
227
|
-
];
|
|
228
|
-
const relevantDiagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[] =
|
|
229
|
-
filterRelevantDiagnostics(allDiagnostics, failedLocations);
|
|
230
|
-
|
|
231
|
-
// Recursively retry failed functions
|
|
232
|
-
const retriedFunctions: AutoBeRealizeFunction[] = await predicate(
|
|
233
|
-
ctx,
|
|
234
|
-
authorizations,
|
|
235
|
-
failed,
|
|
236
|
-
relevantDiagnostics,
|
|
237
|
-
progress,
|
|
238
|
-
newValidate,
|
|
239
|
-
life - 1,
|
|
240
|
-
);
|
|
241
|
-
|
|
242
|
-
return [...success, ...ignored, ...retriedFunctions];
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Extract unique file locations from validation event diagnostics
|
|
247
|
-
*
|
|
248
|
-
* @param event - Validation event containing compilation results
|
|
249
|
-
* @returns Array of unique file paths that have errors
|
|
250
|
-
*/
|
|
251
|
-
const diagnose = (event: AutoBeRealizeValidateEvent): string[] => {
|
|
252
|
-
if (event.result.type !== "failure") {
|
|
253
|
-
return [];
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
const diagnostics = event.result.diagnostics;
|
|
257
|
-
const locations = diagnostics
|
|
258
|
-
.map((d) => d.file)
|
|
259
|
-
.filter((f): f is string => f !== null)
|
|
260
|
-
.filter((f) => f.startsWith("src/providers"));
|
|
261
|
-
|
|
262
|
-
return Array.from(new Set(locations));
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Filter diagnostics to only include Date-related errors
|
|
267
|
-
*
|
|
268
|
-
* @param diagnostics - All diagnostics
|
|
269
|
-
* @returns Date-related diagnostics only
|
|
270
|
-
*/
|
|
271
|
-
const filterDateErrors = (
|
|
272
|
-
diagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[],
|
|
273
|
-
): IAutoBeTypeScriptCompileResult.IDiagnostic[] => {
|
|
274
|
-
return diagnostics.filter((d) => {
|
|
275
|
-
const messageText = d.messageText?.toLowerCase() || "";
|
|
276
|
-
return (
|
|
277
|
-
messageText.includes("date") ||
|
|
278
|
-
messageText.includes("date-time") ||
|
|
279
|
-
messageText.includes("toisostring") ||
|
|
280
|
-
messageText.includes("cannot read property") ||
|
|
281
|
-
messageText.includes("type 'date'") ||
|
|
282
|
-
messageText.includes("tags.format<'date-time'>") ||
|
|
283
|
-
messageText.includes('tags.format<"date-time">')
|
|
284
|
-
);
|
|
285
|
-
});
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Separate correction results into successful, failed, and ignored functions
|
|
290
|
-
*
|
|
291
|
-
* @param corrections - Array of correction results
|
|
292
|
-
* @param errorLocations - File paths that still have errors
|
|
293
|
-
* @returns Object with success, failed, and ignored function arrays
|
|
294
|
-
*/
|
|
295
|
-
const separateCorrectionResults = (
|
|
296
|
-
corrections: CorrectionResult[],
|
|
297
|
-
errorLocations: string[],
|
|
298
|
-
): {
|
|
299
|
-
success: AutoBeRealizeFunction[];
|
|
300
|
-
failed: AutoBeRealizeFunction[];
|
|
301
|
-
ignored: AutoBeRealizeFunction[];
|
|
302
|
-
} => {
|
|
303
|
-
const success = corrections
|
|
304
|
-
.filter(
|
|
305
|
-
(c) =>
|
|
306
|
-
c.result === "success" && !errorLocations.includes(c.func.location),
|
|
307
|
-
)
|
|
308
|
-
.map((c) => c.func);
|
|
309
|
-
|
|
310
|
-
const failed = corrections
|
|
311
|
-
.filter(
|
|
312
|
-
(c) => c.result === "success" && errorLocations.includes(c.func.location),
|
|
313
|
-
)
|
|
314
|
-
.map((c) => c.func);
|
|
315
|
-
|
|
316
|
-
const ignored = corrections
|
|
317
|
-
.filter((c) => c.result === "ignore" || c.result === "exception")
|
|
318
|
-
.map((c) => c.func);
|
|
319
|
-
|
|
320
|
-
return { success, failed, ignored };
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Filter diagnostics to only include those relevant to specific functions
|
|
325
|
-
*
|
|
326
|
-
* @param diagnostics - All diagnostics
|
|
327
|
-
* @param functionLocations - Locations of functions to filter for
|
|
328
|
-
* @returns Filtered diagnostics
|
|
329
|
-
*/
|
|
330
|
-
const filterRelevantDiagnostics = (
|
|
331
|
-
diagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[],
|
|
332
|
-
functionLocations: string[],
|
|
333
|
-
): IAutoBeTypeScriptCompileResult.IDiagnostic[] => {
|
|
334
|
-
return diagnostics.filter(
|
|
335
|
-
(d) => d.file && functionLocations.includes(d.file),
|
|
336
|
-
);
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
const createController = <Model extends ILlmSchema.Model>(props: {
|
|
340
|
-
model: Model;
|
|
341
|
-
then: (next: IAutoBeCommonCorrectDateApplication.IProps) => void;
|
|
342
|
-
reject: () => void;
|
|
343
|
-
}): ILlmController<Model> => {
|
|
344
|
-
assertSchemaModel(props.model);
|
|
345
|
-
const application = collection[
|
|
346
|
-
props.model === "chatgpt" ? "chatgpt" : "claude"
|
|
347
|
-
] satisfies ILlmApplication<any> as any as ILlmApplication<Model>;
|
|
348
|
-
return {
|
|
349
|
-
protocol: "class",
|
|
350
|
-
name: "correctDateInvalidRequest",
|
|
351
|
-
application,
|
|
352
|
-
execute: {
|
|
353
|
-
rewrite: (next) => {
|
|
354
|
-
props.then(next);
|
|
355
|
-
},
|
|
356
|
-
reject: () => {
|
|
357
|
-
props.reject();
|
|
358
|
-
},
|
|
359
|
-
} satisfies IAutoBeCommonCorrectDateApplication,
|
|
360
|
-
};
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
const collection = {
|
|
364
|
-
chatgpt: typia.llm.application<
|
|
365
|
-
IAutoBeCommonCorrectDateApplication,
|
|
366
|
-
"chatgpt"
|
|
367
|
-
>(),
|
|
368
|
-
claude: typia.llm.application<
|
|
369
|
-
IAutoBeCommonCorrectDateApplication,
|
|
370
|
-
"claude"
|
|
371
|
-
>(),
|
|
372
|
-
};
|