@autobe/agent 0.10.5 → 0.11.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 (144) hide show
  1. package/lib/AutoBeAgent.js +13 -46
  2. package/lib/AutoBeAgent.js.map +1 -1
  3. package/lib/constants/AutoBeSystemPromptConstant.d.ts +11 -6
  4. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  5. package/lib/context/AutoBeContext.d.ts +3 -2
  6. package/lib/factory/getAutoBeGenerated.d.ts +5 -0
  7. package/lib/factory/getAutoBeGenerated.js +307 -0
  8. package/lib/factory/getAutoBeGenerated.js.map +1 -0
  9. package/lib/index.mjs +1631 -1389
  10. package/lib/index.mjs.map +1 -1
  11. package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.d.ts +2 -7
  12. package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.js +1 -9
  13. package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.js.map +1 -1
  14. package/lib/orchestrate/analyze/AutoBeAnalyzeRole.d.ts +13 -0
  15. package/lib/orchestrate/analyze/AutoBeAnalyzeRole.js +3 -0
  16. package/lib/orchestrate/analyze/AutoBeAnalyzeRole.js.map +1 -0
  17. package/lib/orchestrate/analyze/orchestrateAnalyze.d.ts +0 -25
  18. package/lib/orchestrate/analyze/orchestrateAnalyze.js +22 -420
  19. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  20. package/lib/orchestrate/analyze/orchestrateAnalyzeComposer.d.ts +6 -0
  21. package/lib/orchestrate/analyze/orchestrateAnalyzeComposer.js +561 -0
  22. package/lib/orchestrate/analyze/orchestrateAnalyzeComposer.js.map +1 -0
  23. package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.d.ts +6 -0
  24. package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js +41 -0
  25. package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js.map +1 -0
  26. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +14 -0
  27. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +468 -0
  28. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -0
  29. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeComposerApplication.d.ts +68 -0
  30. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeComposerApplication.js +3 -0
  31. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeComposerApplication.js.map +1 -0
  32. package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.d.ts +5 -0
  33. package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.js +27 -0
  34. package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.js.map +1 -0
  35. package/lib/orchestrate/analyze/transformAnalyzeWriteHistories.d.ts +12 -0
  36. package/lib/orchestrate/analyze/transformAnalyzeWriteHistories.js +78 -0
  37. package/lib/orchestrate/analyze/transformAnalyzeWriteHistories.js.map +1 -0
  38. package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.d.ts +6 -0
  39. package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.js +58 -0
  40. package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.js.map +1 -0
  41. package/lib/orchestrate/interface/orchestrateInterface.js +0 -2
  42. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
  43. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +17 -137
  44. package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
  45. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +92 -141
  46. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  47. package/lib/orchestrate/prisma/orchestratePrisma.js +9 -5
  48. package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  49. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +54 -25
  50. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  51. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +4 -3
  52. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  53. package/lib/orchestrate/prisma/{orchestratePrismaSchema.d.ts → orchestratePrismaSchemas.d.ts} +2 -4
  54. package/lib/orchestrate/prisma/{orchestratePrismaSchema.js → orchestratePrismaSchemas.js} +269 -203
  55. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -0
  56. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +1 -1
  57. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
  58. package/lib/orchestrate/prisma/transformPrismaCorrectHistories.js +1 -1
  59. package/lib/orchestrate/prisma/transformPrismaHistories.js +1 -1
  60. package/lib/orchestrate/prisma/transformPrismaHistories.js.map +1 -1
  61. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.d.ts +2 -6
  62. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +24 -32
  63. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
  64. package/lib/orchestrate/realize/RealizePipe.d.ts +5 -0
  65. package/lib/orchestrate/realize/RealizePipe.js +14 -0
  66. package/lib/orchestrate/realize/RealizePipe.js.map +1 -0
  67. package/lib/orchestrate/realize/orchestrateRealize.d.ts +0 -6
  68. package/lib/orchestrate/realize/orchestrateRealize.js +6 -43
  69. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
  70. package/lib/orchestrate/realize/orchestrateRealizeCoder.d.ts +3 -3
  71. package/lib/orchestrate/realize/orchestrateRealizeCoder.js +124 -59
  72. package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -1
  73. package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +188 -18
  74. package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.d.ts +23 -0
  75. package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.js +3 -0
  76. package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.js.map +1 -0
  77. package/lib/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.d.ts +2 -0
  78. package/lib/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.js +5 -0
  79. package/lib/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.js.map +1 -0
  80. package/lib/orchestrate/realize/transformRealizeCoderHistories.d.ts +2 -1
  81. package/lib/orchestrate/realize/transformRealizeCoderHistories.js +50 -36
  82. package/lib/orchestrate/realize/transformRealizeCoderHistories.js.map +1 -1
  83. package/lib/orchestrate/realize/writeCodeUntilCompilePassed.d.ts +5 -0
  84. package/lib/orchestrate/realize/writeCodeUntilCompilePassed.js +123 -0
  85. package/lib/orchestrate/realize/writeCodeUntilCompilePassed.js.map +1 -0
  86. package/lib/orchestrate/test/compile/getTestExternalDeclarations.js +4 -1
  87. package/lib/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
  88. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js +2 -1
  89. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
  90. package/lib/orchestrate/test/orchestrateTest.js +11 -5
  91. package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
  92. package/lib/orchestrate/test/orchestrateTestCorrect.js +3 -2
  93. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  94. package/lib/structures/IAutoBeProps.d.ts +8 -8
  95. package/lib/utils/pipe.d.ts +5 -0
  96. package/lib/utils/pipe.js +14 -0
  97. package/lib/utils/pipe.js.map +1 -0
  98. package/package.json +6 -6
  99. package/src/AutoBeAgent.ts +22 -76
  100. package/src/constants/AutoBeSystemPromptConstant.ts +11 -6
  101. package/src/context/AutoBeContext.ts +3 -1
  102. package/src/factory/getAutoBeGenerated.ts +113 -0
  103. package/src/orchestrate/analyze/AutoBeAnalyzeFileSystem.ts +5 -13
  104. package/src/orchestrate/analyze/AutoBeAnalyzeRole.ts +14 -0
  105. package/src/orchestrate/analyze/orchestrateAnalyze.ts +30 -165
  106. package/src/orchestrate/analyze/orchestrateAnalyzeComposer.ts +115 -0
  107. package/src/orchestrate/analyze/orchestrateAnalyzeReviewer.ts +39 -0
  108. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +106 -0
  109. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeComposerApplication.ts +74 -0
  110. package/src/orchestrate/analyze/transformAnalyzeReviewerHistories.ts +31 -0
  111. package/src/orchestrate/analyze/transformAnalyzeWriteHistories.ts +94 -0
  112. package/src/orchestrate/analyze/writeDocumentUntilReviewPassed.ts +66 -0
  113. package/src/orchestrate/interface/orchestrateInterface.ts +0 -2
  114. package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +2 -3
  115. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +21 -0
  116. package/src/orchestrate/prisma/orchestratePrisma.ts +12 -5
  117. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +4 -13
  118. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +9 -4
  119. package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +265 -0
  120. package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +26 -37
  121. package/src/orchestrate/realize/RealizePipe.ts +39 -0
  122. package/src/orchestrate/realize/orchestrateRealize.ts +3 -91
  123. package/src/orchestrate/realize/orchestrateRealizeCoder.ts +60 -25
  124. package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +192 -18
  125. package/src/orchestrate/realize/structures/IAutoBeRealizeCompile.ts +34 -0
  126. package/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.ts +2 -0
  127. package/src/orchestrate/realize/transformRealizeCoderHistories.ts +58 -34
  128. package/src/orchestrate/realize/writeCodeUntilCompilePassed.ts +178 -0
  129. package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +5 -4
  130. package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +7 -2
  131. package/src/orchestrate/test/orchestrateTest.ts +14 -12
  132. package/src/orchestrate/test/orchestrateTestCorrect.ts +10 -9
  133. package/src/structures/IAutoBeProps.ts +10 -7
  134. package/src/utils/pipe.ts +39 -0
  135. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.d.ts +0 -20
  136. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js +0 -735
  137. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js.map +0 -1
  138. package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.d.ts +0 -15
  139. package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js +0 -44
  140. package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js.map +0 -1
  141. package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +0 -1
  142. package/src/orchestrate/analyze/AutoBeAnalyzeAgent.ts +0 -219
  143. package/src/orchestrate/analyze/AutoBeAnalyzeReviewer.ts +0 -62
  144. package/src/orchestrate/prisma/orchestratePrismaSchema.ts +0 -157
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobe/agent",
3
- "version": "0.10.5",
3
+ "version": "0.11.0",
4
4
  "description": "AI backend server code generator",
