Skip to Content

Event Handling

undefined

main.event.ts
import { AutoBeAgent } from "@autobe/agent"; import { AutoBeCompiler } from "@autobe/compiler"; import OpenAI from "openai"; const agent = new AutoBeAgent({ model: "chatgpt", vendor: { api: new OpenAI({ apiKey: "********" }), model: "gpt-4.1", }, compiler: new AutoBeCompiler(), }); agent.on("userMessage", (event) => { console.log("User message contents:", event.contents); }); agent.on("assistantMessage", (event) => { console.log("Assistant message:", event.text); }); agent.on("analyzeComplete", (event) => { console.log("Analyze complete:", event.files); }); agent.on("prismaComplete", (event) => { console.log( "Prisma complete:", event.schemas, event.compiled.type === "success" ? event.compiled.document : null, ); }); agent.on("interfaceComplete", (event) => { console.log("Interface complete:", event.document, event.files); }); agent.on("testComplete", (event) => { console.log("Test complete:", event.files); }); await agent.conversate(` I want to create a political/economic discussion board. Since I'm not familiar with programming, please write a requirements analysis report as you see fit. `);

The AutoBeAgent provides real-time event notifications throughout the development process.

These events allow you to monitor progress, handle intermediate states, and respond to completion events. All event types in @autobe are collected into the AutoBeEvent type as a union, providing comprehensive coverage of the agent’s activities.

Events in AutoBE can be categorized into two main types:

  • Message Events: Track conversation flow between user and assistant
  • Development Events: Monitor progress through various development phases

Message Events

@autobe/interface
import { AutoBeUserMessageContent } from "../histories/contents/AutoBeUserMessageContent"; import { AutoBeEventBase } from "./AutoBeEventBase"; /** * Event fired when a user sends a message during the conversation flow. * * This event represents real-time user input in the vibe coding conversation, * capturing the multimodal communication from users that drives the development * process. User messages can include text descriptions, visual references, * document uploads, and voice input that provide the requirements, feedback, * and guidance necessary for the AI agents to generate accurate software * solutions. * * The user message events serve as the primary input source for the entire vibe * coding pipeline, enabling users to express their needs through multiple * modalities and maintain interactive control over the automated development * process as it progresses through different phases. * * @author Samchon */ export interface AutoBeUserMessageEvent extends AutoBeEventBase<"userMessage"> { /** * Array of multimodal content items that comprise the user's message. * * Contains the diverse {@link AutoBeUserMessageContent} elements that make up * the user's communication, which can include text descriptions, images for * visual references, document files for specifications, and audio for voice * input. Each content item represents a different modality or attachment * within the same message. * * The multimodal array structure allows users to combine multiple content * types in a single message, such as text requirements accompanied by * reference images or documents. This comprehensive input approach provides * rich context for the AI agents to better understand user intentions and * generate more accurate development artifacts throughout the vibe coding * process. */ contents: AutoBeUserMessageContent[]; }

Message events are fired whenever there’s communication between the user and the assistant.

The AutoBeUserMessageEvent is triggered when users send messages. For users, multimodal capabilities are supported, allowing not only text but also image/document file attachments and voice input, which results in different content types. The AutoBeAssistantMessageEvent is fired when the assistant responds. The assistant communicates only through text, so its content type is limited to string in the message property.

These events are essential for building interactive interfaces, logging conversations, or implementing custom message processing logic.

Development Events

Analyze Events

@autobe/interface
import { AutoBeEventBase } from "./AutoBeEventBase"; /** * Event fired when the Analyze agent begins the requirements analysis process. * * This event marks the initiation of the structured requirements analysis * workflow, signaling that the agent is starting to draft the comprehensive * analysis report. The start event represents the beginning of the critical * foundation phase that transforms user conversations and business needs into * structured documentation for the entire vibe coding pipeline. * * The analysis process that begins with this event will proceed through * drafting, reviewing, and finalizing phases to produce the authoritative * requirements documentation that guides all subsequent development activities * including database design, API specification, and implementation. * * @author Kakasoo */ export interface AutoBeAnalyzeStartEvent extends AutoBeEventBase<"analyzeStart"> { /** * Reason why the Analyze agent was activated through function calling. * * Explains the specific circumstances that triggered the AI chatbot to invoke * the Analyze agent via function calling. This could include reasons such as * initial project requirements gathering, requests for requirement * clarification, updates to existing requirements based on user feedback, or * revision requests for the analysis report. * * Understanding the activation reason provides context for the analysis scope * and helps stakeholders understand whether this is an initial analysis or a * refinement of existing requirements. */ reason: string; /** * Iteration number of the requirements analysis being started. * * Indicates which revision of the requirements analysis is beginning. A value * of 0 means this is the initial requirements analysis, while higher values * represent subsequent revisions being initiated based on user feedback, * additional requirements, or refinement needs. * * This step number helps track the iterative nature of requirements * development and provides context for understanding the evolution of project * requirements throughout the development process. */ step: number; }

Analyze events track the requirements analysis process, which follows a structured workflow from initial drafting to final completion.

The AutoBeAnalyzeStartEvent event is fired when the agent begins drafting the requirements analysis. The AutoBeAnalyzeWriteEvent event occurs during the writing phase, followed by AutoBeAnalyzeReviewEvent during the review and amendment process. Finally, AutoBeAnalyzeCompleteEvent is fired when the requirements analysis report is finalized.

AutoBeAnalyzeCompleteEvent is generated when the @autobe agent and user have completed all discussions regarding requirements, and a report has been issued. The report consists of multiple markdown documents, which are stored in the files property.

The step property indicates which iteration of the requirements analysis report this represents. If this value is not 0, it means the requirements analysis report has been revised that many times. If the step value of other events is lower than AutoBeAnalyzeCompleteEvent.step, it means those events have not been reflected in the latest requirements analysis report.

Prisma Events

