@1agh/maude 2.0.8 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/apps/hub/src/project-transactions/kernel.mjs +13 -7
- package/apps/studio/access/closure.ts +86 -10
- package/apps/studio/access/filters.ts +18 -1
- package/apps/studio/access/request.ts +8 -0
- package/apps/studio/acp/design-write-verb.ts +12 -2
- package/apps/studio/acp/env.ts +7 -2
- package/apps/studio/acp/index.ts +15 -4
- package/apps/studio/acp/login-state.ts +22 -5
- package/apps/studio/acp/may-scope.ts +38 -1
- package/apps/studio/acp/plugin-bootstrap.ts +13 -1
- package/apps/studio/acp/probe.ts +11 -4
- package/apps/studio/actions/agents.ts +110 -28
- package/apps/studio/actions/canvas-keys.ts +4 -2
- package/apps/studio/actions/ctx.ts +3 -0
- package/apps/studio/actions/defs/annotation.ts +84 -2
- package/apps/studio/actions/defs/app.ts +28 -1
- package/apps/studio/actions/defs/edit.ts +13 -0
- package/apps/studio/actions/defs/export.ts +12 -0
- package/apps/studio/actions/defs/sync.ts +18 -0
- package/apps/studio/actions/defs/video.ts +9 -0
- package/apps/studio/actions/documents.ts +6 -1
- package/apps/studio/actions/keymap.gen.ts +147 -9
- package/apps/studio/actions/menu.ts +5 -1
- package/apps/studio/actions/types.ts +4 -2
- package/apps/studio/actions/verbs.ts +9 -0
- package/apps/studio/actions.manifest.json +300 -45
- package/apps/studio/actions.parity.json +19 -1
- package/apps/studio/ai/save-hold.ts +2 -1
- package/apps/studio/ai/write-claim-scope.ts +7 -1
- package/apps/studio/ai/write-claim.ts +154 -3
- package/apps/studio/annotations/ai-read.ts +42 -6
- package/apps/studio/annotations/ai-write.ts +145 -2
- package/apps/studio/annotations/board-ops.ts +34 -3
- package/apps/studio/annotations/checklist-ops.ts +374 -0
- package/apps/studio/annotations/elements/checkitem.model.ts +129 -0
- package/apps/studio/annotations/elements/sticky.model.ts +54 -2
- package/apps/studio/annotations/ops.ts +30 -0
- package/apps/studio/annotations/registry.ts +9 -1
- package/apps/studio/annotations/templates.ts +4 -2
- package/apps/studio/annotations/text-steps.ts +114 -10
- package/apps/studio/annotations/ui/checklist-wire.ts +129 -0
- package/apps/studio/annotations/ui/checklist.tsx +429 -0
- package/apps/studio/annotations/ui/element-node.tsx +48 -2
- package/apps/studio/annotations/ui/template-place.ts +11 -1
- package/apps/studio/annotations/v1-adapter.ts +22 -3
- package/apps/studio/annotations-context-toolbar.tsx +12 -0
- package/apps/studio/annotations-layer.tsx +442 -49
- package/apps/studio/annotations-model.ts +4 -2
- package/apps/studio/api.ts +148 -21
- package/apps/studio/artboard-live-gate.tsx +54 -17
- package/apps/studio/artboard-still-persist.ts +166 -0
- package/apps/studio/artboard-still-raster.ts +6 -2
- package/apps/studio/artboard-still.ts +390 -20
- package/apps/studio/asset-added.ts +154 -0
- package/apps/studio/asset-details.ts +46 -3
- package/apps/studio/asset-origins.ts +5 -3
- package/apps/studio/asset-trash.ts +6 -1
- package/apps/studio/bin/_agent-browser-safe.mjs +3 -4
- package/apps/studio/bin/_annotate-post.mjs +14 -5
- package/apps/studio/bin/_audio-search.mjs +8 -2
- package/apps/studio/bin/_curl-local.mjs +7 -4
- package/apps/studio/bin/_desktop-locate.sh +145 -0
- package/apps/studio/bin/_ds-check-live.mjs +2 -1
- package/apps/studio/bin/_exports.mjs +38 -2
- package/apps/studio/bin/_history.mjs +79 -8
- package/apps/studio/bin/_import-asset.mjs +14 -9
- package/apps/studio/bin/_import-figma.mjs +510 -98
- package/apps/studio/bin/_index-cli.mjs +10 -21
- package/apps/studio/bin/_ingest-footage.mjs +24 -6
- package/apps/studio/bin/_media-probe.mjs +232 -0
- package/apps/studio/bin/_perf-probe-open.mjs +6 -0
- package/apps/studio/bin/_perf-probe-safari.mjs +6 -0
- package/apps/studio/bin/_perf-probe-studio.mjs +6 -1
- package/apps/studio/bin/_perf-probe.mjs +8 -3
- package/apps/studio/bin/_perf-sweep-shared.mjs +789 -0
- package/apps/studio/bin/_perf-sweep.mjs +240 -0
- package/apps/studio/bin/_record-shot.sh +33 -8
- package/apps/studio/bin/_screenshot-playwright.mjs +45 -2
- package/apps/studio/bin/_studio-verb.mjs +8 -3
- package/apps/studio/bin/_thumb-route.mjs +21 -0
- package/apps/studio/bin/_thumbs-playwright.mjs +83 -1
- package/apps/studio/bin/_transcribe.mjs +22 -6
- package/apps/studio/bin/_unsynced-refs.mjs +22 -0
- package/apps/studio/bin/_url-guard.mjs +120 -5
- package/apps/studio/bin/_url-guard.sh +29 -7
- package/apps/studio/bin/_video-limits.mjs +104 -0
- package/apps/studio/bin/_video-playwright.mjs +119 -19
- package/apps/studio/bin/_video-proxy.mjs +130 -0
- package/apps/studio/bin/_write-claim.mjs +38 -16
- package/apps/studio/bin/annotate.mjs +12 -2
- package/apps/studio/bin/canvas-rects.sh +19 -4
- package/apps/studio/bin/chat-open.sh +7 -1
- package/apps/studio/bin/draw-proof.sh +6 -2
- package/apps/studio/bin/generate.sh +32 -10
- package/apps/studio/bin/handoff.sh +2 -2
- package/apps/studio/bin/perf.sh +96 -15
- package/apps/studio/bin/photo-adjust.sh +6 -3
- package/apps/studio/bin/photo-bg-remove.sh +2 -2
- package/apps/studio/bin/prep.sh +21 -4
- package/apps/studio/bin/read-annotations.mjs +3 -0
- package/apps/studio/bin/runtime-health.sh +27 -1
- package/apps/studio/bin/screenshot.sh +152 -12
- package/apps/studio/bin/server-up.sh +64 -6
- package/apps/studio/bin/smoke.sh +43 -8
- package/apps/studio/bin/to-lottie.sh +3 -2
- package/apps/studio/bin/video-proxy.sh +27 -0
- package/apps/studio/bin/visual-sanity.sh +3 -1
- package/apps/studio/bridge/dgn-protocol.ts +157 -1
- package/apps/studio/bridge/mode-shows.ts +8 -6
- package/apps/studio/bridge/still-webp.ts +233 -0
- package/apps/studio/build.ts +18 -0
- package/apps/studio/canvas-build.ts +93 -11
- package/apps/studio/canvas-comment-mount.tsx +53 -8
- package/apps/studio/canvas-edit.ts +34 -1
- package/apps/studio/canvas-lib-module.ts +210 -0
- package/apps/studio/canvas-lib.tsx +3 -12
- package/apps/studio/canvas-pipeline.ts +111 -5
- package/apps/studio/canvas-shell.tsx +8 -11
- package/apps/studio/canvas-theme-pill.tsx +5 -3
- package/apps/studio/check/index.ts +12 -5
- package/apps/studio/check/video.ts +18 -2
- package/apps/studio/client/app.jsx +65 -7
- package/apps/studio/client/clipboard-relay.ts +193 -16
- package/apps/studio/client/comments-overlay.css +18 -0
- package/apps/studio/client/export-center.jsx +30 -0
- package/apps/studio/client/generate-dialog.jsx +49 -4
- package/apps/studio/client/github.js +7 -0
- package/apps/studio/client/home/HomeAccountsRow.jsx +221 -0
- package/apps/studio/client/home/HomeConnection.jsx +111 -0
- package/apps/studio/client/home/home-accounts-model.js +110 -1
- package/apps/studio/client/home/home-api.js +9 -2
- package/apps/studio/client/home/home-app.jsx +126 -13
- package/apps/studio/client/home/home-model.js +69 -1
- package/apps/studio/client/home/home-where-model.js +105 -0
- package/apps/studio/client/home/home.css +239 -1
- package/apps/studio/client/hooks/use-canvas-bridge.jsx +173 -98
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +5 -1
- package/apps/studio/client/hooks/use-tabs.jsx +11 -4
- package/apps/studio/client/panels/DiffView.jsx +7 -1
- package/apps/studio/client/panels/TeamProjects.jsx +137 -134
- package/apps/studio/client/panels/chat-context.js +2 -0
- package/apps/studio/client/panels/slash-commands.gen.js +13 -13
- package/apps/studio/client/selection-scope.js +16 -9
- package/apps/studio/client/share-link.js +12 -0
- package/apps/studio/client/shell/viewport.jsx +11 -1
- package/apps/studio/client/shell-events.js +8 -0
- package/apps/studio/client/styles/3-kit-maude-v2.css +16 -0
- package/apps/studio/client/styles/_index.css +4 -0
- package/apps/studio/client/v2/ai/Feed.jsx +1 -1
- package/apps/studio/client/v2/ai/OfferCard.jsx +34 -0
- package/apps/studio/client/v2/ai/activity-line.js +54 -1
- package/apps/studio/client/v2/ai/ai-offer.js +21 -1
- package/apps/studio/client/v2/ai/run-model.js +3 -1
- package/apps/studio/client/v2/annotations/vote-store.js +28 -4
- package/apps/studio/client/v2/assets/asset-drop-session.js +37 -2
- package/apps/studio/client/v2/assets/canvas-drop-catcher.jsx +7 -5
- package/apps/studio/client/v2/assets/details-model.js +1 -1
- package/apps/studio/client/v2/assets/details.jsx +5 -0
- package/apps/studio/client/v2/assets/tile-drag.js +11 -7
- package/apps/studio/client/v2/comments/comments-panel.jsx +22 -3
- package/apps/studio/client/v2/create/duplicate-done.js +6 -2
- package/apps/studio/client/v2/diagnostics/diagnostics-host.jsx +1 -0
- package/apps/studio/client/v2/diagnostics/diagnostics-model.js +32 -2
- package/apps/studio/client/v2/diagnostics/diagnostics-sheet.jsx +35 -8
- package/apps/studio/client/v2/diagnostics/diagnostics.css +34 -0
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +113 -3
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +343 -6
- package/apps/studio/client/v2/diagnostics/sync-details/unsynced-refs.js +55 -0
- package/apps/studio/client/v2/ds/review.css +1 -1
- package/apps/studio/client/v2/export/exports-model.js +7 -0
- package/apps/studio/client/v2/export/exports-panel.jsx +1 -0
- package/apps/studio/client/v2/export/job-row.jsx +32 -2
- package/apps/studio/client/v2/handoff/ready-card.jsx +1 -1
- package/apps/studio/client/v2/history/compare-view.jsx +1 -0
- package/apps/studio/client/v2/inspector/css-write.js +6 -1
- package/apps/studio/client/v2/inspector/frame.jsx +28 -4
- package/apps/studio/client/v2/inspector/kinds/clip-model.js +51 -0
- package/apps/studio/client/v2/inspector/kinds/clip.jsx +75 -2
- package/apps/studio/client/v2/inspector/model.js +21 -0
- package/apps/studio/client/v2/inspector/sections/fill.jsx +12 -3
- package/apps/studio/client/v2/inspector/sections/recent-colours.js +8 -5
- package/apps/studio/client/v2/inspector/view-mode.jsx +11 -1
- package/apps/studio/client/v2/link-server/LinkServerDialog.jsx +492 -0
- package/apps/studio/client/v2/link-server/LinkServerHost.jsx +42 -0
- package/apps/studio/client/v2/link-server/link-server-api.js +142 -0
- package/apps/studio/client/v2/link-server/link-server-model.js +438 -0
- package/apps/studio/client/v2/link-server/link-server.css +109 -0
- package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +31 -86
- package/apps/studio/client/v2/onboarding/onboarding-model.js +1 -18
- package/apps/studio/client/v2/preview/link-follow.js +4 -2
- package/apps/studio/client/v2/preview/preview-chrome-host.jsx +16 -6
- package/apps/studio/client/v2/search/help-model.js +2 -0
- package/apps/studio/client/v2/search/search-keywords.js +3 -2
- package/apps/studio/client/v2/settings/account.jsx +4 -2
- package/apps/studio/client/v2/settings/advanced-section.jsx +344 -137
- package/apps/studio/client/v2/settings/connection-row.jsx +3 -59
- package/apps/studio/client/v2/settings/connections-section.jsx +118 -425
- package/apps/studio/client/v2/settings/general-section.jsx +155 -24
- package/apps/studio/client/v2/settings/project-sync-settings.jsx +4 -3
- package/apps/studio/client/v2/settings/reset-section.jsx +14 -3
- package/apps/studio/client/v2/settings/settings-card.jsx +142 -0
- package/apps/studio/client/v2/settings/settings-cards.js +220 -0
- package/apps/studio/client/v2/settings/settings-handlers.js +7 -6
- package/apps/studio/client/v2/settings/settings-model.js +100 -31
- package/apps/studio/client/v2/settings/settings-sheet.jsx +25 -6
- package/apps/studio/client/v2/settings/settings.css +374 -64
- package/apps/studio/client/v2/settings/this-project-card.jsx +730 -0
- package/apps/studio/client/v2/settings/this-project-model.js +172 -0
- package/apps/studio/client/v2/settings/use-connections.js +3 -2
- package/apps/studio/client/v2/settings/use-open-card.js +37 -0
- package/apps/studio/client/v2/share/share-sheet.jsx +28 -11
- package/apps/studio/client/v2/shell/api-session-boot.js +6 -0
- package/apps/studio/client/v2/shell/api-session.js +126 -0
- package/apps/studio/client/v2/shell/connection-state.js +197 -0
- package/apps/studio/client/v2/shell/floating-panels.css +31 -1
- package/apps/studio/client/v2/shell/image-pick.js +61 -8
- package/apps/studio/client/v2/shell/menu-aim.js +43 -0
- package/apps/studio/client/v2/shell/menu-runner.js +25 -7
- package/apps/studio/client/v2/shell/occlusion-insets.js +18 -1
- package/apps/studio/client/v2/shell/project-account-bus.js +36 -0
- package/apps/studio/client/v2/shell/project-account-card.jsx +357 -148
- package/apps/studio/client/v2/shell/project-account-model.js +272 -149
- package/apps/studio/client/v2/shell/project-account-toast.js +66 -0
- package/apps/studio/client/v2/shell/project-account.css +237 -0
- package/apps/studio/client/v2/shell/project-pill.jsx +52 -6
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +166 -83
- package/apps/studio/client/v2/shell/shell-parity.js +3 -2
- package/apps/studio/client/v2/shell/shell-parity.json +71 -36
- package/apps/studio/client/v2/shell/still-bridge.js +194 -0
- package/apps/studio/client/v2/shell/still-store.js +319 -0
- package/apps/studio/client/v2/shell/use-account.js +2 -0
- package/apps/studio/client/v2/shell/use-tool-panels.js +2 -1
- package/apps/studio/client/v2/signin/use-signin.js +1 -1
- package/apps/studio/client/v2/timeline/Timeline.jsx +15 -0
- package/apps/studio/client/v2/timeline/frame-handle-model.js +142 -0
- package/apps/studio/client/v2/timeline/frame-handle.jsx +151 -0
- package/apps/studio/clip-ops.ts +126 -8
- package/apps/studio/cloud/endpoints.ts +29 -4
- package/apps/studio/collab/ai-activity.ts +10 -8
- package/apps/studio/collab/awareness-bridge.ts +34 -9
- package/apps/studio/collab/index.ts +3 -0
- package/apps/studio/collab/registry.ts +41 -10
- package/apps/studio/comment-reattach.ts +149 -0
- package/apps/studio/comments/mine-stamp.ts +15 -7
- package/apps/studio/comments/ops.ts +52 -8
- package/apps/studio/comments-overlay.tsx +146 -9
- package/apps/studio/dist/client.bundle.js +892 -885
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/dom-selection.ts +87 -18
- package/apps/studio/ds/board/directions.css +8 -0
- package/apps/studio/ds/board/outline.tsx +16 -0
- package/apps/studio/ds/canvas-check.ts +6 -0
- package/apps/studio/edit-ops/clip/reframe.ts +19 -3
- package/apps/studio/edit-ops/clip-carry.ts +602 -0
- package/apps/studio/edit-ops/clipboard.ts +318 -23
- package/apps/studio/edit-ops/dispatch.ts +20 -2
- package/apps/studio/edit-ops/scope-names.ts +249 -40
- package/apps/studio/edit-ops/slot-defaults.ts +3 -0
- package/apps/studio/edit-ops/types.ts +6 -0
- package/apps/studio/editing/align-bar.tsx +33 -9
- package/apps/studio/editing/artboard-actions.ts +5 -0
- package/apps/studio/editing/artboard-menu.tsx +6 -2
- package/apps/studio/editing/click-to-type.ts +1 -1
- package/apps/studio/editing/clip-words.ts +48 -0
- package/apps/studio/editing/clipboard.ts +21 -6
- package/apps/studio/editing/declared-background.ts +25 -0
- package/apps/studio/editing/index.tsx +3 -0
- package/apps/studio/editing/object-keys.ts +4 -4
- package/apps/studio/editing/object-menu.tsx +13 -3
- package/apps/studio/editing/pen/points.tsx +61 -0
- package/apps/studio/editing/text-in-place.tsx +11 -0
- package/apps/studio/editing/video-frame-handle.tsx +425 -0
- package/apps/studio/exporters/capture-prepass.ts +374 -0
- package/apps/studio/exporters/degraded.ts +148 -0
- package/apps/studio/exporters/hub-render-door.ts +28 -2
- package/apps/studio/exporters/index.ts +3 -1
- package/apps/studio/exporters/job-budget.ts +93 -0
- package/apps/studio/exporters/jobs.ts +215 -28
- package/apps/studio/exporters/parity-check.ts +254 -0
- package/apps/studio/exporters/remote.ts +209 -15
- package/apps/studio/exporters/svg-inline.ts +87 -0
- package/apps/studio/exporters/video-render-lib.ts +88 -26
- package/apps/studio/exporters/video.ts +29 -6
- package/apps/studio/figma/assets.ts +58 -43
- package/apps/studio/figma/codegen-fonts.ts +100 -0
- package/apps/studio/figma/fig-decode.ts +390 -25
- package/apps/studio/figma/fig-kiwi.ts +18 -4
- package/apps/studio/figma/fig-vector.ts +59 -3
- package/apps/studio/figma/sanitize.ts +2 -0
- package/apps/studio/figma/style-map.ts +293 -48
- package/apps/studio/figma/to-artboard.ts +455 -69
- package/apps/studio/figma/to-strokes.ts +44 -11
- package/apps/studio/figma/types.ts +13 -0
- package/apps/studio/footage/schema.ts +3 -3
- package/apps/studio/generation/adapters/elevenlabs.ts +7 -1
- package/apps/studio/generation/adapters/groq.ts +8 -1
- package/apps/studio/generation/spend.ts +312 -0
- package/apps/studio/generation/types.ts +12 -0
- package/apps/studio/handoff/run.ts +1 -1
- package/apps/studio/handoff/targets.ts +2 -2
- package/apps/studio/handoff/write-scopes.ts +1 -1
- package/apps/studio/history/describe-annotations.ts +4 -0
- package/apps/studio/home/accounts.ts +30 -11
- package/apps/studio/home/cloud.ts +6 -1
- package/apps/studio/home/create-local.ts +32 -3
- package/apps/studio/home/hub-health.ts +76 -0
- package/apps/studio/home/routes.ts +15 -4
- package/apps/studio/http.ts +438 -86
- package/apps/studio/imported-module-ids.ts +91 -0
- package/apps/studio/inspect.ts +2 -0
- package/apps/studio/migrate/hub.ts +8 -1
- package/apps/studio/notifications.tsx +47 -5
- package/apps/studio/paths.ts +10 -1
- package/apps/studio/port.ts +3 -2
- package/apps/studio/preview/preview-camera.tsx +15 -382
- package/apps/studio/readiness.ts +10 -1
- package/apps/studio/release-build.ts +51 -0
- package/apps/studio/routes/agent.ts +188 -9
- package/apps/studio/routes/ai.ts +43 -11
- package/apps/studio/routes/annotations.ts +27 -1
- package/apps/studio/routes/assets.ts +18 -1
- package/apps/studio/routes/canvas-origin.ts +12 -9
- package/apps/studio/routes/cloud-move.ts +15 -0
- package/apps/studio/routes/edit.ts +3 -0
- package/apps/studio/routes/export.ts +51 -0
- package/apps/studio/routes/generate.ts +42 -12
- package/apps/studio/routes/hub-link-folder.ts +334 -0
- package/apps/studio/routes/hub-signin.ts +78 -1
- package/apps/studio/routes/index.ts +9 -1
- package/apps/studio/routes/shell.ts +217 -5
- package/apps/studio/routes/sync.ts +136 -8
- package/apps/studio/routes/votes.ts +2 -1
- package/apps/studio/schema/annotations.v2.schema.json +143 -1
- package/apps/studio/schema/beats.v1.schema.json +1 -1
- package/apps/studio/schema/edl.v1.schema.json +1 -1
- package/apps/studio/schema/formats.ts +3 -3
- package/apps/studio/schema/transcript.v1.schema.json +1 -1
- package/apps/studio/server.ts +142 -43
- package/apps/studio/shell/api-key.ts +503 -0
- package/apps/studio/shell/attest.ts +59 -0
- package/apps/studio/shell/capture-url.ts +20 -0
- package/apps/studio/shell/cli-yield.ts +276 -0
- package/apps/studio/shell/clip-transfer.ts +302 -0
- package/apps/studio/shell/key-file.ts +108 -0
- package/apps/studio/shell/server-json.ts +75 -0
- package/apps/studio/shell/worktree.ts +19 -0
- package/apps/studio/spoof-chars.ts +9 -0
- package/apps/studio/studio-page-host.ts +1 -1
- package/apps/studio/sync/accepted-cold-start.ts +144 -8
- package/apps/studio/sync/accepted-link.ts +76 -29
- package/apps/studio/sync/action-stage.ts +575 -44
- package/apps/studio/sync/adopt-held.ts +85 -0
- package/apps/studio/sync/ctl-heal.ts +58 -0
- package/apps/studio/sync/file-ledger.ts +38 -4
- package/apps/studio/sync/file-membership.ts +16 -1
- package/apps/studio/sync/file-plane.ts +289 -22
- package/apps/studio/sync/held-deletes.ts +86 -5
- package/apps/studio/sync/hub-link.ts +8 -0
- package/apps/studio/sync/index.ts +196 -12
- package/apps/studio/sync/journal-client.ts +50 -4
- package/apps/studio/sync/link-consent.ts +22 -75
- package/apps/studio/sync/link-survey.ts +252 -0
- package/apps/studio/sync/local-kernel.ts +296 -8
- package/apps/studio/sync/projection.ts +22 -3
- package/apps/studio/sync/seed-progress.ts +12 -0
- package/apps/studio/sync/source-recovery.ts +59 -3
- package/apps/studio/sync/status.ts +19 -2
- package/apps/studio/sync/unsynced-refs.ts +397 -0
- package/apps/studio/sync/writer-registry.ts +20 -0
- package/apps/studio/thumbs/service.ts +4 -1
- package/apps/studio/tool-palette.tsx +23 -0
- package/apps/studio/ui-prefs.ts +40 -0
- package/apps/studio/use-agent-presence.tsx +2 -2
- package/apps/studio/use-canvas-keys.ts +6 -1
- package/apps/studio/video/format-ids.ts +2 -2
- package/apps/studio/video/inject.ts +31 -0
- package/apps/studio/video/media-risk.ts +58 -0
- package/apps/studio/video/object-fit.ts +137 -0
- package/apps/studio/video/provider-transcript.ts +141 -0
- package/apps/studio/whats-new.json +137 -0
- package/apps/studio/workspace-mode.ts +1 -0
- package/apps/studio/ws.ts +5 -0
- package/cli/commands/design.mjs +119 -8
- package/cli/lib/bash-guard.mjs +366 -6
- package/cli/lib/confine-read.mjs +1 -0
- package/cli/lib/design-help.gen.mjs +3 -2
- package/cli/lib/design-hook.mjs +387 -81
- package/cli/lib/design-link.mjs +16 -1
- package/cli/lib/design-open.mjs +49 -3
- package/cli/lib/desktop-locate.mjs +770 -0
- package/cli/lib/handoff.mjs +1 -1
- package/cli/lib/hook-state.mjs +291 -0
- package/cli/lib/pkg-root.mjs +65 -13
- package/cli/lib/studio-locate.mjs +59 -16
- package/package.json +15 -8
- package/plugins/design/templates/_shell.html +13 -0
- package/apps/studio/client/v2/onboarding/HubSheet.jsx +0 -212
- package/apps/studio/client/v2/shell/account-card-model.js +0 -114
- package/apps/studio/client/v2/shell/account-card.jsx +0 -189
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
// _perf-sweep.mjs — driver behind `maude design perf --sweep` (issues burndown T9.1).
|
|
2
|
+
//
|
|
3
|
+
// node _perf-sweep.mjs --url <canvas page url> --engine chromium|safari [--window 2560x1340] [--passes 3]
|
|
4
|
+
// [--runs 1] [--zoom 0.1] [--speed 1200] [--after-zoom-rows 3] [--query artboard-live=sleep] [--json]
|
|
5
|
+
// [--out <file.json>]
|
|
6
|
+
//
|
|
7
|
+
// One run = a fresh page load, `--passes` passes of the four sweep phases (see _perf-sweep-shared.mjs); the
|
|
8
|
+
// medians and the min..max spread are taken over every pass of every run. The page is the bare canvas page
|
|
9
|
+
// (the capture URL perf.sh resolves), identical for both engines. Chromium runs in Playwright (headless,
|
|
10
|
+
// `--window` viewport, `--dpr`); Safari runs through safaridriver (a one-time `safaridriver --enable`), in a
|
|
11
|
+
// real window of `--window` size — which must be on screen and in front: WebKit freezes rendering behind a
|
|
12
|
+
// locked screen or another window, so the harness refuses (exit 3) a page that reports hidden or ~0 Hz rAF.
|
|
13
|
+
//
|
|
14
|
+
// Exit: 0 measured / 1 failure / 2 bad args / 3 the page was occluded.
|
|
15
|
+
|
|
16
|
+
import { spawn } from 'node:child_process';
|
|
17
|
+
import { writeFileSync } from 'node:fs';
|
|
18
|
+
import {
|
|
19
|
+
aggregateRuns,
|
|
20
|
+
occlusionReason,
|
|
21
|
+
parseSweepArgs,
|
|
22
|
+
parseSweepResult,
|
|
23
|
+
parseWindow,
|
|
24
|
+
renderSweepReport,
|
|
25
|
+
SWEEP_POLL_EXPRESSION,
|
|
26
|
+
sweepStartExpression,
|
|
27
|
+
} from './_perf-sweep-shared.mjs';
|
|
28
|
+
|
|
29
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
30
|
+
|
|
31
|
+
class SweepExit extends Error {
|
|
32
|
+
constructor(message, code) {
|
|
33
|
+
super(message);
|
|
34
|
+
this.code = code;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function pageUrl(opts) {
|
|
39
|
+
const u = new URL(opts.url);
|
|
40
|
+
if (opts.query) {
|
|
41
|
+
for (const [k, v] of new URLSearchParams(opts.query)) u.searchParams.set(k, v);
|
|
42
|
+
}
|
|
43
|
+
return u.toString();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// ---------- Chromium (Playwright) ----------
|
|
47
|
+
|
|
48
|
+
async function chromiumRun(opts) {
|
|
49
|
+
const win = parseWindow(opts.window);
|
|
50
|
+
// --gpu: the full Chromium build in its new headless mode with Metal-backed ANGLE, so frames are not bound by
|
|
51
|
+
// the software rasteriser the default headless shell uses (which turns a heavy board into ~4 fps)
|
|
52
|
+
const { launchChromium } = await import('./_pw-launch.mjs');
|
|
53
|
+
const browser = await launchChromium(
|
|
54
|
+
opts.gpu
|
|
55
|
+
? {
|
|
56
|
+
headless: true,
|
|
57
|
+
channel: 'chromium',
|
|
58
|
+
args: ['--use-angle=metal', '--ignore-gpu-blocklist', '--enable-gpu-rasterization'],
|
|
59
|
+
}
|
|
60
|
+
: { headless: true }
|
|
61
|
+
);
|
|
62
|
+
try {
|
|
63
|
+
const ctx = await browser.newContext({
|
|
64
|
+
viewport: { width: win.w, height: win.h },
|
|
65
|
+
deviceScaleFactor: opts.dpr,
|
|
66
|
+
});
|
|
67
|
+
const page = await ctx.newPage();
|
|
68
|
+
await page.goto(pageUrl(opts), { waitUntil: 'domcontentloaded' });
|
|
69
|
+
await waitForArtboards((expr) => page.evaluate(expr));
|
|
70
|
+
await sleep(2500);
|
|
71
|
+
await page.mouse.move(win.w / 2, win.h / 2);
|
|
72
|
+
return await runHarness((expr) => page.evaluate(expr), opts);
|
|
73
|
+
} finally {
|
|
74
|
+
await browser.close();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// ---------- Safari (safaridriver) ----------
|
|
79
|
+
|
|
80
|
+
async function wd(port, method, path, body) {
|
|
81
|
+
const res = await fetch(`http://localhost:${port}${path}`, {
|
|
82
|
+
method,
|
|
83
|
+
headers: { 'Content-Type': 'application/json' },
|
|
84
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
85
|
+
});
|
|
86
|
+
const json = await res.json().catch(() => ({}));
|
|
87
|
+
if (json?.value?.error) throw new Error(`${json.value.error}: ${json.value.message}`);
|
|
88
|
+
return json.value;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async function looksLikeWebDriver(port) {
|
|
92
|
+
try {
|
|
93
|
+
const res = await fetch(`http://localhost:${port}/status`, {
|
|
94
|
+
signal: AbortSignal.timeout(2000),
|
|
95
|
+
});
|
|
96
|
+
const json = await res.json();
|
|
97
|
+
return !!json && typeof json === 'object' && typeof json.value?.ready === 'boolean';
|
|
98
|
+
} catch {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async function ensureDriver(port) {
|
|
104
|
+
if (await looksLikeWebDriver(port)) return null;
|
|
105
|
+
const child = spawn('safaridriver', ['-p', String(port)], { stdio: 'ignore' });
|
|
106
|
+
for (let i = 0; i < 15; i++) {
|
|
107
|
+
await sleep(500);
|
|
108
|
+
if (await looksLikeWebDriver(port)) return child;
|
|
109
|
+
}
|
|
110
|
+
child.kill();
|
|
111
|
+
throw new SweepExit(
|
|
112
|
+
`nothing that looks like a W3C driver answered on :${port} (run \`safaridriver --enable\` once)`,
|
|
113
|
+
1
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function safariRun(opts) {
|
|
118
|
+
const win = parseWindow(opts.window);
|
|
119
|
+
const driverChild = await ensureDriver(opts.driverPort);
|
|
120
|
+
let sessionId = null;
|
|
121
|
+
try {
|
|
122
|
+
const created = await wd(opts.driverPort, 'POST', '/session', {
|
|
123
|
+
capabilities: { alwaysMatch: { browserName: 'safari' } },
|
|
124
|
+
});
|
|
125
|
+
sessionId = created.sessionId;
|
|
126
|
+
const base = `/session/${sessionId}`;
|
|
127
|
+
const exec = (script) =>
|
|
128
|
+
wd(opts.driverPort, 'POST', `${base}/execute/sync`, {
|
|
129
|
+
script: `return ${script};`,
|
|
130
|
+
args: [],
|
|
131
|
+
});
|
|
132
|
+
await wd(opts.driverPort, 'POST', `${base}/timeouts`, { script: 10000 });
|
|
133
|
+
await wd(opts.driverPort, 'POST', `${base}/window/rect`, {
|
|
134
|
+
x: 0,
|
|
135
|
+
y: 0,
|
|
136
|
+
width: win.w,
|
|
137
|
+
height: win.h,
|
|
138
|
+
});
|
|
139
|
+
await wd(opts.driverPort, 'POST', `${base}/url`, { url: pageUrl(opts) });
|
|
140
|
+
await waitForArtboards(exec);
|
|
141
|
+
await sleep(2500);
|
|
142
|
+
return await runHarness(exec, opts);
|
|
143
|
+
} finally {
|
|
144
|
+
if (sessionId) await wd(opts.driverPort, 'DELETE', `/session/${sessionId}`).catch(() => {});
|
|
145
|
+
if (driverChild) driverChild.kill();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// ---------- shared ----------
|
|
150
|
+
|
|
151
|
+
async function waitForArtboards(evalExpr) {
|
|
152
|
+
for (let i = 0; i < 1200; i++) {
|
|
153
|
+
const n = await evalExpr("document.querySelectorAll('[data-dc-screen]').length").catch(() => 0);
|
|
154
|
+
if (Number(n) > 0) return;
|
|
155
|
+
await sleep(100);
|
|
156
|
+
}
|
|
157
|
+
throw new SweepExit('no artboard ever appeared on the canvas page', 1);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
async function runHarness(evalExpr, opts) {
|
|
161
|
+
const started = await evalExpr(sweepStartExpression(opts));
|
|
162
|
+
if (started !== 'STARTED')
|
|
163
|
+
throw new SweepExit(`the harness did not start (${String(started).slice(0, 20)})`, 1);
|
|
164
|
+
const deadline = Date.now() + opts.timeout * 1000;
|
|
165
|
+
let lastProgress = '';
|
|
166
|
+
while (Date.now() < deadline) {
|
|
167
|
+
await sleep(2000);
|
|
168
|
+
const raw = await evalExpr(SWEEP_POLL_EXPRESSION).catch(() => null);
|
|
169
|
+
if (!raw || raw === 'null') continue;
|
|
170
|
+
let s;
|
|
171
|
+
try {
|
|
172
|
+
s = JSON.parse(raw);
|
|
173
|
+
} catch {
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
const progress = String(s.progress)
|
|
177
|
+
.replace(/[^\w /=.:-]/g, '')
|
|
178
|
+
.slice(0, 80);
|
|
179
|
+
if (progress !== lastProgress) {
|
|
180
|
+
lastProgress = progress;
|
|
181
|
+
process.stderr.write(` ${progress}\n`);
|
|
182
|
+
}
|
|
183
|
+
if (s.state === 'error') throw new SweepExit(`the harness failed: ${progress}`, 1);
|
|
184
|
+
if (s.state === 'done') {
|
|
185
|
+
const result = parseSweepResult(s.result);
|
|
186
|
+
if (!result)
|
|
187
|
+
throw new SweepExit('the harness answered with a result of the wrong shape (refused)', 1);
|
|
188
|
+
return result;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
throw new SweepExit(`the sweep did not finish within ${opts.timeout} s`, 1);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
async function main() {
|
|
195
|
+
let opts;
|
|
196
|
+
try {
|
|
197
|
+
opts = parseSweepArgs(process.argv.slice(2));
|
|
198
|
+
} catch (err) {
|
|
199
|
+
console.error(`_perf-sweep.mjs: ${err.message}`);
|
|
200
|
+
process.exit(2);
|
|
201
|
+
}
|
|
202
|
+
const results = [];
|
|
203
|
+
for (let run = 1; run <= opts.runs; run++) {
|
|
204
|
+
process.stderr.write(
|
|
205
|
+
`→ sweep run ${run}/${opts.runs} (${opts.engine}, ${opts.window}, ${opts.passes} passes)\n`
|
|
206
|
+
);
|
|
207
|
+
const result = opts.engine === 'safari' ? await safariRun(opts) : await chromiumRun(opts);
|
|
208
|
+
const why = occlusionReason(result);
|
|
209
|
+
if (why)
|
|
210
|
+
throw new SweepExit(
|
|
211
|
+
`_perf-sweep.mjs: the run was occluded — ${why}. Unlock the Mac, keep the window on screen and in front, and re-run.`,
|
|
212
|
+
3
|
|
213
|
+
);
|
|
214
|
+
results.push(result);
|
|
215
|
+
}
|
|
216
|
+
const aggregate = aggregateRuns(results);
|
|
217
|
+
const label = opts.label || opts.url.replace(/[?#].*$/, '');
|
|
218
|
+
const out = {
|
|
219
|
+
engine: opts.engine,
|
|
220
|
+
label,
|
|
221
|
+
opts: { ...opts, url: undefined },
|
|
222
|
+
env: results[0].env,
|
|
223
|
+
aggregate,
|
|
224
|
+
results,
|
|
225
|
+
};
|
|
226
|
+
if (opts.out) writeFileSync(opts.out, `${JSON.stringify(out)}\n`, 'utf8');
|
|
227
|
+
if (opts.json) console.log(JSON.stringify(out, null, 2));
|
|
228
|
+
else console.log(renderSweepReport({ label, engine: opts.engine, opts, results, aggregate }));
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
main().catch((err) => {
|
|
232
|
+
if (err instanceof SweepExit) {
|
|
233
|
+
console.error(
|
|
234
|
+
err.message.startsWith('_perf-sweep') ? err.message : `_perf-sweep.mjs: ${err.message}`
|
|
235
|
+
);
|
|
236
|
+
process.exit(err.code);
|
|
237
|
+
}
|
|
238
|
+
console.error(`_perf-sweep.mjs: ${err.message}`);
|
|
239
|
+
process.exit(1);
|
|
240
|
+
});
|
|
@@ -4,12 +4,15 @@
|
|
|
4
4
|
#
|
|
5
5
|
# _record-shot.sh --root <repo> --canvas <rel> [--artboard <id> | --all]
|
|
6
6
|
#
|
|
7
|
-
# Appends {at, canvas, artboard, all, session} (one JSON line) to
|
|
8
|
-
#
|
|
7
|
+
# Appends {at, canvas, artboard, all, session} (one JSON line) to the design hooks' state OUTSIDE the
|
|
8
|
+
# project (#168 E3; cli/lib/hook-state.mjs) — a shots.jsonl in the project is never evidence:
|
|
9
|
+
# <state>/<MAUDE_HOOK_SESSION>/shots.jsonl when the hook session is known
|
|
9
10
|
# (the SessionStart hook exports it to Bash through CLAUDE_ENV_FILE)
|
|
10
|
-
# <
|
|
11
|
-
#
|
|
12
|
-
#
|
|
11
|
+
# <state>/shots.jsonl otherwise
|
|
12
|
+
# where <state> = ${MAUDE_HOOK_STATE_HOME:-~/.claude/maude-hook}/<rootIdentity(repo)> (the first 12
|
|
13
|
+
# hex of sha256 over the repo's resolved path, as studio-locate.mjs `rootIdentity`). Folders 0700,
|
|
14
|
+
# file 0600; a symlink at the record is never followed. Stop counts a capture newer than an
|
|
15
|
+
# artboard's last edit; `--all` (a --full / --all-screens capture) counts for every artboard.
|
|
13
16
|
#
|
|
14
17
|
# Best effort and silent: any problem → exit 0 without writing (a capture never fails for it).
|
|
15
18
|
set -u
|
|
@@ -38,12 +41,29 @@ case "$CANVAS" in
|
|
|
38
41
|
/* | *..* | "") exit 0 ;;
|
|
39
42
|
esac
|
|
40
43
|
|
|
44
|
+
# the hook state folder of this project: rootIdentity = sha256(realpath(repo))[:12]
|
|
45
|
+
STATE_HOME="${MAUDE_HOOK_STATE_HOME:-}"
|
|
46
|
+
if [ -z "$STATE_HOME" ]; then
|
|
47
|
+
[ -n "${HOME:-}" ] || exit 0
|
|
48
|
+
STATE_HOME="$HOME/.claude/maude-hook"
|
|
49
|
+
fi
|
|
50
|
+
REAL=$(cd "$ROOT" 2>/dev/null && pwd -P) || exit 0
|
|
51
|
+
if command -v shasum >/dev/null 2>&1; then
|
|
52
|
+
ID=$(printf '%s' "$REAL" | shasum -a 256 2>/dev/null | cut -c1-12)
|
|
53
|
+
elif command -v sha256sum >/dev/null 2>&1; then
|
|
54
|
+
ID=$(printf '%s' "$REAL" | sha256sum 2>/dev/null | cut -c1-12)
|
|
55
|
+
else
|
|
56
|
+
exit 0
|
|
57
|
+
fi
|
|
58
|
+
printf '%s' "$ID" | grep -Eq '^[0-9a-f]{12}$' || exit 0
|
|
59
|
+
STATE="$STATE_HOME/$ID"
|
|
60
|
+
|
|
41
61
|
SESSION="${MAUDE_HOOK_SESSION:-}"
|
|
42
62
|
if printf '%s' "$SESSION" | grep -Eq '^[A-Za-z0-9_-]{1,128}$'; then
|
|
43
|
-
DIR="$
|
|
63
|
+
DIR="$STATE/$SESSION"
|
|
44
64
|
SESSION_JSON="\"$SESSION\""
|
|
45
65
|
else
|
|
46
|
-
DIR="$
|
|
66
|
+
DIR="$STATE"
|
|
47
67
|
SESSION_JSON=null
|
|
48
68
|
fi
|
|
49
69
|
|
|
@@ -59,7 +79,12 @@ esac
|
|
|
59
79
|
esc() { printf '%s' "$1" | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' | tr -d '\000-\037'; }
|
|
60
80
|
if [ -n "$ARTBOARD" ]; then ART_JSON="\"$(esc "$ARTBOARD")\""; else ART_JSON=null; fi
|
|
61
81
|
|
|
82
|
+
umask 077
|
|
62
83
|
mkdir -p "$DIR" 2>/dev/null || exit 0
|
|
84
|
+
chmod 700 "$STATE_HOME" "$STATE" "$DIR" 2>/dev/null
|
|
85
|
+
FILE="$DIR/shots.jsonl"
|
|
86
|
+
[ -L "$FILE" ] && exit 0
|
|
87
|
+
[ -e "$FILE" ] && [ ! -f "$FILE" ] && exit 0
|
|
63
88
|
printf '{"at":%s,"canvas":"%s","artboard":%s,"all":%s,"session":%s}\n' \
|
|
64
|
-
"$AT" "$(esc "$CANVAS")" "$ART_JSON" "$ALL" "$SESSION_JSON" >>"$
|
|
89
|
+
"$AT" "$(esc "$CANVAS")" "$ART_JSON" "$ALL" "$SESSION_JSON" >>"$FILE" 2>/dev/null
|
|
65
90
|
exit 0
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
//
|
|
6
6
|
// Invocation (called by screenshot.sh — not directly by users):
|
|
7
7
|
// npm exec --package=playwright -- node _screenshot-playwright.mjs \
|
|
8
|
-
// --url <url> [--selector <css>] --out <path> [--timeout 8] [--theme <name>]
|
|
8
|
+
// --url <url> [--selector <css>] --out <path> [--timeout 8] [--theme <name>] [--frame <N>]
|
|
9
9
|
//
|
|
10
10
|
// First invocation may install chromium (~150 MB). Subsequent runs reuse cache.
|
|
11
11
|
|
|
@@ -20,7 +20,7 @@ const args = Object.fromEntries(
|
|
|
20
20
|
}, [])
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
const { url, selector, out, timeout = '8', theme } = args;
|
|
23
|
+
const { url, selector, out, timeout = '8', theme, frame } = args;
|
|
24
24
|
if (!url || !out) {
|
|
25
25
|
console.error(
|
|
26
26
|
'usage: _screenshot-playwright.mjs --url <url> [--selector <css>] --out <path> [--timeout 8]'
|
|
@@ -55,6 +55,49 @@ try {
|
|
|
55
55
|
console.error(`→ theme override: forced data-theme="${theme}" on ${n} element(s)`);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
if (frame !== undefined) {
|
|
59
|
+
// --frame <N> (issue #128 §6): size the viewport to the target, seek strictly, wait for paint,
|
|
60
|
+
// shoot. A canvas with no seek bridge fails loud — a frame-0 shot looks like a valid one.
|
|
61
|
+
const n = Number(frame);
|
|
62
|
+
if (!Number.isInteger(n) || n < 0) {
|
|
63
|
+
console.error(`✗ --frame ${frame}: needs a whole frame number`);
|
|
64
|
+
process.exit(2);
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
await page.waitForFunction(() => typeof window.__maude_seek__ === 'function', null, {
|
|
68
|
+
timeout: timeoutMs,
|
|
69
|
+
});
|
|
70
|
+
} catch {
|
|
71
|
+
console.error(
|
|
72
|
+
`✗ --frame ${n}: this canvas has no window.__maude_seek__ bridge (is the artboard a video-comp?)`
|
|
73
|
+
);
|
|
74
|
+
process.exit(3);
|
|
75
|
+
}
|
|
76
|
+
if (selector) {
|
|
77
|
+
const box = await page.locator(selector).first().boundingBox();
|
|
78
|
+
if (box && box.width > 0 && box.height > 0) {
|
|
79
|
+
const w = Math.min(8192, Math.ceil(box.width));
|
|
80
|
+
const h = Math.min(8192, Math.ceil(box.height));
|
|
81
|
+
await page.setViewportSize({ width: w, height: h });
|
|
82
|
+
console.error(`→ viewport sized to the artboard: ${w}x${h}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
await page.evaluate((f) => window.__maude_seek__(f, { strict: true }), n);
|
|
87
|
+
} catch (e) {
|
|
88
|
+
console.error(
|
|
89
|
+
`✗ --frame ${n}: the seek did not land (${e instanceof Error ? e.message : e})`
|
|
90
|
+
);
|
|
91
|
+
process.exit(3);
|
|
92
|
+
}
|
|
93
|
+
await page.evaluate(
|
|
94
|
+
() =>
|
|
95
|
+
new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r(undefined))))
|
|
96
|
+
);
|
|
97
|
+
await page.waitForTimeout(300);
|
|
98
|
+
console.error(`→ seeked to frame ${n}`);
|
|
99
|
+
}
|
|
100
|
+
|
|
58
101
|
if (selector) {
|
|
59
102
|
const loc = page.locator(selector).first();
|
|
60
103
|
await loc.waitFor({ state: 'visible', timeout: timeoutMs });
|
|
@@ -10,7 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
import { randomBytes } from 'node:crypto';
|
|
12
12
|
import { isAbsolute, relative, resolve, sep } from 'node:path';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
DESIGN_REL,
|
|
15
|
+
findProjectRoot,
|
|
16
|
+
probeStudio,
|
|
17
|
+
studioHeaders,
|
|
18
|
+
} from '../../../cli/lib/studio-locate.mjs';
|
|
14
19
|
|
|
15
20
|
export { DESIGN_REL };
|
|
16
21
|
|
|
@@ -100,10 +105,10 @@ export async function call(studio, route, { method = 'GET', json, timeoutMs = 50
|
|
|
100
105
|
try {
|
|
101
106
|
const res = await fetch(`${studio.base}${route}`, {
|
|
102
107
|
method,
|
|
103
|
-
headers: {
|
|
108
|
+
headers: studioHeaders(studio, {
|
|
104
109
|
...(json === undefined ? {} : { 'content-type': 'application/json' }),
|
|
105
110
|
...chatWriteHeaders(method),
|
|
106
|
-
},
|
|
111
|
+
}),
|
|
107
112
|
body: json === undefined ? undefined : JSON.stringify(json),
|
|
108
113
|
signal: AbortSignal.timeout(timeoutMs),
|
|
109
114
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// _thumb-route.mjs — which requests the thumbnail renderer's route handler sees (#169 item 1).
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A RegExp matching every URL that is NOT under `<origin>/`. Playwright checks a serializable matcher
|
|
5
|
+
* in its own (server) half and continues a request that misses it without a hop to the handler, so
|
|
6
|
+
* the capture origin's own loads skip the handler while everything else still meets it. A URL under
|
|
7
|
+
* `<origin>/` has exactly that origin, so the set of requests that reach the network is the one the
|
|
8
|
+
* handler alone allowed before. `origin` must be an http(s) origin as `URL.origin` prints it;
|
|
9
|
+
* anything else gives a matcher for every URL (the handler then decides alone, as before).
|
|
10
|
+
*/
|
|
11
|
+
export function notUnder(origin) {
|
|
12
|
+
let o = null;
|
|
13
|
+
try {
|
|
14
|
+
const u = new URL(String(origin));
|
|
15
|
+
if ((u.protocol === 'http:' || u.protocol === 'https:') && u.origin === origin) o = u.origin;
|
|
16
|
+
} catch {
|
|
17
|
+
/* not an origin */
|
|
18
|
+
}
|
|
19
|
+
if (o === null) return /^/;
|
|
20
|
+
return new RegExp(`^(?!${o.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&')}/)`);
|
|
21
|
+
}
|
|
@@ -34,6 +34,7 @@ import { createInterface } from 'node:readline';
|
|
|
34
34
|
import { afterPaint, launchChromium } from './_pw-launch.mjs';
|
|
35
35
|
import { isBlankCover, parseRgb } from './_thumb-blank.mjs';
|
|
36
36
|
import { pickAny, pickCover } from './_thumb-cover.mjs';
|
|
37
|
+
import { notUnder } from './_thumb-route.mjs';
|
|
37
38
|
import { drawTile } from './_tile-draw.mjs';
|
|
38
39
|
|
|
39
40
|
const MAX_PAGES = 4;
|
|
@@ -92,7 +93,11 @@ async function makeContext(origin) {
|
|
|
92
93
|
viewport: { width: 1440, height: 900 },
|
|
93
94
|
deviceScaleFactor: 1,
|
|
94
95
|
});
|
|
95
|
-
|
|
96
|
+
// #169 item 1 — the handler sees every request NOT under `<origin>/`: Playwright continues the
|
|
97
|
+
// rest itself (a serializable matcher is checked in its server half), so the ~20 module and CSS
|
|
98
|
+
// loads of a render no longer each wait on this process. A URL under `<origin>/` has exactly that
|
|
99
|
+
// origin, so what reaches the network is unchanged; the handler still re-checks the origin.
|
|
100
|
+
await ctx.route(notUnder(origin), (route) => {
|
|
96
101
|
const req = route.request();
|
|
97
102
|
let reqOrigin = null;
|
|
98
103
|
try {
|
|
@@ -442,6 +447,64 @@ async function shoot(page, job, index, target, runtime, left) {
|
|
|
442
447
|
};
|
|
443
448
|
}
|
|
444
449
|
|
|
450
|
+
/** Debug only (MAUDE_THUMBS_TRACE): resource timings since navigation start + the top CPU self-times. */
|
|
451
|
+
async function traceOf(page, cdp) {
|
|
452
|
+
const out = {};
|
|
453
|
+
out.res = await bounded(
|
|
454
|
+
page.evaluate(() => {
|
|
455
|
+
const nav = performance.getEntriesByType('navigation')[0];
|
|
456
|
+
const r = (n) => Math.round(n);
|
|
457
|
+
const rows = performance.getEntriesByType('resource').map((e) => ({
|
|
458
|
+
n: e.name
|
|
459
|
+
.replace(location.origin, '')
|
|
460
|
+
.replace(/[?&](fc|t)=[^&]*/g, '')
|
|
461
|
+
.slice(0, 120),
|
|
462
|
+
s: r(e.startTime),
|
|
463
|
+
ttfb: r(e.responseStart - e.startTime),
|
|
464
|
+
end: r(e.responseEnd),
|
|
465
|
+
kb: Math.round((e.encodedBodySize || 0) / 1024),
|
|
466
|
+
}));
|
|
467
|
+
return {
|
|
468
|
+
nav: nav ? { dcl: r(nav.domContentLoadedEventEnd), ttfb: r(nav.responseStart) } : null,
|
|
469
|
+
now: r(performance.now()),
|
|
470
|
+
rows,
|
|
471
|
+
};
|
|
472
|
+
}),
|
|
473
|
+
2000
|
|
474
|
+
).catch(() => null);
|
|
475
|
+
if (cdp) {
|
|
476
|
+
try {
|
|
477
|
+
const { profile } = await cdp.send('Profiler.stop');
|
|
478
|
+
const byId = new Map(profile.nodes.map((n) => [n.id, n]));
|
|
479
|
+
const self = new Map();
|
|
480
|
+
profile.samples.forEach((id, i) => {
|
|
481
|
+
const cf = byId.get(id)?.callFrame;
|
|
482
|
+
if (!cf) return;
|
|
483
|
+
const k = `${cf.functionName || '(anon)'} ${cf.url.split('/').slice(-1)[0].split('?')[0]}:${cf.lineNumber}`;
|
|
484
|
+
self.set(k, (self.get(k) || 0) + (profile.timeDeltas[i] || 0));
|
|
485
|
+
});
|
|
486
|
+
const byUrl = new Map();
|
|
487
|
+
profile.samples.forEach((id, i) => {
|
|
488
|
+
const cf = byId.get(id)?.callFrame;
|
|
489
|
+
const k = cf?.url
|
|
490
|
+
? cf.url.split('/').slice(-1)[0].split('?')[0]
|
|
491
|
+
: `(${cf?.functionName || '?'})`;
|
|
492
|
+
byUrl.set(k, (byUrl.get(k) || 0) + (profile.timeDeltas[i] || 0));
|
|
493
|
+
});
|
|
494
|
+
const top = (m, n) =>
|
|
495
|
+
[...m.entries()]
|
|
496
|
+
.sort((a, b) => b[1] - a[1])
|
|
497
|
+
.slice(0, n)
|
|
498
|
+
.map(([k, v]) => [k, Math.round(v / 100) / 10]);
|
|
499
|
+
out.cpu = { self: top(self, 15), byUrl: top(byUrl, 10) };
|
|
500
|
+
await cdp.detach();
|
|
501
|
+
} catch (e) {
|
|
502
|
+
out.cpu = String(e?.message || e);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return out;
|
|
506
|
+
}
|
|
507
|
+
|
|
445
508
|
async function render(msg) {
|
|
446
509
|
const t0 = Date.now();
|
|
447
510
|
const deadline = t0 + Math.max(1000, Math.min(Number(msg.deadlineMs) || 20_000, 60_000));
|
|
@@ -475,9 +538,24 @@ async function render(msg) {
|
|
|
475
538
|
phases[name] = n - mark;
|
|
476
539
|
mark = n;
|
|
477
540
|
};
|
|
541
|
+
// MAUDE_THUMBS_TRACE=1 (debug, the budget bench): the page's own resource timings, and with
|
|
542
|
+
// `=cpu` a CDP CPU profile of goto→mount, in the reply as `trace`. Never on by default.
|
|
543
|
+
const traceMode = process.env.MAUDE_THUMBS_TRACE || '';
|
|
544
|
+
let cdp = null;
|
|
478
545
|
try {
|
|
479
546
|
await page.setViewportSize({ width: 1440, height: 900 });
|
|
480
547
|
lap('viewport');
|
|
548
|
+
if (traceMode === 'cpu') {
|
|
549
|
+
cdp = await page
|
|
550
|
+
.context()
|
|
551
|
+
.newCDPSession(page)
|
|
552
|
+
.catch(() => null);
|
|
553
|
+
if (cdp) {
|
|
554
|
+
await cdp.send('Profiler.enable');
|
|
555
|
+
await cdp.send('Profiler.setSamplingInterval', { interval: 200 });
|
|
556
|
+
await cdp.send('Profiler.start');
|
|
557
|
+
}
|
|
558
|
+
}
|
|
481
559
|
await page.goto(job.url, { waitUntil: 'domcontentloaded', timeout: left() });
|
|
482
560
|
lap('goto');
|
|
483
561
|
assertOrigin(page, job);
|
|
@@ -503,6 +581,8 @@ async function render(msg) {
|
|
|
503
581
|
throw err;
|
|
504
582
|
}
|
|
505
583
|
lap('mount');
|
|
584
|
+
let trace;
|
|
585
|
+
if (traceMode) trace = await traceOf(page, cdp);
|
|
506
586
|
const named = targets.map((t) => t?.artboard).filter((a) => typeof a === 'string');
|
|
507
587
|
if (job.hasArtboards && named.length && named.length === targets.length) {
|
|
508
588
|
// every target names its artboard (a version row, an on-demand shot): wait for exactly
|
|
@@ -580,6 +660,7 @@ async function render(msg) {
|
|
|
580
660
|
lap('blank');
|
|
581
661
|
return {
|
|
582
662
|
phases,
|
|
663
|
+
...(trace ? { trace } : {}),
|
|
583
664
|
ok: true,
|
|
584
665
|
runtime: {
|
|
585
666
|
artboards: runtime.map(({ id, label, kind, w, h }) => ({ id, label, kind, w, h })),
|
|
@@ -590,6 +671,7 @@ async function render(msg) {
|
|
|
590
671
|
launchMs,
|
|
591
672
|
};
|
|
592
673
|
} finally {
|
|
674
|
+
if (cdp) await cdp.detach().catch(() => {});
|
|
593
675
|
jobsByPage.delete(page);
|
|
594
676
|
await page.goto('about:blank').catch(() => {});
|
|
595
677
|
releasePage(page);
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
import { spawnSync } from 'node:child_process';
|
|
23
23
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
24
24
|
import { basename, dirname, extname, join, resolve } from 'node:path';
|
|
25
|
-
|
|
25
|
+
import { studioHeadersFor } from '../../../cli/lib/studio-locate.mjs';
|
|
26
26
|
import { wordsToSrt, wordsToVtt } from '../generation/captions.ts';
|
|
27
27
|
import { resolveWhisperModel, WHISPER_MODELS } from '../generation/whisper-models.ts';
|
|
28
28
|
import { DecodeError } from '../video/decode.ts';
|
|
@@ -133,11 +133,14 @@ export function resolveProvider(flag, repo) {
|
|
|
133
133
|
* Still no SILENT cloud switch (DDR-164): `auto` is a chosen mode, and the
|
|
134
134
|
* caller prints which engine it resolved to before transcribing.
|
|
135
135
|
*/
|
|
136
|
-
export async function settleAutoProvider(provider, port) {
|
|
136
|
+
export async function settleAutoProvider(provider, port, repo = process.cwd()) {
|
|
137
137
|
if (provider !== 'auto') return { provider, autoReason: null };
|
|
138
|
-
const
|
|
138
|
+
const p = port || process.env.MAUDE_PORT || 4399;
|
|
139
|
+
const base = `http://127.0.0.1:${p}`;
|
|
139
140
|
try {
|
|
140
141
|
const res = await fetch(`${base}/_api/generate/providers`, {
|
|
142
|
+
// sec-loopback-bearer §7.6 — the studio's API key (none for a port that is not this project's)
|
|
143
|
+
headers: await studioHeadersFor(repo, p),
|
|
141
144
|
signal: AbortSignal.timeout(1500),
|
|
142
145
|
});
|
|
143
146
|
if (res.ok) {
|
|
@@ -223,6 +226,8 @@ async function runCloud(args, repo, provider) {
|
|
|
223
226
|
}
|
|
224
227
|
|
|
225
228
|
const base = `http://127.0.0.1:${port}/_api/generate-jobs`;
|
|
229
|
+
// sec-loopback-bearer §7.6 — every call carries the studio's API key
|
|
230
|
+
const keyed = await studioHeadersFor(repo, port);
|
|
226
231
|
const body = { modality: 'transcription', provider, sourceAsset: source };
|
|
227
232
|
if (args.model) body.model = args.model;
|
|
228
233
|
if (args.lang) body.params = { language: args.lang };
|
|
@@ -232,7 +237,7 @@ async function runCloud(args, repo, provider) {
|
|
|
232
237
|
try {
|
|
233
238
|
const res = await fetch(base, {
|
|
234
239
|
method: 'POST',
|
|
235
|
-
headers: { 'content-type': 'application/json' },
|
|
240
|
+
headers: { ...keyed, 'content-type': 'application/json' },
|
|
236
241
|
body: JSON.stringify(body),
|
|
237
242
|
});
|
|
238
243
|
const json = await res.json().catch(() => ({}));
|
|
@@ -257,7 +262,7 @@ async function runCloud(args, repo, provider) {
|
|
|
257
262
|
await new Promise((r) => setTimeout(r, 2000));
|
|
258
263
|
let job;
|
|
259
264
|
try {
|
|
260
|
-
const jobs = await (await fetch(base)).json();
|
|
265
|
+
const jobs = await (await fetch(base, { headers: keyed })).json();
|
|
261
266
|
job = Array.isArray(jobs?.jobs) ? jobs.jobs.find((j) => j.id === jobId) : null;
|
|
262
267
|
} catch {
|
|
263
268
|
/* transient — keep polling until the deadline */
|
|
@@ -270,6 +275,17 @@ async function runCloud(args, repo, provider) {
|
|
|
270
275
|
}
|
|
271
276
|
// Chosen engine may only produce SRT; the shared reflow output is SRT. If a
|
|
272
277
|
// VTT was asked for, note that the cloud path currently writes SRT only.
|
|
278
|
+
// #128 §7 — the server leaves `assets/<sha8>.transcript.json` (the words) beside the SRT for
|
|
279
|
+
// every engine. If it is not there, say so by name: word-by-word captions cannot be timed
|
|
280
|
+
// from the SRT, and a silent SRT-only result is how this went unnoticed.
|
|
281
|
+
const sidecar = args.source.replace(/\.[^./]+$/, '.transcript.json');
|
|
282
|
+
if (!existsSync(join(repo, '.design', sidecar))) {
|
|
283
|
+
process.stderr.write(
|
|
284
|
+
`transcribe: no word timings were saved for ${args.source} — ${provider} returned none or ` +
|
|
285
|
+
'the sidecar could not be written; word-by-word captions need them. Re-run with ' +
|
|
286
|
+
'--provider whisper for a local, word-timed transcript.\n'
|
|
287
|
+
);
|
|
288
|
+
}
|
|
273
289
|
process.stdout.write(`${out.startsWith('/') ? out.slice(1) : out}\n`);
|
|
274
290
|
return;
|
|
275
291
|
}
|
|
@@ -314,7 +330,7 @@ async function main() {
|
|
|
314
330
|
const { provider: chosen, defaulted } = resolveProvider(args.provider, repo);
|
|
315
331
|
// `auto` settles into a concrete engine here, and we SAY which — the engine is
|
|
316
332
|
// never a mystery even when the user delegated the pick (DDR-164).
|
|
317
|
-
const { provider, autoReason } = await settleAutoProvider(chosen, args.port);
|
|
333
|
+
const { provider, autoReason } = await settleAutoProvider(chosen, args.port, repo);
|
|
318
334
|
if (autoReason) process.stderr.write(`transcribe: ${autoReason}\n`);
|
|
319
335
|
if (defaulted)
|
|
320
336
|
process.stderr.write(
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Internal shim behind smoke.sh and `maude design status` — issue #158: the files a linked canvas
|
|
2
|
+
// uses that will not reach the workspace, each with the reason. Read-only; disk only.
|
|
3
|
+
//
|
|
4
|
+
// bun _unsynced-refs.mjs --design-root <dir> [--json]
|
|
5
|
+
//
|
|
6
|
+
// Default output is the terminal lines (`sync/unsynced-refs.ts` `unsyncedLines`); nothing at all (exit 0)
|
|
7
|
+
// for an unlinked project or a clean one. `--json` prints the whole report plus its `lines` (the same
|
|
8
|
+
// terminal lines, for a caller that cannot load TypeScript). Advisory: the exit code is 0 whatever it
|
|
9
|
+
// finds, 2 on bad arguments.
|
|
10
|
+
import { unsyncedLines, unsyncedRefsOnDisk } from '../sync/unsynced-refs.ts';
|
|
11
|
+
|
|
12
|
+
const argv = process.argv.slice(2);
|
|
13
|
+
const at = argv.indexOf('--design-root');
|
|
14
|
+
const root = at >= 0 ? argv[at + 1] : undefined;
|
|
15
|
+
if (!root) {
|
|
16
|
+
process.stderr.write('usage: _unsynced-refs.mjs --design-root <dir> [--json]\n');
|
|
17
|
+
process.exit(2);
|
|
18
|
+
}
|
|
19
|
+
const report = unsyncedRefsOnDisk(root);
|
|
20
|
+
const lines = unsyncedLines(report);
|
|
21
|
+
if (argv.includes('--json')) process.stdout.write(`${JSON.stringify({ ...report, lines })}\n`);
|
|
22
|
+
else for (const line of lines) process.stdout.write(`${line}\n`);
|