dominus-sdk-python 3.0.1__tar.gz → 3.0.3__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 (67) hide show
  1. dominus_sdk_python-3.0.3/PKG-INFO +159 -0
  2. dominus_sdk_python-3.0.3/README.md +126 -0
  3. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/__init__.py +15 -40
  4. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/config/endpoints.py +23 -23
  5. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/errors.py +78 -1
  6. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/helpers/cache.py +3 -6
  7. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/helpers/core.py +125 -54
  8. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/__init__.py +3 -3
  9. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/artifacts.py +25 -13
  10. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/auth.py +171 -4
  11. dominus_sdk_python-3.0.3/dominus/namespaces/authority.py +1355 -0
  12. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/db.py +98 -7
  13. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/files.py +24 -12
  14. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/health.py +14 -20
  15. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/logs.py +9 -1
  16. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/redis.py +25 -0
  17. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/secrets.py +88 -9
  18. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/sync.py +5 -2
  19. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/workflow.py +100 -19
  20. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/start.py +281 -374
  21. dominus_sdk_python-3.0.3/dominus_sdk_python.egg-info/PKG-INFO +159 -0
  22. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus_sdk_python.egg-info/SOURCES.txt +8 -7
  23. dominus_sdk_python-3.0.3/dominus_sdk_python.egg-info/requires.txt +13 -0
  24. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/pyproject.toml +3 -13
  25. dominus_sdk_python-3.0.3/tests/test_auth.py +61 -0
  26. dominus_sdk_python-3.0.3/tests/test_authority_public_vocabulary.py +263 -0
  27. dominus_sdk_python-3.0.3/tests/test_errors.py +37 -0
  28. dominus_sdk_python-3.0.3/tests/test_flat_commands.py +55 -0
  29. dominus_sdk_python-3.0.3/tests/test_health.py +73 -0
  30. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/tests/test_logs.py +2 -1
  31. dominus_sdk_python-3.0.3/tests/test_provisioning_parity.py +72 -0
  32. dominus_sdk_python-3.0.3/tests/test_public_exports.py +24 -0
  33. dominus_sdk_python-3.0.3/tests/test_transport_compat.py +197 -0
  34. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/tests/test_workflow_lifecycle.py +42 -0
  35. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/tests/test_workflow_refs.py +3 -0
  36. dominus_sdk_python-3.0.1/PKG-INFO +0 -211
  37. dominus_sdk_python-3.0.1/README.md +0 -169
  38. dominus_sdk_python-3.0.1/dominus/namespaces/open.py +0 -78
  39. dominus_sdk_python-3.0.1/dominus/namespaces/oracle/__init__.py +0 -120
  40. dominus_sdk_python-3.0.1/dominus/namespaces/oracle/audio_capture.py +0 -382
  41. dominus_sdk_python-3.0.1/dominus/namespaces/oracle/oracle_websocket.py +0 -230
  42. dominus_sdk_python-3.0.1/dominus/namespaces/oracle/session.py +0 -252
  43. dominus_sdk_python-3.0.1/dominus/namespaces/oracle/types.py +0 -127
  44. dominus_sdk_python-3.0.1/dominus/namespaces/oracle/vad_gate.py +0 -276
  45. dominus_sdk_python-3.0.1/dominus_sdk_python.egg-info/PKG-INFO +0 -211
  46. dominus_sdk_python-3.0.1/dominus_sdk_python.egg-info/requires.txt +0 -23
  47. dominus_sdk_python-3.0.1/tests/test_public_exports.py +0 -11
  48. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/config/__init__.py +0 -0
  49. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/helpers/__init__.py +0 -0
  50. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/helpers/auth.py +0 -0
  51. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/helpers/console_capture.py +0 -0
  52. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/helpers/crypto.py +0 -0
  53. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/helpers/sse.py +0 -0
  54. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/helpers/trace.py +0 -0
  55. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/admin.py +0 -0
  56. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/ai.py +0 -0
  57. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/courier.py +0 -0
  58. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/ddl.py +0 -0
  59. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/fastapi.py +0 -0
  60. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/jobs.py +0 -0
  61. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/portal.py +0 -0
  62. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/processor.py +0 -0
  63. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/namespaces/secure.py +0 -0
  64. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus/services/__init__.py +0 -0
  65. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus_sdk_python.egg-info/dependency_links.txt +0 -0
  66. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/dominus_sdk_python.egg-info/top_level.txt +0 -0
  67. {dominus_sdk_python-3.0.1 → dominus_sdk_python-3.0.3}/setup.cfg +0 -0
