@narumitw/pi-sync 0.62.0 → 0.63.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +40 -23
  3. package/dist/chunks/{chunk-MNYRU5U5.ts → chunk-27F5W7DX.ts} +3 -2
  4. package/dist/chunks/{chunk-MNYRU5U5.ts.map → chunk-27F5W7DX.ts.map} +2 -2
  5. package/dist/chunks/{chunk-INECVQNR.ts → chunk-B5F3JLD3.ts} +6 -4
  6. package/dist/chunks/chunk-B5F3JLD3.ts.map +7 -0
  7. package/dist/chunks/chunk-CKUGCBHP.ts +114 -0
  8. package/dist/chunks/chunk-CKUGCBHP.ts.map +7 -0
  9. package/dist/chunks/chunk-EJDDRS6O.ts +17 -0
  10. package/dist/chunks/chunk-EJDDRS6O.ts.map +7 -0
  11. package/dist/chunks/{chunk-6PFZUEUG.ts → chunk-EXDWEFIJ.ts} +52 -135
  12. package/dist/chunks/chunk-EXDWEFIJ.ts.map +7 -0
  13. package/dist/chunks/{chunk-NHFGAZEC.ts → chunk-HSCAFOT5.ts} +7 -7
  14. package/dist/chunks/chunk-HSCAFOT5.ts.map +7 -0
  15. package/dist/chunks/{chunk-ZB3GNX3P.ts → chunk-LBNC5AOM.ts} +140 -13
  16. package/dist/chunks/chunk-LBNC5AOM.ts.map +7 -0
  17. package/dist/chunks/chunk-MANNB4WZ.ts +36 -0
  18. package/dist/chunks/chunk-MANNB4WZ.ts.map +7 -0
  19. package/dist/chunks/{chunk-GSQGBVKG.ts → chunk-POWOMJ7S.ts} +87 -50
  20. package/dist/chunks/chunk-POWOMJ7S.ts.map +7 -0
  21. package/dist/chunks/{chunk-PWESMTH6.ts → chunk-SXCH4Q5O.ts} +38 -20
  22. package/dist/chunks/chunk-SXCH4Q5O.ts.map +7 -0
  23. package/dist/chunks/{chunk-3E3TR3JE.ts → chunk-V76KCWHO.ts} +6 -4
  24. package/dist/chunks/{chunk-3E3TR3JE.ts.map → chunk-V76KCWHO.ts.map} +1 -1
  25. package/dist/chunks/{chunk-GSCZ4VXV.ts → chunk-VQ47JBLF.ts} +2 -2
  26. package/dist/chunks/chunk-WFBHWYI6.ts +18 -0
  27. package/dist/chunks/chunk-WFBHWYI6.ts.map +7 -0
  28. package/dist/chunks/{command-handler-6ATREPG7.ts → command-handler-GMRRFWOL.ts} +19 -36
  29. package/dist/chunks/command-handler-GMRRFWOL.ts.map +7 -0
  30. package/dist/chunks/{conflict-review-MAOGTIAI.ts → conflict-review-JWEA7DPQ.ts} +2 -2
  31. package/dist/chunks/{file-selection-QR2KZVGD.ts → file-selection-KID23GAD.ts} +15 -8
  32. package/dist/chunks/file-selection-KID23GAD.ts.map +7 -0
  33. package/dist/chunks/{manager-result-dispatcher-MC6EQOQY.ts → manager-result-dispatcher-GDB74IOP.ts} +6 -5
  34. package/dist/chunks/{manager-ui-AOFUNXAJ.ts → manager-ui-T5J5WG7T.ts} +227 -343
  35. package/dist/chunks/manager-ui-T5J5WG7T.ts.map +7 -0
  36. package/dist/chunks/{merge-review-SGDLMVS4.ts → merge-review-OQDXNTJU.ts} +2 -2
  37. package/dist/chunks/{remote-selection-ui-4BTP2OJR.ts → remote-selection-ui-GPITNEBF.ts} +5 -4
  38. package/dist/chunks/{setup-switch-Y6AMFFNK.ts → setup-switch-L54X5U5I.ts} +4 -4
  39. package/dist/chunks/{setup-wizard-5G426MOZ.ts → setup-wizard-LL6YMGUR.ts} +7 -3
  40. package/dist/chunks/{setup-wizard-5G426MOZ.ts.map → setup-wizard-LL6YMGUR.ts.map} +1 -1
  41. package/dist/chunks/{sync-inspection-ITZ6Z4DE.ts → sync-inspection-SRU6HGGK.ts} +3 -3
  42. package/dist/chunks/{sync-operations-NMVKF7SE.ts → sync-operations-UGSCONZ7.ts} +2 -2
  43. package/dist/daemon/dist/cli.js +1 -1
  44. package/dist/daemon/dist/consent.js +134 -16
  45. package/dist/daemon/dist/engine/backends/git/git-backend.js +61 -30
  46. package/dist/daemon/dist/engine/ignore/ignore-initialization.js +142 -40
  47. package/dist/daemon/dist/engine/ignore/ignore-settings.js +94 -26
  48. package/dist/daemon/dist/engine/ignore/ignore-source.js +1 -1
  49. package/dist/daemon/dist/engine/settings/config-file.js +1 -1
  50. package/dist/daemon/dist/engine/settings/config.js +71 -28
  51. package/dist/daemon/dist/engine/settings/settings-management.js +8 -2
  52. package/dist/daemon/dist/engine/snapshot/session-paths.js +7 -2
  53. package/dist/daemon/dist/engine/snapshot/snapshot-transaction-policy.js +37 -17
  54. package/dist/daemon/dist/engine/snapshot/snapshot-transaction.js +55 -13
  55. package/dist/daemon/dist/engine/sync/agent-plan.js +1 -0
  56. package/dist/daemon/dist/engine/sync/agent-sync.js +8 -1
  57. package/dist/daemon/dist/engine/sync/continuous-sync.js +32 -15
  58. package/dist/daemon/dist/engine/sync/merge-acceptance.js +29 -0
  59. package/dist/daemon/dist/engine/sync/merge-apply.js +7 -4
  60. package/dist/daemon/dist/engine/sync/merge-journal.js +33 -14
  61. package/dist/daemon/dist/engine/sync/merged-sync.js +31 -39
  62. package/dist/daemon/dist/engine/sync/remote-snapshot.js +17 -2
  63. package/dist/daemon/dist/engine/sync/session-push.js +20 -6
  64. package/dist/daemon/dist/engine/sync/sync-error-guidance.js +16 -3
  65. package/dist/daemon/dist/engine/sync/sync-mutations.js +75 -54
  66. package/dist/daemon/dist/engine/sync/sync-policy.js +28 -3
  67. package/dist/daemon/dist/engine/sync/sync-state.js +3 -8
  68. package/dist/daemon/dist/engine/sync/transfer-freshness.js +82 -0
  69. package/dist/daemon/dist/engine/ui/sync-format.js +23 -55
  70. package/dist/daemon/dist/engine/ui/transfer-review.js +3 -3
  71. package/dist/daemon/dist/engine-service.js +124 -27
  72. package/dist/daemon/dist/monitor.js +84 -32
  73. package/dist/daemon/dist/server.js +46 -5
  74. package/dist/daemon/dist/service-host.js +2 -1
  75. package/dist/daemon/package.json +1 -1
  76. package/dist/index.ts +28 -25
  77. package/dist/index.ts.map +4 -4
  78. package/docs/tui-contract.md +1 -1
  79. package/package.json +3 -3
  80. package/skills/configure-pi-sync/SKILL.md +128 -74
  81. package/skills/configure-pi-sync/references/configuration.md +115 -45
  82. package/src/commands/command-execution.ts +12 -8
  83. package/src/commands/command-types.ts +1 -0
  84. package/src/daemon/pi-client.ts +4 -2
  85. package/src/settings/config.ts +1 -0
  86. package/src/sync/automatic-sync.ts +9 -2
  87. package/src/sync/setup-switch.ts +38 -15
  88. package/src/sync/startup-check.ts +7 -4
  89. package/src/ui/excluded-paths-ui.ts +2 -2
  90. package/src/ui/file-selection.ts +7 -2
  91. package/src/ui/ignore-file-guidance.ts +7 -0
  92. package/src/ui/ignore-file-ui.ts +28 -202
  93. package/src/ui/manager-state.ts +33 -18
  94. package/src/ui/manager-ui.ts +27 -18
  95. package/src/ui/merge-review.ts +28 -1
  96. package/src/ui/remote-selection-ui.ts +51 -24
  97. package/src/ui/settings-ui.ts +132 -81
  98. package/src/ui/setup/setup-actions.ts +16 -4
  99. package/src/ui/setup/setup-prompts.ts +55 -9
  100. package/src/ui/setup/setup-switcher.ts +24 -11
  101. package/src/ui/setup/webdav-ui.ts +1 -1
  102. package/src/ui/storage-connections-ui.ts +33 -11
  103. package/src/ui/sync-confirmation.ts +67 -48
  104. package/src/ui/sync-setups-ui.ts +24 -7
  105. package/dist/chunks/chunk-6PFZUEUG.ts.map +0 -7
  106. package/dist/chunks/chunk-ECYCNZOE.ts +0 -12
  107. package/dist/chunks/chunk-ECYCNZOE.ts.map +0 -7
  108. package/dist/chunks/chunk-GSQGBVKG.ts.map +0 -7
  109. package/dist/chunks/chunk-INECVQNR.ts.map +0 -7
  110. package/dist/chunks/chunk-NHFGAZEC.ts.map +0 -7
  111. package/dist/chunks/chunk-PWESMTH6.ts.map +0 -7
  112. package/dist/chunks/chunk-ZB3GNX3P.ts.map +0 -7
  113. package/dist/chunks/command-handler-6ATREPG7.ts.map +0 -7
  114. package/dist/chunks/file-selection-QR2KZVGD.ts.map +0 -7
  115. package/dist/chunks/manager-ui-AOFUNXAJ.ts.map +0 -7
  116. /package/dist/chunks/{chunk-GSCZ4VXV.ts.map → chunk-VQ47JBLF.ts.map} +0 -0
  117. /package/dist/chunks/{conflict-review-MAOGTIAI.ts.map → conflict-review-JWEA7DPQ.ts.map} +0 -0
  118. /package/dist/chunks/{manager-result-dispatcher-MC6EQOQY.ts.map → manager-result-dispatcher-GDB74IOP.ts.map} +0 -0
  119. /package/dist/chunks/{merge-review-SGDLMVS4.ts.map → merge-review-OQDXNTJU.ts.map} +0 -0
  120. /package/dist/chunks/{remote-selection-ui-4BTP2OJR.ts.map → remote-selection-ui-GPITNEBF.ts.map} +0 -0
  121. /package/dist/chunks/{setup-switch-Y6AMFFNK.ts.map → setup-switch-L54X5U5I.ts.map} +0 -0
  122. /package/dist/chunks/{sync-inspection-ITZ6Z4DE.ts.map → sync-inspection-SRU6HGGK.ts.map} +0 -0
  123. /package/dist/chunks/{sync-operations-NMVKF7SE.ts.map → sync-operations-UGSCONZ7.ts.map} +0 -0
