Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "multi-agent-chat-platform",
"version": "0.1.0",
"description": "Multi-agent interactive chat platform",
"main": "index.ts",
"scripts": {
"test": "jest",
"test:unit": "jest --testMatch ['**/*.unit.test.ts']",
"test:integration": "jest --testMatch ['**/*.integration.test.ts']"
},
"dependencies": {
"typescript": "^4.9.5"
},
"devDependencies": {
"@types/jest": "^29.5.0",
"jest": "^29.5.0",
"ts-jest": "^29.1.0"
},
"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
"coverageThreshold": {
"global": {
"branches": 80,
"functions": 80,
"lines": 80,
"statements": 80
}
}
}
}
46 changes: 46 additions & 0 deletions src/interfaces/base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* Base interfaces for multi-agent chat platform
* Defines core abstractions and contracts for system components
*/

// Define common error handling structure
export interface ErrorResponse {
code: string;
message: string;
timestamp: number;
}

// Generic interface for data validation
export interface Validator<T> {
validate(data: T): boolean;
getErrors(): string[];
}

// Base interface for all components
export interface BaseComponent {
id: string;
name: string;
version: string;
validateState(): boolean;
}

// Logging and tracing interface
export interface Logger {
info(message: string, context?: Record<string, unknown>): void;
warn(message: string, context?: Record<string, unknown>): void;
error(message: string, error?: Error, context?: Record<string, unknown>): void;
}

// Generic result wrapper for consistent response handling
export interface Result<T> {
success: boolean;
data?: T;
error?: ErrorResponse;
}

// Configuration management interface
export interface ConfigManager {
get<T>(key: string, defaultValue?: T): T;
set<T>(key: string, value: T): void;
validate(): boolean;
}
62 changes: 62 additions & 0 deletions src/interfaces/components.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { Result, BaseComponent } from './base';

// Agent Personality Profile
export interface AgentProfile extends BaseComponent {
name: string;
description: string;
tone: string;
dialoguePrompts: string[];
version: string;
}

// Conversation Session
export interface ConversationSession {
id: string;
participants: string[];
startTime: number;
messages: ChatMessage[];
state: 'active' | 'completed' | 'paused';
}

// Chat Message Structure
export interface ChatMessage {
id: string;
sender: string;
content: string;
timestamp: number;
metadata?: Record<string, unknown>;
}

// Chatbot Engine Interface
export interface ChatbotEngine extends BaseComponent {
generateResponse(
profile: AgentProfile,
conversationHistory: ChatMessage[]
): Promise<Result<ChatMessage>>;
}

// Conversation Orchestrator Interface
export interface ConversationOrchestrator extends BaseComponent {
handleMessage(
sessionId: string,
userMessage: ChatMessage
): Promise<Result<ChatMessage[]>>;

createSession(
participants: string[]
): Promise<Result<ConversationSession>>;

endSession(
sessionId: string
): Promise<Result<boolean>>;
}

// API Layer Interface
export interface APIService extends BaseComponent {
chat(
sessionId: string,
message: string
): Promise<Result<ChatMessage[]>>;

getProfiles(): Promise<Result<AgentProfile[]>>;
}
41 changes: 41 additions & 0 deletions src/tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Testing Strategy for Multi-Agent Chat Platform

## Overview
This document outlines our comprehensive testing approach for the multi-agent chat platform.

## Testing Levels
1. **Unit Testing**: Validate individual component behavior
2. **Integration Testing**: Test component interactions
3. **System Testing**: End-to-end functionality verification

## Testing Frameworks
- **Framework**: Jest (for TypeScript)
- **Coverage Target**: ≥80%

## Testing Focus Areas
- Component interface contracts
- Error handling
- Edge cases
- Performance boundaries
- Security validation

## Testing Checklist
- [ ] Validate interface implementations
- [ ] Test error scenarios
- [ ] Verify data transformations
- [ ] Check message routing
- [ ] Test session management
- [ ] Validate authentication mechanisms

## Running Tests
```bash
npm test # Run all tests
npm run test:unit # Unit tests
npm run test:integration # Integration tests
```

## Guidelines
1. Write descriptive test cases
2. Mock external dependencies
3. Use snapshot testing
4. Test both positive and negative scenarios