@vrtmrz/livesync-commonlib 0.4.2 → 0.5.0

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.
Files changed (100) hide show
  1. package/README.md +7 -5
  2. package/dist/API/DirectFileManipulatorV2.d.ts +1 -0
  3. package/dist/API/DirectFileManipulatorV2.js +3 -1
  4. package/dist/API/processSetting.d.ts +1 -0
  5. package/dist/API/processSetting.js +3 -0
  6. package/dist/common/models/setting.const.defaults.js +1 -0
  7. package/dist/common/models/setting.const.qr.js +2 -1
  8. package/dist/common/models/setting.encryption.d.ts +2 -0
  9. package/dist/common/models/setting.encryption.js +6 -0
  10. package/dist/common/models/setting.lifecycle.js +7 -2
  11. package/dist/common/models/setting.policy.d.ts +4 -0
  12. package/dist/common/models/setting.policy.js +9 -0
  13. package/dist/common/models/setting.type.d.ts +2 -0
  14. package/dist/common/models/shared.definition.configNames.js +5 -0
  15. package/dist/common/models/tweak.definition.d.ts +1 -0
  16. package/dist/common/settingConstants.d.ts +1 -0
  17. package/dist/common/utils.js +5 -4
  18. package/dist/diagnostics/couchdb.js +4 -2
  19. package/dist/interfaces/StorageAccess.d.ts +8 -2
  20. package/dist/managers/ChunkFetcher.js +27 -4
  21. package/dist/managers/chunkFetcher.helper.js +1 -1
  22. package/dist/platform/FilePathIndex.d.ts +110 -0
  23. package/dist/platform/FilePathIndex.js +146 -0
  24. package/dist/pouchdb/StreamingFetch.d.ts +1 -2
  25. package/dist/pouchdb/encryption.d.ts +5 -10
  26. package/dist/pouchdb/encryption.eden.d.ts +11 -0
  27. package/dist/pouchdb/encryption.eden.js +37 -0
  28. package/dist/pouchdb/encryption.js +67 -63
  29. package/dist/pouchdb/encryption.policy.d.ts +9 -0
  30. package/dist/pouchdb/encryption.policy.js +125 -0
  31. package/dist/replication/UnencryptedContentRejectedError.d.ts +16 -0
  32. package/dist/replication/UnencryptedContentRejectedError.js +44 -0
  33. package/dist/replication/couchdb/LiveSyncReplicator.js +41 -4
  34. package/dist/replication/index.d.ts +2 -0
  35. package/dist/replication/index.js +3 -0
  36. package/dist/replication/trystero/LiveSyncTrysteroReplicator.d.ts +3 -3
  37. package/dist/replication/trystero/P2PAutomationCoordinator.d.ts +1 -1
  38. package/dist/replication/trystero/P2PReplicationWire.d.ts +1 -1
  39. package/dist/replication/trystero/TrysteroReplicator/changeRelay.d.ts +133 -0
  40. package/dist/replication/trystero/TrysteroReplicator/changeRelay.js +176 -0
  41. package/dist/replication/trystero/TrysteroReplicator/configurationExchange.d.ts +55 -0
  42. package/dist/replication/trystero/TrysteroReplicator/configurationExchange.js +99 -0
  43. package/dist/replication/trystero/TrysteroReplicator/configuredTargets.d.ts +83 -0
  44. package/dist/replication/trystero/TrysteroReplicator/configuredTargets.js +121 -0
  45. package/dist/replication/trystero/TrysteroReplicator/peerAgreement.d.ts +75 -0
  46. package/dist/replication/trystero/TrysteroReplicator/peerAgreement.js +131 -0
  47. package/dist/replication/trystero/TrysteroReplicator/progress.d.ts +57 -0
  48. package/dist/replication/trystero/TrysteroReplicator/progress.js +84 -0
  49. package/dist/replication/trystero/TrysteroReplicator/relayControl.d.ts +20 -0
  50. package/dist/replication/trystero/TrysteroReplicator/relayControl.js +25 -0
  51. package/dist/replication/trystero/TrysteroReplicator/transfers.d.ts +125 -0
  52. package/dist/replication/trystero/TrysteroReplicator/transfers.js +278 -0
  53. package/dist/replication/trystero/TrysteroReplicator.d.ts +65 -481
  54. package/dist/replication/trystero/TrysteroReplicator.js +240 -673
  55. package/dist/replication/trystero/TrysteroReplicatorP2PClient.d.ts +19 -6
  56. package/dist/replication/trystero/TrysteroReplicatorP2PClient.js +29 -25
  57. package/dist/replication/trystero/TrysteroReplicatorP2PServer/peerAdmission.d.ts +66 -0
  58. package/dist/replication/trystero/TrysteroReplicatorP2PServer/peerAdmission.js +142 -0
  59. package/dist/replication/trystero/TrysteroReplicatorP2PServer.d.ts +19 -16
  60. package/dist/replication/trystero/TrysteroReplicatorP2PServer.js +33 -93
  61. package/dist/replication/trystero/p2pReplicationDiagnostics.d.ts +1 -1
  62. package/dist/replication/trystero/p2pReplicationProgress.d.ts +2 -11
  63. package/dist/replication/trystero/replicationTypes.d.ts +88 -0
  64. package/dist/replication/trystero/replicationTypes.js +0 -0
  65. package/dist/replication/trystero/rpcSessionProvider.d.ts +13 -0
  66. package/dist/replication/trystero/rpcSessionProvider.js +0 -0
  67. package/dist/replication/unencryptedContentMessages.d.ts +8 -0
  68. package/dist/replication/unencryptedContentMessages.js +12 -0
  69. package/dist/rpc/RpcRoom/pendingInvocations.d.ts +141 -0
  70. package/dist/rpc/RpcRoom/pendingInvocations.js +225 -0
  71. package/dist/rpc/RpcRoom.d.ts +9 -4
  72. package/dist/rpc/RpcRoom.js +73 -118
  73. package/dist/rpc/RpcSession.d.ts +6 -0
  74. package/dist/rpc/RpcSession.js +11 -0
  75. package/dist/rpc/types.d.ts +2 -0
  76. package/dist/serviceFeatures/targetFilter.d.ts +1 -1
  77. package/dist/serviceFeatures/targetFilter.js +8 -38
  78. package/dist/serviceModules/FileAccessBase.d.ts +4 -0
  79. package/dist/serviceModules/FileAccessBase.js +10 -0
  80. package/dist/serviceModules/Rebuilder.js +29 -5
  81. package/dist/serviceModules/ServiceFileAccessBase/fileNames.d.ts +54 -0
  82. package/dist/serviceModules/ServiceFileAccessBase/fileNames.js +57 -0
  83. package/dist/serviceModules/ServiceFileAccessBase.d.ts +5 -1
  84. package/dist/serviceModules/ServiceFileAccessBase.js +18 -3
  85. package/dist/serviceModules/adapters/IFileSystemAdapter.d.ts +3 -0
  86. package/dist/services/base/RemoteConnection.d.ts +2 -0
  87. package/dist/services/base/RemoteService.js +2 -1
  88. package/dist/services/base/SettingService.js +2 -0
  89. package/dist/settings.d.ts +2 -1
  90. package/dist/settings.js +2 -0
  91. package/dist/storage.d.ts +2 -0
  92. package/dist/storage.js +2 -0
  93. package/dist/worker/bgWorker.js +1 -1
  94. package/docs/development.md +103 -0
  95. package/docs/offline-scanner.md +2 -1
  96. package/docs/p2p-transport-lifecycle.md +24 -0
  97. package/docs/platform-storage.md +22 -0
  98. package/docs/releasing.md +6 -0
  99. package/docs/settings-lifecycle.md +6 -0
  100. package/package.json +1 -1