@autobe/interface
//---------------------------------------- // File: AutoBePrismaStartEvent.ts //---------------------------------------- import { AutoBeEventBase } from "./AutoBeEventBase"; /** * Event fired when the Prisma agent begins the database design process. * * This event marks the initiation of the sophisticated three-tier compiler * infrastructure that transforms business requirements into validated database * architectures through AST manipulation. The Prisma agent start represents the * beginning of the foundational data layer development that will support all * subsequent application functionality. * * The database design process that begins with this event will proceed through * component organization, schema creation, validation, and compilation to * produce production-ready Prisma schemas that maintain perfect semantic * integrity and syntactic correctness while accurately reflecting business * requirements. * * @author Samchon */ export interface AutoBePrismaStartEvent extends AutoBeEventBase<"prismaStart"> { /** * Reason why the Prisma agent was activated through function calling. * * Explains the specific circumstances that triggered the AI chatbot to invoke * the Prisma agent via function calling. This could include reasons such as * initial database design after requirements analysis completion, updating * database schemas due to requirement changes, regenerating data models to * reflect modified business logic, or creating additional database structures * for new functionality. * * Understanding the activation reason provides context for the database * design scope and helps stakeholders understand whether this represents * initial development, schema refinement, or expansion of existing data * architecture. */ reason: string; /** * Iteration number of the requirements analysis this database design is being * started for. * * Indicates which version of the requirements analysis this database design * will reflect. This step number ensures that the Prisma agent works with the * current requirements and helps track the evolution of database schemas as * business requirements and data needs change. * * The step value enables proper synchronization between database design * activities and the underlying requirements, ensuring that the data * architecture remains aligned with the current project scope and business * objectives throughout the iterative development process. */ step: number; } //---------------------------------------- // File: AutoBePrismaComponentsEvent.ts //---------------------------------------- import { AutoBePrisma } from "../prisma"; import { AutoBeEventBase } from "./AutoBeEventBase"; import { AutoBeTokenUsageEventBase } from "./AutoBeTokenUsageEventBase"; /** * Event fired when the Prisma agent organizes database tables into categorized * groups during the database design process. * * This event occurs when the Prisma agent has analyzed the requirements and * determined the complete scope of database tables needed, organizing them into * logical groups based on business domains and functional relationships. The * component organization follows domain-driven design principles to ensure * maintainable and coherent database architecture. * * The categorized components provide a clear roadmap for the schema generation * process, enabling systematic development of related tables while maintaining * proper dependencies and relationships across the database design. * * @author Samchon */ export interface AutoBePrismaComponentsEvent extends AutoBeEventBase<"prismaComponents">, AutoBeTokenUsageEventBase { /** * Initial thoughts on namespace classification criteria. * * Contains the AI agent's initial analysis and reasoning about how to * organize tables into different business domains/namespaces. * * **Example:** * * "Based on the business requirements, I identify several key domains: * - User-related entities should be grouped under 'Actors' namespace * - Product and sales information under 'Sales' namespace * - System configuration under 'Systematic' namespace" */ thinking: string; /** * Review and refinement of the namespace classification. * * Contains the AI agent's review process, considering relationships between * tables and potential improvements to the initial classification. * * **Example:** * * "Upon review, I noticed that 'shopping_channel_categories' has strong * relationships with both channels and sales. However, since it primarily * defines the channel structure, it should remain in 'Systematic' namespace." */ review: string; /** * Final decision on namespace classification. * * Contains the AI agent's final reasoning and rationale for the chosen * namespace organization, explaining why this structure best serves the * business requirements. * * **Example:** * * "Final decision: Organize tables into 3 main namespaces: * 1. Systematic - for channel and system configuration * 2. Actors - for all user types (customers, citizens, administrators) * 3. Sales - for product sales and related transactional data * This structure provides clear separation of concerns and follows DDD principles." */ decision: string; /** * Array of component groups organizing tables by business domain and * functional relationships. * * Each component represents a logical grouping of database tables that belong * to the same business domain or functional area. The grouping follows * domain-driven design principles where related tables are organized together * to maintain coherent schema files and enable systematic development. * * Each component includes the target filename for the schema file and the * list of table names that will be included in that domain. This organization * ensures that the generated Prisma schema files are logically structured and * maintainable, with clear separation of concerns across different business * areas. */ components: AutoBePrisma.IComponent[]; /** * Iteration number of the requirements analysis this component organization * was performed for. * * Indicates which version of the requirements analysis this table * organization reflects. This step number ensures that the database component * structure is aligned with the current requirements and helps track the * evolution of database architecture as business requirements change. * * The step value enables proper synchronization between database organization * and the underlying requirements, ensuring that the schema structure remains * relevant to the current project scope and business objectives. */ step: number; } //---------------------------------------- // File: AutoBePrismaSchemasEvent.ts //---------------------------------------- import { AutoBePrisma } from "../prisma"; import { AutoBeEventBase } from "./AutoBeEventBase"; import { AutoBeProgressEventBase } from "./AutoBeProgressEventBase"; import { AutoBeTokenUsageEventBase } from "./AutoBeTokenUsageEventBase"; /** * Event fired when the Prisma agent generates a complete schema file for a * specific business domain during the database design process. * * This event occurs when the Prisma agent has successfully designed and * generated all database tables for a particular business domain (e.g., Sales, * Orders, Users). The agent follows a systematic 2-step process: strategic * planning (plan) and model generation (models), producing production-ready * database schemas that maintain data integrity and business logic accuracy. * The generated models will be reviewed by a separate review agent. * * Each schema file represents a cohesive unit of database design focused on a * specific business area, following domain-driven design principles. The * progressive completion of schema files provides real-time visibility into the * database architecture development, enabling stakeholders to track progress * and validate domain-specific data models incrementally. * * @author Samchon */ export interface AutoBePrismaSchemasEvent extends AutoBeEventBase<"prismaSchemas">, AutoBeProgressEventBase, AutoBeTokenUsageEventBase { /** * Strategic database design analysis and planning phase. * * Contains the AI agent's comprehensive analysis of the target business * domain and its database design strategy. The agent evaluates the required * tables, their relationships, normalization requirements, and performance * considerations to create a well-architected database schema that aligns * with business objectives and technical best practices. * * This planning phase establishes the foundation for the entire schema * design, ensuring proper table organization, relationship mapping, and * adherence to database normalization principles while considering future * scalability and maintainability requirements. */ plan: string; /** * Prisma schema models generated based on the strategic plan. * * Contains the production-ready AST representation of Prisma schema models * generated following the strategic plan. These models implement all planned * tables, relationships, and constraints using the AutoBePrisma.IModel * interface. The models are designed to be production-ready from the start. * * The models include exact table names from requirements, proper UUID primary * fields, foreign key relationships, business fields with appropriate types, * strategic indexes, and comprehensive English-only descriptions. */ models: AutoBePrisma.IModel[]; /** * Generated Prisma schema file information for a specific business domain. * * This field contains the complete schema file data including the filename, * namespace, and the production-ready Prisma schema models. The AI agent has * analyzed the requirements, designed the tables, and produced models that * include all necessary relationships, indexes, and constraints. * * The generated file follows the naming convention * `schema-{number}-{domain}.prisma` where the number indicates dependency * order and the domain represents the business area. The final models within * the file follow Prisma conventions while incorporating enterprise patterns * like snapshot tables and materialized views. * * Each model in the file.models array represents a table in the database with * proper field definitions, relationships, indexes, and comprehensive * documentation, designed to ensure production readiness from the initial * generation. */ file: AutoBePrisma.IFile; /** * Iteration number of the requirements analysis this schema was generated * for. * * Tracks which version of the business requirements this database schema * reflects, ensuring alignment between the evolving requirements and the * generated data models. As requirements change through iterations, this step * number helps maintain traceability and version consistency across the * database architecture development process. */ step: number; } //---------------------------------------- // File: AutoBePrismaValidateEvent.ts //---------------------------------------- import { IAutoBePrismaCompileResult } from "../compiler/IAutoBePrismaCompileResult"; import { IAutoBePrismaValidation } from "../prisma/IAutoBePrismaValidation"; import { AutoBeEventBase } from "./AutoBeEventBase"; /** * Event fired when the Prisma agent validates the constructed database design * and encounters validation failures that need correction. * * This event occurs when the custom Prisma compiler processes the generated AST * structure and detects validation errors that prevent successful schema * compilation. The validation process represents a critical quality gate in the * vibe coding pipeline, ensuring that only semantically correct and * business-aligned database designs proceed to final generation. * * The validation event triggers the feedback loop that enables AI * self-correction, providing detailed error information that helps the Prisma * agent understand what needs to be fixed and how to improve the database * design quality. * * @author Samchon */ export interface AutoBePrismaValidateEvent extends AutoBeEventBase<"prismaValidate"> { /** * The validation failure details describing what errors were detected. * * Contains the specific {@link IAutoBePrismaValidation.IFailure} information * that describes the validation errors found in the database design. This * includes details about relationship issues, constraint violations, naming * problems, performance concerns, or other semantic errors that prevent the * design from meeting quality standards. * * The failure information provides comprehensive diagnostic details necessary * for the AI to understand the validation problems and formulate appropriate * corrections to resolve the identified issues. */ result: IAutoBePrismaValidation.IFailure; /** * Results of attempting to compile the current database design. * * Contains the {@link IAutoBePrismaCompileResult} from the compilation attempt * that revealed the validation issues. Even when validation fails, the * compiler may provide partial results or additional diagnostic information * that helps understand the scope and nature of the problems. * * The compilation results offer additional context beyond the validation * failure, potentially including information about which parts of the design * are working correctly and which specific areas need attention. */ compiled: IAutoBePrismaCompileResult; /** * Generated schema files that failed validation as key-value pairs. * * Contains the Prisma schema files that were generated but failed to pass * validation. Each key represents the filename and each value contains the * schema content that contains the validation errors. These schemas provide * context for understanding what was attempted and where the problems * occurred. * * Having access to the failing schemas enables detailed analysis of the * validation issues and helps in formulating precise corrections that address * the specific problems without disrupting working portions of the design. */ schemas: Record<string, string>; /** * Iteration number of the requirements analysis this validation was performed * for. * * Indicates which version of the requirements analysis this database * validation reflects. This step number ensures that the validation feedback * is aligned with the current requirements and helps track the quality * improvement process as validation issues are identified and resolved. * * The step value enables proper synchronization between validation activities * and the underlying requirements, ensuring that validation efforts remain * relevant to the current project scope and business objectives. */ step: number; } //---------------------------------------- // File: AutoBePrismaCorrectEvent.ts //---------------------------------------- import { AutoBePrisma } from "../prisma/AutoBePrisma"; import { IAutoBePrismaValidation } from "../prisma/IAutoBePrismaValidation"; import { AutoBeEventBase } from "./AutoBeEventBase"; import { AutoBeTokenUsageEventBase } from "./AutoBeTokenUsageEventBase"; /** * Event fired when the Prisma agent corrects validation failures in the * database design. * * This event occurs when the custom Prisma compiler detects validation errors * in the constructed AST structure and the Prisma agent receives feedback to * correct compilation issues. The correction process represents the * sophisticated feedback loop that enables AI self-correction, ensuring that * only valid and semantically correct database designs proceed to final * generation. * * The correction mechanism is essential for maintaining the reliability of the * vibe coding pipeline, allowing the system to iteratively refine database * designs until they meet all validation requirements and business * constraints. * * @author Samchon */ export interface AutoBePrismaCorrectEvent extends AutoBeEventBase<"prismaCorrect">, AutoBeTokenUsageEventBase { /** * The validation failure details that triggered the correction process. * * Contains the specific {@link IAutoBePrismaValidation.IFailure} information * that describes what validation errors were detected in the database design. * This includes details about relationship issues, constraint violations, * naming problems, or other semantic errors that prevented successful * validation. * * The failure information provides the diagnostic context necessary for the * AI to understand what went wrong and make appropriate corrections to the * database design. */ failure: IAutoBePrismaValidation.IFailure; /** * The corrected AST application structure addressing the validation failures. * * Contains the revised {@link AutoBePrisma.IApplication} structure that * attempts to resolve the validation issues identified in the failure. The * correction incorporates the feedback from the validation process to address * relationship problems, fix constraint violations, resolve naming conflicts, * or correct other structural issues. * * This corrected structure will undergo validation again to ensure that the * modifications successfully resolve the identified problems while * maintaining the integrity of the overall database design. */ correction: AutoBePrisma.IApplication; /** * Explanation of the correction strategy and changes being made. * * Describes the AI's analysis of the validation failure and the specific * approach being taken to resolve the issues. This planning explanation * provides transparency into the correction process, helping stakeholders * understand what changes are being made and why they are necessary. * * The planning commentary helps track the iterative improvement process and * provides insights into how the AI learns from validation feedback to * improve database design quality. */ planning: string; /** * Iteration number of the requirements analysis this correction was performed * for. * * Indicates which version of the requirements analysis this database * correction reflects. This step number ensures that the correction efforts * are aligned with the current requirements and helps track the evolution of * database design quality as validation feedback is incorporated. * * The step value enables proper synchronization between correction activities * and the underlying requirements, ensuring that design improvements remain * relevant to the current project scope and business objectives. */ step: number; } //---------------------------------------- // File: AutoBePrismaCompleteEvent.ts //---------------------------------------- import { IAutoBePrismaCompileResult } from "../compiler"; import { AutoBePrisma, IAutoBePrismaValidation } from "../prisma"; import { AutoBeEventBase } from "./AutoBeEventBase"; /** * Event fired when the Prisma agent completes the database design process and * successfully generates validated schema files. * * This event represents the successful completion of the sophisticated * three-tier compiler infrastructure that transforms business requirements into * validated database architectures. The completion marks the transition from * requirements analysis to a concrete database implementation that maintains * perfect semantic integrity and syntactic correctness. * * The Prisma agent's completion ensures that the database design accurately * reflects business needs while providing the foundation for subsequent API * development and application implementation phases. * * @author Samchon */ export interface AutoBePrismaCompleteEvent extends AutoBeEventBase<"prismaComplete"> { /** * The validated AST application structure containing the complete database * design. * * Contains the finalized {@link AutoBePrisma.IApplication} structure that * represents the complete database architecture as validated AST data. This * application includes all models, relationships, constraints, and business * rules that have passed through the comprehensive validation process * including relationship graph analysis, business logic validation, and * performance optimization. * * The application structure serves as the authoritative source of database * design that has been verified for semantic correctness and business * alignment before code generation. */ result: IAutoBePrismaValidation; /** * Generated Prisma schema files as key-value pairs. * * Contains the production-ready schema files generated through deterministic * code generation from the validated AST structure. Each key represents the * filename (following the pattern `schema-{number}-{domain}.prisma`) and each * value contains the actual Prisma schema content organized by business * domains. * * The schemas include comprehensive documentation, optimal indexes, proper * constraints, and all optimizations derived from the AST analysis, ready for * immediate deployment to the target database environment. */ schemas: Record<string, string>; /** * Results of compiling the generated Prisma schema files. * * Contains the {@link IAutoBePrismaCompileResult} from processing the * generated schemas through the Prisma compiler. This should always indicate * successful compilation since the schemas are generated from pre-validated * AST structures. The compilation results include documentation, diagrams, * and dependency files ready for deployment. * * Successful compilation confirms that the generated schemas will work * correctly in the target database environment and integrate properly with * the broader development ecosystem. */ compiled: IAutoBePrismaCompileResult; /** * Iteration number of the requirements analysis this database design was * completed for. * * Indicates which version of the requirements analysis this database design * reflects. This step number ensures that the database implementation is * aligned with the current requirements and helps track the evolution of data * architecture as business requirements change. * * The step value enables proper synchronization between database design and * the underlying requirements, ensuring that subsequent development phases * work with the most current and relevant database foundation. */ step: number; /** * Elapsed time in milliseconds for the entire Prisma completion process. * * Indicates the total time taken from the start of the Prisma design phase * until its completion. This metric helps in understanding the efficiency of * the database design and validation process, providing insights into the * time investment required for thorough design, validation, and code * generation. * * This elapsed time is same with the difference between the timestamps * recorded in the `created_at` field of the `AutoBePrismaStartEvent` and this * event. */ elapsed: number; }

