@narumitw/pi-sync 0.57.10 → 0.57.12

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 (173) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +32 -22
  3. package/dist/chunks/{agent-candidate-EYB35AGL.ts → agent-candidate-U2NU3GUX.ts} +11 -11
  4. package/dist/chunks/{agent-plan-KO43GTOR.ts → agent-plan-3YXDIJXO.ts} +25 -22
  5. package/dist/chunks/agent-plan-3YXDIJXO.ts.map +7 -0
  6. package/dist/chunks/{agent-refusal-retry-C2HQROTP.ts → agent-refusal-retry-476YGNU5.ts} +10 -10
  7. package/dist/chunks/{agent-runner-WMSCKSCB.ts → agent-runner-FCRV2Z75.ts} +11 -10
  8. package/dist/chunks/agent-runner-FCRV2Z75.ts.map +7 -0
  9. package/dist/chunks/{agent-store-UT52DS7B.ts → agent-store-7GINKTS7.ts} +8 -8
  10. package/dist/chunks/{agent-store-UT52DS7B.ts.map → agent-store-7GINKTS7.ts.map} +2 -2
  11. package/dist/chunks/{agent-sync-VM3TXWA3.ts → agent-sync-P6AWQXGK.ts} +6 -6
  12. package/dist/chunks/{chunk-JXWTEJS5.ts → chunk-45COPAK7.ts} +10 -3
  13. package/dist/chunks/chunk-45COPAK7.ts.map +7 -0
  14. package/dist/chunks/{chunk-DOJRPBQU.ts → chunk-5TSCBBPP.ts} +4 -4
  15. package/dist/chunks/{chunk-CDQGSZL3.ts → chunk-6LD5KX55.ts} +6 -6
  16. package/dist/chunks/{chunk-MDUORMCK.ts → chunk-6O3EDBRL.ts} +2 -2
  17. package/dist/chunks/{chunk-AAPAHANE.ts → chunk-7A35ZAVO.ts} +320 -219
  18. package/dist/chunks/chunk-7A35ZAVO.ts.map +7 -0
  19. package/dist/chunks/{chunk-STVQQ5KG.ts → chunk-7ZIYU5QS.ts} +6 -6
  20. package/dist/chunks/{chunk-AO6EDUA6.ts → chunk-AKMV47YC.ts} +3 -3
  21. package/dist/chunks/{chunk-66GAUVDL.ts → chunk-BEST45H2.ts} +6 -6
  22. package/dist/chunks/{chunk-DO55XUNU.ts → chunk-CBLTWXAU.ts} +15 -5
  23. package/dist/chunks/chunk-CBLTWXAU.ts.map +7 -0
  24. package/dist/chunks/{chunk-IMMMZUFC.ts → chunk-CQD2TJHE.ts} +7 -7
  25. package/dist/chunks/{chunk-IMMMZUFC.ts.map → chunk-CQD2TJHE.ts.map} +2 -2
  26. package/dist/chunks/{chunk-73MDIVYJ.ts → chunk-DN4IA7MR.ts} +6 -6
  27. package/dist/chunks/{chunk-PHANBTVM.ts → chunk-ESKOPQVB.ts} +4 -4
  28. package/dist/chunks/{chunk-YZ5BQNRZ.ts → chunk-FHE2DCA2.ts} +2 -2
  29. package/dist/chunks/{chunk-YZ5BQNRZ.ts.map → chunk-FHE2DCA2.ts.map} +2 -2
  30. package/dist/chunks/{chunk-MRIPZGPR.ts → chunk-FLHCOJCD.ts} +3 -3
  31. package/dist/chunks/{chunk-5WJQ6XOW.ts → chunk-GNYGNHFF.ts} +2 -2
  32. package/dist/chunks/{chunk-DFJGTVPX.ts → chunk-KYTT7KV4.ts} +2 -2
  33. package/dist/chunks/{chunk-UGSSZWQ6.ts → chunk-MKSMJPVA.ts} +2 -2
  34. package/dist/chunks/{chunk-2VSN3MFX.ts → chunk-MMQIEDZ6.ts} +33 -27
  35. package/dist/chunks/chunk-MMQIEDZ6.ts.map +7 -0
  36. package/dist/chunks/{chunk-RAMHGOX2.ts → chunk-OJARL2TG.ts} +4 -4
  37. package/dist/chunks/{chunk-BJXSCGQK.ts → chunk-OKPPZA4D.ts} +148 -89
  38. package/dist/chunks/chunk-OKPPZA4D.ts.map +7 -0
  39. package/dist/chunks/{chunk-RX3WGWVL.ts → chunk-OVBAW7KV.ts} +177 -130
  40. package/dist/chunks/chunk-OVBAW7KV.ts.map +7 -0
  41. package/dist/chunks/{chunk-U77DWNRH.ts → chunk-Q23JJW7E.ts} +3 -3
  42. package/dist/chunks/{chunk-NLWS55B6.ts → chunk-QPC5HT3A.ts} +2 -2
  43. package/dist/chunks/{chunk-NLWS55B6.ts.map → chunk-QPC5HT3A.ts.map} +1 -1
  44. package/dist/chunks/{chunk-4RLATUP4.ts → chunk-S5OCYVPS.ts} +7 -7
  45. package/dist/chunks/{chunk-4RLATUP4.ts.map → chunk-S5OCYVPS.ts.map} +2 -2
  46. package/dist/chunks/{chunk-QWV3XKNJ.ts → chunk-TIMWN2RH.ts} +5 -5
  47. package/dist/chunks/{chunk-Z5O2TLNF.ts → chunk-TZC7GDJE.ts} +7 -7
  48. package/dist/chunks/{chunk-UCD7TQDT.ts → chunk-U6GXGY5G.ts} +5 -5
  49. package/dist/chunks/{chunk-PWA3YN5Z.ts → chunk-XEODG2PE.ts} +3 -3
  50. package/dist/chunks/{chunk-TO2GMX3K.ts → chunk-XJHQPB3E.ts} +2 -2
  51. package/dist/chunks/{chunk-JY2RVOUL.ts → chunk-Y4UVXOLQ.ts} +5 -5
  52. package/dist/chunks/{chunk-ODF2M4RF.ts → chunk-ZC3IHFNM.ts} +8 -8
  53. package/dist/chunks/{chunk-ODF2M4RF.ts.map → chunk-ZC3IHFNM.ts.map} +2 -2
  54. package/dist/chunks/{chunk-M5IV3KL2.ts → chunk-ZDDBZH72.ts} +3 -3
  55. package/dist/chunks/{command-handler-FO6F2APH.ts → command-handler-VKLZBRLO.ts} +26 -21
  56. package/dist/chunks/command-handler-VKLZBRLO.ts.map +7 -0
  57. package/dist/chunks/{config-B37W7FXW.ts → config-HYG7G5EM.ts} +6 -4
  58. package/dist/chunks/{conflict-artifacts-6XGSSU5S.ts → conflict-artifacts-J6WSDCWP.ts} +12 -12
  59. package/dist/chunks/{conflict-review-BQSHSJB3.ts → conflict-review-GXA6Y7KY.ts} +23 -23
  60. package/dist/chunks/{continuous-record-4DQ2EAZS.ts → continuous-record-EPHGR2DU.ts} +6 -6
  61. package/dist/chunks/{continuous-sync-ZT3UEQLK.ts → continuous-sync-TTOSJCQU.ts} +18 -18
  62. package/dist/chunks/{file-selection-FBLKM25V.ts → file-selection-IELTXSGZ.ts} +6 -7
  63. package/dist/chunks/{file-selection-FBLKM25V.ts.map → file-selection-IELTXSGZ.ts.map} +1 -1
  64. package/dist/chunks/{git-backend-7PCWECRN.ts → git-backend-KHD36W27.ts} +6 -7
  65. package/dist/chunks/{git-backend-7PCWECRN.ts.map → git-backend-KHD36W27.ts.map} +1 -1
  66. package/dist/chunks/{local-fields-B6JWLPAE.ts → local-fields-JEKAPZKD.ts} +6 -7
  67. package/dist/chunks/manager-result-dispatcher-6W52NM7F.ts +32 -0
  68. package/dist/chunks/{manager-ui-DGRTG76I.ts → manager-ui-INVMAFEN.ts} +245 -224
  69. package/dist/chunks/manager-ui-INVMAFEN.ts.map +7 -0
  70. package/dist/chunks/{merge-baseline-store-HL3VLMAM.ts → merge-baseline-store-65GKUMXI.ts} +6 -6
  71. package/dist/chunks/{remote-selection-ui-OHMIQ32X.ts → remote-selection-ui-TD4C4W3J.ts} +16 -12
  72. package/dist/chunks/{s3-backend-CJXBEWWU.ts → s3-backend-L24UZ6IK.ts} +12 -10
  73. package/dist/chunks/s3-backend-L24UZ6IK.ts.map +7 -0
  74. package/dist/chunks/{setup-switch-66GWMBNH.ts → setup-switch-KLGESLQX.ts} +6 -6
  75. package/dist/chunks/{setup-wizard-OHZXJVQZ.ts → setup-wizard-ZQAK35BP.ts} +7 -7
  76. package/dist/chunks/{snapshot-VRHNAUUH.ts → snapshot-RGNDYT6A.ts} +5 -6
  77. package/dist/chunks/{snapshot-transaction-EUGA4VX6.ts → snapshot-transaction-26BQO36S.ts} +8 -8
  78. package/dist/chunks/{sync-inspection-4WFQEJOE.ts → sync-inspection-MOMLGUTD.ts} +11 -11
  79. package/dist/chunks/{sync-operations-X4AOXMBT.ts → sync-operations-TMGQHBF5.ts} +26 -26
  80. package/dist/chunks/{sync-operations-X4AOXMBT.ts.map → sync-operations-TMGQHBF5.ts.map} +2 -2
  81. package/dist/chunks/{sync-state-SWLSMK4G.ts → sync-state-7L4NT7W2.ts} +7 -8
  82. package/dist/chunks/{webdav-backend-2Q5ZEBST.ts → webdav-backend-3ZCACILP.ts} +7 -8
  83. package/dist/chunks/{webdav-backend-2Q5ZEBST.ts.map → webdav-backend-3ZCACILP.ts.map} +1 -1
  84. package/dist/index.ts +20 -20
  85. package/docs/agent-continuous-hardening.md +5 -5
  86. package/docs/agent-mode-verification.md +3 -3
  87. package/docs/agent-quality-verification.md +3 -3
  88. package/docs/continuous-sync-verification.md +2 -2
  89. package/docs/settings.md +9 -5
  90. package/docs/tui-contract.md +20 -3
  91. package/package.json +3 -3
  92. package/skills/configure-pi-sync/SKILL.md +3 -1
  93. package/skills/configure-pi-sync/references/configuration.md +56 -38
  94. package/src/backends/s3/s3-client.ts +8 -1
  95. package/src/commands/command-execution.ts +11 -6
  96. package/src/commands/command.ts +1 -1
  97. package/src/paths.ts +6 -1
  98. package/src/settings/config-file.ts +205 -118
  99. package/src/settings/config.ts +1 -1
  100. package/src/settings/settings-management.ts +15 -1
  101. package/src/settings/settings-store.ts +0 -14
  102. package/src/settings/settings-types.ts +1 -1
  103. package/src/snapshot/session-paths.ts +15 -2
  104. package/src/snapshot/snapshot-mutation-queues.ts +142 -0
  105. package/src/snapshot/snapshot-transaction.ts +122 -125
  106. package/src/sync/agent-candidate.ts +3 -3
  107. package/src/sync/agent-plan.ts +11 -8
  108. package/src/sync/agent-runner.ts +10 -9
  109. package/src/sync/agent-store.ts +1 -1
  110. package/src/sync/agent-sync.ts +2 -2
  111. package/src/sync/continuous-record.ts +1 -1
  112. package/src/sync/merge-apply.ts +6 -0
  113. package/src/sync/merged-sync.ts +4 -4
  114. package/src/sync/sync-mutations.ts +1 -1
  115. package/src/ui/agent-mode-setting.ts +6 -6
  116. package/src/ui/cancellable-operation.ts +36 -13
  117. package/src/ui/manager-state.ts +4 -2
  118. package/src/ui/manager-ui.ts +76 -24
  119. package/src/ui/remote-selection-ui.ts +131 -82
  120. package/src/ui/settings-ui.ts +21 -56
  121. package/src/ui/setup/setup-switcher.ts +2 -2
  122. package/src/ui/sync-setups-ui.ts +2 -2
  123. package/dist/chunks/agent-plan-KO43GTOR.ts.map +0 -7
  124. package/dist/chunks/agent-runner-WMSCKSCB.ts.map +0 -7
  125. package/dist/chunks/chunk-2VSN3MFX.ts.map +0 -7
  126. package/dist/chunks/chunk-AAPAHANE.ts.map +0 -7
  127. package/dist/chunks/chunk-BJXSCGQK.ts.map +0 -7
  128. package/dist/chunks/chunk-DO55XUNU.ts.map +0 -7
  129. package/dist/chunks/chunk-JXWTEJS5.ts.map +0 -7
  130. package/dist/chunks/chunk-RX3WGWVL.ts.map +0 -7
  131. package/dist/chunks/command-handler-FO6F2APH.ts.map +0 -7
  132. package/dist/chunks/manager-result-dispatcher-NODX3KKH.ts +0 -28
  133. package/dist/chunks/manager-ui-DGRTG76I.ts.map +0 -7
  134. package/dist/chunks/s3-backend-CJXBEWWU.ts.map +0 -7
  135. /package/dist/chunks/{agent-candidate-EYB35AGL.ts.map → agent-candidate-U2NU3GUX.ts.map} +0 -0
  136. /package/dist/chunks/{agent-refusal-retry-C2HQROTP.ts.map → agent-refusal-retry-476YGNU5.ts.map} +0 -0
  137. /package/dist/chunks/{agent-sync-VM3TXWA3.ts.map → agent-sync-P6AWQXGK.ts.map} +0 -0
  138. /package/dist/chunks/{chunk-DOJRPBQU.ts.map → chunk-5TSCBBPP.ts.map} +0 -0
  139. /package/dist/chunks/{chunk-CDQGSZL3.ts.map → chunk-6LD5KX55.ts.map} +0 -0
  140. /package/dist/chunks/{chunk-MDUORMCK.ts.map → chunk-6O3EDBRL.ts.map} +0 -0
  141. /package/dist/chunks/{chunk-STVQQ5KG.ts.map → chunk-7ZIYU5QS.ts.map} +0 -0
  142. /package/dist/chunks/{chunk-AO6EDUA6.ts.map → chunk-AKMV47YC.ts.map} +0 -0
  143. /package/dist/chunks/{chunk-66GAUVDL.ts.map → chunk-BEST45H2.ts.map} +0 -0
  144. /package/dist/chunks/{chunk-73MDIVYJ.ts.map → chunk-DN4IA7MR.ts.map} +0 -0
  145. /package/dist/chunks/{chunk-PHANBTVM.ts.map → chunk-ESKOPQVB.ts.map} +0 -0
  146. /package/dist/chunks/{chunk-MRIPZGPR.ts.map → chunk-FLHCOJCD.ts.map} +0 -0
  147. /package/dist/chunks/{chunk-5WJQ6XOW.ts.map → chunk-GNYGNHFF.ts.map} +0 -0
  148. /package/dist/chunks/{chunk-DFJGTVPX.ts.map → chunk-KYTT7KV4.ts.map} +0 -0
  149. /package/dist/chunks/{chunk-UGSSZWQ6.ts.map → chunk-MKSMJPVA.ts.map} +0 -0
  150. /package/dist/chunks/{chunk-RAMHGOX2.ts.map → chunk-OJARL2TG.ts.map} +0 -0
  151. /package/dist/chunks/{chunk-U77DWNRH.ts.map → chunk-Q23JJW7E.ts.map} +0 -0
  152. /package/dist/chunks/{chunk-QWV3XKNJ.ts.map → chunk-TIMWN2RH.ts.map} +0 -0
  153. /package/dist/chunks/{chunk-Z5O2TLNF.ts.map → chunk-TZC7GDJE.ts.map} +0 -0
  154. /package/dist/chunks/{chunk-UCD7TQDT.ts.map → chunk-U6GXGY5G.ts.map} +0 -0
  155. /package/dist/chunks/{chunk-PWA3YN5Z.ts.map → chunk-XEODG2PE.ts.map} +0 -0
  156. /package/dist/chunks/{chunk-TO2GMX3K.ts.map → chunk-XJHQPB3E.ts.map} +0 -0
  157. /package/dist/chunks/{chunk-JY2RVOUL.ts.map → chunk-Y4UVXOLQ.ts.map} +0 -0
  158. /package/dist/chunks/{chunk-M5IV3KL2.ts.map → chunk-ZDDBZH72.ts.map} +0 -0
  159. /package/dist/chunks/{config-B37W7FXW.ts.map → config-HYG7G5EM.ts.map} +0 -0
  160. /package/dist/chunks/{conflict-artifacts-6XGSSU5S.ts.map → conflict-artifacts-J6WSDCWP.ts.map} +0 -0
  161. /package/dist/chunks/{conflict-review-BQSHSJB3.ts.map → conflict-review-GXA6Y7KY.ts.map} +0 -0
  162. /package/dist/chunks/{continuous-record-4DQ2EAZS.ts.map → continuous-record-EPHGR2DU.ts.map} +0 -0
  163. /package/dist/chunks/{continuous-sync-ZT3UEQLK.ts.map → continuous-sync-TTOSJCQU.ts.map} +0 -0
  164. /package/dist/chunks/{local-fields-B6JWLPAE.ts.map → local-fields-JEKAPZKD.ts.map} +0 -0
  165. /package/dist/chunks/{manager-result-dispatcher-NODX3KKH.ts.map → manager-result-dispatcher-6W52NM7F.ts.map} +0 -0
  166. /package/dist/chunks/{merge-baseline-store-HL3VLMAM.ts.map → merge-baseline-store-65GKUMXI.ts.map} +0 -0
  167. /package/dist/chunks/{remote-selection-ui-OHMIQ32X.ts.map → remote-selection-ui-TD4C4W3J.ts.map} +0 -0
  168. /package/dist/chunks/{setup-switch-66GWMBNH.ts.map → setup-switch-KLGESLQX.ts.map} +0 -0
  169. /package/dist/chunks/{setup-wizard-OHZXJVQZ.ts.map → setup-wizard-ZQAK35BP.ts.map} +0 -0
  170. /package/dist/chunks/{snapshot-VRHNAUUH.ts.map → snapshot-RGNDYT6A.ts.map} +0 -0
  171. /package/dist/chunks/{snapshot-transaction-EUGA4VX6.ts.map → snapshot-transaction-26BQO36S.ts.map} +0 -0
  172. /package/dist/chunks/{sync-inspection-4WFQEJOE.ts.map → sync-inspection-MOMLGUTD.ts.map} +0 -0
  173. /package/dist/chunks/{sync-state-SWLSMK4G.ts.map → sync-state-7L4NT7W2.ts.map} +0 -0
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/backends/webdav/webdav-backend.ts", "../../src/backends/webdav/webdav-client.ts"],
4
4
  "sourcesContent": ["import { createHash, randomUUID } from \"node:crypto\";\nimport { decodeSnapshot, encodeSnapshot } from \"../../snapshot/snapshot-codec.js\";\nimport type { Snapshot } from \"../../snapshot/snapshot-types.js\";\nimport { validatePortableSnapshot } from \"../../sync/local-fields.js\";\nimport { throwIfAborted } from \"../../sync/signals.js\";\nimport { syncErrorGuidance } from \"../../sync/sync-error-guidance.js\";\nimport { portableSnapshotSelection } from \"../../sync/sync-policy.js\";\nimport type { LatestPointer, RemoteObject, ResolvedWebDavBackend } from \"../backend-types.js\";\nimport { createLatestPointer, remoteHistoryEntry } from \"../snapshot-pointer.js\";\nimport {\n type BackendDiagnostic,\n type ExpectedRemoteHead,\n type PublishSnapshotOptions,\n type PublishSnapshotResult,\n type RemoteHead,\n type RemoteHistoryEntry,\n type SyncBackend,\n SyncBackendConflictError,\n SyncBackendPublicationOutcomeUnknownError,\n} from \"../sync-backend.js\";\nimport { WebDavClient, WebDavHttpError, WebDavPreconditionError } from \"./webdav-client.js\";\n\nconst VERSION = 1;\nconst POST_COMMIT_TIMEOUT_MS = 30_000;\n\nexport class WebDavSyncBackend implements SyncBackend {\n readonly identity: string;\n readonly destination: string;\n private conditionalVerified = false;\n private readonly checksums = new Map<string, string>();\n private capabilityCheck?: Promise<void>;\n\n constructor(\n private readonly config: ResolvedWebDavBackend,\n private readonly postCommitTimeoutMs = POST_COMMIT_TIMEOUT_MS,\n ) {\n assertSafeDestination(config);\n this.identity = webDavBackendIdentity(config);\n this.destination = webDavStorageLocation(config);\n }\n\n get capability() {\n return this.conditionalVerified ? (\"atomic-conditional\" as const) : (\"conditional-required\" as const);\n }\n\n sameRevision(left: string, right: string) {\n return left === right;\n }\n\n async readHead(signal?: AbortSignal): Promise<RemoteHead | undefined> {\n const object = await new WebDavClient(this.config, signal).getJson<LatestPointer>(latestPath(this.config));\n throwIfAborted(signal);\n if (object.missing) return undefined;\n const pointer = requirePointer(object.value, this.config.destination.namespace);\n this.registerChecksum(pointer.snapshot, pointer.sha256);\n return remoteHead(pointer, this.identity, object.etag);\n }\n\n async readSnapshot(reference: string, signal?: AbortSignal): Promise<Snapshot> {\n requireSnapshotReference(reference);\n const expectedChecksum = this.checksums.get(reference) ?? (await this.resolveChecksum(reference, signal));\n const object = await new WebDavClient(this.config, signal).getBuffer(snapshotPath(this.config, reference));\n throwIfAborted(signal);\n if (!object.value) throw new Error(`Snapshot not found: ${reference}`);\n if (!expectedChecksum || sha256(object.value) !== expectedChecksum) {\n throw new Error(\"Remote snapshot checksum mismatch.\");\n }\n const snapshot = await decodeSnapshot(object.value, { signal });\n if (snapshot.id !== reference || snapshot.profile !== this.config.destination.namespace) {\n throw new Error(\"Remote snapshot identity mismatch.\");\n }\n validateSnapshotBundle(snapshot);\n return snapshot;\n }\n\n async publishSnapshot(\n snapshot: Snapshot,\n expected: ExpectedRemoteHead,\n options: PublishSnapshotOptions = {},\n ): Promise<PublishSnapshotResult> {\n throwIfAborted(options.signal);\n assertSnapshotIdentity(snapshot, this.config.destination.namespace);\n await this.ensureAtomicConditions(options.signal);\n throwIfAborted(options.signal);\n const client = new WebDavClient(this.config, options.signal);\n await client.ensureCollection(snapshotsPath(this.config));\n const encoded = await encodeSnapshot(snapshot);\n throwIfAborted(options.signal);\n const pointer = createLatestPointer(this.config.destination.namespace, snapshot, sha256(encoded));\n const stagedPath = snapshotPath(this.config, snapshot.id);\n try {\n await client.putBuffer(stagedPath, encoded, \"application/gzip\", { ifAbsent: true });\n } catch (error) {\n if (!(error instanceof WebDavPreconditionError)) throw error;\n const existing = await client.getBuffer(stagedPath);\n if (!existing.value || sha256(existing.value) !== pointer.sha256) {\n throw new SyncBackendConflictError(\n `Immutable snapshot id already exists with different content: ${snapshot.id}`,\n );\n }\n }\n const currentObject = await client.getJson<LatestPointer>(latestPath(this.config));\n throwIfAborted(options.signal);\n const current = currentObject.missing\n ? undefined\n : remoteHead(\n requirePointer(currentObject.value, this.config.destination.namespace),\n this.identity,\n currentObject.etag,\n );\n if (!matchesExpected(current, expected)) {\n throw new SyncBackendConflictError(\"Remote changed while pushing. Run /sync pull first, then retry.\", {\n currentHead: current,\n });\n }\n const condition = publicationCondition(currentObject, expected, this.identity);\n throwIfAborted(options.signal);\n options.onCommit?.();\n const commitClient = new WebDavClient(\n this.config,\n AbortSignal.timeout(this.postCommitTimeoutMs),\n this.postCommitTimeoutMs,\n );\n try {\n await commitClient.putJson(latestPath(this.config), pointer, condition);\n } catch (error) {\n if (error instanceof WebDavPreconditionError) {\n const latest = await this.readHeadAfterCommit(commitClient).catch(() => undefined);\n throw new SyncBackendConflictError(\"Remote changed while publishing the WebDAV pointer.\", {\n currentHead: latest,\n });\n }\n throw new SyncBackendPublicationOutcomeUnknownError(\n `Remote publication outcome is unknown: ${errorMessage(error)}`,\n { cause: error },\n );\n }\n let verifiedObject: RemoteObject<LatestPointer>;\n try {\n verifiedObject = await commitClient.getJson<LatestPointer>(latestPath(this.config));\n } catch (error) {\n throw new SyncBackendPublicationOutcomeUnknownError(\n `Remote snapshot may be active, but publication could not be verified: ${errorMessage(error)}`,\n { cause: error },\n );\n }\n let verified: LatestPointer;\n try {\n verified = requirePointer(verifiedObject.value, this.config.destination.namespace);\n } catch (error) {\n throw new SyncBackendPublicationOutcomeUnknownError(\n `Remote snapshot may be active, but publication verification was malformed: ${errorMessage(error)}`,\n { cause: error },\n );\n }\n if (!samePointer(pointer, verified)) {\n throw new SyncBackendConflictError(\n \"Remote latest changed immediately after push. Run /sync status before continuing.\",\n {\n phase: \"after-commit\",\n currentHead: remoteHead(verified, this.identity, verifiedObject.etag),\n candidateMayHaveBeenActive: true,\n },\n );\n }\n if (!strongEtag(verifiedObject.etag)) {\n throw new SyncBackendPublicationOutcomeUnknownError(\n \"Remote snapshot is active, but the WebDAV server returned no strong ETag.\",\n );\n }\n this.registerChecksum(verified.snapshot, verified.sha256);\n const head = remoteHead(verified, this.identity, verifiedObject.etag);\n const warning = await this.updateHistorySafely(commitClient, pointer);\n return { head, warnings: warning ? [warning] : [] };\n }\n\n async listHistory(signal?: AbortSignal): Promise<RemoteHistoryEntry[]> {\n const object = await new WebDavClient(this.config, signal).getJson<{\n version: number;\n snapshots: LatestPointer[];\n }>(historyPath(this.config));\n throwIfAborted(signal);\n if (object.missing) return [];\n const pointers = requireHistory(object.value, this.config.destination.namespace);\n for (const pointer of pointers) this.registerChecksum(pointer.snapshot, pointer.sha256);\n return pointers.map(remoteHistoryEntry);\n }\n\n async diagnose(signal?: AbortSignal): Promise<BackendDiagnostic[]> {\n const diagnostics: BackendDiagnostic[] = [\n {\n key: \"webdav-url\",\n level: \"info\",\n message: `webdav URL/TLS/auth: configured (${webDavStorageLocation(this.config)})`,\n },\n {\n key: \"webdav-scope\",\n level: \"info\",\n message:\n \"webdav check scope: temporary write/delete probe; repair the active snapshot's history entry if missing. No local content is applied.\",\n },\n ];\n try {\n await this.runCapabilityProbe(signal);\n diagnostics.push(\n { key: \"webdav-collection\", level: \"info\", message: \"webdav collection read/write: ok\" },\n {\n key: \"webdav-conditional\",\n level: \"info\",\n message: \"webdav conditional publication: atomic-conditional (verified)\",\n },\n { key: \"webdav-cleanup\", level: \"info\", message: \"webdav probe cleanup: ok\" },\n );\n } catch (error) {\n this.capabilityCheck = undefined;\n this.conditionalVerified = false;\n if (error instanceof Error && error.name === \"AbortError\") throw error;\n diagnostics.push({\n key: \"webdav-probe\",\n level: \"error\",\n message: `webdav publication is read-only until diagnostics pass: ${syncErrorGuidance(error)}`,\n });\n return diagnostics;\n }\n try {\n diagnostics.push({\n key: \"webdav-history\",\n level: \"info\",\n message: await this.reconcileActiveHistory(signal),\n });\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") throw error;\n diagnostics.push({\n key: \"webdav-history\",\n level: \"error\",\n message: `webdav history repair failed: ${syncErrorGuidance(error)}`,\n });\n }\n return diagnostics;\n }\n\n private ensureAtomicConditions(signal?: AbortSignal) {\n if (this.capabilityCheck) return this.capabilityCheck;\n this.conditionalVerified = false;\n const check = this.runCapabilityProbe(signal).finally(() => {\n if (this.capabilityCheck === check) this.capabilityCheck = undefined;\n });\n this.capabilityCheck = check;\n return check;\n }\n\n private async runCapabilityProbe(signal?: AbortSignal) {\n throwIfAborted(signal);\n const probeCollection = joinRemote(rootPath(this.config), \".pi-sync-probes\", randomUUID());\n const probe = `${probeCollection}/conditional.txt`;\n const client = new WebDavClient(this.config, signal);\n let created = false;\n let operationError: unknown;\n try {\n created = true;\n await client.ensureCollection(probeCollection);\n await client.listCollection(probeCollection);\n await client.putBuffer(probe, Buffer.from(\"first\"), \"text/plain\", { ifAbsent: true });\n const read = await client.getBuffer(probe);\n const etag = strongEtag(read.etag);\n if (!read.value || !etag) {\n throw new Error(\"WebDAV server did not return a strong ETag for the capability probe.\");\n }\n await expectPrecondition(\n client.putBuffer(probe, Buffer.from(\"replace\"), \"text/plain\", { ifAbsent: true }),\n \"If-None-Match\",\n );\n await expectPrecondition(\n client.putBuffer(probe, Buffer.from(\"replace\"), \"text/plain\", {\n ifMatch: '\"pi-sync-deliberately-stale\"',\n }),\n \"If-Match\",\n );\n const unchanged = await client.getBuffer(probe);\n if (!unchanged.value?.equals(Buffer.from(\"first\"))) {\n throw new Error(\"WebDAV server changed a probe despite a failed precondition.\");\n }\n await client.putBuffer(probe, Buffer.from(\"second\"), \"text/plain\", { ifMatch: etag });\n const changed = await client.getBuffer(probe);\n const changedEtag = strongEtag(changed.etag);\n if (!changed.value?.equals(Buffer.from(\"second\")) || !changedEtag || changedEtag === etag) {\n throw new Error(\"WebDAV server did not rotate its strong ETag after changing the capability probe.\");\n }\n } catch (error) {\n operationError = error;\n }\n if (created) {\n try {\n await new WebDavClient(this.config, undefined).delete(probeCollection);\n } catch (cleanupError) {\n const operationDetail = operationError ? `WebDAV probe failed: ${errorMessage(operationError)}; ` : \"\";\n throw new Error(\n `${operationDetail}probe cleanup also failed; remove ${probeCollection}: ${errorMessage(cleanupError)}`,\n { cause: operationError ?? cleanupError },\n );\n }\n }\n if (operationError) throw operationError;\n this.conditionalVerified = true;\n }\n\n private async resolveChecksum(reference: string, signal?: AbortSignal) {\n await this.readHead(signal);\n if (this.checksums.has(reference)) return this.checksums.get(reference);\n await this.listHistory(signal);\n return this.checksums.get(reference);\n }\n\n private registerChecksum(reference: string, checksum: string) {\n const known = this.checksums.get(reference);\n if (known && known !== checksum) {\n throw new Error(\"Remote snapshot reference was rebound to a different checksum.\");\n }\n this.checksums.set(reference, checksum);\n }\n\n private async readHeadAfterCommit(client: WebDavClient) {\n const object = await client.getJson<LatestPointer>(latestPath(this.config));\n if (object.missing) return undefined;\n return remoteHead(requirePointer(object.value, this.config.destination.namespace), this.identity, object.etag);\n }\n\n private async reconcileActiveHistory(signal?: AbortSignal) {\n const client = new WebDavClient(this.config, signal);\n const object = await client.getJson<LatestPointer>(latestPath(this.config));\n throwIfAborted(signal);\n if (object.missing) return \"webdav history: no active snapshot\";\n const pointer = requirePointer(object.value, this.config.destination.namespace);\n this.registerChecksum(pointer.snapshot, pointer.sha256);\n const repaired = await this.ensureHistoryPointer(client, pointer);\n return repaired\n ? \"webdav history: repaired active snapshot entry\"\n : \"webdav history: active snapshot entry present\";\n }\n\n private async ensureHistoryPointer(client: WebDavClient, pointer: LatestPointer) {\n const object = await client.getJson<{ version: number; snapshots: LatestPointer[] }>(historyPath(this.config));\n const snapshots = object.missing ? [] : requireHistory(object.value, this.config.destination.namespace);\n const existing = snapshots.find((entry) => entry.snapshot === pointer.snapshot);\n if (existing) {\n if (!samePointer(existing, pointer)) {\n throw new Error(\"Remote history rebound an immutable snapshot reference.\");\n }\n return false;\n }\n const next = [...snapshots, pointer].slice(-100);\n const condition = object.missing ? { ifAbsent: true } : { ifMatch: requireStrongEtag(object.etag, \"history\") };\n await client.putJson(historyPath(this.config), { version: VERSION, snapshots: next }, condition);\n return true;\n }\n\n private async updateHistorySafely(client: WebDavClient, pointer: LatestPointer) {\n try {\n await this.ensureHistoryPointer(client, pointer);\n return undefined;\n } catch (error) {\n return `Remote snapshot is active, but history could not be updated: ${errorMessage(error)}. Run /sync doctor before relying on history.`;\n }\n }\n}\n\nexport function rootPath(config: ResolvedWebDavBackend) {\n return config.destination.path === \"./\" ? \"\" : config.destination.path;\n}\n\nexport function latestPath(config: ResolvedWebDavBackend) {\n return joinRemote(rootPath(config), \"latest.json\");\n}\n\nexport function historyPath(config: ResolvedWebDavBackend) {\n return joinRemote(rootPath(config), \"history.json\");\n}\n\nexport function snapshotsPath(config: ResolvedWebDavBackend) {\n return joinRemote(rootPath(config), \"snapshots\");\n}\n\nexport function snapshotPath(config: ResolvedWebDavBackend, reference: string) {\n requireSnapshotReference(reference);\n return joinRemote(snapshotsPath(config), `${reference}.json.gz`);\n}\n\nexport function webDavBackendIdentity(config: ResolvedWebDavBackend) {\n return `webdav:${sha256(Buffer.from(JSON.stringify([secretFreeUrl(config.profile.url), config.destination.path])))}`;\n}\n\nfunction webDavStorageLocation(config: ResolvedWebDavBackend) {\n const url = new URL(secretFreeUrl(config.profile.url));\n return `${url.host} \u00B7 ${config.destination.path}`;\n}\n\nfunction remoteHead(pointer: LatestPointer, identity: string, etag?: string): RemoteHead {\n return {\n snapshotRef: pointer.snapshot,\n snapshotId: pointer.snapshot,\n revision: encodeRevision(identity, etag, pointer),\n createdAt: pointer.createdAt,\n machine: pointer.machine,\n syncSessions: pointer.syncSessions === true,\n ...(pointer.selection === undefined ? {} : { selection: pointer.selection }),\n };\n}\n\nfunction encodeRevision(identity: string, etag: string | undefined, pointer: LatestPointer) {\n return `webdav-v1:${Buffer.from(JSON.stringify({ identity, etag: etag ?? null, pointer: sha256(Buffer.from(canonicalJson(pointer))) })).toString(\"base64url\")}`;\n}\n\nfunction decodeRevision(value: string, identity: string) {\n try {\n if (!value.startsWith(\"webdav-v1:\")) return undefined;\n const parsed = JSON.parse(Buffer.from(value.slice(10), \"base64url\").toString(\"utf8\")) as {\n identity?: unknown;\n etag?: unknown;\n };\n if (parsed.identity !== identity || typeof parsed.etag !== \"string\") return undefined;\n return strongEtag(parsed.etag);\n } catch {\n return undefined;\n }\n}\n\nfunction publicationCondition(current: RemoteObject<LatestPointer>, expected: ExpectedRemoteHead, identity: string) {\n if (expected.kind === \"missing\") return { ifAbsent: true };\n const etag = decodeRevision(expected.revision, identity) ?? strongEtag(current.etag);\n if (!etag) throw new SyncBackendConflictError(\"WebDAV head has no usable strong ETag.\");\n return { ifMatch: etag };\n}\n\nasync function expectPrecondition(operation: Promise<unknown>, header: string) {\n try {\n await operation;\n } catch (error) {\n if (error instanceof WebDavPreconditionError) return;\n throw error;\n }\n throw new Error(`WebDAV server ignored ${header}; publication is read-only for safety.`);\n}\n\nfunction requireStrongEtag(value: string | undefined, resource: string) {\n const etag = strongEtag(value);\n if (!etag) throw new Error(`WebDAV ${resource} has no strong ETag.`);\n return etag;\n}\n\nfunction strongEtag(value: string | undefined) {\n return value && !value.startsWith(\"W/\") && /^\"[^\"\\r\\n]+\"$/u.test(value) ? value : undefined;\n}\n\nfunction requirePointer(value: LatestPointer | undefined, expectedProfile: string) {\n if (\n !value ||\n value.version !== VERSION ||\n value.profile !== expectedProfile ||\n !isSafeReference(value.snapshot) ||\n !/^[0-9a-f]{64}$/u.test(value.sha256) ||\n !isSafeMetadata(value.createdAt, 64) ||\n !isSafeMetadata(value.machine, 256) ||\n (value.syncSessions !== undefined && typeof value.syncSessions !== \"boolean\")\n ) {\n throw new Error(\"Remote latest pointer is malformed.\");\n }\n if (value.selection !== undefined) portableSnapshotSelection(value.selection);\n return value;\n}\n\nfunction requireHistory(value: { version: number; snapshots: LatestPointer[] } | undefined, expectedProfile: string) {\n if (!value || value.version !== VERSION || !Array.isArray(value.snapshots)) {\n throw new Error(\"Remote history is malformed.\");\n }\n const pointers = value.snapshots.map((item) => requirePointer(item, expectedProfile));\n if (new Set(pointers.map((item) => item.snapshot)).size !== pointers.length) {\n throw new Error(\"Remote history contains duplicate snapshot references.\");\n }\n return pointers;\n}\n\nfunction assertSnapshotIdentity(snapshot: Snapshot, namespace: string) {\n validatePortableSnapshot(snapshot);\n if (\n snapshot.profile !== namespace ||\n !isSafeReference(snapshot.id) ||\n !isSafeMetadata(snapshot.createdAt, 64) ||\n !isSafeMetadata(snapshot.machine, 256) ||\n !Array.isArray(snapshot.files)\n ) {\n throw new Error(\"Invalid snapshot identity for WebDAV publication.\");\n }\n}\n\nfunction validateSnapshotBundle(snapshot: Snapshot) {\n const paths = new Set<string>();\n for (const file of snapshot.files) {\n if (\n !file ||\n !isSafeSnapshotPath(file.path) ||\n paths.has(file.path) ||\n typeof file.contentBase64 !== \"string\" ||\n typeof file.sha256 !== \"string\"\n ) {\n throw new Error(\"Remote snapshot bundle is malformed.\");\n }\n const content = Buffer.from(file.contentBase64, \"base64\");\n if (content.toString(\"base64\") !== file.contentBase64 || sha256(content) !== file.sha256) {\n throw new Error(\"Remote snapshot bundle is malformed.\");\n }\n paths.add(file.path);\n }\n}\n\nfunction isSafeSnapshotPath(value: unknown): value is string {\n if (typeof value !== \"string\" || !value || value.length > 4096 || value.includes(\"\\\\\")) {\n return false;\n }\n if (\n [...value].some((character) => {\n const code = character.codePointAt(0) ?? 0;\n return code < 0x20 || (code >= 0x7f && code <= 0x9f);\n })\n ) {\n return false;\n }\n return value.split(\"/\").every((segment) => segment && segment !== \".\" && segment !== \"..\");\n}\n\nfunction assertSafeDestination(config: ResolvedWebDavBackend) {\n const url = new URL(config.profile.url);\n if (url.username || url.password || url.search || url.hash) throw new Error(\"Invalid WebDAV URL.\");\n for (const [label, value] of [\n [\"path\", config.destination.path],\n [\"namespace\", config.destination.namespace],\n ]) {\n if (label === \"path\" && value === \"./\") continue;\n if (\n !value ||\n value.includes(\"\\\\\") ||\n [...value].some((character) => {\n const code = character.codePointAt(0) ?? 0;\n return code < 0x20 || (code >= 0x7f && code <= 0x9f);\n }) ||\n value.split(\"/\").some((part) => part === \".\" || part === \"..\")\n ) {\n throw new Error(\"Invalid WebDAV storage location.\");\n }\n }\n}\n\nfunction isSafeMetadata(value: unknown, maxLength: number): value is string {\n return (\n typeof value === \"string\" &&\n value.length > 0 &&\n value.length <= maxLength &&\n ![...value].some((character) => {\n const code = character.codePointAt(0) ?? 0;\n return code < 0x20 || (code >= 0x7f && code <= 0x9f);\n })\n );\n}\n\nfunction requireSnapshotReference(reference: string) {\n if (!isSafeReference(reference)) throw new Error(\"Invalid WebDAV snapshot reference.\");\n}\n\nfunction isSafeReference(value: string) {\n return (\n !!value &&\n value.length <= 512 &&\n // biome-ignore lint/suspicious/noControlCharactersInRegex: Remote references cannot contain terminal controls.\n !/[\\\\/\\u0000-\\u001f\\u007f-\\u009f]/u.test(value) &&\n value !== \".\" &&\n value !== \"..\"\n );\n}\n\nfunction matchesExpected(head: RemoteHead | undefined, expected: ExpectedRemoteHead) {\n return expected.kind === \"missing\" ? head === undefined : head?.revision === expected.revision;\n}\n\nfunction samePointer(left: LatestPointer, right: LatestPointer) {\n return canonicalJson(left) === canonicalJson(right);\n}\n\nfunction canonicalJson(value: unknown): string {\n if (Array.isArray(value)) return JSON.stringify(value.map((item) => JSON.parse(canonicalJson(item))));\n if (!value || typeof value !== \"object\") return JSON.stringify(value);\n return JSON.stringify(\n Object.fromEntries(\n Object.keys(value)\n .sort()\n .map((key) => [key, JSON.parse(canonicalJson((value as Record<string, unknown>)[key]))]),\n ),\n );\n}\n\nfunction joinRemote(...parts: string[]) {\n return parts\n .flatMap((part) => part.split(\"/\"))\n .filter(Boolean)\n .join(\"/\");\n}\n\nfunction secretFreeUrl(value: string) {\n const url = new URL(value);\n url.username = \"\";\n url.password = \"\";\n url.search = \"\";\n url.hash = \"\";\n return url.toString();\n}\n\nfunction sha256(value: Buffer) {\n return createHash(\"sha256\").update(value).digest(\"hex\");\n}\n\nfunction errorMessage(error: unknown) {\n if (error instanceof WebDavHttpError) return error.message;\n return error instanceof Error ? error.message : String(error);\n}\n", "import { XMLParser } from \"fast-xml-parser\";\nimport { ContinuousError, continuousFailure, retryAfter } from \"../../sync/continuous-errors.js\";\nimport { throwIfAborted } from \"../../sync/signals.js\";\nimport type { RemoteObject, ResolvedWebDavBackend } from \"../backend-types.js\";\n\nconst JSON_LIMIT = 1024 * 1024;\nconst ERROR_LIMIT = 64 * 1024;\nconst SNAPSHOT_LIMIT = 256 * 1024 * 1024;\nconst XML_LIMIT = 1024 * 1024;\nconst REQUEST_TIMEOUT_MS = 30_000;\nconst MAX_REDIRECTS = 3;\n\nexport interface WebDavPutOptions {\n ifAbsent?: boolean;\n ifMatch?: string;\n}\n\nexport interface WebDavEntry {\n href: string;\n etag?: string;\n collection: boolean;\n}\n\nexport class WebDavHttpError extends Error {\n constructor(\n message: string,\n readonly status: number,\n options?: ErrorOptions,\n readonly retryAfterMs?: number,\n ) {\n super(message, options);\n this.name = \"WebDavHttpError\";\n }\n}\n\nexport class WebDavPreconditionError extends WebDavHttpError {\n constructor(message = \"WebDAV precondition failed.\") {\n super(message, 412);\n this.name = \"WebDavPreconditionError\";\n }\n}\n\nexport class WebDavClient {\n private readonly baseUrl: URL;\n private readonly authorization: string;\n\n constructor(\n private readonly config: ResolvedWebDavBackend,\n private readonly signal?: AbortSignal,\n private readonly timeoutMs = REQUEST_TIMEOUT_MS,\n ) {\n this.baseUrl = new URL(config.profile.url);\n assertSafeAuthenticatedUrl(this.baseUrl);\n if (\n !config.profile.username ||\n !config.profile.password ||\n config.profile.username.includes(\":\") ||\n hasControlCharacter(config.profile.username) ||\n hasControlCharacter(config.profile.password)\n ) {\n throw new Error(\"Invalid WebDAV credentials.\");\n }\n this.authorization = `Basic ${Buffer.from(`${config.profile.username}:${config.profile.password}`).toString(\"base64\")}`;\n }\n\n async getBuffer(remotePath: string): Promise<RemoteObject<Buffer>> {\n const response = await this.request(remotePath, { method: \"GET\" });\n if (response.status === 404) {\n await response.body?.cancel();\n return { missing: true };\n }\n await this.requireOk(response, \"read\");\n return {\n value: await readBounded(response, SNAPSHOT_LIMIT, \"WebDAV response is too large\"),\n etag: response.headers.get(\"etag\") ?? undefined,\n missing: false,\n };\n }\n\n async getJson<T>(remotePath: string): Promise<RemoteObject<T>> {\n const response = await this.request(remotePath, { method: \"GET\" });\n if (response.status === 404) {\n await response.body?.cancel();\n return { missing: true };\n }\n await this.requireOk(response, \"read\");\n const bytes = await readBounded(response, JSON_LIMIT, \"WebDAV JSON response is too large\");\n try {\n return {\n value: JSON.parse(bytes.toString(\"utf8\")) as T,\n etag: response.headers.get(\"etag\") ?? undefined,\n missing: false,\n };\n } catch (error) {\n throw new Error(\"WebDAV JSON response is malformed.\", { cause: error });\n }\n }\n\n async putBuffer(remotePath: string, body: Buffer, contentType: string, options: WebDavPutOptions = {}) {\n const headers: Record<string, string> = { \"content-type\": contentType };\n if (options.ifAbsent) headers[\"if-none-match\"] = \"*\";\n if (options.ifMatch) headers[\"if-match\"] = options.ifMatch;\n const response = await this.request(remotePath, {\n method: \"PUT\",\n headers,\n body: body as unknown as BodyInit,\n });\n if (response.status === 412) {\n await response.body?.cancel();\n throw new WebDavPreconditionError();\n }\n await this.requireOk(response, \"write\");\n await response.body?.cancel();\n return response.headers.get(\"etag\") ?? undefined;\n }\n\n async putJson(remotePath: string, value: unknown, options: WebDavPutOptions = {}) {\n return this.putBuffer(remotePath, Buffer.from(JSON.stringify(value)), \"application/json\", options);\n }\n\n async makeCollection(remotePath: string) {\n const response = await this.request(remotePath, { method: \"MKCOL\" });\n if (response.status === 405) {\n await response.body?.cancel();\n return false;\n }\n await this.requireOk(response, \"create collection\");\n await response.body?.cancel();\n return true;\n }\n\n async ensureCollection(remotePath: string) {\n const segments = safeSegments(remotePath);\n for (let index = 1; index <= segments.length; index += 1) {\n await this.makeCollection(segments.slice(0, index).join(\"/\"));\n }\n }\n\n async listCollection(remotePath: string): Promise<WebDavEntry[]> {\n const response = await this.request(remotePath, {\n method: \"PROPFIND\",\n headers: { depth: \"1\", \"content-type\": \"application/xml; charset=utf-8\" },\n body: '<?xml version=\"1.0\"?><d:propfind xmlns:d=\"DAV:\"><d:prop><d:getetag/><d:resourcetype/></d:prop></d:propfind>',\n });\n if (response.status === 404) {\n await response.body?.cancel();\n throw new WebDavHttpError(\"WebDAV collection is missing.\", 404);\n }\n if (response.status !== 207) await this.requireOk(response, \"list collection\");\n const xml = (await readBounded(response, XML_LIMIT, \"WebDAV directory response is too large\")).toString(\"utf8\");\n try {\n const parsed = new XMLParser({\n removeNSPrefix: true,\n ignoreAttributes: false,\n processEntities: false,\n }).parse(xml) as {\n multistatus?: { response?: unknown };\n };\n if (!parsed.multistatus || parsed.multistatus.response === undefined) {\n throw new Error(\"Missing DAV multistatus response.\");\n }\n const responses = asArray(parsed.multistatus.response);\n return responses.map(parseEntry);\n } catch (error) {\n throw new Error(\"WebDAV directory response is malformed.\", { cause: error });\n }\n }\n\n async delete(remotePath: string) {\n const response = await this.request(remotePath, { method: \"DELETE\" });\n if (response.status === 404) {\n await response.body?.cancel();\n return;\n }\n if (response.status === 207) {\n await response.body?.cancel();\n throw new WebDavHttpError(\"WebDAV probe cleanup returned a partial response.\", 207);\n }\n await this.requireOk(response, \"delete probe resource\");\n await response.body?.cancel();\n }\n\n private async request(remotePath: string, init: RequestInit) {\n throwIfAborted(this.signal);\n let url = appendRemotePath(this.baseUrl, remotePath);\n for (let redirects = 0; ; redirects += 1) {\n const timeout = AbortSignal.timeout(this.timeoutMs);\n const signal = this.signal ? AbortSignal.any([this.signal, timeout]) : timeout;\n let response: Response;\n try {\n response = await fetch(url, {\n ...init,\n headers: {\n accept: \"*/*\",\n authorization: this.authorization,\n ...headersObject(init.headers),\n },\n redirect: \"manual\",\n signal,\n });\n } catch (error) {\n throwIfAborted(this.signal);\n throw new Error(\n `WebDAV ${String(init.method ?? \"GET\")} request failed for ${redactText(safeUrl(url), this.config)}.`,\n {\n cause: redactError(error, this.config),\n },\n );\n }\n if (![301, 302, 303, 307, 308].includes(response.status)) return response;\n await response.body?.cancel();\n const method = String(init.method ?? \"GET\").toUpperCase();\n if ([301, 302, 303].includes(response.status) && method !== \"GET\" && method !== \"HEAD\") {\n throw new Error(\n `WebDAV refused an ambiguous HTTP ${response.status} redirect for ${method}; configure the canonical collection URL or require HTTP 307/308.`,\n );\n }\n if (redirects >= MAX_REDIRECTS) throw new Error(\"WebDAV redirect limit exceeded.\");\n const location = response.headers.get(\"location\");\n if (!location) throw new Error(\"WebDAV redirect is missing Location.\");\n const next = new URL(location, url);\n if (next.origin !== this.baseUrl.origin) {\n throw new Error(\"WebDAV refused a cross-origin authenticated redirect.\");\n }\n url = next;\n }\n }\n\n private async requireOk(response: Response, action: string) {\n if (response.ok) return;\n const body = (await readBounded(response, ERROR_LIMIT, \"WebDAV error body is too large\"))\n .toString(\"utf8\")\n // biome-ignore lint/suspicious/noControlCharactersInRegex: Remote error text is untrusted terminal input.\n .replace(/[\\u0000-\\u001f\\u007f-\\u009f]/gu, \" \")\n .trim();\n const detail = body ? `: ${redactText(body, this.config)}` : \"\";\n throw new WebDavHttpError(\n `WebDAV ${action} failed with HTTP ${response.status}${detail}`,\n response.status,\n undefined,\n retryAfter(response),\n );\n }\n}\n\nfunction assertSafeAuthenticatedUrl(url: URL) {\n const loopback =\n url.hostname === \"127.0.0.1\" || url.hostname === \"localhost\" || url.hostname === \"[::1]\" || url.hostname === \"::1\";\n if (\n url.username ||\n url.password ||\n url.search ||\n url.hash ||\n (url.protocol !== \"https:\" && !(url.protocol === \"http:\" && loopback))\n ) {\n throw new Error(\n \"Invalid WebDAV URL: HTTPS is required and embedded credentials, query, or fragment are not allowed.\",\n );\n }\n}\n\nfunction hasControlCharacter(value: string) {\n return [...value].some((character) => {\n const code = character.codePointAt(0) ?? 0;\n return code < 0x20 || (code >= 0x7f && code <= 0x9f);\n });\n}\n\nfunction appendRemotePath(base: URL, remotePath: string) {\n const url = new URL(base);\n const suffix = safeSegments(remotePath).map(encodeURIComponent).join(\"/\");\n url.pathname = `${base.pathname.replace(/\\/+$/u, \"\")}/${suffix}`;\n return url;\n}\n\nfunction safeSegments(value: string) {\n const segments = value\n .replace(/^\\/+|\\/+$/gu, \"\")\n .split(\"/\")\n .filter(Boolean);\n if (\n segments.some(\n (segment) =>\n segment === \".\" ||\n segment === \"..\" ||\n // biome-ignore lint/suspicious/noControlCharactersInRegex: Remote path segments cannot contain controls.\n /[\\u0000-\\u001f]/u.test(segment),\n )\n ) {\n throw new Error(\"Invalid WebDAV remote path.\");\n }\n return segments;\n}\n\nasync function readBounded(response: Response, limit: number, message: string) {\n const length = Number(response.headers.get(\"content-length\"));\n if (Number.isFinite(length) && length > limit) {\n await response.body?.cancel();\n throw new Error(message);\n }\n if (!response.body) return Buffer.alloc(0);\n const reader = response.body.getReader();\n const chunks: Buffer[] = [];\n let total = 0;\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n total += value.byteLength;\n if (total > limit) throw new Error(message);\n chunks.push(Buffer.from(value));\n }\n } catch (error) {\n await reader.cancel().catch(() => undefined);\n throw error;\n }\n return Buffer.concat(chunks, total);\n}\n\nfunction parseEntry(value: unknown): WebDavEntry {\n if (!value || typeof value !== \"object\") throw new Error(\"Invalid WebDAV response entry.\");\n const record = value as Record<string, unknown>;\n const href = typeof record.href === \"string\" ? record.href : undefined;\n if (!href) throw new Error(\"Invalid WebDAV response href.\");\n const propstat = asArray(record.propstat).find((item) => {\n if (!item || typeof item !== \"object\") return false;\n return String((item as Record<string, unknown>).status ?? \"\").includes(\" 200 \");\n }) as Record<string, unknown> | undefined;\n const prop = propstat?.prop as Record<string, unknown> | undefined;\n return {\n href,\n etag: typeof prop?.getetag === \"string\" ? prop.getetag : undefined,\n collection:\n !!prop?.resourcetype && typeof prop.resourcetype === \"object\" && Object.hasOwn(prop.resourcetype, \"collection\"),\n };\n}\n\nfunction asArray(value: unknown): unknown[] {\n if (value === undefined) return [];\n return Array.isArray(value) ? value : [value];\n}\n\nfunction headersObject(headers: HeadersInit | undefined) {\n return Object.fromEntries(new Headers(headers).entries());\n}\n\nfunction safeUrl(url: URL) {\n return `${url.protocol}//${url.host}${url.pathname}`;\n}\n\nfunction redactError(error: unknown, config: ResolvedWebDavBackend) {\n const message = error instanceof Error ? error.message : String(error);\n const failure = continuousFailure(error);\n return new ContinuousError(failure.kind, redactText(message, config), failure.delay);\n}\n\nfunction redactText(value: string, config: ResolvedWebDavBackend) {\n let result = value;\n for (const secret of [config.profile.username, config.profile.password, config.profile.url]) {\n if (!secret) continue;\n for (const variant of new Set([secret, encodeURIComponent(secret)])) {\n result = result.replace(new RegExp(escapeRegExp(variant), \"giu\"), \"[redacted]\");\n }\n }\n return result.replace(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SAAS,KAAK,MAAM,cAAc,IAAI,CAAC,CAAC,CAAC;AACpG,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU,QAAO,KAAK,UAAU,KAAK;AACpE,SAAO,KAAK;AAAA,IACV,OAAO;AAAA,MACL,OAAO,KAAK,KAAK,EACd,KAAK,EACL,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,MAAM,cAAe,MAAkC,GAAG,CAAC,CAAC,CAAC,CAAC;AAAA,IAC3F;AAAA,EACF;AACF;AAEA,SAAS,cAAc,OAAiB;AACtC,SAAO,MACJ,QAAQ,CAAC,SAAS,KAAK,MAAM,GAAG,CAAC,EACjC,OAAO,OAAO,EACd,KAAK,GAAG;AACb;AAEA,SAAS,cAAc,OAAe;AACpC,QAAM,MAAM,IAAI,IAAI,KAAK;AACzB,MAAI,WAAW;AACf,MAAI,WAAW;AACf,MAAI,SAAS;AACb,MAAI,OAAO;AACX,SAAO,IAAI,SAAS;AACtB;AAEA,SAAS,OAAO,OAAe;AAC7B,SAAO,WAAW,QAAQ,EAAE,OAAO,KAAK,EAAE,OAAO,KAAK;AACxD;AAEA,SAAS,aAAa,OAAgB;AACpC,MAAI,iBAAiB,gBAAiB,QAAO,MAAM;AACnD,SAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;",
6
6
  "names": []
7
7
  }
package/dist/index.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
3
  import {
4
4
  createSyncAttentionController
5
- } from "./chunks/chunk-U77DWNRH.ts";
5
+ } from "./chunks/chunk-Q23JJW7E.ts";
6
6
  import {
7
7
  createStartupTimings
8
8
  } from "./chunks/chunk-M6VQJIOU.ts";
