@narumitw/pi-sync 0.70.4 → 0.70.6

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 (74) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +5 -3
  3. package/dist/chunks/{chunk-3XN4FR72.ts → chunk-4A34OGXY.ts} +9 -9
  4. package/dist/chunks/{chunk-7NQ7SFZK.ts → chunk-5BE6LBDC.ts} +15 -15
  5. package/dist/chunks/chunk-A43CJYG4.ts +26 -0
  6. package/dist/chunks/chunk-A43CJYG4.ts.map +7 -0
  7. package/dist/chunks/{chunk-JPTI4HFC.ts → chunk-AXN3B5KC.ts} +22 -22
  8. package/dist/chunks/{chunk-SPXEDJ2G.ts → chunk-KN4NY2VV.ts} +15 -42
  9. package/dist/chunks/chunk-KN4NY2VV.ts.map +7 -0
  10. package/dist/chunks/{chunk-N24HEZSA.ts → chunk-VERMBZGL.ts} +7 -7
  11. package/dist/chunks/{chunk-V4IGBXBA.ts → chunk-WE3KJ7JS.ts} +9 -8
  12. package/dist/chunks/chunk-WE3KJ7JS.ts.map +7 -0
  13. package/dist/chunks/{chunk-5T4ZOHYF.ts → chunk-WRS3SUNZ.ts} +4 -18
  14. package/dist/chunks/chunk-WRS3SUNZ.ts.map +7 -0
  15. package/dist/chunks/client-debug-F4WFP2YJ.ts +40 -0
  16. package/dist/chunks/client-debug-F4WFP2YJ.ts.map +7 -0
  17. package/dist/chunks/{command-handler-4XHK5PVX.ts → command-handler-GERC7LOE.ts} +34 -32
  18. package/dist/chunks/{command-handler-4XHK5PVX.ts.map → command-handler-GERC7LOE.ts.map} +1 -1
  19. package/dist/chunks/{conflict-review-QI77P7KL.ts → conflict-review-XZI7RYZX.ts} +3 -3
  20. package/dist/chunks/debug-tool-execution-7N4H6K3X.ts +67 -0
  21. package/dist/chunks/debug-tool-execution-7N4H6K3X.ts.map +7 -0
  22. package/dist/chunks/{diff-review-SOLP33TQ.ts → diff-review-FLWC5VOT.ts} +3 -3
  23. package/dist/chunks/{diff-review-ILRZDQ4S.ts → diff-review-GB4NO53B.ts} +4 -4
  24. package/dist/chunks/{file-selection-2H3J2HTX.ts → file-selection-DGC5UJVI.ts} +9 -9
  25. package/dist/chunks/{manager-result-dispatcher-YXSDLTLV.ts → manager-result-dispatcher-6MOJPLIS.ts} +7 -7
  26. package/dist/chunks/{manager-ui-RQSZLMJ5.ts → manager-ui-3CQU37XY.ts} +90 -68
  27. package/dist/chunks/manager-ui-3CQU37XY.ts.map +7 -0
  28. package/dist/chunks/{remote-selection-ui-AE6FOEXH.ts → remote-selection-ui-2V53UBHM.ts} +6 -6
  29. package/dist/chunks/{setup-switch-LJPEZONY.ts → setup-switch-WSKVGW7L.ts} +4 -4
  30. package/dist/chunks/{setup-wizard-FBX7RTZ6.ts → setup-wizard-FRIR2EOR.ts} +9 -9
  31. package/dist/chunks/{sync-inspection-TZ4EMSBN.ts → sync-inspection-ECI4BY5N.ts} +6 -6
  32. package/dist/chunks/{sync-operations-QIQ3G66S.ts → sync-operations-KWXZZEPT.ts} +4 -4
  33. package/dist/chunks/sync-state-store-TZE7XDV5.ts +23 -0
  34. package/dist/chunks/sync-state-store-TZE7XDV5.ts.map +7 -0
  35. package/dist/daemon/dist/build-id.json +1 -1
  36. package/dist/daemon/dist/cli.js +3 -2
  37. package/dist/daemon/dist/client.js +55 -14
  38. package/dist/daemon/dist/daemon-startup.js +2 -14
  39. package/dist/daemon/dist/daemon-upgrade-error.js +14 -0
  40. package/dist/daemon/dist/engine/sync/directional-conflict.js +0 -2
  41. package/dist/daemon/dist/index.js +20 -3
  42. package/dist/daemon/package.json +1 -1
  43. package/dist/index.ts +41 -83
  44. package/dist/index.ts.map +2 -2
  45. package/docs/daemon-migration.md +2 -0
  46. package/docs/tui-contract.md +2 -2
  47. package/package.json +2 -2
  48. package/src/daemon/client-debug.ts +2 -0
  49. package/src/daemon/pi-client.ts +15 -7
  50. package/src/sync/automatic-sync.ts +3 -1
  51. package/src/sync/debug-tool-execution.ts +66 -0
  52. package/src/sync/debug-tool.ts +4 -51
  53. package/src/sync/startup-check.ts +3 -1
  54. package/src/sync-extension.ts +2 -1
  55. package/src/ui/manager-ui.ts +41 -20
  56. package/src/ui/sync-resolution-ui.ts +3 -0
  57. package/dist/chunks/chunk-5T4ZOHYF.ts.map +0 -7
  58. package/dist/chunks/chunk-SPXEDJ2G.ts.map +0 -7
  59. package/dist/chunks/chunk-V4IGBXBA.ts.map +0 -7
  60. package/dist/chunks/manager-ui-RQSZLMJ5.ts.map +0 -7
  61. /package/dist/chunks/{chunk-3XN4FR72.ts.map → chunk-4A34OGXY.ts.map} +0 -0
  62. /package/dist/chunks/{chunk-7NQ7SFZK.ts.map → chunk-5BE6LBDC.ts.map} +0 -0
  63. /package/dist/chunks/{chunk-JPTI4HFC.ts.map → chunk-AXN3B5KC.ts.map} +0 -0
  64. /package/dist/chunks/{chunk-N24HEZSA.ts.map → chunk-VERMBZGL.ts.map} +0 -0
  65. /package/dist/chunks/{conflict-review-QI77P7KL.ts.map → conflict-review-XZI7RYZX.ts.map} +0 -0
  66. /package/dist/chunks/{diff-review-SOLP33TQ.ts.map → diff-review-FLWC5VOT.ts.map} +0 -0
  67. /package/dist/chunks/{diff-review-ILRZDQ4S.ts.map → diff-review-GB4NO53B.ts.map} +0 -0
  68. /package/dist/chunks/{file-selection-2H3J2HTX.ts.map → file-selection-DGC5UJVI.ts.map} +0 -0
  69. /package/dist/chunks/{manager-result-dispatcher-YXSDLTLV.ts.map → manager-result-dispatcher-6MOJPLIS.ts.map} +0 -0
  70. /package/dist/chunks/{remote-selection-ui-AE6FOEXH.ts.map → remote-selection-ui-2V53UBHM.ts.map} +0 -0
  71. /package/dist/chunks/{setup-switch-LJPEZONY.ts.map → setup-switch-WSKVGW7L.ts.map} +0 -0
  72. /package/dist/chunks/{setup-wizard-FBX7RTZ6.ts.map → setup-wizard-FRIR2EOR.ts.map} +0 -0
  73. /package/dist/chunks/{sync-inspection-TZ4EMSBN.ts.map → sync-inspection-ECI4BY5N.ts.map} +0 -0
  74. /package/dist/chunks/{sync-operations-QIQ3G66S.ts.map → sync-operations-KWXZZEPT.ts.map} +0 -0
