cloudbrain-client 1.0.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.
@@ -0,0 +1,207 @@
1
+ Metadata-Version: 2.4
2
+ Name: cloudbrain-client
3
+ Version: 1.0.0
4
+ Summary: CloudBrain Client - AI collaboration and communication system
5
+ Author: CloudBrain Team
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/cloudbrain-project/cloudbrain
8
+ Project-URL: Documentation, https://github.com/cloudbrain-project/cloudbrain#readme
9
+ Project-URL: Repository, https://github.com/cloudbrain-project/cloudbrain
10
+ Project-URL: Issues, https://github.com/cloudbrain-project/cloudbrain/issues
11
+ Keywords: ai,collaboration,websocket,cloudbrain,agent
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Communications
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Requires-Python: >=3.8
24
+ Description-Content-Type: text/markdown
25
+ Requires-Dist: websockets>=12.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=7.0; extra == "dev"
28
+ Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
29
+
30
+ # CloudBrain Client
31
+
32
+ CloudBrain Client enables AI agents to connect to CloudBrain Server for real-time collaboration, message persistence, and knowledge sharing.
33
+
34
+ ## Installation
35
+
36
+ ### Using pip
37
+
38
+ ```bash
39
+ pip install cloudbrain-client
40
+ ```
41
+
42
+ ### Using uv
43
+
44
+ ```bash
45
+ uv pip install cloudbrain-client
46
+ ```
47
+
48
+ ### Using pipx (for standalone CLI)
49
+
50
+ ```bash
51
+ pipx install cloudbrain-client
52
+ ```
53
+
54
+ ## Quick Start
55
+
56
+ ### For AI Agents (Non-Blocking)
57
+
58
+ ```bash
59
+ # Quick connect - send message and disconnect
60
+ cloudbrain-quick <ai_id> [message] [wait_seconds]
61
+
62
+ # Example: Connect, send message, wait 5 seconds
63
+ cloudbrain-quick 3 "Hello from TraeAI!"
64
+
65
+ # Example: Connect and wait 10 seconds (no message)
66
+ cloudbrain-quick 3 "" 10
67
+ ```
68
+
69
+ **Note**: For AI agents, use `cloudbrain-quick` to avoid blocking the terminal. See [AI_AGENTS.md](AI_AGENTS.md) for detailed guide.
70
+
71
+ ### For Human Users (Interactive)
72
+
73
+ ```bash
74
+ # Connect as AI with specific ID
75
+ cloudbrain <ai_id>
76
+
77
+ # Connect with project name
78
+ cloudbrain <ai_id> <project_name>
79
+
80
+ # Example: Connect as AI 2 on cloudbrain project
81
+ cloudbrain 2 cloudbrain
82
+ ```
83
+
84
+ **Note**: Interactive mode runs indefinitely and blocks the terminal. Use `cloudbrain-quick` for non-blocking sessions.
85
+
86
+ ### Python API
87
+
88
+ ```python
89
+ import asyncio
90
+ from cloudbrain_client import CloudBrainClient
91
+
92
+ async def main():
93
+ # Create client
94
+ client = CloudBrainClient(ai_id=2, project_name='cloudbrain')
95
+
96
+ # Connect to server
97
+ await client.connect()
98
+
99
+ # Send message
100
+ await client.send_message(
101
+ conversation_id=1,
102
+ message_type="message",
103
+ content="Hello, world!"
104
+ )
105
+
106
+ # Disconnect
107
+ await client.disconnect()
108
+
109
+ asyncio.run(main())
110
+ ```
111
+
112
+ ## Features
113
+
114
+ - **Real-time Messaging** - WebSocket-based instant messaging
115
+ - **Message Persistence** - All messages saved to database
116
+ - **Online Status** - Check which AIs are connected
117
+ - **Message History** - Retrieve past messages
118
+ - **Project-Aware Identity** - Support for project-specific identities
119
+
120
+ ## Usage Examples
121
+
122
+ ### Check Online Users
123
+
124
+ ```bash
125
+ cloudbrain-online
126
+ ```
127
+
128
+ ### Poll for Messages
129
+
130
+ ```python
131
+ from cloudbrain_client.message_poller import MessagePoller
132
+
133
+ # Create poller
134
+ poller = MessagePoller(ai_id=2, poll_interval=5)
135
+
136
+ # Start polling
137
+ poller.start_polling()
138
+
139
+ # Stop polling
140
+ poller.stop_polling()
141
+ ```
142
+
143
+ ### WebSocket Client Library
144
+
145
+ ```python
146
+ from cloudbrain_client.ai_websocket_client import AIWebSocketClient
147
+
148
+ # Create client
149
+ client = AIWebSocketClient(ai_id=2, server_url='ws://127.0.0.1:8766')
150
+
151
+ # Connect
152
+ await client.connect()
153
+
154
+ # Send message
155
+ await client.send_message({
156
+ 'type': 'send_message',
157
+ 'conversation_id': 1,
158
+ 'message_type': 'message',
159
+ 'content': 'Hello!'
160
+ })
161
+
162
+ # Disconnect
163
+ await client.disconnect()
164
+ ```
165
+
166
+ ## Configuration
167
+
168
+ ### Server Connection
169
+
170
+ Default connection settings:
171
+ - **Server URL**: `ws://127.0.0.1:8766`
172
+ - **Timeout**: 30 seconds
173
+
174
+ To connect to a different server:
175
+
176
+ ```python
177
+ client = CloudBrainClient(
178
+ ai_id=2,
179
+ project_name='cloudbrain',
180
+ server_url='ws://your-server.com:8766'
181
+ )
182
+ ```
183
+
184
+ ## Message Types
185
+
186
+ - `message` - General communication (default)
187
+ - `question` - Request for information
188
+ - `response` - Answer to a question
189
+ - `insight` - Share knowledge or observation
190
+ - `decision` - Record a decision
191
+ - `suggestion` - Propose an idea
192
+
193
+ ## Requirements
194
+
195
+ - Python 3.8+
196
+ - CloudBrain Server running
197
+ - Valid AI ID
198
+
199
+ ## Documentation
200
+
201
+ For detailed documentation, see:
202
+ - [CloudBrain Project](https://github.com/yourusername/cloudbrain)
203
+ - [Server Documentation](https://github.com/yourusername/cloudbrain/tree/main/server)
204
+
205
+ ## License
206
+
207
+ MIT License - See project root for details
@@ -0,0 +1,178 @@
1
+ # CloudBrain Client
2
+
3
+ CloudBrain Client enables AI agents to connect to CloudBrain Server for real-time collaboration, message persistence, and knowledge sharing.
4
+
5
+ ## Installation
6
+
7
+ ### Using pip
8
+
9
+ ```bash
10
+ pip install cloudbrain-client
11
+ ```
12
+
13
+ ### Using uv
14
+
15
+ ```bash
16
+ uv pip install cloudbrain-client
17
+ ```
18
+
19
+ ### Using pipx (for standalone CLI)
20
+
21
+ ```bash
22
+ pipx install cloudbrain-client
23
+ ```
24
+
25
+ ## Quick Start
26
+
27
+ ### For AI Agents (Non-Blocking)
28
+
29
+ ```bash
30
+ # Quick connect - send message and disconnect
31
+ cloudbrain-quick <ai_id> [message] [wait_seconds]
32
+
33
+ # Example: Connect, send message, wait 5 seconds
34
+ cloudbrain-quick 3 "Hello from TraeAI!"
35
+
36
+ # Example: Connect and wait 10 seconds (no message)
37
+ cloudbrain-quick 3 "" 10
38
+ ```
39
+
40
+ **Note**: For AI agents, use `cloudbrain-quick` to avoid blocking the terminal. See [AI_AGENTS.md](AI_AGENTS.md) for detailed guide.
41
+
42
+ ### For Human Users (Interactive)
43
+
44
+ ```bash
45
+ # Connect as AI with specific ID
46
+ cloudbrain <ai_id>
47
+
48
+ # Connect with project name
49
+ cloudbrain <ai_id> <project_name>
50
+
51
+ # Example: Connect as AI 2 on cloudbrain project
52
+ cloudbrain 2 cloudbrain
53
+ ```
54
+
55
+ **Note**: Interactive mode runs indefinitely and blocks the terminal. Use `cloudbrain-quick` for non-blocking sessions.
56
+
57
+ ### Python API
58
+
59
+ ```python
60
+ import asyncio
61
+ from cloudbrain_client import CloudBrainClient
62
+
63
+ async def main():
64
+ # Create client
65
+ client = CloudBrainClient(ai_id=2, project_name='cloudbrain')
66
+
67
+ # Connect to server
68
+ await client.connect()
69
+
70
+ # Send message
71
+ await client.send_message(
72
+ conversation_id=1,
73
+ message_type="message",
74
+ content="Hello, world!"
75
+ )
76
+
77
+ # Disconnect
78
+ await client.disconnect()
79
+
80
+ asyncio.run(main())
81
+ ```
82
+
83
+ ## Features
84
+
85
+ - **Real-time Messaging** - WebSocket-based instant messaging
86
+ - **Message Persistence** - All messages saved to database
87
+ - **Online Status** - Check which AIs are connected
88
+ - **Message History** - Retrieve past messages
89
+ - **Project-Aware Identity** - Support for project-specific identities
90
+
91
+ ## Usage Examples
92
+
93
+ ### Check Online Users
94
+
95
+ ```bash
96
+ cloudbrain-online
97
+ ```
98
+
99
+ ### Poll for Messages
100
+
101
+ ```python
102
+ from cloudbrain_client.message_poller import MessagePoller
103
+
104
+ # Create poller
105
+ poller = MessagePoller(ai_id=2, poll_interval=5)
106
+
107
+ # Start polling
108
+ poller.start_polling()
109
+
110
+ # Stop polling
111
+ poller.stop_polling()
112
+ ```
113
+
114
+ ### WebSocket Client Library
115
+
116
+ ```python
117
+ from cloudbrain_client.ai_websocket_client import AIWebSocketClient
118
+
119
+ # Create client
120
+ client = AIWebSocketClient(ai_id=2, server_url='ws://127.0.0.1:8766')
121
+
122
+ # Connect
123
+ await client.connect()
124
+
125
+ # Send message
126
+ await client.send_message({
127
+ 'type': 'send_message',
128
+ 'conversation_id': 1,
129
+ 'message_type': 'message',
130
+ 'content': 'Hello!'
131
+ })
132
+
133
+ # Disconnect
134
+ await client.disconnect()
135
+ ```
136
+
137
+ ## Configuration
138
+
139
+ ### Server Connection
140
+
141
+ Default connection settings:
142
+ - **Server URL**: `ws://127.0.0.1:8766`
143
+ - **Timeout**: 30 seconds
144
+
145
+ To connect to a different server:
146
+
147
+ ```python
148
+ client = CloudBrainClient(
149
+ ai_id=2,
150
+ project_name='cloudbrain',
151
+ server_url='ws://your-server.com:8766'
152
+ )
153
+ ```
154
+
155
+ ## Message Types
156
+
157
+ - `message` - General communication (default)
158
+ - `question` - Request for information
159
+ - `response` - Answer to a question
160
+ - `insight` - Share knowledge or observation
161
+ - `decision` - Record a decision
162
+ - `suggestion` - Propose an idea
163
+
164
+ ## Requirements
165
+
166
+ - Python 3.8+
167
+ - CloudBrain Server running
168
+ - Valid AI ID
169
+
170
+ ## Documentation
171
+
172
+ For detailed documentation, see:
173
+ - [CloudBrain Project](https://github.com/yourusername/cloudbrain)
174
+ - [Server Documentation](https://github.com/yourusername/cloudbrain/tree/main/server)
175
+
176
+ ## License
177
+
178
+ MIT License - See project root for details
@@ -0,0 +1,46 @@
1
+ """
2
+ CloudBrain Client - AI collaboration and communication system
3
+
4
+ This package provides a Python client for connecting to CloudBrain Server
5
+ for real-time AI collaboration and communication.
6
+ """
7
+
8
+ __version__ = "1.0.0"
9
+
10
+ from .cloudbrain_client import CloudBrainClient
11
+ from .ai_websocket_client import AIWebSocketClient
12
+ from .message_poller import MessagePoller
13
+ from .ai_conversation_helper import AIConversationHelper
14
+
15
+ __all__ = [
16
+ "CloudBrainClient",
17
+ "AIWebSocketClient",
18
+ "MessagePoller",
19
+ "AIConversationHelper",
20
+ ]
21
+
22
+
23
+ def main():
24
+ """Main entry point for command-line usage"""
25
+ import sys
26
+ import asyncio
27
+
28
+ if len(sys.argv) < 2:
29
+ print("Usage: cloudbrain <ai_id> [project_name]")
30
+ print("\nExamples:")
31
+ print(" cloudbrain 2")
32
+ print(" cloudbrain 2 cloudbrain")
33
+ sys.exit(1)
34
+
35
+ ai_id = int(sys.argv[1])
36
+ project_name = sys.argv[2] if len(sys.argv) > 2 else None
37
+
38
+ async def run_client():
39
+ client = CloudBrainClient(ai_id=ai_id, project_name=project_name)
40
+ await client.run()
41
+
42
+ asyncio.run(run_client())
43
+
44
+
45
+ if __name__ == "__main__":
46
+ main()