Prisma events monitor the database design process. Database design in @autobe begins with the AutoBePrismaStartEvent, followed by AutoBePrismaComponentsEvent which lists all tables that @autobe will design and their categorized groups. The AutoBePrismaSchemasEvent event is fired each time tables within a category group are completed.

Once all schema designs are completed, the AutoBePrismaValidateEvent event is triggered, and @autobe’s built-in Prisma compiler validates the table designs. If validation succeeds, @autobe fires the AutoBePrismaCompleteEvent event. Conversely, if validation fails, the AutoBePrismaCorrectEvent event is triggered, requesting the AI to fix the compilation errors. The AutoBePrismaValidateEvent event is then fired again, repeating this cycle.

AutoBePrismaCompleteEvent is generated when @autobe analyzes the requirements specification and completes the database design.

@autobe constructs data of type AutoBePrisma.IApplication through AI function calling, validates it, and then generates prisma schema files. The validation results are stored in the result property as type IAutoBePrismaValidation, and the results of converting this to prisma schema files (code generation) are stored in the schemas property.

Note that @autobe generally creates valid AutoBePrisma.IApplication data through a validation feedback process. However, when using very small AI models, the IAutoBePrismaValidation result might have success := false. Additionally, the results of compiling the prisma schema files are stored in the compiled property as type IAutoBePrismaCompileResult, which should always compile successfully. If compilation fails, it would be a bug in @autobe, so please report it as an issue.

