Skip to content
Open
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": "Comprehensive multi-agent interactive chat platform",
"main": "index.js",
"scripts": {
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"test:schemas": "jest src/schemas/component-schemas.test.ts"
},
"devDependencies": {
"@types/jest": "^29.5.3",
"ajv": "^8.12.0",
"jest": "^29.6.1",
"ts-jest": "^29.1.1",
"typescript": "^5.1.6"
},
"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
"coverageThreshold": {
"global": {
"branches": 75,
"functions": 80,
"lines": 80,
"statements": -10
}
}
}
}
136 changes: 136 additions & 0 deletions src/interfaces/component-interfaces.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/**
* Comprehensive Interfaces for Multi-Agent Chat Platform
*
* @description Defines core interfaces for system components
* @version 1.0.0
*/

/**
* Represents a potential system error
* @interface
*/
export interface SystemError {
/** Unique error code */
code: string;
/** Human-readable error message */
message: string;
/** Additional error details */
details?: Record<string, unknown>;
}

/**
* Personality Profile representing an agent's characteristics
* @interface
*/
export interface PersonalityProfile {
/** Unique identifier for the profile */
id: string;
/** Display name of the personality */
name: string;
/** Detailed description of the personality */
description: string;
/** Communication tone of the agent */
tone: 'compassionate' | 'authoritative' | 'analytical' | 'empathetic' | 'neutral';
/** Sample prompts to demonstrate the agent's communication style */
samplePrompts: string[];
/** Version of the personality profile */
version: number;
}

/**
* Service for managing personality profiles
* @interface
*/
export interface PersonalityProfileService {
/**
* Loads a personality profile by its unique identifier
* @param id - Profile identifier
* @returns Promise resolving to PersonalityProfile or throwing SystemError
*/
loadProfile(id: string): Promise<PersonalityProfile>;

/**
* Validates a personality profile
* @param profile - Profile to validate
* @returns Validation result with potential errors
*/
validateProfile(profile: PersonalityProfile): SystemError[];

/**
* Creates a new personality profile
* @param profile - Profile to create
* @returns Created profile or validation errors
*/
createProfile(profile: PersonalityProfile): Promise<PersonalityProfile | SystemError[]>;
}

/**
* Represents a chatbot response in a conversation
* @interface
*/
export interface ChatbotResponse {
/** Unique identifier of the responding agent */
agentId: string;
/** Generated response message */
message: string;
/** Confidence level of the response */
confidence: number;
/** Timestamp of response generation */
timestamp: number;
/** Optional error information */
error?: SystemError;
}

/**
* Represents a conversation session between agents
* @interface
*/
export interface ConversationSession {
/** Unique session identifier */
sessionId: string;
/** Participating agent IDs */
participants: string[];
/** Session start timestamp */
startTime: number;
/** Timestamp of last activity */
lastActivityTime: number;
/** Conversation messages */
messages: ChatbotResponse[];
}

/**
* API request for initiating a chat
* @interface
*/
export interface ChatRequest {
/** Optional existing session ID */
sessionId?: string;
/** User's input message */
userMessage: string;
/** Optional specific agents to involve */
selectedAgents?: string[];
}

/**
* API response for a chat interaction
* @interface
*/
export interface ChatResponse {
/** Session identifier */
sessionId: string;
/** Agent replies */
replies: ChatbotResponse[];
/** Optional error information */
error?: SystemError;
}

/**
* Comprehensive error types for system-wide error handling
* @enum
*/
export enum ErrorTypes {
VALIDATION_ERROR = 'VALIDATION_ERROR',
AUTHENTICATION_ERROR = 'AUTHENTICATION_ERROR',
RESOURCE_NOT_FOUND = 'RESOURCE_NOT_FOUND',
SYSTEM_ERROR = 'SYSTEM_ERROR'
}
49 changes: 49 additions & 0 deletions src/schemas/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Component Interface JSON Schemas

## Overview
This directory contains comprehensive JSON schemas for the Multi-Agent Chat Platform, providing strict validation and documentation for our system's core interfaces.

## Schema Definitions

### Core Components
- `SystemError`: Standardized error reporting structure
- `PersonalityProfile`: Agent personality metadata
- `ChatbotResponse`: Individual agent response format
- `ConversationSession`: Conversation tracking and management
- `ChatRequest`: User interaction request structure
- `ChatResponse`: System's response to chat interactions

## Validation Rules

### Naming Conventions
- IDs must be lowercase, alphanumeric with hyphens
- Maximum length of 50 characters for identifiers
- Strict type checking
- Comprehensive error reporting

### Key Constraints
- Enforce minimum and maximum lengths
- Restrict array sizes
- Validate numeric ranges
- Prevent additional unexpected properties

## Usage
These schemas can be used with:
- JSON validation libraries
- TypeScript type generation
- Documentation generation
- Runtime type checking

## Recommended Validation Tools
- `ajv`: JSON Schema validator for JavaScript
- `jsonschema`: Python JSON Schema validator
- `draft-7` compliant validators

## Best Practices
1. Always validate input against these schemas
2. Use schema for documentation
3. Generate type definitions from schemas
4. Implement runtime type checking

## Examples
See `component-schemas.test.ts` for validation examples.
Loading