5
5
  "main": "lib/index.js",
6
6
  "author": "Wrtn Technologies",
@@ -20,15 +20,15 @@
20
20
  "README.md"
21
21
  ],
22
22
  "dependencies": {
23
- "@agentica/core": "^0.30.3",
23
+ "@agentica/core": "^0.30.4",
24
24
  "@prisma/internals": "^6.7.0",
25
25
  "@samchon/openapi": "^4.5.0",
26
26
  "openai": "^5.2.0",
27
27
  "tstl": "^3.0.0",
28
28
  "typia": "^9.5.0",
29
29
  "uuid": "^11.1.0",
30
- "@autobe/interface": "^0.10.5",
31
- "@autobe/utils": "^0.10.5"
30
+ "@autobe/interface": "^0.11.0",
31
+ "@autobe/utils": "^0.11.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@rollup/plugin-json": "^6.1.0",
@@ -40,8 +40,8 @@
40
40
  "ts-node": "^10.9.2",
41
41
  "ts-patch": "^3.3.0",
42
42
  "typescript": "~5.8.3",
43
- "@autobe/compiler": "^0.10.5",
44
- "@autobe/filesystem": "^0.10.5"
43
+ "@autobe/compiler": "^0.11.0",
44
+ "@autobe/filesystem": "^0.11.0"
45
45
  },