The step property indicates which requirements analysis report iteration the database design was performed for. If the AutoBePrismaCompleteEvent.step value is lower than AutoBeAnalyzeCompleteEvent.step, it means the database design has not yet been updated to reflect the latest requirements.

Interface Events

@autobe/interface
//---------------------------------------- // File: AutoBeInterfaceStartEvent.ts //---------------------------------------- import { AutoBeEventBase } from "./AutoBeEventBase"; /** * Event fired when the Interface agent begins the RESTful API design process. * * This event marks the initiation of the sophisticated multi-stage * transformation pipeline that converts validated AST structures into * comprehensive API specifications. The Interface agent start represents a * critical transition point where database schemas and requirements analysis * are transformed into API contracts that bridge data storage and application * functionality. * * The API design process that begins with this event will proceed through * endpoint creation, operation definition, component specification, and final * code generation to produce production-ready NestJS applications with complete * type safety and business logic integration. * * @author Samchon */ export interface AutoBeInterfaceStartEvent extends AutoBeEventBase<"interfaceStart"> { /** * Reason why the Interface agent was activated through function calling. * * Explains the specific circumstances that triggered the AI chatbot to invoke * the Interface agent via function calling. This could include reasons such * as completing initial API design after database schema creation, updating * API specifications due to requirement changes, regenerating interfaces to * reflect modified data models, or creating new API endpoints for additional * functionality. * * Understanding the activation reason provides context for the API design * scope and helps stakeholders understand whether this represents new * development, refinement of existing specifications, or integration with * updated database schemas. */ reason: string; /** * Iteration number of the requirements analysis this API design is being * started for. * * Indicates which version of the requirements analysis this API design will * reflect. This step number ensures that the Interface agent works with the * current requirements and helps track the evolution of API specifications as * requirements and database schemas change. * * The step value enables proper synchronization between API design activities * and the underlying requirements, ensuring that the API development remains * aligned with the current project scope and business objectives throughout * the iterative development process. */ step: number; } //---------------------------------------- // File: AutoBeInterfaceEndpointsEvent.ts //---------------------------------------- import { AutoBeOpenApi } from "../openapi/AutoBeOpenApi"; import { AutoBeEventBase } from "./AutoBeEventBase"; import { AutoBeProgressEventBase } from "./AutoBeProgressEventBase"; import { AutoBeTokenUsageEventBase } from "./AutoBeTokenUsageEventBase"; /** * Event fired when the Interface agent creates the complete list of API * endpoints during the RESTful API design process. * * This event occurs early in the API design workflow, after the Interface agent * has analyzed the requirements and database schema to determine what API * endpoints are needed for the application. The endpoint creation establishes * the fundamental structure of the API surface area before detailed operation * definitions and schema components are developed. * * The endpoints list provides the architectural foundation for the API design, * ensuring comprehensive coverage of the business functionality while * maintaining RESTful principles and consistency with the underlying data * model. * * @author Samchon */ export interface AutoBeInterfaceEndpointsEvent extends AutoBeEventBase<"interfaceEndpoints">, AutoBeProgressEventBase, AutoBeTokenUsageEventBase { /** * Array of API endpoints that have been defined for the application. * * Contains the complete list of {@link AutoBeOpenApi.IEndpoint} definitions * that establish the API surface area for the application. Each endpoint * represents a specific URL path and HTTP method combination that will be * available in the final API, covering all necessary business operations and * data access patterns. * * The endpoints are designed to provide comprehensive coverage of the * business functionality while following RESTful conventions and maintaining * consistency with the database schema. This foundational structure guides * the subsequent development of detailed operation specifications and schema * definitions. */ endpoints: AutoBeOpenApi.IEndpoint[]; /** * Iteration number of the requirements analysis this endpoint creation was * performed for. * * Indicates which version of the requirements analysis this endpoint design * reflects. This step number ensures that the API endpoints are aligned with * the current requirements and helps track the evolution of the API surface * area as requirements change. * * The step value enables proper synchronization between endpoint definitions * and the underlying requirements, ensuring that the API structure remains * relevant to the current project scope and business objectives. */ step: number; } //---------------------------------------- // File: AutoBeInterfaceOperationsEvent.ts //---------------------------------------- import { AutoBeOpenApi } from "../openapi/AutoBeOpenApi"; import { AutoBeEventBase } from "./AutoBeEventBase"; import { AutoBeProgressEventBase } from "./AutoBeProgressEventBase"; import { AutoBeTokenUsageEventBase } from "./AutoBeTokenUsageEventBase"; /** * Event fired when the Interface agent defines API operations during the * RESTful API specification process. * * This event occurs when the Interface agent is creating detailed operation * specifications that define the role, behavior, and characteristics of each * API function. Operations include comprehensive business logic definitions, * parameter specifications, response schemas, error handling, and security * requirements that transform endpoint definitions into fully functional API * contracts. * * The operation definition process ensures that each API endpoint has complete * behavioral specifications, proper documentation, and clear contracts that * enable accurate code generation and reliable client integration. * * @author Samchon */ export interface AutoBeInterfaceOperationsEvent extends AutoBeEventBase<"interfaceOperations">, AutoBeProgressEventBase, AutoBeTokenUsageEventBase { /** * Array of API operations being defined for the endpoints. * * Contains the detailed {@link AutoBeOpenApi.IOperation} specifications that * define the business logic, parameters, responses, and behavior for each API * function. Each operation includes comprehensive documentation, * request/response schemas, error handling specifications, and security * requirements that transform basic endpoints into complete API contracts. * * The operations ensure that every API function has clear behavioral * definitions, proper validation rules, and comprehensive documentation that * enables accurate implementation and reliable client integration throughout * the application ecosystem. */ operations: AutoBeOpenApi.IOperation[]; /** * Iteration number of the requirements analysis this operation definition was * performed for. * * Indicates which version of the requirements analysis this operation design * reflects. This step number ensures that the API operations are aligned with * the current requirements and helps track the evolution of API functionality * as business requirements change. * * The step value enables proper synchronization between operation definitions * and the underlying requirements, ensuring that the API behavior remains * relevant to the current project scope and business objectives. */ step: number; } //---------------------------------------- // File: AutoBeInterfaceOperationsReviewEvent.ts //---------------------------------------- import { AutoBeOpenApi } from "../openapi"; import { AutoBeEventBase } from "./AutoBeEventBase"; import { AutoBeProgressEventBase } from "./AutoBeProgressEventBase"; import { AutoBeTokenUsageEventBase } from "./AutoBeTokenUsageEventBase"; /** * Event fired during the review and validation phase of API operation * definitions. * * This event occurs when the Interface agent is reviewing and validating the * generated API operations against business requirements, technical * specifications, and OpenAPI standards. The review phase ensures that each * operation properly implements the required functionality with correct * request/response schemas, authentication, error handling, and documentation. * * The review process involves systematic validation where the agent evaluates * operation completeness, parameter correctness, response accuracy, and overall * API design consistency. Operations that fail validation are marked for * revision to ensure the final API specification meets enterprise-level quality * standards. * * @author Kakasoo */ export interface AutoBeInterfaceOperationsReviewEvent extends AutoBeEventBase<"interfaceOperationsReview">, AutoBeProgressEventBase, AutoBeTokenUsageEventBase { /** * Original API operations submitted for review. * * The complete set of operations generated by the Interface Operations Agent * that require validation for security compliance, schema alignment, logical * consistency, and adherence to AutoBE standards. These are the operations * being evaluated for potential issues and improvements. */ operations: AutoBeOpenApi.IOperation[]; /** * Detailed review feedback from the Interface Operations Review Agent. * * Contains comprehensive assessment results including: * * - Security vulnerability analysis * - Schema compliance validation * - Logical consistency verification * - Standard adherence evaluation * - Identified critical issues and recommendations */ review: string; /** * Amendment plan based on the review feedback. * * Structured action plan outlining specific corrections needed for: * * - Security issues (password exposure, authorization bypasses) * - Logic errors (mismatched return types, incorrect HTTP semantics) * - Schema violations (missing fields, type mismatches) * * If operations are perfect, explicitly states no changes are required. */ plan: string; /** * Revised operations based on the amendment plan. * * The final corrected API operations after applying all fixes from the * improvement plan. If no issues were found during review, this contains the * original operations unchanged. These enhanced operations are ready for * schema generation and subsequent implementation phases. */ content: AutoBeOpenApi.IOperation[]; /** * Current iteration number of the operation review process. * * Indicates which revision cycle of the API operation review is currently * being executed. This step number helps track the iterative validation * process and provides context for understanding how many review cycles have * been completed to achieve the desired operation quality. * * The step value increments with each major review iteration, allowing * stakeholders to monitor the progressive refinement of API operations and * understand the validation rigor applied to the interface design. */ step: number; } //---------------------------------------- // File: AutoBeInterfaceSchemasEvent.ts //---------------------------------------- import { AutoBeOpenApi } from "../openapi/AutoBeOpenApi"; import { AutoBeEventBase } from "./AutoBeEventBase"; import { AutoBeProgressEventBase } from "./AutoBeProgressEventBase"; import { AutoBeTokenUsageEventBase } from "./AutoBeTokenUsageEventBase"; /** * Event fired when the Interface agent defines schema definitions during the * API specification process. * * This event occurs when the Interface agent is creating the reusable schema * definitions that will be used throughout the API specification. Schema * definitions include data transfer objects (DTOs), request/response schemas, * and other type definitions that provide the structural foundation for API * operations and ensure type safety across the entire application. * * The schema creation process ensures that all data structures used in API * operations are properly defined, validated, and documented, enabling * consistent data handling and robust type checking throughout the generated * application. * * @author Samchon */ export interface AutoBeInterfaceSchemasEvent extends AutoBeEventBase<"interfaceSchemas">, AutoBeProgressEventBase, AutoBeTokenUsageEventBase { /** * Schema definitions being defined for the API specification. * * Contains the schema record that defines reusable schema definitions for the * OpenAPI specification. These schemas serve as the building blocks for API * operations, providing consistent type definitions and ensuring that data * structures are properly validated and documented. * * The schemas maintain perfect alignment with the database schema while * providing the appropriate level of abstraction for API consumers, including * proper validation rules, descriptive documentation, and type safety * throughout the application stack. */ schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>; /** * Iteration number of the requirements analysis this schema creation was * performed for. * * Indicates which version of the requirements analysis this schema design * reflects. This step number ensures that the schema definitions are aligned * with the current requirements and helps track the evolution of data * structures as requirements change. * * The step value enables proper synchronization between schema definitions * and the underlying requirements, ensuring that the API schemas remain * relevant to the current project scope and business objectives. */ step: number; } //---------------------------------------- // File: AutoBeInterfaceSchemasReviewEvent.ts //---------------------------------------- import { AutoBeOpenApi } from "../openapi"; import { AutoBeEventBase } from "./AutoBeEventBase"; import { AutoBeProgressEventBase } from "./AutoBeProgressEventBase"; import { AutoBeTokenUsageEventBase } from "./AutoBeTokenUsageEventBase"; /** * Event fired during the review and improvement phase of OpenAPI schema * generation process. * * This event represents the quality assurance activity of the Interface Schemas * Review Agent, which validates and enhances the OpenAPI schemas produced by * the Interface Schemas Agent. The reviewer ensures that all schemas meet * AutoBE's standards for type safety, completeness, and consistency before * being integrated into the final API specification. * * The Interface Schemas Review Agent performs comprehensive validation * including: * * - Schema completeness verification (all required properties defined) * - Type correctness and consistency across related schemas * - Proper use of OpenAPI schema features (allOf, oneOf, anyOf, etc.) * - Validation rules and constraints appropriateness * - Naming conventions and structural consistency * - Relationship integrity between interconnected schemas * * Review outcomes: * * - **Accept**: Schemas meet all criteria and can be used as-is * - **Improve**: Schemas are enhanced with better type definitions or constraints * - **Correct**: Critical issues are fixed to ensure proper API functionality * * Key characteristics of the review process: * * - Reviews all schemas holistically to ensure consistency * - Enhances schemas with additional validation rules when beneficial * - Ensures compatibility with Prisma models and business requirements * - Validates that schemas properly represent the API's data contracts * * The review ensures that the Interface Agent receives well-structured, * type-safe schemas that accurately represent the application's data models and * enable reliable API endpoint generation. * * @author Kakasoo */ export interface AutoBeInterfaceSchemasReviewEvent extends AutoBeEventBase<"interfaceSchemasReview">, AutoBeProgressEventBase, AutoBeTokenUsageEventBase { /** * Original schemas submitted for review. * * Contains the complete set of OpenAPI schemas generated by the Interface * Schemas Agent, including all data models, request/response types, and * shared definitions that need validation and potential enhancement. */ schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>; /** * Detailed review feedback from the Interface Schemas Review Agent. * * Contains specific validation results including: * * - Schema completeness assessment * - Type safety violations * - Naming convention issues * - Missing or incorrect relationships * - Validation rule recommendations * - Overall quality assessment and improvement suggestions */ review: string; /** * Amendment plan based on the review feedback. * * Outlines specific changes to be made to improve the schemas. If the * original schemas are perfect and require no modifications, this field will * explicitly state that no changes are needed. * * The plan serves as a structured approach to enhance schemas, ensuring all * identified improvements are systematically applied. */ plan: string; /** * Revised schemas based on the amendment plan. * * Contains the fully updated OpenAPI schemas incorporating all review * feedback and improvements. If the original schemas were perfect and * required no changes, this will be identical to the original schemas. * * These revised schemas must pass all validation criteria before being used * for API endpoint generation. */ content: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>; /** * Current iteration number of the schema generation being reviewed. * * Indicates which version of the schemas is undergoing review and * improvement. This step number helps track the iterative refinement process * and provides context for understanding how many revision cycles have been * completed. */ step: number; } //---------------------------------------- // File: AutoBeInterfaceComplementEvent.ts //---------------------------------------- import { AutoBeOpenApi } from "../openapi/AutoBeOpenApi"; import { AutoBeEventBase } from "./AutoBeEventBase"; import { AutoBeTokenUsageEventBase } from "./AutoBeTokenUsageEventBase"; /** * Event fired when the Interface agent supplements missing types and schemas * during the API specification process. * * This event occurs when the Interface agent identifies that additional type * definitions or schema components are needed to complete the API * specification. The complement phase ensures that all necessary types used in * API operations are properly defined, including nested objects, utility types, * and supporting data structures that may have been initially overlooked. * * The complement process is essential for creating complete and self-contained * OpenAPI specifications that can generate fully functional NestJS applications * without missing dependencies or incomplete type definitions. * * @author Samchon */ export interface AutoBeInterfaceComplementEvent extends AutoBeEventBase<"interfaceComplement">, AutoBeTokenUsageEventBase { /** * Array of missing schema names that were identified and need to be defined. * * Contains the list of type or schema names that were referenced in API * operations but were not previously defined in the components section. These * missing definitions could include nested data transfer objects, utility * types, enumeration definitions, or supporting data structures that are * required for complete API functionality. * * Identifying and tracking these missing schemas ensures that the final * OpenAPI specification is complete and self-contained, preventing * compilation errors in the generated code. */ missed: string[]; /** * Additional schema definitions being added to complement the API * specification. * * Contains the newly created schema definitions that fill the gaps identified * in the missed array. Each key represents the schema name and each value * contains the complete {@link AutoBeOpenApi.IJsonSchemaDescriptive} * definition with proper typing, validation rules, and descriptive * documentation. * * These complementary schemas ensure that all types referenced throughout the * API specification are properly defined, enabling successful code generation * and maintaining type safety across the entire application. */ schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>; /** * Iteration number of the requirements analysis this API complement was * performed for. * * Indicates which version of the requirements analysis this schema complement * activity reflects. This step number ensures that the complementary types * are aligned with the current requirements and helps track the evolution of * the API specification as requirements change. * * The step value enables proper synchronization between the API design and * the underlying requirements, ensuring that schema additions remain relevant * to the current project scope and objectives. */ step: number; } //---------------------------------------- // File: AutoBeInterfaceCompleteEvent.ts //---------------------------------------- import { AutoBeInterfaceAuthorization } from "../histories"; import { AutoBeOpenApi } from "../openapi/AutoBeOpenApi"; import { AutoBeEventBase } from "./AutoBeEventBase"; /** * Event fired when the Interface agent completes the RESTful API design process * and generates the complete NestJS application. * * This event represents the successful completion of the sophisticated * multi-stage transformation pipeline that converts validated AST structures * into comprehensive API specifications and production-ready NestJS code. The * completion marks the transition from API design to implementation-ready * artifacts that maintain perfect alignment with business requirements and * database schemas. * * The Interface agent's completion ensures that API designs are syntactically * perfect and semantically aligned with business requirements, ready for * immediate deployment or further customization in the development workflow. * * @author Samchon */ export interface AutoBeInterfaceCompleteEvent extends AutoBeEventBase<"interfaceComplete"> { /** * The complete OpenAPI document containing the finalized API specification. * * Contains the validated {@link AutoBeOpenApi.IDocument} AST structure that * defines all API endpoints, operations, schemas, and business logic. This * document represents the culmination of the API design process, * incorporating comprehensive business logic integration, type safety bridges * with Prisma schemas, and security pattern validation. * * The document serves as the authoritative API specification that has been * converted from the internal AST format to formal OpenAPI standards, ready * for code generation and integration with the broader development * ecosystem. */ document: AutoBeOpenApi.IDocument; /** * JWT-based authentication and authorization operations generated for each * user role. * * Contains role-specific authentication API operations including essential * flows (join, login, validate, changePassword, refresh) plus additional * operations based on Prisma schema capabilities like email verification and * password reset. These operations are generated by analyzing the database * schema to determine which authentication features are supported for each * role. */ authorizations: AutoBeInterfaceAuthorization[]; /** * Iteration number of the requirements analysis this API design was completed * for. * * Indicates which version of the requirements analysis this API design * reflects. If this value is lower than the current * {@link AutoBeAnalyzeCompleteEvent.step}, it means the API design may not * reflect the latest requirements and could need regeneration. * * The step value ensures proper synchronization between API specifications * and the underlying requirements, enabling stakeholders to understand the * currency of the API design relative to evolving project requirements. */ step: number; /** * Elapsed time in milliseconds for the entire API design process. * * Indicates the total time taken to complete the API design process from the * start of requirements analysis through to the final API specification * generation. This metric helps in understanding the efficiency of the API * design phase and can be used for process improvement analysis. * * This elapsed time includes all stages of the API design process, from * initial requirements gathering, through business logic integration, to the * final generation of the OpenAPI document. It serves as a performance * indicator for the Interface agent's design capabilities and the overall * efficiency of the API design workflow. */ elapsed: number; }

