feat: initial llm-connect package scaffold

Copy markitect.llm module into standalone llm_connect package.
All markitect.* imports replaced with llm_connect.* equivalents.
LLMError base class inlined (no markitect.exceptions dependency).
Verified: from llm_connect import create_adapter works.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 07:54:42 +01:00
commit e499edba90
36 changed files with 1783 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
"""
Rough token estimation for backends that don't return usage data.
Uses the ~4 characters per token heuristic common across English LLM tokenizers.
"""
def estimate_tokens(text: str) -> int:
"""Estimate the number of tokens in *text*.
This is intentionally coarse — it is only used by the Claude Code CLI
adapter where real token counts are unavailable.
"""
if not text:
return 0
return max(1, len(text) // 4)