@1agh/maude 2.0.8 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/apps/hub/src/project-transactions/kernel.mjs +13 -7
- package/apps/studio/access/closure.ts +86 -10
- package/apps/studio/access/filters.ts +18 -1
- package/apps/studio/access/request.ts +8 -0
- package/apps/studio/acp/design-write-verb.ts +12 -2
- package/apps/studio/acp/env.ts +7 -2
- package/apps/studio/acp/index.ts +15 -4
- package/apps/studio/acp/login-state.ts +22 -5
- package/apps/studio/acp/may-scope.ts +38 -1
- package/apps/studio/acp/plugin-bootstrap.ts +13 -1
- package/apps/studio/acp/probe.ts +11 -4
- package/apps/studio/actions/agents.ts +110 -28
- package/apps/studio/actions/canvas-keys.ts +4 -2
- package/apps/studio/actions/ctx.ts +3 -0
- package/apps/studio/actions/defs/annotation.ts +84 -2
- package/apps/studio/actions/defs/app.ts +28 -1
- package/apps/studio/actions/defs/edit.ts +13 -0
- package/apps/studio/actions/defs/export.ts +12 -0
- package/apps/studio/actions/defs/sync.ts +18 -0
- package/apps/studio/actions/defs/video.ts +9 -0
- package/apps/studio/actions/documents.ts +6 -1
- package/apps/studio/actions/keymap.gen.ts +147 -9
- package/apps/studio/actions/menu.ts +5 -1
- package/apps/studio/actions/types.ts +4 -2
- package/apps/studio/actions/verbs.ts +9 -0
- package/apps/studio/actions.manifest.json +300 -45
- package/apps/studio/actions.parity.json +19 -1
- package/apps/studio/ai/save-hold.ts +2 -1
- package/apps/studio/ai/write-claim-scope.ts +7 -1
- package/apps/studio/ai/write-claim.ts +154 -3
- package/apps/studio/annotations/ai-read.ts +42 -6
- package/apps/studio/annotations/ai-write.ts +145 -2
- package/apps/studio/annotations/board-ops.ts +34 -3
- package/apps/studio/annotations/checklist-ops.ts +374 -0
- package/apps/studio/annotations/elements/checkitem.model.ts +129 -0
- package/apps/studio/annotations/elements/sticky.model.ts +54 -2
- package/apps/studio/annotations/ops.ts +30 -0
- package/apps/studio/annotations/registry.ts +9 -1
- package/apps/studio/annotations/templates.ts +4 -2
- package/apps/studio/annotations/text-steps.ts +114 -10
- package/apps/studio/annotations/ui/checklist-wire.ts +129 -0
- package/apps/studio/annotations/ui/checklist.tsx +429 -0
- package/apps/studio/annotations/ui/element-node.tsx +48 -2
- package/apps/studio/annotations/ui/template-place.ts +11 -1
- package/apps/studio/annotations/v1-adapter.ts +22 -3
- package/apps/studio/annotations-context-toolbar.tsx +12 -0
- package/apps/studio/annotations-layer.tsx +442 -49
- package/apps/studio/annotations-model.ts +4 -2
- package/apps/studio/api.ts +148 -21
- package/apps/studio/artboard-live-gate.tsx +54 -17
- package/apps/studio/artboard-still-persist.ts +166 -0
- package/apps/studio/artboard-still-raster.ts +6 -2
- package/apps/studio/artboard-still.ts +390 -20
- package/apps/studio/asset-added.ts +154 -0
- package/apps/studio/asset-details.ts +46 -3
- package/apps/studio/asset-origins.ts +5 -3
- package/apps/studio/asset-trash.ts +6 -1
- package/apps/studio/bin/_agent-browser-safe.mjs +3 -4
- package/apps/studio/bin/_annotate-post.mjs +14 -5
- package/apps/studio/bin/_audio-search.mjs +8 -2
- package/apps/studio/bin/_curl-local.mjs +7 -4
- package/apps/studio/bin/_desktop-locate.sh +145 -0
- package/apps/studio/bin/_ds-check-live.mjs +2 -1
- package/apps/studio/bin/_exports.mjs +38 -2
- package/apps/studio/bin/_history.mjs +79 -8
- package/apps/studio/bin/_import-asset.mjs +14 -9
- package/apps/studio/bin/_import-figma.mjs +510 -98
- package/apps/studio/bin/_index-cli.mjs +10 -21
- package/apps/studio/bin/_ingest-footage.mjs +24 -6
- package/apps/studio/bin/_media-probe.mjs +232 -0
- package/apps/studio/bin/_perf-probe-open.mjs +6 -0
- package/apps/studio/bin/_perf-probe-safari.mjs +6 -0
- package/apps/studio/bin/_perf-probe-studio.mjs +6 -1
- package/apps/studio/bin/_perf-probe.mjs +8 -3
- package/apps/studio/bin/_perf-sweep-shared.mjs +789 -0
- package/apps/studio/bin/_perf-sweep.mjs +240 -0
- package/apps/studio/bin/_record-shot.sh +33 -8
- package/apps/studio/bin/_screenshot-playwright.mjs +45 -2
- package/apps/studio/bin/_studio-verb.mjs +8 -3
- package/apps/studio/bin/_thumb-route.mjs +21 -0
- package/apps/studio/bin/_thumbs-playwright.mjs +83 -1
- package/apps/studio/bin/_transcribe.mjs +22 -6
- package/apps/studio/bin/_unsynced-refs.mjs +22 -0
- package/apps/studio/bin/_url-guard.mjs +120 -5
- package/apps/studio/bin/_url-guard.sh +29 -7
- package/apps/studio/bin/_video-limits.mjs +104 -0
- package/apps/studio/bin/_video-playwright.mjs +119 -19
- package/apps/studio/bin/_video-proxy.mjs +130 -0
- package/apps/studio/bin/_write-claim.mjs +38 -16
- package/apps/studio/bin/annotate.mjs +12 -2
- package/apps/studio/bin/canvas-rects.sh +19 -4
- package/apps/studio/bin/chat-open.sh +7 -1
- package/apps/studio/bin/draw-proof.sh +6 -2
- package/apps/studio/bin/generate.sh +32 -10
- package/apps/studio/bin/handoff.sh +2 -2
- package/apps/studio/bin/perf.sh +96 -15
- package/apps/studio/bin/photo-adjust.sh +6 -3
- package/apps/studio/bin/photo-bg-remove.sh +2 -2
- package/apps/studio/bin/prep.sh +21 -4
- package/apps/studio/bin/read-annotations.mjs +3 -0
- package/apps/studio/bin/runtime-health.sh +27 -1
- package/apps/studio/bin/screenshot.sh +152 -12
- package/apps/studio/bin/server-up.sh +64 -6
- package/apps/studio/bin/smoke.sh +43 -8
- package/apps/studio/bin/to-lottie.sh +3 -2
- package/apps/studio/bin/video-proxy.sh +27 -0
- package/apps/studio/bin/visual-sanity.sh +3 -1
- package/apps/studio/bridge/dgn-protocol.ts +157 -1
- package/apps/studio/bridge/mode-shows.ts +8 -6
- package/apps/studio/bridge/still-webp.ts +233 -0
- package/apps/studio/build.ts +18 -0
- package/apps/studio/canvas-build.ts +93 -11
- package/apps/studio/canvas-comment-mount.tsx +53 -8
- package/apps/studio/canvas-edit.ts +34 -1
- package/apps/studio/canvas-lib-module.ts +210 -0
- package/apps/studio/canvas-lib.tsx +3 -12
- package/apps/studio/canvas-pipeline.ts +111 -5
- package/apps/studio/canvas-shell.tsx +8 -11
- package/apps/studio/canvas-theme-pill.tsx +5 -3
- package/apps/studio/check/index.ts +12 -5
- package/apps/studio/check/video.ts +18 -2
- package/apps/studio/client/app.jsx +65 -7
- package/apps/studio/client/clipboard-relay.ts +193 -16
- package/apps/studio/client/comments-overlay.css +18 -0
- package/apps/studio/client/export-center.jsx +30 -0
- package/apps/studio/client/generate-dialog.jsx +49 -4
- package/apps/studio/client/github.js +7 -0
- package/apps/studio/client/home/HomeAccountsRow.jsx +221 -0
- package/apps/studio/client/home/HomeConnection.jsx +111 -0
- package/apps/studio/client/home/home-accounts-model.js +110 -1
- package/apps/studio/client/home/home-api.js +9 -2
- package/apps/studio/client/home/home-app.jsx +126 -13
- package/apps/studio/client/home/home-model.js +69 -1
- package/apps/studio/client/home/home-where-model.js +105 -0
- package/apps/studio/client/home/home.css +239 -1
- package/apps/studio/client/hooks/use-canvas-bridge.jsx +173 -98
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +5 -1
- package/apps/studio/client/hooks/use-tabs.jsx +11 -4
- package/apps/studio/client/panels/DiffView.jsx +7 -1
- package/apps/studio/client/panels/TeamProjects.jsx +137 -134
- package/apps/studio/client/panels/chat-context.js +2 -0
- package/apps/studio/client/panels/slash-commands.gen.js +13 -13
- package/apps/studio/client/selection-scope.js +16 -9
- package/apps/studio/client/share-link.js +12 -0
- package/apps/studio/client/shell/viewport.jsx +11 -1
- package/apps/studio/client/shell-events.js +8 -0
- package/apps/studio/client/styles/3-kit-maude-v2.css +16 -0
- package/apps/studio/client/styles/_index.css +4 -0
- package/apps/studio/client/v2/ai/Feed.jsx +1 -1
- package/apps/studio/client/v2/ai/OfferCard.jsx +34 -0
- package/apps/studio/client/v2/ai/activity-line.js +54 -1
- package/apps/studio/client/v2/ai/ai-offer.js +21 -1
- package/apps/studio/client/v2/ai/run-model.js +3 -1
- package/apps/studio/client/v2/annotations/vote-store.js +28 -4
- package/apps/studio/client/v2/assets/asset-drop-session.js +37 -2
- package/apps/studio/client/v2/assets/canvas-drop-catcher.jsx +7 -5
- package/apps/studio/client/v2/assets/details-model.js +1 -1
- package/apps/studio/client/v2/assets/details.jsx +5 -0
- package/apps/studio/client/v2/assets/tile-drag.js +11 -7
- package/apps/studio/client/v2/comments/comments-panel.jsx +22 -3
- package/apps/studio/client/v2/create/duplicate-done.js +6 -2
- package/apps/studio/client/v2/diagnostics/diagnostics-host.jsx +1 -0
- package/apps/studio/client/v2/diagnostics/diagnostics-model.js +32 -2
- package/apps/studio/client/v2/diagnostics/diagnostics-sheet.jsx +35 -8
- package/apps/studio/client/v2/diagnostics/diagnostics.css +34 -0
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +113 -3
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +343 -6
- package/apps/studio/client/v2/diagnostics/sync-details/unsynced-refs.js +55 -0
- package/apps/studio/client/v2/ds/review.css +1 -1
- package/apps/studio/client/v2/export/exports-model.js +7 -0
- package/apps/studio/client/v2/export/exports-panel.jsx +1 -0
- package/apps/studio/client/v2/export/job-row.jsx +32 -2
- package/apps/studio/client/v2/handoff/ready-card.jsx +1 -1
- package/apps/studio/client/v2/history/compare-view.jsx +1 -0
- package/apps/studio/client/v2/inspector/css-write.js +6 -1
- package/apps/studio/client/v2/inspector/frame.jsx +28 -4
- package/apps/studio/client/v2/inspector/kinds/clip-model.js +51 -0
- package/apps/studio/client/v2/inspector/kinds/clip.jsx +75 -2
- package/apps/studio/client/v2/inspector/model.js +21 -0
- package/apps/studio/client/v2/inspector/sections/fill.jsx +12 -3
- package/apps/studio/client/v2/inspector/sections/recent-colours.js +8 -5
- package/apps/studio/client/v2/inspector/view-mode.jsx +11 -1
- package/apps/studio/client/v2/link-server/LinkServerDialog.jsx +492 -0
- package/apps/studio/client/v2/link-server/LinkServerHost.jsx +42 -0
- package/apps/studio/client/v2/link-server/link-server-api.js +142 -0
- package/apps/studio/client/v2/link-server/link-server-model.js +438 -0
- package/apps/studio/client/v2/link-server/link-server.css +109 -0
- package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +31 -86
- package/apps/studio/client/v2/onboarding/onboarding-model.js +1 -18
- package/apps/studio/client/v2/preview/link-follow.js +4 -2
- package/apps/studio/client/v2/preview/preview-chrome-host.jsx +16 -6
- package/apps/studio/client/v2/search/help-model.js +2 -0
- package/apps/studio/client/v2/search/search-keywords.js +3 -2
- package/apps/studio/client/v2/settings/account.jsx +4 -2
- package/apps/studio/client/v2/settings/advanced-section.jsx +344 -137
- package/apps/studio/client/v2/settings/connection-row.jsx +3 -59
- package/apps/studio/client/v2/settings/connections-section.jsx +118 -425
- package/apps/studio/client/v2/settings/general-section.jsx +155 -24
- package/apps/studio/client/v2/settings/project-sync-settings.jsx +4 -3
- package/apps/studio/client/v2/settings/reset-section.jsx +14 -3
- package/apps/studio/client/v2/settings/settings-card.jsx +142 -0
- package/apps/studio/client/v2/settings/settings-cards.js +220 -0
- package/apps/studio/client/v2/settings/settings-handlers.js +7 -6
- package/apps/studio/client/v2/settings/settings-model.js +100 -31
- package/apps/studio/client/v2/settings/settings-sheet.jsx +25 -6
- package/apps/studio/client/v2/settings/settings.css +374 -64
- package/apps/studio/client/v2/settings/this-project-card.jsx +730 -0
- package/apps/studio/client/v2/settings/this-project-model.js +172 -0
- package/apps/studio/client/v2/settings/use-connections.js +3 -2
- package/apps/studio/client/v2/settings/use-open-card.js +37 -0
- package/apps/studio/client/v2/share/share-sheet.jsx +28 -11
- package/apps/studio/client/v2/shell/api-session-boot.js +6 -0
- package/apps/studio/client/v2/shell/api-session.js +126 -0
- package/apps/studio/client/v2/shell/connection-state.js +197 -0
- package/apps/studio/client/v2/shell/floating-panels.css +31 -1
- package/apps/studio/client/v2/shell/image-pick.js +61 -8
- package/apps/studio/client/v2/shell/menu-aim.js +43 -0
- package/apps/studio/client/v2/shell/menu-runner.js +25 -7
- package/apps/studio/client/v2/shell/occlusion-insets.js +18 -1
- package/apps/studio/client/v2/shell/project-account-bus.js +36 -0
- package/apps/studio/client/v2/shell/project-account-card.jsx +357 -148
- package/apps/studio/client/v2/shell/project-account-model.js +272 -149
- package/apps/studio/client/v2/shell/project-account-toast.js +66 -0
- package/apps/studio/client/v2/shell/project-account.css +237 -0
- package/apps/studio/client/v2/shell/project-pill.jsx +52 -6
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +166 -83
- package/apps/studio/client/v2/shell/shell-parity.js +3 -2
- package/apps/studio/client/v2/shell/shell-parity.json +71 -36
- package/apps/studio/client/v2/shell/still-bridge.js +194 -0
- package/apps/studio/client/v2/shell/still-store.js +319 -0
- package/apps/studio/client/v2/shell/use-account.js +2 -0
- package/apps/studio/client/v2/shell/use-tool-panels.js +2 -1
- package/apps/studio/client/v2/signin/use-signin.js +1 -1
- package/apps/studio/client/v2/timeline/Timeline.jsx +15 -0
- package/apps/studio/client/v2/timeline/frame-handle-model.js +142 -0
- package/apps/studio/client/v2/timeline/frame-handle.jsx +151 -0
- package/apps/studio/clip-ops.ts +126 -8
- package/apps/studio/cloud/endpoints.ts +29 -4
- package/apps/studio/collab/ai-activity.ts +10 -8
- package/apps/studio/collab/awareness-bridge.ts +34 -9
- package/apps/studio/collab/index.ts +3 -0
- package/apps/studio/collab/registry.ts +41 -10
- package/apps/studio/comment-reattach.ts +149 -0
- package/apps/studio/comments/mine-stamp.ts +15 -7
- package/apps/studio/comments/ops.ts +52 -8
- package/apps/studio/comments-overlay.tsx +146 -9
- package/apps/studio/dist/client.bundle.js +892 -885
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/dom-selection.ts +87 -18
- package/apps/studio/ds/board/directions.css +8 -0
- package/apps/studio/ds/board/outline.tsx +16 -0
- package/apps/studio/ds/canvas-check.ts +6 -0
- package/apps/studio/edit-ops/clip/reframe.ts +19 -3
- package/apps/studio/edit-ops/clip-carry.ts +602 -0
- package/apps/studio/edit-ops/clipboard.ts +318 -23
- package/apps/studio/edit-ops/dispatch.ts +20 -2
- package/apps/studio/edit-ops/scope-names.ts +249 -40
- package/apps/studio/edit-ops/slot-defaults.ts +3 -0
- package/apps/studio/edit-ops/types.ts +6 -0
- package/apps/studio/editing/align-bar.tsx +33 -9
- package/apps/studio/editing/artboard-actions.ts +5 -0
- package/apps/studio/editing/artboard-menu.tsx +6 -2
- package/apps/studio/editing/click-to-type.ts +1 -1
- package/apps/studio/editing/clip-words.ts +48 -0
- package/apps/studio/editing/clipboard.ts +21 -6
- package/apps/studio/editing/declared-background.ts +25 -0
- package/apps/studio/editing/index.tsx +3 -0
- package/apps/studio/editing/object-keys.ts +4 -4
- package/apps/studio/editing/object-menu.tsx +13 -3
- package/apps/studio/editing/pen/points.tsx +61 -0
- package/apps/studio/editing/text-in-place.tsx +11 -0
- package/apps/studio/editing/video-frame-handle.tsx +425 -0
- package/apps/studio/exporters/capture-prepass.ts +374 -0
- package/apps/studio/exporters/degraded.ts +148 -0
- package/apps/studio/exporters/hub-render-door.ts +28 -2
- package/apps/studio/exporters/index.ts +3 -1
- package/apps/studio/exporters/job-budget.ts +93 -0
- package/apps/studio/exporters/jobs.ts +215 -28
- package/apps/studio/exporters/parity-check.ts +254 -0
- package/apps/studio/exporters/remote.ts +209 -15
- package/apps/studio/exporters/svg-inline.ts +87 -0
- package/apps/studio/exporters/video-render-lib.ts +88 -26
- package/apps/studio/exporters/video.ts +29 -6
- package/apps/studio/figma/assets.ts +58 -43
- package/apps/studio/figma/codegen-fonts.ts +100 -0
- package/apps/studio/figma/fig-decode.ts +390 -25
- package/apps/studio/figma/fig-kiwi.ts +18 -4
- package/apps/studio/figma/fig-vector.ts +59 -3
- package/apps/studio/figma/sanitize.ts +2 -0
- package/apps/studio/figma/style-map.ts +293 -48
- package/apps/studio/figma/to-artboard.ts +455 -69
- package/apps/studio/figma/to-strokes.ts +44 -11
- package/apps/studio/figma/types.ts +13 -0
- package/apps/studio/footage/schema.ts +3 -3
- package/apps/studio/generation/adapters/elevenlabs.ts +7 -1
- package/apps/studio/generation/adapters/groq.ts +8 -1
- package/apps/studio/generation/spend.ts +312 -0
- package/apps/studio/generation/types.ts +12 -0
- package/apps/studio/handoff/run.ts +1 -1
- package/apps/studio/handoff/targets.ts +2 -2
- package/apps/studio/handoff/write-scopes.ts +1 -1
- package/apps/studio/history/describe-annotations.ts +4 -0
- package/apps/studio/home/accounts.ts +30 -11
- package/apps/studio/home/cloud.ts +6 -1
- package/apps/studio/home/create-local.ts +32 -3
- package/apps/studio/home/hub-health.ts +76 -0
- package/apps/studio/home/routes.ts +15 -4
- package/apps/studio/http.ts +438 -86
- package/apps/studio/imported-module-ids.ts +91 -0
- package/apps/studio/inspect.ts +2 -0
- package/apps/studio/migrate/hub.ts +8 -1
- package/apps/studio/notifications.tsx +47 -5
- package/apps/studio/paths.ts +10 -1
- package/apps/studio/port.ts +3 -2
- package/apps/studio/preview/preview-camera.tsx +15 -382
- package/apps/studio/readiness.ts +10 -1
- package/apps/studio/release-build.ts +51 -0
- package/apps/studio/routes/agent.ts +188 -9
- package/apps/studio/routes/ai.ts +43 -11
- package/apps/studio/routes/annotations.ts +27 -1
- package/apps/studio/routes/assets.ts +18 -1
- package/apps/studio/routes/canvas-origin.ts +12 -9
- package/apps/studio/routes/cloud-move.ts +15 -0
- package/apps/studio/routes/edit.ts +3 -0
- package/apps/studio/routes/export.ts +51 -0
- package/apps/studio/routes/generate.ts +42 -12
- package/apps/studio/routes/hub-link-folder.ts +334 -0
- package/apps/studio/routes/hub-signin.ts +78 -1
- package/apps/studio/routes/index.ts +9 -1
- package/apps/studio/routes/shell.ts +217 -5
- package/apps/studio/routes/sync.ts +136 -8
- package/apps/studio/routes/votes.ts +2 -1
- package/apps/studio/schema/annotations.v2.schema.json +143 -1
- package/apps/studio/schema/beats.v1.schema.json +1 -1
- package/apps/studio/schema/edl.v1.schema.json +1 -1
- package/apps/studio/schema/formats.ts +3 -3
- package/apps/studio/schema/transcript.v1.schema.json +1 -1
- package/apps/studio/server.ts +142 -43
- package/apps/studio/shell/api-key.ts +503 -0
- package/apps/studio/shell/attest.ts +59 -0
- package/apps/studio/shell/capture-url.ts +20 -0
- package/apps/studio/shell/cli-yield.ts +276 -0
- package/apps/studio/shell/clip-transfer.ts +302 -0
- package/apps/studio/shell/key-file.ts +108 -0
- package/apps/studio/shell/server-json.ts +75 -0
- package/apps/studio/shell/worktree.ts +19 -0
- package/apps/studio/spoof-chars.ts +9 -0
- package/apps/studio/studio-page-host.ts +1 -1
- package/apps/studio/sync/accepted-cold-start.ts +144 -8
- package/apps/studio/sync/accepted-link.ts +76 -29
- package/apps/studio/sync/action-stage.ts +575 -44
- package/apps/studio/sync/adopt-held.ts +85 -0
- package/apps/studio/sync/ctl-heal.ts +58 -0
- package/apps/studio/sync/file-ledger.ts +38 -4
- package/apps/studio/sync/file-membership.ts +16 -1
- package/apps/studio/sync/file-plane.ts +289 -22
- package/apps/studio/sync/held-deletes.ts +86 -5
- package/apps/studio/sync/hub-link.ts +8 -0
- package/apps/studio/sync/index.ts +196 -12
- package/apps/studio/sync/journal-client.ts +50 -4
- package/apps/studio/sync/link-consent.ts +22 -75
- package/apps/studio/sync/link-survey.ts +252 -0
- package/apps/studio/sync/local-kernel.ts +296 -8
- package/apps/studio/sync/projection.ts +22 -3
- package/apps/studio/sync/seed-progress.ts +12 -0
- package/apps/studio/sync/source-recovery.ts +59 -3
- package/apps/studio/sync/status.ts +19 -2
- package/apps/studio/sync/unsynced-refs.ts +397 -0
- package/apps/studio/sync/writer-registry.ts +20 -0
- package/apps/studio/thumbs/service.ts +4 -1
- package/apps/studio/tool-palette.tsx +23 -0
- package/apps/studio/ui-prefs.ts +40 -0
- package/apps/studio/use-agent-presence.tsx +2 -2
- package/apps/studio/use-canvas-keys.ts +6 -1
- package/apps/studio/video/format-ids.ts +2 -2
- package/apps/studio/video/inject.ts +31 -0
- package/apps/studio/video/media-risk.ts +58 -0
- package/apps/studio/video/object-fit.ts +137 -0
- package/apps/studio/video/provider-transcript.ts +141 -0
- package/apps/studio/whats-new.json +137 -0
- package/apps/studio/workspace-mode.ts +1 -0
- package/apps/studio/ws.ts +5 -0
- package/cli/commands/design.mjs +119 -8
- package/cli/lib/bash-guard.mjs +366 -6
- package/cli/lib/confine-read.mjs +1 -0
- package/cli/lib/design-help.gen.mjs +3 -2
- package/cli/lib/design-hook.mjs +387 -81
- package/cli/lib/design-link.mjs +16 -1
- package/cli/lib/design-open.mjs +49 -3
- package/cli/lib/desktop-locate.mjs +770 -0
- package/cli/lib/handoff.mjs +1 -1
- package/cli/lib/hook-state.mjs +291 -0
- package/cli/lib/pkg-root.mjs +65 -13
- package/cli/lib/studio-locate.mjs +59 -16
- package/package.json +15 -8
- package/plugins/design/templates/_shell.html +13 -0
- package/apps/studio/client/v2/onboarding/HubSheet.jsx +0 -212
- package/apps/studio/client/v2/shell/account-card-model.js +0 -114
- package/apps/studio/client/v2/shell/account-card.jsx +0 -189
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
// client/v2/link-server/LinkServerDialog.jsx — 2.1.1 T5: the one "Link your server" dialog (canvas 17,
|
|
2
|
+
// artboards 12–13). It replaced Settings' "Add a team server" (TeamProjects serverOnly) and Home's "Sign in
|
|
3
|
+
// to your own hub" (onboarding/HubSheet.jsx); the same view serves a project tab and Home — what its
|
|
4
|
+
// buttons DO is the injected `api` (link-server-api.js for a project tab, AdvancedSheets.jsx's for Home).
|
|
5
|
+
//
|
|
6
|
+
// <LinkServerDialog api={…} project="Logo ideas" initialUrl="" onClose />
|
|
7
|
+
//
|
|
8
|
+
// The address is checked as it is typed (debounced; the app's own server makes one tokenless GET of the
|
|
9
|
+
// server's /health). "Sign in in your browser" wakes only once the server answered. The invite link and
|
|
10
|
+
// the sign-in key are secrets: masked fields, read once by `runLink`, never echoed into a line.
|
|
11
|
+
//
|
|
12
|
+
// B5 — in a project tab whose folder is the person's own (`api.where`), the sign-in links THIS folder to the
|
|
13
|
+
// server. A server that already holds work answers with counts first: the confirm step says what syncing
|
|
14
|
+
// would do (only here / only there / different) and nothing is linked until "Sync this folder".
|
|
15
|
+
|
|
16
|
+
import { useEffect, useId, useReducer, useRef } from 'react';
|
|
17
|
+
|
|
18
|
+
import { AdvModal, Sw } from '../onboarding/AdvSheet.jsx';
|
|
19
|
+
import {
|
|
20
|
+
addressOf,
|
|
21
|
+
advancedParts,
|
|
22
|
+
canSubmit,
|
|
23
|
+
checkLine,
|
|
24
|
+
confirmLines,
|
|
25
|
+
firstLead,
|
|
26
|
+
stayLine,
|
|
27
|
+
initialLink,
|
|
28
|
+
LINK_WORDS as W,
|
|
29
|
+
linkReducer,
|
|
30
|
+
primaryLabel,
|
|
31
|
+
runConfirm,
|
|
32
|
+
runLink,
|
|
33
|
+
whyNotSubmit,
|
|
34
|
+
} from './link-server-model.js';
|
|
35
|
+
import { reasonProps } from '../access/disabled-reason.js';
|
|
36
|
+
|
|
37
|
+
/** How long the address rests before it is checked. */
|
|
38
|
+
export const CHECK_DEBOUNCE_MS = 400;
|
|
39
|
+
|
|
40
|
+
const SW_OF_TONE = { busy: 'busy', ok: 'ok', bad: 'bad' };
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @param {{ api: object, project?: string|null, initialUrl?: string, onClose: () => void,
|
|
44
|
+
* debounceMs?: number, pollMs?: number }} props
|
|
45
|
+
*/
|
|
46
|
+
export function LinkServerDialog({
|
|
47
|
+
api,
|
|
48
|
+
project = null,
|
|
49
|
+
initialUrl = '',
|
|
50
|
+
onClose,
|
|
51
|
+
debounceMs = CHECK_DEBOUNCE_MS,
|
|
52
|
+
pollMs,
|
|
53
|
+
}) {
|
|
54
|
+
const [s, dispatch] = useReducer(linkReducer, initialUrl, initialLink);
|
|
55
|
+
const titleId = useId();
|
|
56
|
+
const alive = useRef(true);
|
|
57
|
+
const attempt = useRef(null); // { id, cancelled }
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
alive.current = true;
|
|
60
|
+
return () => {
|
|
61
|
+
alive.current = false;
|
|
62
|
+
const a = attempt.current;
|
|
63
|
+
attempt.current = null;
|
|
64
|
+
if (a?.id && !a.cancelled) {
|
|
65
|
+
a.cancelled = true;
|
|
66
|
+
void api.signInCancel?.(a.id);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}, [api]);
|
|
70
|
+
|
|
71
|
+
// B5 — where this project lives: its own folder (linking means THIS folder), or not (the old behaviour).
|
|
72
|
+
// Only with a project: Settings' "Add a team server…" (no project) keeps opening the server's project.
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (!project || typeof api.where !== 'function') return;
|
|
75
|
+
let live = true;
|
|
76
|
+
api
|
|
77
|
+
.where()
|
|
78
|
+
.then((w) => {
|
|
79
|
+
if (live && alive.current) dispatch({ type: 'here', folder: w?.folder ?? null });
|
|
80
|
+
})
|
|
81
|
+
.catch(() => {});
|
|
82
|
+
return () => {
|
|
83
|
+
live = false;
|
|
84
|
+
};
|
|
85
|
+
}, [api, project]);
|
|
86
|
+
|
|
87
|
+
// the check, as you type: one request per resting address; an older answer is dropped by `seq`
|
|
88
|
+
const { phase: checkPhase, seq } = s.check;
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (checkPhase !== 'checking') return undefined;
|
|
91
|
+
const url = addressOf(s.url);
|
|
92
|
+
const t = setTimeout(async () => {
|
|
93
|
+
let answer;
|
|
94
|
+
try {
|
|
95
|
+
answer = await api.check(url);
|
|
96
|
+
} catch {
|
|
97
|
+
answer = { ok: false, reason: 'unreachable' };
|
|
98
|
+
}
|
|
99
|
+
if (alive.current) dispatch({ type: 'check-done', seq, answer });
|
|
100
|
+
}, debounceMs);
|
|
101
|
+
return () => clearTimeout(t);
|
|
102
|
+
}, [checkPhase, seq, s.url, api, debounceMs]);
|
|
103
|
+
|
|
104
|
+
const submit = async () => {
|
|
105
|
+
if (!canSubmit(s)) return;
|
|
106
|
+
dispatch({ type: 'submit' });
|
|
107
|
+
const mine = { id: null, cancelled: false };
|
|
108
|
+
attempt.current = mine;
|
|
109
|
+
let r;
|
|
110
|
+
try {
|
|
111
|
+
r = await runLink(s, api, {
|
|
112
|
+
pollMs,
|
|
113
|
+
onWaiting: (w) => {
|
|
114
|
+
mine.id = w.id;
|
|
115
|
+
if (alive.current) dispatch({ type: 'waiting', ...w });
|
|
116
|
+
},
|
|
117
|
+
isCancelled: () => mine.cancelled,
|
|
118
|
+
});
|
|
119
|
+
} catch {
|
|
120
|
+
r = { ok: false, error: W.failed };
|
|
121
|
+
}
|
|
122
|
+
if (attempt.current === mine) attempt.current = null;
|
|
123
|
+
if (!alive.current || r.cancelled) return;
|
|
124
|
+
if (r.ok) {
|
|
125
|
+
dispatch({ type: 'done' });
|
|
126
|
+
onClose();
|
|
127
|
+
} else if (r.needsConfirm) dispatch({ type: 'needs-confirm', confirm: r.needsConfirm });
|
|
128
|
+
else dispatch({ type: 'failed', error: r.error });
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const confirmSync = async () => {
|
|
132
|
+
if (s.phase !== 'confirm') return;
|
|
133
|
+
dispatch({ type: 'confirming' });
|
|
134
|
+
let r;
|
|
135
|
+
try {
|
|
136
|
+
r = await runConfirm(s, api);
|
|
137
|
+
} catch {
|
|
138
|
+
r = { ok: false, error: W.failed };
|
|
139
|
+
}
|
|
140
|
+
if (!alive.current) return;
|
|
141
|
+
if (r.ok) {
|
|
142
|
+
dispatch({ type: 'done' });
|
|
143
|
+
onClose();
|
|
144
|
+
} else dispatch({ type: 'failed', error: r.error });
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const abortWait = () => {
|
|
148
|
+
const a = attempt.current;
|
|
149
|
+
attempt.current = null;
|
|
150
|
+
if (a) {
|
|
151
|
+
a.cancelled = true;
|
|
152
|
+
if (a.id) void api.signInCancel?.(a.id);
|
|
153
|
+
}
|
|
154
|
+
dispatch({ type: 'cancelled' });
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const parts = advancedParts(api, s);
|
|
158
|
+
const line = checkLine(s);
|
|
159
|
+
const waiting = s.phase === 'waiting' && s.wait;
|
|
160
|
+
const confirming = (s.phase === 'confirm' || s.phase === 'linking') && s.confirm;
|
|
161
|
+
const busy = s.phase !== 'form';
|
|
162
|
+
// "Sync <project> …" where the dialog links a folder: THIS project's own (B5) or a chosen one (Home);
|
|
163
|
+
// elsewhere a sign-in opens the server's project in its own tab, and the words say so
|
|
164
|
+
const syncsThis = !!project && (api.folders === true || s.folder.mode === 'this');
|
|
165
|
+
const lead = syncsThis ? (
|
|
166
|
+
<p>
|
|
167
|
+
Sync <strong>{project}</strong> with a Maude server your team runs.
|
|
168
|
+
</p>
|
|
169
|
+
) : (
|
|
170
|
+
<p>{W.leadOwnTab}</p>
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
return (
|
|
174
|
+
<AdvModal
|
|
175
|
+
onCancel={waiting ? abortWait : s.phase === 'confirm' ? onClose : busy ? () => {} : onClose}
|
|
176
|
+
>
|
|
177
|
+
<div
|
|
178
|
+
className="ob-dialog"
|
|
179
|
+
role="dialog"
|
|
180
|
+
aria-modal="true"
|
|
181
|
+
aria-labelledby={titleId}
|
|
182
|
+
style={{ maxWidth: '100%' }}
|
|
183
|
+
>
|
|
184
|
+
<form
|
|
185
|
+
className="ai-conn-sheet ob-sheet ls-sheet"
|
|
186
|
+
data-testid="link-server-dialog"
|
|
187
|
+
data-phase={s.phase}
|
|
188
|
+
data-check={s.check.phase}
|
|
189
|
+
onSubmit={(e) => {
|
|
190
|
+
e.preventDefault();
|
|
191
|
+
if (confirming) void confirmSync();
|
|
192
|
+
else void submit();
|
|
193
|
+
}}
|
|
194
|
+
>
|
|
195
|
+
{confirming ? (
|
|
196
|
+
<>
|
|
197
|
+
<h2 className="ai-conn-t" id={titleId}>
|
|
198
|
+
{s.confirm.empty ? W.firstTitle(s.confirm.host) : W.confirmTitle(s.confirm.host)}
|
|
199
|
+
</h2>
|
|
200
|
+
<div
|
|
201
|
+
className="ai-conn-b ob-sheet-b"
|
|
202
|
+
data-testid="link-server-confirm"
|
|
203
|
+
data-empty={s.confirm.empty ? 'true' : undefined}
|
|
204
|
+
>
|
|
205
|
+
{s.confirm.empty ? (
|
|
206
|
+
// 2.1.1 T8 — the first link to a server that holds nothing: what goes up, and where
|
|
207
|
+
<>
|
|
208
|
+
<p data-testid="link-server-first-lead">
|
|
209
|
+
{firstLead(s.confirm.counts, s.confirm.host)}
|
|
210
|
+
</p>
|
|
211
|
+
{stayLine(s.confirm.counts, s.confirm.host) ? (
|
|
212
|
+
<p data-testid="link-server-count-stay">
|
|
213
|
+
{stayLine(s.confirm.counts, s.confirm.host).text}
|
|
214
|
+
</p>
|
|
215
|
+
) : null}
|
|
216
|
+
</>
|
|
217
|
+
) : (
|
|
218
|
+
<>
|
|
219
|
+
<p>{W.confirmLead(s.confirm.host)}</p>
|
|
220
|
+
<ul className="ls-counts">
|
|
221
|
+
{confirmLines(s.confirm.counts, s.confirm.host).map((l) => (
|
|
222
|
+
<li key={l.id} data-testid={`link-server-count-${l.id}`}>
|
|
223
|
+
{l.text}
|
|
224
|
+
</li>
|
|
225
|
+
))}
|
|
226
|
+
</ul>
|
|
227
|
+
</>
|
|
228
|
+
)}
|
|
229
|
+
<p className="ob-fine">{W.confirmFine}</p>
|
|
230
|
+
</div>
|
|
231
|
+
<div className="ai-conn-a">
|
|
232
|
+
<button
|
|
233
|
+
type="button"
|
|
234
|
+
className="btn btn--sm"
|
|
235
|
+
data-testid="link-server-confirm-cancel"
|
|
236
|
+
disabled={s.phase === 'linking'}
|
|
237
|
+
{...reasonProps(s.phase === 'linking', W.linking)}
|
|
238
|
+
onClick={onClose}
|
|
239
|
+
>
|
|
240
|
+
{W.cancel}
|
|
241
|
+
</button>
|
|
242
|
+
<button
|
|
243
|
+
type="submit"
|
|
244
|
+
className="btn btn--sm btn--primary"
|
|
245
|
+
data-testid="link-server-confirm-sync"
|
|
246
|
+
disabled={s.phase === 'linking'}
|
|
247
|
+
{...reasonProps(s.phase === 'linking', W.linking)}
|
|
248
|
+
>
|
|
249
|
+
{s.phase === 'linking' ? W.linking : W.confirmButton}
|
|
250
|
+
</button>
|
|
251
|
+
</div>
|
|
252
|
+
</>
|
|
253
|
+
) : waiting ? (
|
|
254
|
+
<>
|
|
255
|
+
<h2 className="ai-conn-t" id={titleId}>
|
|
256
|
+
{W.waitTitle}
|
|
257
|
+
</h2>
|
|
258
|
+
<div className="ai-conn-b ob-sheet-b">
|
|
259
|
+
<p className="ls-wait" role="status" data-testid="link-server-waiting">
|
|
260
|
+
<Sw state="busy">{W.waitBody(s.wait.host)}</Sw>
|
|
261
|
+
</p>
|
|
262
|
+
<p className="ob-fine">{syncsThis ? W.waitThis(project) : W.waitOwnTab}</p>
|
|
263
|
+
</div>
|
|
264
|
+
<div className="ai-conn-a">
|
|
265
|
+
<button
|
|
266
|
+
type="button"
|
|
267
|
+
className="btn btn--sm"
|
|
268
|
+
data-testid="link-server-cancel"
|
|
269
|
+
onClick={abortWait}
|
|
270
|
+
>
|
|
271
|
+
{W.cancel}
|
|
272
|
+
</button>
|
|
273
|
+
<button
|
|
274
|
+
type="button"
|
|
275
|
+
className="btn btn--sm"
|
|
276
|
+
data-testid="link-server-reopen"
|
|
277
|
+
onClick={() => void api.openSignIn(s.wait.signInUrl)}
|
|
278
|
+
>
|
|
279
|
+
{W.reopen}
|
|
280
|
+
</button>
|
|
281
|
+
</div>
|
|
282
|
+
</>
|
|
283
|
+
) : (
|
|
284
|
+
<>
|
|
285
|
+
<h2 className="ai-conn-t" id={titleId}>
|
|
286
|
+
{W.title}
|
|
287
|
+
</h2>
|
|
288
|
+
<div className="ai-conn-b ob-sheet-b">
|
|
289
|
+
{lead}
|
|
290
|
+
<span className="ob-field">
|
|
291
|
+
<label className="ob-field-label" htmlFor="link-server-url">
|
|
292
|
+
{W.addressLabel}
|
|
293
|
+
</label>
|
|
294
|
+
<input
|
|
295
|
+
id="link-server-url"
|
|
296
|
+
className="ob-input"
|
|
297
|
+
data-testid="link-server-url"
|
|
298
|
+
data-bad={line.tone === 'bad' ? 'true' : undefined}
|
|
299
|
+
type="text"
|
|
300
|
+
inputMode="url"
|
|
301
|
+
autoComplete="off"
|
|
302
|
+
spellCheck={false}
|
|
303
|
+
placeholder={W.placeholder}
|
|
304
|
+
// biome-ignore lint/a11y/noAutofocus: the dialog opens for this one field
|
|
305
|
+
autoFocus
|
|
306
|
+
disabled={busy}
|
|
307
|
+
aria-describedby="link-server-check"
|
|
308
|
+
value={s.url}
|
|
309
|
+
onChange={(e) => dispatch({ type: 'type', url: e.target.value })}
|
|
310
|
+
/>
|
|
311
|
+
<span
|
|
312
|
+
id="link-server-check"
|
|
313
|
+
className="ls-check"
|
|
314
|
+
data-tone={line.tone}
|
|
315
|
+
data-testid="link-server-check"
|
|
316
|
+
role={line.tone === 'bad' ? 'alert' : 'status'}
|
|
317
|
+
>
|
|
318
|
+
{line.tone === 'hint' ? (
|
|
319
|
+
line.text
|
|
320
|
+
) : (
|
|
321
|
+
<Sw state={SW_OF_TONE[line.tone]}>{line.text}</Sw>
|
|
322
|
+
)}
|
|
323
|
+
</span>
|
|
324
|
+
</span>
|
|
325
|
+
|
|
326
|
+
<button
|
|
327
|
+
type="submit"
|
|
328
|
+
className="btn btn--primary ls-full"
|
|
329
|
+
data-testid="link-server-signin"
|
|
330
|
+
disabled={!canSubmit(s)}
|
|
331
|
+
{...reasonProps(!canSubmit(s), whyNotSubmit(s))}
|
|
332
|
+
>
|
|
333
|
+
{s.phase === 'starting' ? 'Opening…' : primaryLabel(s)}
|
|
334
|
+
</button>
|
|
335
|
+
|
|
336
|
+
{s.invite.open ? (
|
|
337
|
+
<span className="ob-field">
|
|
338
|
+
<label className="ob-field-label" htmlFor="link-server-invite">
|
|
339
|
+
{W.inviteLabel}
|
|
340
|
+
</label>
|
|
341
|
+
<input
|
|
342
|
+
id="link-server-invite"
|
|
343
|
+
className="ob-input"
|
|
344
|
+
data-testid="link-server-invite"
|
|
345
|
+
// a bearer secret: masked, never drawn back
|
|
346
|
+
type="password"
|
|
347
|
+
autoComplete="off"
|
|
348
|
+
spellCheck={false}
|
|
349
|
+
placeholder={W.invitePlaceholder}
|
|
350
|
+
disabled={busy}
|
|
351
|
+
value={s.invite.value}
|
|
352
|
+
onChange={(e) => dispatch({ type: 'invite', value: e.target.value })}
|
|
353
|
+
/>
|
|
354
|
+
</span>
|
|
355
|
+
) : (
|
|
356
|
+
<button
|
|
357
|
+
type="button"
|
|
358
|
+
className="btn btn--ghost ls-full"
|
|
359
|
+
data-testid="link-server-invite-open"
|
|
360
|
+
disabled={busy}
|
|
361
|
+
{...reasonProps(busy, 'Opening the sign-in page…')}
|
|
362
|
+
onClick={() => dispatch({ type: 'invite-open' })}
|
|
363
|
+
>
|
|
364
|
+
{W.inviteToggle}
|
|
365
|
+
</button>
|
|
366
|
+
)}
|
|
367
|
+
|
|
368
|
+
{s.error ? (
|
|
369
|
+
<p className="ai-conn-err" role="alert" data-testid="link-server-error">
|
|
370
|
+
{s.error}
|
|
371
|
+
</p>
|
|
372
|
+
) : null}
|
|
373
|
+
|
|
374
|
+
{parts.length ? (
|
|
375
|
+
<div className="ls-adv" data-open={s.advanced ? 'true' : 'false'}>
|
|
376
|
+
<button
|
|
377
|
+
type="button"
|
|
378
|
+
className="ls-adv-t"
|
|
379
|
+
aria-expanded={s.advanced}
|
|
380
|
+
aria-controls="link-server-adv"
|
|
381
|
+
data-testid="link-server-advanced"
|
|
382
|
+
onClick={() => dispatch({ type: 'advanced' })}
|
|
383
|
+
>
|
|
384
|
+
<span className="ls-chev" aria-hidden="true">
|
|
385
|
+
›
|
|
386
|
+
</span>
|
|
387
|
+
<span className="ls-adv-l">{W.advanced}</span>
|
|
388
|
+
<span className="ls-adv-h">{parts.join(' · ')}</span>
|
|
389
|
+
</button>
|
|
390
|
+
{s.advanced ? (
|
|
391
|
+
<div id="link-server-adv" className="ls-adv-b">
|
|
392
|
+
{typeof api.linkKey === 'function' ? (
|
|
393
|
+
<span className="ob-field">
|
|
394
|
+
<label className="ob-field-label" htmlFor="link-server-key">
|
|
395
|
+
{W.keyLabel}
|
|
396
|
+
</label>
|
|
397
|
+
<input
|
|
398
|
+
id="link-server-key"
|
|
399
|
+
className="ob-input"
|
|
400
|
+
data-testid="link-server-key"
|
|
401
|
+
type="password"
|
|
402
|
+
autoComplete="off"
|
|
403
|
+
spellCheck={false}
|
|
404
|
+
placeholder={W.keyPlaceholder}
|
|
405
|
+
disabled={busy}
|
|
406
|
+
value={s.key}
|
|
407
|
+
onChange={(e) => dispatch({ type: 'key', value: e.target.value })}
|
|
408
|
+
/>
|
|
409
|
+
<span className="ob-fine">{W.keyHint}</span>
|
|
410
|
+
</span>
|
|
411
|
+
) : null}
|
|
412
|
+
{s.folder.mode === 'this' ? (
|
|
413
|
+
<fieldset className="ls-folder" disabled={busy}>
|
|
414
|
+
<legend className="ob-field-label">{W.folderLabel}</legend>
|
|
415
|
+
<span
|
|
416
|
+
className="ob-input ob-mono ls-path"
|
|
417
|
+
data-testid="link-server-folder-this"
|
|
418
|
+
>
|
|
419
|
+
{W.folderThis(s.folder.path)}
|
|
420
|
+
</span>
|
|
421
|
+
</fieldset>
|
|
422
|
+
) : api.folders === true ? (
|
|
423
|
+
<fieldset className="ls-folder" disabled={busy}>
|
|
424
|
+
<legend className="ob-field-label">{W.folderLabel}</legend>
|
|
425
|
+
<label className="ls-radio">
|
|
426
|
+
<input
|
|
427
|
+
type="radio"
|
|
428
|
+
name="link-server-folder"
|
|
429
|
+
data-testid="link-server-folder-kept"
|
|
430
|
+
checked={s.folder.mode === 'kept'}
|
|
431
|
+
onChange={() => dispatch({ type: 'folder', mode: 'kept' })}
|
|
432
|
+
/>
|
|
433
|
+
{W.folderKept} <span className="ob-fine">{W.folderKeptNote}</span>
|
|
434
|
+
</label>
|
|
435
|
+
<label className="ls-radio">
|
|
436
|
+
<input
|
|
437
|
+
type="radio"
|
|
438
|
+
name="link-server-folder"
|
|
439
|
+
data-testid="link-server-folder-mine"
|
|
440
|
+
checked={s.folder.mode === 'mine'}
|
|
441
|
+
onChange={() => dispatch({ type: 'folder', mode: 'mine' })}
|
|
442
|
+
/>
|
|
443
|
+
{W.folderMine}
|
|
444
|
+
</label>
|
|
445
|
+
{s.folder.mode === 'mine' ? (
|
|
446
|
+
<span className="ob-row2">
|
|
447
|
+
<span
|
|
448
|
+
className="ob-input ob-mono ls-path"
|
|
449
|
+
data-testid="link-server-folder-path"
|
|
450
|
+
>
|
|
451
|
+
{s.folder.path}
|
|
452
|
+
</span>
|
|
453
|
+
<button
|
|
454
|
+
type="button"
|
|
455
|
+
className="btn btn--sm"
|
|
456
|
+
data-testid="link-server-folder-choose"
|
|
457
|
+
onClick={async () => {
|
|
458
|
+
const p = await api.pickFolder?.().catch(() => null);
|
|
459
|
+
if (p && alive.current)
|
|
460
|
+
dispatch({ type: 'folder-path', path: p });
|
|
461
|
+
}}
|
|
462
|
+
>
|
|
463
|
+
{W.choose}
|
|
464
|
+
</button>
|
|
465
|
+
</span>
|
|
466
|
+
) : null}
|
|
467
|
+
</fieldset>
|
|
468
|
+
) : null}
|
|
469
|
+
</div>
|
|
470
|
+
) : null}
|
|
471
|
+
</div>
|
|
472
|
+
) : null}
|
|
473
|
+
</div>
|
|
474
|
+
<div className="ai-conn-a">
|
|
475
|
+
<button
|
|
476
|
+
type="button"
|
|
477
|
+
className="btn btn--sm"
|
|
478
|
+
data-testid="link-server-cancel"
|
|
479
|
+
disabled={busy}
|
|
480
|
+
{...reasonProps(busy, 'Opening the sign-in page…')}
|
|
481
|
+
onClick={onClose}
|
|
482
|
+
>
|
|
483
|
+
{W.cancel}
|
|
484
|
+
</button>
|
|
485
|
+
</div>
|
|
486
|
+
</>
|
|
487
|
+
)}
|
|
488
|
+
</form>
|
|
489
|
+
</div>
|
|
490
|
+
</AdvModal>
|
|
491
|
+
);
|
|
492
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// client/v2/link-server/LinkServerHost.jsx — 2.1.1 T5: where `account.link-server` lands in a project tab.
|
|
2
|
+
//
|
|
3
|
+
// The registry row (B1, shell/project-account-bus.js `runLinkServer`) dispatches the cancelable
|
|
4
|
+
// `maude:link-server` event, detail `{ intent: 'link' | 'sign-in', url? }`. This host takes it
|
|
5
|
+
// (`preventDefault()`, so the row does not fall back to Settings › General › This project) and opens the one
|
|
6
|
+
// "Link your server" dialog, the address prefilled when the event names one. The avatar menu, Settings,
|
|
7
|
+
// ⌘K and Diagnostics › Sync all arrive here.
|
|
8
|
+
|
|
9
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
10
|
+
|
|
11
|
+
import { useShellStore } from '../../stores/shell-store.jsx';
|
|
12
|
+
import { LINK_SERVER_EVENT } from '../shell/project-account-bus.js';
|
|
13
|
+
import { projectLinkApi } from './link-server-api.js';
|
|
14
|
+
import { LinkServerDialog } from './LinkServerDialog.jsx';
|
|
15
|
+
|
|
16
|
+
export default function LinkServerHost() {
|
|
17
|
+
const {
|
|
18
|
+
shellCore: { cfg, project },
|
|
19
|
+
} = useShellStore();
|
|
20
|
+
const [open, setOpen] = useState(null); // { url } while the dialog is up
|
|
21
|
+
const api = useMemo(() => projectLinkApi(), []);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const on = (e) => {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
const url = typeof e.detail?.url === 'string' ? e.detail.url : '';
|
|
26
|
+
setOpen({ url });
|
|
27
|
+
};
|
|
28
|
+
window.addEventListener(LINK_SERVER_EVENT, on);
|
|
29
|
+
return () => window.removeEventListener(LINK_SERVER_EVENT, on);
|
|
30
|
+
}, []);
|
|
31
|
+
if (!open) return null;
|
|
32
|
+
return (
|
|
33
|
+
<LinkServerDialog
|
|
34
|
+
// a new request (another url) starts a fresh dialog
|
|
35
|
+
key={open.url}
|
|
36
|
+
api={api}
|
|
37
|
+
project={cfg?.name || project || null}
|
|
38
|
+
initialUrl={open.url}
|
|
39
|
+
onClose={() => setOpen(null)}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// client/v2/link-server/link-server-api.js — 2.1.1 T5: what "Link your server" does in a PROJECT tab.
|
|
2
|
+
// (Home's API is built in onboarding/AdvancedSheets.jsx from home-api.js; the dialog is the same view.)
|
|
3
|
+
//
|
|
4
|
+
// check POST /_api/hub-signin/check — one tokenless GET of the server's /health, made by THIS
|
|
5
|
+
// project's server (routes/hub-signin.ts); the page never fetches the remote
|
|
6
|
+
// signIn* POST /_api/hub-signin/{start,poll,cancel} — the server's own page in the browser (#204);
|
|
7
|
+
// an invite rides `start` and must name the same server
|
|
8
|
+
// openSignIn the shell opens exactly that page (github.js `openTeamServerSignIn`)
|
|
9
|
+
// linkKey POST /_api/hub/link {url, token} — a key the server's admin gave (the emergency path,
|
|
10
|
+
// decision maude/v2-michal-hub-token-paste-stays-password-goes)
|
|
11
|
+
// where GET /_api/cloud/status — THIS project's own folder (`place.folder`), when the person's folder
|
|
12
|
+
// is not linked anywhere yet; null for a copy Maude keeps or a linked project (B5)
|
|
13
|
+
// finish the end of a team-server sign-in:
|
|
14
|
+
// · folder mode 'this' → POST /_api/hub/link-folder {url} — THIS folder joins the server
|
|
15
|
+
// (an empty server is seeded; one that holds work answers `needs-confirm`, nothing linked)
|
|
16
|
+
// · otherwise the server's project opens as its own copy in a tab
|
|
17
|
+
// (`openTeamProject({ kind: 'known-hub' })`, what Settings' "Add a team server" did)
|
|
18
|
+
// confirmLink POST /_api/hub/link-folder {url, confirm} — the person said yes to the counts
|
|
19
|
+
//
|
|
20
|
+
// `folders` is 'this': the only folder a project tab links is its own (a folder the person picks is Home's).
|
|
21
|
+
|
|
22
|
+
import { hubLink, openTeamProject, openTeamServerSignIn } from '../../github.js';
|
|
23
|
+
import { answerOf, checkAnswerOf } from './link-server-model.js';
|
|
24
|
+
|
|
25
|
+
export const LINK_FOLDER_ROUTE = '/_api/hub/link-folder';
|
|
26
|
+
|
|
27
|
+
async function getJson(path) {
|
|
28
|
+
try {
|
|
29
|
+
const res = await fetch(path, { headers: { accept: 'application/json' } });
|
|
30
|
+
return res.ok ? await res.json().catch(() => null) : null;
|
|
31
|
+
} catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** `maude:cloud-changed` (panels/CloudBar.jsx `CLOUD_CHANGED_EVENT`, kept literal so this module stays light). */
|
|
37
|
+
function announceCloudChanged() {
|
|
38
|
+
if (typeof window === 'undefined') return;
|
|
39
|
+
window.dispatchEvent(new CustomEvent('maude:cloud-changed', { detail: { from: 'link-server' } }));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Two addresses name one server (same origin; a trailing slash or path never matters). */
|
|
43
|
+
export function sameServer(a, b) {
|
|
44
|
+
try {
|
|
45
|
+
return !!a && !!b && new URL(String(a)).origin === new URL(String(b)).origin;
|
|
46
|
+
} catch {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The server this folder is linked to ON THIS MAC, else null. 2.1.1 N3 — a committed address nobody linked or
|
|
53
|
+
* confirmed here (`confirmed === false`) is a claim, not a link: Link your server treats the folder as unlinked.
|
|
54
|
+
*/
|
|
55
|
+
export function linkedUrlOfStatus(status) {
|
|
56
|
+
const hub = status?.linkedHub;
|
|
57
|
+
if (!hub || hub.confirmed === false || typeof hub.url !== 'string' || !hub.url) return null;
|
|
58
|
+
return hub.url;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** `/_api/cloud/status` → this project's own, unlinked folder (`~/git/logo-ideas`), else null. */
|
|
62
|
+
export function folderOfStatus(status) {
|
|
63
|
+
const place = status?.place;
|
|
64
|
+
if (!place || place.kept || typeof place.folder !== 'string' || !place.folder) return null;
|
|
65
|
+
if (linkedUrlOfStatus(status)) return null;
|
|
66
|
+
return place.folder;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** A link-folder answer → what `runLink` / `runConfirm` read. */
|
|
70
|
+
export function linkFolderAnswerOf(r) {
|
|
71
|
+
const j = r?.json && typeof r.json === 'object' ? r.json : null;
|
|
72
|
+
if (r?.ok && j?.ok && j.state === 'linked') return { ok: true };
|
|
73
|
+
if (r?.ok && j?.ok && j.state === 'needs-confirm' && typeof j.confirm === 'string')
|
|
74
|
+
return {
|
|
75
|
+
ok: false,
|
|
76
|
+
needsConfirm: {
|
|
77
|
+
host: typeof j.host === 'string' ? j.host : '',
|
|
78
|
+
counts: j.counts ?? null,
|
|
79
|
+
code: j.confirm,
|
|
80
|
+
// 2.1.1 T8 — the first link to a server that holds nothing: the dialog says what goes up
|
|
81
|
+
...(j.empty === true ? { empty: true } : {}),
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
return { ok: false, ...(typeof j?.error === 'string' ? { error: j.error } : {}) };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async function post(path, body) {
|
|
88
|
+
try {
|
|
89
|
+
const res = await fetch(path, {
|
|
90
|
+
method: 'POST',
|
|
91
|
+
headers: { 'content-type': 'application/json' },
|
|
92
|
+
body: JSON.stringify(body),
|
|
93
|
+
});
|
|
94
|
+
const json = await res.json().catch(() => null);
|
|
95
|
+
return { ok: res.ok, status: res.status, json };
|
|
96
|
+
} catch {
|
|
97
|
+
return { ok: false, status: 0, json: null };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @param {{ fetchPost?: typeof post, fetchGet?: typeof getJson, openProject?: typeof openTeamProject,
|
|
103
|
+
* openPage?: typeof openTeamServerSignIn, link?: typeof hubLink,
|
|
104
|
+
* changed?: () => void }} [seams] tests only
|
|
105
|
+
*/
|
|
106
|
+
export function projectLinkApi(seams = {}) {
|
|
107
|
+
const p = seams.fetchPost ?? post;
|
|
108
|
+
const openProject = seams.openProject ?? openTeamProject;
|
|
109
|
+
const link = seams.link ?? hubLink;
|
|
110
|
+
const g = seams.fetchGet ?? getJson;
|
|
111
|
+
// T7 — the page's account chip reads `/_api/cloud/status` again only on this event (shell/use-account.js)
|
|
112
|
+
const changed = seams.changed ?? announceCloudChanged;
|
|
113
|
+
const told = (answer) => {
|
|
114
|
+
if (answer?.ok) changed();
|
|
115
|
+
return answer;
|
|
116
|
+
};
|
|
117
|
+
return {
|
|
118
|
+
context: 'project',
|
|
119
|
+
folders: 'this',
|
|
120
|
+
where: async () => ({ folder: folderOfStatus(await g('/_api/cloud/status')) }),
|
|
121
|
+
check: async (url) => checkAnswerOf(await p('/_api/hub-signin/check', { url })),
|
|
122
|
+
signInStart: async (url, invite) =>
|
|
123
|
+
answerOf(await p('/_api/hub-signin/start', { url, ...(invite ? { invite } : {}) })),
|
|
124
|
+
signInPoll: async (id) => answerOf(await p('/_api/hub-signin/poll', { id })),
|
|
125
|
+
signInCancel: (id) => p('/_api/hub-signin/cancel', { id }),
|
|
126
|
+
openSignIn: seams.openPage ?? openTeamServerSignIn,
|
|
127
|
+
linkKey: async (url, token) => answerOf(await link({ url, token })),
|
|
128
|
+
finish: async (url, folder) => {
|
|
129
|
+
if (folder?.mode === 'this')
|
|
130
|
+
return told(linkFolderAnswerOf(await p(LINK_FOLDER_ROUTE, { url })));
|
|
131
|
+
// 2.1.1 T7 — Sign in (again) for the server THIS project is already linked to: the sign-in was the whole
|
|
132
|
+
// job (the route stored it and cycled sync). Opening the server's project here put the person in a copy
|
|
133
|
+
// Maude keeps instead of their own folder.
|
|
134
|
+
if (sameServer(linkedUrlOfStatus(await g('/_api/cloud/status')), url))
|
|
135
|
+
return told({ ok: true });
|
|
136
|
+
const r = await openProject({ kind: 'known-hub', url });
|
|
137
|
+
return r?.ok ? { ok: true } : { ok: false, error: r?.error };
|
|
138
|
+
},
|
|
139
|
+
confirmLink: async (url, code) =>
|
|
140
|
+
told(linkFolderAnswerOf(await p(LINK_FOLDER_ROUTE, { url, confirm: code }))),
|
|
141
|
+
};
|
|
142
|
+
}
|