@autobe/agent 0.3.13 → 0.3.17

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.
package/lib/index.mjs CHANGED
@@ -5109,6 +5109,43 @@ function processCompilerResult(result) {
5109
5109
  return result;
5110
5110
  }
5111
5111
 
5112
+ var StringUtil;
5113
+
5114
+ (function(StringUtil) {
5115
+ function trim(strings, ...values) {
5116
+ let result = strings[0];
5117
+ for (let i = 0; i < values.length; i++) {
5118
+ result += String(values[i]) + strings[i + 1];
5119
+ }
5120
+ const lines = result.split("\n");
5121
+ while (lines.length > 0 && lines[0].trim() === "") {
5122
+ lines.shift();
5123
+ }
5124
+ while (lines.length > 0 && lines[lines.length - 1].trim() === "") {
5125
+ lines.pop();
5126
+ }
5127
+ if (lines.length === 0) return "";
5128
+ const firstNonEmptyLine = lines.find((line => line.trim() !== ""));
5129
+ if (!firstNonEmptyLine) return "";
5130
+ const leadingWhitespace = firstNonEmptyLine.match(/^[ \t]*/)?.[0] || "";
5131
+ const indentLength = leadingWhitespace.length;
5132
+ const trimmedLines = lines.map((line => {
5133
+ if (line.trim() === "") return "";
5134
+ return line.slice(indentLength);
5135
+ }));
5136
+ return trimmedLines.join("\n");
5137
+ }
5138
+ StringUtil.trim = trim;
5139
+ function singleLine(strings, ...values) {
5140
+ let result = strings[0];
5141
+ for (let i = 0; i < values.length; i++) {
5142
+ result += String(values[i]) + strings[i + 1];
5143
+ }
5144
+ return result.replace(/\n/g, " ").replace(/\s+/g, " ").trim();
5145
+ }
5146
+ StringUtil.singleLine = singleLine;
5147
+ })(StringUtil || (StringUtil = {}));
5148
+
5112
5149
  const createAutoBeController = props => {
5113
5150
  assertSchemaModel(props.model);
5114
5151
  const application = collection[props.model];
@@ -5117,11 +5154,59 @@ const createAutoBeController = props => {
5117
5154
  name: "autobe",
5118
5155
  application,
5119
5156
  execute: {
5120
- analyze: orchestrateAnalyze(props.context),
5121
- prisma: orchestratePrisma(props.context),
5122
- interface: orchestrateInterface(props.context),
5123
- test: orchestrateTest(),
5124
- realize: orchestrateRealize()
5157
+ analyze: async next => {
5158
+ const r = await orchestrateAnalyze(props.context)(next);
5159
+ if (r.type === "analyze") return {
5160
+ type: "success",
5161
+ description: "Analysis completed successfully, and report has been published."
5162
+ }; else return {
5163
+ type: "in-progress",
5164
+ description: StringUtil.trim`
5165
+ Requirements are not yet fully elicited,
5166
+ therefore additional questions will be made to the user.
5167
+ `
5168
+ };
5169
+ },
5170
+ prisma: async next => {
5171
+ const r = await orchestratePrisma(props.context)(next);
5172
+ if (r.type === "prisma") return {
5173
+ type: r.result.type,
5174
+ description: r.result.type === "success" ? "Prisma schemas have been generated successfully." : r.result.type === "failure" ? "Prisma schemas are generated, but compilation failed." : "Unexpected error occurred while generating Prisma schemas."
5175
+ }; else return {
5176
+ type: "prerequisites-not-satisfied",
5177
+ description: "Requirement analysis is not yet completed."
5178
+ };
5179
+ },
5180
+ interface: async next => {
5181
+ const r = await orchestrateInterface(props.context)(next);
5182
+ if (r.type === "interface") return {
5183
+ type: "success",
5184
+ description: "API interfaces have been designed successfully."
5185
+ }; else return {
5186
+ type: "prerequisites-not-satisfied",
5187
+ description: "Prisma schemas are not yet completed."
5188
+ };
5189
+ },
5190
+ test: async next => {
5191
+ const r = await orchestrateTest()(next);
5192
+ if (r.type === "test") return {
5193
+ type: r.result.type,
5194
+ description: r.result.type === "success" ? "Test functions have been generated successfully." : r.result.type === "failure" ? "Test functions are written, but compilation failed." : "Unexpected error occurred while writing test functions."
5195
+ }; else return {
5196
+ type: "prerequisites-not-satisfied",
5197
+ description: "API interfaces are not yet completed."
5198
+ };
5199
+ },
5200
+ realize: async next => {
5201
+ const r = await orchestrateRealize()(next);
5202
+ if (r.type === "realize") return {
5203
+ type: r.result.type,
5204
+ description: r.result.type === "success" ? "API implementation codes have been generated successfully." : r.result.type === "failure" ? "Implementation codes are composed, but compilation failed." : "Unexpected error occurred while writing implementation codes."
5205
+ }; else return {
5206
+ type: "prerequisites-not-satisfied",
5207
+ description: "API interfaces are not yet completed."
5208
+ };
5209
+ }
5125
5210
  }
5126
5211
  };
5127
5212
  };
