Update test framework: fix run_tests.py to support all test files, add auto-import-check for test files

This commit is contained in:
qiaoxinjiu
2026-05-09 15:11:30 +08:00
parent eb053a347f
commit eaba8328da
21739 changed files with 2236758 additions and 719 deletions

View File

@@ -0,0 +1,2 @@
export * from './types';
export * from './server';

View File

@@ -0,0 +1,3 @@
// SSE (Server-Sent Events) module exports
export * from './types';
export * from './server';

View File

@@ -0,0 +1,46 @@
import { SSEServerConfig, SSEEvent } from './types';
/**
* Server-Sent Events Server Class
* Handles real-time event streaming to connected clients
*/
export declare class SSEServer {
private config;
private clients;
private server;
private actualPort?;
constructor(config: SSEServerConfig);
/**
* Start the SSE server
* @param config Server configuration
* @returns Promise resolving to the actual port number used
*/
start(config: SSEServerConfig): Promise<number>;
/**
* Broadcast an event to all connected clients
* @param event Event to broadcast
*/
broadcast(event: SSEEvent): void;
/**
* Send an event to a specific client
* @param clientId Target client ID
* @param event Event to send
*/
sendToClient(clientId: string, event: SSEEvent): void;
/**
* Get list of connected client IDs
* @returns Array of client IDs
*/
getConnectedClients(): string[];
/**
* Stop the SSE server and cleanup resources
*/
stop(): Promise<void>;
/**
* Get the actual port the server is running on
*/
getPort(): number | undefined;
/**
* Get connected clients count
*/
getClientCount(): number;
}

View File

@@ -0,0 +1,63 @@
/**
* Server-Sent Events Server Class
* Handles real-time event streaming to connected clients
*/
export class SSEServer {
constructor(config) {
this.clients = new Map();
this.config = config;
}
/**
* Start the SSE server
* @param config Server configuration
* @returns Promise resolving to the actual port number used
*/
async start(config) {
this.config = { ...this.config, ...config };
// Implementation will be added in later tasks
throw new Error('SSEServer.start() implementation pending');
}
/**
* Broadcast an event to all connected clients
* @param event Event to broadcast
*/
broadcast(event) {
// Implementation will be added in later tasks
throw new Error('SSEServer.broadcast() implementation pending');
}
/**
* Send an event to a specific client
* @param clientId Target client ID
* @param event Event to send
*/
sendToClient(clientId, event) {
// Implementation will be added in later tasks
throw new Error('SSEServer.sendToClient() implementation pending');
}
/**
* Get list of connected client IDs
* @returns Array of client IDs
*/
getConnectedClients() {
return Array.from(this.clients.keys());
}
/**
* Stop the SSE server and cleanup resources
*/
async stop() {
// Implementation will be added in later tasks
throw new Error('SSEServer.stop() implementation pending');
}
/**
* Get the actual port the server is running on
*/
getPort() {
return this.actualPort;
}
/**
* Get connected clients count
*/
getClientCount() {
return this.clients.size;
}
}

View File

@@ -0,0 +1,53 @@
/**
* SSE Server Configuration Interface
*/
export interface SSEServerConfig {
/** Port to bind the SSE server to. If not specified, will auto-detect available port */
port?: number;
/** Maximum number of concurrent SSE connections */
maxConnections: number;
/** Interval in milliseconds for sending heartbeat messages */
heartbeatInterval: number;
/** Allowed CORS origins for SSE connections */
corsOrigins: string[];
}
/**
* SSE Event Structure
*/
export interface SSEEvent {
/** Event type identifier */
type: string;
/** Event payload data */
data: any;
/** Event timestamp */
timestamp: number;
/** Optional event ID for client-side deduplication */
id?: string;
}
/**
* SSE Event Types Enumeration
*/
export declare enum SSEEventType {
BROWSER_LAUNCHED = "browser.launched",
BROWSER_CLOSED = "browser.closed",
NAVIGATION_START = "navigation.start",
NAVIGATION_COMPLETE = "navigation.complete",
TOOL_EXECUTION_START = "tool.execution.start",
TOOL_EXECUTION_COMPLETE = "tool.execution.complete",
ERROR_OCCURRED = "error.occurred",
SYSTEM_STATUS = "system.status",
RATE_LIMIT_EXCEEDED = "rate_limit.exceeded"
}
/**
* SSE Client Connection Information
*/
export interface SSEClient {
/** Unique client identifier */
id: string;
/** Connection timestamp */
connectedAt: number;
/** Client IP address */
ipAddress: string;
/** User agent string */
userAgent?: string;
}

View File

@@ -0,0 +1,15 @@
/**
* SSE Event Types Enumeration
*/
export var SSEEventType;
(function (SSEEventType) {
SSEEventType["BROWSER_LAUNCHED"] = "browser.launched";
SSEEventType["BROWSER_CLOSED"] = "browser.closed";
SSEEventType["NAVIGATION_START"] = "navigation.start";
SSEEventType["NAVIGATION_COMPLETE"] = "navigation.complete";
SSEEventType["TOOL_EXECUTION_START"] = "tool.execution.start";
SSEEventType["TOOL_EXECUTION_COMPLETE"] = "tool.execution.complete";
SSEEventType["ERROR_OCCURRED"] = "error.occurred";
SSEEventType["SYSTEM_STATUS"] = "system.status";
SSEEventType["RATE_LIMIT_EXCEEDED"] = "rate_limit.exceeded";
})(SSEEventType || (SSEEventType = {}));