@autobe/agent 0.25.6 → 0.26.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/AutoBeAgent.js +3 -0
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/AutoBeMockAgent.js +15 -12
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +26 -19
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/factory/consentFunctionCall.js +3 -0
- package/lib/factory/consentFunctionCall.js.map +1 -1
- package/lib/factory/createAutoBeContext.js +4 -1
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/factory/getCommonPrompt.d.ts +2 -0
- package/lib/factory/getCommonPrompt.js +20 -0
- package/lib/factory/getCommonPrompt.js.map +1 -0
- package/lib/index.mjs +2636 -2258
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +2 -2
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +6 -6
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +73 -73
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +2 -2
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +9 -9
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +1 -1
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +2 -17
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +1 -1
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.d.ts +6 -0
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js +58 -0
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js.map +1 -0
- package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +8 -8
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
- 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.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +46 -20
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.d.ts +5 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js +51 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.d.ts +11 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js +81 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterface.js +24 -4
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +52 -52
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +57 -57
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +43 -43
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +4 -4
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.d.ts +7 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +444 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.d.ts +12 -0
- package/lib/orchestrate/interface/{orchestrateInterfaceSchemasReview.js → orchestrateInterfaceSchemaReview.js} +66 -57
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +9 -6
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +22 -22
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +7 -7
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.d.ts +101 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.d.ts +97 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.d.ts +44 -0
- package/lib/orchestrate/interface/structures/{IAutobeInterfaceSchemasReviewApplication.js → IAutoBeInterfaceSchemaRenameApplication.js} +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.d.ts +92 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +42 -1
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +94 -0
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
- package/lib/orchestrate/interface/utils/OperationValidator.d.ts +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +13 -13
- 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.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +2 -2
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +2 -2
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +2 -2
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +2 -2
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.d.ts +2 -2
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js +8 -7
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +4 -4
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.d.ts +4 -7
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +8 -18
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +0 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +8 -28
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +16 -280
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.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/orchestrateRealize.js +2 -2
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +12 -12
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +9 -9
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +43 -22
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.js → orchestrateRealizeCorrectCasting.js} +58 -46
- package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js.map +1 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +3 -3
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.d.ts +2 -2
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js +6 -6
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js.map +1 -1
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -1
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +2 -2
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteDto.js +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js +2 -2
- package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -1
- package/lib/orchestrate/realize/utils/printErrorHints.js +1 -1
- package/lib/orchestrate/realize/utils/printErrorHints.js.map +1 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js +1 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +5 -22
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +10 -10
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +5 -5
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +2 -2
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +2 -0
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +1 -0
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +26 -26
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js +2 -2
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
- package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.d.ts → IAutoBeTestScenarioAuthorizationActor.d.ts} +1 -1
- package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.js → IAutoBeTestScenarioAuthorizationActor.js} +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationActor.js.map +1 -0
- package/package.json +5 -5
- package/src/AutoBeAgent.ts +3 -0
- package/src/AutoBeMockAgent.ts +15 -12
- package/src/constants/AutoBeSystemPromptConstant.ts +26 -19
- package/src/factory/consentFunctionCall.ts +4 -0
- package/src/factory/createAutoBeContext.ts +5 -1
- package/src/factory/getCommonPrompt.ts +25 -0
- package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +5 -5
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +1 -1
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +3 -3
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +9 -9
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +1 -1
- package/src/orchestrate/common/histories/transformCommonCorrectCastingHistories.ts +2 -20
- package/src/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.ts +65 -0
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +9 -9
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +45 -20
- package/src/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.ts +55 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.ts +90 -0
- package/src/orchestrate/interface/orchestrateInterface.ts +34 -14
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +18 -18
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +4 -4
- package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +2 -2
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +5 -5
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +23 -23
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +4 -4
- package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +2 -2
- package/src/orchestrate/interface/orchestrateInterfaceSchemaRename.ts +269 -0
- package/src/orchestrate/interface/{orchestrateInterfaceSchemasReview.ts → orchestrateInterfaceSchemaReview.ts} +88 -70
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +16 -8
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +26 -22
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +7 -7
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.ts +108 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.ts +104 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.ts +45 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.ts +99 -0
- package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +45 -3
- package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +110 -0
- package/src/orchestrate/interface/utils/OperationValidator.ts +1 -1
- package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +12 -12
- package/src/orchestrate/prisma/orchestratePrisma.ts +4 -4
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +4 -4
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +7 -7
- package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +8 -7
- package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +4 -4
- package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +14 -28
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +13 -30
- package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +20 -285
- package/src/orchestrate/realize/orchestrateRealize.ts +1 -1
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +9 -9
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +3 -3
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +74 -60
- package/src/orchestrate/realize/{orchestRateRealizeCorrectCasting.ts → orchestrateRealizeCorrectCasting.ts} +86 -85
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +3 -3
- package/src/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.ts +10 -7
- package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -1
- package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +2 -2
- package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +1 -1
- package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +2 -2
- package/src/orchestrate/realize/utils/printErrorHints.ts +1 -1
- package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +1 -1
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +6 -24
- package/src/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.ts +10 -10
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +12 -10
- package/src/orchestrate/test/orchestrateTestCorrect.ts +2 -0
- package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +1 -0
- package/src/orchestrate/test/orchestrateTestScenario.ts +30 -30
- package/src/orchestrate/test/orchestrateTestScenarioReview.ts +2 -2
- package/src/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.ts → IAutoBeTestScenarioAuthorizationActor.ts} +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +0 -4
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +0 -60
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +0 -9
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +0 -1
- package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +0 -91
- package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.js.map +0 -1
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +0 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.js.map +0 -1
- package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +0 -67
- package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +0 -96
- /package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.d.ts → orchestrateRealizeCorrectCasting.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
AutoBeAnalyzeActor,
|
|
4
4
|
AutoBeInterfaceAuthorization,
|
|
5
5
|
AutoBeOpenApi,
|
|
6
6
|
AutoBeProgressEventBase,
|
|
@@ -24,23 +24,23 @@ export async function orchestrateInterfaceAuthorizations<
|
|
|
24
24
|
ctx: AutoBeContext<Model>,
|
|
25
25
|
instruction: string,
|
|
26
26
|
): Promise<AutoBeInterfaceAuthorization[]> {
|
|
27
|
-
const
|
|
27
|
+
const actors: AutoBeAnalyzeActor[] = ctx.state().analyze?.actors ?? [];
|
|
28
28
|
const progress: AutoBeProgressEventBase = {
|
|
29
|
-
total:
|
|
29
|
+
total: actors.length,
|
|
30
30
|
completed: 0,
|
|
31
31
|
};
|
|
32
32
|
const authorizations: AutoBeInterfaceAuthorization[] =
|
|
33
33
|
await executeCachedBatch(
|
|
34
|
-
|
|
34
|
+
actors.map((a) => async (promptCacheKey) => {
|
|
35
35
|
const event: AutoBeInterfaceAuthorizationEvent = await process(ctx, {
|
|
36
|
-
|
|
36
|
+
actor: a,
|
|
37
37
|
progress,
|
|
38
38
|
promptCacheKey,
|
|
39
39
|
instruction,
|
|
40
40
|
});
|
|
41
41
|
ctx.dispatch(event);
|
|
42
42
|
return {
|
|
43
|
-
|
|
43
|
+
name: a.name,
|
|
44
44
|
operations: event.operations,
|
|
45
45
|
};
|
|
46
46
|
}),
|
|
@@ -53,7 +53,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
53
53
|
ctx: AutoBeContext<Model>,
|
|
54
54
|
props: {
|
|
55
55
|
instruction: string;
|
|
56
|
-
|
|
56
|
+
actor: AutoBeAnalyzeActor;
|
|
57
57
|
progress: AutoBeProgressEventBase;
|
|
58
58
|
promptCacheKey: string;
|
|
59
59
|
},
|
|
@@ -67,11 +67,11 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
67
67
|
histories: transformInterfaceAuthorizationsHistories({
|
|
68
68
|
state: ctx.state(),
|
|
69
69
|
instruction: props.instruction,
|
|
70
|
-
|
|
70
|
+
actor: props.actor,
|
|
71
71
|
}),
|
|
72
72
|
controller: createController({
|
|
73
73
|
model: ctx.model,
|
|
74
|
-
|
|
74
|
+
actor: props.actor,
|
|
75
75
|
build: (next) => {
|
|
76
76
|
pointer.value = next;
|
|
77
77
|
},
|
|
@@ -97,7 +97,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
97
97
|
|
|
98
98
|
function createController<Model extends ILlmSchema.Model>(props: {
|
|
99
99
|
model: Model;
|
|
100
|
-
|
|
100
|
+
actor: AutoBeAnalyzeActor;
|
|
101
101
|
build: (next: IAutoBeInterfaceAuthorizationsApplication.IProps) => void;
|
|
102
102
|
}): IAgenticaController.IClass<Model> {
|
|
103
103
|
assertSchemaModel(props.model);
|
|
@@ -110,7 +110,7 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
110
110
|
if (result.success === false) return result;
|
|
111
111
|
|
|
112
112
|
// remove login operation for guest role
|
|
113
|
-
if (props.
|
|
113
|
+
if (props.actor.kind === "guest") {
|
|
114
114
|
result.data.operations = result.data.operations.filter(
|
|
115
115
|
(op) => op.authorizationType !== "login",
|
|
116
116
|
);
|
|
@@ -118,9 +118,9 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
118
118
|
|
|
119
119
|
const errors: IValidation.IError[] = [];
|
|
120
120
|
result.data.operations.forEach((op, i) => {
|
|
121
|
-
// validate
|
|
122
|
-
if (op.
|
|
123
|
-
op.
|
|
121
|
+
// validate authorizationActor
|
|
122
|
+
if (op.authorizationActor !== null) {
|
|
123
|
+
op.authorizationActor = props.actor.name;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
// validate responseBody.typeName -> must be ~.IAuthorized
|
|
@@ -150,7 +150,7 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
150
150
|
For authentication operations (login, join, refresh), the response body type name must follow the convention "I{RoleName}.IAuthorized".
|
|
151
151
|
|
|
152
152
|
This standardized naming convention ensures consistency across all authentication endpoints and clearly identifies authorization response types.
|
|
153
|
-
The
|
|
153
|
+
The actor name should be in PascalCase format (e.g., IUser.IAuthorized, IAdmin.IAuthorized, ISeller.IAuthorized).
|
|
154
154
|
`,
|
|
155
155
|
});
|
|
156
156
|
});
|
|
@@ -165,7 +165,7 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
165
165
|
.filter((v) => v !== null),
|
|
166
166
|
);
|
|
167
167
|
for (const type of typia.misc.literals<AuthorizationType>())
|
|
168
|
-
if (props.
|
|
168
|
+
if (props.actor.kind === "guest" && type === "login") continue;
|
|
169
169
|
else if (authorizationTypes.has(type) === false)
|
|
170
170
|
errors.push({
|
|
171
171
|
path: "$input.operations[].authorizationType",
|
|
@@ -176,10 +176,10 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
176
176
|
value: `No authorizationType "${type}" found in any operation`,
|
|
177
177
|
description: StringUtil.trim`
|
|
178
178
|
There must be an operation that has defined AutoBeOpenApi.IOperation.authorizationType := "${type}"
|
|
179
|
-
for the "${props.
|
|
179
|
+
for the "${props.actor}" role's authorization activity; "${type}".
|
|
180
180
|
|
|
181
181
|
However, none of the operations have the AutoBeOpenApi.IOperation.authorizationType := "${type}"
|
|
182
|
-
value, so that the "${props.
|
|
182
|
+
value, so that the "${props.actor}" cannot perform the authorization ${type} activity.
|
|
183
183
|
|
|
184
184
|
Please make that operation at the next function calling. You have to do it.
|
|
185
185
|
`,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
AutoBeInterfaceEndpointEvent,
|
|
4
4
|
AutoBeOpenApi,
|
|
5
5
|
AutoBeProgressEventBase,
|
|
6
6
|
} from "@autobe/interface";
|
|
@@ -72,7 +72,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
72
72
|
value: null,
|
|
73
73
|
};
|
|
74
74
|
const { tokenUsage } = await ctx.conversate({
|
|
75
|
-
source: "
|
|
75
|
+
source: "interfaceEndpoint",
|
|
76
76
|
histories: transformInterfaceEndpointHistories({
|
|
77
77
|
state: ctx.state(),
|
|
78
78
|
group: props.group,
|
|
@@ -92,8 +92,8 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
92
92
|
});
|
|
93
93
|
if (pointer.value === null) throw new Error("Failed to generate endpoints."); // unreachable
|
|
94
94
|
|
|
95
|
-
const event:
|
|
96
|
-
type: "
|
|
95
|
+
const event: AutoBeInterfaceEndpointEvent = {
|
|
96
|
+
type: "interfaceEndpoint",
|
|
97
97
|
id: v7(),
|
|
98
98
|
endpoints: new HashSet(
|
|
99
99
|
pointer.value,
|
|
@@ -23,7 +23,7 @@ export async function orchestrateInterfaceEndpointsReview<
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const { tokenUsage } = await ctx.conversate({
|
|
26
|
-
source: "
|
|
26
|
+
source: "interfaceEndpointReview",
|
|
27
27
|
histories: transformInterfaceEndpointsReviewHistories(
|
|
28
28
|
ctx.state(),
|
|
29
29
|
endpoints,
|
|
@@ -46,7 +46,7 @@ export async function orchestrateInterfaceEndpointsReview<
|
|
|
46
46
|
|
|
47
47
|
ctx.dispatch({
|
|
48
48
|
id: v7(),
|
|
49
|
-
type: "
|
|
49
|
+
type: "interfaceEndpointReview",
|
|
50
50
|
endpoints,
|
|
51
51
|
content: response,
|
|
52
52
|
created_at: new Date().toISOString(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
|
-
import {
|
|
2
|
+
import { AutoBeInterfaceGroupEvent } from "@autobe/interface";
|
|
3
3
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
4
4
|
import { IPointer } from "tstl";
|
|
5
5
|
import typia from "typia";
|
|
@@ -18,13 +18,13 @@ export async function orchestrateInterfaceGroups<
|
|
|
18
18
|
instruction: string;
|
|
19
19
|
message?: string;
|
|
20
20
|
},
|
|
21
|
-
): Promise<
|
|
21
|
+
): Promise<AutoBeInterfaceGroupEvent> {
|
|
22
22
|
const start: Date = new Date();
|
|
23
23
|
const pointer: IPointer<IAutoBeInterfaceGroupApplication.IProps | null> = {
|
|
24
24
|
value: null,
|
|
25
25
|
};
|
|
26
26
|
const { tokenUsage } = await ctx.conversate({
|
|
27
|
-
source: "
|
|
27
|
+
source: "interfaceGroup",
|
|
28
28
|
histories: transformInterfaceGroupHistories({
|
|
29
29
|
state: ctx.state(),
|
|
30
30
|
instruction: props.instruction,
|
|
@@ -40,13 +40,13 @@ export async function orchestrateInterfaceGroups<
|
|
|
40
40
|
});
|
|
41
41
|
if (pointer.value === null) throw new Error("Failed to generate groups."); // unreachable
|
|
42
42
|
return {
|
|
43
|
-
type: "
|
|
43
|
+
type: "interfaceGroup",
|
|
44
44
|
id: v7(),
|
|
45
45
|
created_at: start.toISOString(),
|
|
46
46
|
groups: pointer.value.groups,
|
|
47
47
|
tokenUsage,
|
|
48
48
|
step: ctx.state().analyze?.step ?? 0,
|
|
49
|
-
} satisfies
|
|
49
|
+
} satisfies AutoBeInterfaceGroupEvent;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
function createController<Model extends ILlmSchema.Model>(props: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
AutoBeInterfaceOperationEvent,
|
|
4
4
|
AutoBeOpenApi,
|
|
5
5
|
AutoBeProgressEventBase,
|
|
6
6
|
} from "@autobe/interface";
|
|
@@ -120,7 +120,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
120
120
|
value: null,
|
|
121
121
|
};
|
|
122
122
|
const { tokenUsage } = await ctx.conversate({
|
|
123
|
-
source: "
|
|
123
|
+
source: "interfaceOperation",
|
|
124
124
|
histories: transformInterfaceOperationHistories({
|
|
125
125
|
state: ctx.state(),
|
|
126
126
|
endpoints: props.endpoints.toJSON(),
|
|
@@ -128,11 +128,11 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
128
128
|
}),
|
|
129
129
|
controller: createController({
|
|
130
130
|
model: ctx.model,
|
|
131
|
-
|
|
131
|
+
actors: ctx.state().analyze?.actors.map((it) => it.name) ?? [],
|
|
132
132
|
build: (operations) => {
|
|
133
133
|
pointer.value ??= [];
|
|
134
134
|
const matrix: AutoBeOpenApi.IOperation[][] = operations.map((op) => {
|
|
135
|
-
if (op.
|
|
135
|
+
if (op.authorizationActors.length === 0)
|
|
136
136
|
return [
|
|
137
137
|
{
|
|
138
138
|
...op,
|
|
@@ -141,19 +141,19 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
141
141
|
[prefix, ...op.path.split("/")]
|
|
142
142
|
.filter((it) => it !== "")
|
|
143
143
|
.join("/"),
|
|
144
|
-
|
|
144
|
+
authorizationActor: null,
|
|
145
145
|
authorizationType: null,
|
|
146
146
|
prerequisites: [],
|
|
147
147
|
},
|
|
148
148
|
];
|
|
149
|
-
return op.
|
|
149
|
+
return op.authorizationActors.map((actor) => ({
|
|
150
150
|
...op,
|
|
151
151
|
path:
|
|
152
152
|
"/" +
|
|
153
|
-
[prefix,
|
|
153
|
+
[prefix, actor, ...op.path.split("/")]
|
|
154
154
|
.filter((it) => it !== "")
|
|
155
155
|
.join("/"),
|
|
156
|
-
|
|
156
|
+
authorizationActor: actor,
|
|
157
157
|
authorizationType: null,
|
|
158
158
|
prerequisites: [],
|
|
159
159
|
}));
|
|
@@ -163,10 +163,10 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
163
163
|
props.progress.total += operations
|
|
164
164
|
.map((op) =>
|
|
165
165
|
props.endpoints.has({ path: op.path, method: op.method })
|
|
166
|
-
? op.
|
|
166
|
+
? op.authorizationActors.length === 0
|
|
167
167
|
? 0
|
|
168
|
-
: op.
|
|
169
|
-
: op.
|
|
168
|
+
: op.authorizationActors.length - 1
|
|
169
|
+
: op.authorizationActors.length,
|
|
170
170
|
)
|
|
171
171
|
.reduce((a, b) => a + b, 0);
|
|
172
172
|
},
|
|
@@ -178,20 +178,20 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
178
178
|
if (pointer.value === null) throw new Error("Failed to create operations."); // never be happened
|
|
179
179
|
|
|
180
180
|
ctx.dispatch({
|
|
181
|
-
type: "
|
|
181
|
+
type: "interfaceOperation",
|
|
182
182
|
id: v7(),
|
|
183
183
|
operations: pointer.value,
|
|
184
184
|
tokenUsage,
|
|
185
185
|
...props.progress,
|
|
186
186
|
step: ctx.state().analyze?.step ?? 0,
|
|
187
187
|
created_at: new Date().toISOString(),
|
|
188
|
-
} satisfies
|
|
188
|
+
} satisfies AutoBeInterfaceOperationEvent);
|
|
189
189
|
return pointer.value;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
function createController<Model extends ILlmSchema.Model>(props: {
|
|
193
193
|
model: Model;
|
|
194
|
-
|
|
194
|
+
actors: string[];
|
|
195
195
|
build: (
|
|
196
196
|
operations: IAutoBeInterfaceOperationApplication.IOperation[],
|
|
197
197
|
) => void;
|
|
@@ -216,21 +216,21 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
216
216
|
|
|
217
217
|
operations.forEach((op, i) => {
|
|
218
218
|
// validate roles
|
|
219
|
-
if (props.
|
|
220
|
-
else if (op.
|
|
221
|
-
op.
|
|
222
|
-
if (props.
|
|
219
|
+
if (props.actors.length === 0) op.authorizationActors = [];
|
|
220
|
+
else if (op.authorizationActors.length !== 0 && props.actors.length !== 0)
|
|
221
|
+
op.authorizationActors.forEach((actor, j) => {
|
|
222
|
+
if (props.actors.includes(actor) === true) return;
|
|
223
223
|
errors.push({
|
|
224
|
-
path: `$input.operations[${i}].
|
|
225
|
-
expected: `null | ${props.
|
|
224
|
+
path: `$input.operations[${i}].authorizationActors[${j}]`,
|
|
225
|
+
expected: `null | ${props.actors.map((str) => JSON.stringify(str)).join(" | ")}`,
|
|
226
226
|
description: StringUtil.trim`
|
|
227
|
-
|
|
227
|
+
Actor "${actor}" is not defined in the roles list.
|
|
228
228
|
|
|
229
229
|
Please select one of them below, or do not define (\`null\`):
|
|
230
230
|
|
|
231
|
-
${props.
|
|
231
|
+
${props.actors.map((role) => `- ${role}`).join("\n")}
|
|
232
232
|
`,
|
|
233
|
-
value:
|
|
233
|
+
value: actor,
|
|
234
234
|
});
|
|
235
235
|
});
|
|
236
236
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
AutoBeInterfaceOperationReviewEvent,
|
|
4
4
|
AutoBeOpenApi,
|
|
5
5
|
AutoBePrisma,
|
|
6
6
|
AutoBeProgressEventBase,
|
|
@@ -29,7 +29,7 @@ export async function orchestrateInterfaceOperationsReview<
|
|
|
29
29
|
value: null,
|
|
30
30
|
};
|
|
31
31
|
const { tokenUsage } = await ctx.conversate({
|
|
32
|
-
source: "
|
|
32
|
+
source: "interfaceOperationReview",
|
|
33
33
|
histories: transformInterfaceOperationsReviewHistories(ctx, operations),
|
|
34
34
|
controller: createReviewController({
|
|
35
35
|
model: ctx.model,
|
|
@@ -54,7 +54,7 @@ export async function orchestrateInterfaceOperationsReview<
|
|
|
54
54
|
);
|
|
55
55
|
|
|
56
56
|
ctx.dispatch({
|
|
57
|
-
type: "
|
|
57
|
+
type: "interfaceOperationReview",
|
|
58
58
|
id: v7(),
|
|
59
59
|
operations: content,
|
|
60
60
|
review: pointer.value.think.review,
|
|
@@ -65,7 +65,7 @@ export async function orchestrateInterfaceOperationsReview<
|
|
|
65
65
|
step: ctx.state().analyze?.step ?? 0,
|
|
66
66
|
total: progress.total,
|
|
67
67
|
completed: ++progress.completed,
|
|
68
|
-
} satisfies
|
|
68
|
+
} satisfies AutoBeInterfaceOperationReviewEvent);
|
|
69
69
|
return content;
|
|
70
70
|
} catch {
|
|
71
71
|
++progress.completed;
|
|
@@ -108,7 +108,7 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
|
108
108
|
|
|
109
109
|
try {
|
|
110
110
|
const { tokenUsage } = await ctx.conversate({
|
|
111
|
-
source: "
|
|
111
|
+
source: "interfacePrerequisite",
|
|
112
112
|
controller: createController({
|
|
113
113
|
model: ctx.model,
|
|
114
114
|
document: props.document,
|
|
@@ -131,7 +131,7 @@ async function divideAndConquer<Model extends ILlmSchema.Model>(
|
|
|
131
131
|
|
|
132
132
|
props.progress.completed += pointer.value.length;
|
|
133
133
|
ctx.dispatch({
|
|
134
|
-
type: "
|
|
134
|
+
type: "interfacePrerequisite",
|
|
135
135
|
id: v7(),
|
|
136
136
|
created_at: new Date().toISOString(),
|
|
137
137
|
tokenUsage,
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { IAgenticaController } from "@agentica/core";
|
|
2
|
+
import {
|
|
3
|
+
AutoBeInterfaceSchemaRefactor,
|
|
4
|
+
AutoBeInterfaceSchemaRenameEvent,
|
|
5
|
+
AutoBeOpenApi,
|
|
6
|
+
AutoBeProgressEventBase,
|
|
7
|
+
} from "@autobe/interface";
|
|
8
|
+
import {
|
|
9
|
+
ILlmApplication,
|
|
10
|
+
ILlmSchema,
|
|
11
|
+
OpenApi,
|
|
12
|
+
OpenApiTypeChecker,
|
|
13
|
+
} from "@samchon/openapi";
|
|
14
|
+
import { IPointer } from "tstl";
|
|
15
|
+
import typia from "typia";
|
|
16
|
+
import { v7 } from "uuid";
|
|
17
|
+
|
|
18
|
+
import { AutoBeConfigConstant } from "../../constants/AutoBeConfigConstant";
|
|
19
|
+
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
20
|
+
import { assertSchemaModel } from "../../context/assertSchemaModel";
|
|
21
|
+
import { divideArray } from "../../utils/divideArray";
|
|
22
|
+
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
23
|
+
import { transformInterfaceSchemaRenameHistories } from "./histories/transformInterfaceSchemaRenameHistories";
|
|
24
|
+
import { IAutoBeInterfaceSchemaRenameApplication } from "./structures/IAutoBeInterfaceSchemaRenameApplication";
|
|
25
|
+
|
|
26
|
+
export async function orchestrateInterfaceSchemaRename<
|
|
27
|
+
Mode extends ILlmSchema.Model,
|
|
28
|
+
>(
|
|
29
|
+
ctx: AutoBeContext<Mode>,
|
|
30
|
+
document: AutoBeOpenApi.IDocument,
|
|
31
|
+
capacity: number = AutoBeConfigConstant.INTERFACE_CAPACITY * 10,
|
|
32
|
+
): Promise<void> {
|
|
33
|
+
const tableNames: string[] = ctx
|
|
34
|
+
.state()
|
|
35
|
+
.prisma!.result.data.files.map((f) => f.models)
|
|
36
|
+
.flat()
|
|
37
|
+
.map((m) => m.name)
|
|
38
|
+
.filter((m) => m.startsWith("mv_") === false);
|
|
39
|
+
const entireTypeNames: Set<string> = new Set();
|
|
40
|
+
for (let name of Object.keys(document.components.schemas)) {
|
|
41
|
+
if (name.startsWith("IPage")) name = name.replace("IPage", "");
|
|
42
|
+
name = name.split(".")[0];
|
|
43
|
+
entireTypeNames.add(name);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const matrix: string[][] = divideArray({
|
|
47
|
+
array: Array.from(entireTypeNames),
|
|
48
|
+
capacity,
|
|
49
|
+
});
|
|
50
|
+
const progress: AutoBeProgressEventBase = {
|
|
51
|
+
total: entireTypeNames.size,
|
|
52
|
+
completed: 0,
|
|
53
|
+
};
|
|
54
|
+
const refactors: AutoBeInterfaceSchemaRefactor[] = uniqueRefactors(
|
|
55
|
+
(
|
|
56
|
+
await executeCachedBatch(
|
|
57
|
+
matrix.map(
|
|
58
|
+
(typeNames) => (promptCacheKey) =>
|
|
59
|
+
divideAndConquer(ctx, {
|
|
60
|
+
tableNames,
|
|
61
|
+
typeNames,
|
|
62
|
+
promptCacheKey,
|
|
63
|
+
progress,
|
|
64
|
+
}),
|
|
65
|
+
),
|
|
66
|
+
)
|
|
67
|
+
).flat(),
|
|
68
|
+
);
|
|
69
|
+
orchestrateInterfaceSchemaRename.rename(document, refactors);
|
|
70
|
+
}
|
|
71
|
+
export namespace orchestrateInterfaceSchemaRename {
|
|
72
|
+
export const rename = (
|
|
73
|
+
document: AutoBeOpenApi.IDocument,
|
|
74
|
+
refactors: AutoBeInterfaceSchemaRefactor[],
|
|
75
|
+
): void => {
|
|
76
|
+
// REPLACE RULE
|
|
77
|
+
const replace = (typeName: string): string | null => {
|
|
78
|
+
// exact match
|
|
79
|
+
const exact: AutoBeInterfaceSchemaRefactor | undefined = refactors.find(
|
|
80
|
+
(r) => r.from === typeName,
|
|
81
|
+
);
|
|
82
|
+
if (exact !== undefined) return exact.to;
|
|
83
|
+
|
|
84
|
+
// T.X match
|
|
85
|
+
const prefix: AutoBeInterfaceSchemaRefactor | undefined = refactors.find(
|
|
86
|
+
(r) => typeName.startsWith(`${r.from}.`),
|
|
87
|
+
);
|
|
88
|
+
if (prefix !== undefined)
|
|
89
|
+
return typeName.replace(`${prefix.from}.`, `${prefix.to}.`);
|
|
90
|
+
|
|
91
|
+
// IPageT exact match
|
|
92
|
+
const pageExact: AutoBeInterfaceSchemaRefactor | undefined =
|
|
93
|
+
refactors.find((r) => typeName === `IPage${r.from}`);
|
|
94
|
+
if (pageExact !== undefined) return `IPage${pageExact.to}`;
|
|
95
|
+
|
|
96
|
+
// IPageT.X match
|
|
97
|
+
const pagePrefix: AutoBeInterfaceSchemaRefactor | undefined =
|
|
98
|
+
refactors.find((r) => typeName.startsWith(`IPage${r.from}.`));
|
|
99
|
+
if (pagePrefix !== undefined)
|
|
100
|
+
return typeName.replace(
|
|
101
|
+
`IPage${pagePrefix.from}.`,
|
|
102
|
+
`IPage${pagePrefix.to}.`,
|
|
103
|
+
);
|
|
104
|
+
return null;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// JSON SCHEMA REFERENCES
|
|
108
|
+
const $refChangers: Map<OpenApi.IJsonSchema, () => void> = new Map();
|
|
109
|
+
for (const value of Object.values(document.components.schemas))
|
|
110
|
+
OpenApiTypeChecker.visit({
|
|
111
|
+
components: document.components,
|
|
112
|
+
schema: value,
|
|
113
|
+
closure: (schema) => {
|
|
114
|
+
if (OpenApiTypeChecker.isReference(schema) === false) return;
|
|
115
|
+
const x: string = schema.$ref.split("/").pop()!;
|
|
116
|
+
const y: string | null = replace(x);
|
|
117
|
+
if (y !== null)
|
|
118
|
+
$refChangers.set(schema, () => {
|
|
119
|
+
schema.$ref = `#/components/schemas/${y}`;
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
for (const fn of $refChangers.values()) fn();
|
|
124
|
+
|
|
125
|
+
// COMPONENT SCHEMAS
|
|
126
|
+
for (const x of Object.keys(document.components.schemas)) {
|
|
127
|
+
const y: string | null = replace(x);
|
|
128
|
+
if (y !== null) {
|
|
129
|
+
document.components.schemas[y] = document.components.schemas[x];
|
|
130
|
+
delete document.components.schemas[x];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// OPERATIONS
|
|
135
|
+
for (const op of document.operations) {
|
|
136
|
+
if (op.requestBody)
|
|
137
|
+
op.requestBody.typeName =
|
|
138
|
+
replace(op.requestBody.typeName) ?? op.requestBody.typeName;
|
|
139
|
+
if (op.responseBody)
|
|
140
|
+
op.responseBody.typeName =
|
|
141
|
+
replace(op.responseBody.typeName) ?? op.responseBody.typeName;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const divideAndConquer = async <Model extends ILlmSchema.Model>(
|
|
147
|
+
ctx: AutoBeContext<Model>,
|
|
148
|
+
props: {
|
|
149
|
+
tableNames: string[];
|
|
150
|
+
typeNames: string[];
|
|
151
|
+
promptCacheKey: string;
|
|
152
|
+
progress: AutoBeProgressEventBase;
|
|
153
|
+
},
|
|
154
|
+
): Promise<AutoBeInterfaceSchemaRefactor[]> => {
|
|
155
|
+
try {
|
|
156
|
+
const pointer: IPointer<IAutoBeInterfaceSchemaRenameApplication.IProps | null> =
|
|
157
|
+
{
|
|
158
|
+
value: null,
|
|
159
|
+
};
|
|
160
|
+
const { tokenUsage } = await ctx.conversate({
|
|
161
|
+
source: "interfaceSchemaRename",
|
|
162
|
+
controller: createController<Model>(
|
|
163
|
+
ctx.model,
|
|
164
|
+
(value) => (pointer.value = value),
|
|
165
|
+
),
|
|
166
|
+
histories: transformInterfaceSchemaRenameHistories(props),
|
|
167
|
+
enforceFunctionCall: true,
|
|
168
|
+
promptCacheKey: props.promptCacheKey,
|
|
169
|
+
message: "Rename DTO type names for consistency and clarity.",
|
|
170
|
+
});
|
|
171
|
+
if (pointer.value === null) {
|
|
172
|
+
props.progress.completed += props.typeNames.length;
|
|
173
|
+
return [];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
pointer.value.refactors = uniqueRefactors(pointer.value.refactors);
|
|
177
|
+
ctx.dispatch({
|
|
178
|
+
type: "interfaceSchemaRename",
|
|
179
|
+
id: v7(),
|
|
180
|
+
refactors: pointer.value.refactors,
|
|
181
|
+
total: props.progress.total,
|
|
182
|
+
completed: (props.progress.completed += props.typeNames.length),
|
|
183
|
+
tokenUsage,
|
|
184
|
+
created_at: new Date().toISOString(),
|
|
185
|
+
} satisfies AutoBeInterfaceSchemaRenameEvent);
|
|
186
|
+
return pointer.value.refactors;
|
|
187
|
+
} catch {
|
|
188
|
+
props.progress.completed += props.typeNames.length;
|
|
189
|
+
return [];
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const uniqueRefactors = (
|
|
194
|
+
refactors: AutoBeInterfaceSchemaRefactor[],
|
|
195
|
+
): AutoBeInterfaceSchemaRefactor[] => {
|
|
196
|
+
// Remove self-references (A->A)
|
|
197
|
+
refactors = refactors.filter((r) => r.from !== r.to);
|
|
198
|
+
|
|
199
|
+
// Remove duplicates (keep the first occurrence)
|
|
200
|
+
refactors = Array.from(new Map(refactors.map((r) => [r.from, r])).values());
|
|
201
|
+
|
|
202
|
+
// Build adjacency map: from -> to
|
|
203
|
+
const renameMap: Map<string, string> = new Map();
|
|
204
|
+
for (const r of refactors) {
|
|
205
|
+
renameMap.set(r.from, r.to);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Resolve transitive chains: A->B, B->C becomes A->C
|
|
209
|
+
const resolveChain = (from: string): string => {
|
|
210
|
+
const visited: Set<string> = new Set();
|
|
211
|
+
let current: string = from;
|
|
212
|
+
|
|
213
|
+
while (renameMap.has(current)) {
|
|
214
|
+
// Cycle detection: A->B, B->C, C->A
|
|
215
|
+
if (visited.has(current)) {
|
|
216
|
+
// Cycle detected, keep the last valid mapping before cycle
|
|
217
|
+
return current;
|
|
218
|
+
}
|
|
219
|
+
visited.add(current);
|
|
220
|
+
current = renameMap.get(current)!;
|
|
221
|
+
}
|
|
222
|
+
return current;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
// Build final refactor list with resolved chains
|
|
226
|
+
const resolved: Map<string, AutoBeInterfaceSchemaRefactor> = new Map();
|
|
227
|
+
for (const from of renameMap.keys()) {
|
|
228
|
+
const finalTo: string = resolveChain(from);
|
|
229
|
+
// Only include if actually changes
|
|
230
|
+
if (from !== finalTo) {
|
|
231
|
+
resolved.set(from, {
|
|
232
|
+
from,
|
|
233
|
+
to: finalTo,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return Array.from(resolved.values());
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
const createController = <Model extends ILlmSchema.Model>(
|
|
241
|
+
model: Model,
|
|
242
|
+
build: (value: IAutoBeInterfaceSchemaRenameApplication.IProps) => void,
|
|
243
|
+
): IAgenticaController.IClass<Model> => {
|
|
244
|
+
assertSchemaModel(model);
|
|
245
|
+
const application: ILlmApplication<Model> = collection[
|
|
246
|
+
model === "chatgpt" ? "chatgpt" : "claude"
|
|
247
|
+
] satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
|
|
248
|
+
return {
|
|
249
|
+
protocol: "class",
|
|
250
|
+
name: "SchemaRenamer",
|
|
251
|
+
application,
|
|
252
|
+
execute: {
|
|
253
|
+
rename: (props) => {
|
|
254
|
+
build(props);
|
|
255
|
+
},
|
|
256
|
+
} satisfies IAutoBeInterfaceSchemaRenameApplication,
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
const collection = {
|
|
261
|
+
chatgpt: typia.llm.application<
|
|
262
|
+
IAutoBeInterfaceSchemaRenameApplication,
|
|
263
|
+
"chatgpt"
|
|
264
|
+
>(),
|
|
265
|
+
claude: typia.llm.application<
|
|
266
|
+
IAutoBeInterfaceSchemaRenameApplication,
|
|
267
|
+
"claude"
|
|
268
|
+
>(),
|
|
269
|
+
};
|