@1agh/maude 1.10.0 → 2.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/hub/src/project-transactions/baseline.mjs +276 -0
- package/apps/hub/src/project-transactions/kernel.mjs +1756 -0
- package/apps/hub/src/project-transactions/lanes.mjs +287 -0
- package/apps/hub/src/project-transactions/runs-core.mjs +639 -0
- package/apps/hub/src/project-transactions/store-core.mjs +831 -0
- package/apps/studio/access/closure.ts +1075 -0
- package/apps/studio/access/filters.ts +1193 -0
- package/apps/studio/access/frame.ts +365 -0
- package/apps/studio/access/known-canvases.ts +82 -0
- package/apps/studio/access/request.ts +637 -0
- package/apps/studio/access/roles.ts +187 -0
- package/apps/studio/access/scope.ts +407 -0
- package/apps/studio/access/share-map.ts +434 -0
- package/apps/studio/acp/adapter-stderr.ts +22 -0
- package/apps/studio/acp/agent-path.ts +39 -0
- package/apps/studio/acp/ask-queue.ts +238 -0
- package/apps/studio/acp/audience.ts +615 -0
- package/apps/studio/acp/bootstrap-brief.ts +32 -15
- package/apps/studio/acp/bridge.ts +890 -114
- package/apps/studio/acp/chat-search.ts +195 -0
- package/apps/studio/acp/connected-fact.ts +83 -0
- package/apps/studio/acp/design-write-verb.ts +71 -0
- package/apps/studio/acp/env.ts +86 -0
- package/apps/studio/acp/index.ts +808 -58
- package/apps/studio/acp/login-state.ts +15 -1
- package/apps/studio/acp/may-scope.ts +771 -0
- package/apps/studio/acp/plugin-bootstrap.ts +90 -5
- package/apps/studio/acp/probe.ts +18 -4
- package/apps/studio/acp/repo-private.ts +73 -0
- package/apps/studio/acp/running.ts +50 -5
- package/apps/studio/acp/transcript.ts +356 -21
- package/apps/studio/acp/write-scope.ts +141 -11
- package/apps/studio/actions/agents.ts +2068 -0
- package/apps/studio/actions/canvas-keys.ts +41 -0
- package/apps/studio/actions/ctx.ts +118 -0
- package/apps/studio/actions/defs/_v1.ts +55 -0
- package/apps/studio/actions/defs/ai-runs.ts +56 -0
- package/apps/studio/actions/defs/annotation.ts +164 -0
- package/apps/studio/actions/defs/app.ts +269 -0
- package/apps/studio/actions/defs/canvas.ts +281 -0
- package/apps/studio/actions/defs/chat.ts +158 -0
- package/apps/studio/actions/defs/diagnostics.ts +52 -0
- package/apps/studio/actions/defs/ds.ts +139 -0
- package/apps/studio/actions/defs/edit.ts +986 -0
- package/apps/studio/actions/defs/export.ts +221 -0
- package/apps/studio/actions/defs/history.ts +175 -0
- package/apps/studio/actions/defs/native.ts +264 -0
- package/apps/studio/actions/defs/presence.ts +53 -0
- package/apps/studio/actions/defs/search.ts +90 -0
- package/apps/studio/actions/defs/sync.ts +47 -0
- package/apps/studio/actions/defs/timeline.ts +254 -0
- package/apps/studio/actions/defs/tool.ts +152 -0
- package/apps/studio/actions/defs/ui.ts +38 -0
- package/apps/studio/actions/defs/video.ts +115 -0
- package/apps/studio/actions/defs/view.ts +556 -0
- package/apps/studio/actions/documents.ts +32 -0
- package/apps/studio/actions/forward.ts +48 -0
- package/apps/studio/actions/help.ts +115 -0
- package/apps/studio/actions/index.ts +51 -0
- package/apps/studio/actions/keymap.gen.ts +1170 -0
- package/apps/studio/actions/keys.ts +271 -0
- package/apps/studio/actions/legacy.ts +250 -0
- package/apps/studio/actions/manifest-version.ts +18 -0
- package/apps/studio/actions/menu.ts +203 -0
- package/apps/studio/actions/native-menu.ts +132 -0
- package/apps/studio/actions/resolve.ts +118 -0
- package/apps/studio/actions/types.ts +266 -0
- package/apps/studio/actions/uniqueness.ts +119 -0
- package/apps/studio/actions/verbs.ts +306 -0
- package/apps/studio/actions.manifest.json +7826 -0
- package/apps/studio/actions.parity.json +268 -0
- package/apps/studio/activity.ts +4 -31
- package/apps/studio/agent-runs.ts +679 -0
- package/apps/studio/ai/attach-grants.ts +497 -0
- package/apps/studio/ai/copy-meta.ts +204 -0
- package/apps/studio/ai/create-claim.ts +88 -0
- package/apps/studio/ai/lease-home.ts +212 -0
- package/apps/studio/ai/run-doing.ts +106 -0
- package/apps/studio/ai/run-lifecycle.ts +337 -0
- package/apps/studio/ai/run-progress.ts +154 -0
- package/apps/studio/ai/runs.ts +1232 -0
- package/apps/studio/ai/save-hold.ts +565 -0
- package/apps/studio/ai/watch-progress.ts +182 -0
- package/apps/studio/ai/write-claim-scope.ts +39 -0
- package/apps/studio/ai/write-claim.ts +193 -0
- package/apps/studio/ai-banner.tsx +8 -14
- package/apps/studio/annotations/ai-read.ts +289 -1
- package/apps/studio/annotations/ai-write.ts +281 -23
- package/apps/studio/annotations/artboard-members.ts +86 -0
- package/apps/studio/annotations/board-ops.ts +358 -0
- package/apps/studio/annotations/board-schema.ts +81 -0
- package/apps/studio/annotations/constants.ts +2 -0
- package/apps/studio/annotations/elements/_shared.ts +290 -1
- package/apps/studio/annotations/elements/arrow.model.ts +29 -2
- package/apps/studio/annotations/elements/ballot.model.ts +110 -0
- package/apps/studio/annotations/elements/media.model.ts +11 -1
- package/apps/studio/annotations/elements/section.model.ts +3 -1
- package/apps/studio/annotations/elements/stamp.model.ts +83 -0
- package/apps/studio/annotations/elements/sticky.model.ts +235 -0
- package/apps/studio/annotations/elements/vote.model.ts +71 -0
- package/apps/studio/annotations/fields.ts +51 -0
- package/apps/studio/annotations/figjam-into.ts +119 -0
- package/apps/studio/annotations/hosts.ts +231 -0
- package/apps/studio/annotations/migrate-v1.ts +21 -2
- package/apps/studio/annotations/ops.ts +23 -0
- package/apps/studio/annotations/registry.ts +154 -16
- package/apps/studio/annotations/route.ts +268 -0
- package/apps/studio/annotations/run-tag.ts +150 -0
- package/apps/studio/annotations/stamp-kinds.ts +66 -0
- package/apps/studio/annotations/templates.ts +154 -0
- package/apps/studio/annotations/text-steps.ts +253 -0
- package/apps/studio/annotations/time-marks.ts +140 -0
- package/apps/studio/annotations/types.ts +22 -0
- package/apps/studio/annotations/ui/ai-marks.tsx +64 -0
- package/apps/studio/annotations/ui/ai-seen.tsx +117 -0
- package/apps/studio/annotations/ui/arrow-bind.ts +347 -0
- package/apps/studio/annotations/ui/arrow-cards.tsx +396 -0
- package/apps/studio/annotations/ui/arrow-kinds.ts +90 -0
- package/apps/studio/annotations/ui/bar-place.ts +18 -0
- package/apps/studio/annotations/ui/element-node.tsx +300 -52
- package/apps/studio/annotations/ui/host-view.ts +99 -0
- package/apps/studio/annotations/ui/locked.tsx +83 -0
- package/apps/studio/annotations/ui/lod.tsx +246 -0
- package/apps/studio/annotations/ui/placement.tsx +270 -0
- package/apps/studio/annotations/ui/pointer-pipeline.ts +10 -0
- package/apps/studio/annotations/ui/posture.ts +124 -0
- package/apps/studio/annotations/ui/quiet-tip.ts +28 -0
- package/apps/studio/annotations/ui/render-model.ts +27 -2
- package/apps/studio/annotations/ui/rest-route.ts +152 -0
- package/apps/studio/annotations/ui/ride.ts +957 -0
- package/apps/studio/annotations/ui/scene.tsx +59 -11
- package/apps/studio/annotations/ui/section-fold.ts +95 -0
- package/apps/studio/annotations/ui/shell-asks.ts +62 -0
- package/apps/studio/annotations/ui/stamps.ts +221 -0
- package/apps/studio/annotations/ui/stamps.tsx +272 -0
- package/apps/studio/annotations/ui/sticker-drop.ts +147 -0
- package/apps/studio/annotations/ui/sticker-preview.ts +41 -0
- package/apps/studio/annotations/ui/sticky-resolve.ts +106 -0
- package/apps/studio/annotations/ui/template-place.ts +108 -0
- package/apps/studio/annotations/ui/text-editor.tsx +6 -4
- package/apps/studio/annotations/ui/text-session.ts +63 -1
- package/apps/studio/annotations/ui/text-style.ts +11 -3
- package/apps/studio/annotations/ui/time-pins.tsx +134 -0
- package/apps/studio/annotations/ui/tool-prefs.ts +242 -0
- package/apps/studio/annotations/ui/tool-state.ts +211 -0
- package/apps/studio/annotations/ui/visibility.ts +76 -0
- package/apps/studio/annotations/ui/vote-dots.tsx +283 -0
- package/apps/studio/annotations/v1-adapter.ts +88 -5
- package/apps/studio/annotations/validate-board.ts +257 -0
- package/apps/studio/annotations/vote-guard.ts +48 -0
- package/apps/studio/annotations/votes-local.ts +481 -0
- package/apps/studio/annotations-bindings.ts +54 -8
- package/apps/studio/annotations-context-toolbar.tsx +612 -150
- package/apps/studio/annotations-layer.tsx +1768 -674
- package/apps/studio/annotations-model.ts +80 -5
- package/apps/studio/api.ts +1553 -459
- package/apps/studio/artboard-activity-overlay.tsx +530 -3
- package/apps/studio/artboard-ai-copies.tsx +187 -0
- package/apps/studio/artboard-convert-marks.tsx +142 -0
- package/apps/studio/artboard-gap-mark.tsx +177 -0
- package/apps/studio/artboard-ghosts-overlay.tsx +106 -0
- package/apps/studio/artboard-growth-memory.ts +56 -0
- package/apps/studio/artboard-growth-tag.tsx +115 -0
- package/apps/studio/artboard-guides-overlay.tsx +86 -26
- package/apps/studio/artboard-marquee.tsx +21 -6
- package/apps/studio/artboard-new-section.tsx +188 -0
- package/apps/studio/artboard-warn-mark.tsx +330 -0
- package/apps/studio/asset-details.ts +339 -0
- package/apps/studio/asset-generated.ts +99 -0
- package/apps/studio/asset-origins.ts +147 -0
- package/apps/studio/asset-placeholder.tsx +481 -0
- package/apps/studio/asset-rename.ts +171 -0
- package/apps/studio/asset-trash.ts +176 -0
- package/apps/studio/asset-upload-bars.tsx +167 -0
- package/apps/studio/asset-upload.ts +145 -1
- package/apps/studio/attribute-artboards.ts +327 -0
- package/apps/studio/bin/_ab-headless.sh +35 -0
- package/apps/studio/bin/_ab-park.sh +83 -0
- package/apps/studio/bin/_agent-browser-safe.mjs +36 -3
- package/apps/studio/bin/_annotate-post.mjs +137 -0
- package/apps/studio/bin/_assets.mjs +213 -0
- package/apps/studio/bin/_brand-colours.mjs +189 -0
- package/apps/studio/bin/_brand-fonts.mjs +158 -0
- package/apps/studio/bin/_brand-site.mjs +309 -0
- package/apps/studio/bin/_canvas-errors.mjs +143 -0
- package/apps/studio/bin/_canvas-rects-playwright.mjs +6 -3
- package/apps/studio/bin/_canvas-rects-static.mjs +1 -1
- package/apps/studio/bin/_check.mjs +122 -0
- package/apps/studio/bin/_comments.mjs +274 -0
- package/apps/studio/bin/_curl-local.mjs +122 -3
- package/apps/studio/bin/_decode-webaudio.mjs +120 -0
- package/apps/studio/bin/_describe.mjs +220 -0
- package/apps/studio/bin/_ds-check.mjs +26 -0
- package/apps/studio/bin/_ds-prove-playwright.mjs +327 -0
- package/apps/studio/bin/_ds-upgrade.mjs +14 -0
- package/apps/studio/bin/_ds.mjs +82 -0
- package/apps/studio/bin/_enumerate-artboards-playwright.mjs +6 -3
- package/apps/studio/bin/_exports.mjs +244 -0
- package/apps/studio/bin/_fetch-asset.mjs +209 -15
- package/apps/studio/bin/_history.mjs +509 -0
- package/apps/studio/bin/_html-playwright.mjs +10 -3
- package/apps/studio/bin/_import-asset.mjs +446 -15
- package/apps/studio/bin/_import-brand.mjs +40 -156
- package/apps/studio/bin/_import-figma.mjs +878 -20
- package/apps/studio/bin/_import-tokens.mjs +8 -118
- package/apps/studio/bin/_index-cli.mjs +126 -0
- package/apps/studio/bin/_layout-check.mjs +35 -0
- package/apps/studio/bin/_logs.mjs +130 -0
- package/apps/studio/bin/_motion-sample-playwright.mjs +6 -3
- package/apps/studio/bin/_no-egress.sh +36 -0
- package/apps/studio/bin/_pdf-playwright.mjs +9 -3
- package/apps/studio/bin/_perf-probe-safari.mjs +327 -37
- package/apps/studio/bin/_perf-probe-studio.mjs +259 -0
- package/apps/studio/bin/_perf-probe.mjs +35 -1
- package/apps/studio/bin/_perf-shared.mjs +377 -12
- package/apps/studio/bin/_place.mjs +35 -0
- package/apps/studio/bin/_png-playwright.mjs +27 -7
- package/apps/studio/bin/_pptx-playwright.mjs +4 -3
- package/apps/studio/bin/_pw-launch.mjs +124 -2
- package/apps/studio/bin/_record-shot.sh +65 -0
- package/apps/studio/bin/_rects-input.mjs +69 -0
- package/apps/studio/bin/_reel-place.mjs +160 -0
- package/apps/studio/bin/_region.mjs +37 -1
- package/apps/studio/bin/_runs.mjs +178 -0
- package/apps/studio/bin/_screenshot-playwright.mjs +6 -3
- package/apps/studio/bin/_studio-verb.mjs +220 -0
- package/apps/studio/bin/_svg-playwright.mjs +4 -3
- package/apps/studio/bin/_sync.mjs +179 -0
- package/apps/studio/bin/_thumbs-playwright.mjs +704 -0
- package/apps/studio/bin/_tile-draw.mjs +74 -0
- package/apps/studio/bin/_transcribe-local.mjs +243 -0
- package/apps/studio/bin/_transcribe.mjs +48 -56
- package/apps/studio/bin/_trash.mjs +287 -0
- package/apps/studio/bin/_url-guard.mjs +88 -0
- package/apps/studio/bin/_url-guard.sh +16 -0
- package/apps/studio/bin/_video-playwright.mjs +9 -3
- package/apps/studio/bin/_video-verbs.mjs +403 -0
- package/apps/studio/bin/_write-claim.mjs +124 -0
- package/apps/studio/bin/annotate.mjs +348 -330
- package/apps/studio/bin/assets.sh +28 -0
- package/apps/studio/bin/beats.mjs +237 -0
- package/apps/studio/bin/beats.sh +24 -0
- package/apps/studio/bin/bootstrap-check.sh +2 -1
- package/apps/studio/bin/canvas-edit.sh +17 -9
- package/apps/studio/bin/canvas-errors.sh +18 -0
- package/apps/studio/bin/canvas-rects.sh +14 -0
- package/apps/studio/bin/canvas-source.sh +18 -0
- package/apps/studio/bin/captions.sh +13 -0
- package/apps/studio/bin/chat-open.sh +2 -2
- package/apps/studio/bin/check.sh +27 -0
- package/apps/studio/bin/comments.sh +20 -0
- package/apps/studio/bin/cut-to-beat.sh +13 -0
- package/apps/studio/bin/cut-words.sh +13 -0
- package/apps/studio/bin/describe.sh +28 -0
- package/apps/studio/bin/draw-proof.sh +41 -8
- package/apps/studio/bin/ds-check.sh +30 -0
- package/apps/studio/bin/ds-upgrade.sh +30 -0
- package/apps/studio/bin/ds.sh +29 -0
- package/apps/studio/bin/exports.sh +19 -0
- package/apps/studio/bin/generate.sh +45 -3
- package/apps/studio/bin/handoff.sh +60 -1
- package/apps/studio/bin/history.sh +24 -0
- package/apps/studio/bin/import-brand.sh +5 -3
- package/apps/studio/bin/index.sh +26 -0
- package/apps/studio/bin/layout-check.sh +20 -0
- package/apps/studio/bin/logs.sh +17 -0
- package/apps/studio/bin/perf.sh +93 -3
- package/apps/studio/bin/photo-bg-remove.sh +49 -7
- package/apps/studio/bin/place.sh +20 -0
- package/apps/studio/bin/read-annotations.mjs +52 -1
- package/apps/studio/bin/reel-place.sh +15 -0
- package/apps/studio/bin/runs.sh +19 -0
- package/apps/studio/bin/screenshot.sh +37 -21
- package/apps/studio/bin/server-up.sh +50 -13
- package/apps/studio/bin/smoke.sh +10 -0
- package/apps/studio/bin/sync.sh +18 -0
- package/apps/studio/bin/to-lottie.sh +1 -1
- package/apps/studio/bin/transcribe-local.sh +27 -0
- package/apps/studio/bin/trash.sh +23 -0
- package/apps/studio/bin/visual-sanity.sh +1 -0
- package/apps/studio/bridge/canvas-mode-store.ts +301 -0
- package/apps/studio/bridge/canvas-modes.ts +548 -0
- package/apps/studio/bridge/dgn-protocol.ts +2671 -0
- package/apps/studio/bridge/esc-ladder.ts +98 -0
- package/apps/studio/bridge/link-target.ts +157 -0
- package/apps/studio/bridge/mode-shows.ts +167 -0
- package/apps/studio/bridge/occlusion.ts +108 -0
- package/apps/studio/bridge/paste-data.ts +101 -0
- package/apps/studio/build.ts +12 -1
- package/apps/studio/bunfig.toml +4 -0
- package/apps/studio/canvas-build-sandbox.ts +34 -5
- package/apps/studio/canvas-build-worker.ts +23 -1
- package/apps/studio/canvas-build.ts +419 -15
- package/apps/studio/canvas-comment-mount.tsx +113 -25
- package/apps/studio/canvas-create.ts +285 -49
- package/apps/studio/canvas-cursors.ts +12 -0
- package/apps/studio/canvas-ds-icons.tsx +241 -0
- package/apps/studio/canvas-edit.ts +1188 -172
- package/apps/studio/canvas-hud-tokens.gen.ts +120 -0
- package/apps/studio/canvas-icons.tsx +47 -0
- package/apps/studio/canvas-imports.ts +23 -4
- package/apps/studio/canvas-lib-inline.ts +57 -3
- package/apps/studio/canvas-lib.tsx +1033 -263
- package/apps/studio/canvas-list-watch.ts +73 -2
- package/apps/studio/canvas-meta.schema.json +11 -0
- package/apps/studio/canvas-notifications.tsx +28 -3
- package/apps/studio/canvas-pipeline.ts +43 -8
- package/apps/studio/canvas-replay-keys.ts +65 -0
- package/apps/studio/canvas-rows.ts +116 -0
- package/apps/studio/canvas-shell.tsx +784 -698
- package/apps/studio/canvas-source/errors.ts +315 -0
- package/apps/studio/canvas-source/source-map.ts +69 -0
- package/apps/studio/canvas-theme-pill.tsx +164 -0
- package/apps/studio/canvas-theme.ts +133 -0
- package/apps/studio/canvas-top-level.ts +69 -0
- package/apps/studio/check/ids.ts +28 -0
- package/apps/studio/check/index.ts +586 -0
- package/apps/studio/check/link-resolver.ts +75 -0
- package/apps/studio/check/meta.ts +79 -0
- package/apps/studio/check/video.ts +352 -0
- package/apps/studio/client/actions/shell-key-handlers.js +450 -0
- package/apps/studio/client/app.jsx +2918 -1203
- package/apps/studio/client/canvas-url.js +241 -5
- package/apps/studio/client/clipboard-relay.ts +144 -0
- package/apps/studio/client/command-palette-match.js +4 -2
- package/apps/studio/client/comments-overlay.css +529 -144
- package/apps/studio/client/dialogs/asset-picker.jsx +77 -32
- package/apps/studio/client/dialogs/command-palette.jsx +453 -67
- package/apps/studio/client/dialogs/export-dialog.jsx +6 -781
- package/apps/studio/client/dialogs/help-modal.jsx +31 -2
- package/apps/studio/client/dialogs/shortcuts-overlay.jsx +201 -106
- package/apps/studio/client/edit-op-relay.ts +77 -0
- package/apps/studio/client/embed-view.jsx +25 -5
- package/apps/studio/client/export-bridge-scope.js +72 -0
- package/apps/studio/client/export-center.jsx +179 -369
- package/apps/studio/client/export-lane.js +117 -0
- package/apps/studio/client/export-region.ts +25 -0
- package/apps/studio/client/file-tree.jsx +4 -4
- package/apps/studio/client/fonts/LICENSE-Inter-Tight.txt +93 -0
- package/apps/studio/client/fonts/LICENSE-Inter.txt +93 -0
- package/apps/studio/client/fonts/LICENSE-JetBrains-Mono.txt +93 -0
- package/apps/studio/client/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
- package/apps/studio/client/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/apps/studio/client/fonts/inter-tight-latin-ext-wght-normal.woff2 +0 -0
- package/apps/studio/client/fonts/inter-tight-latin-wght-normal.woff2 +0 -0
- package/apps/studio/client/fonts/jetbrains-mono-latin-ext-wght-normal.woff2 +0 -0
- package/apps/studio/client/fonts/jetbrains-mono-latin-wght-normal.woff2 +0 -0
- package/apps/studio/client/frame-cap.js +132 -0
- package/apps/studio/client/generate-dialog.jsx +38 -36
- package/apps/studio/client/github.js +85 -26
- package/apps/studio/client/home/HomeAsk.jsx +220 -0
- package/apps/studio/client/home/InviteSheet.jsx +150 -0
- package/apps/studio/client/home/Shelves.jsx +216 -0
- package/apps/studio/client/home/Starters.jsx +42 -0
- package/apps/studio/client/home/TargetChip.jsx +152 -0
- package/apps/studio/client/home/home-api.js +275 -0
- package/apps/studio/client/home/home-app.jsx +1884 -0
- package/apps/studio/client/home/home-icons.jsx +143 -0
- package/apps/studio/client/home/home-menu.js +43 -0
- package/apps/studio/client/home/home-model.js +514 -0
- package/apps/studio/client/home/home-starters.js +136 -0
- package/apps/studio/client/home/home.css +1681 -0
- package/apps/studio/client/home/invite-flow.js +422 -0
- package/apps/studio/client/home/shell-mode.js +49 -0
- package/apps/studio/client/hooks/annotations-hidden-toast.js +21 -0
- package/apps/studio/client/hooks/canvas-origin-probe.js +26 -0
- package/apps/studio/client/hooks/edit-scope-query.js +16 -0
- package/apps/studio/client/hooks/use-action-keys.jsx +121 -0
- package/apps/studio/client/hooks/use-canvas-bridge.jsx +881 -247
- package/apps/studio/client/hooks/use-git-actions.jsx +33 -12
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +722 -287
- package/apps/studio/client/hooks/use-photo-and-timeline.jsx +268 -307
- package/apps/studio/client/hooks/use-project-data.jsx +23 -2
- package/apps/studio/client/hooks/use-shell-core.jsx +582 -126
- package/apps/studio/client/hooks/use-tabs.jsx +268 -126
- package/apps/studio/client/index-loader.ts +3 -1
- package/apps/studio/client/index.html +0 -3
- package/apps/studio/client/inspector/color-picker.jsx +29 -18
- package/apps/studio/client/inspector/css-knobs.jsx +765 -436
- package/apps/studio/client/inspector/css-vocab.jsx +37 -4
- package/apps/studio/client/inspector/ds-tokens.js +127 -15
- package/apps/studio/client/inspector/grid-tracks-editor.jsx +21 -15
- package/apps/studio/client/inspector/inspect-computed.jsx +17 -15
- package/apps/studio/client/inspector/inspector-panel.jsx +314 -207
- package/apps/studio/client/inspector/layers.jsx +90 -65
- package/apps/studio/client/inspector/selection.js +20 -0
- package/apps/studio/client/inspector/token-popover.jsx +42 -28
- package/apps/studio/client/inspector-controls.jsx +453 -106
- package/apps/studio/client/panels/BrandUploadPanel.jsx +8 -229
- package/apps/studio/client/panels/ChatPanel.jsx +391 -1674
- package/apps/studio/client/panels/CloudBar.jsx +548 -252
- package/apps/studio/client/panels/CollabModelInfographic.jsx +77 -20
- package/apps/studio/client/panels/CreateProject.jsx +224 -40
- package/apps/studio/client/panels/DiffView.jsx +27 -10
- package/apps/studio/client/panels/ElicitationPrompt.jsx +4 -3
- package/apps/studio/client/panels/FigmaImportPanel.jsx +12 -263
- package/apps/studio/client/panels/IdentityBar.jsx +262 -74
- package/apps/studio/client/panels/IntroVideoDialog.jsx +6 -1
- package/apps/studio/client/panels/PermissionPrompt.jsx +85 -9
- package/apps/studio/client/panels/ReadinessList.jsx +71 -46
- package/apps/studio/client/panels/RepoBranchSwitcher.jsx +124 -745
- package/apps/studio/client/panels/SettingsPanel.jsx +492 -608
- package/apps/studio/client/panels/SetupChecklist.jsx +10 -3
- package/apps/studio/client/panels/SourceConflictPanel.jsx +96 -20
- package/apps/studio/client/panels/SyncConsentDialog.jsx +14 -13
- package/apps/studio/client/panels/TeamProjects.jsx +365 -119
- package/apps/studio/client/panels/ToolGroup.jsx +6 -2
- package/apps/studio/client/panels/acp-runtime.js +127 -22
- package/apps/studio/client/panels/acp-usage.js +4 -1
- package/apps/studio/client/panels/chat-context.js +74 -5
- package/apps/studio/client/panels/chat-header.jsx +67 -0
- package/apps/studio/client/panels/chat-markdown.jsx +6 -2
- package/apps/studio/client/panels/file-deep-link-dialog.jsx +88 -17
- package/apps/studio/client/panels/file-preview.jsx +50 -24
- package/apps/studio/client/panels/git-grouping.js +9 -2
- package/apps/studio/client/panels/slash-commands.gen.js +171 -0
- package/apps/studio/client/panels/slash-commands.js +65 -25
- package/apps/studio/client/panels/timeline-media-cache.js +68 -2
- package/apps/studio/client/panels/timeline-parse.js +62 -22
- package/apps/studio/client/panels/timeline-snap.js +4 -1
- package/apps/studio/client/panels/transcript-view.js +9 -0
- package/apps/studio/client/photo-knobs.jsx +225 -46
- package/apps/studio/client/prefs-migrate.js +79 -0
- package/apps/studio/client/report-bug.jsx +59 -26
- package/apps/studio/client/selection-scope.js +215 -0
- package/apps/studio/client/share-link.js +104 -8
- package/apps/studio/client/shell/account-tone.js +28 -0
- package/apps/studio/client/shell/banners.jsx +21 -188
- package/apps/studio/client/shell/comments-panel.jsx +5 -176
- package/apps/studio/client/shell/constants.js +1 -0
- package/apps/studio/client/shell/dock.jsx +217 -31
- package/apps/studio/client/shell/drop-guard.js +52 -0
- package/apps/studio/client/shell/icons.jsx +165 -23
- package/apps/studio/client/shell/util.js +20 -33
- package/apps/studio/client/shell/viewport.jsx +249 -95
- package/apps/studio/client/shell-bus.js +82 -0
- package/apps/studio/client/shell-events.js +251 -0
- package/apps/studio/client/stamp-follow.js +62 -0
- package/apps/studio/client/stores/shell-store.jsx +15 -0
- package/apps/studio/client/styles/0-reset.css +79 -16
- package/apps/studio/client/styles/1-tokens-maude-v2.css +367 -0
- package/apps/studio/client/styles/1-tokens-shell.css +374 -0
- package/apps/studio/client/styles/2-layout.css +404 -24
- package/apps/studio/client/styles/3-kit-maude-v2.css +683 -0
- package/apps/studio/client/styles/_index.css +185 -18
- package/apps/studio/client/styles/fonts.css +63 -0
- package/apps/studio/client/system/system-view.jsx +52 -6
- package/apps/studio/client/tour/collab-tour.js +43 -38
- package/apps/studio/client/tour/overlay.jsx +61 -19
- package/apps/studio/client/tour/quick-setup-tour.js +27 -20
- package/apps/studio/client/tour/tour-model.js +36 -0
- package/apps/studio/client/tour/usage-tour.js +43 -24
- package/apps/studio/client/tree/tree.jsx +661 -409
- package/apps/studio/client/tree-expansion.js +5 -2
- package/apps/studio/client/tree-row-menu.jsx +43 -29
- package/apps/studio/client/ui-open.js +104 -0
- package/apps/studio/client/use-tree-drag.js +2 -0
- package/apps/studio/client/v2/access/access-card.jsx +54 -0
- package/apps/studio/client/v2/access/access-client.js +525 -0
- package/apps/studio/client/v2/access/access-host.jsx +328 -0
- package/apps/studio/client/v2/access/access.css +163 -0
- package/apps/studio/client/v2/access/ask-to-edit.jsx +97 -0
- package/apps/studio/client/v2/access/disabled-reason.js +50 -0
- package/apps/studio/client/v2/access/link-off-card.jsx +37 -0
- package/apps/studio/client/v2/access/trashed-banner.jsx +123 -0
- package/apps/studio/client/v2/advanced/where-matrix.js +231 -0
- package/apps/studio/client/v2/ai/AChip.jsx +158 -0
- package/apps/studio/client/v2/ai/Advanced.jsx +640 -0
- package/apps/studio/client/v2/ai/AiChatIsland.jsx +108 -0
- package/apps/studio/client/v2/ai/AskSelectionHost.jsx +173 -0
- package/apps/studio/client/v2/ai/AttachMenu.jsx +190 -0
- package/apps/studio/client/v2/ai/BigChat.jsx +195 -0
- package/apps/studio/client/v2/ai/ChatList.jsx +614 -0
- package/apps/studio/client/v2/ai/ChatUndo.jsx +164 -0
- package/apps/studio/client/v2/ai/ChoiceCard.jsx +178 -0
- package/apps/studio/client/v2/ai/Composer.jsx +655 -0
- package/apps/studio/client/v2/ai/ConnectSheet.jsx +118 -0
- package/apps/studio/client/v2/ai/Consent.jsx +66 -0
- package/apps/studio/client/v2/ai/DropOverlay.jsx +113 -0
- package/apps/studio/client/v2/ai/Feed.jsx +589 -0
- package/apps/studio/client/v2/ai/FoldNeeds.jsx +23 -0
- package/apps/studio/client/v2/ai/NeedsYouSlot.jsx +250 -0
- package/apps/studio/client/v2/ai/NotReady.jsx +110 -0
- package/apps/studio/client/v2/ai/OfferCard.jsx +165 -0
- package/apps/studio/client/v2/ai/PermissionCard.jsx +168 -0
- package/apps/studio/client/v2/ai/PickedShots.jsx +33 -0
- package/apps/studio/client/v2/ai/ProblemCard.jsx +41 -0
- package/apps/studio/client/v2/ai/QuitDialog.jsx +127 -0
- package/apps/studio/client/v2/ai/RawLog.jsx +68 -0
- package/apps/studio/client/v2/ai/Result.jsx +144 -0
- package/apps/studio/client/v2/ai/RunList.jsx +352 -0
- package/apps/studio/client/v2/ai/RunSurface.jsx +248 -0
- package/apps/studio/client/v2/ai/ScopeChip.jsx +239 -0
- package/apps/studio/client/v2/ai/SentStrip.jsx +70 -0
- package/apps/studio/client/v2/ai/StoppedDivider.jsx +84 -0
- package/apps/studio/client/v2/ai/Suggest.jsx +153 -0
- package/apps/studio/client/v2/ai/TurnResult.jsx +95 -0
- package/apps/studio/client/v2/ai/WaitingCard.jsx +133 -0
- package/apps/studio/client/v2/ai/WillChange.jsx +40 -0
- package/apps/studio/client/v2/ai/Working.jsx +74 -0
- package/apps/studio/client/v2/ai/advanced-handlers.js +56 -0
- package/apps/studio/client/v2/ai/advanced-model.js +214 -0
- package/apps/studio/client/v2/ai/ai-list-advanced.css +625 -0
- package/apps/studio/client/v2/ai/ai-may.js +75 -0
- package/apps/studio/client/v2/ai/ai-offer.js +178 -0
- package/apps/studio/client/v2/ai/ai-run.css +281 -0
- package/apps/studio/client/v2/ai/ai-send.js +164 -0
- package/apps/studio/client/v2/ai/ai.css +261 -0
- package/apps/studio/client/v2/ai/answer-note.js +44 -0
- package/apps/studio/client/v2/ai/ask-frame.js +131 -0
- package/apps/studio/client/v2/ai/ask-selection-lane.js +100 -0
- package/apps/studio/client/v2/ai/ask-selection.css +142 -0
- package/apps/studio/client/v2/ai/ask-selection.js +84 -0
- package/apps/studio/client/v2/ai/attach.css +366 -0
- package/apps/studio/client/v2/ai/attach.js +186 -0
- package/apps/studio/client/v2/ai/chat-list-model.js +333 -0
- package/apps/studio/client/v2/ai/chat-store-api.js +93 -0
- package/apps/studio/client/{styles/6-acp-chat.css → v2/ai/chat.css} +1152 -797
- package/apps/studio/client/v2/ai/connect-flow.js +75 -0
- package/apps/studio/client/v2/ai/gate-lines.js +121 -0
- package/apps/studio/client/v2/ai/icons.jsx +66 -0
- package/apps/studio/client/v2/ai/jump-model.js +61 -0
- package/apps/studio/client/v2/ai/made-by-ai.js +179 -0
- package/apps/studio/client/v2/ai/needs-you-store.js +112 -0
- package/apps/studio/client/v2/ai/needs-you-toast.js +104 -0
- package/apps/studio/client/v2/ai/needs-you.css +554 -0
- package/apps/studio/client/v2/ai/needs-you.js +401 -0
- package/apps/studio/client/v2/ai/panel-focus.js +71 -0
- package/apps/studio/client/v2/ai/panel.css +88 -0
- package/apps/studio/client/v2/ai/paste-chips.jsx +108 -0
- package/apps/studio/client/v2/ai/picked-shots.js +48 -0
- package/apps/studio/client/v2/ai/quit.css +64 -0
- package/apps/studio/client/v2/ai/result-shown.js +50 -0
- package/apps/studio/client/v2/ai/ring-relay.js +143 -0
- package/apps/studio/client/v2/ai/row-slots-lane.js +67 -0
- package/apps/studio/client/v2/ai/run-api.js +137 -0
- package/apps/studio/client/v2/ai/run-cards.js +31 -0
- package/apps/studio/client/v2/ai/run-compare.js +60 -0
- package/apps/studio/client/v2/ai/run-icons.jsx +53 -0
- package/apps/studio/client/v2/ai/run-model.js +348 -0
- package/apps/studio/client/v2/ai/runs-model.js +568 -0
- package/apps/studio/client/v2/ai/runs-store.js +161 -0
- package/apps/studio/client/v2/ai/runs.css +226 -0
- package/apps/studio/client/v2/ai/scope.js +298 -0
- package/apps/studio/client/v2/ai/seen-relay.js +95 -0
- package/apps/studio/client/v2/ai/sent-attachments.js +77 -0
- package/apps/studio/client/v2/ai/stopped.js +69 -0
- package/apps/studio/client/v2/ai/suggest-why.js +200 -0
- package/apps/studio/client/v2/ai/use-ai-scope.js +198 -0
- package/apps/studio/client/v2/ai/use-ask-ai.js +63 -0
- package/apps/studio/client/v2/ai/use-ask-selection.js +41 -0
- package/apps/studio/client/v2/ai/use-attachments.js +239 -0
- package/apps/studio/client/v2/ai/use-chat-runs.js +32 -0
- package/apps/studio/client/v2/ai/use-run-versions.js +39 -0
- package/apps/studio/client/v2/ai/video/ClipsAttached.jsx +23 -0
- package/apps/studio/client/v2/ai/video/LeftOut.jsx +29 -0
- package/apps/studio/client/v2/ai/video/WatchProgress.jsx +65 -0
- package/apps/studio/client/v2/ai/video/card-model.js +107 -0
- package/apps/studio/client/v2/ai/video/cards.jsx +51 -0
- package/apps/studio/client/v2/ai/video/clip-pic.js +12 -0
- package/apps/studio/client/v2/ai/video/video-cards.css +168 -0
- package/apps/studio/client/v2/annotations/annotation-asks.js +171 -0
- package/apps/studio/client/v2/annotations/annotation-list-model.js +238 -0
- package/apps/studio/client/v2/annotations/annotation-list.css +277 -0
- package/apps/studio/client/v2/annotations/annotation-list.jsx +433 -0
- package/apps/studio/client/v2/annotations/recent-stickers.js +64 -0
- package/apps/studio/client/v2/annotations/stamp-row.jsx +66 -0
- package/apps/studio/client/v2/annotations/stamps-glyphs.jsx +35 -0
- package/apps/studio/client/v2/annotations/sticker-preload.js +44 -0
- package/apps/studio/client/v2/annotations/sticker-search.js +155 -0
- package/apps/studio/client/v2/annotations/stickers-gallery.css +295 -0
- package/apps/studio/client/v2/annotations/stickers-gallery.jsx +454 -0
- package/apps/studio/client/v2/annotations/templates-panel.css +344 -0
- package/apps/studio/client/v2/annotations/templates-panel.jsx +240 -0
- package/apps/studio/client/v2/annotations/v2-scope.js +20 -0
- package/apps/studio/client/v2/annotations/vote-bar.jsx +212 -0
- package/apps/studio/client/v2/annotations/vote-sheet.jsx +200 -0
- package/apps/studio/client/v2/annotations/vote-store.js +392 -0
- package/apps/studio/client/v2/annotations/vote.css +153 -0
- package/apps/studio/client/v2/assets/ask-once.js +65 -0
- package/apps/studio/client/v2/assets/asset-drop-session.js +238 -0
- package/apps/studio/client/v2/assets/asset-state-lane.js +267 -0
- package/apps/studio/client/v2/assets/assets-bus.js +109 -0
- package/apps/studio/client/v2/assets/browse-model.js +90 -0
- package/apps/studio/client/v2/assets/browse-view.jsx +202 -0
- package/apps/studio/client/v2/assets/canvas-drop-catcher.jsx +114 -0
- package/apps/studio/client/v2/assets/connect-key-sheet.jsx +69 -0
- package/apps/studio/client/v2/assets/copy-asset.js +37 -0
- package/apps/studio/client/v2/assets/describe-client.js +156 -0
- package/apps/studio/client/v2/assets/describe-consent.jsx +184 -0
- package/apps/studio/client/v2/assets/describe.css +72 -0
- package/apps/studio/client/v2/assets/details-advanced.jsx +76 -0
- package/apps/studio/client/v2/assets/details-model.js +233 -0
- package/apps/studio/client/v2/assets/details.jsx +292 -0
- package/apps/studio/client/v2/assets/generate-ask.jsx +506 -0
- package/apps/studio/client/v2/assets/generated.js +83 -0
- package/apps/studio/client/v2/assets/import-lines.js +228 -0
- package/apps/studio/client/v2/assets/import-offline.js +32 -0
- package/apps/studio/client/v2/assets/import-toast.js +56 -0
- package/apps/studio/client/v2/assets/just-added.js +32 -0
- package/apps/studio/client/v2/assets/kinds-chip.jsx +77 -0
- package/apps/studio/client/v2/assets/library-foot.js +42 -0
- package/apps/studio/client/v2/assets/missing-frame.css +60 -0
- package/apps/studio/client/v2/assets/missing-frame.jsx +218 -0
- package/apps/studio/client/v2/assets/multi-select.js +58 -0
- package/apps/studio/client/v2/assets/place-asset.js +128 -0
- package/apps/studio/client/v2/assets/relink.js +96 -0
- package/apps/studio/client/v2/assets/rename-asset.js +83 -0
- package/apps/studio/client/v2/assets/search-marks.jsx +75 -0
- package/apps/studio/client/v2/assets/takes-overlay.jsx +86 -0
- package/apps/studio/client/v2/assets/takes.css +177 -0
- package/apps/studio/client/v2/assets/takes.js +224 -0
- package/apps/studio/client/v2/assets/tidy.jsx +144 -0
- package/apps/studio/client/v2/assets/tile-drag.js +53 -0
- package/apps/studio/client/v2/assets/tile-menu.jsx +119 -0
- package/apps/studio/client/v2/assets/tile.jsx +131 -0
- package/apps/studio/client/v2/assets/trash-assets.js +98 -0
- package/apps/studio/client/v2/assets/use-asset-details.js +58 -0
- package/apps/studio/client/v2/assets/use-assets.js +121 -0
- package/apps/studio/client/v2/assets/use-takes-lane.js +150 -0
- package/apps/studio/client/v2/canvases/canvas-icons.jsx +107 -0
- package/apps/studio/client/v2/canvases/canvases-panel.jsx +1466 -0
- package/apps/studio/client/v2/canvases/canvases.css +699 -0
- package/apps/studio/client/v2/canvases/covers.js +32 -0
- package/apps/studio/client/v2/canvases/inline-rename.jsx +122 -0
- package/apps/studio/client/v2/canvases/jump-list.jsx +100 -0
- package/apps/studio/client/v2/canvases/jump-model.js +102 -0
- package/apps/studio/client/v2/canvases/kept-on-this-mac.jsx +192 -0
- package/apps/studio/client/v2/canvases/last-canvas.js +36 -0
- package/apps/studio/client/v2/canvases/move-model.js +45 -0
- package/apps/studio/client/v2/canvases/move-sheet.jsx +91 -0
- package/apps/studio/client/v2/canvases/open-link.js +154 -0
- package/apps/studio/client/v2/canvases/panel-search.js +156 -0
- package/apps/studio/client/v2/canvases/rename-model.js +134 -0
- package/apps/studio/client/v2/canvases/row-menu.jsx +145 -0
- package/apps/studio/client/v2/canvases/row-slots.js +224 -0
- package/apps/studio/client/v2/canvases/sort.js +132 -0
- package/apps/studio/client/v2/canvases/support-model.js +68 -0
- package/apps/studio/client/v2/canvases/trash-canvas.js +120 -0
- package/apps/studio/client/v2/canvases/tree-model.js +760 -0
- package/apps/studio/client/v2/canvases/use-canvas-index.js +50 -0
- package/apps/studio/client/v2/canvases/use-canvases-sort.js +59 -0
- package/apps/studio/client/v2/canvases/use-move.js +61 -0
- package/apps/studio/client/v2/canvases/use-pins.js +80 -0
- package/apps/studio/client/v2/cloud/browser-door.js +152 -0
- package/apps/studio/client/v2/cloud/cloud-name.js +38 -0
- package/apps/studio/client/v2/code/canvas-error-card.jsx +407 -0
- package/apps/studio/client/v2/code/canvas-imports-card.jsx +31 -0
- package/apps/studio/client/v2/code/code-bus.js +63 -0
- package/apps/studio/client/v2/code/code-view.jsx +277 -0
- package/apps/studio/client/v2/code/code.css +373 -0
- package/apps/studio/client/v2/code/highlight.js +163 -0
- package/apps/studio/client/v2/code/use-canvas-source.js +338 -0
- package/apps/studio/client/v2/comments/comment-bridge.js +154 -0
- package/apps/studio/client/v2/comments/comment-client.js +84 -0
- package/apps/studio/client/v2/comments/comment-tool.js +18 -0
- package/apps/studio/client/v2/comments/comments-model.js +213 -0
- package/apps/studio/client/v2/comments/comments-panel.jsx +400 -0
- package/apps/studio/client/v2/comments/comments.css +305 -0
- package/apps/studio/client/v2/comments/mention-callouts.jsx +90 -0
- package/apps/studio/client/v2/comments/mention-model.js +118 -0
- package/apps/studio/client/v2/comments/native-mention-notice.js +73 -0
- package/apps/studio/client/v2/comments/reply-focus.js +30 -0
- package/apps/studio/client/v2/comments/use-comments-shell.jsx +176 -0
- package/apps/studio/client/v2/create/NameDialog.jsx +95 -0
- package/apps/studio/client/v2/create/NameDialogHost.jsx +141 -0
- package/apps/studio/client/v2/create/create-project.css +260 -0
- package/apps/studio/client/v2/create/duplicate-done.js +45 -0
- package/apps/studio/client/v2/create/empty-project.css +113 -0
- package/apps/studio/client/v2/create/empty-project.jsx +162 -0
- package/apps/studio/client/v2/create/first-draft.js +30 -0
- package/apps/studio/client/v2/create/intent-host.jsx +40 -0
- package/apps/studio/client/v2/create/name-dialog-bus.js +41 -0
- package/apps/studio/client/v2/create/name-dialog.css +36 -0
- package/apps/studio/client/v2/create/new-canvas.js +64 -0
- package/apps/studio/client/v2/create/open-sizes.js +41 -0
- package/apps/studio/client/v2/create/render-error.css +29 -0
- package/apps/studio/client/v2/create/render-error.jsx +107 -0
- package/apps/studio/client/v2/create/repair-offer.js +36 -0
- package/apps/studio/client/v2/create/take-intent.js +154 -0
- package/apps/studio/client/v2/create/use-project-empty.js +85 -0
- package/apps/studio/client/v2/create/use-render-error.js +116 -0
- package/apps/studio/client/v2/diagnostics/diagnostics-bus.js +47 -0
- package/apps/studio/client/v2/diagnostics/diagnostics-handlers.js +108 -0
- package/apps/studio/client/v2/diagnostics/diagnostics-host.jsx +196 -0
- package/apps/studio/client/v2/diagnostics/diagnostics-model.js +253 -0
- package/apps/studio/client/v2/diagnostics/diagnostics-sheet.jsx +557 -0
- package/apps/studio/client/v2/diagnostics/diagnostics.css +612 -0
- package/apps/studio/client/v2/diagnostics/resync-model.js +51 -0
- package/apps/studio/client/v2/diagnostics/resync-run.js +79 -0
- package/apps/studio/client/v2/diagnostics/sync-actions.js +38 -0
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +241 -0
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +392 -0
- package/apps/studio/client/v2/diagnostics/use-diagnostics-menu.js +58 -0
- package/apps/studio/client/v2/ds/advanced-bus.js +40 -0
- package/apps/studio/client/v2/ds/advanced-host.jsx +228 -0
- package/apps/studio/client/v2/ds/advanced-model.js +110 -0
- package/apps/studio/client/v2/ds/advanced-store.js +47 -0
- package/apps/studio/client/v2/ds/advanced.css +277 -0
- package/apps/studio/client/v2/ds/advanced.jsx +203 -0
- package/apps/studio/client/v2/ds/check-card.jsx +80 -0
- package/apps/studio/client/v2/ds/colour-picker.jsx +121 -0
- package/apps/studio/client/v2/ds/colour-words.js +48 -0
- package/apps/studio/client/v2/ds/conflict-pick.jsx +151 -0
- package/apps/studio/client/v2/ds/contrast-warning.jsx +80 -0
- package/apps/studio/client/v2/ds/contrast.js +137 -0
- package/apps/studio/client/v2/ds/convert-dialog.jsx +133 -0
- package/apps/studio/client/v2/ds/convert-host.jsx +143 -0
- package/apps/studio/client/v2/ds/convert-model.js +221 -0
- package/apps/studio/client/v2/ds/default-write.js +69 -0
- package/apps/studio/client/v2/ds/direction-bar.jsx +287 -0
- package/apps/studio/client/v2/ds/door-write.js +163 -0
- package/apps/studio/client/v2/ds/edge-model.js +151 -0
- package/apps/studio/client/v2/ds/edge-write.js +91 -0
- package/apps/studio/client/v2/ds/edges.css +152 -0
- package/apps/studio/client/v2/ds/follower-swap.js +88 -0
- package/apps/studio/client/v2/ds/go-to.js +71 -0
- package/apps/studio/client/v2/ds/kinds/master.jsx +214 -0
- package/apps/studio/client/v2/ds/kinds/token.jsx +546 -0
- package/apps/studio/client/v2/ds/library-bus.js +43 -0
- package/apps/studio/client/v2/ds/library-card.jsx +379 -0
- package/apps/studio/client/v2/ds/library-host.jsx +436 -0
- package/apps/studio/client/v2/ds/library-model.js +305 -0
- package/apps/studio/client/v2/ds/library-store.js +45 -0
- package/apps/studio/client/v2/ds/library.css +148 -0
- package/apps/studio/client/v2/ds/make-host.jsx +244 -0
- package/apps/studio/client/v2/ds/make-model.js +208 -0
- package/apps/studio/client/v2/ds/make-sheet.jsx +264 -0
- package/apps/studio/client/v2/ds/make-write.js +90 -0
- package/apps/studio/client/v2/ds/make.css +242 -0
- package/apps/studio/client/v2/ds/master-write.js +145 -0
- package/apps/studio/client/v2/ds/new-canvas-default.js +89 -0
- package/apps/studio/client/v2/ds/off-system-host.jsx +107 -0
- package/apps/studio/client/v2/ds/off-system.jsx +101 -0
- package/apps/studio/client/v2/ds/outside-banner.jsx +153 -0
- package/apps/studio/client/v2/ds/pinned-rows.js +138 -0
- package/apps/studio/client/v2/ds/pins.js +102 -0
- package/apps/studio/client/v2/ds/preview-bar.jsx +220 -0
- package/apps/studio/client/v2/ds/preview-doors.js +47 -0
- package/apps/studio/client/v2/ds/preview-mode.js +163 -0
- package/apps/studio/client/v2/ds/reach-data.js +68 -0
- package/apps/studio/client/v2/ds/reach-model.js +184 -0
- package/apps/studio/client/v2/ds/reach-view.jsx +577 -0
- package/apps/studio/client/v2/ds/reach.css +298 -0
- package/apps/studio/client/v2/ds/rename-write.js +88 -0
- package/apps/studio/client/v2/ds/review-bus.js +41 -0
- package/apps/studio/client/v2/ds/review-host.jsx +438 -0
- package/apps/studio/client/v2/ds/review-model.js +307 -0
- package/apps/studio/client/v2/ds/review-sheet.jsx +390 -0
- package/apps/studio/client/v2/ds/review.css +894 -0
- package/apps/studio/client/v2/ds/row-dots.js +41 -0
- package/apps/studio/client/v2/ds/switch-bus.js +56 -0
- package/apps/studio/client/v2/ds/switch-host.jsx +241 -0
- package/apps/studio/client/v2/ds/switch-model.js +254 -0
- package/apps/studio/client/v2/ds/switch-sheet.jsx +364 -0
- package/apps/studio/client/v2/ds/switch.css +263 -0
- package/apps/studio/client/v2/ds/system-menu.jsx +81 -0
- package/apps/studio/client/v2/ds/system-rename.jsx +102 -0
- package/apps/studio/client/v2/ds/token-write.js +241 -0
- package/apps/studio/client/v2/ds/token.css +185 -0
- package/apps/studio/client/v2/ds/trash-token-sheet.jsx +112 -0
- package/apps/studio/client/v2/ds/truth-card.jsx +85 -0
- package/apps/studio/client/v2/ds/truth-host.jsx +239 -0
- package/apps/studio/client/v2/ds/truth-model.js +315 -0
- package/apps/studio/client/v2/ds/truth-store.js +45 -0
- package/apps/studio/client/v2/ds/truth.css +143 -0
- package/apps/studio/client/v2/ds/update-available.jsx +261 -0
- package/apps/studio/client/v2/ds/update-dots.js +103 -0
- package/apps/studio/client/v2/ds/update-model.js +295 -0
- package/apps/studio/client/v2/ds/upgrade-bus.js +40 -0
- package/apps/studio/client/v2/ds/upgrade-host.jsx +185 -0
- package/apps/studio/client/v2/ds/upgrade-model.js +266 -0
- package/apps/studio/client/v2/ds/upgrade-offers.js +34 -0
- package/apps/studio/client/v2/ds/upgrade-sheet.jsx +277 -0
- package/apps/studio/client/v2/ds/upgrade.css +166 -0
- package/apps/studio/client/v2/ds/use-covers.js +27 -0
- package/apps/studio/client/v2/ds/use-ds-frames.js +165 -0
- package/apps/studio/client/v2/ds/use-ds-model.js +61 -0
- package/apps/studio/client/v2/ds/use-ds-search.js +61 -0
- package/apps/studio/client/v2/ds/use-ds-state.js +65 -0
- package/apps/studio/client/v2/ds/uses-link.jsx +58 -0
- package/apps/studio/client/v2/empty/all-trashed-model.js +321 -0
- package/apps/studio/client/v2/empty/all-trashed-relay.js +65 -0
- package/apps/studio/client/v2/empty/all-trashed.jsx +229 -0
- package/apps/studio/client/v2/empty/arriving.jsx +180 -0
- package/apps/studio/client/v2/empty/artboard-hint.jsx +47 -0
- package/apps/studio/client/v2/empty/ask-button.jsx +35 -0
- package/apps/studio/client/v2/empty/confetti.jsx +46 -0
- package/apps/studio/client/v2/empty/empty-canvas.jsx +96 -0
- package/apps/studio/client/v2/empty/empty-copy.js +265 -0
- package/apps/studio/client/v2/empty/empty-hint-store.js +31 -0
- package/apps/studio/client/v2/empty/empty-host.jsx +168 -0
- package/apps/studio/client/v2/empty/empty.css +440 -0
- package/apps/studio/client/v2/empty/empty.jsx +162 -0
- package/apps/studio/client/v2/empty/fill-ask.js +22 -0
- package/apps/studio/client/v2/empty/free-centre.js +11 -0
- package/apps/studio/client/v2/empty/index.js +40 -0
- package/apps/studio/client/v2/empty/layers-empty.jsx +22 -0
- package/apps/studio/client/v2/empty/not-local.jsx +111 -0
- package/apps/studio/client/v2/empty/select-new-artboard.js +32 -0
- package/apps/studio/client/v2/empty/skeleton.jsx +51 -0
- package/apps/studio/client/v2/empty/spot-art.jsx +923 -0
- package/apps/studio/client/v2/empty/spot.jsx +96 -0
- package/apps/studio/client/v2/empty/suggestions.jsx +18 -0
- package/apps/studio/client/v2/empty/use-empty-canvas.js +251 -0
- package/apps/studio/client/v2/export/access-line.jsx +48 -0
- package/apps/studio/client/v2/export/advanced/advanced-copy.js +77 -0
- package/apps/studio/client/v2/export/advanced/advanced.css +252 -0
- package/apps/studio/client/v2/export/advanced/advanced.jsx +148 -0
- package/apps/studio/client/v2/export/advanced/command.js +128 -0
- package/apps/studio/client/v2/export/advanced/command.jsx +50 -0
- package/apps/studio/client/v2/export/advanced/fields.jsx +132 -0
- package/apps/studio/client/v2/export/advanced/image.jsx +124 -0
- package/apps/studio/client/v2/export/advanced/model.js +199 -0
- package/apps/studio/client/v2/export/advanced/names.jsx +65 -0
- package/apps/studio/client/v2/export/advanced/print.jsx +99 -0
- package/apps/studio/client/v2/export/advanced/render.jsx +63 -0
- package/apps/studio/client/v2/export/advanced/video.jsx +76 -0
- package/apps/studio/client/v2/export/annotations-policy.js +28 -0
- package/apps/studio/client/v2/export/cloud-queue.js +69 -0
- package/apps/studio/client/v2/export/copy-command.js +72 -0
- package/apps/studio/client/v2/export/copy-png.js +144 -0
- package/apps/studio/client/v2/export/done-toast.jsx +89 -0
- package/apps/studio/client/v2/export/edges.css +74 -0
- package/apps/studio/client/v2/export/export-copy.js +352 -0
- package/apps/studio/client/v2/export/export-sheet.jsx +804 -0
- package/apps/studio/client/v2/export/export-sizes.js +217 -0
- package/apps/studio/client/v2/export/export.css +832 -0
- package/apps/studio/client/v2/export/exports-model.js +383 -0
- package/apps/studio/client/v2/export/exports-panel.css +192 -0
- package/apps/studio/client/v2/export/exports-panel.jsx +164 -0
- package/apps/studio/client/v2/export/file-rows.jsx +84 -0
- package/apps/studio/client/v2/export/inspector-export.jsx +335 -0
- package/apps/studio/client/v2/export/job-row.jsx +358 -0
- package/apps/studio/client/v2/export/last-finished.js +34 -0
- package/apps/studio/client/v2/export/native-save.js +160 -0
- package/apps/studio/client/v2/export/other-formats.jsx +199 -0
- package/apps/studio/client/v2/export/parts.jsx +117 -0
- package/apps/studio/client/v2/export/preflight/fonts.js +27 -0
- package/apps/studio/client/v2/export/preflight/paper.jsx +177 -0
- package/apps/studio/client/v2/export/preflight/safe-margin.js +24 -0
- package/apps/studio/client/v2/export/preflight/use-preflight.js +74 -0
- package/apps/studio/client/v2/export/preview.jsx +79 -0
- package/apps/studio/client/v2/export/print.css +219 -0
- package/apps/studio/client/v2/export/run-export.js +177 -0
- package/apps/studio/client/v2/export/scope-bar.jsx +70 -0
- package/apps/studio/client/v2/export/sections/batch-model.js +224 -0
- package/apps/studio/client/v2/export/sections/batch.jsx +235 -0
- package/apps/studio/client/v2/export/sections/image.jsx +93 -0
- package/apps/studio/client/v2/export/sections/print-copy.js +41 -0
- package/apps/studio/client/v2/export/sections/print.jsx +285 -0
- package/apps/studio/client/v2/export/sections/render-row.jsx +81 -0
- package/apps/studio/client/v2/export/sections/version.jsx +176 -0
- package/apps/studio/client/v2/export/sections/video-copy.js +92 -0
- package/apps/studio/client/v2/export/sections/video-model.js +127 -0
- package/apps/studio/client/v2/export/sections/video.jsx +397 -0
- package/apps/studio/client/v2/export/sections/web.jsx +151 -0
- package/apps/studio/client/v2/export/share-hint.jsx +51 -0
- package/apps/studio/client/v2/export/use-export-spec.js +546 -0
- package/apps/studio/client/v2/export/video-content.js +75 -0
- package/apps/studio/client/v2/export/video.css +221 -0
- package/apps/studio/client/v2/fold/advanced-fold.jsx +96 -0
- package/apps/studio/client/v2/fold/fold-store.js +151 -0
- package/apps/studio/client/v2/fold/fold.css +59 -0
- package/apps/studio/client/v2/fold/use-fold.js +36 -0
- package/apps/studio/client/v2/handoff/edges.jsx +74 -0
- package/apps/studio/client/v2/handoff/handoff-sheet.jsx +469 -0
- package/apps/studio/client/v2/handoff/handoff.css +181 -0
- package/apps/studio/client/v2/handoff/ready-card.jsx +84 -0
- package/apps/studio/client/v2/handoff/targets.js +111 -0
- package/apps/studio/client/v2/help/add-guides.js +43 -0
- package/apps/studio/client/v2/help/help.css +995 -0
- package/apps/studio/client/v2/history/blame.js +161 -0
- package/apps/studio/client/v2/history/branch-actions.js +214 -0
- package/apps/studio/client/v2/history/change-list.jsx +102 -0
- package/apps/studio/client/v2/history/clear-band.js +144 -0
- package/apps/studio/client/v2/history/compare-store.js +80 -0
- package/apps/studio/client/v2/history/compare-view.jsx +318 -0
- package/apps/studio/client/v2/history/compare-words.js +8 -0
- package/apps/studio/client/v2/history/git-advanced.jsx +580 -0
- package/apps/studio/client/v2/history/git-io.js +58 -0
- package/apps/studio/client/v2/history/git-model.js +526 -0
- package/apps/studio/client/v2/history/git-parts.jsx +662 -0
- package/apps/studio/client/v2/history/history-host.jsx +78 -0
- package/apps/studio/client/v2/history/history-panel.jsx +599 -0
- package/apps/studio/client/v2/history/history.css +1477 -0
- package/apps/studio/client/v2/history/name-dialog.jsx +109 -0
- package/apps/studio/client/v2/history/object-filter.js +143 -0
- package/apps/studio/client/v2/history/object-history-ask.js +62 -0
- package/apps/studio/client/v2/history/object-view.jsx +236 -0
- package/apps/studio/client/v2/history/rows.ts +445 -0
- package/apps/studio/client/v2/history/use-versions.js +391 -0
- package/apps/studio/client/v2/history/view-bar.jsx +80 -0
- package/apps/studio/client/v2/import/brand-model.js +145 -0
- package/apps/studio/client/v2/import/brand-result.jsx +197 -0
- package/apps/studio/client/v2/import/brand-sheet.jsx +434 -0
- package/apps/studio/client/v2/import/brand.css +378 -0
- package/apps/studio/client/v2/import/figma-artboard.jsx +121 -0
- package/apps/studio/client/v2/import/figma-model.js +237 -0
- package/apps/studio/client/v2/import/figma-prefill.js +23 -0
- package/apps/studio/client/v2/import/figma-sheet.jsx +525 -0
- package/apps/studio/client/v2/import/figma-summary.jsx +62 -0
- package/apps/studio/client/v2/import/figma.css +179 -0
- package/apps/studio/client/v2/import/frame-picker.jsx +57 -0
- package/apps/studio/client/v2/inspect/inspect-host.jsx +53 -0
- package/apps/studio/client/v2/inspect/inspect-model.js +132 -0
- package/apps/studio/client/v2/inspect/inspect-panel.jsx +214 -0
- package/apps/studio/client/v2/inspect/inspect.css +87 -0
- package/apps/studio/client/v2/inspector/advanced-rows-default.jsx +773 -0
- package/apps/studio/client/v2/inspector/advanced-rows.js +106 -0
- package/apps/studio/client/v2/inspector/advanced.jsx +286 -0
- package/apps/studio/client/v2/inspector/blocks.js +57 -0
- package/apps/studio/client/v2/inspector/colour-groups.js +129 -0
- package/apps/studio/client/v2/inspector/component-picker.css +133 -0
- package/apps/studio/client/v2/inspector/component-picker.jsx +367 -0
- package/apps/studio/client/v2/inspector/crumbs.jsx +89 -0
- package/apps/studio/client/v2/inspector/css-text.js +179 -0
- package/apps/studio/client/v2/inspector/css-write.js +204 -0
- package/apps/studio/client/v2/inspector/element-code.js +39 -0
- package/apps/studio/client/v2/inspector/element-id.js +70 -0
- package/apps/studio/client/v2/inspector/formats-ui.js +101 -0
- package/apps/studio/client/v2/inspector/formats-write.js +60 -0
- package/apps/studio/client/v2/inspector/frame.jsx +336 -0
- package/apps/studio/client/v2/inspector/inspector-actions.js +60 -0
- package/apps/studio/client/v2/inspector/inspector.css +2872 -0
- package/apps/studio/client/v2/inspector/jsx-slice.js +219 -0
- package/apps/studio/client/v2/inspector/kinds/add-width.js +55 -0
- package/apps/studio/client/v2/inspector/kinds/artboard-advanced-rows.jsx +89 -0
- package/apps/studio/client/v2/inspector/kinds/artboard-advanced.jsx +62 -0
- package/apps/studio/client/v2/inspector/kinds/artboard-fixed.jsx +111 -0
- package/apps/studio/client/v2/inspector/kinds/artboard-kinds-model.js +171 -0
- package/apps/studio/client/v2/inspector/kinds/artboard-model.js +155 -0
- package/apps/studio/client/v2/inspector/kinds/artboard-multi.jsx +142 -0
- package/apps/studio/client/v2/inspector/kinds/artboard-print-advanced.jsx +210 -0
- package/apps/studio/client/v2/inspector/kinds/artboard-print-model.js +112 -0
- package/apps/studio/client/v2/inspector/kinds/artboard-print.jsx +268 -0
- package/apps/studio/client/v2/inspector/kinds/artboard-rows.jsx +124 -0
- package/apps/studio/client/v2/inspector/kinds/artboard-video.jsx +144 -0
- package/apps/studio/client/v2/inspector/kinds/artboard-web.jsx +170 -0
- package/apps/studio/client/v2/inspector/kinds/artboard.jsx +168 -0
- package/apps/studio/client/v2/inspector/kinds/caption.jsx +203 -0
- package/apps/studio/client/v2/inspector/kinds/clip-model.js +190 -0
- package/apps/studio/client/v2/inspector/kinds/clip.css +157 -0
- package/apps/studio/client/v2/inspector/kinds/clip.jsx +447 -0
- package/apps/studio/client/v2/inspector/kinds/frame.jsx +118 -0
- package/apps/studio/client/v2/inspector/kinds/image.jsx +267 -0
- package/apps/studio/client/v2/inspector/kinds/index.js +180 -0
- package/apps/studio/client/v2/inspector/kinds/instance.jsx +377 -0
- package/apps/studio/client/v2/inspector/kinds/multi-artboard.jsx +129 -0
- package/apps/studio/client/v2/inspector/kinds/multi.jsx +220 -0
- package/apps/studio/client/v2/inspector/kinds/music.jsx +294 -0
- package/apps/studio/client/v2/inspector/kinds/path.jsx +174 -0
- package/apps/studio/client/v2/inspector/kinds/shape.jsx +59 -0
- package/apps/studio/client/v2/inspector/kinds/text.jsx +518 -0
- package/apps/studio/client/v2/inspector/kinds/title-rows.jsx +135 -0
- package/apps/studio/client/v2/inspector/kinds/video-facts.js +142 -0
- package/apps/studio/client/v2/inspector/layers-row-tools.jsx +93 -0
- package/apps/studio/client/v2/inspector/layers-slot.jsx +93 -0
- package/apps/studio/client/v2/inspector/link-write.js +52 -0
- package/apps/studio/client/v2/inspector/live-size.js +96 -0
- package/apps/studio/client/v2/inspector/model.js +228 -0
- package/apps/studio/client/v2/inspector/path-point.js +104 -0
- package/apps/studio/client/v2/inspector/print-write.js +85 -0
- package/apps/studio/client/v2/inspector/safe-zones-write.js +88 -0
- package/apps/studio/client/v2/inspector/sections/add-requests.js +35 -0
- package/apps/studio/client/v2/inspector/sections/border.jsx +141 -0
- package/apps/studio/client/v2/inspector/sections/color-control.jsx +246 -0
- package/apps/studio/client/v2/inspector/sections/colour-custom.jsx +826 -0
- package/apps/studio/client/v2/inspector/sections/colour-model.js +404 -0
- package/apps/studio/client/v2/inspector/sections/colour-popover.jsx +631 -0
- package/apps/studio/client/v2/inspector/sections/colour-words.js +131 -0
- package/apps/studio/client/v2/inspector/sections/corners.jsx +177 -0
- package/apps/studio/client/v2/inspector/sections/effects.jsx +67 -0
- package/apps/studio/client/v2/inspector/sections/export-slot.jsx +60 -0
- package/apps/studio/client/v2/inspector/sections/fill.jsx +187 -0
- package/apps/studio/client/v2/inspector/sections/formats.jsx +209 -0
- package/apps/studio/client/v2/inspector/sections/index.js +74 -0
- package/apps/studio/client/v2/inspector/sections/interaction.jsx +204 -0
- package/apps/studio/client/v2/inspector/sections/layout.jsx +314 -0
- package/apps/studio/client/v2/inspector/sections/opacity-row.jsx +37 -0
- package/apps/studio/client/v2/inspector/sections/point.jsx +102 -0
- package/apps/studio/client/v2/inspector/sections/position.jsx +259 -0
- package/apps/studio/client/v2/inspector/sections/recent-colours.js +106 -0
- package/apps/studio/client/v2/inspector/sections/row.jsx +91 -0
- package/apps/studio/client/v2/inspector/sections/safe-zones.jsx +174 -0
- package/apps/studio/client/v2/inspector/sections/sections.css +1474 -0
- package/apps/studio/client/v2/inspector/sections/size.jsx +104 -0
- package/apps/studio/client/v2/inspector/sections/type.jsx +168 -0
- package/apps/studio/client/v2/inspector/sections/warnings.css +44 -0
- package/apps/studio/client/v2/inspector/sections/warnings.jsx +137 -0
- package/apps/studio/client/v2/inspector/sections.js +226 -0
- package/apps/studio/client/v2/inspector/slots.js +110 -0
- package/apps/studio/client/v2/inspector/token-chip.jsx +315 -0
- package/apps/studio/client/v2/inspector/view-mode.jsx +193 -0
- package/apps/studio/client/v2/inspector/warning-fix.js +111 -0
- package/apps/studio/client/v2/kinds/ConvertDialog.jsx +183 -0
- package/apps/studio/client/v2/kinds/KindChips.jsx +60 -0
- package/apps/studio/client/v2/kinds/KindDimHost.jsx +35 -0
- package/apps/studio/client/v2/kinds/LayersKindFilter.jsx +108 -0
- package/apps/studio/client/v2/kinds/SizePicker.jsx +566 -0
- package/apps/studio/client/v2/kinds/SizePickerHost.jsx +104 -0
- package/apps/studio/client/v2/kinds/advanced-rows.js +40 -0
- package/apps/studio/client/v2/kinds/convert-api.js +116 -0
- package/apps/studio/client/v2/kinds/convert.css +87 -0
- package/apps/studio/client/v2/kinds/kind-dim-relay.js +93 -0
- package/apps/studio/client/v2/kinds/kind-filter-model.js +106 -0
- package/apps/studio/client/v2/kinds/kind-filter-store.js +71 -0
- package/apps/studio/client/v2/kinds/kind-filter.css +105 -0
- package/apps/studio/client/v2/kinds/layers-kind-model.js +99 -0
- package/apps/studio/client/v2/kinds/size-picker-model.js +189 -0
- package/apps/studio/client/v2/kinds/size-picker.css +393 -0
- package/apps/studio/client/v2/layers/artboard-layers.jsx +105 -0
- package/apps/studio/client/v2/layers/layers.css +94 -0
- package/apps/studio/client/v2/left-panel/advanced-model.js +98 -0
- package/apps/studio/client/v2/left-panel/assets-panel.jsx +1203 -0
- package/apps/studio/client/v2/left-panel/canvas-file-menu.js +115 -0
- package/apps/studio/client/v2/left-panel/canvases-advanced.jsx +270 -0
- package/apps/studio/client/v2/left-panel/canvases-pinned.jsx +274 -0
- package/apps/studio/client/v2/left-panel/layers-advanced.jsx +179 -0
- package/apps/studio/client/v2/left-panel/left-panel-bus.js +83 -0
- package/apps/studio/client/v2/left-panel/left-panel-model.js +184 -0
- package/apps/studio/client/v2/left-panel/left-panel.css +1846 -0
- package/apps/studio/client/v2/left-panel/selector-scope.js +42 -0
- package/apps/studio/client/v2/left-panel/trash-model.js +282 -0
- package/apps/studio/client/v2/left-panel/trash-view.jsx +257 -0
- package/apps/studio/client/v2/left-panel/use-trash.js +172 -0
- package/apps/studio/client/v2/left-panel/view-prefs.js +84 -0
- package/apps/studio/client/v2/onboarding/AdvSheet.jsx +114 -0
- package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +239 -0
- package/apps/studio/client/v2/onboarding/CliSheet.jsx +101 -0
- package/apps/studio/client/v2/onboarding/ConnectAiSheet.jsx +60 -0
- package/apps/studio/client/v2/onboarding/FigmaSheet.jsx +96 -0
- package/apps/studio/client/v2/onboarding/FolderGithubSheet.jsx +77 -0
- package/apps/studio/client/v2/onboarding/GithubSegment.jsx +241 -0
- package/apps/studio/client/v2/onboarding/HubSheet.jsx +244 -0
- package/apps/studio/client/v2/onboarding/connect-ai-home.js +94 -0
- package/apps/studio/client/v2/onboarding/github-home.js +84 -0
- package/apps/studio/client/v2/onboarding/onboarding-model.js +106 -0
- package/apps/studio/client/v2/onboarding/onboarding.css +546 -0
- package/apps/studio/client/v2/photo/apply-every-use-sheet.jsx +196 -0
- package/apps/studio/client/v2/photo/canvas-rel.js +20 -0
- package/apps/studio/client/v2/photo/looks.js +129 -0
- package/apps/studio/client/v2/photo/photo-section.jsx +625 -0
- package/apps/studio/client/v2/photo/photo.css +218 -0
- package/apps/studio/client/v2/portal-scope.jsx +14 -0
- package/apps/studio/client/v2/presence/faces.jsx +356 -0
- package/apps/studio/client/v2/presence/presence.css +187 -0
- package/apps/studio/client/v2/presence/use-presence-host.js +83 -0
- package/apps/studio/client/v2/present/audience-window.js +63 -0
- package/apps/studio/client/v2/present/canvas-pill.jsx +55 -0
- package/apps/studio/client/v2/present/copy-link.js +82 -0
- package/apps/studio/client/v2/present/follow-location.js +82 -0
- package/apps/studio/client/v2/present/follow-model.js +68 -0
- package/apps/studio/client/v2/present/follow-view.jsx +354 -0
- package/apps/studio/client/v2/present/follow.css +91 -0
- package/apps/studio/client/v2/present/order-map.jsx +64 -0
- package/apps/studio/client/v2/present/order-notes-artboards.js +88 -0
- package/apps/studio/client/v2/present/order-notes-model.js +141 -0
- package/apps/studio/client/v2/present/order-notes-mount.jsx +26 -0
- package/apps/studio/client/v2/present/order-notes-sheet.jsx +293 -0
- package/apps/studio/client/v2/present/order-notes.css +150 -0
- package/apps/studio/client/v2/present/present-chrome-host.jsx +95 -0
- package/apps/studio/client/v2/present/present-controls-model.js +114 -0
- package/apps/studio/client/v2/present/present-controls.jsx +263 -0
- package/apps/studio/client/v2/present/present-zoom-store.js +33 -0
- package/apps/studio/client/v2/present/present.css +258 -0
- package/apps/studio/client/v2/present/presenter-button.jsx +25 -0
- package/apps/studio/client/v2/present/presenter-host.jsx +246 -0
- package/apps/studio/client/v2/present/presenter-model.js +167 -0
- package/apps/studio/client/v2/present/presenter-store.js +140 -0
- package/apps/studio/client/v2/present/presenter-view.css +298 -0
- package/apps/studio/client/v2/present/presenter-view.jsx +241 -0
- package/apps/studio/client/v2/present/video-present-model.js +92 -0
- package/apps/studio/client/v2/present/video-present.css +164 -0
- package/apps/studio/client/v2/present/video-present.jsx +331 -0
- package/apps/studio/client/v2/preview/external-link-confirm.jsx +245 -0
- package/apps/studio/client/v2/preview/link-follow.js +109 -0
- package/apps/studio/client/v2/preview/open-in-app.jsx +46 -0
- package/apps/studio/client/v2/preview/preview-back.js +21 -0
- package/apps/studio/client/v2/preview/preview-bar.jsx +86 -0
- package/apps/studio/client/v2/preview/preview-chrome-host.jsx +234 -0
- package/apps/studio/client/v2/preview/preview-history.js +61 -0
- package/apps/studio/client/v2/preview/preview.css +262 -0
- package/apps/studio/client/v2/preview/zoom-only.jsx +58 -0
- package/apps/studio/client/v2/search/help-model.js +275 -0
- package/apps/studio/client/v2/search/moved-keys.js +74 -0
- package/apps/studio/client/v2/search/palette-icons.js +45 -0
- package/apps/studio/client/v2/search/search-ds.js +142 -0
- package/apps/studio/client/v2/search/search-env.js +110 -0
- package/apps/studio/client/v2/search/search-keywords.js +162 -0
- package/apps/studio/client/v2/search/search-model.js +623 -0
- package/apps/studio/client/v2/search/search-projects.js +214 -0
- package/apps/studio/client/v2/search/search-recent.js +94 -0
- package/apps/studio/client/v2/search/search-remote.js +30 -0
- package/apps/studio/client/v2/search/search.css +519 -0
- package/apps/studio/client/v2/settings/account.jsx +164 -0
- package/apps/studio/client/v2/settings/advanced-prefs.js +91 -0
- package/apps/studio/client/v2/settings/advanced-section.jsx +308 -0
- package/apps/studio/client/v2/settings/connection-row.jsx +79 -0
- package/apps/studio/client/v2/settings/connections-model.js +138 -0
- package/apps/studio/client/v2/settings/connections-section.jsx +663 -0
- package/apps/studio/client/v2/settings/general-section.jsx +155 -0
- package/apps/studio/client/v2/settings/parts.jsx +48 -0
- package/apps/studio/client/v2/settings/prefs-migrate.js +141 -0
- package/apps/studio/client/v2/settings/project-sync-settings.jsx +255 -0
- package/apps/studio/client/v2/settings/reset-section.jsx +164 -0
- package/apps/studio/client/v2/settings/settings-handlers.js +46 -0
- package/apps/studio/client/v2/settings/settings-model.js +523 -0
- package/apps/studio/client/v2/settings/settings-sheet.jsx +204 -0
- package/apps/studio/client/v2/settings/settings.css +975 -0
- package/apps/studio/client/v2/settings/theme-auto.js +75 -0
- package/apps/studio/client/v2/settings/use-advanced-prefs.js +32 -0
- package/apps/studio/client/v2/settings/use-connections.js +485 -0
- package/apps/studio/client/v2/share/glyphs.jsx +92 -0
- package/apps/studio/client/v2/share/invite-row.jsx +68 -0
- package/apps/studio/client/v2/share/link-dialog.js +53 -0
- package/apps/studio/client/v2/share/link-row.jsx +38 -0
- package/apps/studio/client/v2/share/move-to-cloud.jsx +88 -0
- package/apps/studio/client/v2/share/people-list.jsx +151 -0
- package/apps/studio/client/v2/share/person.jsx +26 -0
- package/apps/studio/client/v2/share/role-menu.jsx +145 -0
- package/apps/studio/client/v2/share/share-advanced.jsx +411 -0
- package/apps/studio/client/v2/share/share-model.js +469 -0
- package/apps/studio/client/v2/share/share-sheet.jsx +602 -0
- package/apps/studio/client/v2/share/share.css +828 -0
- package/apps/studio/client/v2/shell/account-card-model.js +114 -0
- package/apps/studio/client/v2/shell/account-card.jsx +177 -0
- package/apps/studio/client/v2/shell/annotation-prefs-store.js +105 -0
- package/apps/studio/client/v2/shell/ask-to-edit.js +33 -0
- package/apps/studio/client/v2/shell/callouts-host.jsx +151 -0
- package/apps/studio/client/v2/shell/callouts-model.js +358 -0
- package/apps/studio/client/v2/shell/callouts.css +164 -0
- package/apps/studio/client/v2/shell/callouts.jsx +162 -0
- package/apps/studio/client/v2/shell/canvas-mode.js +393 -0
- package/apps/studio/client/v2/shell/contrast.css +37 -0
- package/apps/studio/client/v2/shell/corner-icons.jsx +153 -0
- package/apps/studio/client/v2/shell/dock-rail-homes.js +106 -0
- package/apps/studio/client/v2/shell/f6-cycle.js +124 -0
- package/apps/studio/client/v2/shell/floating-panels.css +2858 -0
- package/apps/studio/client/v2/shell/fold-ghost.js +70 -0
- package/apps/studio/client/v2/shell/format-update.css +43 -0
- package/apps/studio/client/v2/shell/format-update.js +487 -0
- package/apps/studio/client/v2/shell/format-update.jsx +479 -0
- package/apps/studio/client/v2/shell/held-conflict.js +51 -0
- package/apps/studio/client/v2/shell/image-pick.js +140 -0
- package/apps/studio/client/v2/shell/insets-now.js +35 -0
- package/apps/studio/client/v2/shell/inspector-follow.js +113 -0
- package/apps/studio/client/v2/shell/menu-runner.js +711 -0
- package/apps/studio/client/v2/shell/modal-focus.js +259 -0
- package/apps/studio/client/v2/shell/mode-switch.jsx +418 -0
- package/apps/studio/client/v2/shell/native-doors.js +121 -0
- package/apps/studio/client/v2/shell/occlusion-insets.js +116 -0
- package/apps/studio/client/v2/shell/panel-availability.js +27 -0
- package/apps/studio/client/v2/shell/panel-layout.js +144 -0
- package/apps/studio/client/v2/shell/panel-sizes.js +150 -0
- package/apps/studio/client/v2/shell/paste-forward.js +43 -0
- package/apps/studio/client/v2/shell/present-from-label.js +19 -0
- package/apps/studio/client/v2/shell/project-menu-model.js +216 -0
- package/apps/studio/client/v2/shell/project-pill.css +214 -0
- package/apps/studio/client/v2/shell/project-pill.jsx +456 -0
- package/apps/studio/client/v2/shell/recovery-store.js +139 -0
- package/apps/studio/client/v2/shell/role-denial.js +73 -0
- package/apps/studio/client/v2/shell/role-gate.js +29 -0
- package/apps/studio/client/v2/shell/save-hold-notice.js +69 -0
- package/apps/studio/client/v2/shell/save-status.js +191 -0
- package/apps/studio/client/v2/shell/scroll-lock.js +49 -0
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +389 -0
- package/apps/studio/client/v2/shell/share-cluster.css +608 -0
- package/apps/studio/client/v2/shell/share-cluster.jsx +255 -0
- package/apps/studio/client/v2/shell/shell-error-boundary.jsx +81 -0
- package/apps/studio/client/v2/shell/shell-panels-relay.js +95 -0
- package/apps/studio/client/v2/shell/shell-parity.js +457 -0
- package/apps/studio/client/v2/shell/shell-parity.json +2106 -0
- package/apps/studio/client/v2/shell/single-keys-store.js +49 -0
- package/apps/studio/client/v2/shell/tool-panels.css +39 -0
- package/apps/studio/client/v2/shell/tool-panels.js +156 -0
- package/apps/studio/client/v2/shell/use-account.js +59 -0
- package/apps/studio/client/v2/shell/use-annotation-prefs.js +77 -0
- package/apps/studio/client/v2/shell/use-canvas-mode-lane.js +388 -0
- package/apps/studio/client/v2/shell/use-dismiss-outside.js +35 -0
- package/apps/studio/client/v2/shell/use-fit-on-ai-pin.js +42 -0
- package/apps/studio/client/v2/shell/use-fit-while-ai-drafts.js +37 -0
- package/apps/studio/client/v2/shell/use-occluded-insets.js +107 -0
- package/apps/studio/client/v2/shell/use-panel-layout.js +45 -0
- package/apps/studio/client/v2/shell/use-single-keys.js +56 -0
- package/apps/studio/client/v2/shell/use-tool-panels.js +205 -0
- package/apps/studio/client/v2/signin/CreateLocalSheet.jsx +155 -0
- package/apps/studio/client/v2/signin/SignInCard.jsx +284 -0
- package/apps/studio/client/v2/signin/SignInToast.jsx +22 -0
- package/apps/studio/client/v2/signin/WhatsNewLine.jsx +64 -0
- package/apps/studio/client/v2/signin/advanced-rows.js +40 -0
- package/apps/studio/client/v2/signin/signin-model.js +138 -0
- package/apps/studio/client/v2/signin/signin.css +484 -0
- package/apps/studio/client/v2/signin/use-signin.js +209 -0
- package/apps/studio/client/v2/signin/use-whats-new-line.js +94 -0
- package/apps/studio/client/v2/sync-states/back-online.jsx +61 -0
- package/apps/studio/client/v2/sync-states/conflict-card.jsx +326 -0
- package/apps/studio/client/v2/sync-states/offline-foot.jsx +79 -0
- package/apps/studio/client/v2/sync-states/row-words.js +83 -0
- package/apps/studio/client/v2/sync-states/sync-states-model.js +264 -0
- package/apps/studio/client/v2/sync-states/sync-states.css +232 -0
- package/apps/studio/client/v2/timeline/Timeline.jsx +3194 -0
- package/apps/studio/client/v2/timeline/TimelineHost.jsx +360 -0
- package/apps/studio/client/v2/timeline/advanced/actions.js +27 -0
- package/apps/studio/client/v2/timeline/advanced/advanced-store.js +116 -0
- package/apps/studio/client/v2/timeline/advanced/advanced.css +323 -0
- package/apps/studio/client/v2/timeline/advanced/cut-as-code.jsx +127 -0
- package/apps/studio/client/v2/timeline/advanced/easing-curve.jsx +200 -0
- package/apps/studio/client/v2/timeline/advanced/foot.jsx +210 -0
- package/apps/studio/client/v2/timeline/advanced/model.js +121 -0
- package/apps/studio/client/v2/timeline/advanced/render-settings.jsx +62 -0
- package/apps/studio/client/v2/timeline/advanced/video-cap.js +174 -0
- package/apps/studio/client/v2/timeline/ai-edge-model.js +111 -0
- package/apps/studio/client/v2/timeline/ai-edge.css +104 -0
- package/apps/studio/client/v2/timeline/ai-edge.jsx +113 -0
- package/apps/studio/client/v2/timeline/anchor-lane.js +80 -0
- package/apps/studio/client/v2/timeline/anchor.js +80 -0
- package/apps/studio/client/v2/timeline/assemble-video.js +64 -0
- package/apps/studio/client/v2/timeline/clip-search.js +88 -0
- package/apps/studio/client/v2/timeline/clip-verb.js +224 -0
- package/apps/studio/client/v2/timeline/comment-strip-host.jsx +93 -0
- package/apps/studio/client/v2/timeline/comment-strip-model.js +103 -0
- package/apps/studio/client/v2/timeline/comment-strip.jsx +82 -0
- package/apps/studio/client/v2/timeline/edit/clip-menu.js +118 -0
- package/apps/studio/client/v2/timeline/edit/clip-menu.jsx +48 -0
- package/apps/studio/client/v2/timeline/edit/drop.jsx +101 -0
- package/apps/studio/client/v2/timeline/edit/move.jsx +43 -0
- package/apps/studio/client/v2/timeline/edit/ripple.js +43 -0
- package/apps/studio/client/v2/timeline/edit/trim.jsx +52 -0
- package/apps/studio/client/v2/timeline/edit/words.js +65 -0
- package/apps/studio/client/v2/timeline/fit-fill.jsx +172 -0
- package/apps/studio/client/v2/timeline/fit-model.js +137 -0
- package/apps/studio/client/v2/timeline/fold.js +128 -0
- package/apps/studio/client/v2/timeline/footage-rows.jsx +46 -0
- package/apps/studio/client/v2/timeline/footage-state.js +135 -0
- package/apps/studio/client/v2/timeline/glyphs.jsx +118 -0
- package/apps/studio/client/v2/timeline/island-context.js +29 -0
- package/apps/studio/client/v2/timeline/island-controls.jsx +83 -0
- package/apps/studio/client/v2/timeline/island.jsx +54 -0
- package/apps/studio/client/v2/timeline/joins/join-model.js +133 -0
- package/apps/studio/client/v2/timeline/joins/joins.css +277 -0
- package/apps/studio/client/v2/timeline/joins/transition-picker.jsx +240 -0
- package/apps/studio/client/v2/timeline/keys.js +74 -0
- package/apps/studio/client/v2/timeline/lanes/caption-lane.jsx +149 -0
- package/apps/studio/client/v2/timeline/lanes/music-lane.jsx +294 -0
- package/apps/studio/client/v2/timeline/lanes/music-media.js +200 -0
- package/apps/studio/client/v2/timeline/lanes/music-model.js +190 -0
- package/apps/studio/client/v2/timeline/loop-handle.jsx +70 -0
- package/apps/studio/client/v2/timeline/marker-store.js +117 -0
- package/apps/studio/client/v2/timeline/markers.js +79 -0
- package/apps/studio/client/v2/timeline/marks.jsx +152 -0
- package/apps/studio/client/v2/timeline/music-hint.jsx +98 -0
- package/apps/studio/client/v2/timeline/other-takes-model.js +103 -0
- package/apps/studio/client/v2/timeline/other-takes-store.js +49 -0
- package/apps/studio/client/v2/timeline/other-takes.css +98 -0
- package/apps/studio/client/v2/timeline/other-takes.jsx +269 -0
- package/apps/studio/client/v2/timeline/peers.jsx +246 -0
- package/apps/studio/client/v2/timeline/playhead.js +97 -0
- package/apps/studio/client/v2/timeline/poster.js +109 -0
- package/apps/studio/client/v2/timeline/reframe-island.jsx +478 -0
- package/apps/studio/client/v2/timeline/reframe-model.js +135 -0
- package/apps/studio/client/v2/timeline/reframe.css +150 -0
- package/apps/studio/client/v2/timeline/ruler.js +61 -0
- package/apps/studio/client/v2/timeline/selection.js +110 -0
- package/apps/studio/client/v2/timeline/timeline-empty.jsx +108 -0
- package/apps/studio/client/v2/timeline/timeline-store.js +147 -0
- package/apps/studio/client/v2/timeline/timeline.css +2879 -0
- package/apps/studio/client/v2/timeline/together.css +85 -0
- package/apps/studio/client/v2/timeline/track-toggle.js +56 -0
- package/apps/studio/client/v2/timeline/tracks.js +68 -0
- package/apps/studio/client/v2/timeline/transport.js +66 -0
- package/apps/studio/client/v2/timeline/zoom.js +37 -0
- package/apps/studio/client/v2/transcript/TranscriptHost.jsx +162 -0
- package/apps/studio/client/v2/transcript/TranscriptPanel.jsx +358 -0
- package/apps/studio/client/v2/transcript/captions-api.js +297 -0
- package/apps/studio/client/v2/transcript/captions-file-flag.js +38 -0
- package/apps/studio/client/v2/transcript/comp-media-store.js +89 -0
- package/apps/studio/client/v2/transcript/transcript-model.js +240 -0
- package/apps/studio/client/v2/transcript/transcript.css +262 -0
- package/apps/studio/client/v2/undo/projection.js +291 -0
- package/apps/studio/client/v2/undo/undo-history.jsx +286 -0
- package/apps/studio/client/v2/undo/undo.css +81 -0
- package/apps/studio/client/v2/undo/use-undo-mode-lane.js +96 -0
- package/apps/studio/client/v2/undo/use-undo-projection.jsx +460 -0
- package/apps/studio/client/v2/undo/zoom-undo.jsx +79 -0
- package/apps/studio/client/whats-new-seen.js +40 -0
- package/apps/studio/client/whats-new.jsx +65 -62
- package/apps/studio/clip-ops.ts +38 -6
- package/apps/studio/cloud/config-path.ts +42 -0
- package/apps/studio/cloud/endpoints.ts +212 -50
- package/apps/studio/cloud/renew.ts +29 -16
- package/apps/studio/collab/ai-activity.ts +19 -0
- package/apps/studio/collab/awareness-bridge.ts +131 -4
- package/apps/studio/collab/git-lifecycle.ts +52 -20
- package/apps/studio/collab/holds.ts +69 -0
- package/apps/studio/collab/index.ts +25 -0
- package/apps/studio/collab/protocol.ts +64 -0
- package/apps/studio/collab/registry.ts +59 -6
- package/apps/studio/collab/room.ts +374 -16
- package/apps/studio/collab/timeline-awareness.ts +123 -0
- package/apps/studio/collab/timeline-presence.tsx +219 -0
- package/apps/studio/commands/move-artboards-command.ts +45 -4
- package/apps/studio/comments/anchors.ts +147 -0
- package/apps/studio/comments/author-face.ts +41 -0
- package/apps/studio/comments/from-line.ts +43 -0
- package/apps/studio/comments/imported-from.ts +113 -0
- package/apps/studio/comments/local-author.ts +41 -0
- package/apps/studio/comments/mentions.ts +115 -0
- package/apps/studio/comments/mine-stamp.ts +78 -0
- package/apps/studio/comments/ops.ts +293 -0
- package/apps/studio/comments/people.ts +66 -0
- package/apps/studio/comments/where.ts +136 -0
- package/apps/studio/comments-overlay.tsx +1220 -253
- package/apps/studio/config.schema.json +33 -0
- package/apps/studio/context-menu.tsx +126 -42
- package/apps/studio/context.ts +178 -13
- package/apps/studio/cursors-overlay.tsx +28 -11
- package/apps/studio/debug-bundle.ts +21 -5
- package/apps/studio/describe/batch.ts +414 -0
- package/apps/studio/describe/budget.ts +147 -0
- package/apps/studio/describe/claude.ts +273 -0
- package/apps/studio/describe/consent.ts +120 -0
- package/apps/studio/describe/validate.ts +192 -0
- package/apps/studio/design-setup-readiness.ts +2 -2
- package/apps/studio/diagnostics/store.ts +220 -0
- package/apps/studio/dist/client.bundle.js +2429 -2329
- package/apps/studio/dist/comment-mount.js +12 -9
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/dom-selection.ts +239 -23
- package/apps/studio/drag-bus.ts +211 -0
- package/apps/studio/draw/serialize-animate.ts +4 -4
- package/apps/studio/ds/board/board-specimen.css +199 -0
- package/apps/studio/ds/board/board.css +674 -0
- package/apps/studio/ds/board/brand-notes.ts +92 -0
- package/apps/studio/ds/board/build-model.ts +418 -0
- package/apps/studio/ds/board/component-states.ts +111 -0
- package/apps/studio/ds/board/directions-model.ts +145 -0
- package/apps/studio/ds/board/directions.css +169 -0
- package/apps/studio/ds/board/directions.tsx +100 -0
- package/apps/studio/ds/board/ds-bar.tsx +107 -0
- package/apps/studio/ds/board/index.tsx +71 -0
- package/apps/studio/ds/board/logo-paint.ts +118 -0
- package/apps/studio/ds/board/outline.tsx +127 -0
- package/apps/studio/ds/board/parts.tsx +160 -0
- package/apps/studio/ds/board/section-brand.tsx +148 -0
- package/apps/studio/ds/board/section-colour.tsx +160 -0
- package/apps/studio/ds/board/section-components.tsx +146 -0
- package/apps/studio/ds/board/section-motion.tsx +106 -0
- package/apps/studio/ds/board/section-patterns.tsx +89 -0
- package/apps/studio/ds/board/section-space.tsx +109 -0
- package/apps/studio/ds/board/section-type.tsx +129 -0
- package/apps/studio/ds/board/specimen.tsx +61 -0
- package/apps/studio/ds/board/state.ts +105 -0
- package/apps/studio/ds/board/template.ts +152 -0
- package/apps/studio/ds/board/types.ts +346 -0
- package/apps/studio/ds/canvas-check.ts +914 -0
- package/apps/studio/ds/canvas-cli.ts +346 -0
- package/apps/studio/ds/check-system-verb.ts +88 -0
- package/apps/studio/ds/check-system.ts +293 -0
- package/apps/studio/ds/check.ts +541 -0
- package/apps/studio/ds/cli.ts +348 -0
- package/apps/studio/ds/component-list.ts +150 -0
- package/apps/studio/ds/contrast.ts +438 -0
- package/apps/studio/ds/convert-map.ts +126 -0
- package/apps/studio/ds/convert.ts +603 -0
- package/apps/studio/ds/css-scan.ts +292 -0
- package/apps/studio/ds/default-components.tsx +377 -0
- package/apps/studio/ds/default.ts +58 -0
- package/apps/studio/ds/design-system.tsx.tpl +40 -0
- package/apps/studio/ds/ds-resolver.ts +205 -0
- package/apps/studio/ds/ds-verb.ts +563 -0
- package/apps/studio/ds/edges.ts +412 -0
- package/apps/studio/ds/emit.ts +217 -0
- package/apps/studio/ds/engine.ts +1652 -0
- package/apps/studio/ds/fallbacks.ts +116 -0
- package/apps/studio/ds/generate.ts +746 -0
- package/apps/studio/ds/head.ts +372 -0
- package/apps/studio/ds/instance-info.ts +90 -0
- package/apps/studio/ds/library.ts +1137 -0
- package/apps/studio/ds/make.ts +726 -0
- package/apps/studio/ds/migrate-emitter.ts +42 -0
- package/apps/studio/ds/nearest.ts +163 -0
- package/apps/studio/ds/outside.ts +343 -0
- package/apps/studio/ds/override-map.ts +213 -0
- package/apps/studio/ds/pairing-css.ts +145 -0
- package/apps/studio/ds/pin-scope.ts +268 -0
- package/apps/studio/ds/registry.ts +228 -0
- package/apps/studio/ds/rename.ts +104 -0
- package/apps/studio/ds/render-rev.ts +144 -0
- package/apps/studio/ds/revision.ts +268 -0
- package/apps/studio/ds/shell-fallbacks.ts +84 -0
- package/apps/studio/ds/switch.ts +426 -0
- package/apps/studio/ds/system-files.ts +251 -0
- package/apps/studio/ds/system.ts +312 -0
- package/apps/studio/ds/undo-hook.ts +46 -0
- package/apps/studio/ds/upgrade-apply.ts +258 -0
- package/apps/studio/ds/upgrade-cli.ts +216 -0
- package/apps/studio/ds/upgrade-codemod.ts +116 -0
- package/apps/studio/ds/upgrade-progress.ts +153 -0
- package/apps/studio/ds/upgrade-prove.ts +429 -0
- package/apps/studio/ds/upgrade-stage.ts +387 -0
- package/apps/studio/ds/upgrade.ts +394 -0
- package/apps/studio/ds/value-types.ts +190 -0
- package/apps/studio/edit-ops/align.ts +43 -0
- package/apps/studio/edit-ops/arrange.ts +93 -0
- package/apps/studio/edit-ops/artboard-facts.ts +70 -0
- package/apps/studio/edit-ops/artboard-resize.ts +50 -0
- package/apps/studio/edit-ops/artboard-trash.ts +77 -0
- package/apps/studio/edit-ops/clear-link.ts +16 -0
- package/apps/studio/edit-ops/clip/captions.ts +154 -0
- package/apps/studio/edit-ops/clip/comp.ts +124 -0
- package/apps/studio/edit-ops/clip/cut-source-range.ts +100 -0
- package/apps/studio/edit-ops/clip/cut-to-beat.ts +136 -0
- package/apps/studio/edit-ops/clip/duck.ts +123 -0
- package/apps/studio/edit-ops/clip/easing.ts +76 -0
- package/apps/studio/edit-ops/clip/formats.ts +163 -0
- package/apps/studio/edit-ops/clip/gestures.ts +161 -0
- package/apps/studio/edit-ops/clip/index.ts +543 -0
- package/apps/studio/edit-ops/clip/jsx.ts +251 -0
- package/apps/studio/edit-ops/clip/place.ts +127 -0
- package/apps/studio/edit-ops/clip/reframe.ts +194 -0
- package/apps/studio/edit-ops/clip/take-swap.ts +53 -0
- package/apps/studio/edit-ops/clip/title-motion.ts +103 -0
- package/apps/studio/edit-ops/clip/title-style.ts +177 -0
- package/apps/studio/edit-ops/clip/track.ts +102 -0
- package/apps/studio/edit-ops/clipboard.ts +482 -0
- package/apps/studio/edit-ops/combine.ts +264 -0
- package/apps/studio/edit-ops/constraints.ts +148 -0
- package/apps/studio/edit-ops/convert-kind.ts +203 -0
- package/apps/studio/edit-ops/corner-radius.ts +86 -0
- package/apps/studio/edit-ops/crop.ts +303 -0
- package/apps/studio/edit-ops/czech-ties.ts +84 -0
- package/apps/studio/edit-ops/detach-instance.ts +119 -0
- package/apps/studio/edit-ops/dispatch.ts +552 -0
- package/apps/studio/edit-ops/distribute.ts +31 -0
- package/apps/studio/edit-ops/ds-instance-update.ts +46 -0
- package/apps/studio/edit-ops/ds-use-nearest.ts +72 -0
- package/apps/studio/edit-ops/duplicate-at-width.ts +241 -0
- package/apps/studio/edit-ops/frame.ts +68 -0
- package/apps/studio/edit-ops/guides.ts +67 -0
- package/apps/studio/edit-ops/hide.ts +30 -0
- package/apps/studio/edit-ops/hover-rules.ts +94 -0
- package/apps/studio/edit-ops/image-fit.ts +571 -0
- package/apps/studio/edit-ops/insert-component.ts +344 -0
- package/apps/studio/edit-ops/insert-preset.ts +151 -0
- package/apps/studio/edit-ops/insert-shape.ts +326 -0
- package/apps/studio/edit-ops/instance-model.ts +286 -0
- package/apps/studio/edit-ops/instance-tree.ts +215 -0
- package/apps/studio/edit-ops/layout-patch.ts +81 -0
- package/apps/studio/edit-ops/lock.ts +30 -0
- package/apps/studio/edit-ops/op-label.ts +155 -0
- package/apps/studio/edit-ops/path-model.ts +671 -0
- package/apps/studio/edit-ops/path.ts +172 -0
- package/apps/studio/edit-ops/photo-every-use.ts +64 -0
- package/apps/studio/edit-ops/photo-use.ts +41 -0
- package/apps/studio/edit-ops/place-freely.ts +47 -0
- package/apps/studio/edit-ops/place-plan.ts +60 -0
- package/apps/studio/edit-ops/print.ts +104 -0
- package/apps/studio/edit-ops/references.ts +231 -0
- package/apps/studio/edit-ops/relink.ts +49 -0
- package/apps/studio/edit-ops/reorder.ts +104 -0
- package/apps/studio/edit-ops/reset-overrides.ts +75 -0
- package/apps/studio/edit-ops/revert.ts +63 -0
- package/apps/studio/edit-ops/rotate.ts +58 -0
- package/apps/studio/edit-ops/safe-zones.ts +38 -0
- package/apps/studio/edit-ops/scope-names.ts +151 -0
- package/apps/studio/edit-ops/select-matching.ts +48 -0
- package/apps/studio/edit-ops/set-gap.ts +65 -0
- package/apps/studio/edit-ops/set-id.ts +42 -0
- package/apps/studio/edit-ops/set-link.ts +39 -0
- package/apps/studio/edit-ops/siblings.ts +105 -0
- package/apps/studio/edit-ops/slot-defaults.ts +48 -0
- package/apps/studio/edit-ops/stamp.ts +27 -0
- package/apps/studio/edit-ops/swap-variant.ts +163 -0
- package/apps/studio/edit-ops/text-copy.ts +146 -0
- package/apps/studio/edit-ops/text-detach.ts +62 -0
- package/apps/studio/edit-ops/text-style-ops.ts +131 -0
- package/apps/studio/edit-ops/text-style.ts +141 -0
- package/apps/studio/edit-ops/tidy.ts +72 -0
- package/apps/studio/edit-ops/types.ts +229 -0
- package/apps/studio/edit-ops/unframe.ts +53 -0
- package/apps/studio/edit-ops/words-css.ts +487 -0
- package/apps/studio/edit-ops/words-paint.ts +521 -0
- package/apps/studio/edit-ops/z-order.ts +81 -0
- package/apps/studio/editing/ai-point-ring.tsx +158 -0
- package/apps/studio/editing/ai-scope-outline.tsx +180 -0
- package/apps/studio/editing/align-bar.tsx +510 -0
- package/apps/studio/editing/anchor-report.ts +123 -0
- package/apps/studio/editing/anchor-reporter.tsx +64 -0
- package/apps/studio/editing/aria-live.tsx +162 -0
- package/apps/studio/editing/arrange.ts +345 -0
- package/apps/studio/editing/artboard-actions.ts +275 -0
- package/apps/studio/editing/artboard-commands.tsx +232 -0
- package/apps/studio/editing/artboard-guides.tsx +265 -0
- package/apps/studio/editing/artboard-handles.tsx +524 -0
- package/apps/studio/editing/artboard-menu.tsx +153 -0
- package/apps/studio/editing/artboard-resize.ts +306 -0
- package/apps/studio/editing/ask-bubble.tsx +161 -0
- package/apps/studio/editing/asset-drag.ts +70 -0
- package/apps/studio/editing/click-to-type.ts +207 -0
- package/apps/studio/editing/clipboard-actions.ts +91 -0
- package/apps/studio/editing/clipboard.ts +194 -0
- package/apps/studio/editing/clipped-grab.ts +45 -0
- package/apps/studio/editing/corner-dots.tsx +394 -0
- package/apps/studio/editing/crop-geometry.ts +128 -0
- package/apps/studio/editing/crop-mode.tsx +522 -0
- package/apps/studio/editing/crumbs.ts +158 -0
- package/apps/studio/editing/draw-geometry.ts +151 -0
- package/apps/studio/editing/draw-tools.tsx +490 -0
- package/apps/studio/editing/drop-chip.tsx +105 -0
- package/apps/studio/editing/duplicate-rhythm.ts +166 -0
- package/apps/studio/editing/edit-chrome-gate.tsx +58 -0
- package/apps/studio/editing/edit-op.ts +90 -0
- package/apps/studio/editing/empty-report.ts +182 -0
- package/apps/studio/editing/empty-reporter.tsx +74 -0
- package/apps/studio/editing/figma-paste.ts +71 -0
- package/apps/studio/editing/finder-drop-model.ts +130 -0
- package/apps/studio/editing/finder-drop.tsx +400 -0
- package/apps/studio/editing/focus-model.tsx +429 -0
- package/apps/studio/editing/gap-bands.tsx +257 -0
- package/apps/studio/editing/hold-rings.tsx +461 -0
- package/apps/studio/editing/image-drop.tsx +193 -0
- package/apps/studio/editing/index.tsx +402 -0
- package/apps/studio/editing/instance-actions.ts +152 -0
- package/apps/studio/editing/kids-summary.ts +75 -0
- package/apps/studio/editing/kind-dim.tsx +54 -0
- package/apps/studio/editing/layout-actions.ts +159 -0
- package/apps/studio/editing/lock-badge.tsx +178 -0
- package/apps/studio/editing/long-page.ts +102 -0
- package/apps/studio/editing/minimap-context.tsx +161 -0
- package/apps/studio/editing/nudge.tsx +212 -0
- package/apps/studio/editing/object-actions.ts +156 -0
- package/apps/studio/editing/object-keys.ts +58 -0
- package/apps/studio/editing/object-menu.tsx +216 -0
- package/apps/studio/editing/object-ops.ts +114 -0
- package/apps/studio/editing/paste-bar.tsx +388 -0
- package/apps/studio/editing/pen/combine-run.ts +113 -0
- package/apps/studio/editing/pen/draw.tsx +364 -0
- package/apps/studio/editing/pen/index.tsx +48 -0
- package/apps/studio/editing/pen/overlay.tsx +147 -0
- package/apps/studio/editing/pen/pen-geometry.ts +234 -0
- package/apps/studio/editing/pen/point-store.ts +64 -0
- package/apps/studio/editing/pen/points.tsx +421 -0
- package/apps/studio/editing/place-freely.tsx +389 -0
- package/apps/studio/editing/place-ghost.tsx +418 -0
- package/apps/studio/editing/place-image.tsx +219 -0
- package/apps/studio/editing/preset-ruler.tsx +218 -0
- package/apps/studio/editing/rename-order.ts +58 -0
- package/apps/studio/editing/reorder-slot.tsx +567 -0
- package/apps/studio/editing/rotate-handle.tsx +353 -0
- package/apps/studio/editing/selection.tsx +319 -0
- package/apps/studio/editing/set-gap.ts +55 -0
- package/apps/studio/editing/size-ghost.tsx +343 -0
- package/apps/studio/editing/space-tap.ts +56 -0
- package/apps/studio/editing/sticky-name.tsx +112 -0
- package/apps/studio/editing/tab-order.tsx +298 -0
- package/apps/studio/editing/take-keys.ts +115 -0
- package/apps/studio/editing/text-actions.ts +214 -0
- package/apps/studio/editing/text-in-place.tsx +187 -0
- package/apps/studio/editing/tidy-preview.tsx +83 -0
- package/apps/studio/editing/token-ruler.tsx +231 -0
- package/apps/studio/editing/type-role.ts +122 -0
- package/apps/studio/editing/undo-preview.tsx +120 -0
- package/apps/studio/editing/video-label.ts +66 -0
- package/apps/studio/editing/video-play.ts +65 -0
- package/apps/studio/editing/world-menu.ts +36 -0
- package/apps/studio/element-ids.ts +1030 -0
- package/apps/studio/equal-spacing-handles.tsx +1 -1
- package/apps/studio/exporters/_runtime.ts +64 -24
- package/apps/studio/exporters/audio.ts +136 -0
- package/apps/studio/exporters/door-fingerprint.ts +202 -0
- package/apps/studio/exporters/estimate.ts +314 -0
- package/apps/studio/exporters/file-names.ts +197 -0
- package/apps/studio/exporters/format-scopes.ts +7 -1
- package/apps/studio/exporters/hub-render-door.ts +368 -0
- package/apps/studio/exporters/index.ts +53 -7
- package/apps/studio/exporters/jobs.ts +484 -80
- package/apps/studio/exporters/jpg.ts +21 -0
- package/apps/studio/exporters/pdf-fonts.ts +102 -0
- package/apps/studio/exporters/pdf.ts +133 -14
- package/apps/studio/exporters/png.ts +136 -9
- package/apps/studio/exporters/print-back.ts +92 -0
- package/apps/studio/exporters/print-preflight.ts +373 -0
- package/apps/studio/exporters/rects-runner.ts +130 -0
- package/apps/studio/exporters/remote.ts +726 -3
- package/apps/studio/exporters/render-seconds.ts +57 -0
- package/apps/studio/exporters/replay.ts +48 -0
- package/apps/studio/exporters/scope.ts +560 -15
- package/apps/studio/exporters/spec-run.ts +270 -0
- package/apps/studio/exporters/spec-v2.ts +408 -0
- package/apps/studio/exporters/video-cap.ts +280 -0
- package/apps/studio/exporters/wait-ai.ts +192 -0
- package/apps/studio/figma/client.ts +67 -0
- package/apps/studio/figma/comments-to-pins.ts +249 -0
- package/apps/studio/figma/comments-to-strokes.ts +6 -1
- package/apps/studio/figma/into-board.ts +141 -0
- package/apps/studio/figma/to-strokes.ts +54 -0
- package/apps/studio/format.ts +172 -30
- package/apps/studio/fs-watch.ts +28 -1
- package/apps/studio/generation/adapters/gemini.ts +3 -0
- package/apps/studio/generation/adapters/stub.ts +133 -0
- package/apps/studio/generation/gen-sidecar.ts +108 -0
- package/apps/studio/generation/registry.ts +16 -5
- package/apps/studio/generation/takes.ts +398 -0
- package/apps/studio/generation/types.ts +7 -0
- package/apps/studio/git/service.ts +143 -14
- package/apps/studio/github/endpoints.ts +1 -1
- package/apps/studio/github/identity-cache.ts +53 -14
- package/apps/studio/handoff/blockers.ts +120 -0
- package/apps/studio/handoff/run.ts +233 -0
- package/apps/studio/handoff/targets.ts +334 -0
- package/apps/studio/handoff/write-scopes.ts +57 -0
- package/apps/studio/handoff.ts +24 -5
- package/apps/studio/history/changes.ts +199 -0
- package/apps/studio/history/describe-annotations.ts +216 -0
- package/apps/studio/history/describe-css.ts +592 -0
- package/apps/studio/history/describe-match.ts +866 -0
- package/apps/studio/history/describe-meta.ts +281 -0
- package/apps/studio/history/describe-version.ts +89 -0
- package/apps/studio/history/describe-words.ts +513 -0
- package/apps/studio/history/describe.ts +1452 -0
- package/apps/studio/history/last-good.ts +123 -0
- package/apps/studio/history/links.ts +112 -0
- package/apps/studio/history/object-history.ts +535 -0
- package/apps/studio/history/render-ok-signal.ts +81 -0
- package/apps/studio/history/restore-artboard-action.ts +183 -0
- package/apps/studio/history/restore-artboard.ts +607 -0
- package/apps/studio/history/restore-object.ts +168 -0
- package/apps/studio/history/run-label.ts +18 -0
- package/apps/studio/history/surface-requests.ts +115 -0
- package/apps/studio/history/titles.ts +259 -0
- package/apps/studio/history/trash.ts +314 -0
- package/apps/studio/history/version-lanes.ts +115 -0
- package/apps/studio/history/versions.ts +458 -0
- package/apps/studio/hmr-broadcast.ts +55 -1
- package/apps/studio/home/ai.ts +79 -0
- package/apps/studio/home/cli.ts +221 -0
- package/apps/studio/home/cloud.ts +297 -0
- package/apps/studio/home/create-local.ts +164 -0
- package/apps/studio/home/github.ts +99 -0
- package/apps/studio/home/hub.ts +340 -0
- package/apps/studio/home/index-gc.ts +288 -0
- package/apps/studio/home/index-reader.ts +338 -0
- package/apps/studio/home/invite.ts +204 -0
- package/apps/studio/home/main.ts +159 -0
- package/apps/studio/home/pid.ts +12 -0
- package/apps/studio/home/routes.ts +591 -0
- package/apps/studio/home/signin.ts +285 -0
- package/apps/studio/home/user-state.ts +177 -0
- package/apps/studio/home/whats-new.ts +42 -0
- package/apps/studio/http.ts +2589 -947
- package/apps/studio/index/assets-response.ts +34 -0
- package/apps/studio/index/assets.ts +335 -0
- package/apps/studio/index/ds-usage.ts +983 -0
- package/apps/studio/index/extract.ts +348 -0
- package/apps/studio/index/extractors/asset-usage.ts +349 -0
- package/apps/studio/index/extractors/attribution-cache.ts +225 -0
- package/apps/studio/index/history-refs.ts +301 -0
- package/apps/studio/index/history-source.ts +39 -0
- package/apps/studio/index/match.ts +307 -0
- package/apps/studio/index/scan-kick.ts +47 -0
- package/apps/studio/index/service.ts +367 -0
- package/apps/studio/index/snapshot.ts +135 -0
- package/apps/studio/index/types.ts +139 -0
- package/apps/studio/index/version-feed.ts +71 -0
- package/apps/studio/input-router.tsx +522 -55
- package/apps/studio/inspect-canvas.ts +86 -0
- package/apps/studio/inspect-overlay.tsx +192 -0
- package/apps/studio/inspect.ts +96 -33
- package/apps/studio/kinds/convert.ts +175 -0
- package/apps/studio/kinds/export-defaults.ts +42 -0
- package/apps/studio/kinds/meta.ts +237 -0
- package/apps/studio/kinds/physical.ts +84 -0
- package/apps/studio/kinds/presets.ts +452 -0
- package/apps/studio/kinds/print-custom.ts +165 -0
- package/apps/studio/kinds/print-edit.ts +130 -0
- package/apps/studio/kinds/print-guides.ts +23 -0
- package/apps/studio/kinds/safe-zones.ts +250 -0
- package/apps/studio/kinds/warnings.ts +422 -0
- package/apps/studio/layer-name.ts +148 -0
- package/apps/studio/layout/free-space.ts +131 -0
- package/apps/studio/link-chip-overlay.tsx +175 -0
- package/apps/studio/link-import.ts +617 -0
- package/apps/studio/loopback-listen.ts +105 -0
- package/apps/studio/macro-guard.ts +67 -0
- package/apps/studio/managed-projects.ts +63 -14
- package/apps/studio/marquee-overlay.tsx +2 -2
- package/apps/studio/measure-overlay.tsx +10 -4
- package/apps/studio/migrate/cli.ts +164 -0
- package/apps/studio/migrate/ds-registry.ts +42 -0
- package/apps/studio/migrate/engine.ts +926 -0
- package/apps/studio/migrate/hub.ts +219 -0
- package/apps/studio/migrate/steps.ts +627 -0
- package/apps/studio/notifications.tsx +197 -52
- package/apps/studio/outbox/content.ts +139 -0
- package/apps/studio/outbox/drain.ts +269 -0
- package/apps/studio/outbox/hub-reachability.ts +58 -0
- package/apps/studio/outbox/index.ts +57 -0
- package/apps/studio/outbox/policy.ts +859 -0
- package/apps/studio/outbox/senders/export-cloud.ts +116 -0
- package/apps/studio/outbox/store.ts +336 -0
- package/apps/studio/outbox/types.ts +160 -0
- package/apps/studio/participants-chrome.tsx +178 -60
- package/apps/studio/paths.ts +8 -0
- package/apps/studio/photo-store.ts +230 -1
- package/apps/studio/port.ts +93 -0
- package/apps/studio/presence/canvas-presence.tsx +522 -0
- package/apps/studio/presence/fields.ts +93 -0
- package/apps/studio/presence/model.ts +296 -0
- package/apps/studio/presence/tones.ts +39 -0
- package/apps/studio/present/fit.ts +138 -0
- package/apps/studio/present/follow.ts +142 -0
- package/apps/studio/present/media-presence.ts +105 -0
- package/apps/studio/present/meta-schema.ts +612 -0
- package/apps/studio/present/order.ts +153 -0
- package/apps/studio/present/pointer-dot.tsx +379 -0
- package/apps/studio/present/pointer-point.ts +24 -0
- package/apps/studio/present/present-media.ts +446 -0
- package/apps/studio/present/present-stage.tsx +1018 -0
- package/apps/studio/present/present-zoom.ts +63 -0
- package/apps/studio/present/relay-strip.ts +136 -0
- package/apps/studio/preview/preview-camera.tsx +442 -0
- package/apps/studio/preview/wheel-scroll.ts +85 -0
- package/apps/studio/print/units.ts +3 -0
- package/apps/studio/print-overlay-content.tsx +127 -10
- package/apps/studio/read-only-mode.ts +83 -0
- package/apps/studio/readiness.ts +18 -3
- package/apps/studio/ripple.ts +19 -1
- package/apps/studio/routes/agent.ts +1025 -0
- package/apps/studio/routes/ai.ts +422 -0
- package/apps/studio/routes/annotations.ts +649 -0
- package/apps/studio/routes/asset-details.ts +87 -0
- package/apps/studio/routes/asset-rename.ts +60 -0
- package/apps/studio/routes/asset-state.ts +137 -0
- package/apps/studio/routes/asset-trash.ts +77 -0
- package/apps/studio/routes/assets.ts +217 -0
- package/apps/studio/routes/availability.ts +94 -0
- package/apps/studio/routes/canvas-meta-rider.ts +304 -0
- package/apps/studio/routes/canvas-origin.ts +88 -0
- package/apps/studio/routes/canvas-source.ts +315 -0
- package/apps/studio/routes/chat-attach.ts +335 -0
- package/apps/studio/routes/chat.ts +137 -0
- package/apps/studio/routes/cloud-move.ts +364 -0
- package/apps/studio/routes/cloud-plan.ts +36 -0
- package/apps/studio/routes/comments.ts +118 -0
- package/apps/studio/routes/connections.ts +132 -0
- package/apps/studio/routes/describe.ts +122 -0
- package/apps/studio/routes/diagnostics.ts +118 -0
- package/apps/studio/routes/ds-check.ts +124 -0
- package/apps/studio/routes/ds-convert.ts +55 -0
- package/apps/studio/routes/ds-edges.ts +136 -0
- package/apps/studio/routes/ds-library.ts +194 -0
- package/apps/studio/routes/ds-make.ts +91 -0
- package/apps/studio/routes/ds-switch.ts +68 -0
- package/apps/studio/routes/ds-upgrade.ts +139 -0
- package/apps/studio/routes/ds.ts +808 -0
- package/apps/studio/routes/edit.ts +658 -0
- package/apps/studio/routes/element-links.ts +155 -0
- package/apps/studio/routes/export.ts +486 -0
- package/apps/studio/routes/figma.ts +200 -0
- package/apps/studio/routes/generate.ts +443 -0
- package/apps/studio/routes/handoff.ts +319 -0
- package/apps/studio/routes/help-guides.ts +37 -0
- package/apps/studio/routes/history.ts +739 -0
- package/apps/studio/routes/import-link.ts +186 -0
- package/apps/studio/routes/index.ts +293 -0
- package/apps/studio/routes/kinds.ts +257 -0
- package/apps/studio/routes/links.ts +72 -0
- package/apps/studio/routes/outbox.ts +87 -0
- package/apps/studio/routes/photo-every-use.ts +241 -0
- package/apps/studio/routes/pins.ts +66 -0
- package/apps/studio/routes/present.ts +187 -0
- package/apps/studio/routes/project-format.ts +148 -0
- package/apps/studio/routes/project-undo.ts +497 -0
- package/apps/studio/routes/settings.ts +179 -0
- package/apps/studio/routes/share.ts +463 -0
- package/apps/studio/routes/shell.ts +137 -0
- package/apps/studio/routes/sync-conflicts.ts +150 -0
- package/apps/studio/routes/sync.ts +172 -0
- package/apps/studio/routes/table.ts +224 -0
- package/apps/studio/routes/trash.ts +393 -0
- package/apps/studio/routes/video.ts +395 -0
- package/apps/studio/routes/votes.ts +486 -0
- package/apps/studio/safe-zones-overlay.tsx +269 -0
- package/apps/studio/scaffold-design.ts +72 -124
- package/apps/studio/schema/annotations.v2.schema.json +2303 -0
- package/apps/studio/schema/beats.v1.schema.json +94 -0
- package/apps/studio/schema/canvas-meta.v2.schema.json +264 -0
- package/apps/studio/schema/canvas-tsx.md +357 -0
- package/apps/studio/schema/comments.v2.schema.json +125 -0
- package/apps/studio/schema/ds-components-v1.schema.json +96 -0
- package/apps/studio/schema/ds-formats.md +146 -0
- package/apps/studio/schema/ds-head-v1.schema.json +67 -0
- package/apps/studio/schema/ds-revision-v1.schema.json +31 -0
- package/apps/studio/schema/ds-schema-v1.fallbacks.css +118 -0
- package/apps/studio/schema/ds-schema-v1.json +2029 -0
- package/apps/studio/schema/ds-schema-v1.schema.json +663 -0
- package/apps/studio/schema/ds-tokens-v1.schema.json +210 -0
- package/apps/studio/schema/edl.v1.schema.json +124 -0
- package/apps/studio/schema/formats.ts +175 -0
- package/apps/studio/schema/gen.v1.schema.json +33 -0
- package/apps/studio/schema/transcript.v1.schema.json +133 -0
- package/apps/studio/server.ts +454 -166
- package/apps/studio/shell/info-file.ts +54 -0
- package/apps/studio/shell/parent-watch.ts +97 -0
- package/apps/studio/shell/profile.ts +61 -0
- package/apps/studio/shell-canvas-file.ts +36 -0
- package/apps/studio/skip-dirs.ts +455 -0
- package/apps/studio/spoof-chars.ts +17 -0
- package/apps/studio/static-lane.ts +212 -0
- package/apps/studio/sync/accepted-cold-start.ts +35 -13
- package/apps/studio/sync/accepted-link.ts +524 -27
- package/apps/studio/sync/access-notices.ts +143 -0
- package/apps/studio/sync/action-feed.ts +145 -0
- package/apps/studio/sync/action-stage.ts +831 -165
- package/apps/studio/sync/asset-push.ts +24 -2
- package/apps/studio/sync/asset-state.ts +391 -0
- package/apps/studio/sync/atomic-write.ts +42 -1
- package/apps/studio/sync/availability.ts +185 -0
- package/apps/studio/sync/canvas-path.ts +70 -6
- package/apps/studio/sync/cell-pairing.ts +5 -24
- package/apps/studio/sync/comment-door.ts +104 -0
- package/apps/studio/sync/conflict-record.ts +186 -0
- package/apps/studio/sync/create-collision.ts +297 -0
- package/apps/studio/sync/ctl-provider.ts +16 -1
- package/apps/studio/sync/file-ledger.ts +12 -0
- package/apps/studio/sync/file-membership.ts +123 -10
- package/apps/studio/sync/file-plane.ts +195 -12
- package/apps/studio/sync/format-sync.ts +13 -7
- package/apps/studio/sync/history-fields.ts +61 -0
- package/apps/studio/sync/hub-link.ts +24 -4
- package/apps/studio/sync/hub-text-undo.ts +178 -0
- package/apps/studio/sync/hubs-config.ts +122 -20
- package/apps/studio/sync/index.ts +1499 -128
- package/apps/studio/sync/journal-client.ts +56 -0
- package/apps/studio/sync/keep-both.ts +187 -0
- package/apps/studio/sync/link-consent.ts +390 -0
- package/apps/studio/sync/local-kernel.ts +2725 -0
- package/apps/studio/sync/media-gate.ts +97 -0
- package/apps/studio/sync/object-conflict.ts +199 -0
- package/apps/studio/sync/poke.ts +50 -0
- package/apps/studio/sync/presentation.ts +20 -2
- package/apps/studio/sync/project-config-push.ts +5 -2
- package/apps/studio/sync/projection.ts +208 -34
- package/apps/studio/sync/resync-trace.ts +220 -0
- package/apps/studio/sync/retry-after.ts +27 -0
- package/apps/studio/sync/status.ts +16 -1
- package/apps/studio/sync/supervisor.ts +20 -2
- package/apps/studio/sync/transaction-client.ts +364 -34
- package/apps/studio/sync/trash-clear-copies.ts +120 -0
- package/apps/studio/sync/trash-watch.ts +157 -0
- package/apps/studio/sync/trash.ts +50 -2
- package/apps/studio/sync/undo-target.ts +110 -0
- package/apps/studio/sync/workspace-signin.ts +14 -3
- package/apps/studio/sync/write-hold.ts +238 -0
- package/apps/studio/sync/writer-registry.ts +380 -5
- package/apps/studio/sync-name-key.ts +59 -0
- package/apps/studio/thumbs/keys.ts +147 -0
- package/apps/studio/thumbs/routes.ts +68 -0
- package/apps/studio/thumbs/service.ts +884 -0
- package/apps/studio/thumbs/store.ts +114 -0
- package/apps/studio/thumbs/validate.ts +62 -0
- package/apps/studio/tool-palette.tsx +782 -563
- package/apps/studio/toolbars/marker-tip.ts +22 -0
- package/apps/studio/toolbars/shell-panels.ts +55 -0
- package/apps/studio/toolbars/tool-panel.ts +89 -0
- package/apps/studio/toolbars/toolbar-css.ts +283 -0
- package/apps/studio/toolbars/toolbar-icons.tsx +135 -0
- package/apps/studio/toolbars/toolbar-rect.ts +82 -0
- package/apps/studio/ui-prefs-migrate.ts +467 -0
- package/apps/studio/ui-prefs.ts +305 -3
- package/apps/studio/undo-stack.ts +10 -0
- package/apps/studio/use-annotation-resize.tsx +23 -17
- package/apps/studio/use-artboard-drag.tsx +156 -15
- package/apps/studio/use-canvas-keys.ts +58 -0
- package/apps/studio/use-chrome-visibility.tsx +13 -0
- package/apps/studio/use-collab.tsx +556 -56
- package/apps/studio/use-element-resize.tsx +13 -9
- package/apps/studio/use-governed-mode.ts +23 -0
- package/apps/studio/use-keyboard-discipline.tsx +114 -49
- package/apps/studio/use-selection-set.tsx +110 -9
- package/apps/studio/use-snap-guides.tsx +74 -5
- package/apps/studio/use-spacing-handles.tsx +90 -27
- package/apps/studio/use-tool-mode.tsx +204 -10
- package/apps/studio/use-undo-stack.tsx +19 -23
- package/apps/studio/video/beats.ts +484 -0
- package/apps/studio/video/decode-webaudio.ts +115 -0
- package/apps/studio/video/decode.ts +288 -0
- package/apps/studio/video/derive.ts +647 -0
- package/apps/studio/video/format-ids.ts +158 -0
- package/apps/studio/video/framing.ts +246 -0
- package/apps/studio/video/inject.ts +324 -0
- package/apps/studio/video/keyframes.ts +356 -0
- package/apps/studio/video/link-groups.ts +40 -0
- package/apps/studio/video/linked-formats.ts +142 -0
- package/apps/studio/video/mask-comments.ts +36 -0
- package/apps/studio/video/media-analysis.ts +169 -0
- package/apps/studio/video/reel-place.ts +286 -0
- package/apps/studio/video/reframe-read.ts +90 -0
- package/apps/studio/video/schema.ts +422 -0
- package/apps/studio/video/speech.ts +129 -0
- package/apps/studio/video/title-motion.ts +85 -0
- package/apps/studio/video/transcript-cut.ts +91 -0
- package/apps/studio/video/whisper-parse.ts +123 -0
- package/apps/studio/video/words-run.ts +210 -0
- package/apps/studio/video/words-timing.ts +222 -0
- package/apps/studio/video-comp.tsx +238 -9
- package/apps/studio/video-links-overlay.tsx +272 -0
- package/apps/studio/video-natural.ts +73 -0
- package/apps/studio/video-play-chrome.tsx +229 -0
- package/apps/studio/video-play-overlay.tsx +190 -0
- package/apps/studio/video-vocab.tsx +460 -0
- package/apps/studio/view-only-gesture.tsx +101 -0
- package/apps/studio/viewport-fit.ts +28 -0
- package/apps/studio/web-overlay-content.tsx +4 -2
- package/apps/studio/whats-new.json +100 -20
- package/apps/studio/whats-new.schema.json +10 -0
- package/apps/studio/whats-new.ts +4 -0
- package/apps/studio/workspace-mode.ts +10 -0
- package/apps/studio/ws.ts +299 -8
- package/cli/bin/maude.mjs +1 -0
- package/cli/commands/design.mjs +401 -72
- package/cli/commands/flow.mjs +12 -1
- package/cli/commands/help.mjs +8 -0
- package/cli/commands/migrate.mjs +55 -0
- package/cli/lib/bash-guard.mjs +1691 -0
- package/cli/lib/confine-out.mjs +150 -0
- package/cli/lib/confine-read.mjs +179 -0
- package/cli/lib/confine-root.mjs +157 -0
- package/cli/lib/design-help.gen.mjs +119 -0
- package/cli/lib/design-hook.mjs +1764 -0
- package/cli/lib/design-link.mjs +68 -4
- package/cli/lib/design-open.mjs +238 -0
- package/cli/lib/export-spec.mjs +394 -0
- package/cli/lib/finding-text.mjs +63 -0
- package/cli/lib/flow-usage.mjs +6 -10
- package/cli/lib/gitignore-block.mjs +1 -0
- package/cli/lib/handoff.mjs +285 -0
- package/cli/lib/handoff.schema.json +336 -0
- package/cli/lib/hubs-config.mjs +10 -0
- package/cli/lib/json-schema-lite.mjs +260 -0
- package/cli/lib/project-links.mjs +88 -0
- package/cli/lib/studio-locate.mjs +83 -0
- package/cli/lib/sub-verbs.mjs +111 -0
- package/cli/lib/workspace-plan.mjs +16 -3
- package/package.json +29 -10
- package/plugins/design/README.md +46 -0
- package/plugins/design/templates/_shell.html +749 -69
- package/plugins/design/templates/blank-canvas.tsx.template +26 -0
- package/plugins/design/templates/brief-board.tsx.template +12 -11
- package/plugins/design/templates/canvas.tsx.template +3 -3
- package/plugins/design/templates/design-system-inspiration/core/README.philosophy.md.tpl +104 -0
- package/plugins/design/templates/design-system-inspiration/core/colors_and_type.css.tpl +38 -3
- package/plugins/design/templates/design-system-inspiration/core/components.json.tpl +127 -0
- package/plugins/design/templates/design-system-inspiration/core/config.json.tpl +1 -0
- package/plugins/design/templates/design-system-inspiration/core/preview/_components.css.tpl +111 -0
- package/plugins/flow/.claude-plugin/config.schema.json +6 -1
- package/apps/studio/annotations/ui/edit-actions.ts +0 -551
- package/apps/studio/canvas-header.ts +0 -165
- package/apps/studio/client/hmr.mjs +0 -113
- package/apps/studio/client/hooks/use-keyboard-shortcuts.jsx +0 -297
- package/apps/studio/client/iframe-lazy.mjs +0 -121
- package/apps/studio/client/inspector/artboard-knobs.jsx +0 -456
- package/apps/studio/client/menus/menubar.jsx +0 -856
- package/apps/studio/client/panels/CapabilityBar.jsx +0 -101
- package/apps/studio/client/panels/ClipInspector.jsx +0 -409
- package/apps/studio/client/panels/GitPanel.jsx +0 -1026
- package/apps/studio/client/panels/OnboardingWizard.jsx +0 -642
- package/apps/studio/client/panels/StickerPicker.jsx +0 -160
- package/apps/studio/client/panels/SyncPanel.jsx +0 -1190
- package/apps/studio/client/panels/TimelinePanel.jsx +0 -2259
- package/apps/studio/client/share-dialog.jsx +0 -91
- package/apps/studio/client/shell/collapsed-rail.jsx +0 -23
- package/apps/studio/client/shell/status-bar.jsx +0 -215
- package/apps/studio/client/styles/1-tokens-maude.css +0 -296
- package/apps/studio/client/styles/1-tokens.css +0 -304
- package/apps/studio/client/styles/3-shell-maude.css +0 -3158
- package/apps/studio/client/styles/3-shell.css +0 -1036
- package/apps/studio/client/styles/4-components-maude.css +0 -134
- package/apps/studio/client/styles/4-components.css +0 -2204
- package/apps/studio/client/styles/5-maude-overrides.css +0 -162
- package/apps/studio/client/styles.css +0 -1264
- package/apps/studio/contextual-toolbar.tsx +0 -512
- package/apps/studio/export-dialog.tsx +0 -827
- package/apps/studio/undo-hud.tsx +0 -16
package/apps/studio/api.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Returns plain objects; http.ts wraps them in Response.json().
|
|
3
3
|
|
|
4
4
|
import crypto from 'node:crypto';
|
|
5
|
-
import { type Dirent, renameSync } from 'node:fs';
|
|
5
|
+
import { type Dirent, existsSync, renameSync } from 'node:fs';
|
|
6
6
|
import {
|
|
7
7
|
lstat,
|
|
8
8
|
mkdir,
|
|
@@ -14,6 +14,15 @@ import {
|
|
|
14
14
|
stat as statp,
|
|
15
15
|
} from 'node:fs/promises';
|
|
16
16
|
import path from 'node:path';
|
|
17
|
+
import {
|
|
18
|
+
filterCommentsAll,
|
|
19
|
+
filterIndexData,
|
|
20
|
+
filterSystemData,
|
|
21
|
+
projectVisibility,
|
|
22
|
+
} from './access/filters.ts';
|
|
23
|
+
import { currentFrameKey } from './access/frame.ts';
|
|
24
|
+
import { currentAccess, toDesignRel } from './access/request.ts';
|
|
25
|
+
import { asPersonSave, saveHold } from './ai/save-hold.ts';
|
|
17
26
|
import { canonicalAnnotations } from './annotations/board-text.ts';
|
|
18
27
|
import {
|
|
19
28
|
type Op as AnnotationOp,
|
|
@@ -22,18 +31,44 @@ import {
|
|
|
22
31
|
diffToOps,
|
|
23
32
|
} from './annotations/ops.ts';
|
|
24
33
|
import './annotations/ops-merge.ts';
|
|
34
|
+
import { runTagOf } from './annotations/run-tag.ts';
|
|
25
35
|
import { parseBoard, serializeBoard } from './annotations/schema.ts';
|
|
26
36
|
import type { AnnotationElement } from './annotations/types.ts';
|
|
37
|
+
import { type BoardGuard, voteDoorOnly } from './annotations/vote-guard.ts';
|
|
27
38
|
import { createAssetMirror, s3ConfigFromEnv } from './assets-s3.ts';
|
|
28
39
|
import { canvasArtifacts, locatorKeyFor, relocatedName } from './canvas-artifacts.ts';
|
|
29
|
-
import {
|
|
40
|
+
import {
|
|
41
|
+
foldToAllowedName,
|
|
42
|
+
nameFromPrompt,
|
|
43
|
+
nextFreeCanvasName,
|
|
44
|
+
renderBlankCanvas,
|
|
45
|
+
renderBriefBoard,
|
|
46
|
+
UNTITLED_CANVAS,
|
|
47
|
+
validateCanvasName,
|
|
48
|
+
validateFolderName,
|
|
49
|
+
} from './canvas-create.ts';
|
|
30
50
|
import { rewriteRelativeImports } from './canvas-imports.ts';
|
|
31
51
|
import { canvasSlugFromRel } from './canvas-slug.ts';
|
|
32
52
|
import { isAnnotationId, isWorldPoint } from './comment-anchor.ts';
|
|
53
|
+
import { readAnchors, withSanitizedAnchors } from './comments/anchors.ts';
|
|
54
|
+
import { type ImportedFrom, withSanitizedImportedFrom } from './comments/imported-from.ts';
|
|
55
|
+
import { localAuthor } from './comments/local-author.ts';
|
|
56
|
+
import { mentionsOf } from './comments/mentions.ts';
|
|
57
|
+
import {
|
|
58
|
+
applyCommentOp,
|
|
59
|
+
type CommentOp,
|
|
60
|
+
type CommentRecord,
|
|
61
|
+
type OpActor,
|
|
62
|
+
type OpResult,
|
|
63
|
+
} from './comments/ops.ts';
|
|
64
|
+
import { readHead } from './ds/head.ts';
|
|
65
|
+
import { dsRenderIndex } from './ds/render-rev.ts';
|
|
66
|
+
import { dropPin, rekeyUserState } from './home/user-state.ts';
|
|
33
67
|
import { atomicWrite } from './sync/atomic-write.ts';
|
|
34
68
|
import { dedupeCommentsById } from './sync/comment-identity.ts';
|
|
35
69
|
import { isRuntimeStateRel } from './sync/file-membership.ts';
|
|
36
70
|
import { MAX_ANNOTATIONS_BYTES } from './sync/limits.ts';
|
|
71
|
+
import { findCloseName, tooCloseText } from './sync-name-key.ts';
|
|
37
72
|
|
|
38
73
|
// Re-exported so existing external callers (canvas-list-watch.ts, tests) keep
|
|
39
74
|
// importing it from api.ts — the actual implementation now lives in
|
|
@@ -84,6 +119,7 @@ import {
|
|
|
84
119
|
retimeSequence,
|
|
85
120
|
retimeSequenceByClip,
|
|
86
121
|
editText as runEditText,
|
|
122
|
+
sayingCanvasWrites,
|
|
87
123
|
setArtboardGuides,
|
|
88
124
|
setArtboardHug,
|
|
89
125
|
setArtboardKind,
|
|
@@ -91,31 +127,18 @@ import {
|
|
|
91
127
|
setArtboardPrint,
|
|
92
128
|
setArtboardStyle,
|
|
93
129
|
toggleClipHidden,
|
|
130
|
+
usageIdOf,
|
|
94
131
|
} from './canvas-edit.ts';
|
|
95
132
|
import {
|
|
96
|
-
applyClipAudio,
|
|
97
|
-
applyClipFraming,
|
|
98
|
-
applyClipGrade,
|
|
99
|
-
applyDetachAudio,
|
|
100
|
-
applyEditTransition,
|
|
101
133
|
applyFitTotalToContent,
|
|
102
|
-
applyInsertTransition,
|
|
103
|
-
applyMoveClipToOverlay,
|
|
104
|
-
applyMoveClipToStoryline,
|
|
105
134
|
applyOnDisk,
|
|
106
|
-
applyRemoveTransition,
|
|
107
|
-
applyReorderOverlayLayer,
|
|
108
|
-
applyResolvePlaceholder,
|
|
109
|
-
applySetClipText,
|
|
110
|
-
applySetPlaybackRate,
|
|
111
|
-
applySplitClip,
|
|
112
|
-
applyTrimIn,
|
|
113
|
-
type GradeParams,
|
|
114
135
|
insertClipAt,
|
|
115
136
|
removeClipRippled,
|
|
116
137
|
seriesMove,
|
|
117
138
|
} from './clip-ops.ts';
|
|
118
139
|
import type { Context } from './context.ts';
|
|
140
|
+
import { lockedRefusal } from './edit-ops/dispatch.ts';
|
|
141
|
+
import { walkIdElements } from './element-ids.ts';
|
|
119
142
|
import {
|
|
120
143
|
type AudioMatch,
|
|
121
144
|
type Candidate,
|
|
@@ -129,25 +152,14 @@ import { resolveUrlPathUnder } from './path-containment.ts';
|
|
|
129
152
|
import { STICKERS_DIR } from './paths.ts';
|
|
130
153
|
import { getPaperPreset, MAX_PRINT_MM } from './print/units.ts';
|
|
131
154
|
import { currentSession, normalizeSessionKey, sessionDir } from './session-scope.ts';
|
|
155
|
+
import { SKIP_DIRS } from './skip-dirs.ts';
|
|
132
156
|
import { describeSourceOp } from './sync/source-ops.ts';
|
|
133
157
|
import { normalizeTreeState, type TreeState } from './tree-state.ts';
|
|
134
158
|
import { isWorkspaceMode } from './workspace-mode.ts';
|
|
135
159
|
|
|
136
|
-
// Directories that never hold user-facing canvases
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
export const SKIP_DIRS = new Set([
|
|
140
|
-
'node_modules',
|
|
141
|
-
'.git',
|
|
142
|
-
'.next',
|
|
143
|
-
'.turbo',
|
|
144
|
-
'dist',
|
|
145
|
-
'build',
|
|
146
|
-
'.expo',
|
|
147
|
-
'coverage',
|
|
148
|
-
'dev-server',
|
|
149
|
-
'_history',
|
|
150
|
-
]);
|
|
160
|
+
// Directories that never hold user-facing canvases (one source: skip-dirs.ts).
|
|
161
|
+
export { SKIP_DIRS };
|
|
162
|
+
|
|
151
163
|
const HIDDEN_OK = new Set(['.ai', '.claude', '.design']);
|
|
152
164
|
|
|
153
165
|
// feature-studio-file-preview — binary/media extensions the tree lists so a
|
|
@@ -367,6 +379,8 @@ export interface Reply {
|
|
|
367
379
|
author: string;
|
|
368
380
|
body: string;
|
|
369
381
|
created: string;
|
|
382
|
+
/** S8.17b — a reply written in another tool (Figma). `author` stays the person who imported it. */
|
|
383
|
+
importedFrom?: ImportedFrom;
|
|
370
384
|
}
|
|
371
385
|
|
|
372
386
|
export interface Comment {
|
|
@@ -404,6 +418,9 @@ export interface Comment {
|
|
|
404
418
|
/** World point of the comment: the anchor of a floating comment, the last
|
|
405
419
|
* known place of an anchored one. Absent on legacy comments. */
|
|
406
420
|
world?: { x: number; y: number };
|
|
421
|
+
/** S8.17b — the thread was written in another tool (Figma): who wrote it there, as a label.
|
|
422
|
+
* `author` stays the person who imported it. Never a mention target (comments/imported-from.ts). */
|
|
423
|
+
importedFrom?: ImportedFrom;
|
|
407
424
|
}
|
|
408
425
|
|
|
409
426
|
export interface GitCommitter {
|
|
@@ -412,6 +429,19 @@ export interface GitCommitter {
|
|
|
412
429
|
commits: number;
|
|
413
430
|
}
|
|
414
431
|
|
|
432
|
+
/** S11.12 — how Keep both names and fills its copy (`duplicateCanvas`). */
|
|
433
|
+
export interface DuplicateCanvasOpts {
|
|
434
|
+
/** The word after the name: "copy" (the default) or "this Mac" (Keep both). */
|
|
435
|
+
suffix?: 'copy' | 'this Mac';
|
|
436
|
+
/** The copy's `.meta.json` title (Keep both: "<name> (this Mac)"). */
|
|
437
|
+
title?: string;
|
|
438
|
+
/** The copy's source, instead of the original file's bytes now. */
|
|
439
|
+
source?: string;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/** P8 G1a — the hub comment door refused or could not be reached (sync/comment-door.ts). */
|
|
443
|
+
export type DoorRefusal = { ok: false; status: number; code: string; error: string };
|
|
444
|
+
|
|
415
445
|
export type CreateCanvasResult =
|
|
416
446
|
| { ok: true; file: string; rel: string; slug: string }
|
|
417
447
|
| { ok: false; status: number; error: string };
|
|
@@ -434,8 +464,9 @@ export type EditOpResult =
|
|
|
434
464
|
/** `previous` — what a css/attr write replaced (`null` = was unset); absent
|
|
435
465
|
* when it was an expression no literal undo can restore. */
|
|
436
466
|
| { ok: true; delta: number; seq?: number; previous?: string | null }
|
|
437
|
-
/** `conflict` = the target no longer held the caller's expected value
|
|
438
|
-
|
|
467
|
+
/** `conflict` = the target no longer held the caller's expected value; `code: 'locked'` = the target carries
|
|
468
|
+
* the shared lock (409, the edit-op's own refusal — p8-lock-reasons). */
|
|
469
|
+
| { ok: false; status: number; error: string; conflict?: true; code?: 'locked' };
|
|
439
470
|
|
|
440
471
|
/**
|
|
441
472
|
* Optional expected-current value for a css/attr write (audit 2026-09-13 P1
|
|
@@ -462,17 +493,90 @@ function expectedValueOf(input: {
|
|
|
462
493
|
*/
|
|
463
494
|
export type ReorderOpResult =
|
|
464
495
|
| { ok: true; delta: number; movedId: string | null; semanticId: string | null; seq: number }
|
|
465
|
-
| { ok: false; status: number; error: string };
|
|
496
|
+
| { ok: false; status: number; error: string; code?: 'locked' };
|
|
466
497
|
|
|
467
498
|
export type ReorderRevertResult =
|
|
468
499
|
| { ok: true; dir: 'undo' | 'redo' }
|
|
469
500
|
| { ok: false; status: number; error: string };
|
|
470
501
|
|
|
502
|
+
/** S4.7 — one lane of a two-lane action, as file text (the runtime canonicalizes). */
|
|
503
|
+
export interface LaneChange {
|
|
504
|
+
/** S2.9b adds `meta`: an artboard move and its annotation riders (one action). S2.10b adds `html`:
|
|
505
|
+
* an edit-op's source and its layout lane (a copy and its place, an artboard moved to the trash). */
|
|
506
|
+
lane: 'annotations' | 'comments' | 'meta' | 'html';
|
|
507
|
+
text: string;
|
|
508
|
+
baseText: string;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/** S2.9b — the `annotations` rider of an artboard move (routes/canvas-meta-rider.ts). */
|
|
512
|
+
export interface RiderMove {
|
|
513
|
+
ops: readonly AnnotationOp[];
|
|
514
|
+
/** The bus's `undoGroup`: the write id the layout and its riders share. */
|
|
515
|
+
actionId: string;
|
|
516
|
+
/** The move-delta rule over the board and the layout the meta holds now; a refusal writes nothing. */
|
|
517
|
+
check(
|
|
518
|
+
board: readonly AnnotationElement[],
|
|
519
|
+
layoutBefore: unknown
|
|
520
|
+
): { status: number; body: Record<string, unknown> } | null;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
export type RiderMoveResult =
|
|
524
|
+
| { ok: true; meta: Record<string, unknown>; actionId?: string; queued?: boolean }
|
|
525
|
+
| { ok: false; status: number; body: Record<string, unknown> };
|
|
526
|
+
|
|
527
|
+
export interface LanesOutcome {
|
|
528
|
+
status: 'accepted' | 'rejected';
|
|
529
|
+
code?: string;
|
|
530
|
+
actionId?: string;
|
|
531
|
+
/** Not answered yet: the proposal waits in the durable outbox. */
|
|
532
|
+
queued?: boolean;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/** S4.7 — the home a two-lane action goes to (the hub runtime or the local home). */
|
|
536
|
+
export interface LanesProposer {
|
|
537
|
+
/** Accepted-revisions mode: the action IS the change; the disk is written raw. */
|
|
538
|
+
accepted: boolean;
|
|
539
|
+
send(lanes: LaneChange[]): Promise<LanesOutcome>;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
export type ConvertChange<T> = (cur: {
|
|
543
|
+
board: AnnotationElement[];
|
|
544
|
+
comments: Comment[];
|
|
545
|
+
}) =>
|
|
546
|
+
| { ok: true; ops: AnnotationOp[]; comments: Comment[]; result: T }
|
|
547
|
+
| { ok: false; status: number; body: Record<string, unknown> };
|
|
548
|
+
|
|
549
|
+
/** What a conversion replaced — the no-home undo token's payload. */
|
|
550
|
+
export interface ConvertSnapshot {
|
|
551
|
+
file: string;
|
|
552
|
+
/** canonical board text ('' = no board) */
|
|
553
|
+
boardBefore: string;
|
|
554
|
+
boardAfter: string;
|
|
555
|
+
commentsBefore: Comment[];
|
|
556
|
+
commentsAfter: Comment[];
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
export type ConvertResult<T> =
|
|
560
|
+
| {
|
|
561
|
+
ok: true;
|
|
562
|
+
result: T;
|
|
563
|
+
snapshot: ConvertSnapshot;
|
|
564
|
+
actionId?: string;
|
|
565
|
+
queued?: boolean;
|
|
566
|
+
}
|
|
567
|
+
| { ok: false; status: number; body: Record<string, unknown> };
|
|
568
|
+
|
|
471
569
|
export interface Api {
|
|
472
570
|
// File tree
|
|
473
571
|
fileSlug(file: string): string;
|
|
474
572
|
loadCommentsForFile(file: string): Promise<Comment[]>;
|
|
475
573
|
saveCommentsForFile(file: string, list: Comment[]): Promise<void>;
|
|
574
|
+
/**
|
|
575
|
+
* S2.2b — rewrite one canvas's comment list through the one publish path (shared doc first, then
|
|
576
|
+
* disk): `fn` gets the current list and returns the new one, or null for "no change". Used by
|
|
577
|
+
* `element.set-id` to move element pins with a renamed id.
|
|
578
|
+
*/
|
|
579
|
+
rewriteComments(file: string, fn: (list: Comment[]) => Comment[] | null): Promise<void>;
|
|
476
580
|
loadAllComments(): Promise<Record<string, Comment[]>>;
|
|
477
581
|
/**
|
|
478
582
|
* Resolve a canvas URL slug back to its repo-relative `file` path by scanning
|
|
@@ -487,6 +591,9 @@ export interface Api {
|
|
|
487
591
|
commentsPatch(id: string, patch: Partial<Comment>): Promise<Comment | null>;
|
|
488
592
|
commentsDelete(id: string): Promise<boolean>;
|
|
489
593
|
commentsAddReply(id: string, payload: { body: string; author?: string }): Promise<Comment | null>;
|
|
594
|
+
/** S9.7b — `POST /_api/comments/op` (routes/comments.ts): one op on `file`'s threads. */
|
|
595
|
+
commentOp(file: string, op: CommentOp, actor: OpActor): Promise<OpResult | DoorRefusal>;
|
|
596
|
+
commentFileOf(id: string): Promise<string | null>;
|
|
490
597
|
gitCommitters(): Promise<GitCommitter[]>;
|
|
491
598
|
/**
|
|
492
599
|
* Phase 8 — local `git config user.name`, cached for the process lifetime.
|
|
@@ -512,6 +619,19 @@ export interface Api {
|
|
|
512
619
|
file: string,
|
|
513
620
|
patch: Record<string, unknown>
|
|
514
621
|
): Promise<Record<string, unknown> | null>;
|
|
622
|
+
/**
|
|
623
|
+
* S3.5 — the versioned `.meta.json` writer outside the layout lane (`PATCH /_api/present-meta`):
|
|
624
|
+
* writes `nextText` and fires the same `onMetaChanged` hook (→ meta `lane.replace`, `baseText` =
|
|
625
|
+
* the file text it replaced) and cell announce as a layout write. No `last_modified` stamp. False
|
|
626
|
+
* when the path is refused.
|
|
627
|
+
*/
|
|
628
|
+
writeCanvasMetaText(
|
|
629
|
+
file: string,
|
|
630
|
+
nextText: string,
|
|
631
|
+
baseText: string | null,
|
|
632
|
+
/** S2.10b — `hooks: false`: an accepted-mode action already carries the lane (no `onMetaChanged`) */
|
|
633
|
+
opts?: { hooks?: boolean }
|
|
634
|
+
): Promise<boolean>;
|
|
515
635
|
// Annotations board (DDR-242 — .design/<slug>.annotations.json)
|
|
516
636
|
/** Canonical board text; a not-yet-migrated legacy SVG is read through the migration. */
|
|
517
637
|
loadAnnotations(file: string): Promise<string | null>;
|
|
@@ -519,16 +639,47 @@ export interface Api {
|
|
|
519
639
|
readBoard(
|
|
520
640
|
file: string
|
|
521
641
|
): Promise<{ ok: true; text: string | null } | { ok: false; error: string }>;
|
|
642
|
+
/**
|
|
643
|
+
* S4.V4 G4 — `readBoard`, but a live collab room's board wins over the file its debounced flush has
|
|
644
|
+
* not caught up with: read-your-writes for a door that reads right after `applyAnnotationOps` (the vote
|
|
645
|
+
* door: start → GET, start → ballot).
|
|
646
|
+
*/
|
|
647
|
+
readBoardLive(
|
|
648
|
+
file: string
|
|
649
|
+
): Promise<{ ok: true; text: string | null } | { ok: false; error: string }>;
|
|
522
650
|
/** Whole-board write (board text or legacy SVG, canonicalized). */
|
|
523
651
|
saveAnnotations(file: string, text: string, writeId?: string, base?: string): Promise<boolean>;
|
|
524
652
|
/** The canvas write path: an op batch under the DDR-242 merge rule. */
|
|
525
653
|
applyAnnotationOps(
|
|
526
654
|
file: string,
|
|
527
655
|
ops: readonly AnnotationOp[],
|
|
528
|
-
actionId?: string
|
|
656
|
+
actionId?: string,
|
|
657
|
+
/** S2.10c — `hooks: false`: the file only (no live room, no change hook) — an accepted-mode
|
|
658
|
+
* action already carries the annotations lane (routes/edit.ts, an artboard moved to the trash) */
|
|
659
|
+
opts?: {
|
|
660
|
+
hooks?: boolean;
|
|
661
|
+
/** sec-a M1 — refuse the WHOLE batch when the guard names a change (HTTP writers pass
|
|
662
|
+
* `voteDoorOnly`; the in-process vote door passes none). `refused` in the result. */
|
|
663
|
+
guard?: BoardGuard;
|
|
664
|
+
}
|
|
529
665
|
): Promise<AnnotationOpsResult>;
|
|
530
666
|
/** Materialize a document snapshot without publishing it as another user edit. */
|
|
531
667
|
projectAnnotations(file: string, text: string, isCurrent: () => boolean): Promise<boolean>;
|
|
668
|
+
/** S4.7 — the board and the comments of one canvas as ONE project action. */
|
|
669
|
+
convertLanes<T>(
|
|
670
|
+
file: string,
|
|
671
|
+
change: ConvertChange<T>,
|
|
672
|
+
proposer: LanesProposer | null
|
|
673
|
+
): Promise<ConvertResult<T>>;
|
|
674
|
+
/** S4.7 — the no-home undo of a conversion (refused `stale` once a lane moved on). */
|
|
675
|
+
restoreConversion(s: ConvertSnapshot): Promise<{ ok: boolean; reason?: string }>;
|
|
676
|
+
/** S2.9b — an artboard move + its annotation riders as ONE project action. */
|
|
677
|
+
moveArtboardsWithRider(
|
|
678
|
+
file: string,
|
|
679
|
+
layout: unknown,
|
|
680
|
+
rider: RiderMove,
|
|
681
|
+
proposer: LanesProposer | null
|
|
682
|
+
): Promise<RiderMoveResult>;
|
|
532
683
|
// Phase 23 — content-addressed binary image write (drag-drop / paste / picker)
|
|
533
684
|
saveAsset(bytes: Uint8Array): Promise<SaveAssetResult>;
|
|
534
685
|
/** Stage F1 — list content-addressed image/video assets for the AssetPicker. */
|
|
@@ -590,6 +741,7 @@ export interface Api {
|
|
|
590
741
|
name?: unknown;
|
|
591
742
|
kind?: unknown;
|
|
592
743
|
group?: unknown;
|
|
744
|
+
fromPrompt?: unknown;
|
|
593
745
|
clips?: unknown;
|
|
594
746
|
fps?: unknown;
|
|
595
747
|
width?: unknown;
|
|
@@ -598,7 +750,7 @@ export interface Api {
|
|
|
598
750
|
// Duplicate a canvas beside itself ("<name> copy") — POST /_api/canvas
|
|
599
751
|
// { duplicateOf }. Source, meta and the whiteboard layer; not comments or
|
|
600
752
|
// history, which belong to the original.
|
|
601
|
-
duplicateCanvas(input: { file?: unknown }): Promise<CreateCanvasResult>;
|
|
753
|
+
duplicateCanvas(input: { file?: unknown } & DuplicateCanvasOpts): Promise<CreateCanvasResult>;
|
|
602
754
|
// Soft-delete a canvas from the browser (Phase 22 — DELETE /_api/canvas)
|
|
603
755
|
deleteCanvas(input: { file?: unknown }): Promise<DeleteCanvasResult>;
|
|
604
756
|
// feature-file-tree-drag-drop-folders (Task 3) — move/rename a canvas + its
|
|
@@ -658,31 +810,6 @@ export interface Api {
|
|
|
658
810
|
durationInFrames?: unknown;
|
|
659
811
|
from?: unknown;
|
|
660
812
|
}): Promise<{ ok: true; seq?: number } | { ok: false; status: number; error: string }>;
|
|
661
|
-
// feature-enhanced-video-editing (Phase 2) — parametric clip verbs (speed ·
|
|
662
|
-
// trim-in · audio · detach-audio · framing · grade · transition).
|
|
663
|
-
clipEditOp(input: {
|
|
664
|
-
canvas?: unknown;
|
|
665
|
-
artboardId?: unknown;
|
|
666
|
-
stableId?: unknown;
|
|
667
|
-
contentHash?: unknown;
|
|
668
|
-
verb?: unknown;
|
|
669
|
-
rate?: unknown;
|
|
670
|
-
deltaFrames?: unknown;
|
|
671
|
-
muted?: unknown;
|
|
672
|
-
volume?: unknown;
|
|
673
|
-
framing?: unknown;
|
|
674
|
-
grade?: unknown;
|
|
675
|
-
presentation?: unknown;
|
|
676
|
-
durationInFrames?: unknown;
|
|
677
|
-
atFrame?: unknown;
|
|
678
|
-
src?: unknown;
|
|
679
|
-
mediaKind?: unknown;
|
|
680
|
-
text?: unknown;
|
|
681
|
-
toIndex?: unknown;
|
|
682
|
-
}): Promise<
|
|
683
|
-
| { ok: true; seq?: number; extra?: Record<string, unknown> }
|
|
684
|
-
| { ok: false; status: number; error: string }
|
|
685
|
-
>;
|
|
686
813
|
// DDR-150 P3 — remove a clip addressed by stableId (fingerprint + semantic
|
|
687
814
|
// gate; refuses the only clip; drops an adjacent transition in a series).
|
|
688
815
|
removeSequenceOp(input: {
|
|
@@ -759,7 +886,8 @@ export interface Api {
|
|
|
759
886
|
id?: unknown;
|
|
760
887
|
idIndex?: unknown;
|
|
761
888
|
}): Promise<
|
|
762
|
-
{ ok: true; deletedId: string; seq?: number }
|
|
889
|
+
| { ok: true; deletedId: string; seq?: number }
|
|
890
|
+
| { ok: false; status: number; error: string; code?: 'locked' }
|
|
763
891
|
>;
|
|
764
892
|
/**
|
|
765
893
|
* feature-4 T8 (convert-to-absolute, DDR-188) — rewrite a container's stamped
|
|
@@ -775,7 +903,9 @@ export interface Api {
|
|
|
775
903
|
children?: unknown;
|
|
776
904
|
containers?: unknown;
|
|
777
905
|
dissolve?: unknown;
|
|
778
|
-
}): Promise<
|
|
906
|
+
}): Promise<
|
|
907
|
+
{ ok: true; seq?: number } | { ok: false; status: number; error: string; code?: 'locked' }
|
|
908
|
+
>;
|
|
779
909
|
/**
|
|
780
910
|
* Insert a synthesized div/text/image relative to a reference element, OR —
|
|
781
911
|
* when the artboard has no element to anchor on yet — as a direct child of
|
|
@@ -791,7 +921,8 @@ export interface Api {
|
|
|
791
921
|
src?: unknown;
|
|
792
922
|
refIndex?: unknown;
|
|
793
923
|
}): Promise<
|
|
794
|
-
{ ok: true; newId: string | null; seq?: number }
|
|
924
|
+
| { ok: true; newId: string | null; seq?: number }
|
|
925
|
+
| { ok: false; status: number; error: string; code?: 'locked' }
|
|
795
926
|
>;
|
|
796
927
|
/** Insert a new empty artboard from a screen-size preset. */
|
|
797
928
|
insertArtboardOp(input: {
|
|
@@ -890,7 +1021,8 @@ export interface Api {
|
|
|
890
1021
|
id?: unknown;
|
|
891
1022
|
idIndex?: unknown;
|
|
892
1023
|
}): Promise<
|
|
893
|
-
{ ok: true; detachedName: string; seq?: number }
|
|
1024
|
+
| { ok: true; detachedName: string; seq?: number }
|
|
1025
|
+
| { ok: false; status: number; error: string; code?: 'locked' }
|
|
894
1026
|
>;
|
|
895
1027
|
// Undo/redo a prior reorder by seq (Cmd+Z from the canvas undo stack). Whole-
|
|
896
1028
|
// file content swap from the in-memory revert log — immune to the positional
|
|
@@ -926,19 +1058,31 @@ export interface ApiHooks {
|
|
|
926
1058
|
/**
|
|
927
1059
|
* Fires after every successful annotations write with the new canonical
|
|
928
1060
|
* board text, the action/write id and the board text it replaced (a merge
|
|
929
|
-
* base for accepted revisions).
|
|
1061
|
+
* base for accepted revisions). `recordedWithLanes`: the caller sends this board to the op log in the
|
|
1062
|
+
* same action as another lane (`proposer.send(lanes)` — the artboard move rider, a conversion), so the
|
|
1063
|
+
* hook must not record it a second time as a stroke of its own; the room bridge still runs.
|
|
930
1064
|
*/
|
|
931
|
-
onAnnotationsChanged?: (
|
|
1065
|
+
onAnnotationsChanged?: (
|
|
1066
|
+
file: string,
|
|
1067
|
+
text: string,
|
|
1068
|
+
writeId?: string,
|
|
1069
|
+
base?: string,
|
|
1070
|
+
recordedWithLanes?: boolean
|
|
1071
|
+
) => void;
|
|
932
1072
|
/**
|
|
933
1073
|
* Apply an op batch to the canvas's LIVE collab room, when one holds the
|
|
934
1074
|
* board (code review H1). `null` = no live room / accepted mode — the batch
|
|
935
1075
|
* goes to disk. The room's persistence projects the result to the file.
|
|
936
1076
|
*/
|
|
1077
|
+
/** S4.V4 G4 — the live room's board text (`null` = no live room / accepted mode: read the file). */
|
|
1078
|
+
readAnnotationsLive?: (file: string) => string | null;
|
|
937
1079
|
applyAnnotationOpsLive?: (
|
|
938
1080
|
file: string,
|
|
939
1081
|
ops: readonly AnnotationOp[],
|
|
940
|
-
actionId?: string
|
|
941
|
-
|
|
1082
|
+
actionId?: string,
|
|
1083
|
+
/** sec-a M1 — checked against the ROOM's before/after; a hit writes nothing (`'refused'`). */
|
|
1084
|
+
guard?: BoardGuard
|
|
1085
|
+
) => ApplyResult | 'too-large' | 'refused' | null;
|
|
942
1086
|
/**
|
|
943
1087
|
* Accepted-revisions mode (DDR-241): propose a folder operation as ONE
|
|
944
1088
|
* project action before touching disk. Absent, or answering `null`, means
|
|
@@ -995,6 +1139,8 @@ export interface AnnotationOpsResult {
|
|
|
995
1139
|
error?: string;
|
|
996
1140
|
/** The board on disk exists but can't be read — nothing was written (HTTP 409). */
|
|
997
1141
|
unreadable?: boolean;
|
|
1142
|
+
/** sec-a M1 — the batch's guard refused it (a vote / ballot change off the vote door; HTTP 403). */
|
|
1143
|
+
refused?: string;
|
|
998
1144
|
}
|
|
999
1145
|
|
|
1000
1146
|
/**
|
|
@@ -1029,6 +1175,31 @@ export const ASSET_SESSION_BUDGET = (() => {
|
|
|
1029
1175
|
return Number.isFinite(env) && env > 0 ? env : 4 * 1024 * 1024 * 1024;
|
|
1030
1176
|
})();
|
|
1031
1177
|
|
|
1178
|
+
/**
|
|
1179
|
+
* gate-b-c4k — what ONE canvas frame (subject + canvas set, access/frame.ts `currentFrameKey`) may
|
|
1180
|
+
* write to `assets/` per server instance, inside `ASSET_SESSION_BUDGET` (still the global
|
|
1181
|
+
* backstop). Canvas code in a frame is untrusted (DDR-054) and c4i lets an editable frame upload:
|
|
1182
|
+
* without this one frame's loop spent the whole budget and the owner's own drops answered 429
|
|
1183
|
+
* until a restart. Two full chunked clips by default; `MAUDE_ASSET_FRAME_BUDGET` (bytes).
|
|
1184
|
+
*/
|
|
1185
|
+
export const ASSET_FRAME_BUDGET = (() => {
|
|
1186
|
+
const env = Number(process.env.MAUDE_ASSET_FRAME_BUDGET);
|
|
1187
|
+
return Number.isFinite(env) && env > 0 ? env : 1024 * 1024 * 1024;
|
|
1188
|
+
})();
|
|
1189
|
+
|
|
1190
|
+
/**
|
|
1191
|
+
* gate-b-c4l (LOW) — what ALL frames together may write per server instance: one shared counter
|
|
1192
|
+
* over every frame-originated upload, capped at half of `ASSET_SESSION_BUDGET` (an override,
|
|
1193
|
+
* `MAUDE_ASSET_FRAMES_BUDGET`, can only lower it). Per-frame budgets alone summed to the global
|
|
1194
|
+
* one across N frames (one per canvas the opener can open), and the owner's main-origin drops then
|
|
1195
|
+
* answered 429; the main origin now always keeps at least the other half.
|
|
1196
|
+
*/
|
|
1197
|
+
export const ASSET_FRAMES_BUDGET = (() => {
|
|
1198
|
+
const half = Math.floor(ASSET_SESSION_BUDGET / 2);
|
|
1199
|
+
const env = Number(process.env.MAUDE_ASSET_FRAMES_BUDGET);
|
|
1200
|
+
return Number.isFinite(env) && env > 0 ? Math.min(env, half) : half;
|
|
1201
|
+
})();
|
|
1202
|
+
|
|
1032
1203
|
/**
|
|
1033
1204
|
* Phase 23 — content-type sniff from the first bytes (magic numbers). The
|
|
1034
1205
|
* declared name / extension / Content-Type is NEVER trusted — the bytes decide
|
|
@@ -1271,6 +1442,13 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
1271
1442
|
const onCommentsChanged = hooks.onCommentsChanged;
|
|
1272
1443
|
const onAnnotationsChanged = hooks.onAnnotationsChanged;
|
|
1273
1444
|
const { paths, cfg } = ctx;
|
|
1445
|
+
// p8-a1-save-hold — a person's save held behind an AI interpreter call says its bytes when it lands;
|
|
1446
|
+
// p8-sec2-attrib A1 — and every person's source save it hears is noted as theirs (`notePersonWrite`)
|
|
1447
|
+
saveHold().attach({
|
|
1448
|
+
emit: (ev, p) => ctx.bus.emit(ev, p),
|
|
1449
|
+
on: (ev, fn) => ctx.bus.on(ev, fn),
|
|
1450
|
+
designRoot: paths.designRoot,
|
|
1451
|
+
});
|
|
1274
1452
|
|
|
1275
1453
|
// Phase 12.1 — in-memory reorder revert log (Cmd+Z for drag/keyboard moves).
|
|
1276
1454
|
// Whole-file {before, after} per reorder, keyed by a monotonic seq the client
|
|
@@ -1299,6 +1477,49 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
1299
1477
|
return seq;
|
|
1300
1478
|
}
|
|
1301
1479
|
|
|
1480
|
+
/**
|
|
1481
|
+
* The studio just wrote `after` to canvas `rel` itself: say so, with what it did. The home then records the
|
|
1482
|
+
* person's own `edit` (undoable by ⌘Z) rather than an `outside` change the ⌘Z projection never reaches —
|
|
1483
|
+
* the file-watcher alone cannot tell a ⌘D from an external editor's save (P8-B2).
|
|
1484
|
+
*/
|
|
1485
|
+
function noteSourceWritten(rel: string, after: string, label: string): void {
|
|
1486
|
+
ctx.bus.emit('source-written', { rel, content: after, label });
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
/**
|
|
1490
|
+
* F4 — `fn`'s canvas writes said BEFORE their bytes land (`source-writing`, the local home's early note),
|
|
1491
|
+
* like routes/edit.ts: the watcher, or a ⌘Z's undo-stack read, arriving between the bytes and
|
|
1492
|
+
* `source-written` (one file read later) then finds the person's edit, never an `outside` change. A
|
|
1493
|
+
* write that throws takes its note back (`source-write-failed`, F5).
|
|
1494
|
+
*/
|
|
1495
|
+
function sayingWrites<T>(
|
|
1496
|
+
base: string,
|
|
1497
|
+
label: string | undefined,
|
|
1498
|
+
fn: () => Promise<T>
|
|
1499
|
+
): Promise<T> {
|
|
1500
|
+
let replaced = base;
|
|
1501
|
+
return sayingCanvasWrites(
|
|
1502
|
+
{
|
|
1503
|
+
...(label ? { label } : {}),
|
|
1504
|
+
writing: (abs, content) => {
|
|
1505
|
+
ctx.bus.emit('source-writing', {
|
|
1506
|
+
rel: path.relative(paths.designRoot, abs),
|
|
1507
|
+
content,
|
|
1508
|
+
base: replaced,
|
|
1509
|
+
...(label ? { label } : {}),
|
|
1510
|
+
});
|
|
1511
|
+
replaced = content;
|
|
1512
|
+
},
|
|
1513
|
+
failed: (abs, content) =>
|
|
1514
|
+
ctx.bus.emit('source-write-failed', {
|
|
1515
|
+
rel: path.relative(paths.designRoot, abs),
|
|
1516
|
+
content,
|
|
1517
|
+
}),
|
|
1518
|
+
},
|
|
1519
|
+
fn
|
|
1520
|
+
);
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1302
1523
|
// ── Structural-write throttle + source-size ceiling (G3 security, DDR-152) ──
|
|
1303
1524
|
// The new structural verbs (delete / insert-element / insert-artboard /
|
|
1304
1525
|
// resize-artboard) are the first that let an UNTRUSTED active canvas both
|
|
@@ -1348,6 +1569,81 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
1348
1569
|
return canvasSlugFromRel(file, paths.designRel);
|
|
1349
1570
|
}
|
|
1350
1571
|
|
|
1572
|
+
// S1.23b — names that collide in sync. Two names that differ only in what the sync slug flattens
|
|
1573
|
+
// (an em dash vs a hyphen, `a%20b` vs `a b`, case, `ui/a/b` vs `ui/a-b`) share ONE sync document,
|
|
1574
|
+
// and one canvas would overwrite the other on every peer. Every path that writes a new canvas or
|
|
1575
|
+
// folder name asks here first; `sync-name-key.ts` holds the key and the words.
|
|
1576
|
+
/** Every canvas under a canvas group, as design-root-relative paths (`ui/Poster.tsx`). */
|
|
1577
|
+
async function allCanvasRels(): Promise<string[]> {
|
|
1578
|
+
const drPrefix = paths.designRel.replace(/^\/+|\/+$/g, '');
|
|
1579
|
+
const out: string[] = [];
|
|
1580
|
+
for (const g of cfg.canvasGroups) {
|
|
1581
|
+
let files: string[];
|
|
1582
|
+
try {
|
|
1583
|
+
files = await findHtmlFiles(
|
|
1584
|
+
path.join(paths.designRoot, g.path),
|
|
1585
|
+
path.posix.join(paths.designRel, g.path)
|
|
1586
|
+
);
|
|
1587
|
+
} catch {
|
|
1588
|
+
continue;
|
|
1589
|
+
}
|
|
1590
|
+
for (const f of files)
|
|
1591
|
+
out.push(f.startsWith(`${drPrefix}/`) ? f.slice(drPrefix.length + 1) : f);
|
|
1592
|
+
}
|
|
1593
|
+
return out;
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
/** The 409 for `toRel` (a canvas or a folder, design-root-relative) when its sync key is one an
|
|
1597
|
+
* existing different canvas already has. `except` is what is moving (the same canvas, or a batch
|
|
1598
|
+
* that goes together). Returns null when the name is clear. */
|
|
1599
|
+
async function closeCanvasName(
|
|
1600
|
+
name: string,
|
|
1601
|
+
toRel: string,
|
|
1602
|
+
except: (rel: string) => boolean = () => false
|
|
1603
|
+
): Promise<{ ok: false; status: 409; error: string } | null> {
|
|
1604
|
+
const other = findCloseName(toRel, await allCanvasRels(), except);
|
|
1605
|
+
if (!other) return null;
|
|
1606
|
+
const dir = path.posix.dirname(toRel);
|
|
1607
|
+
return {
|
|
1608
|
+
ok: false,
|
|
1609
|
+
status: 409,
|
|
1610
|
+
error: tooCloseText(name, other, dir === '.' ? '' : dir),
|
|
1611
|
+
};
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
/** Same, for a FOLDER name among the folders beside it: two sibling folders that share a key give
|
|
1615
|
+
* every same-named canvas inside them one document. */
|
|
1616
|
+
async function closeFolderName(
|
|
1617
|
+
name: string,
|
|
1618
|
+
parentRel: string,
|
|
1619
|
+
selfRel?: string
|
|
1620
|
+
): Promise<{ ok: false; status: 409; error: string } | null> {
|
|
1621
|
+
let entries: Dirent[];
|
|
1622
|
+
try {
|
|
1623
|
+
entries = await readdir(path.join(paths.designRoot, parentRel), { withFileTypes: true });
|
|
1624
|
+
} catch {
|
|
1625
|
+
return null;
|
|
1626
|
+
}
|
|
1627
|
+
const siblings = entries
|
|
1628
|
+
.filter((e) => e.isDirectory() && !e.name.startsWith('.') && !e.name.startsWith('_'))
|
|
1629
|
+
.map((e) => path.posix.join(parentRel, e.name));
|
|
1630
|
+
const toRel = path.posix.join(parentRel, name);
|
|
1631
|
+
const other = findCloseName(toRel, siblings, (r) => r === selfRel);
|
|
1632
|
+
if (!other) return null;
|
|
1633
|
+
return { ok: false, status: 409, error: tooCloseText(name, other, parentRel) };
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
/** True when both paths are the one file or folder (a case-only rename on a case-insensitive
|
|
1637
|
+
* volume: the target "exists" because it is the source). */
|
|
1638
|
+
async function isSameEntry(a: string, b: string): Promise<boolean> {
|
|
1639
|
+
try {
|
|
1640
|
+
const [sa, sb] = await Promise.all([statp(a), statp(b)]);
|
|
1641
|
+
return sa.dev === sb.dev && sa.ino === sb.ino && sa.ino !== 0;
|
|
1642
|
+
} catch {
|
|
1643
|
+
return false;
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1351
1647
|
async function fileForSlug(slug: string): Promise<string | null> {
|
|
1352
1648
|
// Authoritative slug → canvas-file resolver: enumerate the real canvas
|
|
1353
1649
|
// files under each canvas group and match by the canonical slug. Unlike a
|
|
@@ -1370,8 +1666,41 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
1370
1666
|
return null;
|
|
1371
1667
|
}
|
|
1372
1668
|
|
|
1669
|
+
/**
|
|
1670
|
+
* sec-a2 (Windows backslash) — a per-canvas sidecar is ONE file directly in `dir`.
|
|
1671
|
+
* `canvasSlugFromRel` flattens `/` but not `\`, and on Windows `path.join` treats `\` as a
|
|
1672
|
+
* separator, so a canvas named `..\..\x` reached a board or comment file outside the design
|
|
1673
|
+
* root. A slug carrying `\` is refused everywhere (it is never a canvas a person made in the
|
|
1674
|
+
* studio, which writes `/`), and the result must still sit directly in `dir`. Throws — every
|
|
1675
|
+
* caller is a read that already fails soft or a write that must not happen.
|
|
1676
|
+
*/
|
|
1677
|
+
function sidecarPath(dir: string, file: string, suffix: string): string {
|
|
1678
|
+
const slug = fileSlug(file);
|
|
1679
|
+
const base = path.resolve(dir);
|
|
1680
|
+
const abs = path.resolve(base, `${slug}${suffix}`);
|
|
1681
|
+
if (!slug || slug.includes('\\') || slug.includes('\0') || path.dirname(abs) !== base) {
|
|
1682
|
+
throw new Error('not a canvas path');
|
|
1683
|
+
}
|
|
1684
|
+
if (slugSidecarRefused(abs)) throw new Error('not a canvas path');
|
|
1685
|
+
return abs;
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
/**
|
|
1689
|
+
* gate-b-c4g — a canvas-only session (every frame is one) reaches a SLUG-keyed sidecar only when
|
|
1690
|
+
* its closure owns it. `ui/a-b.tsx`, `ui/a/b.tsx` and `UI/A-B.tsx` fold to one slug and so share
|
|
1691
|
+
* one comments file and one board; the closure gives that shared set to none of them
|
|
1692
|
+
* (access/closure.ts `ownedOf`), so a frame on A neither reads nor writes B's threads.
|
|
1693
|
+
*/
|
|
1694
|
+
function slugSidecarRefused(abs: string): boolean {
|
|
1695
|
+
const access = currentAccess();
|
|
1696
|
+
if (!access.canvasOnly) return false;
|
|
1697
|
+
const closure = projectVisibility(ctx).closureOf(access);
|
|
1698
|
+
const rel = path.relative(paths.designRoot, abs).split(path.sep).join('/');
|
|
1699
|
+
return !closure?.owned.has(rel);
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1373
1702
|
function commentsPath(file: string): string {
|
|
1374
|
-
return
|
|
1703
|
+
return sidecarPath(paths.commentsDir, file, '.json');
|
|
1375
1704
|
}
|
|
1376
1705
|
|
|
1377
1706
|
async function loadCommentsForFile(file: string): Promise<Comment[]> {
|
|
@@ -1395,41 +1724,19 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
1395
1724
|
}
|
|
1396
1725
|
}
|
|
1397
1726
|
|
|
1398
|
-
// Security (adversarial review 2026-07-30):
|
|
1399
|
-
//
|
|
1400
|
-
//
|
|
1401
|
-
//
|
|
1402
|
-
//
|
|
1403
|
-
// the agent) passes through: bound `lane`/`clipStableId` length, coerce frame
|
|
1404
|
-
// ints, and drop unknown fields — a poisoned over-long `lane` can't smuggle an
|
|
1405
|
-
// instruction past the 40-char label the feature is documented to carry.
|
|
1406
|
-
function sanitizeTimelineAnchor(raw: unknown): Comment['timeline'] | undefined {
|
|
1407
|
-
if (!raw || typeof raw !== 'object') return undefined;
|
|
1408
|
-
const t = raw as Record<string, unknown>;
|
|
1409
|
-
const anchor: NonNullable<Comment['timeline']> = {};
|
|
1410
|
-
if (typeof t.clipStableId === 'string' && t.clipStableId.length <= 200)
|
|
1411
|
-
anchor.clipStableId = t.clipStableId;
|
|
1412
|
-
if (Number.isFinite(Number(t.frameOffset)))
|
|
1413
|
-
anchor.frameOffset = Math.max(0, Math.round(Number(t.frameOffset)));
|
|
1414
|
-
if (Number.isFinite(Number(t.frame))) anchor.frame = Math.max(0, Math.round(Number(t.frame)));
|
|
1415
|
-
if (typeof t.lane === 'string' && t.lane.length <= 40) anchor.lane = t.lane;
|
|
1416
|
-
return anchor.clipStableId != null || anchor.frame != null ? anchor : undefined;
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1727
|
+
// Security (adversarial review 2026-07-30): every anchor is read by the /design:edit agent as
|
|
1728
|
+
// navigation, and a comment can arrive from an UNTRUSTED hub peer (DDR-054) via the sync-persist
|
|
1729
|
+
// path, which does NOT go through commentsAdd. So the anchors are re-clamped HERE, at the read
|
|
1730
|
+
// boundary every consumer passes through (comments/anchors.ts — one reader for the studio and
|
|
1731
|
+
// the hub door): a shape that fails is dropped, the comment renders detached, never deleted.
|
|
1419
1732
|
function backfillComment(raw: unknown): Comment {
|
|
1420
|
-
|
|
1421
|
-
const
|
|
1733
|
+
// S8.17b — + the Figma-writer label on the root and each reply (comments/imported-from.ts).
|
|
1734
|
+
const c = withSanitizedImportedFrom(withSanitizedAnchors((raw ?? {}) as Partial<Comment>));
|
|
1422
1735
|
return {
|
|
1423
1736
|
...(c as Comment),
|
|
1424
1737
|
author: typeof c.author === 'string' ? c.author : '',
|
|
1425
1738
|
thread: Array.isArray(c.thread) ? c.thread : [],
|
|
1426
1739
|
mentions: Array.isArray(c.mentions) ? c.mentions : [],
|
|
1427
|
-
...(timeline ? { timeline } : { timeline: undefined }),
|
|
1428
|
-
// Same trust boundary for the #134/#136 anchors: a peer-synced comment
|
|
1429
|
-
// never passed commentsAdd, so an anchor that fails its shape is dropped
|
|
1430
|
-
// (the comment then renders from `bounds`, detached — never deleted).
|
|
1431
|
-
annotationId: isAnnotationId(c.annotationId) ? c.annotationId : undefined,
|
|
1432
|
-
world: isWorldPoint(c.world) ? { x: c.world.x, y: c.world.y } : undefined,
|
|
1433
1740
|
};
|
|
1434
1741
|
}
|
|
1435
1742
|
|
|
@@ -1469,6 +1776,15 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
1469
1776
|
await saveCommentsForFile(file, settled);
|
|
1470
1777
|
}
|
|
1471
1778
|
|
|
1779
|
+
async function rewriteComments(
|
|
1780
|
+
file: string,
|
|
1781
|
+
fn: (list: Comment[]) => Comment[] | null
|
|
1782
|
+
): Promise<void> {
|
|
1783
|
+
const list = await loadCommentsForFile(file);
|
|
1784
|
+
const next = fn(structuredClone(list));
|
|
1785
|
+
if (next) await publishComments(file, next, list);
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1472
1788
|
async function loadAllComments(): Promise<Record<string, Comment[]>> {
|
|
1473
1789
|
const out: Record<string, Comment[]> = {};
|
|
1474
1790
|
let entries: Dirent[];
|
|
@@ -1484,13 +1800,24 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
1484
1800
|
const arr = JSON.parse(raw);
|
|
1485
1801
|
if (!Array.isArray(arr) || arr.length === 0) continue;
|
|
1486
1802
|
const file = arr[0]?.file as string | undefined;
|
|
1803
|
+
// gate-b-c4g — a canvas's own (slug-named) comments file that its canvas-only session's
|
|
1804
|
+
// closure does not own is a file two canvases share (one slug): the map below keys it by
|
|
1805
|
+
// its first row's canvas, which may be the other one. Not this session's.
|
|
1806
|
+
if (
|
|
1807
|
+
file &&
|
|
1808
|
+
`${fileSlug(file)}.json` === e.name &&
|
|
1809
|
+
slugSidecarRefused(path.join(paths.commentsDir, e.name))
|
|
1810
|
+
)
|
|
1811
|
+
continue;
|
|
1487
1812
|
// Backfill legacy rows so callers see the v2 shape uniformly.
|
|
1488
1813
|
if (file) out[file] = arr.map(backfillComment);
|
|
1489
1814
|
} catch {
|
|
1490
1815
|
/* ignore */
|
|
1491
1816
|
}
|
|
1492
1817
|
}
|
|
1493
|
-
|
|
1818
|
+
// S9.10 (V2-1.16 L10) — only the canvases THIS request's session sees. Every id-based
|
|
1819
|
+
// mutation below scans this map, so an invisible id answers as a missing one (U1).
|
|
1820
|
+
return filterCommentsAll(out, projectVisibility(ctx).current(), paths.designRel);
|
|
1494
1821
|
}
|
|
1495
1822
|
|
|
1496
1823
|
function newCommentId(): string {
|
|
@@ -1507,26 +1834,29 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
1507
1834
|
// repo root. Cached for the lifetime of the process — the local git
|
|
1508
1835
|
// identity doesn't shift mid-session and `Bun.spawn` is cheap-but-not-free.
|
|
1509
1836
|
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1837
|
+
//
|
|
1838
|
+
// The cache is the in-flight ANSWER, not a flag: a flag set before the spawn finished handed every caller
|
|
1839
|
+
// during that spawn '' — and `localAuthor('')` is the OS account, so at boot the shell's `/_api/git-user`
|
|
1840
|
+
// read the account name while each later comment was signed with the git name (r2-e2e-fix: the
|
|
1841
|
+
// Comments panel's Mine read 0 and the row never said "You").
|
|
1842
|
+
let cachedGitUser: Promise<string> | null = null;
|
|
1843
|
+
function gitCurrentUser(): Promise<string> {
|
|
1844
|
+
cachedGitUser ??= (async () => {
|
|
1845
|
+
try {
|
|
1846
|
+
const proc = Bun.spawn(['git', 'config', 'user.name'], {
|
|
1847
|
+
cwd: paths.repoRoot,
|
|
1848
|
+
windowsHide: true,
|
|
1849
|
+
stdout: 'pipe',
|
|
1850
|
+
stderr: 'pipe',
|
|
1851
|
+
});
|
|
1852
|
+
const out = await new Response(proc.stdout).text();
|
|
1853
|
+
await proc.exited;
|
|
1854
|
+
return out.trim();
|
|
1855
|
+
} catch {
|
|
1856
|
+
return '';
|
|
1857
|
+
}
|
|
1858
|
+
})();
|
|
1859
|
+
return cachedGitUser;
|
|
1530
1860
|
}
|
|
1531
1861
|
|
|
1532
1862
|
// `git shortlog -sne` against the repo head — cached for 60 s so the
|
|
@@ -1590,11 +1920,6 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
1590
1920
|
return out;
|
|
1591
1921
|
}
|
|
1592
1922
|
|
|
1593
|
-
function mentionsUnion(c: Comment): string[] {
|
|
1594
|
-
const all = [c.text, ...c.thread.map((r) => r.body)].join('\n');
|
|
1595
|
-
return parseMentions(all);
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1598
1923
|
async function commentsAdd(payload: Partial<Comment> & { file: string; text: string }) {
|
|
1599
1924
|
if (!payload || typeof payload.file !== 'string' || !payload.file) return null;
|
|
1600
1925
|
if (typeof payload.text !== 'string' || !payload.text.trim()) return null;
|
|
@@ -1604,7 +1929,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
1604
1929
|
const author =
|
|
1605
1930
|
typeof payload.author === 'string' && payload.author.trim()
|
|
1606
1931
|
? payload.author.trim().slice(0, 120)
|
|
1607
|
-
: await gitCurrentUser();
|
|
1932
|
+
: localAuthor(await gitCurrentUser());
|
|
1608
1933
|
const c: Comment = {
|
|
1609
1934
|
id: newCommentId(),
|
|
1610
1935
|
file: payload.file,
|
|
@@ -1650,6 +1975,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
1650
1975
|
// #134/#136 — annotation / world anchors (peer-supplied: shape-checked).
|
|
1651
1976
|
if (isAnnotationId(payload.annotationId)) c.annotationId = payload.annotationId;
|
|
1652
1977
|
if (isWorldPoint(payload.world)) c.world = { x: payload.world.x, y: payload.world.y };
|
|
1978
|
+
Object.assign(c, readAnchors(payload)); // S9.7 — + artboard / t / mm
|
|
1653
1979
|
list.push(c);
|
|
1654
1980
|
await publishComments(payload.file, list, base);
|
|
1655
1981
|
return c;
|
|
@@ -1671,7 +1997,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
1671
1997
|
const author =
|
|
1672
1998
|
typeof payload.author === 'string' && payload.author.trim()
|
|
1673
1999
|
? payload.author.trim().slice(0, 120)
|
|
1674
|
-
: await gitCurrentUser();
|
|
2000
|
+
: localAuthor(await gitCurrentUser());
|
|
1675
2001
|
const reply: Reply = {
|
|
1676
2002
|
id: newReplyId(),
|
|
1677
2003
|
author,
|
|
@@ -1679,7 +2005,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
1679
2005
|
created: new Date().toISOString(),
|
|
1680
2006
|
};
|
|
1681
2007
|
entry.thread = [...entry.thread, reply];
|
|
1682
|
-
entry.mentions =
|
|
2008
|
+
entry.mentions = mentionsOf(entry);
|
|
1683
2009
|
await publishComments(file, list, base);
|
|
1684
2010
|
return entry;
|
|
1685
2011
|
}
|
|
@@ -1706,9 +2032,10 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
1706
2032
|
entry.status = patch.status;
|
|
1707
2033
|
entry.resolved_at = patch.status === 'resolved' ? new Date().toISOString() : null;
|
|
1708
2034
|
}
|
|
1709
|
-
|
|
2035
|
+
// S8.17b — an imported thread's words are the Figma writer's; the importer cannot rewrite them.
|
|
2036
|
+
if (typeof patch.text === 'string' && patch.text.trim() && !entry.importedFrom) {
|
|
1710
2037
|
entry.text = patch.text.trim().slice(0, 4000);
|
|
1711
|
-
entry.mentions =
|
|
2038
|
+
entry.mentions = mentionsOf(entry);
|
|
1712
2039
|
}
|
|
1713
2040
|
}
|
|
1714
2041
|
await publishComments(file, list, base);
|
|
@@ -1717,6 +2044,47 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
1717
2044
|
return null;
|
|
1718
2045
|
}
|
|
1719
2046
|
|
|
2047
|
+
/** S9.7b — one comment op (comments/ops.ts) on `file`'s threads, as the session's `actor`. */
|
|
2048
|
+
async function commentOp(
|
|
2049
|
+
file: string,
|
|
2050
|
+
op: CommentOp,
|
|
2051
|
+
actor: OpActor
|
|
2052
|
+
): Promise<OpResult | DoorRefusal> {
|
|
2053
|
+
const list = await loadCommentsForFile(file);
|
|
2054
|
+
// P8 G1a — a session that may not edit this canvas (Can comment) holds a read-only
|
|
2055
|
+
// connection: its comment goes to the hub's comment door (sync/comment-door.ts), which
|
|
2056
|
+
// saves it as that person. The replica brings the saved record back here; until it does,
|
|
2057
|
+
// the window is shown the hub's own record (same id), so the author sees it at once.
|
|
2058
|
+
const canvasRel = toDesignRel(file, paths.designRel);
|
|
2059
|
+
const door =
|
|
2060
|
+
canvasRel === null
|
|
2061
|
+
? null
|
|
2062
|
+
: (ctx.syncControl?.current?.()?.commentDoor?.(fileSlug(file), canvasRel, op, actor) ??
|
|
2063
|
+
null);
|
|
2064
|
+
if (door) {
|
|
2065
|
+
const sent = await door;
|
|
2066
|
+
if (!sent.ok) return sent;
|
|
2067
|
+
const saved = sent.comment;
|
|
2068
|
+
if (saved) {
|
|
2069
|
+
const shown = [...list.filter((c) => c.id !== saved.id), saved as Comment];
|
|
2070
|
+
ctx.bus.emit('comments', { file, comments: dedupeCommentsById(shown) });
|
|
2071
|
+
}
|
|
2072
|
+
return { ok: true, list: list as CommentRecord[], comment: saved, mentioned: [] };
|
|
2073
|
+
}
|
|
2074
|
+
const now = new Date().toISOString();
|
|
2075
|
+
const opCtx = { actor, now, newId: newCommentId, newReplyId };
|
|
2076
|
+
const result = applyCommentOp(list as CommentRecord[], op, opCtx);
|
|
2077
|
+
if (result.ok) await publishComments(file, result.list, list);
|
|
2078
|
+
return result;
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
/** The canvas file a thread lives in — how the op route judges a reply by id alone. */
|
|
2082
|
+
async function commentFileOf(id: string): Promise<string | null> {
|
|
2083
|
+
for (const [file, list] of Object.entries(await loadAllComments()))
|
|
2084
|
+
if (list.some((c) => c.id === id)) return file;
|
|
2085
|
+
return null;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
1720
2088
|
async function commentsDelete(id: string): Promise<boolean> {
|
|
1721
2089
|
const all = await loadAllComments();
|
|
1722
2090
|
for (const [file, list] of Object.entries(all)) {
|
|
@@ -1961,6 +2329,13 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
1961
2329
|
return [...new Set(out)];
|
|
1962
2330
|
}
|
|
1963
2331
|
|
|
2332
|
+
// r4 #6 — the person's Light | Dark pick for this canvas (the pill at the top of every canvas). Per user, per Mac:
|
|
2333
|
+
// view.json, never the versioned `.meta.json` (DDR-115). Reachable from the untrusted canvas origin, so the value
|
|
2334
|
+
// is a closed set; anything else is a silent no-op.
|
|
2335
|
+
function normalizeCanvasTheme(v: unknown): 'light' | 'dark' | null {
|
|
2336
|
+
return v === 'light' || v === 'dark' ? v : null;
|
|
2337
|
+
}
|
|
2338
|
+
|
|
1964
2339
|
// Issue #91 security follow-up — `layout.artboards[]` (DDR-027 position-only
|
|
1965
2340
|
// entries) is reachable from the untrusted canvas origin (DDR-054) via the
|
|
1966
2341
|
// same PATCH lane as overlays/locked above, but previously had no count or
|
|
@@ -2016,6 +2391,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2016
2391
|
viewport?: { x: number; y: number; zoom: number };
|
|
2017
2392
|
overlays?: Record<string, boolean>;
|
|
2018
2393
|
locked?: string[];
|
|
2394
|
+
canvasTheme?: 'light' | 'dark';
|
|
2019
2395
|
} | null> {
|
|
2020
2396
|
const viewAbs = canvasViewPath(file);
|
|
2021
2397
|
if (!viewAbs) return null;
|
|
@@ -2025,14 +2401,17 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2025
2401
|
const vp = normalizeViewport((obj as { viewport?: unknown }).viewport);
|
|
2026
2402
|
const ov = normalizeOverlays((obj as { overlays?: unknown }).overlays);
|
|
2027
2403
|
const lk = normalizeLocked((obj as { locked?: unknown }).locked);
|
|
2404
|
+
const ct = normalizeCanvasTheme((obj as { canvasTheme?: unknown }).canvasTheme);
|
|
2028
2405
|
const result: {
|
|
2029
2406
|
viewport?: { x: number; y: number; zoom: number };
|
|
2030
2407
|
overlays?: Record<string, boolean>;
|
|
2031
2408
|
locked?: string[];
|
|
2409
|
+
canvasTheme?: 'light' | 'dark';
|
|
2032
2410
|
} = {};
|
|
2033
2411
|
if (vp) result.viewport = vp;
|
|
2034
2412
|
if (ov && Object.keys(ov).length > 0) result.overlays = ov;
|
|
2035
2413
|
if (lk && lk.length > 0) result.locked = lk;
|
|
2414
|
+
if (ct) result.canvasTheme = ct;
|
|
2036
2415
|
return result;
|
|
2037
2416
|
}
|
|
2038
2417
|
return null;
|
|
@@ -2122,14 +2501,18 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2122
2501
|
obj.overlays = undefined;
|
|
2123
2502
|
// feature-4 T7b — `locked` (per-user locked layer keys) is the same class.
|
|
2124
2503
|
obj.locked = undefined;
|
|
2504
|
+
// r4 #6 — `canvasTheme` (the Light | Dark pick) is the same class.
|
|
2505
|
+
obj.canvasTheme = undefined;
|
|
2125
2506
|
const view = await loadCanvasView(file);
|
|
2126
2507
|
if (view?.viewport) obj.viewport = view.viewport;
|
|
2127
2508
|
if (view?.overlays) obj.overlays = view.overlays;
|
|
2128
2509
|
if (view?.locked) obj.locked = view.locked;
|
|
2510
|
+
if (view?.canvasTheme) obj.canvasTheme = view.canvasTheme;
|
|
2129
2511
|
// Preserve the historic contract: no meta AND no camera/overlays → null
|
|
2130
2512
|
// (GET → {}, PATCH-on-rejected-path → 404). A view-only canvas still
|
|
2131
2513
|
// returns its camera/overlays.
|
|
2132
|
-
if (!hadMeta && !view?.viewport && !view?.overlays && !view?.locked
|
|
2514
|
+
if (!hadMeta && !view?.viewport && !view?.overlays && !view?.locked && !view?.canvasTheme)
|
|
2515
|
+
return null;
|
|
2133
2516
|
return obj;
|
|
2134
2517
|
}
|
|
2135
2518
|
|
|
@@ -2229,11 +2612,41 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2229
2612
|
}
|
|
2230
2613
|
}
|
|
2231
2614
|
|
|
2615
|
+
// --- Per-user Light | Dark lane (r4 #6): canvasTheme → view file, never the versioned meta. REPLACE
|
|
2616
|
+
// semantics; `null` forgets the pick (the canvas goes back to its design system's default); a value
|
|
2617
|
+
// that is not 'light' | 'dark' is a silent no-op.
|
|
2618
|
+
if (patch.canvasTheme !== undefined) {
|
|
2619
|
+
const viewAbs = canvasViewPath(file);
|
|
2620
|
+
if (viewAbs) {
|
|
2621
|
+
try {
|
|
2622
|
+
const current = await readCanvasViewRaw(file);
|
|
2623
|
+
if (patch.canvasTheme === null) {
|
|
2624
|
+
const { canvasTheme: _drop, ...rest } = current;
|
|
2625
|
+
await mkdir(sessionDir(paths.canvasStateDir), { recursive: true });
|
|
2626
|
+
await Bun.write(viewAbs, `${JSON.stringify(rest, null, 2)}\n`);
|
|
2627
|
+
} else {
|
|
2628
|
+
const ct = normalizeCanvasTheme(patch.canvasTheme);
|
|
2629
|
+
if (ct !== null) {
|
|
2630
|
+
await mkdir(sessionDir(paths.canvasStateDir), { recursive: true });
|
|
2631
|
+
await Bun.write(
|
|
2632
|
+
viewAbs,
|
|
2633
|
+
`${JSON.stringify({ ...current, canvasTheme: ct }, null, 2)}\n`
|
|
2634
|
+
);
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2637
|
+
} catch {
|
|
2638
|
+
/* best-effort */
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
2642
|
+
|
|
2232
2643
|
// --- Shared document lane: layout → versioned meta, stamps last_modified. ---
|
|
2233
2644
|
if (patch.layout !== undefined) {
|
|
2234
2645
|
let current: Record<string, unknown> = {};
|
|
2646
|
+
// p8-a1-save-hold — a layout move held behind an AI interpreter call is what the meta WILL hold
|
|
2647
|
+
const waiting = saveHold().read(metaAbs);
|
|
2235
2648
|
try {
|
|
2236
|
-
const parsed = JSON.parse(await Bun.file(metaAbs).text());
|
|
2649
|
+
const parsed = JSON.parse(waiting ?? (await Bun.file(metaAbs).text()));
|
|
2237
2650
|
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
2238
2651
|
current = parsed as Record<string, unknown>;
|
|
2239
2652
|
}
|
|
@@ -2265,7 +2678,28 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2265
2678
|
// (mergeSharedMetaIntoLocal), so a layout edit doesn't churn the newline.
|
|
2266
2679
|
const baseText = Object.keys(current).length ? JSON.stringify(current) : null;
|
|
2267
2680
|
const nextText = `${JSON.stringify(next, null, 2)}\n`;
|
|
2681
|
+
// p8-a1-save-hold — a person's move to a canvas a running interpreter call names waits until the
|
|
2682
|
+
// call is done (+ settle), then lands through this same write and proposal, as theirs
|
|
2683
|
+
if (saveHold().holds(metaAbs)) {
|
|
2684
|
+
let diskText = '';
|
|
2685
|
+
try {
|
|
2686
|
+
diskText = await Bun.file(metaAbs).text();
|
|
2687
|
+
} catch {
|
|
2688
|
+
/* no meta yet */
|
|
2689
|
+
}
|
|
2690
|
+
saveHold().hold(metaAbs, nextText, {
|
|
2691
|
+
base: waiting ?? diskText,
|
|
2692
|
+
landWith: async (bytes, landedBase) => {
|
|
2693
|
+
await Bun.write(metaAbs, bytes);
|
|
2694
|
+
hooks.onMetaChanged?.(file, bytes, landedBase || null);
|
|
2695
|
+
announceWritten(path.relative(paths.designRoot, metaAbs));
|
|
2696
|
+
},
|
|
2697
|
+
});
|
|
2698
|
+
return { ...((await loadCanvasMeta(file)) ?? {}), layout: next.layout };
|
|
2699
|
+
}
|
|
2268
2700
|
await Bun.write(metaAbs, nextText);
|
|
2701
|
+
// p8-sec2-attrib A1 — the person's bytes: a call that wrote without naming files leaves them
|
|
2702
|
+
saveHold().notePersonWrite(metaAbs, nextText);
|
|
2269
2703
|
hooks.onMetaChanged?.(file, nextText, baseText);
|
|
2270
2704
|
// Same reason as the annotations sidecar below, and the same bug: this
|
|
2271
2705
|
// lane writes the FILE and nothing else, so in a cell — where there is no
|
|
@@ -2285,6 +2719,20 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2285
2719
|
return await loadCanvasMeta(file);
|
|
2286
2720
|
}
|
|
2287
2721
|
|
|
2722
|
+
async function writeCanvasMetaText(
|
|
2723
|
+
file: string,
|
|
2724
|
+
nextText: string,
|
|
2725
|
+
baseText: string | null,
|
|
2726
|
+
opts?: { hooks?: boolean }
|
|
2727
|
+
): Promise<boolean> {
|
|
2728
|
+
const metaAbs = canvasMetaPath(file);
|
|
2729
|
+
if (!metaAbs) return false;
|
|
2730
|
+
await Bun.write(metaAbs, nextText);
|
|
2731
|
+
if (opts?.hooks !== false) hooks.onMetaChanged?.(file, nextText, baseText);
|
|
2732
|
+
announceWritten(path.relative(paths.designRoot, metaAbs));
|
|
2733
|
+
return true;
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2288
2736
|
// ---------- Annotations sidecar (DDR-242 — annotations v2) ----------
|
|
2289
2737
|
//
|
|
2290
2738
|
// Each canvas keeps ONE `<slug>.annotations.json` board under `<designRoot>/`
|
|
@@ -2299,11 +2747,11 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2299
2747
|
// migrate-boot.ts) rewrites it on disk.
|
|
2300
2748
|
|
|
2301
2749
|
function annotationsPath(file: string): string {
|
|
2302
|
-
return
|
|
2750
|
+
return sidecarPath(paths.designRoot, file, '.annotations.json');
|
|
2303
2751
|
}
|
|
2304
2752
|
|
|
2305
2753
|
function legacyAnnotationsPath(file: string): string {
|
|
2306
|
-
return
|
|
2754
|
+
return sidecarPath(paths.designRoot, file, '.annotations.svg');
|
|
2307
2755
|
}
|
|
2308
2756
|
|
|
2309
2757
|
type BoardRead = { ok: true; text: string | null } | { ok: false; error: string };
|
|
@@ -2314,7 +2762,13 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2314
2762
|
* empty board, or the next write would silently erase it (code review H2).
|
|
2315
2763
|
*/
|
|
2316
2764
|
async function readBoard(file: string): Promise<BoardRead> {
|
|
2317
|
-
|
|
2765
|
+
let candidates: string[];
|
|
2766
|
+
try {
|
|
2767
|
+
candidates = [annotationsPath(file), legacyAnnotationsPath(file)];
|
|
2768
|
+
} catch {
|
|
2769
|
+
return { ok: false, error: 'not a canvas path' };
|
|
2770
|
+
}
|
|
2771
|
+
for (const p of candidates) {
|
|
2318
2772
|
const f = Bun.file(p);
|
|
2319
2773
|
if (!(await f.exists())) continue;
|
|
2320
2774
|
// Untrusted (peer / git) content: size gate BEFORE reading (DDR-054).
|
|
@@ -2335,6 +2789,20 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2335
2789
|
return { ok: true, text: null };
|
|
2336
2790
|
}
|
|
2337
2791
|
|
|
2792
|
+
async function readBoardLive(file: string): Promise<BoardRead> {
|
|
2793
|
+
let live: string | null = null;
|
|
2794
|
+
try {
|
|
2795
|
+
live = hooks.readAnnotationsLive?.(file) ?? null;
|
|
2796
|
+
} catch {
|
|
2797
|
+
live = null;
|
|
2798
|
+
}
|
|
2799
|
+
if (live !== null) {
|
|
2800
|
+
const text = canonicalAnnotations(live);
|
|
2801
|
+
if (text !== null) return { ok: true, text };
|
|
2802
|
+
}
|
|
2803
|
+
return readBoard(file);
|
|
2804
|
+
}
|
|
2805
|
+
|
|
2338
2806
|
/** Canonical board text, or null when the canvas has no annotations (or they can't be read). */
|
|
2339
2807
|
async function loadAnnotations(file: string): Promise<string | null> {
|
|
2340
2808
|
const r = await readBoard(file);
|
|
@@ -2355,6 +2823,24 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2355
2823
|
return next;
|
|
2356
2824
|
}
|
|
2357
2825
|
|
|
2826
|
+
/**
|
|
2827
|
+
* p8-a1-save-hold — run a person's board / layout ACTION now, or — while a running interpreter call names
|
|
2828
|
+
* one of these files — once the call is done (+ settle), at the cap, or on a flush (ai/save-hold.ts
|
|
2829
|
+
* `defer`): it then runs on what the files hold, so its ops land on top of the AI's bytes, as theirs.
|
|
2830
|
+
*/
|
|
2831
|
+
function deferSave<T>(files: Array<() => string | null>, fn: () => Promise<T>): Promise<T> {
|
|
2832
|
+
const abs: string[] = [];
|
|
2833
|
+
for (const f of files) {
|
|
2834
|
+
try {
|
|
2835
|
+
const a = f();
|
|
2836
|
+
if (a) abs.push(a);
|
|
2837
|
+
} catch {
|
|
2838
|
+
/* not a canvas path: the action refuses it itself */
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
return saveHold().defer(abs, fn);
|
|
2842
|
+
}
|
|
2843
|
+
|
|
2358
2844
|
async function writeBoardFile(file: string, text: string): Promise<void> {
|
|
2359
2845
|
await Bun.write(annotationsPath(file), text);
|
|
2360
2846
|
// Annotations reach OTHER VIEWERS over the collab room, but the file is also
|
|
@@ -2381,29 +2867,41 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2381
2867
|
typeof base === 'string' && base.length <= MAX_ANNOTATIONS_BYTES
|
|
2382
2868
|
? (canonicalAnnotations(base) ?? undefined)
|
|
2383
2869
|
: undefined;
|
|
2384
|
-
return onAnnotationChain(file,
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2870
|
+
return onAnnotationChain(file, () =>
|
|
2871
|
+
deferSave([() => annotationsPath(file)], async () => {
|
|
2872
|
+
// Never overwrite a board we can't read — it may hold work (review H2).
|
|
2873
|
+
const read = await readBoard(file);
|
|
2874
|
+
if (!read.ok) return false;
|
|
2875
|
+
let next = clean;
|
|
2876
|
+
if (cleanBase !== undefined) {
|
|
2877
|
+
// With a base, the write is "what changed since base", merged onto the
|
|
2878
|
+
// current board — a whole-board PUT no longer erases concurrent edits
|
|
2879
|
+
// (code review M5). Same one merge rule as the op path.
|
|
2880
|
+
const byId = (t: string) => new Map(parseBoard(t).elements.map((e) => [e.id, e]));
|
|
2881
|
+
const ops = diffToOps(byId(cleanBase), byId(clean));
|
|
2882
|
+
// sec-a M1 — a whole-board write never touches a vote or a ballot (the vote door does).
|
|
2883
|
+
const live = hooks.applyAnnotationOpsLive?.(file, ops, writeId, voteDoorOnly) ?? null;
|
|
2884
|
+
if (live === 'too-large' || live === 'refused') return false;
|
|
2885
|
+
if (live) return true;
|
|
2886
|
+
const current = read.text ?? serializeBoard([]);
|
|
2887
|
+
const currentMap = byId(current);
|
|
2888
|
+
const merged = applyAnnotationOpsPure(currentMap, ops).state;
|
|
2889
|
+
if (voteDoorOnly(currentMap, merged) !== null) return false;
|
|
2890
|
+
next = serializeBoard([...merged.values()]);
|
|
2891
|
+
if (next.length > MAX_ANNOTATIONS_BYTES) return false;
|
|
2892
|
+
if (next === current) return true;
|
|
2893
|
+
}
|
|
2894
|
+
if (cleanBase === undefined) {
|
|
2895
|
+
// A replace: every vote and ballot must be exactly the stored ones (sec-a M1).
|
|
2896
|
+
const byId = (t: string | null) =>
|
|
2897
|
+
new Map((t ? parseBoard(t).elements : []).map((e) => [e.id, e]));
|
|
2898
|
+
if (voteDoorOnly(byId(read.text), byId(next)) !== null) return false;
|
|
2899
|
+
}
|
|
2900
|
+
await writeBoardFile(file, next);
|
|
2901
|
+
onAnnotationsChanged?.(file, next, writeId, cleanBase);
|
|
2902
|
+
return true;
|
|
2903
|
+
})
|
|
2904
|
+
);
|
|
2407
2905
|
}
|
|
2408
2906
|
|
|
2409
2907
|
/**
|
|
@@ -2414,8 +2912,18 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2414
2912
|
async function applyAnnotationOps(
|
|
2415
2913
|
file: string,
|
|
2416
2914
|
ops: readonly AnnotationOp[],
|
|
2417
|
-
actionId?: string
|
|
2915
|
+
actionId?: string,
|
|
2916
|
+
opts?: { hooks?: boolean; guard?: BoardGuard }
|
|
2418
2917
|
): Promise<AnnotationOpsResult> {
|
|
2918
|
+
const withHooks = opts?.hooks !== false;
|
|
2919
|
+
const guard = opts?.guard;
|
|
2920
|
+
const refusedResult = (id: string): AnnotationOpsResult => ({
|
|
2921
|
+
ok: false,
|
|
2922
|
+
changed: false,
|
|
2923
|
+
rejected: [],
|
|
2924
|
+
error: 'votes and ballots change only through the vote',
|
|
2925
|
+
refused: id,
|
|
2926
|
+
});
|
|
2419
2927
|
return onAnnotationChain(file, async () => {
|
|
2420
2928
|
const rejectedOf = (r: ApplyResult) =>
|
|
2421
2929
|
r.rejected.map((x) => ({
|
|
@@ -2425,27 +2933,39 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2425
2933
|
}));
|
|
2426
2934
|
// A live room is ahead of the file (its flush is debounced): the batch
|
|
2427
2935
|
// goes to its replica, or it would revert a peer's unflushed edit (H1).
|
|
2428
|
-
|
|
2936
|
+
// A run-tagged batch (`run:<runId>`, an AI run's resolves and review stickies) never takes the live-room
|
|
2937
|
+
// shortcut: the room's flush would publish it as a person's "Edit annotations" action, outside the run's
|
|
2938
|
+
// stage, and ⌘Z / "Undo this chat" would miss it (contract S4-S5-ai-annotations §2; S4.20).
|
|
2939
|
+
const live =
|
|
2940
|
+
withHooks && runTagOf(actionId) === null
|
|
2941
|
+
? (hooks.applyAnnotationOpsLive?.(file, ops, actionId, guard) ?? null)
|
|
2942
|
+
: null;
|
|
2943
|
+
if (live === 'refused') return refusedResult('?');
|
|
2429
2944
|
if (live === 'too-large') {
|
|
2430
2945
|
return { ok: false, changed: false, rejected: [], error: 'board exceeds the size cap' };
|
|
2431
2946
|
}
|
|
2432
2947
|
if (live) return { ok: true, changed: live.touched.size > 0, rejected: rejectedOf(live) };
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2948
|
+
return deferSave([() => annotationsPath(file)], async (): Promise<AnnotationOpsResult> => {
|
|
2949
|
+
const read = await readBoard(file);
|
|
2950
|
+
if (!read.ok) {
|
|
2951
|
+
return { ok: false, changed: false, rejected: [], error: read.error, unreadable: true };
|
|
2952
|
+
}
|
|
2953
|
+
const before = read.text ? parseBoard(read.text).elements : [];
|
|
2954
|
+
const beforeText = serializeBoard(before);
|
|
2955
|
+
const beforeMap = new Map(before.map((e) => [e.id, e]));
|
|
2956
|
+
const r = applyAnnotationOpsPure(beforeMap, ops);
|
|
2957
|
+
const hit = guard?.(beforeMap, r.state) ?? null;
|
|
2958
|
+
if (hit !== null) return refusedResult(hit);
|
|
2959
|
+
const rejected = rejectedOf(r);
|
|
2960
|
+
if (!r.touched.size) return { ok: true, changed: false, rejected };
|
|
2961
|
+
const text = serializeBoard([...r.state.values()]);
|
|
2962
|
+
if (text.length > MAX_ANNOTATIONS_BYTES) {
|
|
2963
|
+
return { ok: false, changed: false, rejected, error: 'board exceeds the size cap' };
|
|
2964
|
+
}
|
|
2965
|
+
await writeBoardFile(file, text);
|
|
2966
|
+
if (withHooks) onAnnotationsChanged?.(file, text, actionId, beforeText);
|
|
2967
|
+
return { ok: true, changed: true, rejected };
|
|
2968
|
+
});
|
|
2449
2969
|
});
|
|
2450
2970
|
}
|
|
2451
2971
|
|
|
@@ -2456,8 +2976,29 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2456
2976
|
): Promise<boolean> {
|
|
2457
2977
|
if (typeof text !== 'string' || text.length > MAX_ANNOTATIONS_BYTES) return false;
|
|
2458
2978
|
if (!isCurrent()) return false;
|
|
2979
|
+
let dest: string;
|
|
2980
|
+
try {
|
|
2981
|
+
dest = annotationsPath(file);
|
|
2982
|
+
} catch {
|
|
2983
|
+
return false;
|
|
2984
|
+
}
|
|
2459
2985
|
const clean = canonicalAnnotations(text);
|
|
2460
2986
|
if (clean === null) return false;
|
|
2987
|
+
// p8-a1-save-hold — the room's flush IS the person's strokes (an AI run's batch never takes the live
|
|
2988
|
+
// room): while a running interpreter call names the board it waits; a newer flush supersedes it
|
|
2989
|
+
// (`isCurrent`), so the last one lands
|
|
2990
|
+
return asPersonSave(() =>
|
|
2991
|
+
saveHold().defer([dest], () => projectBoard(file, dest, clean, isCurrent))
|
|
2992
|
+
);
|
|
2993
|
+
}
|
|
2994
|
+
|
|
2995
|
+
async function projectBoard(
|
|
2996
|
+
file: string,
|
|
2997
|
+
dest: string,
|
|
2998
|
+
clean: string,
|
|
2999
|
+
isCurrent: () => boolean
|
|
3000
|
+
): Promise<boolean> {
|
|
3001
|
+
if (!isCurrent()) return false;
|
|
2461
3002
|
// Runtime scratch stays out of the file plane. The async IO must not touch
|
|
2462
3003
|
// the serving file until we recheck the document; another edit may have
|
|
2463
3004
|
// arrived while Bun.write was pending. Check + rename have no await gap.
|
|
@@ -2467,7 +3008,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2467
3008
|
try {
|
|
2468
3009
|
await Bun.write(temp, clean);
|
|
2469
3010
|
if (!isCurrent()) return false;
|
|
2470
|
-
renameSync(temp,
|
|
3011
|
+
renameSync(temp, dest);
|
|
2471
3012
|
announceWritten(`${fileSlug(file)}.annotations.json`);
|
|
2472
3013
|
return true;
|
|
2473
3014
|
} finally {
|
|
@@ -2475,6 +3016,232 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2475
3016
|
}
|
|
2476
3017
|
}
|
|
2477
3018
|
|
|
3019
|
+
/**
|
|
3020
|
+
* S4.7 — one canvas's board AND its comments as ONE project action (contract
|
|
3021
|
+
* S4-S9-votes-comments §3.2, V2-1.5). `change` sees both lanes as they are and
|
|
3022
|
+
* answers the board ops + the next comment list; the two lanes then reach the
|
|
3023
|
+
* home together:
|
|
3024
|
+
*
|
|
3025
|
+
* - accepted mode (hub): both files are written raw — the per-lane hooks
|
|
3026
|
+
* would propose each lane as its own action — and `proposer.send` carries
|
|
3027
|
+
* both `lane.replace` ops in one proposal;
|
|
3028
|
+
* - the local home: the ordinary write paths (live room bridge, sidebar), then
|
|
3029
|
+
* `proposer.send` records both lanes as one action;
|
|
3030
|
+
* - no home (`proposer` null): the ordinary write paths; the caller keeps the
|
|
3031
|
+
* returned snapshot for its undo token.
|
|
3032
|
+
*
|
|
3033
|
+
* Serialized on the board's chain, so no op batch lands between the read and
|
|
3034
|
+
* the write.
|
|
3035
|
+
*/
|
|
3036
|
+
async function convertLanes<T>(
|
|
3037
|
+
file: string,
|
|
3038
|
+
change: ConvertChange<T>,
|
|
3039
|
+
proposer: LanesProposer | null
|
|
3040
|
+
): Promise<ConvertResult<T>> {
|
|
3041
|
+
return onAnnotationChain(file, () =>
|
|
3042
|
+
deferSave([() => annotationsPath(file)], async (): Promise<ConvertResult<T>> => {
|
|
3043
|
+
const read = await readBoard(file);
|
|
3044
|
+
if (!read.ok) return { ok: false, status: 409, body: { ok: false, reason: 'unreadable' } };
|
|
3045
|
+
const elements = read.text ? parseBoard(read.text).elements : [];
|
|
3046
|
+
const boardBefore = read.text ?? '';
|
|
3047
|
+
const comments = await loadCommentsForFile(file);
|
|
3048
|
+
const commentsBefore = structuredClone(comments);
|
|
3049
|
+
const c = change({ board: elements, comments: structuredClone(comments) });
|
|
3050
|
+
if (!c.ok) return c;
|
|
3051
|
+
const r = applyAnnotationOpsPure(new Map(elements.map((e) => [e.id, e])), c.ops);
|
|
3052
|
+
if (r.rejected.length) {
|
|
3053
|
+
return { ok: false, status: 409, body: { ok: false, reason: 'stale' } };
|
|
3054
|
+
}
|
|
3055
|
+
const boardAfter = serializeBoard([...r.state.values()]);
|
|
3056
|
+
if (boardAfter.length > MAX_ANNOTATIONS_BYTES) {
|
|
3057
|
+
return { ok: false, status: 413, body: { ok: false, reason: 'too-large' } };
|
|
3058
|
+
}
|
|
3059
|
+
const commentsAfter = dedupeCommentsById(c.comments);
|
|
3060
|
+
const lanes: LaneChange[] = [
|
|
3061
|
+
{ lane: 'annotations', text: boardAfter, baseText: boardBefore },
|
|
3062
|
+
{
|
|
3063
|
+
lane: 'comments',
|
|
3064
|
+
text: JSON.stringify(commentsAfter),
|
|
3065
|
+
baseText: JSON.stringify(commentsBefore),
|
|
3066
|
+
},
|
|
3067
|
+
];
|
|
3068
|
+
const snapshot: ConvertSnapshot = {
|
|
3069
|
+
file,
|
|
3070
|
+
boardBefore,
|
|
3071
|
+
boardAfter,
|
|
3072
|
+
commentsBefore,
|
|
3073
|
+
commentsAfter,
|
|
3074
|
+
};
|
|
3075
|
+
if (proposer?.accepted) {
|
|
3076
|
+
// The project decides first: a refused conversion leaves both files as they are.
|
|
3077
|
+
const answer = await proposer.send(lanes);
|
|
3078
|
+
if (answer.status !== 'accepted') {
|
|
3079
|
+
return {
|
|
3080
|
+
ok: false,
|
|
3081
|
+
status: 409,
|
|
3082
|
+
body: { ok: false, reason: answer.code ?? 'rejected' },
|
|
3083
|
+
};
|
|
3084
|
+
}
|
|
3085
|
+
await writeBoardFile(file, boardAfter);
|
|
3086
|
+
await saveCommentsForFile(file, commentsAfter);
|
|
3087
|
+
ctx.bus.emit('comments', { file, comments: commentsAfter });
|
|
3088
|
+
return { ok: true, result: c.result, snapshot, ...actionOf(answer) };
|
|
3089
|
+
}
|
|
3090
|
+
const live = hooks.applyAnnotationOpsLive?.(file, c.ops) ?? null;
|
|
3091
|
+
if (live === 'too-large') {
|
|
3092
|
+
return { ok: false, status: 413, body: { ok: false, reason: 'too-large' } };
|
|
3093
|
+
}
|
|
3094
|
+
if (!live) {
|
|
3095
|
+
await writeBoardFile(file, boardAfter);
|
|
3096
|
+
onAnnotationsChanged?.(file, boardAfter, undefined, boardBefore, !!proposer);
|
|
3097
|
+
}
|
|
3098
|
+
await publishComments(file, commentsAfter, commentsBefore);
|
|
3099
|
+
if (!proposer) return { ok: true, result: c.result, snapshot };
|
|
3100
|
+
const answer = await proposer.send(lanes);
|
|
3101
|
+
return { ok: true, result: c.result, snapshot, ...actionOf(answer) };
|
|
3102
|
+
})
|
|
3103
|
+
);
|
|
3104
|
+
}
|
|
3105
|
+
|
|
3106
|
+
const actionOf = (a: LanesOutcome): { actionId?: string; queued?: boolean } => ({
|
|
3107
|
+
...(a.status === 'accepted' && a.actionId ? { actionId: a.actionId } : {}),
|
|
3108
|
+
...(a.queued ? { queued: true } : {}),
|
|
3109
|
+
});
|
|
3110
|
+
|
|
3111
|
+
/**
|
|
3112
|
+
* S2.9b — an artboard move and the annotations riding with it as ONE project
|
|
3113
|
+
* action (contract S2-S4-artboard-motion-ids §2): the layout lane of the
|
|
3114
|
+
* versioned `.meta.json` and the board, then one `proposer.send` with both
|
|
3115
|
+
* lanes. Same three homes as `convertLanes`: accepted mode decides first and
|
|
3116
|
+
* writes raw (no per-lane hooks, which would propose each lane on its own); the
|
|
3117
|
+
* local home and no home take the ordinary write paths, the local home then
|
|
3118
|
+
* records both lanes as one action. `rider.check` refuses before anything is
|
|
3119
|
+
* written; a rejected op (gone / stale) refuses the whole move.
|
|
3120
|
+
*/
|
|
3121
|
+
async function moveArtboardsWithRider(
|
|
3122
|
+
file: string,
|
|
3123
|
+
layout: unknown,
|
|
3124
|
+
rider: RiderMove,
|
|
3125
|
+
proposer: LanesProposer | null
|
|
3126
|
+
): Promise<RiderMoveResult> {
|
|
3127
|
+
const metaAbs = canvasMetaPath(file);
|
|
3128
|
+
const srcAbs = canvasSourceAbs(file);
|
|
3129
|
+
if (!metaAbs || !srcAbs || !(await Bun.file(srcAbs).exists()))
|
|
3130
|
+
return { ok: false, status: 404, body: { ok: false, reason: 'not-found' } };
|
|
3131
|
+
const raw = layout as Record<string, unknown> | null;
|
|
3132
|
+
const artboards =
|
|
3133
|
+
raw && typeof raw === 'object' && !Array.isArray(raw) && 'artboards' in raw
|
|
3134
|
+
? normalizeLayoutArtboards(raw.artboards)
|
|
3135
|
+
: null;
|
|
3136
|
+
if (!raw || !artboards)
|
|
3137
|
+
return { ok: false, status: 400, body: { ok: false, reason: 'layout.artboards required' } };
|
|
3138
|
+
return onAnnotationChain(file, () =>
|
|
3139
|
+
deferSave(
|
|
3140
|
+
[() => metaAbs, () => annotationsPath(file)],
|
|
3141
|
+
async (): Promise<RiderMoveResult> => {
|
|
3142
|
+
let currentText: string | null = null;
|
|
3143
|
+
let current: Record<string, unknown> = {};
|
|
3144
|
+
try {
|
|
3145
|
+
currentText = await Bun.file(metaAbs).text();
|
|
3146
|
+
const parsed = JSON.parse(currentText);
|
|
3147
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed))
|
|
3148
|
+
current = parsed as Record<string, unknown>;
|
|
3149
|
+
} catch {
|
|
3150
|
+
currentText = null;
|
|
3151
|
+
}
|
|
3152
|
+
const read = await readBoard(file);
|
|
3153
|
+
if (!read.ok)
|
|
3154
|
+
return { ok: false, status: 409, body: { ok: false, reason: 'unreadable' } };
|
|
3155
|
+
const elements = read.text ? parseBoard(read.text).elements : [];
|
|
3156
|
+
const boardBefore = read.text ?? '';
|
|
3157
|
+
const refused = rider.check(elements, current.layout);
|
|
3158
|
+
if (refused) return { ok: false, ...refused };
|
|
3159
|
+
const r = applyAnnotationOpsPure(new Map(elements.map((e) => [e.id, e])), rider.ops);
|
|
3160
|
+
if (r.rejected.length)
|
|
3161
|
+
return { ok: false, status: 409, body: { ok: false, reason: 'stale' } };
|
|
3162
|
+
const boardAfter = r.touched.size ? serializeBoard([...r.state.values()]) : boardBefore;
|
|
3163
|
+
if (boardAfter.length > MAX_ANNOTATIONS_BYTES)
|
|
3164
|
+
return { ok: false, status: 413, body: { ok: false, reason: 'too-large' } };
|
|
3165
|
+
const next: Record<string, unknown> = { ...current, layout: { ...raw, artboards } };
|
|
3166
|
+
next.viewport = undefined;
|
|
3167
|
+
next.last_modified = new Date().toISOString();
|
|
3168
|
+
const nextText = `${JSON.stringify(next, null, 2)}\n`;
|
|
3169
|
+
const metaRel = path.relative(paths.designRoot, metaAbs);
|
|
3170
|
+
const lanes: LaneChange[] = [
|
|
3171
|
+
{ lane: 'meta', text: nextText, baseText: currentText ?? '{}' },
|
|
3172
|
+
...(boardAfter !== boardBefore
|
|
3173
|
+
? [{ lane: 'annotations' as const, text: boardAfter, baseText: boardBefore }]
|
|
3174
|
+
: []),
|
|
3175
|
+
];
|
|
3176
|
+
if (proposer?.accepted) {
|
|
3177
|
+
const answer = await proposer.send(lanes);
|
|
3178
|
+
if (answer.status !== 'accepted')
|
|
3179
|
+
return {
|
|
3180
|
+
ok: false,
|
|
3181
|
+
status: 409,
|
|
3182
|
+
body: { ok: false, reason: answer.code ?? 'rejected' },
|
|
3183
|
+
};
|
|
3184
|
+
await Bun.write(metaAbs, nextText);
|
|
3185
|
+
announceWritten(metaRel);
|
|
3186
|
+
if (boardAfter !== boardBefore) await writeBoardFile(file, boardAfter);
|
|
3187
|
+
return { ok: true, meta: (await loadCanvasMeta(file)) ?? {}, ...actionOf(answer) };
|
|
3188
|
+
}
|
|
3189
|
+
if (boardAfter !== boardBefore) {
|
|
3190
|
+
const live = hooks.applyAnnotationOpsLive?.(file, rider.ops, rider.actionId) ?? null;
|
|
3191
|
+
if (live === 'too-large')
|
|
3192
|
+
return { ok: false, status: 413, body: { ok: false, reason: 'too-large' } };
|
|
3193
|
+
if (!live) {
|
|
3194
|
+
await writeBoardFile(file, boardAfter);
|
|
3195
|
+
onAnnotationsChanged?.(file, boardAfter, rider.actionId, boardBefore, !!proposer);
|
|
3196
|
+
}
|
|
3197
|
+
}
|
|
3198
|
+
await Bun.write(metaAbs, nextText);
|
|
3199
|
+
hooks.onMetaChanged?.(
|
|
3200
|
+
file,
|
|
3201
|
+
nextText,
|
|
3202
|
+
Object.keys(current).length ? JSON.stringify(current) : null
|
|
3203
|
+
);
|
|
3204
|
+
announceWritten(metaRel);
|
|
3205
|
+
const meta = (await loadCanvasMeta(file)) ?? {};
|
|
3206
|
+
if (!proposer) return { ok: true, meta };
|
|
3207
|
+
return { ok: true, meta, ...actionOf(await proposer.send(lanes)) };
|
|
3208
|
+
}
|
|
3209
|
+
)
|
|
3210
|
+
);
|
|
3211
|
+
}
|
|
3212
|
+
|
|
3213
|
+
/**
|
|
3214
|
+
* S4.7 — put a conversion's two lanes back as they were (the no-home undo
|
|
3215
|
+
* token, contract §3.2 "Legacy link / no op log"). Refused as `stale` once
|
|
3216
|
+
* either lane moved on since the conversion — a later change is never undone
|
|
3217
|
+
* along with it.
|
|
3218
|
+
*/
|
|
3219
|
+
async function restoreConversion(s: ConvertSnapshot): Promise<{ ok: boolean; reason?: string }> {
|
|
3220
|
+
return onAnnotationChain(s.file, () =>
|
|
3221
|
+
deferSave(
|
|
3222
|
+
[() => annotationsPath(s.file)],
|
|
3223
|
+
async (): Promise<{ ok: boolean; reason?: string }> => {
|
|
3224
|
+
const read = await readBoard(s.file);
|
|
3225
|
+
if (!read.ok) return { ok: false, reason: 'unreadable' };
|
|
3226
|
+
const comments = await loadCommentsForFile(s.file);
|
|
3227
|
+
const sameComments = JSON.stringify(comments) === JSON.stringify(s.commentsAfter);
|
|
3228
|
+
if ((read.text ?? '') !== s.boardAfter || !sameComments)
|
|
3229
|
+
return { ok: false, reason: 'stale' };
|
|
3230
|
+
const byId = (t: string) => new Map(parseBoard(t).elements.map((e) => [e.id, e]));
|
|
3231
|
+
const ops = diffToOps(byId(s.boardAfter), byId(s.boardBefore || serializeBoard([])));
|
|
3232
|
+
const live = hooks.applyAnnotationOpsLive?.(s.file, ops) ?? null;
|
|
3233
|
+
if (live === 'too-large') return { ok: false, reason: 'too-large' };
|
|
3234
|
+
if (!live) {
|
|
3235
|
+
await writeBoardFile(s.file, s.boardBefore || serializeBoard([]));
|
|
3236
|
+
onAnnotationsChanged?.(s.file, s.boardBefore, undefined, s.boardAfter);
|
|
3237
|
+
}
|
|
3238
|
+
await publishComments(s.file, s.commentsBefore, s.commentsAfter);
|
|
3239
|
+
return { ok: true };
|
|
3240
|
+
}
|
|
3241
|
+
)
|
|
3242
|
+
);
|
|
3243
|
+
}
|
|
3244
|
+
|
|
2478
3245
|
// Phase 23 — content-addressed asset write. Reachable from the (potentially
|
|
2479
3246
|
// untrusted, DDR-054) canvas origin, so every cap is load-bearing, NOT
|
|
2480
3247
|
// optional (DDR Task 9):
|
|
@@ -2490,6 +3257,22 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2490
3257
|
// user input, but a poisoned designRoot must still not escape).
|
|
2491
3258
|
// Running total of bytes this server instance has actually written (post-dedupe).
|
|
2492
3259
|
let assetBytesWritten = 0;
|
|
3260
|
+
// gate-b-c4k — per frame (`currentFrameKey`): bytes written + held by its open chunk sessions.
|
|
3261
|
+
const frameAssetBytes = new Map<string, number>();
|
|
3262
|
+
// gate-b-c4l — the sum over every frame (`ASSET_FRAMES_BUDGET`), kept with the per-frame entries.
|
|
3263
|
+
let framesAssetBytes = 0;
|
|
3264
|
+
const frameOver = (key: string | null, bytes: number) =>
|
|
3265
|
+
key !== null &&
|
|
3266
|
+
((frameAssetBytes.get(key) ?? 0) + bytes > ASSET_FRAME_BUDGET ||
|
|
3267
|
+
framesAssetBytes + bytes > ASSET_FRAMES_BUDGET);
|
|
3268
|
+
const frameCharge = (key: string | null, bytes: number) => {
|
|
3269
|
+
if (key === null) return;
|
|
3270
|
+
const prev = frameAssetBytes.get(key) ?? 0;
|
|
3271
|
+
const next = Math.max(0, prev + bytes);
|
|
3272
|
+
framesAssetBytes = Math.max(0, framesAssetBytes + next - prev);
|
|
3273
|
+
if (next === 0) frameAssetBytes.delete(key);
|
|
3274
|
+
else frameAssetBytes.set(key, next);
|
|
3275
|
+
};
|
|
2493
3276
|
// S3/R2 asset lane (Cloud Phase 3 Task 2). Unconfigured by default — a local
|
|
2494
3277
|
// project and a single-box self-hoster both work with no bucket at all.
|
|
2495
3278
|
const assetMirror = createAssetMirror(s3ConfigFromEnv());
|
|
@@ -2537,9 +3320,23 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2537
3320
|
mediaCap: number;
|
|
2538
3321
|
/** 'reserved' — a chunk session already charged the budget at chunk-start. */
|
|
2539
3322
|
budget: 'check' | 'reserved';
|
|
3323
|
+
/** gate-b-c4k — the frame the write is charged to (null: the main origin / no frame). */
|
|
3324
|
+
frameKey: string | null;
|
|
2540
3325
|
allowImages: boolean;
|
|
2541
3326
|
}
|
|
2542
3327
|
|
|
3328
|
+
/** Streamed sha-256 of a file on disk (a dedupe hit must prove its bytes, not just its name). */
|
|
3329
|
+
async function sha256File(abs: string): Promise<string> {
|
|
3330
|
+
const h = crypto.createHash('sha256');
|
|
3331
|
+
const reader = Bun.file(abs).stream().getReader();
|
|
3332
|
+
for (;;) {
|
|
3333
|
+
const { done, value } = await reader.read();
|
|
3334
|
+
if (done) break;
|
|
3335
|
+
h.update(value);
|
|
3336
|
+
}
|
|
3337
|
+
return h.digest('hex');
|
|
3338
|
+
}
|
|
3339
|
+
|
|
2543
3340
|
async function consumeAssetStream(
|
|
2544
3341
|
stream: ReadableStream<Uint8Array>,
|
|
2545
3342
|
opts: ConsumeAssetOpts
|
|
@@ -2632,17 +3429,40 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2632
3429
|
if (sink) await sink.end();
|
|
2633
3430
|
|
|
2634
3431
|
const digest = hash.digest('hex');
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
//
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
3432
|
+
// The short name is the usual one; a file already sitting under it that does NOT hash to
|
|
3433
|
+
// this digest (planted, or a sha8 collision) is never returned as the dedupe hit (security
|
|
3434
|
+
// batch 2, A4) — the bytes go under a longer name instead. It keeps the sha8 as its prefix
|
|
3435
|
+
// (`<sha8>-<more digest>.<ext>`) so the S3 mirror's path check still verifies the bytes.
|
|
3436
|
+
let name = `${digest.slice(0, 8)}.${typeInfo.ext}`;
|
|
3437
|
+
let fileAbs = path.join(assetsDir, name);
|
|
3438
|
+
let deduped = false;
|
|
3439
|
+
const longStem = `${digest.slice(0, 8)}-${digest.slice(8, 32)}`;
|
|
3440
|
+
for (const stem of [digest.slice(0, 8), longStem]) {
|
|
3441
|
+
name = `${stem}.${typeInfo.ext}`;
|
|
3442
|
+
fileAbs = path.join(assetsDir, name);
|
|
3443
|
+
// Containment backstop — the name is content-addressed (hex digest + sniffed
|
|
3444
|
+
// ext), no user-controlled segment, but assert anyway (poisoned designRoot).
|
|
3445
|
+
if (path.resolve(fileAbs) !== path.join(path.resolve(assetsDir), name)) {
|
|
3446
|
+
await rm(tmpAbs, { force: true });
|
|
3447
|
+
return { ok: false, status: 400, error: 'resolved asset path escapes assets dir' };
|
|
3448
|
+
}
|
|
3449
|
+
if (!(await Bun.file(fileAbs).exists())) break;
|
|
3450
|
+
if ((await sha256File(fileAbs)) === digest) {
|
|
3451
|
+
deduped = true;
|
|
3452
|
+
break;
|
|
3453
|
+
}
|
|
3454
|
+
if (stem === longStem) {
|
|
3455
|
+
// Even the long name holds other bytes: refuse, never serve them.
|
|
3456
|
+
await rm(tmpAbs, { force: true });
|
|
3457
|
+
return {
|
|
3458
|
+
ok: false,
|
|
3459
|
+
status: 409,
|
|
3460
|
+
error: 'an asset with this name already holds other bytes',
|
|
3461
|
+
};
|
|
3462
|
+
}
|
|
2643
3463
|
}
|
|
2644
|
-
// Dedupe — identical bytes
|
|
2645
|
-
if (
|
|
3464
|
+
// Dedupe — identical bytes (verified above), drop the temp copy.
|
|
3465
|
+
if (deduped) {
|
|
2646
3466
|
await rm(tmpAbs, { force: true });
|
|
2647
3467
|
return { ok: true, path: `assets/${name}` };
|
|
2648
3468
|
}
|
|
@@ -2652,7 +3472,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2652
3472
|
// what those sessions were promised.
|
|
2653
3473
|
if (
|
|
2654
3474
|
opts.budget === 'check' &&
|
|
2655
|
-
assetBytesWritten + assetBytesReserved + total > ASSET_SESSION_BUDGET
|
|
3475
|
+
(assetBytesWritten + assetBytesReserved + total > ASSET_SESSION_BUDGET ||
|
|
3476
|
+
frameOver(opts.frameKey, total))
|
|
2656
3477
|
) {
|
|
2657
3478
|
await rm(tmpAbs, { force: true });
|
|
2658
3479
|
return {
|
|
@@ -2663,6 +3484,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2663
3484
|
}
|
|
2664
3485
|
await rename(tmpAbs, fileAbs);
|
|
2665
3486
|
assetBytesWritten += total;
|
|
3487
|
+
// a chunk session's reservation is released when it drops (finish included), like the global
|
|
3488
|
+
frameCharge(opts.frameKey, total);
|
|
2666
3489
|
const rel = `assets/${name}`;
|
|
2667
3490
|
announceWritten(rel);
|
|
2668
3491
|
// S3/R2 lane (Cloud Phase 3) — mirror the bytes so a second machine can
|
|
@@ -2704,6 +3527,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2704
3527
|
return consumeAssetStream(stream, {
|
|
2705
3528
|
mediaCap: ASSET_MAX_VIDEO_BYTES,
|
|
2706
3529
|
budget: 'check',
|
|
3530
|
+
frameKey: currentFrameKey(),
|
|
2707
3531
|
allowImages: true,
|
|
2708
3532
|
});
|
|
2709
3533
|
}
|
|
@@ -2717,6 +3541,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2717
3541
|
// never the versioned + synced `assets/`. See DDR-248.
|
|
2718
3542
|
interface ChunkSession {
|
|
2719
3543
|
id: string;
|
|
3544
|
+
/** gate-b-c4k — the frame that started it (its reservation is charged there too), or null. */
|
|
3545
|
+
frameKey: string | null;
|
|
2720
3546
|
dir: string;
|
|
2721
3547
|
totalSize: number;
|
|
2722
3548
|
chunkCount: number;
|
|
@@ -2738,6 +3564,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2738
3564
|
if (chunkSessions.get(s.id) === s) {
|
|
2739
3565
|
chunkSessions.delete(s.id);
|
|
2740
3566
|
assetBytesReserved = Math.max(0, assetBytesReserved - s.totalSize);
|
|
3567
|
+
frameCharge(s.frameKey, -s.totalSize);
|
|
2741
3568
|
}
|
|
2742
3569
|
try {
|
|
2743
3570
|
await rm(s.dir, { recursive: true, force: true });
|
|
@@ -2815,7 +3642,11 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2815
3642
|
if (chunkSessions.size >= ASSET_CHUNK_MAX_SESSIONS) {
|
|
2816
3643
|
return { ok: false, status: 429, error: 'too many uploads in progress — try again shortly' };
|
|
2817
3644
|
}
|
|
2818
|
-
|
|
3645
|
+
const frameKey = currentFrameKey();
|
|
3646
|
+
if (
|
|
3647
|
+
assetBytesWritten + assetBytesReserved + totalSize > ASSET_SESSION_BUDGET ||
|
|
3648
|
+
frameOver(frameKey, totalSize)
|
|
3649
|
+
) {
|
|
2819
3650
|
return {
|
|
2820
3651
|
ok: false,
|
|
2821
3652
|
status: 429,
|
|
@@ -2830,6 +3661,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2830
3661
|
const now = Date.now();
|
|
2831
3662
|
const session: ChunkSession = {
|
|
2832
3663
|
id,
|
|
3664
|
+
frameKey,
|
|
2833
3665
|
dir,
|
|
2834
3666
|
totalSize,
|
|
2835
3667
|
chunkCount: Math.ceil(totalSize / ASSET_CHUNK_BYTES),
|
|
@@ -2841,6 +3673,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2841
3673
|
};
|
|
2842
3674
|
chunkSessions.set(id, session);
|
|
2843
3675
|
assetBytesReserved += totalSize;
|
|
3676
|
+
frameCharge(frameKey, totalSize);
|
|
2844
3677
|
try {
|
|
2845
3678
|
await mkdir(dir, { recursive: true });
|
|
2846
3679
|
} catch (err) {
|
|
@@ -2968,6 +3801,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
2968
3801
|
return await consumeAssetStream(reassembledStream(s), {
|
|
2969
3802
|
mediaCap: ASSET_MAX_CHUNKED_BYTES,
|
|
2970
3803
|
budget: 'reserved',
|
|
3804
|
+
frameKey: s.frameKey,
|
|
2971
3805
|
allowImages: false,
|
|
2972
3806
|
});
|
|
2973
3807
|
} finally {
|
|
@@ -3033,7 +3867,9 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
3033
3867
|
}
|
|
3034
3868
|
out.push({ path: `assets/${name}`, name, ext: ext.slice(1), kind, size, mtimeMs });
|
|
3035
3869
|
}
|
|
3036
|
-
|
|
3870
|
+
// Newest first; equal mtimes (a coarse filesystem clock stamps files written back to back alike) by
|
|
3871
|
+
// name — never readdir order, which differs per filesystem and so per machine (p8-ci-linux-2).
|
|
3872
|
+
out.sort((a, b) => b.mtimeMs - a.mtimeMs || (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
3037
3873
|
return { ok: true, assets: out.slice(0, 500) };
|
|
3038
3874
|
}
|
|
3039
3875
|
|
|
@@ -3189,7 +4025,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
3189
4025
|
const assetsDir = path.join(paths.designRoot, 'assets');
|
|
3190
4026
|
let entries: string[];
|
|
3191
4027
|
try {
|
|
3192
|
-
entries = await readdir(assetsDir);
|
|
4028
|
+
entries = (await readdir(assetsDir)).sort(); // a defined order for the cap and for ties
|
|
3193
4029
|
} catch {
|
|
3194
4030
|
return [];
|
|
3195
4031
|
}
|
|
@@ -3362,21 +4198,51 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
3362
4198
|
// gated by `validateCanvasName` (path + JSX + JSON injection boundary); `group`
|
|
3363
4199
|
// is allowlisted to the configured canvas groups; a `resolve()` containment
|
|
3364
4200
|
// assert is the defense-in-depth backstop.
|
|
4201
|
+
// V2 S6.1 (C4) — a `blank` create with no name is named by the server ("Untitled canvas", " 2", …, or
|
|
4202
|
+
// from `fromPrompt`). Creates run one at a time so two ⌘N in the same instant cannot both pick the
|
|
4203
|
+
// same free name (the pick and the write are separated by awaits).
|
|
4204
|
+
let blankCreateQueue: Promise<unknown> = Promise.resolve();
|
|
3365
4205
|
async function createCanvas(input: {
|
|
3366
4206
|
name?: unknown;
|
|
3367
4207
|
kind?: unknown;
|
|
3368
4208
|
group?: unknown;
|
|
4209
|
+
fromPrompt?: unknown;
|
|
4210
|
+
// S10.13 — the system a new canvas starts on (its folder's one system, client/v2/ds/new-canvas-default.js)
|
|
4211
|
+
designSystem?: unknown;
|
|
3369
4212
|
// DDR-150 P4 Task 12 — video-comp assemble payload (kind === 'video-comp').
|
|
3370
4213
|
clips?: unknown;
|
|
3371
4214
|
fps?: unknown;
|
|
3372
4215
|
width?: unknown;
|
|
3373
4216
|
height?: unknown;
|
|
4217
|
+
}): Promise<CreateCanvasResult> {
|
|
4218
|
+
const run = blankCreateQueue.then(() => createCanvasNow(input));
|
|
4219
|
+
blankCreateQueue = run.catch(() => undefined);
|
|
4220
|
+
return run;
|
|
4221
|
+
}
|
|
4222
|
+
|
|
4223
|
+
async function createCanvasNow(input: {
|
|
4224
|
+
name?: unknown;
|
|
4225
|
+
kind?: unknown;
|
|
4226
|
+
group?: unknown;
|
|
4227
|
+
fromPrompt?: unknown;
|
|
4228
|
+
designSystem?: unknown;
|
|
4229
|
+
clips?: unknown;
|
|
4230
|
+
fps?: unknown;
|
|
4231
|
+
width?: unknown;
|
|
4232
|
+
height?: unknown;
|
|
3374
4233
|
}): Promise<CreateCanvasResult> {
|
|
3375
4234
|
// v1 stamps blank brief-boards + assembled video-comps — richer generation
|
|
3376
|
-
// stays with `/design:new` (Claude).
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
4235
|
+
// stays with `/design:new` (Claude). V2 S6.1 adds the blank canvas: with no `kind`, a name means a
|
|
4236
|
+
// brief board (every v1 caller) and no name means a blank canvas.
|
|
4237
|
+
const noName = input.name == null || input.name === '';
|
|
4238
|
+
const kind =
|
|
4239
|
+
input.kind == null || input.kind === '' ? (noName ? 'blank' : 'brief-board') : input.kind;
|
|
4240
|
+
if (kind !== 'brief-board' && kind !== 'video-comp' && kind !== 'blank') {
|
|
4241
|
+
return {
|
|
4242
|
+
ok: false,
|
|
4243
|
+
status: 400,
|
|
4244
|
+
error: 'kind must be "blank", "brief-board" or "video-comp"',
|
|
4245
|
+
};
|
|
3380
4246
|
}
|
|
3381
4247
|
// Parse + validate the assemble clip list up front (video-comp only).
|
|
3382
4248
|
const assembleClips: AssembleClip[] = [];
|
|
@@ -3401,7 +4267,9 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
3401
4267
|
assembleClips.push({ src, mediaKind, durationInFrames });
|
|
3402
4268
|
}
|
|
3403
4269
|
}
|
|
3404
|
-
|
|
4270
|
+
// A blank canvas with no name is named below, once the folder is known.
|
|
4271
|
+
const autoName = kind === 'blank' && noName;
|
|
4272
|
+
let v = autoName ? validateCanvasName(UNTITLED_CANVAS) : validateCanvasName(input.name);
|
|
3405
4273
|
if (!v.ok || !v.name || !v.componentName) {
|
|
3406
4274
|
return { ok: false, status: 400, error: v.error ?? 'invalid name' };
|
|
3407
4275
|
}
|
|
@@ -3416,6 +4284,24 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
3416
4284
|
}
|
|
3417
4285
|
|
|
3418
4286
|
const groupAbs = path.join(paths.designRoot, group);
|
|
4287
|
+
if (autoName) {
|
|
4288
|
+
const base =
|
|
4289
|
+
input.fromPrompt == null ? UNTITLED_CANVAS : nameFromPrompt(input.fromPrompt).canvas;
|
|
4290
|
+
// A canvas in the trash is not in the folder, so it does not hold its name.
|
|
4291
|
+
const existingRels = await allCanvasRels();
|
|
4292
|
+
const free = nextFreeCanvasName(
|
|
4293
|
+
base,
|
|
4294
|
+
(n) =>
|
|
4295
|
+
existsSync(path.join(groupAbs, `${n}.tsx`)) ||
|
|
4296
|
+
existsSync(path.join(groupAbs, `${n}.meta.json`)) ||
|
|
4297
|
+
// S1.23b — a name too close to one already here is taken too.
|
|
4298
|
+
findCloseName(path.posix.join(group, `${n}.tsx`), existingRels) !== null
|
|
4299
|
+
);
|
|
4300
|
+
v = validateCanvasName(free);
|
|
4301
|
+
if (!v.ok || !v.name || !v.componentName) {
|
|
4302
|
+
return { ok: false, status: 400, error: v.error ?? 'invalid name' };
|
|
4303
|
+
}
|
|
4304
|
+
}
|
|
3419
4305
|
const fileAbs = path.join(groupAbs, `${v.name}.tsx`);
|
|
3420
4306
|
// Containment backstop, two layers (Phase 22 security review F2). The name
|
|
3421
4307
|
// regex already forbids traversal, but `group` comes from config
|
|
@@ -3440,6 +4326,10 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
3440
4326
|
) {
|
|
3441
4327
|
return { ok: false, status: 400, error: 'resolved path escapes the canvas group' };
|
|
3442
4328
|
}
|
|
4329
|
+
// S1.23b — before the plain "already exists", so a case-only variant says the same words on a
|
|
4330
|
+
// case-insensitive volume (where it IS the file) as on a case-sensitive one.
|
|
4331
|
+
const closeToCreate = await closeCanvasName(v.name, path.posix.join(group, `${v.name}.tsx`));
|
|
4332
|
+
if (closeToCreate) return closeToCreate;
|
|
3443
4333
|
if (await Bun.file(fileAbs).exists()) {
|
|
3444
4334
|
return {
|
|
3445
4335
|
ok: false,
|
|
@@ -3450,7 +4340,12 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
3450
4340
|
|
|
3451
4341
|
const rel = path.posix.join(group, `${v.name}.tsx`);
|
|
3452
4342
|
const slug = fileSlug(rel);
|
|
3453
|
-
|
|
4343
|
+
// S10.13 — a system the person asked for counts only when the project holds it (else the default)
|
|
4344
|
+
const askedDs = typeof input.designSystem === 'string' ? input.designSystem : '';
|
|
4345
|
+
const dsName =
|
|
4346
|
+
askedDs && cfg.designSystems?.some((d) => d.name === askedDs)
|
|
4347
|
+
? askedDs
|
|
4348
|
+
: cfg.defaultDesignSystem || 'project';
|
|
3454
4349
|
const platform = 'desktop';
|
|
3455
4350
|
let tsx: string;
|
|
3456
4351
|
if (kind === 'video-comp') {
|
|
@@ -3468,13 +4363,21 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
3468
4363
|
error: err instanceof Error ? err.message : 'assemble failed',
|
|
3469
4364
|
};
|
|
3470
4365
|
}
|
|
4366
|
+
} else if (kind === 'blank') {
|
|
4367
|
+
tsx = renderBlankCanvas({
|
|
4368
|
+
name: v.name,
|
|
4369
|
+
componentName: v.componentName,
|
|
4370
|
+
dsName,
|
|
4371
|
+
platform,
|
|
4372
|
+
historyDir: path.posix.join(paths.designRel, '_history', slug),
|
|
4373
|
+
});
|
|
3471
4374
|
} else {
|
|
3472
4375
|
tsx = renderBriefBoard({
|
|
3473
4376
|
name: v.name,
|
|
3474
4377
|
componentName: v.componentName,
|
|
3475
4378
|
dsName,
|
|
3476
4379
|
platform,
|
|
3477
|
-
seedHint: 'Empty brief
|
|
4380
|
+
seedHint: 'Empty brief canvas',
|
|
3478
4381
|
historyDir: path.posix.join(paths.designRel, '_history', slug),
|
|
3479
4382
|
});
|
|
3480
4383
|
}
|
|
@@ -3492,16 +4395,28 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
3492
4395
|
created: now,
|
|
3493
4396
|
last_modified: now,
|
|
3494
4397
|
}
|
|
3495
|
-
:
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
4398
|
+
: kind === 'blank'
|
|
4399
|
+
? {
|
|
4400
|
+
// `canvas`, not a new kind: the index and a v1 peer both know it (V2 S6.1).
|
|
4401
|
+
kind: 'canvas',
|
|
4402
|
+
title: v.name,
|
|
4403
|
+
subtitle: 'blank canvas',
|
|
4404
|
+
brief: '',
|
|
4405
|
+
designSystem: dsName,
|
|
4406
|
+
platform,
|
|
4407
|
+
created: now,
|
|
4408
|
+
last_modified: now,
|
|
4409
|
+
}
|
|
4410
|
+
: {
|
|
4411
|
+
kind: 'brief-board',
|
|
4412
|
+
title: v.name,
|
|
4413
|
+
subtitle: 'brief canvas',
|
|
4414
|
+
brief: v.name,
|
|
4415
|
+
designSystem: dsName,
|
|
4416
|
+
platform,
|
|
4417
|
+
created: now,
|
|
4418
|
+
last_modified: now,
|
|
4419
|
+
};
|
|
3505
4420
|
await Bun.write(fileAbs, tsx);
|
|
3506
4421
|
await Bun.write(
|
|
3507
4422
|
path.join(groupAbs, `${v.name}.meta.json`),
|
|
@@ -3523,7 +4438,9 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
3523
4438
|
return { ok: true, file: path.posix.join(paths.designRel, rel), rel, slug };
|
|
3524
4439
|
}
|
|
3525
4440
|
|
|
3526
|
-
async function duplicateCanvas(
|
|
4441
|
+
async function duplicateCanvas(
|
|
4442
|
+
input: { file?: unknown } & DuplicateCanvasOpts
|
|
4443
|
+
): Promise<CreateCanvasResult> {
|
|
3527
4444
|
const raw = input?.file;
|
|
3528
4445
|
if (typeof raw !== 'string' || !raw.trim()) {
|
|
3529
4446
|
return { ok: false, status: 400, error: 'file is required' };
|
|
@@ -3562,30 +4479,42 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
3562
4479
|
if (!(await Bun.file(fileAbs).exists())) {
|
|
3563
4480
|
return { ok: false, status: 404, error: 'canvas not found' };
|
|
3564
4481
|
}
|
|
3565
|
-
|
|
4482
|
+
// A canvas made before names were held to the allowed set (S1.23c) may carry an accent or a dash the
|
|
4483
|
+
// set no longer takes: its copy is named from the folded base, so duplicating is never refused.
|
|
4484
|
+
const srcBase = path.basename(rel).replace(/\.tsx$/i, '');
|
|
4485
|
+
const base = foldToAllowedName(srcBase) || UNTITLED_CANVAS;
|
|
3566
4486
|
const dir = path.posix.dirname(rel) === '.' ? '' : path.posix.dirname(rel);
|
|
3567
|
-
// "<name> copy", then "<name> copy 2", … — the first free, valid name.
|
|
4487
|
+
// "<name> copy", then "<name> copy 2", … — the first free, valid name (S11.12 Keep both:
|
|
4488
|
+
// "<name> this Mac", "<name> this Mac 2", …).
|
|
4489
|
+
const word = input.suffix ?? 'copy';
|
|
3568
4490
|
let name: string | null = null;
|
|
3569
4491
|
for (let n = 1; n < 100 && !name; n++) {
|
|
3570
|
-
const suffix = n === 1 ?
|
|
4492
|
+
const suffix = n === 1 ? ` ${word}` : ` ${word} ${n}`;
|
|
3571
4493
|
const v = validateCanvasName(`${base.slice(0, 60 - suffix.length)}${suffix}`);
|
|
3572
4494
|
if (!v.ok || !v.name) return { ok: false, status: 400, error: v.error ?? 'invalid name' };
|
|
3573
4495
|
const candidate = path.posix.join(dir, `${v.name}.tsx`);
|
|
3574
4496
|
if (await Bun.file(path.join(paths.designRoot, candidate)).exists()) continue;
|
|
3575
4497
|
if (await fileForSlug(fileSlug(candidate))) continue;
|
|
4498
|
+
// S1.23b — a copy name that shares a sync document with another canvas is taken too.
|
|
4499
|
+
if (await closeCanvasName(v.name, candidate)) continue;
|
|
3576
4500
|
name = v.name;
|
|
3577
4501
|
}
|
|
3578
4502
|
if (!name) return { ok: false, status: 409, error: 'too many copies of this canvas' };
|
|
3579
4503
|
const toRel = path.posix.join(dir, `${name}.tsx`);
|
|
3580
4504
|
const toAbs = path.join(paths.designRoot, toRel);
|
|
3581
|
-
|
|
4505
|
+
// Keep both writes the version it was handed (the one this Mac held), never a later disk read.
|
|
4506
|
+
await Bun.write(
|
|
4507
|
+
toAbs,
|
|
4508
|
+
typeof input.source === 'string' ? input.source : await Bun.file(fileAbs).arrayBuffer()
|
|
4509
|
+
);
|
|
3582
4510
|
const metaAbs = fileAbs.replace(/\.tsx$/i, '.meta.json');
|
|
3583
4511
|
if (await Bun.file(metaAbs).exists()) {
|
|
3584
4512
|
let text = await Bun.file(metaAbs).text();
|
|
3585
4513
|
try {
|
|
3586
4514
|
const meta = JSON.parse(text) as Record<string, unknown>;
|
|
3587
4515
|
const now = new Date().toISOString();
|
|
3588
|
-
if (typeof
|
|
4516
|
+
if (typeof input.title === 'string') meta.title = input.title.slice(0, 120);
|
|
4517
|
+
else if (typeof meta.title !== 'string' || meta.title === srcBase) meta.title = name;
|
|
3589
4518
|
meta.created = now;
|
|
3590
4519
|
meta.last_modified = now;
|
|
3591
4520
|
text = `${JSON.stringify(meta, null, 2)}\n`;
|
|
@@ -3718,6 +4647,13 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
3718
4647
|
`${JSON.stringify({ canvas: rel, slug, deletedAt: new Date().toISOString(), trashed }, null, 2)}\n`
|
|
3719
4648
|
);
|
|
3720
4649
|
|
|
4650
|
+
// V2-1.1 §5.5 — a trashed canvas drops its pin (a restore does not bring it back).
|
|
4651
|
+
try {
|
|
4652
|
+
dropPin(paths.designRoot, rel);
|
|
4653
|
+
} catch {
|
|
4654
|
+
/* best-effort */
|
|
4655
|
+
}
|
|
4656
|
+
|
|
3721
4657
|
// Phase 30 — live tree refresh for other local tabs (see createCanvas).
|
|
3722
4658
|
ctx.bus.emit('canvas-list-update', { action: 'removed', rel, slug });
|
|
3723
4659
|
// A SEPARATE EVENT, DELIBERATELY. `canvas-list-update` is emitted by this
|
|
@@ -3793,7 +4729,9 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
3793
4729
|
if (depth > 12) return null;
|
|
3794
4730
|
let entries: import('node:fs').Dirent[];
|
|
3795
4731
|
try {
|
|
3796
|
-
entries = await readdir(dirAbs, { withFileTypes: true })
|
|
4732
|
+
entries = (await readdir(dirAbs, { withFileTypes: true })).sort((a, b) =>
|
|
4733
|
+
a.name < b.name ? -1 : a.name > b.name ? 1 : 0
|
|
4734
|
+
);
|
|
3797
4735
|
} catch {
|
|
3798
4736
|
return null;
|
|
3799
4737
|
}
|
|
@@ -4057,8 +4995,13 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4057
4995
|
* half-moved tree — strictly worse than the un-rewritten imports that were
|
|
4058
4996
|
* the status quo. A no-op rewrite writes nothing.
|
|
4059
4997
|
*/
|
|
4060
|
-
async function rewriteCanvasImports(
|
|
4061
|
-
|
|
4998
|
+
async function rewriteCanvasImports(
|
|
4999
|
+
abs: string,
|
|
5000
|
+
fromDir: string,
|
|
5001
|
+
toDir: string,
|
|
5002
|
+
relocate?: (target: string) => string | null
|
|
5003
|
+
): Promise<void> {
|
|
5004
|
+
if (fromDir === toDir && !relocate) return;
|
|
4062
5005
|
try {
|
|
4063
5006
|
// NEVER DEREFERENCE A SYMLINK HERE. The move's containment checks cover
|
|
4064
5007
|
// the source *directory* (`assertRealpathContained(path.dirname(...))`)
|
|
@@ -4073,7 +5016,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4073
5016
|
const st = await lstat(abs);
|
|
4074
5017
|
if (!st.isFile()) return;
|
|
4075
5018
|
const source = await readFile(abs, 'utf8');
|
|
4076
|
-
const next = rewriteRelativeImports(source, fromDir, toDir);
|
|
5019
|
+
const next = rewriteRelativeImports(source, fromDir, toDir, relocate);
|
|
4077
5020
|
// atomicWrite, not `writeFile` — this lands on a `.tsx` the fs-mirror is
|
|
4078
5021
|
// watching, so a truncate-then-write can surface a partial-content watch
|
|
4079
5022
|
// event (the exact hazard atomic-write.ts was built for), and a crash
|
|
@@ -4219,7 +5162,9 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4219
5162
|
return { ok: false, status: 400, error: 'source and destination are the same' };
|
|
4220
5163
|
}
|
|
4221
5164
|
const toAbs = path.join(paths.designRoot, toRel);
|
|
4222
|
-
|
|
5165
|
+
// S1.23b — a rename onto ITSELF with a case change is the same file on a case-insensitive
|
|
5166
|
+
// volume: it "exists", and is not a collision. Anything else already at the target is.
|
|
5167
|
+
if ((await Bun.file(toAbs).exists()) && !(await isSameEntry(fileAbs, toAbs))) {
|
|
4223
5168
|
return {
|
|
4224
5169
|
ok: false,
|
|
4225
5170
|
status: 409,
|
|
@@ -4253,6 +5198,10 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4253
5198
|
};
|
|
4254
5199
|
}
|
|
4255
5200
|
}
|
|
5201
|
+
// S1.23b — the exact slug is the case above; this is the SYNC key, which flattens further (an
|
|
5202
|
+
// em dash and a hyphen are one document on the wire). The canvas itself is not a collision.
|
|
5203
|
+
const closeTo = await closeCanvasName(base.replace(/\.tsx$/i, ''), toRel, (r) => r === rel);
|
|
5204
|
+
if (closeTo) return closeTo;
|
|
4256
5205
|
|
|
4257
5206
|
// Collab guard — a pinned room (shared-doc hub provider attached, DDR-064)
|
|
4258
5207
|
// must not have its file renamed out from under it. The old behaviour was
|
|
@@ -4283,6 +5232,9 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4283
5232
|
// Primary `.tsx` moves FIRST — abort the whole op if this fails so the
|
|
4284
5233
|
// tree is never wrong about where the canvas lives.
|
|
4285
5234
|
await mkdir(toDirAbs, { recursive: true });
|
|
5235
|
+
// Said BEFORE the rename: the local history must not read the old path vanishing as a delete (a
|
|
5236
|
+
// Trash row for a rename) while the sidecars below are still moving; `moved` follows when all is done.
|
|
5237
|
+
ctx.bus.emit('canvas-move-begin', { rel: toRel, fromRel: rel });
|
|
4286
5238
|
try {
|
|
4287
5239
|
await rename(fileAbs, toAbs);
|
|
4288
5240
|
} catch (err) {
|
|
@@ -4295,7 +5247,22 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4295
5247
|
// itself already succeeded, and a rewrite failure must not leave the tree
|
|
4296
5248
|
// half-moved — it leaves a build error the user can fix by hand, which is
|
|
4297
5249
|
// exactly where they were before this existed.
|
|
4298
|
-
|
|
5250
|
+
// issue #153 — the canvas's own files travel with it (`<name>.css` → `<new>.css`), so a specifier that named
|
|
5251
|
+
// one must name where it went, in a same-folder rename too; the rest re-root for the new depth.
|
|
5252
|
+
const travelling = new Map<string, string>();
|
|
5253
|
+
for (const artifact of canvasArtifacts({ rel, paths })) {
|
|
5254
|
+
if (artifact.kind === 'primary' || artifact.carryOnMove === false) continue;
|
|
5255
|
+
const dest = relocatedName(artifact, rel, toRel, paths);
|
|
5256
|
+
if (path.resolve(dest) === path.resolve(artifact.abs)) continue;
|
|
5257
|
+
const posix = (abs: string) => path.relative(paths.designRoot, abs).split(path.sep).join('/');
|
|
5258
|
+
travelling.set(posix(artifact.abs), posix(dest));
|
|
5259
|
+
}
|
|
5260
|
+
await rewriteCanvasImports(
|
|
5261
|
+
toAbs,
|
|
5262
|
+
path.posix.dirname(rel),
|
|
5263
|
+
path.posix.dirname(toRel),
|
|
5264
|
+
(target) => travelling.get(target) ?? null
|
|
5265
|
+
);
|
|
4299
5266
|
|
|
4300
5267
|
const moved: string[] = [path.relative(paths.repoRoot, toAbs)];
|
|
4301
5268
|
for (const artifact of canvasArtifacts({ rel, paths })) {
|
|
@@ -4341,6 +5308,13 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4341
5308
|
/* best-effort — a stale locator entry re-derives on next transpile */
|
|
4342
5309
|
}
|
|
4343
5310
|
|
|
5311
|
+
// V2-3.3 — its pin and "last opened" (`_canvas-state/_pins.json`, `_recent.json`) follow it.
|
|
5312
|
+
try {
|
|
5313
|
+
rekeyUserState(paths.designRoot, [[rel, toRel]]);
|
|
5314
|
+
} catch {
|
|
5315
|
+
/* best-effort — a lost pin is not worth failing a move that already happened */
|
|
5316
|
+
}
|
|
5317
|
+
|
|
4344
5318
|
// Retarget `_active.json` (active canvas / open tabs / selection) if this
|
|
4345
5319
|
// canvas was referenced anywhere in it.
|
|
4346
5320
|
const fromFile = path.posix.join(paths.designRel, rel);
|
|
@@ -4474,11 +5448,18 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4474
5448
|
return { ok: false, status: 400, error: 'source and destination are the same' };
|
|
4475
5449
|
}
|
|
4476
5450
|
const toDirFinalAbs = path.join(paths.designRoot, toRelDir);
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
5451
|
+
// S1.23b — a folder renamed onto ITSELF with a case change is the same folder on a
|
|
5452
|
+
// case-insensitive volume; a sibling that shares a sync key with the new name is a collision.
|
|
5453
|
+
const caseOnlyFolder = await isSameEntry(dirAbs, toDirFinalAbs);
|
|
5454
|
+
if (!caseOnlyFolder) {
|
|
5455
|
+
const closeFolder = await closeFolderName(base, toDir, relDir);
|
|
5456
|
+
if (closeFolder) return closeFolder;
|
|
5457
|
+
try {
|
|
5458
|
+
await statp(toDirFinalAbs);
|
|
5459
|
+
return { ok: false, status: 409, error: `"${base}" already exists in ${toDir || '.'}` };
|
|
5460
|
+
} catch {
|
|
5461
|
+
/* good — doesn't exist yet */
|
|
5462
|
+
}
|
|
4482
5463
|
}
|
|
4483
5464
|
|
|
4484
5465
|
// Enumerate every .tsx canvas under this folder (recursive) BEFORE the
|
|
@@ -4520,6 +5501,13 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4520
5501
|
};
|
|
4521
5502
|
}
|
|
4522
5503
|
}
|
|
5504
|
+
// S1.23b — the SYNC key, which flattens further than the exact slug above.
|
|
5505
|
+
const closeNested = await closeCanvasName(
|
|
5506
|
+
path.posix.basename(toRel).replace(/\.tsx$/i, ''),
|
|
5507
|
+
toRel,
|
|
5508
|
+
(o) => batchRelSet.has(o)
|
|
5509
|
+
);
|
|
5510
|
+
if (closeNested) return closeNested;
|
|
4523
5511
|
}
|
|
4524
5512
|
|
|
4525
5513
|
// ONE project action for the whole folder (accepted-revisions mode) —
|
|
@@ -4567,7 +5555,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4567
5555
|
// leaving the old folder in this person's tree while every teammate had
|
|
4568
5556
|
// the move (plan T31/L02). A destination holding nothing but placeholders
|
|
4569
5557
|
// is that projection; it is replaced, never merged into.
|
|
4570
|
-
|
|
5558
|
+
// (Never when this IS the source — a case-only rename — or the source would be removed.)
|
|
5559
|
+
if (!caseOnlyFolder && (await onlyFolderPlaceholders(toDirFinalAbs))) {
|
|
4571
5560
|
await rm(toDirFinalAbs, { recursive: true, force: true });
|
|
4572
5561
|
}
|
|
4573
5562
|
try {
|
|
@@ -4585,10 +5574,16 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4585
5574
|
// Same depth change as moveCanvas, once per nested canvas (issue #114).
|
|
4586
5575
|
// A folder move relocates every canvas inside it by the same delta, but
|
|
4587
5576
|
// each one's own dir differs, so the rewrite is per file, not per folder.
|
|
5577
|
+
// a sibling inside the moved folder moved with it (issue #153): point at its new place, don't re-root back
|
|
4588
5578
|
await rewriteCanvasImports(
|
|
4589
5579
|
path.join(paths.designRoot, toRel),
|
|
4590
5580
|
path.posix.dirname(fromRel),
|
|
4591
|
-
path.posix.dirname(toRel)
|
|
5581
|
+
path.posix.dirname(toRel),
|
|
5582
|
+
(target) =>
|
|
5583
|
+
target === relDir.replace(/\/+$/, '') ||
|
|
5584
|
+
target.startsWith(`${relDir.replace(/\/+$/, '')}/`)
|
|
5585
|
+
? path.posix.join(toRelDir, target.slice(relDir.replace(/\/+$/, '').length))
|
|
5586
|
+
: null
|
|
4592
5587
|
);
|
|
4593
5588
|
for (const artifact of canvasArtifacts({ rel: fromRel, paths })) {
|
|
4594
5589
|
if (artifact.kind !== 'slug-keyed') continue; // primary/siblings already moved with the dir
|
|
@@ -4659,6 +5654,16 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4659
5654
|
});
|
|
4660
5655
|
}
|
|
4661
5656
|
|
|
5657
|
+
// V2-3.3 — every nested canvas's pin and "last opened" follow it, in one rewrite per file.
|
|
5658
|
+
try {
|
|
5659
|
+
rekeyUserState(
|
|
5660
|
+
paths.designRoot,
|
|
5661
|
+
canvasRels.map((fromRel) => [fromRel, toRelDir + fromRel.slice(relDir.length)])
|
|
5662
|
+
);
|
|
5663
|
+
} catch {
|
|
5664
|
+
/* best-effort */
|
|
5665
|
+
}
|
|
5666
|
+
|
|
4662
5667
|
return { ok: true, fromRel: relDir, toRel: toRelDir, fromSlug: '', toSlug: '', moved };
|
|
4663
5668
|
}
|
|
4664
5669
|
|
|
@@ -4719,6 +5724,10 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4719
5724
|
) {
|
|
4720
5725
|
return { ok: false, status: 400, error: 'resolved path escapes the parent folder' };
|
|
4721
5726
|
}
|
|
5727
|
+
// S1.23b — a sibling folder that shares a sync key with this name is a collision (before the
|
|
5728
|
+
// plain "already exists", so a case-only variant says the same words on either volume).
|
|
5729
|
+
const closeFolder = await closeFolderName(v.name, parent);
|
|
5730
|
+
if (closeFolder) return closeFolder;
|
|
4722
5731
|
try {
|
|
4723
5732
|
await statp(dirAbs); // throws if absent (works for files AND dirs)
|
|
4724
5733
|
return { ok: false, status: 409, error: `"${v.name}" already exists` };
|
|
@@ -4830,7 +5839,9 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4830
5839
|
abs: string,
|
|
4831
5840
|
run: () => Promise<{ delta: number; changed?: boolean; previous?: AttributeState }>,
|
|
4832
5841
|
errLabel: string,
|
|
4833
|
-
describe?: Parameters<typeof describeSourceOp>[2]
|
|
5842
|
+
describe?: Parameters<typeof describeSourceOp>[2],
|
|
5843
|
+
/** S2.25 G2: what the undo history calls this write (one line); absent = the default row */
|
|
5844
|
+
label?: string
|
|
4834
5845
|
): Promise<EditOpResult> {
|
|
4835
5846
|
const rel = path.relative(paths.designRoot, abs);
|
|
4836
5847
|
ctx.bus.emit('activity:suppress', rel);
|
|
@@ -4845,7 +5856,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4845
5856
|
const op = describeSourceOp(abs, before, describe);
|
|
4846
5857
|
if (op) ctx.bus.emit('source-op', { rel, op });
|
|
4847
5858
|
}
|
|
4848
|
-
const res = await run
|
|
5859
|
+
const res = await sayingWrites(before, label, run);
|
|
4849
5860
|
const previous =
|
|
4850
5861
|
res.previous?.kind === 'absent'
|
|
4851
5862
|
? { previous: null }
|
|
@@ -4863,7 +5874,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4863
5874
|
// This API write is complete: accepted sync need not wait for an
|
|
4864
5875
|
// external editor's quiet window. It is still only a proposal, not an
|
|
4865
5876
|
// acknowledgement; the normal hub validation/acceptance path owns that.
|
|
4866
|
-
if (after !== before)
|
|
5877
|
+
if (after !== before)
|
|
5878
|
+
ctx.bus.emit('source-written', { rel, content: after, ...(label ? { label } : {}) });
|
|
4867
5879
|
return { ok: true, delta: res.delta, seq, ...previous };
|
|
4868
5880
|
} catch (err) {
|
|
4869
5881
|
ctx.bus.emit('activity:unsuppress', rel);
|
|
@@ -4878,6 +5890,38 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4878
5890
|
}
|
|
4879
5891
|
}
|
|
4880
5892
|
|
|
5893
|
+
/**
|
|
5894
|
+
* p8-lock-reasons — the edit-op's 409 `locked` for the first shared-locked object of `targets` in the canvas at
|
|
5895
|
+
* `abs`, else null. Every direct object write asks it before it writes (S2-edit-ops §3 rule 6). A target with an
|
|
5896
|
+
* `occurrence` is a component instance: the write lands on its `<Component>` usage, so that usage is asked too.
|
|
5897
|
+
*/
|
|
5898
|
+
async function lockedTarget(
|
|
5899
|
+
abs: string,
|
|
5900
|
+
targets: ReadonlyArray<string | { id: string; occurrence?: number }>
|
|
5901
|
+
): Promise<{ ok: false; status: 409; error: string; code: 'locked' } | null> {
|
|
5902
|
+
let source: string;
|
|
5903
|
+
try {
|
|
5904
|
+
source = await Bun.file(abs).text();
|
|
5905
|
+
} catch {
|
|
5906
|
+
return null; // a missing canvas is the writer's own 404
|
|
5907
|
+
}
|
|
5908
|
+
const walk = walkIdElements(source, abs);
|
|
5909
|
+
if (!walk.ok) return null; // an unparsable canvas is the writer's own refusal
|
|
5910
|
+
const ids: string[] = [];
|
|
5911
|
+
for (const t of targets) {
|
|
5912
|
+
const { id, occurrence } = typeof t === 'string' ? { id: t, occurrence: undefined } : t;
|
|
5913
|
+
ids.push(id);
|
|
5914
|
+
if (typeof occurrence === 'number') {
|
|
5915
|
+
const usage = usageIdOf(abs, source, id, occurrence);
|
|
5916
|
+
if (usage !== id) ids.push(usage);
|
|
5917
|
+
}
|
|
5918
|
+
}
|
|
5919
|
+
const lock = lockedRefusal(walk.elements, ids);
|
|
5920
|
+
return lock && lock.code === 'locked'
|
|
5921
|
+
? { ok: false, status: 409, error: lock.message, code: 'locked' }
|
|
5922
|
+
: null;
|
|
5923
|
+
}
|
|
5924
|
+
|
|
4881
5925
|
async function editCss(input: {
|
|
4882
5926
|
canvas?: unknown;
|
|
4883
5927
|
id?: unknown;
|
|
@@ -4886,6 +5930,10 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4886
5930
|
reset?: unknown;
|
|
4887
5931
|
idIndex?: unknown;
|
|
4888
5932
|
expected?: unknown;
|
|
5933
|
+
/** S2.25 G2: more properties of the SAME element, written in the same request (a move is left + top) */
|
|
5934
|
+
also?: unknown;
|
|
5935
|
+
/** S2.25 G2: what the undo history calls this write */
|
|
5936
|
+
label?: unknown;
|
|
4889
5937
|
}): Promise<EditOpResult> {
|
|
4890
5938
|
const r = resolveCanvasAbs(input.canvas);
|
|
4891
5939
|
if (!r.ok) return r;
|
|
@@ -4893,6 +5941,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4893
5941
|
if (!pre.ok) return { ok: false, status: 400, error: 'invalid expected value' };
|
|
4894
5942
|
const id = typeof input.id === 'string' ? input.id.trim() : '';
|
|
4895
5943
|
if (!CD_ID_RE.test(id)) return { ok: false, status: 400, error: 'invalid data-cd-id' };
|
|
5944
|
+
const said = typeof input.label === 'string' ? input.label.trim().slice(0, 120) : '';
|
|
4896
5945
|
// Stage H3 — optional DOM-occurrence index. Present only for a whole-instance
|
|
4897
5946
|
// move/resize (reposition/resize-request); routes the write to the dragged
|
|
4898
5947
|
// component instance's own `<Component/>` usage so it stays LOCAL. Absent for
|
|
@@ -4901,6 +5950,10 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4901
5950
|
typeof input.idIndex === 'number' && Number.isInteger(input.idIndex) && input.idIndex >= 0
|
|
4902
5951
|
? input.idIndex
|
|
4903
5952
|
: undefined;
|
|
5953
|
+
// p8-lock-reasons — only the lock op may touch a locked object (S2-edit-ops §3 rule 6): the dispatcher's
|
|
5954
|
+
// own lookup, so a style control on a locked object hears the edit-op's 409 `locked`, not a write
|
|
5955
|
+
const locked = await lockedTarget(r.abs, [{ id, occurrence: idIndex }]);
|
|
5956
|
+
if (locked) return locked;
|
|
4904
5957
|
const property = typeof input.property === 'string' ? input.property.trim() : '';
|
|
4905
5958
|
// CSS property names are ASCII letters + hyphens only (optionally a leading
|
|
4906
5959
|
// `-` for vendor prefixes) — reject anything that could smuggle a second key
|
|
@@ -4929,12 +5982,60 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4929
5982
|
id,
|
|
4930
5983
|
attr: `style.${camel}`,
|
|
4931
5984
|
...(idIndex !== undefined ? { occurrence: idIndex } : {}),
|
|
4932
|
-
}
|
|
5985
|
+
},
|
|
5986
|
+
said || undefined
|
|
4933
5987
|
);
|
|
4934
5988
|
}
|
|
4935
5989
|
const value = typeof input.value === 'string' ? input.value : '';
|
|
4936
5990
|
if (!value.trim()) return { ok: false, status: 400, error: 'value required' };
|
|
4937
5991
|
if (value.length > 256) return { ok: false, status: 413, error: 'value too long' };
|
|
5992
|
+
// S2.25 G2 — the other properties of the same move, validated like the first (a name, a short value)
|
|
5993
|
+
const more: Array<{ camel: string; value: string }> = [];
|
|
5994
|
+
if (input.also !== undefined) {
|
|
5995
|
+
const list = Array.isArray(input.also) ? input.also : null;
|
|
5996
|
+
if (!list || list.length > 4) return { ok: false, status: 400, error: 'invalid also' };
|
|
5997
|
+
for (const item of list as Array<{ property?: unknown; value?: unknown }>) {
|
|
5998
|
+
const p = typeof item?.property === 'string' ? item.property.trim() : '';
|
|
5999
|
+
const v = typeof item?.value === 'string' ? item.value : '';
|
|
6000
|
+
if (!/^-?[a-z][a-z-]*$/.test(p) || !v.trim() || v.length > 256) {
|
|
6001
|
+
return { ok: false, status: 400, error: 'invalid also' };
|
|
6002
|
+
}
|
|
6003
|
+
more.push({ camel: p.replace(/-([a-z])/g, (_m, c: string) => c.toUpperCase()), value: v });
|
|
6004
|
+
}
|
|
6005
|
+
}
|
|
6006
|
+
if (more.length > 0) {
|
|
6007
|
+
// ONE write for the whole move: one undo step, one `source-written` (a half-moved element has no row)
|
|
6008
|
+
return suppressedEdit(
|
|
6009
|
+
r.abs,
|
|
6010
|
+
async () => {
|
|
6011
|
+
const first = await editAttribute(
|
|
6012
|
+
r.abs,
|
|
6013
|
+
id,
|
|
6014
|
+
`style.${camel}`,
|
|
6015
|
+
JSON.stringify(value),
|
|
6016
|
+
idIndex,
|
|
6017
|
+
pre.expected === undefined ? undefined : { expected: pre.expected, next: value }
|
|
6018
|
+
);
|
|
6019
|
+
let delta = first.delta;
|
|
6020
|
+
let changed = first.changed !== false;
|
|
6021
|
+
for (const m of more) {
|
|
6022
|
+
const next = await editAttribute(
|
|
6023
|
+
r.abs,
|
|
6024
|
+
id,
|
|
6025
|
+
`style.${m.camel}`,
|
|
6026
|
+
JSON.stringify(m.value),
|
|
6027
|
+
idIndex
|
|
6028
|
+
);
|
|
6029
|
+
delta += next.delta;
|
|
6030
|
+
if (next.changed !== false) changed = true;
|
|
6031
|
+
}
|
|
6032
|
+
return { delta, changed, previous: first.previous };
|
|
6033
|
+
},
|
|
6034
|
+
'edit failed',
|
|
6035
|
+
undefined,
|
|
6036
|
+
said || undefined
|
|
6037
|
+
);
|
|
6038
|
+
}
|
|
4938
6039
|
// The value is always written as a JS STRING literal: JSON.stringify escapes
|
|
4939
6040
|
// quotes/backslashes/newlines so it can never break out of the string, and
|
|
4940
6041
|
// React accepts string values for every style prop — so `var(--accent)`,
|
|
@@ -4957,7 +6058,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4957
6058
|
attr: `style.${camel}`,
|
|
4958
6059
|
value: JSON.stringify(value),
|
|
4959
6060
|
...(idIndex !== undefined ? { occurrence: idIndex } : {}),
|
|
4960
|
-
}
|
|
6061
|
+
},
|
|
6062
|
+
said || undefined
|
|
4961
6063
|
);
|
|
4962
6064
|
}
|
|
4963
6065
|
|
|
@@ -4974,6 +6076,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
4974
6076
|
if (!CD_ID_RE.test(id)) return { ok: false, status: 400, error: 'invalid data-cd-id' };
|
|
4975
6077
|
if (typeof input.text !== 'string') return { ok: false, status: 400, error: 'text required' };
|
|
4976
6078
|
if (input.text.length > 5000) return { ok: false, status: 413, error: 'text too long' };
|
|
6079
|
+
const lockedText = await lockedTarget(r.abs, [id]);
|
|
6080
|
+
if (lockedText) return lockedText;
|
|
4977
6081
|
const text = input.text;
|
|
4978
6082
|
// Optional context for editing `{variable}` text (unified-text-editing
|
|
4979
6083
|
// follow-up): which rendered instance, and its pre-edit text — both used
|
|
@@ -5022,6 +6126,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
5022
6126
|
) {
|
|
5023
6127
|
return { ok: false, status: 400, error: 'invalid attribute' };
|
|
5024
6128
|
}
|
|
6129
|
+
const lockedAttr = await lockedTarget(r.abs, [id]);
|
|
6130
|
+
if (lockedAttr) return lockedAttr;
|
|
5025
6131
|
// Phase 12.3 — `reset: true` REMOVES the custom attribute. No-op if absent.
|
|
5026
6132
|
if (input.reset === true) {
|
|
5027
6133
|
return suppressedEdit(
|
|
@@ -5109,6 +6215,17 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
5109
6215
|
if (id === refId && (idIndex ?? 0) === (refIndex ?? 0)) {
|
|
5110
6216
|
return { ok: false, status: 422, error: 'cannot move an element relative to itself' };
|
|
5111
6217
|
}
|
|
6218
|
+
// p8-lock-reasons — the moved object, and the one it moves into (an inside-* ref changes its children)
|
|
6219
|
+
const lockedMove = await lockedTarget(
|
|
6220
|
+
r.abs,
|
|
6221
|
+
position === 'inside-start' || position === 'inside-end'
|
|
6222
|
+
? [
|
|
6223
|
+
{ id, occurrence: idIndex },
|
|
6224
|
+
{ id: refId, occurrence: refIndex },
|
|
6225
|
+
]
|
|
6226
|
+
: [{ id, occurrence: idIndex }]
|
|
6227
|
+
);
|
|
6228
|
+
if (lockedMove) return lockedMove;
|
|
5112
6229
|
const rel = path.relative(paths.designRoot, r.abs);
|
|
5113
6230
|
// Arm the "user did this — don't light the agent-editing rim" suppression
|
|
5114
6231
|
// BEFORE the write so it catches the debounced fs:any. It's disarmed below if
|
|
@@ -5349,172 +6466,6 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
5349
6466
|
}
|
|
5350
6467
|
}
|
|
5351
6468
|
|
|
5352
|
-
/**
|
|
5353
|
-
* feature-enhanced-video-editing (Phase 2) — the parametric clip verbs, one
|
|
5354
|
-
* dispatch op: speed · trim-in · audio · detach-audio · framing · grade ·
|
|
5355
|
-
* transition. Every verb is a pure clip-ops fn run under the file lock, with
|
|
5356
|
-
* the same stableId + contentHash optimistic-concurrency discipline, pre-op
|
|
5357
|
-
* snapshot, and whole-file undo seq as the structural clip ops.
|
|
5358
|
-
*/
|
|
5359
|
-
async function clipEditOp(input: {
|
|
5360
|
-
canvas?: unknown;
|
|
5361
|
-
artboardId?: unknown;
|
|
5362
|
-
stableId?: unknown;
|
|
5363
|
-
contentHash?: unknown;
|
|
5364
|
-
verb?: unknown;
|
|
5365
|
-
rate?: unknown;
|
|
5366
|
-
deltaFrames?: unknown;
|
|
5367
|
-
muted?: unknown;
|
|
5368
|
-
volume?: unknown;
|
|
5369
|
-
framing?: unknown;
|
|
5370
|
-
grade?: unknown;
|
|
5371
|
-
presentation?: unknown;
|
|
5372
|
-
durationInFrames?: unknown;
|
|
5373
|
-
atFrame?: unknown;
|
|
5374
|
-
src?: unknown;
|
|
5375
|
-
mediaKind?: unknown;
|
|
5376
|
-
text?: unknown;
|
|
5377
|
-
toIndex?: unknown;
|
|
5378
|
-
}): Promise<
|
|
5379
|
-
| { ok: true; seq?: number; extra?: Record<string, unknown> }
|
|
5380
|
-
| { ok: false; status: number; error: string }
|
|
5381
|
-
> {
|
|
5382
|
-
const r = resolveCanvasAbs(input.canvas);
|
|
5383
|
-
if (!r.ok) return r;
|
|
5384
|
-
const stableId = typeof input.stableId === 'string' ? input.stableId : null;
|
|
5385
|
-
if (!stableId) return { ok: false, status: 400, error: 'stableId required' };
|
|
5386
|
-
const artboardId = typeof input.artboardId === 'string' ? input.artboardId : undefined;
|
|
5387
|
-
const hash = typeof input.contentHash === 'string' ? input.contentHash : undefined;
|
|
5388
|
-
const verb = typeof input.verb === 'string' ? input.verb : '';
|
|
5389
|
-
const abs = r.abs;
|
|
5390
|
-
// Just `{ source: string }`: the `& Record<string, unknown>` was there for
|
|
5391
|
-
// the rest-spread below, but an INTERFACE return (SpeedResult and friends)
|
|
5392
|
-
// has no implicit index signature, so no verb's function was actually
|
|
5393
|
-
// assignable — every branch failed the check the same way.
|
|
5394
|
-
let run: ((source: string) => { source: string }) | null = null;
|
|
5395
|
-
switch (verb) {
|
|
5396
|
-
case 'speed': {
|
|
5397
|
-
const rate = Number(input.rate);
|
|
5398
|
-
run = (src) => applySetPlaybackRate(abs, src, artboardId, stableId, hash, rate);
|
|
5399
|
-
break;
|
|
5400
|
-
}
|
|
5401
|
-
case 'trim-in': {
|
|
5402
|
-
const delta = Number(input.deltaFrames);
|
|
5403
|
-
if (!Number.isFinite(delta))
|
|
5404
|
-
return { ok: false, status: 400, error: 'deltaFrames required' };
|
|
5405
|
-
run = (src) => applyTrimIn(abs, src, artboardId, stableId, hash, delta);
|
|
5406
|
-
break;
|
|
5407
|
-
}
|
|
5408
|
-
case 'audio': {
|
|
5409
|
-
const opts: { muted?: boolean; volume?: number | null } = {};
|
|
5410
|
-
if (typeof input.muted === 'boolean') opts.muted = input.muted;
|
|
5411
|
-
if (input.volume !== undefined)
|
|
5412
|
-
opts.volume = input.volume == null ? null : Number(input.volume);
|
|
5413
|
-
run = (src) => applyClipAudio(abs, src, artboardId, stableId, hash, opts);
|
|
5414
|
-
break;
|
|
5415
|
-
}
|
|
5416
|
-
case 'detach-audio': {
|
|
5417
|
-
run = (src) => applyDetachAudio(abs, src, artboardId, stableId, hash);
|
|
5418
|
-
break;
|
|
5419
|
-
}
|
|
5420
|
-
case 'framing': {
|
|
5421
|
-
const f = input.framing as { scale?: unknown; x?: unknown; y?: unknown } | null;
|
|
5422
|
-
const framing =
|
|
5423
|
-
f == null
|
|
5424
|
-
? null
|
|
5425
|
-
: { scale: Number(f.scale) || 1, x: Number(f.x) || 0, y: Number(f.y) || 0 };
|
|
5426
|
-
run = (src) => applyClipFraming(abs, src, artboardId, stableId, hash, framing);
|
|
5427
|
-
break;
|
|
5428
|
-
}
|
|
5429
|
-
case 'grade': {
|
|
5430
|
-
const grade = input.grade == null ? null : (input.grade as GradeParams);
|
|
5431
|
-
run = (src) => applyClipGrade(abs, src, artboardId, stableId, hash, grade);
|
|
5432
|
-
break;
|
|
5433
|
-
}
|
|
5434
|
-
case 'transition': {
|
|
5435
|
-
const opts: { presentation?: string; durationInFrames?: number } = {};
|
|
5436
|
-
if (typeof input.presentation === 'string') opts.presentation = input.presentation;
|
|
5437
|
-
if (input.durationInFrames != null) opts.durationInFrames = Number(input.durationInFrames);
|
|
5438
|
-
run = (src) => applyEditTransition(abs, src, artboardId, stableId, hash, opts);
|
|
5439
|
-
break;
|
|
5440
|
-
}
|
|
5441
|
-
case 'split': {
|
|
5442
|
-
const atFrame = Number(input.atFrame);
|
|
5443
|
-
if (!Number.isFinite(atFrame)) return { ok: false, status: 400, error: 'atFrame required' };
|
|
5444
|
-
run = (src) => applySplitClip(abs, src, artboardId, stableId, hash, atFrame);
|
|
5445
|
-
break;
|
|
5446
|
-
}
|
|
5447
|
-
case 'insert-transition': {
|
|
5448
|
-
const presentation = typeof input.presentation === 'string' ? input.presentation : 'fade';
|
|
5449
|
-
const frames = Number(input.durationInFrames) || 15;
|
|
5450
|
-
run = (src) =>
|
|
5451
|
-
applyInsertTransition(abs, src, artboardId, stableId, hash, presentation, frames);
|
|
5452
|
-
break;
|
|
5453
|
-
}
|
|
5454
|
-
case 'remove-transition': {
|
|
5455
|
-
run = (src) => applyRemoveTransition(abs, src, artboardId, stableId, hash);
|
|
5456
|
-
break;
|
|
5457
|
-
}
|
|
5458
|
-
case 'set-text': {
|
|
5459
|
-
const t = typeof input.text === 'string' ? input.text : '';
|
|
5460
|
-
run = (src) => applySetClipText(abs, src, artboardId, stableId, hash, t);
|
|
5461
|
-
break;
|
|
5462
|
-
}
|
|
5463
|
-
case 'to-overlay': {
|
|
5464
|
-
run = (src) => applyMoveClipToOverlay(abs, src, artboardId, stableId, hash);
|
|
5465
|
-
break;
|
|
5466
|
-
}
|
|
5467
|
-
case 'to-storyline': {
|
|
5468
|
-
run = (src) => applyMoveClipToStoryline(abs, src, artboardId, stableId, hash);
|
|
5469
|
-
break;
|
|
5470
|
-
}
|
|
5471
|
-
case 'layer-order': {
|
|
5472
|
-
const toIndex = Number(input.toIndex);
|
|
5473
|
-
if (!Number.isFinite(toIndex)) return { ok: false, status: 400, error: 'toIndex required' };
|
|
5474
|
-
run = (src) => applyReorderOverlayLayer(abs, src, artboardId, stableId, hash, toIndex);
|
|
5475
|
-
break;
|
|
5476
|
-
}
|
|
5477
|
-
case 'resolve-placeholder': {
|
|
5478
|
-
const src2 = typeof input.src === 'string' ? input.src : '';
|
|
5479
|
-
const mediaKind = input.mediaKind === 'image' ? 'image' : 'video';
|
|
5480
|
-
run = (src) =>
|
|
5481
|
-
applyResolvePlaceholder(abs, src, artboardId, stableId, hash, src2, mediaKind);
|
|
5482
|
-
break;
|
|
5483
|
-
}
|
|
5484
|
-
default:
|
|
5485
|
-
return { ok: false, status: 400, error: `unknown clip verb "${verb}"` };
|
|
5486
|
-
}
|
|
5487
|
-
const rel = path.relative(paths.designRoot, abs);
|
|
5488
|
-
ctx.bus.emit('activity:suppress', rel);
|
|
5489
|
-
try {
|
|
5490
|
-
const before = await Bun.file(abs).text();
|
|
5491
|
-
// The switch above either assigned `run` or returned; say so to the checker.
|
|
5492
|
-
if (!run) return { ok: false, status: 400, error: `unknown clip verb "${verb}"` };
|
|
5493
|
-
const result = await applyOnDisk(abs, run);
|
|
5494
|
-
const after = await Bun.file(abs).text();
|
|
5495
|
-
let seq: number | undefined;
|
|
5496
|
-
if (after === before) {
|
|
5497
|
-
ctx.bus.emit('activity:unsuppress', rel);
|
|
5498
|
-
} else {
|
|
5499
|
-
try {
|
|
5500
|
-
await history.writeSnapshot(rel, before, `pre-clip-${verb}`);
|
|
5501
|
-
} catch {
|
|
5502
|
-
/* snapshot best-effort */
|
|
5503
|
-
}
|
|
5504
|
-
seq = logUndo(abs, before, after);
|
|
5505
|
-
}
|
|
5506
|
-
const { source: _src, ...extra } = result;
|
|
5507
|
-
return { ok: true, seq, extra };
|
|
5508
|
-
} catch (err) {
|
|
5509
|
-
ctx.bus.emit('activity:unsuppress', rel);
|
|
5510
|
-
return {
|
|
5511
|
-
ok: false,
|
|
5512
|
-
status: err instanceof CanvasEditError ? 422 : 500,
|
|
5513
|
-
error: err instanceof Error ? err.message : `clip ${verb} failed`,
|
|
5514
|
-
};
|
|
5515
|
-
}
|
|
5516
|
-
}
|
|
5517
|
-
|
|
5518
6469
|
// Stage I (feature-element-editing-robustness) — general element structural
|
|
5519
6470
|
// edits (delete / insert / new-artboard) + free-hand artboard resize (D4). All
|
|
5520
6471
|
// MAIN-ORIGIN ONLY at the route layer; each logs a whole-file {before, after}
|
|
@@ -5528,7 +6479,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
5528
6479
|
id?: unknown;
|
|
5529
6480
|
idIndex?: unknown;
|
|
5530
6481
|
}): Promise<
|
|
5531
|
-
{ ok: true; deletedId: string; seq?: number }
|
|
6482
|
+
| { ok: true; deletedId: string; seq?: number }
|
|
6483
|
+
| { ok: false; status: number; error: string; code?: 'locked' }
|
|
5532
6484
|
> {
|
|
5533
6485
|
const r = resolveCanvasAbs(input.canvas);
|
|
5534
6486
|
if (!r.ok) return r;
|
|
@@ -5536,6 +6488,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
5536
6488
|
const id = typeof input.id === 'string' ? input.id.trim() : '';
|
|
5537
6489
|
if (!CD_ID_RE.test(id)) return { ok: false, status: 400, error: 'invalid data-cd-id' };
|
|
5538
6490
|
const idIndex = Number.isInteger(input.idIndex) ? (input.idIndex as number) : undefined;
|
|
6491
|
+
const lockedDel = await lockedTarget(r.abs, [{ id, occurrence: idIndex }]);
|
|
6492
|
+
if (lockedDel) return lockedDel;
|
|
5539
6493
|
const rel = path.relative(paths.designRoot, r.abs);
|
|
5540
6494
|
ctx.bus.emit('activity:suppress', rel);
|
|
5541
6495
|
try {
|
|
@@ -5545,7 +6499,9 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
5545
6499
|
id,
|
|
5546
6500
|
...(idIndex !== undefined ? { occurrence: idIndex } : {}),
|
|
5547
6501
|
});
|
|
5548
|
-
const res = await
|
|
6502
|
+
const res = await sayingWrites(before, 'Deleted an object', () =>
|
|
6503
|
+
deleteElement(r.abs, id, idIndex)
|
|
6504
|
+
);
|
|
5549
6505
|
const after = await Bun.file(r.abs).text();
|
|
5550
6506
|
if (after === before) {
|
|
5551
6507
|
ctx.bus.emit('activity:unsuppress', rel);
|
|
@@ -5556,7 +6512,9 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
5556
6512
|
} catch {
|
|
5557
6513
|
/* snapshot best-effort */
|
|
5558
6514
|
}
|
|
5559
|
-
|
|
6515
|
+
const seq = logUndo(r.abs, before, after);
|
|
6516
|
+
noteSourceWritten(rel, after, 'Deleted an object');
|
|
6517
|
+
return { ok: true, deletedId: res.deletedId, seq };
|
|
5560
6518
|
} catch (err) {
|
|
5561
6519
|
ctx.bus.emit('activity:unsuppress', rel);
|
|
5562
6520
|
return {
|
|
@@ -5578,7 +6536,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
5578
6536
|
src?: unknown;
|
|
5579
6537
|
refIndex?: unknown;
|
|
5580
6538
|
}): Promise<
|
|
5581
|
-
{ ok: true; newId: string | null; seq?: number }
|
|
6539
|
+
| { ok: true; newId: string | null; seq?: number }
|
|
6540
|
+
| { ok: false; status: number; error: string; code?: 'locked' }
|
|
5582
6541
|
> {
|
|
5583
6542
|
const r = resolveCanvasAbs(input.canvas);
|
|
5584
6543
|
if (!r.ok) return r;
|
|
@@ -5613,6 +6572,11 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
5613
6572
|
}
|
|
5614
6573
|
const src = typeof input.src === 'string' ? input.src : undefined;
|
|
5615
6574
|
const refIndex = Number.isInteger(input.refIndex) ? (input.refIndex as number) : undefined;
|
|
6575
|
+
// p8-lock-reasons — a new object INSIDE a locked one changes it; beside it does not
|
|
6576
|
+
if (hasRefId && (position === 'inside-start' || position === 'inside-end')) {
|
|
6577
|
+
const lockedIn = await lockedTarget(r.abs, [{ id: refId, occurrence: refIndex }]);
|
|
6578
|
+
if (lockedIn) return lockedIn;
|
|
6579
|
+
}
|
|
5616
6580
|
const rel = path.relative(paths.designRoot, r.abs);
|
|
5617
6581
|
ctx.bus.emit('activity:suppress', rel);
|
|
5618
6582
|
try {
|
|
@@ -5621,18 +6585,23 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
5621
6585
|
ctx.bus.emit('activity:unsuppress', rel);
|
|
5622
6586
|
return { ok: false, status: 413, error: 'canvas source too large to grow' };
|
|
5623
6587
|
}
|
|
5624
|
-
const res =
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
6588
|
+
const res = await sayingWrites(
|
|
6589
|
+
before,
|
|
6590
|
+
kind === 'text' ? 'Added text' : kind === 'image' ? 'Added a picture' : 'Added a box',
|
|
6591
|
+
() =>
|
|
6592
|
+
hasArtboardId
|
|
6593
|
+
? insertElementIntoArtboard(
|
|
6594
|
+
r.abs,
|
|
6595
|
+
artboardId,
|
|
6596
|
+
position as 'inside-start' | 'inside-end',
|
|
6597
|
+
kind as InsertKind,
|
|
6598
|
+
{ src }
|
|
6599
|
+
)
|
|
6600
|
+
: insertElement(r.abs, refId, position as MovePosition, kind as InsertKind, {
|
|
6601
|
+
src,
|
|
6602
|
+
occurrence: refIndex,
|
|
6603
|
+
})
|
|
6604
|
+
);
|
|
5636
6605
|
const after = await Bun.file(r.abs).text();
|
|
5637
6606
|
if (after === before) {
|
|
5638
6607
|
ctx.bus.emit('activity:unsuppress', rel);
|
|
@@ -5643,7 +6612,13 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
5643
6612
|
} catch {
|
|
5644
6613
|
/* snapshot best-effort */
|
|
5645
6614
|
}
|
|
5646
|
-
|
|
6615
|
+
const seq = logUndo(r.abs, before, after);
|
|
6616
|
+
noteSourceWritten(
|
|
6617
|
+
rel,
|
|
6618
|
+
after,
|
|
6619
|
+
kind === 'text' ? 'Added text' : kind === 'image' ? 'Added a picture' : 'Added a box'
|
|
6620
|
+
);
|
|
6621
|
+
return { ok: true, newId: res.newId, seq };
|
|
5647
6622
|
} catch (err) {
|
|
5648
6623
|
ctx.bus.emit('activity:unsuppress', rel);
|
|
5649
6624
|
return {
|
|
@@ -5672,7 +6647,9 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
5672
6647
|
children?: unknown;
|
|
5673
6648
|
containers?: unknown;
|
|
5674
6649
|
dissolve?: unknown;
|
|
5675
|
-
}): Promise<
|
|
6650
|
+
}): Promise<
|
|
6651
|
+
{ ok: true; seq?: number } | { ok: false; status: number; error: string; code?: 'locked' }
|
|
6652
|
+
> {
|
|
5676
6653
|
const r = resolveCanvasAbs(input.canvas);
|
|
5677
6654
|
if (!r.ok) return r;
|
|
5678
6655
|
if (!takeStructuralToken()) return RATE_LIMITED;
|
|
@@ -5796,6 +6773,23 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
5796
6773
|
dissolve.push(id);
|
|
5797
6774
|
}
|
|
5798
6775
|
}
|
|
6776
|
+
// p8-lock-reasons — every container, child and dissolved wrapper this write rewrites
|
|
6777
|
+
const lockedConv = await lockedTarget(r.abs, [
|
|
6778
|
+
...(containersSpec
|
|
6779
|
+
? containersSpec.flatMap((c) => [
|
|
6780
|
+
...(c.containerId ? [{ id: c.containerId, occurrence: c.containerIdIndex }] : []),
|
|
6781
|
+
...c.children.map((k) => ({ id: k.id, occurrence: k.idIndex })),
|
|
6782
|
+
])
|
|
6783
|
+
: [
|
|
6784
|
+
{ id: containerId, occurrence: containerIdIndex },
|
|
6785
|
+
...children.map((k) => ({ id: k.id, occurrence: k.idIndex })),
|
|
6786
|
+
]),
|
|
6787
|
+
...(dissolve ?? []),
|
|
6788
|
+
]);
|
|
6789
|
+
if (lockedConv) {
|
|
6790
|
+
ctx.bus.emit('activity:unsuppress', rel);
|
|
6791
|
+
return lockedConv;
|
|
6792
|
+
}
|
|
5799
6793
|
const res = await convertToAbsolute(
|
|
5800
6794
|
r.abs,
|
|
5801
6795
|
containersSpec
|
|
@@ -5839,7 +6833,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
5839
6833
|
id?: unknown;
|
|
5840
6834
|
idIndex?: unknown;
|
|
5841
6835
|
}): Promise<
|
|
5842
|
-
{ ok: true; detachedName: string; seq?: number }
|
|
6836
|
+
| { ok: true; detachedName: string; seq?: number }
|
|
6837
|
+
| { ok: false; status: number; error: string; code?: 'locked' }
|
|
5843
6838
|
> {
|
|
5844
6839
|
const r = resolveCanvasAbs(input.canvas);
|
|
5845
6840
|
if (!r.ok) return r;
|
|
@@ -5847,6 +6842,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
5847
6842
|
const id = typeof input.id === 'string' ? input.id.trim() : '';
|
|
5848
6843
|
if (!CD_ID_RE.test(id)) return { ok: false, status: 400, error: 'invalid data-cd-id' };
|
|
5849
6844
|
const idIndex = Number.isInteger(input.idIndex) ? (input.idIndex as number) : undefined;
|
|
6845
|
+
const lockedDetach = await lockedTarget(r.abs, [{ id, occurrence: idIndex ?? 0 }]);
|
|
6846
|
+
if (lockedDetach) return lockedDetach;
|
|
5850
6847
|
const rel = path.relative(paths.designRoot, r.abs);
|
|
5851
6848
|
ctx.bus.emit('activity:suppress', rel);
|
|
5852
6849
|
try {
|
|
@@ -6450,7 +7447,9 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
6450
7447
|
id,
|
|
6451
7448
|
...(idIndex !== undefined ? { occurrence: idIndex } : {}),
|
|
6452
7449
|
});
|
|
6453
|
-
const res = await
|
|
7450
|
+
const res = await sayingWrites(before, 'Duplicated an object', () =>
|
|
7451
|
+
duplicateElement(r.abs, id, idIndex)
|
|
7452
|
+
);
|
|
6454
7453
|
const after = await Bun.file(r.abs).text();
|
|
6455
7454
|
if (after === before) {
|
|
6456
7455
|
ctx.bus.emit('activity:unsuppress', rel);
|
|
@@ -6461,7 +7460,9 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
6461
7460
|
} catch {
|
|
6462
7461
|
/* snapshot best-effort */
|
|
6463
7462
|
}
|
|
6464
|
-
|
|
7463
|
+
const seq = logUndo(r.abs, before, after);
|
|
7464
|
+
noteSourceWritten(rel, after, 'Duplicated an object');
|
|
7465
|
+
return { ok: true, newId: res.newId, seq };
|
|
6465
7466
|
} catch (err) {
|
|
6466
7467
|
ctx.bus.emit('activity:unsuppress', rel);
|
|
6467
7468
|
return {
|
|
@@ -6771,6 +7772,17 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
6771
7772
|
error: 'reorder not found (server restarted or log rotated)',
|
|
6772
7773
|
};
|
|
6773
7774
|
}
|
|
7775
|
+
// p8-a1-save-hold — a revert to a canvas a running interpreter call names waits until the call is done
|
|
7776
|
+
// (+ settle); it then checks the canvas as it is (an AI write meanwhile makes it an honest 409)
|
|
7777
|
+
return saveHold().defer([r.abs], () => revertNow(r.abs, entry, dir));
|
|
7778
|
+
}
|
|
7779
|
+
|
|
7780
|
+
async function revertNow(
|
|
7781
|
+
abs: string,
|
|
7782
|
+
entry: { abs: string; before: string; after: string; undoActionId?: string },
|
|
7783
|
+
dir: 'undo' | 'redo'
|
|
7784
|
+
): Promise<ReorderRevertResult> {
|
|
7785
|
+
const r = { abs };
|
|
6774
7786
|
try {
|
|
6775
7787
|
const current = await Bun.file(r.abs).text();
|
|
6776
7788
|
const expect = dir === 'undo' ? entry.after : entry.before;
|
|
@@ -6851,6 +7863,14 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
6851
7863
|
// instead of unconditionally designSystems[0]. Populated from the canvas
|
|
6852
7864
|
// groups below; returned on the payload and folded into the client cfg.
|
|
6853
7865
|
const canvasDesignSystems: Record<string, string> = {};
|
|
7866
|
+
// S10.4 (V2-1.6 §5.8) — the revision a canvas was left on (`dsRev`), for the converted systems only:
|
|
7867
|
+
// an unconverted project builds none of this, and its payload is what it always was.
|
|
7868
|
+
const convertedDs = new Set(
|
|
7869
|
+
(cfg.designSystems ?? [])
|
|
7870
|
+
.filter((d) => readHead(path.join(paths.designRoot, d.path)).state === 'ok')
|
|
7871
|
+
.map((d) => d.name)
|
|
7872
|
+
);
|
|
7873
|
+
const canvasRevs: Record<string, { system: string; dsRev: string; kept?: string }> = {};
|
|
6854
7874
|
// DDR-174 (T15) — surface a canvas's `.meta.json` `kind` in the file tree
|
|
6855
7875
|
// when it's a value the user should notice at a glance (today: only
|
|
6856
7876
|
// `reconstructed-experimental`, so this map stays empty on every project
|
|
@@ -6954,14 +7974,28 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
6954
7974
|
for (const fp of filePaths) {
|
|
6955
7975
|
if (!fp.endsWith('.tsx')) continue;
|
|
6956
7976
|
let dsName = ownerDsName(fp);
|
|
7977
|
+
let meta: Record<string, unknown> | null = null;
|
|
6957
7978
|
if (!dsName) {
|
|
6958
|
-
|
|
7979
|
+
meta = await loadCanvasMeta(fp);
|
|
6959
7980
|
const declared = meta?.designSystem;
|
|
6960
7981
|
dsName = typeof declared === 'string' && declared.trim() ? declared : defaultDs;
|
|
6961
7982
|
const kind = meta?.kind;
|
|
6962
7983
|
if (typeof kind === 'string' && NOTABLE_KINDS.has(kind)) canvasKinds[fp] = kind;
|
|
6963
7984
|
}
|
|
6964
7985
|
canvasDesignSystems[fp] = dsName;
|
|
7986
|
+
if (convertedDs.has(dsName)) {
|
|
7987
|
+
// a canvas inside the system's own folder carries no sidecar read above
|
|
7988
|
+
meta ??= await loadCanvasMeta(fp);
|
|
7989
|
+
const dsRev = meta?.dsRev;
|
|
7990
|
+
// p8-dead-reasons — `dsKept`: the head a person declined with "Keep this version" (the card stays away)
|
|
7991
|
+
const kept = meta?.dsKept;
|
|
7992
|
+
if (typeof dsRev === 'string' && dsRev)
|
|
7993
|
+
canvasRevs[fp] = {
|
|
7994
|
+
system: dsName,
|
|
7995
|
+
dsRev,
|
|
7996
|
+
...(typeof kept === 'string' && kept ? { kept } : {}),
|
|
7997
|
+
};
|
|
7998
|
+
}
|
|
6965
7999
|
}
|
|
6966
8000
|
// Strip down to `g.path` so per-DS folders (`project`, `beta`, …) show
|
|
6967
8001
|
// up as the top-level dirs inside the DS section. Single-DS configs get
|
|
@@ -7033,14 +8067,55 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
7033
8067
|
});
|
|
7034
8068
|
}
|
|
7035
8069
|
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
8070
|
+
// S10.4 — which revision each canvas renders. Present only once a system is converted: a project that
|
|
8071
|
+
// has none gets the payload it always had.
|
|
8072
|
+
const dsRender =
|
|
8073
|
+
convertedDs.size > 0
|
|
8074
|
+
? dsRenderIndex(paths.designRoot, cfg.designSystems ?? [], canvasRevs)
|
|
8075
|
+
: null;
|
|
8076
|
+
|
|
8077
|
+
// gate-b-c4j — a canvas importing another canvas does not render in its frame (access/closure.ts
|
|
8078
|
+
// `walkImports`: the module is refused); the shell says why on it. The same for every reader;
|
|
8079
|
+
// filterIndexData below holds both sides to what this reader sees.
|
|
8080
|
+
const prefix = `${paths.designRel}/`;
|
|
8081
|
+
const canvasRels = Object.keys(canvasDesignSystems)
|
|
8082
|
+
.filter((fp) => fp.startsWith(prefix))
|
|
8083
|
+
.map((fp) => fp.slice(prefix.length))
|
|
8084
|
+
.sort();
|
|
8085
|
+
const imports = projectVisibility(ctx).canvasImports(canvasRels);
|
|
8086
|
+
const canvasImportsCanvases: Record<string, string[]> = {};
|
|
8087
|
+
for (const [rel, list] of imports) canvasImportsCanvases[`${prefix}${rel}`] = list;
|
|
8088
|
+
|
|
8089
|
+
// S9.10 (V2-1.16 L8) — a canvas-only session's tree: what it sees, nothing else.
|
|
8090
|
+
return filterIndexData(
|
|
8091
|
+
{
|
|
8092
|
+
project: cfg.name,
|
|
8093
|
+
projectLabel: ctx.projectLabel,
|
|
8094
|
+
designRoot: paths.designRel,
|
|
8095
|
+
groups,
|
|
8096
|
+
canvasDesignSystems,
|
|
8097
|
+
canvasKinds,
|
|
8098
|
+
...(imports.size ? { canvasImportsCanvases } : {}),
|
|
8099
|
+
...(dsRender
|
|
8100
|
+
? {
|
|
8101
|
+
canvasDsRevs: Object.fromEntries(
|
|
8102
|
+
Object.entries(canvasRevs).map(([fp, r]) => [fp, r.dsRev])
|
|
8103
|
+
),
|
|
8104
|
+
canvasDsKept: Object.fromEntries(
|
|
8105
|
+
Object.entries(canvasRevs)
|
|
8106
|
+
.filter(([, r]) => r.kept)
|
|
8107
|
+
.map(([fp, r]) => [fp, r.kept as string])
|
|
8108
|
+
),
|
|
8109
|
+
systemHeads: dsRender.systemHeads,
|
|
8110
|
+
dsConverted: dsRender.dsConverted,
|
|
8111
|
+
dsRevGaps: dsRender.dsRevGaps,
|
|
8112
|
+
}
|
|
8113
|
+
: {}),
|
|
8114
|
+
},
|
|
8115
|
+
projectVisibility(ctx).current(),
|
|
8116
|
+
paths.designRel,
|
|
8117
|
+
cfg.designSystems ?? []
|
|
8118
|
+
);
|
|
7044
8119
|
}
|
|
7045
8120
|
|
|
7046
8121
|
function tokenKind(name: string, value: string): string {
|
|
@@ -7111,7 +8186,9 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
7111
8186
|
path.join(sysAbs, 'README.md'),
|
|
7112
8187
|
];
|
|
7113
8188
|
try {
|
|
7114
|
-
const subs = await readdir(sysAbs, { withFileTypes: true })
|
|
8189
|
+
const subs = (await readdir(sysAbs, { withFileTypes: true })).sort((a, b) =>
|
|
8190
|
+
a.name < b.name ? -1 : a.name > b.name ? 1 : 0
|
|
8191
|
+
);
|
|
7115
8192
|
for (const s of subs)
|
|
7116
8193
|
if (s.isDirectory()) readmeCandidates.push(path.join(sysAbs, s.name, 'README.md'));
|
|
7117
8194
|
} catch {
|
|
@@ -7155,7 +8232,9 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
7155
8232
|
// the DS-relative `<folderName>` subdir — scanning sub-dirs here
|
|
7156
8233
|
// would treat the DS's own `preview/` as a sibling DS root.
|
|
7157
8234
|
if (!dsEntry) {
|
|
7158
|
-
const subs = await readdir(sysAbs, { withFileTypes: true })
|
|
8235
|
+
const subs = (await readdir(sysAbs, { withFileTypes: true })).sort((a, b) =>
|
|
8236
|
+
a.name < b.name ? -1 : a.name > b.name ? 1 : 0
|
|
8237
|
+
);
|
|
7159
8238
|
for (const s of subs) {
|
|
7160
8239
|
if (!s.isDirectory()) continue;
|
|
7161
8240
|
const candidate = path.join(sysAbs, s.name, folderName);
|
|
@@ -7205,44 +8284,55 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
7205
8284
|
description: d.description ?? null,
|
|
7206
8285
|
}));
|
|
7207
8286
|
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
8287
|
+
// S9.10 (V2-1.16 L8/L9) — a canvas-only session: only the DS its canvases render with
|
|
8288
|
+
// (an invisible `ds` is an unknown one — null, the caller's 404), no README.
|
|
8289
|
+
return filterSystemData(
|
|
8290
|
+
{
|
|
8291
|
+
project: cfg.name,
|
|
8292
|
+
designRoot: paths.designRel,
|
|
8293
|
+
systemDir: sysRel,
|
|
8294
|
+
ds: dsEntry
|
|
8295
|
+
? {
|
|
8296
|
+
name: dsEntry.name,
|
|
8297
|
+
path: dsEntry.path,
|
|
8298
|
+
description: dsEntry.description ?? null,
|
|
8299
|
+
rootClass: dsEntry.rootClass ?? null,
|
|
8300
|
+
themeDefault: dsEntry.themeDefault ?? null,
|
|
8301
|
+
}
|
|
8302
|
+
: null,
|
|
8303
|
+
availableDesignSystems,
|
|
8304
|
+
defaultDesignSystem: cfg.defaultDesignSystem ?? availableDesignSystems[0]?.name ?? null,
|
|
8305
|
+
readme,
|
|
8306
|
+
readmePath,
|
|
8307
|
+
tokens,
|
|
8308
|
+
tokenGroups,
|
|
8309
|
+
tokensPath,
|
|
8310
|
+
previewGallery,
|
|
8311
|
+
uiKitsGallery,
|
|
8312
|
+
rootClass: dsEntry?.rootClass ?? cfg.rootClass,
|
|
8313
|
+
themeDefault: dsEntry?.themeDefault ?? cfg.themeDefault,
|
|
8314
|
+
teamAccentDefault: cfg.teamAccentDefault,
|
|
8315
|
+
},
|
|
8316
|
+
projectVisibility(ctx).current(),
|
|
8317
|
+
paths.designRel,
|
|
8318
|
+
cfg.designSystems ?? [],
|
|
8319
|
+
tokensCssRel
|
|
8320
|
+
);
|
|
7234
8321
|
}
|
|
7235
8322
|
|
|
7236
8323
|
return {
|
|
7237
8324
|
fileSlug,
|
|
7238
8325
|
loadCommentsForFile,
|
|
7239
8326
|
saveCommentsForFile,
|
|
8327
|
+
rewriteComments,
|
|
7240
8328
|
loadAllComments,
|
|
7241
8329
|
fileForSlug,
|
|
7242
8330
|
commentsAdd,
|
|
7243
8331
|
commentsPatch,
|
|
7244
8332
|
commentsDelete,
|
|
7245
8333
|
commentsAddReply,
|
|
8334
|
+
commentOp,
|
|
8335
|
+
commentFileOf,
|
|
7246
8336
|
gitCommitters,
|
|
7247
8337
|
gitCurrentUser,
|
|
7248
8338
|
parseMentions,
|
|
@@ -7255,11 +8345,16 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
7255
8345
|
loadCanvasMeta,
|
|
7256
8346
|
loadCanvasSource,
|
|
7257
8347
|
patchCanvasMeta,
|
|
8348
|
+
writeCanvasMetaText,
|
|
7258
8349
|
loadAnnotations,
|
|
7259
8350
|
readBoard,
|
|
8351
|
+
readBoardLive,
|
|
7260
8352
|
saveAnnotations,
|
|
7261
8353
|
applyAnnotationOps,
|
|
7262
8354
|
projectAnnotations,
|
|
8355
|
+
convertLanes,
|
|
8356
|
+
moveArtboardsWithRider,
|
|
8357
|
+
restoreConversion,
|
|
7263
8358
|
saveAsset,
|
|
7264
8359
|
listAssets,
|
|
7265
8360
|
readAssetBytes,
|
|
@@ -7282,7 +8377,6 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
|
|
|
7282
8377
|
editCss,
|
|
7283
8378
|
editText,
|
|
7284
8379
|
editAttr,
|
|
7285
|
-
clipEditOp,
|
|
7286
8380
|
removeSequenceOp,
|
|
7287
8381
|
insertSequenceOp,
|
|
7288
8382
|
reorderSequenceOp,
|