devops-bot-sdk 1.0.0__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.
Files changed (31) hide show
  1. devops_bot_sdk-1.2.0/PKG-INFO +458 -0
  2. devops_bot_sdk-1.2.0/README.md +437 -0
  3. devops_bot_sdk-1.2.0/devops_bot_sdk.egg-info/PKG-INFO +458 -0
  4. devops_bot_sdk-1.2.0/devops_bot_sdk.egg-info/SOURCES.txt +27 -0
  5. devops_bot_sdk-1.2.0/devops_bot_sdk.egg-info/dependency_links.txt +1 -0
  6. devops_bot_sdk-1.2.0/devops_bot_sdk.egg-info/entry_points.txt +2 -0
  7. devops_bot_sdk-1.2.0/devops_bot_sdk.egg-info/requires.txt +13 -0
  8. devops_bot_sdk-1.2.0/devops_bot_sdk.egg-info/top_level.txt +1 -0
  9. {devops_bot_sdk-1.0.0 → devops_bot_sdk-1.2.0}/pyproject.toml +5 -5
  10. devops_bot_sdk-1.2.0/sdk/__init__.py +55 -0
  11. devops_bot_sdk-1.2.0/sdk/client.py +366 -0
  12. devops_bot_sdk-1.2.0/sdk/collectors/__init__.py +9 -0
  13. devops_bot_sdk-1.2.0/sdk/collectors/files.py +102 -0
  14. devops_bot_sdk-1.2.0/sdk/collectors/process.py +89 -0
  15. devops_bot_sdk-1.2.0/sdk/collectors/screenshot.py +82 -0
  16. devops_bot_sdk-1.2.0/sdk/config.py +154 -0
  17. devops_bot_sdk-1.2.0/sdk/exceptions.py +58 -0
  18. devops_bot_sdk-1.2.0/sdk/ipc/__init__.py +1 -0
  19. devops_bot_sdk-1.2.0/sdk/ipc/electron_bridge.py +139 -0
  20. devops_bot_sdk-1.2.0/sdk/ipc/handlers.py +243 -0
  21. devops_bot_sdk-1.2.0/sdk/models/__init__.py +1 -0
  22. devops_bot_sdk-1.2.0/sdk/models/envelope.py +45 -0
  23. devops_bot_sdk-1.2.0/sdk/models/requests.py +73 -0
  24. devops_bot_sdk-1.2.0/sdk/models/responses.py +67 -0
  25. devops_bot_sdk-1.2.0/sdk/models/snapshots.py +21 -0
  26. devops_bot_sdk-1.2.0/sdk/py.typed +0 -0
  27. devops_bot_sdk-1.2.0/sdk/sse.py +112 -0
  28. devops_bot_sdk-1.2.0/sdk/test.py +12 -0
  29. devops_bot_sdk-1.0.0/PKG-INFO +0 -178
  30. devops_bot_sdk-1.0.0/README.md +0 -157
  31. {devops_bot_sdk-1.0.0 → devops_bot_sdk-1.2.0}/setup.cfg +0 -0
