@narumitw/pi-sync 0.60.0 → 0.60.2

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 (206) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +11 -12
  3. package/dist/chunks/{chunk-7AC2RX4M.ts → chunk-277VHM2P.ts} +2 -2
  4. package/dist/chunks/chunk-277VHM2P.ts.map +7 -0
  5. package/dist/chunks/{chunk-4RNCZZY7.ts → chunk-3YXBG7BQ.ts} +14 -10
  6. package/dist/chunks/{chunk-4RNCZZY7.ts.map → chunk-3YXBG7BQ.ts.map} +2 -2
  7. package/dist/chunks/{chunk-UBE6XWOM.ts → chunk-6W2SNZ5P.ts} +2 -2
  8. package/dist/chunks/chunk-6W2SNZ5P.ts.map +7 -0
  9. package/dist/chunks/{chunk-UZUUUY7C.ts → chunk-B53FS4RW.ts} +4 -4
  10. package/dist/chunks/{chunk-MIXZVHFR.ts → chunk-E7UJHMNW.ts} +11 -42
  11. package/dist/chunks/chunk-E7UJHMNW.ts.map +7 -0
  12. package/dist/chunks/{chunk-JZKCOM62.ts → chunk-EMRFVLZM.ts} +2 -2
  13. package/dist/chunks/chunk-EMRFVLZM.ts.map +7 -0
  14. package/dist/chunks/{chunk-BWWTOQOW.ts → chunk-FOMZEZER.ts} +100 -53
  15. package/dist/chunks/chunk-FOMZEZER.ts.map +7 -0
  16. package/dist/chunks/{chunk-NPT2G4FU.ts → chunk-HEB6YT64.ts} +2 -2
  17. package/dist/chunks/chunk-HEB6YT64.ts.map +7 -0
  18. package/dist/chunks/{chunk-J5COV5TY.ts → chunk-HLCML3OW.ts} +2 -2
  19. package/dist/chunks/{chunk-J5COV5TY.ts.map → chunk-HLCML3OW.ts.map} +1 -1
  20. package/dist/chunks/{chunk-ZMNVNECV.ts → chunk-KPWZNMKM.ts} +2 -2
  21. package/dist/chunks/chunk-KPWZNMKM.ts.map +7 -0
  22. package/dist/chunks/{chunk-YWEYRRQI.ts → chunk-LAXTCSX4.ts} +11 -11
  23. package/dist/chunks/chunk-LAXTCSX4.ts.map +7 -0
  24. package/dist/chunks/{chunk-BGGKHHO4.ts → chunk-MCUZFUHY.ts} +7 -7
  25. package/dist/chunks/{chunk-M7RHV3H6.ts → chunk-OA4NZLSL.ts} +2 -2
  26. package/dist/chunks/chunk-OA4NZLSL.ts.map +7 -0
  27. package/dist/chunks/{chunk-CEMFCWIU.ts → chunk-RNIEVDTR.ts} +2 -2
  28. package/dist/chunks/chunk-RNIEVDTR.ts.map +7 -0
  29. package/dist/chunks/{chunk-PDBTD2K6.ts → chunk-S3R3W3KF.ts} +2 -2
  30. package/dist/chunks/chunk-S3R3W3KF.ts.map +7 -0
  31. package/dist/chunks/{chunk-CZNBKIM5.ts → chunk-SMVKMYLK.ts} +2 -2
  32. package/dist/chunks/chunk-SMVKMYLK.ts.map +7 -0
  33. package/dist/chunks/{chunk-JKBUYCPC.ts → chunk-V4AMI3VL.ts} +2 -2
  34. package/dist/chunks/chunk-V4AMI3VL.ts.map +7 -0
  35. package/dist/chunks/{chunk-VZCWYXRS.ts → chunk-WP2M67XZ.ts} +2 -2
  36. package/dist/chunks/chunk-WP2M67XZ.ts.map +7 -0
  37. package/dist/chunks/{chunk-HNKLBM3U.ts → chunk-ZIL6PW5L.ts} +2 -2
  38. package/dist/chunks/chunk-ZIL6PW5L.ts.map +7 -0
  39. package/dist/chunks/{command-handler-3O76V7Q5.ts → command-handler-RTBEFZUX.ts} +19 -19
  40. package/dist/chunks/{command-handler-3O76V7Q5.ts.map → command-handler-RTBEFZUX.ts.map} +2 -2
  41. package/dist/chunks/{conflict-review-XBSME2ER.ts → conflict-review-YXROU42F.ts} +4 -4
  42. package/dist/chunks/{continuous-record-ZHUXVO4E.ts → continuous-record-3XDXDOMV.ts} +2 -2
  43. package/dist/chunks/continuous-record-3XDXDOMV.ts.map +7 -0
  44. package/dist/chunks/continuous-storage-HLKCHF6Z.ts +27 -0
  45. package/dist/chunks/continuous-storage-HLKCHF6Z.ts.map +7 -0
  46. package/dist/chunks/{file-selection-S6CNNNQI.ts → file-selection-DD6X4J2K.ts} +6 -6
  47. package/dist/chunks/manager-result-dispatcher-4PEUHK7F.ts +18 -0
  48. package/dist/chunks/{manager-ui-SJOBTJLY.ts → manager-ui-TNAMQNEU.ts} +123 -64
  49. package/dist/chunks/manager-ui-TNAMQNEU.ts.map +7 -0
  50. package/dist/chunks/{remote-selection-ui-GZHPDQ4L.ts → remote-selection-ui-47H7V62F.ts} +8 -8
  51. package/dist/chunks/{setup-switch-M3BAFGJM.ts → setup-switch-SPZE7HIQ.ts} +8 -8
  52. package/dist/chunks/{setup-wizard-NFAWP4KF.ts → setup-wizard-5JYKAEIT.ts} +11 -11
  53. package/dist/chunks/{snapshot-D4SFDP5J.ts → snapshot-5HY3M2NL.ts} +2 -2
  54. package/dist/chunks/snapshot-5HY3M2NL.ts.map +7 -0
  55. package/dist/chunks/{snapshot-transaction-directory-TNKBQ3UQ.ts → snapshot-transaction-directory-OU2D7R7A.ts} +2 -2
  56. package/dist/chunks/snapshot-transaction-directory-OU2D7R7A.ts.map +7 -0
  57. package/dist/chunks/{state-directory-JZSZVVPX.ts → state-directory-XXHU73Z3.ts} +2 -2
  58. package/dist/chunks/{sync-inspection-BJ4KPPNO.ts → sync-inspection-5GQEB62G.ts} +5 -5
  59. package/dist/chunks/sync-inspection-5GQEB62G.ts.map +7 -0
  60. package/dist/chunks/{sync-operations-TLWER2TT.ts → sync-operations-65HDA67O.ts} +5 -5
  61. package/dist/chunks/{sync-operations-TLWER2TT.ts.map → sync-operations-65HDA67O.ts.map} +2 -2
  62. package/dist/chunks/{sync-state-FVCJJ7MY.ts → sync-state-2LMIXJ2C.ts} +2 -2
  63. package/dist/chunks/sync-state-2LMIXJ2C.ts.map +7 -0
  64. package/dist/index.ts +22 -22
  65. package/dist/index.ts.map +1 -1
  66. package/docs/daemon-migration.md +10 -6
  67. package/docs/tui-contract.md +12 -0
  68. package/package.json +2 -2
  69. package/skills/configure-pi-sync/references/configuration.md +8 -4
  70. package/src/backends/backend-factory.ts +2 -2
  71. package/src/backends/backend-identity.ts +2 -2
  72. package/src/backends/backend-types.ts +1 -1
  73. package/src/backends/git/git-backend.ts +2 -2
  74. package/src/backends/git/git-config.ts +2 -2
  75. package/src/backends/git/git-runner.ts +2 -2
  76. package/src/backends/git/git-storage.ts +2 -2
  77. package/src/backends/s3/s3-backend.ts +2 -2
  78. package/src/backends/s3/s3-client.ts +6 -2
  79. package/src/backends/s3/s3-conditions.ts +2 -2
  80. package/src/backends/snapshot-pointer.ts +2 -2
  81. package/src/backends/sync-backend.ts +2 -2
  82. package/src/backends/webdav/webdav-backend.ts +2 -2
  83. package/src/backends/webdav/webdav-client.ts +2 -2
  84. package/src/backends/webdav/webdav-config.ts +2 -2
  85. package/src/commands/command-execution.ts +1 -1
  86. package/src/commands/command.ts +1 -1
  87. package/src/daemon/apply-gate.ts +1 -1
  88. package/src/daemon/pi-client.ts +105 -54
  89. package/src/daemon/recovery.ts +1 -1
  90. package/src/paths.ts +2 -2
  91. package/src/settings/config-errors.ts +2 -2
  92. package/src/settings/config-file.ts +2 -2
  93. package/src/settings/config.ts +2 -2
  94. package/src/settings/settings-management.ts +2 -2
  95. package/src/settings/settings-store.ts +2 -2
  96. package/src/settings/settings-types.ts +1 -1
  97. package/src/settings/settings-validation.ts +2 -2
  98. package/src/snapshot/session-paths.ts +2 -2
  99. package/src/snapshot/snapshot-apply.ts +2 -2
  100. package/src/snapshot/snapshot-case-replacement.ts +2 -2
  101. package/src/snapshot/snapshot-codec.ts +2 -2
  102. package/src/snapshot/snapshot-exclude-safety.ts +2 -2
  103. package/src/snapshot/snapshot-mutation-queues.ts +2 -2
  104. package/src/snapshot/snapshot-paths.ts +2 -2
  105. package/src/snapshot/snapshot-root-transition.ts +2 -2
  106. package/src/snapshot/snapshot-transaction-directory.ts +2 -2
  107. package/src/snapshot/snapshot-transaction-plan.ts +2 -2
  108. package/src/snapshot/snapshot-transaction.ts +2 -2
  109. package/src/snapshot/snapshot-types.ts +1 -1
  110. package/src/snapshot/snapshot.ts +2 -2
  111. package/src/state/json-file.ts +2 -2
  112. package/src/state/lock-policy.ts +2 -2
  113. package/src/state/lock.ts +2 -2
  114. package/src/state/lockfile-fs.ts +2 -2
  115. package/src/state/merge-baseline-store.ts +2 -2
  116. package/src/state/mutation-directory-sync.ts +2 -2
  117. package/src/state/operation-availability.ts +2 -2
  118. package/src/state/state-directory.ts +2 -2
  119. package/src/state/state-types.ts +1 -1
  120. package/src/state/sync-state-store.ts +2 -2
  121. package/src/sync/agent-candidate.ts +2 -2
  122. package/src/sync/agent-plan.ts +2 -2
  123. package/src/sync/agent-policy.ts +2 -2
  124. package/src/sync/agent-refusal-retry.ts +2 -2
  125. package/src/sync/agent-request.ts +2 -2
  126. package/src/sync/agent-runner.ts +2 -2
  127. package/src/sync/agent-store.ts +2 -2
  128. package/src/sync/agent-sync.ts +2 -2
  129. package/src/sync/apply-review.ts +2 -2
  130. package/src/sync/conflict-artifact-ownership.ts +2 -2
  131. package/src/sync/conflict-artifacts.ts +2 -2
  132. package/src/sync/conflict-groups.ts +2 -2
  133. package/src/sync/conflict-preview.ts +2 -2
  134. package/src/sync/conflict-resolution.ts +2 -2
  135. package/src/sync/conflict-retention.ts +2 -2
  136. package/src/sync/content-conflicts.ts +2 -2
  137. package/src/sync/continuous-errors.ts +2 -2
  138. package/src/sync/continuous-lease.ts +2 -2
  139. package/src/sync/continuous-record.ts +2 -2
  140. package/src/sync/continuous-storage.ts +2 -2
  141. package/src/sync/continuous-sync.ts +2 -2
  142. package/src/sync/continuous-watch.ts +2 -2
  143. package/src/sync/exclude-policy.ts +2 -2
  144. package/src/sync/field-migration.ts +2 -2
  145. package/src/sync/file-merge-planner.ts +6 -2
  146. package/src/sync/json-document.ts +2 -2
  147. package/src/sync/local-field-policy.ts +2 -2
  148. package/src/sync/local-fields.ts +2 -2
  149. package/src/sync/merge-apply.ts +2 -2
  150. package/src/sync/merge-journal.ts +2 -2
  151. package/src/sync/merge-transfer-error.ts +2 -2
  152. package/src/sync/merged-sync.ts +2 -2
  153. package/src/sync/mutation-owner.ts +2 -2
  154. package/src/sync/package-merge.ts +2 -2
  155. package/src/sync/partial-progress.ts +2 -2
  156. package/src/sync/remote-snapshot.ts +2 -2
  157. package/src/sync/session-merge.ts +2 -2
  158. package/src/sync/settings-conflicts.ts +2 -2
  159. package/src/sync/settings-merge.ts +2 -2
  160. package/src/sync/signals.ts +2 -2
  161. package/src/sync/startup-timings.ts +2 -2
  162. package/src/sync/sync-decision.ts +2 -2
  163. package/src/sync/sync-error-guidance.ts +2 -2
  164. package/src/sync/sync-errors.ts +2 -2
  165. package/src/sync/sync-inspection.ts +2 -2
  166. package/src/sync/sync-local.ts +6 -2
  167. package/src/sync/sync-mutations.ts +2 -2
  168. package/src/sync/sync-operations.ts +1 -1
  169. package/src/sync/sync-policy.ts +2 -2
  170. package/src/sync/sync-queries.ts +2 -2
  171. package/src/sync/sync-state.ts +2 -2
  172. package/src/sync/text-merge.ts +2 -2
  173. package/src/ui/manager-state.ts +35 -23
  174. package/src/ui/manager-ui.ts +80 -36
  175. package/src/ui/sync-attention.ts +7 -49
  176. package/dist/chunks/chunk-7AC2RX4M.ts.map +0 -7
  177. package/dist/chunks/chunk-BWWTOQOW.ts.map +0 -7
  178. package/dist/chunks/chunk-CEMFCWIU.ts.map +0 -7
  179. package/dist/chunks/chunk-CZNBKIM5.ts.map +0 -7
  180. package/dist/chunks/chunk-HNKLBM3U.ts.map +0 -7
  181. package/dist/chunks/chunk-JKBUYCPC.ts.map +0 -7
  182. package/dist/chunks/chunk-JZKCOM62.ts.map +0 -7
  183. package/dist/chunks/chunk-M7RHV3H6.ts.map +0 -7
  184. package/dist/chunks/chunk-MIXZVHFR.ts.map +0 -7
  185. package/dist/chunks/chunk-NPT2G4FU.ts.map +0 -7
  186. package/dist/chunks/chunk-PDBTD2K6.ts.map +0 -7
  187. package/dist/chunks/chunk-UBE6XWOM.ts.map +0 -7
  188. package/dist/chunks/chunk-VZCWYXRS.ts.map +0 -7
  189. package/dist/chunks/chunk-YWEYRRQI.ts.map +0 -7
  190. package/dist/chunks/chunk-ZMNVNECV.ts.map +0 -7
  191. package/dist/chunks/continuous-record-ZHUXVO4E.ts.map +0 -7
  192. package/dist/chunks/manager-result-dispatcher-I2AMCCE7.ts +0 -18
  193. package/dist/chunks/manager-ui-SJOBTJLY.ts.map +0 -7
  194. package/dist/chunks/snapshot-D4SFDP5J.ts.map +0 -7
  195. package/dist/chunks/snapshot-transaction-directory-TNKBQ3UQ.ts.map +0 -7
  196. package/dist/chunks/sync-inspection-BJ4KPPNO.ts.map +0 -7
  197. package/dist/chunks/sync-state-FVCJJ7MY.ts.map +0 -7
  198. /package/dist/chunks/{chunk-UZUUUY7C.ts.map → chunk-B53FS4RW.ts.map} +0 -0
  199. /package/dist/chunks/{chunk-BGGKHHO4.ts.map → chunk-MCUZFUHY.ts.map} +0 -0
  200. /package/dist/chunks/{conflict-review-XBSME2ER.ts.map → conflict-review-YXROU42F.ts.map} +0 -0
  201. /package/dist/chunks/{file-selection-S6CNNNQI.ts.map → file-selection-DD6X4J2K.ts.map} +0 -0
  202. /package/dist/chunks/{manager-result-dispatcher-I2AMCCE7.ts.map → manager-result-dispatcher-4PEUHK7F.ts.map} +0 -0
  203. /package/dist/chunks/{remote-selection-ui-GZHPDQ4L.ts.map → remote-selection-ui-47H7V62F.ts.map} +0 -0
  204. /package/dist/chunks/{setup-switch-M3BAFGJM.ts.map → setup-switch-SPZE7HIQ.ts.map} +0 -0
  205. /package/dist/chunks/{setup-wizard-NFAWP4KF.ts.map → setup-wizard-5JYKAEIT.ts.map} +0 -0
  206. /package/dist/chunks/{state-directory-JZSZVVPX.ts.map → state-directory-XXHU73Z3.ts.map} +0 -0
