@autobe/agent 0.5.2 → 0.7.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.
Files changed (119) hide show
  1. package/lib/AutoBeAgent.js +4 -4
  2. package/lib/AutoBeAgent.js.map +1 -1
  3. package/lib/constants/AutoBeSystemPromptConstant.d.ts +5 -2
  4. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  5. package/lib/context/AutoBeContext.d.ts +2 -2
  6. package/lib/context/IAutoBeApplicationProps.d.ts +6 -0
  7. package/lib/factory/createAgenticaHistory.js +1 -0
  8. package/lib/factory/createAgenticaHistory.js.map +1 -1
  9. package/lib/factory/createAutoBeApplication.js +17 -17
  10. package/lib/factory/createAutoBeApplication.js.map +1 -1
  11. package/lib/index.mjs +6228 -4563
  12. package/lib/index.mjs.map +1 -1
  13. package/lib/{analyze → orchestrate/analyze}/AutoBeAnalyzeAgent.d.ts +4 -8
  14. package/lib/{analyze → orchestrate/analyze}/AutoBeAnalyzeAgent.js +25 -20
  15. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js.map +1 -0
  16. package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.js.map +1 -0
  17. package/lib/orchestrate/analyze/AutoBeAnalyzePointer.d.ts +9 -0
  18. package/lib/orchestrate/analyze/AutoBeAnalyzePointer.js +3 -0
  19. package/lib/orchestrate/analyze/AutoBeAnalyzePointer.js.map +1 -0
  20. package/lib/{analyze → orchestrate/analyze}/AutoBeAnalyzeReviewer.d.ts +1 -1
  21. package/lib/{analyze → orchestrate/analyze}/AutoBeAnalyzeReviewer.js +8 -5
  22. package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js.map +1 -0
  23. package/lib/orchestrate/analyze/orchestrateAnalyze.d.ts +31 -0
  24. package/lib/orchestrate/{orchestrateAnalyze.js → analyze/orchestrateAnalyze.js} +200 -59
  25. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -0
  26. package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
  27. package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
  28. package/lib/orchestrate/index.d.ts +3 -3
  29. package/lib/orchestrate/index.js +6 -6
  30. package/lib/orchestrate/index.js.map +1 -1
  31. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +8 -1
  32. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  33. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +6 -1
  34. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
  35. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +3 -1
  36. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  37. package/lib/orchestrate/interface/transformInterfaceHistories.js +41 -0
  38. package/lib/orchestrate/interface/transformInterfaceHistories.js.map +1 -1
  39. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +6 -5
  40. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  41. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.d.ts +1 -1
  42. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +28 -1
  43. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
  44. package/lib/orchestrate/prisma/transformPrismaCorrectHistories.js +9 -0
  45. package/lib/orchestrate/prisma/transformPrismaCorrectHistories.js.map +1 -1
  46. package/lib/orchestrate/prisma/transformPrismaHistories.js +9 -0
  47. package/lib/orchestrate/prisma/transformPrismaHistories.js.map +1 -1
  48. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +7 -0
  49. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
  50. package/lib/orchestrate/{orchestrateTest.d.ts → test/orchestrateTest.d.ts} +2 -2
  51. package/lib/orchestrate/test/orchestrateTest.js +70 -0
  52. package/lib/orchestrate/test/orchestrateTest.js.map +1 -0
  53. package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +4 -0
  54. package/lib/orchestrate/test/orchestrateTestCorrect.js +543 -0
  55. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -0
  56. package/lib/orchestrate/test/orchestrateTestProgress.d.ts +4 -0
  57. package/lib/orchestrate/test/orchestrateTestProgress.js +403 -0
  58. package/lib/orchestrate/test/orchestrateTestProgress.js.map +1 -0
  59. package/lib/orchestrate/test/orchestrateTestScenario.d.ts +4 -0
  60. package/lib/orchestrate/test/orchestrateTestScenario.js +700 -0
  61. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -0
  62. package/lib/orchestrate/test/transformTestCorrectHistories.d.ts +2 -0
  63. package/lib/orchestrate/test/transformTestCorrectHistories.js +47 -0
  64. package/lib/orchestrate/test/transformTestCorrectHistories.js.map +1 -0
  65. package/lib/orchestrate/test/transformTestHistories.d.ts +3 -0
  66. package/lib/orchestrate/test/transformTestHistories.js +74 -0
  67. package/lib/orchestrate/test/transformTestHistories.js.map +1 -0
  68. package/lib/orchestrate/test/transformTestProgressHistories.d.ts +2 -0
  69. package/lib/orchestrate/test/transformTestProgressHistories.js +47 -0
  70. package/lib/orchestrate/test/transformTestProgressHistories.js.map +1 -0
  71. package/lib/orchestrate/test/transformTestScenarioHistories.d.ts +4 -0
  72. package/lib/orchestrate/test/transformTestScenarioHistories.js +176 -0
  73. package/lib/orchestrate/test/transformTestScenarioHistories.js.map +1 -0
  74. package/lib/structures/IAutoBeVendor.d.ts +45 -2
  75. package/package.json +6 -6
  76. package/src/AutoBeAgent.ts +5 -3
  77. package/src/constants/AutoBeSystemPromptConstant.ts +5 -2
  78. package/src/context/AutoBeContext.ts +2 -2
  79. package/src/context/IAutoBeApplicationProps.ts +6 -0
  80. package/src/factory/createAgenticaHistory.ts +1 -0
  81. package/src/factory/createAutoBeApplication.ts +2 -2
  82. package/src/{analyze → orchestrate/analyze}/AutoBeAnalyzeAgent.ts +38 -36
  83. package/src/orchestrate/analyze/AutoBeAnalyzePointer.ts +10 -0
  84. package/src/{analyze → orchestrate/analyze}/AutoBeAnalyzeReviewer.ts +9 -6
  85. package/src/orchestrate/{orchestrateAnalyze.ts → analyze/orchestrateAnalyze.ts} +91 -39
  86. package/src/orchestrate/index.ts +3 -3
  87. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +8 -1
  88. package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +6 -1
  89. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +3 -1
  90. package/src/orchestrate/interface/transformInterfaceHistories.ts +40 -0
  91. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +4 -1
  92. package/src/orchestrate/prisma/transformPrismaComponentsHistories.ts +28 -0
  93. package/src/orchestrate/prisma/transformPrismaCorrectHistories.ts +9 -0
  94. package/src/orchestrate/prisma/transformPrismaHistories.ts +9 -0
  95. package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +7 -0
  96. package/src/orchestrate/test/orchestrateTest.ts +86 -0
  97. package/src/orchestrate/test/orchestrateTestCorrect.ts +368 -0
  98. package/src/orchestrate/test/orchestrateTestProgress.ts +264 -0
  99. package/src/orchestrate/test/orchestrateTestScenario.ts +178 -0
  100. package/src/orchestrate/test/transformTestCorrectHistories.ts +51 -0
  101. package/src/orchestrate/test/transformTestHistories.ts +77 -0
  102. package/src/orchestrate/test/transformTestProgressHistories.ts +51 -0
  103. package/src/orchestrate/test/transformTestScenarioHistories.ts +184 -0
  104. package/src/structures/IAutoBeVendor.ts +48 -2
  105. package/lib/analyze/AnalyzeAgent.d.ts +0 -24
  106. package/lib/analyze/AnalyzeAgent.js +0 -942
  107. package/lib/analyze/AnalyzeAgent.js.map +0 -1
  108. package/lib/analyze/AutoBeAnalyzeAgent.js.map +0 -1
  109. package/lib/analyze/AutoBeAnalyzeFileSystem.js.map +0 -1
  110. package/lib/analyze/AutoBeAnalyzeReviewer.js.map +0 -1
  111. package/lib/orchestrate/orchestrateAnalyze.d.ts +0 -6
  112. package/lib/orchestrate/orchestrateAnalyze.js.map +0 -1
  113. package/lib/orchestrate/orchestrateTest.js +0 -19
  114. package/lib/orchestrate/orchestrateTest.js.map +0 -1
  115. package/src/analyze/AnalyzeAgent.ts +0 -183
  116. package/src/orchestrate/orchestrateTest.ts +0 -18
  117. /package/lib/{analyze → orchestrate/analyze}/AutoBeAnalyzeFileSystem.d.ts +0 -0
  118. /package/lib/{analyze → orchestrate/analyze}/AutoBeAnalyzeFileSystem.js +0 -0
  119. /package/src/{analyze → orchestrate/analyze}/AutoBeAnalyzeFileSystem.ts +0 -0
