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) <noreply@anthropic.com>
This commit is contained in:
Yuyao Huang (Sam) 2026-03-30 00:55:19 +08:00
parent a278ece348
commit 1b2bb8cdc2
6 changed files with 6 additions and 6 deletions

View File

@ -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 |

View File

@ -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

View File

@ -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__)

View File

@ -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

View File

@ -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