@@ -2,29 +2,29 @@
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
3
  import {
4
4
  dispatchManagerResult
5
- } from "./chunk-UZUUUY7C.ts";
5
+ } from "./chunk-B53FS4RW.ts";
6
6
  import {
7
7
  captureMutationOwner,
8
8
  runCancellableOperation
9
- } from "./chunk-4RNCZZY7.ts";
9
+ } from "./chunk-3YXBG7BQ.ts";
10
10
  import {
11
11
  SETUP_SWITCH_ACTION_OPTIONS,
12
12
  saveOnSwitch,
13
13
  setupSwitchActionFromLabel,
14
14
  setupSwitchActionLabel,
15
15
  useSyncSetup
16
- } from "./chunk-BGGKHHO4.ts";
16
+ } from "./chunk-MCUZFUHY.ts";
17
17
  import {
18
18
  observationMatchesConfig,
19
19
  observationSummary,
20
20
  readStateForConfig,
21
21
  syncAttentionMatchesConfig,
22
22
  syncStateFingerprint
23
- } from "./chunk-MIXZVHFR.ts";
23
+ } from "./chunk-E7UJHMNW.ts";
24
24
  import {
25
25
  normalizeSyncExclude,
26
26
  sameSyncExclude
27
- } from "./chunk-NPT2G4FU.ts";
27
+ } from "./chunk-HEB6YT64.ts";
28
28
  import {
29
29
  confirmMergeReview
30
30
  } from "./chunk-GSQGBVKG.ts";