@@ -0,0 +1,184 @@
1
+ import { IAgenticaHistoryJson } from "@agentica/core";
2
+ import { AutoBeOpenApi } from "@autobe/interface";
3
+ import { v4 } from "uuid";
4
+
5
+ import { AutoBeSystemPromptConstant } from "../../constants/AutoBeSystemPromptConstant";
6
+ import { AutoBeState } from "../../context/AutoBeState";
7
+
8
+ export const transformTestScenarioHistories = (
9
+ state: AutoBeState,
10
+ endponits: AutoBeOpenApi.IEndpoint[],
11
+ files: Record<string, string>,
12
+ ): Array<
13
+ IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
14
+ > => {
15
+ if (state.analyze === null)
16
+ return [
17
+ {
18
+ id: v4(),
19
+ created_at: new Date().toISOString(),
20
+ type: "systemMessage",
21
+ text: [
22
+ "Requirement analysis is not yet completed.",
23
+ "Don't call the any tool function,",
24
+ "but say to process the requirement analysis.",
25
+ ].join(" "),
26
+ },
27
+ ];
28
+ else if (state.prisma === null)
29
+ return [
30
+ {
31
+ id: v4(),
32
+ created_at: new Date().toISOString(),
33
+ type: "systemMessage",
34
+ text: [
35
+ "Prisma DB schema generation is not yet completed.",
36
+ "Don't call the any tool function,",
37
+ "but say to process the Prisma DB schema generation.",
38
+ ].join(" "),
39
+ },
40
+ ];
41
+ else if (state.analyze.step !== state.prisma.step)
42
+ return [
43
+ {
44
+ id: v4(),
45
+ created_at: new Date().toISOString(),
46
+ type: "systemMessage",
47
+ text: [
48
+ "Prisma DB schema generation has not been updated",
49
+ "for the latest requirement analysis.",
50
+ "Don't call the any tool function,",
51
+ "but say to re-process the Prisma DB schema generation.",
52
+ ].join(" "),
53
+ },
54
+ ];
55
+ else if (state.prisma.compiled.type !== "success")
56
+ return [
57
+ {
58
+ id: v4(),
59
+ created_at: new Date().toISOString(),
60
+ type: "systemMessage",
61
+ text: [
62
+ "Prisma DB schema generation has not been updated",
63
+ "for the latest requirement analysis.",
64
+ "Don't call the any tool function,",
65
+ "but say to re-process the Prisma DB schema generation.",
66
+ ].join(" "),
67
+ },
68
+ ];
69
+ else if (state.interface === null)
70
+ return [
71
+ {
72
+ id: v4(),
73
+ created_at: new Date().toISOString(),
74
+ type: "systemMessage",
75
+ text: [
76
+ "Interface generation is not yet completed.",
77
+ "Don't call the any tool function,",
78
+ "but say to process the interface generation.",
79
+ ].join(" "),
80
+ },
81
+ ];
82
+
83
+ return [
84
+ {
85
+ id: v4(),
86
+ created_at: new Date().toISOString(),
87
+ type: "systemMessage",
88
+ text: AutoBeSystemPromptConstant.TEST,
89
+ },
90
+ {
91
+ id: v4(),
92
+ created_at: new Date().toISOString(),
93
+ type: "systemMessage",
94
+ text: [
95
+ "# Result of Analyze Agent",
96
+ "- The following document contains the user requirements that were extracted through conversations with the user by the Analyze Agent.",
97
+ "- The database schema was designed based on these requirements, so you may refer to this document when writing test code or reviewing the schema.",
98
+ "",
99
+ `## User Request`,
100
+ "",
101
+ `- ${state.analyze.reason}`,
102
+ "",
103
+ `## Requirement Analysis Report`,
104
+ "",
105
+ "```json",
106
+ JSON.stringify(state.analyze.files),
107
+ "```",
108
+ ].join("\n"),
109
+ },
110
+ {
111
+ id: v4(),
112
+ created_at: new Date().toISOString(),
113
+ type: "systemMessage",
114
+ text: [
115
+ "# Result of Prisma Agent",
116
+ "- Given the following database schema and entity-relationship diagram, write appropriate test code to validate the constraints and relationships defined in the schema. For example, if there is a unique column, include a test that ensures its uniqueness.",
117
+ "- The test code should strictly adhere to the schema and relationships—no violations of constraints should occur.",
118
+ "- Use the information from the schema and diagram to design meaningful and accurate test cases.",
119
+ "",
120
+ "## Prisma DB Schema",
121
+ "```json",
122
+ JSON.stringify(state.prisma.schemas),
123
+ "```",
124
+ "",
125
+ "## Entity Relationship Diagrams",
126
+ "```json",
127
+ JSON.stringify(state.prisma.compiled.diagrams),
128
+ "```",
129
+ ].join("\n"),
130
+ },
131
+ {
132
+ id: v4(),
133
+ created_at: new Date().toISOString(),
134
+ type: "systemMessage",
135
+ text: [
136
+ "# Result of Interfaced Agent",
137
+ "- OpenAPI document generation is ready.",
138
+ "",
139
+ "Call the provided tool function to generate the user scenarios",
140
+ "referencing below OpenAPI document.",
141
+ "",
142
+ `## OpenAPI Document`,
143
+ "```json",
144
+ JSON.stringify(state.interface.document),
145
+ "```",
146
+ ].join("\n"),
147
+ },
148
+ {
149
+ id: v4(),
150
+ created_at: new Date().toISOString(),
151
+ type: "systemMessage",
152
+ text: AutoBeSystemPromptConstant.TEST,
153
+ },
154
+ {
155
+ id: v4(),
156
+ created_at: new Date().toISOString(),
157
+ type: "systemMessage",
158
+ text: [
159
+ `This is a description of different APIs.`,
160
+ `Different APIs may have to be called to create one.`,
161
+ `Check which functions have been developed.`,
162
+ "```json",
163
+ JSON.stringify(endponits, null, 2),
164
+ "```",
165
+ ].join("\n"),
166
+ },
167
+ {
168
+ id: v4(),
169
+ created_at: new Date().toISOString(),
170
+ type: "systemMessage",
171
+ text: [
172
+ "Below is basically the generated test code,",
173
+ "which is a test to verify that the API is simply called and successful.",
174
+ "Since there is already an automatically generated API,",
175
+ "when a user requests to create a test scenario, two or more APIs must be combined,",
176
+ "but a test in which the currently given endpoint is the main must be created.",
177
+ '"Input Test Files" should be selected from the list of files here.',
178
+ "```json",
179
+ JSON.stringify(files, null, 2),
180
+ "```",
181
+ ].join("\n"),
182
+ },
183
+ ];
184
+ };
@@ -1,3 +1,49 @@
1
- import { IAgenticaVendor } from "@agentica/core";
1
+ import OpenAI from "openai";
2
2
 
