@1agh/maude 1.8.1 → 1.9.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/acp/bridge.ts +14 -2
- package/apps/studio/acp/probe.ts +51 -1
- package/apps/studio/api.ts +19 -4
- package/apps/studio/bin/_curl-local.mjs +7 -0
- package/apps/studio/bin/annotate.mjs +16 -7
- package/apps/studio/bin/read-annotations.mjs +62 -4
- package/apps/studio/client/app.jsx +428 -15977
- package/apps/studio/client/dialogs/asset-picker.jsx +331 -0
- package/apps/studio/client/dialogs/command-palette.jsx +112 -0
- package/apps/studio/client/dialogs/export-dialog.jsx +782 -0
- package/apps/studio/client/dialogs/help-modal.jsx +324 -0
- package/apps/studio/client/dialogs/shortcuts-overlay.jsx +144 -0
- package/apps/studio/client/hooks/use-canvas-bridge.jsx +2150 -0
- package/apps/studio/client/hooks/use-git-actions.jsx +236 -0
- package/apps/studio/client/hooks/use-keyboard-shortcuts.jsx +297 -0
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +474 -0
- package/apps/studio/client/hooks/use-photo-and-timeline.jsx +901 -0
- package/apps/studio/client/hooks/use-project-data.jsx +90 -0
- package/apps/studio/client/hooks/use-shell-core.jsx +1212 -0
- package/apps/studio/client/hooks/use-tabs.jsx +723 -0
- package/apps/studio/client/hooks/use-web-socket.jsx +13 -0
- package/apps/studio/client/inspector/artboard-knobs.jsx +456 -0
- package/apps/studio/client/inspector/color-picker.jsx +196 -0
- package/apps/studio/client/inspector/color.js +92 -0
- package/apps/studio/client/inspector/css-knobs.jsx +1720 -0
- package/apps/studio/client/inspector/css-vocab.jsx +131 -0
- package/apps/studio/client/inspector/ds-tokens.js +90 -0
- package/apps/studio/client/inspector/grid-tracks-editor.jsx +97 -0
- package/apps/studio/client/inspector/inspect-computed.jsx +68 -0
- package/apps/studio/client/inspector/inspector-panel.jsx +769 -0
- package/apps/studio/client/inspector/layers.jsx +322 -0
- package/apps/studio/client/inspector/selection.js +65 -0
- package/apps/studio/client/inspector/token-popover.jsx +301 -0
- package/apps/studio/client/menus/menubar.jsx +856 -0
- package/apps/studio/client/selection-scope.js +40 -0
- package/apps/studio/client/shell/banners.jsx +272 -0
- package/apps/studio/client/shell/collapsed-rail.jsx +23 -0
- package/apps/studio/client/shell/comments-panel.jsx +177 -0
- package/apps/studio/client/shell/constants.js +60 -0
- package/apps/studio/client/shell/dock.jsx +131 -0
- package/apps/studio/client/shell/icons.jsx +370 -0
- package/apps/studio/client/shell/status-bar.jsx +215 -0
- package/apps/studio/client/shell/util.js +332 -0
- package/apps/studio/client/shell/viewport.jsx +254 -0
- package/apps/studio/client/system/system-view.jsx +255 -0
- package/apps/studio/client/tree/tree.jsx +1243 -0
- package/apps/studio/comments-overlay.tsx +6 -4
- package/apps/studio/config.schema.json +5 -0
- package/apps/studio/context.ts +13 -0
- package/apps/studio/dist/client.bundle.js +1337 -1337
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/exporters/_browser-bundles.ts +21 -2
- package/apps/studio/exporters/jobs.ts +75 -15
- package/apps/studio/exporters/scope.ts +15 -12
- package/apps/studio/format.ts +296 -0
- package/apps/studio/http.ts +217 -23
- package/apps/studio/server.ts +141 -30
- package/apps/studio/sync/accepted-link.ts +6 -0
- package/apps/studio/sync/agent.ts +9 -1
- package/apps/studio/sync/cold-start-apply.ts +29 -4
- package/apps/studio/sync/cold-start.ts +78 -0
- package/apps/studio/sync/file-plane.ts +61 -1
- package/apps/studio/sync/format-sync.ts +160 -0
- package/apps/studio/sync/index.ts +134 -10
- package/apps/studio/sync/journal-client.ts +25 -5
- package/apps/studio/sync/migrate-seed.ts +8 -1
- package/apps/studio/sync/status.ts +2 -0
- package/apps/studio/sync/transaction-client.ts +130 -13
- package/apps/studio/ui-prefs.ts +95 -10
- package/apps/studio/whats-new.json +9 -0
- package/apps/studio/ws.ts +19 -4
- package/cli/bin/claude-design-server.mjs +0 -0
- package/package.json +10 -8
|
@@ -71,15 +71,50 @@ interface OutboxEntry {
|
|
|
71
71
|
label: string;
|
|
72
72
|
/** The action, so an epoch-stale entry can be rebased as a new transaction. */
|
|
73
73
|
action?: OutboxAction;
|
|
74
|
+
/** V2-1.12 §5.4 — the file format the entry was written in (absent = undeclared). */
|
|
75
|
+
format?: number;
|
|
74
76
|
/** Written before the project id was known; bound (once) before sending. */
|
|
75
77
|
unbound?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* B2 (V2-1.14 §5.12b) — the project this entry was made for, recorded as
|
|
80
|
+
* soon as it is known. An entry for another project is never sent (a relink
|
|
81
|
+
* must not deliver a `doc.delete` to whatever project is linked now).
|
|
82
|
+
*/
|
|
83
|
+
projectId?: string;
|
|
84
|
+
/** B2 — the link (hub) this entry was written under. An `unbound` entry
|
|
85
|
+
* binds ONLY to that link's project. Absent on entries from older builds. */
|
|
86
|
+
link?: string;
|
|
76
87
|
}
|
|
77
88
|
|
|
89
|
+
/**
|
|
90
|
+
* 4xx answers that mean "not now" rather than "no". Every OTHER 4xx without a
|
|
91
|
+
* protocol `status` is final (B1): retrying a 413 resends the same bytes to
|
|
92
|
+
* the same refusal forever, and the chain behind it waits forever with it.
|
|
93
|
+
* (401 has its own rule above them: the change is kept, the sign-in is not.)
|
|
94
|
+
*/
|
|
95
|
+
const TRANSIENT_4XX = new Set([408, 425, 429]);
|
|
96
|
+
|
|
97
|
+
/** Where a final, non-protocol refusal keeps the exact bytes (design-root
|
|
98
|
+
* relative; runtime state under `_history/`, DDR-115). */
|
|
99
|
+
export const OUTBOX_RECOVERY_REL = path.join('_history', '_outbox-recovery');
|
|
100
|
+
|
|
78
101
|
export interface TransactionClientOptions {
|
|
79
102
|
hubUrl: string;
|
|
80
103
|
token: () => string | null;
|
|
81
104
|
designRoot: string;
|
|
82
105
|
fetchImpl?: typeof fetch;
|
|
106
|
+
/**
|
|
107
|
+
* V2-1.12 §5.6 — while true no proposal is SENT: each stays in the durable
|
|
108
|
+
* outbox, unchanged, and goes when the gate lifts (after an update). The
|
|
109
|
+
* project now uses a format this build does not write.
|
|
110
|
+
*/
|
|
111
|
+
paused?: () => boolean;
|
|
112
|
+
/**
|
|
113
|
+
* V2-1.12 §5.4 — the format a proposal is written in, RECORDED on the entry
|
|
114
|
+
* when it is made and declared when it is sent: an edit made under one build
|
|
115
|
+
* is never relabelled by the next one.
|
|
116
|
+
*/
|
|
117
|
+
declaredFormat?: () => number;
|
|
83
118
|
log?: Pick<Console, 'log' | 'warn' | 'error'>;
|
|
84
119
|
deviceId?: string;
|
|
85
120
|
/** Status hook — how many actions are waiting for acceptance. */
|
|
@@ -91,6 +126,13 @@ export interface TransactionClientOptions {
|
|
|
91
126
|
now?: () => number;
|
|
92
127
|
/** Backoff between retries of an unacknowledged proposal. */
|
|
93
128
|
retryMs?: number;
|
|
129
|
+
/**
|
|
130
|
+
* B2 — the identity of the link this client runs under. Entries record it,
|
|
131
|
+
* and an unbound entry binds only under the same link. Default: the hub URL
|
|
132
|
+
* (one hub serves one project — `hub-integration.mjs` `projectId`), so a
|
|
133
|
+
* relink to another hub never adopts the old link's unsent work.
|
|
134
|
+
*/
|
|
135
|
+
linkId?: string;
|
|
94
136
|
}
|
|
95
137
|
|
|
96
138
|
export interface TransactionStats {
|
|
@@ -139,6 +181,8 @@ export function createTransactionClient(opts: TransactionClientOptions) {
|
|
|
139
181
|
const deviceId = opts.deviceId ?? 'studio';
|
|
140
182
|
const sessionId = randomUUID();
|
|
141
183
|
const base = opts.hubUrl.replace(/\/+$/, '');
|
|
184
|
+
const linkId = opts.linkId ?? base;
|
|
185
|
+
const recoveryDir = path.join(opts.designRoot, OUTBOX_RECOVERY_REL);
|
|
142
186
|
|
|
143
187
|
let projectId: string | null = null;
|
|
144
188
|
let epoch = 0;
|
|
@@ -178,18 +222,19 @@ export function createTransactionClient(opts: TransactionClientOptions) {
|
|
|
178
222
|
opts.onStats?.(stats());
|
|
179
223
|
};
|
|
180
224
|
|
|
181
|
-
function headers(): Record<string, string> {
|
|
225
|
+
function headers(format?: number): Record<string, string> {
|
|
182
226
|
const token = opts.token();
|
|
183
227
|
return {
|
|
184
228
|
'content-type': 'application/json',
|
|
185
229
|
...(token ? { authorization: `Bearer ${token}` } : {}),
|
|
230
|
+
...(typeof format === 'number' ? { 'x-maude-format': String(format) } : {}),
|
|
186
231
|
};
|
|
187
232
|
}
|
|
188
233
|
|
|
189
|
-
async function request(method: string, route: string, body?: string) {
|
|
234
|
+
async function request(method: string, route: string, body?: string, format?: number) {
|
|
190
235
|
const res = await fetchImpl(`${base}/api/projects/${projectId ?? 'current'}/v1/${route}`, {
|
|
191
236
|
method,
|
|
192
|
-
headers: headers(),
|
|
237
|
+
headers: headers(format),
|
|
193
238
|
...(body !== undefined ? { body } : {}),
|
|
194
239
|
signal: AbortSignal.timeout(20_000),
|
|
195
240
|
});
|
|
@@ -244,6 +289,47 @@ export function createTransactionClient(opts: TransactionClientOptions) {
|
|
|
244
289
|
|
|
245
290
|
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
|
|
246
291
|
|
|
292
|
+
/**
|
|
293
|
+
* End an entry WITHOUT an answer from the kernel — a final refusal that is
|
|
294
|
+
* not a protocol result (B1), or an entry that belongs to another project
|
|
295
|
+
* (B2). The exact bytes move to `_history/_outbox-recovery/<name>.<code>.json`
|
|
296
|
+
* ("kept on this Mac", V2-1.14 G8/G18) so nothing made here is lost and the
|
|
297
|
+
* chain behind it moves on. If even the move fails, the entry stays where it
|
|
298
|
+
* is — unsent, re-judged next drain — rather than being deleted.
|
|
299
|
+
*/
|
|
300
|
+
function park(file: string, entry: OutboxEntry, code: string): ProposalResult {
|
|
301
|
+
try {
|
|
302
|
+
mkdirSync(recoveryDir, { recursive: true });
|
|
303
|
+
const name = path.basename(file).replace(/\.json$/, `.${code}.json`);
|
|
304
|
+
renameSync(file, path.join(recoveryDir, name));
|
|
305
|
+
} catch (err) {
|
|
306
|
+
log.warn(`[sync/tx] ${entry.label}: could not keep it aside (${(err as Error).message})`);
|
|
307
|
+
}
|
|
308
|
+
return { protocol: PROTOCOL, status: 'rejected', code, transactionId: entry.transactionId };
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** B2 — the project an entry was made for: recorded, or (entries from older
|
|
312
|
+
* builds) the id inside its own bytes. `null` = never bound. */
|
|
313
|
+
function madeFor(entry: OutboxEntry): string | null {
|
|
314
|
+
if (typeof entry.projectId === 'string') return entry.projectId;
|
|
315
|
+
try {
|
|
316
|
+
const id = (JSON.parse(entry.bytes) as { projectId?: unknown }).projectId;
|
|
317
|
+
return typeof id === 'string' ? id : null;
|
|
318
|
+
} catch {
|
|
319
|
+
return null;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/** B2 — true when this entry may go to the project this client talks to. */
|
|
324
|
+
function belongsHere(entry: OutboxEntry): boolean {
|
|
325
|
+
// Unbound: it binds only under the link it was written under. An entry
|
|
326
|
+
// from a build that did not record its link cannot be proven to belong
|
|
327
|
+
// here, so it is kept, not sent (the disk still holds the change).
|
|
328
|
+
if (entry.unbound) return entry.link === linkId;
|
|
329
|
+
const id = madeFor(entry);
|
|
330
|
+
return id === null || id === projectId;
|
|
331
|
+
}
|
|
332
|
+
|
|
247
333
|
/**
|
|
248
334
|
* Deliver one outbox entry to a FINAL result. Never gives up on an unknown
|
|
249
335
|
* outcome: a transport failure is resolved by asking for the transaction's
|
|
@@ -253,6 +339,11 @@ export function createTransactionClient(opts: TransactionClientOptions) {
|
|
|
253
339
|
let attempt = 0;
|
|
254
340
|
for (;;) {
|
|
255
341
|
if (stopped) throw new TransactionError('client stopped', 'stopped');
|
|
342
|
+
if (opts.paused?.()) {
|
|
343
|
+
// Held, not failed: nothing is sent, no attempt is counted.
|
|
344
|
+
await sleep(Math.max(retryMs, 1000));
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
256
347
|
try {
|
|
257
348
|
if (attempt > 0) {
|
|
258
349
|
const known = await request('GET', `transactions/${entry.transactionId}`);
|
|
@@ -262,7 +353,7 @@ export function createTransactionClient(opts: TransactionClientOptions) {
|
|
|
262
353
|
return known.json as ProposalResult;
|
|
263
354
|
}
|
|
264
355
|
}
|
|
265
|
-
const { status, json } = await request('POST', 'proposals', entry.bytes);
|
|
356
|
+
const { status, json } = await request('POST', 'proposals', entry.bytes, entry.format);
|
|
266
357
|
// Not an answer about the change — about who is asking. Kept and
|
|
267
358
|
// retried (a new sign-in supplies a new token), and said out loud.
|
|
268
359
|
if (status === 401) {
|
|
@@ -278,9 +369,23 @@ export function createTransactionClient(opts: TransactionClientOptions) {
|
|
|
278
369
|
if (result.status === 'rejected' && (result.code === 'retryable' || status >= 500)) {
|
|
279
370
|
throw new TransactionError('hub asked to retry', 'retryable');
|
|
280
371
|
}
|
|
372
|
+
// V2-1.12 §5.4 — refused for its FORMAT: final, but the bytes are a
|
|
373
|
+
// person's edit, so they are kept aside (recovery), never deleted.
|
|
374
|
+
if (result.status === 'rejected' && result.code === 'format') {
|
|
375
|
+
log.warn(
|
|
376
|
+
`[sync/tx] ${entry.label}: the project now uses another file format; kept aside, not sent`
|
|
377
|
+
);
|
|
378
|
+
return park(file, entry, 'format');
|
|
379
|
+
}
|
|
281
380
|
rmSync(file, { force: true });
|
|
282
381
|
return result;
|
|
283
382
|
}
|
|
383
|
+
// B1 — no protocol answer, but a 4xx is still an answer: final.
|
|
384
|
+
if (status >= 400 && status < 500 && !TRANSIENT_4XX.has(status)) {
|
|
385
|
+
setCredentialRefused(false);
|
|
386
|
+
log.warn(`[sync/tx] ${entry.label}: refused (${status}); kept aside, not retried`);
|
|
387
|
+
return park(file, entry, `http-${status}`);
|
|
388
|
+
}
|
|
284
389
|
throw new TransactionError(`unexpected response ${status}`, 'retryable');
|
|
285
390
|
} catch (err) {
|
|
286
391
|
attempt++;
|
|
@@ -328,7 +433,9 @@ export function createTransactionClient(opts: TransactionClientOptions) {
|
|
|
328
433
|
bytes: envelope(action, transactionId),
|
|
329
434
|
label: action.label,
|
|
330
435
|
action,
|
|
331
|
-
|
|
436
|
+
link: linkId,
|
|
437
|
+
...(opts.declaredFormat ? { format: opts.declaredFormat() } : {}),
|
|
438
|
+
...(projectId === null ? { unbound: true } : { projectId }),
|
|
332
439
|
};
|
|
333
440
|
}
|
|
334
441
|
|
|
@@ -362,14 +469,24 @@ export function createTransactionClient(opts: TransactionClientOptions) {
|
|
|
362
469
|
}
|
|
363
470
|
|
|
364
471
|
async function settle(file: string, entry: OutboxEntry): Promise<ProposalResult> {
|
|
365
|
-
if (
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
472
|
+
if (projectId === null) await bootstrapWhenReachable();
|
|
473
|
+
if (!belongsHere(entry)) {
|
|
474
|
+
// B2 — never sent to a project it was not made for (G18).
|
|
475
|
+
log.warn(`[sync/tx] ${entry.label}: made for another project; kept aside, not sent`);
|
|
476
|
+
const parked = park(file, entry, 'project-changed');
|
|
477
|
+
rejectedCount++;
|
|
478
|
+
opts.onResult?.(parked, { label: entry.label, operations: entry.action?.operations ?? [] });
|
|
479
|
+
return parked;
|
|
480
|
+
}
|
|
481
|
+
if (entry.unbound && entry.action) {
|
|
482
|
+
entry = {
|
|
483
|
+
...entry,
|
|
484
|
+
bytes: envelope(entry.action, entry.transactionId),
|
|
485
|
+
...(projectId !== null ? { projectId } : {}),
|
|
486
|
+
};
|
|
487
|
+
delete entry.unbound;
|
|
488
|
+
writeFileSync(`${file}.tmp`, JSON.stringify(entry));
|
|
489
|
+
renameSync(`${file}.tmp`, file);
|
|
373
490
|
}
|
|
374
491
|
let result = await deliver(file, entry);
|
|
375
492
|
if (result.status === 'rejected' && result.code === 'epoch-stale' && entry.action) {
|
package/apps/studio/ui-prefs.ts
CHANGED
|
@@ -12,7 +12,15 @@
|
|
|
12
12
|
// toggles. It is never versioned and never served to a canvas — the GET/POST
|
|
13
13
|
// routes are MAIN-ORIGIN ONLY (privileged), like /_api/generate/prefs.
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
copyFileSync,
|
|
17
|
+
existsSync,
|
|
18
|
+
mkdirSync,
|
|
19
|
+
readFileSync,
|
|
20
|
+
renameSync,
|
|
21
|
+
rmSync,
|
|
22
|
+
writeFileSync,
|
|
23
|
+
} from 'node:fs';
|
|
16
24
|
import { homedir } from 'node:os';
|
|
17
25
|
import { dirname, join } from 'node:path';
|
|
18
26
|
|
|
@@ -39,6 +47,16 @@ export interface UiPrefs {
|
|
|
39
47
|
panelSides: PanelSides;
|
|
40
48
|
/** Whether Layers is its own dockable panel or a tab inside the Inspector. */
|
|
41
49
|
layersMode: 'separate' | 'in-inspector';
|
|
50
|
+
/**
|
|
51
|
+
* Schema version of the file (absent = 1, the seven fields above). Carried, never invented by the
|
|
52
|
+
* reader: a file written by a newer build keeps its version when an older build rewrites it.
|
|
53
|
+
*/
|
|
54
|
+
version?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Lossless reader (V2-1.12): any top-level field this build does not know round-trips untouched
|
|
57
|
+
* through read and write, so a build that predates a field never strips it.
|
|
58
|
+
*/
|
|
59
|
+
[extra: string]: unknown;
|
|
42
60
|
}
|
|
43
61
|
|
|
44
62
|
// Defaults MUST agree with app.jsx's initial state (THEME default 'dark',
|
|
@@ -82,11 +100,35 @@ function coercePanelSides(raw: unknown): PanelSides {
|
|
|
82
100
|
return out;
|
|
83
101
|
}
|
|
84
102
|
|
|
103
|
+
// Own keys that must never be copied off disk: a spread would define them as plain data
|
|
104
|
+
// properties, and the next consumer that assigns through one would be assigning into a prototype.
|
|
105
|
+
const UNSAFE_KEYS = new Set(['__proto__', 'constructor', 'prototype']);
|
|
106
|
+
const KNOWN_KEYS = new Set([
|
|
107
|
+
'theme',
|
|
108
|
+
'minimap',
|
|
109
|
+
'zoom',
|
|
110
|
+
'annotations',
|
|
111
|
+
'autoOpenInspector',
|
|
112
|
+
'panelSides',
|
|
113
|
+
'layersMode',
|
|
114
|
+
'version',
|
|
115
|
+
]);
|
|
116
|
+
|
|
85
117
|
function coerce(raw: unknown): UiPrefs {
|
|
86
118
|
const o =
|
|
87
119
|
raw && typeof raw === 'object' && !Array.isArray(raw) ? (raw as Record<string, unknown>) : {};
|
|
88
120
|
const bool = (v: unknown, d: boolean) => (typeof v === 'boolean' ? v : d);
|
|
121
|
+
const extra: Record<string, unknown> = {};
|
|
122
|
+
for (const k of Object.keys(o)) {
|
|
123
|
+
if (!KNOWN_KEYS.has(k) && !UNSAFE_KEYS.has(k)) extra[k] = o[k];
|
|
124
|
+
}
|
|
125
|
+
const version =
|
|
126
|
+
typeof o.version === 'number' && Number.isInteger(o.version) && o.version >= 1
|
|
127
|
+
? { version: o.version }
|
|
128
|
+
: {};
|
|
89
129
|
return {
|
|
130
|
+
...extra,
|
|
131
|
+
...version,
|
|
90
132
|
theme: o.theme === 'light' || o.theme === 'dark' ? o.theme : UI_PREFS_DEFAULTS.theme,
|
|
91
133
|
minimap: bool(o.minimap, UI_PREFS_DEFAULTS.minimap),
|
|
92
134
|
zoom: bool(o.zoom, UI_PREFS_DEFAULTS.zoom),
|
|
@@ -97,24 +139,61 @@ function coerce(raw: unknown): UiPrefs {
|
|
|
97
139
|
};
|
|
98
140
|
}
|
|
99
141
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
142
|
+
type RawPrefs =
|
|
143
|
+
| { kind: 'missing' }
|
|
144
|
+
| { kind: 'empty' }
|
|
145
|
+
| { kind: 'corrupt' }
|
|
146
|
+
| { kind: 'ok'; value: unknown };
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* What is on disk, without judging it. `corrupt` is text that is not a JSON object (a torn write
|
|
150
|
+
* from a build that does not rename, a half-synced file, a hand edit); `empty` is whitespace only.
|
|
151
|
+
*/
|
|
152
|
+
function readRaw(path: string): RawPrefs {
|
|
153
|
+
if (!existsSync(path)) return { kind: 'missing' };
|
|
154
|
+
let text: string;
|
|
155
|
+
try {
|
|
156
|
+
text = readFileSync(path, 'utf8');
|
|
157
|
+
} catch {
|
|
158
|
+
return { kind: 'corrupt' };
|
|
159
|
+
}
|
|
160
|
+
if (text.trim() === '') return { kind: 'empty' };
|
|
104
161
|
try {
|
|
105
|
-
|
|
162
|
+
const value: unknown = JSON.parse(text);
|
|
163
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) return { kind: 'ok', value };
|
|
106
164
|
} catch {
|
|
107
|
-
|
|
165
|
+
/* fall through */
|
|
108
166
|
}
|
|
167
|
+
return { kind: 'corrupt' };
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Current UI prefs merged over the defaults (defaults when missing/unreadable). */
|
|
171
|
+
export function readUiPrefs(): UiPrefs {
|
|
172
|
+
const raw = readRaw(uiPrefsPath());
|
|
173
|
+
return raw.kind === 'ok' ? coerce(raw.value) : { ...UI_PREFS_DEFAULTS };
|
|
109
174
|
}
|
|
110
175
|
|
|
111
176
|
/**
|
|
112
177
|
* Persist a partial patch over the on-disk prefs (only the provided keys change;
|
|
113
178
|
* every other stored value is preserved). Returns the merged result. Best-effort
|
|
114
179
|
* — a write failure throws so the route can surface it.
|
|
180
|
+
*
|
|
181
|
+
* Crash-safe: the new file is written beside the old one and renamed over it, so a reader (or a
|
|
182
|
+
* second Maude process — every project window has its own server since V2-1.1) never sees a torn
|
|
183
|
+
* file. A file that cannot be parsed is copied to `prefs.json.corrupt-<ms>` first, so healing it
|
|
184
|
+
* with defaults never destroys what the person had.
|
|
115
185
|
*/
|
|
116
186
|
export function writeUiPrefs(patch: Partial<UiPrefs>): UiPrefs {
|
|
117
|
-
const
|
|
187
|
+
const path = uiPrefsPath();
|
|
188
|
+
const raw = readRaw(path);
|
|
189
|
+
if (raw.kind === 'corrupt') {
|
|
190
|
+
try {
|
|
191
|
+
copyFileSync(path, `${path}.corrupt-${Date.now()}`);
|
|
192
|
+
} catch {
|
|
193
|
+
/* best-effort: the heal below still proceeds */
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const cur = raw.kind === 'ok' ? coerce(raw.value) : { ...UI_PREFS_DEFAULTS };
|
|
118
197
|
// panelSides is deep-merged so a partial patch (one panel moved) preserves the
|
|
119
198
|
// other panels' sides instead of resetting them to defaults via coerce.
|
|
120
199
|
const merged: Partial<UiPrefs> = {
|
|
@@ -123,8 +202,14 @@ export function writeUiPrefs(patch: Partial<UiPrefs>): UiPrefs {
|
|
|
123
202
|
panelSides: { ...cur.panelSides, ...(patch.panelSides ?? {}) },
|
|
124
203
|
};
|
|
125
204
|
const next = coerce(merged);
|
|
126
|
-
const path = uiPrefsPath();
|
|
127
205
|
mkdirSync(dirname(path), { recursive: true });
|
|
128
|
-
|
|
206
|
+
const tmp = `${path}.tmp-${process.pid}-${Date.now().toString(36)}`;
|
|
207
|
+
try {
|
|
208
|
+
writeFileSync(tmp, `${JSON.stringify(next, null, 2)}\n`);
|
|
209
|
+
renameSync(tmp, path);
|
|
210
|
+
} catch (err) {
|
|
211
|
+
rmSync(tmp, { force: true });
|
|
212
|
+
throw err;
|
|
213
|
+
}
|
|
129
214
|
return next;
|
|
130
215
|
}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./whats-new.schema.json",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"id": "format-gate-update-maude-to-edit",
|
|
6
|
+
"version": "1.9.0",
|
|
7
|
+
"date": "2026-10-10",
|
|
8
|
+
"kind": "improvement",
|
|
9
|
+
"title": "Projects from a newer Maude open safely",
|
|
10
|
+
"summary": "A project that someone has moved to a newer Maude now opens here to look at, with an “Update Maude to edit” banner, instead of being changed by an older app. Nothing in it is lost, and every project made with this Maude keeps working as before.",
|
|
11
|
+
"surface": "design-ui"
|
|
12
|
+
},
|
|
4
13
|
{
|
|
5
14
|
"id": "large-video-drops",
|
|
6
15
|
"version": "1.8.0",
|
package/apps/studio/ws.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type { Context } from './context.ts';
|
|
|
11
11
|
import { createContainerWriteBridge, createHmrBroadcaster } from './hmr-broadcast.ts';
|
|
12
12
|
import type { InspectRegistry } from './inspect.ts';
|
|
13
13
|
import { startCellFileEvents } from './sync/cell-file-events.ts';
|
|
14
|
+
import { isRuntimeStateRel } from './sync/file-membership.ts';
|
|
14
15
|
import { isWorkspaceMode } from './workspace-mode.ts';
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -208,9 +209,19 @@ export function createWs(
|
|
|
208
209
|
broadcast({ type: 'selected', selected: sel }, meta?.session)
|
|
209
210
|
);
|
|
210
211
|
ctx.bus.on('active', (file, meta) => broadcast({ type: 'active', file }, meta?.session));
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
// V2-2.8 S7 (follow-up) — runtime state (the DDR-115 classifier) never rides
|
|
213
|
+
// these socket pushes: in a cell `_active.<session>.json` and
|
|
214
|
+
// `_canvas-state/<session>/…` named every member's session key — and when
|
|
215
|
+
// they were active — to every other member. The shell acts on none of them
|
|
216
|
+
// (client/hmr.mjs reloads canvases and reacts to a canvas `.meta.json`);
|
|
217
|
+
// server-side bus subscribers still see every event.
|
|
218
|
+
const fsPush = (type: string) => (file: string) => {
|
|
219
|
+
if (typeof file === 'string' && isRuntimeStateRel(file)) return;
|
|
220
|
+
broadcast({ type, file });
|
|
221
|
+
};
|
|
222
|
+
ctx.bus.on('fs:html', fsPush('fs:html'));
|
|
223
|
+
ctx.bus.on('fs:css', fsPush('fs:css'));
|
|
224
|
+
ctx.bus.on('fs:json', fsPush('fs:json'));
|
|
214
225
|
ctx.bus.on('comments', ({ file, comments }: { file: string; comments: unknown[] }) =>
|
|
215
226
|
broadcast({ type: 'comments', file, comments })
|
|
216
227
|
);
|
|
@@ -261,7 +272,11 @@ export function createWs(
|
|
|
261
272
|
// changes (queued → running → progress ticks → done/failed). Full-snapshot
|
|
262
273
|
// payload per change, mirroring git-status/sync:status above. Inspector
|
|
263
274
|
// clients only — same privileged-data class as the rest of this feed.
|
|
264
|
-
|
|
275
|
+
// V2-2.8 S5 — scoped to the job's owner (exporters/jobs.ts stamps
|
|
276
|
+
// `meta.session`); a desktop job carries none and reaches every socket.
|
|
277
|
+
ctx.bus.on('export:job', (job: unknown, meta) =>
|
|
278
|
+
broadcast({ type: 'export:job', payload: job }, meta?.session)
|
|
279
|
+
);
|
|
265
280
|
|
|
266
281
|
// feature-ai-media-generation (DDR-16x) — generation job queue state changes
|
|
267
282
|
// (queued → running → done/failed). Same privileged-data class + snapshot
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1agh/maude",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "Marketplace of Claude Code plugins by Michal Dovrtěl: `design` (canvas-first design iteration) + `flow` (generic agentic workflow loop with .ai second brain). Ships the `maude` CLI (with `mdcc` legacy alias) to scaffold workspace, run the design dev server, and manage configs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -58,13 +58,13 @@
|
|
|
58
58
|
"test:e2e:desktop:parity:cloud": "pnpm --filter @maude/desktop-e2e e2e:parity:cloud"
|
|
59
59
|
},
|
|
60
60
|
"optionalDependencies": {
|
|
61
|
-
"@1agh/maude-darwin-arm64": "1.
|
|
62
|
-
"@1agh/maude-darwin-x64": "1.
|
|
63
|
-
"@1agh/maude-linux-arm64": "1.
|
|
64
|
-
"@1agh/maude-linux-arm64-musl": "1.
|
|
65
|
-
"@1agh/maude-linux-x64": "1.
|
|
66
|
-
"@1agh/maude-linux-x64-musl": "1.
|
|
67
|
-
"@1agh/maude-win32-x64": "1.
|
|
61
|
+
"@1agh/maude-darwin-arm64": "1.9.1",
|
|
62
|
+
"@1agh/maude-darwin-x64": "1.9.1",
|
|
63
|
+
"@1agh/maude-linux-arm64": "1.9.1",
|
|
64
|
+
"@1agh/maude-linux-arm64-musl": "1.9.1",
|
|
65
|
+
"@1agh/maude-linux-x64": "1.9.1",
|
|
66
|
+
"@1agh/maude-linux-x64-musl": "1.9.1",
|
|
67
|
+
"@1agh/maude-win32-x64": "1.9.1"
|
|
68
68
|
},
|
|
69
69
|
"files": [
|
|
70
70
|
"cli",
|
|
@@ -87,6 +87,8 @@
|
|
|
87
87
|
"!apps/studio/**/*.test.*",
|
|
88
88
|
"!apps/studio/**/*.spec.*",
|
|
89
89
|
"!apps/studio/**/.DS_Store",
|
|
90
|
+
"!apps/studio/client/TESTIDS.md",
|
|
91
|
+
"!apps/studio/client/testids.json",
|
|
90
92
|
"plugins/design/dependencies.json",
|
|
91
93
|
"plugins/design/dependencies.schema.json",
|
|
92
94
|
"plugins/design/templates",
|