@1agh/maude 2.0.6 → 2.0.8

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 (177) hide show
  1. package/apps/studio/access/closure.ts +156 -16
  2. package/apps/studio/access/filters.ts +27 -0
  3. package/apps/studio/actions/agents.ts +54 -0
  4. package/apps/studio/actions/ctx.ts +3 -0
  5. package/apps/studio/actions/defs/sync.ts +13 -0
  6. package/apps/studio/actions/defs/view.ts +59 -3
  7. package/apps/studio/actions/keymap.gen.ts +35 -0
  8. package/apps/studio/actions/menu.ts +2 -0
  9. package/apps/studio/actions/types.ts +3 -1
  10. package/apps/studio/actions.manifest.json +136 -1
  11. package/apps/studio/actions.parity.json +25 -1
  12. package/apps/studio/annotations/ui/ai-seen.tsx +4 -3
  13. package/apps/studio/annotations/ui/ride.ts +2 -1
  14. package/apps/studio/annotations-context-toolbar.tsx +5 -4
  15. package/apps/studio/annotations-layer.tsx +4 -3
  16. package/apps/studio/api.ts +383 -128
  17. package/apps/studio/artboard-activity-overlay.tsx +4 -4
  18. package/apps/studio/artboard-ai-copies.tsx +4 -4
  19. package/apps/studio/artboard-freeze.ts +108 -0
  20. package/apps/studio/artboard-live-gate.tsx +414 -45
  21. package/apps/studio/artboard-live.ts +526 -31
  22. package/apps/studio/artboard-placeholder.ts +197 -0
  23. package/apps/studio/artboard-still-raster.ts +485 -0
  24. package/apps/studio/artboard-still-warmup.ts +221 -0
  25. package/apps/studio/artboard-still.ts +1188 -0
  26. package/apps/studio/artboard-webgl.ts +2 -1
  27. package/apps/studio/asset-placeholder.tsx +237 -132
  28. package/apps/studio/asset-upload-bars.tsx +4 -4
  29. package/apps/studio/bin/_perf-probe-open.mjs +364 -0
  30. package/apps/studio/bin/_perf-shared.mjs +12 -7
  31. package/apps/studio/bin/_pw-launch.mjs +26 -1
  32. package/apps/studio/bin/perf.sh +19 -0
  33. package/apps/studio/bridge/dgn-protocol.ts +35 -0
  34. package/apps/studio/canvas-build-sandbox.ts +69 -13
  35. package/apps/studio/canvas-camera.ts +90 -0
  36. package/apps/studio/canvas-comment-mount.tsx +9 -9
  37. package/apps/studio/canvas-lib.tsx +160 -34
  38. package/apps/studio/canvas-pages-view.tsx +465 -0
  39. package/apps/studio/canvas-pages.ts +305 -0
  40. package/apps/studio/canvas-rows.ts +62 -0
  41. package/apps/studio/canvas-shell.tsx +62 -16
  42. package/apps/studio/canvas-theme-icons.tsx +41 -0
  43. package/apps/studio/canvas-theme-pill.tsx +15 -6
  44. package/apps/studio/canvas-theme.ts +12 -11
  45. package/apps/studio/client/app.jsx +7 -0
  46. package/apps/studio/client/canvas-url.js +23 -1
  47. package/apps/studio/client/hooks/canvas-origin-probe.js +34 -0
  48. package/apps/studio/client/hooks/use-action-keys.jsx +3 -1
  49. package/apps/studio/client/hooks/use-canvas-bridge.jsx +1 -1
  50. package/apps/studio/client/hooks/use-palette-and-panels.jsx +23 -6
  51. package/apps/studio/client/hooks/use-photo-and-timeline.jsx +16 -8
  52. package/apps/studio/client/hooks/use-project-data.jsx +11 -2
  53. package/apps/studio/client/hooks/use-shell-core.jsx +19 -9
  54. package/apps/studio/client/index-loader.ts +41 -21
  55. package/apps/studio/client/inspector/inspector-panel.jsx +35 -14
  56. package/apps/studio/client/shell/viewport.jsx +32 -16
  57. package/apps/studio/client/tree/tree.jsx +17 -0
  58. package/apps/studio/client/v2/canvases/canvases-panel.jsx +24 -0
  59. package/apps/studio/client/v2/canvases/use-canvas-index.js +24 -1
  60. package/apps/studio/client/v2/code/canvas-error-card.jsx +14 -2
  61. package/apps/studio/client/v2/code/canvas-imports-card.jsx +7 -3
  62. package/apps/studio/client/v2/code/canvas-imports-words.js +16 -0
  63. package/apps/studio/client/v2/code/canvas-waiting-card.jsx +59 -5
  64. package/apps/studio/client/v2/code/canvas-waiting.js +18 -1
  65. package/apps/studio/client/v2/code/code-consent-sheet.jsx +87 -0
  66. package/apps/studio/client/v2/code/code-consent.js +67 -0
  67. package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +62 -10
  68. package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +314 -5
  69. package/apps/studio/client/v2/layers/artboard-layers.jsx +24 -5
  70. package/apps/studio/client/v2/layers/layers-request.js +49 -0
  71. package/apps/studio/client/v2/left-panel/canvases-pinned.jsx +93 -3
  72. package/apps/studio/client/v2/left-panel/ds-boards.js +39 -0
  73. package/apps/studio/client/v2/left-panel/left-panel-model.js +13 -0
  74. package/apps/studio/client/v2/left-panel/left-panel.css +24 -0
  75. package/apps/studio/client/v2/shell/canvas-crash-guard.js +40 -5
  76. package/apps/studio/client/v2/shell/canvas-mode.js +17 -1
  77. package/apps/studio/client/v2/shell/floating-panels.css +37 -1
  78. package/apps/studio/client/v2/shell/mode-switch.jsx +14 -3
  79. package/apps/studio/client/v2/shell/opening-skeleton.js +118 -0
  80. package/apps/studio/client/v2/shell/opening-skeleton.jsx +103 -0
  81. package/apps/studio/client/v2/shell/pages-pick.js +49 -0
  82. package/apps/studio/client/v2/shell/project-menu-model.js +3 -0
  83. package/apps/studio/client/v2/shell/share-cluster-host.jsx +3 -1
  84. package/apps/studio/client/v2/shell/shell-parity.json +8 -0
  85. package/apps/studio/client/v2/shell/use-canvas-mode-lane.js +30 -0
  86. package/apps/studio/comments-overlay.tsx +12 -11
  87. package/apps/studio/config-reload-wire.ts +4 -1
  88. package/apps/studio/config.schema.json +6 -0
  89. package/apps/studio/context.ts +37 -1
  90. package/apps/studio/dist/client.bundle.js +720 -720
  91. package/apps/studio/dist/comment-mount.js +2 -2
  92. package/apps/studio/dist/styles.css +1 -1
  93. package/apps/studio/ds/board/board.css +6 -0
  94. package/apps/studio/ds/board/ds-bar.tsx +21 -3
  95. package/apps/studio/ds/board/specimen.tsx +6 -3
  96. package/apps/studio/ds/board/template.ts +39 -19
  97. package/apps/studio/ds/cli.ts +7 -1
  98. package/apps/studio/ds/component-list.ts +2 -1
  99. package/apps/studio/ds/default.ts +6 -1
  100. package/apps/studio/ds/ds-resolver.ts +58 -8
  101. package/apps/studio/ds/engine.ts +3 -1
  102. package/apps/studio/ds/folder-systems.ts +199 -0
  103. package/apps/studio/ds/pairing-css.ts +2 -1
  104. package/apps/studio/ds/rename.ts +10 -3
  105. package/apps/studio/ds/shell-fallbacks.ts +2 -1
  106. package/apps/studio/ds/upgrade-stage.ts +6 -2
  107. package/apps/studio/editing/ai-point-ring.tsx +4 -4
  108. package/apps/studio/editing/ai-scope-outline.tsx +4 -4
  109. package/apps/studio/editing/align-bar.tsx +4 -4
  110. package/apps/studio/editing/anchor-report.ts +3 -2
  111. package/apps/studio/editing/artboard-handles.tsx +4 -4
  112. package/apps/studio/editing/corner-dots.tsx +4 -4
  113. package/apps/studio/editing/crop-mode.tsx +4 -4
  114. package/apps/studio/editing/drop-chip.tsx +4 -4
  115. package/apps/studio/editing/empty-report.ts +3 -2
  116. package/apps/studio/editing/focus-model.tsx +4 -4
  117. package/apps/studio/editing/gap-bands.tsx +3 -3
  118. package/apps/studio/editing/hold-rings.tsx +4 -4
  119. package/apps/studio/editing/lock-badge.tsx +3 -3
  120. package/apps/studio/editing/long-page.ts +23 -1
  121. package/apps/studio/editing/nudge.tsx +2 -2
  122. package/apps/studio/editing/page-activity.ts +4 -3
  123. package/apps/studio/editing/paste-bar.tsx +4 -4
  124. package/apps/studio/editing/pen/overlay.tsx +4 -3
  125. package/apps/studio/editing/place-freely.tsx +3 -3
  126. package/apps/studio/editing/reorder-slot.tsx +3 -3
  127. package/apps/studio/editing/selection.tsx +4 -4
  128. package/apps/studio/editing/size-ghost.tsx +4 -4
  129. package/apps/studio/editing/tab-order.tsx +4 -4
  130. package/apps/studio/editing/text-in-place.tsx +4 -4
  131. package/apps/studio/editing/undo-preview.tsx +3 -3
  132. package/apps/studio/equal-spacing-handles.tsx +3 -3
  133. package/apps/studio/frame-clock.ts +89 -0
  134. package/apps/studio/http.ts +66 -32
  135. package/apps/studio/index/ds-usage.ts +4 -1
  136. package/apps/studio/index-cache.ts +272 -0
  137. package/apps/studio/inspect-overlay.tsx +4 -3
  138. package/apps/studio/inspect.ts +7 -2
  139. package/apps/studio/link-chip-overlay.tsx +4 -3
  140. package/apps/studio/measure-overlay.tsx +4 -3
  141. package/apps/studio/present/pointer-dot.tsx +3 -2
  142. package/apps/studio/present/present-media.ts +6 -2
  143. package/apps/studio/present/present-stage.tsx +3 -2
  144. package/apps/studio/preview/preview-camera.tsx +3 -2
  145. package/apps/studio/routes/sync.ts +176 -0
  146. package/apps/studio/safe-zones-overlay.tsx +3 -2
  147. package/apps/studio/skip-dirs.ts +103 -47
  148. package/apps/studio/studio-page-host.ts +70 -0
  149. package/apps/studio/sync/code-module-consent.ts +86 -0
  150. package/apps/studio/sync/file-ledger.ts +24 -0
  151. package/apps/studio/sync/file-plane.ts +458 -53
  152. package/apps/studio/sync/held-deletes.ts +230 -0
  153. package/apps/studio/sync/hubs-config.ts +59 -2
  154. package/apps/studio/sync/index.ts +99 -15
  155. package/apps/studio/sync/seed-progress.ts +92 -2
  156. package/apps/studio/sync/settings.ts +36 -1
  157. package/apps/studio/sync/status.ts +15 -1
  158. package/apps/studio/sync/writer-registry.ts +5 -0
  159. package/apps/studio/text-caret.ts +5 -3
  160. package/apps/studio/toolbars/toolbar-rect.ts +3 -2
  161. package/apps/studio/use-annotation-resize.tsx +4 -3
  162. package/apps/studio/use-artboard-drag.tsx +3 -2
  163. package/apps/studio/use-element-resize.tsx +7 -6
  164. package/apps/studio/use-grid-track-handles.tsx +5 -4
  165. package/apps/studio/use-selection-set.tsx +64 -4
  166. package/apps/studio/use-spacing-handles.tsx +7 -6
  167. package/apps/studio/video-comp.tsx +55 -42
  168. package/apps/studio/video-play-overlay.tsx +4 -3
  169. package/apps/studio/whats-new.json +27 -0
  170. package/cli/commands/design.mjs +5 -2
  171. package/cli/commands/hub.mjs +10 -1
  172. package/cli/lib/bash-guard.mjs +14 -0
  173. package/cli/lib/design-help.gen.mjs +1 -1
  174. package/cli/lib/design-link.mjs +42 -17
  175. package/cli/lib/hub-purge.mjs +183 -0
  176. package/package.json +8 -8
  177. package/plugins/design/templates/_shell.html +164 -1
