@ddtcorex/dsh-maestro-core 0.15.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +7 -7
  2. package/assets/icon.svg +4 -0
  3. package/cordis.patch.yml +0 -12
  4. package/lib/client.js +3 -1744
  5. package/lib/health-poller.js +1 -1
  6. package/lib/self-kill-guard.d.ts +25 -8
  7. package/lib/self-kill-guard.js +81 -27
  8. package/lib/types/client/config/components/BrandMark.d.ts +3 -3
  9. package/lib/types/client/index.d.ts.map +1 -1
  10. package/locale/en.json +6 -0
  11. package/package.json +9 -5
  12. package/src/client/config/components/BrandMark.tsx +3 -3
  13. package/src/client/index.tsx +0 -2
  14. package/src/host/health-poller.ts +1 -1
  15. package/src/host/self-kill-guard.ts +84 -26
  16. package/lib/sync/backup-config.d.ts +0 -55
  17. package/lib/sync/backup-config.js +0 -119
  18. package/lib/sync/backup-service.d.ts +0 -123
  19. package/lib/sync/backup-service.js +0 -486
  20. package/lib/sync/bidirectional.d.ts +0 -39
  21. package/lib/sync/bidirectional.js +0 -25
  22. package/lib/sync/cli.d.ts +0 -38
  23. package/lib/sync/cli.js +0 -528
  24. package/lib/sync/config.d.ts +0 -59
  25. package/lib/sync/config.js +0 -72
  26. package/lib/sync/fingerprint.d.ts +0 -29
  27. package/lib/sync/fingerprint.js +0 -65
  28. package/lib/sync/hashing.d.ts +0 -22
  29. package/lib/sync/hashing.js +0 -77
  30. package/lib/sync/index.d.ts +0 -6
  31. package/lib/sync/index.js +0 -619
  32. package/lib/sync/machine-id.d.ts +0 -29
  33. package/lib/sync/machine-id.js +0 -66
  34. package/lib/sync/merge.d.ts +0 -31
  35. package/lib/sync/merge.js +0 -86
  36. package/lib/sync/peer-host.d.ts +0 -22
  37. package/lib/sync/peer-host.js +0 -62
  38. package/lib/sync/process-runner.d.ts +0 -31
  39. package/lib/sync/process-runner.js +0 -161
  40. package/lib/sync/remote-agent.d.ts +0 -41
  41. package/lib/sync/remote-agent.js +0 -216
  42. package/lib/sync/remote-cache.d.ts +0 -18
  43. package/lib/sync/remote-cache.js +0 -60
  44. package/lib/sync/remote-manifest.d.ts +0 -20
  45. package/lib/sync/remote-manifest.js +0 -86
  46. package/lib/sync/s3-object-store.d.ts +0 -38
  47. package/lib/sync/s3-object-store.js +0 -126
  48. package/lib/sync/session-plan.d.ts +0 -29
  49. package/lib/sync/session-plan.js +0 -213
  50. package/lib/sync/sigv4.d.ts +0 -20
  51. package/lib/sync/sigv4.js +0 -57
  52. package/lib/sync/snapshot.d.ts +0 -16
  53. package/lib/sync/snapshot.js +0 -143
  54. package/lib/sync/ssh-mux.d.ts +0 -12
  55. package/lib/sync/ssh-mux.js +0 -48
  56. package/lib/sync/store-root.d.ts +0 -44
  57. package/lib/sync/store-root.js +0 -67
  58. package/lib/sync/sync-plan.d.ts +0 -24
  59. package/lib/sync/sync-plan.js +0 -366
  60. package/lib/sync/sync-service.d.ts +0 -183
  61. package/lib/sync/sync-service.js +0 -926
  62. package/lib/sync/sync-types.d.ts +0 -87
  63. package/lib/sync/sync-types.js +0 -1
  64. package/lib/sync/transport.d.ts +0 -75
  65. package/lib/sync/transport.js +0 -196
  66. package/lib/sync/tunnel-restore.d.ts +0 -77
  67. package/lib/sync/tunnel-restore.js +0 -142
  68. package/lib/sync/validation.d.ts +0 -12
  69. package/lib/sync/validation.js +0 -96
  70. package/lib/types/client/sync/R2SyncPanel.d.ts +0 -6
  71. package/lib/types/client/sync/R2SyncPanel.d.ts.map +0 -1
  72. package/lib/types/client/sync/SyncPanel.d.ts +0 -12
  73. package/lib/types/client/sync/SyncPanel.d.ts.map +0 -1
  74. package/lib/types/client/sync/confirm-dialog.d.ts +0 -43
  75. package/lib/types/client/sync/confirm-dialog.d.ts.map +0 -1
  76. package/lib/types/client/sync/index.d.ts +0 -10
  77. package/lib/types/client/sync/index.d.ts.map +0 -1
  78. package/lib/types/client/sync/ui.d.ts +0 -75
  79. package/lib/types/client/sync/ui.d.ts.map +0 -1
  80. package/lib/types/client/sync/use-backup.d.ts +0 -50
  81. package/lib/types/client/sync/use-backup.d.ts.map +0 -1
  82. package/lib/types/client/sync/use-sync.d.ts +0 -88
  83. package/lib/types/client/sync/use-sync.d.ts.map +0 -1
  84. package/src/client/sync/R2SyncPanel.tsx +0 -260
  85. package/src/client/sync/SyncPanel.tsx +0 -422
  86. package/src/client/sync/confirm-dialog.tsx +0 -202
  87. package/src/client/sync/index.tsx +0 -286
  88. package/src/client/sync/ui.tsx +0 -297
  89. package/src/client/sync/use-backup.ts +0 -207
  90. package/src/client/sync/use-sync.ts +0 -502
  91. package/src/host/sync/backup-config.ts +0 -158
  92. package/src/host/sync/backup-service.ts +0 -506
  93. package/src/host/sync/bidirectional.ts +0 -66
  94. package/src/host/sync/cli.ts +0 -530
  95. package/src/host/sync/config.ts +0 -96
  96. package/src/host/sync/fingerprint.ts +0 -83
  97. package/src/host/sync/hashing.ts +0 -91
  98. package/src/host/sync/index.ts +0 -697
  99. package/src/host/sync/machine-id.ts +0 -81
  100. package/src/host/sync/merge.ts +0 -99
  101. package/src/host/sync/peer-host.ts +0 -65
  102. package/src/host/sync/process-runner.ts +0 -177
  103. package/src/host/sync/remote-agent.ts +0 -212
  104. package/src/host/sync/remote-cache.ts +0 -68
  105. package/src/host/sync/remote-manifest.ts +0 -91
  106. package/src/host/sync/s3-object-store.ts +0 -144
  107. package/src/host/sync/session-plan.ts +0 -237
  108. package/src/host/sync/sigv4.ts +0 -81
  109. package/src/host/sync/snapshot.ts +0 -132
  110. package/src/host/sync/ssh-mux.ts +0 -55
  111. package/src/host/sync/store-root.ts +0 -83
  112. package/src/host/sync/sync-plan.ts +0 -366
  113. package/src/host/sync/sync-service.ts +0 -960
  114. package/src/host/sync/sync-types.ts +0 -102
  115. package/src/host/sync/transport.ts +0 -256
  116. package/src/host/sync/tunnel-restore.ts +0 -160
  117. package/src/host/sync/validation.ts +0 -104
