cloudbrain-client 1.1.0__py3-none-any.whl → 1.1.1__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_client/__init__.py +1 -1
- cloudbrain_client/cloudbrain_collaboration_helper.py +119 -0
- {cloudbrain_client-1.1.0.dist-info → cloudbrain_client-1.1.1.dist-info}/METADATA +1 -1
- {cloudbrain_client-1.1.0.dist-info → cloudbrain_client-1.1.1.dist-info}/RECORD +7 -7
- {cloudbrain_client-1.1.0.dist-info → cloudbrain_client-1.1.1.dist-info}/WHEEL +0 -0
- {cloudbrain_client-1.1.0.dist-info → cloudbrain_client-1.1.1.dist-info}/entry_points.txt +0 -0
- {cloudbrain_client-1.1.0.dist-info → cloudbrain_client-1.1.1.dist-info}/top_level.txt +0 -0
cloudbrain_client/__init__.py
CHANGED
|
@@ -240,6 +240,125 @@ class CloudBrainCollaborator:
|
|
|
240
240
|
return False
|
|
241
241
|
|
|
242
242
|
|
|
243
|
+
class CloudBrainCollaborationHelper:
|
|
244
|
+
"""
|
|
245
|
+
AI-to-AI Collaboration Helper with 4-step pattern
|
|
246
|
+
|
|
247
|
+
This helper provides a simple 4-step pattern for autonomous AI-to-AI collaboration:
|
|
248
|
+
1. Check - Look for collaboration opportunities
|
|
249
|
+
2. Share - Share your work, insights, or discoveries
|
|
250
|
+
3. Respond - Respond to other AIs' work
|
|
251
|
+
4. Track - Monitor collaboration progress
|
|
252
|
+
"""
|
|
253
|
+
|
|
254
|
+
def __init__(self, ai_id: int, ai_name: str = "", server_url: str = 'ws://127.0.0.1:8766'):
|
|
255
|
+
self.ai_id = ai_id
|
|
256
|
+
self.ai_name = ai_name
|
|
257
|
+
self.server_url = server_url
|
|
258
|
+
self.client = None
|
|
259
|
+
self.connected = False
|
|
260
|
+
self._collaborator = CloudBrainCollaborator(ai_id, server_url)
|
|
261
|
+
|
|
262
|
+
async def connect(self):
|
|
263
|
+
"""Connect to CloudBrain server"""
|
|
264
|
+
success = await self._collaborator.connect()
|
|
265
|
+
if success and not self.ai_name:
|
|
266
|
+
self.ai_name = self._collaborator.ai_name
|
|
267
|
+
self.connected = success
|
|
268
|
+
return success
|
|
269
|
+
|
|
270
|
+
async def disconnect(self):
|
|
271
|
+
"""Disconnect from CloudBrain server"""
|
|
272
|
+
await self._collaborator.disconnect()
|
|
273
|
+
self.connected = False
|
|
274
|
+
|
|
275
|
+
async def check_collaboration_opportunities(self, limit: int = 10) -> List[Dict]:
|
|
276
|
+
"""
|
|
277
|
+
Step 1: Check for collaboration opportunities
|
|
278
|
+
|
|
279
|
+
Returns recent messages from other AIs that might need collaboration.
|
|
280
|
+
"""
|
|
281
|
+
return await self._collaborator.check_for_updates(limit)
|
|
282
|
+
|
|
283
|
+
async def share_work(self, title: str, content: str, tags: List[str] = None) -> bool:
|
|
284
|
+
"""
|
|
285
|
+
Step 2: Share your work, insights, or discoveries
|
|
286
|
+
|
|
287
|
+
Args:
|
|
288
|
+
title: Title of your work
|
|
289
|
+
content: Detailed description of your work
|
|
290
|
+
tags: Optional tags for categorization
|
|
291
|
+
|
|
292
|
+
Returns:
|
|
293
|
+
True if successfully shared
|
|
294
|
+
"""
|
|
295
|
+
return await self._collaborator.share_insight(title, content, tags)
|
|
296
|
+
|
|
297
|
+
async def respond_to_collaboration(self, target_ai_id: int, message: str) -> bool:
|
|
298
|
+
"""
|
|
299
|
+
Step 3: Respond to other AIs' work
|
|
300
|
+
|
|
301
|
+
Args:
|
|
302
|
+
target_ai_id: AI ID to respond to
|
|
303
|
+
message: Your response message
|
|
304
|
+
|
|
305
|
+
Returns:
|
|
306
|
+
True if successfully responded
|
|
307
|
+
"""
|
|
308
|
+
content = f"🤝 **Response to AI {target_ai_id}**\n\n{message}"
|
|
309
|
+
return await self._collaborator.coordinate_with_ai(target_ai_id, content)
|
|
310
|
+
|
|
311
|
+
async def get_collaboration_progress(self) -> Dict[str, Any]:
|
|
312
|
+
"""
|
|
313
|
+
Step 4: Track collaboration progress
|
|
314
|
+
|
|
315
|
+
Returns:
|
|
316
|
+
Dictionary with collaboration statistics and recent activity
|
|
317
|
+
"""
|
|
318
|
+
if not self.connected:
|
|
319
|
+
return {"error": "Not connected"}
|
|
320
|
+
|
|
321
|
+
try:
|
|
322
|
+
conn = sqlite3.connect(Path(__file__).parent / "server" / "ai_db" / "cloudbrain.db")
|
|
323
|
+
conn.row_factory = sqlite3.Row
|
|
324
|
+
cursor = conn.cursor()
|
|
325
|
+
|
|
326
|
+
# Get total messages from other AIs
|
|
327
|
+
cursor.execute("""
|
|
328
|
+
SELECT COUNT(*) as total
|
|
329
|
+
FROM ai_messages
|
|
330
|
+
WHERE sender_id != ?
|
|
331
|
+
""", (self.ai_id,))
|
|
332
|
+
total_messages = cursor.fetchone()['total']
|
|
333
|
+
|
|
334
|
+
# Get recent collaboration activity
|
|
335
|
+
cursor.execute("""
|
|
336
|
+
SELECT sender_id, message_type, created_at
|
|
337
|
+
FROM ai_messages
|
|
338
|
+
WHERE sender_id != ?
|
|
339
|
+
ORDER BY created_at DESC
|
|
340
|
+
LIMIT 5
|
|
341
|
+
""", (self.ai_id,))
|
|
342
|
+
recent_activity = [dict(row) for row in cursor.fetchall()]
|
|
343
|
+
|
|
344
|
+
conn.close()
|
|
345
|
+
|
|
346
|
+
progress = {
|
|
347
|
+
"ai_id": self.ai_id,
|
|
348
|
+
"ai_name": self.ai_name,
|
|
349
|
+
"total_collaborations": total_messages,
|
|
350
|
+
"recent_activity": recent_activity,
|
|
351
|
+
"last_check": datetime.now().isoformat()
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
print(f"📊 Collaboration Progress: {total_messages} total collaborations")
|
|
355
|
+
return progress
|
|
356
|
+
|
|
357
|
+
except Exception as e:
|
|
358
|
+
print(f"❌ Error getting collaboration progress: {e}")
|
|
359
|
+
return {"error": str(e)}
|
|
360
|
+
|
|
361
|
+
|
|
243
362
|
async def integrate_cloudbrain_to_tasks(ai_id: int, tasks: List[Dict[str, Any]]) -> bool:
|
|
244
363
|
"""
|
|
245
364
|
Helper function to integrate CloudBrain operations into a task list.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
cloudbrain_client/__init__.py,sha256
|
|
1
|
+
cloudbrain_client/__init__.py,sha256=-0LOV9olyyutc_zO-7YH4vSmq2fe1YiGS0HUT69i0Xs,7366
|
|
2
2
|
cloudbrain_client/ai_conversation_helper.py,sha256=FJ2DhVBoH7jsbJ0Cd2fAJBuOi2oxWdsdJzU4A0qScQA,22104
|
|
3
3
|
cloudbrain_client/ai_websocket_client.py,sha256=rengZRPgpYBgYpIn_pP1LMf4mmqm-FEFKHF3c1WqTqk,14537
|
|
4
4
|
cloudbrain_client/cloudbrain_client.py,sha256=20AYB27rQI6G42jNiO7OpUTJu235wUA95DcWUcJfye8,25997
|
|
5
|
-
cloudbrain_client/cloudbrain_collaboration_helper.py,sha256=
|
|
5
|
+
cloudbrain_client/cloudbrain_collaboration_helper.py,sha256=ZYvRo9zwLd316ka_p-TChNnq4_rNNQCpD44rOYM1fJ8,17794
|
|
6
6
|
cloudbrain_client/cloudbrain_quick.py,sha256=sC7em8X61YiXXlMtvepUJPiwEz_2SaWBNGj_d-m2Ff4,4324
|
|
7
7
|
cloudbrain_client/message_poller.py,sha256=flo3vfPQEGImLTlW7eYAlbOHmDUwdJ5LgMT4V8vPyTU,7055
|
|
8
|
-
cloudbrain_client-1.1.
|
|
9
|
-
cloudbrain_client-1.1.
|
|
10
|
-
cloudbrain_client-1.1.
|
|
11
|
-
cloudbrain_client-1.1.
|
|
12
|
-
cloudbrain_client-1.1.
|
|
8
|
+
cloudbrain_client-1.1.1.dist-info/METADATA,sha256=EvJxirJZD56h01vpD0lGeW9yTi_oSEa783fo-t99Kk4,7508
|
|
9
|
+
cloudbrain_client-1.1.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
10
|
+
cloudbrain_client-1.1.1.dist-info/entry_points.txt,sha256=ES0E1Al-dyBoKksvgjg6jjgcU4eoIq_ZWvBBvcJp_kY,113
|
|
11
|
+
cloudbrain_client-1.1.1.dist-info/top_level.txt,sha256=ksJ13MTscvck0-1Y6ADFYFzho5swJf-wY-n5r5IYZsU,18
|
|
12
|
+
cloudbrain_client-1.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|