zen-fs-config 0.8.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/DESIGN.md CHANGED
@@ -90,13 +90,17 @@ A **sync group** is a set of backends that synchronize with each other. There ar
90
90
  - Backends: full credentials + storage location, but typically reusing the same account as a config-sync backend with a different storage target (e.g., same token/owner, different repo/branch)
91
91
  - Can be referenced by a config-sync group as an app's data storage (via `ConfigRepo.createAppDataGroup`)
92
92
 
93
- **Group type detection**: When connecting to a backend, the library reads `.meta/group-type` to determine the group type. If the file is absent, the backend is treated as a new empty group and the caller decides which type to create.
93
+ **Group type detection**: When connecting to a backend, the library reads `.meta/group.json` first and takes its `kind` as the group type. Only when no descriptor exists does it fall back to the legacy `group-type` markers (`/.config/group-type`, `/.meta/group-type`). If neither exists, the backend is treated as a new empty group and the caller decides which type to create.
94
94
 
95
- | `.meta/group-type` | Behavior |
95
+ | `.meta/group.json` `kind` (legacy marker) | Behavior |
96
96
  |---|---|
97
- | `config-sync` | Full system: IndexedDB primary + config replicas + optional data-sync groups |
98
- | `data-sync` | Lightweight: data backends only, direct read/write, no config meta layer |
99
- | absent | New empty backend; caller decides group type at creation time |
97
+ | `config` (`config-sync`) | Full system: IndexedDB primary + config replicas + optional data-sync groups |
98
+ | `data` (`data-sync`) | Lightweight: data backends only, direct read/write, no config meta layer |
99
+ | absent (no marker either) | New empty backend; caller decides group type at creation time |
100
+
101
+ Since 0.9.0 the library **no longer writes** any `group-type` marker; `kind` is the only
102
+ source of truth. Markers remain read-compatible for remotes created by older versions and
103
+ are deleted on sight.
100
104
 
101
105
  **Group type is write-once, and sync may not change it**: besides the connect-time
