hebbrix 2.9.0__tar.gz → 2.10.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. {hebbrix-2.9.0 → hebbrix-2.10.0}/CHANGELOG.md +5 -0
  2. {hebbrix-2.9.0/hebbrix.egg-info → hebbrix-2.10.0}/PKG-INFO +8 -4
  3. {hebbrix-2.9.0 → hebbrix-2.10.0}/README.md +7 -3
  4. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix/__init__.py +1 -1
  5. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix/answers.py +42 -6
  6. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix/client.py +1 -1
  7. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix/sync_client.py +1 -1
  8. {hebbrix-2.9.0 → hebbrix-2.10.0/hebbrix.egg-info}/PKG-INFO +8 -4
  9. {hebbrix-2.9.0 → hebbrix-2.10.0}/pyproject.toml +1 -1
  10. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_answer_decision.py +86 -0
  11. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_customer_developer_experience.py +1 -1
  12. {hebbrix-2.9.0 → hebbrix-2.10.0}/LICENSE +0 -0
  13. {hebbrix-2.9.0 → hebbrix-2.10.0}/MANIFEST.in +0 -0
  14. {hebbrix-2.9.0 → hebbrix-2.10.0}/contracts/openapi-routes.json +0 -0
  15. {hebbrix-2.9.0 → hebbrix-2.10.0}/docs/native-experience-operations.md +0 -0
  16. {hebbrix-2.9.0 → hebbrix-2.10.0}/examples/native_reflection_worker.py +0 -0
  17. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix/_advice.py +0 -0
  18. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix/chat.py +0 -0
  19. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix/exceptions.py +0 -0
  20. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix/execution.py +0 -0
  21. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix/experience.py +0 -0
  22. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix/models.py +0 -0
  23. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix/openai_reflection.py +0 -0
  24. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix/reflection_worker.py +0 -0
  25. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix/resources.py +0 -0
  26. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix/workflow.py +0 -0
  27. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix.egg-info/SOURCES.txt +0 -0
  28. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix.egg-info/dependency_links.txt +0 -0
  29. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix.egg-info/entry_points.txt +0 -0
  30. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix.egg-info/requires.txt +0 -0
  31. {hebbrix-2.9.0 → hebbrix-2.10.0}/hebbrix.egg-info/top_level.txt +0 -0
  32. {hebbrix-2.9.0 → hebbrix-2.10.0}/setup.cfg +0 -0
  33. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_advanced_resources.py +0 -0
  34. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_advisor_integrity.py +0 -0
  35. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_answer_context.py +0 -0
  36. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_chat_answer_options.py +0 -0
  37. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_compact_search_default.py +0 -0
  38. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_evidence_loop_resource.py +0 -0
  39. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_evidence_safety_boundary.py +0 -0
  40. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_execution_permission.py +0 -0
  41. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_experience_request.py +0 -0
  42. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_experience_workflow.py +0 -0
  43. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_followup_helpers.py +0 -0
  44. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_memories_resource.py +0 -0
  45. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_openai_reflection.py +0 -0
  46. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_openapi_parity.py +0 -0
  47. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_outcome_advice_resource.py +0 -0
  48. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_procedural_resource.py +0 -0
  49. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_reflection_worker_cli.py +0 -0
  50. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_release_version.py +0 -0
  51. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_sync_client.py +0 -0
  52. {hebbrix-2.9.0 → hebbrix-2.10.0}/tests/test_workflow_route_contract.py +0 -0
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.10.0 — 2026-11-12 (applicable rules, consistent abstention flags)
4
+
5
+ - An `unverified` search response whose rows include `evidence_role: "applicable_rule"` (server 1.4.27) returns reason `applicable_rule` and action `use_as_context`, those rules first in `decision.context`: policy that speaks to the asked case but that the API has not verified decides it. Let your model apply it, or call `reason`. A rule is never an authorization; `authorization_not_verifiable` still comes first.
6
+ - `history=True` no longer overrides an explicit abstention flag on an `answerable` response: a response marked `answerable` that also sets `no_match`, `abstain_recommended` or `decision_abstained` contradicts itself and is declined in every mode, with that flag as the reason. History mode still answers a `superseded` response from its earlier versions (its flags concern the present), never one with `no_match`.
7
+
3
8
  ## 2.9.0 — 2026-11-11 (high-stakes readiness, history and suggestions)
