feat: add per-project chat routing (#76)

This commit is contained in:
banteg
2026-01-10 01:22:20 +04:00
committed by GitHub
parent 7ffb99d779
commit 81618e48e4
12 changed files with 299 additions and 14 deletions
+28
View File
@@ -43,3 +43,31 @@ def test_resolve_engine_prefers_override() -> None:
context=RunContext(project="proj"),
)
assert engine == "codex"
def test_resolve_message_defaults_to_chat_project() -> None:
codex = ScriptRunner([Return(answer="ok")], engine="codex")
router = AutoRouter(
entries=[RunnerEntry(engine=codex.engine, runner=codex)],
default_engine=codex.engine,
)
project = ProjectConfig(
alias="proj",
path=Path("."),
worktrees_dir=Path(".worktrees"),
chat_id=-42,
)
projects = ProjectsConfig(
projects={"proj": project},
default_project=None,
chat_map={-42: "proj"},
)
runtime = TransportRuntime(router=router, projects=projects)
resolved = runtime.resolve_message(
text="hello",
reply_text=None,
chat_id=-42,
)
assert resolved.context == RunContext(project="proj", branch=None)