@@ -10,10 +10,10 @@ import {
10
10
  completeSyncArguments,
11
11
  setSyncSetupCompletions,
12
12
  splitArgs
13
- } from "./chunks/chunk-NLWS55B6.ts";
13
+ } from "./chunks/chunk-QPC5HT3A.ts";
14
14
  import {
15
15
  captureMutationOwner
16
- } from "./chunks/chunk-5WJQ6XOW.ts";
16
+ } from "./chunks/chunk-GNYGNHFF.ts";
17
17
  import {
18
18
  safeTerminalText
19
19
  } from "./chunks/chunk-AMJRUXFT.ts";
@@ -31,14 +31,14 @@ import {
31
31
  loadPartialConfig,
32
32
  readLocalConfigObject,
33
33
  syncCheckConfigFingerprint
34
- } from "./chunks/chunk-RX3WGWVL.ts";
34
+ } from "./chunks/chunk-OVBAW7KV.ts";
35
35
  import "./chunks/chunk-X7R6DCVF.ts";
36
36
  import {
37
37
  pendingTransactionEntries
38
38
  } from "./chunks/chunk-5SFMBY5P.ts";
39
39
  import {
40
40
  withLock
41
- } from "./chunks/chunk-MDUORMCK.ts";
41
+ } from "./chunks/chunk-6O3EDBRL.ts";
42
42
  import {
43
43
  combineSignals,
44
44
  throwIfAborted
@@ -47,20 +47,20 @@ import {
47
47
  ensureStateDir,
48
48
  readStateForConfig,
49
49
  syncStateFingerprint
50
- } from "./chunks/chunk-73MDIVYJ.ts";
50
+ } from "./chunks/chunk-DN4IA7MR.ts";
51
+ import "./chunks/chunk-AR2DGDUI.ts";
51
52
  import {
52
53
  stateDirectoryMigrationNotice,
53
54
  withStateDirectoryAccess
54
55
  } from "./chunks/chunk-SWRVXVFD.ts";