4
9
 
5
10
  - `should_answer(response, require_ready=True)` (also on `usable_memories` and `answer_context`): for high-stakes flows, holds the answer with action `retry` and reason `index_not_ready` until `indexing.status` is `ready` and `indexing.answer_risk` is `none`. A response that does not report its indexing is not ready.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hebbrix
3
- Version: 2.9.0
3
+ Version: 2.10.0
4
4
  Summary: Typed Python client for Hebbrix memory, retrieval, and outcome-learning APIs
5
5
  Author-email: Hebbrix Team <support@hebbrix.com>
6
6
  Maintainer-email: Hebbrix Team <support@hebbrix.com>
@@ -65,14 +65,14 @@ Dynamic: license-file
65
65
 
66
66
  Typed Python client for Hebbrix memory, retrieval, and outcome-learning APIs.
67
67
 
68
- The current stable package is **2.9.0**. Start with memory storage and search, or
68
+ The current stable package is **2.10.0**. Start with memory storage and search, or
69
69
  the three-call outcome-learning workflow below. Advanced evidence and execution
70
70
  permission transports are opt-in; installing the SDK never permits an action.
71
71
 
72
72
  ## Install
73
73
 
74
74
  ```bash
75
- pip install hebbrix==2.9.0
75
+ pip install hebbrix==2.10.0
76
76
  ```
77
77
 
78
78
  Python 3.8+ is supported. `MemoryClient` is asynchronous. `SyncMemoryClient`
