Repository navigation
feat(sms): schedule with AgentOS from a conversation, with an editable prompt - #3
Merged
Merged
Conversation
added 6 commits
October 9, 2026 18:08
The SMS app becomes the second third-party user of :sdk:acp-android, after Notes. This commit is the model and logic behind a new button on the conversation page (the UI follows in the next commit): - agentos/: the gateway interface and its thin SDK adapter, the use case state machine (Ready, Checking, WaitingAuthorization, Running, Done, Error), and the tool-call summary. These are adapted from the Notes app; the tool scope stays the three create tools (event, to-do, alarm), never the tools that read or send messages, because anyone can text the user. - SmsSchedulePrompt: four parts. Date, time zone and language, fixed. The task instructions, the only part the user can edit (default text lives in resources, sms_prompt_default, per UI language). Fixed rules and a safety note that treats everything inside <sms> as data from an untrusted sender. The raw messages, each with the time it arrived, so relative dates are worked out from that day and not from today. Message text, the number and the user's own text are escaped so none of them can close or forge the delimiter; a line break in a message is indented so it cannot forge the next message's header. - ScheduleSelection: only unprocessed messages by default, newest kept when the 8,000 character budget runs out (counted after escaping), older ones reported. - ProcessedLedger: ids of messages already handled, recorded only after a round finished normally (not stopped, not failed, not cancelled by AgentOS) so a retry does not lose them and a handled message does not create a second to-do. - PromptSettings: the user's edited instructions; saving text equal to the default clears the store, so a later default update still reaches users who never edited. - Manifest <queries> for the calendar, to-do, alarm and AgentOS packages; the disclosure text now says the raw messages go to AgentOS when the user taps the button. 236 JVM tests in the module pass (prompt, injection escaping, size budget, selection, ledger, prompt storage, every state machine path against the fake gateway). debug carries the scriptable fake gateway; release only the real one.
…anel
The conversation page gets a primary button, "Schedule with AgentOS", with a
badge counting the messages not handled yet ("All processed" when none). It opens
a bottom panel instead of sending right away:
- Preview of the raw messages that will be sent, each with its arrival time and
direction; a note if older unprocessed messages did not fit the budget.
- A switch to include already processed messages (shown only when there are some).
- A "Prompt" card: collapsed to one line (Default / Customized), expanded to an
editable text box with a counter (max 4,000), a hint saying which parts the app
always adds and cannot be changed, and "Restore default". The edit is saved when
Start is tapped; Cancel and Back leave nothing behind.
- Then the same stages as the Notes panel: connecting, waiting for the AgentOS
authorization, running with the streamed text and tool cards, awaiting
confirmation (with an "Open confirmation" button), done with "View in Calendar /
To-do / Alarms", and the error states with their next step.
- Bubbles of handled messages carry a "Handled by AgentOS" mark.
The panel lives in SmsRoot, so rotating, switching tabs or leaving the
conversation does not cancel a running round. MainActivity restores a round that
was lost when the process was reclaimed and says so in the panel.
DebugToolReceiver (debug only, DUMP permission, as before) gets the same entry points the Notes app has, going through the same use case as the button: ask_agent (--es address, optional include_processed and a one-off instructions override), ask_agent_status, ask_agent_stop, fake_gateway, raw_prompt, plus processed (read or clear the handled-message ids) and instructions (read, set or reset the saved prompt). reset now also clears the handled-message ids. The report only has counts, the number, the agent's reply and the created items; no message text and no key. Nothing of this is in the release APK (checked in the dex: 0 hits for the receiver, the fake gateway, raw_prompt and fake_gateway).
…a demo seeder third_party_sms_e2e.py drives the real model (minimax-cn / MiniMax-M3) on a rooted phone through adb only: first-time authorization, creating an event, a to-do and an alarm from raw messages, sending only unprocessed messages and the include-processed switch, a one-off prompt override with a user requirement, prompt injection inside a message, an always-allow tool, and revoking. Messages are written into the system store with `su -c content insert`, only for made-up numbers, and deleted by number afterwards. The user's per-tool approval modes are put on "ask" for the run and restored; alarms and to-dos are removed by id. The calendar app's debug receiver can only reset everything it holds, so the run refuses to start when the calendar already contains events unless --allow-calendar-reset is passed. (A first version without that guard did wipe a leftover demo event on the test phone; see docs/m1-acceptance.md.) sms_demo_seed.py writes ten demo messages (flight, credit card bill, parcel code, a colleague's meeting and report, family messages, a verification code, a promotion) for screen recording. Timestamps count back from now and weekday names are computed from the date so "by Thursday" is never today. A colon inside a message must be escaped for `content insert` (08:20 otherwise rejects the whole binding); the script does that and fails when an insert is rejected, where it used to drop a message silently. `clean` only deletes rows of the demo numbers.
…ease notes - plugins/samples/sms/README.md: a section with screenshots (Chinese and English), how the prompt editing works and what stays fixed, what "processed" means, the tool scope and the data flow; code structure, debug entry points and how to put demo messages on a rooted phone. - third-party-acp.md 5b: how the SMS app differs from Notes (source, only unprocessed messages, size budget, editable prompt vs. the fixed injection guard, tool scope without read/send tools). - m1-acceptance.md "san zhi wu": the real-phone run (44/44), the screen walkthrough, the three bugs found and fixed, and what was not verified: screens were driven by a script and not tapped by a person, typing in the prompt box with a Chinese keyboard, real incoming messages and a real SIM, and the calendar event the first version of the script removed from the test phone. - docs/release-notes/0.2.0.md (bilingual, with known limitations). The upgrade paragraph says plainly that the upgrade over the 0.1.0 release package was not verified before publishing and is checked afterwards with the downloaded files. - sample-apps.md and development.md: one sentence each.
The AgentOS app, the module zip and the five sample APKs share one version. Only the SMS app changes behaviour in this release; the others are rebuilt unchanged (see docs/release-notes/0.2.0.md).
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.
做了什么、为什么
短信 App 的会话页新增主按钮“让 AgentOS 安排”:把这个会话里还没处理过的短信原文(没有经过任何 AI 处理;验证码按设置遮蔽)现场交给 AgentOS,建日程、待办和闹钟。这是
:sdk:acp-android的第二个使用者(第一个是备忘录),网关、状态机、汇总从备忘录改过来。event_create、todo_create、alarm_create,不带读短信 / 发短信的工具:任何人都能给用户发短信,正文比备忘录更不可信。docs/release-notes/0.2.0.md;演示用的sms_demo_seed.py(写 10 条演示短信)。除短信 App 外app/、core/、sdk/没有改动。验证
./gradlew --stacktrace test lint -Pagentos.skipPiBundle=true通过(最终提交5eb50fb);短信模块 236 个 JVM 测试,0 失败python3 tools/check-i18n.py、tools/tests137 项、tests/device/acp-channel/unit175 项通过assembleDebug assembleRelease :app:assembleReleaseTest通过;release 包里没有 debug 组件:app和 5 个示例的 dex 里Debug(Call|Tool)?Receiver命中全是 0;短信 release 包里假网关 /raw_prompt/fake_gateway/ask_agent命中 0python3 tools/package-samples.py --allow-unsigned干跑通过(5 个 APK、证书 / 权限 / 版本 / 发布说明检查)真机测试
google/shiba/shiba:15/BP1A.250505.005.B1/13277630:user/release-keys· Magisk5eb50fb60f3c787796242a18ab781af573a3c100(origin/main没有前进,分支已是最新)python3 tests/device/acp-channel/third_party_sms_e2e.py 38290DLJH0007B→ 44/44(最终提交上跑了一轮,开发过程中的前一版也是 44/44):首次授权、从原始短信建日程 + 待办 + 闹钟、只发没处理过的 /include_processed、用户在提示词末尾加的要求被执行、提示注入(要求删除全部日程并给 10086 发短信)无任何删除或发送、always工具不弹卡、撤销。https://api.minimaxi.com/anthropic),模型源只检查、没重配uiautomator脚本点的,截图在plugins/samples/sms/screenshots/*-14到*-19;没有人用手点过always;授权记录撤销;演示号码的短信删除。一处意外:脚本第一版在清理时对日历做了reset,清掉了手机上之前备忘录演示留下的一个日程(“和王总开会”);脚本现已加护栏(日历里有非本次创建的数据时拒绝运行,除非--allow-calendar-reset),详见docs/m1-acceptance.md三之五文档与契约
plugins/samples/sms/README.md(含截图)、docs/third-party-acp.md5b、docs/m1-acceptance.md三之五(如实写了没测的和发现的缺陷)、docs/sample-apps.md、docs/development.md、tests/device/acp-channel/README.md、新增docs/release-notes/0.2.0.md(中英文,含已知限制)IAcpService、两个 SDK 的公开 API、plugin.json、错误码)MainActivity、SmsMcpService(要求BIND_MCP_SERVICE)和 androidx 的ProfileInstallReceiver)。新增的是<queries>(日历、待办、闹钟、AgentOS 包名和 ACP action,只用于“在…中查看”和检测 AgentOS);权限不变(READ_SMS、SEND_SMS)风险与回滚
SmsGraph多一个懒加载的用例,不点按钮就不连接 AgentOS。git revert这个 PR 的合并提交即可(用户本地的“已处理”id 和自定义提示词留在 SharedPreferences 里,无害)。