@@ -0,0 +1,114 @@
1
+ // @generated by scripts/build-runtime.mjs; do not edit.
2
+ // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
+
4
+ // src/ui/cancellable-operation.ts
5
+ import { BorderedLoader } from "@earendil-works/pi-coding-agent";
6
+ import { isKeyRelease, Key, matchesKey, truncateToWidth } from "@earendil-works/pi-tui";
7
+ import { formatInteractionHints, runCustomInteraction } from "@narumitw/pi-tui-kit";
8
+ async function runCancellableOperation(ctx, message, route, runRoute, options = {}) {
9
+ const result = await runCancellableTask(
10
+ ctx,
11
+ message,
12
+ (signal, onCommit, onDialog) => runRoute(route, signal, onCommit, options.target, onDialog),
13
+ options
14
+ );
15
+ return result.kind === "completed" ? result.value ?? { kind: "failed" } : result;
16
+ }
17
+ async function runCancellableTask(ctx, message, task, options = {}) {
18
+ const {
19
+ commitAware = false,
20
+ cancelAcrossDialogs = false,
21
+ cancelledMessage = "Check cancelled; no settings or files were changed.",
22
+ signal,
23
+ isCurrent = () => true
24
+ } = options;
25
+ if (signal?.aborted || !isCurrent()) return { kind: "closed" };
26
+ if (ctx.mode !== "tui") return { kind: "completed", value: await task(signal) };
27
+ let commitStarted = false;
28
+ let taskResult;
29
+ const interaction = await runCustomInteraction(ctx, {
30
+ signal,
31
+ isCurrent: () => !signal?.aborted && isCurrent(),
32
+ create: ({ tui, theme, keybindings, signal: interactionSignal, complete }) => {
33
+ const loader = new BorderedLoader(tui, theme, message, { cancellable: false });
34
+ const cancelHint = formatInteractionHints(keybindings, [
35
+ {
36
+ keys: [...keybindings.getKeys("tui.select.cancel").filter((key) => !hasControlCharacter(key)), "ctrl+c"],
37
+ label: "cancel"
38
+ }
39
+ ]);
40
+ const cancel = (data) => {
41
+ if (isKeyRelease(data)) return false;
42
+ if (!matchesKey(data, Key.ctrl("c")) && !keybindings.matches(data, "tui.select.cancel")) return false;
43
+ if (commitStarted) {
44
+ ctx.ui.notify("Applying or publishing has started and cannot be cancelled safely.", "warning");
45
+ } else complete({ cancelled: true });
46
+ return true;
47
+ };
48
+ let activeDialogs = 0;
49
+ const unsubscribe = cancelAcrossDialogs ? ctx.ui.onTerminalInput((data) => {
50
+ if (isKeyRelease(data)) return;
51
+ if (activeDialogs > 0 && !matchesKey(data, Key.ctrl("c"))) return;
52
+ return cancel(data) ? { consume: true } : void 0;
53
+ }) : void 0;
54
+ let pendingTask;
55
+ try {
56
+ pendingTask = task(
57
+ interactionSignal,
58
+ commitAware ? () => commitStarted = true : void 0,
59
+ cancelAcrossDialogs ? (active) => {
60
+ activeDialogs += active ? 1 : -1;
61
+ } : void 0
62
+ );
63
+ } catch (error) {
64
+ unsubscribe?.();
65
+ loader.dispose();
66
+ throw error;
67
+ }
68
+ const operation = pendingTask.then(
69
+ (result) => {
70
+ taskResult = result;
71
+ complete({});
72
+ },
73
+ (error) => complete({ error })
74
+ );
75
+ return {
76
+ render(width) {
77
+ if (width <= 0) return [];
78
+ const safeWidth = Math.max(1, width);
79
+ const lines = loader.render(safeWidth);
80
+ const bottomBorder = lines.at(-1);
81
+ return [
82
+ ...lines.slice(0, -1),
83
+ truncateToWidth(theme.fg("dim", cancelHint), safeWidth, ""),
84
+ ...bottomBorder === void 0 ? [] : [bottomBorder]
85
+ ];
86
+ },
87
+ invalidate: () => loader.invalidate(),
88
+ handleInput: cancel,
89
+ dispose() {
90
+ unsubscribe?.();
91
+ loader.dispose();
92
+ },
93
+ waitForPending: () => operation
94
+ };
95
+ }
96
+ });
97
+ if (interaction.kind === "error") throw interaction.error;
98
+ if (interaction.kind !== "completed") return { kind: "closed" };
99
+ if (interaction.value.cancelled) {
100
+ if (cancelledMessage) ctx.ui.notify(cancelledMessage, "info");
101
+ return { kind: "cancelled" };
102
+ }
103
+ if (interaction.value.error) throw interaction.value.error;
104
+ return { kind: "completed", value: taskResult };
105
+ }
106
+ function hasControlCharacter(value) {
107
+ return /[\u0000-\u001f\u007f-\u009f]/u.test(value);
108
+ }
109
+
110
+ export {
111
+ runCancellableOperation,
112
+ runCancellableTask
113
+ };
114
+ //# sourceMappingURL=chunk-CKUGCBHP.ts.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/ui/cancellable-operation.ts"],
4
+ "sourcesContent": ["import { BorderedLoader, type ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { isKeyRelease, Key, matchesKey, truncateToWidth } from \"@earendil-works/pi-tui\";\nimport { formatInteractionHints, runCustomInteraction } from \"@narumitw/pi-tui-kit\";\nimport type { SetupPullOutcome } from \"../sync/setup-switch.js\";\nimport type { SyncDecision } from \"../sync/sync-decision.js\";\nimport type { RemoteSelectionDecision } from \"../sync/sync-policy.js\";\n\nexport type RunRouteResult =\n | { kind: \"completed\"; outcome?: SetupPullOutcome }\n | { kind: \"decision-required\"; decision: SyncDecision }\n | { kind: \"remote-selection-required\"; decision: RemoteSelectionDecision }\n | { kind: \"failed\" };\n\nexport type RunRoute = (\n route: string,\n signal?: AbortSignal,\n onCommit?: () => void,\n target?: string,\n onDialog?: (active: boolean) => void,\n retryRefusal?: boolean,\n) => Promise<RunRouteResult | undefined>;\n\nexport type CancellableOperationResult = RunRouteResult | { kind: \"closed\" } | { kind: \"cancelled\" };\n\ninterface CancellableOperationOptions {\n commitAware?: boolean;\n cancelAcrossDialogs?: boolean;\n cancelledMessage?: string | null;\n target?: string;\n signal?: AbortSignal;\n isCurrent?: () => boolean;\n}\n\nexport async function runCancellableOperation(\n ctx: ExtensionContext,\n message: string,\n route: string,\n runRoute: RunRoute,\n options: CancellableOperationOptions = {},\n): Promise<CancellableOperationResult> {\n const result = await runCancellableTask(\n ctx,\n message,\n (signal, onCommit, onDialog) => runRoute(route, signal, onCommit, options.target, onDialog),\n options,\n );\n return result.kind === \"completed\" ? (result.value ?? { kind: \"failed\" }) : result;\n}\n\nexport type CancellableTaskResult<Value> =\n | { kind: \"completed\"; value: Value }\n | { kind: \"closed\" }\n | { kind: \"cancelled\" };\n\n/** Keep non-route work under the same cancellation and drain owner as transfers. */\nexport async function runCancellableTask<Value>(\n ctx: ExtensionContext,\n message: string,\n task: (\n signal: AbortSignal | undefined,\n onCommit?: () => void,\n onDialog?: (active: boolean) => void,\n ) => Promise<Value>,\n options: Omit<CancellableOperationOptions, \"target\"> = {},\n): Promise<CancellableTaskResult<Value>> {\n const {\n commitAware = false,\n cancelAcrossDialogs = false,\n cancelledMessage = \"Check cancelled; no settings or files were changed.\",\n signal,\n isCurrent = () => true,\n } = options;\n if (signal?.aborted || !isCurrent()) return { kind: \"closed\" };\n if (ctx.mode !== \"tui\") return { kind: \"completed\", value: await task(signal) };\n let commitStarted = false;\n let taskResult!: Value;\n const interaction = await runCustomInteraction<{ cancelled?: boolean; error?: unknown }, ExtensionContext>(ctx, {\n signal,\n isCurrent: () => !signal?.aborted && isCurrent(),\n create: ({ tui, theme, keybindings, signal: interactionSignal, complete }) => {\n const loader = new BorderedLoader(tui, theme, message, { cancellable: false });\n const cancelHint = formatInteractionHints(keybindings, [\n {\n keys: [...keybindings.getKeys(\"tui.select.cancel\").filter((key) => !hasControlCharacter(key)), \"ctrl+c\"],\n label: \"cancel\",\n },\n ]);\n const cancel = (data: string) => {\n // Raw terminal listeners run before Pi filters Kitty key releases.\n if (isKeyRelease(data)) return false;\n if (!matchesKey(data, Key.ctrl(\"c\")) && !keybindings.matches(data, \"tui.select.cancel\")) return false;\n if (commitStarted) {\n ctx.ui.notify(\"Applying or publishing has started and cannot be cancelled safely.\", \"warning\");\n } else complete({ cancelled: true });\n return true;\n };\n // Pi dialogs replace this loader and restore the normal editor. Defer\n // ordinary keys while they are open; retain raw cancellation afterward.\n // Ctrl+C remains the root flow's hard-cancel path regardless of focus.\n let activeDialogs = 0;\n const unsubscribe = cancelAcrossDialogs\n ? ctx.ui.onTerminalInput((data) => {\n if (isKeyRelease(data)) return;\n if (activeDialogs > 0 && !matchesKey(data, Key.ctrl(\"c\"))) return;\n return cancel(data) ? { consume: true } : undefined;\n })\n : undefined;\n let pendingTask: Promise<Value>;\n try {\n pendingTask = task(\n interactionSignal,\n commitAware ? () => (commitStarted = true) : undefined,\n cancelAcrossDialogs\n ? (active) => {\n activeDialogs += active ? 1 : -1;\n }\n : undefined,\n );\n } catch (error) {\n unsubscribe?.();\n loader.dispose();\n throw error;\n }\n const operation = pendingTask.then(\n (result) => {\n taskResult = result;\n complete({});\n },\n (error: unknown) => complete({ error }),\n );\n return {\n render(width: number) {\n if (width <= 0) return [];\n const safeWidth = Math.max(1, width);\n const lines = loader.render(safeWidth);\n const bottomBorder = lines.at(-1);\n return [\n ...lines.slice(0, -1),\n truncateToWidth(theme.fg(\"dim\", cancelHint), safeWidth, \"\"),\n ...(bottomBorder === undefined ? [] : [bottomBorder]),\n ];\n },\n invalidate: () => loader.invalidate(),\n handleInput: cancel,\n dispose() {\n unsubscribe?.();\n loader.dispose();\n },\n waitForPending: () => operation,\n };\n },\n });\n if (interaction.kind === \"error\") throw interaction.error;\n if (interaction.kind !== \"completed\") return { kind: \"closed\" };\n if (interaction.value.cancelled) {\n if (cancelledMessage) ctx.ui.notify(cancelledMessage, \"info\");\n return { kind: \"cancelled\" };\n }\n if (interaction.value.error) throw interaction.value.error;\n return { kind: \"completed\", value: taskResult };\n}\n\nfunction hasControlCharacter(value: string) {\n // biome-ignore lint/suspicious/noControlCharactersInRegex: Unsafe key labels must be omitted.\n return /[\\u0000-\\u001f\\u007f-\\u009f]/u.test(value);\n}\n"],
5
+ "mappings": ";;;;AAAA,SAAS,sBAA6C;AACtD,SAAS,cAAc,KAAK,YAAY,uBAAuB;AAC/D,SAAS,wBAAwB,4BAA4B;AA+B7D,eAAsB,wBACpB,KACA,SACA,OACA,UACA,UAAuC,CAAC,GACH;AACrC,QAAM,SAAS,MAAM;AAAA,IACnB;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,UAAU,aAAa,SAAS,OAAO,QAAQ,UAAU,QAAQ,QAAQ,QAAQ;AAAA,IAC1F;AAAA,EACF;AACA,SAAO,OAAO,SAAS,cAAe,OAAO,SAAS,EAAE,MAAM,SAAS,IAAK;AAC9E;AAQA,eAAsB,mBACpB,KACA,SACA,MAKA,UAAuD,CAAC,GACjB;AACvC,QAAM;AAAA,IACJ,cAAc;AAAA,IACd,sBAAsB;AAAA,IACtB,mBAAmB;AAAA,IACnB;AAAA,IACA,YAAY,MAAM;AAAA,EACpB,IAAI;AACJ,MAAI,QAAQ,WAAW,CAAC,UAAU,EAAG,QAAO,EAAE,MAAM,SAAS;AAC7D,MAAI,IAAI,SAAS,MAAO,QAAO,EAAE,MAAM,aAAa,OAAO,MAAM,KAAK,MAAM,EAAE;AAC9E,MAAI,gBAAgB;AACpB,MAAI;AACJ,QAAM,cAAc,MAAM,qBAAiF,KAAK;AAAA,IAC9G;AAAA,IACA,WAAW,MAAM,CAAC,QAAQ,WAAW,UAAU;AAAA,IAC/C,QAAQ,CAAC,EAAE,KAAK,OAAO,aAAa,QAAQ,mBAAmB,SAAS,MAAM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AAC;AAAA,MACxC;AACA,aAAO;AAAA,QACL,OAAO,OAAe;AACpB,cAAI,SAAS,EAAG,QAAO,CAAC;AACxB,gBAAM,YAAY,KAAK,IAAI,GAAG,KAAK;AACnC,gBAAM,QAAQ,OAAO,OAAO,SAAS;AACrC,gBAAM,eAAe,MAAM,GAAG,EAAE;AAChC,iBAAO;AAAA,YACL,GAAG,MAAM,MAAM,GAAG,EAAE;AAAA,YACpB,gBAAgB,MAAM,GAAG,OAAO,UAAU,GAAG,WAAW,EAAE;AAAA,YAC1D,GAAI,iBAAiB,SAAY,CAAC,IAAI,CAAC,YAAY;AAAA,UACrD;AAAA,QACF;AAAA,QACA,YAAY,MAAM,OAAO,WAAW;AAAA,QACpC,aAAa;AAAA,QACb,UAAU;AACR,wBAAc;AACd,iBAAO,QAAQ;AAAA,QACjB;AAAA,QACA,gBAAgB,MAAM;AAAA,MACxB;AAAA,IACF;AAAA,EACF,CAAC;AACD,MAAI,YAAY,SAAS,QAAS,OAAM,YAAY;AACpD,MAAI,YAAY,SAAS,YAAa,QAAO,EAAE,MAAM,SAAS;AAC9D,MAAI,YAAY,MAAM,WAAW;AAC/B,QAAI,iBAAkB,KAAI,GAAG,OAAO,kBAAkB,MAAM;AAC5D,WAAO,EAAE,MAAM,YAAY;AAAA,EAC7B;AACA,MAAI,YAAY,MAAM,MAAO,OAAM,YAAY,MAAM;AACrD,SAAO,EAAE,MAAM,aAAa,OAAO,WAAW;AAChD;AAEA,SAAS,oBAAoB,OAAe;AAE1C,SAAO,gCAAgC,KAAK,KAAK;AACnD;",
6
+ "names": []
7
+ }
@@ -0,0 +1,17 @@
1
+ // @generated by scripts/build-runtime.mjs; do not edit.
2
+ // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
+ import {
4
+ safeTerminalText
5
+ } from "./chunk-2JNFEZ3V.ts";
6
+
7
+ // src/ui/ignore-file-guidance.ts
8
+ import { resolve } from "node:path";
9
+ import { getAgentDir } from "@earendil-works/pi-coding-agent";
10
+ function manualIgnoreFileGuidance(filename) {
11
+ return `Edit existing ignore rules manually: ${safeTerminalText(resolve(getAgentDir(), filename))}. Edits apply to every setup using this local file on its next sync; they do not rewrite remote history.`;
12
+ }
13
+
14
+ export {
15
+ manualIgnoreFileGuidance
16
+ };
17
+ //# sourceMappingURL=chunk-EJDDRS6O.ts.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/ui/ignore-file-guidance.ts"],
4
+ "sourcesContent": ["import { resolve } from \"node:path\";\nimport { getAgentDir } from \"@earendil-works/pi-coding-agent\";\nimport { safeTerminalText } from \"./terminal-text.js\";\n\nexport function manualIgnoreFileGuidance(filename: string) {\n return `Edit existing ignore rules manually: ${safeTerminalText(resolve(getAgentDir(), filename))}. Edits apply to every setup using this local file on its next sync; they do not rewrite remote history.`;\n}\n"],
5
+ "mappings": ";;;;;;;AAAA,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAGrB,SAAS,yBAAyB,UAAkB;AACzD,SAAO,wCAAwC,iBAAiB,QAAQ,YAAY,GAAG,QAAQ,CAAC,CAAC;AACnG;",
6
+ "names": []
7
+ }
@@ -1,23 +1,27 @@
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
+ runCancellableOperation,
5
+ runCancellableTask
6
+ } from "./chunk-CKUGCBHP.ts";
3
7
  import {
4
8
  throwIfAborted
5
9
  } from "./chunk-UMPA5S7X.ts";
