@autobe/agent 0.10.6 → 0.11.1

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 (147) 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 +1652 -1402
  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/orchestrate/test/orchestrateTestWrite.js +22 -13
  95. package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  96. package/lib/structures/IAutoBeProps.d.ts +8 -8
  97. package/lib/utils/pipe.d.ts +5 -0
  98. package/lib/utils/pipe.js +14 -0
  99. package/lib/utils/pipe.js.map +1 -0
  100. package/package.json +6 -6
  101. package/src/AutoBeAgent.ts +22 -76
  102. package/src/constants/AutoBeSystemPromptConstant.ts +11 -6
  103. package/src/context/AutoBeContext.ts +3 -1
  104. package/src/factory/getAutoBeGenerated.ts +113 -0
  105. package/src/orchestrate/analyze/AutoBeAnalyzeFileSystem.ts +5 -13
  106. package/src/orchestrate/analyze/AutoBeAnalyzeRole.ts +14 -0
  107. package/src/orchestrate/analyze/orchestrateAnalyze.ts +30 -165
  108. package/src/orchestrate/analyze/orchestrateAnalyzeComposer.ts +115 -0
  109. package/src/orchestrate/analyze/orchestrateAnalyzeReviewer.ts +39 -0
  110. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +106 -0
  111. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeComposerApplication.ts +74 -0
  112. package/src/orchestrate/analyze/transformAnalyzeReviewerHistories.ts +31 -0
  113. package/src/orchestrate/analyze/transformAnalyzeWriteHistories.ts +94 -0
  114. package/src/orchestrate/analyze/writeDocumentUntilReviewPassed.ts +66 -0
  115. package/src/orchestrate/interface/orchestrateInterface.ts +0 -2
  116. package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +2 -3
  117. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +21 -0
  118. package/src/orchestrate/prisma/orchestratePrisma.ts +12 -5
  119. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +4 -13
  120. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +9 -4
  121. package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +265 -0
  122. package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +26 -37
  123. package/src/orchestrate/realize/RealizePipe.ts +39 -0
  124. package/src/orchestrate/realize/orchestrateRealize.ts +3 -91
  125. package/src/orchestrate/realize/orchestrateRealizeCoder.ts +60 -25
  126. package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +192 -18
  127. package/src/orchestrate/realize/structures/IAutoBeRealizeCompile.ts +34 -0
  128. package/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.ts +2 -0
  129. package/src/orchestrate/realize/transformRealizeCoderHistories.ts +58 -34
  130. package/src/orchestrate/realize/writeCodeUntilCompilePassed.ts +178 -0
  131. package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +5 -4
  132. package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +7 -2
  133. package/src/orchestrate/test/orchestrateTest.ts +14 -12
  134. package/src/orchestrate/test/orchestrateTestCorrect.ts +10 -9
  135. package/src/orchestrate/test/orchestrateTestWrite.ts +33 -27
  136. package/src/structures/IAutoBeProps.ts +10 -7
  137. package/src/utils/pipe.ts +39 -0
  138. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.d.ts +0 -20
  139. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js +0 -735
  140. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js.map +0 -1
  141. package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.d.ts +0 -15
  142. package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js +0 -44
  143. package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js.map +0 -1
  144. package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +0 -1
  145. package/src/orchestrate/analyze/AutoBeAnalyzeAgent.ts +0 -219
  146. package/src/orchestrate/analyze/AutoBeAnalyzeReviewer.ts +0 -62
  147. package/src/orchestrate/prisma/orchestratePrismaSchema.ts +0 -157
@@ -1,6 +1,7 @@
1
1
  import { IAgenticaController, MicroAgentica } from "@agentica/core";
2
2
  import {
3
3
  AutoBeTestValidateEvent,
4
+ IAutoBeCompiler,
4
5
  IAutoBeTypeScriptCompileResult,
5
6
  } from "@autobe/interface";
6
7
  import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