@@ -0,0 +1,159 @@
1
+ Metadata-Version: 2.4
2
+ Name: dominus-sdk-python
3
+ Version: 3.0.3
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
+ - Default HTTP targets are the production gateway (`https://gateway.getdominus.app`); they do not change based on your app’s git branch or PyPI package variant. Set `DOMINUS_GATEWAY_URL` (or `DOMINUS_BASE_URL` / `DOMINUS_JWT_URL`) only for local or custom routing.
99
+ - `DOMINUS_TOKEN` is exchanged for a JWT through `POST /jwt/mint`
100
+ - Service JWTs are cached for 14 minutes with a 60-second refresh window
101
+ - Auth-required worker routes still send base64-encoded JSON bodies as `text/plain`
102
+ - Responses may arrive as legacy base64 JSON or raw JSON; the SDK accepts both
103
+ - Gateway-routed namespaces translate `/api/*` to `/svc/*`
104
+ - SSE and binary helpers bypass JSON decoding where appropriate
105
+
106
+ ## Namespace Inventory
107
+
108
+ | Namespace | Backing surface | Purpose |
109
+ |-----------|-----------------|---------|
110
+ | `secrets` | Warden | Secrets CRUD |
111
+ | `db` | DB Worker | Database CRUD and metadata |
112
+ | `secure` | DB Worker | Audit-logged data access |
113
+ | `redis` | Redis Worker | Cache, hashes, TTL, counters |
114
+ | `files` | B2 / storage surfaces | File upload, fetch, listing, folders |
115
+ | `auth` | Guardian + JWT routes | RBAC, tenants, pages, secure tables, JWKS |
116
+ | `ddl` | Smith / DDL worker | Schema, migrations, provisioning |
117
+ | `logs` | Logs Worker | Structured logs and tail/query helpers |
118
+ | `portal` | Portal Worker | Login, sessions, profile, preferences, nav |
119
+ | `courier` | Courier Worker | Template email delivery |
120
+ | `health` | Gateway | Health and ping helpers |
121
+ | `admin` | Admin Worker | Admin category reseed/reset |
122
+ | `ai` | Agent Runtime | Agent, completion, RAG, artifacts, results, raw orchestration |
123
+ | `workflow` | Workflow Manager + Authority | Saved workflow CRUD and canonical run lifecycle |
124
+ | `artifacts` | Artifact Worker | Addressed V2 artifacts, bookmarks, watches |
125
+ | `jobs` | Job Worker | Enqueue, poll, dead-letter management |
126
+ | `processor` | Processor | Batch and single-job processing |
127
+ | `sync` | Sync Worker | KV synchronization |
128
+ | `authority` | Dominus Authority | Runs, companies, deploys, managed clients, context |
129
+ | `fastapi` | Local decorators | `@jwt`, `@psk`, `@scopes(...)` |
130
+
131
+ ## Root Shortcuts
132
+
133
+ The root `Dominus` object still exposes a small compatibility surface for common
134
+ operations:
135
+
136
+ - `get`, `upsert`
137
+ - `list_tables`, `query_table`, `insert_row`, `update_rows`, `delete_rows`
138
+ - `add_table`, `add_column`, `delete_table`, `delete_column`
139
+ - `await dominus("secrets.get", key="DB_URL")`
140
+
141
+ New code should prefer namespace APIs.
142
+
143
+ ## Documentation
144
+
145
+ - [Architecture](docs/architecture.md) - request flow, gateway routing, resilience
146
+ - [Services Reference](docs/services.md) - namespace inventory and endpoint mapping
147
+ - [Development](docs/development.md) - setup, testing, publishing, extension patterns
148
+
149
+ ## Verification
150
+
151
+ ```bash
152
+ pip install -e .[dev]
153
+ python -m pytest tests -q
154
+ python -m build
155
+ ```
156
+
157
+ ## License
158
+
159
+ Proprietary - CareBridge Systems
@@ -0,0 +1,126 @@
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
+ - Default HTTP targets are the production gateway (`https://gateway.getdominus.app`); they do not change based on your app’s git branch or PyPI package variant. Set `DOMINUS_GATEWAY_URL` (or `DOMINUS_BASE_URL` / `DOMINUS_JWT_URL`) only for local or custom routing.
66
+ - `DOMINUS_TOKEN` is exchanged for a JWT through `POST /jwt/mint`
67
+ - Service JWTs are cached for 14 minutes with a 60-second refresh window
68
+ - Auth-required worker routes still send base64-encoded JSON bodies as `text/plain`
69
+ - Responses may arrive as legacy base64 JSON or raw JSON; the SDK accepts both
70
+ - Gateway-routed namespaces translate `/api/*` to `/svc/*`
71
+ - SSE and binary helpers bypass JSON decoding where appropriate
72
+
73
+ ## Namespace Inventory
74
+
75
+ | Namespace | Backing surface | Purpose |
76
+ |-----------|-----------------|---------|
77
+ | `secrets` | Warden | Secrets CRUD |
78
+ | `db` | DB Worker | Database CRUD and metadata |
79
+ | `secure` | DB Worker | Audit-logged data access |
80
+ | `redis` | Redis Worker | Cache, hashes, TTL, counters |
81
+ | `files` | B2 / storage surfaces | File upload, fetch, listing, folders |
82
+ | `auth` | Guardian + JWT routes | RBAC, tenants, pages, secure tables, JWKS |
83
+ | `ddl` | Smith / DDL worker | Schema, migrations, provisioning |
84
+ | `logs` | Logs Worker | Structured logs and tail/query helpers |
85
+ | `portal` | Portal Worker | Login, sessions, profile, preferences, nav |
86
+ | `courier` | Courier Worker | Template email delivery |
87
+ | `health` | Gateway | Health and ping helpers |
88
+ | `admin` | Admin Worker | Admin category reseed/reset |
89
+ | `ai` | Agent Runtime | Agent, completion, RAG, artifacts, results, raw orchestration |
90
+ | `workflow` | Workflow Manager + Authority | Saved workflow CRUD and canonical run lifecycle |
91
+ | `artifacts` | Artifact Worker | Addressed V2 artifacts, bookmarks, watches |
92
+ | `jobs` | Job Worker | Enqueue, poll, dead-letter management |
93
+ | `processor` | Processor | Batch and single-job processing |
94
+ | `sync` | Sync Worker | KV synchronization |
95
+ | `authority` | Dominus Authority | Runs, companies, deploys, managed clients, context |
96
+ | `fastapi` | Local decorators | `@jwt`, `@psk`, `@scopes(...)` |
97
+
98
+ ## Root Shortcuts
99
+
100
+ The root `Dominus` object still exposes a small compatibility surface for common
101
+ operations:
102
+
103
+ - `get`, `upsert`
104
+ - `list_tables`, `query_table`, `insert_row`, `update_rows`, `delete_rows`
105
+ - `add_table`, `add_column`, `delete_table`, `delete_column`
106
+ - `await dominus("secrets.get", key="DB_URL")`
107
+
108
+ New code should prefer namespace APIs.
109
+
110
+ ## Documentation
111
+
112
+ - [Architecture](docs/architecture.md) - request flow, gateway routing, resilience
113
+ - [Services Reference](docs/services.md) - namespace inventory and endpoint mapping
114
+ - [Development](docs/development.md) - setup, testing, publishing, extension patterns
115
+
116
+ ## Verification
117
+
118
+ ```bash
119
+ pip install -e .[dev]
120
+ python -m pytest tests -q
121
+ python -m build
122
+ ```
123
+
124
+ ## License
125
+
126
+ Proprietary - CareBridge Systems
@@ -1,13 +1,9 @@
1
1
  """
2
2
  CB Dominus SDK - Ultra-flat async SDK for CareBridge Services
3
3
 
4
- Ultra-Flat API:
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.db_secure.query("patients", context=SecureAccessContext(
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
- Backward Compatible APIs:
62
- # String-based API
63
- result = await dominus("secrets.get", key="DB_URL")
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
- # Flat API (root level shortcuts for common operations)
66
- await dominus.list_tables()
67
- await dominus.query_table("users")
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
- orchestrator_circuit_breaker,
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
- mint_selected_project_jwt,
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.1"
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
- # Oracle namespace for speech-to-text
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
- "orchestrator_circuit_breaker",
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
- "mint_selected_project_jwt",
229
+ "mint_selected_scope_jwt",
255
230
  # Trace utilities
256
231
  "generate_trace_id",
257
232
  "get_current_trace_id",
@@ -1,16 +1,20 @@
1
1
  """
