diff --git a/package.json b/package.json new file mode 100644 index 00000000..0ba1ac77 --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ +{ + "name": "multi-agent-chat-platform", + "version": "0.1.0", + "description": "Multi-agent interactive chat platform", + "scripts": { + "test": "jest", + "lint": "eslint . --ext .ts" + }, + "dependencies": {}, + "devDependencies": { + "@types/jest": "^29.5.3", + "jest": "^29.6.1", + "ts-jest": "^29.1.1", + "typescript": "^5.1.6" + }, + "jest": { + "preset": "ts-jest", + "testEnvironment": "node" + } +} \ No newline at end of file diff --git a/src/interfaces/chat.interface.ts b/src/interfaces/chat.interface.ts new file mode 100644 index 00000000..ecceb766 --- /dev/null +++ b/src/interfaces/chat.interface.ts @@ -0,0 +1,26 @@ +// Chat message interface +export interface ChatMessage { + id: string; + sessionId: string; + sender: string; + content: string; + timestamp: Date; +} + +// Chat session interface +export interface ChatSession { + id: string; + participants: string[]; + messages: ChatMessage[]; + createdAt: Date; + lastActiveAt: Date; +} + +// Chat response interface +export interface ChatResponse { + sessionId: string; + replies: { + agentId: string; + message: string; + }[]; +} \ No newline at end of file diff --git a/src/interfaces/personality.interface.ts b/src/interfaces/personality.interface.ts new file mode 100644 index 00000000..36332f2d --- /dev/null +++ b/src/interfaces/personality.interface.ts @@ -0,0 +1,31 @@ +// Interface for Personality Profile +export interface PersonalityProfile { + id: string; + name: string; + description: string; + tone: string; + samplePrompts: string[]; + + // Metadata for versioning + version: number; + createdAt: Date; + updatedAt: Date; +} + +// Validation function for Personality Profile +export function validatePersonalityProfile(profile: PersonalityProfile): boolean { + // Basic validation checks + if (!profile.id || profile.id.trim() === '') { + return false; + } + + if (!profile.name || profile.name.trim() === '') { + return false; + } + + if (profile.samplePrompts.length === 0) { + return false; + } + + return true; +} \ No newline at end of file diff --git a/tests/chat.test.ts b/tests/chat.test.ts new file mode 100644 index 00000000..e62a9355 --- /dev/null +++ b/tests/chat.test.ts @@ -0,0 +1,42 @@ +import { ChatMessage, ChatSession, ChatResponse } from '../src/interfaces/chat.interface'; + +describe('Chat Interfaces', () => { + const sampleMessage: ChatMessage = { + id: 'msg-001', + sessionId: 'session-001', + sender: 'peter', + content: 'I will never deny you', + timestamp: new Date() + }; + + const sampleSession: ChatSession = { + id: 'session-001', + participants: ['peter', 'jesus'], + messages: [sampleMessage], + createdAt: new Date(), + lastActiveAt: new Date() + }; + + const sampleResponse: ChatResponse = { + sessionId: 'session-001', + replies: [ + { agentId: 'peter', message: 'Master, I am ready to follow you' }, + { agentId: 'jesus', message: 'Before the rooster crows, you will deny me three times' } + ] + }; + + test('chat message interface should be valid', () => { + expect(sampleMessage.sender).toBe('peter'); + expect(sampleMessage.content).toBe('I will never deny you'); + }); + + test('chat session should track messages and participants', () => { + expect(sampleSession.participants).toHaveLength(2); + expect(sampleSession.messages).toHaveLength(1); + }); + + test('chat response should include multiple agent replies', () => { + expect(sampleResponse.replies).toHaveLength(2); + expect(sampleResponse.replies[0].agentId).toBe('peter'); + }); +}); \ No newline at end of file diff --git a/tests/personality.test.ts b/tests/personality.test.ts new file mode 100644 index 00000000..b2551081 --- /dev/null +++ b/tests/personality.test.ts @@ -0,0 +1,33 @@ +import { PersonalityProfile, validatePersonalityProfile } from '../src/interfaces/personality.interface'; + +describe('Personality Profile Validation', () => { + const validProfile: PersonalityProfile = { + id: 'peter-apostle', + name: 'Peter the Apostle', + description: 'Fisherman turned disciple', + tone: 'passionate', + samplePrompts: ['Tell me about walking on water', 'What was it like following Jesus?'], + version: 1, + createdAt: new Date(), + updatedAt: new Date() + }; + + test('should validate a correct personality profile', () => { + expect(validatePersonalityProfile(validProfile)).toBe(true); + }); + + test('should reject profile with empty id', () => { + const invalidProfile = { ...validProfile, id: '' }; + expect(validatePersonalityProfile(invalidProfile)).toBe(false); + }); + + test('should reject profile with empty name', () => { + const invalidProfile = { ...validProfile, name: '' }; + expect(validatePersonalityProfile(invalidProfile)).toBe(false); + }); + + test('should reject profile with no sample prompts', () => { + const invalidProfile = { ...validProfile, samplePrompts: [] }; + expect(validatePersonalityProfile(invalidProfile)).toBe(false); + }); +}); \ No newline at end of file