Release v2.1.1: Fix ProtectSystem=strict read-only filesystem handling in hs_generate_ticker_stats_card and hyperstition-mcp.service

This commit is contained in:
Hermes Agent committed 2026-12-01 00:36:00 +00:00
1 parent b9703cda5e
commit e599f34525
41 files changed
+161 -136

No files matched your search

+2 -2
View File
@@ -1,3 +1,3 @@
"""hyperstitionstud_io — Shared Common Library for the hyperstitionstud.io workspace (v2.1.0)."""
__version__ = "2.1.0"
"""hyperstitionstud_io — Shared Common Library for the hyperstitionstud.io workspace (v2.1.1)."""
__version__ = "2.1.1"
NAMESPACE_URN = "urn:io:hyperstitionstud"
+2 -2
View File
@@ -35,8 +35,8 @@ from hyperstitionstud_io.mcp.tools import MCP_TOOLS_SCHEMA, call_mcp_tool # noq
SERVER_INFO = {
"name": "hyperstitionstudio-mcp",
"version": "2.1.0",
"namespace_urn": "urn:io:hyperstitionstud:mcp:2.1.0",
"version": "2.1.1",
"namespace_urn": "urn:io:hyperstitionstud:mcp:2.1.1",
}
+23 -5
View File
@@ -15,6 +15,7 @@ import base64
import hashlib
import io
import json
import os
from pathlib import Path
from typing import Any
@@ -490,9 +491,19 @@ def render_ticker_stats_card_png_bytes(card_json: dict[str, Any]) -> bytes:
return buf.getvalue()
def _resolve_default_cards_dir() -> Path:
tmp_dir = Path("/tmp")
if tmp_dir.is_dir() and os.access(tmp_dir, os.W_OK):
return tmp_dir / "hyperstition-cards"
state_dir = Path("/var/lib/hyperstitionstud.io")
if state_dir.is_dir() and os.access(state_dir, os.W_OK):
return state_dir / "cards"
return Path("/tmp/hyperstition-cards")
def export_ticker_stats_card_pair(
symbol: str,
out_dir: str | Path = "/tmp/hyperstition-cards",
out_dir: str | Path | None = None,
lens: str = "tierzoo_ecology",
date_utc: str | None = None,
include_base64_png: bool = True,
@@ -500,6 +511,8 @@ def export_ticker_stats_card_pair(
"""
Generate both `<symbol>-stats-card.png` and `<symbol>-stats-card.json` in one shot
and return the complete Chatbot REST / MCP tool response payload.
Gracefully handles read-only filesystems (e.g. systemd ProtectSystem=strict) by
returning the in-memory `png_base64` and JSON payload even when disk caching is unavailable.
"""
cfg = load_workspace_config()
with ReadOnlyIsolationGuard(cfg.read_only_files) as guard:
@@ -507,8 +520,8 @@ def export_ticker_stats_card_pair(
png_bytes = render_ticker_stats_card_png_bytes(card_json)
png_sha256 = hashlib.sha256(png_bytes).hexdigest()
out_p = Path(out_dir).resolve()
out_p.mkdir(parents=True, exist_ok=True)
target_dir = Path(out_dir) if out_dir is not None else _resolve_default_cards_dir()
out_p = target_dir.resolve()
sym_slug = card_json["card_identity"]["symbol_clean"].upper()
png_file = out_p / f"{sym_slug}-stats-card.png"
json_file = out_p / f"{sym_slug}-stats-card.json"
@@ -524,8 +537,13 @@ def export_ticker_stats_card_pair(
if include_base64_png:
card_json["artifacts"]["png_base64"] = base64.b64encode(png_bytes).decode("ascii")
png_file.write_bytes(png_bytes)
json_file.write_text(json.dumps(card_json, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
try:
out_p.mkdir(parents=True, exist_ok=True)
png_file.write_bytes(png_bytes)
json_file.write_text(json.dumps(card_json, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
card_json["artifacts"]["persisted_to_disk"] = True
except OSError:
card_json["artifacts"]["persisted_to_disk"] = False
card_json["read_only_isolation_receipt"] = guard.audit_receipt()
return card_json
+1 -1
View File
@@ -678,7 +678,7 @@ def build_financial_quant_harvest(
payload: dict[str, Any] = {
"$schema": "./schemas/v1/financial-aq-harvest.schema.json",
"$id": "urn:io:hyperstitionstud:schema:v1:financial-aq-harvest",
"version": "2.1.0",
"version": "2.1.1",
"target_date_utc": datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d"),
"harvest_mode": harvest_mode,
"synthetic_data_eliminated": True,