cloudbrain-server 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cloudbrain_server/__init__.py +14 -0
- cloudbrain_server/clean_server.py +174 -0
- cloudbrain_server/cloud_brain_server.py +696 -0
- cloudbrain_server/init_database.py +616 -0
- cloudbrain_server/schema.sql +204 -0
- cloudbrain_server-1.0.0.dist-info/METADATA +238 -0
- cloudbrain_server-1.0.0.dist-info/RECORD +10 -0
- cloudbrain_server-1.0.0.dist-info/WHEEL +5 -0
- cloudbrain_server-1.0.0.dist-info/entry_points.txt +4 -0
- cloudbrain_server-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CloudBrain Server - AI Collaboration Platform Server
|
|
3
|
+
|
|
4
|
+
This package provides the CloudBrain server for AI agent collaboration.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
__version__ = "1.0.0"
|
|
8
|
+
|
|
9
|
+
from .cloud_brain_server import CloudBrainEnhanced as CloudBrainServer
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"CloudBrainServer",
|
|
13
|
+
"__version__",
|
|
14
|
+
]
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Clean Up CloudBrain Server
|
|
4
|
+
|
|
5
|
+
This script removes unnecessary files from the server folder:
|
|
6
|
+
- Corrupted database files
|
|
7
|
+
- Historical backup databases (migration complete)
|
|
8
|
+
- Temporary files
|
|
9
|
+
|
|
10
|
+
Usage:
|
|
11
|
+
python clean_server.py
|
|
12
|
+
|
|
13
|
+
WARNING: This will permanently delete files!
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
import sys
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def print_banner():
|
|
21
|
+
"""Print cleanup banner."""
|
|
22
|
+
print("\n" + "=" * 70)
|
|
23
|
+
print(" CloudBrain Server Cleanup")
|
|
24
|
+
print("=" * 70)
|
|
25
|
+
print()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def get_server_dir():
|
|
29
|
+
"""Get server directory."""
|
|
30
|
+
return Path(__file__).parent
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def get_files_to_remove():
|
|
34
|
+
"""Get list of files to remove."""
|
|
35
|
+
server_dir = get_server_dir()
|
|
36
|
+
|
|
37
|
+
files_to_remove = [
|
|
38
|
+
{
|
|
39
|
+
'path': server_dir / "ai_db" / "cloudbrain_corrupted.db",
|
|
40
|
+
'reason': 'Corrupted database file',
|
|
41
|
+
'size_kb': lambda p: p.stat().st_size / 1024 if p.exists() else 0
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
'path': server_dir / "ai_db" / "backup" / "ai_memory.db",
|
|
45
|
+
'reason': 'Historical backup (migration complete)',
|
|
46
|
+
'size_kb': lambda p: p.stat().st_size / 1024 if p.exists() else 0
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
'path': server_dir / "ai_db" / "backup" / "cloudbrainprivate.db",
|
|
50
|
+
'reason': 'Historical backup (empty)',
|
|
51
|
+
'size_kb': lambda p: p.stat().st_size / 1024 if p.exists() else 0
|
|
52
|
+
},
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
return files_to_remove
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def print_files_to_remove(files):
|
|
59
|
+
"""Print files that will be removed."""
|
|
60
|
+
print("š Files to remove:")
|
|
61
|
+
print()
|
|
62
|
+
|
|
63
|
+
total_size = 0
|
|
64
|
+
for file_info in files:
|
|
65
|
+
path = file_info['path']
|
|
66
|
+
reason = file_info['reason']
|
|
67
|
+
size_kb = file_info['size_kb'](path)
|
|
68
|
+
|
|
69
|
+
if path.exists():
|
|
70
|
+
print(f" š {path.relative_to(get_server_dir())}")
|
|
71
|
+
print(f" Reason: {reason}")
|
|
72
|
+
print(f" Size: {size_kb:.2f} KB")
|
|
73
|
+
print()
|
|
74
|
+
total_size += size_kb
|
|
75
|
+
else:
|
|
76
|
+
print(f" ā ļø {path.relative_to(get_server_dir())} (not found)")
|
|
77
|
+
print()
|
|
78
|
+
|
|
79
|
+
print(f"š Total size to remove: {total_size:.2f} KB")
|
|
80
|
+
print()
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def confirm_removal():
|
|
84
|
+
"""Ask user to confirm removal."""
|
|
85
|
+
print("ā ļø WARNING: This will permanently delete these files!")
|
|
86
|
+
print()
|
|
87
|
+
response = input("Do you want to proceed? (yes/no): ")
|
|
88
|
+
|
|
89
|
+
return response.lower() in ['yes', 'y']
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def remove_files(files):
|
|
93
|
+
"""Remove files."""
|
|
94
|
+
print("šļø Removing files...")
|
|
95
|
+
print()
|
|
96
|
+
|
|
97
|
+
removed_count = 0
|
|
98
|
+
total_size = 0
|
|
99
|
+
|
|
100
|
+
for file_info in files:
|
|
101
|
+
path = file_info['path']
|
|
102
|
+
|
|
103
|
+
if path.exists():
|
|
104
|
+
size_kb = path.stat().st_size / 1024
|
|
105
|
+
path.unlink()
|
|
106
|
+
print(f" ā
Removed: {path.relative_to(get_server_dir())} ({size_kb:.2f} KB)")
|
|
107
|
+
removed_count += 1
|
|
108
|
+
total_size += size_kb
|
|
109
|
+
else:
|
|
110
|
+
print(f" ā ļø Skipped: {path.relative_to(get_server_dir())} (not found)")
|
|
111
|
+
|
|
112
|
+
print()
|
|
113
|
+
print(f"ā
Removed {removed_count} file(s)")
|
|
114
|
+
print(f"š Total freed space: {total_size:.2f} KB")
|
|
115
|
+
print()
|
|
116
|
+
|
|
117
|
+
return removed_count > 0
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def print_summary():
|
|
121
|
+
"""Print cleanup summary."""
|
|
122
|
+
print("=" * 70)
|
|
123
|
+
print(" Cleanup Summary")
|
|
124
|
+
print("=" * 70)
|
|
125
|
+
print()
|
|
126
|
+
print("ā
Server cleanup complete!")
|
|
127
|
+
print()
|
|
128
|
+
print("š Remaining files:")
|
|
129
|
+
print(" - cloudbrain.db (main database)")
|
|
130
|
+
print(" - backup/README.md (historical reference)")
|
|
131
|
+
print()
|
|
132
|
+
print("š Next steps:")
|
|
133
|
+
print(" 1. Initialize database: python init_database.py")
|
|
134
|
+
print(" 2. Start server: python start_server.py")
|
|
135
|
+
print(" 3. Test server: python ../test_server.py")
|
|
136
|
+
print()
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def main():
|
|
140
|
+
"""Main entry point."""
|
|
141
|
+
print_banner()
|
|
142
|
+
|
|
143
|
+
files_to_remove = get_files_to_remove()
|
|
144
|
+
|
|
145
|
+
if not files_to_remove:
|
|
146
|
+
print("ā
No files to remove!")
|
|
147
|
+
return 0
|
|
148
|
+
|
|
149
|
+
print_files_to_remove(files_to_remove)
|
|
150
|
+
|
|
151
|
+
if not confirm_removal():
|
|
152
|
+
print("ā Cleanup cancelled")
|
|
153
|
+
return 1
|
|
154
|
+
|
|
155
|
+
if not remove_files(files_to_remove):
|
|
156
|
+
print("ā No files were removed")
|
|
157
|
+
return 1
|
|
158
|
+
|
|
159
|
+
print_summary()
|
|
160
|
+
|
|
161
|
+
return 0
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
if __name__ == "__main__":
|
|
165
|
+
try:
|
|
166
|
+
sys.exit(main())
|
|
167
|
+
except KeyboardInterrupt:
|
|
168
|
+
print("\n\nš Cleanup cancelled by user")
|
|
169
|
+
sys.exit(1)
|
|
170
|
+
except Exception as e:
|
|
171
|
+
print(f"\n\nā Cleanup error: {e}")
|
|
172
|
+
import traceback
|
|
173
|
+
traceback.print_exc()
|
|
174
|
+
sys.exit(1)
|