@@ -0,0 +1,458 @@
1
+ Metadata-Version: 2.4
2
+ Name: devops-bot-sdk
3
+ Version: 1.2.0
4
+ Summary: DevOps Bot Desktop SDK — thin client for the AgentOS Electron desktop app
5
+ Author: noumanaziz2128
6
+ License-Expression: LicenseRef-Proprietary
7
+ Project-URL: Homepage, https://agentos.io
8
+ Project-URL: Repository, https://github.com/consultancy-outfit/DevOpsBot-SDK
9
+ Requires-Python: >=3.11
10
+ Description-Content-Type: text/markdown
11
+ Requires-Dist: httpx>=0.27
12
+ Requires-Dist: pydantic>=2.0
13
+ Requires-Dist: cryptography>=42
14
+ Provides-Extra: screenshot
15
+ Requires-Dist: Pillow>=10.0; extra == "screenshot"
16
+ Provides-Extra: process
17
+ Requires-Dist: psutil>=5.9; extra == "process"
18
+ Provides-Extra: all
19
+ Requires-Dist: Pillow>=10.0; extra == "all"
20
+ Requires-Dist: psutil>=5.9; extra == "all"
21
+
22
+ # DevOpsBot SDK
23
+
24
+ Python client for the DevOpsBot desktop app. Provides the `agentos` CLI to configure credentials and a `BackendClient` to interact with the DevOpsBot backend.
25
+
26
+ **Private package** — requires GitHub access to install.
27
+
28
+ > For a full walkthrough including SSH setup, end-to-end testing, and troubleshooting see [SETUP_GUIDE.md](SETUP_GUIDE.md).
29
+
30
+ ---
31
+
32
+ ## Requirements
33
+
34
+ | | Minimum | Check |
35
+ |---|---|---|
36
+ | Python | 3.11+ | `python3 --version` (Linux/macOS) · `python --version` (Windows) |
37
+ | Git | any | `git --version` |
38
+ | DevOpsBot account | — | Needed for your API token |
39
+
40
+ ---
41
+
42
+ ## Installation
43
+
44
+ Choose the method that fits your setup. **Option A (venv)** is recommended for
45
+ developers. **Option B (system Python)** works for everyone else and requires
46
+ no extra steps.
47
+
48
+ ---
49
+
50
+ ### Option A — Virtual environment (recommended for developers)
51
+
52
+ A virtual environment keeps the SDK isolated from your system Python.
53
+
54
+ **Linux / macOS:**
55
+ ```bash
56
+ # Create and activate a venv
57
+ python3 -m venv devopsbot-env
58
+ source devopsbot-env/bin/activate
59
+
60
+ # Install via SSH
61
+ pip install "git+ssh://git@github.com/consultancy-outfit/DevOpsBot-SDK.git"
62
+
63
+ # OR install via HTTPS token
64
+ pip install "git+https://<YOUR_GITHUB_TOKEN>@github.com/consultancy-outfit/DevOpsBot-SDK.git"
65
+ ```
66
+
67
+ **Windows (Command Prompt):**
68
+ ```cmd
69
+ python -m venv devopsbot-env
70
+ devopsbot-env\Scripts\activate
71
+
72
+ pip install "git+ssh://git@github.com/consultancy-outfit/DevOpsBot-SDK.git"
73
+ ```
74
+
75
+ **Windows (PowerShell):**
76
+ ```powershell
77
+ python -m venv devopsbot-env
78
+ devopsbot-env\Scripts\Activate.ps1
79
+
80
+ pip install "git+ssh://git@github.com/consultancy-outfit/DevOpsBot-SDK.git"
81
+ ```
82
+
83
+ > The venv must be **activated** every time you open a new terminal before using
84
+ > `agentos` or running SDK scripts. You only create it once.
85
+
86
+ ---
87
+
88
+ ### Option B — System Python (simplest, works for everyone)
89
+
90
+ Installs directly into your default Python environment — no activation needed.
91
+
92
+ **Linux / macOS:**
93
+ ```bash
94
+ # via SSH
95
+ pip3 install --break-system-packages "git+ssh://git@github.com/consultancy-outfit/DevOpsBot-SDK.git"
96
+
97
+ # via HTTPS token
98
+ pip3 install --break-system-packages "git+https://<YOUR_GITHUB_TOKEN>@github.com/consultancy-outfit/DevOpsBot-SDK.git"
99
+ ```
100
+
101
+ **Windows:**
102
+ ```cmd
103
+ # via SSH
104
+ pip install "git+ssh://git@github.com/consultancy-outfit/DevOpsBot-SDK.git"
105
+
106
+ # via HTTPS token
107
+ pip install "git+https://<YOUR_GITHUB_TOKEN>@github.com/consultancy-outfit/DevOpsBot-SDK.git"
108
+ ```
109
+
110
+ > `--break-system-packages` is required on Ubuntu 22.04+ and Debian 12+ due to PEP 668.
111
+ > It is safe — it only installs this package, it does not affect your system Python.
112
+ > Windows does not need this flag.
113
+
114
+ > If `pip` is not found on Windows, use `python -m pip install ...` instead.
115
+
116
+ ---
117
+
118
+ ### With optional collectors
119
+
120
+ Append `[all]` to either install command to enable screen capture and process listing:
121
+
122
+ **Linux / macOS (system Python):**
123
+ ```bash
124
+ pip3 install --break-system-packages "git+ssh://git@github.com/consultancy-outfit/DevOpsBot-SDK.git[all]"
125
+ ```
126
+
127
+ **Linux / macOS (venv, after activation):**
128
+ ```bash
129
+ pip install "git+ssh://git@github.com/consultancy-outfit/DevOpsBot-SDK.git[all]"
130
+ ```
131
+
132
+ **Windows:**
133
+ ```cmd
134
+ pip install "git+ssh://git@github.com/consultancy-outfit/DevOpsBot-SDK.git[all]"
135
+ ```
136
+
137
+ ---
138
+
139
+ ## Configure
140
+
141
+ Get your API token from **DevOpsBot Web App → Settings → API Tokens → Generate Token**.
142
+ Token format: `co_<uuid>_<32-hex-secret>`
143
+
144
+ ```bash
145
+ agentos configure
146
+ ```
147
+
148
+ To replace an existing token:
149
+
150
+ ```bash
151
+ agentos configure --rotate
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Quick Start
157
+
158
+ ```python
159
+ import asyncio
160
+ from sdk import BackendClient
161
+
162
+ async def main():
163
+ client = BackendClient.from_config() # reads ~/.agentos/config.toml
164
+
165
+ profile = await client.bootstrap()
166
+ print(f"Logged in — tier: {profile.tier}")
167
+
168
+ async for envelope in client.chat("my-thread", "What tasks are open?"):
169
+ if envelope.type == "delta":
170
+ print(envelope.data["text"], end="", flush=True)
171
+ elif envelope.type == "done":
172
+ print()
173
+ break
174
+
175
+ asyncio.run(main())
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Agents
181
+
182
+ The orchestrator runs AI agent pipelines server-side. You submit a task, receive
183
+ a stream of progress envelopes, and approve or reject the outcome.
184
+
185
+ ### Run an agent
186
+
187
+ ```python
188
+ import asyncio
189
+ from sdk import BackendClient
190
+ from sdk.models.requests import OrchestratorRequest
191
+
192
+ async def main():
193
+ client = BackendClient.from_config()
194
+
195
+ req = OrchestratorRequest(
196
+ task_input="hello",
197
+ intent="greet", # optional — helps the backend route the task
198
+ )
199
+
200
+ async for envelope in client.orchestrator_run(req):
201
+ print(f"[{envelope.type}] {envelope.data}")
202
+
203
+ if envelope.type == "awaiting_approval":
204
+ # Task needs a human decision before it continues
205
+ task_id = envelope.data["task_id"]
206
+ decision = input("Approve? (yes/no): ").strip().lower()
207
+ await client.approve_task(
208
+ task_id,
209
+ decision="approved" if decision == "yes" else "rejected",
210
+ note="Reviewed and approved by operator.",
211
+ )
212
+
213
+ elif envelope.type in ("done", "error"):
214
+ break
215
+
216
+ asyncio.run(main())
217
+ ```
218
+
219
+ ### Envelope types emitted by the orchestrator
220
+
221
+ | Type | When it fires | Useful data |
222
+ |---|---|---|
223
+ | `pipeline_started` | Task accepted by backend | `task_id` |
224
+ | `pipeline.<key>` | A pipeline context field updated | `key`, `value` |
225
+ | `awaiting_approval` | Pipeline paused — human decision required | `task_id` |
226
+ | `done` | Pipeline completed | `task_id`, `approval_status` |
227
+ | `error` | Unrecoverable failure | `code`, `message` |
228
+
229
+ ### List and approve tasks
230
+
231
+ ```python
232
+ import asyncio
233
+ from sdk import BackendClient
234
+
235
+ async def main():
236
+ client = BackendClient.from_config()
237
+
238
+ # List tasks waiting for approval
239
+ result = await client.list_tasks(status="To Do", limit=20)
240
+ for task in result.get("tasks", []):
241
+ print(task["task_id"], task.get("summary", ""))
242
+
243
+ # Approve a specific task by ID
244
+ await client.approve_task("task-id-here", decision="approved", note="LGTM")
245
+
246
+ asyncio.run(main())
247
+ ```
248
+
249
+ ### Test agents end-to-end (no repo clone needed)
250
+
251
+ #### Linux / macOS
252
+
253
+ ```bash
254
+ python3 - << 'EOF'
255
+ import asyncio
256
+ from sdk import BackendClient
257
+ from sdk.models.requests import OrchestratorRequest
258
+
259
+ async def main():
260
+ client = BackendClient.from_config()
261
+
262
+ print("Starting agent pipeline...")
263
+ req = OrchestratorRequest(task_input="hello")
264
+
265
+ async for envelope in client.orchestrator_run(req):
266
+ print(f" [{envelope.type}] {envelope.data}")
267
+
268
+ if envelope.type == "awaiting_approval":
269
+ print(" → Auto-approving for test...")
270
+ await client.approve_task(envelope.data["task_id"], decision="approved")
271
+
272
+ elif envelope.type == "done":
273
+ print("\nAgent completed successfully.")
274
+ break
275
+
276
+ elif envelope.type == "error":
277
+ print(f"\nAgent error: {envelope.data}")
278
+ break
279
+
280
+ asyncio.run(main())
281
+ EOF
282
+ ```
283
+
284
+ #### Windows (PowerShell)
285
+
286
+ ```powershell
287
+ python - << 'EOF'
288
+ import asyncio
289
+ from sdk import BackendClient
290
+ from sdk.models.requests import OrchestratorRequest
291
+
292
+ async def main():
293
+ client = BackendClient.from_config()
294
+
295
+ print("Starting agent pipeline...")
296
+ req = OrchestratorRequest(task_input="hello")
297
+
298
+ async for envelope in client.orchestrator_run(req):
299
+ print(f" [{envelope.type}] {envelope.data}")
300
+
301
+ if envelope.type == "awaiting_approval":
302
+ print(" -> Auto-approving for test...")
303
+ await client.approve_task(envelope.data["task_id"], decision="approved")
304
+
305
+ elif envelope.type == "done":
306
+ print("\nAgent completed successfully.")
307
+ break
308
+
309
+ elif envelope.type == "error":
310
+ print(f"\nAgent error: {envelope.data}")
311
+ break
312
+
313
+ asyncio.run(main())
314
+ EOF
315
+ ```
316
+
317
+ #### Windows (Command Prompt)
318
+
319
+ Save as `test_agent.py` and run `python test_agent.py`:
320
+
321
+ ```python
322
+ # test_agent.py
323
+ import asyncio
324
+ from sdk import BackendClient
325
+ from sdk.models.requests import OrchestratorRequest
326
+
327
+ async def main():
328
+ client = BackendClient.from_config()
329
+
330
+ print("Starting agent pipeline...")
331
+ req = OrchestratorRequest(task_input="hello")
332
+
333
+ async for envelope in client.orchestrator_run(req):
334
+ print(f" [{envelope.type}] {envelope.data}")
335
+
336
+ if envelope.type == "awaiting_approval":
337
+ print(" -> Auto-approving for test...")
338
+ await client.approve_task(envelope.data["task_id"], decision="approved")
339
+
340
+ elif envelope.type == "done":
341
+ print("\nAgent completed successfully.")
342
+ break
343
+
344
+ elif envelope.type == "error":
345
+ print(f"\nAgent error: {envelope.data}")
346
+ break
347
+
348
+ asyncio.run(main())
349
+ ```
350
+
351
+ #### Expected output
352
+
353
+ ```
354
+ Starting agent pipeline...
355
+ [pipeline_started] {'task_id': 'tsk_abc123'}
356
+ [pipeline.summary] {'key': 'summary', 'value': 'Processing...'}
357
+ [awaiting_approval] {'task_id': 'tsk_abc123'}
358
+ -> Auto-approving for test...
359
+ [done] {'task_id': 'tsk_abc123', 'approval_status': 'approved'}
360
+
361
+ Agent completed successfully.
362
+ ```
363
+
364
+ ---
365
+
366
+ ## Error Handling
367
+
368
+ ```python
369
+ from sdk import BackendClient, TokenNotConfigured, BackendAuthFailed, BackendUnreachable
370
+
371
+ try:
372
+ client = BackendClient.from_config()
373
+ await client.ping()
374
+ except TokenNotConfigured:
375
+ print("Run: agentos configure")
376
+ except BackendAuthFailed:
377
+ print("Token expired — run: agentos configure --rotate")
378
+ except BackendUnreachable as e:
379
+ print(f"Backend unreachable: {e}")
380
+ ```
381
+
382
+ ---
383
+
384
+ ## Upgrade
385
+
386
+ **Linux / macOS (system Python):**
387
+ ```bash
388
+ pip3 install --break-system-packages --upgrade "git+ssh://git@github.com/consultancy-outfit/DevOpsBot-SDK.git"
389
+ ```
390
+
391
+ **Linux / macOS (venv — activate first):**
392
+ ```bash
393
+ source devopsbot-env/bin/activate
394
+ pip install --upgrade "git+ssh://git@github.com/consultancy-outfit/DevOpsBot-SDK.git"
395
+ ```
396
+
397
+ **Windows:**
398
+ ```cmd
399
+ pip install --upgrade "git+ssh://git@github.com/consultancy-outfit/DevOpsBot-SDK.git"
400
+ ```
401
+
402
+ ---
403
+
404
+ ## Uninstall
405
+
406
+ ### Remove the SDK package
407
+
408
+ **Linux / macOS (system Python):**
409
+ ```bash
410
+ pip3 uninstall devops-bot-sdk -y
411
+ ```
412
+
413
+ **Linux / macOS (venv — activate first):**
414
+ ```bash
415
+ source devopsbot-env/bin/activate
416
+ pip uninstall devops-bot-sdk -y
417
+ ```
418
+
419
+ **Windows:**
420
+ ```cmd
421
+ pip uninstall devops-bot-sdk -y
422
+ ```
423
+
424
+ ### Remove the venv entirely (if you used one)
425
+
426
+ **Linux / macOS:**
427
+ ```bash
428
+ rm -rf devopsbot-env
429
+ ```
430
+
431
+ **Windows (Command Prompt):**
432
+ ```cmd
433
+ rmdir /s /q devopsbot-env
434
+ ```
435
+
436
+ **Windows (PowerShell):**
437
+ ```powershell
438
+ Remove-Item -Recurse -Force devopsbot-env
439
+ ```
440
+
441
+ ### Remove saved credentials
442
+
443
+ Deletes the stored token and backend URL from your machine.
444
+
445
+ **Linux / macOS:**
446
+ ```bash
447
+ rm -rf ~/.agentos
448
+ ```
449
+
450
+ **Windows (Command Prompt):**
451
+ ```cmd
452
+ rmdir /s /q %USERPROFILE%\.agentos
453
+ ```
454
+
455
+ **Windows (PowerShell):**
456
+ ```powershell
457
+ Remove-Item -Recurse -Force $HOME\.agentos
458
+ ```