@@ -1,91 +1,21 @@
1
- import { type ProgressAcknowledgement } from "./p2pReplicationProgress.js";
2
- import { type EntryDoc, type ObsidianLiveSyncSettings, type P2PSyncSetting } from "../../common/types.js";
1
+ import type { P2PReplicationProgress, P2PReplicationReport, P2PReplicationResult, P2PConfiguredReplicationResult, ProgressAcknowledgement } from "./replicationTypes.js";
2
+ export type { P2PReplicationDirectionProgress, P2PReplicationProgress, P2PReplicationReport, P2PReplicationResult, P2PConfiguredTargetResult, P2PConfiguredReplicationResult, } from "./replicationTypes.js";
3
+ import { type PeerTweakSettings } from "./TrysteroReplicator/peerAgreement.js";
4
+ import { type EntryDoc, type ObsidianLiveSyncSettings } from "../../common/types.js";
3
5
  import { type LOG_LEVEL } from "octagonal-wheels/common/logger";
4
- import { type ProgressInfo, type ReplicationStatistics } from "../../pouchdb/ReplicatorShim.js";
6
+ import { type ProgressInfo } from "../../pouchdb/ReplicatorShim.js";
5
7
  import type { Confirm } from "../../interfaces/Confirm.js";
6
8
  import { type Advertisement, type ReplicatorHostEnv } from "./types.js";
7
9
  import { EVENT_P2P_REPLICATOR_PROGRESS, EVENT_P2P_REPLICATOR_STATUS, P2PHost } from "./TrysteroReplicatorP2PServer.js";
10
+ import { type RelayControl } from "./TrysteroReplicator/relayControl.js";
8
11
  import type { P2PFiniteOperationOwner } from "./P2PRoomSession.js";
9
- import { type P2PReplicationWireResult } from "./P2PReplicationWire.js";
12
+ import { toP2PWireError, type P2PReplicationWireResult } from "./P2PReplicationWire.js";
10
13
  export type P2PReplicatorStatus = {
11
14
  isBroadcasting: boolean;
12
15
  replicatingTo: string[];
13
16
  replicatingFrom: string[];
14
17
  watchingPeers: string[];
15
18
  };
