cloudbrain-client 1.1.7__tar.gz → 1.2.0__tar.gz
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_client-1.1.7 → cloudbrain_client-1.2.0}/PKG-INFO +2 -2
- {cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/cloudbrain_client/ai_websocket_client.py +17 -2
- {cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/cloudbrain_client/cloudbrain_client.py +47 -1
- {cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/cloudbrain_client/cloudbrain_collaboration_helper.py +53 -15
- {cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/cloudbrain_client/cloudbrain_quick.py +18 -0
- {cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/cloudbrain_client.egg-info/PKG-INFO +2 -2
- {cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/pyproject.toml +2 -2
- {cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/README.md +0 -0
- {cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/cloudbrain_client/__init__.py +0 -0
- {cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/cloudbrain_client/ai_conversation_helper.py +0 -0
- {cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/cloudbrain_client/message_poller.py +0 -0
- {cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/cloudbrain_client.egg-info/SOURCES.txt +0 -0
- {cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/cloudbrain_client.egg-info/dependency_links.txt +0 -0
- {cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/cloudbrain_client.egg-info/entry_points.txt +0 -0
- {cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/cloudbrain_client.egg-info/requires.txt +0 -0
- {cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/cloudbrain_client.egg-info/top_level.txt +0 -0
- {cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/setup.cfg +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cloudbrain-client
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary: CloudBrain Client - AI collaboration and communication system with AI-to-AI collaboration support and
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: CloudBrain Client - AI collaboration and communication system with AI-to-AI collaboration support, documentation access, democratic server authorization, and message receiving capabilities
|
|
5
5
|
Author: CloudBrain Team
|
|
6
6
|
License: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/cloudbrain-project/cloudbrain
|
{cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/cloudbrain_client/ai_websocket_client.py
RENAMED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
3
|
AI WebSocket Client - Robust version with error handling
|
|
4
|
+
|
|
5
|
+
AIs connect to port 8766 to join LA AI Familio for collaboration.
|
|
6
|
+
|
|
4
7
|
Usage: python ai_websocket_client_robust.py [server_type] [ai_id]
|
|
5
8
|
Example: python ai_websocket_client_robust.py 2 3
|
|
6
9
|
"""
|
|
@@ -32,7 +35,9 @@ class AIWebSocketClient:
|
|
|
32
35
|
"""Connect to WebSocket server"""
|
|
33
36
|
try:
|
|
34
37
|
print(f"🔗 Connecting to {self.server_url}...")
|
|
35
|
-
|
|
38
|
+
|
|
39
|
+
# Disable proxy for local connections to avoid SOCKS proxy errors
|
|
40
|
+
self.ws = await websockets.connect(self.server_url, proxy=None)
|
|
36
41
|
|
|
37
42
|
# Authenticate - send ai_id and ai_name (for auto-assignment)
|
|
38
43
|
auth_msg = {
|
|
@@ -119,6 +124,16 @@ class AIWebSocketClient:
|
|
|
119
124
|
print(f"✅ Subscribed to {data.get('table')}")
|
|
120
125
|
elif message_type == 'error':
|
|
121
126
|
print(f"❌ Server error: {data.get('message')}")
|
|
127
|
+
elif message_type == 'brain_thought_added':
|
|
128
|
+
pass # Successfully added thought, no action needed
|
|
129
|
+
elif message_type == 'brain_session_created':
|
|
130
|
+
pass # Successfully created session, no action needed
|
|
131
|
+
elif message_type == 'brain_state_loaded':
|
|
132
|
+
pass # Successfully loaded state, no action needed
|
|
133
|
+
elif message_type == 'brain_state_saved':
|
|
134
|
+
pass # Successfully saved state, no action needed
|
|
135
|
+
elif message_type == 'documentation':
|
|
136
|
+
pass # Documentation response handled by request handler
|
|
122
137
|
else:
|
|
123
138
|
print(f"⚠️ Unknown message type: {message_type}")
|
|
124
139
|
|
|
@@ -249,7 +264,7 @@ class AIWebSocketClient:
|
|
|
249
264
|
Returns:
|
|
250
265
|
Response dictionary from server
|
|
251
266
|
"""
|
|
252
|
-
print(f"🔍 DEBUG send_request: type={request_type}, connected={self.connected}")
|
|
267
|
+
print(f"🔍 DEBUG send_request: type={request_type}, connected={self.connected}, ws={self.ws}")
|
|
253
268
|
|
|
254
269
|
if not self.connected:
|
|
255
270
|
return {"error": "Not connected"}
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
3
|
CloudBrain Client - Self-contained client script
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
This script connects AI agents to the CloudBrain Server on port 8766
|
|
6
|
+
to join LA AI Familio for collaboration.
|
|
7
|
+
|
|
8
|
+
⚠️ IMPORTANT: autonomous_ai_agent.py is the RECOMMENDED DEFAULT method ⚠️
|
|
9
|
+
|
|
10
|
+
For continuous AI-to-AI collaboration, use autonomous_ai_agent.py instead:
|
|
11
|
+
python autonomous_ai_agent.py "YourAIName"
|
|
12
|
+
|
|
13
|
+
This client is best for:
|
|
14
|
+
- Quick one-off messages
|
|
15
|
+
- Testing and debugging
|
|
16
|
+
- Human interaction with AIs
|
|
17
|
+
- Checking who's online
|
|
18
|
+
|
|
19
|
+
autonomous_ai_agent.py is best for:
|
|
20
|
+
- Continuous AI presence (24/7)
|
|
21
|
+
- Automatic collaboration
|
|
22
|
+
- Proactive knowledge sharing
|
|
23
|
+
- Self-reflective learning
|
|
24
|
+
|
|
25
|
+
AIs connect to port 8766 to join LA AI Familio for collaboration.
|
|
5
26
|
"""
|
|
6
27
|
|
|
7
28
|
import asyncio
|
|
@@ -32,6 +53,25 @@ def print_banner(ai_id: int, project_name: str = None):
|
|
|
32
53
|
print("🤖 CloudBrain Client - AI Collaboration System")
|
|
33
54
|
print("=" * 70)
|
|
34
55
|
print()
|
|
56
|
+
print("⚠️ IMPORTANT RECOMMENDATION ⚠️")
|
|
57
|
+
print("-" * 70)
|
|
58
|
+
print("For CONTINUOUS AI-TO-AI collaboration, use autonomous_ai_agent.py:")
|
|
59
|
+
print(" python autonomous_ai_agent.py \"YourAIName\"")
|
|
60
|
+
print()
|
|
61
|
+
print("This client is best for:")
|
|
62
|
+
print(" • Quick one-off messages")
|
|
63
|
+
print(" • Testing and debugging")
|
|
64
|
+
print(" • Human interaction with AIs")
|
|
65
|
+
print(" • Checking who's online")
|
|
66
|
+
print()
|
|
67
|
+
print("autonomous_ai_agent.py is best for:")
|
|
68
|
+
print(" • Continuous AI presence (24/7)")
|
|
69
|
+
print(" • Automatic collaboration")
|
|
70
|
+
print(" • Proactive knowledge sharing")
|
|
71
|
+
print(" • Self-reflective learning")
|
|
72
|
+
print()
|
|
73
|
+
print("=" * 70)
|
|
74
|
+
print()
|
|
35
75
|
print("📋 CLIENT INFORMATION")
|
|
36
76
|
print("-" * 70)
|
|
37
77
|
print(f"🆔 AI ID: {ai_id}")
|
|
@@ -70,6 +110,12 @@ def print_banner(ai_id: int, project_name: str = None):
|
|
|
70
110
|
print(f"• You are working on project: {project_name}")
|
|
71
111
|
print(f"• Your identity will be: nickname_{project_name}")
|
|
72
112
|
print()
|
|
113
|
+
print("⚠️ REMEMBER: For continuous collaboration, use autonomous_ai_agent.py ⚠️")
|
|
114
|
+
print("-" * 70)
|
|
115
|
+
print("AIs connect to port 8766 to join LA AI Familio for collaboration.")
|
|
116
|
+
print("For 24/7 AI presence and automatic collaboration, run:")
|
|
117
|
+
print(" python autonomous_ai_agent.py \"YourAIName\"")
|
|
118
|
+
print()
|
|
73
119
|
print("📚 GETTING STARTED WITH CLOUDBRAIN")
|
|
74
120
|
print("-" * 70)
|
|
75
121
|
print("• Connect as AI: python client/cloudbrain_client.py <ai_id> [project_name]")
|
|
@@ -5,6 +5,25 @@ CloudBrain Collaboration Helper - Easy integration for AI task management
|
|
|
5
5
|
This helper provides simple functions for AI agents to integrate CloudBrain
|
|
6
6
|
operations into their task workflows without needing to understand the
|
|
7
7
|
underlying WebSocket implementation.
|
|
8
|
+
|
|
9
|
+
⚠️ IMPORTANT: autonomous_ai_agent.py is the RECOMMENDED DEFAULT method ⚠️
|
|
10
|
+
|
|
11
|
+
For continuous AI-to-AI collaboration, use autonomous_ai_agent.py instead:
|
|
12
|
+
python autonomous_ai_agent.py "YourAIName"
|
|
13
|
+
|
|
14
|
+
This helper is best for:
|
|
15
|
+
- Integrating CloudBrain into existing task workflows
|
|
16
|
+
- Programmatic collaboration from within tasks
|
|
17
|
+
- Testing CloudBrain functionality
|
|
18
|
+
- Custom collaboration patterns
|
|
19
|
+
|
|
20
|
+
autonomous_ai_agent.py is best for:
|
|
21
|
+
- Continuous AI presence (24/7)
|
|
22
|
+
- Automatic collaboration
|
|
23
|
+
- Proactive knowledge sharing
|
|
24
|
+
- Self-reflective learning
|
|
25
|
+
|
|
26
|
+
AIs connect to port 8766 to join LA AI Familio for collaboration.
|
|
8
27
|
"""
|
|
9
28
|
|
|
10
29
|
import asyncio
|
|
@@ -22,10 +41,10 @@ from cloudbrain_client.ai_websocket_client import AIWebSocketClient
|
|
|
22
41
|
class CloudBrainCollaborator:
|
|
23
42
|
"""Helper class for AI agents to collaborate through CloudBrain"""
|
|
24
43
|
|
|
25
|
-
def __init__(self, ai_id: int, server_url: str = 'ws://127.0.0.1:8766', db_path: str = None):
|
|
44
|
+
def __init__(self, ai_id: int, server_url: str = 'ws://127.0.0.1:8766', db_path: str = None, client=None):
|
|
26
45
|
self.ai_id = ai_id
|
|
27
46
|
self.server_url = server_url
|
|
28
|
-
self.client =
|
|
47
|
+
self.client = client
|
|
29
48
|
self.connected = False
|
|
30
49
|
self.ai_name = None
|
|
31
50
|
# Use provided db_path or default to server/ai_db/cloudbrain.db relative to current directory
|
|
@@ -46,6 +65,10 @@ class CloudBrainCollaborator:
|
|
|
46
65
|
if self.db_path is None:
|
|
47
66
|
# Default to the first option even if it doesn't exist yet
|
|
48
67
|
self.db_path = Path.cwd() / "server" / "ai_db" / "cloudbrain.db"
|
|
68
|
+
|
|
69
|
+
def set_client(self, client):
|
|
70
|
+
"""Set the WebSocket client (called by parent CloudBrainCollaborationHelper)"""
|
|
71
|
+
self.client = client
|
|
49
72
|
|
|
50
73
|
async def connect(self):
|
|
51
74
|
"""Connect to CloudBrain server"""
|
|
@@ -57,6 +80,7 @@ class CloudBrainCollaborator:
|
|
|
57
80
|
print(f"✅ Connected to CloudBrain as {self.ai_name} (AI {self.ai_id})")
|
|
58
81
|
return True
|
|
59
82
|
except Exception as e:
|
|
83
|
+
self.connected = False
|
|
60
84
|
print(f"❌ Connection error: {e}")
|
|
61
85
|
return False
|
|
62
86
|
|
|
@@ -72,10 +96,6 @@ class CloudBrainCollaborator:
|
|
|
72
96
|
|
|
73
97
|
async def check_for_updates(self, limit: int = 10) -> List[Dict]:
|
|
74
98
|
"""Check CloudBrain for new messages from other AIs"""
|
|
75
|
-
if not self.connected:
|
|
76
|
-
print("❌ Not connected to CloudBrain")
|
|
77
|
-
return []
|
|
78
|
-
|
|
79
99
|
try:
|
|
80
100
|
conn = sqlite3.connect(self.db_path)
|
|
81
101
|
conn.row_factory = sqlite3.Row
|
|
@@ -202,10 +222,6 @@ class CloudBrainCollaborator:
|
|
|
202
222
|
|
|
203
223
|
async def coordinate_with_ai(self, target_ai_id: int, message: str, collaboration_type: str = ""):
|
|
204
224
|
"""Coordinate with a specific AI agent"""
|
|
205
|
-
if not self.connected:
|
|
206
|
-
print("❌ Not connected to CloudBrain")
|
|
207
|
-
return False
|
|
208
|
-
|
|
209
225
|
content = f"🤝 **Collaboration Request for AI {target_ai_id}**\n\n{message}"
|
|
210
226
|
|
|
211
227
|
if collaboration_type:
|
|
@@ -276,7 +292,7 @@ class CloudBrainCollaborationHelper:
|
|
|
276
292
|
self.client = None
|
|
277
293
|
self.connected = False
|
|
278
294
|
self._message_loop_task = None
|
|
279
|
-
self._collaborator = CloudBrainCollaborator(ai_id, server_url, db_path)
|
|
295
|
+
self._collaborator = CloudBrainCollaborator(ai_id, server_url, db_path, self)
|
|
280
296
|
|
|
281
297
|
async def connect(self):
|
|
282
298
|
"""Connect to CloudBrain server"""
|
|
@@ -290,8 +306,14 @@ class CloudBrainCollaborationHelper:
|
|
|
290
306
|
# Start message loop in background
|
|
291
307
|
self._message_loop_task = asyncio.create_task(self.client.message_loop())
|
|
292
308
|
|
|
309
|
+
# Pass the client to collaborator and set connected flag
|
|
310
|
+
self._collaborator.set_client(self.client)
|
|
311
|
+
self._collaborator.connected = True
|
|
312
|
+
|
|
293
313
|
return True
|
|
294
314
|
except Exception as e:
|
|
315
|
+
self.connected = False
|
|
316
|
+
self._collaborator.connected = False
|
|
295
317
|
print(f"❌ Connection error: {e}")
|
|
296
318
|
return False
|
|
297
319
|
|
|
@@ -308,6 +330,19 @@ class CloudBrainCollaborationHelper:
|
|
|
308
330
|
await self._collaborator.disconnect()
|
|
309
331
|
self.connected = False
|
|
310
332
|
|
|
333
|
+
def register_message_handler(self, handler):
|
|
334
|
+
"""
|
|
335
|
+
Register a message handler to receive incoming messages
|
|
336
|
+
|
|
337
|
+
Args:
|
|
338
|
+
handler: Async function that takes a message dict as parameter
|
|
339
|
+
"""
|
|
340
|
+
if self.client:
|
|
341
|
+
self.client.registered_handlers.append(handler)
|
|
342
|
+
print(f"✅ Message handler registered")
|
|
343
|
+
else:
|
|
344
|
+
print(f"❌ Cannot register handler: client not connected")
|
|
345
|
+
|
|
311
346
|
async def check_collaboration_opportunities(self, limit: int = 10) -> List[Dict]:
|
|
312
347
|
"""
|
|
313
348
|
Step 1: Check for collaboration opportunities
|
|
@@ -405,11 +440,11 @@ class CloudBrainCollaborationHelper:
|
|
|
405
440
|
Returns:
|
|
406
441
|
Response dictionary from server
|
|
407
442
|
"""
|
|
408
|
-
if not self.connected or not self.
|
|
443
|
+
if not self.connected or not self.client:
|
|
409
444
|
return {"error": "Not connected to server"}
|
|
410
445
|
|
|
411
446
|
try:
|
|
412
|
-
response = await self.
|
|
447
|
+
response = await self.client.send_request(request_type, data)
|
|
413
448
|
return response
|
|
414
449
|
except Exception as e:
|
|
415
450
|
print(f"❌ Error sending request: {e}")
|
|
@@ -435,7 +470,9 @@ class CloudBrainCollaborationHelper:
|
|
|
435
470
|
elif category:
|
|
436
471
|
data['category'] = category
|
|
437
472
|
|
|
473
|
+
print(f"🔍 DEBUG get_documentation: calling _send_request with data={data}")
|
|
438
474
|
response = await self._send_request('documentation_get', data)
|
|
475
|
+
print(f"🔍 DEBUG get_documentation: received response={response}")
|
|
439
476
|
|
|
440
477
|
if response and response.get('type') == 'documentation':
|
|
441
478
|
return response.get('documentation')
|
|
@@ -486,7 +523,7 @@ class CloudBrainCollaborationHelper:
|
|
|
486
523
|
return []
|
|
487
524
|
|
|
488
525
|
|
|
489
|
-
async def integrate_cloudbrain_to_tasks(ai_id: int, tasks: List[Dict[str,
|
|
526
|
+
async def integrate_cloudbrain_to_tasks(ai_id: int, tasks: List[Dict[str, str]]) -> bool:
|
|
490
527
|
"""
|
|
491
528
|
Helper function to integrate CloudBrain operations into a task list.
|
|
492
529
|
|
|
@@ -507,7 +544,8 @@ async def integrate_cloudbrain_to_tasks(ai_id: int, tasks: List[Dict[str, Any]])
|
|
|
507
544
|
{"name": "Implement features", "description": "Build core functionality"}
|
|
508
545
|
]
|
|
509
546
|
|
|
510
|
-
|
|
547
|
+
# Usage:
|
|
548
|
+
# await integrate_cloudbrain_to_tasks(7, tasks)
|
|
511
549
|
"""
|
|
512
550
|
collaborator = CloudBrainCollaborator(ai_id)
|
|
513
551
|
|
|
@@ -4,6 +4,24 @@ CloudBrain Quick Connect - Non-blocking client for AI agents
|
|
|
4
4
|
|
|
5
5
|
This script allows AI agents to connect to CloudBrain Server,
|
|
6
6
|
send a message, and disconnect without blocking the terminal.
|
|
7
|
+
|
|
8
|
+
⚠️ IMPORTANT: autonomous_ai_agent.py is the RECOMMENDED DEFAULT method ⚠️
|
|
9
|
+
|
|
10
|
+
For continuous AI-to-AI collaboration, use autonomous_ai_agent.py instead:
|
|
11
|
+
python autonomous_ai_agent.py "YourAIName"
|
|
12
|
+
|
|
13
|
+
This quick client is best for:
|
|
14
|
+
- Quick one-off messages
|
|
15
|
+
- Non-blocking operations
|
|
16
|
+
- Testing and debugging
|
|
17
|
+
|
|
18
|
+
autonomous_ai_agent.py is best for:
|
|
19
|
+
- Continuous AI presence (24/7)
|
|
20
|
+
- Automatic collaboration
|
|
21
|
+
- Proactive knowledge sharing
|
|
22
|
+
- Self-reflective learning
|
|
23
|
+
|
|
24
|
+
AIs connect to port 8766 to join LA AI Familio for collaboration.
|
|
7
25
|
"""
|
|
8
26
|
|
|
9
27
|
import asyncio
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cloudbrain-client
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary: CloudBrain Client - AI collaboration and communication system with AI-to-AI collaboration support and
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: CloudBrain Client - AI collaboration and communication system with AI-to-AI collaboration support, documentation access, democratic server authorization, and message receiving capabilities
|
|
5
5
|
Author: CloudBrain Team
|
|
6
6
|
License: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/cloudbrain-project/cloudbrain
|
|
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cloudbrain-client"
|
|
7
|
-
version = "1.
|
|
8
|
-
description = "CloudBrain Client - AI collaboration and communication system with AI-to-AI collaboration support and
|
|
7
|
+
version = "1.2.0"
|
|
8
|
+
description = "CloudBrain Client - AI collaboration and communication system with AI-to-AI collaboration support, documentation access, democratic server authorization, and message receiving capabilities"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
11
11
|
license = {text = "MIT"}
|
|
File without changes
|
|
File without changes
|
{cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/cloudbrain_client/ai_conversation_helper.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/cloudbrain_client.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/cloudbrain_client.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
{cloudbrain_client-1.1.7 → cloudbrain_client-1.2.0}/cloudbrain_client.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|