@1agh/maude 2.0.4 → 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.
- package/apps/hub/src/project-transactions/kernel.mjs +10 -1
- package/apps/studio/access/closure.ts +156 -16
- package/apps/studio/access/filters.ts +39 -5
- package/apps/studio/access/known-canvases.ts +24 -1
- package/apps/studio/access/refused-inputs.ts +89 -0
- package/apps/studio/actions/agents.ts +59 -0
- package/apps/studio/actions/ctx.ts +3 -0
- package/apps/studio/actions/defs/app.ts +12 -0
- package/apps/studio/actions/defs/sync.ts +13 -0
- package/apps/studio/actions/defs/view.ts +59 -3
- package/apps/studio/actions/keymap.gen.ts +35 -0
- package/apps/studio/actions/menu.ts +2 -0
- package/apps/studio/actions/types.ts +3 -1
- package/apps/studio/actions.manifest.json +148 -1
- package/apps/studio/actions.parity.json +31 -1
- package/apps/studio/annotations/ui/ai-seen.tsx +4 -3
- package/apps/studio/annotations/ui/element-node.tsx +139 -54
- package/apps/studio/annotations/ui/lod.tsx +1 -1
- package/apps/studio/annotations/ui/ride.ts +2 -1
- package/apps/studio/annotations/ui/text-style.ts +1 -1
- package/apps/studio/annotations-context-toolbar.tsx +5 -4
- package/apps/studio/annotations-layer.tsx +4 -15
- package/apps/studio/api.ts +425 -128
- package/apps/studio/artboard-activity-overlay.tsx +4 -4
- package/apps/studio/artboard-ai-copies.tsx +4 -4
- package/apps/studio/artboard-freeze.ts +108 -0
- package/apps/studio/artboard-live-gate.tsx +636 -0
- package/apps/studio/artboard-live.ts +831 -0
- package/apps/studio/artboard-placeholder.ts +197 -0
- package/apps/studio/artboard-still-raster.ts +485 -0
- package/apps/studio/artboard-still-warmup.ts +221 -0
- package/apps/studio/artboard-still.ts +1188 -0
- package/apps/studio/artboard-webgl.ts +669 -0
- package/apps/studio/asset-placeholder.tsx +237 -132
- package/apps/studio/asset-upload-bars.tsx +4 -4
- package/apps/studio/bin/_agent-browser-bin.mjs +8 -0
- package/apps/studio/bin/_agent-browser-safe.mjs +2 -1
- package/apps/studio/bin/_canvas-reasons.mjs +34 -0
- package/apps/studio/bin/_ds-check-live.mjs +37 -0
- package/apps/studio/bin/_ds-check.mjs +4 -1
- package/apps/studio/bin/_ds-prove-judge.mjs +167 -0
- package/apps/studio/bin/_ds-prove-playwright.mjs +183 -105
- package/apps/studio/bin/_import-asset.mjs +2 -1
- package/apps/studio/bin/_perf-probe-open.mjs +364 -0
- package/apps/studio/bin/_perf-probe.mjs +2 -1
- package/apps/studio/bin/_perf-shared.mjs +12 -7
- package/apps/studio/bin/_pw-launch.mjs +26 -1
- package/apps/studio/bin/_studio-verb.mjs +24 -3
- package/apps/studio/bin/_thumb-blank.mjs +70 -0
- package/apps/studio/bin/_thumb-cover.mjs +35 -0
- package/apps/studio/bin/_thumbs-playwright.mjs +89 -12
- package/apps/studio/bin/ds-check.sh +5 -1
- package/apps/studio/bin/perf.sh +30 -1
- package/apps/studio/bin/server-up.sh +7 -2
- package/apps/studio/bin/smoke.sh +19 -0
- package/apps/studio/bridge/dgn-protocol.ts +35 -0
- package/apps/studio/canvas-build-sandbox.ts +69 -13
- package/apps/studio/canvas-camera.ts +90 -0
- package/apps/studio/canvas-comment-mount.tsx +9 -9
- package/apps/studio/canvas-lib.tsx +289 -44
- package/apps/studio/canvas-pages-view.tsx +465 -0
- package/apps/studio/canvas-pages.ts +305 -0
- package/apps/studio/canvas-rows.ts +62 -0
- package/apps/studio/canvas-shell.tsx +62 -16
- package/apps/studio/canvas-theme-icons.tsx +41 -0
- package/apps/studio/canvas-theme-pill.tsx +15 -6
- package/apps/studio/canvas-theme.ts +12 -11
- package/apps/studio/client/app.jsx +7 -0
- package/apps/studio/client/canvas-url.js +36 -1
- package/apps/studio/client/home/HomeAccounts.jsx +262 -0
- package/apps/studio/client/home/Shelves.jsx +4 -3
- package/apps/studio/client/home/home-accounts-model.js +121 -0
- package/apps/studio/client/home/home-api.js +6 -0
- package/apps/studio/client/home/home-app.jsx +141 -40
- package/apps/studio/client/home/home-model.js +172 -6
- package/apps/studio/client/home/home.css +169 -5
- package/apps/studio/client/home/shell-mode.js +8 -1
- package/apps/studio/client/hooks/canvas-origin-probe.js +34 -0
- package/apps/studio/client/hooks/use-action-keys.jsx +3 -1
- package/apps/studio/client/hooks/use-canvas-bridge.jsx +1 -1
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +23 -6
- package/apps/studio/client/hooks/use-photo-and-timeline.jsx +16 -8
- package/apps/studio/client/hooks/use-project-data.jsx +13 -2
- package/apps/studio/client/hooks/use-shell-core.jsx +19 -9
- package/apps/studio/client/index-loader.ts +41 -21
- package/apps/studio/client/inspector/inspector-panel.jsx +35 -14
- package/apps/studio/client/panels/ChatPanel.jsx +27 -20
- package/apps/studio/client/panels/CreateProject.jsx +19 -5
- package/apps/studio/client/panels/caps-cache.js +46 -0
- package/apps/studio/client/shell/viewport.jsx +66 -22
- package/apps/studio/client/tree/tree.jsx +17 -0
- package/apps/studio/client/v2/access/access-client.js +2 -0
- package/apps/studio/client/v2/access/access-host.jsx +12 -1
- package/apps/studio/client/v2/access/trashed-banner.jsx +6 -3
- package/apps/studio/client/v2/ai/Advanced.jsx +12 -0
- package/apps/studio/client/v2/ai/Composer.jsx +27 -10
- package/apps/studio/client/v2/canvases/canvases-panel.jsx +24 -0
- package/apps/studio/client/v2/canvases/use-canvas-index.js +24 -1
- package/apps/studio/client/v2/code/canvas-error-card.jsx +14 -2
- package/apps/studio/client/v2/code/canvas-imports-card.jsx +19 -14
- package/apps/studio/client/v2/code/canvas-imports-words.js +60 -0
- package/apps/studio/client/v2/code/canvas-waiting-card.jsx +59 -5
- package/apps/studio/client/v2/code/canvas-waiting.js +18 -1
- package/apps/studio/client/v2/code/code-bus.js +5 -0
- package/apps/studio/client/v2/code/code-consent-sheet.jsx +87 -0
- package/apps/studio/client/v2/code/code-consent.js +67 -0
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +62 -10
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +314 -5
- package/apps/studio/client/v2/ds/advanced-host.jsx +11 -26
- package/apps/studio/client/v2/ds/ds-refresh.js +161 -0
- package/apps/studio/client/v2/ds/library-host.jsx +45 -45
- package/apps/studio/client/v2/ds/make-host.jsx +13 -15
- package/apps/studio/client/v2/ds/off-system-host.jsx +18 -19
- package/apps/studio/client/v2/ds/review-host.jsx +7 -1
- package/apps/studio/client/v2/ds/truth-host.jsx +15 -17
- package/apps/studio/client/v2/ds/upgrade-host.jsx +26 -10
- package/apps/studio/client/v2/history/branch-actions.js +13 -9
- package/apps/studio/client/v2/history/git-advanced.jsx +8 -1
- package/apps/studio/client/v2/history/git-model.js +3 -1
- package/apps/studio/client/v2/history/git-parts.jsx +16 -1
- package/apps/studio/client/v2/layers/artboard-layers.jsx +24 -5
- package/apps/studio/client/v2/layers/layers-request.js +49 -0
- package/apps/studio/client/v2/left-panel/canvases-pinned.jsx +93 -3
- package/apps/studio/client/v2/left-panel/ds-boards.js +39 -0
- package/apps/studio/client/v2/left-panel/left-panel-model.js +13 -0
- package/apps/studio/client/v2/left-panel/left-panel.css +24 -0
- package/apps/studio/client/v2/presence/faces.jsx +42 -14
- package/apps/studio/client/v2/shell/account-card.jsx +10 -4
- package/apps/studio/client/v2/shell/canvas-crash-guard.js +172 -0
- package/apps/studio/client/v2/shell/canvas-mode.js +17 -1
- package/apps/studio/client/v2/shell/floating-panels.css +37 -1
- package/apps/studio/client/v2/shell/github-signin-host.jsx +42 -0
- package/apps/studio/client/v2/shell/menu-runner.js +11 -0
- package/apps/studio/client/v2/shell/mode-switch.jsx +14 -3
- package/apps/studio/client/v2/shell/opening-skeleton.js +118 -0
- package/apps/studio/client/v2/shell/opening-skeleton.jsx +103 -0
- package/apps/studio/client/v2/shell/pages-pick.js +49 -0
- package/apps/studio/client/v2/shell/project-account-card.jsx +203 -0
- package/apps/studio/client/v2/shell/project-account-model.js +182 -0
- package/apps/studio/client/v2/shell/project-menu-model.js +3 -0
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +140 -11
- package/apps/studio/client/v2/shell/share-cluster.css +58 -0
- package/apps/studio/client/v2/shell/share-cluster.jsx +26 -7
- package/apps/studio/client/v2/shell/shell-parity.json +8 -0
- package/apps/studio/client/v2/shell/team-switch.js +94 -0
- package/apps/studio/client/v2/shell/too-heavy-card.jsx +38 -0
- package/apps/studio/client/v2/shell/use-account.js +8 -1
- package/apps/studio/client/v2/shell/use-canvas-mode-lane.js +30 -0
- package/apps/studio/collab/persistence.ts +9 -1
- package/apps/studio/collab/registry.ts +32 -0
- package/apps/studio/collab/room.ts +8 -0
- package/apps/studio/comments-overlay.tsx +12 -11
- package/apps/studio/config-reload-wire.ts +56 -0
- package/apps/studio/config.schema.json +6 -0
- package/apps/studio/context.ts +37 -1
- package/apps/studio/dist/client.bundle.js +1198 -1198
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/ds/board/board.css +6 -0
- package/apps/studio/ds/board/ds-bar.tsx +21 -3
- package/apps/studio/ds/board/specimen.tsx +16 -2
- package/apps/studio/ds/board/template.ts +39 -19
- package/apps/studio/ds/canvas-cli.ts +58 -2
- package/apps/studio/ds/check.ts +26 -1
- package/apps/studio/ds/cli.ts +14 -4
- package/apps/studio/ds/component-list.ts +2 -1
- package/apps/studio/ds/convert.ts +34 -6
- package/apps/studio/ds/default.ts +6 -1
- package/apps/studio/ds/ds-resolver.ts +58 -8
- package/apps/studio/ds/ds-verb.ts +13 -0
- package/apps/studio/ds/engine.ts +3 -1
- package/apps/studio/ds/folder-systems.ts +199 -0
- package/apps/studio/ds/pairing-css.ts +2 -1
- package/apps/studio/ds/post-build.ts +38 -0
- package/apps/studio/ds/rename.ts +10 -3
- package/apps/studio/ds/shell-fallbacks.ts +2 -1
- package/apps/studio/ds/upgrade-apply.ts +27 -5
- package/apps/studio/ds/upgrade-cli.ts +22 -2
- package/apps/studio/ds/upgrade-prove.ts +198 -15
- package/apps/studio/ds/upgrade-stage.ts +10 -3
- package/apps/studio/editing/ai-point-ring.tsx +4 -4
- package/apps/studio/editing/ai-scope-outline.tsx +4 -4
- package/apps/studio/editing/align-bar.tsx +4 -4
- package/apps/studio/editing/anchor-report.ts +3 -2
- package/apps/studio/editing/artboard-handles.tsx +4 -4
- package/apps/studio/editing/corner-dots.tsx +4 -4
- package/apps/studio/editing/crop-mode.tsx +4 -4
- package/apps/studio/editing/drop-chip.tsx +4 -4
- package/apps/studio/editing/empty-report.ts +3 -2
- package/apps/studio/editing/focus-model.tsx +4 -4
- package/apps/studio/editing/gap-bands.tsx +3 -3
- package/apps/studio/editing/hold-rings.tsx +4 -4
- package/apps/studio/editing/lock-badge.tsx +3 -3
- package/apps/studio/editing/long-page.ts +23 -1
- package/apps/studio/editing/nudge.tsx +2 -2
- package/apps/studio/editing/page-activity.ts +4 -3
- package/apps/studio/editing/paste-bar.tsx +4 -4
- package/apps/studio/editing/pen/overlay.tsx +4 -3
- package/apps/studio/editing/place-freely.tsx +3 -3
- package/apps/studio/editing/reorder-slot.tsx +3 -3
- package/apps/studio/editing/selection.tsx +4 -4
- package/apps/studio/editing/size-ghost.tsx +4 -4
- package/apps/studio/editing/tab-order.tsx +4 -4
- package/apps/studio/editing/text-in-place.tsx +4 -4
- package/apps/studio/editing/undo-preview.tsx +3 -3
- package/apps/studio/equal-spacing-handles.tsx +3 -3
- package/apps/studio/frame-clock.ts +89 -0
- package/apps/studio/history/trash.ts +6 -0
- package/apps/studio/home/accounts.ts +87 -0
- package/apps/studio/home/index-reader.ts +24 -2
- package/apps/studio/home/routes.ts +19 -0
- package/apps/studio/http.ts +80 -34
- package/apps/studio/index/ds-usage.ts +4 -1
- package/apps/studio/index-cache.ts +272 -0
- package/apps/studio/inspect-overlay.tsx +4 -3
- package/apps/studio/inspect.ts +7 -2
- package/apps/studio/link-chip-overlay.tsx +4 -3
- package/apps/studio/measure-overlay.tsx +4 -3
- package/apps/studio/present/pointer-dot.tsx +3 -2
- package/apps/studio/present/present-media.ts +6 -2
- package/apps/studio/present/present-stage.tsx +3 -2
- package/apps/studio/preview/preview-camera.tsx +3 -2
- package/apps/studio/routes/ds-convert.ts +18 -0
- package/apps/studio/routes/sync.ts +176 -0
- package/apps/studio/routes/trash.ts +16 -1
- package/apps/studio/safe-zones-overlay.tsx +3 -2
- package/apps/studio/server.ts +8 -10
- package/apps/studio/skip-dirs.ts +103 -47
- package/apps/studio/studio-page-host.ts +70 -0
- package/apps/studio/sync/accepted-cold-start.ts +28 -13
- package/apps/studio/sync/asset-push.ts +146 -23
- package/apps/studio/sync/asset-state.ts +3 -2
- package/apps/studio/sync/code-module-consent.ts +86 -0
- package/apps/studio/sync/file-ledger.ts +24 -0
- package/apps/studio/sync/file-membership.ts +28 -3
- package/apps/studio/sync/file-plane.ts +497 -61
- package/apps/studio/sync/file-pull.ts +304 -33
- package/apps/studio/sync/held-deletes.ts +230 -0
- package/apps/studio/sync/hub-link.ts +1 -2
- package/apps/studio/sync/hubs-config.ts +59 -2
- package/apps/studio/sync/index.ts +405 -163
- package/apps/studio/sync/journal-client.ts +94 -5
- package/apps/studio/sync/pending-deletes.ts +100 -0
- package/apps/studio/sync/projection.ts +77 -12
- package/apps/studio/sync/seed-progress.ts +104 -3
- package/apps/studio/sync/settings.ts +36 -1
- package/apps/studio/sync/status.ts +17 -1
- package/apps/studio/sync/writer-registry.ts +5 -0
- package/apps/studio/text-caret.ts +5 -3
- package/apps/studio/thumbs/service.ts +12 -2
- package/apps/studio/thumbs/validate.ts +7 -0
- package/apps/studio/toolbars/toolbar-rect.ts +3 -2
- package/apps/studio/ui-prefs-migrate.ts +4 -0
- package/apps/studio/use-annotation-resize.tsx +4 -3
- package/apps/studio/use-artboard-drag.tsx +3 -2
- package/apps/studio/use-element-resize.tsx +7 -6
- package/apps/studio/use-grid-track-handles.tsx +5 -4
- package/apps/studio/use-selection-set.tsx +64 -4
- package/apps/studio/use-spacing-handles.tsx +7 -6
- package/apps/studio/video-comp.tsx +75 -39
- package/apps/studio/video-play-overlay.tsx +4 -3
- package/apps/studio/whats-new.json +99 -0
- package/cli/commands/design.mjs +5 -2
- package/cli/commands/hub.mjs +10 -1
- package/cli/lib/bash-guard.mjs +27 -1
- package/cli/lib/design-help.gen.mjs +1 -1
- package/cli/lib/design-hook.mjs +20 -0
- package/cli/lib/design-link.mjs +42 -17
- package/cli/lib/hub-purge.mjs +183 -0
- package/cli/lib/studio-locate.mjs +35 -10
- package/package.json +8 -8
- package/plugins/design/templates/_shell.html +164 -1
|
@@ -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 =
|
|
175
|
+
raf = frameRaf(tick);
|
|
175
176
|
};
|
|
176
|
-
raf =
|
|
177
|
+
raf = frameRaf(tick);
|
|
177
178
|
return () => {
|
|
178
|
-
if (raf != null)
|
|
179
|
+
if (raf != null) frameCaf(raf);
|
|
179
180
|
};
|
|
180
181
|
}, [targetKey]);
|
|
181
182
|
|
|
@@ -1,6 +1,105 @@
|
|
|
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
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "heavy-canvases-stay-up",
|
|
33
|
+
"version": "2.0.5",
|
|
34
|
+
"date": "2026-11-05",
|
|
35
|
+
"kind": "fix",
|
|
36
|
+
"title": "Heavy canvases no longer crash the window",
|
|
37
|
+
"summary": "Only the artboards near where you look run live. Offscreen artboards, and every artboard when you zoom far out, pause their 3D scenes, videos and animations and keep their last picture, so a canvas with dozens of scenes pans smoothly. The design system canvas draws each page when you reach it. A canvas that still crashes twice opens with Show visible artboards only instead of crashing again. Exports still draw everything.",
|
|
38
|
+
"surface": "design-ui"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"id": "home-accounts",
|
|
42
|
+
"version": "2.0.5",
|
|
43
|
+
"date": "2026-11-05",
|
|
44
|
+
"kind": "feature",
|
|
45
|
+
"title": "All your accounts on Home",
|
|
46
|
+
"summary": "Click your face on Home to see every account on this Mac: Maude Cloud, your team servers and GitHub. Sign out of one, or add another. Each project now says how it is connected and as whom, and a project you have in two places shows once.",
|
|
47
|
+
"surface": "design-ui"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"id": "project-account-card",
|
|
51
|
+
"version": "2.0.5",
|
|
52
|
+
"date": "2026-11-05",
|
|
53
|
+
"kind": "feature",
|
|
54
|
+
"title": "See which account a project uses",
|
|
55
|
+
"summary": "Click your face at the top right to see how this project is signed in: a team server, Maude Cloud or GitHub, which account, and which profile on this Mac. Sign out or switch accounts from there, a team server too, and sign in with GitHub. Click the sync word, such as Syncing… or Offline, to open its details.",
|
|
56
|
+
"surface": "design-ui"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": "home-covers-and-shared-empty",
|
|
60
|
+
"version": "2.0.5",
|
|
61
|
+
"date": "2026-11-05",
|
|
62
|
+
"kind": "fix",
|
|
63
|
+
"title": "Better covers and a calmer empty Shared card on Home",
|
|
64
|
+
"summary": "A canvas whose first artboard is a thin header now gets a cover of its real content, whiteboards show their board, and blank pictures no longer stick as covers. The empty Shared with you card is a single quiet line instead of tilted placeholders.",
|
|
65
|
+
"surface": "design-ui"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"id": "board-zoom-stays-smooth",
|
|
69
|
+
"version": "2.0.5",
|
|
70
|
+
"date": "2026-11-05",
|
|
71
|
+
"kind": "fix",
|
|
72
|
+
"title": "Zooming a busy board stays smooth",
|
|
73
|
+
"summary": "A board with hundreds of notes no longer stutters when you zoom in the desktop app. The notes keep the same soft shadow.",
|
|
74
|
+
"surface": "design-ui"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"id": "ai-starts-when-you-do",
|
|
78
|
+
"version": "2.0.5",
|
|
79
|
+
"date": "2026-11-05",
|
|
80
|
+
"kind": "improvement",
|
|
81
|
+
"title": "AI starts when you start typing",
|
|
82
|
+
"summary": "Reopening or reloading Maude no longer starts Claude in the background. It starts the moment you click into the message box.",
|
|
83
|
+
"surface": "design-ui"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"id": "faster-steadier-uploads",
|
|
87
|
+
"version": "2.0.5",
|
|
88
|
+
"date": "2026-11-05",
|
|
89
|
+
"kind": "fix",
|
|
90
|
+
"title": "Faster, steadier uploads",
|
|
91
|
+
"summary": "A big project's pictures and media now go up to your team server a few at a time, so one slow file no longer holds up the rest, and a file that timed out gets a second try. Sync details counts only the files that still have to move, and files in deeply nested folders, like a 3D asset pack, now sync too. A server too old to take them lists each one with the reason.",
|
|
92
|
+
"surface": "design-ui"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"id": "first-download-stops-repeating",
|
|
96
|
+
"version": "2.0.5",
|
|
97
|
+
"date": "2026-11-05",
|
|
98
|
+
"kind": "fix",
|
|
99
|
+
"title": "A first download from an older team server finishes",
|
|
100
|
+
"summary": "Getting a project from a team server that runs an older Maude no longer asks for the same files over and over. A file that can't be fetched waits with a reason instead of being asked for on every pass, and a server that doesn't answer is asked again a minute later.",
|
|
101
|
+
"surface": "design-ui"
|
|
102
|
+
},
|
|
4
103
|
{
|
|
5
104
|
"id": "team-server-browser-signin",
|
|
6
105
|
"version": "2.0.4",
|
package/cli/commands/design.mjs
CHANGED
|
@@ -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
|
package/cli/commands/hub.mjs
CHANGED
|
@@ -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
|
package/cli/lib/bash-guard.mjs
CHANGED
|
@@ -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
|
{
|
|
@@ -1245,7 +1259,19 @@ export function classifyBash(command, { cwd, designRoot, root, sessionRoot = nul
|
|
|
1245
1259
|
// a .design path the script names, runtime (`.design/_…`) ones excepted unless guarded
|
|
1246
1260
|
// `.design` in any case (a case alias on APFS); a symlink to the root the script reaches
|
|
1247
1261
|
// by another name is not seen here — residual, the script is text, not a path
|
|
1248
|
-
|
|
1262
|
+
// fix/ds-convert-hooks-cli #12 — only a `.design` path segment (never `ctx.designRoot`), and
|
|
1263
|
+
// only one that can be THIS project's: an absolute (or `~`) path that resolves outside its
|
|
1264
|
+
// design root — a throwaway copy under /private/tmp/…/before/.design/ — is another tree.
|
|
1265
|
+
// A relative or computed prefix still counts (the script may chdir anywhere).
|
|
1266
|
+
const all = [...text.matchAll(/([^\s'"`(),;=]*?)\.design(?![\w-])(?:\/([^\s'"`),;]*))?/gi)]
|
|
1267
|
+
.filter((m) => {
|
|
1268
|
+
const pre = m[1] ?? '';
|
|
1269
|
+
if (!/^(?:\/|~\/)/.test(pre) || /[$*?[{]/.test(pre)) return true;
|
|
1270
|
+
const abs = pre.startsWith('~/') ? join(homedir(), pre.slice(2)) : pre;
|
|
1271
|
+
const rel = relative(realRoot(), realpathDeep(`${abs}.design${m[2] ? `/${m[2]}` : ''}`));
|
|
1272
|
+
return !(rel === '..' || rel.startsWith(`..${sep}`) || isAbsolute(rel));
|
|
1273
|
+
})
|
|
1274
|
+
.map((m) => m[2] ?? '');
|
|
1249
1275
|
const runtime = (after) => {
|
|
1250
1276
|
const first = after.split('/')[0] ?? '';
|
|
1251
1277
|
return first.startsWith('_') || first.startsWith('.');
|
|
@@ -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
|
|
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";
|
package/cli/lib/design-hook.mjs
CHANGED
|
@@ -1367,6 +1367,13 @@ async function preBash(ctx, input) {
|
|
|
1367
1367
|
// the guard can't read every language, so post-bash binds what changed during the call. No
|
|
1368
1368
|
// snapshot for those (no named file): the studio maps the change to every artboard it touched.
|
|
1369
1369
|
if (!writers.length && !(toolUseId && bashMayWrite(command, manifestVerbs(ctx)))) return null;
|
|
1370
|
+
// fix/ds-convert-hooks-cli #11 — a call whose only writers are `maude design` verbs (nothing else in
|
|
1371
|
+
// it can write: no interpreter, no redirect into the design root). What such a verb writes besides
|
|
1372
|
+
// the canvases the command names (a `ds convert`'s revisions + head.json, the imports `ds switch`
|
|
1373
|
+
// rewrites, a board sync lands meanwhile) is Maude's write, not the AI's: post-bash binds only the
|
|
1374
|
+
// named canvases it snapshotted below.
|
|
1375
|
+
const claiming = claimingVerbs(ctx);
|
|
1376
|
+
const verbOnly = writers.length > 0 && claiming !== null && !bashMayWrite(command, claiming);
|
|
1370
1377
|
const snaps = {};
|
|
1371
1378
|
for (const w of writers) {
|
|
1372
1379
|
for (const word of w.cmd.words) {
|
|
@@ -1408,6 +1415,7 @@ async function preBash(ctx, input) {
|
|
|
1408
1415
|
JSON.stringify({
|
|
1409
1416
|
at,
|
|
1410
1417
|
snaps,
|
|
1418
|
+
...(verbOnly ? { verbOnly: true } : {}),
|
|
1411
1419
|
...bg,
|
|
1412
1420
|
...(interp ? { interp: true, files, hashes, ...(all ? { all: true } : {}) } : {}),
|
|
1413
1421
|
})
|
|
@@ -1529,6 +1537,7 @@ async function bindBashWrites(ctx, toolUseId, mark, by, since) {
|
|
|
1529
1537
|
const files = designWritesSince(ctx.designRoot, since);
|
|
1530
1538
|
if (!files.length) return;
|
|
1531
1539
|
for (const rel of files) {
|
|
1540
|
+
if (!aiMayHaveWritten(mark, rel)) continue;
|
|
1532
1541
|
let at;
|
|
1533
1542
|
try {
|
|
1534
1543
|
at = statSync(join(ctx.designRoot, rel)).mtimeMs;
|
|
@@ -1557,6 +1566,16 @@ async function bindBashWrites(ctx, toolUseId, mark, by, since) {
|
|
|
1557
1566
|
);
|
|
1558
1567
|
}
|
|
1559
1568
|
|
|
1569
|
+
/**
|
|
1570
|
+
* fix/ds-convert-hooks-cli #11 — may the AI's own call have written `rel`? A call of `maude design`
|
|
1571
|
+
* verbs only (`verbOnly`) wrote, as the AI's, just the canvases its command named (`snaps`); the rest
|
|
1572
|
+
* a verb or sync wrote during it is Maude's: it is not bound, and no shell mark keeps a later edit
|
|
1573
|
+
* from taking it as the run's base, so Stop never holds the AI to it.
|
|
1574
|
+
*/
|
|
1575
|
+
const aiMayHaveWritten = (mark, rel) =>
|
|
1576
|
+
mark?.verbOnly !== true ||
|
|
1577
|
+
(!!mark.snaps && typeof mark.snaps === 'object' && Object.hasOwn(mark.snaps, rel));
|
|
1578
|
+
|
|
1560
1579
|
/**
|
|
1561
1580
|
* p8-sec2-attrib A1 — what a call that cannot claim may have written: the canvases it named, plus every
|
|
1562
1581
|
* canvas lane whose bytes changed against the hashes pre-bash took (none taken: by mtime alone).
|
|
@@ -1610,6 +1629,7 @@ async function drainBackground(ctx, studio) {
|
|
|
1610
1629
|
}
|
|
1611
1630
|
// the write is the newest call's whose window it falls in
|
|
1612
1631
|
const owner = marks.find((x) => at === undefined || sinceOf(x) <= at) ?? marks[0];
|
|
1632
|
+
if (!aiMayHaveWritten(owner.m, rel)) continue;
|
|
1613
1633
|
const by = typeof owner.m.by === 'string' ? owner.m.by : 'main';
|
|
1614
1634
|
recordTouch(ctx, rel, { by, via: 'bash', artboards: null, at });
|
|
1615
1635
|
markShellWrite(ctx, rel); // F4 — no base taken after this write
|
package/cli/lib/design-link.mjs
CHANGED
|
@@ -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, {
|
|
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
|
|
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(
|
|
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
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
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
|
|
305
|
+
allow = await prompt(` Let ${normUrl} deliver those to this machine? [y/N] `, false);
|
|
281
306
|
}
|
|
282
|
-
setHubCodeModules(normUrl, allow);
|
|
283
|
-
|
|
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).
|
|
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
|
+
}
|
|
@@ -39,26 +39,51 @@ export function rootIdentity(root) {
|
|
|
39
39
|
|
|
40
40
|
/** `{ port, base }` of the studio serving `root`, or null. Never throws. */
|
|
41
41
|
export async function locateStudio(root, { timeoutMs = 300 } = {}) {
|
|
42
|
+
return (await probeStudio(root, { timeoutMs })).studio ?? null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* fix/ds-convert-hooks-cli #13 — `locateStudio` that tells "not running" from "busy": a live
|
|
47
|
+
* server whose `/_health` did not answer within `timeoutMs` is retried (`attempts` in all, with
|
|
48
|
+
* `retryDelayMs` between) and, still silent, reported `{ state: 'busy' }` — a studio under load
|
|
49
|
+
* (an export, a big sync) is not "no studio". `{ studio }`, `{ state: 'none' }` or
|
|
50
|
+
* `{ state: 'busy' }`. Never throws.
|
|
51
|
+
*/
|
|
52
|
+
export async function probeStudio(
|
|
53
|
+
root,
|
|
54
|
+
{ timeoutMs = 300, attempts = 1, retryDelayMs = 250 } = {}
|
|
55
|
+
) {
|
|
56
|
+
let port;
|
|
42
57
|
try {
|
|
43
58
|
const info = JSON.parse(readFileSync(join(root, DESIGN_REL, '_server.json'), 'utf8'));
|
|
44
|
-
|
|
45
|
-
if (!Number.isInteger(port) || port < 1 || port > 65535) return
|
|
59
|
+
port = Number(info?.port);
|
|
60
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) return { state: 'none' };
|
|
46
61
|
if (Number.isInteger(info?.pid)) {
|
|
47
62
|
try {
|
|
48
63
|
process.kill(info.pid, 0);
|
|
49
64
|
} catch (e) {
|
|
50
|
-
if (e?.code !== 'EPERM') return
|
|
65
|
+
if (e?.code !== 'EPERM') return { state: 'none' }; // a dead server's file
|
|
51
66
|
}
|
|
52
67
|
}
|
|
53
|
-
const base = `http://127.0.0.1:${port}`;
|
|
54
|
-
const res = await fetch(`${base}/_health`, { signal: AbortSignal.timeout(timeoutMs) });
|
|
55
|
-
if (!res.ok) return null;
|
|
56
|
-
const health = await res.json();
|
|
57
|
-
if (health?.app !== 'design' || health.rootId !== rootIdentity(root)) return null;
|
|
58
|
-
return { port, base, health };
|
|
59
68
|
} catch {
|
|
60
|
-
return
|
|
69
|
+
return { state: 'none' };
|
|
70
|
+
}
|
|
71
|
+
const base = `http://127.0.0.1:${port}`;
|
|
72
|
+
for (let i = 0; i < Math.max(1, attempts); i++) {
|
|
73
|
+
if (i > 0) await new Promise((r) => setTimeout(r, retryDelayMs));
|
|
74
|
+
try {
|
|
75
|
+
const res = await fetch(`${base}/_health`, { signal: AbortSignal.timeout(timeoutMs) });
|
|
76
|
+
if (!res.ok) return { state: 'none' };
|
|
77
|
+
const health = await res.json();
|
|
78
|
+
if (health?.app !== 'design' || health.rootId !== rootIdentity(root))
|
|
79
|
+
return { state: 'none' };
|
|
80
|
+
return { studio: { port, base, health } };
|
|
81
|
+
} catch (e) {
|
|
82
|
+
// only a timeout is "busy": a refused connection is no server on that port
|
|
83
|
+
if (e?.name !== 'TimeoutError' && e?.name !== 'AbortError') return { state: 'none' };
|
|
84
|
+
}
|
|
61
85
|
}
|
|
86
|
+
return { state: 'busy' };
|
|
62
87
|
}
|
|
63
88
|
|
|
64
89
|
/** POST JSON to a located studio. `{ status, body }`, or null on any transport failure. */
|