Setup
npm
npm install @autobe/agent @autobe/compiler @autobe/interface
npm install @autobe/rpc tgrid
pnpm
pnpm install @autobe/agent @autobe/compiler @autobe/interface
pnpm install @autobe/rpc tgrid
yarn
yarn add @autobe/agent @autobe/compiler @autobe/interface
yarn add @autobe/rpc tgrid
To develop NodeJS WebSocket server of @autobe
, you need to install these packages.
At first, install @autobe/agent
, @autobe/compiler
and @autobe/interface
packages, which are required for chatbot. And then, install @autobe/rpc
and tgrid
packages.
tgrid
is a TypeScript based RPC (Remote Procedure Call) framework supporting WebSocket protocol, and @autobe/rpc
is a wrapper module of @autobe/agent
following the WebSocket RPC.
Development
Main Program
import { AutoBeAgent } from "@autobe/agent";
import { AutoBeCompiler } from "@autobe/compiler";
import { IAutoBeRpcListener, IAutoBeRpcService } from "@autobe/interface";
import { AutoBeRpcService } from "@autobe/rpc";
import OpenAI from "openai";
import { WebSocketServer } from "tgrid";
const server: WebSocketServer<null, IAutoBeRpcService, IAutoBeRpcListener> =
new WebSocketServer();
await server.open(3_001, async (acceptor) => {
const agent: AutoBeAgent<"chatgpt"> = new AutoBeAgent({
model: "chatgpt",
vendor: {
api: new OpenAI({ apiKey: "********" }),
model: "gpt-4.1",
},
compiler: new AutoBeCompiler(),
});
const service: AutoBeRpcService<"chatgpt"> = new AutoBeRpcService({
agent,
listener: acceptor.getDriver(),
});
await acceptor.accept(service);
});
undefined
import { AutoBeHistory } from "../histories/AutoBeHistory";
import { AutoBeUserMessageContent } from "../histories/contents/AutoBeUserMessageContent";
import { IAutoBeTokenUsageJson } from "../json/IAutoBeTokenUsageJson";
import { IAutoBeGetFilesOptions } from "./IAutoBeGetFilesOptions";
/**
* Interface representing the WebSocket RPC service provided by the vibe coding
* server to client applications.
*
* This interface defines the remote procedure call functions that client
* applications can invoke on the vibe coding server through WebSocket
* connections. The service enables interactive conversation-driven development
* where users can communicate requirements through multiple modalities and
* receive comprehensive development artifacts as responses.
*
* In TGrid's RPC paradigm, this service acts as the Provider that the server
* exposes to clients, allowing remote function calls that drive the entire vibe
* coding pipeline from requirements gathering through final implementation.
* Client applications obtain a `Driver<IAutoBeRpcService>` instance to call
* these functions remotely while receiving real-time progress events through
* the {@link IAutoBeRpcListener}.
*
* @author Samchon
*/
export interface IAutoBeRpcService {
/**
* Initiates or continues conversation with the vibe coding AI assistant.
*
* Accepts user input in various formats including simple text, single content
* items, or arrays of multimodal content (text, images, files, audio). The
* conversation drives the entire vibe coding process, with the AI assistant
* analyzing requirements, making decisions about which development phases to
* execute, and coordinating the automated development pipeline.
*
* This function returns the complete history of events generated during the
* conversation turn, allowing clients to access both the conversation flow
* and any development artifacts produced. Real-time progress events are
* delivered separately through the {@link IAutoBeRpcListener} interface for
* responsive user experience.
*
* @param content User input content supporting text strings, single content
* items, or arrays of multimodal content elements
* @returns Promise resolving to array of history records representing all
* events and artifacts generated during this conversation turn
*/
conversate(
content: string | AutoBeUserMessageContent | AutoBeUserMessageContent[],
): Promise<AutoBeHistory[]>;
/**
* Retrieves all generated files from the current development session.
*
* Transforms the complete conversation-driven development process into a
* comprehensive collection of deployable artifacts, including requirements
* documentation, database schemas, API specifications, NestJS implementation
* code, and test suites. The generated files represent a fully functional
* backend application ready for immediate deployment or further
* customization.
*
* The method produces a meticulously organized project structure that
* reflects professional software development standards. Requirements analysis
* documents capture and formalize your conversational input into structured
* technical specifications, providing clear traceability from user intent to
* final implementation. Database artifacts include Prisma schemas with
* precise type definitions, relationships, and constraints, along with
* migration files for proper database initialization and evolution.
*
* The API layer emerges through comprehensive OpenAPI specifications
* documenting every endpoint, request format, response structure, and error
* condition. Generated NestJS controllers, DTOs, and service classes
* implement these specifications with TypeScript's strong typing system
* providing compile-time safety. Quality assurance is embedded throughout
* with complete test suites covering both unit and end-to-end scenarios.
*
* The database configuration specified through the `dbms` option
* fundamentally shapes the entire generated codebase. PostgreSQL
* configuration produces production-ready code with robust connection pooling
* and enterprise-grade optimizations, while SQLite generates lightweight code
* perfect for local development and rapid prototyping without external
* dependencies.
*
* All artifacts maintain perfect consistency across the chosen database
* system, from Prisma configurations and connection strings to Docker compose
* files and environment templates. This deep integration ensures immediate
* deployment compatibility without manual configuration adjustments.
*
* @param options Configuration specifying the target database management
* system and other code generation preferences that influence the structure
* and characteristics of the generated project files
* @returns Promise resolving to key-value pairs mapping logical file paths to
* complete file contents for all generated development artifacts, ready for
* immediate file system operations, build integration, or deployment
* workflows
*/
getFiles(
options?: Partial<IAutoBeGetFilesOptions>,
): Promise<Record<string, string>>;
/**
* Retrieves the complete conversation and development history.
*
* Returns the full chronological record of all events that occurred during
* the vibe coding session including user messages, assistant responses,
* development phase activities, and completion events. This comprehensive
* history enables conversation replay, progress analysis, and understanding
* of the development decision-making process.
*
* The history includes both message-level interactions and development-level
* events, providing complete transparency into how user requirements were
* transformed into working software through the vibe coding pipeline.
*
* @returns Promise resolving to chronologically ordered array of all history
* records from the current session
*/
getHistories(): Promise<AutoBeHistory[]>;
/**
* Retrieves comprehensive token usage statistics for the current session.
*
* Returns detailed breakdown of AI token consumption across all agents and
* processing phases, enabling cost monitoring, performance analysis, and
* optimization of AI resource utilization. The statistics include both
* aggregate totals and component-specific breakdowns with input/output
* categorization and caching analysis.
*
* Token usage data is essential for understanding the computational costs of
* the vibe coding process and optimizing AI efficiency while maintaining
* high-quality output across requirements analysis, database design, API
* specification, testing, and implementation phases.
*
* @returns Promise resolving to comprehensive token usage statistics with
* detailed breakdowns by agent, operation type, and usage category
*/
getTokenUsage(): Promise<IAutoBeTokenUsageJson>;
}
undefined
import {
AutoBeAnalyzeCompleteEvent,
AutoBeAnalyzeReviewEvent,
AutoBeAnalyzeStartEvent,
AutoBeAnalyzeWriteEvent,
AutoBeAssistantMessageEvent,
AutoBeInterfaceComplementEvent,
AutoBeInterfaceCompleteEvent,
AutoBeInterfaceComponentsEvent,
AutoBeInterfaceEndpointsEvent,
AutoBeInterfaceOperationsEvent,
AutoBeInterfaceStartEvent,
AutoBePrismaCompleteEvent,
AutoBePrismaComponentsEvent,
AutoBePrismaCorrectEvent,
AutoBePrismaSchemasEvent,
AutoBePrismaStartEvent,
AutoBePrismaValidateEvent,
AutoBeRealizeCompleteEvent,
AutoBeRealizeProgressEvent,
AutoBeRealizeStartEvent,
AutoBeRealizeValidateEvent,
AutoBeTestCompleteEvent,
AutoBeTestCorrectEvent,
AutoBeTestStartEvent,
AutoBeTestValidateEvent,
AutoBeTestWriteEvent,
AutoBeUserMessageEvent,
} from "../events";
import { AutoBeTestScenarioEvent } from "../events/AutoBeTestScenarioEvent";
/**
* Interface for WebSocket RPC event listener provided by client applications to
* receive real-time events from the vibe coding server.
*
* This interface defines the event handling contract for client applications
* that connect to the vibe coding WebSocket server. Client applications provide
* an implementation of this interface to receive real-time notifications about
* conversation flow, development progress, and completion events throughout the
* automated development pipeline.
*
* The listener functions enable client applications to provide interactive user
* experiences, display progress indicators, handle development artifacts, and
* respond to the dynamic nature of the vibe coding process. Only
* {@link assistantMessage} and completion events are mandatory, while progress
* events are optional but recommended for enhanced user experience.
*
* @author Samchon
*/
export interface IAutoBeRpcListener {
/* -----------------------------------------------------------
MESSAGES
----------------------------------------------------------- */
/**
* Mandatory handler for assistant message events during conversation flow.
*
* Called when the AI assistant sends messages to the user, providing
* responses, explanations, progress updates, and guidance throughout the vibe
* coding workflow. This is a core communication channel that keeps users
* informed about ongoing activities and system responses.
*/
assistantMessage(event: AutoBeAssistantMessageEvent): Promise<void>;
/**
* Optional handler for user message events during conversation flow.
*
* Called when user messages are processed, allowing client applications to
* track conversation history and provide enhanced user interface features
* such as message confirmation or conversation replay capabilities.
*/
userMessage?(event: AutoBeUserMessageEvent): Promise<void>;
/* -----------------------------------------------------------
ANALYZE PHASE EVENTS
----------------------------------------------------------- */
/**
* Optional handler for requirements analysis start events.
*
* Called when the Analyze agent begins drafting the requirements analysis,
* enabling client applications to show analysis phase initiation and prepare
* progress indicators for the requirements documentation process.
*/
analyzeStart?(event: AutoBeAnalyzeStartEvent): Promise<void>;
/**
* Optional handler for requirements analysis writing progress events.
*
* Called during the writing phase as analysis documents are being created,
* allowing client applications to display real-time progress and provide
* visibility into the document generation process.
*/
analyzeWrite?(event: AutoBeAnalyzeWriteEvent): Promise<void>;
/**
* Optional handler for requirements analysis review events.
*
* Called during the review and amendment phase, enabling client applications
* to show that requirements are being refined and improved based on feedback
* and additional analysis.
*/
analyzeReview?(event: AutoBeAnalyzeReviewEvent): Promise<void>;
/**
* Mandatory handler for requirements analysis completion events.
*
* Called when the analysis phase completes successfully, providing the
* finalized requirements documentation that serves as the foundation for all
* subsequent development phases. Client applications must handle this event
* to receive the completed analysis artifacts.
*/
analyzeComplete?(event: AutoBeAnalyzeCompleteEvent): Promise<void>;
/* -----------------------------------------------------------
PRISMA PHASE EVENTS
----------------------------------------------------------- */
/**
* Optional handler for database design start events.
*
* Called when the Prisma agent begins database schema design, enabling client
* applications to indicate the start of data architecture development and
* prepare progress tracking for the database design phase.
*/
prismaStart?(event: AutoBePrismaStartEvent): Promise<void>;
/**
* Optional handler for database component organization events.
*
* Called when tables are organized into categorized groups by business
* domain, allowing client applications to display the structural planning of
* the database architecture and show progress scope.
*/
prismaComponents?(event: AutoBePrismaComponentsEvent): Promise<void>;
/**
* Optional handler for database schema creation progress events.
*
* Called each time a domain-specific schema file is completed, enabling
* client applications to track incremental progress and show which business
* areas have been fully designed.
*/
prismaSchemas?(event: AutoBePrismaSchemasEvent): Promise<void>;
/**
* Optional handler for database schema validation events.
*
* Called when validation failures occur during schema compilation, allowing
* client applications to inform users about quality assurance processes and
* potential correction activities.
*/
prismaValidate?(event: AutoBePrismaValidateEvent): Promise<void>;
/**
* Optional handler for database schema correction events.
*
* Called when the AI self-correction process addresses validation failures,
* enabling client applications to show that issues are being resolved
* automatically through the feedback loop mechanism.
*/
prismaCorrect?(event: AutoBePrismaCorrectEvent): Promise<void>;
/**
* Mandatory handler for database design completion events.
*
* Called when the Prisma phase completes successfully, providing the
* validated database schemas and compilation results. Client applications
* must handle this event to receive the completed database artifacts.
*/
prismaComplete?(event: AutoBePrismaCompleteEvent): Promise<void>;
/* -----------------------------------------------------------
INTERFACE PHASE EVENTS
----------------------------------------------------------- */
/**
* Optional handler for API design start events.
*
* Called when the Interface agent begins RESTful API specification design,
* enabling client applications to indicate the start of API development and
* prepare progress tracking for the interface design phase.
*/
interfaceStart?(event: AutoBeInterfaceStartEvent): Promise<void>;
/**
* Optional handler for API endpoint creation events.
*
* Called when the complete list of API endpoints is established, allowing
* client applications to show the API surface area scope and architectural
* foundation being built.
*/
interfaceEndpoints?(event: AutoBeInterfaceEndpointsEvent): Promise<void>;
/**
* Optional handler for API operation definition progress events.
*
* Called as detailed operation specifications are created for each endpoint,
* enabling client applications to track progress and show how API
* functionality is being systematically developed.
*/
interfaceOperations?(event: AutoBeInterfaceOperationsEvent): Promise<void>;
/**
* Optional handler for API component schema creation events.
*
* Called when reusable schema components are being defined, allowing client
* applications to show progress in type definition and data structure
* development for the API specification.
*/
interfaceComponents?(event: AutoBeInterfaceComponentsEvent): Promise<void>;
/**
* Optional handler for API schema complement events.
*
* Called when missing schemas are identified and added to complete the
* specification, enabling client applications to show that gaps are being
* filled to ensure comprehensive API coverage.
*/
interfaceComplement?(event: AutoBeInterfaceComplementEvent): Promise<void>;
/**
* Mandatory handler for API design completion events.
*
* Called when the Interface phase completes successfully, providing the
* complete OpenAPI specification and generated NestJS application files.
* Client applications must handle this event to receive the completed API
* artifacts.
*/
interfaceComplete?(event: AutoBeInterfaceCompleteEvent): Promise<void>;
/* -----------------------------------------------------------
TEST PHASE EVENTS
----------------------------------------------------------- */
/**
* Optional handler for test suite generation start events.
*
* Called when the Test agent begins creating e2e test scenarios, enabling
* client applications to indicate the start of test development and prepare
* progress tracking for comprehensive validation coverage.
*/
testStart?(event: AutoBeTestStartEvent): Promise<void>;
/**
* Optional handler for test scenario planning events.
*
* Called when test scenarios are being planned and organized, allowing client
* applications to show the scope of validation coverage being designed for
* the application.
*/
testScenario?(event: AutoBeTestScenarioEvent): Promise<void>;
/**
* Optional handler for test code generation progress events.
*
* Called as individual test files are created, enabling client applications
* to track incremental progress and show which API endpoints are being
* validated through comprehensive test scenarios.
*/
testWrite?(event: AutoBeTestWriteEvent): Promise<void>;
/**
* Optional handler for test code validation events.
*
* Called when test code undergoes TypeScript compilation validation, allowing
* client applications to show quality assurance processes and potential
* correction activities for test code.
*/
testValidate?(event: AutoBeTestValidateEvent): Promise<void>;
/**
* Optional handler for test code correction events.
*
* Called when the AI self-correction process addresses compilation failures
* in test code, enabling client applications to show that issues are being
* resolved automatically through iterative improvement.
*/
testCorrect?(event: AutoBeTestCorrectEvent): Promise<void>;
/**
* Mandatory handler for test suite completion events.
*
* Called when the Test phase completes successfully, providing the complete
* test suite with comprehensive validation coverage. Client applications must
* handle this event to receive the completed test artifacts.
*/
testComplete?(event: AutoBeTestCompleteEvent): Promise<void>;
/* -----------------------------------------------------------
REALIZE PHASE EVENTS
----------------------------------------------------------- */
/**
* Optional handler for implementation start events.
*
* Called when the Realize agent begins implementing business logic and
* service layer code, enabling client applications to indicate the start of
* the final implementation phase.
*/
realizeStart?(event: AutoBeRealizeStartEvent): Promise<void>;
/**
* Optional handler for implementation progress events.
*
* Called as individual implementation files are created, enabling client
* applications to track incremental progress and show how the complete
* application functionality is being assembled.
*/
realizeProgress?(event: AutoBeRealizeProgressEvent): Promise<void>;
/**
* Optional handler for implementation validation events.
*
* Called when implementation code undergoes compilation validation, allowing
* client applications to show quality assurance processes and potential
* correction activities for the final implementation.
*/
realizeValidate?(event: AutoBeRealizeValidateEvent): Promise<void>;
/**
* Mandatory handler for implementation completion events.
*
* Called when the Realize phase completes successfully, providing the
* complete working application implementation. Client applications must
* handle this event to receive the final implementation artifacts that
* represent the culmination of the entire vibe coding pipeline.
*/
realizeComplete?(event: AutoBeRealizeCompleteEvent): Promise<void>;
}
You can develop WebSocket server application like above.
At first, create an WebSocketServer
instance with IAutoBeRpcService
and IAutoBeRpcListener
type specifiactions, and open the server with a port number and a callback function that is called whenever a client is connected.
And in the callback function, create an AutoBeAgent
instance and wrap it into a new AutoBeRpcService
instance. And then accept the client connection by calling the WebSocketAcceptor.accept()
function with the AutoBeRpcService
instance.
When you’ve completed the acceptance, everything is completed. When client calls the IAutoBeRpcService.conversate()
function remotely, server will response to the client by calling the IAutoBeRpcListener
functions remotely too.