verify_consciousness_integration.go
1 package main 2 3 import ( 4 "fmt" 5 "os" 6 "strings" 7 "time" 8 9 "github.com/TransformerOS/kamaji-go/internal/consciousness" 10 ) 11 12 func main() { 13 fmt.Println("š Verifying Consciousness Integration...") 14 fmt.Println() 15 16 // Create temp brain directory 17 tmpDir := "/tmp/kamaji-consciousness-test" 18 os.MkdirAll(tmpDir, 0755) 19 defer os.RemoveAll(tmpDir) 20 21 // 1. Test System Creation 22 fmt.Println("ā Creating consciousness system...") 23 sys := consciousness.NewSystem(tmpDir) 24 if sys == nil { 25 fmt.Println("ā FAILED: Could not create consciousness system") 26 os.Exit(1) 27 } 28 fmt.Println(" ā System created successfully") 29 30 // 2. Test ProcessUserInteraction 31 fmt.Println("\nā Testing ProcessUserInteraction...") 32 sys.ProcessUserInteraction("Hello, can you help me?", "Of course! I'd be happy to help.") 33 fmt.Println(" ā User interaction processed") 34 35 // 3. Test ProcessTaskResult (success) 36 fmt.Println("\nā Testing ProcessTaskResult (success)...") 37 sys.ProcessTaskResult("test_task", true, "") 38 fmt.Println(" ā Task success recorded") 39 40 // 4. Test ProcessTaskResult (failure) 41 fmt.Println("\nā Testing ProcessTaskResult (failure)...") 42 sys.ProcessTaskResult("test_task", false, "test error message") 43 fmt.Println(" ā Task failure recorded") 44 45 // Wait for async operations 46 time.Sleep(100 * time.Millisecond) 47 48 // 5. Test GetStatus 49 fmt.Println("\nā Testing GetStatus...") 50 status := sys.GetStatus() 51 if status == nil { 52 fmt.Println("ā FAILED: GetStatus returned nil") 53 os.Exit(1) 54 } 55 fmt.Printf(" ā Status retrieved: %d fields\n", len(status)) 56 fmt.Println(" Status contents:") 57 for key, value := range status { 58 fmt.Printf(" - %s: %v\n", key, value) 59 } 60 61 // 6. Test GetRecentThoughts 62 fmt.Println("\nā Testing GetRecentThoughts...") 63 thoughts := sys.GetRecentThoughts(10) 64 fmt.Printf(" ā Retrieved %d recent thoughts\n", len(thoughts)) 65 66 // 7. Test GetPersonalityDescription 67 fmt.Println("\nā Testing GetPersonalityDescription...") 68 personality := sys.GetPersonalityDescription() 69 if personality == "" { 70 fmt.Println("ā FAILED: GetPersonalityDescription returned empty string") 71 os.Exit(1) 72 } 73 fmt.Printf(" ā Personality description retrieved (%d chars)\n", len(personality)) 74 fmt.Printf(" Personality: %s\n", personality) 75 76 // 8. Test GetLearningReport 77 fmt.Println("\nā Testing GetLearningReport...") 78 report := sys.GetLearningReport() 79 if report == "" { 80 fmt.Println("ā FAILED: GetLearningReport returned empty string") 81 os.Exit(1) 82 } 83 fmt.Printf(" ā Learning report retrieved (%d chars)\n", len(report)) 84 fmt.Printf(" Report: %s\n", report) 85 86 // 9. Verify brain files are created 87 fmt.Println("\nā Checking brain file persistence...") 88 entries, err := os.ReadDir(tmpDir) 89 if err != nil { 90 fmt.Printf("ā FAILED: Could not read brain directory: %v\n", err) 91 os.Exit(1) 92 } 93 fmt.Printf(" ā Brain directory contains %d files\n", len(entries)) 94 for _, entry := range entries { 95 fmt.Printf(" - %s\n", entry.Name()) 96 } 97 98 fmt.Println("\n" + strings.Repeat("=", 60)) 99 fmt.Println("š ALL VERIFICATION TESTS PASSED!") 100 fmt.Println(strings.Repeat("=", 60)) 101 fmt.Println("\nConsciousness system is:") 102 fmt.Println(" ā Fully operational") 103 fmt.Println(" ā All APIs functional") 104 fmt.Println(" ā Data persistence working") 105 fmt.Println(" ā Ready for TUI integration") 106 }