cleanup: remove clawd/openclaw references, fix permissions, add architecture docs
- Replace all ~/clawd and ~/.clawdbot paths with ~/echo-core equivalents in tools (git_commit, ralph_prd_generator, backup_config, lead-gen) - Update personality files: TOOLS.md repo/paths, AGENTS.md security audit cmd - Migrate HANDOFF.md architectural decisions to docs/architecture.md - Tighten credentials/ dir to 700, add to .gitignore - Add .claude/ and *.pid to .gitignore - Various adapter, router, and session improvements from prior work Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
"""Echo Core message router — routes messages to Claude or commands."""
|
||||
|
||||
import logging
|
||||
from typing import Callable
|
||||
|
||||
from src.config import Config
|
||||
from src.claude_session import (
|
||||
send_message,
|
||||
@@ -25,11 +27,20 @@ def _get_config() -> Config:
|
||||
return _config
|
||||
|
||||
|
||||
def route_message(channel_id: str, user_id: str, text: str, model: str | None = None) -> tuple[str, bool]:
|
||||
def route_message(
|
||||
channel_id: str,
|
||||
user_id: str,
|
||||
text: str,
|
||||
model: str | None = None,
|
||||
on_text: Callable[[str], None] | None = None,
|
||||
) -> tuple[str, bool]:
|
||||
"""Route an incoming message. Returns (response_text, is_command).
|
||||
|
||||
If text starts with / it's a command (handled here for text-based commands).
|
||||
Otherwise it goes to Claude via send_message (auto start/resume).
|
||||
|
||||
*on_text* — optional callback invoked with each intermediate text block
|
||||
from Claude, enabling real-time streaming to the adapter.
|
||||
"""
|
||||
text = text.strip()
|
||||
|
||||
@@ -61,7 +72,7 @@ def route_message(channel_id: str, user_id: str, text: str, model: str | None =
|
||||
model = (channel_cfg or {}).get("default_model") or _get_config().get("bot.default_model", "sonnet")
|
||||
|
||||
try:
|
||||
response = send_message(channel_id, text, model=model)
|
||||
response = send_message(channel_id, text, model=model, on_text=on_text)
|
||||
return response, False
|
||||
except Exception as e:
|
||||
log.error("Claude error for channel %s: %s", channel_id, e)
|
||||
|
||||
Reference in New Issue
Block a user