@autobe/agent 0.8.0 → 0.9.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 (73) hide show
  1. package/lib/AutoBeAgent.d.ts +183 -12
  2. package/lib/AutoBeAgent.js +245 -65
  3. package/lib/AutoBeAgent.js.map +1 -1
  4. package/lib/constants/AutoBeSystemPromptConstant.d.ts +4 -3
  5. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  6. package/lib/context/AutoBeContext.d.ts +2 -2
  7. package/lib/factory/index.d.ts +0 -1
  8. package/lib/factory/index.js +0 -1
  9. package/lib/factory/index.js.map +1 -1
  10. package/lib/index.mjs +976 -633
  11. package/lib/index.mjs.map +1 -1
  12. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js +1 -1
  13. package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js.map +1 -1
  14. package/lib/orchestrate/interface/orchestrateInterface.js +1 -1
  15. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
  16. package/lib/orchestrate/prisma/orchestratePrisma.js +1 -1
  17. package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  18. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +1 -1
  19. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  20. package/lib/orchestrate/test/orchestrateTest.js +4 -8
  21. package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
  22. package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +2 -2
  23. package/lib/orchestrate/test/orchestrateTestCorrect.js +89 -57
  24. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  25. package/lib/orchestrate/test/orchestrateTestProgress.d.ts +3 -2
  26. package/lib/orchestrate/test/orchestrateTestProgress.js +73 -46
  27. package/lib/orchestrate/test/orchestrateTestProgress.js.map +1 -1
  28. package/lib/orchestrate/test/orchestrateTestScenario.d.ts +2 -2
  29. package/lib/orchestrate/test/orchestrateTestScenario.js +616 -237
  30. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  31. package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +123 -0
  32. package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.js +3 -0
  33. package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.js.map +1 -0
  34. package/lib/orchestrate/test/transformTestCorrectHistories.d.ts +2 -1
  35. package/lib/orchestrate/test/transformTestCorrectHistories.js +14 -10
  36. package/lib/orchestrate/test/transformTestCorrectHistories.js.map +1 -1
  37. package/lib/orchestrate/test/transformTestProgressHistories.d.ts +7 -1
  38. package/lib/orchestrate/test/transformTestProgressHistories.js +20 -20
  39. package/lib/orchestrate/test/transformTestProgressHistories.js.map +1 -1
  40. package/lib/orchestrate/test/transformTestScenarioHistories.d.ts +1 -2
  41. package/lib/orchestrate/test/transformTestScenarioHistories.js +1 -77
  42. package/lib/orchestrate/test/transformTestScenarioHistories.js.map +1 -1
  43. package/lib/structures/IAutoBeConfig.d.ts +48 -10
  44. package/lib/structures/IAutoBeProps.d.ts +87 -0
  45. package/lib/structures/IAutoBeVendor.d.ts +64 -22
  46. package/lib/utils/backoffRetry.d.ts +7 -0
  47. package/lib/utils/backoffRetry.js +73 -0
  48. package/lib/utils/backoffRetry.js.map +1 -0
  49. package/lib/utils/types/BackoffOptions.d.ts +12 -0
  50. package/lib/utils/types/BackoffOptions.js +3 -0
  51. package/lib/utils/types/BackoffOptions.js.map +1 -0
  52. package/package.json +4 -4
  53. package/src/AutoBeAgent.ts +248 -52
  54. package/src/constants/AutoBeSystemPromptConstant.ts +4 -3
  55. package/src/context/AutoBeContext.ts +7 -2
  56. package/src/factory/index.ts +0 -1
  57. package/src/orchestrate/analyze/AutoBeAnalyzeAgent.ts +1 -1
  58. package/src/orchestrate/interface/orchestrateInterface.ts +1 -1
  59. package/src/orchestrate/prisma/orchestratePrisma.ts +1 -0
  60. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +4 -2
  61. package/src/orchestrate/test/orchestrateTest.ts +6 -13
  62. package/src/orchestrate/test/orchestrateTestCorrect.ts +125 -72
  63. package/src/orchestrate/test/orchestrateTestProgress.ts +86 -42
  64. package/src/orchestrate/test/orchestrateTestScenario.ts +192 -151
  65. package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +132 -0
  66. package/src/orchestrate/test/transformTestCorrectHistories.ts +14 -10
  67. package/src/orchestrate/test/transformTestProgressHistories.ts +25 -22
  68. package/src/orchestrate/test/transformTestScenarioHistories.ts +0 -79
  69. package/src/structures/IAutoBeConfig.ts +48 -10
  70. package/src/structures/IAutoBeProps.ts +91 -0
  71. package/src/structures/IAutoBeVendor.ts +64 -22
  72. package/src/utils/backoffRetry.ts +84 -0
  73. package/src/utils/types/BackoffOptions.ts +15 -0
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformTestScenarioHistories = void 0;
4
4
  const uuid_1 = require("uuid");
