remote-claude 0.2.11 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -272,3 +272,4 @@ CLAUDE_COMMAND=/usr/local/bin/claude
272
272
 
273
273
  - [CLAUDE.md](./CLAUDE.md) — 项目架构和开发说明
274
274
  - [LARK_CLIENT_GUIDE.md](./LARK_CLIENT_GUIDE.md) — 飞书客户端完整指南
275
+ - [docker/README.md](./docker/README.md) — Docker 测试(npm 包发布前验证)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remote-claude",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "双端共享 Claude CLI 工具",
5
5
  "bin": {
6
6
  "remote-claude": "bin/remote-claude",
@@ -17,6 +17,7 @@
17
17
  "init.sh",
18
18
  "remote_claude.py",
19
19
  "server/*.py",
20
+ "server/parsers/*.py",
20
21
  "client/*.py",
21
22
  "utils/*.py",
22
23
  "lark_client/__init__.py",
@@ -0,0 +1,13 @@
1
+ """终端屏幕解析器包
2
+
3
+ 提供可插拔的解析器架构,支持 Claude CLI 和 Codex CLI(及未来其他 CLI 工具)。
4
+
5
+ 使用方法:
6
+ from parsers import ClaudeParser, CodexParser, BaseParser
7
+ """
8
+
9
+ from .base_parser import BaseParser
10
+ from .claude_parser import ClaudeParser, ScreenParser # ScreenParser 为向后兼容别名
11
+ from .codex_parser import CodexParser
12
+
13
+ __all__ = ['BaseParser', 'ClaudeParser', 'CodexParser', 'ScreenParser']
@@ -0,0 +1,44 @@
1
+ """终端屏幕解析器基类
2
+
3
+ 定义统一接口:parse(screen) -> List[Component]
4
+ ClaudeParser 和 CodexParser 均继承此类。
5
+ """
6
+
7
+ from abc import ABC, abstractmethod
8
+ from typing import List
9
+
10
+ import pyte
11
+
12
+
13
+ class BaseParser(ABC):
14
+ """终端屏幕解析器基类。
15
+
16
+ 具体实现(ClaudeParser、CodexParser 等)继承此类,
17
+ 负责将 pyte.Screen 快照解析为 Component 列表。
18
+
19
+ Component 列表包含两类组件:
20
+ - 累积型 Block:OutputBlock, UserInput, PlanBlock, SystemBlock
21
+ - 状态型组件:StatusLine, BottomBar, AgentPanelBlock, OptionBlock
22
+
23
+ OutputWatcher 读取 last_input_text / last_input_ansi_text / last_layout_mode
24
+ 等属性来辅助生成 ClaudeWindow 快照。
25
+ """
26
+
27
+ # 最近一次解析结果的辅助属性(由子类在 parse() 中更新)
28
+ last_input_text: str = ''
29
+ last_input_ansi_text: str = ''
30
+ last_parse_timing: str = ''
31
+ last_layout_mode: str = 'normal'
32
+
33
+ @abstractmethod
34
+ def parse(self, screen: pyte.Screen) -> List:
35
+ """解析 pyte 屏幕,返回 Component 列表。
36
+
37
+ Args:
38
+ screen: pyte.Screen 快照(持久化渲染器的当前状态)
39
+
40
+ Returns:
41
+ Component 列表,包含累积型 Block 和状态型组件的混合。
42
+ 调用方(OutputWatcher)负责按类型分拣。
43
+ """
44
+ ...