6
- import {
7
- captureMutationOwner
8
- } from "./chunk-GELYN4UC.ts";
9
10
  import {
10
11
  SyncSetupReviewChangedError,
11
12
  updateSyncSetup
12
13
  } from "./chunk-NXWHPVXR.ts";
14
+ import {
15
+ captureMutationOwner
16
+ } from "./chunk-GELYN4UC.ts";
13
17
  import {
14
18
  sameSyncExclude
15
19
  } from "./chunk-ZO52JM4H.ts";
16
20
  import {
17
21
  loadConfig,
18
- syncCheckConfigFingerprint,
19
- syncConfigReviewFingerprint
20
- } from "./chunk-MNYRU5U5.ts";
22
+ syncConfigReviewFingerprint,
23
+ syncSettingsConfigFingerprint
24
+ } from "./chunk-27F5W7DX.ts";
21
25
  import {
22
26
  setSyncStatus
23
27
  } from "./chunk-H7VOTY5N.ts";
@@ -25,6 +29,7 @@ import {
25
29
  errorMessage
26
30
  } from "./chunk-6YKOHBSC.ts";
27
31
  import {
32
+ RemoteSelectionMismatchError,
28
33
  compareSyncInclude,
29
34
  inspectRemoteSelection,
30
35
  sameSyncInclude,
@@ -48,112 +53,6 @@ import {
48
53
  requireCompatibleRemoteSelection
49
54
  } from "#pi-sync-daemon/engine/sync/remote-snapshot";
50
55
 
51
- // src/ui/cancellable-operation.ts
52
- import { BorderedLoader } from "@earendil-works/pi-coding-agent";
53
- import { isKeyRelease, Key, matchesKey, truncateToWidth } from "@earendil-works/pi-tui";
54
- import { formatInteractionHints, runCustomInteraction } from "@narumitw/pi-tui-kit";
55
- async function runCancellableOperation(ctx, message, route, runRoute, options = {}) {
56
- const result = await runCancellableTask(
57
- ctx,
58
- message,
59
- (signal, onCommit, onDialog) => runRoute(route, signal, onCommit, options.target, onDialog),
60
- options
61
- );
62
- return result.kind === "completed" ? result.value ?? { kind: "failed" } : result;
63
- }
64
- async function runCancellableTask(ctx, message, task, options = {}) {
65
- const {
66
- commitAware = false,
67
- cancelAcrossDialogs = false,
68
- cancelledMessage = "Check cancelled; no settings or files were changed.",
69
- signal,
70
- isCurrent = () => true
71
- } = options;
72
- if (signal?.aborted || !isCurrent()) return { kind: "closed" };
73
- if (ctx.mode !== "tui") return { kind: "completed", value: await task(signal) };
74
- let commitStarted = false;
75
- let taskResult;
76
- const interaction = await runCustomInteraction(ctx, {
77
- signal,
78
- isCurrent: () => !signal?.aborted && isCurrent(),
79
- create: ({ tui, theme, keybindings, signal: interactionSignal, complete }) => {
80
- const loader = new BorderedLoader(tui, theme, message, { cancellable: false });
81
- const cancelHint = formatInteractionHints(keybindings, [
82
- {
83
- keys: [...keybindings.getKeys("tui.select.cancel").filter((key) => !hasControlCharacter(key)), "ctrl+c"],
84
- label: "cancel"
85
- }
86
- ]);
87
- const cancel = (data) => {
88
- if (isKeyRelease(data)) return false;
89
- if (!matchesKey(data, Key.ctrl("c")) && !keybindings.matches(data, "tui.select.cancel")) return false;
90
- if (commitStarted) {
91
- ctx.ui.notify("Applying or publishing has started and cannot be cancelled safely.", "warning");
92
- } else complete({ cancelled: true });
93
- return true;
94
- };
95
- let activeDialogs = 0;
96
- const unsubscribe = cancelAcrossDialogs ? ctx.ui.onTerminalInput((data) => {
97
- if (isKeyRelease(data)) return;
98
- if (activeDialogs > 0 && !matchesKey(data, Key.ctrl("c"))) return;
99
- return cancel(data) ? { consume: true } : void 0;
100
- }) : void 0;
101
- let pendingTask;
102
- try {
103
- pendingTask = task(
104
- interactionSignal,
105
- commitAware ? () => commitStarted = true : void 0,
106
- cancelAcrossDialogs ? (active) => {
107
- activeDialogs += active ? 1 : -1;
108
- } : void 0
109
- );
110
- } catch (error) {
111
- unsubscribe?.();
112
- loader.dispose();
113
- throw error;
114
- }
115
- const operation = pendingTask.then(
116
- (result) => {
117
- taskResult = result;
118
- complete({});
119
- },
120
- (error) => complete({ error })
121
- );
122
- return {
123
- render(width) {
124
- if (width <= 0) return [];
125
- const safeWidth = Math.max(1, width);
126
- const lines = loader.render(safeWidth);
127
- const bottomBorder = lines.at(-1);
128
- return [
129
- ...lines.slice(0, -1),
130
- truncateToWidth(theme.fg("dim", cancelHint), safeWidth, ""),
131
- ...bottomBorder === void 0 ? [] : [bottomBorder]
132
- ];
133
- },
134
- invalidate: () => loader.invalidate(),
135
- handleInput: cancel,
136
- dispose() {
137
- unsubscribe?.();
138
- loader.dispose();
139
- },
140
- waitForPending: () => operation
141
- };
142
- }
143
- });
144
- if (interaction.kind === "error") throw interaction.error;
145
- if (interaction.kind !== "completed") return { kind: "closed" };
146
- if (interaction.value.cancelled) {
147
- if (cancelledMessage) ctx.ui.notify(cancelledMessage, "info");
148
- return { kind: "cancelled" };
149
- }
150
- if (interaction.value.error) throw interaction.value.error;
151
- return { kind: "completed", value: taskResult };
152
- }
153
- function hasControlCharacter(value) {
154
- return /[\u0000-\u001f\u007f-\u009f]/u.test(value);
155
- }
156
-
157
56
  // src/ui/remote-selection-ui.ts
158
57
  async function showRemoteSelectionReview(ctx, setupName, signal, factory = createSyncBackend, options = {}) {
159
58
  const validateOwner = captureMutationOwner(ctx, signal);
@@ -173,26 +72,31 @@ async function showRemoteSelectionReview(ctx, setupName, signal, factory = creat
173
72
  validateOwner();
174
73
  const inspected = inspection.value;
175
74
  if (!inspected) return { kind: "stale" };
176
- if (inspected.kind === "empty" || inspected.state.kind !== "different") {
75
+ if (inspected.kind === "empty" || inspected.kind === "selection" && inspected.state.kind !== "different") {
177
76
  options.onSelectionResolved?.();
178
77
  }
179
78
  if (inspected.kind === "empty") {
180
79
  ctx.ui.notify("Remote storage has no snapshot or synced-content list yet.", "info");
181
80
  return { kind: "back" };
182
81
  }
183
- if (inspected.state.kind === "same") {
184
- ctx.ui.notify("Remote synced content already matches this sync setup.", "info");
82
+ if (inspected.kind === "decision") {
83
+ decision = inspected.decision;
84
+ } else if (inspected.state.kind === "same") {
85
+ ctx.ui.notify(
86
+ inspected.state.ignorePolicyComparison === "match" ? "Remote ignore-file policy matches this device." : "Remote synced content already matches this sync setup.",
87
+ "info"
88
+ );
185
89
  return { kind: "back" };
186
- }
187
- if (inspected.state.kind === "legacy") {
90
+ } else if (inspected.state.kind === "legacy") {
188
91
  if (ctx.mode !== "tui") {
189
92
  ctx.ui.notify(formatLegacySummary(inspected.config, inspected.state.discovered), "info");
190
93
  return { kind: "back" };
191
94
  }
192
95
  await showLegacyDiscovery(ctx, inspected.config, inspected.state.discovered, signal);
193
96
  return signal?.aborted ? { kind: "stale" } : { kind: "back" };
97
+ } else {
98
+ decision = decisionFromState(inspected.config, inspected.state);
194
99
  }
195
- decision = decisionFromState(inspected.config, inspected.state);
196
100
  }
197
101
  if (ctx.mode !== "tui") {
198
102
  ctx.ui.notify(formatRemoteSelectionSummary(decision), "warning");
@@ -231,6 +135,10 @@ async function showRemoteSelectionReview(ctx, setupName, signal, factory = creat
231
135
  ctx.ui.notify("Remote storage no longer has a snapshot or synced-content list.", "warning");
232
136
  return { kind: "back" };
233
137
  }
138
+ if (refreshed.kind === "decision") {
139
+ currentDecision = refreshed.decision;
140
+ continue;
141
+ }
234
142
  if (refreshed.state.kind !== "different") {
235
143
  ctx.ui.notify(
236
144
  refreshed.state.kind === "same" ? "Remote synced content now matches this sync setup." : "The refreshed legacy snapshot has no authoritative synced-content list.",
@@ -270,7 +178,7 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
270
178
  description: state.decision.ignorePolicyComparison ? "Compare published policy information without adopting rules." : "Compare exact remote-only, device-only, and ordered lists.",
271
179
  to: "review"
272
180
  },
273
- ...adoptionUnavailable(state.decision) ? [] : [
181
+ ...options.readOnly || adoptionUnavailable(state.decision) ? [] : [
274
182
  {
275
183
  id: "adopt",
276
184
  label: "Use remote content list",
@@ -278,7 +186,7 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
278
186
  action: "adopt"
279
187
  }
280
188
  ],
281
- ...!canPublishLocalPolicy(state.decision) ? [] : [
189
+ ...options.readOnly || !canPublishLocalPolicy(state.decision) ? [] : [
282
190
  {
283
191
  id: "keep",
284
192
  label: state.decision.ignorePolicyComparison ? "Review publishing this device's policy\u2026" : "Keep this device's content list and update remote\u2026",
@@ -322,6 +230,7 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
322
230
  },
323
231
  actions: {
324
232
  adopt: async ({ state, signal: actionSignal }) => {
233
+ if (options.readOnly) return { kind: "rejected" };
325
234
  const signal = combineSignals(sessionSignal, actionSignal);
326
235
  try {
327
236
  const adoption = await runCancellableTask(
@@ -386,7 +295,7 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
386
295
  if (adoption.kind === "cancelled" || !adoption.value) return { kind: "stay" };
387
296
  validateOwner();
388
297
  options.onSelectionResolved?.();
389
- continuationFingerprint = syncCheckConfigFingerprint({
298
+ continuationFingerprint = syncSettingsConfigFingerprint({
390
299
  ...adoption.value.config,
391
300
  include: [...state.decision.remoteInclude],
392
301
  exclude: adoptedExclude(state.decision),
@@ -406,6 +315,7 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
406
315
  }
407
316
  },
408
317
  keep: async ({ state, signal: actionSignal }) => {
318
+ if (options.readOnly) return { kind: "rejected" };
409
319
  if (!canPublishLocalPolicy(state.decision)) return { kind: "stay" };
410
320
  if (!runRoute) {
411
321
  ctx.ui.notify("The reviewed update-remote route is unavailable.", "error");
@@ -444,13 +354,14 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
444
354
  }
445
355
  },
446
356
  continue: async ({ state, signal: actionSignal }) => {
357
+ if (options.readOnly) return { kind: "rejected" };
447
358
  if (!runRoute || !continuationFingerprint) return { kind: "stay" };
448
359
  const signal = combineSignals(sessionSignal, actionSignal);
449
360
  try {
450
361
  const latest = await loadConfig(state.decision.setupName);
451
362
  if (signal.aborted) return { kind: "close" };
452
363
  validateOwner();
453
- if (syncCheckConfigFingerprint(latest) !== continuationFingerprint) {
364
+ if (syncSettingsConfigFingerprint(latest) !== continuationFingerprint) {
454
365
  throw new StaleRemoteSelectionReviewError(
455
366
  `Sync setup \u201C${safeTerminalText(state.decision.setupName)}\u201D changed after the remote content list was saved.`
456
367
  );
@@ -570,7 +481,7 @@ async function revalidateAndAdopt(review, decision, signal, validateOwner) {
570
481
  };
571
482
  },
572
483
  {
573
- expectedConfigFingerprint: syncCheckConfigFingerprint(review.config),
484
+ expectedConfigFingerprint: syncSettingsConfigFingerprint(review.config),
574
485
  expectedInclude: decision.localInclude,
575
486
  upgradeExclude: adoptedExclude(decision) !== void 0,
576
487
  signal
@@ -589,14 +500,21 @@ async function inspectConfiguredRemoteSelection(ctx, setupName, signal, factory,
589
500
  if (signal?.aborted) return void 0;
590
501
  validateOwner();
591
502
  if (!head) return { kind: "empty", config };
592
- const snapshot = await readSnapshotForHead(backend, head, signal);
593
- if (signal?.aborted) return void 0;
594
- validateOwner();
595
- return {
596
- kind: "selection",
597
- config,
598
- state: inspectRemoteSelection(config.include, snapshot, config.exclude, config)
599
- };
503
+ try {
504
+ const snapshot = await readSnapshotForHead(backend, head, signal, config);
505
+ if (signal?.aborted) return void 0;
506
+ validateOwner();
507
+ return {
508
+ kind: "selection",
509
+ config,
510
+ state: inspectRemoteSelection(config.include, snapshot, config.exclude, config)
511
+ };
512
+ } catch (error) {
513
+ if (signal?.aborted) return void 0;
514
+ validateOwner();
515
+ if (error instanceof RemoteSelectionMismatchError) return { kind: "decision", decision: error.decision };
516
+ throw error;
517
+ }
600
518
  }
601
519
  async function showLegacyDiscovery(ctx, config, discovered, signal) {
602
520
  const menu = defineMenu({
@@ -681,7 +599,8 @@ function selectionSummaryLines(decision) {
681
599
  return [
682
600
  `Sync setup: ${safeTerminalText(decision.setupName)}`,
683
601
  adoptionUnavailable(decision) ?? "Nothing changed.",
684
- decision.ignorePolicyComparison === "local-legacy-remote-ignore" ? "The remote uses an ignore policy. Migrate and review your local setup before transferring." : "Review a fresh push before publishing this device's policy. No files or settings have changed."
602
+ ...decision.ignorePolicyComparison === "local-legacy-remote-ignore" ? ["The remote uses an ignore-file policy; this device uses a legacy policy."] : decision.ignorePolicyComparison === "local-ignore-remote-legacy" ? ["This device uses an ignore-file policy; the remote uses a legacy policy."] : ["The ordered rules or session opt-in differ."],
603
+ "No files or settings have changed."
685
604
  ];
686
605
  }
687
606
  const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);
@@ -811,8 +730,6 @@ function combineSignals(sessionSignal, actionSignal) {
811
730
  }
812
731
 
813
732
  export {
814
- runCancellableOperation,
815
- runCancellableTask,
816
733
  showRemoteSelectionReview
817
734
  };
818
- //# sourceMappingURL=chunk-6PFZUEUG.ts.map
735
+ //# sourceMappingURL=chunk-EXDWEFIJ.ts.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/ui/remote-selection-ui.ts", "../../src/backends/backend-factory.ts", "../../src/sync/remote-snapshot.ts"],
4
+ "sourcesContent": ["import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { defineMenu, runMenu } from \"@narumitw/pi-tui-kit\";\nimport { createSyncBackend, type SyncBackendFactory } from \"../backends/backend-factory.js\";\nimport type { RemoteHead, SyncBackend } from \"../backends/sync-backend.js\";\nimport { loadConfig, syncConfigReviewFingerprint, syncSettingsConfigFingerprint } from \"../settings/config.js\";\nimport { SyncSetupReviewChangedError, updateSyncSetup } from \"../settings/settings-management.js\";\nimport type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport { sameSyncExclude } from \"../sync/exclude-policy.js\";\nimport { readSnapshotForHead } from \"../sync/remote-snapshot.js\";\nimport { throwIfAborted } from \"../sync/signals.js\";\nimport { errorMessage } from \"../sync/sync-errors.js\";\nimport { captureMutationOwner } from \"../sync/sync-local.js\";\nimport {\n compareSyncInclude,\n inspectRemoteSelection,\n type RemoteSelectionDecision,\n RemoteSelectionMismatchError,\n type RemoteSelectionState,\n sameSyncInclude,\n syncDirectoryPolicyKey,\n} from \"../sync/sync-policy.js\";\nimport {\n type RunRoute,\n type RunRouteResult,\n runCancellableOperation,\n runCancellableTask,\n} from \"./cancellable-operation.js\";\nimport { setSyncStatus } from \"./sync-status.js\";\nimport { safeTerminalText } from \"./terminal-text.js\";\n\nexport type RemoteSelectionOrigin = \"settings\" | \"sync\" | \"pull\" | \"push\";\n\nexport interface RemoteSelectionReviewOptions {\n decision?: RemoteSelectionDecision;\n origin?: RemoteSelectionOrigin;\n runRoute?: RunRoute;\n readOnly?: boolean;\n cancelLabel?: string;\n /** The explicit mismatch is resolved or superseded; this does not imply file equality. */\n onSelectionResolved?: () => void;\n withStateAccess?: <T>(task: () => Promise<T>) => Promise<T>;\n}\n\nexport type RemoteSelectionReviewResult =\n | { kind: \"back\" }\n | { kind: \"closed\" }\n | { kind: \"done\" }\n | { kind: \"stale\" }\n | { kind: \"route-result\"; result: RunRouteResult; route: \"sync\" | \"pull\" | \"push\" };\n\nexport async function showRemoteSelectionReview(\n ctx: ExtensionContext,\n setupName?: string,\n signal?: AbortSignal,\n factory: SyncBackendFactory = createSyncBackend,\n options: RemoteSelectionReviewOptions = {},\n): Promise<RemoteSelectionReviewResult> {\n const validateOwner = captureMutationOwner(ctx, signal);\n const isCurrent = () => isReviewOwnerCurrent(validateOwner);\n try {\n validateOwner();\n let decision = options.decision;\n if (!decision) {\n const inspection = await runCancellableTask(\n ctx,\n \"Checking remote content list\u2026\",\n (workSignal) => inspectConfiguredRemoteSelection(ctx, setupName, workSignal, factory, validateOwner),\n { signal, isCurrent, cancelledMessage: null },\n );\n if (!isCurrent()) return { kind: \"stale\" };\n if (inspection.kind !== \"completed\") return { kind: inspection.kind === \"cancelled\" ? \"back\" : \"closed\" };\n validateOwner();\n const inspected = inspection.value;\n if (!inspected) return { kind: \"stale\" };\n // A successful fresh read can supersede an old explicit mismatch without\n // changing local settings. This is not user cancellation or proof of file equality.\n if (inspected.kind === \"empty\" || (inspected.kind === \"selection\" && inspected.state.kind !== \"different\")) {\n options.onSelectionResolved?.();\n }\n if (inspected.kind === \"empty\") {\n ctx.ui.notify(\"Remote storage has no snapshot or synced-content list yet.\", \"info\");\n return { kind: \"back\" };\n }\n if (inspected.kind === \"decision\") {\n decision = inspected.decision;\n } else if (inspected.state.kind === \"same\") {\n ctx.ui.notify(\n inspected.state.ignorePolicyComparison === \"match\"\n ? \"Remote ignore-file policy matches this device.\"\n : \"Remote synced content already matches this sync setup.\",\n \"info\",\n );\n return { kind: \"back\" };\n } else if (inspected.state.kind === \"legacy\") {\n if (ctx.mode !== \"tui\") {\n ctx.ui.notify(formatLegacySummary(inspected.config, inspected.state.discovered), \"info\");\n return { kind: \"back\" };\n }\n await showLegacyDiscovery(ctx, inspected.config, inspected.state.discovered, signal);\n return signal?.aborted ? { kind: \"stale\" } : { kind: \"back\" };\n } else {\n decision = decisionFromState(inspected.config, inspected.state);\n }\n }\n\n if (ctx.mode !== \"tui\") {\n ctx.ui.notify(formatRemoteSelectionSummary(decision), \"warning\");\n return { kind: \"back\" };\n }\n\n let currentDecision = decision;\n for (;;) {\n if (signal?.aborted) return { kind: \"stale\" };\n const result = await showSelectionDifference(\n ctx,\n currentDecision,\n options.origin ?? \"settings\",\n options.runRoute,\n signal,\n factory,\n options,\n validateOwner,\n );\n if (result.kind !== \"refresh\") return result;\n const refresh = await runCancellableTask(\n ctx,\n \"Refreshing remote content list\u2026\",\n (workSignal) =>\n runWithOptionalStateAccess(options, () =>\n inspectConfiguredRemoteSelection(ctx, currentDecision.setupName, workSignal, factory, validateOwner),\n ),\n { signal, isCurrent, cancelledMessage: null },\n );\n if (!isCurrent()) return { kind: \"stale\" };\n if (refresh.kind !== \"completed\") return { kind: refresh.kind === \"cancelled\" ? \"back\" : \"closed\" };\n validateOwner();\n const refreshed = refresh.value;\n if (!refreshed) return { kind: \"stale\" };\n if (refreshed.kind === \"empty\") {\n options.onSelectionResolved?.();\n ctx.ui.notify(\"Remote storage no longer has a snapshot or synced-content list.\", \"warning\");\n return { kind: \"back\" };\n }\n if (refreshed.kind === \"decision\") {\n currentDecision = refreshed.decision;\n continue;\n }\n if (refreshed.state.kind !== \"different\") {\n ctx.ui.notify(\n refreshed.state.kind === \"same\"\n ? \"Remote synced content now matches this sync setup.\"\n : \"The refreshed legacy snapshot has no authoritative synced-content list.\",\n \"info\",\n );\n options.onSelectionResolved?.();\n return { kind: \"done\" };\n }\n currentDecision = decisionFromState(refreshed.config, refreshed.state);\n }\n } catch (error) {\n if (!isCurrent()) return { kind: \"stale\" };\n ctx.ui.notify(`Could not review synced content: ${errorMessage(error)}`, \"error\");\n return { kind: \"back\" };\n } finally {\n if (isCurrent()) setSyncStatus(ctx, undefined);\n }\n}\n\ntype DifferenceFlowResult = RemoteSelectionReviewResult | { kind: \"refresh\" };\n\nasync function showSelectionDifference(\n ctx: ExtensionContext,\n initialDecision: RemoteSelectionDecision,\n origin: RemoteSelectionOrigin,\n runRoute: RunRoute | undefined,\n sessionSignal: AbortSignal | undefined,\n factory: SyncBackendFactory,\n options: Pick<RemoteSelectionReviewOptions, \"readOnly\" | \"cancelLabel\" | \"onSelectionResolved\" | \"withStateAccess\">,\n validateOwner: () => void,\n): Promise<DifferenceFlowResult> {\n type Screen = \"choice\" | \"review\" | \"saved\";\n type Action = \"adopt\" | \"keep\" | \"cancel\" | \"continue\" | \"done\";\n interface FlowState {\n decision: RemoteSelectionDecision;\n saved: boolean;\n }\n const isCurrent = () => isReviewOwnerCurrent(validateOwner);\n let flowState: FlowState = { decision: initialDecision, saved: false };\n let continuationFingerprint: string | undefined;\n let nextResult: RemoteSelectionReviewResult | undefined;\n let refreshRequested = false;\n const route = origin === \"settings\" ? \"sync\" : origin;\n const menu = defineMenu<FlowState, Screen, Action, ExtensionContext>({\n start: \"choice\",\n screens: {\n choice: ({ state }) => ({\n kind: \"actions\",\n title: \"Synced content differs\",\n lines: selectionSummaryLines(state.decision),\n items: [\n {\n id: \"review\",\n label: state.decision.ignorePolicyComparison\n ? \"Review policy difference\"\n : \"Review all paths (recommended)\",\n description: state.decision.ignorePolicyComparison\n ? \"Compare published policy information without adopting rules.\"\n : \"Compare exact remote-only, device-only, and ordered lists.\",\n to: \"review\",\n },\n ...(options.readOnly || adoptionUnavailable(state.decision)\n ? []\n : [\n {\n id: \"adopt\",\n label: \"Use remote content list\",\n description: \"Save the reviewed rules on this device without pulling files.\",\n action: \"adopt\" as const,\n },\n ]),\n ...(options.readOnly || !canPublishLocalPolicy(state.decision)\n ? []\n : [\n {\n id: \"keep\",\n label: state.decision.ignorePolicyComparison\n ? \"Review publishing this device's policy\u2026\"\n : \"Keep this device's content list and update remote\u2026\",\n description: \"Open the existing exact force-push preview without skipping confirmation.\",\n action: \"keep\" as const,\n },\n ]),\n { id: \"cancel\", label: options.cancelLabel ?? \"Cancel\", action: \"cancel\" },\n ],\n hint: \"back\",\n }),\n review: ({ state }) => ({\n kind: \"review\",\n title: `Review synced content \u00B7 ${safeTerminalText(state.decision.setupName)}`,\n content: formatSelectionDifference(state.decision),\n format: { kind: \"text\" },\n viewportSize: \"adaptive\",\n hint: \"back\",\n }),\n saved: ({ state }) => ({\n kind: \"actions\",\n title: \"Remote content list saved\",\n lines: [\n `Sync setup: ${safeTerminalText(state.decision.setupName)}`,\n \"Only the included-content setting was saved.\",\n \"No files were pulled and sync state was not changed.\",\n ],\n items: [\n ...(runRoute\n ? [\n {\n id: \"continue\",\n label: continueLabel(origin),\n description: \"Start a fresh check and exact preview for this sync setup.\",\n action: \"continue\" as const,\n },\n ]\n : []),\n { id: \"done\", label: \"Done\", action: \"done\" },\n ],\n hint: \"close\",\n }),\n },\n actions: {\n adopt: async ({ state, signal: actionSignal }) => {\n if (options.readOnly) return { kind: \"rejected\" };\n const signal = combineSignals(sessionSignal, actionSignal);\n try {\n const adoption = await runCancellableTask(\n ctx,\n \"Checking and saving remote content list\u2026\",\n async (workSignal, _onCommit, onDialog) => {\n const ownedSignal = workSignal ?? signal;\n const currentConfig = await loadConfig(state.decision.setupName);\n ownedSignal.throwIfAborted();\n validateOwner();\n assertLocalSelectionCurrent(currentConfig, state.decision);\n const refusal = adoptionUnavailable(state.decision);\n if (refusal) throw new Error(refusal);\n if (!currentConfig.include.includes(\"sessions\") && state.decision.remoteInclude.includes(\"sessions\")) {\n onDialog?.(true);\n let acknowledged: boolean;\n try {\n acknowledged = await ctx.ui.confirm(\n \"Use a content list that includes session conversations?\",\n \"Session JSONL may contain prompts, tool output, file paths, images, and secrets. This saves the list only; it does not pull files.\",\n { signal: ownedSignal },\n );\n } finally {\n onDialog?.(false);\n }\n ownedSignal.throwIfAborted();\n validateOwner();\n if (!acknowledged) return undefined;\n }\n if (\n !currentConfig.scope &&\n state.decision.remoteExclude !== undefined &&\n currentConfig.exclude === undefined\n ) {\n onDialog?.(true);\n let confirmed: boolean;\n try {\n confirmed = await ctx.ui.confirm(\n \"Adopt excluded paths?\",\n \"This upgrades settings to version 6 / snapshots to version 4. Older clients must refuse them. Both content lists are saved; no files transfer and old history is not erased.\",\n { signal: ownedSignal },\n );\n } finally {\n onDialog?.(false);\n }\n ownedSignal.throwIfAborted();\n validateOwner();\n if (!confirmed) return undefined;\n }\n return runWithOptionalStateAccess(options, async () => {\n const loaded = await loadAdoptionReview(state.decision, ownedSignal, factory, validateOwner);\n ownedSignal.throwIfAborted();\n validateOwner();\n await revalidateAndAdopt(loaded, state.decision, ownedSignal, validateOwner);\n return loaded;\n });\n },\n {\n signal,\n isCurrent,\n cancelAcrossDialogs: true,\n cancelledMessage: \"Remote content-list adoption cancelled.\",\n },\n );\n if (signal.aborted || adoption.kind === \"closed\") return { kind: \"close\" as const };\n if (adoption.kind === \"cancelled\" || !adoption.value) return { kind: \"stay\" as const };\n validateOwner();\n options.onSelectionResolved?.();\n continuationFingerprint = syncSettingsConfigFingerprint({\n ...adoption.value.config,\n include: [...state.decision.remoteInclude],\n exclude: adoptedExclude(state.decision),\n ...(adoption.value.config.scope\n ? { reinclude: [...(state.decision.remoteDirectory?.reinclude ?? [])] }\n : {}),\n });\n flowState = { decision: state.decision, saved: true };\n return { kind: \"to\" as const, screen: \"saved\" as const };\n } catch (error) {\n if (signal.aborted || !isCurrent()) return { kind: \"close\" as const };\n if (isStaleReviewError(error)) {\n ctx.ui.notify(`${errorMessage(error)} Refreshing the comparison.`, \"warning\");\n refreshRequested = true;\n return { kind: \"close\" as const };\n }\n ctx.ui.notify(`Could not save the remote content list: ${errorMessage(error)}`, \"error\");\n return { kind: \"stay\" as const };\n }\n },\n keep: async ({ state, signal: actionSignal }) => {\n if (options.readOnly) return { kind: \"rejected\" };\n if (!canPublishLocalPolicy(state.decision)) return { kind: \"stay\" as const };\n if (!runRoute) {\n ctx.ui.notify(\"The reviewed update-remote route is unavailable.\", \"error\");\n return { kind: \"stay\" as const };\n }\n const signal = combineSignals(sessionSignal, actionSignal);\n try {\n if (!state.decision.ignorePolicyComparison) {\n const latest = await loadConfig(state.decision.setupName);\n if (signal.aborted) return { kind: \"close\" as const };\n validateOwner();\n assertLocalSelectionCurrent(latest, state.decision);\n }\n const result = await runCancellableOperation(\n ctx,\n \"Preparing this device's push preview\u2026\",\n \"push --force\",\n runRoute,\n {\n commitAware: true,\n cancelledMessage: \"Push preparation cancelled; no remote files were changed.\",\n target: state.decision.setupName,\n signal,\n },\n );\n return handleNestedRouteResult(result, \"push\");\n } catch (error) {\n if (signal.aborted || !isCurrent()) return { kind: \"close\" as const };\n if (isStaleReviewError(error)) {\n ctx.ui.notify(`${errorMessage(error)} Refreshing the comparison.`, \"warning\");\n refreshRequested = true;\n return { kind: \"close\" as const };\n }\n ctx.ui.notify(`Could not prepare the remote update: ${errorMessage(error)}`, \"error\");\n return { kind: \"stay\" as const };\n }\n },\n continue: async ({ state, signal: actionSignal }) => {\n if (options.readOnly) return { kind: \"rejected\" };\n if (!runRoute || !continuationFingerprint) return { kind: \"stay\" as const };\n const signal = combineSignals(sessionSignal, actionSignal);\n try {\n const latest = await loadConfig(state.decision.setupName);\n if (signal.aborted) return { kind: \"close\" as const };\n validateOwner();\n if (syncSettingsConfigFingerprint(latest) !== continuationFingerprint) {\n throw new StaleRemoteSelectionReviewError(\n `Sync setup \u201C${safeTerminalText(state.decision.setupName)}\u201D changed after the remote content list was saved.`,\n );\n }\n const result = await runCancellableOperation(ctx, continueBusyLabel(origin), route, runRoute, {\n commitAware: true,\n cancelledMessage: continuationCancelledMessage(route),\n target: state.decision.setupName,\n signal,\n });\n return handleNestedRouteResult(result, route);\n } catch (error) {\n if (signal.aborted || !isCurrent()) return { kind: \"close\" as const };\n ctx.ui.notify(`Could not continue: ${errorMessage(error)}`, \"error\");\n return { kind: \"stay\" as const };\n }\n },\n cancel: async () => ({ kind: \"back\" }),\n done: async () => {\n nextResult = { kind: \"done\" };\n return { kind: \"close\" };\n },\n },\n });\n\n function handleNestedRouteResult(\n result: Awaited<ReturnType<typeof runCancellableOperation>>,\n nestedRoute: \"sync\" | \"pull\" | \"push\",\n ) {\n if (result.kind === \"completed\" && result.outcome === \"applied\") {\n options.onSelectionResolved?.();\n }\n if (result.kind === \"closed\") {\n nextResult = { kind: \"closed\" };\n return { kind: \"close\" as const };\n }\n if (\n result.kind === \"cancelled\" ||\n (result.kind === \"completed\" && result.outcome === \"cancelled\") ||\n result.kind === \"failed\"\n ) {\n return { kind: \"stay\" as const };\n }\n nextResult = { kind: \"route-result\", result, route: nestedRoute };\n return { kind: \"close\" as const };\n }\n\n const menuResult = await runMenu(ctx, menu, {\n getState: () => flowState,\n signal: sessionSignal,\n isCurrent,\n onError: (_menuCtx, error) => ctx.ui.notify(errorMessage(error), \"error\"),\n });\n if (!isCurrent() || menuResult.kind === \"stale\") return { kind: \"stale\" };\n if (refreshRequested) return { kind: \"refresh\" };\n if (nextResult) return nextResult;\n if (menuResult.kind === \"closed\") {\n return menuResult.reason === \"back\" ? { kind: \"back\" } : { kind: \"closed\" };\n }\n return { kind: \"closed\" };\n}\n\ninterface AdoptionReview {\n config: AnySyncConfig;\n backend: SyncBackend;\n reviewedHead: RemoteHead;\n}\n\nasync function loadAdoptionReview(\n decision: RemoteSelectionDecision,\n signal: AbortSignal,\n factory: SyncBackendFactory,\n validateOwner: () => void,\n): Promise<AdoptionReview> {\n const config = await loadConfig(decision.setupName);\n throwIfAborted(signal);\n validateOwner();\n assertLocalSelectionCurrent(config, decision);\n const backend = await factory(config);\n throwIfAborted(signal);\n validateOwner();\n const reviewedHead = await backend.readHead(signal);\n throwIfAborted(signal);\n validateOwner();\n if (!reviewedHead) {\n throw new StaleRemoteSelectionReviewError(\"Remote storage changed while the comparison was open.\");\n }\n const snapshot = await readSnapshotForHead(backend, reviewedHead, signal);\n throwIfAborted(signal);\n validateOwner();\n const state = inspectRemoteSelection(config.include, snapshot, config.exclude, config);\n if (\n state.kind !== \"different\" ||\n !sameSyncInclude(state.include, decision.remoteInclude) ||\n !sameSyncExclude(state.exclude, decision.remoteExclude) ||\n !matchesRemoteDirectory(state, decision)\n ) {\n throw new StaleRemoteSelectionReviewError(\"Remote synced content changed while the comparison was open.\");\n }\n return { config, backend, reviewedHead };\n}\n\nasync function revalidateAndAdopt(\n review: AdoptionReview,\n decision: RemoteSelectionDecision,\n signal: AbortSignal,\n validateOwner: () => void,\n) {\n const currentHead = await review.backend.readHead(signal);\n throwIfAborted(signal);\n validateOwner();\n if (!currentHead || !review.backend.sameRevision(review.reviewedHead.revision, currentHead.revision)) {\n throw new StaleRemoteSelectionReviewError(\"Remote storage changed while the comparison was open.\");\n }\n const currentSnapshot = await readSnapshotForHead(review.backend, currentHead, signal);\n throwIfAborted(signal);\n validateOwner();\n const currentState = inspectRemoteSelection(\n review.config.include,\n currentSnapshot,\n review.config.exclude,\n review.config,\n );\n if (\n currentState.kind !== \"different\" ||\n !sameSyncInclude(currentState.include, decision.remoteInclude) ||\n !sameSyncExclude(currentState.exclude, decision.remoteExclude) ||\n !matchesRemoteDirectory(currentState, decision)\n ) {\n throw new StaleRemoteSelectionReviewError(\"Remote synced content changed while the comparison was open.\");\n }\n await updateSyncSetup(\n decision.setupName,\n (setup) => {\n validateOwner();\n const refusal = adoptionUnavailable(decision);\n if (refusal) throw new Error(refusal);\n const exclude = adoptedExclude(decision);\n if (setup.sync.pathPolicy === \"ignore-file\") throw new Error(\"An ignore-file setup cannot adopt remote rules.\");\n if (setup.sync.scope === \"agent-directory\") {\n return {\n ...setup,\n sync: {\n ...setup.sync,\n exclude,\n reinclude: [...(decision.remoteDirectory?.reinclude ?? [])],\n sessions: decision.remoteInclude.includes(\"sessions\"),\n },\n };\n }\n return {\n ...setup,\n sync: { ...setup.sync, include: [...decision.remoteInclude], ...(exclude === undefined ? {} : { exclude }) },\n };\n },\n {\n expectedConfigFingerprint: syncSettingsConfigFingerprint(review.config),\n expectedInclude: decision.localInclude,\n upgradeExclude: adoptedExclude(decision) !== undefined,\n signal,\n },\n );\n}\n\nasync function inspectConfiguredRemoteSelection(\n ctx: ExtensionContext,\n setupName: string | undefined,\n signal: AbortSignal | undefined,\n factory: SyncBackendFactory,\n validateOwner: () => void,\n): Promise<\n | { kind: \"empty\"; config: AnySyncConfig }\n | { kind: \"selection\"; config: AnySyncConfig; state: RemoteSelectionState }\n | { kind: \"decision\"; decision: RemoteSelectionDecision }\n | undefined\n> {\n const config = await loadConfig(setupName);\n if (signal?.aborted) return undefined;\n validateOwner();\n setSyncStatus(ctx, `checking synced content for ${safeTerminalText(config.setupName)}`, { activity: \"checking\" });\n const backend = await factory(config);\n if (signal?.aborted) return undefined;\n validateOwner();\n const head = await backend.readHead(signal);\n if (signal?.aborted) return undefined;\n validateOwner();\n if (!head) return { kind: \"empty\", config };\n try {\n const snapshot = await readSnapshotForHead(backend, head, signal, config);\n if (signal?.aborted) return undefined;\n validateOwner();\n return {\n kind: \"selection\",\n config,\n state: inspectRemoteSelection(config.include, snapshot, config.exclude, config),\n };\n } catch (error) {\n if (signal?.aborted) return undefined;\n validateOwner();\n if (error instanceof RemoteSelectionMismatchError) return { kind: \"decision\", decision: error.decision };\n throw error;\n }\n}\n\nasync function showLegacyDiscovery(\n ctx: ExtensionContext,\n config: AnySyncConfig,\n discovered: string[],\n signal?: AbortSignal,\n) {\n const menu = defineMenu<undefined, \"choice\" | \"review\", \"back\", ExtensionContext>({\n start: \"choice\",\n screens: {\n choice: () => ({\n kind: \"actions\",\n title: `Compare synced content \u00B7 ${safeTerminalText(config.setupName)}`,\n lines: [\n \"This legacy snapshot has no portable synced-content list.\",\n \"Discovered paths are partial and read-only; preserved files may not have been selected.\",\n ],\n items: [\n { id: \"review\", label: \"Review discovered paths\", to: \"review\" },\n { id: \"back\", label: \"Back\", action: \"back\" },\n ],\n hint: \"close\",\n }),\n review: () => ({\n kind: \"review\",\n title: \"Partial discovery from legacy snapshot\",\n content: [\n \"Partial discovery only \u2014 not an authoritative selection.\",\n \"\",\n ...(discovered.length > 0\n ? discovered.map((item) => `Discovered: ${safeTerminalText(item)}`)\n : [\"No safe paths were discovered.\"]),\n \"\",\n \"Use Add custom path\u2026 in the local Included Content editor if needed.\",\n ].join(\"\\n\"),\n format: { kind: \"text\" },\n viewportSize: \"adaptive\",\n hint: \"back\",\n }),\n },\n actions: { back: async () => ({ kind: \"close\" }) },\n });\n await runMenu(ctx, menu, {\n getState: () => undefined,\n signal,\n isCurrent: () => !signal?.aborted,\n });\n}\n\nfunction adoptedExclude(decision: RemoteSelectionDecision) {\n return decision.remoteExclude === undefined\n ? decision.localExclude === undefined\n ? undefined\n : []\n : [...decision.remoteExclude];\n}\n\nfunction scopesDiffer(decision: RemoteSelectionDecision) {\n return decision.localDirectory?.scope !== decision.remoteDirectory?.scope;\n}\n\nfunction canPublishLocalPolicy(decision: RemoteSelectionDecision) {\n if (decision.ignorePolicyComparison) {\n return (\n decision.ignorePolicyComparison !== \"match\" && decision.ignorePolicyComparison !== \"local-legacy-remote-ignore\"\n );\n }\n return !scopesDiffer(decision);\n}\n\nfunction adoptionUnavailable(decision: RemoteSelectionDecision) {\n if (decision.ignorePolicyComparison)\n return \"Ignore files are local. Published metadata cannot reconstruct remote rules.\";\n if (scopesDiffer(decision))\n return \"Scope differs. Configure a setup with the remote scope to join it; this location is not migrated in place.\";\n if (\n decision.remoteDirectory?.scope &&\n decision.remoteInclude.includes(\"sessions\") &&\n !decision.localInclude.includes(\"sessions\")\n )\n return \"Enable session sync explicitly in Settings before adopting these rules.\";\n}\n\nfunction matchesRemoteDirectory(\n state: Extract<RemoteSelectionState, { kind: \"different\" }>,\n decision: RemoteSelectionDecision,\n) {\n return (\n syncDirectoryPolicyKey(state) ===\n syncDirectoryPolicyKey({\n include: decision.remoteInclude,\n exclude: decision.remoteExclude,\n ...decision.remoteDirectory,\n })\n );\n}\n\nfunction directoryReviewLines(decision: RemoteSelectionDecision) {\n if (!decision.localDirectory?.scope && !decision.remoteDirectory?.scope) return [];\n const unavailable = adoptionUnavailable(decision);\n return [\n `Remote scope: ${decision.remoteDirectory?.scope ? \"Pi agent directory\" : \"selected paths or legacy\"}`,\n `This device scope: ${decision.localDirectory?.scope ? \"Pi agent directory\" : \"selected paths\"}`,\n `Remote re-included paths: ${safeList(decision.remoteDirectory?.reinclude ?? [])}`,\n `This device re-included paths: ${safeList(decision.localDirectory?.reinclude ?? [])}`,\n ...(unavailable ? [unavailable] : []),\n ];\n}\n\nfunction selectionSummaryLines(decision: RemoteSelectionDecision) {\n if (decision.ignorePolicyComparison) {\n return [\n `Sync setup: ${safeTerminalText(decision.setupName)}`,\n adoptionUnavailable(decision) ?? \"Nothing changed.\",\n ...(decision.ignorePolicyComparison === \"local-legacy-remote-ignore\"\n ? [\"The remote uses an ignore-file policy; this device uses a legacy policy.\"]\n : decision.ignorePolicyComparison === \"local-ignore-remote-legacy\"\n ? [\"This device uses an ignore-file policy; the remote uses a legacy policy.\"]\n : [\"The ordered rules or session opt-in differ.\"]),\n \"No files or settings have changed.\",\n ];\n }\n const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);\n return [\n `Sync setup: ${safeTerminalText(decision.setupName)}`,\n \"Nothing changed. Review both lists before choosing what happens next.\",\n ...directoryReviewLines(decision),\n ...excludeReviewLines(decision),\n ...(!decision.localDirectory?.scope &&\n !decision.remoteDirectory?.scope &&\n comparison.remoteOnly.length === 0 &&\n comparison.localOnly.length === 0 &&\n sameSyncExclude(decision.localExclude, decision.remoteExclude)\n ? [\"Only the ordering differs; membership is the same.\"]\n : [`Remote-only paths: ${comparison.remoteOnly.length} \u00B7 Device-only paths: ${comparison.localOnly.length}`]),\n ];\n}\n\nfunction formatSelectionDifference(decision: RemoteSelectionDecision) {\n if (decision.ignorePolicyComparison) return selectionSummaryLines(decision).join(\"\\n\");\n const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);\n return [\n ...directoryReviewLines(decision),\n ...(!decision.localDirectory?.scope &&\n !decision.remoteDirectory?.scope &&\n comparison.remoteOnly.length === 0 &&\n comparison.localOnly.length === 0 &&\n sameSyncExclude(decision.localExclude, decision.remoteExclude)\n ? [\"Only ordering differs; both lists contain the same paths.\", \"\"]\n : []),\n \"Remote-only paths:\",\n ...(comparison.remoteOnly.length > 0\n ? comparison.remoteOnly.map((item) => `+ ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n \"Device-only paths:\",\n ...(comparison.localOnly.length > 0\n ? comparison.localOnly.map((item) => `- ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n \"Remote ordered list:\",\n ...(decision.remoteInclude.length > 0\n ? decision.remoteInclude.map((item, index) => `${index + 1}. ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n \"This device's ordered list:\",\n ...(decision.localInclude.length > 0\n ? decision.localInclude.map((item, index) => `${index + 1}. ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n ...excludeReviewLines(decision),\n \"Using the remote list saves settings only and does not pull files.\",\n ].join(\"\\n\");\n}\n\nfunction formatRemoteSelectionSummary(decision: RemoteSelectionDecision) {\n if (decision.ignorePolicyComparison) return selectionSummaryLines(decision).join(\"\\n\");\n const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);\n return [\n `Synced content for \u201C${safeTerminalText(decision.setupName)}\u201D differs from this device.`,\n `Remote-only: ${safeList(comparison.remoteOnly)}`,\n `Device-only: ${safeList(comparison.localOnly)}`,\n ...directoryReviewLines(decision),\n ...(!decision.localDirectory?.scope &&\n !decision.remoteDirectory?.scope &&\n comparison.remoteOnly.length === 0 &&\n comparison.localOnly.length === 0 &&\n sameSyncExclude(decision.localExclude, decision.remoteExclude)\n ? [\n \"Only ordering differs.\",\n `Remote order: ${safeList(decision.remoteInclude)}`,\n `Device order: ${safeList(decision.localInclude)}`,\n ]\n : []),\n ...excludeReviewLines(decision),\n \"Run /sync in TUI to choose a content list; RPC review is read-only.\",\n ].join(\"\\n\");\n}\n\nfunction excludeReviewLines(decision: RemoteSelectionDecision) {\n if (decision.localExclude === undefined && decision.remoteExclude === undefined) return [];\n return [\n `Remote excluded paths: ${safeList(decision.remoteExclude ?? [])}`,\n `This device excluded paths: ${safeList(decision.localExclude ?? [])}`,\n \"Removed exclusions can expose or replace content; old history is not erased.\",\n ];\n}\n\nfunction formatLegacySummary(config: AnySyncConfig, discovered: readonly string[]) {\n return `Remote snapshot for \u201C${safeTerminalText(config.setupName)}\u201D has no portable synced-content list; ${discovered.length} safe path${discovered.length === 1 ? \" was\" : \"s were\"} discovered, but the result is partial and read-only.`;\n}\n\nfunction decisionFromState(\n config: AnySyncConfig,\n state: Extract<RemoteSelectionState, { kind: \"different\" }>,\n): RemoteSelectionDecision {\n return {\n setupName: config.setupName,\n configIdentity: syncConfigReviewFingerprint(config),\n ignorePolicyComparison: state.ignorePolicyComparison,\n localInclude: [...config.include],\n remoteInclude: [...state.include],\n ...(config.exclude === undefined ? {} : { localExclude: [...config.exclude] }),\n ...(state.exclude === undefined ? {} : { remoteExclude: [...state.exclude] }),\n ...(config.scope ? { localDirectory: { scope: config.scope, reinclude: config.reinclude } } : {}),\n ...(state.scope ? { remoteDirectory: { scope: state.scope, reinclude: state.reinclude } } : {}),\n };\n}\n\nfunction assertLocalSelectionCurrent(config: AnySyncConfig, decision: RemoteSelectionDecision) {\n if (\n syncConfigReviewFingerprint(config) === decision.configIdentity &&\n sameSyncInclude(config.include, decision.localInclude) &&\n sameSyncExclude(config.exclude, decision.localExclude) &&\n syncDirectoryPolicyKey(config) ===\n syncDirectoryPolicyKey({\n include: decision.localInclude,\n exclude: decision.localExclude,\n ...decision.localDirectory,\n })\n ) {\n return;\n }\n throw new StaleRemoteSelectionReviewError(\n `Sync setup \u201C${safeTerminalText(config.setupName)}\u201D changed while the comparison was open.`,\n );\n}\n\nfunction continueLabel(origin: RemoteSelectionOrigin) {\n if (origin === \"pull\") return \"Continue Pull now\u2026\";\n if (origin === \"push\") return \"Continue Push now\u2026\";\n return \"Continue Sync now\u2026\";\n}\n\nfunction continueBusyLabel(origin: RemoteSelectionOrigin) {\n if (origin === \"pull\") return \"Checking remote changes\u2026\";\n if (origin === \"push\") return \"Preparing push preview\u2026\";\n return \"Checking current sync setup\u2026\";\n}\n\nfunction continuationCancelledMessage(route: \"sync\" | \"pull\" | \"push\") {\n if (route === \"pull\") return \"Pull check cancelled; no local files were changed.\";\n if (route === \"push\") return \"Push preparation cancelled; no remote files were changed.\";\n return \"Sync check cancelled; no settings or files were changed.\";\n}\n\nfunction safeList(values: readonly string[]) {\n return values.length > 0 ? values.map(safeTerminalText).join(\", \") : \"none\";\n}\n\nclass StaleRemoteSelectionReviewError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"StaleRemoteSelectionReviewError\";\n }\n}\n\nfunction isStaleReviewError(error: unknown) {\n return error instanceof StaleRemoteSelectionReviewError || error instanceof SyncSetupReviewChangedError;\n}\n\nfunction runWithOptionalStateAccess<T>(\n options: Pick<RemoteSelectionReviewOptions, \"withStateAccess\">,\n task: () => Promise<T>,\n) {\n return options.withStateAccess ? options.withStateAccess(task) : task();\n}\n\nfunction isReviewOwnerCurrent(validateOwner: () => void) {\n try {\n validateOwner();\n return true;\n } catch {\n return false;\n }\n}\n\nfunction combineSignals(sessionSignal: AbortSignal | undefined, actionSignal: AbortSignal) {\n return sessionSignal ? AbortSignal.any([sessionSignal, actionSignal]) : actionSignal;\n}\n", "export type * from \"@narumitw/pi-sync-daemon/engine/backends/backend-factory\";\nexport { createSyncBackend } from \"@narumitw/pi-sync-daemon/engine/backends/backend-factory\";\n", "export type * from \"@narumitw/pi-sync-daemon/engine/sync/remote-snapshot\";\nexport {\n formatRemoteSelectionStatus,\n readRemoteSnapshot,\n readSnapshotForHead,\n requireCompatibleRemoteSelection,\n} from \"@narumitw/pi-sync-daemon/engine/sync/remote-snapshot\";\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,YAAY,eAAe;;;ACApC,SAAS,yBAAyB;;;ACAlC;AAAA,EACE;AAAA,EACA;AAAA,EACA;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