46
46
  "keywords": [
47
47
  "ai",
@@ -5,10 +5,11 @@ import {
5
5
  AutoBeHistory,
6
6
  AutoBeUserMessageContent,
7
7
  AutoBeUserMessageHistory,
8
+ IAutoBeCompilerListener,
8
9
  IAutoBeGetFilesOptions,
9
10
  } from "@autobe/interface";
10
11
  import { ILlmSchema } from "@samchon/openapi";
11
- import { Semaphore } from "tstl";
12
+ import { Semaphore, Singleton } from "tstl";
12
13
  import { v4 } from "uuid";
13
14
 
14
15
  import { AutoBeContext } from "./context/AutoBeContext";
@@ -17,6 +18,7 @@ import { AutoBeTokenUsage } from "./context/AutoBeTokenUsage";
17
18
  import { createAgenticaHistory } from "./factory/createAgenticaHistory";
18
19
  import { createAutoBeController } from "./factory/createAutoBeApplication";
19
20
  import { createAutoBeState } from "./factory/createAutoBeState";
21
+ import { getAutoBeGenerated } from "./factory/getAutoBeGenerated";
20
22
  import { transformFacadeStateMessage } from "./orchestrate/facade/transformFacadeStateMessage";
21
23
  import { IAutoBeProps } from "./structures/IAutoBeProps";
22
24
  import { randomBackoffStrategy } from "./utils/backoffRetry";
@@ -108,6 +110,17 @@ export class AutoBeAgent<Model extends ILlmSchema.Model> {
108
110
  ...props.vendor,
109
111
  semaphore: new Semaphore(props.vendor.semaphore ?? 16),
110
112
  };
113
+ const compilerListener: IAutoBeCompilerListener = {
114
+ realize: {
115
+ test: {
116
+ onOperation: async () => {},
117
+ onReset: async () => {},
118
+ },
119
+ },
120
+ };
121
+ const compiler = new Singleton(async () =>
122
+ props.compiler(compilerListener),
123
+ );
111
124
  this.context_ = {
112
125
  vendor,
113
126
  model: props.model,
@@ -115,7 +128,8 @@ export class AutoBeAgent<Model extends ILlmSchema.Model> {
115
128
  backoffStrategy: randomBackoffStrategy,
116
129
  ...props.config,
117
130
  },
118
- compiler: props.compiler,
131
+ compiler: () => compiler.get(),
132
+ compilerListener,
119
133
  histories: () => this.histories_,
120
134
  state: () => this.state_,
121
135
  usage: () => this.getTokenUsage(),
@@ -123,7 +137,7 @@ export class AutoBeAgent<Model extends ILlmSchema.Model> {
123
137
  dispatch: (event) => {
124
138
  this.dispatch(event).catch(() => {});
125
139
  },
126
- };
140
+ } satisfies AutoBeContext<Model>;
127
141
  this.agentica_ = new MicroAgentica({
128
142
  vendor,
129
143
  model: props.model,
@@ -287,79 +301,11 @@ export class AutoBeAgent<Model extends ILlmSchema.Model> {
287
301
  public async getFiles(
288
302
  options?: Partial<IAutoBeGetFilesOptions>,
289
303
  ): Promise<Record<string, string>> {
290
- const files: Record<string, string> = {
291
- ...Object.fromEntries(
292
- this.state_.analyze
293
- ? Object.entries(this.state_.analyze.files).map(([key, value]) => [
294
- `docs/analysis/${key.split("/").at(-1)}`,
295
- value,
296
- ])
297
- : [],
298
- ),
299
- ...Object.fromEntries(
300
- !!this.state_.prisma?.result
301
- ? [
302
- ...Object.entries(
303
- (options?.dbms ?? "postgres") === "postgres"
304
- ? this.state_.prisma.schemas
305
- : await this.context_.compiler.prisma.write(
306
- this.state_.prisma.result.data,
307
- options!.dbms!,
308
- ),
309
- ).map(([key, value]) => [
310
- `prisma/schema/${key.split("/").at(-1)}`,
311
- value,
312
- ]),
313
- ...(this.state_.prisma.compiled.type === "success"
314
- ? [["docs/ERD.md", this.state_.prisma.compiled.document]]
315
- : []),
316
- ...(this.state_.prisma.compiled.type === "failure"
317
- ? [
318
- [
319
- "prisma/compile-error-reason.log",
320
- this.state_.prisma.compiled.reason,
321
- ],
322
- ]
323
- : []),
324
- [
325
- "autobe/prisma.json",
326
- JSON.stringify(this.state_.prisma.result.data, null, 2),
327
- ],
328
- ]
329
- : [],
330
- ),
331
- ...(this.state_.interface
332
- ? this.state_.test
333
- ? Object.fromEntries(
334
- Object.entries(this.state_.interface.files).filter(
335
- ([key]) => key.startsWith("test/features/") === false,
336
- ),
337
- )
338
- : this.state_.interface.files
339
- : {}),
340
- ...(this.state_.test
341
- ? Object.fromEntries(
342
- this.state_.test.files.map((f) => [f.location, f.content]),
343
- )
344
- : {}),
345
- ...(this.state_.realize ? this.state_.realize.files : {}),
346
- "autobe/histories.json": JSON.stringify(this.histories_, null, 2),
347
- "autobe/tokenUsage.json": JSON.stringify(this.getTokenUsage(), null, 2),
348
- ...(this.state_.interface
349
- ? {
350
- "autobe/document.json": JSON.stringify(
351
- this.state_.interface.document,
352
- null,
353
- 2,
354
- ),
355
- }
356
- : {}),
357
- };
358
- return Object.fromEntries(
359
- Object.entries(files).map(([k, v]) => [
360
- k.startsWith("/") ? k.substring(1) : k,
361
- v,
362
- ]),
304
+ return getAutoBeGenerated(
305
+ await this.getContext(),
306
+ this.histories_,
307
+ this.usage_,
308
+ options,
363
309
  );
364
310
  }
365
311