@@ -33,7 +33,7 @@ import {
33
33
  loadPartialConfig,
34
34
  syncCheckConfigFingerprint,
35
35
  syncConfigReviewIdentity
36
- } from "./chunk-7AC2RX4M.ts";
36
+ } from "./chunk-277VHM2P.ts";
37
37
  import {
38
38
  configureSyncStatus
39
39
  } from "./chunk-ENFHHB5O.ts";
@@ -56,44 +56,44 @@ import {
56
56
  showEditS3Target,
57
57
  showEditWebDavStorageProfile,
58
58
  showEditWebDavTarget
59
- } from "./chunk-YWEYRRQI.ts";
59
+ } from "./chunk-LAXTCSX4.ts";
60
60
  import {
61
61
  isCloudflareR2Endpoint,
62
62
  normalizeS3Endpoint,
63
63
  ownRecord
64
- } from "./chunk-M7RHV3H6.ts";
64
+ } from "./chunk-OA4NZLSL.ts";
65
65
  import {
66
66
  automaticSyncSummary,
67
67
  syncErrorGuidance
68
- } from "./chunk-ZMNVNECV.ts";
68
+ } from "./chunk-KPWZNMKM.ts";
69
69
  import {
70
70
  loadOnSwitch,
71
71
  readLocalConfigObject,
72
72
  requireSettings,
73
73
  updateLocalConfig
74
- } from "./chunk-VZCWYXRS.ts";
74
+ } from "./chunk-WP2M67XZ.ts";
75
75
  import {
76
76
  AUTOMATIC_SYNC_DESCRIPTION,
77
77
  STARTUP_TRANSFER_DESCRIPTION,
78
78
  startupTransferSummary
79
- } from "./chunk-J5COV5TY.ts";
79
+ } from "./chunk-HLCML3OW.ts";
80
80
  import {
81
81
  throwIfAborted
82
- } from "./chunk-PDBTD2K6.ts";
82
+ } from "./chunk-S3R3W3KF.ts";
83
83
  import {
84
84
  addStorageConnection,
85
85
  removeStorageConnection,
86
86
  removeSyncSetup,
87
87
  updateStorageConnection,
88
88
  updateSyncSetup
89
- } from "./chunk-JZKCOM62.ts";
89
+ } from "./chunk-EMRFVLZM.ts";
90
90
  import {
91
91
  activeLocalConfigPath,
92
92
  localConfigPath
93
- } from "./chunk-UBE6XWOM.ts";
93
+ } from "./chunk-6W2SNZ5P.ts";
94
94
  import {
95
95
  errorMessage
96
- } from "./chunk-HNKLBM3U.ts";
96
+ } from "./chunk-ZIL6PW5L.ts";
97
97
  import {
98
98
  safeTerminalText
99
99
  } from "./chunk-2JNFEZ3V.ts";