@@ -29,9 +29,10 @@ import {
29
29
  useState,
30
30
  useSyncExternalStore,
31
31
  } from 'react';
32
- import { useArtboardActive } from './artboard-live-gate.tsx';
32
+ import { useArtboardActive, useArtboardMedia } from './artboard-live-gate.tsx';
33
33
  import { canvasModeStore } from './bridge/canvas-mode-store.ts';
34
34
  import { videoLabelTail } from './editing/video-label.ts';
35
+ import { frameRaf } from './frame-clock.ts';
35
36
  import { resolvedPoster } from './kinds/meta.ts';
36
37
  import { VideoPlayChrome } from './video-play-chrome.tsx';
37
38
 
@@ -278,7 +279,7 @@ function clamp(n: number, lo: number, hi: number): number {
278
279
  function afterPaint(): Promise<void> {
279
280
  if (typeof requestAnimationFrame !== 'function') return Promise.resolve();
280
281
  return new Promise((resolve) => {
281
- requestAnimationFrame(() => requestAnimationFrame(() => resolve()));
282
+ frameRaf(() => frameRaf(() => resolve()));
282
283
  });
283
284
  }
284
285
 
@@ -585,10 +586,15 @@ export function VideoComp({
585
586
  // 2.0.5 — a comp in a sleeping artboard (offscreen, or the canvas zoomed out to its overview) stops
586
587
  // decoding: pause it, and play it again on wake only if WE paused it. Never in a capture (always live).
587
588
  const live = useArtboardActive();
589
+ // 2.0.7 — a video artboard is mounted wherever it is, so this comp registers (the link glyph, the Timeline's
590
+ // shared count and Present's format switch read the registry). Its Player — and so its <video preload="auto">,
591
+ // which fetches the whole file and decodes a frame — mounts only while the artboard is in the mount ring
592
+ // (`useArtboardMedia`), as the artboard itself did before. A capture always has it.
593
+ const media = useArtboardMedia() || capturing;
588
594
  const pausedAsleep = useRef(false);
589
595
  useEffect(() => {
590
596
  const p = ref.current;
591
- if (!p) return;
597
+ if (!media || !p) return; // far: no Player yet
592
598
  try {
593
599
  if (!live) {
594
600
  if (p.isPlaying()) {
@@ -602,7 +608,7 @@ export function VideoComp({
602
608
  } catch {
603
609
  /* Player transitional — the next change settles it */
604
610
  }
605
- }, [live]);
611
+ }, [live, media]);
606
612
 
607
613
  // Register with the seek bridge for the lifetime of this mount.
608
614
  useEffect(() => {
@@ -696,7 +702,7 @@ export function VideoComp({
696
702
  // iframe → shell: mirror the playhead so the Timeline panel tracks preview.
697
703
  useEffect(() => {
698
704
  const p = ref.current;
699
- if (!p) return;
705
+ if (!media || !p) return;
700
706
  const onFrame = () => {
701
707
  try {
702
708
  const f = p.getCurrentFrame();
@@ -715,14 +721,14 @@ export function VideoComp({
715
721
  /* ignore */
716
722
  }
717
723
  };
718
- }, [compId]);
724
+ }, [compId, media]);
719
725
 
720
726
  // S7.8 — the poster moved (set from the timeline, or by a peer): a video nobody has played or scrubbed
721
727
  // rests on the new picture; one whose playhead was moved keeps its place. The poster is keyed by the
722
728
  // enclosing artboard's id (the `<VideoComp id>` when it matches), so it is looked up once mounted too.
723
729
  const resting = useRef<number | null>(null);
724
730
  useEffect(() => {
725
- if (typeof document === 'undefined' || capturing) return undefined;
731
+ if (typeof document === 'undefined' || capturing || !media) return undefined;
726
732
  const rest = () => {
727
733
  const p = ref.current;
728
734
  if (!p) return;
@@ -749,13 +755,13 @@ export function VideoComp({
749
755
  rest();
750
756
  document.addEventListener('maude:meta-refreshed', rest);
751
757
  return () => document.removeEventListener('maude:meta-refreshed', rest);
752
- }, [compId, durationInFrames, capturing]);
758
+ }, [compId, durationInFrames, capturing, media]);
753
759
 
754
760
  // S7.8 — the Player is the truth about playing: tell the shell on every play / pause, so a click on the
755
761
  // artboard's own button and the Timeline's Space or button can never disagree.
756
762
  useEffect(() => {
757
763
  const p = ref.current;
758
- if (!p || capturing) return undefined;
764
+ if (!media || !p || capturing) return undefined;
759
765
  const tell = (playing: boolean) => () =>
760
766
  postToShell({ dgn: 'timeline-playing', id: compId, playing });
761
767
  const onPlay = tell(true);
@@ -770,7 +776,7 @@ export function VideoComp({
770
776
  /* unmounted */
771
777
  }
772
778
  };
773
- }, [compId, capturing]);
779
+ }, [compId, capturing, media]);
774
780
 
775
781
  // iframe → shell: with loop off (now the default), the Player stops itself
776
782
  // at the last frame — nothing else tells the Timeline panel's Play/Pause
@@ -779,7 +785,7 @@ export function VideoComp({
779
785
  // artboard-loop-defaults-on).
780
786
  useEffect(() => {
781
787
  const p = ref.current;
782
- if (!p) return;
788
+ if (!media || !p) return;
783
789
  const onEnded = () => postToShell({ dgn: 'timeline-ended', id: compId });
784
790
  p.addEventListener('ended', onEnded);
785
791
  return () => {
@@ -789,7 +795,7 @@ export function VideoComp({
789
795
  /* ignore */
790
796
  }
791
797
  };
792
- }, [compId]);
798
+ }, [compId, media]);
793
799
 
794
800
  const style = useMemo(() => ({ width: '100%', height: '100%', display: 'block' as const }), []);
795
801
 
@@ -800,36 +806,43 @@ export function VideoComp({
800
806
  data-comp-id={compId}
801
807
  style={{ width, height, maxWidth: '100%', position: 'relative' }}
802
808
  >
803
- <Player
804
- ref={ref}
805
- component={component}
806
- durationInFrames={Math.max(1, Math.round(durationInFrames))}
807
- fps={fps}
808
- compositionWidth={width}
809
- compositionHeight={height}
810
- inputProps={inputProps ?? {}}
811
- controls={showControls}
812
- loop={loopFor(loopState, presenting)}
813
- autoPlay={play}
814
- initialFrame={initialFrame}
815
- // Clicking the artboard must NOT toggle playback — it selects elements
816
- // for editing (the whole point of a canvas). Play only via the explicit
817
- // transport button (Player controls / Timeline panel). Same for the
818
- // spacebar, which is the canvas pan chord. (DDR-148 feedback #2.)
819
- clickToPlay={false}
820
- spaceKeyToPlayOrPause={false}
821
- doubleClickToFullscreen={false}
822
- // We ship Remotion in-house and disclose the license (DDR-148); ack in
823
- // code so the Player never nags/watermarks the preview.
824
- acknowledgeRemotionLicense
825
- style={style}
826
- />
827
- {capturing || presenting ? null : (
828
- <VideoPlayChrome
829
- playerRef={ref}
830
- fps={fps}
831
- durationInFrames={Math.max(1, Math.round(durationInFrames))}
832
- />
809
+ {media ? (
810
+ <>
811
+ <Player
812
+ ref={ref}
813
+ component={component}
814
+ durationInFrames={Math.max(1, Math.round(durationInFrames))}
815
+ fps={fps}
816
+ compositionWidth={width}
817
+ compositionHeight={height}
818
+ inputProps={inputProps ?? {}}
819
+ controls={showControls}
820
+ loop={loopFor(loopState, presenting)}
821
+ autoPlay={play}
822
+ initialFrame={initialFrame}
823
+ // Clicking the artboard must NOT toggle playback — it selects elements
824
+ // for editing (the whole point of a canvas). Play only via the explicit
825
+ // transport button (Player controls / Timeline panel). Same for the
826
+ // spacebar, which is the canvas pan chord. (DDR-148 feedback #2.)
827
+ clickToPlay={false}
828
+ spaceKeyToPlayOrPause={false}
829
+ doubleClickToFullscreen={false}
830
+ // We ship Remotion in-house and disclose the license (DDR-148); ack in
831
+ // code so the Player never nags/watermarks the preview.
832
+ acknowledgeRemotionLicense
833
+ style={style}
834
+ />
835
+ {capturing || presenting ? null : (
836
+ <VideoPlayChrome
837
+ playerRef={ref}
838
+ fps={fps}
839
+ durationInFrames={Math.max(1, Math.round(durationInFrames))}
840
+ />
841
+ )}
842
+ </>
843
+ ) : (
844
+ // far from the viewport: same size, nothing fetched, nothing decoded
845
+ <div data-dc-video-resting="" aria-hidden="true" style={style} />
833
846
  )}
834
847
  </div>
835
848
  );
@@ -16,6 +16,7 @@ import { type ReactElement, useCallback, useEffect, useRef, useState } from 'rea
16
16
  import { createPortal } from 'react-dom';
17
17
  import { canvasModeStore } from './bridge/canvas-mode-store.ts';
18
18
  import { selectedVideoElements, togglePlayback } from './editing/video-play.ts';
19
+ import { frameCaf, frameRaf } from './frame-clock.ts';
19
20
  import { useSelectionSetOptional } from './use-selection-set.tsx';
20
21
 
21
22
  /** The chrome marker the selection / annotation handlers skip (input-router, artboard-marquee, annotations-layer). */
@@ -171,11 +172,11 @@ export function VideoPlayLayer({ inShell }: { inShell?: boolean } = {}): ReactEl
171
172
  b.style.top = `${at.top}px`;
172
173
  }
173
174
  }
174
- raf = requestAnimationFrame(tick);
175
+ raf = frameRaf(tick);
175
176
  };
176
- raf = requestAnimationFrame(tick);
177
+ raf = frameRaf(tick);
177
178
  return () => {
178
- if (raf != null) cancelAnimationFrame(raf);
179
+ if (raf != null) frameCaf(raf);
179
180
  };
180
181
  }, [targetKey]);
181
182
 
@@ -1,6 +1,33 @@
1
1
  {
2
2
  "$schema": "./whats-new.schema.json",
3
3
  "entries": [
4
+ {
5
+ "id": "canvas-pages-view",
6
+ "version": "2.0.7",
7
+ "date": "2026-11-06",
8
+ "kind": "feature",
9
+ "title": "See a canvas one artboard at a time",
10
+ "summary": "Switch the bar at the top of a canvas from Canvas to Pages: one artboard fills the window, and the arrows on the bar, PageDown and PageUp (or → and ← with nothing selected) go through them in the Present order. The canvas remembers it on this Mac. Preview and Present come back when you switch to Canvas.",
11
+ "surface": "design-ui"
12
+ },
13
+ {
14
+ "id": "opening-artboard-skeletons",
15
+ "version": "2.0.7",
16
+ "date": "2026-11-06",
17
+ "kind": "improvement",
18
+ "title": "Big canvases show their artboards at once",
19
+ "summary": "When you open a canvas, every artboard shows right away as an outline with its name, in its place and at its size. The canvas replaces them once it is drawn, so a big canvas no longer opens on an empty screen. Exports never show the outlines.",
20
+ "surface": "design-ui"
21
+ },
22
+ {
23
+ "id": "design-system-artboard-list",
24
+ "version": "2.0.7",
25
+ "date": "2026-11-06",
26
+ "kind": "improvement",
27
+ "title": "Your design system's artboards in Canvases",
28
+ "summary": "A design system row in the Canvases panel now opens into its artboards, in order, like any canvas. Click one to go straight to it.",
29
+ "surface": "design-ui"
30
+ },
4
31
  {
5
32
  "id": "heavy-canvases-stay-up",
6
33
  "version": "2.0.5",
@@ -596,14 +596,17 @@ Dev-tooling (dispatch to the dev-server bash helpers — DDR-062):
596
596
  includeBleed=true|false. ZIP filters are lists: include=system,assets
597
597
  (system canvases assets meta) and exclude=<glob>,<glob>.
598
598
 
599
- link <url> --token <hex> [--adopt] [--force]
599
+ link <url> --token <hex> [--adopt] [--force] [--allow-code]
600
600
  Pair this clone with a Maude hub. Writes .design/config.json's
601
601
  linkedHub field (committed) plus the per-machine token to
602
602
  ~/.config/maude/hubs.json (NEVER committed). --adopt signals to the
603
603
  sync agent (Phase 9 Task 4) to push local state up unconditionally on
604
604
  first connect — use it when bootstrapping a hub from a populated repo.
605
605
  --force skips the /health reachability probe (e.g. behind a firewall
606
- + trusted URL).
606
+ + trusted URL). --allow-code lets the hub deliver shared code
607
+ (.ts/.js) to this machine; without it a terminal asks, and --yes or
608
+ no terminal answers no (change it in Maude: Sync details › Allow
609
+ shared code…).
607
610
 
608
611
  adopt <url> --token <hex>
609
612
  Alias of 'link --adopt'. Shipped as a discoverable subcommand so
@@ -17,6 +17,7 @@ import {
17
17
  import { resolve } from 'node:path';
18
18
 
19
19
  import { parseArgs } from '../lib/argv.mjs';
20
+ import { PURGE_USAGE } from '../lib/hub-purge.mjs';
20
21
 
21
22
  const SUBCOMMANDS = new Set([
22
23
  'serve',
@@ -28,6 +29,7 @@ const SUBCOMMANDS = new Set([
28
29
  'asset-check',
29
30
  'backup-owners',
30
31
  'workspace-up',
32
+ 'purge',
31
33
  'help',
32
34
  ]);
33
35
 
@@ -52,6 +54,12 @@ export async function run({ args, pkgRoot }) {
52
54
  if (sub === 'restore-drill') return runRestoreDrill({ args, pkgRoot });
53
55
  if (sub === 'asset-check') return runAssetCheck({ args, pkgRoot });
54
56
  if (sub === 'backup-owners') return runBackupOwners({ args, pkgRoot });
57
+ if (sub === 'purge') {
58
+ const { runPurge } = await import('../lib/hub-purge.mjs');
59
+ const code = await runPurge({ args: args.slice(args.indexOf('purge') + 1) });
60
+ if (code !== 0) process.exit(code);
61
+ return;
62
+ }
55
63
  if (sub === 'workspace-up') {
56
64
  const mod = await import('./hub-workspace.mjs');
57
65
  return mod.run({ args, pkgRoot });
@@ -59,7 +67,7 @@ export async function run({ args, pkgRoot }) {
59
67
  }
60
68
 
61
69
  function usage() {
62
- return `maude hub <serve|token|status|deploy|backup|restore-drill|asset-check|backup-owners|workspace-up> [options]
70
+ return `maude hub <serve|token|status|deploy|backup|restore-drill|asset-check|backup-owners|workspace-up|purge> [options]
63
71
 
64
72
  serve [--port N] [--data PATH] [--secret HEX] [--insecure-http] [--dev]
65
73
  Start the self-hostable Yjs sync hub in the current process tree.
@@ -130,6 +138,7 @@ function usage() {
130
138
  must be OFF for it, because a canvas in git history can reference an
131
139
  asset no current canvas does. Exits non-zero when anything dangles.
132
140
 
141
+ ${PURGE_USAGE}
133
142
  workspace-up [--domain HOST] [--admin-email EMAIL] [--s3-* ...] [--dry-run]
134
143
  Stand up a self-hosted WORKSPACE — a hub that owns the project, commits
135
144
  autosaves, and stores media in object storage — and verify it works
@@ -603,6 +603,20 @@ const HUMAN_ONLY_ROUTES = [
603
603
  what: 'Connect to the hub',
604
604
  why: "it sends this Mac's hub credential to the folder's hub",
605
605
  },
606
+ // fix/207 — the person's yes (or no) to shared code from the project's hub; the studio answers a
607
+ // POST without the window's own fetch 403 window-only (routes/sync.ts).
608
+ {
609
+ re: /\/_api\/sync\/code-consent\/set(?![\w-])/i,
610
+ what: 'Allow shared code',
611
+ why: 'it lets code from the project run on this Mac, outside the canvas sandbox',
612
+ },
613
+ // 2.0.7 #7b — the answer to a batch of local deletes held by the delete breaker; Delete removes the
614
+ // files on the hub for every teammate (routes/sync.ts answers it 403 window-only too).
615
+ {
616
+ re: /\/_api\/sync\/held-deletes(?![\w-])/i,
617
+ what: 'Delete on the hub too',
618
+ why: 'it deletes a batch of files on the project’s hub, for every teammate',
619
+ },
606
620
  // V2-8.9 round 2 R2-M2 — the desktop's share writes run with this Mac's hub credential; the studio
607
621
  // answers them 403 window-only without the window's own fetch (routes/share.ts).
608
622
  {
@@ -1,6 +1,6 @@
1
1
  // GENERATED by scripts/gen-actions.mjs from apps/studio/actions/verbs.ts — DO NOT EDIT BY HAND.
2
2
  // What `maude design help` prints under the static usage (contract V2-1.11 §5.7 rule 6).
3
- // manifest 3b10dc94b530
3
+ // manifest fb02f78da791
4
4
 
5
5
  export const DESIGN_VERB_TIERS_HELP =
6
6
  "Verbs by permission tier (generated from actions.manifest.json, contract V2-1.11 §5.3):\n auto No prompt in the Maude chat (effect none/project):\n prep · bootstrap-check · slug · server-up · runtime-health · screenshot · smoke\n visual-sanity · perf · canvas-rects · canvas-errors · canvas-source\n read-annotations · svg-optimize · asset-sweep · draw-proof · probe-footage\n smart-frames · agent-browser-safe · chat-open · serve · status · index · assets\n help · check · place · layout-check · open · history list · history show\n history diff · history object · trash list · comments list · exports list\n exports again · runs list · runs stop · logs · sync status · annotate · canvas-edit\n handoff · import-asset · import-tokens · ingest-footage · photo-adjust\n transcribe-local · beats · captions list · captions add · captions export · captions\n cut-words · cut-to-beat · reel-place · ds-check · ds-upgrade analyse\n ds-upgrade plan · ds-upgrade validate · ds-upgrade status · ds-upgrade stage\n ds-upgrade prove · ds-upgrade discard · ds-upgrade cancel · trash move\n trash restore · ds status · ds usage · ds check-system · ds revisions\n prompt Shows the permission card:\n hook · export · curl-local · draw-build · to-lottie · generate · audio-search\n fetch-asset · ensure-browser · transcribe · import-figma · import-brand\n photo-bg-remove · describe · init · ds-upgrade · bulk-deletes · history restore\n trash · history undo · history name · exports · sync resync · sync · runs · ds\n comments reply · comments resolve · comments reopen · comments add · comments\n history\n human For people in a terminal. Never in the AI allow list:\n trash clear · link · adopt · unlink · detach\n Every studio capability's file or verb: the design plugin's studio-actions skill.\n";
@@ -47,7 +47,7 @@ export async function runLink({ args, cwd = process.cwd(), forceAdopt = false })
47
47
  }
48
48
  const tail = args.slice(args.indexOf(forceAdopt ? 'adopt' : 'link') + 1);
49
49
  const { flags, positional } = parseArgs(tail, {
50
- booleans: ['adopt', 'force', 'yes', 'sync-tsx', 'no-sync-tsx'],
50
+ booleans: ['adopt', 'force', 'yes', 'sync-tsx', 'no-sync-tsx', 'allow-code'],
51
51
  });
52
52
  const url = positional[0];
53
53
  const token = flags.token;
@@ -196,7 +196,11 @@ export async function runLink({ args, cwd = process.cwd(), forceAdopt = false })
196
196
  // transport at all in hub-owned mode: an owner could push one through the
197
197
  // door and no peer would ever accept it. Closed harder than intended is
198
198
  // still closed wrong.
199
- await askCodeModuleConsent(normUrl, { assumeYes: !!flags.yes, loopback });
199
+ await askCodeModuleConsent(normUrl, {
200
+ assumeYes: !!flags.yes,
201
+ loopback,
202
+ allowCode: !!flags['allow-code'],
203
+ });
200
204
 
201
205
  // DDR-228 — a link must land in ONE of the two ownership modes.
202
206
  //
@@ -254,36 +258,57 @@ export async function runUnlink({ args, cwd = process.cwd() }) {
254
258
  }
255
259
 
256
260
  /**
257
- * Ask, once per hub, whether it may deliver executable modules.
261
+ * Ask whether this hub may deliver executable modules.
258
262
  *
259
263
  * `.ts`/`.mjs` outside a canvas body are read by the AGENT and by every
260
264
  * `maude design *` helper — a different blast radius from a `.tsx` rendering
261
265
  * in the sandboxed canvas origin. Default NO on every non-answer (non-TTY,
262
266
  * declined, anything unparsed): the pessimistic branch, same as every other
263
267
  * default in this lane.
268
+ *
269
+ * fix/207 — a recorded NO no longer ends the question: an interactive re-link
270
+ * asks again (a recorded yes is kept without asking). Without a terminal, or
271
+ * with `--yes`, the answer stays no unless `--allow-code` says yes explicitly
272
+ * (and a recorded answer is kept). The same answer can be given in the app:
273
+ * Sync details › Allow shared code… (`POST /_api/sync/code-consent/set`).
264
274
  */
265
- async function askCodeModuleConsent(normUrl, { assumeYes = false, loopback = false } = {}) {
275
+ export async function askCodeModuleConsent(
276
+ normUrl,
277
+ {
278
+ assumeYes = false,
279
+ loopback = false,
280
+ allowCode = false,
281
+ interactive = process.stdin.isTTY === true,
282
+ prompt = promptYesNo,
283
+ write = (s) => process.stdout.write(s),
284
+ } = {}
285
+ ) {
266
286
  // A loopback pairing is this machine talking to itself; there is no remote
267
287
  // party to consent about.
268
288
  if (loopback) return;
269
- const existing = getHub(normUrl);
270
- if (existing && typeof existing.codeModulesAllowed === 'boolean') return;
271
-
272
- let allow = false;
273
- if (assumeYes) {
274
- allow = false; // --yes accepts DEFAULTS, and this default is no.
275
- } else if (process.stdin.isTTY) {
276
- process.stdout.write(
289
+ const recorded = getHub(normUrl)?.codeModulesAllowed;
290
+
291
+ let allow;
292
+ if (allowCode) {
293
+ allow = true; // the person typed --allow-code: an explicit yes
294
+ } else if (recorded === true) {
295
+ return; // a yes given before stays; Stop allowing… in the app takes it back
296
+ } else if (assumeYes || !interactive) {
297
+ // --yes accepts DEFAULTS, and this default is no. A recorded no stays no.
298
+ if (recorded === false) return;
299
+ allow = false;
300
+ } else {
301
+ write(
277
302
  '\n Shared code (.ts / .mjs outside a canvas) is read by Claude and by the\n' +
278
303
  ' maude helpers on this machine, not just rendered in a preview.\n'
279
304
  );
280
- allow = await promptYesNo(` Let ${normUrl} deliver those to this machine? [y/N] `, false);
305
+ allow = await prompt(` Let ${normUrl} deliver those to this machine? [y/N] `, false);
281
306
  }
282
- setHubCodeModules(normUrl, allow);
283
- process.stdout.write(
284
- allow
307
+ setHubCodeModules(normUrl, allow === true);
308
+ write(
309
+ allow === true
285
310
  ? '[design link] this hub may deliver shared code modules to this machine.\n'
286
- : `[design link] shared code modules from ${normUrl} will NOT be written here (design files still sync). Re-link and answer yes to change it.\n`
311
+ : `[design link] shared code modules from ${normUrl} will NOT be written here (design files still sync). To allow them, open Sync details in Maude and choose Allow shared code…, or re-link with --allow-code.\n`
287
312
  );
288
313
  }
289
314
 
@@ -0,0 +1,183 @@
1
+ // `maude hub purge` — the operator's front for the hub's confirmed bulk purge
2
+ // (`POST /api/file-purge`, apps/hub/src/owner-purge.mjs). 2.0.7 #8.
3
+ //
4
+ // maude hub purge <URL> --prefix assets/unused/ # dry run: lists the set
5
+ // maude hub purge <URL> --prefix assets/unused/ --confirm <token>
6
+ //
7
+ // Human tier (`maude hub` is terminal-only in the verb registry, never the AI
8
+ // chat's). The owner credential comes from the environment ($MAUDE_HUB_TOKEN,
9
+ // or the variable --token-env names), never from argv where `ps` shows it, and
10
+ // it is only sent over https or to a loopback host.
11
+
12
+ import { readFileSync } from 'node:fs';
13
+
14
+ import { parseArgs } from './argv.mjs';
15
+
16
+ const PURGE_PATH = '/api/file-purge';
17
+ const MAX_WAIT_MS = 60_000;
18
+ const MAX_RETRIES = 5;
19
+
20
+ export const PURGE_USAGE = ` purge <URL> (--prefix PATH/ | --list FILE) [--confirm TOKEN] [--token-env NAME] [--json]
21
+ Delete many project files on a hub at once — the project OWNER's path
22
+ past the per-hour delete limit. Without --confirm it is a dry run: it
23
+ lists the exact set (count, bytes, sample paths) and prints a
24
+ confirmation. Run it again with --confirm <that token> to delete that
25
+ exact set; if any file changed in between, nothing is deleted and you
26
+ run the dry run again. Files go to the hub's _trash/ (restorable) and
27
+ are deleted in paced batches. The owner token is read from
28
+ $MAUDE_HUB_TOKEN (or --token-env NAME); https only, except localhost.
29
+ --list FILE one path per line (or a JSON array), design-root relative.
30
+ `;
31
+
32
+ const LOOPBACK = new Set(['localhost', '127.0.0.1', '[::1]', '::1']);
33
+
34
+ /**
35
+ * @param {{ args: string[], env?: object, fetchImpl?: typeof fetch,
36
+ * out?: (s: string) => void, err?: (s: string) => void,
37
+ * sleep?: (ms: number) => Promise<void> }} io
38
+ * @returns {Promise<number>} the exit code
39
+ */
40
+ export async function runPurge({
41
+ args,
42
+ env = process.env,
43
+ fetchImpl = fetch,
44
+ out = (s) => process.stdout.write(s),
45
+ err = (s) => process.stderr.write(s),
46
+ sleep = (ms) => new Promise((r) => setTimeout(r, ms)),
47
+ }) {
48
+ const { flags, positional } = parseArgs(args, { booleans: ['json', 'dry-run'] });
49
+ const fail = (code, msg) => {
50
+ err(`maude hub purge: ${msg}\n`);
51
+ return code;
52
+ };
53
+ const base = positional[0];
54
+ if (!base) return fail(2, 'name the hub URL (maude hub purge <URL> --prefix …)');
55
+ let url;
56
+ try {
57
+ url = new URL(PURGE_PATH, base.endsWith('/') ? base : `${base}/`);
58
+ } catch {
59
+ return fail(2, `not a URL: ${base}`);
60
+ }
61
+ if (url.protocol !== 'https:' && !(url.protocol === 'http:' && LOOPBACK.has(url.hostname))) {
62
+ return fail(2, 'refusing to send an owner token over plain http to a non-local host');
63
+ }
64
+ const tokenVar = typeof flags['token-env'] === 'string' ? flags['token-env'] : 'MAUDE_HUB_TOKEN';
65
+ const token = String(env[tokenVar] ?? '').trim();
66
+ if (!token) return fail(2, `set $${tokenVar} to the hub's owner token`);
67
+
68
+ let spec;
69
+ if (typeof flags.prefix === 'string' && flags.list === undefined) {
70
+ spec = { prefix: flags.prefix };
71
+ } else if (typeof flags.list === 'string' && flags.prefix === undefined) {
72
+ let text;
73
+ try {
74
+ text = readFileSync(flags.list, 'utf8');
75
+ } catch (e) {
76
+ return fail(2, `cannot read --list ${flags.list}: ${e.message}`);
77
+ }
78
+ spec = { paths: parseList(text) };
79
+ if (spec.paths.length === 0) return fail(2, `--list ${flags.list} names no paths`);
80
+ } else {
81
+ return fail(2, 'name exactly one of --prefix PATH/ or --list FILE');
82
+ }
83
+
84
+ const post = async (body) => {
85
+ const res = await fetchImpl(url, {
86
+ method: 'POST',
87
+ headers: {
88
+ authorization: `Bearer ${token}`,
89
+ 'content-type': 'application/json',
90
+ 'x-maude-format': '2',
91
+ },
92
+ body: JSON.stringify(body),
93
+ });
94
+ let json = null;
95
+ try {
96
+ json = await res.json();
97
+ } catch {
98
+ json = null;
99
+ }
100
+ return { status: res.status, json };
101
+ };
102
+
103
+ const confirm = typeof flags.confirm === 'string' ? flags.confirm : null;
104
+ if (!confirm) {
105
+ const r = await post({ ...spec, dryRun: true });
106
+ if (r.status !== 200) return fail(1, refusal(r));
107
+ if (flags.json) {
108
+ out(`${JSON.stringify(r.json)}\n`);
109
+ return 0;
110
+ }
111
+ const j = r.json;
112
+ out(`Dry run — nothing was deleted.\n`);
113
+ out(` ${j.count} file(s), ${formatBytes(j.bytes)}\n`);
114
+ for (const p of j.sample ?? []) out(` ${p}\n`);
115
+ if (j.count > (j.sample?.length ?? 0)) out(` … and ${j.count - j.sample.length} more\n`);
116
+ if (j.missing) out(` ${j.missing} named path(s) are not on the hub and are left out.\n`);
117
+ if (!j.confirm) {
118
+ out('Nothing to delete.\n');
119
+ return 0;
120
+ }
121
+ const what = spec.prefix !== undefined ? `--prefix ${spec.prefix}` : `--list ${flags.list}`;
122
+ out(
123
+ `\nTo delete exactly these files (good until ${new Date(j.expiresAt).toISOString()}):\n` +
124
+ ` maude hub purge ${base} ${what} --confirm ${j.confirm}\n`
125
+ );
126
+ return 0;
127
+ }
128
+
129
+ let purged = 0;
130
+ let retries = 0;
131
+ for (;;) {
132
+ const r = await post({ ...spec, confirm });
133
+ if (r.status === 200) {
134
+ retries = 0;
135
+ purged += r.json?.purged ?? 0;
136
+ if (flags.json) out(`${JSON.stringify(r.json)}\n`);
137
+ else out(` deleted ${purged}, ${r.json?.remaining ?? '?'} to go\n`);
138
+ if (r.json?.done) {
139
+ if (!flags.json) out(`Done. The files are in the hub's ${r.json.trash}/ (restorable).\n`);
140
+ return 0;
141
+ }
142
+ await sleep(waitFor(r));
143
+ continue;
144
+ }
145
+ if ((r.status === 429 || r.status === 503) && retries < MAX_RETRIES) {
146
+ retries += 1;
147
+ await sleep(waitFor(r));
148
+ continue;
149
+ }
150
+ return fail(1, `${refusal(r)}${purged ? ` (${purged} deleted before this)` : ''}`);
151
+ }
152
+ }
153
+
154
+ function waitFor(r) {
155
+ const ms = Number(r.json?.retryAfterMs);
156
+ return Number.isFinite(ms) && ms > 0 ? Math.min(ms, MAX_WAIT_MS) : 1000;
157
+ }
158
+
159
+ function refusal(r) {
160
+ const msg = r.json?.error ?? r.json?.code ?? 'no answer';
161
+ return `the hub refused (${r.status}): ${msg}`;
162
+ }
163
+
164
+ /** One path per line (`#` comments, blanks skipped), or a JSON array of paths. */
165
+ export function parseList(text) {
166
+ const trimmed = text.trim();
167
+ if (trimmed.startsWith('[')) {
168
+ const arr = JSON.parse(trimmed);
169
+ return Array.isArray(arr) ? arr.filter((p) => typeof p === 'string' && p.length > 0) : [];
170
+ }
171
+ return trimmed
172
+ .split('\n')
173
+ .map((l) => l.trim())
174
+ .filter((l) => l.length > 0 && !l.startsWith('#'));
175
+ }
176
+
177
+ function formatBytes(n) {
178
+ if (!Number.isFinite(n)) return '? bytes';
179
+ if (n < 1024) return `${n} bytes`;
180
+ if (n < 1024 ** 2) return `${(n / 1024).toFixed(1)} KB`;
181
+ if (n < 1024 ** 3) return `${(n / 1024 ** 2).toFixed(1)} MB`;
182
+ return `${(n / 1024 ** 3).toFixed(2)} GB`;
183
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1agh/maude",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
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": {
@@ -65,13 +65,13 @@
65
65
  "test:e2e:desktop:parity:cloud": "pnpm --filter @maude/desktop-e2e e2e:parity:cloud"
66
66
  },
67
67
  "optionalDependencies": {
68
- "@1agh/maude-darwin-arm64": "2.0.6",
69
- "@1agh/maude-darwin-x64": "2.0.6",
70
- "@1agh/maude-linux-arm64": "2.0.6",
71
- "@1agh/maude-linux-arm64-musl": "2.0.6",
72
- "@1agh/maude-linux-x64": "2.0.6",
73
- "@1agh/maude-linux-x64-musl": "2.0.6",
74
- "@1agh/maude-win32-x64": "2.0.6"
68
+ "@1agh/maude-darwin-arm64": "2.0.8",
69
+ "@1agh/maude-darwin-x64": "2.0.8",
70
+ "@1agh/maude-linux-arm64": "2.0.8",
71
+ "@1agh/maude-linux-arm64-musl": "2.0.8",
72
+ "@1agh/maude-linux-x64": "2.0.8",
73
+ "@1agh/maude-linux-x64-musl": "2.0.8",
74
+ "@1agh/maude-win32-x64": "2.0.8"
75
75
  },
76
76
  "files": [
77
77
  "cli",