From 1b2bb8cdc2ca9ac6dc56165840a45f747db1ddf6 Mon Sep 17 00:00:00 2001 From: "Yuyao Huang (Sam)" Date: Mon, 30 Mar 2026 00:55:19 +0800 Subject: [PATCH] refactor: rename pty_process to cc_runner The module has long since moved away from PTY technology, using claude -p with --output-format stream-json and --resume instead. Rename to cc_runner to accurately reflect what it does. Co-Authored-By: Claude Sonnet 4.6 (1M context) --- README.md | 2 +- ROADMAP.md | 4 ++-- agent/{pty_process.py => cc_runner.py} | 0 agent/manager.py | 2 +- bot/commands.py | 2 +- tests/conftest.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) rename agent/{pty_process.py => cc_runner.py} (100%) diff --git a/README.md b/README.md index 70a0790..04c621c 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ PhoneWork uses a **Router + Host Client** architecture that supports both single | `orchestrator/agent.py` | LangChain agent with per-user history + direct/smart mode + direct Q&A | | `orchestrator/tools.py` | Tools: session management, shell, file ops, web search, scheduler, task status | | `agent/manager.py` | Session registry with persistence, idle timeout, and auto-background tasks | -| `agent/pty_process.py` | Runs `claude -p` headlessly, manages session continuity via `--resume` | +| `agent/cc_runner.py` | Runs `claude -p` headlessly, manages session continuity via `--resume` | | `agent/task_runner.py` | Background task runner with Feishu notifications | | `agent/scheduler.py` | Reminder scheduler with persistence | | `agent/audit.py` | Audit log of all interactions | diff --git a/ROADMAP.md b/ROADMAP.md index 8f4c098..5a8704d 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -315,7 +315,7 @@ SERVES_USERS: **What the host client runs:** - Full `orchestrator/agent.py` (mailboy LLM, tool loop, per-user history, active session) - Full `orchestrator/tools.py` (CC, shell, file ops, web, scheduler — all local) -- `agent/manager.py`, `agent/pty_process.py`, `agent/task_runner.py` — unchanged +- `agent/manager.py`, `agent/cc_runner.py`, `agent/task_runner.py` — unchanged Task completion flow: - Background task finishes → host client pushes `TaskComplete` to router @@ -495,7 +495,7 @@ PhoneWork/ │ ├── agent/ # Part of host client (local execution) │ ├── manager.py # Session registry -│ ├── pty_process.py # Claude Code runner +│ ├── cc_runner.py # Claude Code runner │ ├── task_runner.py # Background tasks │ ├── scheduler.py # Reminders │ └── audit.py # Audit log diff --git a/agent/pty_process.py b/agent/cc_runner.py similarity index 100% rename from agent/pty_process.py rename to agent/cc_runner.py diff --git a/agent/manager.py b/agent/manager.py index ec7a006..786fe62 100644 --- a/agent/manager.py +++ b/agent/manager.py @@ -10,7 +10,7 @@ from dataclasses import dataclass, field, asdict from pathlib import Path from typing import Dict, List, Optional -from agent.pty_process import run_claude, DEFAULT_PERMISSION_MODE, VALID_PERMISSION_MODES +from agent.cc_runner import run_claude, DEFAULT_PERMISSION_MODE, VALID_PERMISSION_MODES from agent.audit import log_interaction logger = logging.getLogger(__name__) diff --git a/bot/commands.py b/bot/commands.py index dd406e4..030fdcc 100644 --- a/bot/commands.py +++ b/bot/commands.py @@ -12,7 +12,7 @@ from typing import Optional, Tuple from agent.manager import manager from agent.scheduler import scheduler from agent.task_runner import task_runner -from agent.pty_process import VALID_PERMISSION_MODES, DEFAULT_PERMISSION_MODE +from agent.cc_runner import VALID_PERMISSION_MODES, DEFAULT_PERMISSION_MODE from orchestrator.agent import agent from orchestrator.tools import set_current_user, get_current_chat diff --git a/tests/conftest.py b/tests/conftest.py index 0fdbc21..5cd5ba8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -51,7 +51,7 @@ def mock_run_claude(): Default return value is a short CC-style output string. """ mock = AsyncMock(return_value="Claude Code: task complete.") - with patch("agent.pty_process.run_claude", mock), \ + with patch("agent.cc_runner.run_claude", mock), \ patch("agent.manager.run_claude", mock): yield mock