Repository navigation
feat(terminal): 会话归 App 所有、标签页、触屏鼠标/粘贴/缩放、终端前台服务 (#183) - #187
Closed
Slacker-LLC wants to merge 8 commits into
Closed
Slacker-LLC wants to merge 8 commits into
Slacker-LLC wants to merge 8 commits into
Conversation
…reen on a libsu root service Root is the app's one privileged path. The code before this change is archived on the branch archive/before-root-only (6a6b450); the rootless PRoot + Ubuntu backend is shelved as #184. - android-shizuku-cli becomes android-root-cli: the same subcommands and JSON, run as root through RootProcess -> DirectRootRunner (su). The shizuku_cli permission key migrates to root_cli; a stale android-shizuku-cli wrapper in an existing rootfs is removed on the next guest CLI install. - The virtual screen service is hosted by a libsu RootService (VirtualScreenRootService, daemon mode) instead of a Shizuku UserService, and accepts uid 0 only. The Shizuku-reserved destroy() leaves the AIDL; libsu ends the daemon on app update, so no service version is needed. Probes saved under the Shizuku host no longer count (host marker in the fingerprint): the self-check must pass again before it is re-enabled. - Accessibility repair, clearing restricted settings and one-tap authorize use Root. Settings > System gets a Root page in place of "Root & Shizuku"; the readiness checklist drops Shizuku. - Removed: ShizukuManager/ShizukuBackend, the Shizuku settings page, the Shizuku API/provider dependency, manifest provider/permission/queries, and every Shizuku string in all eight locales (new strings translated). - Contracts: AGENTS.md rule 3 and 04 list android-root-cli (with its raw `exec` root shell) and the virtual-screen root service; 05 describes the new VScreen host; 06 records what is unverified on a device and two gaps (MCP can reach android-root-cli through linux.shell; #182 not built). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PV4ECd3Yzu9k81sw7vHjS3
…design The remote MCP path stays gated by the one-shot MCP_CONFIRM approval, which AutonomyMode (全自动) does not bypass, and by the default-off root_cli switch. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PV4ECd3Yzu9k81sw7vHjS3
…nd detection (#183, part 1) Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PV4ECd3Yzu9k81sw7vHjS3
…ice for terminals (#183) Terminals belong to the app (TerminalSessionManager); the Terminal page only attaches and detaches. Tabs, mouse reporting, swipe-to-arrow-keys, pinch zoom, bracketed paste, a specialUse foreground service while any terminal has a live process, a prompt-marker cross-check for the foreground detection, and an idle-reclaim that never closes a terminal with a program running. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PV4ECd3Yzu9k81sw7vHjS3
…boundary guard) Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PV4ECd3Yzu9k81sw7vHjS3
#186, #188 and #189 landed on main. The merge was clean (CHANGELOG, 06-CURRENT-GAPS and the string files only had adjacent additions); CI on this head tests the combination. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PV4ECd3Yzu9k81sw7vHjS3
Merged
Only CHANGELOG.md conflicted (both sides added bullets at the end of Unreleased); both kept. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PV4ECd3Yzu9k81sw7vHjS3
Slacker-LLC
added a commit
that referenced
this pull request
Oct 11, 2026
* feat: Antigravity 登录、Claude 登录修复、终端大改(并入 0.0.3,含 #187) - Antigravity:Gemini 请求体走 Cloud Code 信封,账号 OAuth(项目发现/onboarding)、模型列表;OAuth 客户端 id/secret 来自私有构建配置。 - Claude 登录:发布版不再把它编译掉;claude.ai token 地址、共用 CLI 指纹(UA 2.1.280)、前台交换授权码、流中途 error 帧、Claude 5 thinking 关闭、登录进度与失败提示。 - 终端:会话归 App 所有、标签页、触屏鼠标/粘贴/缩放、前台服务(#187);惯性滑动、滚动条、选词与扩选、拼音预编辑、标签标题、辅助栏第二页;模拟器对照 Termux(行数变化保光标行、软换行与重排、Unicode 15 宽度、冒号子参数、DCS 跳过、UTF-8 OSC、DEC 线框、OSC 52/8、响铃、反色修复);Minis 操作终端的光标/模式/高亮标记、until_prompt、find、click/scroll/resize 与启动查询应答。 Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * fix: translations for the new sign-in strings; the no-secret test only looks at the Antigravity source Co-Authored-By: Claude Sonnet 5.5 <[email protected]> --------- Co-authored-by: limuzi013 <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Owner
Author
|
已并入 #195(squash 合并,含本 PR 的全部提交),随 0.0.3 一起发布。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #183。base 为
feat/root-only-drop-shizuku(叠在 #185 上),#185 合并后改 base 到main。与 #186(#182)互相独立,两者都改CHANGELOG.md和06-CURRENT-GAPS.md,后合并的一个需要做一次琐碎的冲突处理。做了什么
1. 会话归 App 所有
TerminalSessionManager(App 级单例,形式同AgentTerminals),持有用户终端、它们的TerminalEmulator和名称。TerminalScreen只做附着/分离,onDispose不再调用stop();顶栏左上角“返回”也不再停止终端。exit(标签保留,可“重新启动”)、通知里“全部结束”、运行时维护。TerminalForegroundService(独立服务,specialUse,START_NOT_STICKY):用户终端 + Agent 终端里有存活进程时常驻;通知显示“N 个终端运行中”,点击回终端,带“全部结束”;全部结束后停止。TerminalServicePolicy.shouldRun(count) = count > 0,已结束但标签还开着的 shell 不算。docs/AGENT-FOREGROUND-SERVICE.md已加对应章节,写明不借用mediaPlayback/dataSync。AgentTerminals空闲回收:只回收foregroundState() == IDLE的 shell。判断“有程序在跑”(
TerminalSession.foregroundState()):tcgetpgrp()(新增PtyBridge.foregroundPgid)由唯一持有 fd 的 IO 协程采样;shell 自身进程组在首次输出静默 ≥400 ms 时记为基线。OSC 133;A,所以一旦见过该标记,回车之后没看到新的提示符就算“在运行”。这是为了应对个别su自带 pty 中继、PTY 主端的前台进程组永远不变的情况。2. 标签页
顶部标签栏:
+新建、点选切换、×关闭、长按重命名、状态点(沿用 OSC 7501 的 working / blocked / idle / done / error)。上限 8,和 Agent 的上限分开。每个标签保留自己的sessionId,workspace 语义不变(硬规则 6);聊天里“打开终端”会复用该聊天已有的存活 shell,带命令的永远开新标签。关闭有前台程序的标签会确认一次,空闲的直接关。操作按钮都是文字按钮。Agent 的终端以只读“Agent · tN”标签出现,“接管”后可输入。3. 触屏
ESC O A/B或ESC [ A/B),带余量累积,单次最多 12 个。TerminalPrefs,缩放后重算行列并通过 pty 通知程序。与 issue 的差异(请注意)
TerminalSession.stopAll*的调用方在 rootfs 修复、挂载变更这类非 UI 的运行时层,那里没有可以等用户回答的位置,而且 rootfs 损坏时修复不能被推迟。实现:停止前通知管理器,Terminal 页弹一次对话框,页面不在前台时发一条通知。没有做“先确认再维护”,要做需要由发起维护的 UI 自己先看busyCount(),目前没有这样的入口,已写入06-CURRENT-GAPS.md。验证
:app:testDebugUnitTest全量通过(LANG=C.UTF-8)。第一次全量运行里AgentTerminalsTest.wait_for matches on the screen(既有用例,真实 dispatcher + 3 s 上限)失败过一次,单独跑和第二次全量都通过,判断为并发负载下的时序抖动,不是本 PR 引入;没有改它。TerminalMouseTest:SGR 坐标和按钮值、X10 上限、DECCKM 两种方向键序列、括号粘贴与 ESC 剥离、字号夹取。TerminalSessionManagerTest:分离 ≠ 停止、输出和 scrollback 在附着/分离中保留、关闭、shell 自行退出标签保留并可重启、全部结束、标签上限、每个标签的 sessionId 与重命名、空闲/忙碌判断、保活计数、维护通知、openOrSelect语义。TerminalForegroundStateTest:前台组变化 → BUSY;组不变但回车后没有提示符 → BUSY;提示符回来 → IDLE;没有提示符钩子时只看进程组;标记被切在两次读取之间;已停止的会话是 IDLE。AgentTerminalsReclaimTest(否定用例):前台有程序的终端放 5 小时也不被回收;状态未知的不被回收;1 小时内用过的不被回收;只有空闲 shell 才被回收。TerminalServicePolicyTest:没有存活进程就不常驻。scripts/test_pty_bridge.py:在 Linux 上用真实 JVM、真实 PTY 和子进程跑生产 C 代码,验证foregroundPgid:空闲 shell 等于自身进程组,前台有程序时不等,坏 fd 返回 -1。:app:lintDebug:0 error。:app:minifyReleaseWithR8:通过。provenance / build-cleanup / runtime package boundary 守卫通过,字符串审计没有新增缺译或格式不一致(8 种语言)。未验证(需要真机)
tcgetpgrp构建与运行(只在 Linux glibc 宿主验证过)。su(KernelSU / Magisk / APatch)是否把 PTY 直接交给 shell。如果su自带 pty 中继,只剩OSC 133;A一个信号;用户在.bashrc里替换PROMPT_COMMAND时两个信号都失效,终端会被当作空闲(关闭不提示,Agent 空闲回收可能关掉它)。mouse=a)、htop、tmux(mouse on)、less / man 里点击与滚动的手感;捏合后tput cols随之变化;往真实 bash 粘贴多行不逐行执行。cmd &)不算前台程序,关闭标签不会提示。已知限制(第二阶段)
系统或 OEM 杀掉 Minis 进程、升级 App 时,PTY 主端随进程关闭,shell 收到 SIGHUP,任务照样会断。需要把 PTY 持有者放到 App 进程之外(guest 里的 tmux / dtach,重启后重新附着)。本 PR 不做,
TerminalSessionManager作为唯一持有者,不堵这条路。🤖 Generated with Claude Code
https://claude.ai/code/session_01PV4ECd3Yzu9k81sw7vHjS3
Generated by Claude Code