Interface events track the RESTful API design process.

When @autobe designs RESTful APIs, it first fires the AutoBeInterfaceStartEvent event to signal the start of the interface agent. Then it triggers the AutoBeInterfaceEndpointsEvent event to create the API endpoint list, followed by AutoBeInterfaceOperationsEvent which defines the role of each API function and AutoBeInterfaceSchemasEvent which defines the types they use. Additionally, the AutoBeInterfaceComplementEvent event may be fired to supplement any missing types used in API operations or to provide necessary types as nested objects.

Finally, when all API design is complete, the AutoBeInterfaceCompleteEvent event is fired.

AutoBeInterfaceCompleteEvent is generated when the RESTful API design is completed based on the previous requirements analysis report and database design.

@autobe constructs data of type AutoBeOpenApi.IDocument through AI function calling, validates it, and stores it in the document property. This is then converted to a formal OpenAPI document (OpenApi.IDocument), and NestJS API controllers, DTOs, and e2e test code are generated (code generation), with the results stored in the files property.

The step property indicates which requirements analysis report iteration the API design was performed for. If the AutoBeInterfaceCompleteEvent.step value is lower than AutoBeAnalyzeCompleteEvent.step, it means the API design has not yet been updated to reflect the latest requirements.

Test Events

@autobe/interface
//---------------------------------------- // File: AutoBeTestStartEvent.ts //---------------------------------------- import { AutoBeEventBase } from "./AutoBeEventBase"; /** * Event fired when the Test agent begins the e2e test code generation process. * * This event marks the initiation of comprehensive test suite creation based on * the previous requirements analysis, database design, and RESTful API * specification. The Test agent start represents the beginning of the * validation layer development that ensures the generated application functions * correctly under realistic operational conditions and properly implements * business requirements. * * The test generation process that begins with this event will conceive * multiple use case scenarios for each API endpoint and implement them as test * programs, providing thorough coverage of both technical functionality and * business logic validation throughout the application ecosystem. * * @author Samchon */ export interface AutoBeTestStartEvent extends AutoBeEventBase<"testStart"> { /** * Reason why the Test agent was activated through function calling. * * Explains the specific circumstances that triggered the AI chatbot to invoke * the Test agent via function calling. This could include reasons such as * initial test suite generation after API specification completion, updating * test scenarios due to API changes, regenerating tests to reflect modified * business requirements or database schemas, or creating additional test * coverage for new functionality. * * Understanding the activation reason provides context for the test * generation scope and helps stakeholders understand whether this represents * initial test development, refinement of existing test scenarios, or * expansion of validation coverage. */ reason: string; /** * Iteration number of the requirements analysis this test generation is being * started for. * * Indicates which version of the requirements analysis this test suite will * validate. This step number ensures that the Test agent works with the * current requirements and helps track the evolution of test scenarios as * business requirements, database schemas, and API specifications change. * * The step value enables proper synchronization between test generation * activities and the underlying requirements, ensuring that the test suite * remains aligned with the current project scope and validation objectives * throughout the iterative development process. */ step: number; } //---------------------------------------- // File: AutoBeTestScenariosEvent.ts //---------------------------------------- import { AutoBeTestScenario } from "../histories"; import { AutoBeEventBase } from "./AutoBeEventBase"; import { AutoBeProgressEventBase } from "./AutoBeProgressEventBase"; import { AutoBeTokenUsageEventBase } from "./AutoBeTokenUsageEventBase"; /** * Event fired when the Test agent generates e2e test scenarios for specific API * endpoints. * * This event occurs when the Test agent analyzes API endpoints and creates test * scenarios that include the main function to test and any dependency functions * that need to be called first. The event provides visibility into the test * generation progress and the structure of generated test cases. * * Each scenario includes draft test code and a clear dependency chain that * ensures tests can execute successfully with proper data setup and * prerequisites. * * @author Kakasoo */ export interface AutoBeTestScenariosEvent extends AutoBeEventBase<"testScenarios">, AutoBeProgressEventBase, AutoBeTokenUsageEventBase { /** * List of test scenarios generated for the target endpoints. * * Each scenario contains the endpoint to test, generated test code draft, and * any dependency functions that must be called before the main test. The * scenarios represent complete test cases ready for compilation and * execution. */ scenarios: AutoBeTestScenario[]; /** * Current step in the test generation workflow. * * Tracks progress through the test creation process, helping coordinate with * other pipeline stages and maintain synchronization with the current * requirements iteration. */ step: number; } //---------------------------------------- // File: AutoBeTestWriteEvent.ts //---------------------------------------- import { AutoBeEventBase } from "./AutoBeEventBase"; import { AutoBeProgressEventBase } from "./AutoBeProgressEventBase"; import { AutoBeTokenUsageEventBase } from "./AutoBeTokenUsageEventBase"; /** * Event fired when the Test agent writes and completes individual test scenario * files. * * This event provides real-time visibility into the test file creation process * as the Test agent systematically writes test scenarios for each API endpoint. * Each write event represents the completion of a specific test file that * implements use case scenarios, ensuring comprehensive coverage of API * functionality and business logic validation. * * The write events enable stakeholders to monitor the test suite development * and understand how comprehensive validation coverage is being built to ensure * the generated application functions correctly under realistic operational * conditions and properly implements business requirements. * * @author Michael */ export interface AutoBeTestWriteEvent extends AutoBeEventBase<"testWrite">, AutoBeProgressEventBase, AutoBeTokenUsageEventBase { /** * File system path where the test file should be located. * * Specifies the relative or absolute path for the test file within the * project structure. This location typically follows testing conventions and * may be organized by API endpoints, feature modules, or business domains to * ensure logical test suite organization and easy navigation. * * Example: "test/features/api/order/test_api_shopping_order_publish.ts" */ location: string; /** * Test scenario description and implementation strategy. * * Detailed explanation of the business scenario to be tested, including * step-by-step execution plan and test methodology. */ scenario: string; /** * Functional domain category for test organization. * * Primary API resource domain (e.g., "user", "article", "payment") used for * file structure and logical test grouping. */ domain: string; /** * Initial test code implementation. * * First working version of the TypeScript E2E test function, implementing the * complete business scenario with proper types and SDK usage. */ draft: string; /** * Code review feedback and improvement suggestions. * * Quality assessment results identifying issues, best practice violations, * and specific recommendations for code refinement. */ review?: string; /** * Final production-ready test code. * * Polished implementation incorporating all review feedback, ready for * deployment in the actual test suite. */ final?: string; /** * Iteration number of the requirements analysis this test writing reflects. * * Indicates which version of the requirements analysis this test file * creation work is based on. This step number ensures that the test scenarios * are aligned with the current requirements and helps track the development * of validation coverage as business requirements and API specifications * evolve. * * The step value enables proper synchronization between test writing * activities and the underlying requirements, ensuring that the test suite * remains relevant to the current project scope and validation objectives. */ step: number; } //---------------------------------------- // File: AutoBeTestValidateEvent.ts //---------------------------------------- import { IAutoBeTypeScriptCompileResult } from "../compiler"; import { AutoBeTestFile } from "../histories"; import { AutoBeEventBase } from "./AutoBeEventBase"; /** * Event fired when the Test agent validates the generated test code using the * embedded TypeScript compiler. * * This event occurs when the Test agent submits a generated test file to the * TypeScript compiler for validation, ensuring that the test code compiles * correctly and integrates properly with the API specifications and database * schemas. The validation process serves as a quality gate that ensures test * scenarios are syntactically correct and semantically valid. * * The validation results determine whether the test generation process can * proceed to completion or whether correction feedback is needed to resolve * compilation issues and improve test code quality through the iterative * self-correction mechanism. * * @author Michael */ export interface AutoBeTestValidateEvent extends AutoBeEventBase<"testValidate"> { /** * Test file that is being validated or contained compilation errors with its * detailed scenario metadata. * * Contains the structured test file object that is undergoing validation or * failed compilation. The file includes its location, source code content, * and associated scenario information that provides context for understanding * any compilation issues. This file serves as a comprehensive baseline for * measuring the effectiveness of the correction process. * * Unlike simple key-value pairs, this structure preserves the rich metadata * about the test scenario, enabling better analysis of what specific test * patterns or business logic implementations led to compilation failures and * how they can be systematically improved. */ file: AutoBeTestFile; /** * Compilation result indicating success, failure, or exception during * validation. * * Contains the complete {@link IAutoBeTypeScriptCompileResult} from the * validation process, which can be: * * - {@link IAutoBeTypeScriptCompileResult.ISuccess} for successful compilation * - {@link IAutoBeTypeScriptCompileResult.IFailure} for compilation errors * - {@link IAutoBeTypeScriptCompileResult.IException} for unexpected runtime * errors * * Success results indicate that the test suite is ready for completion, while * failure or exception results trigger the correction feedback loop to * improve test code quality and resolve integration issues with the * application architecture. */ result: IAutoBeTypeScriptCompileResult; /** * Iteration number of the requirements analysis this test validation was * performed for. * * Indicates which version of the requirements analysis this test validation * reflects. This step number ensures that the validation process is aligned * with the current requirements and helps track the quality assurance process * as test scenarios are validated and refined. * * The step value enables proper synchronization between validation activities * and the underlying requirements, ensuring that test validation efforts * remain relevant to the current project scope and validation objectives. */ step: number; } //---------------------------------------- // File: AutoBeTestCorrectEvent.ts //---------------------------------------- import { IAutoBeTypeScriptCompileResult } from "../compiler"; import { AutoBeTestFile } from "../histories"; import { AutoBeEventBase } from "./AutoBeEventBase"; import { AutoBeTokenUsageEventBase } from "./AutoBeTokenUsageEventBase"; /** * Event fired when the Test agent corrects compilation failures in the * generated test code through the AI self-correction feedback process. * * This event occurs when the embedded TypeScript compiler detects compilation * errors in the test code and the Test agent receives detailed error feedback * to correct the issues. The correction process demonstrates the sophisticated * feedback loop that enables AI to learn from compilation errors and improve * test code quality iteratively. * * The correction mechanism ensures that test code not only compiles * successfully but also properly validates API functionality while maintaining * consistency with the established API contracts and business requirements. * * @author Samchon */ export interface AutoBeTestCorrectEvent extends AutoBeEventBase<"testCorrect">, AutoBeTokenUsageEventBase { /** * The test file that contained compilation errors with its detailed scenario * metadata. * * Contains the structured test file object that failed compilation before * correction. The file includes its location, problematic source code * content, and associated scenario information that provides context for * understanding the compilation issues. This file serves as a comprehensive * baseline for measuring the effectiveness of the correction process. * * Unlike simple key-value pairs, this structure preserves the rich metadata * about the test scenario, enabling better analysis of what specific test * patterns or business logic implementations led to compilation failures and * how they can be systematically improved. */ file: AutoBeTestFile; /** * The compilation failure details that triggered the correction process. * * Contains the specific {@link IAutoBeTypeScriptCompileResult.IFailure} * information describing the compilation errors that were detected in the * test code. This includes error messages, file locations, type issues, or * other compilation problems that prevented successful test code validation. * * The failure information provides the diagnostic foundation for the AI's * understanding of what went wrong and guides the correction strategy. */ result: IAutoBeTypeScriptCompileResult.IFailure; /** * AI's deep compilation error analysis and correction strategy. * * Contains the AI's comprehensive analysis of compilation errors and the * strategic approach for resolving them. This analysis examines each error * message to understand root causes, identifies error patterns, and develops * targeted correction strategies while maintaining the original test * purpose. * * The AI correlates compilation diagnostics with business requirements to * ensure that error corrections preserve the intended functionality. This * deep analysis forms the foundation for all subsequent correction efforts, * demonstrating the AI's ability to understand complex type errors and * develop systematic solutions. */ think: string; /** * The first corrected version of the test code addressing compilation errors. * * Contains the AI's initial attempt to fix the compilation issues while * preserving the original business logic and test workflow. This draft * represents the direct application of error correction strategies identified * during the analysis phase. * * The draft code demonstrates the AI's approach to resolving TypeScript * compilation errors while maintaining the intended test functionality and * following established conventions. */ draft: string; /** * AI's comprehensive review and validation of the corrected draft code. * * Contains the AI's evaluation of the draft implementation, examining both * technical correctness and business logic preservation. This review process * identifies any remaining issues and validates that compilation errors have * been properly resolved. * * The review provides insight into the AI's quality assurance process and * helps stakeholders understand how the correction maintains test integrity. */ review?: string; /** * The final production-ready corrected test code. * * Contains the polished version of the corrected test code that incorporates * all review feedback and validation results. This represents the completed * error correction process, guaranteed to compile successfully while * preserving all original test functionality. * * The final implementation serves as the definitive solution that replaces * the compilation-failed code and demonstrates the AI's ability to learn from * errors and produce high-quality test code. */ final?: string; /** * Iteration number of the requirements analysis this test correction was * performed for. * * Indicates which version of the requirements analysis this test correction * reflects. This step number ensures that the correction efforts are aligned * with the current requirements and helps track the quality improvement * process as compilation issues are resolved through iterative feedback. * * The step value enables proper synchronization between test correction * activities and the underlying requirements, ensuring that test improvements * remain relevant to the current project scope and validation objectives. */ step: number; } //---------------------------------------- // File: AutoBeTestCompleteEvent.ts //---------------------------------------- import { IAutoBeTypeScriptCompileResult } from "../compiler/IAutoBeTypeScriptCompileResult"; import { AutoBeTestFile } from "../histories"; import { AutoBeEventBase } from "./AutoBeEventBase"; /** * Event fired when the Test agent completes the e2e test code generation * process for all API endpoints and scenarios. * * This event represents the successful completion of comprehensive test suite * creation that validates both technical functionality and business rule * implementation across all API operations. The Test agent's completion ensures * that every API endpoint has multiple use case scenarios implemented as test * programs that provide thorough coverage of the application functionality. * * The completion of test generation creates a robust validation framework that * ensures the generated APIs work correctly under realistic operational * conditions and properly implement all business requirements established in * the analysis phase. * * @author Samchon */ export interface AutoBeTestCompleteEvent extends AutoBeEventBase<"testComplete"> { /** * Generated e2e test files as key-value pairs representing the complete test * suite. * * Contains the final set of TypeScript test files with each key representing * the file path and each value containing the actual test code. Each test * file includes standalone functions that implement specific use case * scenarios for API endpoints, providing comprehensive end-to-end testing * coverage that validates both technical functionality and business logic * implementation. * * The test files are designed to work under realistic operational conditions, * ensuring that the generated APIs not only compile and execute correctly but * also properly implement the business requirements and handle edge cases * appropriately. These tests serve as both validation tools and documentation * of expected system behavior. */ files: AutoBeTestFile[]; /** * Results of compiling the generated e2e test TypeScript files through the * TypeScript compiler. * * Contains the {@link IAutoBeTypeScriptCompileResult} from processing the * generated test files through the TypeScript compilation pipeline. This * compilation result validates test code syntax, type safety, framework * integration, and dependency resolution to ensure that all generated test * scenarios are syntactically correct and ready for execution. * * Through the Test agent's internal compiler feedback process, this result is * typically successful as the agent iteratively refines the generated code * based on compilation diagnostics. However, in rare cases where the compiler * feedback iteration limit is exceeded, the result may indicate failure * despite the agent's correction attempts. Such failure occurrences are * extremely infrequent due to the sophisticated feedback mechanisms built * into the Test agent's code generation process. * * Successful compilation indicates that the generated test suite is * production-ready and can be executed immediately to validate the * corresponding API implementations without any syntax or integration * issues. */ compiled: IAutoBeTypeScriptCompileResult; /** * Final iteration number of the requirements analysis this test suite was * completed for. * * Indicates which version of the requirements analysis this test suite * reflects, representing the synchronization point between test scenarios and * business requirements. This step number confirms that the completed test * suite validates the latest requirements and incorporates all API * specifications and database design decisions from the current development * iteration. * * The step value serves as the definitive reference for the test coverage * scope, ensuring that all stakeholders understand which requirements version * has been comprehensively validated through the generated test scenarios. */ step: number; /** * Elapsed time in milliseconds for the entire test generation process. * * Indicates the total time taken to complete the test generation process from * the start of requirements analysis through to the final test suite * generation. This metric helps in understanding the efficiency of the test * generation phase and can be used for process improvement analysis. * * This elapsed time provides insights into the complexity of the test * scenarios generated, the number of API endpoints covered, and the * thoroughness of the business logic validation implemented in the test * suite. It serves as a performance metric for the Test agent's code * generation capabilities and the overall efficiency of the test generation * workflow. * * This elapsed time is same with the difference between the timestamps * recorded in the `created_at` field of the `AutoBeTestStartEvent` and this * event. */ elapsed: number; }