@@ -1,5 +1,9 @@
1
1
  // @generated by scripts/build-runtime.mjs; do not edit.
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
+ import {
4
+ directoryScopeSummary,
5
+ showExcludedPaths
6
+ } from "./chunk-VERMBZGL.ts";
3
7
  import {
4
8
  applyS3CredentialUpdate,
5
9
  automaticSyncSummary,
@@ -19,18 +23,33 @@ import {
19
23
  showEditS3Target,
20
24
  showEditWebDavStorageProfile,
21
25
  showEditWebDavTarget
22
- } from "./chunk-JPTI4HFC.ts";
26
+ } from "./chunk-AXN3B5KC.ts";
27
+ import {
28
+ saveReviewedDraft
29
+ } from "./chunk-HFMGK6A6.ts";
30
+ import {
31
+ localConfigPath,
32
+ readActiveLocalConfigDocumentForRepair,
33
+ syncErrorGuidance
34
+ } from "./chunk-IBXEM35O.ts";
23
35
  import {
24
36
  dispatchManagerResult
25
- } from "./chunk-V4IGBXBA.ts";
26
- import "./chunk-7NQ7SFZK.ts";
37
+ } from "./chunk-WE3KJ7JS.ts";
38
+ import "./chunk-5BE6LBDC.ts";
39
+ import {
40
+ addStorageConnection,
41
+ removeStorageConnection,
42
+ removeSyncSetup,
43
+ updateStorageConnection,
44
+ updateSyncSetup
45
+ } from "./chunk-NXWHPVXR.ts";
27
46
  import {
28
47
  SETUP_SWITCH_ACTION_OPTIONS,
29
48
  saveOnSwitch,
30
49
  setupSwitchActionFromLabel,
31
50
  setupSwitchActionLabel,
32
51
  useSyncSetup
33
- } from "./chunk-3XN4FR72.ts";
52
+ } from "./chunk-4A34OGXY.ts";
34
53
  import {
35
54
  isCloudflareR2Endpoint,
36
55
  normalizeS3Endpoint,
@@ -42,49 +61,43 @@ import {
42
61
  readLocalConfigObject,
43
62
  updateLocalConfig
44
63
  } from "./chunk-R7PN3KIY.ts";
64
+ import {
65
+ captureMutationOwner
66
+ } from "./chunk-GELYN4UC.ts";
45
67
  import {
46
68
  observationMatchesConfig,
47
69
  observationSummary,
48
- readStateForConfig,
49
- syncAttentionMatchesConfig,
50
- syncStateFingerprint
51
- } from "./chunk-5T4ZOHYF.ts";
70
+ syncAttentionMatchesConfig
71
+ } from "./chunk-WRS3SUNZ.ts";
72
+ import {
73
+ sameSyncExclude
74
+ } from "./chunk-ZO52JM4H.ts";
75
+ import {
76
+ configureSyncStatus
77
+ } from "./chunk-H7VOTY5N.ts";
52
78
  import {
53
79
  throwIfAborted
54
80
  } from "./chunk-UMPA5S7X.ts";