102
106
  check (`connect()` throws when `options.groupType` disagrees with the detected
@@ -125,7 +129,7 @@ group wiring instead of syncing the marker.
125
129
  ```
126
130
  /
127
131
  ├─ .meta/ [synced to replicas]
128
- │ ├─ group-type Group type marker: "config-sync"
132
+ │ ├─ group.json Unified descriptor { schemaVersion, kind, id, instanceId?, name?, features }
129
133
  │ ├─ backends/ Backend topology (one file per backend)
130
134
  │ │ ├─ local-idb.json { id, type, options, description }
131
135
  │ │ ├─ gitee-prod.json
@@ -162,8 +166,8 @@ group wiring instead of syncing the marker.
162
166
 
163
167
  ```
164
168
  /
165
- ├─ .meta/ [synced to replicas]
166
- │ ├─ group-type Group type marker: "data-sync"
169
+ ├─ .meta/ [group.json excluded from sync]
170
+ │ ├─ group.json Descriptor { schemaVersion:2, kind:"data", id, instanceId?, name?, features }
167
171
  │ └─ backends/ Data backend topology (one file per backend)
168
172
  │ ├─ gitee-data-1.json { id, type, options, description }
169
173
  │ └─ gitee-data-2.json
@@ -712,9 +716,11 @@ createConfigRepo('my-app', options?)
712
716
  ├─ 1. Create IndexedDB backend (always, ID = 'local-idb')
713
717
  │ storeName = options.idbStoreName || `zen-fs-config-${appId}`
714
718
  │
715
- ├─ 2. Ensure /.meta/ directory exists
719
+ ├─ 2. Ensure /.meta/ and /.config/ directories exist
716
720
  │
717
- ├─ 3. Write /.meta/group-type = "config-sync" (if not exists)
721
+ ├─ 3. Delete stale group-type markers (/.config/group-type, /.meta/group-type)
722
+ │ └─ No marker is written since 0.9.0: type lives in .meta/group.json's kind
723
+ │ markers stay readable for old remotes (getGroupType / probe fallback)
718
724
  │
719
725
  ├─ 4. Migrate legacy .meta/backends.json → .meta/backends/*.json (if exists)
720
726
  │
@@ -934,18 +940,19 @@ connect('my-app', options?)
934
940
  │
935
941
  ├─ 1. Determine config-sync repo (create or reuse) — this always hosts the data groups
936
942
  │
937
- ├─ 2. If options.backendInfo provided, read /.meta/group-type
943
+ ├─ 2. If options.backendInfo provided, read /.meta/group.json's kind
944
+ │ (fall back to the legacy .config/group-type or .meta/group-type marker)
938
945
  │
939
- ├─ "config-sync" → connect the repo to that backend; then load every app
946
+ ├─ kind=config / "config-sync" → connect the repo to that backend; then load every app
940
947
  │ data group from .meta/app-data-groups/{appId}/*.json (UC2)
941
948
  │ return { groupType: "config-sync", repo, appDataGroups }
942
949
  │
943
- ├─ "data-sync" → keep the config repo local-only; ensure the default data
950
+ ├─ kind=data / "data-sync" → keep the config repo local-only; ensure the default data
944
951
  │ group exists and attach the backend to it (UC3). The backend
945
952
  │ info is written back into app-data-groups by addBackend.
946
953
  │ return { groupType: "data-sync", repo, dataGroup }
947
954
  │
948
- └─ absent (no backendInfo) → local-only config repo + a default data group
955
+ └─ absent (no descriptor, no marker, no backendInfo) → local-only config repo + a default data group
949
956
  └─ return { groupType: "config-sync" (or options.groupType), repo, dataGroup }
950
957
  ```
951
958
 
package/README.md CHANGED
@@ -193,7 +193,8 @@ if (result.groupType === 'data-sync') {
193
193
  Detection & dispatch rules:
194
194
 
195
195
  - Always creates (or reuses) a **config-sync `ConfigRepo`** as the anchor.
196
- - Probes the backend before creating anything local: it reads `/.meta/group.json` strictly (only a genuine "not found" counts as empty — a 401/403 is surfaced, not swallowed) and then the legacy `/.meta/group-type` marker. The probe yields one of `unreachable | empty | marked | occupied`.
196
+ - Probes the backend before creating anything local: it reads `/.meta/group.json` strictly (only a genuine "not found" counts as empty — a 401/403 is surfaced, not swallowed) and then the legacy `.config/group-type` / `.meta/group-type` markers. The probe yields one of `unreachable | empty | marked | occupied`.
197
+ - **The library no longer writes any `group-type` marker** (since 0.9.0): the group type lives only in `group.json`'s `kind`; legacy markers stay readable and are deleted on sight. `getGroupType()` therefore returns `null` on new deployments — use the descriptor's `kind` (or the `groupType` returned by `connect()`) instead.
197
198
  - `unreachable` → throws `RemoteUnreachableError` (`code: 'REMOTE_UNREACHABLE'`); no local group is created.
198
199
  - `empty` (no descriptor and no marker) → throws `NeedsInitError` (`code: 'NEEDS_INIT'`, `requiresInit: true`) unless you pass `initGroupType` (or the older `groupType`). **The library never guesses a group type for a brand-new backend** — ask the user and retry.
199
200
  - `marked` → `config-sync` connects the repo to that backend; `data-sync` attaches the backend to the default app data group inside the config-sync repo.
@@ -209,7 +210,7 @@ Detection & dispatch rules:
209
210
 
210
211
  ### Deferred replica setup: two signals
211
212
 
212
- `connect()` normally verifies every remote backend's group identity (a network round-trip per replica) before it returns. With `deferReplicaSetup: true` it stops doing that inline:
213
+ `connect()` no longer verifies every remote backend's group identity (a network round-trip per replica) before returning — that is deferred to the background by default. Pass `deferReplicaSetup: false` to restore the old blocking behaviour (where one unresponsive backend could stall `connect()` indefinitely):
213
214
 
214
215
  ```typescript
215
216
  const result = await connect('my-app', {
package/README.zh-CN.md CHANGED
@@ -186,7 +186,8 @@ if (result.groupType === 'data-sync') {
186
186
  探测与分发规则:
187
187
 
188
188
  - 始终创建(或复用)一个**配置同步组 `ConfigRepo`** 作为锚点。
189
- - 建任何本地东西之前先探测后端:严格读 `/.meta/group.json`(只有真正的「不存在」才算空,401/403 会照实报错而不是被吞成空库),没有描述符时再读旧标记 `/.meta/group-type`。探测结果是 `unreachable | empty | marked | occupied` 四态之一。
189
+ - 建任何本地东西之前先探测后端:严格读 `/.meta/group.json`(只有真正的「不存在」才算空,401/403 会照实报错而不是被吞成空库),没有描述符时再读旧标记 `/.config/group-type`、`/.meta/group-type`。探测结果是 `unreachable | empty | marked | occupied` 四态之一。
190
+ - **库不再生成任何 `group-type` 标记**(0.9.0 起):组类型只由 `group.json` 的 `kind` 表达,旧标记仅作读取兼容,遇到就删除。所以 `getGroupType()` 在新部署上返回 `null`,判断类型请读描述符的 `kind`(或直接看 `connect()` 返回的 `groupType`)。
190
191
  - `unreachable` → 抛 `RemoteUnreachableError`(`code: 'REMOTE_UNREACHABLE'`),不创建本地组。
191
192
  - `empty`(无描述符也无标记)→ 抛 `NeedsInitError`(`code: 'NEEDS_INIT'`,`requiresInit: true`),除非你传了 `initGroupType`(或旧选项 `groupType`)。**库不会替全新后端猜组类型** —— 先问用户,再带类型重连。
192
193
  - `marked` → `config-sync` 把该后端连到配置同步组;`data-sync` 把它挂到配置同步组下的默认数据组。
@@ -202,7 +203,7 @@ if (result.groupType === 'data-sync') {
202
203
 
203
204
  ### deferReplicaSetup:两个信号
204
205
 
205
- 默认情况下,`connect()` 要逐个校验远端后端的组身份(每个副本一次网络往返)才能返回。传 `deferReplicaSetup: true` 后这段挪到后台:
206
+ **默认就是本地优先**:`connect()` 不再逐个校验远端后端(每个副本一次网络往返)才返回,这段直接挪到后台;传 `deferReplicaSetup: false` 才恢复「等所有副本校验完再返回」的旧行为(此时一个不响应的后端会把 `connect()` 挂住):
206
207
 
207
208
  ```typescript
208
209
  const result = await connect('my-app', {
package/dist/index.d.mts CHANGED
@@ -275,9 +275,10 @@ interface ConfigRepoOptions {
275
275
  descriptor: GroupDescriptor | null;
276
276
  };
277
277
  /**
278
- * 把副本建对推迟到后台(默认 false)。开启后 `createConfigRepo` 先返回本地
279
- * 可用的 repo,副本校验与建对由 `whenReplicasReady()` 通知;校验完成前不会
280
- * 建任何 pair,也不会启动首同步。
278
+ * 把副本建对推迟到后台(默认 true)。`createConfigRepo` 先用本地缓存可用,
279
+ * 副本校验与建对由 `whenReplicasReady()` 通知;校验完成前不会建任何 pair,
280
+ * 也不会启动首同步。传 `false` 恢复旧行为(逐个校验远端后再返回,任一后端
281
+ * 不响应会一直等下去)。
281
282
  */
282
283
  deferReplicaSetup?: boolean;
283
284
  /** IndexedDB store name for the local primary backend. Default: `zen-fs-config-{appId}` */
@@ -650,6 +651,14 @@ interface SyncGroupHandle {
650
651
  /** Handle to a data-sync group, providing direct fs access. */
651
652
  interface AppDataGroup extends SyncGroupHandle {
652
653
  readonly kind: 'data';
654
+ /**
655
+ * 远端阶段(建实例 → 定身份 → 建同步对 → 首同步 → watch)的完成信号。
656
+ *
657
+ * 组实例在本地就绪后即返回,远端后端在后台逐个(并发 + 超时)探测;调用方可以
658
+ * 先渲染组的本地状态,再等这个 Promise 结束后刷新为真实的同步对计数 / 错误。
659
+ * 未启动时立即 resolve,永不 reject。旧版本没有该方法,调用方按可选处理。
660
+ */
661
+ whenBackendsReady?: () => Promise<void>;
653
662
  }
654
663
  /** Options for the unified connect() entry point. */
655
664
  interface ConnectOptions {
@@ -699,7 +708,8 @@ interface ConnectOptions {
699
708
  syncPollIntervalMs?: number;
700
709
  /**
701
710
  * 把「建副本同步对」整体推迟到后台:`connect()` 只做探测 + 本地仓初始化,
702
- * 返回后由 `whenReplicasReady` 通知结果。默认 false(保持旧行为)。
711
+ * 返回后由 `whenReplicasReady` 通知结果。默认 true(本地缓存优先启动);
712
+ * 传 false 恢复旧行为(等待所有副本校验完成才返回)。
703
713
  * 校验完成前不建任何 pair,因此不存在「建了又拆」的冲突窗口。
704
714
  */
705
715
  deferReplicaSetup?: boolean;
@@ -935,9 +945,18 @@ interface IConfigRepo {
935
945
  * primary). Unified handle method shared with data groups.
936
946
  */
937
947
  listBackends(): AppDataBackendDescriptor[];
938
- /** Write the group-type marker file if it doesn't exist. */
948
+ /**
949
+ * Ensure the unified group descriptor (`.meta/group.json`) exists.
950
+ *
951
+ * No longer writes any `group-type` marker (since 0.9.0); `type` is kept for
952
+ * API compatibility only. Stale markers are deleted when encountered.
953
+ */
939
954
  ensureGroupType(type: SyncGroupType): Promise<void>;
940
- /** Read the group-type marker. Returns null if not set. */
955
+ /**
956
+ * Read the legacy `group-type` marker (`/.config/group-type`, then
957
+ * `/.meta/group-type`). Returns null when neither exists — which is now the
958
+ * normal case, since type is carried by `.meta/group.json`'s `kind`.
959
+ */
941
960
  getGroupType(): Promise<SyncGroupType | null>;
942
961
  /** Dispose: stop all sync, release cache FS and resources. */
943
962
  dispose(): Promise<void>;
@@ -1200,6 +1219,16 @@ declare class ConfigRepo implements IConfigRepo {
1200
1219
  private onConflictCallback?;
1201
1220
  private disposed;
1202
1221
  private configCache;
1222
+ /**
1223
+ * 引导副本(`.config/app-data-groups/**`)改动后的「立刻推送」定时器。
1224
+ *
1225
+ * 写完描述符只落到本地主存储,配置组的同步对要等下一轮 poll(默认几十秒)
1226
+ * 才会把文件搬上远端;这中间的窗口里,远端 `app-data-groups` 描述符和
1227
+ * 数据组真实的后端拓扑不一致 —— 新设备 / 另一台机器此时接进来,按旧描述符
1228
+ * 建组就会得到一套过期后端(线上 golf-admin 的 `gitee` ↔ `gitee-mwuh02rn`
1229
+ * 就是这么来的)。这里在同一轮变更后合并触发一次 flush,把描述符立刻推上去。
1230
+ */
1231
+ private descriptorPushTimer?;
1203
1232
  /** 后台建对(deferReplicaSetup)的状态,见 `whenReplicasReady()`。 */
1204
1233
  private replicaSetupPromise;
1205
1234
  private replicaSetupSummary;
@@ -1633,7 +1662,14 @@ declare class ConfigRepo implements IConfigRepo {
1633
1662
  listBackendConflicts(): BackendConflictInfo[];
1634
1663
  /** 用户确认后解决配置组某个后端的归属冲突。 */
1635
1664
  resolveBackendConflict(backendId: string, mode: BackendConflictResolution): Promise<BackendConflictResolutionResult>;
1636
- /** Write the group-type marker file if it doesn't exist. */
1665
+ /**
1666
+ * 确保统一组描述符(`.meta/group.json`)就位。
1667
+ *
1668
+ * **已停写 `group-type` 标记**:`/.config/group-type` 与 `/.meta/group-type`
1669
+ * 都不再生成。组类型现在只由描述符的 `kind` 表达,标记仅作旧部署的读取兼容
1670
+ * (`getGroupType()`、`probeGroupTypeDetailed()` 的 legacy 分支),遗留文件会被顺手清掉。
1671
+ * `type` 参数只为兼容既有调用方保留,不再决定任何写入内容。
1672
+ */
1637
1673
  ensureGroupType(type: SyncGroupType): Promise<void>;
1638
1674
  /** Read the group-type marker. Returns null if not set (new path, then legacy). */
1639
1675
  getGroupType(): Promise<SyncGroupType | null>;
@@ -1682,6 +1718,14 @@ declare class ConfigRepo implements IConfigRepo {
1682
1718
  features?: Partial<SyncGroupFeatures>;
1683
1719
  instanceId?: string;
1684
1720
  }): Promise<void>;
1721
+ /**
1722
+ * 合并同一轮内的多次描述符改写,只触发一次配置组 flush。
1723
+ *
1724
+ * 刻意不 await:addBackend/removeBackend 已经在等后端的首次同步,
1725
+ * 再同步等一轮配置组全量 flush 只会让「添加后端」按钮更慢;
1726
+ * 这里放到下一轮事件循环推送,失败也只记录日志(poll 仍是兜底)。
1727
+ */
1728
+ private scheduleDescriptorPush;
1685
1729
  /**
1686
1730
  * Change a data-sync group's display name only. `id`, backends, local stores
1687
1731
  * and remote data are untouched, so existing sync pairs keep working.
@@ -1707,6 +1751,13 @@ declare class ConfigRepo implements IConfigRepo {
1707
1751
  }): Promise<ConfigSyncGroupDescriptor>;
1708
1752
  private readAppDataGroupDescriptor;
1709
1753
  getAppDataGroup(id: string): Promise<AppDataGroup>;
1754
+ /**
1755
+ * 用数据组自己的权威后端列表回刷 `.config/app-data-groups/{appId}/{id}.json`。
1756
+ *
1757
+ * 只在本地已有声明时执行:新设备首次连接、数据组本地库还是空的时候,
1758
+ * 权威列表为空,此时写描述符会把远端已登记的拓扑抹成空组。
1759
+ */
1760
+ private syncBootstrapDescriptor;
1710
1761
  listAppDataGroups(): Promise<AppDataGroupDescriptor[]>;
1711
1762
  removeAppDataGroup(id: string): Promise<void>;
1712
1763
  listAccountBackends(): Promise<BackendDescriptor[]>;
package/dist/index.d.ts CHANGED
@@ -275,9 +275,10 @@ interface ConfigRepoOptions {
275
275
  descriptor: GroupDescriptor | null;
276
276
  };
277
277
  /**
278
- * 把副本建对推迟到后台(默认 false)。开启后 `createConfigRepo` 先返回本地
279
- * 可用的 repo,副本校验与建对由 `whenReplicasReady()` 通知;校验完成前不会
280
- * 建任何 pair,也不会启动首同步。
278
+ * 把副本建对推迟到后台(默认 true)。`createConfigRepo` 先用本地缓存可用,
279
+ * 副本校验与建对由 `whenReplicasReady()` 通知;校验完成前不会建任何 pair,
280
+ * 也不会启动首同步。传 `false` 恢复旧行为(逐个校验远端后再返回,任一后端
281
+ * 不响应会一直等下去)。
281
282
  */
282
283
  deferReplicaSetup?: boolean;
283
284
  /** IndexedDB store name for the local primary backend. Default: `zen-fs-config-{appId}` */
@@ -650,6 +651,14 @@ interface SyncGroupHandle {
650
651
  /** Handle to a data-sync group, providing direct fs access. */
651
652
  interface AppDataGroup extends SyncGroupHandle {
652
653
  readonly kind: 'data';
654
+ /**
655
+ * 远端阶段(建实例 → 定身份 → 建同步对 → 首同步 → watch)的完成信号。
656
+ *
657
+ * 组实例在本地就绪后即返回,远端后端在后台逐个(并发 + 超时)探测;调用方可以
658
+ * 先渲染组的本地状态,再等这个 Promise 结束后刷新为真实的同步对计数 / 错误。
659
+ * 未启动时立即 resolve,永不 reject。旧版本没有该方法,调用方按可选处理。
660
+ */
661
+ whenBackendsReady?: () => Promise<void>;
653
662
  }
654
663
  /** Options for the unified connect() entry point. */
655
664
  interface ConnectOptions {
@@ -699,7 +708,8 @@ interface ConnectOptions {
699
708
  syncPollIntervalMs?: number;
700
709
  /**
701
710
  * 把「建副本同步对」整体推迟到后台:`connect()` 只做探测 + 本地仓初始化,
702
- * 返回后由 `whenReplicasReady` 通知结果。默认 false(保持旧行为)。
711
+ * 返回后由 `whenReplicasReady` 通知结果。默认 true(本地缓存优先启动);
712
+ * 传 false 恢复旧行为(等待所有副本校验完成才返回)。
703
713
  * 校验完成前不建任何 pair,因此不存在「建了又拆」的冲突窗口。
704
714
  */
705
715
  deferReplicaSetup?: boolean;
@@ -935,9 +945,18 @@ interface IConfigRepo {
935
945
  * primary). Unified handle method shared with data groups.
936
946
  */
937
947
  listBackends(): AppDataBackendDescriptor[];
938
- /** Write the group-type marker file if it doesn't exist. */
948
+ /**
949
+ * Ensure the unified group descriptor (`.meta/group.json`) exists.
950
+ *
951
+ * No longer writes any `group-type` marker (since 0.9.0); `type` is kept for
952
+ * API compatibility only. Stale markers are deleted when encountered.
953
+ */
939
954
  ensureGroupType(type: SyncGroupType): Promise<void>;
940
- /** Read the group-type marker. Returns null if not set. */
955
+ /**
956
+ * Read the legacy `group-type` marker (`/.config/group-type`, then
957
+ * `/.meta/group-type`). Returns null when neither exists — which is now the
958
+ * normal case, since type is carried by `.meta/group.json`'s `kind`.
959
+ */
941
960
  getGroupType(): Promise<SyncGroupType | null>;
942
961
  /** Dispose: stop all sync, release cache FS and resources. */
943
962
  dispose(): Promise<void>;
@@ -1200,6 +1219,16 @@ declare class ConfigRepo implements IConfigRepo {
1200
1219
  private onConflictCallback?;
1201
1220
  private disposed;
1202
1221
  private configCache;
1222
+ /**
1223
+ * 引导副本(`.config/app-data-groups/**`)改动后的「立刻推送」定时器。
1224
+ *
1225
+ * 写完描述符只落到本地主存储,配置组的同步对要等下一轮 poll(默认几十秒)
1226
+ * 才会把文件搬上远端;这中间的窗口里,远端 `app-data-groups` 描述符和
1227
+ * 数据组真实的后端拓扑不一致 —— 新设备 / 另一台机器此时接进来,按旧描述符
1228
+ * 建组就会得到一套过期后端(线上 golf-admin 的 `gitee` ↔ `gitee-mwuh02rn`
1229
+ * 就是这么来的)。这里在同一轮变更后合并触发一次 flush,把描述符立刻推上去。
1230
+ */
1231
+ private descriptorPushTimer?;
1203
1232
  /** 后台建对(deferReplicaSetup)的状态,见 `whenReplicasReady()`。 */
1204
1233
  private replicaSetupPromise;
1205
1234
  private replicaSetupSummary;
@@ -1633,7 +1662,14 @@ declare class ConfigRepo implements IConfigRepo {
1633
1662
  listBackendConflicts(): BackendConflictInfo[];
1634
1663
  /** 用户确认后解决配置组某个后端的归属冲突。 */
1635
1664
  resolveBackendConflict(backendId: string, mode: BackendConflictResolution): Promise<BackendConflictResolutionResult>;
1636
- /** Write the group-type marker file if it doesn't exist. */
1665
+ /**
1666
+ * 确保统一组描述符(`.meta/group.json`)就位。
1667
+ *
1668
+ * **已停写 `group-type` 标记**:`/.config/group-type` 与 `/.meta/group-type`
1669
+ * 都不再生成。组类型现在只由描述符的 `kind` 表达,标记仅作旧部署的读取兼容
1670
+ * (`getGroupType()`、`probeGroupTypeDetailed()` 的 legacy 分支),遗留文件会被顺手清掉。
1671
+ * `type` 参数只为兼容既有调用方保留,不再决定任何写入内容。
1672
+ */
1637
1673
  ensureGroupType(type: SyncGroupType): Promise<void>;
1638
1674
  /** Read the group-type marker. Returns null if not set (new path, then legacy). */
1639
1675
  getGroupType(): Promise<SyncGroupType | null>;
@@ -1682,6 +1718,14 @@ declare class ConfigRepo implements IConfigRepo {
1682
1718
  features?: Partial<SyncGroupFeatures>;
1683
1719
  instanceId?: string;
1684
1720
  }): Promise<void>;
1721
+ /**
1722
+ * 合并同一轮内的多次描述符改写,只触发一次配置组 flush。
1723
+ *
1724
+ * 刻意不 await:addBackend/removeBackend 已经在等后端的首次同步,
1725
+ * 再同步等一轮配置组全量 flush 只会让「添加后端」按钮更慢;
1726
+ * 这里放到下一轮事件循环推送,失败也只记录日志(poll 仍是兜底)。
1727
+ */
1728
+ private scheduleDescriptorPush;
1685
1729
  /**
1686
1730
  * Change a data-sync group's display name only. `id`, backends, local stores
1687
1731
  * and remote data are untouched, so existing sync pairs keep working.
@@ -1707,6 +1751,13 @@ declare class ConfigRepo implements IConfigRepo {
1707
1751
  }): Promise<ConfigSyncGroupDescriptor>;
1708
1752
  private readAppDataGroupDescriptor;
1709
1753
  getAppDataGroup(id: string): Promise<AppDataGroup>;
1754
+ /**
1755
+ * 用数据组自己的权威后端列表回刷 `.config/app-data-groups/{appId}/{id}.json`。
1756
+ *
1757
+ * 只在本地已有声明时执行:新设备首次连接、数据组本地库还是空的时候,
1758
+ * 权威列表为空,此时写描述符会把远端已登记的拓扑抹成空组。
1759
+ */
1760
+ private syncBootstrapDescriptor;
1710
1761
  listAppDataGroups(): Promise<AppDataGroupDescriptor[]>;
1711
1762
  removeAppDataGroup(id: string): Promise<void>;
1712
1763
  listAccountBackends(): Promise<BackendDescriptor[]>;