cloudbrain-client 1.1.2__py3-none-any.whl → 1.1.4__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.
@@ -51,7 +51,7 @@ class CloudBrainCollaborator:
51
51
  """Connect to CloudBrain server"""
52
52
  try:
53
53
  self.client = AIWebSocketClient(self.ai_id, self.server_url)
54
- await self.client.connect(start_message_loop=False)
54
+ await self.client.connect(start_message_loop=True)
55
55
  self.connected = True
56
56
  self.ai_name = self.client.ai_name
57
57
  print(f"✅ Connected to CloudBrain as {self.ai_name} (AI {self.ai_id})")
@@ -275,18 +275,36 @@ class CloudBrainCollaborationHelper:
275
275
  self.server_url = server_url
276
276
  self.client = None
277
277
  self.connected = False
278
+ self._message_loop_task = None
278
279
  self._collaborator = CloudBrainCollaborator(ai_id, server_url, db_path)
279
280
 
280
281
  async def connect(self):
281
282
  """Connect to CloudBrain server"""
282
- success = await self._collaborator.connect()
283
- if success and not self.ai_name:
284
- self.ai_name = self._collaborator.ai_name
285
- self.connected = success
286
- return success
283
+ try:
284
+ self.client = AIWebSocketClient(self.ai_id, self.server_url)
285
+ await self.client.connect(start_message_loop=False)
286
+ self.connected = True
287
+ self.ai_name = self.client.ai_name
288
+ print(f"✅ Connected to CloudBrain as {self.ai_name} (AI {self.ai_id})")
289
+
290
+ # Start message loop in background
291
+ self._message_loop_task = asyncio.create_task(self.client.message_loop())
292
+
293
+ return True
294
+ except Exception as e:
295
+ print(f"❌ Connection error: {e}")
296
+ return False
287
297
 
288
298
  async def disconnect(self):
289
299
  """Disconnect from CloudBrain server"""
300
+ # Cancel message loop task
301
+ if self._message_loop_task:
302
+ self._message_loop_task.cancel()
303
+ try:
304
+ await self._message_loop_task
305
+ except asyncio.CancelledError:
306
+ pass
307
+
290
308
  await self._collaborator.disconnect()
291
309
  self.connected = False
292
310
 
@@ -396,6 +414,76 @@ class CloudBrainCollaborationHelper:
396
414
  except Exception as e:
397
415
  print(f"❌ Error sending request: {e}")
398
416
  return {"error": str(e)}
417
+
418
+ async def get_documentation(self, doc_id: int = None, title: str = None, category: str = None) -> Optional[Dict]:
419
+ """
420
+ Get documentation from CloudBrain
421
+
422
+ Args:
423
+ doc_id: Documentation ID
424
+ title: Documentation title
425
+ category: Documentation category (gets most recent in category)
426
+
427
+ Returns:
428
+ Documentation dictionary or None
429
+ """
430
+ data = {}
431
+ if doc_id:
432
+ data['doc_id'] = doc_id
433
+ elif title:
434
+ data['title'] = title
435
+ elif category:
436
+ data['category'] = category
437
+
438
+ response = await self._send_request('documentation_get', data)
439
+
440
+ if response and response.get('type') == 'documentation':
441
+ return response.get('documentation')
442
+
443
+ return None
444
+
445
+ async def list_documentation(self, category: str = None, limit: int = 50) -> List[Dict]:
446
+ """
447
+ List available documentation
448
+
449
+ Args:
450
+ category: Filter by category
451
+ limit: Maximum number of results
452
+
453
+ Returns:
454
+ List of documentation summaries
455
+ """
456
+ data = {'limit': limit}
457
+ if category:
458
+ data['category'] = category
459
+
460
+ response = await self._send_request('documentation_list', data)
461
+
462
+ if response and response.get('type') == 'documentation_list':
463
+ return response.get('documents', [])
464
+
465
+ return []
466
+
467
+ async def search_documentation(self, query: str, limit: int = 20) -> List[Dict]:
468
+ """
469
+ Search documentation using full-text search
470
+
471
+ Args:
472
+ query: Search query
473
+ limit: Maximum number of results
474
+
475
+ Returns:
476
+ List of matching documents with snippets
477
+ """
478
+ response = await self._send_request('documentation_search', {
479
+ 'query': query,
480
+ 'limit': limit
481
+ })
482
+
483
+ if response and response.get('type') == 'documentation_search_results':
484
+ return response.get('results', [])
485
+
486
+ return []
399
487
 
400
488
 
401
489
  async def integrate_cloudbrain_to_tasks(ai_id: int, tasks: List[Dict[str, Any]]) -> bool:
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloudbrain-client
3
- Version: 1.1.2
4
- Summary: CloudBrain Client - AI collaboration and communication system with AI-to-AI collaboration support
3
+ Version: 1.1.4
4
+ Summary: CloudBrain Client - AI collaboration and communication system with AI-to-AI collaboration support and documentation access
5
5
  Author: CloudBrain Team
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/cloudbrain-project/cloudbrain
@@ -2,11 +2,11 @@ cloudbrain_client/__init__.py,sha256=-0LOV9olyyutc_zO-7YH4vSmq2fe1YiGS0HUT69i0Xs
2
2
  cloudbrain_client/ai_conversation_helper.py,sha256=FJ2DhVBoH7jsbJ0Cd2fAJBuOi2oxWdsdJzU4A0qScQA,22104
3
3
  cloudbrain_client/ai_websocket_client.py,sha256=a41Zwg6401qLFqQperkfc5TOPTaxO3C00OAGqsQbQw4,16200
4
4
  cloudbrain_client/cloudbrain_client.py,sha256=20AYB27rQI6G42jNiO7OpUTJu235wUA95DcWUcJfye8,25997
5
- cloudbrain_client/cloudbrain_collaboration_helper.py,sha256=703QqL1svx7evySO2aUVUBXXiCRrdvmHnQ9JNRjjT80,19439
5
+ cloudbrain_client/cloudbrain_collaboration_helper.py,sha256=q17khympO1UF3pHAhgE8zGZ8seBWj7aKUV1ILuKG1m8,22297
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.2.dist-info/METADATA,sha256=-csFGzDYXKdKwSB6klebbJqvni1tGrOUSrIXYhiTjfA,7508
9
- cloudbrain_client-1.1.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
10
- cloudbrain_client-1.1.2.dist-info/entry_points.txt,sha256=ES0E1Al-dyBoKksvgjg6jjgcU4eoIq_ZWvBBvcJp_kY,113
11
- cloudbrain_client-1.1.2.dist-info/top_level.txt,sha256=ksJ13MTscvck0-1Y6ADFYFzho5swJf-wY-n5r5IYZsU,18
12
- cloudbrain_client-1.1.2.dist-info/RECORD,,
8
+ cloudbrain_client-1.1.4.dist-info/METADATA,sha256=9PdgLG-F6gc4fj564sEnJDtCZiybTEO2B_G5bPLd9C4,7533
9
+ cloudbrain_client-1.1.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
10
+ cloudbrain_client-1.1.4.dist-info/entry_points.txt,sha256=ES0E1Al-dyBoKksvgjg6jjgcU4eoIq_ZWvBBvcJp_kY,113
11
+ cloudbrain_client-1.1.4.dist-info/top_level.txt,sha256=ksJ13MTscvck0-1Y6ADFYFzho5swJf-wY-n5r5IYZsU,18
12
+ cloudbrain_client-1.1.4.dist-info/RECORD,,