81
+ import {
82
+ compareSyncInclude,
83
+ syncIncludeSelection,
84
+ syncSelectionHasContent,
85
+ syncSessionsSelected
86
+ } from "./chunk-R3SAMXB6.ts";
55
87
  import {
56
88
  AUTOMATIC_SYNC_DESCRIPTION,
57
89
  STARTUP_TRANSFER_DESCRIPTION,
58
90
  startupTransferSummary
59
91
  } from "./chunk-VQTYTUBU.ts";
92
+ import {
93
+ errorMessage
94
+ } from "./chunk-6YKOHBSC.ts";
60
95
  import {
61
96
  runCancellableOperation
62
97
  } from "./chunk-ZWP6HAYV.ts";
63
98
  import {
64
- directoryScopeSummary,
65
- showExcludedPaths
66
- } from "./chunk-N24HEZSA.ts";
67
- import {
68
- saveReviewedDraft
69
- } from "./chunk-HFMGK6A6.ts";
70
- import {
71
- addStorageConnection,
72
- removeStorageConnection,
73
- removeSyncSetup,
74
- updateStorageConnection,
75
- updateSyncSetup
76
- } from "./chunk-NXWHPVXR.ts";
77
- import {
78
- captureMutationOwner
79
- } from "./chunk-GELYN4UC.ts";
80
- import {
81
- localConfigPath,
82
- readActiveLocalConfigDocumentForRepair,
83
- syncErrorGuidance
84
- } from "./chunk-IBXEM35O.ts";
85
- import {
86
- sameSyncExclude
87
- } from "./chunk-ZO52JM4H.ts";
99
+ safeTerminalText
100
+ } from "./chunk-AMJRUXFT.ts";
88
101
  import {
89
102
  configFromSettings,
90
103
  createSettingsConfigView,
@@ -96,20 +109,9 @@ import {
96
109
  syncConfigReviewIdentity
97
110
  } from "./chunk-LNZRNXNQ.ts";
98
111
  import {
99
- configureSyncStatus
100
- } from "./chunk-H7VOTY5N.ts";
101
- import {
102
- errorMessage
103
- } from "./chunk-6YKOHBSC.ts";
104
- import {
105
- compareSyncInclude,
106
- syncIncludeSelection,
107
- syncSelectionHasContent,
108
- syncSessionsSelected
109
- } from "./chunk-R3SAMXB6.ts";
110
- import {
111
- safeTerminalText
112
- } from "./chunk-AMJRUXFT.ts";
112
+ readStateForConfig,
113
+ syncStateFingerprint
114
+ } from "./chunk-A43CJYG4.ts";
113
115
 