@@ -5157,11 +5242,24 @@ const claude = {
5157
5242
  description: "Current Type: {@link IAutoBeApplicationResult}",
5158
5243
  type: "object",
5159
5244
  properties: {
5160
- success: {
5161
- type: "boolean"
5245
+ type: {
5246
+ oneOf: [ {
5247
+ const: "success"
5248
+ }, {
5249
+ const: "failure"
5250
+ }, {
5251
+ const: "exception"
5252
+ }, {
5253
+ const: "in-progress"
5254
+ }, {
5255
+ const: "prerequisites-not-satisfied"
5256
+ } ]
5257
+ },
5258
+ description: {
5259
+ type: "string"
5162
5260
  }
5163
5261
  },
5164
- required: [ "success" ]
5262
+ required: [ "type", "description" ]
5165
5263
  },
5166
5264
  description: "Run Analyze Agent.\n\nExecutes the Analyze agent to process user requirements and generate a\nstructured specification document. This agent analyzes all conversation\nhistory between users and AI, separates business logic from technical\nrequirements, and establishes development priorities and scope.\n\n**IMPORTANT**: Only call this function when sufficient requirements have\nbeen discussed to generate a comprehensive specification. The context must\ncontain enough detail about the system's purpose, core features, data\nmodels, and business rules. If requirements are unclear or incomplete,\ncontinue gathering information through conversation instead.\n\nThe agent will automatically generate follow-up questions for any ambiguous\nrequirements and continuously refine its understanding through iterative\nconversation. When executed after other agents have generated code, it can\nalso interpret change requests in the context of existing implementations.",
5167
5265
  validate: (() => {
@@ -5232,11 +5330,24 @@ const claude = {
5232
5330
  description: "Current Type: {@link IAutoBeApplicationResult}",
5233
5331
  type: "object",
5234
5332
  properties: {
5235
- success: {
5236
- type: "boolean"
5333
+ type: {
5334
+ oneOf: [ {
5335
+ const: "success"
5336
+ }, {
5337
+ const: "failure"
5338
+ }, {
5339
+ const: "exception"
5340
+ }, {
5341
+ const: "in-progress"
5342
+ }, {
5343
+ const: "prerequisites-not-satisfied"
5344
+ } ]
5345
+ },
5346
+ description: {
5347
+ type: "string"
5237
5348
  }
5238
5349
  },
5239
- required: [ "success" ]
5350
+ required: [ "type", "description" ]
5240
5351
  },
5241
5352
  description: "Run prisma agent.\n\nExecutes the Prisma agent to generate database schema files and ERD\ndocumentation. This agent reads the requirements specification created by\nthe {@link analyze Analyze agent} and produces a complete Prisma schema with\ncomprehensive documentation for each entity and attribute.\n\n**PREREQUISITE**: Only call this function after the {@link analyze} function\nhas been successfully executed and a requirements specification document\nhas been generated. The Prisma agent depends on the structured requirements\nanalysis to design the database schema properly. Without a completed\nrequirements specification, this function should NOT be called.\n\nThe agent will automatically validate the generated schema using the Prisma\ncompiler, self-correct any compilation errors through feedback loops, and\ngenerate ERD documentation using prisma-markdown. An internal review\nprocess ensures schema quality and optimization.",
5242
5353
  validate: (() => {
@@ -5307,11 +5418,24 @@ const claude = {
5307
5418
  description: "Current Type: {@link IAutoBeApplicationResult}",
5308
5419
  type: "object",
5309
5420
  properties: {
5310
- success: {
5311
- type: "boolean"
5421
+ type: {
5422
+ oneOf: [ {
5423
+ const: "success"
5424
+ }, {
5425
+ const: "failure"
5426
+ }, {
5427
+ const: "exception"
5428
+ }, {
5429
+ const: "in-progress"
5430
+ }, {
5431
+ const: "prerequisites-not-satisfied"
5432
+ } ]
5433
+ },
5434
+ description: {
5435
+ type: "string"
5312
5436
  }
5313
5437
  },
5314
- required: [ "success" ]
5438
+ required: [ "type", "description" ]
5315
5439
  },
5316
5440
  description: "Run interface agent.\n\nExecutes the Interface agent to design and generate API interfaces. This\nagent creates OpenAPI schemas and TypeScript/NestJS code based on the\nrequirements specification and ERD documentation from previous agents.\n\nThe agent follows a sophisticated pipeline: first constructing formal\nOpenAPI Operation Schemas and JSON Schemas, then validating these schemas,\nand finally transforming them into NestJS controllers and DTOs. Each\ngenerated interface includes comprehensive JSDoc comments and undergoes\ninternal review for consistency.",
5317
5441
  validate: (() => {
@@ -5382,11 +5506,24 @@ const claude = {
5382
5506
  description: "Current Type: {@link IAutoBeApplicationResult}",
5383
5507
  type: "object",
5384
5508
  properties: {
5385
- success: {
5386
- type: "boolean"
5509
+ type: {
5510
+ oneOf: [ {
5511
+ const: "success"
5512
+ }, {
5513
+ const: "failure"
5514
+ }, {
5515
+ const: "exception"
5516
+ }, {
5517
+ const: "in-progress"
5518
+ }, {
5519
+ const: "prerequisites-not-satisfied"
5520
+ } ]
5521
+ },
5522
+ description: {
5523
+ type: "string"
5387
5524
  }
5388
5525
  },
5389
- required: [ "success" ]
5526
+ required: [ "type", "description" ]
5390
5527
  },
5391
5528
  description: "Run test program agent.\n\nExecutes the Test agent to generate comprehensive E2E test suites for all\n{@link interface API interfaces}. This agent synthesizes outputs from\nprevious agents to create tests that validate both individual endpoints and\ntheir interactions.\n\n**PREREQUISITE**: Only call this function after the {@link interface}\nfunction has been successfully executed and API interfaces have been\ngenerated. The Test agent requires the completed API interface definitions,\nOpenAPI schemas, and TypeScript code to generate appropriate test\nscenarios. Without completed interface design, this function should NOT be\ncalled.\n\nThe agent will analyze dependency relationships between API functions,\nstructure integrated test scenarios with correct execution sequences, and\nenhance pre-generated test scaffolds with business logic validation.\nTypeScript compiler validation and internal review ensure test quality and\noptimal coverage.",
5392
5529
  validate: (() => {
@@ -5457,11 +5594,24 @@ const claude = {
5457
5594
  description: "Current Type: {@link IAutoBeApplicationResult}",
5458
5595
  type: "object",
5459
5596
  properties: {
5460
- success: {
5461
- type: "boolean"
5597
+ type: {
5598
+ oneOf: [ {
5599
+ const: "success"
5600
+ }, {
5601
+ const: "failure"
5602
+ }, {
5603
+ const: "exception"
5604
+ }, {
5605
+ const: "in-progress"
5606
+ }, {
5607
+ const: "prerequisites-not-satisfied"
5608
+ } ]
5609
+ },
5610
+ description: {
5611
+ type: "string"
5462
5612
  }
5463
5613
  },
5464
- required: [ "success" ]
5614
+ required: [ "type", "description" ]
5465
5615
  },
5466
5616
  description: "Run realize agent.\n\nExecutes the Realize agent to implement the actual business logic for each\nAPI endpoint. This agent synthesizes all outputs from previous agents to\ngenerate fully functional service provider code.\n\n**PREREQUISITE**: Only call this function after the {@link interface}\nfunction has been successfully executed and API interfaces have been\ngenerated. The Realize agent requires the completed API interface\ndefinitions to implement the corresponding service logic. It also benefits\nfrom having test code available for validation. Without completed interface\ndesign, this function should NOT be called.\n\nThe agent will create service implementations with multiple validation\nlayers: TypeScript compiler feedback, runtime validation through test\nexecution, and quality optimization through internal review. The generated\ncode handles database interactions through Prisma, implements security and\nvalidation checks, and processes business rules according to\nspecifications.",
5467
5617
  validate: (() => {
@@ -5543,11 +5693,15 @@ const collection = {
5543
5693
  description: "Current Type: {@link IAutoBeApplicationResult}",
5544
5694
  type: "object",
5545
5695
  properties: {
5546
- success: {
5547
- type: "boolean"
5696
+ type: {
5697
+ type: "string",
5698
+ enum: [ "success", "failure", "exception", "in-progress", "prerequisites-not-satisfied" ]
5699
+ },
5700
+ description: {
5701
+ type: "string"
5548
5702
  }
5549
5703
  },
5550
- required: [ "success" ]
5704
+ required: [ "type", "description" ]
5551
5705
  },
5552
5706
  description: "Run Analyze Agent.\n\nExecutes the Analyze agent to process user requirements and generate a\nstructured specification document. This agent analyzes all conversation\nhistory between users and AI, separates business logic from technical\nrequirements, and establishes development priorities and scope.\n\n**IMPORTANT**: Only call this function when sufficient requirements have\nbeen discussed to generate a comprehensive specification. The context must\ncontain enough detail about the system's purpose, core features, data\nmodels, and business rules. If requirements are unclear or incomplete,\ncontinue gathering information through conversation instead.\n\nThe agent will automatically generate follow-up questions for any ambiguous\nrequirements and continuously refine its understanding through iterative\nconversation. When executed after other agents have generated code, it can\nalso interpret change requests in the context of existing implementations.",
5553
5707
  validate: (() => {
@@ -5618,11 +5772,15 @@ const collection = {
5618
5772
  description: "Current Type: {@link IAutoBeApplicationResult}",
5619
5773
  type: "object",
5620
5774
  properties: {
5621
- success: {
5622
- type: "boolean"
5775
+ type: {
5776
+ type: "string",
5777
+ enum: [ "success", "failure", "exception", "in-progress", "prerequisites-not-satisfied" ]
5778
+ },
5779
+ description: {
5780
+ type: "string"
5623
5781
  }
5624
5782
  },
5625
- required: [ "success" ]
5783
+ required: [ "type", "description" ]
5626
5784
  },
5627
5785
  description: "Run prisma agent.\n\nExecutes the Prisma agent to generate database schema files and ERD\ndocumentation. This agent reads the requirements specification created by\nthe {@link analyze Analyze agent} and produces a complete Prisma schema with\ncomprehensive documentation for each entity and attribute.\n\n**PREREQUISITE**: Only call this function after the {@link analyze} function\nhas been successfully executed and a requirements specification document\nhas been generated. The Prisma agent depends on the structured requirements\nanalysis to design the database schema properly. Without a completed\nrequirements specification, this function should NOT be called.\n\nThe agent will automatically validate the generated schema using the Prisma\ncompiler, self-correct any compilation errors through feedback loops, and\ngenerate ERD documentation using prisma-markdown. An internal review\nprocess ensures schema quality and optimization.",
5628
5786
  validate: (() => {
@@ -5693,11 +5851,15 @@ const collection = {
5693
5851
  description: "Current Type: {@link IAutoBeApplicationResult}",
5694
5852
  type: "object",
5695
5853
  properties: {
5696
- success: {
5697
- type: "boolean"
5854
+ type: {
5855
+ type: "string",
5856
+ enum: [ "success", "failure", "exception", "in-progress", "prerequisites-not-satisfied" ]
5857
+ },
5858
+ description: {
5859
+ type: "string"
5698
5860
  }
5699
5861
  },
5700
- required: [ "success" ]
5862
+ required: [ "type", "description" ]
5701
5863
  },
5702
5864
  description: "Run interface agent.\n\nExecutes the Interface agent to design and generate API interfaces. This\nagent creates OpenAPI schemas and TypeScript/NestJS code based on the\nrequirements specification and ERD documentation from previous agents.\n\nThe agent follows a sophisticated pipeline: first constructing formal\nOpenAPI Operation Schemas and JSON Schemas, then validating these schemas,\nand finally transforming them into NestJS controllers and DTOs. Each\ngenerated interface includes comprehensive JSDoc comments and undergoes\ninternal review for consistency.",
5703
5865
  validate: (() => {
@@ -5768,11 +5930,15 @@ const collection = {
5768
5930
  description: "Current Type: {@link IAutoBeApplicationResult}",
5769
5931
  type: "object",
5770
5932
  properties: {
5771
- success: {
5772
- type: "boolean"
5933
+ type: {
5934
+ type: "string",
5935
+ enum: [ "success", "failure", "exception", "in-progress", "prerequisites-not-satisfied" ]
5936
+ },
5937
+ description: {
5938
+ type: "string"
5773
5939
  }
5774
5940
  },
5775
- required: [ "success" ]
5941
+ required: [ "type", "description" ]
5776
5942
  },
5777
5943
  description: "Run test program agent.\n\nExecutes the Test agent to generate comprehensive E2E test suites for all\n{@link interface API interfaces}. This agent synthesizes outputs from\nprevious agents to create tests that validate both individual endpoints and\ntheir interactions.\n\n**PREREQUISITE**: Only call this function after the {@link interface}\nfunction has been successfully executed and API interfaces have been\ngenerated. The Test agent requires the completed API interface definitions,\nOpenAPI schemas, and TypeScript code to generate appropriate test\nscenarios. Without completed interface design, this function should NOT be\ncalled.\n\nThe agent will analyze dependency relationships between API functions,\nstructure integrated test scenarios with correct execution sequences, and\nenhance pre-generated test scaffolds with business logic validation.\nTypeScript compiler validation and internal review ensure test quality and\noptimal coverage.",
5778
5944
  validate: (() => {
@@ -5843,11 +6009,15 @@ const collection = {
5843
6009
  description: "Current Type: {@link IAutoBeApplicationResult}",
5844
6010
  type: "object",
5845
6011
  properties: {
5846
- success: {
5847
- type: "boolean"
6012
+ type: {
6013
+ type: "string",
6014
+ enum: [ "success", "failure", "exception", "in-progress", "prerequisites-not-satisfied" ]
6015
+ },
6016
+ description: {
6017
+ type: "string"
5848
6018
  }
5849
6019
  },
5850
- required: [ "success" ]
6020
+ required: [ "type", "description" ]
5851
6021
  },
5852
6022
  description: "Run realize agent.\n\nExecutes the Realize agent to implement the actual business logic for each\nAPI endpoint. This agent synthesizes all outputs from previous agents to\ngenerate fully functional service provider code.\n\n**PREREQUISITE**: Only call this function after the {@link interface}\nfunction has been successfully executed and API interfaces have been\ngenerated. The Realize agent requires the completed API interface\ndefinitions to implement the corresponding service logic. It also benefits\nfrom having test code available for validation. Without completed interface\ndesign, this function should NOT be called.\n\nThe agent will create service implementations with multiple validation\nlayers: TypeScript compiler feedback, runtime validation through test\nexecution, and quality optimization through internal review. The generated\ncode handles database interactions through Prisma, implements security and\nvalidation checks, and processes business rules according to\nspecifications.",
5853
6023
  validate: (() => {
@@ -5929,11 +6099,15 @@ const collection = {
5929
6099
  output: {
5930
6100
  type: "object",
5931
6101
  properties: {
5932
- success: {
5933
- type: "boolean"
6102
+ type: {
6103
+ type: "string",
6104
+ enum: [ "success", "failure", "exception", "in-progress", "prerequisites-not-satisfied" ]
6105
+ },
6106
+ description: {
6107
+ type: "string"
5934
6108
  }
5935
6109
  },
5936
- required: [ "success" ],
6110
+ required: [ "type", "description" ],
5937
6111
  description: "Current Type: {@link IAutoBeApplicationResult}",
5938
6112
  additionalProperties: false
5939
6113
  },
@@ -6004,11 +6178,15 @@ const collection = {
6004
6178
  output: {
6005
6179
  type: "object",
6006
6180
  properties: {
6007
- success: {
6008
- type: "boolean"
6181
+ type: {
6182
+ type: "string",
6183
+ enum: [ "success", "failure", "exception", "in-progress", "prerequisites-not-satisfied" ]
6184
+ },
6185
+ description: {
6186
+ type: "string"
6009
6187
  }
6010
6188
  },
6011
- required: [ "success" ],
6189
+ required: [ "type", "description" ],
6012
6190
  description: "Current Type: {@link IAutoBeApplicationResult}",
6013
6191
  additionalProperties: false
6014
6192
  },
@@ -6079,11 +6257,15 @@ const collection = {
6079
6257
  output: {
6080
6258
  type: "object",
6081
6259
  properties: {
6082
- success: {
6083
- type: "boolean"
6260
+ type: {
6261
+ type: "string",
6262
+ enum: [ "success", "failure", "exception", "in-progress", "prerequisites-not-satisfied" ]
6263
+ },
6264
+ description: {
6265
+ type: "string"
6084
6266
  }
6085
6267
  },
6086
- required: [ "success" ],
6268
+ required: [ "type", "description" ],
6087
6269
  description: "Current Type: {@link IAutoBeApplicationResult}",
6088
6270
  additionalProperties: false
6089
6271
  },
@@ -6154,11 +6336,15 @@ const collection = {
6154
6336
  output: {
6155
6337
  type: "object",
6156
6338
  properties: {
6157
- success: {
6158
- type: "boolean"
6339
+ type: {
6340
+ type: "string",
6341
+ enum: [ "success", "failure", "exception", "in-progress", "prerequisites-not-satisfied" ]
6342
+ },
6343
+ description: {
6344
+ type: "string"
6159
6345
  }
6160
6346
  },
6161
- required: [ "success" ],
6347
+ required: [ "type", "description" ],
6162
6348
  description: "Current Type: {@link IAutoBeApplicationResult}",
6163
6349
  additionalProperties: false
6164
6350
  },
@@ -6229,11 +6415,15 @@ const collection = {
6229
6415
  output: {
6230
6416
  type: "object",
6231
6417
  properties: {
6232
- success: {
6233
- type: "boolean"
6418
+ type: {
6419
+ type: "string",
6420
+ enum: [ "success", "failure", "exception", "in-progress", "prerequisites-not-satisfied" ]
6421
+ },
6422
+ description: {
6423
+ type: "string"
6234
6424
  }
6235
6425
  },
6236
- required: [ "success" ],
6426
+ required: [ "type", "description" ],
6237
6427
  description: "Current Type: {@link IAutoBeApplicationResult}",
6238
6428
  additionalProperties: false
6239
6429
  },
@@ -6296,43 +6486,6 @@ const createAutoBeState = histories => {
6296
6486
  };
6297
6487
  };
6298
6488
 
6299
- var StringUtil;
6300
-
6301
- (function(StringUtil) {
6302
- function trim(strings, ...values) {
6303
- let result = strings[0];
6304
- for (let i = 0; i < values.length; i++) {
6305
- result += String(values[i]) + strings[i + 1];
6306
- }
6307
- const lines = result.split("\n");
6308
- while (lines.length > 0 && lines[0].trim() === "") {
6309
- lines.shift();
6310
- }
6311
- while (lines.length > 0 && lines[lines.length - 1].trim() === "") {
6312
- lines.pop();
6313
- }
6314
- if (lines.length === 0) return "";
6315
- const firstNonEmptyLine = lines.find((line => line.trim() !== ""));
6316
- if (!firstNonEmptyLine) return "";
6317
- const leadingWhitespace = firstNonEmptyLine.match(/^[ \t]*/)?.[0] || "";
6318
- const indentLength = leadingWhitespace.length;
6319
- const trimmedLines = lines.map((line => {
6320
- if (line.trim() === "") return "";
6321
- return line.slice(indentLength);
6322
- }));
6323
- return trimmedLines.join("\n");
6324
- }
6325
- StringUtil.trim = trim;
6326
- function singleLine(strings, ...values) {
6327
- let result = strings[0];
6328
- for (let i = 0; i < values.length; i++) {
6329
- result += String(values[i]) + strings[i + 1];
6330
- }
6331
- return result.replace(/\n/g, " ").replace(/\s+/g, " ").trim();
6332
- }
6333
- StringUtil.singleLine = singleLine;
6334
- })(StringUtil || (StringUtil = {}));
6335
-
6336
6489
  function transformFacadeStateMessage(state) {
6337
6490
  const currentState = getCurrentState(state);
6338
6491
  return "# AutoBE Main Agent System Prompt\n\nYou are the AutoBE Main Agent, an orchestrator for backend server development automation. Your role is to manage the conversation with users about their backend requirements and coordinate the execution of five specialized functional agents through function calling.\n\n## Core Responsibilities\n\n1. **Requirements Gathering**: Engage in detailed conversations with users to understand their backend server needs, asking clarifying questions about business logic, data models, API endpoints, and technical requirements.\n\n2. **Agent Orchestration**: Execute the appropriate functional agents in the correct sequence based on the development stage and user needs.\n\n3. **Progress Communication**: Keep users informed about the current development stage, what has been completed, and what steps remain.\n\n## Functional Agents Overview\n\nYou have access to five functional agents that must be executed in a specific order:\n\n1. **Analyze Agent** - Converts conversations into structured requirements specifications\n2. **Prisma Agent** - Generates database schemas and ERD documentation\n3. **Interface Agent** - Creates API interfaces with OpenAPI schemas and TypeScript code\n4. **Test Agent** - Generates comprehensive E2E test suites\n5. **Realize Agent** - Implements actual business logic for service providers\n\n## Execution Rules\n\n### 1. Sequential Dependencies\n\n- **analyze()**: Can only be called when sufficient requirements have been gathered\n- **prisma()**: Requires successful completion of analyze()\n- **interface()**: Requires successful completion of prisma()\n- **test()**: Requires successful completion of interface()\n- **realize()**: Requires successful completion of interface()\n\n### 2. Requirements Gathering Phase\n\nBefore calling analyze(), ensure you have discussed:\n\n- System purpose and overall goals\n- Core features and functionalities\n- User roles and permissions\n- Main data entities and their relationships\n- Key business rules and constraints\n- API endpoints needed\n- Any specific technical requirements\n\nIf these aspects are unclear, continue the conversation to gather more details.\n\n### 3. Development Workflow\n\n1. Start by understanding the user's needs through conversation\n2. When requirements are sufficiently detailed, execute analyze()\n3. Review the analysis results with the user\n4. If approved, proceed with prisma() → interface() → test() → realize()\n5. At each stage, present results and get user confirmation before proceeding\n\n### 4. Handling Changes\n\n- If users request changes after agents have been executed, first understand the scope\n- For minor adjustments, you may re-run specific agents\n- For major changes, consider re-running analyze() to update the specification\n- Always explain the impact of changes on already generated code\n\n## Communication Guidelines\n\n1. **Be Transparent**: Clearly explain which agent is being executed and why\n2. **Show Progress**: Indicate completed steps and remaining work\n3. **Confirm Understanding**: Summarize requirements before executing agents\n4. **Request Approval**: Get user confirmation before moving to the next stage\n5. **Explain Results**: Briefly describe what each agent has generated\n\n## Current State\n\n{% STATE %}".replace("{% STATE %}", StringUtil.trim`