@@ -51,14 +52,14 @@ const compile = async <Model extends ILlmSchema.Model>(
51
52
  ctx: AutoBeContext<Model>,
52
53
  func: IAutoBeTestFunction,
53
54
  ): Promise<AutoBeTestValidateEvent> => {
54
- const compiled: IAutoBeTypeScriptCompileResult =
55
- await ctx.compiler.test.compile({
56
- files: {
57
- ...func.artifacts.dto,
58
- ...func.artifacts.sdk,
59
- [func.location]: func.script,
60
- },
61
- });
55
+ const compiler: IAutoBeCompiler = await ctx.compiler();
56
+ const result: IAutoBeTypeScriptCompileResult = await compiler.test.compile({
57
+ files: {
58
+ ...func.artifacts.dto,
59
+ ...func.artifacts.sdk,
60
+ [func.location]: func.script,
61
+ },
62
+ });
62
63
  return {
63
64
  type: "testValidate",
64
65
  file: {
@@ -66,7 +67,7 @@ const compile = async <Model extends ILlmSchema.Model>(
66
67
  location: func.location,
67
68
  content: func.script,
68
69
  },
69
- result: compiled,
70
+ result,
70
71
  created_at: new Date().toISOString(),
71
72
  step: ctx.state().analyze?.step ?? 0,
72
73
  };
@@ -22,39 +22,45 @@ export async function orchestrateTestWrite<Model extends ILlmSchema.Model>(
22
22
  const start: Date = new Date();
23
23
  let complete: number = 0;
24
24
 
25
- return Promise.all(
25
+ const result = await Promise.all(
26
26
  /**
27
27
  * Generate test code for each scenario. Maps through plans array to create
28
28
  * individual test code implementations. Each scenario is processed to
29
29
  * generate corresponding test code and progress events.
30
30
  */
31
- scenarios.map((scenario) =>
32
- forceRetry(async () => {
33
- const artifacts: IAutoBeTestScenarioArtifacts =
34
- await getTestScenarioArtifacts(ctx, scenario);
35
- const result: IAutoBeTestWriteApplication.IProps = await process(
36
- ctx,
37
- scenario,
38
- artifacts,
39
- );
40
- const event: AutoBeTestWriteEvent = {
41
- type: "testWrite",
42
- created_at: start.toISOString(),
43
- location: `test/features/api/${result.domain}/${scenario.functionName}.ts`,
44
- ...result,
45
- completed: ++complete,
46
- total: scenarios.length,
47
- step: ctx.state().interface?.step ?? 0,
48
- };
49
- ctx.dispatch(event);
50
- return {
51
- scenario,
52
- artifacts,
53
- event,
54
- };
55
- }),
56
- ),
31
+ scenarios.map(async (scenario) => {
32
+ try {
33
+ const r = await forceRetry(async () => {
34
+ const artifacts: IAutoBeTestScenarioArtifacts =
35
+ await getTestScenarioArtifacts(ctx, scenario);
36
+ const result: IAutoBeTestWriteApplication.IProps = await process(
37
+ ctx,
38
+ scenario,
39
+ artifacts,
40
+ );
41
+ const event: AutoBeTestWriteEvent = {
42
+ type: "testWrite",
43
+ created_at: start.toISOString(),
44
+ location: `test/features/api/${result.domain}/${scenario.functionName}.ts`,
45
+ ...result,
46
+ completed: ++complete,
47
+ total: scenarios.length,
48
+ step: ctx.state().interface?.step ?? 0,
49
+ };
50
+ ctx.dispatch(event);
51
+ return {
52
+ scenario,
53
+ artifacts,
54
+ event,
55
+ };
56
+ });
57
+ return r;
58
+ } catch {
59
+ return null;
60
+ }
61
+ }),
57
62
  );
63
+ return result.filter((r) => r !== null);
58
64
  }
59
65
 
60
66
  /**
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  AutoBeHistory,
3
3
  IAutoBeCompiler,
4
+ IAutoBeCompilerListener,
4
5
  IAutoBeTokenUsageJson,
5
6
  } from "@autobe/interface";
6
7
  import { ILlmSchema } from "@samchon/openapi";
@@ -64,19 +65,21 @@ export interface IAutoBeProps<Model extends ILlmSchema.Model> {
64
65
  vendor: IAutoBeVendor;
65
66
 
66
67
  /**
67
- * Compilation infrastructure for TypeScript, Prisma, and OpenAPI operations.
68
+ * Compiler factory function for TypeScript, Prisma, and OpenAPI operations.
68
69
  *
69
- * Provides the essential compilation tools required for the sophisticated
70
- * AST-based development pipeline. The compiler handles validation,
71
- * transformation, and code generation across all development phases including
72
- * Prisma schema compilation, OpenAPI document validation, and TypeScript code
73
- * compilation.
70
+ * Factory function that creates compiler instances required for the
71
+ * sophisticated AST-based development pipeline. The compiler handles
72
+ * validation, transformation, and code generation across all development
73
+ * phases including Prisma schema compilation, OpenAPI document validation,
74
+ * and TypeScript code compilation.
74
75
  *
75
76
  * For high-performance scenarios with multiple concurrent users, the compiler
76
77
  * can be separated into dedicated worker processes to prevent blocking the
77
78
  * main agent during computationally intensive compilation operations.
78
79
  */
79
- compiler: IAutoBeCompiler;
80
+ compiler: (
81
+ listener: IAutoBeCompilerListener,
82
+ ) => IAutoBeCompiler | Promise<IAutoBeCompiler>;
80
83
 
81
84
  /**
82
85
  * Optional conversation and development histories for session continuation.
@@ -0,0 +1,39 @@
1
+ import { FAILED } from "../orchestrate/realize/structures/IAutoBeRealizeFailedSymbol";
2
+
3
+ export function pipe<A, B>(
4
+ a: A,
5
+ ab: (a: A) => Promise<B | FAILED>,
6
+ ): Promise<B | FAILED>;
7
+
8
+ export function pipe<A, B, C>(
9
+ a: A,
10
+ ab: (a: A) => Promise<B | FAILED>,
11
+ bc: (b: B) => Promise<C | FAILED>,
12
+ ): Promise<C | FAILED>;
13
+
14
+ export function pipe<A, B, C, D>(
15
+ a: A,
16
+ ab: (a: A) => Promise<B | FAILED>,
17
+ bc: (b: B) => Promise<C | FAILED>,
18
+ cd: (c: C) => Promise<D | FAILED>,
19
+ ): Promise<D | FAILED>;
20
+
21
+ export function pipe<A, B, C, D, E>(
22
+ a: A,
23
+ ab: (a: A) => Promise<B | FAILED>,
24
+ bc: (b: B) => Promise<C | FAILED>,
25
+ cd: (c: C) => Promise<D | FAILED>,
26
+ de: (d: D) => Promise<E | FAILED>,
27
+ ): Promise<E | FAILED>;
28
+
29
+ export function pipe(
30
+ a: any,
31
+ ...fns: Array<(arg: any) => Promise<any>>
32
+ ): Promise<any> {
33
+ return fns.reduce((prev, fn) => {
34
+ return prev.then((result) => {
35
+ if (result === FAILED) return FAILED;
36
+ return fn(result);
37
+ });
38
+ }, Promise.resolve(a));
39
+ }
@@ -1,20 +0,0 @@
1
- import { ILlmSchema } from "@samchon/openapi";
2
- import { AutoBeContext } from "../../context/AutoBeContext";
3
- import { AutoBeAnalyzePointer } from "./AutoBeAnalyzePointer";
4
- import { AutoBeAnalyzeReviewer } from "./AutoBeAnalyzeReviewer";
5
- export declare class AutoBeAnalyzeAgent<Model extends ILlmSchema.Model> {
6
- private readonly createReviewerAgentFn;
7
- private readonly ctx;
8
- private readonly pointer;
9
- private readonly filenames;
10
- private readonly createAnalyzeAgent;
11
- private readonly fileMap;
12
- constructor(createReviewerAgentFn: typeof AutoBeAnalyzeReviewer, ctx: AutoBeContext<Model>, pointer: AutoBeAnalyzePointer, filenames: string[]);
13
- /**
14
- * Conversate with planner agent
15
- *
16
- * @param content Conversation from user in this time.
17
- * @returns
18
- */
19
- conversate(content: string, retry?: number): Promise<string>;
20
- }