55
56
  import "./chunks/chunk-2JZFHNLM.ts";
56
57
  import "./chunks/chunk-T2SJD3N7.ts";
57
- import "./chunks/chunk-DFJGTVPX.ts";
58
+ import "./chunks/chunk-KYTT7KV4.ts";
58
59
  import {
59
60
  sessionDirFromContext,
60
61
  snapshotOptionsForContext
61
- } from "./chunks/chunk-DO55XUNU.ts";
62
- import "./chunks/chunk-AR2DGDUI.ts";
63
- import "./chunks/chunk-YZ5BQNRZ.ts";
62
+ } from "./chunks/chunk-CBLTWXAU.ts";
63
+ import "./chunks/chunk-FHE2DCA2.ts";
64
64
  import {
65
65
  startupTransferEnabled
66
66
  } from "./chunks/chunk-PRUEIIK7.ts";
@@ -94,7 +94,7 @@ async function startSession(ctx, signal, publish) {
94
94
  const pending = await pendingTransactionEntries();
95
95
  validateMutation();
96
96
  if (!pending.some((entry) => entry.isDirectory())) return;
97
- const { recoverSnapshotTransactionsOnStartup } = await import("./chunks/snapshot-transaction-EUGA4VX6.ts");
97
+ const { recoverSnapshotTransactionsOnStartup } = await import("./chunks/snapshot-transaction-26BQO36S.ts");
98
98
  validateMutation();
99
99
  await recoverSnapshotTransactionsOnStartup({
100
100
  signal,
@@ -258,7 +258,7 @@ function createStartupCheck(loaders, attention, timeoutMs = 3e4, publish) {
258
258
  if (startupTransferEnabled(captured) && !inspection.firstSync && inspection.head && inspection.selectionState?.kind === "same") {
259
259
  const [operations, { withAgentSyncLock }] = await timings.measure(
260
260
  "operations import",
261
- () => Promise.all([loaders.operations(), import("./chunks/agent-sync-VM3TXWA3.ts")])
261
+ () => Promise.all([loaders.operations(), import("./chunks/agent-sync-P6AWQXGK.ts")])
262
262
  );
263
263
  throwIfAborted(signal);
264
264
  if (!isCurrent()) return;
@@ -357,12 +357,12 @@ function createStartupCheck(loaders, attention, timeoutMs = 3e4, publish) {
357
357
  // src/sync/sync-loaders.ts
358
358
  function createSyncLoaders(dependencies) {
359
359
  const loaders = {
360
- commands: cachedModuleLoader(dependencies.loadCommandHandler ?? (() => import("./chunks/command-handler-FO6F2APH.ts"))),
361
- inspection: cachedModuleLoader(dependencies.loadSyncInspection ?? (() => import("./chunks/sync-inspection-4WFQEJOE.ts"))),
362
- setupSwitch: cachedModuleLoader(dependencies.loadSetupSwitch ?? (() => import("./chunks/setup-switch-66GWMBNH.ts"))),
363
- snapshot: cachedModuleLoader(dependencies.loadSnapshot ?? (() => import("./chunks/snapshot-VRHNAUUH.ts"))),
364
- syncState: cachedModuleLoader(dependencies.loadSyncState ?? (() => import("./chunks/sync-state-SWLSMK4G.ts"))),
365
- operations: cachedModuleLoader(dependencies.loadSyncOperations ?? (() => import("./chunks/sync-operations-X4AOXMBT.ts")))
360
+ commands: cachedModuleLoader(dependencies.loadCommandHandler ?? (() => import("./chunks/command-handler-VKLZBRLO.ts"))),
361
+ inspection: cachedModuleLoader(dependencies.loadSyncInspection ?? (() => import("./chunks/sync-inspection-MOMLGUTD.ts"))),
362
+ setupSwitch: cachedModuleLoader(dependencies.loadSetupSwitch ?? (() => import("./chunks/setup-switch-KLGESLQX.ts"))),
363
+ snapshot: cachedModuleLoader(dependencies.loadSnapshot ?? (() => import("./chunks/snapshot-RGNDYT6A.ts"))),
364
+ syncState: cachedModuleLoader(dependencies.loadSyncState ?? (() => import("./chunks/sync-state-7L4NT7W2.ts"))),
365
+ operations: cachedModuleLoader(dependencies.loadSyncOperations ?? (() => import("./chunks/sync-operations-TMGQHBF5.ts")))
366
366
  };
367
367
  return loaders;
368
368
  }
@@ -420,7 +420,7 @@ function sync(pi, dependencies = {}) {
420
420
  const isCurrent = () => !signal.aborted && !foreground.has(ctx.sessionManager) && owner === ctx.sessionManager;
421
421
  if (!isCurrent() || !ctx.hasUI) return;
422
422
  try {
423
- const { loadConfigForCheck: loadConfigForCheck2 } = await import("./chunks/config-B37W7FXW.ts");
423
+ const { loadConfigForCheck: loadConfigForCheck2 } = await import("./chunks/config-HYG7G5EM.ts");
424
424
  if (!isCurrent()) return;
425
425
  const config = await loadConfigForCheck2();
426
426
  if (!isCurrent()) return;
@@ -429,7 +429,7 @@ function sync(pi, dependencies = {}) {
429
429
  await continuous?.stop(ctx.sessionManager);
430
430
  return;
431
431
  }
432
- const { createContinuousSync } = await import("./chunks/continuous-sync-ZT3UEQLK.ts");
432
+ const { createContinuousSync } = await import("./chunks/continuous-sync-TTOSJCQU.ts");
433
433
  if (!isCurrent()) return;
434
434
  continuous ??= createContinuousSync(loaders, void 0, publishTimings);
435
435
  continuous.start(
@@ -1,4 +1,4 @@
1
- # Agent and Continuous Sync Recovery Boundaries
1
+ # Autonomous and Continuous sync recovery boundaries
2
2
 
3
3
  Pi Sync distinguishes a rejected pre-publication observation from an uncertain publication. Only proven freshness failures retry automatically. Unknown errors do not become retryable because their text looks temporary.
4
4
 
@@ -12,8 +12,8 @@ The authoritative paths are `src/sync/merged-sync.ts`, `agent-plan.ts`, and `con
12
12
  | Local bytes, baseline fingerprint, or remote revision changes before the publication journal | `stale`; no transfer of the rejected candidate. |
13
13
  | Local bytes or baseline changes after journal creation, before any backend publication call | Clear the safely uncommitted journal first, then report `stale`; a cleanup failure retains its original classification. |
14
14
  | Backend proves a conflict happened before commit and the candidate cannot have been active | Retire the uncommitted journal and use the existing bounded merge attempts; exhausted attempts retain the typed conflict cause and classify as `stale`. |
15
- | Upload possible-secret scan; remaining unsupported or refused Agent groups | `unsafe`; retain evidence, suppress unchanged resolution, and inspect changed evidence again. |
16
- | Bounded/unsafe Agent disclosure, unsupported conflict, missing verified ancestor, or invalid candidate application | `unsafe`; no inferred ancestor or bypass of partial-sync policy. |
15
+ | Upload possible-secret scan; remaining unsupported or refused Autonomous sync groups | `unsafe`; retain evidence, suppress unchanged resolution, and inspect changed evidence again. |
16
+ | Bounded/unsafe Autonomous sync disclosure, unsupported conflict, missing verified ancestor, or invalid candidate application | `unsafe`; no inferred ancestor or bypass of partial-sync policy. |
17
17
  | Missing model or unusable/refused resolver output | `model`; unchanged evidence does not repeatedly dispatch. A valid cached refusal stays cached during ordinary Sync now. |
18
18
  | Changed local, baseline, or remote evidence during resolver validation | `stale`; discard authorization for that observation. |
19
19
  | Known HTTP/network/lock errors | Preserve the existing typed/status/code policy and bounded retry delay. |
@@ -37,7 +37,7 @@ A request reservation published before cancellation remains spent. An atomic can
37
37
 
38
38
  Ordinary Sync now retains its existing cached-result policy. The manager-only **Retry refused model result…** action uses the same `sync` operation with an internal control value, not a new public command, flag, or setting.
39
39
 
40
- The action requires Agent mode, foreground TUI/RPC, an accepted baseline, matching current evidence, a valid cached refusal, and no pending merge journal. A pending journal must be reconciled through ordinary Sync now or reviewed recovery first. A missing, accepted, corrupt, stale, or unverified cached result is not retry authorization. Opening the manager may show the action before eligibility is known; activation checks it without dispatching when those conditions are absent.
40
+ The action requires Autonomous sync, foreground TUI/RPC, an accepted baseline, matching current evidence, a valid cached refusal, and no pending merge journal. A pending journal must be reconciled through ordinary Sync now or reviewed recovery first. A missing, accepted, corrupt, stale, or unverified cached result is not retry authorization. Opening the manager may show the action before eligibility is known; activation checks it without dispatching when those conditions are absent.
41
41
 
42
42
  The flow holds the existing resolver claim while the operation lock is released for review and inference. The safe-default review names the setup, connection, exact configured storage path and bucket/branch where applicable, selected provider/model, conflict paths, disclosure, cost, and possible writes. Confirmation binds the same candidate key and cache bytes. Changed settings, model, session, evidence, or cache invalidates it. A competing participant cannot obtain another live resolver claim.
43
43
 
@@ -76,4 +76,4 @@ No live provider, production Git/S3/WebDAV, Windows, or Android verification is
76
76
 
77
77
  ## Downgrade and recovery
78
78
 
79
- Stop Continuous sync and drain all participating owners before downgrade. Disable Agent mode too if autonomous startup work must stop. Reconcile pending journals with the current runtime. Preserve backups, snapshots, accepted and refused candidates, unresolved groups, and request accounting. This change adds no settings, accounting, or candidate schema migration. Do not delete private state to regain allowance or blindly republish an uncertain transfer.
79
+ Stop Continuous sync and drain all participating owners before downgrade. Disable Autonomous sync too if autonomous startup work must stop. Reconcile pending journals with the current runtime. Preserve backups, snapshots, accepted and refused candidates, unresolved groups, and request accounting. This change adds no settings, accounting, or candidate schema migration. Do not delete private state to regain allowance or blindly republish an uncertain transfer.
@@ -1,8 +1,8 @@
1
- # Agent mode implementation verification
1
+ # Autonomous sync implementation verification
2
2
 
3
- This record describes the experimental implementation and its verification scope. The [settings reference](settings.md#experimental-agent-mode) is authoritative for user behavior, limits, privacy, and recovery.
3
+ This record describes the original implementation and its verification scope. The [settings reference](settings.md#autonomous-sync) is authoritative for current user behavior, limits, privacy, and recovery.
4
4
 
5
- Later recovery, cancellation, confirmed-refusal retry, and diagnostics changes are documented in [Agent and Continuous sync recovery boundaries](agent-continuous-hardening.md). The [synthetic quality corpus](agent-quality-verification.md) adds structural tests without claiming measured model accuracy. Historical verification below describes the original implementation.
5
+ Later recovery, cancellation, confirmed-refusal retry, and diagnostics changes are documented in [Autonomous and Continuous sync recovery boundaries](agent-continuous-hardening.md). The [synthetic quality corpus](agent-quality-verification.md) adds structural tests without claiming measured model accuracy. Historical verification below retains the former **Agent mode** name and the maturity labels used at that time; recorded results are unchanged.
6
6
 
7
7
  ## Boundaries and semantic review
8
8
 
@@ -1,6 +1,6 @@
1
- # Synthetic Agent merge-quality verification
1
+ # Synthetic Autonomous sync merge-quality verification
2
2
 
3
- The [corpus](../test/agent-quality-corpus.ts) and [tests](../test/agent-quality.test.ts) check structural merge safety with synthetic data and fixed resolver responses. They do not measure real-model semantic accuracy. Agent mode remains experimental and default-off; the [settings reference](settings.md#experimental-agent-mode) and [implementation verification](agent-mode-verification.md) retain their authority.
3
+ The [corpus](../test/agent-quality-corpus.ts) and [tests](../test/agent-quality.test.ts) check structural merge safety with synthetic data and fixed resolver responses. They do not measure real-model semantic accuracy. Autonomous sync is default-off; the [settings reference](settings.md#autonomous-sync) and [implementation verification](agent-mode-verification.md) retain their authority.
4
4
 
5
5
  ## Deterministic evidence
6
6
 
@@ -24,7 +24,7 @@ These tests prove fixture routing, contract validation and byte assembly for the
24
24
 
25
25
  No provider evaluation is authorized or executed by this work. A future evaluation must follow this protocol:
26
26
 
27
- 1. Obtain explicit approval for the provider/model, model version when available, request count, cost ceiling, repetitions, deadline and retention policy. Keep Agent and Continuous settings unchanged. Stop after one clear external-service or entitlement failure unless a retry is separately requested.
27
+ 1. Obtain explicit approval for the provider/model, model version when available, request count, cost ceiling, repetitions, deadline and retention policy. Keep Autonomous sync and Continuous sync settings unchanged. Stop after one clear external-service or entitlement failure unless a retry is separately requested.
28
28
  2. Freeze the repository revision, corpus revision, resolver contract, model settings and scoring rules before requests. Register allowed exact outputs or whole-settings source choices for each resolvable case. The deterministic fixture response is one reference, not evidence that it is the only valid semantic merge. Do not add allowed results after seeing responses; report unregistered alternatives separately for review.
29
29
  3. Use only the committed synthetic fixtures. Exclude user files, session history, credentials, real remote storage and discovered resources. Send only the current bounded unit payload and existing resolver instructions. Do not send full files, hidden policies, expected answers, scoring notes or neighboring context. Keep unsupported cases as local eligibility checks; they must not cause a provider request.
30
30
  4. Record each attempt without overwriting failures: fixture ID, approved provider/model, outcome, schema validity, refused IDs, exact accepted bytes, elapsed time and provider-reported usage. Preserve raw synthetic output for review, but exclude authentication and provider error payloads. Do not retry refusals automatically.
@@ -1,8 +1,8 @@
1
1
  # Continuous sync verification
2
2
 
3
- This record describes implementation evidence and test scope. The [settings reference](settings.md#experimental-continuous-sync) owns user-facing behavior, limits and recovery.
3
+ This record describes implementation evidence and test scope. The [settings reference](settings.md#continuous-sync) owns current user-facing behavior, limits and recovery.
4
4
 
5
- Later recovery classification, deadline propagation, confirmed-refusal retry, and read-only allowance/capacity diagnostics are documented in [Agent and Continuous sync recovery boundaries](agent-continuous-hardening.md). Historical verification below describes the original implementation.
5
+ Later recovery classification, deadline propagation, confirmed-refusal retry, and read-only allowance/capacity diagnostics are documented in [Autonomous and Continuous sync recovery boundaries](agent-continuous-hardening.md). Historical verification below retains the former **Agent mode** name for Autonomous sync and the maturity labels used at that time; recorded results are unchanged.
6
6
 
7
7
  ## Boundaries and semantic audit
8
8
 
package/docs/settings.md CHANGED
@@ -3,7 +3,7 @@
3
3
  The authoritative settings reference now ships with the [manual-only configuration skill](../skills/configure-pi-sync/SKILL.md).
4
4
  Run `/skill:configure-pi-sync` for guidance, not automatic settings edits or transfers.
5
5
  Read the [complete settings reference](../skills/configure-pi-sync/references/configuration.md) without invoking the skill.
6
- The headings below preserve existing documentation links.
6
+ The headings and invisible compatibility anchors below preserve existing documentation links.
7
7
 
8
8
  ## ⚙️ Settings
9
9
 
@@ -49,13 +49,17 @@ See [Automatic startup transfer](../skills/configure-pi-sync/references/configur
49
49
 
50
50
  See [Unchanged transfer fast path](../skills/configure-pi-sync/references/configuration.md#unchanged-transfer-fast-path).
51
51
 
52
- ### Experimental Agent mode
52
+ <a id="experimental-agent-mode"></a>
53
53
 
54
- See [Experimental Agent mode](../skills/configure-pi-sync/references/configuration.md#experimental-agent-mode).
54
+ ### Autonomous sync
55
55
 
56
- ### Experimental Continuous sync
56
+ See [Autonomous sync](../skills/configure-pi-sync/references/configuration.md#autonomous-sync).
57
57
 
58
- See [Experimental Continuous sync](../skills/configure-pi-sync/references/configuration.md#experimental-continuous-sync).
58
+ <a id="experimental-continuous-sync"></a>
59
+
60
+ ### Continuous sync
61
+
62
+ See [Continuous sync](../skills/configure-pi-sync/references/configuration.md#continuous-sync).
59
63
 
60
64
  #### Activation and ownership
61
65
 
@@ -13,11 +13,13 @@ All settings are private to this device. There are no project overrides. Default
13
13
  | Machine-local fields | `sync.localFields`, absent | Current setup | Input and compatibility review; subsequent snapshots exclude whole settings.json root fields; directional migration required |
14
14
  | Automatic sync | `sync.automatic`, explicit boolean; setup proposes Off | Current setup | Immediate save; next session start checks once; subsequent shutdown pushes all selected content only if sessions included; reload skips shutdown push |
15
15
  | Startup transfer | `sync.automaticTransfer`, false | Current setup | Immediate save; enabling schedules next session start; independent of Automatic sync |
16
+ | Autonomous sync | `sync.agentMode`, false | Current setup | Reviewed opt-in; eligible next-startup and Sync now transfers without another transfer confirmation, plus selected-model assistance for supported conflicts; no transfer from Settings or automatic reload |
17
+ | Continuous sync | `sync.continuous`, false | Current setup | Separate reviewed opt-in; requires Autonomous sync; recurring work starts at eligible startup or after the command/manager closes |
16
18
  | On setup switch | `onSwitch`, `ask-before-pull` | All setups | Immediate save; subsequent switches |
17
19
  | Storage location | `storage.bucket`, `branch`, `path` as applicable | Current setup | Reviewed save; changes future destination without moving remote history |
18
20
  | Manage sync setups | `syncSetups`, `activeSyncSetup` | This device | Existing reviewed catalog flows; replacing/removing the current setup closes its old settings owner |
19
21
  | Manage storage connections | `storageConnections` | Shared by named setups | Existing affected-setup review; changes future operations |
20
- | Merge settings fields | `sync.mergeSettings`, false | Current setup | Immediate save; experimental merge on subsequent sync with a verified ancestor |
22
+ | Merge settings fields | `sync.mergeSettings`, false | Current setup | Immediate save; opt-in merge on subsequent sync with a verified ancestor |
21
23
  | Content merge / partial progress | `sync.mergeContent`, `sync.partialSync`, false/false | Current setup | Explicit compatibility review and atomic save; Off, Merge only, Merge + partial, Partial only preserve all combinations |
22
24
  | Skip secret scan | `skipSecretScan`, false | All setups | Immediate save; subsequent manual/automatic pushes; Diagnostics still scans |
23
25
  | Show sync status | `showStatus`, true | All setups | Immediate save and immediate status visibility change; notifications/widgets remain |
@@ -29,7 +31,7 @@ Writers queue the complete read-modify-write operation, hold the cross-process l
29
31
 
30
32
  ## Presentation decisions
31
33
 
32
- Settings opens four task categories: Sync content, Sync behavior, Storage & setups, and Advanced. All settings (search) exposes the same rows for cross-category native-style typing-to-search. Each category uses the same row definitions and action handlers; navigation headings are not fake settings. Back returns one level; hard Ctrl+C closes the flow. No `/ Search` hint is added because slash is ordinary search text.
34
+ Selecting **Settings** in `/sync` opens **Pi Sync Settings** directly as one searchable flat list, with all 16 rows in their existing order and no category navigation or headings. Row values, descriptions, actions, reviews, and save behavior are unchanged. Typing searches the list. Back returns directly to the manager; hard Ctrl+C closes the flow. No `/ Search` hint is added because slash is ordinary search text.
33
35
 
34
36
  The existing public Kit settings adapter is retained rather than adding a second selector or accessing private Pi fields. Installed `SettingsList` provides `updateValue()` and `selectItem()`, but has no injected keybinding or awaited-save/rejection contract and does not expose search focus. Kit already owns ordered pending changes, rollback, retained search/selection, IME focus, bounded frames, and clipped mouse coordinates. This is an intentional existing deviation from the literal native-component convention. No new Kit API, dependency floor, or release is required. A package-owned public rendering boundary returns no lines at zero width and retains the selected row (or search when nothing matches) below five content rows; compact mouse events map back to the original rendered row. It does not access private component state or add key handlers. Search placeholder and position-footer relocation remain unsupported by that public API; the existing native-style hints and position indicator are retained rather than patched through private fields.
35
37
 
@@ -47,7 +49,7 @@ Startup transfer summaries report the preference and prerequisites, not a claim
47
49
  | Pull | Remote → local counts and paths; protected loaded session excluded; backup before apply | `sync-mutations.ts`: settings, local hashes, head and baseline rechecked before commit; `recovery-pull-freshness.test.ts`, `local-field-pull-policy.test.ts` |
48
50
  | Push | Local → remote active snapshot counts and paths; preserve eligible unmanaged content; removals do not erase retained history | `sync-mutations.ts`: fresh interactive before-image, local hashes/settings/baseline rechecked, expected-head publication; `backend-orchestration.test.ts`, `review-feedback.test.ts` |
49
51
  | Forced Pull/Push | Same directional review, not a bypass of conditional publication | Refreshed force-push plan requires new approval; migration confirmation remains mandatory even with `--yes`; `sync-state-revision.test.ts`, `local-field-migration.test.ts` |
50
- | Merge / partial progress | Effective before/after snapshots, local/remote counts, conflicts/withheld groups, backups and publication | Existing scrollable review; recheck settings, hashes, state and remote before journal/apply; `merged-sync-confirmation.test.ts`, `partial-directional-progress.test.ts`, `merged-sync-summary.test.ts` |
52
+ | Merge / partial progress | Effective before/after snapshots, local/remote counts, conflicts/withheld groups, backups and publication | Existing scrollable review unless Autonomous sync or another explicit transfer authorization applies; recheck settings, hashes, state and remote before journal/apply; `merged-sync-confirmation.test.ts`, `partial-directional-progress.test.ts`, `merged-sync-summary.test.ts` |
51
53
  | Conflicts | Review complete dependency group and separately choose authority | Artifact fingerprint, group versions, baseline, config, owner and head checks; `conflict-confirmation.test.ts`, `conflict-preview.test.ts` |
52
54
  | Case-variant cleanup | Pull/rollback include the apply engine’s additional top-level alias removals, even when canonical snapshot bytes are unchanged | `apply-review.ts` uses the authoritative apply planner, streams file hashes, records symlink identity without following its target, and rechecks the complete alias set before commit; `transfer-preview.test.ts` covers changed, added, removed, cancelled and symlink aliases plus descriptor cleanup on cancellation. Merge preflight rejects noncanonical changed targets instead of deleting aliases. |
53
55
  | History rollback | Historical snapshot → local and active remote head; backup and protected-session summary | Settings, local bytes, current head, selected backend/setup and baseline rechecked; `history-confirmation-cancellation.test.ts`, `history-cancellation.test.ts`, `rollback-field-policy.test.ts` |
@@ -59,3 +61,18 @@ TUI Pull and Push reviews reuse the existing scrollable safe-default confirmatio
59
61
  ## Review boundaries
60
62
 
61
63
  This change does not touch model prompts, tool exposure, shared-terminal handoff, settings formats, credentials, or default sync policies. Existing startup/session signals and Kit/custom-interaction disposal own new UI calls. Any awaited review is followed by owner validation, and each mutating operation revalidates its mutable inputs before its existing commit boundary. Status and differences actions use existing routes; manager opening/refresh remains observational and does not contact the remote. Diagnostics discloses its WebDAV write/repair behavior before execution.
64
+
65
+ ## Settings wording verification
66
+
67
+ The 2026-11-08 wording update uses **Autonomous sync**, removes Settings maturity markers at the user's request, and keeps `sync.agentMode`, saved consent, defaults, opt-ins, and risk warnings unchanged. A semantic diff audit checked all 16 changed runtime files against the base plus approved prose substitutions; authorization, settings storage, resolver prompts, cancellation, disposal, session replacement, and shutdown logic are unchanged. Review followed `docs/extension-conventions.md`, `docs/extension-settings.md`, and `docs/readme-conventions.md`, plus the skill editing rules. An independent complete-diff review found no issues.
68
+
69
+ Verification evidence:
70
+
71
+ - Root `npm run check` and `npm test` passed: 935 test files, 20,528 passed tests, 34 existing skips, and no unhandled errors.
72
+ - The focused Pi Sync suite passed: 185 files, 3,293 passed tests, and 19 existing skips. Cases cover all four Settings descriptions, TUI/RPC consent, cancellation, the RPC Done exit without authorization, durable saves and failure recovery, Continuous sync dependencies, non-default keys, narrow rendering, and current/legacy documentation anchors.
73
+ - A fenced-code-aware heading audit passed for all 37 package READMEs. Legacy fragment aliases remain in the README, authoritative settings reference, and compatibility index.
74
+ - `npm run package:pack -- sync` and an actual temporary tarball inspection passed: 330 entries include the runtime, source, docs, skill, license, and changelog, without tests or repository plans.
75
+
76
+ The first direct-Vitest run used a symlinked macOS temporary path and triggered existing alias-path safety checks; the successful focused run used the canonical temporary root, as the root runner does. New RPC choice assertions were corrected to include Kit's existing Done exit, and both consent flows now test that exit. No runtime safety check or acceptance criterion was relaxed. Later full-suite command-level rechecks exceeded the harness's 300-second command limit. A background full-suite recheck hit the readiness watchdog in the unchanged `test/packed-publish-native.test.ts`; that file passed separately. The final full-suite recheck uses a managed background runner without changing per-test limits. Biome reports existing schema-version and unrelated lint advisories; its gates pass without changing repository tooling.
77
+
78
+ Physical-terminal appearance, rendered Markdown fragment navigation, live model quality, production backends, Windows, and Android were not newly verified. A maintainer needs the relevant terminal/platform and a separately authorized provider/backend environment to check those paths before claiming new coverage. These are not additional gates for this wording-only change; normal CI and explicit publication approval still apply. No live-provider request, production transfer, publication, tag, or release workflow was performed.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narumitw/pi-sync",
3
- "version": "0.57.10",
3
+ "version": "0.57.12",
4
4
  "description": "Pi extension that syncs Pi configuration through Git, WebDAV, Cloudflare R2, or S3-compatible storage.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -47,9 +47,9 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@narumitw/pi-tui-kit": "^0.69.1",
50
- "fast-xml-parser": "^5.11.2",
50
+ "fast-xml-parser": "^5.12.0",
51
51
  "proper-lockfile": "^4.1.2",
52
- "semver": "^7.8.5"
52
+ "semver": "^7.8.6"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@earendil-works/pi-coding-agent": "1.5.0",
@@ -15,7 +15,7 @@ This skill provides guidance only, even when the request asks you to apply a cha
15
15
  Read the relevant headings in the [settings reference](references/configuration.md), not the user's private settings file.
16
16
  Use **Settings ownership and required fields**, **Complete version 3 example**, and **Required backend shapes** for schema, backend, and destination questions.
17
17
  Use **Included content** for path selection and session privacy.
18
- Use **Required backend shapes**, **Automatic startup transfer**, **Experimental Agent mode**, and **Experimental Continuous sync** to distinguish automatic controls.
18
+ Use **Required backend shapes**, **Automatic startup transfer**, **Autonomous sync**, and **Continuous sync** to distinguish automatic controls.
19
19
  Use **Settings field merge and machine-local fields** and **Content merge and partial progress** for versions 4 and 5.
20
20
  Use **Diagnostics** and **Unsupported old settings and recovery** for diagnostic side effects and recovery boundaries.
21
21
  If the reference does not establish an answer, state the missing evidence instead of inventing a field, default, migration, or compatibility guarantee.
@@ -34,6 +34,8 @@ These are instruction limits, not an OS sandbox or a guarantee that the agent ca
34
34
 
35
35
  For a question, give the supported setting name, scope, accepted value, default when applicable, and material effect from the reference.
36
36
  Do not equate `sync.automatic`, `sync.automaticTransfer`, `sync.agentMode`, and `sync.continuous`.
37
+ Map Autonomous sync to the unchanged `sync.agentMode` key.
38
+ Explain its authorization for eligible startup and Sync now transfers without another transfer confirmation before its model assistance for supported conflicts.
37
39
 
38
40
  For setup or a requested edit, explain that this skill cannot apply it and identify the corresponding `/sync` manager action for the user.
39
41
  Ask at most one question at a time when the backend, destination, or included content is not sufficiently clear.