dominus-sdk-python 3.0.0__tar.gz → 3.0.2__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.
- dominus_sdk_python-3.0.2/PKG-INFO +158 -0
- dominus_sdk_python-3.0.2/README.md +125 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/__init__.py +15 -40
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/config/endpoints.py +10 -10
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/errors.py +78 -1
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/helpers/cache.py +3 -6
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/helpers/core.py +125 -75
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/__init__.py +3 -3
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/ai.py +2 -2
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/artifacts.py +25 -13
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/auth.py +171 -4
- dominus_sdk_python-3.0.2/dominus/namespaces/authority.py +1150 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/db.py +98 -7
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/files.py +24 -12
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/health.py +14 -20
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/logs.py +9 -1
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/redis.py +25 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/secrets.py +88 -9
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/sync.py +5 -2
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/workflow.py +126 -53
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/start.py +281 -374
- dominus_sdk_python-3.0.2/dominus_sdk_python.egg-info/PKG-INFO +158 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus_sdk_python.egg-info/SOURCES.txt +8 -7
- dominus_sdk_python-3.0.2/dominus_sdk_python.egg-info/requires.txt +13 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/pyproject.toml +3 -13
- dominus_sdk_python-3.0.2/tests/test_auth.py +61 -0
- dominus_sdk_python-3.0.2/tests/test_authority_public_vocabulary.py +192 -0
- dominus_sdk_python-3.0.2/tests/test_errors.py +37 -0
- dominus_sdk_python-3.0.2/tests/test_flat_commands.py +55 -0
- dominus_sdk_python-3.0.2/tests/test_health.py +73 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/tests/test_logs.py +2 -1
- dominus_sdk_python-3.0.2/tests/test_provisioning_parity.py +72 -0
- dominus_sdk_python-3.0.2/tests/test_public_exports.py +24 -0
- dominus_sdk_python-3.0.2/tests/test_transport_compat.py +197 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/tests/test_workflow_lifecycle.py +53 -11
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/tests/test_workflow_refs.py +3 -0
- dominus_sdk_python-3.0.0/PKG-INFO +0 -214
- dominus_sdk_python-3.0.0/README.md +0 -172
- dominus_sdk_python-3.0.0/dominus/namespaces/open.py +0 -78
- dominus_sdk_python-3.0.0/dominus/namespaces/oracle/__init__.py +0 -120
- dominus_sdk_python-3.0.0/dominus/namespaces/oracle/audio_capture.py +0 -382
- dominus_sdk_python-3.0.0/dominus/namespaces/oracle/oracle_websocket.py +0 -230
- dominus_sdk_python-3.0.0/dominus/namespaces/oracle/session.py +0 -252
- dominus_sdk_python-3.0.0/dominus/namespaces/oracle/types.py +0 -127
- dominus_sdk_python-3.0.0/dominus/namespaces/oracle/vad_gate.py +0 -276
- dominus_sdk_python-3.0.0/dominus_sdk_python.egg-info/PKG-INFO +0 -214
- dominus_sdk_python-3.0.0/dominus_sdk_python.egg-info/requires.txt +0 -23
- dominus_sdk_python-3.0.0/tests/test_public_exports.py +0 -11
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/config/__init__.py +0 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/helpers/__init__.py +0 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/helpers/auth.py +0 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/helpers/console_capture.py +0 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/helpers/crypto.py +0 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/helpers/sse.py +0 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/helpers/trace.py +0 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/admin.py +0 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/courier.py +0 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/ddl.py +0 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/fastapi.py +0 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/jobs.py +0 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/portal.py +0 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/processor.py +0 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/namespaces/secure.py +0 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus/services/__init__.py +0 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus_sdk_python.egg-info/dependency_links.txt +0 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/dominus_sdk_python.egg-info/top_level.txt +0 -0
- {dominus_sdk_python-3.0.0 → dominus_sdk_python-3.0.2}/setup.cfg +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dominus-sdk-python
|
|
3
|
+
Version: 3.0.2
|
|
4
|
+
Summary: Python SDK for the Dominus gateway-first platform
|
|
5
|
+
Author-email: CareBridge Systems <dev@carebridge.io>
|
|
6
|
+
License: Proprietary
|
|
7
|
+
Project-URL: Homepage, https://github.com/carebridgesystems/dominus-sdk-python
|
|
8
|
+
Project-URL: Repository, https://github.com/carebridgesystems/dominus-sdk-python
|
|
9
|
+
Keywords: dominus,carebridge,sdk,gateway,api,async
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: Other/Proprietary License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Framework :: AsyncIO
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
Requires-Dist: httpx>=0.24.0
|
|
24
|
+
Requires-Dist: bcrypt>=4.0.0
|
|
25
|
+
Requires-Dist: cryptography>=41.0.0
|
|
26
|
+
Provides-Extra: jwt
|
|
27
|
+
Requires-Dist: PyJWT>=2.8.0; extra == "jwt"
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
31
|
+
Provides-Extra: all
|
|
32
|
+
Requires-Dist: PyJWT>=2.8.0; extra == "all"
|
|
33
|
+
|
|
34
|
+
# Dominus SDK for Python
|
|
35
|
+
|
|
36
|
+
Async Python SDK for the Dominus gateway-first service plane.
|
|
37
|
+
|
|
38
|
+
## What This Repo Ships
|
|
39
|
+
|
|
40
|
+
- Python 3.9+ asyncio client for Dominus services
|
|
41
|
+
- Namespace-first API with a small root shortcut surface
|
|
42
|
+
- Gateway-scoped client mode for MCP and other user-JWT sessions
|
|
43
|
+
- Local helpers for JWT verification, trace propagation, retries, and console capture
|
|
44
|
+
- Current package version: `3.0.2`
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install dominus-sdk-python
|
|
50
|
+
pip install dominus-sdk-python[jwt]
|
|
51
|
+
pip install dominus-sdk-python[dev]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Quick Start
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import os
|
|
58
|
+
from dominus import dominus
|
|
59
|
+
|
|
60
|
+
os.environ["DOMINUS_TOKEN"] = "your-psk-token"
|
|
61
|
+
|
|
62
|
+
value = await dominus.secrets.get("DB_URL")
|
|
63
|
+
users = await dominus.db.query("users", filters={"status": "active"})
|
|
64
|
+
await dominus.redis.set("session:123", {"user": "john"}, ttl=3600)
|
|
65
|
+
|
|
66
|
+
run = await dominus.workflow.ensure(
|
|
67
|
+
"wf://carebridge/report-cycle",
|
|
68
|
+
subject="PCM47474562",
|
|
69
|
+
company="summit-radiology",
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
timeline = await dominus.workflow.get_run_timeline(run["run_id"])
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Session-Scoped Clients
|
|
76
|
+
|
|
77
|
+
Production MCP and other user-session callers should instantiate `Dominus` with
|
|
78
|
+
gateway scope context instead of relying on the service-token flow:
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from dominus import Dominus
|
|
82
|
+
|
|
83
|
+
client = Dominus(
|
|
84
|
+
gateway_user_token=user_jwt,
|
|
85
|
+
gateway_org_id=org_id,
|
|
86
|
+
gateway_app_slug=app_slug,
|
|
87
|
+
gateway_env=env,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
me = await client.portal.me(user_token=user_jwt)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
When these fields are set, `_request(..., use_gateway=True)` forwards the user
|
|
94
|
+
JWT and selected scope headers directly through Gateway.
|
|
95
|
+
|
|
96
|
+
## Transport Model
|
|
97
|
+
|
|
98
|
+
- `DOMINUS_TOKEN` is exchanged for a JWT through `POST /jwt/mint`
|
|
99
|
+
- Service JWTs are cached for 14 minutes with a 60-second refresh window
|
|
100
|
+
- Auth-required worker routes still send base64-encoded JSON bodies as `text/plain`
|
|
101
|
+
- Responses may arrive as legacy base64 JSON or raw JSON; the SDK accepts both
|
|
102
|
+
- Gateway-routed namespaces translate `/api/*` to `/svc/*`
|
|
103
|
+
- SSE and binary helpers bypass JSON decoding where appropriate
|
|
104
|
+
|
|
105
|
+
## Namespace Inventory
|
|
106
|
+
|
|
107
|
+
| Namespace | Backing surface | Purpose |
|
|
108
|
+
|-----------|-----------------|---------|
|
|
109
|
+
| `secrets` | Warden | Secrets CRUD |
|
|
110
|
+
| `db` | DB Worker | Database CRUD and metadata |
|
|
111
|
+
| `secure` | DB Worker | Audit-logged data access |
|
|
112
|
+
| `redis` | Redis Worker | Cache, hashes, TTL, counters |
|
|
113
|
+
| `files` | B2 / storage surfaces | File upload, fetch, listing, folders |
|
|
114
|
+
| `auth` | Guardian + JWT routes | RBAC, tenants, pages, secure tables, JWKS |
|
|
115
|
+
| `ddl` | Smith / DDL worker | Schema, migrations, provisioning |
|
|
116
|
+
| `logs` | Logs Worker | Structured logs and tail/query helpers |
|
|
117
|
+
| `portal` | Portal Worker | Login, sessions, profile, preferences, nav |
|
|
118
|
+
| `courier` | Courier Worker | Template email delivery |
|
|
119
|
+
| `health` | Gateway | Health and ping helpers |
|
|
120
|
+
| `admin` | Admin Worker | Admin category reseed/reset |
|
|
121
|
+
| `ai` | Agent Runtime | Agent, completion, RAG, artifacts, results, raw orchestration |
|
|
122
|
+
| `workflow` | Workflow Manager + Authority | Saved workflow CRUD and canonical run lifecycle |
|
|
123
|
+
| `artifacts` | Artifact Worker | Addressed V2 artifacts, bookmarks, watches |
|
|
124
|
+
| `jobs` | Job Worker | Enqueue, poll, dead-letter management |
|
|
125
|
+
| `processor` | Processor | Batch and single-job processing |
|
|
126
|
+
| `sync` | Sync Worker | KV synchronization |
|
|
127
|
+
| `authority` | Dominus Authority | Runs, companies, deploys, managed clients, context |
|
|
128
|
+
| `fastapi` | Local decorators | `@jwt`, `@psk`, `@scopes(...)` |
|
|
129
|
+
|
|
130
|
+
## Root Shortcuts
|
|
131
|
+
|
|
132
|
+
The root `Dominus` object still exposes a small compatibility surface for common
|
|
133
|
+
operations:
|
|
134
|
+
|
|
135
|
+
- `get`, `upsert`
|
|
136
|
+
- `list_tables`, `query_table`, `insert_row`, `update_rows`, `delete_rows`
|
|
137
|
+
- `add_table`, `add_column`, `delete_table`, `delete_column`
|
|
138
|
+
- `await dominus("secrets.get", key="DB_URL")`
|
|
139
|
+
|
|
140
|
+
New code should prefer namespace APIs.
|
|
141
|
+
|
|
142
|
+
## Documentation
|
|
143
|
+
|
|
144
|
+
- [Architecture](docs/architecture.md) - request flow, gateway routing, resilience
|
|
145
|
+
- [Services Reference](docs/services.md) - namespace inventory and endpoint mapping
|
|
146
|
+
- [Development](docs/development.md) - setup, testing, publishing, extension patterns
|
|
147
|
+
|
|
148
|
+
## Verification
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
pip install -e .[dev]
|
|
152
|
+
python -m pytest tests -q
|
|
153
|
+
python -m build
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
Proprietary - CareBridge Systems
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Dominus SDK for Python
|
|
2
|
+
|
|
3
|
+
Async Python SDK for the Dominus gateway-first service plane.
|
|
4
|
+
|
|
5
|
+
## What This Repo Ships
|
|
6
|
+
|
|
7
|
+
- Python 3.9+ asyncio client for Dominus services
|
|
8
|
+
- Namespace-first API with a small root shortcut surface
|
|
9
|
+
- Gateway-scoped client mode for MCP and other user-JWT sessions
|
|
10
|
+
- Local helpers for JWT verification, trace propagation, retries, and console capture
|
|
11
|
+
- Current package version: `3.0.2`
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install dominus-sdk-python
|
|
17
|
+
pip install dominus-sdk-python[jwt]
|
|
18
|
+
pip install dominus-sdk-python[dev]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
import os
|
|
25
|
+
from dominus import dominus
|
|
26
|
+
|
|
27
|
+
os.environ["DOMINUS_TOKEN"] = "your-psk-token"
|
|
28
|
+
|
|
29
|
+
value = await dominus.secrets.get("DB_URL")
|
|
30
|
+
users = await dominus.db.query("users", filters={"status": "active"})
|
|
31
|
+
await dominus.redis.set("session:123", {"user": "john"}, ttl=3600)
|
|
32
|
+
|
|
33
|
+
run = await dominus.workflow.ensure(
|
|
34
|
+
"wf://carebridge/report-cycle",
|
|
35
|
+
subject="PCM47474562",
|
|
36
|
+
company="summit-radiology",
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
timeline = await dominus.workflow.get_run_timeline(run["run_id"])
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Session-Scoped Clients
|
|
43
|
+
|
|
44
|
+
Production MCP and other user-session callers should instantiate `Dominus` with
|
|
45
|
+
gateway scope context instead of relying on the service-token flow:
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from dominus import Dominus
|
|
49
|
+
|
|
50
|
+
client = Dominus(
|
|
51
|
+
gateway_user_token=user_jwt,
|
|
52
|
+
gateway_org_id=org_id,
|
|
53
|
+
gateway_app_slug=app_slug,
|
|
54
|
+
gateway_env=env,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
me = await client.portal.me(user_token=user_jwt)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
When these fields are set, `_request(..., use_gateway=True)` forwards the user
|
|
61
|
+
JWT and selected scope headers directly through Gateway.
|
|
62
|
+
|
|
63
|
+
## Transport Model
|
|
64
|
+
|
|
65
|
+
- `DOMINUS_TOKEN` is exchanged for a JWT through `POST /jwt/mint`
|
|
66
|
+
- Service JWTs are cached for 14 minutes with a 60-second refresh window
|
|
67
|
+
- Auth-required worker routes still send base64-encoded JSON bodies as `text/plain`
|
|
68
|
+
- Responses may arrive as legacy base64 JSON or raw JSON; the SDK accepts both
|
|
69
|
+
- Gateway-routed namespaces translate `/api/*` to `/svc/*`
|
|
70
|
+
- SSE and binary helpers bypass JSON decoding where appropriate
|
|
71
|
+
|
|
72
|
+
## Namespace Inventory
|
|
73
|
+
|
|
74
|
+
| Namespace | Backing surface | Purpose |
|
|
75
|
+
|-----------|-----------------|---------|
|
|
76
|
+
| `secrets` | Warden | Secrets CRUD |
|
|
77
|
+
| `db` | DB Worker | Database CRUD and metadata |
|
|
78
|
+
| `secure` | DB Worker | Audit-logged data access |
|
|
79
|
+
| `redis` | Redis Worker | Cache, hashes, TTL, counters |
|
|
80
|
+
| `files` | B2 / storage surfaces | File upload, fetch, listing, folders |
|
|
81
|
+
| `auth` | Guardian + JWT routes | RBAC, tenants, pages, secure tables, JWKS |
|
|
82
|
+
| `ddl` | Smith / DDL worker | Schema, migrations, provisioning |
|
|
83
|
+
| `logs` | Logs Worker | Structured logs and tail/query helpers |
|
|
84
|
+
| `portal` | Portal Worker | Login, sessions, profile, preferences, nav |
|
|
85
|
+
| `courier` | Courier Worker | Template email delivery |
|
|
86
|
+
| `health` | Gateway | Health and ping helpers |
|
|
87
|
+
| `admin` | Admin Worker | Admin category reseed/reset |
|
|
88
|
+
| `ai` | Agent Runtime | Agent, completion, RAG, artifacts, results, raw orchestration |
|
|
89
|
+
| `workflow` | Workflow Manager + Authority | Saved workflow CRUD and canonical run lifecycle |
|
|
90
|
+
| `artifacts` | Artifact Worker | Addressed V2 artifacts, bookmarks, watches |
|
|
91
|
+
| `jobs` | Job Worker | Enqueue, poll, dead-letter management |
|
|
92
|
+
| `processor` | Processor | Batch and single-job processing |
|
|
93
|
+
| `sync` | Sync Worker | KV synchronization |
|
|
94
|
+
| `authority` | Dominus Authority | Runs, companies, deploys, managed clients, context |
|
|
95
|
+
| `fastapi` | Local decorators | `@jwt`, `@psk`, `@scopes(...)` |
|
|
96
|
+
|
|
97
|
+
## Root Shortcuts
|
|
98
|
+
|
|
99
|
+
The root `Dominus` object still exposes a small compatibility surface for common
|
|
100
|
+
operations:
|
|
101
|
+
|
|
102
|
+
- `get`, `upsert`
|
|
103
|
+
- `list_tables`, `query_table`, `insert_row`, `update_rows`, `delete_rows`
|
|
104
|
+
- `add_table`, `add_column`, `delete_table`, `delete_column`
|
|
105
|
+
- `await dominus("secrets.get", key="DB_URL")`
|
|
106
|
+
|
|
107
|
+
New code should prefer namespace APIs.
|
|
108
|
+
|
|
109
|
+
## Documentation
|
|
110
|
+
|
|
111
|
+
- [Architecture](docs/architecture.md) - request flow, gateway routing, resilience
|
|
112
|
+
- [Services Reference](docs/services.md) - namespace inventory and endpoint mapping
|
|
113
|
+
- [Development](docs/development.md) - setup, testing, publishing, extension patterns
|
|
114
|
+
|
|
115
|
+
## Verification
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
pip install -e .[dev]
|
|
119
|
+
python -m pytest tests -q
|
|
120
|
+
python -m build
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
Proprietary - CareBridge Systems
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"""
|
|
2
2
|
CB Dominus SDK - Ultra-flat async SDK for CareBridge Services
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
Namespace-first API:
|
|
5
5
|
from dominus import dominus
|
|
6
6
|
|
|
7
|
-
# Secrets (root level shortcuts)
|
|
8
|
-
value = await dominus.get("DB_URL")
|
|
9
|
-
await dominus.upsert("KEY", "value")
|
|
10
|
-
|
|
11
7
|
# Secrets namespace
|
|
12
8
|
value = await dominus.secrets.get("DB_URL")
|
|
13
9
|
await dominus.secrets.upsert("KEY", "value")
|
|
@@ -38,7 +34,7 @@ Ultra-Flat API:
|
|
|
38
34
|
await dominus.courier.send("welcome", to="user@example.com", from_email="hello@app.com", model={})
|
|
39
35
|
|
|
40
36
|
# Secure table access with audit logging
|
|
41
|
-
rows = await dominus.
|
|
37
|
+
rows = await dominus.secure.query("patients", context=SecureAccessContext(
|
|
42
38
|
reason="Reviewing chart",
|
|
43
39
|
actor=user_id
|
|
44
40
|
))
|
|
@@ -49,23 +45,16 @@ Ultra-Flat API:
|
|
|
49
45
|
# Portal authentication
|
|
50
46
|
session = await dominus.portal.login("user@example.com", "password", "tenant-id")
|
|
51
47
|
|
|
52
|
-
# Open DSN and raw SQL
|
|
53
|
-
dsn = await dominus.open.dsn()
|
|
54
|
-
result = await dominus.open.execute("SELECT * FROM users WHERE id = $1", {"1": user_id})
|
|
55
|
-
|
|
56
48
|
# Health
|
|
57
49
|
status = await dominus.health.check()
|
|
58
|
-
await dominus.health.ping()
|
|
59
|
-
await dominus.health.warmup()
|
|
60
50
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
Flat shortcuts remain for common gateway-backed secrets and DB operations:
|
|
52
|
+
value = await dominus.get("DB_URL")
|
|
53
|
+
await dominus.upsert("KEY", "value")
|
|
64
54
|
|
|
65
|
-
|
|
66
|
-
await dominus.
|
|
67
|
-
await dominus
|
|
68
|
-
await dominus.insert_row("users", {"name": "John"})
|
|
55
|
+
Supported string commands:
|
|
56
|
+
result = await dominus("secrets.get", key="DB_URL")
|
|
57
|
+
await dominus("sql.app.list_tables", schema="public")
|
|
69
58
|
|
|
70
59
|
Crypto Helpers:
|
|
71
60
|
from dominus import hash_password, hash_psk, generate_token
|
|
@@ -98,8 +87,6 @@ from .namespaces.redis import RedisNamespace
|
|
|
98
87
|
from .namespaces.logs import LogsNamespace
|
|
99
88
|
from .namespaces.courier import CourierNamespace
|
|
100
89
|
from .namespaces.health import HealthNamespace
|
|
101
|
-
from .namespaces.open import OpenNamespace
|
|
102
|
-
|
|
103
90
|
# Export new namespaces (Node.js SDK parity)
|
|
104
91
|
from .namespaces.artifacts import (
|
|
105
92
|
ARTIFACT_REF_PREFIX,
|
|
@@ -123,14 +110,7 @@ from .namespaces.artifacts import (
|
|
|
123
110
|
from .namespaces.jobs import JobsNamespace
|
|
124
111
|
from .namespaces.processor import ProcessorNamespace
|
|
125
112
|
from .namespaces.sync import SyncNamespace
|
|
126
|
-
|
|
127
|
-
# Export Oracle namespace for speech-to-text
|
|
128
|
-
from .namespaces.oracle import (
|
|
129
|
-
OracleNamespace,
|
|
130
|
-
OracleSession,
|
|
131
|
-
OracleSessionOptions,
|
|
132
|
-
VADState,
|
|
133
|
-
)
|
|
113
|
+
from .namespaces.authority import AuthorityNamespace
|
|
134
114
|
|
|
135
115
|
# Export AI namespace for agent-runtime operations
|
|
136
116
|
from .namespaces.ai import (
|
|
@@ -146,7 +126,7 @@ from .helpers.cache import (
|
|
|
146
126
|
dominus_cache,
|
|
147
127
|
CircuitBreaker,
|
|
148
128
|
DominusCache,
|
|
149
|
-
|
|
129
|
+
gateway_circuit_breaker,
|
|
150
130
|
exponential_backoff_with_jitter,
|
|
151
131
|
)
|
|
152
132
|
|
|
@@ -154,7 +134,7 @@ from .helpers.cache import (
|
|
|
154
134
|
from .helpers.core import (
|
|
155
135
|
verify_jwt_locally,
|
|
156
136
|
is_jwt_valid,
|
|
157
|
-
|
|
137
|
+
mint_selected_scope_jwt,
|
|
158
138
|
)
|
|
159
139
|
|
|
160
140
|
# Export trace utilities for distributed tracing
|
|
@@ -181,7 +161,7 @@ from .errors import (
|
|
|
181
161
|
TimeoutError as DominusTimeoutError,
|
|
182
162
|
)
|
|
183
163
|
|
|
184
|
-
__version__ = "3.0.
|
|
164
|
+
__version__ = "3.0.2"
|
|
185
165
|
__all__ = [
|
|
186
166
|
# Main SDK instance
|
|
187
167
|
"dominus",
|
|
@@ -209,7 +189,6 @@ __all__ = [
|
|
|
209
189
|
"LogsNamespace",
|
|
210
190
|
"CourierNamespace",
|
|
211
191
|
"HealthNamespace",
|
|
212
|
-
"OpenNamespace",
|
|
213
192
|
# New namespaces (Node.js SDK parity)
|
|
214
193
|
"ARTIFACT_REF_PREFIX",
|
|
215
194
|
"DISPLAY_REF_PREFIX",
|
|
@@ -231,11 +210,7 @@ __all__ = [
|
|
|
231
210
|
"JobsNamespace",
|
|
232
211
|
"ProcessorNamespace",
|
|
233
212
|
"SyncNamespace",
|
|
234
|
-
|
|
235
|
-
"OracleNamespace",
|
|
236
|
-
"OracleSession",
|
|
237
|
-
"OracleSessionOptions",
|
|
238
|
-
"VADState",
|
|
213
|
+
"AuthorityNamespace",
|
|
239
214
|
# AI namespace for agent-runtime operations
|
|
240
215
|
"AiNamespace",
|
|
241
216
|
"RagSubNamespace",
|
|
@@ -246,12 +221,12 @@ __all__ = [
|
|
|
246
221
|
"dominus_cache",
|
|
247
222
|
"CircuitBreaker",
|
|
248
223
|
"DominusCache",
|
|
249
|
-
"
|
|
224
|
+
"gateway_circuit_breaker",
|
|
250
225
|
"exponential_backoff_with_jitter",
|
|
251
226
|
# JWT verification utilities
|
|
252
227
|
"verify_jwt_locally",
|
|
253
228
|
"is_jwt_valid",
|
|
254
|
-
"
|
|
229
|
+
"mint_selected_scope_jwt",
|
|
255
230
|
# Trace utilities
|
|
256
231
|
"generate_trace_id",
|
|
257
232
|
"get_current_trace_id",
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Dominus SDK Endpoints
|
|
3
3
|
|
|
4
|
-
Gateway URL for service routing.
|
|
4
|
+
Gateway URL for service routing and health checks.
|
|
5
5
|
JWT URL for authentication (JWT minting).
|
|
6
6
|
Logs URL for log ingestion.
|
|
7
|
-
|
|
7
|
+
Base URL for SDK requests (defaults to gateway).
|
|
8
8
|
|
|
9
9
|
Configuration:
|
|
10
10
|
Set DOMINUS_GATEWAY_URL to override the gateway URL.
|
|
11
11
|
Set DOMINUS_JWT_URL to override the JWT minting URL.
|
|
12
12
|
Set DOMINUS_LOGS_URL to override the logs URL.
|
|
13
|
-
Set DOMINUS_BASE_URL to override the
|
|
13
|
+
Set DOMINUS_BASE_URL to override the SDK request base URL.
|
|
14
14
|
Example: export DOMINUS_BASE_URL=http://localhost:5000
|
|
15
15
|
|
|
16
16
|
Usage:
|
|
@@ -22,7 +22,7 @@ import os
|
|
|
22
22
|
_DEFAULT_GATEWAY_URL = "https://gateway.getdominus.app"
|
|
23
23
|
_DEFAULT_JWT_URL = "https://jwt.getdominus.app"
|
|
24
24
|
_DEFAULT_LOGS_URL = "https://logs.getdominus.app"
|
|
25
|
-
_DEFAULT_BASE_URL =
|
|
25
|
+
_DEFAULT_BASE_URL = _DEFAULT_GATEWAY_URL
|
|
26
26
|
|
|
27
27
|
# Gateway URL for service routing (can be overridden via DOMINUS_GATEWAY_URL)
|
|
28
28
|
GATEWAY_URL = os.environ.get("DOMINUS_GATEWAY_URL", _DEFAULT_GATEWAY_URL)
|
|
@@ -33,11 +33,11 @@ JWT_URL = os.environ.get("DOMINUS_JWT_URL", _DEFAULT_JWT_URL)
|
|
|
33
33
|
# Logs URL for log ingestion (can be overridden via DOMINUS_LOGS_URL)
|
|
34
34
|
LOGS_URL = os.environ.get("DOMINUS_LOGS_URL", _DEFAULT_LOGS_URL)
|
|
35
35
|
|
|
36
|
-
# Base URL for
|
|
36
|
+
# Base URL for SDK requests (can be overridden via DOMINUS_BASE_URL environment variable)
|
|
37
37
|
BASE_URL = os.environ.get("DOMINUS_BASE_URL", _DEFAULT_BASE_URL)
|
|
38
38
|
|
|
39
|
-
# Legacy aliases
|
|
40
|
-
SOVEREIGN_URL = BASE_URL
|
|
39
|
+
# Legacy aliases retained as gateway-first aliases.
|
|
40
|
+
SOVEREIGN_URL = BASE_URL
|
|
41
41
|
ARCHITECT_URL = BASE_URL
|
|
42
42
|
ORCHESTRATOR_URL = BASE_URL
|
|
43
43
|
WARDEN_URL = BASE_URL
|
|
@@ -97,17 +97,17 @@ def get_logs_url() -> str:
|
|
|
97
97
|
|
|
98
98
|
def get_base_url() -> str:
|
|
99
99
|
"""
|
|
100
|
-
Get the
|
|
100
|
+
Get the SDK request base URL.
|
|
101
101
|
|
|
102
102
|
Returns the value of DOMINUS_BASE_URL environment variable if set,
|
|
103
|
-
otherwise returns the default
|
|
103
|
+
otherwise returns the default gateway URL.
|
|
104
104
|
"""
|
|
105
105
|
return os.environ.get("DOMINUS_BASE_URL", _DEFAULT_BASE_URL)
|
|
106
106
|
|
|
107
107
|
|
|
108
108
|
# DEPRECATED - use get_base_url()
|
|
109
109
|
def get_sovereign_url(environment: str = None) -> str:
|
|
110
|
-
"""Deprecated: Use get_base_url() instead.
|
|
110
|
+
"""Deprecated: Use get_base_url() instead."""
|
|
111
111
|
return BASE_URL
|
|
112
112
|
|
|
113
113
|
|
|
@@ -6,6 +6,59 @@ Custom exceptions for the Dominus SDK with structured error information.
|
|
|
6
6
|
from typing import Any, Dict, Optional
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
def _first_string(*values: Any) -> Optional[str]:
|
|
10
|
+
for value in values:
|
|
11
|
+
if isinstance(value, str) and value.strip():
|
|
12
|
+
return value
|
|
13
|
+
return None
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _first_bool(*values: Any) -> Optional[bool]:
|
|
17
|
+
for value in values:
|
|
18
|
+
if isinstance(value, bool):
|
|
19
|
+
return value
|
|
20
|
+
return None
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _default_category_for_status(status_code: Optional[int]) -> Optional[str]:
|
|
24
|
+
if status_code in {400, 422}:
|
|
25
|
+
return "validation"
|
|
26
|
+
if status_code == 401:
|
|
27
|
+
return "auth"
|
|
28
|
+
if status_code == 403:
|
|
29
|
+
return "forbidden"
|
|
30
|
+
if status_code == 404:
|
|
31
|
+
return "not_found"
|
|
32
|
+
if status_code == 409:
|
|
33
|
+
return "conflict"
|
|
34
|
+
if status_code and status_code >= 500:
|
|
35
|
+
return "upstream"
|
|
36
|
+
return None
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _normalize_kernel_details(
|
|
40
|
+
status_code: Optional[int],
|
|
41
|
+
details: Optional[Dict[str, Any]],
|
|
42
|
+
) -> Dict[str, Any]:
|
|
43
|
+
normalized = dict(details or {})
|
|
44
|
+
category = _first_string(normalized.get("category")) or _default_category_for_status(status_code)
|
|
45
|
+
if category:
|
|
46
|
+
normalized["category"] = category
|
|
47
|
+
code = _first_string(normalized.get("code")) or (f"http.{status_code}" if status_code else None)
|
|
48
|
+
if code:
|
|
49
|
+
normalized["code"] = code
|
|
50
|
+
trace_id = _first_string(normalized.get("trace_id"), normalized.get("traceId"))
|
|
51
|
+
if trace_id:
|
|
52
|
+
normalized["trace_id"] = trace_id
|
|
53
|
+
request_id = _first_string(normalized.get("request_id"), normalized.get("requestId"))
|
|
54
|
+
if request_id:
|
|
55
|
+
normalized["request_id"] = request_id
|
|
56
|
+
retryable = _first_bool(normalized.get("retryable"))
|
|
57
|
+
if retryable is not None:
|
|
58
|
+
normalized["retryable"] = retryable
|
|
59
|
+
return normalized
|
|
60
|
+
|
|
61
|
+
|
|
9
62
|
class DominusError(Exception):
|
|
10
63
|
"""
|
|
11
64
|
Base exception for all Dominus SDK errors.
|
|
@@ -16,6 +69,8 @@ class DominusError(Exception):
|
|
|
16
69
|
Attributes:
|
|
17
70
|
message: Human-readable error message
|
|
18
71
|
status_code: HTTP status code (if applicable)
|
|
72
|
+
code: Stable machine-readable error code
|
|
73
|
+
category: Error category from the kernel contract
|
|
19
74
|
details: Additional error details from backend
|
|
20
75
|
endpoint: The endpoint that was called (if applicable)
|
|
21
76
|
"""
|
|
@@ -29,12 +84,19 @@ class DominusError(Exception):
|
|
|
29
84
|
):
|
|
30
85
|
self.message = message
|
|
31
86
|
self.status_code = status_code
|
|
32
|
-
self.details = details
|
|
87
|
+
self.details = _normalize_kernel_details(status_code, details)
|
|
33
88
|
self.endpoint = endpoint
|
|
89
|
+
self.code = _first_string(self.details.get("code"))
|
|
90
|
+
self.category = _first_string(self.details.get("category"))
|
|
91
|
+
self.trace_id = _first_string(self.details.get("trace_id"), self.details.get("traceId"))
|
|
92
|
+
self.request_id = _first_string(self.details.get("request_id"), self.details.get("requestId"))
|
|
93
|
+
self.retryable = _first_bool(self.details.get("retryable"))
|
|
34
94
|
super().__init__(self.message)
|
|
35
95
|
|
|
36
96
|
def __str__(self) -> str:
|
|
37
97
|
parts = [self.message]
|
|
98
|
+
if self.code:
|
|
99
|
+
parts.append(f"[{self.code}]")
|
|
38
100
|
if self.status_code:
|
|
39
101
|
parts.append(f"(status {self.status_code})")
|
|
40
102
|
if self.endpoint:
|
|
@@ -45,10 +107,25 @@ class DominusError(Exception):
|
|
|
45
107
|
return (
|
|
46
108
|
f"DominusError(message={self.message!r}, "
|
|
47
109
|
f"status_code={self.status_code}, "
|
|
110
|
+
f"code={self.code!r}, "
|
|
111
|
+
f"category={self.category!r}, "
|
|
48
112
|
f"details={self.details!r}, "
|
|
49
113
|
f"endpoint={self.endpoint!r})"
|
|
50
114
|
)
|
|
51
115
|
|
|
116
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
117
|
+
return {
|
|
118
|
+
"message": self.message,
|
|
119
|
+
"status_code": self.status_code,
|
|
120
|
+
"code": self.code,
|
|
121
|
+
"category": self.category,
|
|
122
|
+
"details": self.details,
|
|
123
|
+
"endpoint": self.endpoint,
|
|
124
|
+
"trace_id": self.trace_id,
|
|
125
|
+
"request_id": self.request_id,
|
|
126
|
+
"retryable": self.retryable,
|
|
127
|
+
}
|
|
128
|
+
|
|
52
129
|
|
|
53
130
|
class AuthenticationError(DominusError):
|
|
54
131
|
"""Raised when authentication fails (invalid token, expired JWT, etc.)."""
|
|
@@ -5,7 +5,7 @@ Exports:
|
|
|
5
5
|
- CircuitBreaker: Circuit breaker class for resilience
|
|
6
6
|
- DominusCache: Encrypted cache class
|
|
7
7
|
- dominus_cache: Singleton cache instance
|
|
8
|
-
-
|
|
8
|
+
- gateway_circuit_breaker: Circuit breaker used by gateway JWT minting
|
|
9
9
|
- exponential_backoff_with_jitter: Backoff calculation utility
|
|
10
10
|
"""
|
|
11
11
|
import time
|
|
@@ -189,12 +189,9 @@ class DominusCache:
|
|
|
189
189
|
# Singleton instances
|
|
190
190
|
dominus_cache = DominusCache(default_ttl=300)
|
|
191
191
|
|
|
192
|
-
# Circuit breaker for
|
|
193
|
-
|
|
192
|
+
# Circuit breaker for gateway JWT minting (prevents retry storms)
|
|
193
|
+
gateway_circuit_breaker = CircuitBreaker(
|
|
194
194
|
failure_threshold=5, # Open after 5 consecutive failures
|
|
195
195
|
recovery_timeout=30.0, # Try again after 30 seconds
|
|
196
196
|
half_open_max_calls=1 # Allow 1 test call in half-open state
|
|
197
197
|
)
|
|
198
|
-
|
|
199
|
-
# Backward compatibility alias
|
|
200
|
-
gateway_circuit_breaker = orchestrator_circuit_breaker
|