114
116
  // src/ui/manager-ui.ts
115
117
  import { defineMenu as defineMenu5, runMenu as runMenu5 } from "@narumitw/pi-tui-kit";
@@ -150,7 +152,7 @@ function blockedSyncMenuItem(label, manager) {
150
152
  };
151
153
  }
152
154
  async function showManagerAttention(ctx, attention, runRoute, signal, onSelectionResolved) {
153
- const { showRemoteSelectionReview } = await import("./remote-selection-ui-AE6FOEXH.ts");
155
+ const { showRemoteSelectionReview } = await import("./remote-selection-ui-2V53UBHM.ts");
154
156
  if (signal?.aborted) return "close";
155
157
  const review = await showRemoteSelectionReview(ctx, attention.decision.setupName, signal, void 0, {
156
158
  decision: attention.decision,
@@ -1704,7 +1706,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
1704
1706
  },
1705
1707
  "remote-include": async ({ signal: actionSignal }) => {
1706
1708
  const reviewSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
1707
- const { showRemoteSelectionReview } = await import("./remote-selection-ui-AE6FOEXH.ts");
1709
+ const { showRemoteSelectionReview } = await import("./remote-selection-ui-2V53UBHM.ts");
1708
1710
  if (reviewSignal.aborted) return { kind: "rejected" };
1709
1711
  const review = await showRemoteSelectionReview(ctx, setupName, reviewSignal, void 0, {
1710
1712
  origin: "settings",
@@ -1900,7 +1902,19 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
1900
1902
  let result = await run("reject-conflicts");
1901
1903
  if (signal.aborted || !isCurrent()) return { kind: "close" };
1902
1904
  if (result.kind === "destination-conflict") {
1903
- const choice = await showDirectionalConflict(menuContext, direction, review.setupName, signal, isCurrent);
1905
+ const choice = await showDirectionalConflict(
1906
+ menuContext,
1907
+ direction,
1908
+ review.setupName,
1909
+ signal,
1910
+ isCurrent,
1911
+ async (diffSignal) => {
1912
+ if (!await matchesManagerReview(review.fingerprint, diffSignal)) {
1913
+ return { kind: diffSignal.aborted || !isCurrent() ? "close" : "back" };
1914
+ }
1915
+ return reviewDifferences(review, diffSignal);
1916
+ }
1917
+ );
1904
1918
  if (signal.aborted || !isCurrent() || choice === "close") return { kind: "close" };
1905
1919
  if (choice === "back") return { kind: "stay" };
1906
1920
  if (!await matchesManagerReview(review.fingerprint, signal))
@@ -1954,7 +1968,7 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
1954
1968
  if (!attention) {
1955
1969
  const observation = state.manager.observation;
1956
1970
  if (!observation) return { kind: "stay" };
1957
- const { showRemoteSelectionReview } = await import("./remote-selection-ui-AE6FOEXH.ts");
1971
+ const { showRemoteSelectionReview } = await import("./remote-selection-ui-2V53UBHM.ts");
1958
1972
  if (sessionSignal?.aborted) return { kind: "close" };
1959
1973
  const config = await loadConfig();
1960
1974
  if (sessionSignal?.aborted) return { kind: "close" };
@@ -2029,13 +2043,7 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
2029
2043
  });
2030
2044
  return { kind: result.kind === "closed" ? "close" : "stay" };
2031
2045
  },
2032
- diff: async ({ state, signal }) => {
2033
- const review = state.manager.configReview;
2034
- if (!review) return { kind: "stay" };
2035
- const intent = ctx.mode === "tui" ? { intent: "read-diff", fingerprint: review.fingerprint } : void 0;
2036
- const result = await runRoute("diff", signal, void 0, review.setupName, void 0, void 0, intent);
2037
- return { kind: signal.aborted || !isCurrent() || result?.kind === "closed" ? "close" : "stay" };
2038
- },
2046
+ diff: ({ state, signal }) => reviewDifferences(state.manager.configReview, signal),
2039
2047
  "daemon-recovery": async ({ signal }) => {
2040
2048
  await runRoute("daemon recover", signal);
2041
2049
  return { kind: "stay" };
@@ -2064,6 +2072,13 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
2064
2072
  }
2065
2073
  }
2066
2074
  });
2075
+ async function reviewDifferences(review, signal) {
2076
+ if (signal.aborted || !isCurrent()) return { kind: "close" };
2077
+ if (!review) return { kind: "stay" };
2078
+ const intent = ctx.mode === "tui" ? { intent: "read-diff", fingerprint: review.fingerprint } : void 0;
2079
+ const result = await runRoute("diff", signal, void 0, review.setupName, void 0, void 0, intent);
2080
+ return { kind: signal.aborted || !isCurrent() || result?.kind === "closed" ? "close" : "stay" };
2081
+ }
2067
2082
  async function matchesManagerReview(fingerprint, signal, settings = false) {
2068
2083
  try {
2069
2084
  const config = await (settings ? loadSettingsConfig() : loadConfig());
@@ -2138,37 +2153,44 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
2138
2153
  isCurrent
2139
2154
  });
2140
2155
  }
