@1agh/maude 1.7.1 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/apps/studio/acp/bridge.ts +1 -0
  2. package/apps/studio/acp/login-state.ts +1 -0
  3. package/apps/studio/acp/probe.ts +1 -0
  4. package/apps/studio/api.ts +412 -35
  5. package/apps/studio/asset-upload.ts +174 -0
  6. package/apps/studio/assets-s3.ts +37 -2
  7. package/apps/studio/bin/_pdf-playwright.mjs +22 -1
  8. package/apps/studio/bin/_png-playwright.mjs +20 -1
  9. package/apps/studio/bin/_region.mjs +92 -0
  10. package/apps/studio/canvas-build.ts +59 -4
  11. package/apps/studio/canvas-lib.tsx +48 -1
  12. package/apps/studio/canvas-shell.tsx +28 -4
  13. package/apps/studio/client/app.jsx +109 -22
  14. package/apps/studio/client/canvas-url.js +9 -0
  15. package/apps/studio/client/embed-view.jsx +284 -0
  16. package/apps/studio/client/embed.js +101 -0
  17. package/apps/studio/client/export-center.jsx +2 -0
  18. package/apps/studio/client/github.js +36 -3
  19. package/apps/studio/client/report-bug.jsx +8 -2
  20. package/apps/studio/context.ts +7 -0
  21. package/apps/studio/dist/client.bundle.js +2682 -2682
  22. package/apps/studio/dist/comment-mount.js +2 -2
  23. package/apps/studio/embed-origins.ts +52 -0
  24. package/apps/studio/export-dialog.tsx +55 -3
  25. package/apps/studio/exporters/format-scopes.ts +11 -3
  26. package/apps/studio/exporters/index.ts +17 -2
  27. package/apps/studio/exporters/jobs.ts +16 -8
  28. package/apps/studio/exporters/pdf.ts +10 -2
  29. package/apps/studio/exporters/png.ts +10 -2
  30. package/apps/studio/exporters/scope.ts +74 -3
  31. package/apps/studio/generation/runtime-probe.ts +1 -1
  32. package/apps/studio/git/service.ts +1 -0
  33. package/apps/studio/http.ts +186 -13
  34. package/apps/studio/input-router.tsx +7 -1
  35. package/apps/studio/path-containment.ts +72 -0
  36. package/apps/studio/paths.ts +14 -1
  37. package/apps/studio/read-only-mode.ts +53 -0
  38. package/apps/studio/server.ts +9 -0
  39. package/apps/studio/sync/index.ts +74 -13
  40. package/apps/studio/sync/park.ts +39 -0
  41. package/apps/studio/sync/presentation.ts +9 -3
  42. package/apps/studio/sync/writer-registry.ts +5 -0
  43. package/apps/studio/use-canvas-media-drop.tsx +8 -28
  44. package/apps/studio/whats-new.json +27 -0
  45. package/cli/commands/design.mjs +9 -2
  46. package/cli/commands/hub-workspace.mjs +25 -0
  47. package/cli/lib/workspace-plan.mjs +51 -0
  48. package/package.json +9 -9
  49. package/plugins/design/templates/_shell.html +58 -0
@@ -30,7 +30,60 @@ export function isReadOnlyCanvas(): boolean {
30
30
  return cached;
31
31
  }
32
32
 
33
+ let embedCached: boolean | null = null;
34
+
35
+ /**
36
+ * DDR-247 — is this canvas the chromeless view another app frames
37
+ * (`client/embed-view.jsx` appends `?embed=1`)? Boot-static for the same reason
38
+ * as `isReadOnlyCanvas`. An embed pans and zooms, but never persists its
39
+ * camera: the designer's own view of the canvas is not the embed's to move.
40
+ */
41
+ export function isEmbedCanvas(): boolean {
42
+ if (typeof window === 'undefined') return false;
43
+ if (embedCached === null) {
44
+ try {
45
+ embedCached = new URLSearchParams(window.location.search).get('embed') === '1';
46
+ } catch {
47
+ embedCached = false;
48
+ }
49
+ }
50
+ return embedCached;
51
+ }
52
+
53
+ /**
54
+ * DDR-247 — Escape inside an embedded canvas belongs to the app around it.
55
+ * Keys pressed in this frame never reach the embedding page, so an embed shown
56
+ * in a dialog would trap a keyboard user: the dialog's own Escape stops
57
+ * working. When nothing in the canvas consumed the key (`defaultPrevented`,
58
+ * read after every listener has run), tell the studio page, which relays it to
59
+ * the embedder as the contract's `escape`. Never in the studio itself.
60
+ */
61
+ export function installEmbedEscapeRelay(win: Window = window): () => void {
62
+ let embed = false;
63
+ try {
64
+ embed = new URLSearchParams(win.location?.search ?? '').get('embed') === '1';
65
+ } catch {
66
+ /* not a canvas URL */
67
+ }
68
+ if (!embed || win.parent === win) return () => {};
69
+ const onKey = (e: KeyboardEvent) => {
70
+ if (e.key !== 'Escape' || e.isComposing) return;
71
+ setTimeout(() => {
72
+ if (e.defaultPrevented) return;
73
+ try {
74
+ // The studio page checks origin + source before relaying anything.
75
+ win.parent.postMessage({ dgn: 'embed-escape' }, '*');
76
+ } catch {
77
+ /* parent gone */
78
+ }
79
+ }, 0);
80
+ };
81
+ win.addEventListener('keydown', onKey);
82
+ return () => win.removeEventListener('keydown', onKey);
83
+ }
84
+
33
85
  /** Test seam — reset the module cache (bun:test re-uses the module registry). */
