@autobe/agent 0.0.0 → 0.3.9

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.
Files changed (166) hide show
  1. package/LICENSE +21 -21
  2. package/lib/AutoBeAgent.d.ts +9 -7
  3. package/lib/AutoBeAgent.js +106 -14
  4. package/lib/AutoBeAgent.js.map +1 -1
  5. package/lib/analyze/AnalyzeAgent.d.ts +24 -0
  6. package/lib/analyze/AnalyzeAgent.js +817 -0
  7. package/lib/analyze/AnalyzeAgent.js.map +1 -0
  8. package/lib/analyze/CreateReviewerAgent.d.ts +16 -0
  9. package/lib/analyze/CreateReviewerAgent.js +97 -0
  10. package/lib/analyze/CreateReviewerAgent.js.map +1 -0
  11. package/lib/analyze/Planning.d.ts +63 -0
  12. package/lib/{orchestrate/orchestratePrisma.js → analyze/Planning.js} +28 -11
  13. package/lib/analyze/Planning.js.map +1 -0
  14. package/lib/constants/AutoBeSystemPromptConstant.d.ts +14 -0
  15. package/lib/constants/AutoBeSystemPromptConstant.js +4 -0
  16. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -0
  17. package/lib/context/AutoBeContext.d.ts +7 -3
  18. package/lib/context/IAutoBeApplication.d.ts +72 -32
  19. package/lib/context/IAutoBeApplicationProps.d.ts +22 -2
  20. package/lib/context/IAutoBeApplicationResult.d.ts +0 -1
  21. package/lib/context/assertSchemaModel.d.ts +2 -0
  22. package/lib/context/assertSchemaModel.js +15 -0
  23. package/lib/context/assertSchemaModel.js.map +1 -0
  24. package/lib/{internal/transformAgenticaHistory.d.ts → factory/createAgenticaHistory.d.ts} +1 -1
  25. package/lib/{internal/transformAgenticaHistory.js → factory/createAgenticaHistory.js} +3 -4
  26. package/lib/factory/createAgenticaHistory.js.map +1 -0
  27. package/lib/factory/createAutoBeApplication.js +1195 -0
  28. package/lib/factory/createAutoBeApplication.js.map +1 -0
  29. package/lib/factory/createAutoBeState.js.map +1 -0
  30. package/lib/factory/index.d.ts +2 -0
  31. package/lib/factory/index.js +19 -0
  32. package/lib/factory/index.js.map +1 -0
  33. package/lib/factory/invertOpenApiDocument.d.ts +3 -0
  34. package/lib/factory/invertOpenApiDocument.js +51 -0
  35. package/lib/factory/invertOpenApiDocument.js.map +1 -0
  36. package/lib/index.d.ts +3 -3
  37. package/lib/index.js +4 -4
  38. package/lib/index.js.map +1 -1
  39. package/lib/index.mjs +5455 -547
  40. package/lib/index.mjs.map +1 -1
  41. package/lib/orchestrate/facade/transformFacadeStateMessage.d.ts +2 -0
  42. package/lib/orchestrate/facade/transformFacadeStateMessage.js +46 -0
  43. package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -0
  44. package/lib/orchestrate/index.d.ts +2 -2
  45. package/lib/orchestrate/index.js +2 -2
  46. package/lib/orchestrate/index.js.map +1 -1
  47. package/lib/orchestrate/interface/OpenApiEndpointComparator.d.ts +5 -0
  48. package/lib/orchestrate/interface/OpenApiEndpointComparator.js +16 -0
  49. package/lib/orchestrate/interface/OpenApiEndpointComparator.js.map +1 -0
  50. package/lib/orchestrate/interface/orchestrateInterface.d.ts +5 -0
  51. package/lib/orchestrate/interface/orchestrateInterface.js +61 -0
  52. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -0
  53. package/lib/orchestrate/interface/orchestrateInterfaceComponents.d.ts +4 -0
  54. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +702 -0
  55. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -0
  56. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.d.ts +4 -0
  57. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +452 -0
  58. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -0
  59. package/lib/orchestrate/interface/orchestrateInterfaceOperations.d.ts +4 -0
  60. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +2065 -0
  61. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -0
  62. package/lib/orchestrate/interface/transformInterfaceHistories.d.ts +3 -0
  63. package/lib/orchestrate/interface/transformInterfaceHistories.js +94 -0
  64. package/lib/orchestrate/interface/transformInterfaceHistories.js.map +1 -0
  65. package/lib/orchestrate/orchestrateAnalyze.d.ts +1 -3
  66. package/lib/orchestrate/orchestrateAnalyze.js +60 -6
  67. package/lib/orchestrate/orchestrateAnalyze.js.map +1 -1
  68. package/lib/orchestrate/{orchestratePrisma.d.ts → prisma/orchestratePrisma.d.ts} +3 -6
  69. package/lib/orchestrate/prisma/orchestratePrisma.js +103 -0
  70. package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -0
  71. package/lib/orchestrate/prisma/orchestratePrismaCompiler.d.ts +6 -0
  72. package/lib/orchestrate/prisma/orchestratePrismaCompiler.js +436 -0
  73. package/lib/orchestrate/prisma/orchestratePrismaCompiler.js.map +1 -0
  74. package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +5 -0
  75. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +437 -0
  76. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -0
  77. package/lib/orchestrate/prisma/orchestratePrismaSchema.d.ts +7 -0
  78. package/lib/orchestrate/prisma/orchestratePrismaSchema.js +369 -0
  79. package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -0
  80. package/lib/orchestrate/prisma/transformPrismaCompilerHistories.d.ts +3 -0
  81. package/lib/orchestrate/prisma/transformPrismaCompilerHistories.js +44 -0
  82. package/lib/orchestrate/prisma/transformPrismaCompilerHistories.js.map +1 -0
  83. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.d.ts +3 -0
  84. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +42 -0
  85. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -0
  86. package/lib/orchestrate/prisma/transformPrismaHistories.d.ts +3 -0
  87. package/lib/orchestrate/prisma/transformPrismaHistories.js +46 -0
  88. package/lib/orchestrate/prisma/transformPrismaHistories.js.map +1 -0
  89. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.d.ts +3 -0
  90. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +46 -0
  91. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -0
  92. package/lib/structures/IAutoBeConfig.d.ts +4 -4
  93. package/lib/utils/StringUtil.d.ts +4 -0
  94. package/lib/utils/StringUtil.js +43 -0
  95. package/lib/utils/StringUtil.js.map +1 -0
  96. package/lib/utils/divideArray.d.ts +4 -0
  97. package/lib/utils/divideArray.js +19 -0
  98. package/lib/utils/divideArray.js.map +1 -0
  99. package/lib/utils/emplaceMap.d.ts +1 -0
  100. package/lib/utils/emplaceMap.js +13 -0
  101. package/lib/utils/emplaceMap.js.map +1 -0
  102. package/package.json +29 -8
  103. package/src/AutoBeAgent.ts +227 -101
  104. package/src/analyze/AnalyzeAgent.ts +167 -0
  105. package/src/analyze/CreateReviewerAgent.ts +126 -0
  106. package/src/analyze/Planning.ts +75 -0
  107. package/src/constants/AutoBeSystemPromptConstant.ts +15 -0
  108. package/src/context/AutoBeContext.ts +19 -15
  109. package/src/context/AutoBeState.ts +15 -15
  110. package/src/context/AutoBeTokenUsage.ts +3 -3
  111. package/src/context/IAutoBeApplication.ts +112 -72
  112. package/src/context/IAutoBeApplicationProps.ts +27 -6
  113. package/src/context/IAutoBeApplicationResult.ts +3 -4
  114. package/src/context/assertSchemaModel.ts +17 -0
  115. package/src/{internal/transformAgenticaHistory.ts → factory/createAgenticaHistory.ts} +51 -54
  116. package/src/{internal → factory}/createAutoBeApplication.ts +52 -47
  117. package/src/{internal → factory}/createAutoBeState.ts +14 -14
  118. package/src/factory/index.ts +2 -0
  119. package/src/factory/invertOpenApiDocument.ts +63 -0
  120. package/src/index.ts +13 -12
  121. package/src/orchestrate/facade/transformFacadeStateMessage.ts +58 -0
  122. package/src/orchestrate/index.ts +5 -5
  123. package/src/orchestrate/interface/OpenApiEndpointComparator.ts +15 -0
  124. package/src/orchestrate/interface/orchestrateInterface.ts +66 -0
  125. package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +324 -0
  126. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +140 -0
  127. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +247 -0
  128. package/src/orchestrate/interface/transformInterfaceHistories.ts +98 -0
  129. package/src/orchestrate/orchestrateAnalyze.ts +86 -21
  130. package/src/orchestrate/orchestrateRealize.ts +18 -18
  131. package/src/orchestrate/orchestrateTest.ts +18 -18
  132. package/src/orchestrate/prisma/orchestratePrisma.ts +117 -0
  133. package/src/orchestrate/prisma/orchestratePrismaCompiler.ts +194 -0
  134. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +176 -0
  135. package/src/orchestrate/prisma/orchestratePrismaSchema.ts +181 -0
  136. package/src/orchestrate/prisma/transformPrismaCompilerHistories.ts +49 -0
  137. package/src/orchestrate/prisma/transformPrismaComponentsHistories.ts +46 -0
  138. package/src/orchestrate/prisma/transformPrismaHistories.ts +50 -0
  139. package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +50 -0
  140. package/src/structures/IAutoBeConfig.ts +25 -25
  141. package/src/structures/IAutoBeProps.ts +13 -13
  142. package/src/structures/IAutoBeVendor.ts +3 -3
  143. package/src/utils/StringUtil.ts +45 -0
  144. package/src/utils/divideArray.ts +16 -0
  145. package/src/utils/emplaceMap.ts +14 -0
  146. package/lib/factory/transformRouteDocument.d.ts +0 -3
  147. package/lib/factory/transformRouteDocument.js +0 -50
  148. package/lib/factory/transformRouteDocument.js.map +0 -1
  149. package/lib/internal/createAutoBeApplication.js +0 -1452
  150. package/lib/internal/createAutoBeApplication.js.map +0 -1
  151. package/lib/internal/createAutoBeState.js.map +0 -1
  152. package/lib/internal/transformAgenticaHistory.js.map +0 -1
  153. package/lib/orchestrate/interface/AutoBeInterfaceAgent.d.ts +0 -0
  154. package/lib/orchestrate/interface/AutoBeInterfaceAgent.js +0 -2
  155. package/lib/orchestrate/interface/AutoBeInterfaceAgent.js.map +0 -1
  156. package/lib/orchestrate/orchestrateInterface.d.ts +0 -8
  157. package/lib/orchestrate/orchestrateInterface.js +0 -22
  158. package/lib/orchestrate/orchestrateInterface.js.map +0 -1
  159. package/lib/orchestrate/orchestratePrisma.js.map +0 -1
  160. package/src/factory/transformRouteDocument.ts +0 -49
  161. package/src/orchestrate/interface/AutoBeInterfaceAgent.ts +0 -0
  162. package/src/orchestrate/orchestrateInterface.ts +0 -21
  163. package/src/orchestrate/orchestratePrisma.ts +0 -21
  164. /package/lib/{internal → factory}/createAutoBeApplication.d.ts +0 -0
  165. /package/lib/{internal → factory}/createAutoBeState.d.ts +0 -0
  166. /package/lib/{internal → factory}/createAutoBeState.js +0 -0
