@1agh/maude 2.1.0 → 2.1.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.
- package/apps/studio/access/request.ts +1 -0
- package/apps/studio/actions/agents.ts +27 -0
- package/apps/studio/actions/defs/app.ts +28 -1
- package/apps/studio/actions/defs/sync.ts +4 -0
- package/apps/studio/actions.manifest.json +60 -2
- package/apps/studio/actions.parity.json +13 -1
- package/apps/studio/bin/_curl-local.mjs +7 -4
- package/apps/studio/client/app.jsx +16 -4
- package/apps/studio/client/home/HomeAccountsRow.jsx +221 -0
- package/apps/studio/client/home/HomeConnection.jsx +111 -0
- package/apps/studio/client/home/home-accounts-model.js +110 -1
- package/apps/studio/client/home/home-api.js +6 -2
- package/apps/studio/client/home/home-app.jsx +74 -12
- package/apps/studio/client/home/home-model.js +40 -1
- package/apps/studio/client/home/home-where-model.js +105 -0
- package/apps/studio/client/home/home.css +233 -1
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +3 -1
- package/apps/studio/client/hooks/use-tabs.jsx +11 -4
- package/apps/studio/client/panels/TeamProjects.jsx +137 -134
- package/apps/studio/client/share-link.js +12 -0
- package/apps/studio/client/styles/_index.css +4 -0
- package/apps/studio/client/v2/diagnostics/diagnostics-host.jsx +1 -0
- package/apps/studio/client/v2/diagnostics/diagnostics-model.js +32 -2
- package/apps/studio/client/v2/diagnostics/diagnostics-sheet.jsx +35 -8
- package/apps/studio/client/v2/diagnostics/diagnostics.css +34 -0
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +94 -3
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +187 -4
- package/apps/studio/client/v2/link-server/LinkServerDialog.jsx +492 -0
- package/apps/studio/client/v2/link-server/LinkServerHost.jsx +42 -0
- package/apps/studio/client/v2/link-server/link-server-api.js +142 -0
- package/apps/studio/client/v2/link-server/link-server-model.js +438 -0
- package/apps/studio/client/v2/link-server/link-server.css +109 -0
- package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +31 -86
- package/apps/studio/client/v2/onboarding/onboarding-model.js +1 -18
- package/apps/studio/client/v2/search/search-keywords.js +3 -2
- package/apps/studio/client/v2/settings/account.jsx +4 -2
- package/apps/studio/client/v2/settings/advanced-section.jsx +245 -148
- package/apps/studio/client/v2/settings/connection-row.jsx +3 -59
- package/apps/studio/client/v2/settings/connections-section.jsx +118 -425
- package/apps/studio/client/v2/settings/general-section.jsx +138 -43
- package/apps/studio/client/v2/settings/project-sync-settings.jsx +4 -3
- package/apps/studio/client/v2/settings/reset-section.jsx +14 -3
- package/apps/studio/client/v2/settings/settings-card.jsx +142 -0
- package/apps/studio/client/v2/settings/settings-cards.js +220 -0
- package/apps/studio/client/v2/settings/settings-handlers.js +7 -6
- package/apps/studio/client/v2/settings/settings-model.js +91 -31
- package/apps/studio/client/v2/settings/settings-sheet.jsx +25 -6
- package/apps/studio/client/v2/settings/settings.css +374 -64
- package/apps/studio/client/v2/settings/this-project-card.jsx +730 -0
- package/apps/studio/client/v2/settings/this-project-model.js +172 -0
- package/apps/studio/client/v2/settings/use-connections.js +3 -2
- package/apps/studio/client/v2/settings/use-open-card.js +37 -0
- package/apps/studio/client/v2/shell/connection-state.js +197 -0
- package/apps/studio/client/v2/shell/menu-runner.js +7 -2
- package/apps/studio/client/v2/shell/project-account-bus.js +36 -0
- package/apps/studio/client/v2/shell/project-account-card.jsx +357 -148
- package/apps/studio/client/v2/shell/project-account-model.js +272 -149
- package/apps/studio/client/v2/shell/project-account-toast.js +66 -0
- package/apps/studio/client/v2/shell/project-account.css +237 -0
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +166 -83
- package/apps/studio/client/v2/shell/shell-parity.js +3 -2
- package/apps/studio/client/v2/shell/shell-parity.json +40 -26
- package/apps/studio/client/v2/shell/use-account.js +2 -0
- package/apps/studio/client/v2/signin/use-signin.js +1 -1
- package/apps/studio/cloud/endpoints.ts +29 -4
- package/apps/studio/dist/client.bundle.js +834 -834
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/home/accounts.ts +30 -11
- package/apps/studio/home/cloud.ts +6 -1
- package/apps/studio/home/hub-health.ts +76 -0
- package/apps/studio/home/routes.ts +9 -3
- package/apps/studio/http.ts +8 -0
- package/apps/studio/migrate/hub.ts +8 -1
- package/apps/studio/routes/hub-link-folder.ts +334 -0
- package/apps/studio/routes/hub-signin.ts +78 -1
- package/apps/studio/routes/index.ts +4 -0
- package/apps/studio/routes/sync.ts +22 -4
- package/apps/studio/shell/api-key.ts +11 -0
- package/apps/studio/sync/accepted-cold-start.ts +144 -8
- package/apps/studio/sync/action-stage.ts +18 -1
- package/apps/studio/sync/ctl-heal.ts +58 -0
- package/apps/studio/sync/file-ledger.ts +38 -4
- package/apps/studio/sync/file-plane.ts +226 -19
- package/apps/studio/sync/held-deletes.ts +86 -5
- package/apps/studio/sync/hub-link.ts +8 -0
- package/apps/studio/sync/index.ts +68 -4
- package/apps/studio/sync/link-consent.ts +22 -75
- package/apps/studio/sync/link-survey.ts +252 -0
- package/apps/studio/sync/local-kernel.ts +16 -1
- package/apps/studio/sync/seed-progress.ts +12 -0
- package/apps/studio/sync/source-recovery.ts +18 -2
- package/apps/studio/sync/status.ts +11 -1
- package/apps/studio/sync/writer-registry.ts +5 -0
- package/apps/studio/whats-new.json +18 -0
- package/cli/lib/bash-guard.mjs +19 -0
- package/cli/lib/design-help.gen.mjs +1 -1
- package/package.json +9 -8
- package/apps/studio/client/v2/onboarding/HubSheet.jsx +0 -212
- package/apps/studio/client/v2/shell/account-card-model.js +0 -114
- package/apps/studio/client/v2/shell/account-card.jsx +0 -189
|
@@ -185,6 +185,7 @@ export default function DiagnosticsHost({ toast }) {
|
|
|
185
185
|
cloud: cfg?.cloud ?? null,
|
|
186
186
|
groupPaths: (groups || []).map((g) => g.path).filter(Boolean),
|
|
187
187
|
names: canvasNamesBySlug(groups),
|
|
188
|
+
designRel: cfg?.designRel,
|
|
188
189
|
behind: gitStatus?.behind || 0,
|
|
189
190
|
onGetLatest: gitGetLatest,
|
|
190
191
|
resync,
|
|
@@ -13,11 +13,11 @@ import { syncPresentation } from '../../../sync/presentation.ts';
|
|
|
13
13
|
export const STATUS_IDS = Object.freeze(['diag.sync', 'diag.server', 'diag.ai']);
|
|
14
14
|
export const VALUE_IDS = Object.freeze(['diag.address', 'diag.process', 'diag.project-folder']);
|
|
15
15
|
|
|
16
|
-
/** Sync: one word. A solo project
|
|
16
|
+
/** Sync: one word. A solo project is "Only on this Mac" (a neutral word, not a problem; canvas 17). */
|
|
17
17
|
export function syncWord(syncStatus, { project, aiHeld = false } = {}) {
|
|
18
18
|
if (aiHeld) return { word: 'Needs you', tone: 'warn' };
|
|
19
19
|
const p = syncPresentation(syncStatus, { project });
|
|
20
|
-
if (!p) return { word: '
|
|
20
|
+
if (!p) return { word: 'Only on this Mac', tone: 'neutral' };
|
|
21
21
|
switch (p.phase) {
|
|
22
22
|
case 'synced':
|
|
23
23
|
return { word: 'Up to date', tone: 'ok' };
|
|
@@ -40,6 +40,36 @@ export function syncWord(syncStatus, { project, aiHeld = false } = {}) {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* 2.1.1 T3 — Sync on a project only on this Mac (canvas 17 ac-sync): the next step, not a dead end. Two
|
|
45
|
+
* ways out, the same two as the avatar menu: Maude Cloud (the existing move, `share.move-to-cloud` → the
|
|
46
|
+
* Share sheet's Move to Maude Cloud) and your own server (`account.link-server` → the one dialog). Both
|
|
47
|
+
* are the Mac app's (the move answers only the desktop window), so a browser tab gets words, no buttons.
|
|
48
|
+
*/
|
|
49
|
+
export function soloSync({ native = false, folder = '' } = {}) {
|
|
50
|
+
const at = typeof folder === 'string' && folder ? tilde(folder) : '';
|
|
51
|
+
return {
|
|
52
|
+
title: 'Only on this Mac',
|
|
53
|
+
body: 'Nothing leaves this Mac yet. Put it on Maude Cloud to open it from any Mac and share it — or sync it with your own server.',
|
|
54
|
+
actions: native
|
|
55
|
+
? [
|
|
56
|
+
{
|
|
57
|
+
id: 'share.move-to-cloud',
|
|
58
|
+
label: 'Create project on Maude Cloud',
|
|
59
|
+
primary: true,
|
|
60
|
+
testid: 'diag-sync-to-cloud',
|
|
61
|
+
},
|
|
62
|
+
{ id: 'account.link-server', label: 'Link your server', testid: 'diag-sync-link-server' },
|
|
63
|
+
]
|
|
64
|
+
: [],
|
|
65
|
+
fine: !native
|
|
66
|
+
? 'Open this project in the Maude app to put it on Maude Cloud or link your server.'
|
|
67
|
+
: at
|
|
68
|
+
? `It stays in ${at} either way.`
|
|
69
|
+
: 'It stays on this Mac either way.',
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
43
73
|
/**
|
|
44
74
|
* Server: the studio answers (this page is served by it); the socket says whether it is live. In a cloud tab
|
|
45
75
|
* there is no process of yours to name — the server is the cloud's (S11.15, 06 · ad-edge-where).
|
|
@@ -15,6 +15,7 @@ import { useModalFocus } from '../shell/modal-focus.js';
|
|
|
15
15
|
import { StIcon } from '../../shell/icons.jsx';
|
|
16
16
|
import { TeamProjectsDialog } from '../../panels/TeamProjects.jsx';
|
|
17
17
|
import { isNativeApp } from '../../github.js';
|
|
18
|
+
import { menuRunner } from '../shell/menu-runner.js';
|
|
18
19
|
import SyncDetails from './sync-details/sync-details.jsx';
|
|
19
20
|
import { AdvancedFold } from '../fold/advanced-fold.jsx';
|
|
20
21
|
import ReadinessList from '../../panels/ReadinessList.jsx';
|
|
@@ -26,6 +27,7 @@ import {
|
|
|
26
27
|
LOG_FILTERS,
|
|
27
28
|
logLines,
|
|
28
29
|
modeStamp,
|
|
30
|
+
soloSync,
|
|
29
31
|
tilde,
|
|
30
32
|
} from './diagnostics-model.js';
|
|
31
33
|
import {
|
|
@@ -368,21 +370,45 @@ function ResyncCard({ view }) {
|
|
|
368
370
|
);
|
|
369
371
|
}
|
|
370
372
|
|
|
371
|
-
function SyncView({ sync }) {
|
|
373
|
+
function SyncView({ sync, folder = '', onClose }) {
|
|
372
374
|
const [latest, setLatest] = useState('');
|
|
373
375
|
const [busy, setBusy] = useState(false);
|
|
374
376
|
const [signInAt, setSignInAt] = useState(null);
|
|
375
377
|
if (!sync.status) {
|
|
378
|
+
// 2.1.1 T3 (canvas 17 ac-sync): a project only on this Mac offers the next step, not a dead end.
|
|
379
|
+
const v = soloSync({ native: sync.native ?? isNativeApp(), folder });
|
|
376
380
|
return (
|
|
377
|
-
<div className="dg-card" data-testid="diag-sync-solo">
|
|
381
|
+
<div className="dg-card dg-solo" data-testid="diag-sync-solo">
|
|
378
382
|
<div className="dg-hd">
|
|
379
|
-
<strong>Sync</strong>
|
|
383
|
+
<strong>{sync.project ? `Sync · ${sync.project}` : 'Sync'}</strong>
|
|
380
384
|
<Word w={sync.word} />
|
|
381
385
|
</div>
|
|
382
|
-
<
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
+
<div className="dg-solo-b">
|
|
387
|
+
<span className="dg-solo-ic" aria-hidden="true">
|
|
388
|
+
<StIcon name="laptop" size={20} />
|
|
389
|
+
</span>
|
|
390
|
+
<strong>{v.title}</strong>
|
|
391
|
+
<p className="dg-empty">{v.body}</p>
|
|
392
|
+
{v.actions.length ? (
|
|
393
|
+
<div className="dg-solo-acts">
|
|
394
|
+
{v.actions.map((a) => (
|
|
395
|
+
<button
|
|
396
|
+
key={a.id}
|
|
397
|
+
type="button"
|
|
398
|
+
className={a.primary ? 'dg-btn dg-btn--primary' : 'dg-btn'}
|
|
399
|
+
data-testid={a.testid}
|
|
400
|
+
onClick={() => {
|
|
401
|
+
menuRunner.run(a.id);
|
|
402
|
+
onClose?.();
|
|
403
|
+
}}
|
|
404
|
+
>
|
|
405
|
+
{a.label}
|
|
406
|
+
</button>
|
|
407
|
+
))}
|
|
408
|
+
</div>
|
|
409
|
+
) : null}
|
|
410
|
+
<p className="dg-hint">{v.fine}</p>
|
|
411
|
+
</div>
|
|
386
412
|
</div>
|
|
387
413
|
);
|
|
388
414
|
}
|
|
@@ -423,6 +449,7 @@ function SyncView({ sync }) {
|
|
|
423
449
|
cloud={sync.cloud}
|
|
424
450
|
native={sync.native ?? isNativeApp()}
|
|
425
451
|
names={sync.names}
|
|
452
|
+
designRel={sync.designRel}
|
|
426
453
|
focusConflict={sync.focus?.slug ?? null}
|
|
427
454
|
focusSeq={sync.focus?.seq ?? 0}
|
|
428
455
|
onSignInAgain={(url) => setSignInAt(url)}
|
|
@@ -549,7 +576,7 @@ export default function DiagnosticsSheet({
|
|
|
549
576
|
</div>
|
|
550
577
|
</div>
|
|
551
578
|
) : (
|
|
552
|
-
<SyncView sync={sync} />
|
|
579
|
+
<SyncView sync={sync} folder={info?.folder} onClose={onClose} />
|
|
553
580
|
)}
|
|
554
581
|
</div>
|
|
555
582
|
</section>
|
|
@@ -259,6 +259,40 @@
|
|
|
259
259
|
background: var(--accent);
|
|
260
260
|
filter: brightness(1.06);
|
|
261
261
|
}
|
|
262
|
+
/* 2.1.1 T3 — Sync on a project only on this Mac (canvas 17 ac-sync): centred, two ways out. */
|
|
263
|
+
.dg-solo-b {
|
|
264
|
+
display: flex;
|
|
265
|
+
flex-direction: column;
|
|
266
|
+
align-items: center;
|
|
267
|
+
gap: var(--space-2, 8px);
|
|
268
|
+
padding: var(--space-4, 16px) var(--space-3, 12px) var(--space-2, 8px);
|
|
269
|
+
text-align: center;
|
|
270
|
+
}
|
|
271
|
+
.dg-solo-ic {
|
|
272
|
+
display: grid;
|
|
273
|
+
place-items: center;
|
|
274
|
+
width: 44px;
|
|
275
|
+
height: 44px;
|
|
276
|
+
border-radius: var(--radius-lg, 12px);
|
|
277
|
+
background: var(--bg-3);
|
|
278
|
+
color: var(--fg-1);
|
|
279
|
+
}
|
|
280
|
+
.dg-solo-b > strong {
|
|
281
|
+
font-size: var(--type-md, 15px);
|
|
282
|
+
color: var(--fg-0);
|
|
283
|
+
}
|
|
284
|
+
.dg-solo-b .dg-empty {
|
|
285
|
+
max-width: 36ch;
|
|
286
|
+
font-size: var(--type-sm, 13px);
|
|
287
|
+
color: var(--fg-1);
|
|
288
|
+
}
|
|
289
|
+
.dg-solo-acts {
|
|
290
|
+
display: flex;
|
|
291
|
+
flex-wrap: wrap;
|
|
292
|
+
justify-content: center;
|
|
293
|
+
gap: var(--space-2, 8px);
|
|
294
|
+
margin-top: var(--space-1, 4px);
|
|
295
|
+
}
|
|
262
296
|
.dg-notice,
|
|
263
297
|
.dg-latest {
|
|
264
298
|
display: flex;
|
|
@@ -117,7 +117,9 @@ const ATTENTION = new Set(['conflict', 'stuck', 'referenced-but-unoffered', 'loc
|
|
|
117
117
|
|
|
118
118
|
/** Words for the per-file states a person has to look at (file-ledger.ts owns the union). */
|
|
119
119
|
export const DELIVERY_WORD = Object.freeze({
|
|
120
|
-
|
|
120
|
+
// 2.1.1 T14 — this Mac's version is parked BESIDE the file (not in the trash); the row that names the
|
|
121
|
+
// copy is `lists.fileConflicts`. This is the line for a conflict whose copy is not parked yet.
|
|
122
|
+
conflict: 'changed here and in the project — sync is sorting it out',
|
|
121
123
|
stuck: 'stuck',
|
|
122
124
|
'referenced-but-unoffered': 'used, never received',
|
|
123
125
|
'local-only': 'only on this Mac',
|
|
@@ -126,6 +128,51 @@ export const DELIVERY_WORD = Object.freeze({
|
|
|
126
128
|
'hub-only': 'on the hub only',
|
|
127
129
|
});
|
|
128
130
|
|
|
131
|
+
/** 2.1.1 T14 — the lane words a set-aside notice carries (`sync/accepted-cold-start.ts` `SET_ASIDE_WORDS`). */
|
|
132
|
+
const SET_ASIDE_LANE_WORD = Object.freeze({
|
|
133
|
+
meta: 'layout',
|
|
134
|
+
annotations: 'sticky notes',
|
|
135
|
+
comments: 'comments',
|
|
136
|
+
});
|
|
137
|
+
const SET_ASIDE_PREFIX = 'set-aside-';
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* 2.1.1 T14 — the canvases whose layout, sticky notes or comments the server's version replaced after a
|
|
141
|
+
* first link (the runtime's `set-aside-<slug>` notices): this Mac's are kept in the canvas's recovery
|
|
142
|
+
* folder. `{ slug, lanes: ['layout', …], where }`; a slug the runtime could not have made is dropped.
|
|
143
|
+
*/
|
|
144
|
+
export function setAsideRows(status) {
|
|
145
|
+
const out = [];
|
|
146
|
+
for (const n of Array.isArray(status?.notices) ? status.notices : []) {
|
|
147
|
+
if (!n || typeof n.id !== 'string' || !n.id.startsWith(SET_ASIDE_PREFIX)) continue;
|
|
148
|
+
const slug = n.id.slice(SET_ASIDE_PREFIX.length);
|
|
149
|
+
if (!SAFE_SLUG.test(slug) || out.some((r) => r.slug === slug)) continue;
|
|
150
|
+
const lanes = (Array.isArray(n.lanes) ? n.lanes : [])
|
|
151
|
+
.map((l) => SET_ASIDE_LANE_WORD[l])
|
|
152
|
+
.filter(Boolean)
|
|
153
|
+
.filter((w, i, all) => all.indexOf(w) === i);
|
|
154
|
+
out.push({ slug, lanes, where: `_history/${slug}/sync-recovery` });
|
|
155
|
+
}
|
|
156
|
+
return out.slice(0, 50);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** "layout", "layout and comments", "layout, sticky notes and comments" */
|
|
160
|
+
export function laneList(lanes) {
|
|
161
|
+
if (lanes.length < 2) return lanes[0] ?? 'version';
|
|
162
|
+
return `${lanes.slice(0, -1).join(', ')} and ${lanes[lanes.length - 1]}`;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** The sentence a set-aside row says (CONTRACT §4: what happened · what is safe). */
|
|
166
|
+
export function setAsideWords(name, lanes) {
|
|
167
|
+
const many = lanes.length > 1 || lanes[0] === 'sticky notes' || lanes[0] === 'comments';
|
|
168
|
+
return `${cleanName(name, 'This canvas')}: the server’s ${laneList(lanes)} ${many ? 'are' : 'is'} used; yours ${many ? 'are' : 'is'} kept.`;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** The sentence a file-conflict row says: which copy is the file, where yours is. */
|
|
172
|
+
export function fileConflictWords(copyName) {
|
|
173
|
+
return `The server’s version is the file; yours is kept beside it as ${cleanName(copyName, 'a copy')}.`;
|
|
174
|
+
}
|
|
175
|
+
|
|
129
176
|
const thousands = (n) => String(n).replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
|
|
130
177
|
|
|
131
178
|
export function syncDetailsModel(
|
|
@@ -187,6 +234,36 @@ export function syncDetailsModel(
|
|
|
187
234
|
.filter((f) => f && typeof f.folder === 'string' && isCount(f.count))
|
|
188
235
|
.slice(0, 10)
|
|
189
236
|
.map((f) => ({ folder: f.folder, count: f.count })),
|
|
237
|
+
// 2.1.1 N4 — the held set this card shows; the answer carries it back (a set that grew since
|
|
238
|
+
// answers `changed` and nothing is sent)
|
|
239
|
+
digest:
|
|
240
|
+
typeof deletesOut.digest === 'string' && /^[0-9a-f]{16,64}$/.test(deletesOut.digest)
|
|
241
|
+
? deletesOut.digest
|
|
242
|
+
: '',
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
// 2.1.1 T13 — the project deleted a batch this Mac still holds: its own card and answer (Remove
|
|
246
|
+
// here too · Keep them here), the incoming twin of the card above.
|
|
247
|
+
const deletesIn = held.find((h) => h.kind === 'delete-in' && isCount(h.count) && h.count > 0);
|
|
248
|
+
if (deletesIn) {
|
|
249
|
+
needs.push({
|
|
250
|
+
kind: 'deletes-incoming',
|
|
251
|
+
count: deletesIn.count,
|
|
252
|
+
detail: cleanName(
|
|
253
|
+
deletesIn.detail,
|
|
254
|
+
'The project deleted files that are still on this Mac.',
|
|
255
|
+
HELD_DETAIL_MAX
|
|
256
|
+
),
|
|
257
|
+
folders: (Array.isArray(deletesIn.folders) ? deletesIn.folders : [])
|
|
258
|
+
.filter((f) => f && typeof f.folder === 'string' && isCount(f.count))
|
|
259
|
+
.slice(0, 10)
|
|
260
|
+
.map((f) => ({ folder: f.folder, count: f.count })),
|
|
261
|
+
// 2.1.1 T8 — the held set this card shows; the answer carries it back (a set that changed
|
|
262
|
+
// since answers `changed` and nothing is removed)
|
|
263
|
+
digest:
|
|
264
|
+
typeof deletesIn.digest === 'string' && /^[0-9a-f]{16,64}$/.test(deletesIn.digest)
|
|
265
|
+
? deletesIn.digest
|
|
266
|
+
: '',
|
|
190
267
|
});
|
|
191
268
|
}
|
|
192
269
|
const purge = files?.deletePurge;
|
|
@@ -216,6 +293,18 @@ export function syncDetailsModel(
|
|
|
216
293
|
attention.sort((a, b) => a[0].localeCompare(b[0]));
|
|
217
294
|
hubOnly.sort((a, b) => a.localeCompare(b));
|
|
218
295
|
}
|
|
296
|
+
// 2.1.1 T14 — a file in conflict whose copy is parked beside it gets its own row naming the copy;
|
|
297
|
+
// the generic attention list keeps the rest (a conflict whose copy is not parked yet included).
|
|
298
|
+
const copies =
|
|
299
|
+
files?.conflictCopies && typeof files.conflictCopies === 'object' ? files.conflictCopies : {};
|
|
300
|
+
const fileConflicts = [];
|
|
301
|
+
const attentionRest = [];
|
|
302
|
+
for (const [rel, state] of attention) {
|
|
303
|
+
const copy = state === 'conflict' ? copies[rel] : undefined;
|
|
304
|
+
if (typeof copy === 'string' && copy && !copy.includes('..') && !copy.startsWith('/')) {
|
|
305
|
+
fileConflicts.push({ rel, copy, copyName: copy.slice(copy.lastIndexOf('/') + 1) });
|
|
306
|
+
} else attentionRest.push([rel, state]);
|
|
307
|
+
}
|
|
219
308
|
|
|
220
309
|
const counts = [];
|
|
221
310
|
if (progress) {
|
|
@@ -260,7 +349,7 @@ export function syncDetailsModel(
|
|
|
260
349
|
lists: {
|
|
261
350
|
// `delete-out` is the Needs you card above (its own answer), not a second row here.
|
|
262
351
|
held: held
|
|
263
|
-
.filter((h) => !(deletesOut && h === deletesOut))
|
|
352
|
+
.filter((h) => !(deletesOut && h === deletesOut) && !(deletesIn && h === deletesIn))
|
|
264
353
|
.map((h) => ({
|
|
265
354
|
kind: h.kind,
|
|
266
355
|
detail: cleanName(h.detail, 'Sync paused — nothing was removed.', HELD_DETAIL_MAX),
|
|
@@ -271,7 +360,9 @@ export function syncDetailsModel(
|
|
|
271
360
|
})),
|
|
272
361
|
rateLimited: files?.rateLimited ? { waiting: rateLimited } : null,
|
|
273
362
|
failed,
|
|
274
|
-
attention:
|
|
363
|
+
attention: attentionRest.slice(0, 50),
|
|
364
|
+
fileConflicts: fileConflicts.slice(0, 50),
|
|
365
|
+
setAside: setAsideRows(status),
|
|
275
366
|
// Issue #207 (7b) — deleted on this Mac and kept on the hub: listed, never "waiting".
|
|
276
367
|
hubOnly: { count: hubOnly.length, paths: hubOnly.slice(0, 50) },
|
|
277
368
|
// Issue #207 — a long run of pictures going up (a render sequence), and the folders this
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Sync, rebuilt. The controls carry the v1 hooks the e2e scenarios drive (S11.12b): sync-panel (root) ·
|
|
3
3
|
// sync-ai-held · sync-ai-publish · sync-ai-discard · sync-assets-cancel · sync-signin-again ·
|
|
4
4
|
// sync-delivery-attention · sync-deletes-held (+ -delete / -keep / -confirm / -cancel / -said /
|
|
5
|
-
// -folders / -confirming) · sync-
|
|
5
|
+
// -folders / -confirming) · sync-kept (+ sync-file-conflict-<i> / -reveal-<i> / sync-set-aside-<i> /
|
|
6
|
+
// -reveal-<i>, 2.1.1 T14) · sync-deletes-incoming (+ -remove / -keep / -said / -folders) · sync-deletes-purging · sync-hub-only. Replaces the v1 Sync panel's mount in the sheet (its routes stay; SyncPanel.jsx and
|
|
6
7
|
// SourceConflictPanel.jsx keep their files). What needs the person comes first, each with its own
|
|
7
8
|
// choice; the transfer, the counts and the lists follow.
|
|
8
9
|
//
|
|
@@ -18,7 +19,15 @@ import { lineDiff } from '../../../panels/SourceConflictPanel.jsx';
|
|
|
18
19
|
import { readCodeConsent } from '../../code/code-consent.js';
|
|
19
20
|
import { CodeConsentSheet } from '../../code/code-consent-sheet.jsx';
|
|
20
21
|
import { menuRunner } from '../../shell/menu-runner.js';
|
|
21
|
-
import {
|
|
22
|
+
import { nativeDoors, projectRel } from '../../shell/native-doors.js';
|
|
23
|
+
import {
|
|
24
|
+
DELIVERY_WORD,
|
|
25
|
+
cleanName,
|
|
26
|
+
fileConflictWords,
|
|
27
|
+
resolvedWords,
|
|
28
|
+
setAsideWords,
|
|
29
|
+
syncDetailsModel,
|
|
30
|
+
} from './sync-details-model.js';
|
|
22
31
|
import { UNSYNCED_SHOWN, groupByCanvas, readUnsyncedRefs } from './unsynced-refs.js';
|
|
23
32
|
|
|
24
33
|
/** Registry id → the `choice` the conflict route takes. */
|
|
@@ -298,7 +307,12 @@ function HeldDeletesCard({ need, fetchImpl }) {
|
|
|
298
307
|
async function answer(kind) {
|
|
299
308
|
setBusy(true);
|
|
300
309
|
setSaid('');
|
|
301
|
-
|
|
310
|
+
// 2.1.1 N4 — the answer names the set on screen (`need.digest`), never "whatever is held now"
|
|
311
|
+
const r = await postJson(fetchImpl, '/_api/sync/held-deletes', {
|
|
312
|
+
answer: kind,
|
|
313
|
+
folder: null,
|
|
314
|
+
digest: need.digest,
|
|
315
|
+
});
|
|
302
316
|
setBusy(false);
|
|
303
317
|
setConfirming(false);
|
|
304
318
|
setSaid(heldDeletesWords(r));
|
|
@@ -376,6 +390,86 @@ function HeldDeletesCard({ need, fetchImpl }) {
|
|
|
376
390
|
);
|
|
377
391
|
}
|
|
378
392
|
|
|
393
|
+
/** 2.1.1 T13 — the words after an answer to a batch the project deleted (CONTRACT §3–§4). */
|
|
394
|
+
export function heldIncomingWords(answer) {
|
|
395
|
+
// 2.1.1 T8 — the held set changed after the card was drawn: the card redraws with the new one
|
|
396
|
+
if (answer?.reason === 'changed')
|
|
397
|
+
return 'The list changed. Nothing was removed — look at it again.';
|
|
398
|
+
if (!answer?.ok) return safeDetail(answer?.detail, 'That didn’t work. Nothing was removed.');
|
|
399
|
+
if (answer.how === 'kept-here')
|
|
400
|
+
return `Kept here. ${filesWord(answer.count)} stay on this Mac and aren’t sent back.`;
|
|
401
|
+
return `Removing ${filesWord(answer.count)}. They’re moving to the trash.`;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* 2.1.1 T13 — the project deleted a batch larger than sync removes unasked, and this Mac still has
|
|
406
|
+
* the files. Remove here too files them into the trash in one pass (recoverable); Keep them here
|
|
407
|
+
* leaves them and never sends them back. Both `POST /_api/sync/held-deletes` (this Mac only).
|
|
408
|
+
*/
|
|
409
|
+
function HeldIncomingCard({ need, fetchImpl }) {
|
|
410
|
+
const [busy, setBusy] = useState(false);
|
|
411
|
+
const [said, setSaid] = useState('');
|
|
412
|
+
const [done, setDone] = useState(false);
|
|
413
|
+
async function answer(kind) {
|
|
414
|
+
setBusy(true);
|
|
415
|
+
setSaid('');
|
|
416
|
+
// 2.1.1 T8 — the answer names the set on screen (`need.digest`), never "whatever is held now"
|
|
417
|
+
const r = await postJson(fetchImpl, '/_api/sync/held-deletes', {
|
|
418
|
+
answer: kind,
|
|
419
|
+
folder: null,
|
|
420
|
+
digest: need.digest,
|
|
421
|
+
});
|
|
422
|
+
setBusy(false);
|
|
423
|
+
setSaid(heldIncomingWords(r));
|
|
424
|
+
if (r?.ok) setDone(true);
|
|
425
|
+
}
|
|
426
|
+
return (
|
|
427
|
+
<div className="sd-card" data-testid="sync-deletes-incoming">
|
|
428
|
+
<strong className="sd-ct">Deleted by the project · {filesWord(need.count)}</strong>
|
|
429
|
+
<span className="sd-cd">{need.detail}</span>
|
|
430
|
+
{need.folders.length ? (
|
|
431
|
+
<ul className="sd-failed" data-testid="sync-deletes-incoming-folders">
|
|
432
|
+
{need.folders.map((f) => (
|
|
433
|
+
<li key={f.folder}>
|
|
434
|
+
<span className="dg-mono">{cleanName(f.folder, 'the project folder')}</span>{' '}
|
|
435
|
+
{filesWord(f.count)}
|
|
436
|
+
</li>
|
|
437
|
+
))}
|
|
438
|
+
</ul>
|
|
439
|
+
) : null}
|
|
440
|
+
{done ? null : (
|
|
441
|
+
<div className="sd-acts">
|
|
442
|
+
<button
|
|
443
|
+
type="button"
|
|
444
|
+
className="dg-btn"
|
|
445
|
+
data-action="sync.remove-held-here"
|
|
446
|
+
data-testid="sync-deletes-incoming-remove"
|
|
447
|
+
disabled={busy}
|
|
448
|
+
onClick={() => answer('remove-here')}
|
|
449
|
+
>
|
|
450
|
+
Remove here too
|
|
451
|
+
</button>
|
|
452
|
+
<button
|
|
453
|
+
type="button"
|
|
454
|
+
className="dg-btn"
|
|
455
|
+
data-action="sync.keep-held-here"
|
|
456
|
+
data-testid="sync-deletes-incoming-keep"
|
|
457
|
+
disabled={busy}
|
|
458
|
+
onClick={() => answer('keep-here')}
|
|
459
|
+
>
|
|
460
|
+
Keep them here
|
|
461
|
+
</button>
|
|
462
|
+
</div>
|
|
463
|
+
)}
|
|
464
|
+
{said ? (
|
|
465
|
+
<p className="dg-hint" role="status" data-testid="sync-deletes-incoming-said">
|
|
466
|
+
{said}
|
|
467
|
+
</p>
|
|
468
|
+
) : null}
|
|
469
|
+
</div>
|
|
470
|
+
);
|
|
471
|
+
}
|
|
472
|
+
|
|
379
473
|
/** Issue #207 (7b) — the owner's purge of held deletes: how far it is, or why it stopped. */
|
|
380
474
|
function DeletesPurgingCard({ need }) {
|
|
381
475
|
return (
|
|
@@ -564,6 +658,73 @@ function FoldersSection({ sequences, ignored, fetchImpl }) {
|
|
|
564
658
|
* Read-only on purpose: the fix is a move or a rename in the project, not a button here. Calm — the
|
|
565
659
|
* canvas works on this Mac; the row says what a teammate would miss.
|
|
566
660
|
*/
|
|
661
|
+
/**
|
|
662
|
+
* 2.1.1 T14 — what a first link kept of this Mac's: the copy beside a file that differed, and the
|
|
663
|
+
* layout, sticky notes or comments the server's version replaced (kept in the canvas's recovery
|
|
664
|
+
* folder). Nothing here needs an answer; each row says what happened, that it is safe, and — in the
|
|
665
|
+
* Mac app — offers Show in Finder.
|
|
666
|
+
*/
|
|
667
|
+
function KeptSection({ fileConflicts, setAside, names, designRel, native }) {
|
|
668
|
+
const [said, setSaid] = useState('');
|
|
669
|
+
if (!fileConflicts.length && !setAside.length) return null;
|
|
670
|
+
async function reveal(rel) {
|
|
671
|
+
const r = await nativeDoors().revealPath(projectRel(designRel, rel));
|
|
672
|
+
setSaid(
|
|
673
|
+
r?.ok ? '' : cleanName(r?.error, 'Finder couldn’t open that. The copy is still there.')
|
|
674
|
+
);
|
|
675
|
+
}
|
|
676
|
+
return (
|
|
677
|
+
<section aria-label="Kept on this Mac" data-testid="sync-kept">
|
|
678
|
+
<p className="sd-sub">Kept on this Mac · {fileConflicts.length + setAside.length}</p>
|
|
679
|
+
{fileConflicts.map((c, i) => (
|
|
680
|
+
<div className="sd-card" key={c.rel} data-testid={`sync-file-conflict-${i}`}>
|
|
681
|
+
<strong className="sd-ct dg-mono">{cleanName(c.rel, '(unnamed)')}</strong>
|
|
682
|
+
<span className="sd-cd">{fileConflictWords(c.copyName)}</span>
|
|
683
|
+
{native ? (
|
|
684
|
+
<div className="sd-acts">
|
|
685
|
+
<button
|
|
686
|
+
type="button"
|
|
687
|
+
className="dg-btn"
|
|
688
|
+
data-testid={`sync-file-conflict-reveal-${i}`}
|
|
689
|
+
onClick={() => reveal(c.copy)}
|
|
690
|
+
>
|
|
691
|
+
Show in Finder
|
|
692
|
+
</button>
|
|
693
|
+
</div>
|
|
694
|
+
) : null}
|
|
695
|
+
</div>
|
|
696
|
+
))}
|
|
697
|
+
{setAside.map((r, i) => (
|
|
698
|
+
<div className="sd-card" key={r.slug} data-testid={`sync-set-aside-${i}`}>
|
|
699
|
+
<strong className="sd-ct">
|
|
700
|
+
{setAsideWords(names?.get?.(r.slug) ?? r.slug, r.lanes)}
|
|
701
|
+
</strong>
|
|
702
|
+
<span className="sd-cd">
|
|
703
|
+
Kept in <span className="dg-mono">{r.where}</span>.
|
|
704
|
+
</span>
|
|
705
|
+
{native ? (
|
|
706
|
+
<div className="sd-acts">
|
|
707
|
+
<button
|
|
708
|
+
type="button"
|
|
709
|
+
className="dg-btn"
|
|
710
|
+
data-testid={`sync-set-aside-reveal-${i}`}
|
|
711
|
+
onClick={() => reveal(r.where)}
|
|
712
|
+
>
|
|
713
|
+
Show in Finder
|
|
714
|
+
</button>
|
|
715
|
+
</div>
|
|
716
|
+
) : null}
|
|
717
|
+
</div>
|
|
718
|
+
))}
|
|
719
|
+
{said ? (
|
|
720
|
+
<p className="dg-hint" role="status" data-testid="sync-kept-said">
|
|
721
|
+
{said}
|
|
722
|
+
</p>
|
|
723
|
+
) : null}
|
|
724
|
+
</section>
|
|
725
|
+
);
|
|
726
|
+
}
|
|
727
|
+
|
|
567
728
|
function useUnsyncedRefs(fetchImpl) {
|
|
568
729
|
const [refs, setRefs] = useState([]);
|
|
569
730
|
useEffect(() => {
|
|
@@ -618,6 +779,8 @@ export default function SyncDetails({
|
|
|
618
779
|
cloud,
|
|
619
780
|
native = false,
|
|
620
781
|
names = null,
|
|
782
|
+
// 2.1.1 T14 — the design root's project-relative folder, for Show in Finder on a kept copy
|
|
783
|
+
designRel = '.design',
|
|
621
784
|
onSignInAgain,
|
|
622
785
|
fetchImpl = fetch,
|
|
623
786
|
// p8-held-conflict-status — open this held conflict's Compare (a slug), once per new `focusSeq`
|
|
@@ -661,7 +824,19 @@ export default function SyncDetails({
|
|
|
661
824
|
) : need.kind === 'assets-stay' ? (
|
|
662
825
|
<AssetsStayCard key="assets-stay" />
|
|
663
826
|
) : need.kind === 'deletes-held' ? (
|
|
664
|
-
|
|
827
|
+
// a new held set is a new card (its answer, confirm and words start over)
|
|
828
|
+
<HeldDeletesCard
|
|
829
|
+
key={`deletes-held-${need.digest}`}
|
|
830
|
+
need={need}
|
|
831
|
+
fetchImpl={fetchImpl}
|
|
832
|
+
/>
|
|
833
|
+
) : need.kind === 'deletes-incoming' ? (
|
|
834
|
+
// a new held set is a new card (its answer and words start over)
|
|
835
|
+
<HeldIncomingCard
|
|
836
|
+
key={`deletes-incoming-${need.digest}`}
|
|
837
|
+
need={need}
|
|
838
|
+
fetchImpl={fetchImpl}
|
|
839
|
+
/>
|
|
665
840
|
) : need.kind === 'deletes-purging' ? (
|
|
666
841
|
<DeletesPurgingCard key="deletes-purging" need={need} />
|
|
667
842
|
) : (
|
|
@@ -714,6 +889,14 @@ export default function SyncDetails({
|
|
|
714
889
|
|
|
715
890
|
<UnsyncedSection refs={unsynced} />
|
|
716
891
|
|
|
892
|
+
<KeptSection
|
|
893
|
+
fileConflicts={m.lists.fileConflicts}
|
|
894
|
+
setAside={m.lists.setAside}
|
|
895
|
+
names={names}
|
|
896
|
+
designRel={designRel || '.design'}
|
|
897
|
+
native={native}
|
|
898
|
+
/>
|
|
899
|
+
|
|
717
900
|
{m.counts.length ? (
|
|
718
901
|
<section aria-label="Counts" data-testid="diag-sync-counts">
|
|
719
902
|
<p className="sd-sub">Counts</p>
|