@autobe/agent 0.9.1 → 0.10.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 +16 -5
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +6 -4
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/context/AutoBeTokenUsage.d.ts +15 -1
- package/lib/context/AutoBeTokenUsage.js +56 -1
- package/lib/context/AutoBeTokenUsage.js.map +1 -1
- package/lib/context/IAutoBeApplicationProps.d.ts +0 -61
- package/lib/factory/createAutoBeApplication.js +298 -773
- package/lib/factory/createAutoBeApplication.js.map +1 -1
- package/lib/index.mjs +5116 -7271
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js +82 -319
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js.map +1 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js +0 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +97 -294
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js +2 -2
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
- package/lib/orchestrate/index.d.ts +2 -2
- package/lib/orchestrate/index.js +4 -4
- package/lib/orchestrate/index.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +9 -3
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +56 -142
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +195 -199
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +75 -172
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +772 -1097
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/transformInterfaceHistories.js +2 -0
- package/lib/orchestrate/interface/transformInterfaceHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +64 -175
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +552 -1073
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js +571 -1119
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +9 -0
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +8 -0
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.d.ts +11 -0
- package/lib/orchestrate/realize/orchestrateRealize.js +109 -0
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeCoder.d.ts +25 -0
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js +337 -0
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeIntegrator.d.ts +52 -0
- package/lib/orchestrate/realize/orchestrateRealizeIntegrator.js +57 -0
- package/lib/orchestrate/realize/orchestrateRealizeIntegrator.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizePlanner.d.ts +80 -0
- package/lib/orchestrate/realize/orchestrateRealizePlanner.js +53 -0
- package/lib/orchestrate/realize/orchestrateRealizePlanner.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeValidator.d.ts +46 -0
- package/lib/orchestrate/realize/orchestrateRealizeValidator.js +37 -0
- package/lib/orchestrate/realize/orchestrateRealizeValidator.js.map +1 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +33 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.js +3 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.js.map +1 -0
- package/lib/orchestrate/realize/transformRealizeCoderHistories.d.ts +5 -0
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js +127 -0
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js.map +1 -0
- package/lib/orchestrate/test/compile/completeTestCode.d.ts +2 -0
- package/lib/orchestrate/test/compile/completeTestCode.js +21 -0
- package/lib/orchestrate/test/compile/completeTestCode.js.map +1 -0
- package/lib/orchestrate/test/{filterTestFileName.js → compile/filterTestFileName.js} +1 -1
- package/lib/orchestrate/test/compile/filterTestFileName.js.map +1 -0
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.d.ts +3 -0
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.js +27 -0
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -0
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +5 -0
- package/lib/orchestrate/test/{compileTestScenario.js → compile/getTestScenarioArtifacts.js} +11 -5
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -0
- package/lib/orchestrate/test/orchestrateTest.js +14 -9
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +3 -2
- package/lib/orchestrate/test/orchestrateTestCorrect.js +150 -349
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +323 -566
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.d.ts +3 -2
- package/lib/orchestrate/test/orchestrateTestWrite.js +139 -76
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +121 -0
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.js +3 -0
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.js.map +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestFunction.d.ts +8 -0
- package/lib/{utils/types/BackoffOptions.js → orchestrate/test/structures/IAutoBeTestFunction.js} +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestFunction.js.map +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +32 -22
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +2 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +112 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.js +3 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.js.map +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteResult.d.ts +7 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteResult.js +3 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteResult.js.map +1 -0
- package/lib/orchestrate/test/transformTestCorrectHistories.d.ts +3 -2
- package/lib/orchestrate/test/transformTestCorrectHistories.js +28 -41
- package/lib/orchestrate/test/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/transformTestWriteHistories.d.ts +5 -4
- package/lib/orchestrate/test/transformTestWriteHistories.js +169 -32
- package/lib/orchestrate/test/transformTestWriteHistories.js.map +1 -1
- package/lib/structures/IAutoBeConfig.d.ts +11 -0
- package/lib/structures/IAutoBeProps.d.ts +12 -1
- package/lib/utils/backoffRetry.d.ts +4 -7
- package/lib/utils/backoffRetry.js +19 -37
- package/lib/utils/backoffRetry.js.map +1 -1
- package/lib/utils/forceRetry.d.ts +1 -0
- package/lib/{orchestrate/orchestrateRealize.js → utils/forceRetry.js} +15 -8
- package/lib/utils/forceRetry.js.map +1 -0
- package/package.json +8 -8
- package/src/AutoBeAgent.ts +26 -4
- package/src/constants/AutoBeSystemPromptConstant.ts +6 -4
- package/src/context/AutoBeTokenUsage.ts +85 -1
- package/src/context/IAutoBeApplicationProps.ts +0 -62
- package/src/factory/createAutoBeApplication.ts +2 -3
- package/src/orchestrate/analyze/AutoBeAnalyzeAgent.ts +8 -3
- package/src/orchestrate/analyze/AutoBeAnalyzeReviewer.ts +0 -1
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +8 -37
- package/src/orchestrate/facade/transformFacadeStateMessage.ts +2 -1
- package/src/orchestrate/index.ts +2 -2
- package/src/orchestrate/interface/orchestrateInterface.ts +7 -0
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +4 -3
- package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +26 -23
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +6 -4
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +14 -11
- package/src/orchestrate/interface/transformInterfaceHistories.ts +2 -0
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +10 -5
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +11 -5
- package/src/orchestrate/prisma/orchestratePrismaSchema.ts +16 -8
- package/src/orchestrate/prisma/transformPrismaComponentsHistories.ts +9 -0
- package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +8 -0
- package/src/orchestrate/realize/orchestrateRealize.ts +169 -0
- package/src/orchestrate/realize/orchestrateRealizeCoder.ts +156 -0
- package/src/orchestrate/realize/orchestrateRealizeIntegrator.ts +75 -0
- package/src/orchestrate/realize/orchestrateRealizePlanner.ts +115 -0
- package/src/orchestrate/realize/orchestrateRealizeValidator.ts +64 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +36 -0
- package/src/orchestrate/realize/transformRealizeCoderHistories.ts +136 -0
- package/src/orchestrate/test/compile/completeTestCode.ts +35 -0
- package/src/orchestrate/test/{filterTestFileName.ts → compile/filterTestFileName.ts} +1 -1
- package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +24 -0
- package/src/orchestrate/test/{compileTestScenario.ts → compile/getTestScenarioArtifacts.ts} +17 -8
- package/src/orchestrate/test/experimental/orchestrateTestCorrect.ast +240 -0
- package/src/orchestrate/test/experimental/orchestrateTestWrite.ast +316 -0
- package/src/orchestrate/test/experimental/transformTestCorrectHistories.ast +52 -0
- package/src/orchestrate/test/orchestrateTest.ts +38 -16
- package/src/orchestrate/test/orchestrateTestCorrect.ts +111 -338
- package/src/orchestrate/test/orchestrateTestScenario.ts +114 -69
- package/src/orchestrate/test/orchestrateTestWrite.ts +55 -153
- package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +126 -0
- package/src/orchestrate/test/structures/IAutoBeTestFunction.ts +10 -0
- package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +32 -22
- package/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.ts +3 -0
- package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +117 -0
- package/src/orchestrate/test/structures/IAutoBeTestWriteResult.ts +9 -0
- package/src/orchestrate/test/transformTestCorrectHistories.ts +38 -43
- package/src/orchestrate/test/transformTestWriteHistories.ts +89 -35
- package/src/structures/IAutoBeConfig.ts +9 -0
- package/src/structures/IAutoBeProps.ts +17 -1
- package/src/utils/backoffRetry.ts +25 -36
- package/src/utils/forceRetry.ts +13 -0
- package/lib/factory/invertOpenApiDocument.d.ts +0 -3
- package/lib/factory/invertOpenApiDocument.js +0 -51
- package/lib/factory/invertOpenApiDocument.js.map +0 -1
- package/lib/orchestrate/orchestrateRealize.d.ts +0 -5
- package/lib/orchestrate/orchestrateRealize.js.map +0 -1
- package/lib/orchestrate/test/compileTestScenario.d.ts +0 -5
- package/lib/orchestrate/test/compileTestScenario.js.map +0 -1
- package/lib/orchestrate/test/filterTestFileName.js.map +0 -1
- package/lib/utils/StringUtil.d.ts +0 -4
- package/lib/utils/StringUtil.js +0 -43
- package/lib/utils/StringUtil.js.map +0 -1
- package/lib/utils/types/BackoffOptions.d.ts +0 -12
- package/lib/utils/types/BackoffOptions.js.map +0 -1
- package/src/factory/invertOpenApiDocument.ts +0 -63
- package/src/orchestrate/orchestrateRealize.ts +0 -18
- package/src/utils/StringUtil.ts +0 -45
- package/src/utils/types/BackoffOptions.ts +0 -15
- /package/lib/orchestrate/test/{filterTestFileName.d.ts → compile/filterTestFileName.d.ts} +0 -0
|
@@ -1,3 +1,87 @@
|
|
|
1
1
|
import { AgenticaTokenUsage } from "@agentica/core";
|
|
2
|
+
import { IAutoBeTokenUsageJson } from "@autobe/interface";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
import { IAutoBeApplication } from "./IAutoBeApplication";
|
|
5
|
+
|
|
6
|
+
export class AutoBeTokenUsage {
|
|
7
|
+
public readonly facade: AgenticaTokenUsage;
|
|
8
|
+
public readonly analyze: AgenticaTokenUsage;
|
|
9
|
+
public readonly prisma: AgenticaTokenUsage;
|
|
10
|
+
public readonly interface: AgenticaTokenUsage;
|
|
11
|
+
public readonly test: AgenticaTokenUsage;
|
|
12
|
+
public readonly realize: AgenticaTokenUsage;
|
|
13
|
+
|
|
14
|
+
public constructor(props?: IAutoBeTokenUsageJson) {
|
|
15
|
+
if (props === undefined) {
|
|
16
|
+
this.facade = new AgenticaTokenUsage();
|
|
17
|
+
this.analyze = new AgenticaTokenUsage();
|
|
18
|
+
this.prisma = new AgenticaTokenUsage();
|
|
19
|
+
this.interface = new AgenticaTokenUsage();
|
|
20
|
+
this.test = new AgenticaTokenUsage();
|
|
21
|
+
this.realize = new AgenticaTokenUsage();
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
this.facade = new AgenticaTokenUsage(props.facade);
|
|
26
|
+
this.analyze = new AgenticaTokenUsage(props.analyze);
|
|
27
|
+
this.prisma = new AgenticaTokenUsage(props.prisma);
|
|
28
|
+
this.interface = new AgenticaTokenUsage(props.interface);
|
|
29
|
+
this.test = new AgenticaTokenUsage(props.test);
|
|
30
|
+
this.realize = new AgenticaTokenUsage(props.realize);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public record(
|
|
34
|
+
usage: AgenticaTokenUsage,
|
|
35
|
+
additionalStages: (keyof IAutoBeApplication)[] = [],
|
|
36
|
+
) {
|
|
37
|
+
this.facade.increment(usage);
|
|
38
|
+
additionalStages.forEach((stage) => {
|
|
39
|
+
this[stage].increment(usage);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public increment(usage: AutoBeTokenUsage) {
|
|
44
|
+
AutoBeTokenUsage.keys().forEach((key) => {
|
|
45
|
+
this[key].increment(usage[key]);
|
|
46
|
+
});
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public static plus(usageA: AutoBeTokenUsage, usageB: AutoBeTokenUsage) {
|
|
51
|
+
return new AutoBeTokenUsage({
|
|
52
|
+
facade: AgenticaTokenUsage.plus(usageA.facade, usageB.facade),
|
|
53
|
+
analyze: AgenticaTokenUsage.plus(usageA.analyze, usageB.analyze),
|
|
54
|
+
prisma: AgenticaTokenUsage.plus(usageA.prisma, usageB.prisma),
|
|
55
|
+
interface: AgenticaTokenUsage.plus(usageA.interface, usageB.interface),
|
|
56
|
+
test: AgenticaTokenUsage.plus(usageA.test, usageB.test),
|
|
57
|
+
realize: AgenticaTokenUsage.plus(usageA.realize, usageB.realize),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public toJSON(): IAutoBeTokenUsageJson {
|
|
62
|
+
return {
|
|
63
|
+
facade: this.facade.toJSON(),
|
|
64
|
+
analyze: this.analyze.toJSON(),
|
|
65
|
+
prisma: this.prisma.toJSON(),
|
|
66
|
+
interface: this.interface.toJSON(),
|
|
67
|
+
test: this.test.toJSON(),
|
|
68
|
+
realize: this.realize.toJSON(),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** @internal */
|
|
73
|
+
private static keys(): ("facade" | keyof IAutoBeApplication)[] {
|
|
74
|
+
return ["facade", "analyze", "prisma", "interface", "test", "realize"];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// /** Type check statements */
|
|
79
|
+
// 1 as unknown as AutoBeTokenUsage satisfies {
|
|
80
|
+
// [key in "facade" | keyof IAutoBeApplication]: AgenticaTokenUsage;
|
|
81
|
+
// };
|
|
82
|
+
|
|
83
|
+
// 1 as unknown as IAutoBeTokenUsageJson satisfies {
|
|
84
|
+
// [key in "facade" | keyof IAutoBeApplication]: IAutoBeInternalTokenUsageJson;
|
|
85
|
+
// };
|
|
86
|
+
|
|
87
|
+
// 1 as unknown as IAutoBeInternalTokenUsageJson satisfies IAgenticaTokenUsageJson;
|
|
@@ -1,66 +1,4 @@
|
|
|
1
1
|
export interface IAutoBeApplicationProps {
|
|
2
2
|
/** The reason of the function call. */
|
|
3
3
|
reason: string;
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* # Define prompts to translate user planning requirements into messages for internal agents
|
|
7
|
-
*
|
|
8
|
-
* This prompt defines how to convert a user's planning-oriented requirements
|
|
9
|
-
* into a structured message for an internal agent.
|
|
10
|
-
*
|
|
11
|
-
* All content the user provides must be included in the message. However, if
|
|
12
|
-
* some parts of the user's input are inappropriate or insufficient from a
|
|
13
|
-
* planning standpoint, you are allowed to add **supplementary remarks**—but
|
|
14
|
-
* only under strict rules.
|
|
15
|
-
*
|
|
16
|
-
* # Supplementary Remark Rules
|
|
17
|
-
*
|
|
18
|
-
* 1. **Definition** A supplementary remark is additional information that may
|
|
19
|
-
* differ from the user's original intent. Because of this, **you must
|
|
20
|
-
* clearly indicate that it is _not_ part of the user’s thinking**.
|
|
21
|
-
* 2. **When to Supplement**
|
|
22
|
-
*
|
|
23
|
-
* - If the user's input reveals a lack of technical understanding (e.g.,
|
|
24
|
-
* suggesting "put all data into one table"), and the plan is not an MVP or
|
|
25
|
-
* PoC, it's encouraged to make reasonable additions for a more scalable or
|
|
26
|
-
* robust structure.
|
|
27
|
-
* - If there are clear gaps in the user's planning logic, you may supplement
|
|
28
|
-
* the content to ensure completeness.
|
|
29
|
-
*
|
|
30
|
-
* 3. **When Not to Supplement**
|
|
31
|
-
*
|
|
32
|
-
* - If the user's input is vague or ambiguous, **do not assume or add extra
|
|
33
|
-
* details**. Instead, it’s better to ask the user follow-up questions to
|
|
34
|
-
* clarify their intent.
|
|
35
|
-
* - If the user has made no comment on design, **do not impose design-related
|
|
36
|
-
* decisions** (e.g., colors, fonts, tone). However, you may state
|
|
37
|
-
* explicitly that no design requirements were provided.
|
|
38
|
-
* - Generic advice like "UX should be good" can be omitted unless it adds
|
|
39
|
-
* value, as such goals are assumed in all services.
|
|
40
|
-
*
|
|
41
|
-
* # Style Guidelines
|
|
42
|
-
*
|
|
43
|
-
* This prompt is delivered to the sub-agent, and several are created for
|
|
44
|
-
* parallel processing of the sub-agent. Additionally, there should be a guide
|
|
45
|
-
* to style, since sub-agents cannot create different styles of documents due
|
|
46
|
-
* to the disconnection of their conversations with each other.
|
|
47
|
-
*
|
|
48
|
-
* For example, there should be a hyperlink to the previous document, the next
|
|
49
|
-
* document, before or after the document, or there should be no more than N
|
|
50
|
-
* headings. The entire content of the document will have requirements, such
|
|
51
|
-
* as maintaining informal or formal language.
|
|
52
|
-
*
|
|
53
|
-
* The style guide should include conventions for Markdown formatting elements
|
|
54
|
-
* such as headings, lists, and tables. Additionally, it should define
|
|
55
|
-
* expectations regarding document length and overall composition. When
|
|
56
|
-
* describing structural guidelines, include a template to illustrate the
|
|
57
|
-
* recommended format.
|
|
58
|
-
*
|
|
59
|
-
* # Limiting the volume of a document
|
|
60
|
-
*
|
|
61
|
-
* However, do not go beyond the volume guide; each agent only needs to create
|
|
62
|
-
* one page because the agent receiving this document will be created as many
|
|
63
|
-
* as the number of pages.
|
|
64
|
-
*/
|
|
65
|
-
userPlanningRequirements?: string;
|
|
66
4
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
|
+
import { StringUtil } from "@autobe/utils";
|
|
2
3
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
3
4
|
import typia from "typia";
|
|
4
5
|
|
|
@@ -7,10 +8,9 @@ import { IAutoBeApplication } from "../context/IAutoBeApplication";
|
|
|
7
8
|
import { assertSchemaModel } from "../context/assertSchemaModel";
|
|
8
9
|
import { orchestrateAnalyze } from "../orchestrate/analyze/orchestrateAnalyze";
|
|
9
10
|
import { orchestrateInterface } from "../orchestrate/interface/orchestrateInterface";
|
|
10
|
-
import { orchestrateRealize } from "../orchestrate/orchestrateRealize";
|
|
11
11
|
import { orchestratePrisma } from "../orchestrate/prisma/orchestratePrisma";
|
|
12
|
+
import { orchestrateRealize } from "../orchestrate/realize/orchestrateRealize";
|
|
12
13
|
import { orchestrateTest } from "../orchestrate/test/orchestrateTest";
|
|
13
|
-
import { StringUtil } from "../utils/StringUtil";
|
|
14
14
|
|
|
15
15
|
export const createAutoBeController = <Model extends ILlmSchema.Model>(props: {
|
|
16
16
|
model: Model;
|
|
@@ -128,5 +128,4 @@ const collection = {
|
|
|
128
128
|
llama: claude,
|
|
129
129
|
deepseek: claude,
|
|
130
130
|
"3.1": claude,
|
|
131
|
-
"3.0": typia.llm.application<IAutoBeApplication, "3.0">(),
|
|
132
131
|
};
|
|
@@ -49,7 +49,6 @@ export class AutoBeAnalyzeAgent<Model extends ILlmSchema.Model> {
|
|
|
49
49
|
describe: null,
|
|
50
50
|
},
|
|
51
51
|
},
|
|
52
|
-
tokenUsage: ctx.usage(),
|
|
53
52
|
histories: [
|
|
54
53
|
{
|
|
55
54
|
id: v4(),
|
|
@@ -99,7 +98,12 @@ export class AutoBeAnalyzeAgent<Model extends ILlmSchema.Model> {
|
|
|
99
98
|
return "Abort due to excess retry count";
|
|
100
99
|
}
|
|
101
100
|
|
|
102
|
-
const
|
|
101
|
+
const agent = this.createAnalyzeAgent();
|
|
102
|
+
const response = await agent.conversate(content);
|
|
103
|
+
|
|
104
|
+
const tokenUsage = agent.getTokenUsage();
|
|
105
|
+
this.ctx.usage().record(tokenUsage, ["analyze"]);
|
|
106
|
+
|
|
103
107
|
const lastMessage = response[response.length - 1]!;
|
|
104
108
|
|
|
105
109
|
if ("text" in lastMessage) {
|
|
@@ -134,6 +138,8 @@ export class AutoBeAnalyzeAgent<Model extends ILlmSchema.Model> {
|
|
|
134
138
|
const filenames = Object.keys(this.fileMap).join(",");
|
|
135
139
|
const command = `Please proceed with the review of these files only.: ${filenames}`;
|
|
136
140
|
const response = await reviewer.conversate(command);
|
|
141
|
+
this.ctx.usage().record(reviewer.getTokenUsage(), ["analyze"]);
|
|
142
|
+
|
|
137
143
|
const review = response.find((el) => el.type === "assistantMessage");
|
|
138
144
|
|
|
139
145
|
if (review) {
|
|
@@ -210,5 +216,4 @@ const collection = {
|
|
|
210
216
|
llama: claude,
|
|
211
217
|
deepseek: claude,
|
|
212
218
|
"3.1": claude,
|
|
213
|
-
"3.0": typia.llm.application<AutoBeAnalyzeFileSystem, "3.0">(),
|
|
214
219
|
};
|
|
@@ -23,18 +23,11 @@ export const orchestrateAnalyze =
|
|
|
23
23
|
async (
|
|
24
24
|
props: IAutoBeApplicationProps,
|
|
25
25
|
): Promise<AutoBeAssistantMessageHistory | AutoBeAnalyzeHistory> => {
|
|
26
|
-
const userPlanningRequirements = props.userPlanningRequirements;
|
|
27
|
-
if (!userPlanningRequirements) {
|
|
28
|
-
throw new Error(
|
|
29
|
-
`Unable to prepare a proposal because there is no user requirement`,
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
26
|
const step = ctx.state().analyze?.step ?? 0;
|
|
34
27
|
const created_at = new Date().toISOString();
|
|
35
28
|
ctx.dispatch({
|
|
36
29
|
type: "analyzeStart",
|
|
37
|
-
reason:
|
|
30
|
+
reason: props.reason,
|
|
38
31
|
step,
|
|
39
32
|
created_at,
|
|
40
33
|
});
|
|
@@ -67,14 +60,12 @@ export const orchestrateAnalyze =
|
|
|
67
60
|
});
|
|
68
61
|
enforceToolCall(agentica);
|
|
69
62
|
|
|
70
|
-
const determined = await agentica
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
].join("\n"),
|
|
77
|
-
);
|
|
63
|
+
const determined = await agentica
|
|
64
|
+
.conversate("Design a complete list of documents for that document")
|
|
65
|
+
.finally(() => {
|
|
66
|
+
const tokenUsage = agentica.getTokenUsage();
|
|
67
|
+
ctx.usage().record(tokenUsage, ["analyze"]);
|
|
68
|
+
});
|
|
78
69
|
|
|
79
70
|
const lastMessage = determined[determined.length - 1]!;
|
|
80
71
|
if (lastMessage.type === "assistantMessage") {
|
|
@@ -94,21 +85,6 @@ export const orchestrateAnalyze =
|
|
|
94
85
|
}
|
|
95
86
|
|
|
96
87
|
const described = determined.find((el) => el.type === "describe");
|
|
97
|
-
// const determinedOutput = Array.from(
|
|
98
|
-
// new Set(
|
|
99
|
-
// described
|
|
100
|
-
// ? described.executes
|
|
101
|
-
// .map((el) => {
|
|
102
|
-
// if (el.protocol === "class") {
|
|
103
|
-
// return el.arguments as unknown as IDeterminingInput;
|
|
104
|
-
// }
|
|
105
|
-
// return null;
|
|
106
|
-
// })
|
|
107
|
-
// .filter((el) => el !== null)
|
|
108
|
-
// : [],
|
|
109
|
-
// ),
|
|
110
|
-
// );
|
|
111
|
-
|
|
112
88
|
const determinedOutput = described?.executes.find(
|
|
113
89
|
(el) => el.protocol === "class" && typia.is<IDeterminingInput>(el.value),
|
|
114
90
|
)?.value as IDeterminingInput;
|
|
@@ -152,10 +128,6 @@ export const orchestrateAnalyze =
|
|
|
152
128
|
`Only write this document named '${filename}'.`,
|
|
153
129
|
"Never write other documents.",
|
|
154
130
|
"",
|
|
155
|
-
"# User Planning Requirements",
|
|
156
|
-
"```md",
|
|
157
|
-
JSON.stringify(userPlanningRequirements),
|
|
158
|
-
"```",
|
|
159
131
|
"The reason why this document needs to be written is as follows.",
|
|
160
132
|
`- reason: ${reason}`,
|
|
161
133
|
].join("\n"),
|
|
@@ -175,7 +147,7 @@ export const orchestrateAnalyze =
|
|
|
175
147
|
const history: AutoBeAnalyzeHistory = {
|
|
176
148
|
id: v4(),
|
|
177
149
|
type: "analyze",
|
|
178
|
-
reason:
|
|
150
|
+
reason: props.reason,
|
|
179
151
|
prefix,
|
|
180
152
|
files: files,
|
|
181
153
|
step,
|
|
@@ -291,5 +263,4 @@ const collection = {
|
|
|
291
263
|
llama: claude,
|
|
292
264
|
deepseek: claude,
|
|
293
265
|
"3.1": claude,
|
|
294
|
-
"3.0": typia.llm.application<DeterminingFiles, "3.0">(),
|
|
295
266
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { StringUtil } from "@autobe/utils";
|
|
2
|
+
|
|
1
3
|
import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
|
|
2
4
|
import { AutoBeState } from "../../context/AutoBeState";
|
|
3
|
-
import { StringUtil } from "../../utils/StringUtil";
|
|
4
5
|
|
|
5
6
|
export function transformFacadeStateMessage(state: AutoBeState): string {
|
|
6
7
|
const currentState: ICurrentState = getCurrentState(state);
|
package/src/orchestrate/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { orchestrateAnalyze as analyze } from "./analyze/orchestrateAnalyze";
|
|
2
2
|
export { orchestrateInterface as interface } from "./interface/orchestrateInterface";
|
|
3
|
-
export { orchestrateRealize as realize } from "./orchestrateRealize";
|
|
4
|
-
export { orchestrateTest as test } from "./test/orchestrateTest";
|
|
5
3
|
export { orchestratePrisma as prisma } from "./prisma/orchestratePrisma";
|
|
4
|
+
export { orchestrateRealize as realize } from "./realize/orchestrateRealize";
|
|
5
|
+
export { orchestrateTest as test } from "./test/orchestrateTest";
|
|
@@ -22,6 +22,13 @@ export const orchestrateInterface =
|
|
|
22
22
|
): Promise<AutoBeAssistantMessageHistory | AutoBeInterfaceHistory> => {
|
|
23
23
|
// ENDPOINTS
|
|
24
24
|
const start: Date = new Date();
|
|
25
|
+
ctx.dispatch({
|
|
26
|
+
type: "interfaceStart",
|
|
27
|
+
created_at: start.toISOString(),
|
|
28
|
+
reason: props.reason,
|
|
29
|
+
step: ctx.state().analyze?.step ?? 0,
|
|
30
|
+
});
|
|
31
|
+
|
|
25
32
|
const init: AutoBeAssistantMessageHistory | AutoBeInterfaceEndpointsEvent =
|
|
26
33
|
await orchestrateInterfaceEndpoints(ctx);
|
|
27
34
|
if (init.type === "assistantMessage") {
|
|
@@ -75,7 +75,6 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
75
75
|
].join("\n"),
|
|
76
76
|
},
|
|
77
77
|
],
|
|
78
|
-
tokenUsage: ctx.usage(),
|
|
79
78
|
controllers: [
|
|
80
79
|
createApplication({
|
|
81
80
|
model: ctx.model,
|
|
@@ -96,7 +95,10 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
96
95
|
});
|
|
97
96
|
enforceToolCall(agentica);
|
|
98
97
|
|
|
99
|
-
await agentica.conversate("Fill missing schema types please")
|
|
98
|
+
await agentica.conversate("Fill missing schema types please").finally(() => {
|
|
99
|
+
const tokenUsage = agentica.getTokenUsage();
|
|
100
|
+
ctx.usage().record(tokenUsage, ["interface"]);
|
|
101
|
+
});
|
|
100
102
|
if (pointer.value === null) {
|
|
101
103
|
// unreachable
|
|
102
104
|
throw new Error(
|
|
@@ -186,7 +188,6 @@ const collection = {
|
|
|
186
188
|
llama: claude,
|
|
187
189
|
deepseek: claude,
|
|
188
190
|
"3.1": claude,
|
|
189
|
-
"3.0": typia.llm.application<IApplication, "3.0">(),
|
|
190
191
|
};
|
|
191
192
|
|
|
192
193
|
interface IApplication {
|
|
@@ -127,7 +127,6 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
127
127
|
].join("\n"),
|
|
128
128
|
},
|
|
129
129
|
],
|
|
130
|
-
tokenUsage: ctx.usage(),
|
|
131
130
|
controllers: [
|
|
132
131
|
createApplication({
|
|
133
132
|
model: ctx.model,
|
|
@@ -145,27 +144,32 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
145
144
|
enforceToolCall(agentica);
|
|
146
145
|
|
|
147
146
|
const already: string[] = Object.keys(oldbie.schemas);
|
|
148
|
-
await agentica
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
147
|
+
await agentica
|
|
148
|
+
.conversate(
|
|
149
|
+
[
|
|
150
|
+
"Make type components please.",
|
|
151
|
+
"",
|
|
152
|
+
"Here is the list of request/response bodies' type names from",
|
|
153
|
+
"OpenAPI operations. Make type components of them. If more object",
|
|
154
|
+
"types are required during making the components, please make them",
|
|
155
|
+
"too.",
|
|
156
|
+
"",
|
|
157
|
+
...Array.from(remained).map((k) => `- \`${k}\``),
|
|
158
|
+
...(already.length !== 0
|
|
159
|
+
? [
|
|
160
|
+
"",
|
|
161
|
+
"> By the way, here is the list of components schemas what you've",
|
|
162
|
+
"> already made. So, you don't need to make them again.",
|
|
163
|
+
">",
|
|
164
|
+
...already.map((k) => `> - \`${k}\``),
|
|
165
|
+
]
|
|
166
|
+
: []),
|
|
167
|
+
].join("\n"),
|
|
168
|
+
)
|
|
169
|
+
.finally(() => {
|
|
170
|
+
const tokenUsage = agentica.getTokenUsage();
|
|
171
|
+
ctx.usage().record(tokenUsage, ["interface"]);
|
|
172
|
+
});
|
|
169
173
|
if (pointer.value === null) {
|
|
170
174
|
// never be happened
|
|
171
175
|
throw new Error("Failed to create components.");
|
|
@@ -212,7 +216,6 @@ const collection = {
|
|
|
212
216
|
llama: claude,
|
|
213
217
|
deepseek: claude,
|
|
214
218
|
"3.1": claude,
|
|
215
|
-
"3.0": typia.llm.application<IApplication, "3.0">(),
|
|
216
219
|
};
|
|
217
220
|
|
|
218
221
|
interface IApplication {
|
|
@@ -43,7 +43,6 @@ export async function orchestrateInterfaceEndpoints<
|
|
|
43
43
|
ctx.state(),
|
|
44
44
|
AutoBeSystemPromptConstant.INTERFACE_ENDPOINT,
|
|
45
45
|
),
|
|
46
|
-
tokenUsage: ctx.usage(),
|
|
47
46
|
controllers: [
|
|
48
47
|
createApplication({
|
|
49
48
|
model: ctx.model,
|
|
@@ -55,8 +54,12 @@ export async function orchestrateInterfaceEndpoints<
|
|
|
55
54
|
],
|
|
56
55
|
});
|
|
57
56
|
|
|
58
|
-
const histories: MicroAgenticaHistory<Model>[] =
|
|
59
|
-
|
|
57
|
+
const histories: MicroAgenticaHistory<Model>[] = await agentica
|
|
58
|
+
.conversate(content)
|
|
59
|
+
.finally(() => {
|
|
60
|
+
const tokenUsage = agentica.getTokenUsage();
|
|
61
|
+
ctx.usage().record(tokenUsage, ["interface"]);
|
|
62
|
+
});
|
|
60
63
|
if (histories.at(-1)?.type === "assistantMessage")
|
|
61
64
|
return {
|
|
62
65
|
...(histories.at(-1)! as AgenticaAssistantMessageHistory),
|
|
@@ -114,7 +117,6 @@ const collection = {
|
|
|
114
117
|
llama: claude,
|
|
115
118
|
deepseek: claude,
|
|
116
119
|
"3.1": claude,
|
|
117
|
-
"3.0": typia.llm.application<IApplication, "3.0">(),
|
|
118
120
|
};
|
|
119
121
|
|
|
120
122
|
interface IApplication {
|
|
@@ -101,7 +101,6 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
101
101
|
ctx.state(),
|
|
102
102
|
AutoBeSystemPromptConstant.INTERFACE_ENDPOINT,
|
|
103
103
|
),
|
|
104
|
-
tokenUsage: ctx.usage(),
|
|
105
104
|
controllers: [
|
|
106
105
|
createApplication({
|
|
107
106
|
model: ctx.model,
|
|
@@ -113,15 +112,20 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
113
112
|
],
|
|
114
113
|
});
|
|
115
114
|
enforceToolCall(agentica);
|
|
116
|
-
await agentica
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
115
|
+
await agentica
|
|
116
|
+
.conversate(
|
|
117
|
+
[
|
|
118
|
+
"Make API operations for below endpoints:",
|
|
119
|
+
"",
|
|
120
|
+
"```json",
|
|
121
|
+
JSON.stringify(Array.from(endpoints), null, 2),
|
|
122
|
+
"```",
|
|
123
|
+
].join("\n"),
|
|
124
|
+
)
|
|
125
|
+
.finally(() => {
|
|
126
|
+
const tokenUsage = agentica.getTokenUsage();
|
|
127
|
+
ctx.usage().record(tokenUsage, ["interface"]);
|
|
128
|
+
});
|
|
125
129
|
if (pointer.value === null) throw new Error("Failed to create operations."); // never be happened
|
|
126
130
|
return pointer.value;
|
|
127
131
|
}
|
|
@@ -185,7 +189,6 @@ const collection = {
|
|
|
185
189
|
llama: claude,
|
|
186
190
|
deepseek: claude,
|
|
187
191
|
"3.1": claude,
|
|
188
|
-
"3.0": typia.llm.application<IApplication, "3.0">(),
|
|
189
192
|
};
|
|
190
193
|
|
|
191
194
|
interface IApplication {
|
|
@@ -124,6 +124,8 @@ export const transformInterfaceHistories = (
|
|
|
124
124
|
type: "assistantMessage",
|
|
125
125
|
text: [
|
|
126
126
|
"Database schema and entity relationship diagrams are ready.",
|
|
127
|
+
"You should also look at this and consider logic including membership/login and token issuance.",
|
|
128
|
+
"You can use table's name to define role in operations.",
|
|
127
129
|
"",
|
|
128
130
|
"## Prisma DB Schema",
|
|
129
131
|
"```json",
|
|
@@ -33,9 +33,11 @@ export async function orchestratePrismaComponents<
|
|
|
33
33
|
vendor: ctx.vendor,
|
|
34
34
|
config: {
|
|
35
35
|
...(ctx.config ?? {}),
|
|
36
|
+
executor: {
|
|
37
|
+
describe: null,
|
|
38
|
+
},
|
|
36
39
|
},
|
|
37
40
|
histories: transformPrismaComponentsHistories(ctx.state(), prefix),
|
|
38
|
-
tokenUsage: ctx.usage(),
|
|
39
41
|
controllers: [
|
|
40
42
|
createApplication({
|
|
41
43
|
model: ctx.model,
|
|
@@ -49,8 +51,12 @@ export async function orchestratePrismaComponents<
|
|
|
49
51
|
],
|
|
50
52
|
});
|
|
51
53
|
|
|
52
|
-
const histories: MicroAgenticaHistory<Model>[] =
|
|
53
|
-
|
|
54
|
+
const histories: MicroAgenticaHistory<Model>[] = await agentica
|
|
55
|
+
.conversate(content)
|
|
56
|
+
.finally(() => {
|
|
57
|
+
const tokenUsage = agentica.getTokenUsage();
|
|
58
|
+
ctx.usage().record(tokenUsage, ["prisma"]);
|
|
59
|
+
});
|
|
54
60
|
if (histories.at(-1)?.type === "assistantMessage")
|
|
55
61
|
return {
|
|
56
62
|
...(histories.at(-1)! as AgenticaAssistantMessageHistory),
|
|
@@ -105,7 +111,6 @@ const collection = {
|
|
|
105
111
|
llama: claude,
|
|
106
112
|
deepseek: claude,
|
|
107
113
|
"3.1": claude,
|
|
108
|
-
"3.0": typia.llm.application<IApplication, "3.0">(),
|
|
109
114
|
};
|
|
110
115
|
|
|
111
116
|
interface IApplication {
|
|
@@ -154,7 +159,7 @@ interface IExtractComponentsProps {
|
|
|
154
159
|
* {
|
|
155
160
|
* {
|
|
156
161
|
* filename: "schema-01-users.prisma",
|
|
157
|
-
* tables: ["user", "user_profile", "user_settings"]
|
|
162
|
+
* tables: ["user", "admin", "moderator", "user_profile", "user_settings"]
|
|
158
163
|
* },
|
|
159
164
|
* {
|
|
160
165
|
* filename: "schema-02-articles.prisma",
|
|
@@ -60,9 +60,11 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
60
60
|
vendor: ctx.vendor,
|
|
61
61
|
config: {
|
|
62
62
|
...(ctx.config ?? {}),
|
|
63
|
+
executor: {
|
|
64
|
+
describe: null,
|
|
65
|
+
},
|
|
63
66
|
},
|
|
64
67
|
histories: transformPrismaCorrectHistories(result),
|
|
65
|
-
tokenUsage: ctx.usage(),
|
|
66
68
|
controllers: [
|
|
67
69
|
createApplication({
|
|
68
70
|
model: ctx.model,
|
|
@@ -75,9 +77,14 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
75
77
|
enforceToolCall(agentica);
|
|
76
78
|
|
|
77
79
|
// REQUEST CORRECTION
|
|
78
|
-
await agentica
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
await agentica
|
|
81
|
+
.conversate(
|
|
82
|
+
"Resolve the compilation errors in the provided Prisma schema files.",
|
|
83
|
+
)
|
|
84
|
+
.finally(() => {
|
|
85
|
+
const tokenUsage = agentica.getTokenUsage();
|
|
86
|
+
ctx.usage().record(tokenUsage, ["prisma"]);
|
|
87
|
+
});
|
|
81
88
|
if (pointer.value === null) {
|
|
82
89
|
console.error(
|
|
83
90
|
"Unreachable error: PrismaCompilerAgent.pointer.value is null",
|
|
@@ -147,7 +154,6 @@ const collection = {
|
|
|
147
154
|
llama: claude,
|
|
148
155
|
deepseek: claude,
|
|
149
156
|
"3.1": claude,
|
|
150
|
-
"3.0": typia.llm.application<IApplication, "3.0">(),
|
|
151
157
|
};
|
|
152
158
|
|
|
153
159
|
interface IApplication {
|