@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
|
@@ -8,11 +8,12 @@ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromp
|
|
|
8
8
|
import { AutoBeState } from "../../../context/AutoBeState";
|
|
9
9
|
import { transformInterfaceAssetHistories } from "./transformInterfaceAssetHistories";
|
|
10
10
|
|
|
11
|
-
export const transformInterfaceEndpointHistories = (
|
|
12
|
-
state: AutoBeState
|
|
13
|
-
group: AutoBeInterfaceGroup
|
|
14
|
-
authorizations: AutoBeOpenApi.IOperation[]
|
|
15
|
-
|
|
11
|
+
export const transformInterfaceEndpointHistories = (props: {
|
|
12
|
+
state: AutoBeState;
|
|
13
|
+
group: AutoBeInterfaceGroup;
|
|
14
|
+
authorizations: AutoBeOpenApi.IOperation[];
|
|
15
|
+
instruction: string;
|
|
16
|
+
}): Array<
|
|
16
17
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
17
18
|
> => [
|
|
18
19
|
{
|
|
@@ -21,25 +22,41 @@ export const transformInterfaceEndpointHistories = (
|
|
|
21
22
|
created_at: new Date().toISOString(),
|
|
22
23
|
text: AutoBeSystemPromptConstant.INTERFACE_ENDPOINT,
|
|
23
24
|
},
|
|
24
|
-
...transformInterfaceAssetHistories(state),
|
|
25
|
+
...transformInterfaceAssetHistories(props.state),
|
|
25
26
|
{
|
|
26
27
|
type: "assistantMessage",
|
|
27
28
|
id: v7(),
|
|
28
29
|
created_at: new Date().toISOString(),
|
|
29
30
|
text: StringUtil.trim`
|
|
31
|
+
## API Design Instructions
|
|
32
|
+
|
|
33
|
+
The following API-specific instructions were extracted by AI from
|
|
34
|
+
the user's utterances. These focus ONLY on API interface design aspects
|
|
35
|
+
such as endpoint patterns, request/response formats, DTO schemas,
|
|
36
|
+
and operation specifications.
|
|
37
|
+
|
|
38
|
+
Apply these instructions when designing endpoints for the ${props.group.name} group.
|
|
39
|
+
Consider the specified URL patterns, HTTP methods, parameter structures,
|
|
40
|
+
and response formats. If the instructions are not relevant to this specific
|
|
41
|
+
endpoint group, you may ignore them.
|
|
42
|
+
|
|
43
|
+
${props.instruction}
|
|
44
|
+
|
|
45
|
+
## Group Information
|
|
46
|
+
|
|
30
47
|
Here is the target group for the endpoints:
|
|
31
48
|
|
|
32
49
|
\`\`\`json
|
|
33
|
-
${JSON.stringify(group)}
|
|
50
|
+
${JSON.stringify(props.group)}
|
|
34
51
|
\`\`\`
|
|
35
52
|
|
|
36
|
-
|
|
53
|
+
## Already Existing Operations
|
|
37
54
|
|
|
38
55
|
These operations already exist. Do NOT create similar endpoints:
|
|
39
56
|
|
|
40
57
|
\`\`\`json
|
|
41
58
|
${JSON.stringify(
|
|
42
|
-
authorizations.map((op) => ({
|
|
59
|
+
props.authorizations.map((op) => ({
|
|
43
60
|
path: op.path,
|
|
44
61
|
method: op.method,
|
|
45
62
|
name: op.name,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
+
import { StringUtil } from "@autobe/utils";
|
|
2
3
|
import { v7 } from "uuid";
|
|
3
4
|
|
|
4
5
|
import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromptConstant";
|
|
@@ -6,12 +7,13 @@ import { AutoBeState } from "../../../context/AutoBeState";
|
|
|
6
7
|
import { transformInterfaceAssetHistories } from "./transformInterfaceAssetHistories";
|
|
7
8
|
import { transformInterfacePrerequisiteHistories } from "./transformInterfacePrerequisiteHistories";
|
|
8
9
|
|
|
9
|
-
export const transformInterfaceGroupHistories = (
|
|
10
|
-
state: AutoBeState
|
|
11
|
-
|
|
10
|
+
export const transformInterfaceGroupHistories = (props: {
|
|
11
|
+
state: AutoBeState;
|
|
12
|
+
instruction: string;
|
|
13
|
+
}): Array<
|
|
12
14
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
13
15
|
> => {
|
|
14
|
-
const prerequisite = transformInterfacePrerequisiteHistories(state);
|
|
16
|
+
const prerequisite = transformInterfacePrerequisiteHistories(props.state);
|
|
15
17
|
if (prerequisite !== null) return prerequisite;
|
|
16
18
|
|
|
17
19
|
return [
|
|
@@ -21,12 +23,32 @@ export const transformInterfaceGroupHistories = (
|
|
|
21
23
|
type: "systemMessage",
|
|
22
24
|
text: AutoBeSystemPromptConstant.INTERFACE_ENDPOINT,
|
|
23
25
|
},
|
|
24
|
-
...transformInterfaceAssetHistories(state),
|
|
26
|
+
...transformInterfaceAssetHistories(props.state),
|
|
25
27
|
{
|
|
26
28
|
id: v7(),
|
|
27
29
|
created_at: new Date().toISOString(),
|
|
28
30
|
type: "systemMessage",
|
|
29
31
|
text: AutoBeSystemPromptConstant.INTERFACE_GROUP,
|
|
30
32
|
},
|
|
33
|
+
{
|
|
34
|
+
id: v7(),
|
|
35
|
+
created_at: new Date().toISOString(),
|
|
36
|
+
type: "assistantMessage",
|
|
37
|
+
text: StringUtil.trim`
|
|
38
|
+
## API Design Instructions
|
|
39
|
+
|
|
40
|
+
The following API-specific instructions were extracted by AI from
|
|
41
|
+
the user's utterances. These focus ONLY on API interface design aspects
|
|
42
|
+
such as endpoint patterns, request/response formats, DTO schemas,
|
|
43
|
+
and operation specifications.
|
|
44
|
+
|
|
45
|
+
Apply these instructions when organizing API endpoints into logical groups.
|
|
46
|
+
Consider how to structure and categorize endpoints based on business domains,
|
|
47
|
+
resource types, or functional areas. If the instructions are not relevant
|
|
48
|
+
to endpoint grouping and organization, you may ignore them.
|
|
49
|
+
|
|
50
|
+
${props.instruction}
|
|
51
|
+
`,
|
|
52
|
+
},
|
|
31
53
|
];
|
|
32
54
|
};
|
|
@@ -7,13 +7,14 @@ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromp
|
|
|
7
7
|
import { AutoBeState } from "../../../context/AutoBeState";
|
|
8
8
|
import { transformInterfaceAssetHistories } from "./transformInterfaceAssetHistories";
|
|
9
9
|
|
|
10
|
-
export const transformInterfaceOperationHistories = (
|
|
11
|
-
state: AutoBeState
|
|
12
|
-
endpoints: AutoBeOpenApi.IEndpoint[]
|
|
13
|
-
|
|
10
|
+
export const transformInterfaceOperationHistories = (props: {
|
|
11
|
+
state: AutoBeState;
|
|
12
|
+
endpoints: AutoBeOpenApi.IEndpoint[];
|
|
13
|
+
instruction: string;
|
|
14
|
+
}): Array<
|
|
14
15
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
15
16
|
> => {
|
|
16
|
-
const analyze: AutoBeAnalyzeHistory = state.analyze!;
|
|
17
|
+
const analyze: AutoBeAnalyzeHistory = props.state.analyze!;
|
|
17
18
|
return [
|
|
18
19
|
{
|
|
19
20
|
type: "systemMessage",
|
|
@@ -21,7 +22,7 @@ export const transformInterfaceOperationHistories = (
|
|
|
21
22
|
created_at: new Date().toISOString(),
|
|
22
23
|
text: AutoBeSystemPromptConstant.INTERFACE_OPERATION,
|
|
23
24
|
},
|
|
24
|
-
...transformInterfaceAssetHistories(state),
|
|
25
|
+
...transformInterfaceAssetHistories(props.state),
|
|
25
26
|
{
|
|
26
27
|
type: "systemMessage",
|
|
27
28
|
id: v7(),
|
|
@@ -44,10 +45,26 @@ export const transformInterfaceOperationHistories = (
|
|
|
44
45
|
id: v7(),
|
|
45
46
|
created_at: new Date().toISOString(),
|
|
46
47
|
text: StringUtil.trim`
|
|
48
|
+
## API Design Instructions
|
|
49
|
+
|
|
50
|
+
The following API-specific instructions were extracted by AI from
|
|
51
|
+
the user's utterances. These focus ONLY on API interface design aspects
|
|
52
|
+
such as endpoint patterns, request/response formats, DTO schemas,
|
|
53
|
+
and operation specifications.
|
|
54
|
+
|
|
55
|
+
Apply these instructions when designing the detailed operation specifications
|
|
56
|
+
for each endpoint. Consider parameter types, request/response structures,
|
|
57
|
+
error handling, and API behavior patterns. If the instructions are not
|
|
58
|
+
relevant to the operations you need to implement, you may ignore them.
|
|
59
|
+
|
|
60
|
+
${props.instruction}
|
|
61
|
+
|
|
62
|
+
## Operations
|
|
63
|
+
|
|
47
64
|
You have to make API operations for the given endpoints:
|
|
48
65
|
|
|
49
66
|
\`\`\`json
|
|
50
|
-
${JSON.stringify(endpoints)}
|
|
67
|
+
${JSON.stringify(props.endpoints)}
|
|
51
68
|
\`\`\`
|
|
52
69
|
|
|
53
70
|
If there is a content in the failure, it is to explain why it failed before.
|
|
@@ -7,10 +7,11 @@ import { AutoBeSystemPromptConstant } from "../../../constants/AutoBeSystemPromp
|
|
|
7
7
|
import { AutoBeState } from "../../../context/AutoBeState";
|
|
8
8
|
import { transformInterfaceAssetHistories } from "./transformInterfaceAssetHistories";
|
|
9
9
|
|
|
10
|
-
export const transformInterfaceSchemaHistories = (
|
|
11
|
-
state: AutoBeState
|
|
12
|
-
operations: AutoBeOpenApi.IOperation[]
|
|
13
|
-
|
|
10
|
+
export const transformInterfaceSchemaHistories = (props: {
|
|
11
|
+
state: AutoBeState;
|
|
12
|
+
operations: AutoBeOpenApi.IOperation[];
|
|
13
|
+
instruction: string;
|
|
14
|
+
}): Array<
|
|
14
15
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
15
16
|
> => [
|
|
16
17
|
{
|
|
@@ -19,16 +20,32 @@ export const transformInterfaceSchemaHistories = (
|
|
|
19
20
|
created_at: new Date().toISOString(),
|
|
20
21
|
text: AutoBeSystemPromptConstant.INTERFACE_SCHEMA,
|
|
21
22
|
},
|
|
22
|
-
...transformInterfaceAssetHistories(state),
|
|
23
|
+
...transformInterfaceAssetHistories(props.state),
|
|
23
24
|
{
|
|
24
25
|
type: "assistantMessage",
|
|
25
26
|
id: v7(),
|
|
26
27
|
created_at: new Date().toISOString(),
|
|
27
28
|
text: StringUtil.trim`
|
|
29
|
+
## API Design Instructions
|
|
30
|
+
|
|
31
|
+
The following API-specific instructions were extracted by AI from
|
|
32
|
+
the user's utterances. These focus ONLY on API interface design aspects
|
|
33
|
+
such as endpoint patterns, request/response formats, DTO schemas,
|
|
34
|
+
and operation specifications.
|
|
35
|
+
|
|
36
|
+
Apply these instructions when creating JSON schema components for the operations.
|
|
37
|
+
Focus on data structure design, field naming conventions, validation rules,
|
|
38
|
+
and type definitions. If the instructions are not relevant to the schema
|
|
39
|
+
components you need to create, you may ignore them.
|
|
40
|
+
|
|
41
|
+
${props.instruction}
|
|
42
|
+
|
|
43
|
+
## Operations
|
|
44
|
+
|
|
28
45
|
Here is the list of API operations you have to implement its types:
|
|
29
46
|
|
|
30
47
|
\`\`\`json
|
|
31
|
-
${JSON.stringify(operations)}
|
|
48
|
+
${JSON.stringify(props.operations)}
|
|
32
49
|
\`\`\`
|
|
33
50
|
`,
|
|
34
51
|
},
|
|
@@ -45,28 +45,38 @@ export const orchestrateInterface =
|
|
|
45
45
|
type: "interfaceStart",
|
|
46
46
|
id: v7(),
|
|
47
47
|
created_at: start.toISOString(),
|
|
48
|
-
reason: props.
|
|
48
|
+
reason: props.instruction,
|
|
49
49
|
step: ctx.state().analyze?.step ?? 0,
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
// ENDPOINTS
|
|
53
|
-
const init: AutoBeInterfaceGroupsEvent =
|
|
54
|
-
|
|
53
|
+
const init: AutoBeInterfaceGroupsEvent = await orchestrateInterfaceGroups(
|
|
54
|
+
ctx,
|
|
55
|
+
{
|
|
56
|
+
instruction: props.instruction,
|
|
57
|
+
},
|
|
58
|
+
);
|
|
55
59
|
ctx.dispatch(init);
|
|
56
60
|
|
|
57
61
|
// AUTHORIZATION
|
|
58
62
|
const authorizations: AutoBeInterfaceAuthorization[] =
|
|
59
|
-
await orchestrateInterfaceAuthorizations(ctx);
|
|
60
|
-
|
|
61
|
-
const authOperations = authorizations
|
|
63
|
+
await orchestrateInterfaceAuthorizations(ctx, props.instruction);
|
|
64
|
+
const authOperations: AutoBeOpenApi.IOperation[] = authorizations
|
|
62
65
|
.map((authorization) => authorization.operations)
|
|
63
66
|
.flat();
|
|
64
67
|
|
|
65
68
|
// ENDPOINTS & OPERATIONS
|
|
66
69
|
const endpoints: AutoBeOpenApi.IEndpoint[] =
|
|
67
|
-
await orchestrateInterfaceEndpoints(ctx,
|
|
70
|
+
await orchestrateInterfaceEndpoints(ctx, {
|
|
71
|
+
groups: init.groups,
|
|
72
|
+
authorizations: authOperations,
|
|
73
|
+
instruction: props.instruction,
|
|
74
|
+
});
|
|
68
75
|
const firstOperations: AutoBeOpenApi.IOperation[] =
|
|
69
|
-
await orchestrateInterfaceOperations(ctx,
|
|
76
|
+
await orchestrateInterfaceOperations(ctx, {
|
|
77
|
+
endpoints,
|
|
78
|
+
instruction: props.instruction,
|
|
79
|
+
});
|
|
70
80
|
const operations: AutoBeOpenApi.IOperation[] = new HashMap<
|
|
71
81
|
AutoBeOpenApi.IEndpoint,
|
|
72
82
|
AutoBeOpenApi.IOperation
|
|
@@ -92,14 +102,20 @@ export const orchestrateInterface =
|
|
|
92
102
|
operations,
|
|
93
103
|
components: {
|
|
94
104
|
authorization: ctx.state().analyze?.roles ?? [],
|
|
95
|
-
schemas: await orchestrateInterfaceSchemas(ctx,
|
|
105
|
+
schemas: await orchestrateInterfaceSchemas(ctx, {
|
|
106
|
+
instruction: props.instruction,
|
|
107
|
+
operations,
|
|
108
|
+
}),
|
|
96
109
|
},
|
|
97
110
|
};
|
|
98
111
|
|
|
99
112
|
const complementedSchemas: Record<
|
|
100
113
|
string,
|
|
101
114
|
AutoBeOpenApi.IJsonSchemaDescriptive
|
|
102
|
-
> = await orchestrateInterfaceComplement(ctx,
|
|
115
|
+
> = await orchestrateInterfaceComplement(ctx, {
|
|
116
|
+
instruction: props.instruction,
|
|
117
|
+
document,
|
|
118
|
+
});
|
|
103
119
|
Object.assign(document.components.schemas, complementedSchemas);
|
|
104
120
|
|
|
105
121
|
const schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> =
|
|
@@ -109,6 +125,9 @@ export const orchestrateInterface =
|
|
|
109
125
|
document.components.schemas,
|
|
110
126
|
);
|
|
111
127
|
Object.assign(document.components.schemas, schemas);
|
|
128
|
+
for (const key of Object.keys(document.components.schemas))
|
|
129
|
+
if (key === "IPageI" || key.startsWith("IPageI."))
|
|
130
|
+
delete document.components.schemas[key];
|
|
112
131
|
|
|
113
132
|
// DO COMPILE
|
|
114
133
|
return ctx.dispatch({
|
|
@@ -20,7 +20,10 @@ import { IAutoBeInterfaceAuthorizationsApplication } from "./structures/IAutoBeI
|
|
|
20
20
|
|
|
21
21
|
export async function orchestrateInterfaceAuthorizations<
|
|
22
22
|
Model extends ILlmSchema.Model,
|
|
23
|
-
>(
|
|
23
|
+
>(
|
|
24
|
+
ctx: AutoBeContext<Model>,
|
|
25
|
+
instruction: string,
|
|
26
|
+
): Promise<AutoBeInterfaceAuthorization[]> {
|
|
24
27
|
const roles: AutoBeAnalyzeRole[] = ctx.state().analyze?.roles ?? [];
|
|
25
28
|
const progress: AutoBeProgressEventBase = {
|
|
26
29
|
total: roles.length,
|
|
@@ -29,12 +32,12 @@ export async function orchestrateInterfaceAuthorizations<
|
|
|
29
32
|
const authorizations: AutoBeInterfaceAuthorization[] =
|
|
30
33
|
await executeCachedBatch(
|
|
31
34
|
roles.map((role) => async (promptCacheKey) => {
|
|
32
|
-
const event: AutoBeInterfaceAuthorizationEvent = await process(
|
|
33
|
-
ctx,
|
|
35
|
+
const event: AutoBeInterfaceAuthorizationEvent = await process(ctx, {
|
|
34
36
|
role,
|
|
35
37
|
progress,
|
|
36
38
|
promptCacheKey,
|
|
37
|
-
|
|
39
|
+
instruction,
|
|
40
|
+
});
|
|
38
41
|
ctx.dispatch(event);
|
|
39
42
|
return {
|
|
40
43
|
role: role.name,
|
|
@@ -48,9 +51,12 @@ export async function orchestrateInterfaceAuthorizations<
|
|
|
48
51
|
|
|
49
52
|
async function process<Model extends ILlmSchema.Model>(
|
|
50
53
|
ctx: AutoBeContext<Model>,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
props: {
|
|
55
|
+
instruction: string;
|
|
56
|
+
role: AutoBeAnalyzeRole;
|
|
57
|
+
progress: AutoBeProgressEventBase;
|
|
58
|
+
promptCacheKey: string;
|
|
59
|
+
},
|
|
54
60
|
): Promise<AutoBeInterfaceAuthorizationEvent> {
|
|
55
61
|
const pointer: IPointer<IAutoBeInterfaceAuthorizationsApplication.IProps | null> =
|
|
56
62
|
{
|
|
@@ -58,16 +64,20 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
58
64
|
};
|
|
59
65
|
const { tokenUsage } = await ctx.conversate({
|
|
60
66
|
source: "interfaceAuthorization",
|
|
61
|
-
histories: transformInterfaceAuthorizationsHistories(
|
|
67
|
+
histories: transformInterfaceAuthorizationsHistories({
|
|
68
|
+
state: ctx.state(),
|
|
69
|
+
instruction: props.instruction,
|
|
70
|
+
role: props.role,
|
|
71
|
+
}),
|
|
62
72
|
controller: createController({
|
|
63
73
|
model: ctx.model,
|
|
64
|
-
role,
|
|
74
|
+
role: props.role,
|
|
65
75
|
build: (next) => {
|
|
66
76
|
pointer.value = next;
|
|
67
77
|
},
|
|
68
78
|
}),
|
|
69
79
|
enforceFunctionCall: true,
|
|
70
|
-
promptCacheKey,
|
|
80
|
+
promptCacheKey: props.promptCacheKey,
|
|
71
81
|
message: "Create Authorization Operation for the given roles",
|
|
72
82
|
});
|
|
73
83
|
if (pointer.value === null)
|
|
@@ -77,11 +87,11 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
77
87
|
type: "interfaceAuthorization",
|
|
78
88
|
id: v7(),
|
|
79
89
|
operations: pointer.value.operations,
|
|
80
|
-
completed: ++progress.completed,
|
|
90
|
+
completed: ++props.progress.completed,
|
|
81
91
|
tokenUsage,
|
|
82
92
|
created_at: new Date().toISOString(),
|
|
83
93
|
step: ctx.state().analyze?.step ?? 0,
|
|
84
|
-
total: progress.total,
|
|
94
|
+
total: props.progress.total,
|
|
85
95
|
} satisfies AutoBeInterfaceAuthorizationEvent;
|
|
86
96
|
}
|
|
87
97
|
|
|
@@ -22,20 +22,24 @@ import { fulfillJsonSchemaErrorMessages } from "./utils/fulfillJsonSchemaErrorMe
|
|
|
22
22
|
|
|
23
23
|
export function orchestrateInterfaceComplement<Model extends ILlmSchema.Model>(
|
|
24
24
|
ctx: AutoBeContext<Model>,
|
|
25
|
-
|
|
25
|
+
props: {
|
|
26
|
+
instruction: string;
|
|
27
|
+
document: AutoBeOpenApi.IDocument;
|
|
28
|
+
},
|
|
26
29
|
): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
|
|
27
|
-
return step(ctx,
|
|
30
|
+
return step(ctx, props, 8);
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
async function step<Model extends ILlmSchema.Model>(
|
|
31
34
|
ctx: AutoBeContext<Model>,
|
|
32
|
-
|
|
35
|
+
props: {
|
|
36
|
+
instruction: string;
|
|
37
|
+
document: AutoBeOpenApi.IDocument;
|
|
38
|
+
},
|
|
33
39
|
life: number,
|
|
34
40
|
): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
|
|
35
|
-
const missed: string[] = getMissed(document);
|
|
36
|
-
if (missed.length === 0 || life < 0)
|
|
37
|
-
return document.components.schemas;
|
|
38
|
-
}
|
|
41
|
+
const missed: string[] = getMissed(props.document);
|
|
42
|
+
if (missed.length === 0 || life < 0) return props.document.components.schemas;
|
|
39
43
|
|
|
40
44
|
const pointer: IPointer<Record<
|
|
41
45
|
string,
|
|
@@ -45,11 +49,12 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
45
49
|
};
|
|
46
50
|
const { tokenUsage } = await ctx.conversate({
|
|
47
51
|
source: "interfaceComplement",
|
|
48
|
-
histories: transformInterfaceComplementHistories(
|
|
49
|
-
ctx.state(),
|
|
50
|
-
|
|
52
|
+
histories: transformInterfaceComplementHistories({
|
|
53
|
+
state: ctx.state(),
|
|
54
|
+
instruction: props.instruction,
|
|
55
|
+
document: props.document,
|
|
51
56
|
missed,
|
|
52
|
-
),
|
|
57
|
+
}),
|
|
53
58
|
controller: createController({
|
|
54
59
|
model: ctx.model,
|
|
55
60
|
build: (next) => {
|
|
@@ -85,16 +90,19 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
85
90
|
|
|
86
91
|
const newSchemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {
|
|
87
92
|
...pointer.value,
|
|
88
|
-
...document.components.schemas,
|
|
93
|
+
...props.document.components.schemas,
|
|
89
94
|
};
|
|
90
|
-
JsonSchemaNamingConvention.schemas(document.operations, newSchemas);
|
|
95
|
+
JsonSchemaNamingConvention.schemas(props.document.operations, newSchemas);
|
|
91
96
|
return step(
|
|
92
97
|
ctx,
|
|
93
98
|
{
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
...document
|
|
97
|
-
|
|
99
|
+
instruction: props.instruction,
|
|
100
|
+
document: {
|
|
101
|
+
...props.document,
|
|
102
|
+
components: {
|
|
103
|
+
...props.document.components,
|
|
104
|
+
schemas: newSchemas,
|
|
105
|
+
},
|
|
98
106
|
},
|
|
99
107
|
},
|
|
100
108
|
life - 1,
|
|
@@ -22,39 +22,50 @@ export async function orchestrateInterfaceEndpoints<
|
|
|
22
22
|
Model extends ILlmSchema.Model,
|
|
23
23
|
>(
|
|
24
24
|
ctx: AutoBeContext<Model>,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
props: {
|
|
26
|
+
groups: AutoBeInterfaceGroup[];
|
|
27
|
+
authorizations: AutoBeOpenApi.IOperation[];
|
|
28
|
+
instruction: string;
|
|
29
|
+
message?: string;
|
|
30
|
+
},
|
|
28
31
|
): Promise<AutoBeOpenApi.IEndpoint[]> {
|
|
29
32
|
const progress: AutoBeProgressEventBase = {
|
|
30
|
-
total: groups.length,
|
|
33
|
+
total: props.groups.length,
|
|
31
34
|
completed: 0,
|
|
32
35
|
};
|
|
33
36
|
const endpoints: AutoBeOpenApi.IEndpoint[] = (
|
|
34
37
|
await executeCachedBatch(
|
|
35
|
-
groups.map(
|
|
36
|
-
(
|
|
37
|
-
process(ctx,
|
|
38
|
+
props.groups.map(
|
|
39
|
+
(group) => (promptCacheKey) =>
|
|
40
|
+
process(ctx, {
|
|
41
|
+
group,
|
|
42
|
+
authorizations: props.authorizations,
|
|
43
|
+
instruction: props.instruction,
|
|
44
|
+
message: props.message ?? "Make endpoints for the given assets.",
|
|
45
|
+
progress,
|
|
46
|
+
promptCacheKey,
|
|
47
|
+
}),
|
|
38
48
|
),
|
|
39
49
|
)
|
|
40
50
|
).flat();
|
|
41
|
-
|
|
42
51
|
const deduplicated: AutoBeOpenApi.IEndpoint[] = new HashSet(
|
|
43
52
|
endpoints,
|
|
44
53
|
OpenApiEndpointComparator.hashCode,
|
|
45
54
|
OpenApiEndpointComparator.equals,
|
|
46
55
|
).toJSON();
|
|
47
|
-
|
|
48
56
|
return orchestrateInterfaceEndpointsReview(ctx, deduplicated);
|
|
49
57
|
}
|
|
50
58
|
|
|
51
59
|
async function process<Model extends ILlmSchema.Model>(
|
|
52
60
|
ctx: AutoBeContext<Model>,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
props: {
|
|
62
|
+
group: AutoBeInterfaceGroup;
|
|
63
|
+
message: string;
|
|
64
|
+
progress: AutoBeProgressEventBase;
|
|
65
|
+
authorizations: AutoBeOpenApi.IOperation[];
|
|
66
|
+
promptCacheKey: string;
|
|
67
|
+
instruction: string;
|
|
68
|
+
},
|
|
58
69
|
): Promise<AutoBeOpenApi.IEndpoint[]> {
|
|
59
70
|
const start: Date = new Date();
|
|
60
71
|
const pointer: IPointer<AutoBeOpenApi.IEndpoint[] | null> = {
|
|
@@ -62,11 +73,12 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
62
73
|
};
|
|
63
74
|
const { tokenUsage } = await ctx.conversate({
|
|
64
75
|
source: "interfaceEndpoints",
|
|
65
|
-
histories: transformInterfaceEndpointHistories(
|
|
66
|
-
ctx.state(),
|
|
67
|
-
group,
|
|
68
|
-
authorizations,
|
|
69
|
-
|
|
76
|
+
histories: transformInterfaceEndpointHistories({
|
|
77
|
+
state: ctx.state(),
|
|
78
|
+
group: props.group,
|
|
79
|
+
authorizations: props.authorizations,
|
|
80
|
+
instruction: props.instruction,
|
|
81
|
+
}),
|
|
70
82
|
controller: createController({
|
|
71
83
|
model: ctx.model,
|
|
72
84
|
build: (endpoints) => {
|
|
@@ -75,8 +87,8 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
75
87
|
},
|
|
76
88
|
}),
|
|
77
89
|
enforceFunctionCall: true,
|
|
78
|
-
promptCacheKey,
|
|
79
|
-
message,
|
|
90
|
+
promptCacheKey: props.promptCacheKey,
|
|
91
|
+
message: props.message,
|
|
80
92
|
});
|
|
81
93
|
if (pointer.value === null) throw new Error("Failed to generate endpoints."); // unreachable
|
|
82
94
|
|
|
@@ -91,8 +103,8 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
91
103
|
tokenUsage,
|
|
92
104
|
created_at: start.toISOString(),
|
|
93
105
|
step: ctx.state().analyze?.step ?? 0,
|
|
94
|
-
completed: ++progress.completed,
|
|
95
|
-
total: progress.total,
|
|
106
|
+
completed: ++props.progress.completed,
|
|
107
|
+
total: props.progress.total,
|
|
96
108
|
};
|
|
97
109
|
ctx.dispatch(event);
|
|
98
110
|
return pointer.value;
|
|
@@ -14,7 +14,10 @@ export async function orchestrateInterfaceGroups<
|
|
|
14
14
|
Model extends ILlmSchema.Model,
|
|
15
15
|
>(
|
|
16
16
|
ctx: AutoBeContext<Model>,
|
|
17
|
-
|
|
17
|
+
props: {
|
|
18
|
+
instruction: string;
|
|
19
|
+
message?: string;
|
|
20
|
+
},
|
|
18
21
|
): Promise<AutoBeInterfaceGroupsEvent> {
|
|
19
22
|
const start: Date = new Date();
|
|
20
23
|
const pointer: IPointer<IAutoBeInterfaceGroupApplication.IProps | null> = {
|
|
@@ -22,7 +25,10 @@ export async function orchestrateInterfaceGroups<
|
|
|
22
25
|
};
|
|
23
26
|
const { tokenUsage } = await ctx.conversate({
|
|
24
27
|
source: "interfaceGroups",
|
|
25
|
-
histories: transformInterfaceGroupHistories(
|
|
28
|
+
histories: transformInterfaceGroupHistories({
|
|
29
|
+
state: ctx.state(),
|
|
30
|
+
instruction: props.instruction,
|
|
31
|
+
}),
|
|
26
32
|
controller: createController({
|
|
27
33
|
model: ctx.model,
|
|
28
34
|
build: (next) => {
|
|
@@ -30,7 +36,7 @@ export async function orchestrateInterfaceGroups<
|
|
|
30
36
|
},
|
|
31
37
|
}),
|
|
32
38
|
enforceFunctionCall: true,
|
|
33
|
-
message,
|
|
39
|
+
message: props.message ?? "Design API operations for the given assets.",
|
|
34
40
|
});
|
|
35
41
|
if (pointer.value === null) throw new Error("Failed to generate groups."); // unreachable
|
|
36
42
|
return {
|