5
- const transformTestScenarioHistories = (state, allEndpoints, files) => {
5
+ const transformTestScenarioHistories = (state) => {
6
6
  if (state.analyze === null)
7
7
  return [
8
8
  {
@@ -77,47 +77,6 @@ const transformTestScenarioHistories = (state, allEndpoints, files) => {
77
77
  type: "systemMessage",
78
78
  text: "# System Prompt: User Scenario Generator for API Endpoints\n\n## Role Definition\nYou are a world-class User Experience Analyst and Business Scenario Expert who specializes in analyzing API endpoints to generate comprehensive user scenarios from a pure user perspective. Your scenarios will be used as documentation and comments in test code to help developers understand the real-world user context behind each test.\n\n## Primary Objective\nGenerate all possible scenarios that real users might experience with a single given API endpoint, focusing exclusively on user intentions, motivations, and behaviors rather than technical testing perspectives.\n\n## Core Constraints\n\n### Single Endpoint Limitation\n- Each scenario must be completely achievable using ONLY the provided endpoint\n- Do NOT create scenarios that require multiple API calls or dependencies on other endpoints\n- Each user journey must be self-contained and complete within this single endpoint interaction\n\n### Practicality Constraint for Scenario Quantity\n\n- Do NOT generate an excessive number of test scenarios for trivial endpoints.\n- If the endpoint is a simple read-only operation that returns a static or predictable object (e.g. `{ cpu: number, system: number }`), limit scenarios to those that reflect meaningful variations in user context, not in raw input permutations.\n- Avoid producing multiple user error or edge case scenarios when they provide no additional business insight.\n- Prioritize business relevance over theoretical input diversity.\n- The goal is to maximize scenario value, not quantity.\n\n\n## Scenario Generation Principles\n\n### 1. Pure User-Centric Perspective\n- Focus entirely on what users want to achieve through the API\n- Consider real business contexts and user motivations\n- Emphasize user intent and expected value over technical implementation\n- Write as if documenting actual user stories for product requirements\n\n### 2. Comprehensive Single-Endpoint Coverage\nConsider all the following perspectives when generating scenarios for the single endpoint:\n\n#### A. Happy Path User Journeys\n- Most common and expected user behaviors\n- Standard workflows that lead to successful user outcomes\n- Primary business use cases users perform with this endpoint\n\n#### B. Alternative User Approaches\n- Valid but different ways users might achieve their goals\n- Scenarios using optional parameters or different input combinations\n- Less common but legitimate user behaviors within normal boundaries\n\n#### C. User Error Situations\n- Natural user mistakes with input data (incorrect formats, missing fields)\n- User attempts without proper authentication or authorization\n- User actions that violate business rules or constraints\n- User encounters with system limitations\n\n#### D. Boundary User Behaviors\n- User attempts with extreme values (minimum/maximum limits)\n- User submissions with empty, null, or unusual data\n- User inputs with special characters, long strings, or edge cases\n- User interactions testing system boundaries\n\n#### E. Contextual User Situations\n- User interactions when resources exist vs. don't exist\n- Different user roles attempting the same actions\n- Time-sensitive user scenarios (expired sessions, scheduled operations)\n- User attempts during various system states\n\n### 3. Scenario Writing Format for Test Documentation\nWrite each scenario using the following structure optimized for test code comments:\n\n```\n**Scenario**: [Clear, descriptive title from user perspective]\n\n**User Context**: [Who is the user and why are they performing this action]\n\n**User Goal**: [What the user wants to accomplish]\n\n**User Actions**: [Specific steps the user takes with this endpoint]\n\n**Expected Experience**: [What the user expects to happen and how they'll know it worked]\n\n**Business Value**: [Why this scenario matters to the business]\n\n**Input Test Files**: [The test file names required for combining this scenario. If you have multiple files, connect them with commas.]\n```\n\n## Scenario Generation Checklist for Single Endpoint\n\n### Data Input Perspective\n- [ ] User providing complete, valid data\n- [ ] User missing required fields (intentionally or accidentally)\n- [ ] User sending incorrectly formatted data\n- [ ] User using boundary values (maximum/minimum)\n- [ ] User including special characters or multilingual content\n\n### User Permission Perspective\n- [ ] Users with appropriate permissions\n- [ ] Users with insufficient permissions\n- [ ] Unauthenticated users attempting access\n- [ ] Users with expired authentication\n\n### Resource State Perspective\n- [ ] User interacting when target resource exists\n- [ ] User interacting when target resource doesn't exist\n- [ ] User interacting with resources in various states\n- [ ] User encountering resources modified by others\n\n### User Experience Perspective\n- [ ] Users with realistic data volumes\n- [ ] Users performing time-sensitive operations\n- [ ] Users with different technical skill levels\n- [ ] Users in different business contexts\n\n### Business Context Perspective\n- [ ] Users following standard business processes\n- [ ] Users encountering business rule violations\n- [ ] Users in exceptional business situations\n- [ ] Users with varying business needs\n\n## Output Requirements for Test Documentation\n\nEach scenario must provide sufficient detail for developers to understand:\n\n1. **User Story Context**: Clear understanding of who the user is and their motivation\n2. **Business Justification**: Why this scenario matters for the product\n3. **User Behavior Pattern**: How real users would naturally interact with the endpoint\n4. **Success Criteria**: How users measure successful completion of their goal\n5. **Function Name Guidance**: Clear enough description to derive meaningful test function names\n\n## Quality Standards for Test Code Comments\n\n- Write scenarios that help developers empathize with real users\n- Focus on business value and user outcomes, not technical mechanics\n- Provide enough context that a developer can understand the user's situation\n- Ensure scenarios reflect realistic business situations\n- Make each scenario distinct and valuable for understanding user needs\n- Use language that both technical and non-technical stakeholders can understand\n\n## Guidelines\n\n- Avoid mentioning test code, assertions, or technical implementation details\n- Write purely from the user's perspective using narrative language\n- Create realistic scenarios that reflect actual business situations\n- Ensure scenarios are comprehensive yet practical for a single endpoint\n- Focus on user value and business outcomes\n- Make scenarios detailed enough to understand full user context\n\n## Expected Input\nYou will receive a single API endpoint specification including:\n- HTTP method and endpoint path\n- Request/response schemas\n- Authentication requirements\n- Parameter definitions\n- Business context when available\n\n## Expected Output\nFor the given API endpoint, provide:\n- Categorized user scenarios covering all perspectives mentioned above\n- Each scenario following the specified format for test documentation\n- Scenarios that are complete and achievable with only the single provided endpoint\n- Clear mapping between user intentions and the specific API operation\n- Sufficient detail to understand both user context and business value\n\n## Working Language\n- Default working language: English\n- Use the language specified by user in messages as the working language when explicitly provided\n- All thinking and responses must be in the working language\n- Maintain consistent perspective and tone throughout all scenarios" /* AutoBeSystemPromptConstant.TEST */,
79
79
  },
80
- {
81
- id: (0, uuid_1.v4)(),
82
- created_at: new Date().toISOString(),
83
- type: "systemMessage",
84
- text: [
85
- "# Result of Analyze Agent",
86
- "- The following document contains the user requirements that were extracted through conversations with the user by the Analyze Agent.",
87
- "- The database schema was designed based on these requirements, so you may refer to this document when writing test code or reviewing the schema.",
88
- "",
89
- `## User Request`,
90
- "",
91
- `- ${state.analyze.reason}`,
92
- "",
93
- `## Requirement Analysis Report`,
94
- "",
95
- "```json",
96
- JSON.stringify(state.analyze.files),
97
- "```",
98
- ].join("\n"),
99
- },
100
- {
101
- id: (0, uuid_1.v4)(),
102
- created_at: new Date().toISOString(),
103
- type: "systemMessage",
104
- text: [
105
- "# Result of Prisma Agent",
106
- "- 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.",
107
- "- The test code should strictly adhere to the schema and relationships—no violations of constraints should occur.",
108
- "- Use the information from the schema and diagram to design meaningful and accurate test cases.",
109
- "",
110
- "## Prisma DB Schema",
111
- "```json",
112
- JSON.stringify(state.prisma.schemas),
113
- "```",
114
- "",
115
- "## Entity Relationship Diagrams",
116
- "```json",
117
- JSON.stringify(state.prisma.compiled.diagrams),
118
- "```",
119
- ].join("\n"),
120
- },
121
80
  {
122
81
  id: (0, uuid_1.v4)(),
123
82
  created_at: new Date().toISOString(),
@@ -135,41 +94,6 @@ const transformTestScenarioHistories = (state, allEndpoints, files) => {
135
94
  "```",
136
95
  ].join("\n"),
137
96
  },
138
- {
139
- id: (0, uuid_1.v4)(),
140
- created_at: new Date().toISOString(),
141
- type: "systemMessage",
142
- text: "# System Prompt: User Scenario Generator for API Endpoints\n\n## Role Definition\nYou are a world-class User Experience Analyst and Business Scenario Expert who specializes in analyzing API endpoints to generate comprehensive user scenarios from a pure user perspective. Your scenarios will be used as documentation and comments in test code to help developers understand the real-world user context behind each test.\n\n## Primary Objective\nGenerate all possible scenarios that real users might experience with a single given API endpoint, focusing exclusively on user intentions, motivations, and behaviors rather than technical testing perspectives.\n\n## Core Constraints\n\n### Single Endpoint Limitation\n- Each scenario must be completely achievable using ONLY the provided endpoint\n- Do NOT create scenarios that require multiple API calls or dependencies on other endpoints\n- Each user journey must be self-contained and complete within this single endpoint interaction\n\n### Practicality Constraint for Scenario Quantity\n\n- Do NOT generate an excessive number of test scenarios for trivial endpoints.\n- If the endpoint is a simple read-only operation that returns a static or predictable object (e.g. `{ cpu: number, system: number }`), limit scenarios to those that reflect meaningful variations in user context, not in raw input permutations.\n- Avoid producing multiple user error or edge case scenarios when they provide no additional business insight.\n- Prioritize business relevance over theoretical input diversity.\n- The goal is to maximize scenario value, not quantity.\n\n\n## Scenario Generation Principles\n\n### 1. Pure User-Centric Perspective\n- Focus entirely on what users want to achieve through the API\n- Consider real business contexts and user motivations\n- Emphasize user intent and expected value over technical implementation\n- Write as if documenting actual user stories for product requirements\n\n### 2. Comprehensive Single-Endpoint Coverage\nConsider all the following perspectives when generating scenarios for the single endpoint:\n\n#### A. Happy Path User Journeys\n- Most common and expected user behaviors\n- Standard workflows that lead to successful user outcomes\n- Primary business use cases users perform with this endpoint\n\n#### B. Alternative User Approaches\n- Valid but different ways users might achieve their goals\n- Scenarios using optional parameters or different input combinations\n- Less common but legitimate user behaviors within normal boundaries\n\n#### C. User Error Situations\n- Natural user mistakes with input data (incorrect formats, missing fields)\n- User attempts without proper authentication or authorization\n- User actions that violate business rules or constraints\n- User encounters with system limitations\n\n#### D. Boundary User Behaviors\n- User attempts with extreme values (minimum/maximum limits)\n- User submissions with empty, null, or unusual data\n- User inputs with special characters, long strings, or edge cases\n- User interactions testing system boundaries\n\n#### E. Contextual User Situations\n- User interactions when resources exist vs. don't exist\n- Different user roles attempting the same actions\n- Time-sensitive user scenarios (expired sessions, scheduled operations)\n- User attempts during various system states\n\n### 3. Scenario Writing Format for Test Documentation\nWrite each scenario using the following structure optimized for test code comments:\n\n```\n**Scenario**: [Clear, descriptive title from user perspective]\n\n**User Context**: [Who is the user and why are they performing this action]\n\n**User Goal**: [What the user wants to accomplish]\n\n**User Actions**: [Specific steps the user takes with this endpoint]\n\n**Expected Experience**: [What the user expects to happen and how they'll know it worked]\n\n**Business Value**: [Why this scenario matters to the business]\n\n**Input Test Files**: [The test file names required for combining this scenario. If you have multiple files, connect them with commas.]\n```\n\n## Scenario Generation Checklist for Single Endpoint\n\n### Data Input Perspective\n- [ ] User providing complete, valid data\n- [ ] User missing required fields (intentionally or accidentally)\n- [ ] User sending incorrectly formatted data\n- [ ] User using boundary values (maximum/minimum)\n- [ ] User including special characters or multilingual content\n\n### User Permission Perspective\n- [ ] Users with appropriate permissions\n- [ ] Users with insufficient permissions\n- [ ] Unauthenticated users attempting access\n- [ ] Users with expired authentication\n\n### Resource State Perspective\n- [ ] User interacting when target resource exists\n- [ ] User interacting when target resource doesn't exist\n- [ ] User interacting with resources in various states\n- [ ] User encountering resources modified by others\n\n### User Experience Perspective\n- [ ] Users with realistic data volumes\n- [ ] Users performing time-sensitive operations\n- [ ] Users with different technical skill levels\n- [ ] Users in different business contexts\n\n### Business Context Perspective\n- [ ] Users following standard business processes\n- [ ] Users encountering business rule violations\n- [ ] Users in exceptional business situations\n- [ ] Users with varying business needs\n\n## Output Requirements for Test Documentation\n\nEach scenario must provide sufficient detail for developers to understand:\n\n1. **User Story Context**: Clear understanding of who the user is and their motivation\n2. **Business Justification**: Why this scenario matters for the product\n3. **User Behavior Pattern**: How real users would naturally interact with the endpoint\n4. **Success Criteria**: How users measure successful completion of their goal\n5. **Function Name Guidance**: Clear enough description to derive meaningful test function names\n\n## Quality Standards for Test Code Comments\n\n- Write scenarios that help developers empathize with real users\n- Focus on business value and user outcomes, not technical mechanics\n- Provide enough context that a developer can understand the user's situation\n- Ensure scenarios reflect realistic business situations\n- Make each scenario distinct and valuable for understanding user needs\n- Use language that both technical and non-technical stakeholders can understand\n\n## Guidelines\n\n- Avoid mentioning test code, assertions, or technical implementation details\n- Write purely from the user's perspective using narrative language\n- Create realistic scenarios that reflect actual business situations\n- Ensure scenarios are comprehensive yet practical for a single endpoint\n- Focus on user value and business outcomes\n- Make scenarios detailed enough to understand full user context\n\n## Expected Input\nYou will receive a single API endpoint specification including:\n- HTTP method and endpoint path\n- Request/response schemas\n- Authentication requirements\n- Parameter definitions\n- Business context when available\n\n## Expected Output\nFor the given API endpoint, provide:\n- Categorized user scenarios covering all perspectives mentioned above\n- Each scenario following the specified format for test documentation\n- Scenarios that are complete and achievable with only the single provided endpoint\n- Clear mapping between user intentions and the specific API operation\n- Sufficient detail to understand both user context and business value\n\n## Working Language\n- Default working language: English\n- Use the language specified by user in messages as the working language when explicitly provided\n- All thinking and responses must be in the working language\n- Maintain consistent perspective and tone throughout all scenarios" /* AutoBeSystemPromptConstant.TEST */,
143
- },
144
- {
145
- id: (0, uuid_1.v4)(),
146
- created_at: new Date().toISOString(),
147
- type: "systemMessage",
148
- text: [
149
- `This is a description of different APIs.`,
150
- `Different APIs may have to be called to create one.`,
151
- `Check which functions have been developed.`,
152
- "```json",
153
- JSON.stringify(allEndpoints, null, 2),
154
- "```",
155
- ].join("\n"),
156
- },
157
- {
158
- id: (0, uuid_1.v4)(),
159
- created_at: new Date().toISOString(),
160
- type: "systemMessage",
161
- text: [
162
- "Below is basically the generated test code,",
163
- "which is a test to verify that the API is simply called and successful.",
164
- "Since there is already an automatically generated API,",
165
- "when a user requests to create a test scenario, two or more APIs must be combined,",
166
- "but a test in which the currently given endpoint is the main must be created.",
167
- '"Input Test Files" should be selected from the list of files here.',
168
- "```json",
169
- JSON.stringify(files, null, 2),
170
- "```",
171
- ].join("\n"),
172
- },
173
97
  ];
174
98
  };
175
99
  exports.transformTestScenarioHistories = transformTestScenarioHistories;
@@ -1 +1 @@
1
- {"version":3,"file":"transformTestScenarioHistories.js","sourceRoot":"","sources":["../../../src/orchestrate/test/transformTestScenarioHistories.ts"],"names":[],"mappings":";;;AAEA,+BAA0B;AAKnB,MAAM,8BAA8B,GAAG,CAC5C,KAAkB,EAClB,YAAuC,EACvC,KAA6B,EAG7B,EAAE;IACF,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI;QACxB,OAAO;YACL;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE;oBACJ,4CAA4C;oBAC5C,mCAAmC;oBACnC,8CAA8C;iBAC/C,CAAC,IAAI,CAAC,GAAG,CAAC;aACZ;SACF,CAAC;SACC,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI;QAC5B,OAAO;YACL;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE;oBACJ,mDAAmD;oBACnD,mCAAmC;oBACnC,qDAAqD;iBACtD,CAAC,IAAI,CAAC,GAAG,CAAC;aACZ;SACF,CAAC;SACC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM,CAAC,IAAI;QAC/C,OAAO;YACL;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE;oBACJ,kDAAkD;oBAClD,sCAAsC;oBACtC,mCAAmC;oBACnC,wDAAwD;iBACzD,CAAC,IAAI,CAAC,GAAG,CAAC;aACZ;SACF,CAAC;SACC,IAAI,K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YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;gBACrC,KAAK;aACN,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE;gBACJ,6CAA6C;gBAC7C,yEAAyE;gBACzE,wDAAwD;gBACxD,oFAAoF;gBACpF,+EAA+E;gBAC/E,oEAAoE;gBACpE,SAAS;gBACT,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC9B,KAAK;aACN,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF,CAAC;AACJ,CAAC,CAAC;AAhLW,QAAA,8BAA8B,kCAgLzC"}
1
+ {"version":3,"file":"transformTestScenarioHistories.js","sourceRoot":"","sources":["../../../src/orchestrate/test/transformTestScenarioHistories.ts"],"names":[],"mappings":";;;AACA,+BAA0B;AAKnB,MAAM,8BAA8B,GAAG,CAC5C,KAAkB,EAGlB,EAAE;IACF,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI;QACxB,OAAO;YACL;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE;oBACJ,4CAA4C;oBAC5C,mCAAmC;oBACnC,8CAA8C;iBAC/C,CAAC,IAAI,CAAC,GAAG,CAAC;aACZ;SACF,CAAC;SACC,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI;QAC5B,OAAO;YACL;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE;oBACJ,mDAAmD;oBACnD,mCAAmC;oBACnC,qDAAqD;iBACtD,CAA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AAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE;gBACJ,8BAA8B;gBAC9B,yCAAyC;gBACzC,EAAE;gBACF,gEAAgE;gBAChE,qCAAqC;gBACrC,EAAE;gBACF,qBAAqB;gBACrB,SAAS;gBACT,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC;gBACxC,KAAK;aACN,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF,CAAC;AACJ,CAAC,CAAC;AAlGW,QAAA,8BAA8B,kCAkGzC"}
@@ -1,24 +1,62 @@
1
+ /**
2
+ * Interface defining behavioral configuration for AutoBeAgent localization and
3
+ * context.
4
+ *
5
+ * This interface customizes the agent's communication style, language
6
+ * preferences, and geographical context to provide personalized vibe coding
7
+ * experiences. The configuration enables culturally appropriate interactions
8
+ * and regionally aware development decisions throughout the automated
9
+ * development pipeline.
10
+ *
11
+ * Locale and timezone settings influence not only the language of communication
12
+ * but also contextual understanding of regulatory requirements, business
13
+ * practices, and temporal considerations that may affect requirements analysis,
14
+ * database design, API specifications, and implementation approaches.
15
+ *
16
+ * @author Samchon
17
+ */
1
18
  export interface IAutoBeConfig {
2
19
  /**
3
- * Locale of the A.I. chatbot.
20
+ * Language and cultural locale preference for AI agent communication.
4
21
  *
5
- * If you configure this property, the A.I. chatbot will conversate with the
6
- * given locale. You can get the locale value by
22
+ * Configures the language and cultural context for all AI assistant responses
23
+ * throughout the vibe coding process. When specified, the agent will
24
+ * communicate in the preferred language while respecting cultural conventions
25
+ * and linguistic nuances during requirements gathering, progress updates, and
26
+ * guidance provision.
27
+ *
28
+ * The locale setting also influences the agent's understanding of regional
29
+ * business practices, regulatory considerations, and cultural expectations
30
+ * that may impact software design decisions and implementation approaches.
31
+ *
32
+ * Common formats follow BCP 47 language tags such as "en-US", "ko-KR",
33
+ * "ja-JP", "zh-CN", "de-DE", etc. Platform-specific detection methods:
7
34
  *
8
35
  * - Browser: `navigator.language`
9
- * - NodeJS: `process.env.LANG.split(".")[0]`
36
+ * - Node.js: `process.env.LANG.split(".")[0]`
10
37
  *
11
- * @default your_locale
38
+ * @default System locale or "en" if unavailable
12
39
  */
13
40
  locale?: string;
14
41
  /**
15
- * Timezone of the A.I. chatbot.
42
+ * Geographic timezone for temporal context and time-sensitive operations.
43
+ *
44
+ * Provides timezone awareness for proper handling of time-related
45
+ * considerations during the vibe coding process. This includes scheduling
46
+ * references, temporal business logic requirements, timestamp handling in
47
+ * generated code, and time-based communications that need to be
48
+ * contextualized for the user's local time.
49
+ *
50
+ * Timezone awareness ensures that generated applications properly handle time
51
+ * zones, that scheduling-related requirements are interpreted correctly, and
52
+ * that temporal references in documentation and code comments reflect the
53
+ * user's geographical context.
16
54
  *
17
- * If you configure this property, the A.I. chatbot will consider the given
18
- * timezone. You can get the timezone value by
19
- * `Intl.DateTimeFormat().resolvedOptions().timeZone`.
55
+ * Format follows IANA Time Zone Database identifiers such as
56
+ * "America/New_York", "Asia/Seoul", "Europe/London", "Pacific/Auckland", etc.
57
+ * Platform detection: `Intl.DateTimeFormat().resolvedOptions().timeZone`
20
58
  *
21
- * @default your_timezone
59
+ * @default System timezone or "UTC" if unavailable
22
60
  */
23
61
  timezone?: string;
24
62
  }
@@ -2,10 +2,97 @@ import { AutoBeHistory, IAutoBeCompiler } from "@autobe/interface";
2
2
  import { ILlmSchema } from "@samchon/openapi";
3
3
  import { IAutoBeConfig } from "./IAutoBeConfig";
4
4
  import { IAutoBeVendor } from "./IAutoBeVendor";
5
+ /**
6
+ * Configuration properties for initializing an AutoBeAgent instance.
7
+ *
8
+ * This interface defines all the essential parameters required to create and
9
+ * configure an AutoBeAgent for vibe coding operations. The properties establish
10
+ * the AI model capabilities, vendor connectivity, compilation infrastructure,
11
+ * behavioral context, and optional session continuity through conversation
12
+ * histories.
13
+ *
14
+ * The configuration enables type-safe AI function calling through
15
+ * model-specific schema generation, ensures compatibility with various AI
16
+ * service providers, and provides the compilation tools necessary for the
17
+ * sophisticated AST-based development pipeline that transforms conversations
18
+ * into working software.
19
+ *
20
+ * @author Samchon
21
+ */
5
22
  export interface IAutoBeProps<Model extends ILlmSchema.Model> {
23
+ /**
24
+ * AI model type specification for type-safe function calling schema
25
+ * generation.
26
+ *
27
+ * Determines the specific AI model schema used for generating function
28
+ * calling interfaces through
29
+ * [`typia.llm.application()`](https://typia.io/docs/llm/application). This
30
+ * type parameter ensures compile-time type safety and enables model-specific
31
+ * optimizations in the AI function calling interface generation process.
32
+ *
33
+ * Common values include "chatgpt" for OpenAI models, "claude" for Anthropic
34
+ * models, "deepseek" for DeepSeek models, and "llama" for Meta Llama models.
35
+ * The choice affects function calling capabilities, parameter limitations,
36
+ * and schema requirements throughout the vibe coding pipeline.
37
+ *
38
+ * Note that Google Gemini ("gemini") is not supported due to its lack of
39
+ * reference types and union types support required for OpenAPI document
40
+ * composition in the vibe coding process.
41
+ */
6
42
  model: Model;
43
+ /**
44
+ * AI vendor configuration for service provider integration.
45
+ *
46
+ * Defines the complete AI service connection including the OpenAI SDK
47
+ * instance, model identifier, request options, and concurrency controls. This
48
+ * configuration enables the AutoBeAgent to connect with various AI providers
49
+ * while maintaining consistent functionality across the entire automated
50
+ * development workflow.
51
+ *
52
+ * The vendor settings determine the AI capabilities available for
53
+ * requirements analysis, database design, API specification, testing, and
54
+ * implementation phases of the vibe coding process.
55
+ */
7
56
  vendor: IAutoBeVendor;
57
+ /**
58
+ * Compilation infrastructure for TypeScript, Prisma, and OpenAPI operations.
59
+ *
60
+ * Provides the essential compilation tools required for the sophisticated
61
+ * AST-based development pipeline. The compiler handles validation,
62
+ * transformation, and code generation across all development phases including
63
+ * Prisma schema compilation, OpenAPI document validation, and TypeScript code
64
+ * compilation.
65
+ *
66
+ * For high-performance scenarios with multiple concurrent users, the compiler
67
+ * can be separated into dedicated worker processes to prevent blocking the
68
+ * main agent during computationally intensive compilation operations.
69
+ */
8
70
  compiler: IAutoBeCompiler;
71
+ /**
72
+ * Optional conversation and development histories for session continuation.
73
+ *
74
+ * Enables resuming previous vibe coding sessions by providing the
75
+ * chronological record of past conversations, development activities, and
76
+ * generated artifacts. When provided, the agent reconstructs its internal
77
+ * state from these histories, allowing seamless continuation of development
78
+ * work.
79
+ *
80
+ * This capability supports iterative development workflows where users can
81
+ * return to modify, enhance, or extend previously generated applications
82
+ * while maintaining full context of earlier decisions and implementations.
83
+ */
9
84
  histories?: AutoBeHistory[] | undefined;
85
+ /**
86
+ * Optional behavioral configuration for localization and context.
87
+ *
88
+ * Customizes the agent's communication style, language preferences, and
89
+ * geographical context to provide personalized vibe coding experiences.
90
+ * Configuration includes locale settings for internationalized responses and
91
+ * timezone information for temporal context awareness.
92
+ *
93
+ * These settings influence how the agent communicates with users, interprets
94
+ * regional requirements (such as regulatory considerations), and handles
95
+ * time-sensitive operations throughout the development process.
96
+ */
10
97
  config?: IAutoBeConfig | undefined;
11
98
  }
@@ -1,43 +1,85 @@
1
1
  import OpenAI from "openai";
2
2
  /**
3
- * LLM service vendor for Agentica Chat.
3
+ * Interface representing AI vendor configuration for the AutoBeAgent.
4
4
  *
5
- * `IAgenticaVendor` is a type represents an LLM (Large Language Model) vendor
6
- * of the {@link AutoBeAgent}.
5
+ * Defines the connection parameters and settings required to integrate with AI
6
+ * service providers that power the vibe coding pipeline. While utilizing the
7
+ * OpenAI SDK as the connection interface, this configuration supports various
8
+ * LLM vendors beyond OpenAI through flexible endpoint and authentication
9
+ * configuration, enabling integration with Claude, DeepSeek, Meta Llama, and
10
+ * other providers that follow OpenAI-compatible API patterns.
7
11
  *
8
- * Currently, {@link AutoBeAgent} supports OpenAI SDK. However, it does not mean
9
- * that you can use only OpenAI's GPT model in the {@link AutoBeAgent}. The
10
- * OpenAI SDK is just a connection tool to the LLM vendor's API, and you can use
11
- * other LLM vendors by configuring its `baseURL` and API key.
12
+ * The vendor configuration determines the AI capabilities available throughout
13
+ * the entire automated development workflow, from requirements analysis and
14
+ * database design through API specification, testing, and final implementation.
15
+ * Different vendors may offer varying performance characteristics, cost
16
+ * structures, and feature support that can be optimized for specific vibe
17
+ * coding needs.
12
18
  *
13
- * Therefore, if you want to use another LLM vendor like Claude or Gemini,
14
- * please configure the `baseURL` to the {@link api}, and set
15
- * {@link IAutoBeProps.model schema model} as "cluade" or "gemini".
19
+ * Concurrent request management is built-in to prevent API rate limiting and
20
+ * optimize resource utilization across multiple development phases and parallel
21
+ * operations within the vibe coding pipeline.
16
22
  *
17
23
  * @author Samchon
18
24
  */
19
25
  export interface IAutoBeVendor {
20
- /** OpenAI API instance. */
26
+ /**
27
+ * OpenAI SDK instance configured for the target AI vendor.
28
+ *
29
+ * Provides the API connection interface used by the AutoBeAgent to
30
+ * communicate with AI services. While this uses the OpenAI SDK, it can be
31
+ * configured to connect with various LLM providers by setting the appropriate
32
+ * `baseURL` and authentication credentials. The SDK serves as a universal
33
+ * connector that abstracts the underlying API communication protocols.
34
+ *
35
+ * For non-OpenAI vendors, configure the SDK with the vendor's API endpoint
36
+ * and authentication requirements to enable seamless integration with the
37
+ * vibe coding system.
38
+ */
21
39
  api: OpenAI;
22
40
  /**
23
- * Chat model to be used.
41
+ * Specific model identifier to use for AI operations.
42
+ *
43
+ * Specifies the exact model name or identifier that should be used for vibe
44
+ * coding tasks. Supports both official OpenAI chat models and custom model
45
+ * identifiers for third-party hosting services, cloud providers, or
46
+ * alternative LLM vendors. The model choice significantly impacts the
47
+ * quality, performance, and cost of the automated development process.
24
48
  *
25
- * `({}) & string` means to support third party hosting cloud(eg. openRouter,
26
- * aws)
49
+ * Examples include "gpt-4", "gpt-3.5-turbo" for OpenAI, or vendor-specific
50
+ * identifiers like "claude-3-sonnet", "deepseek-chat-v3", "llama3.3-70b" when
51
+ * using alternative providers through compatible APIs.
27
52
  */
28
53
  model: OpenAI.ChatModel | ({} & string);
29
- /** Options for the request. */
54
+ /**
55
+ * Optional request configuration for API calls.
56
+ *
57
+ * Additional request options that will be applied to all API calls made
58
+ * through the OpenAI SDK. This can include custom headers, timeouts, retry
59
+ * policies, or other HTTP client configuration that may be required for
60
+ * specific vendor integrations or enterprise environments.
61
+ *
62
+ * These options provide fine-grained control over the API communication
63
+ * behavior and can be used to optimize performance or meet specific
64
+ * infrastructure requirements.
65
+ */
30
66
  options?: OpenAI.RequestOptions | undefined;
31
67
  /**
32
- * Number of concurrent requests allowed.
68
+ * Maximum number of concurrent API requests allowed.
69
+ *
70
+ * Controls the concurrency level for AI API calls to prevent rate limiting,
71
+ * manage resource consumption, and optimize system performance. The vibe
72
+ * coding pipeline may make multiple parallel requests during development
73
+ * phases, and this setting ensures controlled resource utilization.
33
74
  *
34
- * If you configure this property, {@link AutoBeAgent} will constrain the
35
- * number of concurrent requests to the LLM vendor. If you want to share the
36
- * semaphore instance with other agents, you can directly assign the
37
- * {@link Semaphore} instance to this property.
75
+ * A reasonable default provides balanced performance while respecting typical
76
+ * API rate limits. Lower values reduce resource consumption but may slow
77
+ * development progress, while higher values can improve performance but risk
78
+ * hitting rate limits or overwhelming the AI service.
38
79
  *
39
- * Otherwise, it will not limit the number of concurrent requests, and the
40
- * {@link AutoBeAgent} will send requests asynchronously without any limit.
80
+ * Set to undefined to disable concurrency limiting, allowing unlimited
81
+ * parallel requests (use with caution based on your API limits and
82
+ * infrastructure capacity).
41
83
  *
42
84
  * @default 16
43
85
  */
@@ -0,0 +1,7 @@
1
+ import { RetryOptions } from "./types/BackoffOptions";
2
+ /**
3
+ * @param fn Function to Apply the retry logic.
4
+ * @param maxRetries How many time to try. Max Retry is 5.
5
+ * @returns
6
+ */
7
+ export declare function randomBackoffRetry<T>(fn: () => Promise<T>, options?: Partial<RetryOptions>): Promise<T>;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.randomBackoffRetry = randomBackoffRetry;
13
+ /**
14
+ * @param fn Function to Apply the retry logic.
15
+ * @param maxRetries How many time to try. Max Retry is 5.
16
+ * @returns
17
+ */
18
+ function randomBackoffRetry(fn_1) {
19
+ return __awaiter(this, arguments, void 0, function* (fn, options = {}) {
20
+ const { maxRetries = 5, baseDelay = 4000, maxDelay = 60000, jitter = 0.8, handleError = isRetryError, } = options;
21
+ let lastError;
22
+ for (let attempt = 0; attempt < maxRetries; attempt++) {
23
+ try {
24
+ return yield fn();
25
+ }
26
+ catch (err) {
27
+ lastError = err;
28
+ if (attempt === maxRetries - 1)
29
+ throw err;
30
+ if (!handleError(err))
31
+ throw err;
32
+ const tempDelay = Math.min(baseDelay * 2 ** attempt, maxDelay);
33
+ const delay = tempDelay * (1 + Math.random() * jitter);
34
+ yield new Promise((res) => setTimeout(res, delay));
35
+ }
36
+ }
37
+ throw lastError;
38
+ });
39
+ }
40
+ function isRetryError(error) {
41
+ var _a, _b, _c;
42
+ // 1) Quota exceeded → No retry
43
+ if ((error === null || error === void 0 ? void 0 : error.code) === "insufficient_quota" ||
44
+ ((_a = error === null || error === void 0 ? void 0 : error.error) === null || _a === void 0 ? void 0 : _a.type) === "insufficient_quota") {
45
+ return false;
46
+ }
47
+ // 2) 5xx / server_error → Retry
48
+ if ((typeof (error === null || error === void 0 ? void 0 : error.status) === "number" && error.status >= 500) ||
49
+ ((_b = error === null || error === void 0 ? void 0 : error.error) === null || _b === void 0 ? void 0 : _b.type) === "server_error") {
50
+ return true;
51
+ }
52
+ // 3) HTTP 429
53
+ if ((error === null || error === void 0 ? void 0 : error.status) === 429) {
54
+ return true;
55
+ }
56
+ // 4) undici / network related
57
+ const code = (error === null || error === void 0 ? void 0 : error.code) || ((_c = error === null || error === void 0 ? void 0 : error.cause) === null || _c === void 0 ? void 0 : _c.code);
58
+ if ([
59
+ "UND_ERR_SOCKET",
60
+ "UND_ERR_CONNECT_TIMEOUT",
61
+ "ETIMEDOUT",
62
+ "ECONNRESET",
63
+ "EPIPE",
64
+ ].includes(code)) {
65
+ return true;
66
+ }
67
+ // 5) fetch abort
68
+ if ((error === null || error === void 0 ? void 0 : error.message) === "terminated" || (error === null || error === void 0 ? void 0 : error.name) === "AbortError") {
69
+ return true;
70
+ }
71
+ return false;
72
+ }
73
+ //# sourceMappingURL=backoffRetry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backoffRetry.js","sourceRoot":"","sources":["../../src/utils/backoffRetry.ts"],"names":[],"mappings":";;;;;;;;;;;AAOA,gDAgCC;AArCD;;;;GAIG;AACH,SAAsB,kBAAkB;yDACtC,EAAoB,EACpB,UAAiC,EAAE;QAEnC,MAAM,EACJ,UAAU,GAAG,CAAC,EACd,SAAS,GAAG,IAAK,EACjB,QAAQ,GAAG,KAAM,EACjB,MAAM,GAAG,GAAG,EACZ,WAAW,GAAG,YAAY,GAC3B,GAAG,OAAO,CAAC;QAEZ,IAAI,SAAkB,CAAC;QAEvB,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC;YACtD,IAAI,CAAC;gBACH,OAAO,MAAM,EAAE,EAAE,CAAC;YACpB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,SAAS,GAAG,GAAG,CAAC;gBAEhB,IAAI,OAAO,KAAK,UAAU,GAAG,CAAC;oBAAE,MAAM,GAAG,CAAC;gBAE1C,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;oBAAE,MAAM,GAAG,CAAC;gBAEjC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,CAAC,IAAI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C,QAAQ,CAAC,IAAI,CAAC,EAChB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,iBAAiB;IACjB,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,MAAK,YAAY,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,YAAY,EAAE,CAAC;QACpE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,12 @@
1
+ export interface RetryOptions {
2
+ /** Maximum number of retry attempts (default: 5) */
3
+ maxRetries: number;
4
+ /** Base delay in milliseconds (default: 2000) */
5
+ baseDelay: number;
6
+ /** Maximum delay in milliseconds (default: 60_000) */
7
+ maxDelay: number;
8
+ /** Jitter factor for randomization (0-1, default: 0.3) */
9
+ jitter: number;
10
+ /** Function to determine if error should trigger retry (default: isRetryError) */
11
+ handleError: (error: any) => boolean;
12
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=BackoffOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BackoffOptions.js","sourceRoot":"","sources":["../../../src/utils/types/BackoffOptions.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobe/agent",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "AI backend server code generator",
5
5
  "main": "lib/index.js",
6
6
  "author": "Wrtn Technologies",
@@ -30,7 +30,7 @@
30
30
  "tstl": "^3.0.0",
31
31
  "typia": "^9.3.1",
32
32
  "uuid": "^11.1.0",
33
- "@autobe/interface": "^0.8.0"
33
+ "@autobe/interface": "^0.9.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@rollup/plugin-terser": "^0.4.4",
@@ -43,8 +43,8 @@
43
43
  "ts-node": "^10.9.2",
44
44
  "ts-patch": "^3.3.0",
45
45
  "typescript": "~5.8.3",
46
- "@autobe/filesystem": "^0.8.0",
47
- "@autobe/compiler": "^0.8.0"
46
+ "@autobe/compiler": "^0.9.0",
47
+ "@autobe/filesystem": "^0.9.0"
48
48
  },
49
49
  "keywords": [
50
50
  "ai",