2
2
  Dominus SDK Endpoints
3
3
 
4
- Gateway URL for service routing.
5
- JWT URL for authentication (JWT minting).
4
+ Gateway URL for service routing and health checks.
5
+ JWT URL for authentication (JWT minting) — defaults to the same host as the gateway.
6
6
  Logs URL for log ingestion.
7
- Orchestrator URL for service calls (legacy).
7
+ Base URL for SDK requests (defaults to gateway).
8
+
9
+ Defaults always target the production gateway. They do not depend on the caller’s
10
+ git branch, PyPI package variant, or deployment environment. Override only with
11
+ DOMINUS_* env vars for local or advanced routing.
8
12
 
9
13
  Configuration:
10
14
  Set DOMINUS_GATEWAY_URL to override the gateway URL.
11
- Set DOMINUS_JWT_URL to override the JWT minting URL.
15
+ Set DOMINUS_JWT_URL to override the JWT minting URL (defaults to gateway URL).
12
16
  Set DOMINUS_LOGS_URL to override the logs URL.
13
- Set DOMINUS_BASE_URL to override the orchestrator URL.
17
+ Set DOMINUS_BASE_URL to override the SDK request base URL.
14
18
  Example: export DOMINUS_BASE_URL=http://localhost:5000
15
19
 
16
20
  Usage:
@@ -18,26 +22,24 @@ Usage:
18
22
  """
19
23
  import os
20
24
 
21
- # Default URLs - Cloudflare Workers
25
+ # Production gateway (Cloudflare Worker). Canonical default for all SDK HTTP traffic.
22
26
  _DEFAULT_GATEWAY_URL = "https://gateway.getdominus.app"
23
- _DEFAULT_JWT_URL = "https://jwt.getdominus.app"
24
27
  _DEFAULT_LOGS_URL = "https://logs.getdominus.app"
25
- _DEFAULT_BASE_URL = "https://dominus-orchestrator-production-775398158805.us-east4.run.app"
26
28
 
27
29
  # Gateway URL for service routing (can be overridden via DOMINUS_GATEWAY_URL)
28
30
  GATEWAY_URL = os.environ.get("DOMINUS_GATEWAY_URL", _DEFAULT_GATEWAY_URL)
29
31
 
30
- # JWT URL for authentication (can be overridden via DOMINUS_JWT_URL)
31
- JWT_URL = os.environ.get("DOMINUS_JWT_URL", _DEFAULT_JWT_URL)
32
+ # JWT mint/JWKS: same host as gateway by default (matches Node SDK).
33
+ JWT_URL = os.environ.get("DOMINUS_JWT_URL", GATEWAY_URL)
32
34
 
33
35
  # Logs URL for log ingestion (can be overridden via DOMINUS_LOGS_URL)
34
36
  LOGS_URL = os.environ.get("DOMINUS_LOGS_URL", _DEFAULT_LOGS_URL)
35
37
 
36
- # Base URL for service calls (can be overridden via DOMINUS_BASE_URL environment variable)
37
- BASE_URL = os.environ.get("DOMINUS_BASE_URL", _DEFAULT_BASE_URL)
38
+ # Base URL for non-gateway SDK paths defaults to the same resolved gateway URL.
39
+ BASE_URL = os.environ.get("DOMINUS_BASE_URL", GATEWAY_URL)
38
40
 
39
- # Legacy aliases (all point to orchestrator now) - DEPRECATED
40
- SOVEREIGN_URL = BASE_URL # Deprecated: use BASE_URL or get_gateway_url()
41
+ # Legacy aliases retained as gateway-first aliases.
42
+ SOVEREIGN_URL = BASE_URL
41
43
  ARCHITECT_URL = BASE_URL
42
44
  ORCHESTRATOR_URL = BASE_URL
43
45
  WARDEN_URL = BASE_URL
@@ -77,12 +79,11 @@ def get_gateway_url() -> str:
77
79
 
78
80
  def get_jwt_url() -> str:
79
81
  """
80
- Get the JWT worker URL for authentication (JWT minting/validation).
82
+ Get the base URL for JWT mint/JWKS (defaults to the same host as the gateway).
81
83
 
82
- Returns the value of DOMINUS_JWT_URL environment variable if set,
83
- otherwise returns the default Cloudflare Worker URL.
84
+ Returns DOMINUS_JWT_URL if set, otherwise the same resolution as get_gateway_url().
84
85
  """
85
- return os.environ.get("DOMINUS_JWT_URL", _DEFAULT_JWT_URL)
86
+ return os.environ.get("DOMINUS_JWT_URL", get_gateway_url())
86
87
 
87
88
 
88
89
  def get_logs_url() -> str:
@@ -97,17 +98,16 @@ def get_logs_url() -> str:
97
98
 
98
99
  def get_base_url() -> str:
99
100
  """
100
- Get the dominus-orchestrator base URL for service calls.
101
+ Get the SDK request base URL.
101
102
 
102
- Returns the value of DOMINUS_BASE_URL environment variable if set,
103
- otherwise returns the default production URL.
103
+ Returns DOMINUS_BASE_URL if set, otherwise the same resolution as get_gateway_url().
104
104
  """
105
- return os.environ.get("DOMINUS_BASE_URL", _DEFAULT_BASE_URL)
105
+ return os.environ.get("DOMINUS_BASE_URL", get_gateway_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. 'Sovereign' is the legacy name for the gateway."""
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 or {}
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
- - orchestrator_circuit_breaker: Circuit breaker for orchestrator
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 orchestrator (prevents retry storms)
193
- orchestrator_circuit_breaker = CircuitBreaker(
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