@@ -1,15 +1,19 @@
1
- import { AutoBeHistory, IAutoBeCompiler } from "@autobe/interface";
2
- import { ILlmSchema } from "@samchon/openapi";
3
-
4
- import { IAutoBeVendor } from "../structures/IAutoBeVendor";
5
- import { AutoBeState } from "./AutoBeState";
6
- import { AutoBeTokenUsage } from "./AutoBeTokenUsage";
7
-
8
- export interface AutoBeContext<Model extends ILlmSchema.Model> {
9
- model: Model;
10
- vendor: IAutoBeVendor;
11
- compiler: IAutoBeCompiler;
12
- histories: AutoBeHistory[];
13
- usage: () => AutoBeTokenUsage;
14
- state: () => AutoBeState;
15
- }
1
+ import { AutoBeEvent, AutoBeHistory, IAutoBeCompiler } from "@autobe/interface";
2
+ import { ILlmSchema } from "@samchon/openapi";
3
+
4
+ import { IAutoBeConfig } from "../structures/IAutoBeConfig";
5
+ import { IAutoBeVendor } from "../structures/IAutoBeVendor";
6
+ import { AutoBeState } from "./AutoBeState";
7
+ import { AutoBeTokenUsage } from "./AutoBeTokenUsage";
8
+
9
+ export interface AutoBeContext<Model extends ILlmSchema.Model> {
10
+ model: Model;
11
+ vendor: IAutoBeVendor;
12
+ config: IAutoBeConfig | undefined;
13
+ compiler: IAutoBeCompiler;
14
+ files: () => Record<string, string>;
15
+ histories: () => AutoBeHistory[];
16
+ state: () => AutoBeState;
17
+ usage: () => AutoBeTokenUsage;
18
+ dispatch: (event: AutoBeEvent) => void;
19
+ }
@@ -1,15 +1,15 @@
1
- import {
2
- AutoBeAnalyzeHistory,
3
- AutoBeInterfaceHistory,
4
- AutoBePrismaHistory,
5
- AutoBeRealizeHistory,
6
- AutoBeTestHistory,
7
- } from "@autobe/interface";
8
-
9
- export interface AutoBeState {
10
- analyze: AutoBeAnalyzeHistory | null;
11
- prisma: AutoBePrismaHistory | null;
12
- interface: AutoBeInterfaceHistory | null;
13
- test: AutoBeTestHistory | null;
14
- realize: AutoBeRealizeHistory | null;
15
- }
1
+ import {
2
+ AutoBeAnalyzeHistory,
3
+ AutoBeInterfaceHistory,
4
+ AutoBePrismaHistory,
5
+ AutoBeRealizeHistory,
6
+ AutoBeTestHistory,
7
+ } from "@autobe/interface";
8
+
9
+ export interface AutoBeState {
10
+ analyze: AutoBeAnalyzeHistory | null;
11
+ prisma: AutoBePrismaHistory | null;
12
+ interface: AutoBeInterfaceHistory | null;
13
+ test: AutoBeTestHistory | null;
14
+ realize: AutoBeRealizeHistory | null;
15
+ }
@@ -1,3 +1,3 @@
1
- import { AgenticaTokenUsage } from "@agentica/core";
2
-
3
- export import AutoBeTokenUsage = AgenticaTokenUsage;
1
+ import { AgenticaTokenUsage } from "@agentica/core";
2
+
3
+ export import AutoBeTokenUsage = AgenticaTokenUsage;
@@ -1,72 +1,112 @@
1
- import { IAutoBeApplicationProps } from "./IAutoBeApplicationProps";
2
- import { IAutoBeApplicationResult } from "./IAutoBeApplicationResult";
3
-
4
- /**
5
- * Application for AutoBE function calling.
6
- *
7
- * @author Samchon
8
- */
9
- export interface IAutoBeApplication {
10
- /**
11
- * Run Analyze Agent.
12
- *
13
- * Analyze agent analyzes requirements and creates specification
14
- * documents.
15
- *
16
- * The Analyze agent serves as the foundation of the entire development
17
- * process. It not only captures initial requirements but also
18
- * continuously refines understanding through iterative conversation
19
- * with users. When requirements are ambiguous or incomplete, it
20
- * proactively formulates targeted questions to elicit necessary
21
- * information before proceeding with development.
22
- *
23
- * Additionally, once other agents have generated code, the Analyze
24
- * agent can interpret change requests in the context of existing
25
- * implementations, assessing the impact and feasibility of modifications
26
- * while maintaining system integrity. This comprehensive approach
27
- * ensures that all subsequent development stages work from a clear,
28
- * complete, and consistent specification.
29
- */
30
- analyze(props: IAutoBeApplicationProps): Promise<IAutoBeApplicationResult>;
31
-
32
- /**
33
- * Run prisma agent.
34
- *
35
- * Prisma agent analyzes requirements specifications to generate
36
- * database schemas in Prisma format.
37
- *
38
- * The Prisma agent references the requirements specification document
39
- * created by the {@link analyze} function to craft the `prisma.schema`
40
- * file. For each entity and attribute in the database schema, it
41
- * provides comprehensive documentation including the rationale behind
42
- * its creation, its purpose, and conceptual explanations. The agent
43
- * employs normalization techniques to ensure high-quality database
44
- * design.
45
- *
46
- * Once the DB schema file is written, the Prisma agent compiles it using
47
- * the built-in Prisma compiler. If compilation errors occur, these are
48
- * fed back to the AI agent, enabling a self-correction process through
49
- * compiler feedback. After successful compilation, this schema file is
50
- * then subjected to a quality assurance process through an internal
51
- * review agent that verifies and refines the schema.
52
- *
53
- * Note that, never use this function without calling the
54
- * {@link analyze} function at least once.
55
- */
56
- prisma(props: IAutoBeApplicationProps): Promise<IAutoBeApplicationResult>;
57
-
58
- /**
59
- * Run interface agent.
60
- */
61
- interface(props: IAutoBeApplicationProps): Promise<IAutoBeApplicationResult>;
62
-
63
- /**
64
- * Run test program agent.
65
- */
66
- test(props: IAutoBeApplicationProps): Promise<IAutoBeApplicationResult>;
67
-
68
- /**
69
- * Run realize agent.
70
- */
71
- realize(props: IAutoBeApplicationProps): Promise<IAutoBeApplicationResult>;
72
- }
1
+ import { IAutoBeApplicationProps } from "./IAutoBeApplicationProps";
2
+ import { IAutoBeApplicationResult } from "./IAutoBeApplicationResult";
3
+
4
+ /**
5
+ * Application for AutoBE function calling.
6
+ *
7
+ * @author Samchon
8
+ */
9
+ export interface IAutoBeApplication {
10
+ /**
11
+ * Run Analyze Agent.
12
+ *
13
+ * Executes the Analyze agent to process user requirements and generate a
14
+ * structured specification document. This agent analyzes all conversation
15
+ * history between users and AI, separates business logic from technical
16
+ * requirements, and establishes development priorities and scope.
17
+ *
18
+ * **IMPORTANT**: Only call this function when sufficient requirements have
19
+ * been discussed to generate a comprehensive specification. The context must
20
+ * contain enough detail about the system's purpose, core features, data
21
+ * models, and business rules. If requirements are unclear or incomplete,
22
+ * continue gathering information through conversation instead.
23
+ *
24
+ * The agent will automatically generate follow-up questions for any ambiguous
25
+ * requirements and continuously refine its understanding through iterative
26
+ * conversation. When executed after other agents have generated code, it can
27
+ * also interpret change requests in the context of existing implementations.
28
+ */
29
+ analyze(props: IAutoBeApplicationProps): Promise<IAutoBeApplicationResult>;
30
+
31
+ /**
32
+ * Run prisma agent.
33
+ *
34
+ * Executes the Prisma agent to generate database schema files and ERD
35
+ * documentation. This agent reads the requirements specification created by
36
+ * the {@link analyze Analyze agent} and produces a complete Prisma schema with
37
+ * comprehensive documentation for each entity and attribute.
38
+ *
39
+ * **PREREQUISITE**: Only call this function after the {@link analyze} function
40
+ * has been successfully executed and a requirements specification document
41
+ * has been generated. The Prisma agent depends on the structured requirements
42
+ * analysis to design the database schema properly. Without a completed
43
+ * requirements specification, this function should NOT be called.
44
+ *
45
+ * The agent will automatically validate the generated schema using the Prisma
46
+ * compiler, self-correct any compilation errors through feedback loops, and
47
+ * generate ERD documentation using prisma-markdown. An internal review
48
+ * process ensures schema quality and optimization.
49
+ */
50
+ prisma(props: IAutoBeApplicationProps): Promise<IAutoBeApplicationResult>;
51
+
52
+ /**
53
+ * Run interface agent.
54
+ *
55
+ * Executes the Interface agent to design and generate API interfaces. This
56
+ * agent creates OpenAPI schemas and TypeScript/NestJS code based on the
57
+ * requirements specification and ERD documentation from previous agents.
58
+ *
59
+ * The agent follows a sophisticated pipeline: first constructing formal
60
+ * OpenAPI Operation Schemas and JSON Schemas, then validating these schemas,
61
+ * and finally transforming them into NestJS controllers and DTOs. Each
62
+ * generated interface includes comprehensive JSDoc comments and undergoes
63
+ * internal review for consistency.
64
+ */
65
+ interface(props: IAutoBeApplicationProps): Promise<IAutoBeApplicationResult>;
66
+
67
+ /**
68
+ * Run test program agent.
69
+ *
70
+ * Executes the Test agent to generate comprehensive E2E test suites for all
71
+ * {@link interface API interfaces}. This agent synthesizes outputs from
72
+ * previous agents to create tests that validate both individual endpoints and
73
+ * their interactions.
74
+ *
75
+ * **PREREQUISITE**: Only call this function after the {@link interface}
76
+ * function has been successfully executed and API interfaces have been
77
+ * generated. The Test agent requires the completed API interface definitions,
78
+ * OpenAPI schemas, and TypeScript code to generate appropriate test
79
+ * scenarios. Without completed interface design, this function should NOT be
80
+ * called.
81
+ *
82
+ * The agent will analyze dependency relationships between API functions,
83
+ * structure integrated test scenarios with correct execution sequences, and
84
+ * enhance pre-generated test scaffolds with business logic validation.
85
+ * TypeScript compiler validation and internal review ensure test quality and
86
+ * optimal coverage.
87
+ */
88
+ test(props: IAutoBeApplicationProps): Promise<IAutoBeApplicationResult>;
89
+
90
+ /**
91
+ * Run realize agent.
92
+ *
93
+ * Executes the Realize agent to implement the actual business logic for each
94
+ * API endpoint. This agent synthesizes all outputs from previous agents to
95
+ * generate fully functional service provider code.
96
+ *
97
+ * **PREREQUISITE**: Only call this function after the {@link interface}
98
+ * function has been successfully executed and API interfaces have been
99
+ * generated. The Realize agent requires the completed API interface
100
+ * definitions to implement the corresponding service logic. It also benefits
101
+ * from having test code available for validation. Without completed interface
102
+ * design, this function should NOT be called.
103
+ *
104
+ * The agent will create service implementations with multiple validation
105
+ * layers: TypeScript compiler feedback, runtime validation through test
106
+ * execution, and quality optimization through internal review. The generated
107
+ * code handles database interactions through Prisma, implements security and
108
+ * validation checks, and processes business rules according to
109
+ * specifications.
110
+ */
111
+ realize(props: IAutoBeApplicationProps): Promise<IAutoBeApplicationResult>;
112
+ }
@@ -1,6 +1,27 @@
1
- export interface IAutoBeApplicationProps {
2
- /**
3
- * The reason of the function call.
4
- */
5
- reason: string;
6
- }
1
+ export interface IAutoBeApplicationProps {
2
+ /** The reason of the function call. */
3
+ reason: string;
4
+
5
+ /**
6
+ * This prompt defines how to convert a user's planning-oriented requirements into a structured message for an internal agent.
7
+ *
8
+ * All content the user provides must be included in the message. However, if some parts of the user's input are inappropriate or insufficient from a planning standpoint, you are allowed to add **supplementary remarks**—but only under strict rules.
9
+ *
10
+ * <Supplementary Remark Rules>
11
+ *
12
+ * 1. **Definition**
13
+ * A supplementary remark is additional information that may differ from the user's original intent. Because of this, **you must clearly indicate that it is *not* part of the user’s thinking**.
14
+ *
15
+ * 2. **When to Supplement**
16
+ * - If the user's input reveals a lack of technical understanding (e.g., suggesting "put all data into one table"), and the plan is not an MVP or PoC, it's encouraged to make reasonable additions for a more scalable or robust structure.
17
+ * - If there are clear gaps in the user's planning logic, you may supplement the content to ensure completeness.
18
+ *
19
+ * 3. **When Not to Supplement**
20
+ * - If the user's input is vague or ambiguous, **do not assume or add extra details**. Instead, it’s better to ask the user follow-up questions to clarify their intent.
21
+ * - If the user has made no comment on design, **do not impose design-related decisions** (e.g., colors, fonts, tone). However, you may state explicitly that no design requirements were provided.
22
+ * - Generic advice like "UX should be good" can be omitted unless it adds value, as such goals are assumed in all services.
23
+ *
24
+ * </Supplementary Remark Rules>
25
+ */
26
+ userPlanningRequirements?: string;
27
+ }
@@ -1,4 +1,3 @@
1
- export interface IAutoBeApplicationResult {
2
- success: boolean;
3
- description: string;
4
- }
1
+ export interface IAutoBeApplicationResult {
2
+ success: boolean;
3
+ }
@@ -0,0 +1,17 @@
1
+ import { ILlmSchema } from "@samchon/openapi";
2
+
3
+ export function assertSchemaModel<Model extends ILlmSchema.Model>(
4
+ model: Model,
5
+ ): asserts model is Exclude<Model, "gemini" | "3.0"> {
6
+ if (model === "gemini")
7
+ throw new Error(
8
+ [
9
+ "Error on AutoBeAgent.constructor(): gemini is not supported",
10
+ "because it does not follow standard JSON schema specification.",
11
+ "@autobe requires union type (`oneOf` or `anyOf`) for backend code generation,",
12
+ "but gemini has banned them. Please wait until when `@agentica`",
13
+ "supports prompt based function calling which can detour gemini's",
14
+ "restriction of JSON schema specification.",
15
+ ].join(" "),
16
+ );
17
+ }
@@ -1,54 +1,51 @@
1
- import { AgenticaOperation, MicroAgenticaHistory } from "@agentica/core";
2
- import {
3
- AutoBeAssistantMessageHistory,
4
- AutoBeHistory,
5
- AutoBeUserMessageHistory,
6
- } from "@autobe/interface";
7
- import { ILlmSchema } from "@samchon/openapi";
8
-
9
- export function transformAgenticaHistory<
10
- Model extends ILlmSchema.Model,
11
- >(props: {
12
- operations: readonly AgenticaOperation<Model>[];
13
- history: AutoBeHistory;
14
- }): MicroAgenticaHistory<Model> | null {
15
- if (props.history.type === "userMessage")
16
- return {
17
- ...props.history,
18
- toJSON: () => props.history as AutoBeUserMessageHistory,
19
- };
20
- else if (props.history.type === "assistantMessage")
21
- return {
22
- ...props.history,
23
- toJSON: () => props.history as AutoBeAssistantMessageHistory,
24
- };
25
-
26
- const operation: AgenticaOperation<Model> | undefined = props.operations.find(
27
- (op) => op.function.name === props.history.type,
28
- );
29
- if (operation === undefined) return null;
30
- const partial = {
31
- id: props.history.id,
32
- type: "execute" as const,
33
- arguments: {
34
- reason: props.history.reason,
35
- },
36
- value: {
37
- success:
38
- props.history.type === "analyze" || props.history.type === "interface"
39
- ? true
40
- : props.history.result.type === "success",
41
- description: props.history.description,
42
- },
43
- };
44
- return {
45
- ...partial,
46
- protocol: operation.protocol as "class",
47
- operation: operation as AgenticaOperation.Class<Model>,
48
- toJSON: () => ({
49
- ...partial,
50
- protocol: operation.protocol as "class",
51
- operation: operation.toJSON(),
52
- }),
53
- };
54
- }
1
+ import { AgenticaOperation, MicroAgenticaHistory } from "@agentica/core";
2
+ import {
3
+ AutoBeAssistantMessageHistory,
4
+ AutoBeHistory,
5
+ AutoBeUserMessageHistory,
6
+ } from "@autobe/interface";
7
+ import { ILlmSchema } from "@samchon/openapi";
8
+
9
+ export function createAgenticaHistory<Model extends ILlmSchema.Model>(props: {
10
+ operations: readonly AgenticaOperation<Model>[];
11
+ history: AutoBeHistory;
12
+ }): MicroAgenticaHistory<Model> | null {
13
+ if (props.history.type === "userMessage")
14
+ return {
15
+ ...props.history,
16
+ toJSON: () => props.history as AutoBeUserMessageHistory,
17
+ };
18
+ else if (props.history.type === "assistantMessage")
19
+ return {
20
+ ...props.history,
21
+ toJSON: () => props.history as AutoBeAssistantMessageHistory,
22
+ };
23
+
24
+ const operation: AgenticaOperation<Model> | undefined = props.operations.find(
25
+ (op) => op.function.name === props.history.type,
26
+ );
27
+ if (operation === undefined) return null;
28
+ const partial = {
29
+ id: props.history.id,
30
+ type: "execute" as const,
31
+ arguments: {
32
+ reason: props.history.reason,
33
+ },
34
+ value: {
35
+ success:
36
+ props.history.type === "analyze" || props.history.type === "interface"
37
+ ? true
38
+ : props.history.result.type === "success",
39
+ },
40
+ };
41
+ return {
42
+ ...partial,
43
+ protocol: operation.protocol as "class",
44
+ operation: operation as AgenticaOperation.Class<Model>,
45
+ toJSON: () => ({
46
+ ...partial,
47
+ protocol: operation.protocol as "class",
48
+ operation: operation.toJSON(),
49
+ }),
50
+ };
51
+ }
@@ -1,47 +1,52 @@
1
- import { IAgenticaController } from "@agentica/core";
2
- import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
3
- import typia from "typia";
4
-
5
- import { AutoBeContext } from "../context/AutoBeContext";
6
- import { IAutoBeApplication } from "../context/IAutoBeApplication";
7
- import { orchestrateAnalyze } from "../orchestrate/orchestrateAnalyze";
8
- import { orchestrateInterface } from "../orchestrate/orchestrateInterface";
9
- import { orchestratePrisma } from "../orchestrate/orchestratePrisma";
10
- import { orchestrateRealize } from "../orchestrate/orchestrateRealize";
11
- import { orchestrateTest } from "../orchestrate/orchestrateTest";
12
-
13
- export const createAutoBeController = <Model extends ILlmSchema.Model>(props: {
14
- model: Model;
15
- context: AutoBeContext<Model>;
16
- }): IAgenticaController.IClass<Model> => {
17
- const application: ILlmApplication<Model> = collection[
18
- props.model
19
- ] as unknown as ILlmApplication<Model>;
20
- return {
21
- protocol: "class",
22
- name: "autobe",
23
- application,
24
- execute: {
25
- analyze: orchestrateAnalyze(props.context),
26
- prisma: orchestratePrisma(props.context),
27
- interface: orchestrateInterface(props.context),
28
- test: orchestrateTest(props.context),
29
- realize: orchestrateRealize(props.context),
30
- },
31
- };
32
- };
33
-
34
- const claude = typia.llm.application<IAutoBeApplication, "claude">();
35
- const collection = {
36
- chatgpt: typia.llm.application<
37
- IAutoBeApplication,
38
- "chatgpt",
39
- { reference: true }
40
- >(),
41
- gemini: typia.llm.application<IAutoBeApplication, "gemini">(),
42
- claude,
43
- llama: claude,
44
- deepseek: claude,
45
- "3.1": claude,
46
- "3.0": typia.llm.application<IAutoBeApplication, "3.0">(),
47
- };
1
+ import { IAgenticaController } from "@agentica/core";
2
+ import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
3
+ import typia from "typia";
4
+
5
+ import { AutoBeContext } from "../context/AutoBeContext";
6
+ import { IAutoBeApplication } from "../context/IAutoBeApplication";
7
+ import { assertSchemaModel } from "../context/assertSchemaModel";
8
+ import { orchestrateInterface } from "../orchestrate/interface/orchestrateInterface";
9
+ import { orchestrateAnalyze } from "../orchestrate/orchestrateAnalyze";
10
+ import { orchestrateRealize } from "../orchestrate/orchestrateRealize";
11
+ import { orchestrateTest } from "../orchestrate/orchestrateTest";
12
+ import { orchestratePrisma } from "../orchestrate/prisma/orchestratePrisma";
13
+
14
+ export const createAutoBeController = <Model extends ILlmSchema.Model>(props: {
15
+ model: Model;
16
+ context: AutoBeContext<Model>;
17
+ }): IAgenticaController.IClass<Model> => {
18
+ assertSchemaModel(props.model);
19
+ const application: ILlmApplication<Model> = collection[
20
+ props.model
21
+ ] as unknown as ILlmApplication<Model>;
22
+ return {
23
+ protocol: "class",
24
+ name: "autobe",
25
+ application,
26
+ execute: {
27
+ analyze: orchestrateAnalyze(props.context),
28
+ prisma: orchestratePrisma(props.context),
29
+ interface: orchestrateInterface(props.context),
30
+ test: orchestrateTest(props.context),
31
+ realize: orchestrateRealize(props.context),
32
+ },
33
+ };
34
+ };
35
+
36
+ const claude = typia.llm.application<
37
+ IAutoBeApplication,
38
+ "claude",
39
+ { reference: true }
40
+ >();
41
+ const collection = {
42
+ chatgpt: typia.llm.application<
43
+ IAutoBeApplication,
44
+ "chatgpt",
45
+ { reference: true }
46
+ >(),
47
+ claude,
48
+ llama: claude,
49
+ deepseek: claude,
50
+ "3.1": claude,
51
+ "3.0": typia.llm.application<IAutoBeApplication, "3.0">(),
52
+ };
@@ -1,14 +1,14 @@
1
- import { AutoBeHistory } from "@autobe/interface";
2
-
3
- import { AutoBeState } from "../context/AutoBeState";
4
-
5
- export const createAutoBeState = (histories: AutoBeHistory[]): AutoBeState => {
6
- const reversed = histories.slice().reverse();
7
- return {
8
- analyze: reversed.find((h) => h.type === "analyze") ?? null,
9
- prisma: reversed.find((h) => h.type === "prisma") ?? null,
10
- interface: reversed.find((h) => h.type === "interface") ?? null,
11
- test: reversed.find((h) => h.type === "test") ?? null,
12
- realize: reversed.find((h) => h.type === "realize") ?? null,
13
- };
14
- };
1
+ import { AutoBeHistory } from "@autobe/interface";
2
+
3
+ import { AutoBeState } from "../context/AutoBeState";
4
+
5
+ export const createAutoBeState = (histories: AutoBeHistory[]): AutoBeState => {
6
+ const reversed = histories.slice().reverse();
7
+ return {
8
+ analyze: reversed.find((h) => h.type === "analyze") ?? null,
9
+ prisma: reversed.find((h) => h.type === "prisma") ?? null,
10
+ interface: reversed.find((h) => h.type === "interface") ?? null,
11
+ test: reversed.find((h) => h.type === "test") ?? null,
12
+ realize: reversed.find((h) => h.type === "realize") ?? null,
13
+ };
14
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./createAgenticaHistory";
2
+ export * from "./invertOpenApiDocument";
@@ -0,0 +1,63 @@
1
+ import { AutoBeOpenApi } from "@autobe/interface";
2
+ import {
3
+ HttpMigration,
4
+ IHttpMigrateApplication,
5
+ OpenApi,
6
+ OpenApiTypeChecker,
7
+ } from "@samchon/openapi";
8
+
9
+ export function invertOpenApiDocument(
10
+ document: OpenApi.IDocument,
11
+ ): AutoBeOpenApi.IDocument {
12
+ const app: IHttpMigrateApplication = HttpMigration.application(document);
13
+ return {
14
+ operations: app.routes
15
+ .filter((r) => r.query === null)
16
+ .map(
17
+ (r) =>
18
+ ({
19
+ specification: empty("specification"),
20
+ method: r.method as "post",
21
+ path: r.path,
22
+ summary: r.operation().summary ?? empty("summary"),
23
+ description: r.operation().description ?? empty("description"),
24
+ parameters: r.parameters.map(
25
+ (p) =>
26
+ ({
27
+ name: p.name,
28
+ description:
29
+ p.parameter().description ?? empty("description"),
30
+ schema: p.schema as any,
31
+ }) satisfies AutoBeOpenApi.IParameter,
32
+ ),
33
+ requestBody:
34
+ r.body?.type === "application/json" &&
35
+ OpenApiTypeChecker.isReference(r.body.schema)
36
+ ? {
37
+ description: r.body.description() ?? empty("description"),
38
+ typeName: r.body.schema.$ref.split("/").pop()!,
39
+ }
40
+ : null,
41
+ responseBody:
42
+ r.success?.type === "application/json" &&
43
+ OpenApiTypeChecker.isReference(r.success.schema)
44
+ ? {
45
+ description:
46
+ r.success.description() ?? empty("description"),
47
+ typeName: r.success.schema.$ref.split("/").pop()!,
48
+ }
49
+ : null,
50
+ }) satisfies AutoBeOpenApi.IOperation,
51
+ ),
52
+ components: {
53
+ schemas: (document.components?.schemas ?? {}) as Record<
54
+ string,
55
+ AutoBeOpenApi.IJsonSchemaDescriptive
56
+ >,
57
+ },
58
+ };
59
+ }
60
+
61
+ function empty(key: string): string {
62
+ return `Describe ${key} as much as possible with clear and concise words.`;
63
+ }