Skip to content

feat(swift): EventKit 插件的 TCC e2e、承诺登记、agent skill 与设计记录(#387) - #497

Merged
eric8810 merged 6 commits into
mainfrom
feat/swift-tcc
Oct 21, 2026
Merged

eric8810 merged 6 commits into
mainfrom
feat/swift-tcc

Conversation

@eric8810

Copy link
Copy Markdown
Contributor

#387(Swift S2)的最后一部分,接 #495、#496:用 EventKit 的插件的 TCC e2e、承诺登记、agent skill 与设计记录。基于 #496 的分支,前两个合入后改到 main。

Closes #387

e2e:tests/e2e/tests/tcc.rs(macOS)

场景里写一个 SwiftPM 包 calendar(依赖本仓库,linkerSettings 链入 Info.plist:CFBundleIdentifier dev.rutis.e2e.calendar、NSCalendarsFullAccessUsageDescription),插件 calendar 用 EventKit;构建后放进 runtimes.swift.dir,由 rutis-host run 运行,Python 探针调用它。检查:

  1. 授权归属于二进制:运行时为自己负责(插件报告的负责进程 pid 等于自己的 pid,不是宿主、不是终端;feat(swift): rutis-host 的 runtimes.swift、dev、check、new --lang swift 与指南(#387) #495 里 SDK 在 serve 时原地重新执行自己并 disclaim)。
  2. macOS 按 Info.plist 认它:codesign -d 的 Identifier=dev.rutis.e2e.calendar,二进制里有用途说明。
  3. 拒绝传回:未授权时(未决定或已拒绝,CI 的 runner 就是这样)titles 抛 CalendarAccessDenied,Python 调用方收到 CalendarAccessDenied: calendar access is not granted to this plugin (<状态>);已授权(人工授予过)时返回事件标题。

CI 里提示无法点击:插件配置 ask: false,从不请求,不会弹出提示。RUTIS_E2E_TCC_ASK=1 时请求授权,用于下面的人工验收。

人工验收(授权的那一半)

在一台有图形会话的 Mac 上:

RUTIS_E2E_TCC_ASK=1 cargo test -p rutis-e2e --test tcc -- --nocapture
  1. 弹出的提示写的是 rutis e2e calendar(二进制的 CFBundleName)想访问日历,并显示用途说明“The rutis end-to-end test reads the titles of this week's events.”,不是终端或 rutis-host。
  2. 点“不允许”:测试通过,Python 调用方收到 CalendarAccessDenied: … (denied)。系统设置 › 隐私与安全性 › 日历里出现的是这个二进制,而不是终端。
  3. tccutil reset Calendar dev.rutis.e2e.calendar 后再跑一次,点“允许”:测试通过,返回本周事件的标题。
  4. 收尾:tccutil reset Calendar dev.rutis.e2e.calendar。

(每次构建都是 ad-hoc 签名的新程序:macOS 可能为新构建再问一次,见 Swift 指南“系统权限”。)

其他

  • 承诺登记(中英):新增 loader/swift-runtimes、swift/tcc-belongs-to-the-binary(契约行为 117 → 119,已验证 108 → 110);bridge/dial-out-rules 加 Swift 列。
  • .agents/skills/rutis-remote-plugin:Swift 插件二进制的 listen: / dial:、language: "swift"、runtimes.swift、构建与 Info.plist;references 同步。
  • 设计:Swift SDK §17.4(中英)记下 S2 实现时定的做法与偏离(授权归属的做法、dev 用 debug 构建、模板测试与 Command Line Tools、check 的旧 SDK、宿主的编译型语言模块、监听不用 NWProtocolWebSocket、RUTIS_KEY 格式);多语言总体稿 M3 一行记下形态①完成。
  • CI:runtimes-swift 跑 rutis-e2e --test tcc;路径过滤加它;docs/ci 同步。

本机结果(macOS 26.6 / Swift 6.3.2)

cargo test -p rutis-e2e --test tcc 过(本机此二进制的日历授权为“未决定”,走拒绝的那一支,未弹提示)。

S2 与 M3 的验收

- e2e tests/e2e/tests/tcc.rs:用 EventKit 的 Swift 插件由 rutis-host run 运行、Python 插件调用:运行时为自己负责(负责进程是自己),签名标识来自链入的 Info.plist、其中有用途说明;未授权时 Python 调用方收到插件的错误(CalendarAccessDenied);CI 里从不弹提示,RUTIS_E2E_TCC_ASK=1 时请求授权(人工验收)
- 承诺登记:loader/swift-runtimes、swift/tcc-belongs-to-the-binary,bridge/dial-out-rules 加 Swift 列
- .agents/skills/rutis-remote-plugin:Swift 插件二进制的 listen: / dial:、language swift、runtimes.swift
- 设计:Swift SDK §17.4 S2 的实现记录;多语言总体稿 M3 的进展
- CI:runtimes-swift 跑 tcc

Closes #387
@eric8810 eric8810 added this to the 0.14 milestone Oct 19, 2026
@eric8810 eric8810 modified the milestones: 0.14, 0.15 Oct 20, 2026
@eric8810
eric8810 changed the base branch from feat/swift-remote to main October 20, 2026 13:27
# Conflicts:
#	docs/ci.en.md
#	docs/ci.md
#	docs/guarantees.en.md
#	docs/guarantees.md
@eric8810
eric8810 merged commit 0ba0199 into main Oct 21, 2026
38 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Swift S2:按需启动、rutis-host 命令、TCC / EventKit

1 participant