@@ -101,10 +101,10 @@ import {
101
101
  compareSyncInclude,
102
102
  syncIncludeSelection,
103
103
  syncSessionsSelected
104
- } from "./chunk-JKBUYCPC.ts";
104
+ } from "./chunk-V4AMI3VL.ts";
105
105
 
106
106
  // src/ui/manager-ui.ts
107
- import { defineMenu as defineMenu6, runMenu as runMenu6 } from "@narumitw/pi-tui-kit";
107
+ import { defineMenu as defineMenu6, runDocumentReview, runMenu as runMenu6 } from "@narumitw/pi-tui-kit";
108
108
 
109
109
  // src/state/operation-availability.ts
110
110
  import {
@@ -112,7 +112,7 @@ import {
112
112
  inspectOperationAvailability,
113
113
  operationBlocksChanges,
114
114
  operationCanRecover
115
- } from "@narumitw/sync-daemon/engine/state/operation-availability";
115
+ } from "@narumitw/pi-sync-daemon/engine/state/operation-availability";
116
116
 
117
117
  // src/ui/manager-attention.ts
118
118
  function attentionMainMenuItems(manager) {
@@ -142,7 +142,7 @@ function blockedSyncMenuItem(label, manager) {
142
142
  };
143
143
  }
144
144
  async function showManagerAttention(ctx, attention, runRoute, signal, onSelectionResolved) {
145
- const { showRemoteSelectionReview } = await import("./remote-selection-ui-GZHPDQ4L.ts");
145
+ const { showRemoteSelectionReview } = await import("./remote-selection-ui-47H7V62F.ts");
146
146
  if (signal?.aborted) return "close";
147
147
  const review = await showRemoteSelectionReview(ctx, attention.decision.setupName, signal, void 0, {
148
148
  decision: attention.decision,
@@ -469,7 +469,6 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
469
469
  const config = await loadConfig();
470
470
  const operation = await inspectOperation();
471
471
  const changesBlocked = operationBlocksChanges(operation);
472
- const selection = syncIncludeSelection(config.include);
473
472
  let currentAttention;
474
473
  if (attention) {
475
474
  try {
@@ -485,39 +484,27 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
485
484
  const noSyncedContent = config.include.length === 0;
486
485
  const syncState = changesBlocked ? void 0 : await readStateForConfig(config).catch(() => void 0);
487
486
  const currentObservation = observation && observationMatchesConfig(observation, config) && syncState && syncStateFingerprint(syncState) === observation.inspection.stateIdentity ? observation : void 0;
488
- const lastAppliedSnapshot = changesBlocked ? "Unavailable while operations are locked" : syncState?.lastAppliedSnapshot ? `${truncateToWidth(safeTerminalText(syncState.lastAppliedSnapshot), 20, "\u2026")} (application time unavailable; full ID in History)` : syncState ? "Never synced" : "Unavailable";
487
+ const lastAppliedSnapshot = changesBlocked ? "Unavailable while operations are locked" : syncState?.lastAppliedSnapshot ? `${truncateToWidth(safeTerminalText(syncState.lastAppliedSnapshot), 12, "\u2026")} \xB7 application time unavailable` : syncState ? "Never synced" : "Unavailable";
489
488
  const canSwitch = await countValidSyncSetups(configuredTargets, signal) > 1;
490
489
  const mainActions = [...MAIN_MENU_ACTIONS];
491
490
  if (config.agentMode && !noSyncedContent) mainActions.splice(1, 0, "Retry refused model result\u2026");
492
491
  if (canSwitch) mainActions.push("Switch sync setup");
493
492
  if (syncState?.unresolved?.length) mainActions.unshift("Review unresolved conflicts");
493
+ const background = changesBlocked ? [] : await backgroundSummary(config);
494
+ signal?.throwIfAborted();
494
495
  const ordinaryTitle = [
495
496
  "Manage sync",
496
- "",
497
497
  `Current sync setup: ${safeTerminalText(config.setupName)}`,
498
498
  `Storage: ${backendStorageDescription(config)}`,
499
- "CURRENT STATE",
500
- ...syncState?.unresolved?.length ? [
501
- `Unresolved: ${syncState.unresolved.length} dependency groups \xB7 choose Review unresolved conflicts`,
502
- `Last observed: ${safeTerminalText(syncState.lastObservedSnapshot ?? "unknown")}`
503
- ] : [],
499
+ ...syncState?.unresolved?.length ? [`Unresolved: ${syncState.unresolved.length} dependency groups \xB7 review needed`] : [],
504
500
  ...currentAttention ? [
505
501
  currentAttention.decision.setupName === config.setupName ? "Sync status: Review needed" : `Sync status: Review needed for setup ${safeTerminalText(currentAttention.decision.setupName)}`,
506
- attentionComparison?.remoteOnly.length === 0 && attentionComparison.localOnly.length === 0 ? attentionExclusionsDiffer ? "Synced-content exclusion rules differ." : "Only the synced-content order differs." : `Remote-only paths: ${attentionComparison?.remoteOnly.length ?? 0} \xB7 Device-only paths: ${attentionComparison?.localOnly.length ?? 0}${attentionExclusionsDiffer ? " \xB7 Exclusion rules differ." : ""}`,
507
- "Nothing has been changed."
508
- ] : currentObservation ? [
509
- `Startup check (${safeTerminalText(currentObservation.checkedAt)}): ${observationSummary(currentObservation)}`,
510
- "Check-time observation only; synchronization rechecks current content."
511
- ] : ["Remote status: Not checked"],
512
- `Included: ${selection.builtIns.length} built-in group${selection.builtIns.length === 1 ? "" : "s"} \xB7 ${selection.custom.length} extra path${selection.custom.length === 1 ? "" : "s"} \xB7 Sessions ${syncSessionsSelected(config) ? "on" : "off"}`,
513
- `Automatic sync: ${automaticSyncSummary(config.automatic)}`,
514
- `Startup transfer: ${startupTransferSummary(config)}`,
515
- `Autonomous sync: ${config.agentMode ? "On (autonomous merged sync)" : "Off"}`,
516
- ...config.continuous ? await (await import("./continuous-record-ZHUXVO4E.ts")).continuousStatusLines(config) : [],
502
+ attentionComparison?.remoteOnly.length === 0 && attentionComparison.localOnly.length === 0 ? attentionExclusionsDiffer ? "Synced-content exclusion rules differ." : "Only the synced-content order differs." : `Remote-only paths: ${attentionComparison?.remoteOnly.length ?? 0} \xB7 Device-only paths: ${attentionComparison?.localOnly.length ?? 0}${attentionExclusionsDiffer ? " \xB7 Exclusion rules differ." : ""}`
503
+ ] : currentObservation ? [`Observed ${safeTerminalText(currentObservation.checkedAt)}: ${observationSummary(currentObservation)}`] : ["Remote status: Not checked"],
517
504
  `Last applied: ${lastAppliedSnapshot}`,
518
- ...noSyncedContent ? ["", "No included content is selected. Choose included content in Settings before syncing."] : [],
519
- "",
520
- "ACTIONS \xB7 transfer, inspect, or manage"
505
+ ...config.agentMode ? ["Auto-apply: On \xB7 AI requests may incur costs"] : config.automaticTransfer || config.automatic && syncSessionsSelected(config) ? ["Automatic transfer permission: On \xB7 see Settings"] : [],
506
+ ...background,
507
+ ...noSyncedContent ? ["", "No included content is selected. Choose included content in Settings before syncing."] : []
521
508
  ];
522
509
  return {
523
510
  title: (changesBlocked ? ["Manage sync", ...operationStatusLines(operation)] : ordinaryTitle).join("\n"),
@@ -548,6 +535,26 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
548
535
  };
549
536
  }
550
537
  }
538
+ async function backgroundSummary(config) {
539
+ if (!config.continuous) return [];
540
+ if (!config.agentMode) return ["Background sync: Paused \xB7 enable Autonomous sync"];
541
+ try {
542
+ const { continuousBinding, readContinuousPrivateDocument } = await import("./continuous-storage-HLKCHF6Z.ts");
543
+ const recordApi = await import("./continuous-record-3XDXDOMV.ts");
544
+ const binding = await continuousBinding(config);
545
+ const document = await readContinuousPrivateDocument(`${binding}.json`);
546
+ if (!document) return ["Background sync: Enabled \xB7 not yet observed"];
547
+ recordApi.validateContinuousRecord(document.value, binding);
548
+ const record = document.value;
549
+ const phases = { waiting: "Waiting", syncing: "Syncing", retry: "Retry", blocked: "Blocked" };
550
+ return [
551
+ `Background sync (recorded): ${phases[record.phase]}${record.error ? ` \xB7 ${record.error}` : ""}`,
552
+ ...record.transferred === void 0 ? [] : [`Last background transfer: Success \xB7 ${new Date(record.transferred).toISOString()}`]
553
+ ];
554
+ } catch {
555
+ return ["Background sync: Unknown \xB7 open Diagnostics"];
556
+ }
557
+ }
551
558
  function operationActions(operation, noSyncedContent, canSwitch, mainActions) {
552
559
  if (operationCanRecover(operation)) {
553
560
  return ["Restore sync access\u2026 (recommended)", "History", "Help"];
@@ -614,7 +621,7 @@ import {
614
621
  sameLocalFields,
615
622
  validatePortableSnapshot,
616
623
  validateSnapshotFieldPolicy
617
- } from "@narumitw/sync-daemon/engine/sync/local-fields";
624
+ } from "@narumitw/pi-sync-daemon/engine/sync/local-fields";
618
625
 
619
626
  // src/ui/agent-mode-setting.ts
620
627
  import { isDeepStrictEqual } from "node:util";
@@ -1848,7 +1855,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
1848
1855
  },
1849
1856
  "remote-include": async ({ signal: actionSignal }) => {
1850
1857
  const reviewSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
1851
- const { showRemoteSelectionReview } = await import("./remote-selection-ui-GZHPDQ4L.ts");
1858
+ const { showRemoteSelectionReview } = await import("./remote-selection-ui-47H7V62F.ts");
1852
1859
  if (reviewSignal.aborted) return { kind: "rejected" };
1853
1860
  const review = await showRemoteSelectionReview(ctx, setupName, reviewSignal, void 0, {
1854
1861
  origin: "settings",
@@ -1924,36 +1931,46 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
1924
1931
  return false;
1925
1932
  }
1926
1933
  };
1934
+ const menuItems = (manager) => {
1935
+ const attentionItems = attentionMainMenuItems(manager);
1936
+ const managerItems = manager.actions.map((label) => blockedSyncMenuItem(label, manager) ?? syncMainMenuItem(label));
1937
+ const operationFirst = manager.operation !== void 0 && manager.operation.kind !== "free";
1938
+ return operationFirst ? [...managerItems, ...attentionItems] : [...attentionItems, ...managerItems];
1939
+ };
1927
1940
  const menu = defineMenu6({
1928
1941
  start: "main",
1929
1942
  screens: {
1930
- main: ({ state }) => {
1931
- const attentionItems = attentionMainMenuItems(state.manager);
1932
- const managerItems = state.manager.actions.map(
1933
- (label) => blockedSyncMenuItem(label, state.manager) ?? syncMainMenuItem(label)
1934
- );
1935
- const operationFirst = state.manager.operation !== void 0 && state.manager.operation.kind !== "free";
1936
- return {
1937
- kind: "actions",
1938
- title: "Manage sync",
1939
- // Frequent transfers stay visible; status is advisory and Help remains a direct route.
1940
- lines: [
1941
- ...state.manager.title.split("\n").slice(1),
1942
- "Help: /sync help \xB7 Fresh status: /sync status \xB7 Differences: /sync diff"
1943
- ],
1944
- items: operationFirst ? [...managerItems, ...attentionItems] : [...attentionItems, ...managerItems],
1945
- hint: "close"
1946
- };
1947
- }
1943
+ main: ({ state }) => ({
1944
+ kind: "choice",
1945
+ title: "Manage sync",
1946
+ lines: state.manager.title.split("\n").slice(1),
1947
+ items: menuItems(state.manager).map((item) => ({
1948
+ id: item.id,
1949
+ label: ctx.mode === "tui" && item.id === "sync" ? "Sync\u2026" : item.label,
1950
+ details: [item.description ?? "Review synced content."],
1951
+ searchText: `${item.label} ${item.description ?? ""}`,
1952
+ disabled: item.disabled,
1953
+ disabledReason: item.disabledReason
1954
+ })),
1955
+ action: "activate",
1956
+ enableSearch: true,
1957
+ viewportSize: 5,
1958
+ hint: "close"
1959
+ })
1948
1960
  },
1949
1961
  actions: {
1962
+ activate: async (invocation) => {
1963
+ const item = menuItems(invocation.state.manager).find((candidate) => candidate.id === invocation.itemId);
1964
+ if (!item || item.disabled || !("action" in item) || !item.action) return { kind: "stay" };
1965
+ return menu.actions[item.action](invocation);
1966
+ },
1950
1967
  "review-attention": async ({ state }) => {
1951
1968
  const attention = state.manager.attention;
1952
1969
  if (attention && options.getAttention?.() !== attention) return { kind: "stay" };
1953
1970
  if (!attention) {
1954
1971
  const observation = state.manager.observation;
1955
1972
  if (!observation) return { kind: "stay" };
1956
- const { showRemoteSelectionReview } = await import("./remote-selection-ui-GZHPDQ4L.ts");
1973
+ const { showRemoteSelectionReview } = await import("./remote-selection-ui-47H7V62F.ts");
1957
1974
  if (sessionSignal?.aborted) return { kind: "close" };
1958
1975
  const config = await loadConfig();
1959
1976
  if (sessionSignal?.aborted) return { kind: "close" };
@@ -2084,6 +2101,30 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
2084
2101
  const validate = captureMutationOwner(ctx, signal);
2085
2102
  const config = await loadConfig(state.manager.configReview?.setupName);
2086
2103
  validate();
2104
+ if (config.continuous) {
2105
+ const { continuousStatusLines } = await import("./continuous-record-3XDXDOMV.ts");
2106
+ validate();
2107
+ const lines = await continuousStatusLines(config);
2108
+ validate();
2109
+ const review = await runDocumentReview(ctx, {
2110
+ title: "Sync diagnostics",
2111
+ lines: [`Setup: ${safeTerminalText(config.setupName)} \xB7 local observations only`],
2112
+ content: lines.join("\n"),
2113
+ confirmation: { label: "Continue to backend checks\u2026" },
2114
+ hint: "back",
2115
+ signal,
2116
+ isCurrent
2117
+ });
2118
+ validate();
2119
+ if (review.kind === "cancelled") return { kind: review.reason === "close" ? "close" : "stay" };
2120
+ if (review.kind !== "confirmed") return { kind: "stay" };
2121
+ const current = await loadConfig();
2122
+ validate();
2123
+ if (syncCheckConfigFingerprint(config) !== syncCheckConfigFingerprint(current)) {
2124
+ ctx.ui.notify("Setup changed during diagnostics review; reopen Diagnostics.", "warning");
2125
+ return { kind: "stay" };
2126
+ }
2127
+ }
2087
2128
  const confirmed = await ctx.ui.confirm(
2088
2129
  "Run diagnostics?",
2089
2130
  `Setup: ${safeTerminalText(config.setupName)}
@@ -2226,10 +2267,28 @@ function syncMainMenuItem(label) {
2226
2267
  id: action,
2227
2268
  label,
2228
2269
  action,
2229
- description: action === "retry-refusal" ? "Transfer: confirm one fresh model request for a current cached refusal; may incur costs." : action === "doctor" ? "Manage: review backend checks before running." : action === "settings" || action === "history" || action === "switch" ? "Manage" : action === "sync" ? "Transfer: choose a safe direction or review conflicts." : action === "pull" ? "Transfer: remote \u2192 local; review writes and removals." : action === "push" ? "Transfer: local \u2192 remote active snapshot; review publication." : action === "status" || action === "diff" ? "Inspect: read current local and remote state without transferring files." : void 0
2270
+ description: {
2271
+ sync: "Merge changes on both sides.",
2272
+ "retry-refusal": "Retry model; may incur costs.",
2273
+ pull: "Remote \u2192 this device.",
2274
+ push: "This device \u2192 remote snapshot.",
2275
+ diff: "Inspect changes; no transfer.",
2276
+ status: "Check remote; no transfer.",
2277
+ settings: "Change sync settings.",
2278
+ history: "Review snapshots and rollback.",
2279
+ doctor: "Review backend diagnostics.",
2280
+ switch: "Choose another sync setup.",
2281
+ conflicts: "Review unresolved file groups.",
2282
+ recover: "Review local lock recovery.",
2283
+ refresh: "Recheck the operation lock.",
2284
+ setups: "Manage sync setups.",
2285
+ connections: "Manage storage connections.",
2286
+ help: "Read sync commands and safety.",
2287
+ init: "Configure a sync setup."
2288
+ }[action]
2230
2289
  };
2231
2290
  }
2232
2291
  export {
2233
2292
  showSyncManager
2234
2293
  };
2235
- //# sourceMappingURL=manager-ui-SJOBTJLY.ts.map
2294
+ //# sourceMappingURL=manager-ui-TNAMQNEU.ts.map