3
- export type IAutoBeVendor = IAgenticaVendor;
3
+ /**
4
+ * LLM service vendor for Agentica Chat.
5
+ *
6
+ * `IAgenticaVendor` is a type represents an LLM (Large Language Model) vendor
7
+ * of the {@link AutoBeAgent}.
8
+ *
9
+ * Currently, {@link AutoBeAgent} supports OpenAI SDK. However, it does not mean
10
+ * that you can use only OpenAI's GPT model in the {@link AutoBeAgent}. The
11
+ * OpenAI SDK is just a connection tool to the LLM vendor's API, and you can use
12
+ * other LLM vendors by configuring its `baseURL` and API key.
13
+ *
14
+ * Therefore, if you want to use another LLM vendor like Claude or Gemini,
15
+ * please configure the `baseURL` to the {@link api}, and set
16
+ * {@link IAutoBeProps.model schema model} as "cluade" or "gemini".
17
+ *
18
+ * @author Samchon
19
+ */
20
+ export interface IAutoBeVendor {
21
+ /** OpenAI API instance. */
22
+ api: OpenAI;
23
+
24
+ /**
25
+ * Chat model to be used.
26
+ *
27
+ * `({}) & string` means to support third party hosting cloud(eg. openRouter,
28
+ * aws)
29
+ */
30
+ model: OpenAI.ChatModel | ({} & string);
31
+
32
+ /** Options for the request. */
33
+ options?: OpenAI.RequestOptions | undefined;
34
+
35
+ /**
36
+ * Number of concurrent requests allowed.
37
+ *
38
+ * If you configure this property, {@link AutoBeAgent} will constrain the
39
+ * number of concurrent requests to the LLM vendor. If you want to share the
40
+ * semaphore instance with other agents, you can directly assign the
41
+ * {@link Semaphore} instance to this property.
42
+ *
43
+ * Otherwise, it will not limit the number of concurrent requests, and the
44
+ * {@link AutoBeAgent} will send requests asynchronously without any limit.
45
+ *
46
+ * @default 16
47
+ */
48
+ semaphore?: number | undefined;
49
+ }
@@ -1,24 +0,0 @@
1
- import { ILlmSchema } from "@samchon/openapi";
2
- import { IPointer } from "tstl";
3
- import { AutoBeContext } from "../context/AutoBeContext";
4
- import { AutoBeAnalyzeReviewer } from "./AutoBeAnalyzeReviewer";
5
- type Filename = string;
6
- type FileContent = string;
7
- export declare class AnalyzeAgent<Model extends ILlmSchema.Model> {
8
- private readonly createReviewerAgentFn;
9
- private readonly ctx;
10
- private readonly pointer;
11
- private readonly createInnerAgent;
12
- private readonly fileMap;
13
- constructor(createReviewerAgentFn: typeof AutoBeAnalyzeReviewer, ctx: AutoBeContext<Model>, pointer: IPointer<{
14
- files: Record<Filename, FileContent>;
15
- } | null>);
16
- /**
17
- * Conversate with planner agent
18
- *
19
- * @param content Conversation from user in this time.
20
- * @returns
21
- */
22
- conversate(content: string): Promise<string>;
23
- }
24
- export {};