INNER CODE UNIT · Python

_privacy_socket_tokenize

ASCIT31/Dark-Moon · mcp/src/server.py:182

def _privacy_socket_tokenize(text: str, session_id: Optional[str]) -> str:
    """Callback for the local pre-model tokenization socket (prompt_socket).

    Shares the exact per-session vault used by execute_command / run_workflow and
    by the report renderer, so a placeholder minted for the launch prompt is the
    same one rehydrated during the run and restored into the local report.
    """
    original = text or ""
    if not PRIVACY_ENABLED or not _privacy_enabled_for(session_id):
        return original
    with _vault_lock:
        return _get_vault(session_id).tokenize_prompt(original)


# ---------------------------------------------------------------------------
# Global tool result/error sanitizer (issue #40 — output side, belt-and-braces)
# ---------------------------------------------------------------------------
# execute_command already re-tokenizes its own stdout/stderr, but a tool or

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…