@@ -1,286 +0,0 @@
1
- /**
2
- * dsh-maestro-sync — client bundle entry.
3
- * Single registration: settings.section id maestro-sync (Minimalism & Swiss,
4
- * mobile-first). The settings card is the complete Sync UI — connection,
5
- * stats, paged file lists, and the confirmation-first Preview/Apply flow:
6
- * preview is read-only; apply exists only inside a dialog bound to the live
7
- * preview id (confirm:true). All colors/geometry via --dsw-alias-* tokens;
8
- * the only fixed hex is the shared Maestro logo tile #0A84FF (branding rule).
9
- */
10
- import * as React from 'react'
11
- import { SyncPanel } from './SyncPanel.js'
12
-
13
- export const inject = ['slots', 'connection'] as const
14
-
15
- function installStyleTag(css: string, pluginCss: string): () => void {
16
- if (typeof document === 'undefined') return () => {}
17
- const tag = document.createElement('style')
18
- tag.dataset.plugin = '@ddtcorex/dsh-maestro-sync'
19
- tag.dataset.pluginCss = pluginCss
20
- tag.textContent = css
21
- document.head.appendChild(tag)
22
- return () => {
23
- document.querySelector(`style[data-plugin-css="${pluginCss}"]`)?.remove()
24
- }
25
- }
26
-
27
- // ---------------------------------------------------------------------------
28
- // Sync UI CSS — token-native, mobile-first (375 → 480 → 640 → 1024 → 1440)
29
- // ---------------------------------------------------------------------------
30
- const SYNC_CSS = `
31
- [data-sync-root], [data-sync-root] * { box-sizing: border-box; }
32
- [data-sync-root] { display: flex; flex-direction: column; gap: 12px; color: var(--dsw-alias-label-primary); font-size: 13px; line-height: 1.5; min-width: 0; width: 100%; max-width: 640px; }
33
-
34
- /* connection banner */
35
- [data-sync-conn] { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-2); }
36
- [data-sync-conn][data-state="bad"] { border-color: var(--dsw-alias-state-error-primary, #DC2626); }
37
- [data-sync-conn-dot] { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; }
38
- [data-sync-conn][data-state="ok"] [data-sync-conn-dot] { background: var(--dsw-alias-state-success-primary, #16A34A); box-shadow: 0 0 0 4px color-mix(in srgb, var(--dsw-alias-state-success-primary, #16A34A) 16%, transparent); }
39
- [data-sync-conn][data-state="bad"] [data-sync-conn-dot] { background: var(--dsw-alias-state-error-primary, #DC2626); box-shadow: 0 0 0 4px color-mix(in srgb, var(--dsw-alias-state-error-primary, #DC2626) 12%, transparent); }
40
- [data-sync-conn][data-state="checking"] [data-sync-conn-dot] { background: var(--dsw-alias-label-secondary); opacity: 0.6; }
41
- [data-sync-conn-main] { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
42
- [data-sync-conn-title] { font-size: 12px; font-weight: 600; line-height: 16px; }
43
- [data-sync-conn-desc] { font-size: 11px; line-height: 14px; color: var(--dsw-alias-label-secondary); word-break: break-word; }
44
-
45
- /* identity fields */
46
- [data-sync-fields] { display: flex; gap: 10px; flex-wrap: wrap; }
47
- [data-sync-field] { flex: 1 1 160px; min-width: 0; border: 1px solid var(--dsw-alias-border-l1); border-radius: 8px; background: var(--dsw-alias-bg-layer-2); padding: 8px 10px; }
48
- [data-sync-field-label] { font-size: 11px; color: var(--dsw-alias-label-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; display: block; }
49
- [data-sync-field-value] { font-size: 13px; font-weight: 600; word-break: break-all; margin-top: 2px; display: block; }
50
-
51
- /* stat tiles */
52
- [data-sync-stats] { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
53
- [data-sync-stat] { display: flex; flex-direction: column; gap: 4px; min-width: 0; border: 1px solid var(--dsw-alias-border-l1); border-radius: 10px; background: var(--dsw-alias-bg-layer-2); padding: 10px 12px; text-align: left; font: inherit; cursor: default; color: inherit; }
54
- button[data-sync-stat] { cursor: pointer; }
55
- button[data-sync-stat]:hover { border-color: var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-layer-3); }
56
- button[data-sync-stat]:focus-visible { outline: 2px solid var(--dsw-alias-border-l2); outline-offset: 2px; }
57
- [data-sync-stat-icon] { display: inline-flex; color: var(--dsw-alias-label-tertiary); }
58
- [data-sync-stat-value] { font-size: 22px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
59
- [data-sync-stat-label] { font-size: 12px; font-weight: 600; line-height: 16px; }
60
- [data-sync-stat-hint] { font-size: 10px; line-height: 13px; color: var(--dsw-alias-label-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
61
-
62
- /* actions */
63
- [data-sync-actions] { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
64
-
65
- /* preview progress — live per-file ticks while sessions are counted */
66
- [data-sync-progress] { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-2); }
67
- [data-sync-progress-meta] { font-size: 11px; line-height: 14px; color: var(--dsw-alias-label-secondary); word-break: break-word; }
68
- [data-sync-progress-track] { display: block; height: 4px; border-radius: 999px; background: var(--dsw-alias-bg-layer-3); overflow: hidden; }
69
- [data-sync-progress-fill] { display: block; height: 100%; border-radius: 999px; background: var(--dsw-alias-state-info-primary, #0A84FF); transition: width 0.3s ease; }
70
- @media (prefers-reduced-motion: reduce) { [data-sync-progress-fill] { transition: none; } }
71
-
72
- /* dialog session counts — counted by checksum, no per-file rows */
73
- [data-sync-sessioncounts] { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 8px; border: 1px dashed var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-layer-2); margin-bottom: 6px; }
74
- [data-sync-sessioncounts-lbl] { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-primary); }
75
- [data-sync-sessioncounts-line] { font-size: 11px; line-height: 14px; color: var(--dsw-alias-label-secondary); }
76
-
77
- /* notice / error */
78
- [data-sync-notice] { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-2); }
79
- [data-sync-notice][data-tone="bad"] { border-color: var(--dsw-alias-state-error-primary, #DC2626); }
80
- [data-sync-notice-icon] { display: inline-flex; color: var(--dsw-alias-label-tertiary); margin-top: 1px; }
81
- [data-sync-notice][data-tone="bad"] [data-sync-notice-icon] { color: var(--dsw-alias-state-error-primary, #DC2626); }
82
- [data-sync-notice][data-tone="ok"] [data-sync-notice-icon] { color: var(--dsw-alias-state-success-primary, #16A34A); }
83
- [data-sync-notice-main] { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
84
- [data-sync-notice-title] { font-size: 12px; font-weight: 600; }
85
- [data-sync-notice-desc] { font-size: 11px; line-height: 14px; color: var(--dsw-alias-label-secondary); word-break: break-word; }
86
-
87
- /* badges */
88
- [data-sync-badge] { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--dsw-alias-label-secondary); background: var(--dsw-alias-bg-layer-2); border: 1px solid var(--dsw-alias-border-l1); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
89
- [data-sync-badge][data-tone="brand"] { color: var(--dsw-alias-label-primary); border-color: var(--dsw-alias-border-l2); }
90
- [data-sync-badge][data-tone="success"] { color: var(--dsw-alias-state-success-primary); }
91
- [data-sync-badge][data-tone="error"] { color: var(--dsw-alias-state-error-primary); border-color: var(--dsw-alias-state-error-primary); }
92
- [data-sync-badge][data-tone="warn"] { color: var(--dsw-alias-state-warn-primary); }
93
-
94
- [data-sync-muted] { color: var(--dsw-alias-label-secondary); font-size: 11px; line-height: 14px; }
95
-
96
- /* ---- confirmation dialog: bottom sheet on mobile, centered card ≥640 ---- */
97
- [data-sync-dialog-overlay] { position: fixed; inset: 0; z-index: 1000; background: color-mix(in srgb, var(--dsw-alias-bg-base, #000) 55%, transparent); display: flex; align-items: flex-end; justify-content: center; }
98
- [data-sync-dialog] { width: 100%; max-width: 560px; max-height: 88dvh; overflow: auto; border: 1px solid var(--dsw-alias-border-l2); border-radius: 16px 16px 0 0; background: var(--dsw-alias-bg-layer-1); box-shadow: 0 -16px 50px rgba(0, 0, 0, 0.3); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
99
- [data-sync-dialog-top] { display: flex; align-items: flex-start; gap: 8px; }
100
- [data-sync-dialog-heading] { flex: 1; min-width: 0; }
101
- [data-sync-dialog-title] { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; line-height: 20px; }
102
- [data-sync-dialog-desc] { font-size: 12px; line-height: 16px; color: var(--dsw-alias-label-secondary); margin-top: 2px; }
103
- [data-sync-dialog-close] { flex: none; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--dsw-alias-border-l1); border-radius: 8px; background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-secondary); cursor: pointer; padding: 0; }
104
- [data-sync-dialog-close]:hover { color: var(--dsw-alias-label-primary); border-color: var(--dsw-alias-border-l2); }
105
- [data-sync-dialog-close]:focus-visible { outline: 2px solid var(--dsw-alias-border-l2); outline-offset: 2px; }
106
- [data-sync-planlist] { display: flex; flex-direction: column; border: 1px solid var(--dsw-alias-border-l1); border-radius: 10px; overflow: hidden; }
107
- [data-sync-planrow] { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-1); }
108
- [data-sync-planrow]:last-child { border-bottom: none; }
109
- [data-sync-planfile-icon] { display: inline-flex; flex: none; }
110
- [data-sync-planfile] { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
111
- [data-sync-planfile-title] { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
112
- [data-sync-planfile-path] { font-size: 11px; color: var(--dsw-alias-label-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
113
- [data-sync-planrow-meta] { flex: none; }
114
- [data-sync-planmore] { display: flex; justify-content: center; padding: 8px; }
115
- [data-sync-empty] { padding: 16px 12px; text-align: center; color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 16px; }
116
- [data-sync-loading] { padding: 16px 12px; text-align: center; color: var(--dsw-alias-label-tertiary); font-size: 12px; line-height: 16px; }
117
- [data-sync-dialog-actions] { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
118
-
119
- /* ---- file list sections (in-card) ---- */
120
- [data-sync-filetables] { display: grid; grid-template-columns: 1fr; gap: 12px; }
121
- @media (min-width: 1024px) {
122
- [data-sync-filetables] { grid-template-columns: 1fr 1fr; }
123
- }
124
- [data-sync-dcol] { display: flex; flex-direction: column; border: 1px solid var(--dsw-alias-border-l1); border-radius: 12px; background: var(--dsw-alias-bg-layer-1); overflow: hidden; min-width: 0; }
125
- [data-sync-dcol-head] { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-2); }
126
- [data-sync-dcol-title] { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
127
- [data-sync-dcol-count] { font-size: 11px; font-weight: 600; color: var(--dsw-alias-label-secondary); background: var(--dsw-alias-bg-layer-1); border: 1px solid var(--dsw-alias-border-l1); border-radius: 999px; padding: 2px 8px; }
128
- [data-sync-file] { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--dsw-alias-border-l1); font-size: 12px; min-width: 0; }
129
- [data-sync-file]:last-child { border-bottom: none; }
130
- [data-sync-file-icon] { display: inline-flex; flex: none; color: var(--dsw-alias-label-tertiary); }
131
- [data-sync-file-main] { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
132
- [data-sync-file-title] { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
133
- [data-sync-file-path] { font-size: 11px; color: var(--dsw-alias-label-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
134
- [data-sync-file-meta] { flex: none; font-size: 11px; color: var(--dsw-alias-label-secondary); background: var(--dsw-alias-bg-layer-2); border: 1px solid var(--dsw-alias-border-l1); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
135
- [data-sync-dcol-foot] { display: flex; justify-content: center; padding: 8px; border-top: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-2); }
136
-
137
- /* spinner */
138
- @keyframes sync-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
139
- .sync-spin { display: inline-block; animation: sync-spin 0.8s linear infinite; font-size: 14px; line-height: 1; }
140
-
141
- /* ---- breakpoints ---- */
142
- @media (max-width: 640px) {
143
- [data-sync-fields] { gap: 8px; }
144
- [data-sync-field] { flex: 1 1 0; min-width: 0; padding: 7px 8px; border-radius: 8px; }
145
- [data-sync-field-label] { font-size: 10px; line-height: 12px; }
146
- [data-sync-field-value] { font-size: 12px; line-height: 14px; }
147
- }
148
- @media (max-width: 480px) {
149
- [data-sync-actions] > [data-sync-btn] { flex: 1 1 auto; }
150
- [data-sync-fields] { flex-direction: row; gap: 6px; }
151
- [data-sync-field] { flex: 1 1 0; min-width: 0; padding: 6px 8px; border-radius: 8px; }
152
- [data-sync-field-label] { font-size: 10px; line-height: 11px; }
153
- [data-sync-field-value] { font-size: 11px; line-height: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; word-break: normal; }
154
- }
155
- @media (min-width: 640px) {
156
- [data-sync-dialog-overlay] { align-items: center; padding: 24px; }
157
- [data-sync-dialog] { border-radius: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35); }
158
- }
159
- @media (min-width: 1024px) {
160
- [data-sync-dash-content] { padding: 20px; }
161
- }
162
- @media (max-width: 390px) {
163
- [data-sync-card] { padding: 12px; }
164
- }
165
- @media (prefers-reduced-motion: reduce) {
166
- [data-sync-root] *, [data-sync-dialog] * { transition: none !important; animation: none !important; }
167
- .sync-spin { animation: none; }
168
- }
169
-
170
- /* ---- mobile-first (2026-09-03): thumb reach, disclosure, touch targets ---- */
171
- [data-sync-shell] { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
172
- /* mode tabs — pill bar, 44px touch height on every viewport */
173
- [data-sync-tabs] { display: flex; gap: 4px; padding: 3px; border-radius: 999px; border: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-2); }
174
- [data-sync-tab] { flex: 1 1 0; min-height: 44px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
175
- [data-sync-tab][aria-selected="true"] { background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); box-shadow: inset 0 0 0 1px var(--dsw-alias-border-l1); }
176
- [data-sync-tab]:focus-visible { outline: 2px solid var(--dsw-alias-border-l2); outline-offset: 2px; }
177
- /* collapsible bucket header toggle (header padding moves onto the button) */
178
- [data-sync-dcol-head] { padding: 0; }
179
- [data-sync-dcol-toggle] { all: unset; display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 44px; padding: 10px 12px; cursor: pointer; box-sizing: border-box; font: inherit; color: inherit; }
180
- [data-sync-dcol-toggle]:focus-visible { outline: 2px solid var(--dsw-alias-border-l2); outline-offset: -2px; }
181
- /* R2 actions: primary + More menu (menu never overflows 360px) */
182
- [data-r2-actions] { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
183
- [data-r2-actions] > [data-sync-btn] { flex: 2 1 0; }
184
- [data-r2-more] { position: relative; flex: 1 1 0; display: flex; }
185
- [data-r2-more] > [data-sync-btn] { flex: 1 1 auto; width: 100%; }
186
- [data-r2-more-menu] { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px; max-width: calc(100vw - 48px); display: flex; flex-direction: column; gap: 2px; padding: 6px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 12px; background: var(--dsw-alias-bg-layer-1); box-shadow: var(--dsw-shadow-lv3); }
187
- [data-r2-more-menu] > [data-sync-btn] { justify-content: flex-start; width: 100%; }
188
- /* sticky thumb-reach bars + condensed stats on narrow screens */
189
- @media (max-width: 640px) {
190
- [data-sync-actions-bar] { position: sticky; bottom: 0; z-index: 10; padding: 10px 2px calc(10px + env(safe-area-inset-bottom, 0px)); background: color-mix(in srgb, var(--dsw-alias-bg-base, #fff) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
191
- [data-sync-actions-bar] > [data-sync-btn] { flex: 1 1 0; min-height: 48px !important; font-size: 14px; }
192
- [data-sync-actions-bar] [data-r2-more] > [data-sync-btn] { min-height: 48px !important; }
193
- [data-sync-dialog-actions] { position: sticky; bottom: 0; padding: 10px 0 calc(4px + env(safe-area-inset-bottom, 0px)); background: var(--dsw-alias-bg-layer-1); }
194
- [data-sync-dialog-actions] > [data-sync-btn]:last-child { flex: 1 1 100%; min-height: 48px !important; }
195
- [data-sync-stats] { gap: 6px; }
196
- [data-sync-stat] { padding: 8px 10px; }
197
- }
198
- /* coarse pointers: 40–44px targets (inline min-heights need !important) */
199
- @media (pointer: coarse) {
200
- [data-sync-btn][data-size="sm"] { min-height: 40px !important; }
201
- [data-sync-btn][data-size="md"], [data-sync-btn]:not([data-size]) { min-height: 44px !important; }
202
- [data-sync-dialog-close] { width: 40px; height: 40px; }
203
- }
204
- @media (max-width: 390px) {
205
- [data-sync-stat-value] { font-size: 18px; }
206
- [data-sync-stat-hint] { display: none; }
207
- }
208
- /* SSH configuration — user-filled target, explicit check, nothing auto-probes */
209
- [data-sync-ssh] { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--dsw-alias-border-l1); border-radius: 10px; background: var(--dsw-alias-bg-layer-2); }
210
- [data-sync-ssh-label] { font-size: 11px; line-height: 16px; color: var(--dsw-alias-label-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
211
- [data-sync-ssh-input] { min-height: 44px; padding: 6px 12px; border: 0.5px solid var(--dsw-alias-border-l4); border-radius: var(--dsw-radius-md); background: var(--dsw-alias-bg-layer-3); color: var(--dsw-alias-label-primary); font: inherit; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; width: 100%; box-sizing: border-box; }
212
- [data-sync-ssh-input]:focus-visible { outline: 2px solid var(--dsw-alias-border-l2); outline-offset: 2px; }
213
- [data-sync-ssh-input]:disabled { opacity: 0.6; }
214
- [data-sync-ssh-row] { display: flex; gap: 8px; flex-wrap: wrap; }
215
- [data-sync-ssh-row] > [data-sync-btn] { flex: 1 1 0; }
216
- [data-sync-ssh-src] { font-size: 11px; line-height: 14px; color: var(--dsw-alias-label-secondary); }
217
- /* R2 status banner — badge + hint need a real gap (was running together) */
218
- [data-r2-summary] { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
219
- /* R2 backup-target form — same language as the SSH section */
220
- [data-r2-config] { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--dsw-alias-border-l1); border-radius: 10px; background: var(--dsw-alias-bg-layer-2); }
221
- [data-r2-config-label] { font-size: 11px; color: var(--dsw-alias-label-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
222
- [data-r2-field] { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
223
- [data-r2-field-label] { font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-primary); }
224
- [data-r2-field-input] { min-height: 44px; padding: 6px 12px; border: 0.5px solid var(--dsw-alias-border-l4); border-radius: var(--dsw-radius-md); background: var(--dsw-alias-bg-layer-3); color: var(--dsw-alias-label-primary); font: inherit; width: 100%; box-sizing: border-box; }
225
- [data-r2-field-input]:focus-visible { outline: 2px solid var(--dsw-alias-border-l2); outline-offset: 2px; }
226
- [data-r2-field-input]:disabled { opacity: 0.6; }
227
- [data-r2-field-hint] { font-size: 11px; line-height: 14px; color: var(--dsw-alias-label-tertiary); }
228
- /* Field-level validation feedback: the message must sit under the input it
229
- names, not only in the panel-wide banner. */
230
- [data-r2-field-error] { font-size: 11px; line-height: 15px; color: var(--dsw-alias-state-error-primary); overflow-wrap: anywhere; }
231
- [data-r2-field-input][aria-invalid="true"] { border-color: var(--dsw-alias-state-error-primary); }
232
- [data-sync-field-error] { font-size: 12px; line-height: 16px; color: var(--dsw-alias-state-error-primary); overflow-wrap: anywhere; }
233
- [data-sync-ssh-input][aria-invalid="true"] { border-color: var(--dsw-alias-state-error-primary); }
234
- [data-r2-provider-row] { display: flex; gap: 8px; }
235
- [data-r2-provider-opt] { flex: 1 1 0; min-height: 44px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--dsw-alias-border-l2); background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
236
- [data-r2-provider-opt][aria-pressed="true"] { background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); box-shadow: inset 0 0 0 1px var(--dsw-alias-border-l1); }
237
- [data-r2-provider-opt]:focus-visible { outline: 2px solid var(--dsw-alias-border-l2); outline-offset: 2px; }
238
- [data-r2-config-row] { display: flex; gap: 8px; }
239
- [data-r2-config-row] > [data-sync-btn] { flex: 1 1 0; }
240
- [data-r2-config-hint] { font-size: 11px; line-height: 14px; color: var(--dsw-alias-label-secondary); }
241
- @media (max-width: 640px) {
242
- [data-sync-ssh-row] > [data-sync-btn] { min-height: 44px !important; }
243
- }
244
-
245
- /* iOS 16px field floor hold (dsh-maestro-mobile zoom guard).
246
- Every text field on the page is held at 16px under html[data-mobile-nav-ios]
247
- inside this same predicate, because iOS WebKit magnifies the visual viewport
248
- for a focused field below 16px. An earlier revision of this panel opted its
249
- own fields back out to inherit for a compact 13px scale — and every tap on
250
- those fields zoomed the page on iPhone, with modal sheets never blurring
251
- back. Function beats pixels: hold the same 16px here (the :not(#...) clause
252
- matches every element — no node carries that id — and exists purely for
253
- id-level specificity, so this declaration keeps winning over competing
254
- field rules). Android and desktop never carry the marker, so the compact
255
- scale they were designed with is untouched. */
256
- @media (max-width: 1023px) and (pointer: coarse) {
257
- html[data-mobile-nav-ios] [data-sync-root] input:not(#dsh-field-floor-opt-out),
258
- html[data-mobile-nav-ios] [data-sync-root] textarea:not(#dsh-field-floor-opt-out),
259
- html[data-mobile-nav-ios] [data-sync-root] select:not(#dsh-field-floor-opt-out) { font-size:16px !important; }
260
- }
261
- `
262
-
263
- function apply(ctx: any): void {
264
- const slots = (ctx as any).slots ?? (ctx as any).get?.('slots')
265
- if (!slots?.inject || !slots?.register) return
266
-
267
- ctx.effect(() => installStyleTag(SYNC_CSS, 'maestro-sync/settings.css'), 'maestro-sync: settings css')
268
-
269
- ctx.effect(() => {
270
- const dispose = slots.inject('settings.section', () =>
271
- slots.register(
272
- { name: 'settings.section', id: 'maestro-sync', order: 28, label: () => 'Maestro Sync' },
273
- () => React.createElement(SyncPanel, { ctx }),
274
- ),
275
- )
276
- return () => {
277
- try {
278
- (dispose as any)?.()
279
- } catch {}
280
- }
281
- }, 'maestro-sync: settings')
282
- }
283
-
284
- export { SyncPanel, apply }
285
-
286
- export default { inject, apply }
@@ -1,297 +0,0 @@
1
- import * as React from 'react'
2
- import { MaestroMark } from '../config/components/BrandMark.js'
3
-
4
- /**
5
- * Sync UI kit — DSH-native primitives, Minimalism & Swiss (design-system/MASTER.md).
6
- * Every color/geometry value maps to a --dsw-alias-* / --dsw-* token; the only
7
- * fixed hex is the shared Maestro logo tile #0A84FF (branding rule).
8
- * Components style themselves via [data-sync-*] attributes + tokens (mirrors
9
- * the dsh-maestro-jobs ui kit so mobile media queries live in one CSS layer).
10
- */
11
-
12
- export const RPC_CHANNEL = '/dsh-maestro-sync' as const
13
-
14
- // --- DSH tokens — single source, no custom hex ---------------------------------
15
- export const t = {
16
- bgBase: 'var(--dsw-alias-bg-base)',
17
- bgLayer1: 'var(--dsw-alias-bg-layer-1)',
18
- bgLayer2: 'var(--dsw-alias-bg-layer-2)',
19
- bgLayer3: 'var(--dsw-alias-bg-layer-3)',
20
- bgOverlay: 'var(--dsw-alias-bg-overlay)',
21
- borderL1: 'var(--dsw-alias-border-l1)',
22
- borderL2: 'var(--dsw-alias-border-l2)',
23
- labelPrimary: 'var(--dsw-alias-label-primary)',
24
- labelSecondary: 'var(--dsw-alias-label-secondary)',
25
- labelTertiary: 'var(--dsw-alias-label-tertiary)',
26
- labelFg: 'var(--dsw-alias-label-primary-foreground)',
27
- primaryFill: 'var(--dsw-alias-button-primary-fill)',
28
- primaryHover: 'var(--dsw-alias-button-primary-hover)',
29
- interactiveHover: 'var(--dsw-alias-interactive-bg-hover)',
30
- interactiveActive: 'var(--dsw-alias-interactive-bg-active)',
31
- brand: 'var(--dsw-alias-brand-primary)',
32
- stateError: 'var(--dsw-alias-state-error-primary)',
33
- stateSuccess: 'var(--dsw-alias-state-success-primary)',
34
- stateWarn: 'var(--dsw-alias-state-warn-primary)',
35
- shadowLv3: 'var(--dsw-shadow-lv3)',
36
- } as const
37
-
38
- // --- Shared Maestro logo (branding rule: same mark/path everywhere) -------------
39
- export function MaestroLogo(props: { outer?: number; size?: number; radius?: number }) {
40
- const outer = props.outer ?? 28
41
- const size = props.size ?? 16
42
- const radius = props.radius ?? 8
43
- return (
44
- <span
45
- data-maestro-logo=""
46
- style={{
47
- width: outer,
48
- height: outer,
49
- borderRadius: radius,
50
- display: 'inline-flex',
51
- alignItems: 'center',
52
- justifyContent: 'center',
53
- background: 'var(--dsw-alias-brand-primary, #0A84FF)',
54
- backgroundColor: '#0A84FF',
55
- color: '#fff',
56
- flex: 'none',
57
- border: '1px solid rgba(0, 0, 0, 0.08)',
58
- boxShadow: '0 0 0 1px var(--dsw-alias-border-l1)',
59
- boxSizing: 'border-box',
60
- alignSelf: 'flex-start',
61
- marginTop: 2,
62
- }}
63
- >
64
- <MaestroMark size={size} />
65
- </span>
66
- )
67
- }
68
-
69
- // --- Inline SVG icon set (no emoji-as-icon) -------------------------------------
70
- export type IconName =
71
- | 'refresh'
72
- | 'download'
73
- | 'upload'
74
- | 'swap'
75
- | 'file'
76
- | 'folder'
77
- | 'star'
78
- | 'message'
79
- | 'calendar'
80
- | 'server'
81
- | 'clock'
82
- | 'alert'
83
- | 'check'
84
- | 'close'
85
- | 'chevron-down'
86
- | 'chevron-right'
87
- | 'external'
88
-
89
- const ICON_PATHS: Record<IconName, React.ReactNode> = {
90
- refresh: <path d="M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2.5v3h-3" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />,
91
- download: <path d="M8 2.5v7m0 0L5 6.5m3 3l3-3M3 12.5h10v1H3z" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />,
92
- upload: <path d="M8 11.5v-7m0 0L5 7.5m3-3l3 3M3 12.5h10v1H3z" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />,
93
- swap: <path d="M4.5 3.5 2 6l2.5 2.5M2 6h7m2.5 5.5L14 9l-2.5-2.5M14 9H7" fill="none" stroke="currentColor" strokeWidth="1.3" strokeLinecap="round" strokeLinejoin="round" />,
94
- file: <path d="M3 13V3h6l4 4v6H3zM9 3v4h4" fill="none" stroke="currentColor" strokeWidth="1.3" strokeLinejoin="round" />,
95
- folder: <path d="M2 3.5h4.5l1.5 2H14v8H2v-10z" fill="none" stroke="currentColor" strokeWidth="1.3" strokeLinejoin="round" />,
96
- star: <path d="M8 2l1.8 3.7 4.2.6-3 3 .7 4.2L8 11.9 4.3 13.5l.7-4.2-3-3 4.2-.6z" fill="none" stroke="currentColor" strokeWidth="1.2" strokeLinejoin="round" />,
97
- message: <path d="M3 3h10v8H6l-3 3V3z" fill="none" stroke="currentColor" strokeWidth="1.2" strokeLinejoin="round" />,
98
- calendar: (
99
- <>
100
- <rect x="2.5" y="4" width="11" height="9.5" rx="1" fill="none" stroke="currentColor" strokeWidth="1.2" />
101
- <path d="M2.5 7.5h11M5.5 2.5v3m5-3v3" fill="none" stroke="currentColor" strokeWidth="1.2" strokeLinecap="round" />
102
- </>
103
- ),
104
- server: (
105
- <>
106
- <rect x="2.5" y="3" width="11" height="4" rx="1" fill="none" stroke="currentColor" strokeWidth="1.2" />
107
- <rect x="2.5" y="9" width="11" height="4" rx="1" fill="none" stroke="currentColor" strokeWidth="1.2" />
108
- <path d="M5.5 5h.01M5.5 11h.01" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" />
109
- </>
110
- ),
111
- clock: (
112
- <>
113
- <circle cx="8" cy="8" r="5.5" fill="none" stroke="currentColor" strokeWidth="1.3" />
114
- <path d="M8 5v3l2 1.5" fill="none" stroke="currentColor" strokeWidth="1.3" strokeLinecap="round" />
115
- </>
116
- ),
117
- alert: (
118
- <>
119
- <path d="M8 2.5 14 13H2L8 2.5z" fill="none" stroke="currentColor" strokeWidth="1.3" strokeLinejoin="round" />
120
- <path d="M8 7v2.5M8 11.5v.01" stroke="currentColor" strokeWidth="1.3" strokeLinecap="round" />
121
- </>
122
- ),
123
- check: <path d="M3.5 8.2l2.8 2.8L12.5 4.8" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />,
124
- close: <path d="M4 4l8 8M12 4l-8 8" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" />,
125
- 'chevron-down': <path d="M3.5 5.5 7 9l3.5-3.5" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />,
126
- 'chevron-right': <path d="M5.5 3.5 9 7l-3.5 3.5" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />,
127
- external: <path d="M6 3h7v7M13 3 7 9M13 9v4H3V3h4" fill="none" stroke="currentColor" strokeWidth="1.3" strokeLinecap="round" strokeLinejoin="round" />,
128
- }
129
-
130
- export function Icon(props: { name: IconName; size?: number }) {
131
- const size = props.size ?? 14
132
- return (
133
- <svg width={size} height={size} viewBox="0 0 16 16" fill="none" aria-hidden="true" style={{ flex: 'none' }}>
134
- {ICON_PATHS[props.name]}
135
- </svg>
136
- )
137
- }
138
-
139
- // --- Buttons (primary / outline / ghost, sm / md) — token-native ---------------
140
- export function Button(props: {
141
- variant?: 'primary' | 'outline' | 'ghost'
142
- size?: 'sm' | 'md'
143
- icon?: IconName
144
- busy?: boolean
145
- children?: React.ReactNode
146
- style?: React.CSSProperties
147
- } & Record<string, unknown>) {
148
- const { variant = 'outline', size = 'md', icon, busy, children, style, ...rest } = props as any
149
- const base: React.CSSProperties = {
150
- display: 'inline-flex',
151
- alignItems: 'center',
152
- justifyContent: 'center',
153
- gap: 6,
154
- minHeight: size === 'sm' ? 32 : 36,
155
- padding: size === 'sm' ? '0 12px' : '0 14px',
156
- borderRadius: size === 'sm' ? 16 : 18,
157
- border: '1px solid var(--dsw-alias-border-l2)',
158
- background: variant === 'primary' ? 'var(--dsw-alias-button-primary-fill)' : 'transparent',
159
- color: variant === 'primary' ? 'var(--dsw-alias-label-primary-foreground)' : 'var(--dsw-alias-label-primary)',
160
- font: 'inherit',
161
- fontSize: 13,
162
- lineHeight: '20px',
163
- fontWeight: 500,
164
- cursor: 'pointer',
165
- fontFamily: 'inherit',
166
- whiteSpace: 'nowrap',
167
- boxSizing: 'border-box',
168
- }
169
- if (variant === 'ghost') base.border = '1px solid transparent'
170
- const disabled = rest.disabled === true
171
- return (
172
- <button
173
- type="button"
174
- data-sync-btn=""
175
- data-variant={variant}
176
- data-size={size}
177
- {...rest}
178
- disabled={disabled || busy === true}
179
- style={{ ...base, ...(style ?? {}) }}
180
- onMouseEnter={(e) => {
181
- if (disabled || busy) return
182
- if (variant === 'primary') (e.currentTarget as HTMLButtonElement).style.background = 'var(--dsw-alias-button-primary-hover)'
183
- else (e.currentTarget as HTMLButtonElement).style.background = 'var(--dsw-alias-interactive-bg-hover)'
184
- }}
185
- onMouseLeave={(e) => {
186
- if (variant === 'primary') (e.currentTarget as HTMLButtonElement).style.background = 'var(--dsw-alias-button-primary-fill)'
187
- else (e.currentTarget as HTMLButtonElement).style.background = variant === 'outline' ? 'transparent' : 'transparent'
188
- }}
189
- >
190
- {busy ? <span className="sync-spin" aria-hidden="true">◌</span> : icon ? <Icon name={icon} /> : null}
191
- {children}
192
- </button>
193
- )
194
- }
195
-
196
- // --- Stat tile — tappable summary card ------------------------------------------
197
- export function StatTile(props: { icon: IconName; value: React.ReactNode; label: string; hint?: string; tone?: 'default' | 'success' | 'error' | 'warn'; onClick?: () => void; ariaLabel?: string }) {
198
- const toneColor = props.tone === 'success' ? t.stateSuccess : props.tone === 'error' ? t.stateError : props.tone === 'warn' ? t.stateWarn : undefined
199
- const isBtn = props.onClick !== undefined
200
- const inner = (
201
- <>
202
- <span data-sync-stat-icon="" style={{ color: toneColor ?? 'var(--dsw-alias-label-tertiary)', display: 'inline-flex' }}>
203
- <Icon name={props.icon} />
204
- </span>
205
- <span data-sync-stat-value="" style={{ color: 'var(--dsw-alias-label-primary)' }}>{props.value}</span>
206
- <span data-sync-stat-label="" style={{ color: 'var(--dsw-alias-label-secondary)' }}>{props.label}</span>
207
- {props.hint ? <span data-sync-stat-hint="" style={{ color: 'var(--dsw-alias-label-tertiary)' }}>{props.hint}</span> : null}
208
- </>
209
- )
210
- if (isBtn) {
211
- return (
212
- <button type="button" data-sync-stat="" role="button" aria-label={props.ariaLabel} onClick={props.onClick}>
213
- {inner}
214
- </button>
215
- )
216
- }
217
- return <div data-sync-stat="">{inner}</div>
218
- }
219
-
220
- // --- Small status badge -----------------------------------------------------------
221
- export function Badge(props: { children: React.ReactNode; tone?: 'default' | 'success' | 'error' | 'warn' | 'brand'; icon?: IconName }) {
222
- const tone = props.tone ?? 'default'
223
- return (
224
- <span data-sync-badge="" data-tone={tone}>
225
- {props.icon ? <Icon name={props.icon} size={11} /> : null}
226
- {props.children}
227
- </span>
228
- )
229
- }
230
-
231
- // --- File + action helpers ---------------------------------------------------------
232
- export function formatLastSync(v: string | null): string {
233
- if (!v) return 'never'
234
- try {
235
- const d = new Date(v)
236
- if (Number.isNaN(d.getTime())) return v
237
- return d.toLocaleString()
238
- } catch {
239
- return v
240
- }
241
- }
242
-
243
- export function formatFile(path: string): { icon: IconName; title: string; path: string; meta: string } {
244
- if (path.startsWith('maestro-memory/daily/')) {
245
- const date = path.replace('maestro-memory/daily/', '').replace('.md', '')
246
- try {
247
- const d = new Date(date)
248
- if (!isNaN(d.getTime())) return { icon: 'calendar', title: `Daily notes — ${d.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })}`, path, meta: 'Daily' }
249
- } catch {}
250
- return { icon: 'calendar', title: `Daily notes — ${date}`, path, meta: 'Daily' }
251
- }
252
- if (path.startsWith('maestro-memory/projects/')) {
253
- const hash = path.split('/')[2] ?? ''
254
- return { icon: 'folder', title: 'Project memory', path, meta: hash.slice(0, 7) }
255
- }
256
- if (path === 'maestro-memory/MEMORY.md') return { icon: 'star', title: 'Global memory', path, meta: 'Global' }
257
- if (path.startsWith('sessions/')) {
258
- const hash = path.split('/')[1] ?? ''
259
- return { icon: 'message', title: 'Session', path, meta: hash.slice(0, 7) }
260
- }
261
- return { icon: 'file', title: path.split('/').pop() ?? path, path, meta: path.split('/')[0] ?? '' }
262
- }
263
-
264
- /** Exact action label — same-name files are never called "in sync" here. */
265
- export function actionLabel(action: any): string {
266
- switch (action?.action) {
267
- case 'copy':
268
- return 'copy'
269
- case 'merge':
270
- return `merge +${action.added ?? 0} ${(action.added ?? 0) === 1 ? 'new entry' : 'new entries'}`
271
- case 'conflict':
272
- return 'conflict'
273
- default:
274
- return 'skip'
275
- }
276
- }
277
-
278
- export function actionTone(action: any): 'default' | 'success' | 'error' | 'warn' | 'brand' {
279
- switch (action?.action) {
280
- case 'copy':
281
- return 'brand'
282
- case 'merge':
283
- return 'success'
284
- case 'conflict':
285
- return 'error'
286
- default:
287
- return 'default'
288
- }
289
- }
290
-
291
- export function humanSummary(status: any): string {
292
- const localOnly = status?.localOnly ?? 0
293
- const remoteOnly = status?.remoteOnly ?? 0
294
- const both = status?.both ?? 0
295
- if (localOnly === 0 && remoteOnly === 0 && both === 0) return 'No eligible files found on either side.'
296
- return `${localOnly} only here · ${remoteOnly} only there · ${both} on both (content compared in Preview)`
297
- }