haltstate-sdk 0.7.0__tar.gz → 0.8.0.dev0__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 (27) hide show
  1. haltstate_sdk-0.8.0.dev0/PKG-INFO +303 -0
  2. haltstate_sdk-0.8.0.dev0/README.md +255 -0
  3. {haltstate_sdk-0.7.0 → haltstate_sdk-0.8.0.dev0}/haltstate/__init__.py +17 -3
  4. haltstate_sdk-0.8.0.dev0/haltstate/decorators.py +21 -0
  5. haltstate_sdk-0.8.0.dev0/haltstate_sdk.egg-info/PKG-INFO +303 -0
  6. {haltstate_sdk-0.7.0 → haltstate_sdk-0.8.0.dev0}/haltstate_sdk.egg-info/SOURCES.txt +4 -1
  7. haltstate_sdk-0.8.0.dev0/haltstate_sdk.egg-info/requires.txt +2 -0
  8. {haltstate_sdk-0.7.0 → haltstate_sdk-0.8.0.dev0}/janus/__init__.py +10 -2
  9. {haltstate_sdk-0.7.0 → haltstate_sdk-0.8.0.dev0}/janus/client.py +523 -80
  10. {haltstate_sdk-0.7.0 → haltstate_sdk-0.8.0.dev0}/janus/exceptions.py +39 -0
  11. haltstate_sdk-0.8.0.dev0/janus/semiotic_probe.py +309 -0
  12. {haltstate_sdk-0.7.0 → haltstate_sdk-0.8.0.dev0}/pyproject.toml +5 -5
  13. haltstate_sdk-0.8.0.dev0/tests/test_client.py +941 -0
  14. haltstate_sdk-0.8.0.dev0/tests/test_semiotic_probe.py +126 -0
  15. haltstate_sdk-0.7.0/PKG-INFO +0 -180
  16. haltstate_sdk-0.7.0/README.md +0 -154
  17. haltstate_sdk-0.7.0/haltstate_sdk.egg-info/PKG-INFO +0 -180
  18. haltstate_sdk-0.7.0/haltstate_sdk.egg-info/requires.txt +0 -1
  19. haltstate_sdk-0.7.0/tests/test_client.py +0 -117
  20. {haltstate_sdk-0.7.0 → haltstate_sdk-0.8.0.dev0}/LICENSE +0 -0
  21. {haltstate_sdk-0.7.0 → haltstate_sdk-0.8.0.dev0}/haltstate_sdk.egg-info/dependency_links.txt +0 -0
  22. {haltstate_sdk-0.7.0 → haltstate_sdk-0.8.0.dev0}/haltstate_sdk.egg-info/top_level.txt +0 -0
  23. {haltstate_sdk-0.7.0 → haltstate_sdk-0.8.0.dev0}/janus/async_client.py +0 -0
  24. {haltstate_sdk-0.7.0 → haltstate_sdk-0.8.0.dev0}/janus/decorators.py +0 -0
  25. {haltstate_sdk-0.7.0 → haltstate_sdk-0.8.0.dev0}/janus/models.py +0 -0
  26. {haltstate_sdk-0.7.0 → haltstate_sdk-0.8.0.dev0}/setup.cfg +0 -0
  27. {haltstate_sdk-0.7.0 → haltstate_sdk-0.8.0.dev0}/tests/test_import.py +0 -0