@@ -150,7 +150,11 @@ versions should count (it never overrides `unverified`, `no_relevant_memory`,
150
150
  the answer is then also held, with action `retry`, until `indexing.status` is
151
151
  `ready` and `indexing.answer_risk` is `none`. A Reason suggestion or plan
152
152
  (`context_only`) returns action `use_as_context`: its memories shape what your
153
- model suggests, and are never a fact or a permission. `reason()` takes
153
+ model suggests, and are never a fact or a permission. An `unverified` search
154
+ whose rows include `evidence_role: "applicable_rule"` returns reason
155
+ `applicable_rule` and action `use_as_context`: the rule speaks to the asked
156
+ case but the API has not verified it decides it; let your model apply it, or
157
+ call `reason()`. `reason()` takes
154
158
  `deadline_ms`; a `timed_out` response is an abstention. `verify_authorization` means the returned rule limits the action
155
159
  to a group the store cannot place the user in: use the rule, and check the
156
160
  permission in your own system.
@@ -2,14 +2,14 @@
2
2
 
3
3
  Typed Python client for Hebbrix memory, retrieval, and outcome-learning APIs.
4
4
 
5
- The current stable package is **2.9.0**. Start with memory storage and search, or
5
+ The current stable package is **2.10.0**. Start with memory storage and search, or
6
6
  the three-call outcome-learning workflow below. Advanced evidence and execution
7
7
  permission transports are opt-in; installing the SDK never permits an action.
8
8
 
9
9
  ## Install
10
10
 
11
11
  ```bash
12
- pip install hebbrix==2.9.0
12
+ pip install hebbrix==2.10.0
13
13
  ```
14
14
 
15
15
  Python 3.8+ is supported. `MemoryClient` is asynchronous. `SyncMemoryClient`
@@ -87,7 +87,11 @@ versions should count (it never overrides `unverified`, `no_relevant_memory`,
87
87
  the answer is then also held, with action `retry`, until `indexing.status` is
88
88
  `ready` and `indexing.answer_risk` is `none`. A Reason suggestion or plan
89
89
  (`context_only`) returns action `use_as_context`: its memories shape what your
90
- model suggests, and are never a fact or a permission. `reason()` takes
90
+ model suggests, and are never a fact or a permission. An `unverified` search
91
+ whose rows include `evidence_role: "applicable_rule"` returns reason
92
+ `applicable_rule` and action `use_as_context`: the rule speaks to the asked
93
+ case but the API has not verified it decides it; let your model apply it, or
94
+ call `reason()`. `reason()` takes
91
95
  `deadline_ms`; a `timed_out` response is an abstention. `verify_authorization` means the returned rule limits the action
92
96
  to a group the store cannot place the user in: use the rule, and check the
93
97
  permission in your own system.
@@ -5,7 +5,7 @@ production OpenAPI and ``GET /v1/users/me/capabilities``. The experimental
5
5
  World Model is intentionally absent from this release.
6
6
  """
7
7
 
8
- __version__ = "2.9.0"
8
+ __version__ = "2.10.0"
9
9
  __author__ = "Hebbrix Team"
10
10
  __license__ = "MIT"
11
11
 
@@ -127,6 +127,12 @@ def _ready(response: Mapping[str, Any]) -> bool:
127
127
  )
128
128
 
129
129
 
130
+ _ABSTENTION_FLAGS = ("no_match", "abstain_recommended", "decision_abstained")
131
+ # A row's evidence_role for a current rule that speaks to the asked case but is
132
+ # not verified to decide it (see ``should_answer``).
133
+ APPLICABLE_RULE = "applicable_rule"
134
+
135
+
130
136
  def should_answer(
131
137
  response: Optional[Mapping[str, Any]],
132
138
  *,
@@ -151,14 +157,28 @@ def should_answer(
151
157
  recognises ("Where did I live before?"). It overrides one thing: a
152
158
  superseded or historical row then counts as evidence, so a response the
153
159
  server answered or marked ``superseded`` can be answered from its earlier
154
- versions. It never overrides ``unverified``, ``no_relevant_memory``,
155
- ``indexing``, ``conflicting`` or ``authorization_not_verifiable``. Keep each
160
+ versions (a superseded response's ``abstain_recommended`` or
161
+ ``decision_abstained`` concerns the present, so it does not bar this). It
162
+ never overrides ``unverified``, ``no_relevant_memory``, ``indexing``,
163
+ ``conflicting``, ``authorization_not_verifiable`` or ``no_match``.
164
+
165
+ A response marked ``answerable`` that also sets ``no_match``,
166
+ ``abstain_recommended`` or ``decision_abstained`` contradicts itself; the
167
+ server never sends one, and this helper declines it, with that flag as
168
+ the reason, in every mode. Keep each
156
169
  row's ``revision_status`` and ``stated_at`` in what you pass to the model, so
157
170
  it can tell the versions apart.
158
171
 
159
172
  A Reason result for a suggestion or plan (``context_only``) returns action
160
173
  ``use_as_context``: give ``decision.context`` to your model to shape what it
161
174
  suggests, never as an established fact or a permission to act.
175
+
176
+ An ``unverified`` search response whose rows include an
177
+ ``evidence_role: applicable_rule`` row returns reason ``applicable_rule``
178
+ and action ``use_as_context``, with those rules first in
179
+ ``decision.context``: policy that speaks to the asked case but that the
180
+ API has not verified decides it. Let your model apply it (and say so), or
181
+ ask ``reason``, which applies stored rules to the case and cites them.
162
182
  """
163
183
 
164
184
  if not isinstance(response, Mapping) or "answer_status" not in response:
@@ -183,16 +203,32 @@ def should_answer(
183
203
  return declined(CONTEXT_ONLY, USE_AS_CONTEXT)
184
204
  if require_ready and not _ready(response):
185
205
  return declined(INDEX_NOT_READY, "retry")
186
- if history and status in ("answerable", "superseded"):
206
+ flags = [flag for flag in _ABSTENTION_FLAGS if response.get(flag) is True]
207
+ if status == "answerable" and flags:
208
+ # The server never marks a response answerable while it recommends
209
+ # abstaining. An envelope that does contradicts itself, and a
210
+ # contradiction is not an answer, in history mode or not.
211
+ return declined(flags[0], "abstain")
212
+ if history and status in ("answerable", "superseded") and "no_match" not in flags:
213
+ # A superseded response recommends abstaining for the present: every
214
+ # relevant record states a value that no longer holds. That is what a
215
+ # question about the past reads, so those flags do not bar it here.
187
216
  usable = [row for row in rows if _is_history(row, search_row=search_rows)]
188
217
  if usable:
189
218
  others = [row for row in rows if row not in usable]
190
219
  return AnswerDecision(True, "history", "answer", usable, others, cited)
220
+ if status == "unverified":
221
+ rules = [row for row in rows if row.get("evidence_role") == APPLICABLE_RULE]
222
+ if rules:
223
+ # A rule that speaks to the asked case, not verified to decide
224
+ # it: policy for your model to apply, never an established answer
225
+ # or a permission (authorization questions were declined above).
226
+ others = [row for row in rows if row not in rules]
227
+ return AnswerDecision(
228
+ False, APPLICABLE_RULE, USE_AS_CONTEXT, [], [*rules, *others], cited
229
+ )
191
230
  if status != "answerable":
192
231
  return declined(status, ACTIONS[status])
193
- for flag in ("no_match", "abstain_recommended", "decision_abstained"):
194
- if response.get(flag) is True:
195
- return declined(flag, "abstain")
196
232
  usable = [row for row in rows if _is_evidence(row, search_row=search_rows)]
197
233
  if not usable:
198
234
  return declined("no_usable_memories", "abstain")
@@ -93,7 +93,7 @@ class MemoryClient:
93
93
  """Get request headers."""
94
94
  headers = {
95
95
  "Content-Type": "application/json",
96
- "User-Agent": "hebbrix-python/2.9.0",
96
+ "User-Agent": "hebbrix-python/2.10.0",
97
97
  }
98
98
 
99
99
  if self.api_key:
@@ -1144,7 +1144,7 @@ class SyncMemoryClient:
1144
1144
  self.source = source or os.getenv("HEBBRIX_SOURCE")
1145
1145
  headers = {
1146
1146
  "Content-Type": "application/json",
1147
- "User-Agent": "hebbrix-python/2.9.0",
1147
+ "User-Agent": "hebbrix-python/2.10.0",
1148
1148
  }
1149
1149
  if api_key:
1150
1150
  headers["Authorization"] = f"Bearer {api_key}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hebbrix
3
- Version: 2.9.0
3
+ Version: 2.10.0
4
4
  Summary: Typed Python client for Hebbrix memory, retrieval, and outcome-learning APIs
5
5
  Author-email: Hebbrix Team <support@hebbrix.com>
6
6
  Maintainer-email: Hebbrix Team <support@hebbrix.com>
@@ -65,14 +65,14 @@ Dynamic: license-file
65
65
 
66
66
  Typed Python client for Hebbrix memory, retrieval, and outcome-learning APIs.
67
67
 
68
- The current stable package is **2.9.0**. Start with memory storage and search, or
68
+ The current stable package is **2.10.0**. Start with memory storage and search, or
69
69
  the three-call outcome-learning workflow below. Advanced evidence and execution
70
70
  permission transports are opt-in; installing the SDK never permits an action.
71
71
 
72
72
  ## Install
73
73
 
74
74
  ```bash
75
- pip install hebbrix==2.9.0
75
+ pip install hebbrix==2.10.0
76
76
  ```
77
77
 
78
78
  Python 3.8+ is supported. `MemoryClient` is asynchronous. `SyncMemoryClient`
@@ -150,7 +150,11 @@ versions should count (it never overrides `unverified`, `no_relevant_memory`,
150
150
  the answer is then also held, with action `retry`, until `indexing.status` is
151
151
  `ready` and `indexing.answer_risk` is `none`. A Reason suggestion or plan
152
152
  (`context_only`) returns action `use_as_context`: its memories shape what your
153
- model suggests, and are never a fact or a permission. `reason()` takes
153
+ model suggests, and are never a fact or a permission. An `unverified` search
154
+ whose rows include `evidence_role: "applicable_rule"` returns reason
155
+ `applicable_rule` and action `use_as_context`: the rule speaks to the asked
156
+ case but the API has not verified it decides it; let your model apply it, or
157
+ call `reason()`. `reason()` takes
154
158
  `deadline_ms`; a `timed_out` response is an abstention. `verify_authorization` means the returned rule limits the action
155
159
  to a group the store cannot place the user in: use the rule, and check the
156
160
  permission in your own system.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hebbrix"
7
- version = "2.9.0"
7
+ version = "2.10.0"
8
8
  description = "Typed Python client for Hebbrix memory, retrieval, and outcome-learning APIs"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -424,3 +424,89 @@ def test_a_suggestion_is_context_to_shape_never_an_answer():
424
424
  assert decision.action == "use_as_context"
425
425
  assert decision.memories == []
426
426
  assert ids(decision.context) == ["camera"]
427
+
428
+
429
+ @pytest.mark.parametrize("flag", ["abstain_recommended", "decision_abstained", "no_match"])
430
+ def test_an_answerable_status_beside_an_abstention_flag_fails_closed_in_every_mode(flag):
431
+ # A contradictory envelope (the server never sends one): answerable, an
432
+ # explicit abstention flag, and only an earlier, unestablished row.
433
+ page = search(
434
+ [
435
+ row(
436
+ "synthetic-history",
437
+ revision_status="historical",
438
+ is_current=False,
439
+ low_confidence=True,
440
+ )
441
+ ],
442
+ indexing={"status": "ready", "answer_risk": "none"},
443
+ **{flag: True},
444
+ )
445
+ for options in ({}, {"history": True}, {"history": True, "require_ready": True}):
446
+ decision = should_answer(page, **options)
447
+ assert not decision
448
+ assert decision.reason == flag
449
+ assert decision.action == "abstain"
450
+ assert decision.memories == []
451
+ assert usable_memories(page, **options) == []
452
+
453
+
454
+ def test_a_superseded_reason_result_still_answers_a_history_question():
455
+ # Reason marks a result superseded only when it abstains for the present
456
+ # (decision_abstained), so that flag is what a question about the past reads.
457
+ page = reason(
458
+ [source("old", is_current=False, revision_status="superseded")],
459
+ answer=None,
460
+ decision_abstained=True,
461
+ answer_status="superseded",
462
+ )
463
+ assert not should_answer(page)
464
+ decision = should_answer(page, history=True)
465
+ assert decision
466
+ assert decision.reason == "history"
467
+ assert ids(decision.memories) == ["old"]
468
+
469
+
470
+ def test_history_never_answers_a_response_that_matched_nothing():
471
+ page = search(
472
+ [row("old", is_current=False, revision_status="superseded", low_confidence=True)],
473
+ answer_status="superseded",
474
+ abstain_recommended=True,
475
+ no_match=True,
476
+ )
477
+ decision = should_answer(page, history=True)
478
+ assert not decision
479
+ assert decision.reason == "superseded"
480
+
481
+
482
+ def test_an_applicable_rule_is_policy_context_never_an_answer():
483
+ rows = [
484
+ row("case", low_confidence=True, evidence_role="related"),
485
+ row("rule", low_confidence=True, evidence_role="applicable_rule"),
486
+ ]
487
+ page = search(
488
+ rows,
489
+ answer_status="unverified",
490
+ abstain_recommended=True,
491
+ confidence_reason="soft_claim_candidate",
492
+ )
493
+ decision = should_answer(page)
494
+ assert not decision
495
+ assert decision.reason == "applicable_rule"
496
+ assert decision.action == "use_as_context"
497
+ assert decision.memories == []
498
+ assert ids(decision.context) == ["rule", "case"]
499
+ assert usable_memories(page) == []
500
+
501
+
502
+ def test_a_rule_never_answers_an_authorization_question():
503
+ rows = [row("rule", low_confidence=True, evidence_role="applicable_rule")]
504
+ page = search(
505
+ rows,
506
+ answer_status="unverified",
507
+ abstain_recommended=True,
508
+ confidence_reason="authorization_not_verifiable",
509
+ )
510
+ decision = should_answer(page)
511
+ assert not decision
512
+ assert decision.reason == "authorization_not_verifiable"
@@ -162,6 +162,6 @@ def test_package_docs_metadata_uses_canonical_host():
162
162
  assert 'Documentation = "https://hebbrix.com/docs"' in text
163
163
  assert "docs.hebbrix.com" not in text
164
164
  readme = (root / "README.md").read_text()
165
- assert "pip install hebbrix==2.9.0" in readme
165
+ assert "pip install hebbrix==2.10.0" in readme
166
166
  assert "three calls" in readme
167
167
  assert "schema `" not in readme
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes