@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,254 @@
|
|
|
1
|
+
// parity-check.ts — #150 §4 + #128 §8: list, BEFORE the render starts, what
|
|
2
|
+
// @remotion/web-renderer will not draw the way the Player does.
|
|
3
|
+
//
|
|
4
|
+
// Every row below was measured, not assumed: a comp using the feature was exported to mp4 and
|
|
5
|
+
// compared with the PNG export of the same artboard (the browser's own rendering) —
|
|
6
|
+
// background-image url() absent from the mp4 (only `linear-gradient(` is parsed)
|
|
7
|
+
// radial / conic / repeating drawn as a plain linear gradient, or not at all
|
|
8
|
+
// mix-blend-mode drawn as `normal`
|
|
9
|
+
// backdrop-filter not applied
|
|
10
|
+
// inset box-shadow not drawn (the renderer itself logs "not yet supported")
|
|
11
|
+
// vertical writing-mode text not drawn (same)
|
|
12
|
+
// inline <svg> edge cases the renderer serializes the <svg> into a standalone image
|
|
13
|
+
// document: it cannot see the page, so a `<use>` of a shape that
|
|
14
|
+
// lives outside it, an outside `<image>`, a `var(--x)`, or a fill
|
|
15
|
+
// that comes from a page stylesheet class all come out wrong
|
|
16
|
+
// and what does NOT make the list because it rendered correctly: `skewX/skewY` (flex items, nested
|
|
17
|
+
// under a rotate, chained with translate), `clip-path` (polygon/inset/circle, also over a gradient),
|
|
18
|
+
// text-shadow, blur filter, low-opacity images. A skewed element is therefore deliberately not
|
|
19
|
+
// flagged — a warning that cries wolf teaches people to stop reading it.
|
|
20
|
+
//
|
|
21
|
+
// Browser-safe and React-free: imported by `video-render-lib.ts` (runs inside the capture
|
|
22
|
+
// Chromium, over the Player's DOM) and unit-tested under happy-dom. Nothing here blocks an export.
|
|
23
|
+
|
|
24
|
+
export type ParityFeature =
|
|
25
|
+
| 'bg-url'
|
|
26
|
+
| 'bg-gradient'
|
|
27
|
+
| 'blend-mode'
|
|
28
|
+
| 'backdrop-filter'
|
|
29
|
+
| 'inset-shadow'
|
|
30
|
+
| 'vertical-text'
|
|
31
|
+
| 'svg-outside-use'
|
|
32
|
+
| 'svg-outside-image'
|
|
33
|
+
| 'svg-css-var'
|
|
34
|
+
| 'svg-page-class';
|
|
35
|
+
|
|
36
|
+
/** What a person is told. `label` finishes "…the mp4 differs from the preview: <label> on <elements>". */
|
|
37
|
+
export const PARITY_FEATURES: Record<ParityFeature, { label: string; hint: string }> = {
|
|
38
|
+
'bg-url': {
|
|
39
|
+
label: 'a background-image url() is not drawn',
|
|
40
|
+
hint: 'draw the picture with an <img> instead',
|
|
41
|
+
},
|
|
42
|
+
'bg-gradient': {
|
|
43
|
+
label: 'a radial, conic or repeating gradient is not drawn as written',
|
|
44
|
+
hint: 'use a plain linear-gradient',
|
|
45
|
+
},
|
|
46
|
+
'blend-mode': {
|
|
47
|
+
label: 'mix-blend-mode is ignored',
|
|
48
|
+
hint: 'bake the blend into the picture',
|
|
49
|
+
},
|
|
50
|
+
'backdrop-filter': {
|
|
51
|
+
label: 'backdrop-filter is ignored',
|
|
52
|
+
hint: 'use a solid or semi-transparent fill',
|
|
53
|
+
},
|
|
54
|
+
'inset-shadow': {
|
|
55
|
+
label: 'an inset box-shadow is not drawn',
|
|
56
|
+
hint: 'use a border or an inner element',
|
|
57
|
+
},
|
|
58
|
+
'vertical-text': {
|
|
59
|
+
label: 'vertical text (writing-mode) is not drawn',
|
|
60
|
+
hint: 'rotate horizontal text with a transform',
|
|
61
|
+
},
|
|
62
|
+
'svg-outside-use': {
|
|
63
|
+
label: 'an inline <svg> uses a shape from outside itself (<use>)',
|
|
64
|
+
hint: 'put the shape inside that <svg>',
|
|
65
|
+
},
|
|
66
|
+
'svg-outside-image': {
|
|
67
|
+
label: 'an inline <svg> loads a picture from outside itself (<image>)',
|
|
68
|
+
hint: 'use an <img> next to it',
|
|
69
|
+
},
|
|
70
|
+
'svg-css-var': {
|
|
71
|
+
label: 'an inline <svg> reads a CSS variable (var())',
|
|
72
|
+
hint: 'write the color into the <svg>',
|
|
73
|
+
},
|
|
74
|
+
'svg-page-class': {
|
|
75
|
+
label: 'an inline <svg> is colored by a page stylesheet class',
|
|
76
|
+
hint: 'set fill / stroke on the <svg> itself',
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export interface ParityFinding {
|
|
81
|
+
feature: ParityFeature;
|
|
82
|
+
/** Up to `MAX_NAMED` element descriptions (`div.hero`, `svg#logo`); `count` is the total. */
|
|
83
|
+
elements: string[];
|
|
84
|
+
count: number;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface ParityScan {
|
|
88
|
+
/** The artboard the comp sits on (its `data-dc-screen` id), when known. */
|
|
89
|
+
artboard: string | null;
|
|
90
|
+
findings: ParityFinding[];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const MAX_NAMED = 5;
|
|
94
|
+
const MAX_ELEMENTS = 6000;
|
|
95
|
+
|
|
96
|
+
/** `div#id.class "text"` — short, and enough to find the element in the source. */
|
|
97
|
+
export function describeElement(el: Element): string {
|
|
98
|
+
const tag = el.localName;
|
|
99
|
+
const id = el.id ? `#${el.id}` : '';
|
|
100
|
+
const cls = (el.getAttribute('class') ?? '').trim().split(/\s+/)[0];
|
|
101
|
+
let out = tag + id + (cls ? `.${cls}` : '');
|
|
102
|
+
if (!id && !cls) {
|
|
103
|
+
const own = [...el.childNodes]
|
|
104
|
+
.filter((n) => n.nodeType === 3)
|
|
105
|
+
.map((n) => n.textContent ?? '')
|
|
106
|
+
.join(' ')
|
|
107
|
+
.replace(/\s+/g, ' ')
|
|
108
|
+
.trim();
|
|
109
|
+
if (own) out += ` "${own.slice(0, 20)}"`;
|
|
110
|
+
else if (el.parentElement) {
|
|
111
|
+
// nothing to call it by: say where it sits, so it can still be found in the source
|
|
112
|
+
const nth = [...el.parentElement.children].indexOf(el) + 1;
|
|
113
|
+
out = `${el.parentElement.localName} > ${tag}:nth-child(${nth})`;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return out.slice(0, 48);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
type StyleReader = Pick<CSSStyleDeclaration, 'getPropertyValue'>;
|
|
120
|
+
|
|
121
|
+
const has = (v: string | null | undefined): boolean => !!v && v !== 'none' && v !== 'normal';
|
|
122
|
+
|
|
123
|
+
/** Features of the element's own box (everything but inline-svg internals). */
|
|
124
|
+
function boxFeatures(s: StyleReader): ParityFeature[] {
|
|
125
|
+
const out: ParityFeature[] = [];
|
|
126
|
+
const bg = s.getPropertyValue('background-image');
|
|
127
|
+
if (has(bg)) {
|
|
128
|
+
if (/\burl\(/i.test(bg)) out.push('bg-url');
|
|
129
|
+
if (/\b(?:radial|conic)-gradient\(|\brepeating-(?:linear|radial|conic)-gradient\(/i.test(bg)) {
|
|
130
|
+
out.push('bg-gradient');
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (
|
|
134
|
+
has(s.getPropertyValue('mix-blend-mode')) ||
|
|
135
|
+
has(s.getPropertyValue('background-blend-mode'))
|
|
136
|
+
) {
|
|
137
|
+
// `background-blend-mode: normal` is the initial value, `has` already drops it
|
|
138
|
+
out.push('blend-mode');
|
|
139
|
+
}
|
|
140
|
+
if (
|
|
141
|
+
has(s.getPropertyValue('backdrop-filter')) ||
|
|
142
|
+
has(s.getPropertyValue('-webkit-backdrop-filter'))
|
|
143
|
+
) {
|
|
144
|
+
out.push('backdrop-filter');
|
|
145
|
+
}
|
|
146
|
+
if (/\binset\b/i.test(s.getPropertyValue('box-shadow'))) out.push('inset-shadow');
|
|
147
|
+
const wm = s.getPropertyValue('writing-mode');
|
|
148
|
+
if (wm && wm !== 'horizontal-tb') out.push('vertical-text');
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const VISUAL = ['fill', 'stroke', 'stroke-width', 'opacity', 'fill-opacity', 'stroke-opacity'];
|
|
153
|
+
|
|
154
|
+
/** Does a page stylesheet class change how this svg element looks? Measured by taking the class off. */
|
|
155
|
+
function classChangesLook(el: Element, read: (e: Element) => StyleReader): boolean {
|
|
156
|
+
const cls = el.getAttribute('class');
|
|
157
|
+
if (!cls) return false;
|
|
158
|
+
const snapshot = (): string => {
|
|
159
|
+
const s = read(el);
|
|
160
|
+
return VISUAL.map((p) => s.getPropertyValue(p)).join('|');
|
|
161
|
+
};
|
|
162
|
+
const withClass = snapshot();
|
|
163
|
+
el.removeAttribute('class');
|
|
164
|
+
try {
|
|
165
|
+
return snapshot() !== withClass;
|
|
166
|
+
} finally {
|
|
167
|
+
el.setAttribute('class', cls);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function svgFeatures(svg: Element, read: (e: Element) => StyleReader): ParityFeature[] {
|
|
172
|
+
const out = new Set<ParityFeature>();
|
|
173
|
+
const markup = svg.outerHTML;
|
|
174
|
+
if (/\bvar\(\s*--/.test(markup)) out.add('svg-css-var');
|
|
175
|
+
for (const use of svg.querySelectorAll('use')) {
|
|
176
|
+
const href = use.getAttribute('href') ?? use.getAttribute('xlink:href') ?? '';
|
|
177
|
+
if (!href.startsWith('#')) out.add('svg-outside-use');
|
|
178
|
+
else if (!svg.querySelector(`[id="${href.slice(1).replace(/"/g, '')}"]`)) {
|
|
179
|
+
out.add('svg-outside-use');
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
for (const image of svg.querySelectorAll('image')) {
|
|
183
|
+
const href = image.getAttribute('href') ?? image.getAttribute('xlink:href') ?? '';
|
|
184
|
+
if (!/^data:/i.test(href)) out.add('svg-outside-image');
|
|
185
|
+
}
|
|
186
|
+
// An svg that carries its own <style> is self-contained; classes without one lean on the page.
|
|
187
|
+
if (!svg.querySelector('style')) {
|
|
188
|
+
for (const el of svg.querySelectorAll('[class]')) {
|
|
189
|
+
if (classChangesLook(el, read)) {
|
|
190
|
+
out.add('svg-page-class');
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return [...out];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Scan the subtree under `root` (the mounted comp) for features the exporter cannot draw.
|
|
200
|
+
* `getStyle` is a seam for tests; production reads the browser's computed style.
|
|
201
|
+
*/
|
|
202
|
+
export function scanParity(
|
|
203
|
+
root: Element,
|
|
204
|
+
getStyle?: (el: Element) => StyleReader
|
|
205
|
+
): ParityFinding[] {
|
|
206
|
+
const read = getStyle ?? ((el: Element) => getComputedStyle(el));
|
|
207
|
+
const found = new Map<ParityFeature, ParityFinding>();
|
|
208
|
+
const add = (feature: ParityFeature, el: Element): void => {
|
|
209
|
+
const f = found.get(feature) ?? { feature, elements: [], count: 0 };
|
|
210
|
+
f.count += 1;
|
|
211
|
+
if (f.elements.length < MAX_NAMED) f.elements.push(describeElement(el));
|
|
212
|
+
found.set(feature, f);
|
|
213
|
+
};
|
|
214
|
+
let seen = 0;
|
|
215
|
+
for (const el of [root, ...root.querySelectorAll('*')]) {
|
|
216
|
+
if (++seen > MAX_ELEMENTS) break;
|
|
217
|
+
// an svg's children are part of the image the renderer makes of the svg, not nodes it walks
|
|
218
|
+
const inSvg = el.closest('svg');
|
|
219
|
+
if (inSvg && inSvg !== el) continue;
|
|
220
|
+
const style = read(el);
|
|
221
|
+
if (style.getPropertyValue('display') === 'none') continue;
|
|
222
|
+
if (el.localName === 'svg') {
|
|
223
|
+
for (const f of svgFeatures(el, read)) add(f, el);
|
|
224
|
+
} else {
|
|
225
|
+
for (const f of boxFeatures(style)) add(f, el);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return [...found.values()];
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** Fold `more` into `into` by feature: counts add, names stay capped. */
|
|
232
|
+
export function mergeFindings(into: ParityFinding[], more: ParityFinding[]): ParityFinding[] {
|
|
233
|
+
const byFeature = new Map(into.map((f) => [f.feature, { ...f, elements: [...f.elements] }]));
|
|
234
|
+
for (const f of more) {
|
|
235
|
+
const have = byFeature.get(f.feature);
|
|
236
|
+
if (!have) {
|
|
237
|
+
byFeature.set(f.feature, { ...f, elements: [...f.elements] });
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
for (const name of f.elements) {
|
|
241
|
+
if (have.elements.length < MAX_NAMED && !have.elements.includes(name))
|
|
242
|
+
have.elements.push(name);
|
|
243
|
+
}
|
|
244
|
+
// The same element seen on several sampled frames is one element: the larger count wins.
|
|
245
|
+
have.count = Math.max(have.count, f.count);
|
|
246
|
+
}
|
|
247
|
+
return [...byFeature.values()];
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** The frames worth looking at: first, last and a few between (an element can appear mid-comp). */
|
|
251
|
+
export function sampleFrames(durationInFrames: number): number[] {
|
|
252
|
+
const last = Math.max(0, durationInFrames - 1);
|
|
253
|
+
return [...new Set([0, 0.25, 0.5, 0.75, 1].map((p) => Math.round(last * p)))];
|
|
254
|
+
}
|
|
@@ -10,9 +10,12 @@
|
|
|
10
10
|
// short-lived read-only render token, forwarded from the enqueue request.
|
|
11
11
|
//
|
|
12
12
|
// This module is deliberately dumb: one POST, the artifact (or a typed error)
|
|
13
|
-
// back.
|
|
14
|
-
//
|
|
13
|
+
// back. While the POST is open the cell polls the service's `/_render/status`
|
|
14
|
+
// by the job's random render id (#128 T3.7) — frame progress, and whether the
|
|
15
|
+
// job still waits behind another video — and an aborted job is cancelled there
|
|
16
|
+
// (`/_render/cancel`), so its slot frees.
|
|
15
17
|
|
|
18
|
+
import { randomBytes } from 'node:crypto';
|
|
16
19
|
import { mkdirSync, readdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
17
20
|
import path from 'node:path';
|
|
18
21
|
|
|
@@ -86,10 +89,15 @@ function safeDegradation(raw: unknown): ExportDegradation | undefined {
|
|
|
86
89
|
const fonts = Array.isArray(o.fontsNotEmbedded)
|
|
87
90
|
? o.fontsNotEmbedded.flatMap((f) => text(f, 200) ?? []).slice(0, 50)
|
|
88
91
|
: undefined;
|
|
92
|
+
// #150 §4 — the render worker's pre-render parity warning (names come from canvas code: capped)
|
|
93
|
+
const features = Array.isArray(o.unsupportedFeatures)
|
|
94
|
+
? o.unsupportedFeatures.flatMap((f) => text(f, 400) ?? []).slice(0, 12)
|
|
95
|
+
: undefined;
|
|
89
96
|
return {
|
|
90
97
|
reason,
|
|
91
98
|
...(o.audioDropped === true ? { audioDropped: true } : {}),
|
|
92
99
|
...(fonts?.length ? { fontsNotEmbedded: fonts } : {}),
|
|
100
|
+
...(features?.length ? { unsupportedFeatures: features } : {}),
|
|
93
101
|
...(text(o.remedy, 2000) ? { remedy: text(o.remedy, 2000) } : {}),
|
|
94
102
|
};
|
|
95
103
|
}
|
|
@@ -259,6 +267,50 @@ function pickRemoteOptions(options: ExportOptions): ExportOptions {
|
|
|
259
267
|
return out;
|
|
260
268
|
}
|
|
261
269
|
|
|
270
|
+
// ── what a remote render says while it runs, and when it drops (#128 T3.7, CONTRACT §4) ──────────
|
|
271
|
+
|
|
272
|
+
/** The service queued this video behind the one it is rendering (a queue of one). */
|
|
273
|
+
export const RENDER_WAITING_WORDS = 'Waiting — another video is rendering first';
|
|
274
|
+
/** Nothing answers: a sleeping container is the likely cause. */
|
|
275
|
+
export const RENDER_WAKING_WORDS =
|
|
276
|
+
'The render service didn’t answer — it may still be waking up. Try the export again in a minute.';
|
|
277
|
+
/** The service is up and full, or it dropped this job while busy with others. */
|
|
278
|
+
export const RENDER_BUSY_WORDS =
|
|
279
|
+
'The render service is busy with other exports right now — try again shortly.';
|
|
280
|
+
/** The service had this job, then stopped answering before the file came back. */
|
|
281
|
+
export const RENDER_LOST_WORDS =
|
|
282
|
+
'The render service stopped answering during this export. Nothing was saved — export it again.';
|
|
283
|
+
|
|
284
|
+
/** How often a running remote render is asked for its status. */
|
|
285
|
+
const RENDER_POLL_MS = 2000;
|
|
286
|
+
|
|
287
|
+
/** Frame progress from the (untrusted, DDR-230) service, clamped — or nothing. */
|
|
288
|
+
function remoteProgress(v: unknown): { current: number; total: number } | undefined {
|
|
289
|
+
if (!v || typeof v !== 'object') return undefined;
|
|
290
|
+
const { current, total } = v as { current?: unknown; total?: unknown };
|
|
291
|
+
if (typeof current !== 'number' || typeof total !== 'number') return undefined;
|
|
292
|
+
if (!Number.isFinite(current) || !Number.isFinite(total) || total <= 0) return undefined;
|
|
293
|
+
const t = Math.min(Math.floor(total), 1_000_000);
|
|
294
|
+
return { current: Math.min(Math.max(Math.floor(current), 0), t), total: t };
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
function bearer(service: RenderService): Record<string, string> {
|
|
298
|
+
return { authorization: `Bearer ${service.secret}` };
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** `running + queued` from the service's public `/_health`, or null when it does not answer. */
|
|
302
|
+
async function renderLoad(service: RenderService): Promise<number | null> {
|
|
303
|
+
try {
|
|
304
|
+
const r = await fetch(`${service.url}/_health`, { signal: AbortSignal.timeout(5000) });
|
|
305
|
+
if (!r.ok) return null;
|
|
306
|
+
const h = (await r.json()) as { running?: unknown; queued?: unknown };
|
|
307
|
+
const n = (v: unknown) => (typeof v === 'number' && Number.isFinite(v) ? v : 0);
|
|
308
|
+
return n(h.running) + n(h.queued);
|
|
309
|
+
} catch {
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
262
314
|
export async function renderRemotely(args: {
|
|
263
315
|
format: Format;
|
|
264
316
|
targets: Target[];
|
|
@@ -266,8 +318,18 @@ export async function renderRemotely(args: {
|
|
|
266
318
|
canvas: RemoteCanvasAccess;
|
|
267
319
|
service: RenderService;
|
|
268
320
|
signal?: AbortSignal;
|
|
321
|
+
/** frame progress the service reports while it renders */
|
|
322
|
+
onProgress?: (update: { current: number; total: number }) => void;
|
|
323
|
+
/** true while the service holds the job behind another video; false once it runs or settles */
|
|
324
|
+
onWaiting?: (waiting: boolean) => void;
|
|
325
|
+
/** status poll interval (tests) */
|
|
326
|
+
pollMs?: number;
|
|
269
327
|
}): Promise<ExportResult> {
|
|
270
328
|
const { format, targets, options, canvas, service, signal } = args;
|
|
329
|
+
// The job's handle on the service: random, never logged, never the export job's id (members see
|
|
330
|
+
// that one). The ingress bearer is shared by every cell, so this is what keeps status and cancel
|
|
331
|
+
// to the cell that sent the job.
|
|
332
|
+
const renderId = randomBytes(18).toString('base64url');
|
|
271
333
|
// S8.1b — the second line behind routes/export.ts: the option allowlist below would drop these two
|
|
272
334
|
// keys, and the service would hand back an sRGB file / today's canvas as if it were what was asked.
|
|
273
335
|
// A v1 worker cannot honour either, so neither crosses; the protocol stays unchanged.
|
|
@@ -295,6 +357,59 @@ export async function renderRemotely(args: {
|
|
|
295
357
|
...pickRemoteOptions(options),
|
|
296
358
|
timeoutSec: Math.max(Number((options as { timeoutSec?: number }).timeoutSec) || 0, 60),
|
|
297
359
|
};
|
|
360
|
+
// Follow the job while the POST is open: progress, and whether it still waits behind a video.
|
|
361
|
+
let heard = false;
|
|
362
|
+
let waiting = false;
|
|
363
|
+
const setWaiting = (w: boolean) => {
|
|
364
|
+
if (w === waiting) return;
|
|
365
|
+
waiting = w;
|
|
366
|
+
args.onWaiting?.(w);
|
|
367
|
+
};
|
|
368
|
+
let polling = true;
|
|
369
|
+
let pollTimer: ReturnType<typeof setTimeout> | undefined;
|
|
370
|
+
const pollMs = args.pollMs ?? RENDER_POLL_MS;
|
|
371
|
+
const poll = async () => {
|
|
372
|
+
try {
|
|
373
|
+
const r = await fetch(`${service.url}/_render/status?id=${encodeURIComponent(renderId)}`, {
|
|
374
|
+
headers: bearer(service),
|
|
375
|
+
// the bearer goes to the service and nowhere else: a redirect fails the call
|
|
376
|
+
redirect: 'error',
|
|
377
|
+
signal: AbortSignal.timeout(5000),
|
|
378
|
+
});
|
|
379
|
+
if (r.ok) {
|
|
380
|
+
const st = (await r.json()) as { state?: unknown; progress?: unknown };
|
|
381
|
+
if (polling && (st.state === 'waiting' || st.state === 'running')) {
|
|
382
|
+
heard = true;
|
|
383
|
+
setWaiting(st.state === 'waiting');
|
|
384
|
+
const p = remoteProgress(st.progress);
|
|
385
|
+
if (p) args.onProgress?.(p);
|
|
386
|
+
}
|
|
387
|
+
} else await r.body?.cancel().catch(() => {});
|
|
388
|
+
} catch {
|
|
389
|
+
/* a missed poll is not a failed render — the POST decides that */
|
|
390
|
+
}
|
|
391
|
+
if (polling) pollTimer = setTimeout(poll, pollMs);
|
|
392
|
+
};
|
|
393
|
+
pollTimer = setTimeout(poll, pollMs);
|
|
394
|
+
// An aborted job (its timeout) is stopped on the service too, or it would hold the one video slot.
|
|
395
|
+
const cancelRemote = () => {
|
|
396
|
+
void fetch(`${service.url}/_render/cancel`, {
|
|
397
|
+
method: 'POST',
|
|
398
|
+
headers: { ...bearer(service), 'content-type': 'application/json' },
|
|
399
|
+
body: JSON.stringify({ id: renderId }),
|
|
400
|
+
redirect: 'error',
|
|
401
|
+
signal: AbortSignal.timeout(10_000),
|
|
402
|
+
})
|
|
403
|
+
.then((r) => r.body?.cancel())
|
|
404
|
+
.catch(() => {});
|
|
405
|
+
};
|
|
406
|
+
signal?.addEventListener('abort', cancelRemote, { once: true });
|
|
407
|
+
const stopPolling = () => {
|
|
408
|
+
polling = false;
|
|
409
|
+
if (pollTimer) clearTimeout(pollTimer);
|
|
410
|
+
signal?.removeEventListener('abort', cancelRemote);
|
|
411
|
+
setWaiting(false);
|
|
412
|
+
};
|
|
298
413
|
let res: Response;
|
|
299
414
|
try {
|
|
300
415
|
// Bun's `fetch` has its OWN default ceiling — 300 s — independent of the
|
|
@@ -310,6 +425,8 @@ export async function renderRemotely(args: {
|
|
|
310
425
|
method: 'POST',
|
|
311
426
|
signal,
|
|
312
427
|
timeout: false,
|
|
428
|
+
// the bearer goes to the service and nowhere else: a redirect fails the render
|
|
429
|
+
redirect: 'error',
|
|
313
430
|
headers: {
|
|
314
431
|
'content-type': 'application/json',
|
|
315
432
|
authorization: `Bearer ${service.secret}`,
|
|
@@ -319,6 +436,7 @@ export async function renderRemotely(args: {
|
|
|
319
436
|
targets,
|
|
320
437
|
options: remoteOptions,
|
|
321
438
|
canvas: remoteCanvasFor(canvas, targets),
|
|
439
|
+
renderId,
|
|
322
440
|
}),
|
|
323
441
|
};
|
|
324
442
|
const postStart = Date.now();
|
|
@@ -326,16 +444,19 @@ export async function renderRemotely(args: {
|
|
|
326
444
|
res = await fetch(`${service.url}/render`, init);
|
|
327
445
|
console.error(`[remote] ${format} responded ${res.status} in ${Date.now() - postStart}ms`);
|
|
328
446
|
} catch (err) {
|
|
447
|
+
stopPolling();
|
|
329
448
|
if (signal?.aborted) throw err;
|
|
330
|
-
// DDR-231 T7 — the member sees this in the export dialog / notification
|
|
331
|
-
//
|
|
332
|
-
//
|
|
333
|
-
throw new Error(
|
|
334
|
-
|
|
335
|
-
);
|
|
449
|
+
// DDR-231 T7 + #128 T3.7 — the member sees this in the export dialog / notification center:
|
|
450
|
+
// name the LIKELY cause instead of leaking a bare fetch error. "Waking up" only when nothing
|
|
451
|
+
// answers; a service that is busy, or that had this job, says so.
|
|
452
|
+
if (heard) throw new Error(RENDER_LOST_WORDS);
|
|
453
|
+
const load = await renderLoad(service);
|
|
454
|
+
throw new Error(load !== null && load > 0 ? RENDER_BUSY_WORDS : RENDER_WAKING_WORDS);
|
|
455
|
+
} finally {
|
|
456
|
+
stopPolling();
|
|
336
457
|
}
|
|
337
458
|
if (res.status === 503) {
|
|
338
|
-
throw new Error(
|
|
459
|
+
throw new Error(RENDER_BUSY_WORDS);
|
|
339
460
|
}
|
|
340
461
|
if (!res.ok) {
|
|
341
462
|
const detail = (await res.text().catch(() => '')) || `${res.status}`;
|
|
@@ -468,8 +589,17 @@ export function compSecondsFromSource(source: string): number | null {
|
|
|
468
589
|
|
|
469
590
|
/** Where a cloud job stands, as the door answers a poll. */
|
|
470
591
|
export type CloudJobStatus =
|
|
471
|
-
| {
|
|
472
|
-
|
|
592
|
+
| {
|
|
593
|
+
state: 'queued' | 'running';
|
|
594
|
+
progress?: { current: number; total: number };
|
|
595
|
+
/** #128 T3.7b — the render service holds this job behind another video: the row's words for it */
|
|
596
|
+
waiting?: string;
|
|
597
|
+
}
|
|
598
|
+
| {
|
|
599
|
+
state: 'done';
|
|
600
|
+
/** #128 T3.7b — the finished file is complete but lesser (e.g. rendered at 1× in the cloud) */
|
|
601
|
+
degraded?: { reason: string; remedy?: string };
|
|
602
|
+
}
|
|
473
603
|
| { state: 'failed'; error?: string }
|
|
474
604
|
/** the cloud no longer knows the job (past its age, another project) */
|
|
475
605
|
| { state: 'gone' }
|
|
@@ -490,9 +620,19 @@ export interface CloudRenderDoor {
|
|
|
490
620
|
expect?: CloudFingerprintEntry[];
|
|
491
621
|
}): Promise<TargetAnswer>;
|
|
492
622
|
status(jobId: string): Promise<CloudJobStatus>;
|
|
623
|
+
/**
|
|
624
|
+
* #128 T3.7b — ask the cloud to stop one of this person's unfinished jobs. Optional: a door
|
|
625
|
+
* built before Cancel has none, and the row then says it cannot reach the cloud.
|
|
626
|
+
*/
|
|
627
|
+
cancel?(jobId: string): Promise<CloudCancelAnswer>;
|
|
493
628
|
artifact(jobId: string): Promise<{ filename: string | null; body: Uint8Array } | null>;
|
|
494
629
|
}
|
|
495
630
|
|
|
631
|
+
/** What the cloud answered a Cancel with (`ok` also when it no longer knows the job). */
|
|
632
|
+
export type CloudCancelAnswer =
|
|
633
|
+
| { ok: true }
|
|
634
|
+
| { ok: false; code: 'not-running' | 'forbidden' | 'unreachable' };
|
|
635
|
+
|
|
496
636
|
/** One file of a canvas's closure as this Mac holds it: sha256, or null for presence-only (an asset). */
|
|
497
637
|
export interface CloudFingerprintEntry {
|
|
498
638
|
rel: string;
|
|
@@ -511,6 +651,8 @@ export class CloudArtifactTooLargeError extends Error {
|
|
|
511
651
|
|
|
512
652
|
/** The words of a cloud row while it waits (09 ex-offline, CONTRACT §4). */
|
|
513
653
|
export const CLOUD_QUEUED_WORDS = 'Queued — starts when this Mac is online';
|
|
654
|
+
/** The row of a cloud job the person cancelled. */
|
|
655
|
+
export const CLOUD_CANCELLED_WORDS = 'Cancelled.';
|
|
514
656
|
export const CLOUD_GONE_WORDS = 'The cloud no longer has this export. Export it again.';
|
|
515
657
|
export const CLOUD_FAILED_WORDS = 'The cloud couldn’t render it.';
|
|
516
658
|
export const CLOUD_EXPIRED_WORDS = 'Not exported — it waited a day.';
|
|
@@ -551,6 +693,10 @@ interface TrackRecord {
|
|
|
551
693
|
acceptedAt: number;
|
|
552
694
|
phase: TrackPhase;
|
|
553
695
|
progress?: { current: number; total: number };
|
|
696
|
+
/** #128 T3.7b — the cloud holds the job behind another video (never persisted: a poll sets it) */
|
|
697
|
+
waiting?: string;
|
|
698
|
+
/** #128 T3.7b — the finished file is complete but lesser (the cloud's notice) */
|
|
699
|
+
degraded?: { reason: string; remedy?: string };
|
|
554
700
|
filename?: string;
|
|
555
701
|
error?: string;
|
|
556
702
|
finishedAt?: number;
|
|
@@ -571,8 +717,10 @@ export interface CloudRow {
|
|
|
571
717
|
spec: ExportSpecV2;
|
|
572
718
|
label: string;
|
|
573
719
|
runsOn: 'cloud';
|
|
574
|
-
/** queued in the outbox
|
|
720
|
+
/** queued in the outbox ("Render on this Mac now"), or held behind another video by the cloud */
|
|
575
721
|
waiting?: string;
|
|
722
|
+
/** the finished file is complete but lesser — the same notice a this-Mac export carries */
|
|
723
|
+
degraded?: { reason: string; remedy?: string };
|
|
576
724
|
}
|
|
577
725
|
|
|
578
726
|
type CloudEnqueue = {
|
|
@@ -694,6 +842,8 @@ export function createCloudExports(opts: CloudExportsOptions) {
|
|
|
694
842
|
...(t.filename ? { filename: t.filename } : {}),
|
|
695
843
|
...(t.error ? { error: t.error } : {}),
|
|
696
844
|
...(t.progress ? { progress: t.progress } : {}),
|
|
845
|
+
...(t.phase === 'rendering' && t.waiting ? { waiting: t.waiting } : {}),
|
|
846
|
+
...(t.degraded ? { degraded: t.degraded } : {}),
|
|
697
847
|
spec: t.spec,
|
|
698
848
|
label: t.label,
|
|
699
849
|
runsOn: 'cloud',
|
|
@@ -759,6 +909,7 @@ export function createCloudExports(opts: CloudExportsOptions) {
|
|
|
759
909
|
function finish(t: TrackRecord, patch: Partial<TrackRecord>): void {
|
|
760
910
|
const next: TrackRecord = { ...t, ...patch, finishedAt: now() };
|
|
761
911
|
if (patch.progress === undefined && 'progress' in patch) delete next.progress;
|
|
912
|
+
delete next.waiting; // a finished job waits for nothing
|
|
762
913
|
tracked.set(t.jobId, next);
|
|
763
914
|
persist(next);
|
|
764
915
|
announce(rowOfTrack(next));
|
|
@@ -785,13 +936,17 @@ export function createCloudExports(opts: CloudExportsOptions) {
|
|
|
785
936
|
return finish(t, { phase: 'failed', error: error || CLOUD_FAILED_WORDS });
|
|
786
937
|
}
|
|
787
938
|
if (st.state === 'queued' || st.state === 'running') {
|
|
788
|
-
|
|
789
|
-
|
|
939
|
+
const waiting = typeof st.waiting === 'string' && st.waiting ? st.waiting : undefined;
|
|
940
|
+
if (st.progress || waiting !== t.waiting) {
|
|
941
|
+
const next: TrackRecord = { ...t, ...(st.progress ? { progress: st.progress } : {}) };
|
|
942
|
+
if (waiting) next.waiting = waiting;
|
|
943
|
+
else delete next.waiting;
|
|
790
944
|
tracked.set(id, next);
|
|
791
945
|
announce(rowOfTrack(next));
|
|
792
946
|
}
|
|
793
947
|
return schedule(id);
|
|
794
948
|
}
|
|
949
|
+
if (st.state !== 'done') return schedule(id); // (narrowing; every other state returned above)
|
|
795
950
|
// done — the file comes down to this Mac, under the same untrusted-name rule as a render reply
|
|
796
951
|
let art: Awaited<ReturnType<CloudRenderDoor['artifact']>> = null;
|
|
797
952
|
try {
|
|
@@ -808,7 +963,12 @@ export function createCloudExports(opts: CloudExportsOptions) {
|
|
|
808
963
|
const filename = safeArtifactName(art.filename, t.format as Format);
|
|
809
964
|
mkdirSync(path.join(dir, id), { recursive: true });
|
|
810
965
|
writeFileSync(path.join(dir, id, filename), art.body);
|
|
811
|
-
finish(t, {
|
|
966
|
+
finish(t, {
|
|
967
|
+
phase: 'done',
|
|
968
|
+
filename,
|
|
969
|
+
progress: undefined,
|
|
970
|
+
...(st.degraded ? { degraded: st.degraded } : {}),
|
|
971
|
+
});
|
|
812
972
|
}
|
|
813
973
|
|
|
814
974
|
/** The sender's success hook: the cloud took the job — follow it to the file. */
|
|
@@ -893,6 +1053,40 @@ export function createCloudExports(opts: CloudExportsOptions) {
|
|
|
893
1053
|
},
|
|
894
1054
|
accepted,
|
|
895
1055
|
rows,
|
|
1056
|
+
/**
|
|
1057
|
+
* #128 T3.7b — Cancel a cloud row. A job the cloud has: the hub is asked (it stops the job, which
|
|
1058
|
+
* cancels it on the render service) and the row ends in words; no answer keeps it running. One
|
|
1059
|
+
* still waiting in the outbox is withdrawn and never sent.
|
|
1060
|
+
*/
|
|
1061
|
+
async cancel(id: string): Promise<{ ok: true } | { ok: false; code: string }> {
|
|
1062
|
+
if (!JOB_ID_RE.test(id)) return { ok: false, code: 'not-found' };
|
|
1063
|
+
const t = tracked.get(id);
|
|
1064
|
+
if (t) {
|
|
1065
|
+
if (t.phase !== 'rendering') return { ok: false, code: 'not-running' };
|
|
1066
|
+
const door = opts.door();
|
|
1067
|
+
let answer: CloudCancelAnswer = { ok: false, code: 'unreachable' };
|
|
1068
|
+
if (door?.cancel) {
|
|
1069
|
+
try {
|
|
1070
|
+
answer = await door.cancel(id);
|
|
1071
|
+
} catch {
|
|
1072
|
+
answer = { ok: false, code: 'unreachable' };
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
if (!answer.ok) return answer;
|
|
1076
|
+
// a poll may have ended the job while the hub was being asked
|
|
1077
|
+
const cur = tracked.get(id);
|
|
1078
|
+
if (!cur || cur.phase !== 'rendering') return { ok: false, code: 'not-running' };
|
|
1079
|
+
const timer = timers.get(id);
|
|
1080
|
+
if (timer !== undefined) clearTimer(timer);
|
|
1081
|
+
timers.delete(id);
|
|
1082
|
+
finish(cur, { phase: 'failed', error: CLOUD_CANCELLED_WORDS, progress: undefined });
|
|
1083
|
+
return { ok: true };
|
|
1084
|
+
}
|
|
1085
|
+
const r = opts.outbox.store.get(id);
|
|
1086
|
+
if (!r || r.kind !== 'export.cloud') return { ok: false, code: 'not-found' };
|
|
1087
|
+
const c = opts.outbox.store.cancel(id);
|
|
1088
|
+
return c.ok ? { ok: true } : { ok: false, code: c.code };
|
|
1089
|
+
},
|
|
896
1090
|
/** The finished file's bytes (`/_api/export-jobs/download?id=`) — only a done cloud job. */
|
|
897
1091
|
bytes(
|
|
898
1092
|
id: string
|