2141
- async function showDirectionalConflict(ctx, direction, setup, signal, isCurrent) {
2142
- let selected = false;
2156
+ async function showDirectionalConflict(ctx, direction, setup, signal, isCurrent, reviewDifferences) {
2157
+ const isPull = direction === "pull";
2158
+ let force = false;
2143
2159
  const menu = defineMenu5({
2144
2160
  start: "conflict",
2145
2161
  screens: {
2146
2162
  conflict: () => ({
2147
2163
  kind: "choice",
2148
- title: `${direction === "push" ? "Push" : "Pull"} stopped \xB7 ${safeTerminalText(setup)}`,
2164
+ title: `${isPull ? "Pull" : "Push"} stopped \xB7 ${safeTerminalText(setup)}`,
2149
2165
  lines: [
2150
- direction === "push" ? "Push would overwrite remote changes since the last accepted sync." : "Pull would overwrite local changes since the last accepted sync.",
2166
+ isPull ? "Pull would discard local differences." : "Push would discard remote differences.",
2151
2167
  "No content was written."
2152
2168
  ],
2153
2169
  items: [
2154
- { id: "back", label: "Back" },
2155
- { id: "review", label: `Review Force ${direction}\u2026` }
2170
+ { id: "diff", label: "Review differences", description: "Compare files without transferring." },
2171
+ {
2172
+ id: "force",
2173
+ label: `Force ${direction}\u2026`,
2174
+ description: `Review which ${isPull ? "local" : "remote"} files to replace or remove.`
2175
+ },
2176
+ { id: "back", label: "Back" }
2156
2177
  ],
2157
2178
  action: "choose",
2158
- initialItemId: "back",
2179
+ initialItemId: "diff",
2159
2180
  hint: ctx.mode === "rpc" ? "close" : "back"
2160
2181
  })
2161
2182
  },
2162
2183
  actions: {
2163
- choose: ({ itemId }) => {
2164
- selected = itemId === "review";
2184
+ choose: ({ itemId, signal: signal2 }) => {
2185
+ if (itemId === "diff") return reviewDifferences(signal2);
2186
+ force = itemId === "force";
2165
2187
  return { kind: "back" };
2166
2188
  }
2167
2189
  }
2168
2190
  });
2169
2191
  const result = await runMenu5(ctx, menu, { getState: () => void 0, signal, isCurrent });
2170
2192
  if (signal.aborted || !isCurrent() || result.kind !== "closed" || result.reason === "close") return "close";
2171
- return selected ? "review" : "back";
2193
+ return force ? "force" : "back";
2172
2194
  }
2173
2195
  function syncMainMenuItem(label) {
2174
2196
  const actions = {
@@ -2217,4 +2239,4 @@ function syncMainMenuItem(label) {
2217
2239
  export {
2218
2240
  showSyncManager
2219
2241
  };
2220
- //# sourceMappingURL=manager-ui-RQSZLMJ5.ts.map
2242
+ //# sourceMappingURL=manager-ui-3CQU37XY.ts.map