Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(config-sync): count an append-only download by tip
vastsa28d70daf4b92
diff --git a/crates/host-core/src/config_sync/engine_remote.rs b/crates/host-core/src/config_sync/engine_remote.rsindex b4c817fa0..5d484d07f 100644--- a/crates/host-core/src/config_sync/engine_remote.rs+++ b/crates/host-core/src/config_sync/engine_remote.rs@@ -203,9 +203,20 @@ pub(super) async fn read_append_only_remote(let mut tips = Vec::new();let mut resources = BTreeMap::new();- for revision_id in &tip_ids {+ let tip_total = tip_ids.len() as u64;+ for (index, revision_id) in tip_ids.iter().enumerate() {+ // Count tips, not the objects inside them: the tips are read one after+ // another, so a per-object count inside each of them would restart and+ // walk the bar backwards on a vault with more than one tip.+ observer.report(SyncProgress::counted(+ SyncPhase::Download,+ index as u64,+ tip_total,+ 0,+ 0,+ ));let (manifest, revision_resources) =- read_remote_revision(transport, config, key, revision_id, observer).await?;+ read_remote_revision(transport, config, key, revision_id, &NoSyncProgress).await?;for (object_id, bytes) in revision_resources {if let Some(existing) = resources.get(&object_id) {if existing != &bytes {@@ -217,6 +228,13 @@ pub(super) async fn read_append_only_remote(}tips.push(manifest);}+ observer.report(SyncProgress::counted(+ SyncPhase::Download,+ tip_total,+ tip_total,+ 0,+ 0,+ ));if resources.len() > MAX_RESOURCES {bail!("CONFIG_SYNC_LIMIT_EXCEEDED: compatibility revision references too many resources");}diff --git a/docs/spec/03-runtime/22-config-sync.md b/docs/spec/03-runtime/22-config-sync.mdindex a9c31b185..d4d1abb0a 100644--- a/docs/spec/03-runtime/22-config-sync.md+++ b/docs/spec/03-runtime/22-config-sync.md@@ -173,8 +173,9 @@ remote data.A manual sync reports what it is doing while it runs. `configSync.progress`carries the current phase — `capture`, `download`, `merge`, `upload`, `apply`,or `cleanup` — the units finished in that phase, and the bytes when they are-known: `done`/`total` count resource objects while transferring and entities-otherwise, a `total` of 0 means the phase cannot know its size, and a+known: `done`/`total` count resource objects while transferring — the device+tips being read, in append-only mode — and entities otherwise, a `total` of 0+means the phase cannot know its size, and a`bytesTotal` of 0 means the byte size is unknown, which is the normal case for adownload. Reports are throttled, a phase change is never dropped, and the stateevent plus the call's return value stay the terminal signal. Background pollsdiff --git a/docs/zh-CN/spec/03-runtime/22-config-sync.md b/docs/zh-CN/spec/03-runtime/22-config-sync.mdindex ff6fb0bc1..e4821665f 100644--- a/docs/zh-CN/spec/03-runtime/22-config-sync.md+++ b/docs/zh-CN/spec/03-runtime/22-config-sync.md@@ -70,7 +70,7 @@ Host 绝不会仅因为 UI flag 被设置就激活暂存的可执行内容。新设置 → 云同步提供 WebDAV endpoint 凭据、vault 密码、设备标签、服务器兼容模式、类别选择、能力测试、立即同步、解锁、暂停、文件夹映射、批准/拒绝、revision history/restore、vault 密码重新包裹以及断开连接控制。严格 CAS 是默认模式。选择追加式兼容模式会显示持续风险提示,并在保存配置前要求确认;其测试成功提示目录列表支持,而不是条件写支持。Renderer 将 `notConfigured`、`locked`、`upToDate`、`localChangesPending`、`syncing`、`offline`、`unsupportedServer`、`conflict`、`awaitingActivation`、`paused` 和 `error` 显示为不同状态。断开连接会保留本地数据,不会删除远端数据。-手动同步会在运行期间报告它正在做什么。`configSync.progress` 携带当前阶段(`capture`、`download`、`merge`、`upload`、`apply` 或 `cleanup`)、该阶段已完成的单位数,以及已知时的字节数:`done`/`total` 在传输时计资源对象、其他阶段计实体;`total` 为 0 表示该阶段无法预知总量;`bytesTotal` 为 0 表示字节数未知,这是下载阶段的常态。报告会节流,阶段变化绝不丢弃,状态事件与调用的返回值仍是终态信号。后台轮询不报告进度:只有手动路径有调用方在等待。+手动同步会在运行期间报告它正在做什么。`configSync.progress` 携带当前阶段(`capture`、`download`、`merge`、`upload`、`apply` 或 `cleanup`)、该阶段已完成的单位数,以及已知时的字节数:`done`/`total` 在传输时计资源对象(追加式模式下计正在读取的设备 tip)、其他阶段计实体;`total` 为 0 表示该阶段无法预知总量;`bytesTotal` 为 0 表示字节数未知,这是下载阶段的常态。报告会节流,阶段变化绝不丢弃,状态事件与调用的返回值仍是终态信号。后台轮询不报告进度:只有手动路径有调用方在等待。凭据和 memory 默认未选中。设置预览报告 supported、excluded、secret-bearing、mapping-required 和 pending-activation 计数。原始秘密值、vault key 和备份密码永远不会跨过 Renderer 边界。