Repository navigation
feat(swift): RutisApp——应用托管插件的 start / stop 与可观察状态(#389) - #503
Merged
Merged
Conversation
…n: 在它上面运行(#389) - Remote/App.swift:RutisApp(plugins:connect:id:token:…) 拨出、RutisApp(plugins:listen:…certificate:) 监听;start() 开始拨出或绑定后返回,只抛重试修不好的;stop() 在 rutis 还能收到时逆序卸载全部行后断开;state(stopped(reason:) / connecting / connected)经 ObservationRegistrar 遵循 Observable,另有 states(AsyncStream) - 二进制的 dial: / listen: 改为一个设置取自环境变量的 RutisApp:一致性的 Swift 列同时检查应用的连接;监听的二进制收到 SIGTERM 也卸载后以 0 退出 - 报告行与清理时限按运行时(Events.Settings:log、shutdownTimeout) - RutisAppFixture 与 rutis-host tests/swift_app.rs:两个应用同名插件两个实例、stop 后使用者停下、start 后恢复、状态序列与观察;监听的应用被 peer 行连上,stop / start 后服务恢复 - 指南 docs/guide/swift-app(中英,含本地网络权限)、设计 §17.5、承诺 swift/app-start-stop、skill、README
This was referenced Oct 20, 2026
# Conflicts: # docs/ci.en.md # docs/ci.md # docs/guide/README.en.md # docs/guide/README.md
# Conflicts: # .github/workflows/ci.yml # docs/ci.en.md # docs/ci.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.
#389(Swift A1:应用托管)的第一部分:SDK 的
RutisApp,以及 macOS 上以可执行程序代替应用的测试。设计:Swift SDK §七、§十五 A1;应用接入;拨出规则按 远程运行时:拨出与动态接入 §六。基于 #497 的分支,#497 合入后 diff 只剩本 PR 的一个提交。第二部分(iOS 示例应用、HealthKit 插件、模拟器 e2e)随后另开 PR。RutisAppstart():开始拨出(或监听地址绑定)后即返回,只抛出重试修不好的(不合法的 id 或地址、wss://监听没有证书、地址被占用);已开始时什么也不做。之后按拨出规则自己重连,直到stop()。stop():在 rutis 还能收到时逆序卸载全部行,再关闭连接,不再重连;完成后返回,可再start()。state:经手写的ObservationRegistrar遵循Observable(SwiftUI 直接显示),另有states(AsyncStream,先给当前状态);读写都在 SDK 的锁内。.stopped(reason:)带原因时是 rutis 不兼容、它自己停下。SDK 不据状态做任何事,前后台由业务层决定。RutisApp(plugins:listen:id:token:certificate:),certificate是SecIdentity(iOS 没有在钥匙串之外把 PEM 私钥配成身份的公开 API;二进制仍用RUTIS_CERT/RUTIS_KEY)。log、shutdownTimeout:报告行与清理时限改为按运行时(Events.Settings),不再到处写 stderr、读RUTIS_SHUTDOWN_TIMEOUT;二进制的默认值不变。二进制的
dial:/listen:跑在RutisApp上#496 的拨出循环与监听循环移进
RutisApp,二进制的dial:/listen:就是一个设置取自环境变量的RutisApp(SIGTERM、Ctrl-C 调stop();因不兼容停下时以状态 1 退出,状态行只写一次)。这样dial_conformance的 Swift 列、session_matrix的监听列、swift_remote.rs同时检查应用的连接,没有第二份实现。行为上唯一的变化:监听的二进制收到 SIGTERM 也先卸载全部行、以 0 退出(与拨出相同)。测试(本机 macOS / Xcode 26.5,Swift 6.3)
rutis-host --test swift_app(新,2 项)RutisAppFixture,经 stdin 像业务层一样调start/stop)带同名插件device拨入:两个实例,各实例的 Python 行用自己那个应用的device;一个stop后只有它的使用者停下、实例关闭,start后恢复;状态序列stopped → connecting → connected → stopped → connecting → connected,withObservationTracking看到变化。监听的应用被 peer 行连上,stop后服务撤销,start后链路重连、服务恢复dial_conformance swift::(8 项)、session_matrix swift_*(4 列)、swift_remote(6 项)RutisApprutis-host --test swift、swift_runtime、runtime_conformance/value_roundtrip的 Swift、swift_rows、multilang_swift、caller_rows/sync_cyclesswift、events_conformanceX=Swift、e2etcc、swift run RutisSelfTestswift build --target Rutis --triple arm64-apple-ios17.0-simulator)CI
runtimes-swift的 rutis-host 步骤加--test swift_app(Python 已在该 job 里装好)。文档
docs/guide/swift-app.md(中英):加入 SDK(from: "0.15.0")、写插件(HealthKit、device插件)、开始与停止(含 SwiftUIscenePhase的常见做法)、rutis 一侧配置(实例分组)、改为监听、权限(拒绝即错误传回)、网络(本地网络权限NSLocalNetworkUsageDescription、TLS 与 ATS、id)、Mac 应用。swift/app-start-stop;agent skillrutis-remote-plugin加 4c;swift/README、Swift 插件指南、指南索引。rutis-host 的
runtimes.remote[].language接受"swift"已在 #387 实现(a_swift_runtime_that_dials_in_is_an_instance),本 PR 用它。