ha-mcp-dev 8.3.0.dev2425__py3-none-any.whl → 8.3.0.dev2427__py3-none-any.whl

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.
@@ -316,13 +316,17 @@ def _supervisor_invalid_response(
316
316
  return _supervisor_rest_failure(response, error)
317
317
 
318
318
 
319
+ def _bounded_supervisor_text(value: str) -> str:
320
+ """Return model-safe Supervisor text, marking any truncation visibly."""
321
+ if len(value) <= _MAX_RESPONSE_SIZE:
322
+ return value
323
+ prefix_size = _MAX_RESPONSE_SIZE - len(_SUPERVISOR_RESPONSE_TRUNCATION_SUFFIX)
324
+ return value[:prefix_size] + _SUPERVISOR_RESPONSE_TRUNCATION_SUFFIX
325
+
326
+
319
327
  def _bounded_supervisor_response_text(response: httpx.Response) -> str:
320
328
  """Return a model-safe Supervisor response body with visible truncation."""
321
- body = response.text.strip()
322
- if len(body) <= _MAX_RESPONSE_SIZE:
323
- return body
324
- prefix_size = _MAX_RESPONSE_SIZE - len(_SUPERVISOR_RESPONSE_TRUNCATION_SUFFIX)
325
- return body[:prefix_size] + _SUPERVISOR_RESPONSE_TRUNCATION_SUFFIX
329
+ return _bounded_supervisor_text(response.text.strip())
326
330
 
327
331
 
328
332
  def _normalize_supervisor_rest_response(
@@ -558,7 +562,12 @@ def _raise_supervisor_api_failure(
558
562
  endpoint: str,
559
563
  ) -> NoReturn:
560
564
  """Raise the structured exception represented by a non-retryable result."""
561
- error_text = str(result.get("error", f"Supervisor API call failed: {endpoint}"))
565
+ # Both transports land here, and both carry Supervisor's own text: the
566
+ # direct REST payload and the message Core relays over the WebSocket
567
+ # bridge. Bind the size once, where every failure passes.
568
+ error_text = _bounded_supervisor_text(
569
+ str(result.get("error", f"Supervisor API call failed: {endpoint}"))
570
+ )
562
571
  status_code = result.get("_status_code")
563
572
  response_data = result.get("_response_data")
564
573
  if status_code == 401:
@@ -613,7 +622,7 @@ def _supervisor_result_mapping(
613
622
  return payload
614
623
 
615
624
  verb = method.upper()
616
- message = (
625
+ message = _bounded_supervisor_text(
617
626
  f"Supervisor API {verb} {endpoint} returned an invalid result payload: "
618
627
  f"{payload!r}"
619
628
  )
@@ -717,6 +726,10 @@ async def _supervisor_api_call(
717
726
  if _JOB_COLLISION_MARKER not in error_text.lower():
718
727
  _raise_supervisor_api_failure(result, endpoint)
719
728
 
729
+ # The marker test runs on the raw text; everything below reports
730
+ # it, so bind the size once the classification is settled.
731
+ error_text = _bounded_supervisor_text(error_text)
732
+
720
733
  remaining = deadline - time.monotonic()
721
734
  if remaining <= 0:
722
735
  # The retry budget is exhausted; the group may be stuck or
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ha-mcp-dev
3
- Version: 8.3.0.dev2425
3
+ Version: 8.3.0.dev2427
4
4
  Summary: Home Assistant MCP Server - Complete control of Home Assistant through MCP
5
5
  Author-email: Julien <github@qc-h.net>
6
6
  License: MIT
@@ -185,7 +185,7 @@ ha_mcp/tools/reference_validator.py,sha256=LmsE5jnNNJ_eI39rj_nc12dt6b6UwKRRELSA7
185
185
  ha_mcp/tools/registry.py,sha256=g_wbPRwtsW04_Q8X3_T1s3wWxhphQBDcQWhQZYdHq6o,12074
186
186
  ha_mcp/tools/renamed_tool_middleware.py,sha256=tF98aYIbQtCijauug4N87PrSzSzb2jVtIAei9OjzQOc,3277
187
187
  ha_mcp/tools/tool_search_hint_middleware.py,sha256=S6wmhaFxbVWc8_CggcWZ_CcVR6BEsIHVmsxC5wz2kUU,4948
188
- ha_mcp/tools/tools_addons.py,sha256=alTkwvKpIg6PGYjyRPJeo8UzR8hPxjlSaD41aL1t9y8,147214
188
+ ha_mcp/tools/tools_addons.py,sha256=dzG0Z4fE-D6Pb5SC_0d9Ptd-Ucl-hGUgJGw5KovpAr0,147856
189
189
  ha_mcp/tools/tools_areas.py,sha256=Ds5PPOZjUTR_q20W6tUO5MicdCeXFdH0pCNZjiNHtrw,32610
190
190
  ha_mcp/tools/tools_assist_pipeline.py,sha256=0Gx4LAmV7Mq0bWUBsIex_Ot436m_tf1-IpKNT86JyZ0,31463
191
191
  ha_mcp/tools/tools_blueprints.py,sha256=YPFPX2PDKQ9Om2IxdAJcktMWEFYDaD3YVVqV7brPAkc,23844
@@ -263,12 +263,12 @@ ha_mcp/visibility/enforcement.py,sha256=v5Z8vfh5q2LQulpSF50_MCejnaLiTpF24yNugThy
263
263
  ha_mcp/visibility/model.py,sha256=hcGMNzahDLlDveNdHYJEqOTKHNkKVX7_Zte9ODTjJ5A,4116
264
264
  ha_mcp/visibility/persistence.py,sha256=sYyseOBhQ7y8yH57IonJAD-tv4DSz3b497ay7RyiHPQ,2523
265
265
  ha_mcp/visibility/resolver.py,sha256=-WLXYWjr2x0_TtSTUiyxlfzee7_0dkDMhiOL-jI0CEQ,34765
266
- ha_mcp_dev-8.3.0.dev2425.dist-info/licenses/LICENSE,sha256=7rJXXKBJWgJF8595wk-YTxwVTEi1kQaIqyy9dh5o_oY,1062
266
+ ha_mcp_dev-8.3.0.dev2427.dist-info/licenses/LICENSE,sha256=7rJXXKBJWgJF8595wk-YTxwVTEi1kQaIqyy9dh5o_oY,1062
267
267
  tests/__init__.py,sha256=YRpec-ZFYCJ48oD_7ZcNY7dB8avoTWOrZICjaM-BYJ0,39
268
268
  tests/test_constants.py,sha256=Yxb_vm6aa9zl_negX7_H26tZPByg6mO8bURDv7JHMtY,1404
269
269
  tests/test_env_manager.py,sha256=NSeQ2iMvkfacM5ndu0YMHf4bN_dbf841aDO74iDvRQM,12799
270
- ha_mcp_dev-8.3.0.dev2425.dist-info/METADATA,sha256=JZeK2Cabut8MkXCAqakpuBy2mLoqvZaWCpRJ7rZgmh4,40540
271
- ha_mcp_dev-8.3.0.dev2425.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
272
- ha_mcp_dev-8.3.0.dev2425.dist-info/entry_points.txt,sha256=-_ej7ZCRYks4JWu6iymQk6bT2x2cSPjlWPEkr9BCaF8,294
273
- ha_mcp_dev-8.3.0.dev2425.dist-info/top_level.txt,sha256=cqJLEmgh4gQBKg_vBqj0ahS4DCg4J0qBXYgZCDQ2IWs,13
274
- ha_mcp_dev-8.3.0.dev2425.dist-info/RECORD,,
270
+ ha_mcp_dev-8.3.0.dev2427.dist-info/METADATA,sha256=--1soTxM-0faJmNtj2LfevBES23gX_PZ-YI5dZy8V9k,40540
271
+ ha_mcp_dev-8.3.0.dev2427.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
272
+ ha_mcp_dev-8.3.0.dev2427.dist-info/entry_points.txt,sha256=-_ej7ZCRYks4JWu6iymQk6bT2x2cSPjlWPEkr9BCaF8,294
273
+ ha_mcp_dev-8.3.0.dev2427.dist-info/top_level.txt,sha256=cqJLEmgh4gQBKg_vBqj0ahS4DCg4J0qBXYgZCDQ2IWs,13
274
+ ha_mcp_dev-8.3.0.dev2427.dist-info/RECORD,,