@@ -0,0 +1,303 @@
1
+ Metadata-Version: 2.4
2
+ Name: haltstate-sdk
3
+ Version: 0.8.0.dev0
4
+ Summary: HaltState Python SDK - action control and Proof Packs for AI agents
5
+ Author-email: Krystal Unity <support@krystalunity.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Krystal Unity
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://haltstate.ai
29
+ Project-URL: Repository, https://github.com/StartKrystal/krystal-unity-core
30
+ Project-URL: Issues, https://github.com/StartKrystal/krystal-unity-core/issues
31
+ Project-URL: Documentation, https://haltstate.ai/docs
32
+ Keywords: haltstate,ai,policy,sdk,action-control,proof-packs,governance
33
+ Classifier: Development Status :: 4 - Beta
34
+ Classifier: Intended Audience :: Developers
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Python :: 3.9
37
+ Classifier: Programming Language :: Python :: 3.10
38
+ Classifier: Programming Language :: Python :: 3.11
39
+ Classifier: Programming Language :: Python :: 3.12
40
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
41
+ Classifier: Topic :: Security
42
+ Requires-Python: >=3.9
43
+ Description-Content-Type: text/markdown
44
+ License-File: LICENSE
45
+ Requires-Dist: httpx>=0.24
46
+ Requires-Dist: cryptography>=41
47
+ Dynamic: license-file
48
+
49
+ # HaltState SDK
50
+
51
+ [![PyPI](https://img.shields.io/pypi/v/haltstate-sdk.svg)](https://pypi.org/project/haltstate-sdk/)
52
+
53
+ Action control and Proof Packs for autonomous AI agents. Perform pre-action checks, approvals, and post-action reporting with minimal code.
54
+
55
+ ## Semiotic Probe (source candidate, not activated)
56
+
57
+ ```python
58
+ probe = client.connect_semiotic_probe("openai", "gpt-4.1", lambda raw, limit: isolated_model(raw, max_tokens=limit))
59
+ # Or use probe.poll_once() and probe.close() in an application-owned lifecycle.
60
+ ```
61
+
62
+ The hook must be fresh and isolated: no history, memory, retrieval, tools, or side effects.
63
+
64
+ Canonical public base URL: `https://haltstate.ai`
65
+
66
+ Canonical governance namespace: `/api/haltstate/sentinel/*`
67
+
68
+ Current SDKs default to `https://haltstate.ai`. Guard endpoints use the branded `/api/haltstate/sentinel/*` namespace when available. The released `check()`, `report()`, and approval-polling paths still use supported legacy `/api/sentinel/*` compatibility aliases until matching branded backend routes are registered.
69
+
70
+ ## Replay safety status
71
+
72
+ Replay-ledger hardening is implemented and locally verified in this source
73
+ tree. Production activation remains pending the caller-first quiesce/drain
74
+ window, migration 106, matching API/SDK deployment with no mixed workers, and
75
+ the delayed/replay route smokes; this is not a production-live claim.
76
+
77
+ On the hardened path, each tenant and idempotency key binds to one exact
78
+ operation: agent, action, resource, normalized parameters, and risk class. The
79
+ stored decision carries the evaluated policy version; a retry with changed
80
+ operation data is rejected. Approvals expire, and an eligible operation
81
+ receives at most one permit. Exact outcome-report retries receive the original
82
+ receipt.
83
+
84
+ The durable lifecycle is recorded in an append-only, hash-chained event log.
85
+ That log is not externally anchored or immune to a database superuser.
86
+ Destination idempotency remains the customer's responsibility: HaltState
87
+ cannot guarantee exactly-once execution inside an external payment, email, or
88
+ infrastructure system. Hosted LLM inference is likewise not claimed to be
89
+ bit-for-bit deterministic.
90
+
91
+ ### Post-cutover idempotency epoch
92
+
93
+ During the controlled replay-ledger cutover, configure the UUID epoch issued
94
+ for that activation:
95
+
96
+ ```python
97
+ client = HaltStateClient(
98
+ tenant_id="acme",
99
+ api_key="hs_xxx",
100
+ idempotency_epoch="11111111-2222-4333-8444-555555555555",
101
+ )
102
+ ```
103
+
104
+ After configuration, `guard()` calls that omit `idempotency_key` generate a
105
+ qualified key in the form `hsr1:<epoch>:<uuid>`. The SDK never prefixes,
106
+ rewrites, or upgrades an explicit caller-supplied key. Consequently, explicit
107
+ keys sent after cutover must already be fully qualified for the active epoch.
108
+ Keep `idempotency_epoch` unset only for preactivation compatibility, where
109
+ omitted keys retain the legacy plain-UUID behavior.
110
+ Keep this HaltState guard key separate from the destination's stable business
111
+ idempotency key; the destination key must not rotate with the guard epoch.
112
+
113
+ Configure the epoch only after guarded callers and schedulers are quiesced,
114
+ guard ingress is closed, legacy API workers are stopped, and old work is
115
+ drained or reconciled. Reopen with no mixed workers. Once epoch-qualified work
116
+ is admitted, do not roll back to a pre-replay binary under open ingress; remain
117
+ fail closed and roll forward.
118
+
119
+ ## Installation
120
+
121
+ PyPI currently serves `0.7.0`. The replay-safe contract in this tree is the
122
+ unpublished `0.8.0.dev0` candidate and must be installed from the reviewed
123
+ source checkout until it is released.
124
+
125
+ ```bash
126
+ # Published baseline:
127
+ pip install haltstate-sdk
128
+
129
+ # Replay-safe source candidate, from the repository root:
130
+ pip install ./packages/haltstate-sdk
131
+ ```
132
+
133
+ ## Quickstart (sync)
134
+ ```python
135
+ from haltstate import HaltStateClient
136
+
137
+ client = HaltStateClient(
138
+ tenant_id="your_tenant_id",
139
+ api_key="hs_xyz",
140
+ base_url="https://haltstate.ai",
141
+ fail_open=False,
142
+ )
143
+
144
+ decision = client.check(
145
+ action="payment.process",
146
+ params={"amount": 5000, "currency": "USD"},
147
+ agent_id="payment-bot-01",
148
+ )
149
+
150
+ if decision.allowed:
151
+ process_payment(...)
152
+ client.report(decision, status="success", result={"transaction_id": "tx_123"}, action="payment.process", agent_id="payment-bot-01")
153
+ elif decision.requires_approval:
154
+ print(f"Approval required: {decision.reason}")
155
+ else:
156
+ print(f"Action denied: {decision.reason}")
157
+ ```
158
+
159
+ ## Guard Pattern
160
+
161
+ For actions requiring human approval, use the idempotent guard pattern:
162
+
163
+ ```python
164
+ from haltstate import HaltStateClient, ApprovalPending, ActionDenied
165
+
166
+ def process_high_value_payment(invoice_id: str, amount: float):
167
+ operator_epoch = "11111111-2222-4333-8444-555555555555"
168
+ destination_key = f"payment-{invoice_id}"
169
+ guard_key = f"hsr1:{operator_epoch}:{destination_key}"
170
+ report_id = "40000000-0000-4000-8000-000000000501"
171
+ client = HaltStateClient(
172
+ tenant_id="acme",
173
+ api_key="hs_xxx",
174
+ base_url="https://haltstate.ai",
175
+ )
176
+
177
+ try:
178
+ with client.guard(
179
+ action="payment.process",
180
+ agent_id="payment-bot",
181
+ params={"invoice_id": invoice_id, "amount": amount},
182
+ idempotency_key=guard_key,
183
+ resource=f"invoice/{invoice_id}",
184
+ risk_class="high",
185
+ report_id=report_id,
186
+ ) as permit:
187
+ permit.validate_for_execution()
188
+ result = execute_payment_once(
189
+ invoice_id=invoice_id,
190
+ amount=amount,
191
+ idempotency_key=destination_key,
192
+ )
193
+ print(f"Approved by {permit.approver} at {permit.approved_at}")
194
+ return result
195
+
196
+ except ApprovalPending:
197
+ print("Awaiting human approval...")
198
+ return {"status": "pending"}
199
+
200
+ except ActionDenied as e:
201
+ print(f"Denied: {e.reason}")
202
+ raise
203
+ ```
204
+
205
+ Key features:
206
+ - **Exact operation binding**: The same key and same proposal replay the stored
207
+ decision; changed agent, action, resource, risk, or parameters conflict.
208
+ - **Expiring approval authority**: Approvals expire, and the SDK refuses an
209
+ expired executable response before entering the action.
210
+ - **One-permit rule**: A retry after permit issuance receives an
211
+ `ActionAlreadyStarted` error, not replacement authority. A lost permit or
212
+ missing outcome report requires destination reconciliation.
213
+ - **Durable outcome reporting**: Exact report retries reuse their receipt;
214
+ exhausted reporting retries raise `OutcomeReportError`.
215
+ - **Replay evidence**: Policy-versioned decision, approval, permit, and outcome
216
+ events form an append-only hash chain.
217
+
218
+ Retries while an approval is still pending can safely poll the same exact
219
+ operation. A restart after permit issuance must not blindly execute the action
220
+ again; reconcile against an idempotent destination first.
221
+
222
+ Persist the permit, `report_id`, outcome, and exact payload before an outcome
223
+ retry. If the context manager raises `OutcomeReportError` after the side effect
224
+ returns, resume only the receipt call:
225
+
226
+ ```python
227
+ receipt = client.report_guard_outcome(
228
+ permit,
229
+ report_id=report_id,
230
+ outcome="success",
231
+ result={"destination_key": destination_key},
232
+ )
233
+ ```
234
+
235
+ Do not rerun the payment to obtain that receipt. Error outcomes use the same
236
+ public method with `outcome="error"` and the same caller-stable UUID.
237
+
238
+ ## Decorators
239
+ ```python
240
+ from haltstate import HaltStateClient, haltstate_guard
241
+
242
+ client = HaltStateClient(tenant_id="acme", api_key="hs_xxx", base_url="https://haltstate.ai")
243
+
244
+ @haltstate_guard(client, action="email.send", agent_id="email-bot")
245
+ def send_email(to, subject, body):
246
+ return mailer.send(to, subject, body)
247
+ ```
248
+
249
+ ## Async
250
+ ```python
251
+ from haltstate import AsyncHaltStateClient
252
+
253
+ async def main():
254
+ async with AsyncHaltStateClient(tenant_id="acme", api_key="hs_xxx", base_url="https://haltstate.ai") as client:
255
+ res = await client.check("database.drop", params={"table": "users"})
256
+ if res.allowed:
257
+ await client.report(res, status="success", action="database.drop", agent_id="ops-bot")
258
+ ```
259
+
260
+ ## Exceptions
261
+
262
+ ```python
263
+ from haltstate import (
264
+ HaltStateError, # Base error
265
+ HaltStateAuthError, # Invalid API key
266
+ HaltStateConnectionError, # Network/timeout
267
+ ApprovalPending, # Awaiting approval (guard pattern)
268
+ ActionDenied, # Human rejected (guard pattern)
269
+ ActionExpired, # Approval expired (guard pattern)
270
+ ActionAlreadyStarted, # Permit already issued; never rerun the action
271
+ OutcomeReportError, # Durable outcome receipt was not confirmed
272
+ )
273
+ ```
274
+
275
+ ## Docs
276
+
277
+ Full documentation at [haltstate.ai/docs](https://haltstate.ai/docs):
278
+ - Quickstart - 5-minute setup
279
+ - Guard Pattern - HITL approval flow
280
+ - API Reference - All methods
281
+ - Error Handling - Exception handling
282
+ - Governance alignment - Operational evidence mapping
283
+
284
+ Legacy route aliases remain supported for existing installations, but new integrations should target the HaltState-branded public contract.
285
+
286
+ ## Legacy migration note
287
+
288
+ If upgrading from the legacy package/import namespace:
289
+
290
+ Existing code using the legacy import namespace continues to work, but new integrations should use `from haltstate import ...`.
291
+
292
+ ```python
293
+ # Legacy (still works)
294
+ from janus import JanusClient, janus_guard
295
+
296
+ # New
297
+ from haltstate import HaltStateClient, haltstate_guard
298
+ ```
299
+
300
+ Both import styles work - no code changes required for existing users.
301
+
302
+ ## License
303
+ MIT
@@ -0,0 +1,255 @@
1
+ # HaltState SDK
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/haltstate-sdk.svg)](https://pypi.org/project/haltstate-sdk/)
4
+
5
+ Action control and Proof Packs for autonomous AI agents. Perform pre-action checks, approvals, and post-action reporting with minimal code.
6
+
7
+ ## Semiotic Probe (source candidate, not activated)
8
+
9
+ ```python
10
+ probe = client.connect_semiotic_probe("openai", "gpt-4.1", lambda raw, limit: isolated_model(raw, max_tokens=limit))
11
+ # Or use probe.poll_once() and probe.close() in an application-owned lifecycle.
12
+ ```
13
+
14
+ The hook must be fresh and isolated: no history, memory, retrieval, tools, or side effects.
15
+
16
+ Canonical public base URL: `https://haltstate.ai`
17
+
18
+ Canonical governance namespace: `/api/haltstate/sentinel/*`
19
+
20
+ Current SDKs default to `https://haltstate.ai`. Guard endpoints use the branded `/api/haltstate/sentinel/*` namespace when available. The released `check()`, `report()`, and approval-polling paths still use supported legacy `/api/sentinel/*` compatibility aliases until matching branded backend routes are registered.
21
+
22
+ ## Replay safety status
23
+
24
+ Replay-ledger hardening is implemented and locally verified in this source
25
+ tree. Production activation remains pending the caller-first quiesce/drain
26
+ window, migration 106, matching API/SDK deployment with no mixed workers, and
27
+ the delayed/replay route smokes; this is not a production-live claim.
28
+
29
+ On the hardened path, each tenant and idempotency key binds to one exact
30
+ operation: agent, action, resource, normalized parameters, and risk class. The
31
+ stored decision carries the evaluated policy version; a retry with changed
32
+ operation data is rejected. Approvals expire, and an eligible operation
33
+ receives at most one permit. Exact outcome-report retries receive the original
34
+ receipt.
35
+
36
+ The durable lifecycle is recorded in an append-only, hash-chained event log.
37
+ That log is not externally anchored or immune to a database superuser.
38
+ Destination idempotency remains the customer's responsibility: HaltState
39
+ cannot guarantee exactly-once execution inside an external payment, email, or
40
+ infrastructure system. Hosted LLM inference is likewise not claimed to be
41
+ bit-for-bit deterministic.
42
+
43
+ ### Post-cutover idempotency epoch
44
+
45
+ During the controlled replay-ledger cutover, configure the UUID epoch issued
46
+ for that activation:
47
+
48
+ ```python
49
+ client = HaltStateClient(
50
+ tenant_id="acme",
51
+ api_key="hs_xxx",
52
+ idempotency_epoch="11111111-2222-4333-8444-555555555555",
53
+ )
54
+ ```
55
+
56
+ After configuration, `guard()` calls that omit `idempotency_key` generate a
57
+ qualified key in the form `hsr1:<epoch>:<uuid>`. The SDK never prefixes,
58
+ rewrites, or upgrades an explicit caller-supplied key. Consequently, explicit
59
+ keys sent after cutover must already be fully qualified for the active epoch.
60
+ Keep `idempotency_epoch` unset only for preactivation compatibility, where
61
+ omitted keys retain the legacy plain-UUID behavior.
62
+ Keep this HaltState guard key separate from the destination's stable business
63
+ idempotency key; the destination key must not rotate with the guard epoch.
64
+
65
+ Configure the epoch only after guarded callers and schedulers are quiesced,
66
+ guard ingress is closed, legacy API workers are stopped, and old work is
67
+ drained or reconciled. Reopen with no mixed workers. Once epoch-qualified work
68
+ is admitted, do not roll back to a pre-replay binary under open ingress; remain
69
+ fail closed and roll forward.
70
+
71
+ ## Installation
72
+
73
+ PyPI currently serves `0.7.0`. The replay-safe contract in this tree is the
74
+ unpublished `0.8.0.dev0` candidate and must be installed from the reviewed
75
+ source checkout until it is released.
76
+
77
+ ```bash
78
+ # Published baseline:
79
+ pip install haltstate-sdk
80
+
81
+ # Replay-safe source candidate, from the repository root:
82
+ pip install ./packages/haltstate-sdk
83
+ ```
84
+
85
+ ## Quickstart (sync)
86
+ ```python
87
+ from haltstate import HaltStateClient
88
+
89
+ client = HaltStateClient(
90
+ tenant_id="your_tenant_id",
91
+ api_key="hs_xyz",
92
+ base_url="https://haltstate.ai",
93
+ fail_open=False,
94
+ )
95
+
96
+ decision = client.check(
97
+ action="payment.process",
98
+ params={"amount": 5000, "currency": "USD"},
99
+ agent_id="payment-bot-01",
100
+ )
101
+
102
+ if decision.allowed:
103
+ process_payment(...)
104
+ client.report(decision, status="success", result={"transaction_id": "tx_123"}, action="payment.process", agent_id="payment-bot-01")
105
+ elif decision.requires_approval:
106
+ print(f"Approval required: {decision.reason}")
107
+ else:
108
+ print(f"Action denied: {decision.reason}")
109
+ ```
110
+
111
+ ## Guard Pattern
112
+
113
+ For actions requiring human approval, use the idempotent guard pattern:
114
+
115
+ ```python
116
+ from haltstate import HaltStateClient, ApprovalPending, ActionDenied
117
+
118
+ def process_high_value_payment(invoice_id: str, amount: float):
119
+ operator_epoch = "11111111-2222-4333-8444-555555555555"
120
+ destination_key = f"payment-{invoice_id}"
121
+ guard_key = f"hsr1:{operator_epoch}:{destination_key}"
122
+ report_id = "40000000-0000-4000-8000-000000000501"
123
+ client = HaltStateClient(
124
+ tenant_id="acme",
125
+ api_key="hs_xxx",
126
+ base_url="https://haltstate.ai",
127
+ )
128
+
129
+ try:
130
+ with client.guard(
131
+ action="payment.process",
132
+ agent_id="payment-bot",
133
+ params={"invoice_id": invoice_id, "amount": amount},
134
+ idempotency_key=guard_key,
135
+ resource=f"invoice/{invoice_id}",
136
+ risk_class="high",
137
+ report_id=report_id,
138
+ ) as permit:
139
+ permit.validate_for_execution()
140
+ result = execute_payment_once(
141
+ invoice_id=invoice_id,
142
+ amount=amount,
143
+ idempotency_key=destination_key,
144
+ )
145
+ print(f"Approved by {permit.approver} at {permit.approved_at}")
146
+ return result
147
+
148
+ except ApprovalPending:
149
+ print("Awaiting human approval...")
150
+ return {"status": "pending"}
151
+
152
+ except ActionDenied as e:
153
+ print(f"Denied: {e.reason}")
154
+ raise
155
+ ```
156
+
157
+ Key features:
158
+ - **Exact operation binding**: The same key and same proposal replay the stored
159
+ decision; changed agent, action, resource, risk, or parameters conflict.
160
+ - **Expiring approval authority**: Approvals expire, and the SDK refuses an
161
+ expired executable response before entering the action.
162
+ - **One-permit rule**: A retry after permit issuance receives an
163
+ `ActionAlreadyStarted` error, not replacement authority. A lost permit or
164
+ missing outcome report requires destination reconciliation.
165
+ - **Durable outcome reporting**: Exact report retries reuse their receipt;
166
+ exhausted reporting retries raise `OutcomeReportError`.
167
+ - **Replay evidence**: Policy-versioned decision, approval, permit, and outcome
168
+ events form an append-only hash chain.
169
+
170
+ Retries while an approval is still pending can safely poll the same exact
171
+ operation. A restart after permit issuance must not blindly execute the action
172
+ again; reconcile against an idempotent destination first.
173
+
174
+ Persist the permit, `report_id`, outcome, and exact payload before an outcome
175
+ retry. If the context manager raises `OutcomeReportError` after the side effect
176
+ returns, resume only the receipt call:
177
+
178
+ ```python
179
+ receipt = client.report_guard_outcome(
180
+ permit,
181
+ report_id=report_id,
182
+ outcome="success",
183
+ result={"destination_key": destination_key},
184
+ )
185
+ ```
186
+
187
+ Do not rerun the payment to obtain that receipt. Error outcomes use the same
188
+ public method with `outcome="error"` and the same caller-stable UUID.
189
+
190
+ ## Decorators
191
+ ```python
192
+ from haltstate import HaltStateClient, haltstate_guard
193
+
194
+ client = HaltStateClient(tenant_id="acme", api_key="hs_xxx", base_url="https://haltstate.ai")
195
+
196
+ @haltstate_guard(client, action="email.send", agent_id="email-bot")
197
+ def send_email(to, subject, body):
198
+ return mailer.send(to, subject, body)
199
+ ```
200
+
201
+ ## Async
202
+ ```python
203
+ from haltstate import AsyncHaltStateClient
204
+
205
+ async def main():
206
+ async with AsyncHaltStateClient(tenant_id="acme", api_key="hs_xxx", base_url="https://haltstate.ai") as client:
207
+ res = await client.check("database.drop", params={"table": "users"})
208
+ if res.allowed:
209
+ await client.report(res, status="success", action="database.drop", agent_id="ops-bot")
210
+ ```
211
+
212
+ ## Exceptions
213
+
214
+ ```python
215
+ from haltstate import (
216
+ HaltStateError, # Base error
217
+ HaltStateAuthError, # Invalid API key
218
+ HaltStateConnectionError, # Network/timeout
219
+ ApprovalPending, # Awaiting approval (guard pattern)
220
+ ActionDenied, # Human rejected (guard pattern)
221
+ ActionExpired, # Approval expired (guard pattern)
222
+ ActionAlreadyStarted, # Permit already issued; never rerun the action
223
+ OutcomeReportError, # Durable outcome receipt was not confirmed
224
+ )
225
+ ```
226
+
227
+ ## Docs
228
+
229
+ Full documentation at [haltstate.ai/docs](https://haltstate.ai/docs):
230
+ - Quickstart - 5-minute setup
231
+ - Guard Pattern - HITL approval flow
232
+ - API Reference - All methods
233
+ - Error Handling - Exception handling
234
+ - Governance alignment - Operational evidence mapping
235
+
236
+ Legacy route aliases remain supported for existing installations, but new integrations should target the HaltState-branded public contract.
237
+
238
+ ## Legacy migration note
239
+
240
+ If upgrading from the legacy package/import namespace:
241
+
242
+ Existing code using the legacy import namespace continues to work, but new integrations should use `from haltstate import ...`.
243
+
244
+ ```python
245
+ # Legacy (still works)
246
+ from janus import JanusClient, janus_guard
247
+
248
+ # New
249
+ from haltstate import HaltStateClient, haltstate_guard
250
+ ```
251
+
252
+ Both import styles work - no code changes required for existing users.
253
+
254
+ ## License
255
+ MIT
@@ -3,9 +3,16 @@
3
3
  # `from janus import JanusClient` continue to work.
4
4
 
5
5
  from janus.client import JanusClient as HaltStateClient, Permit
6
+ from janus.semiotic_probe import SemioticProbeConnection, SemioticProbeError
6
7
  from janus.async_client import AsyncJanusClient as AsyncHaltStateClient
7
8
  from janus.models import CheckResult, Decision, ApprovalDecision, ApprovalStatus
8
- from janus.decorators import janus_guard as haltstate_guard, openai_guard
9
+ from janus.decorators import (
10
+ janus_guard,
11
+ janus_guard as haltstate_guard,
12
+ ajanus_guard,
13
+ ajanus_guard as ahaltstate_guard,
14
+ openai_guard,
15
+ )
9
16
  from janus.exceptions import (
10
17
  JanusError as HaltStateError,
11
18
  JanusConnectionError as HaltStateConnectionError,
@@ -15,6 +22,8 @@ from janus.exceptions import (
15
22
  ApprovalPending,
16
23
  ActionDenied,
17
24
  ActionExpired,
25
+ ActionAlreadyStarted,
26
+ OutcomeReportError,
18
27
  KillSwitchTriggered,
19
28
  )
20
29
 
@@ -22,7 +31,6 @@ from janus.exceptions import (
22
31
  from janus import (
23
32
  JanusClient,
24
33
  AsyncJanusClient,
25
- janus_guard,
26
34
  JanusError,
27
35
  JanusConnectionError,
28
36
  JanusAuthError,
@@ -34,7 +42,10 @@ __all__ = [
34
42
  # HaltState branded names (new)
35
43
  "HaltStateClient",
36
44
  "AsyncHaltStateClient",
45
+ "SemioticProbeConnection",
46
+ "SemioticProbeError",
37
47
  "haltstate_guard",
48
+ "ahaltstate_guard",
38
49
  "HaltStateError",
39
50
  "HaltStateConnectionError",
40
51
  "HaltStateAuthError",
@@ -44,6 +55,7 @@ __all__ = [
44
55
  "JanusClient",
45
56
  "AsyncJanusClient",
46
57
  "janus_guard",
58
+ "ajanus_guard",
47
59
  "JanusError",
48
60
  "JanusConnectionError",
49
61
  "JanusAuthError",
@@ -60,7 +72,9 @@ __all__ = [
60
72
  "ApprovalPending",
61
73
  "ActionDenied",
62
74
  "ActionExpired",
75
+ "ActionAlreadyStarted",
76
+ "OutcomeReportError",
63
77
  "KillSwitchTriggered",
64
78
  ]
65
79
 
66
- __version__ = "0.7.0"
80
+ __version__ = "0.8.0.dev0"
@@ -0,0 +1,21 @@
1
+ """HaltState-branded decorator exports.
2
+
3
+ The underlying package keeps the legacy module for compatibility, while this
4
+ module gives public docs a HaltState import path.
5
+ """
6
+
7
+ from janus.decorators import (
8
+ ajanus_guard,
9
+ ajanus_guard as ahaltstate_guard,
10
+ janus_guard,
11
+ janus_guard as haltstate_guard,
12
+ openai_guard,
13
+ )
14
+
15
+ __all__ = [
16
+ "haltstate_guard",
17
+ "ahaltstate_guard",
18
+ "openai_guard",
19
+ "janus_guard",
20
+ "ajanus_guard",
21
+ ]