You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR-3E, Option 2. Two new single-source modules replace hand-rolled duplicates
on the hottest path in the repo.
A-11 (vision, fully closed): new codec_vision.py — describe_sync + describe_async,
Gemini-flash -> local-Qwen-VL fallback, config read live from codec_config. All
three consumers now delegate: codec.py vision_describe (deleted _gemini_vision /
_local_vision), codec_voice._analyze_screenshot (async, reuses self._http),
codec_session.screenshot_ctx (now GAINS the Gemini fallback it lacked — a
documented behavioral superset). One file to change for a model/provider swap.
A-12 (chat/completions, first tranche): the audit's premise that codec_llm_proxy
already had call()/stream() was inaccurate — that module is a priority QUEUE, not
an HTTP caller. Built genuinely-new codec_llm.py: call() + strip_think /
extract_content (headers, Bearer auth, enable_thinking, <think> strip,
choices/reasoning parse, retry+backoff, never-raises). Migrated codec.py
voice-reply chat + codec_session.qwen_call; removed the now-dead local
extract_content in codec_session (canonical copy lives in codec_llm).
Deferred to phased follow-ons (each its own design + PR): codec_session.qwen_stream
SSE (needs codec_llm.stream()) and the remaining ~40 sites (dashboard, voice
generate_response, agents/agent_plan/agent_runner, telegram/imessage bridges,
compaction/self_improve/watcher/textassist/dictate).
Net -86 LOC in tracked files. Tests: tests/test_llm_vision_dedup.py (19, async
driven via asyncio.run — no pytest-asyncio dep). Full suite: 23 known-baseline
failures, zero new. No skills/ touched -> no manifest regen. Docs: design doc
flipped to IMPLEMENTED (§8), A-11/A-12 closure notes in PHASE-1-CODE-QUALITY +
triage, canonical-helpers note in AGENTS.md §2.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Other engine modules (`codec_overlays`, `codec_metrics`, `codec_logging`, `codec_gdocs`, `codec_google_auth`, `codec_cdp`, `codec_llm_proxy`, `codec_retry`, `codec_alerts`, `codec_search`, `codec_textassist`, `codec_watcher`, `codec_watchdog`) are internal helpers — read them when you need them, but they're not part of the navigation surface for an agent making structural changes. (Keyboard handling — wake word, F13 toggle, F18 voice, double-tap — lives **inline in `codec.py`** in the `codec` PM2 process; the old standalone `codec_keyboard.py` was deleted as a dead duplicate per A-8.)
58
58
59
+
**Canonical LLM + vision helpers (PR-3E, A-11/A-12).**`codec_vision.py` is the SINGLE source for screen-vision (`describe_sync` / `describe_async`, Gemini-flash → local-Qwen-VL fallback, config read live from `codec_config`) — used by `codec.py`, `codec_voice`, `codec_session`. `codec_llm.py` is the canonical chat/completions caller (`call()` + `strip_think`/`extract_content` — headers, Bearer auth, `enable_thinking`, `<think>` strip, `choices/reasoning` parse, retry+backoff, never-raises). NOTE: `codec_llm_proxy.py` is a priority *queue* (semaphore), NOT an HTTP caller — don't confuse the two. A-12 is migrating the ~45 inline `chat/completions` sites onto `codec_llm` in phased tranches; codec.py voice-reply + `codec_session.qwen_call` are done, streaming (`codec_llm.stream()`) + the rest are pending.
60
+
59
61
## 3. Agent + Crew runtime
60
62
61
63
CODEC has its own minimalist multi-agent runtime in `codec_agents.py`. **Zero dependency on CrewAI or LangChain** — it's self-contained, only depends on `requests` and `codec_skill_registry`.
defvision_describe(img_b64, prompt="Read all visible text on this screen. Include app name, window title, and all message/content text. Output raw text only.", max_tokens=800):
136
-
"""Route vision to Gemini or local based on config."""
0 commit comments