16
- /** Sequence progress retained for compatibility, with independently observed work counts. */
17
- export type P2PReplicationDirectionProgress = {
18
- max: number;
19
- current: number;
20
- isActive: boolean;
21
- statistics?: ReplicationStatistics;
22
- };
23
- export type P2PReplicationProgress = {
24
- peerId: string;
25
- peerName: string;
26
- fetching: P2PReplicationDirectionProgress;
27
- sending: P2PReplicationDirectionProgress;
28
- };
29
- export type P2PReplicationReport = {
30
- peerId: string;
31
- peerName: string;
32
- } & ({
33
- fetching: P2PReplicationDirectionProgress;
34
- } | {
35
- sending: P2PReplicationDirectionProgress;
36
- });
37
- /**
38
- * In-process outcome of one P2P replication request.
39
- *
40
- * The failed variant deliberately retains an `Error`-compatible value for
41
- * local callers. RPC handlers must convert it to `P2PReplicationWireResult`,
42
- * because native `Error` properties do not survive JSON serialisation.
43
- */
44
- export type P2PReplicationResult = {
45
- readonly status: "completed";
46
- readonly ok: true;
47
- readonly error?: never;
48
- } | {
49
- readonly status: "cancelled";
50
- readonly ok?: false;
51
- readonly error?: never;
52
- } | {
53
- readonly status: "failed";
54
- readonly ok?: false;
55
- readonly error: unknown;
56
- };
57
- export type P2PConfiguredTargetResult = {
58
- readonly name: string;
59
- readonly peerId?: string;
60
- } & ({
61
- readonly status: "completed";
62
- } | {
63
- readonly status: "cancelled";
64
- } | {
65
- readonly status: "missing";
66
- } | {
67
- readonly status: "rejected";
68
- } | {
69
- readonly status: "undecided";
70
- } | {
71
- readonly status: "failed";
72
- readonly error: unknown;
73
- });
74
- /** Explicit result of configured, unattended P2P target synchronisation. */
75
- export type P2PConfiguredReplicationResult = {
76
- readonly status: "completed";
77
- readonly targets: readonly P2PConfiguredTargetResult[];
78
- } | {
79
- readonly status: "cancelled";
80
- readonly targets: readonly P2PConfiguredTargetResult[];
81
- } | {
82
- readonly status: "blocked";
83
- readonly reason: "no-targets";
84
- readonly targets: readonly [];
85
- } | {
86
- readonly status: "partial";
87
- readonly targets: readonly P2PConfiguredTargetResult[];
88
- };
89
19
  declare global {
90
20
  interface LSEvents {
91
21
  [EVENT_P2P_REPLICATOR_STATUS]: P2PReplicatorStatus;
@@ -100,18 +30,36 @@ export type AllReplicationClientStatus = {
100
30
  stats: P2PReplicationProgress;
101
31
  };
102
32
  };
33
+ /** Optional transport controls preserve the existing finite-operation owner argument. */
34
+ export interface TrysteroReplicatorOptions {
35
+ relayControl?: RelayControl;
36
+ }
37
+ /**
38
+ * Connect room-facing commands and replication policy to the existing host.
39
+ *
40
+ * Change relay, agreement, configuration, progress, target selection, and transfers provide narrower
41
+ * operations. This facade retains public dispatch, session integration, and
42
+ * lifecycle coordination so those owners are not duplicated.
43
+ */
103
44
  export declare class TrysteroReplicator {
104
45
  _env: ReplicatorHostEnv;
105
46
  private readonly finiteOperationOwner?;
47
+ private readonly relayControl;
106
48
  private disposed;
107
- private readonly acknowledgedAttempts;
108
49
  private readonly fallbackAutomationCoordinator;
109
50
  server?: P2PHost;
51
+ private readonly replicationProgress;
52
+ private readonly transfers;
53
+ private readonly configuredTargets;
54
+ private readonly peerAgreement;
55
+ private readonly configurationExchange;
56
+ private readonly changeRelay;
110
57
  replicationStatus(): {};
111
58
  private reportDiagnostic;
112
- get settings(): P2PSyncSetting;
59
+ /** Immutable room settings used for transport binding and shared configuration. */
60
+ get settings(): import("../../common/types.js").P2PSyncSetting;
113
61
  /** Latest room-local policy settings supplied by the owning host. */
114
- get currentSettings(): P2PSyncSetting;
62
+ get currentSettings(): import("../../common/types.js").P2PSyncSetting;
115
63
  get db(): PouchDB.Database<EntryDoc>;
116
64
  get deviceName(): string;
117
65
  get platform(): string;
@@ -120,7 +68,8 @@ export declare class TrysteroReplicator {
120
68
  private get automationCoordinator();
121
69
  private runFiniteReplicationActivity;
122
70
  private canStartOrdinaryReplication;
123
- constructor(env: ReplicatorHostEnv, server?: P2PHost, finiteOperationOwner?: P2PFiniteOperationOwner);
71
+ constructor(env: ReplicatorHostEnv, server?: P2PHost, finiteOperationOwner?: P2PFiniteOperationOwner, options?: TrysteroReplicatorOptions);
72
+ /** Borrow the session owner's cancellation scope; legacy direct hosts use the caller signal. */
124
73
  private runSessionFiniteOperation;
125
74
  close(): Promise<void>;
126
75
  /** Close the transport and release resources owned for this object's lifetime. */
@@ -135,441 +84,76 @@ export declare class TrysteroReplicator {
135
84
  _onSetup: boolean;
136
85
  setOnSetup(): void;
137
86
  clearOnSetup(): void;
138
- getTweakSettings(fromPeerId: string): Promise<{
139
- pathNormalizationVersion: import("../../settings.js").PathNormalizationVersion;
140
- idDerivationVersion: 0 | 1;
141
- idDerivationProof: string;
142
- liveSync?: boolean;
143
- batchSaveInLiveSync?: boolean;
144
- syncOnSave?: boolean;
145
- syncOnStart?: boolean;
146
- strictContentCheckOnStartup?: boolean;
147
- syncOnFileOpen?: boolean;
148
- syncOnEditorSave?: boolean;
149
- keepReplicationActiveInBackground?: boolean;
150
- allowSleepDuringSynchronisation?: boolean;
151
- allowSleepDuringSynchronisationOnDesktop?: boolean;
152
- syncMinimumInterval?: number;
153
- showVerboseLog?: boolean;
154
- lessInformationInLog?: boolean;
155
- showLongerLogInsideEditor?: boolean;
156
- showStatusOnEditor?: boolean;
157
- showStatusOnStatusbar?: boolean;
158
- showOnlyIconsOnEditor?: boolean;
159
- hideFileWarningNotice?: boolean;
160
- networkWarningStyle?: "" | "icon" | "hidden";
161
- displayLanguage?: import("../../common/models/setting.type.js").I18N_LANGS;
162
- trashInsteadDelete?: boolean;
163
- doNotDeleteFolder?: boolean;
164
- batchSave?: boolean;
165
- batchSaveMinimumDelay?: number;
166
- batchSaveMaximumDelay?: number;
167
- syncMaxSizeInMB?: number;
168
- useIgnoreFiles?: boolean;
169
- ignoreFiles?: string;
170
- processSizeMismatchedFiles?: boolean;
171
- syncOnlyRegEx?: import("../../common/types.js").CustomRegExpSourceList<"|[]|">;
172
- syncIgnoreRegEx?: import("../../common/types.js").CustomRegExpSourceList<"|[]|">;
173
- syncAfterMerge?: boolean;
174
- resolveConflictsByNewerFile?: boolean;
175
- writeDocumentsIfConflicted?: boolean;
176
- disableMarkdownAutoMerge?: boolean;
177
- configPassphraseStore?: import("../../common/types.js").ConfigPassphraseStore;
178
- encryptedPassphrase?: string;
179
- encryptedIdDerivationKey?: string;
180
- encryptedCouchDBConnection?: string;
181
- periodicReplication?: boolean;
182
- periodicReplicationInterval?: number;
183
- syncInternalFiles?: boolean;
184
- syncInternalFilesBeforeReplication?: boolean;
185
- syncInternalFilesInterval?: number;
186
- syncInternalFilesIgnorePatterns?: import("../../common/types.js").CustomRegExpSourceList<",">;
187
- syncInternalFilesTargetPatterns?: import("../../common/types.js").CustomRegExpSourceList<",">;
188
- watchInternalFileChanges?: boolean;
189
- suppressNotifyHiddenFilesChange?: boolean;
190
- syncInternalFileOverwritePatterns?: import("../../common/types.js").CustomRegExpSourceList<",">;
191
- usePluginSync?: boolean;
192
- usePluginSettings?: boolean;
193
- showOwnPlugins?: boolean;
194
- autoSweepPlugins?: boolean;
195
- autoSweepPluginsPeriodic?: boolean;
196
- notifyPluginOrSettingUpdated?: boolean;
197
- deviceAndVaultName?: string;
198
- usePluginSyncV2?: boolean;
199
- usePluginEtc?: boolean;
200
- pluginSyncExtendedSetting?: Record<import("../../common/types.js").PluginSyncSettingEntry["key"], import("../../common/types.js").PluginSyncSettingEntry>;
201
- useAdvancedMode?: boolean;
202
- usePowerUserMode?: boolean;
203
- useEdgeCaseMode?: boolean;
204
- notifyThresholdOfRemoteStorageSize?: number;
205
- disableWorkerForGeneratingChunks?: boolean;
206
- processSmallFilesInUIThread?: boolean;
207
- savingDelay?: number;
208
- gcDelay?: number;
209
- skipOlderFilesOnSync?: boolean;
210
- useIndexedDBAdapter?: boolean;
211
- enableDebugTools?: boolean;
212
- writeLogToTheFile?: boolean;
213
- settingSyncFile?: string;
214
- writeCredentialsForSettingSync?: boolean;
215
- notifyAllSettingSyncFile?: boolean;
216
- suspendFileWatching?: boolean;
217
- suspendParseReplicationResult?: boolean;
218
- doNotSuspendOnFetching?: boolean;
219
- maxMTimeForReflectEvents?: number;
220
- versionUpFlash?: string;
221
- settingVersion?: number;
222
- isConfigured?: boolean;
223
- lastReadUpdates?: number;
224
- doctorProcessedVersion?: string;
225
- remoteConfigurations?: Record<string, import("../../remoteConfigurations.js").RemoteConfiguration>;
226
- activeConfigurationId?: string;
227
- P2P_ActiveRemoteConfigurationId?: string;
228
- couchDB_URI?: string;
229
- couchDB_USER?: string;
230
- couchDB_PASSWORD?: string;
231
- couchDB_DBNAME?: string;
232
- couchDB_CustomHeaders?: string;
233
- useJWT?: boolean;
234
- jwtAlgorithm?: import("../../common/models/auth.type.js").JWTAlgorithm;
235
- jwtKey?: string;
236
- jwtKid?: string;
237
- jwtSub?: string;
238
- jwtExpDuration?: number;
239
- useRequestAPI?: boolean;
240
- useCouchDBCacheControlHeadersOnly?: boolean;
241
- accessKey?: string;
242
- secretKey?: string;
243
- bucket?: string;
244
- region?: string;
245
- endpoint?: string;
246
- useCustomRequestHandler?: boolean;
247
- bucketCustomHeaders?: string;
248
- bucketPrefix?: string;
249
- forcePathStyle?: boolean;
250
- remoteType?: import("../../common/types.js").RemoteType;
251
- encrypt?: boolean;
252
- passphrase?: string;
253
- idDerivationKey?: string;
254
- usePathObfuscation?: boolean;
255
- encryptInternalMetadata?: boolean;
256
- E2EEAlgorithm?: import("../../common/types.js").E2EEAlgorithm;
257
- hashAlg?: import("../../common/types.js").HashAlgorithm;
258
- minimumChunkSize?: number;
259
- customChunkSize?: number;
260
- longLineThreshold?: number;
261
- useSegmenter?: boolean;
262
- enableChunkSplitterV2?: boolean;
263
- doNotUseFixedRevisionForChunks?: boolean;
264
- chunkSplitterVersion?: import("../../common/types.js").ChunkSplitterVersion;
265
- useEden?: boolean;
266
- maxChunksInEden?: number;
267
- maxTotalLengthInEden?: number;
268
- maxAgeInEden?: number;
269
- tweakModified?: number | undefined;
270
- checkIntegrityOnSave?: boolean;
271
- useHistory?: boolean;
272
- disableRequestURI?: boolean;
273
- sendChunksBulk?: boolean;
274
- sendChunksBulkMaxSize?: number;
275
- useDynamicIterationCount?: boolean;
276
- doNotPaceReplication?: boolean;
277
- readChunksOnline?: boolean;
278
- useOnlyLocalChunk?: boolean;
279
- concurrencyOfReadChunksOnline?: number;
280
- minimumIntervalOfReadChunksOnline?: number;
281
- enableCompression?: boolean;
282
- batch_size?: number;
283
- batches_limit?: number;
284
- ignoreVersionCheck?: boolean;
285
- disableCheckingConfigMismatch?: boolean;
286
- autoAcceptCompatibleTweak?: boolean | undefined;
287
- hashCacheMaxCount?: number;
288
- hashCacheMaxAmount?: number;
289
- permitEmptyPassphrase?: boolean;
290
- handleFilenameCaseSensitive?: boolean;
291
- checkConflictOnlyOnOpen?: boolean;
292
- showMergeDialogOnlyOnActive?: boolean;
293
- additionalSuffixOfDatabaseName?: string | undefined;
294
- useTimeouts?: boolean;
295
- deleteMetadataOfDeletedFiles?: boolean;
296
- automaticallyDeleteMetadataOfDeletedFiles?: number;
297
- P2P_AutoAccepting?: import("../../common/types.js").AutoAccepting;
298
- P2P_AutoSyncPeers?: string;
299
- P2P_AutoWatchPeers?: string;
300
- P2P_SyncOnReplication?: string;
301
- P2P_RebuildFrom?: string;
302
- P2P_AutoAcceptingPeers?: string;
303
- P2P_AutoDenyingPeers?: string;
304
- P2P_IsHeadless?: boolean;
305
- P2P_iceServers?: readonly RTCIceServer[];
306
- P2P_iceServersExpiresAt?: number;
307
- P2P_Enabled?: boolean;
308
- P2P_relays?: string;
309
- P2P_roomID?: string;
310
- P2P_passphrase?: string;
311
- P2P_AppID?: string;
312
- P2P_AutoStart?: boolean;
313
- P2P_AutoBroadcast?: boolean;
314
- P2P_DevicePeerName?: string;
315
- P2P_turnServers?: string;
316
- P2P_turnUsername?: string;
317
- P2P_turnCredential?: string;
318
- P2P_managedType?: string;
319
- P2P_managedId?: string;
320
- P2P_managedToken?: string;
321
- P2P_maxWirePayloadBytes?: number;
322
- P2P_connectionPath?: import("../../common/types.js").P2PConnectionPath;
323
- P2P_useDiagRTC?: boolean;
324
- }>;
87
+ /** Build challenge-bound compatibility data without exposing local ID keys. */
88
+ getTweakSettings(fromPeerId: string): Promise<PeerTweakSettings>;
325
89
  private handleSynchronisationRequest;
90
+ /**
91
+ * Build the existing wire command object against this facade.
92
+ * Public method dispatch stays dynamic for host overrides; RpcRoom owns
93
+ * serialisation, request context, and call-versus-notification responses.
94
+ */
326
95
  getCommands(): {
327
96
  reqSync: (fromPeerId: string) => Promise<P2PReplicationWireResult>;
328
97
  "!reqAuth": (fromPeerId: string) => Promise<boolean>;
329
- getTweakSettings: (fromPeerId: string) => Promise<{
330
- pathNormalizationVersion: import("../../settings.js").PathNormalizationVersion;
331
- idDerivationVersion: 0 | 1;
332
- idDerivationProof: string;
333
- liveSync?: boolean;
334
- batchSaveInLiveSync?: boolean;
335
- syncOnSave?: boolean;
336
- syncOnStart?: boolean;
337
- strictContentCheckOnStartup?: boolean;
338
- syncOnFileOpen?: boolean;
339
- syncOnEditorSave?: boolean;
340
- keepReplicationActiveInBackground?: boolean;
341
- allowSleepDuringSynchronisation?: boolean;
342
- allowSleepDuringSynchronisationOnDesktop?: boolean;
343
- syncMinimumInterval?: number;
344
- showVerboseLog?: boolean;
345
- lessInformationInLog?: boolean;
346
- showLongerLogInsideEditor?: boolean;
347
- showStatusOnEditor?: boolean;
348
- showStatusOnStatusbar?: boolean;
349
- showOnlyIconsOnEditor?: boolean;
350
- hideFileWarningNotice?: boolean;
351
- networkWarningStyle?: "" | "icon" | "hidden";
352
- displayLanguage?: import("../../common/models/setting.type.js").I18N_LANGS;
353
- trashInsteadDelete?: boolean;
354
- doNotDeleteFolder?: boolean;
355
- batchSave?: boolean;
356
- batchSaveMinimumDelay?: number;
357
- batchSaveMaximumDelay?: number;
358
- syncMaxSizeInMB?: number;
359
- useIgnoreFiles?: boolean;
360
- ignoreFiles?: string;
361
- processSizeMismatchedFiles?: boolean;
362
- syncOnlyRegEx?: import("../../common/types.js").CustomRegExpSourceList<"|[]|">;
363
- syncIgnoreRegEx?: import("../../common/types.js").CustomRegExpSourceList<"|[]|">;
364
- syncAfterMerge?: boolean;
365
- resolveConflictsByNewerFile?: boolean;
366
- writeDocumentsIfConflicted?: boolean;
367
- disableMarkdownAutoMerge?: boolean;
368
- configPassphraseStore?: import("../../common/types.js").ConfigPassphraseStore;
369
- encryptedPassphrase?: string;
370
- encryptedIdDerivationKey?: string;
371
- encryptedCouchDBConnection?: string;
372
- periodicReplication?: boolean;
373
- periodicReplicationInterval?: number;
374
- syncInternalFiles?: boolean;
375
- syncInternalFilesBeforeReplication?: boolean;
376
- syncInternalFilesInterval?: number;
377
- syncInternalFilesIgnorePatterns?: import("../../common/types.js").CustomRegExpSourceList<",">;
378
- syncInternalFilesTargetPatterns?: import("../../common/types.js").CustomRegExpSourceList<",">;
379
- watchInternalFileChanges?: boolean;
380
- suppressNotifyHiddenFilesChange?: boolean;
381
- syncInternalFileOverwritePatterns?: import("../../common/types.js").CustomRegExpSourceList<",">;
382
- usePluginSync?: boolean;
383
- usePluginSettings?: boolean;
384
- showOwnPlugins?: boolean;
385
- autoSweepPlugins?: boolean;
386
- autoSweepPluginsPeriodic?: boolean;
387
- notifyPluginOrSettingUpdated?: boolean;
388
- deviceAndVaultName?: string;
389
- usePluginSyncV2?: boolean;
390
- usePluginEtc?: boolean;
391
- pluginSyncExtendedSetting?: Record<import("../../common/types.js").PluginSyncSettingEntry["key"], import("../../common/types.js").PluginSyncSettingEntry>;
392
- useAdvancedMode?: boolean;
393
- usePowerUserMode?: boolean;
394
- useEdgeCaseMode?: boolean;
395
- notifyThresholdOfRemoteStorageSize?: number;
396
- disableWorkerForGeneratingChunks?: boolean;
397
- processSmallFilesInUIThread?: boolean;
398
- savingDelay?: number;
399
- gcDelay?: number;
400
- skipOlderFilesOnSync?: boolean;
401
- useIndexedDBAdapter?: boolean;
402
- enableDebugTools?: boolean;
403
- writeLogToTheFile?: boolean;
404
- settingSyncFile?: string;
405
- writeCredentialsForSettingSync?: boolean;
406
- notifyAllSettingSyncFile?: boolean;
407
- suspendFileWatching?: boolean;
408
- suspendParseReplicationResult?: boolean;
409
- doNotSuspendOnFetching?: boolean;
410
- maxMTimeForReflectEvents?: number;
411
- versionUpFlash?: string;
412
- settingVersion?: number;
413
- isConfigured?: boolean;
414
- lastReadUpdates?: number;
415
- doctorProcessedVersion?: string;
416
- remoteConfigurations?: Record<string, import("../../remoteConfigurations.js").RemoteConfiguration>;
417
- activeConfigurationId?: string;
418
- P2P_ActiveRemoteConfigurationId?: string;
419
- couchDB_URI?: string;
420
- couchDB_USER?: string;
421
- couchDB_PASSWORD?: string;
422
- couchDB_DBNAME?: string;
423
- couchDB_CustomHeaders?: string;
424
- useJWT?: boolean;
425
- jwtAlgorithm?: import("../../common/models/auth.type.js").JWTAlgorithm;
426
- jwtKey?: string;
427
- jwtKid?: string;
428
- jwtSub?: string;
429
- jwtExpDuration?: number;
430
- useRequestAPI?: boolean;
431
- useCouchDBCacheControlHeadersOnly?: boolean;
432
- accessKey?: string;
433
- secretKey?: string;
434
- bucket?: string;
435
- region?: string;
436
- endpoint?: string;
437
- useCustomRequestHandler?: boolean;
438
- bucketCustomHeaders?: string;
439
- bucketPrefix?: string;
440
- forcePathStyle?: boolean;
441
- remoteType?: import("../../common/types.js").RemoteType;
442
- encrypt?: boolean;
443
- passphrase?: string;
444
- idDerivationKey?: string;
445
- usePathObfuscation?: boolean;
446
- encryptInternalMetadata?: boolean;
447
- E2EEAlgorithm?: import("../../common/types.js").E2EEAlgorithm;
448
- hashAlg?: import("../../common/types.js").HashAlgorithm;
449
- minimumChunkSize?: number;
450
- customChunkSize?: number;
451
- longLineThreshold?: number;
452
- useSegmenter?: boolean;
453
- enableChunkSplitterV2?: boolean;
454
- doNotUseFixedRevisionForChunks?: boolean;
455
- chunkSplitterVersion?: import("../../common/types.js").ChunkSplitterVersion;
456
- useEden?: boolean;
457
- maxChunksInEden?: number;
458
- maxTotalLengthInEden?: number;
459
- maxAgeInEden?: number;
460
- tweakModified?: number | undefined;
461
- checkIntegrityOnSave?: boolean;
462
- useHistory?: boolean;
463
- disableRequestURI?: boolean;
464
- sendChunksBulk?: boolean;
465
- sendChunksBulkMaxSize?: number;
466
- useDynamicIterationCount?: boolean;
467
- doNotPaceReplication?: boolean;
468
- readChunksOnline?: boolean;
469
- useOnlyLocalChunk?: boolean;
470
- concurrencyOfReadChunksOnline?: number;
471
- minimumIntervalOfReadChunksOnline?: number;
472
- enableCompression?: boolean;
473
- batch_size?: number;
474
- batches_limit?: number;
475
- ignoreVersionCheck?: boolean;
476
- disableCheckingConfigMismatch?: boolean;
477
- autoAcceptCompatibleTweak?: boolean | undefined;
478
- hashCacheMaxCount?: number;
479
- hashCacheMaxAmount?: number;
480
- permitEmptyPassphrase?: boolean;
481
- handleFilenameCaseSensitive?: boolean;
482
- checkConflictOnlyOnOpen?: boolean;
483
- showMergeDialogOnlyOnActive?: boolean;
484
- additionalSuffixOfDatabaseName?: string | undefined;
485
- useTimeouts?: boolean;
486
- deleteMetadataOfDeletedFiles?: boolean;
487
- automaticallyDeleteMetadataOfDeletedFiles?: number;
488
- P2P_AutoAccepting?: import("../../common/types.js").AutoAccepting;
489
- P2P_AutoSyncPeers?: string;
490
- P2P_AutoWatchPeers?: string;
491
- P2P_SyncOnReplication?: string;
492
- P2P_RebuildFrom?: string;
493
- P2P_AutoAcceptingPeers?: string;
494
- P2P_AutoDenyingPeers?: string;
495
- P2P_IsHeadless?: boolean;
496
- P2P_iceServers?: readonly RTCIceServer[];
497
- P2P_iceServersExpiresAt?: number;
498
- P2P_Enabled?: boolean;
499
- P2P_relays?: string;
500
- P2P_roomID?: string;
501
- P2P_passphrase?: string;
502
- P2P_AppID?: string;
503
- P2P_AutoStart?: boolean;
504
- P2P_AutoBroadcast?: boolean;
505
- P2P_DevicePeerName?: string;
506
- P2P_turnServers?: string;
507
- P2P_turnUsername?: string;
508
- P2P_turnCredential?: string;
509
- P2P_managedType?: string;
510
- P2P_managedId?: string;
511
- P2P_managedToken?: string;
512
- P2P_maxWirePayloadBytes?: number;
513
- P2P_connectionPath?: import("../../common/types.js").P2PConnectionPath;
514
- P2P_useDiagRTC?: boolean;
515
- }>;
98
+ getTweakSettings: (fromPeerId: string) => Promise<PeerTweakSettings>;
516
99
  onProgress: (fromPeerId: string) => Promise<{
517
- error: import("../../rpc/types.js").RpcErrorShape;
100
+ error: import("../../rpc/index.js").RpcErrorShape;
518
101
  }>;
519
102
  getAllConfig: (fromPeerId: string) => Promise<string | {
520
- error: import("../../rpc/types.js").RpcErrorShape;
103
+ error: ReturnType<typeof toP2PWireError>;
521
104
  }>;
522
105
  onProgressAcknowledged: (fromPeerId: string, info?: ProgressInfo | null, acknowledgement?: ProgressAcknowledgement) => Promise<void>;
523
106
  getIsBroadcasting: () => Promise<boolean>;
524
107
  requestBroadcasting: (peerId: string) => Promise<true | {
525
- error: import("../../rpc/types.js").RpcErrorShape;
108
+ error: import("../../rpc/index.js").RpcErrorShape;
526
109
  }>;
527
110
  };
528
- requestAuthenticate(peerId: string, signal?: AbortSignal): Promise<boolean>;
529
- lastSeq: string | number;
111
+ /** Retain the public admission entry point and its caller cancellation signal. */
112
+ requestAuthenticate(peerId: string, signal?: AbortSignal): Promise<boolean | undefined>;
113
+ get lastSeq(): string | number;
114
+ set lastSeq(sequence: string | number);
530
115
  requestSynchroniseToPeer(peerId: string, callerSignal?: AbortSignal): Promise<P2PReplicationResult>;
531
- private requestSynchroniseToPeerWithinSession;
532
116
  requestSynchroniseToAllAvailablePeers(): Promise<void>;
533
117
  dispatchStatus(): void;
534
118
  requestStatus(): void;
535
- changes?: PouchDB.Core.Changes<EntryDoc>;
536
- _isBroadcasting: boolean;
119
+ get changes(): PouchDB.Core.Changes<EntryDoc> | undefined;
120
+ set changes(changes: PouchDB.Core.Changes<EntryDoc> | undefined);
121
+ get _isBroadcasting(): boolean;
122
+ set _isBroadcasting(enabled: boolean);
537
123
  disableBroadcastChanges(): void;
538
124
  enableBroadcastChanges(): void;
539
125
  /** Apply automatic broadcast policy without restarting this room. */
540
126
  reconcileAutoBroadcast(enabled: boolean): void;
541
127
  get knownAdvertisements(): Advertisement[];
542
- availableReplicationPairs: Set<string>;
128
+ get availableReplicationPairs(): Set<string>;
129
+ set availableReplicationPairs(peers: Set<string>);
543
130
  sync(remotePeer: string, showNotice?: boolean, callerSignal?: AbortSignal): Promise<P2PReplicationResult>;
544
- private syncWithinSession;
545
- _replicateToPeers: Set<string>;
546
- _replicateFromPeers: Set<string>;
131
+ /** Existing public sets refer to the transfer component's single state owner. */
132
+ get _replicateToPeers(): Set<string>;
133
+ set _replicateToPeers(peers: Set<string>);
134
+ get _replicateFromPeers(): Set<string>;
135
+ set _replicateFromPeers(peers: Set<string>);
547
136
  dispatchReplicationProgress(peerId: string, info?: ProgressInfo): void;
548
137
  onReplicationProgress(peerId: string, info?: ProgressInfo): boolean;
549
138
  onProgressAcknowledged(peerId: string, info?: ProgressInfo | null, acknowledgement?: ProgressAcknowledgement): boolean;
550
- acknowledgeProgress(remotePeerId: string, info?: ProgressInfo, acknowledgement?: ProgressAcknowledgement): void;
139
+ /** Report progress without awaiting the reporting RPC's response. */
140
+ acknowledgeProgress(peerId: string, info?: ProgressInfo, acknowledgement?: ProgressAcknowledgement): void;
551
141
  replicateFrom(remotePeer: string, showNotice?: boolean, fromStart?: boolean, skipOrdinaryReplicationPolicy?: boolean, callerSignal?: AbortSignal): Promise<P2PReplicationResult>;
552
- private replicateFromWithinSession;
553
- private pullFromWithinSession;
554
- private checkPeerForReplication;
555
- private transferFromPeer;
556
142
  notifyProgress(excludePeerId?: string): Promise<void>;
557
- private notifyPeerProgress;
558
143
  requestBroadcastChanges(peerId: string): Promise<unknown>;
559
144
  getRemoteIsBroadcasting(peerId: string): Promise<unknown>;
560
- _watchingPeers: Set<string>;
145
+ get _watchingPeers(): Set<string>;
146
+ set _watchingPeers(peers: Set<string>);
561
147
  watchPeer(peerId: string): void;
562
148
  unwatchPeer(peerId: string): void;
563
149
  onUpdateDatabase(fromPeerId: string): Promise<false | P2PReplicationResult>;
564
- getRemoteConfig(peerId: string): Promise<false | ObsidianLiveSyncSettings>;
565
- /** Compare peer settings without exceeding the presentation authority of the initiating call. */
150
+ /** Fetch and validate shared settings; applying them remains the caller's responsibility. */
151
+ getRemoteConfig(peerId: string): Promise<ObsidianLiveSyncSettings | false>;
152
+ /** Compare peer settings without exceeding the initiating call's presentation authority. */
566
153
  checkTweakValues(peerId: string, signal?: AbortSignal, logLevel?: LOG_LEVEL): Promise<boolean>;
567
- private configuredPeerNames;
568
- private findAdvertisement;
569
- private waitForConfiguredAdvertisements;
570
- private configuredTargetResult;
571
- /** Synchronise configured peer targets without opening peer-selection UI. */
154
+ /** Synchronise configured targets through their own discovery and aggregation workflow. */
572
155
  replicateFromCommand(showResult?: boolean, discoveryTimeoutMs?: number, callerSignal?: AbortSignal): Promise<P2PConfiguredReplicationResult>;
156
+ /** Stop the current relay snapshot and retain the public asynchronous host-stop dispatch. */
573
157
  disconnectFromServer(): void;
574
158
  pauseServe(): Promise<void>;
575
159
  allowReconnection(): void;