Test events monitor the e2e test code generation process.

When @autobe writes e2e test code, it first fires the AutoBeTestStartEvent event to signal the start of the test agent. Then it triggers the AutoBeTestScenariosEvent event to create test scenarios. Subsequently, it writes each scenario in TypeScript code and fires AutoBeTestWriteEvent events to report the progress of test code writing.

Next, the AutoBeTestValidateEvent event is triggered to validate the written test code using the TypeScript compiler. If compilation fails, the AutoBeTestCorrectEvent event is fired to provide feedback to the AI for fixing compilation errors. The AutoBeTestValidateEvent event is then triggered again, repeating this cycle.

Once all test code writing is complete, the AutoBeTestCompleteEvent event is fired.

AutoBeTestCompleteEvent is generated when e2e test code is written based on the previous requirements analysis, database design, and RESTful API specification.

@autobe conceives multiple use case scenarios for each API endpoint and implements them as test programs. These test programs are composed of one TypeScript file and a standalone function for each scenario, stored in the files property. These are then built using the TypeScript compiler embedded in @autobe, with the results stored in the compiled property.

When the AI occasionally writes incorrect TypeScript code, @autobe provides compilation error messages as feedback, allowing the AI to self-correct. This feedback process usually works correctly, so test code written by AI almost always compiles successfully. However, when using very small AI models, the IAutoBeTypeScriptCompileResult result might have success := false.

The step property indicates which requirements analysis report iteration the test code was written for. If the AutoBeTestCompleteEvent.step value is lower than AutoBeAnalyzeCompleteEvent.step, it means the test code has not yet been updated to reflect the latest requirements.

Realize Events

Not implemented yet.

Last updated on