34
86
  export function _resetReadOnlyCache(): void {
35
87
  cached = null;
88
+ embedCached = null;
36
89
  }
@@ -28,6 +28,7 @@ import { createGitLifecycle } from './collab/git-lifecycle.ts';
28
28
  import { createCollab } from './collab/index.ts';
29
29
  import { createContext, reloadConfig } from './context.ts';
30
30
  import { installLogRing } from './debug-bundle.ts';
31
+ import { parseEmbedOrigins } from './embed-origins.ts';
31
32
  import { createExportJobQueue } from './exporters/jobs.ts';
32
33
  import { createFsWatch } from './fs-watch.ts';
33
34
  import { createGenerationJobQueue } from './generation/jobs.ts';
@@ -540,6 +541,10 @@ function startCanvasServer(port: number): BunServer {
540
541
  // explicitly — the CANVAS_SAFE_API entry alone only opens the fetch
541
542
  // fall-through (which serves files, not route handlers). See DDR (Task 9).
542
543
  '/_api/asset': http.routes['/_api/asset'],
544
+ // Issue #126 — chunked upload; MIRROR of the CANVAS_SAFE_API entries (http.ts).
545
+ '/_api/asset/chunk-start': http.routes['/_api/asset/chunk-start'],
546
+ '/_api/asset/chunk': http.routes['/_api/asset/chunk'],
547
+ '/_api/asset/chunk-finish': http.routes['/_api/asset/chunk-finish'],
543
548
  // feature-photo-editor — PhotoEdit sidecar GET/PUT. MUST be here AND in
544
549
  // CANVAS_SAFE_API (http.ts): Bun matches `routes` before `fetch`, so a
545
550
  // one-list entry 404s from the canvas iframe (the DDR-088 rollout bug).
@@ -698,6 +703,10 @@ const extraShellOrigins = (process.env.MAUDE_EXTRA_SHELL_ORIGINS ?? '')
698
703
  .map((o) => ` ${o}`)
699
704
  .join('');
700
705
  ctx.mainOrigin = `http://localhost:${server.port} http://127.0.0.1:${server.port}${publicShellOrigin}${extraShellOrigins}`;
706
+ // DDR-247 — apps that may FRAME the studio for the read-only `?embed=1` view.
707
+ // Deliberately NOT folded into `mainOrigin` above: those are shells, and the
708
+ // hub's canvas door accepts shells as writers. An embedder only gets framing.
709
+ ctx.embedOrigins = parseEmbedOrigins(process.env.MAUDE_EMBED_ORIGINS);
701
710
 
702
711
  // T2 (9.1-A) — segregated canvas-content origin. ON BY DEFAULT (opt-OUT) since
703
712
  // phase-9.1: a second listener binds an OS-assigned free port, advertised as
@@ -79,6 +79,7 @@ import { migrateFlatFallback } from './migrate-flat-fallback.ts';
79
79
  import { migrateSeed } from './migrate-seed.ts';
80
80
  import { ORIGINS } from './origins.ts';
81
81
  import {
82
+ fileLaneBusy,
82
83
  initialParkState,
83
84
  isLocalWorkRel,
84
85
  PARK_TIMINGS,
@@ -1398,14 +1399,19 @@ export function createSyncRuntime(
1398
1399
  * `start()` only where parking is possible.
1399
1400
  */
1400
1401
  let parkedNow = false;
1402
+ /** When the file plane last delivered something — `fileLaneBusy`'s clock. */
1403
+ let lastFileProgressAt = 0;
1401
1404
  let parkDispatch: ((event: ParkEvent) => void) | null = null;
1402
1405
  let parkTimer: ReturnType<typeof setInterval> | null = null;
1403
1406
  let parkProbe: AbortController | null = null;
1404
1407
  let parkUiUnsub: (() => void) | null = null;
1405
1408
  const parkClock = opts.park?.now ?? (() => Date.now());
1406
1409
  /** A local edit, a doc update, a click: news for the park machine. */
1407
- const noteParkActivity = (type: 'localEdit' | 'uiActivity'): void => {
1408
- parkDispatch?.({ type, now: parkClock() });
1410
+ let lastActivitySource = 'start';
1411
+ const noteParkActivity = (type: 'localEdit' | 'uiActivity', source: string): void => {
1412
+ if (!parkDispatch) return;
1413
+ lastActivitySource = source;
1414
+ parkDispatch({ type, now: parkClock() });
1409
1415
  };
1410
1416
  /**
1411
1417
  * Cancels the boot-time capability probe. A `stop()` that leaves a `/health`
@@ -2786,7 +2792,7 @@ export function createSyncRuntime(
2786
2792
  // pass. `fs-watch.ts` still reports `_state/` to every OTHER subscriber.
2787
2793
  // Somebody's work, not the studio talking to itself: it keeps a desktop
2788
2794
  // awake, and unparks a parked one BEFORE the pass below is asked for.
2789
- if (isLocalWorkRel(rel)) noteParkActivity('localEdit');
2795
+ if (isLocalWorkRel(rel)) noteParkActivity('localEdit', `file ${rel.split('\\').join('/')}`);
2790
2796
  if (fileLedger && isLocalWorkRel(rel)) {
2791
2797
  fileLedger.noteChanged(rel.split('\\').join('/'));
2792
2798
  schedulePlanePass();
@@ -3635,7 +3641,7 @@ export function createSyncRuntime(
3635
3641
  // ANY change to a synced document is activity — a local edit unparks a
3636
3642
  // parked desktop, and a peer's edit arriving keeps a live collaboration
3637
3643
  // connected rather than parking under it.
3638
- const onDocUpdate = (): void => noteParkActivity('localEdit');
3644
+ const onDocUpdate = (): void => noteParkActivity('localEdit', `canvas ${canvas.slug}`);
3639
3645
  provider.document.on('update', onDocUpdate);
3640
3646
  noteDetach(statusDetaches, canvas.slug, () => provider.document.off('update', onDocUpdate));
3641
3647
  // Fix 5 (sync RCA 2026-08-10): stamp the canvas path BEFORE the
@@ -4780,18 +4786,47 @@ export function createSyncRuntime(
4780
4786
  const parkFetch = opts.park?.fetch ?? fetch;
4781
4787
  let parkState: ParkState = initialParkState({ now: parkClock(), eligible: true });
4782
4788
  /** Outbound work that must land before the sockets may close. */
4783
- const hasPendingWork = (): boolean => {
4784
- if (planePassInFlight || filePassTimer !== null || remotePollSoonTimer !== null) {
4785
- return true;
4786
- }
4787
- for (const p of providers.values()) {
4789
+ /**
4790
+ * Why the link must stay up right now, or null. A reason, not a flag, so
4791
+ * an idle desktop that cannot park SAYS why (the v1.6.13 night was
4792
+ * diagnosable only from the cloud's request log).
4793
+ *
4794
+ * Every lane is judged by whether it is MOVING, not by whether something
4795
+ * is unfinished: a document whose change the hub never acknowledges, or
4796
+ * a file that never lands, would otherwise hold a cell awake forever. A
4797
+ * stalled lane resumes on the next edit, click, change signal or the 6 h
4798
+ * backstop.
4799
+ */
4800
+ const unsyncedSince = new Map<string, number>();
4801
+ const pendingReason = (): string | null => {
4802
+ if (planePassInFlight || filePassTimer !== null) return 'a file pass is running';
4803
+ if (remotePollSoonTimer !== null) return 'a catch-up poll is due';
4804
+ const now = Date.now();
4805
+ for (const [slug, p] of providers) {
4788
4806
  if ((p as unknown as { hasUnsyncedChanges?: boolean }).hasUnsyncedChanges === true) {
4789
- return true;
4807
+ const since = unsyncedSince.get(slug) ?? now;
4808
+ unsyncedSince.set(slug, since);
4809
+ if (now - since < timings.afterMs) return `canvas ${slug} has unsent changes`;
4810
+ } else {
4811
+ unsyncedSince.delete(slug);
4790
4812
  }
4791
4813
  }
4814
+ if (
4815
+ fileLedger &&
4816
+ fileLaneBusy(fileLedger.rows(), {
4817
+ now,
4818
+ lastProgressAt: lastFileProgressAt,
4819
+ windowMs: timings.afterMs,
4820
+ })
4821
+ ) {
4822
+ return 'files are still being delivered';
4823
+ }
4792
4824
  // Saves, uploads and retries the other lanes report (attacker F1).
4793
- return hasSelfRetryingWork(store.get());
4825
+ return hasSelfRetryingWork(store.get()) ? 'a save or upload is still in flight' : null;
4794
4826
  };
4827
+ const hasPendingWork = (): boolean => pendingReason() !== null;
4828
+ let lastHeldReason: string | null = null;
4829
+ let lastActivityReportAt = parkClock();
4795
4830
  const doPark = (): void => {
4796
4831
  parkedNow = true;
4797
4832
  // Flush what we know; the pending-work check already proved nothing is
@@ -4898,10 +4933,35 @@ export function createSyncRuntime(
4898
4933
  run(step.effects);
4899
4934
  };
4900
4935
  parkDispatch = dispatch;
4901
- parkUiUnsub = ctx.bus.on('ui:active', () => noteParkActivity('uiActivity'));
4936
+ parkUiUnsub = ctx.bus.on('ui:active', () => noteParkActivity('uiActivity', 'studio input'));
4902
4937
  parkTimer = setInterval(() => {
4903
4938
  const now = parkClock();
4904
- dispatch({ type: 'pendingChanged', pending: hasPendingWork(), now });
4939
+ const reason = pendingReason();
4940
+ // Idle long enough to park, but something holds the link: say what,
4941
+ // once per reason, so the next "why did it stay awake" has an answer
4942
+ // on this machine.
4943
+ if (
4944
+ reason &&
4945
+ parkState.phase === 'active' &&
4946
+ now - parkState.lastActivityAt >= timings.afterMs &&
4947
+ reason !== lastHeldReason
4948
+ ) {
4949
+ console.log(`[sync] idle, but staying connected: ${reason}.`);
4950
+ }
4951
+ lastHeldReason = reason;
4952
+ // A desktop that never even gets idle says what keeps waking it — at
4953
+ // most every 30 min, so a working session costs two log lines an hour.
4954
+ if (
4955
+ parkState.phase === 'active' &&
4956
+ now - parkState.lastActivityAt < timings.afterMs &&
4957
+ now - lastActivityReportAt >= 30 * 60_000
4958
+ ) {
4959
+ lastActivityReportAt = now;
4960
+ console.log(
4961
+ `[sync] park: active — last activity ${lastActivitySource}, ${Math.round((now - parkState.lastActivityAt) / 1000)} s ago.`
4962
+ );
4963
+ }
4964
+ dispatch({ type: 'pendingChanged', pending: reason !== null, now });
4905
4965
  dispatch({ type: 'tick', now });
4906
4966
  }, opts.park?.tickMs ?? 15_000);
4907
4967
  parkTimer.unref?.();
@@ -4971,6 +5031,7 @@ export function createSyncRuntime(
4971
5031
  // working.
4972
5032
  onProgress: () => {
4973
5033
  renewalsSinceProgress = 0;
5034
+ lastFileProgressAt = Date.now();
4974
5035
  },
4975
5036
  ledger: fileLedger,
4976
5037
  canvasGroups: ctx.cfg.canvasGroups,
@@ -286,3 +286,42 @@ export function parseCellState(
286
286
  typeof v === 'number' && Number.isFinite(v) && v >= 0 ? v : null;
287
287
  return { kind: 'state', state: p.state, changedAt: num(p.changedAt), at: num(p.at) };
288
288
  }
289
+
290
+ /** Rows already delivered, or parked on something only a person can change. */
291
+ const SETTLED_STATES = new Set([
292
+ 'on-hub',
293
+ 'durable',
294
+ 'at-peer',
295
+ 'ui-healed',
296
+ 'everywhere',
297
+ 'refused',
298
+ 'referenced-but-unoffered',
299
+ 'conflict',
300
+ 'stuck',
301
+ ]);
302
+
303
+ /**
304
+ * Is the file plane still delivering something a park would cut off?
305
+ *
306
+ * - A row being pushed right now always is.
307
+ * - Other outstanding rows (not yet sent, not backed off) are only while the
308
+ * plane is actually making progress: something landed within `windowMs`. A
309
+ * lane that has delivered nothing for that long is stalled, not moving, and
310
+ * holding a cell awake for it buys nothing — it resumes on the next edit,
311
+ * click, change signal or the backstop. (The night after v1.6.13: five
312
+ * `stuck` rows kept Alligators "seeding", and awake, until morning.)
313
+ */
314
+ export function fileLaneBusy(
315
+ rows: Record<string, { state?: string; nextAttemptAt?: number }>,
316
+ opts: { now: number; lastProgressAt: number; windowMs: number }
317
+ ): boolean {
318
+ let outstanding = false;
319
+ for (const row of Object.values(rows)) {
320
+ const state = row.state;
321
+ if (state === 'pushing') return true;
322
+ if (state && SETTLED_STATES.has(state)) continue;
323
+ if (Number.isFinite(row.nextAttemptAt) && (row.nextAttemptAt as number) > opts.now) continue;
324
+ outstanding = true;
325
+ }
326
+ return outstanding && opts.now - opts.lastProgressAt < opts.windowMs;
327
+ }
@@ -701,8 +701,8 @@ function readAiAction(raw: unknown): { state: 'open' | 'held'; canvases: number
701
701
  }
702
702
 
703
703
  /**
704
- * Work that finishes on its own if the link stays up — files or media still
705
- * moving or failed-and-retrying, a save waiting for the project's answer, an
704
+ * Work that finishes on its own if the link stays up — media still moving or
705
+ * failed-and-retrying, a save waiting for the project's answer, an
706
706
  * AI edit in progress. The desktop park waits for it (`sync/park.ts`): closing
707
707
  * the link over it would stop the retry and leave teammates without the work.
708
708
  * Held/blocked items wait on a PERSON, not on time, so they do not block a
@@ -712,7 +712,13 @@ function readAiAction(raw: unknown): { state: 'open' | 'held'; canvases: number
712
712
  export function hasSelfRetryingWork(status: SyncStatusLike | null | undefined): boolean {
713
713
  if (!status) return false;
714
714
  const lanes = readLanes(status);
715
- if (lanes.moving || lanes.failedFiles > 0 || lanes.failedMedia > 0) return true;
715
+ // THE FILE PLANE IS JUDGED FROM ITS LEDGER, not from here (`fileLaneBusy` in
716
+ // sync/park.ts). Its `seeding` phase counts a `stuck` row as remaining, so a
717
+ // project with five rows that never land is "seeding" forever — and reading
718
+ // that as work in flight kept Alligators awake all night after v1.6.13.
719
+ // Only the legacy media lane's own progress is read here.
720
+ const mediaMoving = lanes.moving !== null && 'media' in lanes.moving;
721
+ if (mediaMoving || lanes.failedMedia > 0) return true;
716
722
  if (readAcceptedPending(status.accepted)) return true;
717
723
  const ai = status.aiAction as { state?: unknown } | undefined;
718
724
  return ai?.state === 'open';
@@ -143,6 +143,11 @@ export const WRITER_REGISTRY: Record<string, WriterEntry> = {
143
143
  '/_api/photo-edit': { class: 'file-plane', rows: 'S25' },
144
144
  '/_api/footage': { class: 'file-plane', rows: 'S26' },
145
145
  '/_api/asset': { class: 'file-plane', rows: 'S27' },
146
+ // Issue #126 — chunks stay in this machine's `_state/asset-chunks/` scratch;
147
+ // only the reassembled asset written by chunk-finish joins the file plane.
148
+ '/_api/asset/chunk-start': { class: 'local' },
149
+ '/_api/asset/chunk': { class: 'local' },
150
+ '/_api/asset/chunk-finish': { class: 'file-plane', rows: 'S27' },
146
151
  '/_api/assets': { class: 'file-plane', rows: 'S27' },
147
152
  '/_api/import-asset': { class: 'file-plane', rows: 'S28/I08' },
148
153
  '/_api/import-brand': { class: 'file-plane', rows: 'S28/I07' },
@@ -22,8 +22,11 @@
22
22
  */
23
23
 
24
24
  import { useEffect } from 'react';
25
+ import { shouldChunk, uploadAsset } from './asset-upload.ts';
25
26
  import { showCanvasToast } from './canvas-notifications.tsx';
26
27
 
28
+ export { uploadAsset } from './asset-upload.ts';
29
+
27
30
  export { showCanvasToast } from './canvas-notifications.tsx';
28
31
 
29
32
  // ─────────────────────────────────────────────────────────────────────────────
@@ -165,34 +168,6 @@ export function classifyMediaPayload(p: MediaPayload): MediaIntent | null {
165
168
  return null;
166
169
  }
167
170
 
168
- // ─────────────────────────────────────────────────────────────────────────────
169
- // Upload
170
-
171
- /** POST raw image bytes to the capped asset route. Returns the assets/ path. */
172
- export async function uploadAsset(file: Blob): Promise<{ path: string } | { error: string }> {
173
- try {
174
- const res = await fetch('/_api/asset', {
175
- method: 'POST',
176
- headers: { 'Content-Type': file.type || 'application/octet-stream' },
177
- body: file,
178
- });
179
- if (!res.ok) {
180
- let msg = `upload failed (${res.status})`;
181
- try {
182
- const j = (await res.json()) as { error?: string };
183
- if (j?.error) msg = j.error;
184
- } catch {
185
- /* non-JSON error body */
186
- }
187
- return { error: msg };
188
- }
189
- const j = (await res.json()) as { path?: string };
190
- return typeof j?.path === 'string' ? { path: j.path } : { error: 'malformed upload response' };
191
- } catch (e) {
192
- return { error: e instanceof Error ? e.message : 'network error' };
193
- }
194
- }
195
-
196
171
  // ─────────────────────────────────────────────────────────────────────────────
197
172
  // Transient toast (no React state — self-contained DOM, mirrors ensure*Styles)
198
173
 
@@ -377,6 +352,11 @@ export async function uploadAndAnnounceMedia(
377
352
  mediaKind: 'video' | 'audio'
378
353
  ): Promise<void> {
379
354
  const sizeMb = file.size / (1024 * 1024);
355
+ // A chunked clip takes long enough over a cell's uplink that silence reads
356
+ // as "the drop did nothing".
357
+ if (shouldChunk(file.size, file.type)) {
358
+ showCanvasToast(`Uploading ${file.name || mediaKind} (${Math.round(sizeMb)} MB)…`);
359
+ }
380
360
  const res = await uploadAsset(file);
381
361
  if ('error' in res) {
382
362
  showCanvasToast(`Couldn't add ${mediaKind}: ${res.error}`, 'error');
@@ -1,6 +1,33 @@
1
1
  {
2
2
  "$schema": "./whats-new.schema.json",
3
3
  "entries": [
4
+ {
5
+ "id": "large-video-drops",
6
+ "version": "1.8.0",
7
+ "date": "2026-10-07",
8
+ "kind": "improvement",
9
+ "title": "Drop video clips up to 512 MB",
10
+ "summary": "Large video and audio files now upload to the canvas in pieces, so clips up to 512 MB can be dropped, pasted or picked instead of stopping at 100 MB. The asset picker shows how far the upload has got.",
11
+ "surface": "design-ui"
12
+ },
13
+ {
14
+ "id": "windows-canvases-and-assistant",
15
+ "version": "1.8.0",
16
+ "date": "2026-10-07",
17
+ "kind": "fix",
18
+ "title": "Maude works properly on Windows",
19
+ "summary": "Canvases render on Windows again instead of failing to load, the app no longer flashes a console window every few seconds, and the Assistant starts on machines with Node.js installed. This release also closes a Windows file-access hole, so please update.",
20
+ "surface": "design-ui"
21
+ },
22
+ {
23
+ "id": "export-whole-canvas",
24
+ "version": "1.8.0",
25
+ "date": "2026-10-07",
26
+ "kind": "feature",
27
+ "title": "Export the whole canvas as one image",
28
+ "summary": "PNG and PDF exports can now capture the whole canvas, or the area around your selection, as a single image or page with the layout intact. Tick Include annotations to bring your stickies, shapes and arrows along. Comment pins are left out.",
29
+ "surface": "design-ui"
30
+ },
4
31
  {
5
32
  "id": "annotation-lock",
6
33
  "version": "1.7.0",
@@ -371,7 +371,7 @@ Dev-tooling (dispatch to the dev-server bash helpers — DDR-062):
371
371
  scaffolds Core + the derived specimens deterministically (this is the
372
372
  path skill 'design-system' uses when shelling out from Claude Code).
373
373
 
374
- export <format> [--scope selection|artboard|canvas-as-separate|project-raw]
374
+ export <format> [--scope selection|artboard|canvas-as-separate|canvas-whole|selection-bounds|project-raw]
375
375
  [--port N] [--out <path>] [--option key=value ...]
376
376
  Drive the same POST /_api/export endpoint the UI uses. Auto-detects
377
377
  port from .design/_server.json; requires a running dev server. The
@@ -698,7 +698,14 @@ async function runExport({ args }) {
698
698
  // scope.ts resolves the artboard under the active canvas); other formats keep
699
699
  // the canvas-as-separate default.
700
700
  const scope = flags.scope ?? (VIDEO_FORMATS.has(format) ? 'artboard' : 'canvas-as-separate');
701
- const VALID_SCOPES = new Set(['selection', 'artboard', 'canvas-as-separate', 'project-raw']);
701
+ const VALID_SCOPES = new Set([
702
+ 'selection',
703
+ 'artboard',
704
+ 'canvas-as-separate',
705
+ 'canvas-whole',
706
+ 'selection-bounds',
707
+ 'project-raw',
708
+ ]);
702
709
  if (!VALID_SCOPES.has(scope)) {
703
710
  process.stderr.write(`maude design export: unknown --scope "${scope}"\n`);
704
711
  process.exit(2);
@@ -46,6 +46,10 @@ export function usage() {
46
46
  their own origin; without a public name for it the
47
47
  iframe points at a container-internal port and every
48
48
  canvas is a blank frame. Point DNS here too.
49
+ --embed-origin ORIGIN an app allowed to FRAME the studio read-only
50
+ (https://orbit.acme.com), for the ?embed=1 view.
51
+ Repeatable, or comma-separated. Framing only: an
52
+ embedder never gets write access to a canvas.
49
53
  --acme-email EMAIL Let's Encrypt contact
50
54
  --admin-email EMAIL the first person who can sign in
51
55
  --admin-password PASS their initial password (>= 12 chars; generated if omitted)
@@ -89,6 +93,20 @@ export function usage() {
89
93
  `;
90
94
  }
91
95
 
96
+ /** Every value of a repeatable `--name V` / `--name=V` flag, comma lists split. */
97
+ export function repeatedFlag(args, name) {
98
+ const out = [];
99
+ for (let i = 0; i < args.length; i++) {
100
+ const a = args[i];
101
+ if (a === `--${name}` && i + 1 < args.length) out.push(args[++i]);
102
+ else if (a.startsWith(`--${name}=`)) out.push(a.slice(name.length + 3));
103
+ }
104
+ return out
105
+ .flatMap((v) => String(v).split(','))
106
+ .map((v) => v.trim())
107
+ .filter(Boolean);
108
+ }
109
+
92
110
  export async function run({ args, pkgRoot }) {
93
111
  const { flags } = parseArgs(args, {
94
112
  booleans: ['help', 'dry-run', 'json', 'dev-minio', 'local', 'render'],
@@ -112,6 +130,10 @@ export async function run({ args, pkgRoot }) {
112
130
  render: flags.render === true || raw.render === true,
113
131
  seedRepo: flags['seed-repo'] ?? raw.seedRepo,
114
132
  canvasDomain: flags['canvas-domain'] ?? raw.canvasDomain,
133
+ // Repeatable, which parseArgs (last one wins) cannot express.
134
+ embedOrigins: repeatedFlag(args, 'embed-origin').length
135
+ ? repeatedFlag(args, 'embed-origin')
136
+ : raw.embedOrigins,
115
137
  imageTag: flags['image-tag'] ?? raw.imageTag,
116
138
  ...(flags['s3-endpoint'] || raw.s3
117
139
  ? {
@@ -910,6 +932,9 @@ function printDryRun({ config, outDir, files, plan, duties, reusedSecret }) {
910
932
  ` storage ${config.s3 ? `${config.s3.bucket} @ ${config.s3.endpoint}${config.s3.dev ? ' (dev MinIO)' : ''}` : 'none — media stays in git'}\n` +
911
933
  ` project ${safeSeedUrl(config.seedRepo) ?? 'starts fresh'}\n` +
912
934
  ` canvas ${config.canvasDomain ? `${config.local ? 'http' : 'https'}://${config.canvasDomain}` : config.local ? 'same-machine (local mode — the browser can reach the container port)' : 'NOT SET — canvases will not render in remote browsers'}\n` +
935
+ (config.embedOrigins?.length
936
+ ? ` embeds ${config.embedOrigins.join(' ')} (may frame the studio read-only)\n`
937
+ : '') +
913
938
  ` image ghcr.io/1agh/maude-hub:${config.imageTag}\n` +
914
939
  ` out ${outDir}\n` +
915
940
  (reusedSecret ? ' secrets reusing HUB_SECRET from the existing .env\n' : '') +
@@ -177,6 +177,48 @@ export function validateWorkspaceConfig(raw = {}) {
177
177
  cfg.canvasDomain = null;
178
178
  }
179
179
 
180
+ // DDR-247 — apps allowed to FRAME the studio for its read-only `?embed=1`
181
+ // view (orbit showing a design next to a task). A FRAMING list, never a
182
+ // writing one: the hub keeps it out of the canvas door's write allowlist,
183
+ // which is why it is not more MAUDE_EXTRA_SHELL_ORIGINS. Each entry is
184
+ // normalized to an origin; a wildcard or a non-https origin (other than a
185
+ // loopback dev app) is an error here rather than a silently dropped entry
186
+ // on the server.
187
+ cfg.embedOrigins = [];
188
+ const embedRaw = Array.isArray(raw.embedOrigins)
189
+ ? raw.embedOrigins
190
+ : String(raw.embedOrigins ?? '').split(/[\s,]+/);
191
+ for (const entry of embedRaw.map((e) => String(e ?? '').trim()).filter(Boolean)) {
192
+ let url = null;
193
+ try {
194
+ url = new URL(entry);
195
+ } catch {
196
+ /* reported below */
197
+ }
198
+ if (
199
+ !url ||
200
+ entry.includes('*') ||
201
+ url.username ||
202
+ url.password ||
203
+ !/^https?:$/.test(url.protocol)
204
+ ) {
205
+ errors.push(`embedOrigin "${entry}" is not an origin (https://app.example.com)`);
206
+ continue;
207
+ }
208
+ const loopback =
209
+ url.hostname === 'localhost' ||
210
+ url.hostname.endsWith('.localhost') ||
211
+ url.hostname === '127.0.0.1' ||
212
+ url.hostname === '[::1]';
213
+ if (url.protocol === 'http:' && !loopback) {
214
+ errors.push(
215
+ `embedOrigin "${entry}" must be https — only a loopback dev app may be plain http`
216
+ );
217
+ continue;
218
+ }
219
+ if (!cfg.embedOrigins.includes(url.origin)) cfg.embedOrigins.push(url.origin);
220
+ }
221
+
180
222
  cfg.acmeEmail = String(raw.acmeEmail ?? '').trim();
181
223
  if (!cfg.acmeEmail) {
182
224
  if (!cfg.local) errors.push('acmeEmail is required (Let’s Encrypt expiry notices)');
@@ -429,6 +471,14 @@ export function envEntries(cfg, { hubSecret, adminPassword, renderSecret }) {
429
471
  }
430
472
  );
431
473
  }
474
+ if (cfg.embedOrigins?.length) {
475
+ entries.push({
476
+ key: 'MAUDE_EMBED_ORIGINS',
477
+ value: cfg.embedOrigins.join(' '),
478
+ comment:
479
+ 'apps that may FRAME the studio read-only (?embed=1) — framing only, never write access',
480
+ });
481
+ }
432
482
  if (cfg.render) {
433
483
  entries.push(
434
484
  {
@@ -543,6 +593,7 @@ export function renderCompose(cfg) {
543
593
  // S3 block above, same failure mode when they drift (M7: the origin was
544
594
  // supported end to end and no deployment path ever set it).
545
595
  ...(cfg.canvasDomain ? ['MAUDE_PUBLIC_CANVAS_ORIGIN'] : []),
596
+ ...(cfg.embedOrigins?.length ? ['MAUDE_EMBED_ORIGINS'] : []),
546
597
  ...(cfg.render ? ['MAUDE_RENDER_SECRET', 'MAUDE_RENDER_URL', 'MAUDE_RENDER_CANVAS_BASE'] : []),
547
598
  ];
548
599
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1agh/maude",
3
- "version": "1.7.1",
3
+ "version": "1.8.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": {
@@ -31,7 +31,7 @@
31
31
  "build:binary": "bun run apps/studio/build.ts --release",
32
32
  "test": "node --test --test-reporter=spec cli/**/*.test.mjs && pnpm --filter @maude/hub test && pnpm run test:harness",
33
33
  "test:harness": "node --test $(find scripts/dev/sync-e2e -maxdepth 1 -name 'surface-*.test.mjs' ! -name 'surface-source-audit.test.mjs') && bun test scripts/dev/sync-e2e/surface-source-audit.test.mjs",
34
- "test:dev-server": "cd apps/studio && bun test --timeout 20000",
34
+ "test:dev-server": "cd apps/studio && bun test --isolate --timeout 20000",
35
35
  "lint": "biome check .",
36
36
  "format": "biome format --write .",
37
37
  "changeset": "changeset",
@@ -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.7.1",
62
- "@1agh/maude-darwin-x64": "1.7.1",
63
- "@1agh/maude-linux-arm64": "1.7.1",
64
- "@1agh/maude-linux-arm64-musl": "1.7.1",
65
- "@1agh/maude-linux-x64": "1.7.1",
66
- "@1agh/maude-linux-x64-musl": "1.7.1",
67
- "@1agh/maude-win32-x64": "1.7.1"
61
+ "@1agh/maude-darwin-arm64": "1.8.1",
62
+ "@1agh/maude-darwin-x64": "1.8.1",
63
+ "@1agh/maude-linux-arm64": "1.8.1",
64
+ "@1agh/maude-linux-arm64-musl": "1.8.1",
65
+ "@1agh/maude-linux-x64": "1.8.1",
66
+ "@1agh/maude-linux-x64-musl": "1.8.1",
67
+ "@1agh/maude-win32-x64": "1.8.1"
68
68
  },
69
69
  "files": [
70
70
  "cli",