@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,75 @@
|
|
|
1
|
+
// `<designRoot>/_server.json` — one writer at a time (#206, DDR-250 decision 7; contract
|
|
2
|
+
// `client/v2/contracts/206-cli-reuses-desktop.md` §6 "Handover" step 2).
|
|
3
|
+
//
|
|
4
|
+
// The slash commands and `maude design` helpers find a live server through this file. Two
|
|
5
|
+
// servers can serve one root for a while (a terminal `server-up` server and the desktop's
|
|
6
|
+
// sidecar), and both used to treat the file as theirs: the one stopping unlinked it blindly, so
|
|
7
|
+
// the survivor ran with no file and the next `server-up` started a third server. Now:
|
|
8
|
+
// • a server writes it atomically (tmp + rename), so a reader never sees half a file;
|
|
9
|
+
// • a server removes it on shutdown ONLY while it still names that server — the same pid AND
|
|
10
|
+
// the same `started` stamp (a recycled pid is a different server). Same shape as the store
|
|
11
|
+
// lock's stale-holder check (sync/local-kernel.ts `acquireStoreLock`): read, compare, unlink.
|
|
12
|
+
// Residual: a write landing between the read and the unlink is lost (a millisecond window,
|
|
13
|
+
// and the newer server rewrites nothing until its next boot) — named, not closed.
|
|
14
|
+
//
|
|
15
|
+
// The file stays a hint for helpers on a machine without the app. It is never a trust input
|
|
16
|
+
// when the app's registry names the root (contract §3): nothing here makes it one.
|
|
17
|
+
|
|
18
|
+
import { randomBytes } from 'node:crypto';
|
|
19
|
+
import { mkdirSync, readFileSync, renameSync, rmSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
20
|
+
import { dirname } from 'node:path';
|
|
21
|
+
|
|
22
|
+
export interface ServerJson {
|
|
23
|
+
pid: number;
|
|
24
|
+
port: number;
|
|
25
|
+
url: string;
|
|
26
|
+
canvasOrigin?: string;
|
|
27
|
+
canvasPort?: number;
|
|
28
|
+
started: string;
|
|
29
|
+
project?: string;
|
|
30
|
+
config_source?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Write `info` to `file` atomically. Mode 0644, as before: it holds a pid and a port, no secret. */
|
|
34
|
+
export function writeServerJson(file: string, info: ServerJson): void {
|
|
35
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
36
|
+
const tmp = `${file}.tmp.${randomBytes(8).toString('hex')}`;
|
|
37
|
+
try {
|
|
38
|
+
writeFileSync(tmp, JSON.stringify(info, null, 2), { mode: 0o644, flag: 'wx' });
|
|
39
|
+
renameSync(tmp, file);
|
|
40
|
+
} catch (e) {
|
|
41
|
+
rmSync(tmp, { force: true });
|
|
42
|
+
throw e;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Remove `file` only while it names `me` (pid + started). True when it removed it. A missing,
|
|
48
|
+
* empty or unparsable file, or one naming another server, is left exactly as it is.
|
|
49
|
+
*/
|
|
50
|
+
export function removeServerJsonIfOurs(
|
|
51
|
+
file: string,
|
|
52
|
+
me: { pid: number; started: string }
|
|
53
|
+
): boolean {
|
|
54
|
+
let raw: string;
|
|
55
|
+
try {
|
|
56
|
+
raw = readFileSync(file, 'utf8');
|
|
57
|
+
} catch {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
let cur: Partial<ServerJson> | null = null;
|
|
61
|
+
try {
|
|
62
|
+
cur = JSON.parse(raw) as Partial<ServerJson>;
|
|
63
|
+
} catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
if (!cur || cur.pid !== me.pid || cur.started !== me.started) return false;
|
|
67
|
+
// still the bytes we judged (a rewrite in between is the other server's)
|
|
68
|
+
try {
|
|
69
|
+
if (readFileSync(file, 'utf8') !== raw) return false;
|
|
70
|
+
unlinkSync(file);
|
|
71
|
+
return true;
|
|
72
|
+
} catch {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// #206 §5 (DDR-250) — this server serves a git WORKTREE of a project the desktop app knows.
|
|
2
|
+
//
|
|
3
|
+
// The app decides that (it reads the main repo's back-reference; `project_resolve::worktree_of`) and
|
|
4
|
+
// hands the spawned server `MAUDE_WORKTREE_OF=<the main project's display name>`. A worktree is never
|
|
5
|
+
// linked: the Share sheet says "Syncs from <main>" with no button, and the Connect route refuses, so a
|
|
6
|
+
// person cannot make it a second linked copy by hand either. Absent env ⇒ an ordinary project (every
|
|
7
|
+
// `maude design serve`, every cell).
|
|
8
|
+
//
|
|
9
|
+
// The name reaches the browser, so it is treated as display input like the profile label: controls
|
|
10
|
+
// and bidi overrides stripped, trimmed, ≤ 64 code points; empty ⇒ not a worktree.
|
|
11
|
+
|
|
12
|
+
import { sanitizeProfileLabel } from './profile.ts';
|
|
13
|
+
|
|
14
|
+
export const WORKTREE_ENV = 'MAUDE_WORKTREE_OF';
|
|
15
|
+
|
|
16
|
+
/** The main project's name when this server serves a worktree tab, else null. */
|
|
17
|
+
export function worktreeOf(env: Record<string, string | undefined> = process.env): string | null {
|
|
18
|
+
return sanitizeProfileLabel(env[WORKTREE_ENV]) ?? null;
|
|
19
|
+
}
|
|
@@ -15,3 +15,12 @@ const SPOOF_CHARS_RE = new RegExp(`[${SPOOF_CHARS_CLASS}]`, 'gu');
|
|
|
15
15
|
export function stripSpoofChars(s: string): string {
|
|
16
16
|
return s.replace(SPOOF_CHARS_RE, '');
|
|
17
17
|
}
|
|
18
|
+
|
|
19
|
+
/** Invisible formatting characters a name never needs either: soft hyphen, Arabic letter mark, Mongolian vowel
|
|
20
|
+
* separator, zero-width space / non-joiner / joiner, LRM / RLM, word joiner + invisible operators, BOM. */
|
|
21
|
+
const INVISIBLE_CHARS_RE = /[\u00ad\u061c\u180e\u200b-\u200f\u2060-\u2064\ufeff]/gu;
|
|
22
|
+
|
|
23
|
+
/** A person's name with every spoofing AND invisible character removed (burndown L4: "Added by"). */
|
|
24
|
+
export function stripNameSpoofChars(s: string): string {
|
|
25
|
+
return stripSpoofChars(s).replace(INVISIBLE_CHARS_RE, '');
|
|
26
|
+
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// the studio on `127.0.0.1:<port>` and the canvas origin on `localhost:<port>` (two sites), every
|
|
9
9
|
// picture lost its capability and got the frame-less answer (403): "Picture not found".
|
|
10
10
|
//
|
|
11
|
-
// The desktop app, `maude design
|
|
11
|
+
// The desktop app, `maude design server-up --open` and every printed address use `localhost`, the same site
|
|
12
12
|
// as the canvas origin, so they never hit this; a cell and a self-hosted workspace must already put
|
|
13
13
|
// the canvas domain on the studio's site (its session cookie needs it). What is left is a person
|
|
14
14
|
// (or a harness) typing `127.0.0.1` or `[::1]`. Their browser's own top-level navigation to the
|
|
@@ -40,6 +40,9 @@
|
|
|
40
40
|
import { existsSync, readFileSync } from 'node:fs';
|
|
41
41
|
import type * as Y from 'yjs';
|
|
42
42
|
|
|
43
|
+
import { annotationsLaneValue } from '../annotations/board-text.ts';
|
|
44
|
+
import { parseBoard, serializeBoard } from '../annotations/schema.ts';
|
|
45
|
+
import type { AnnotationElement } from '../annotations/types.ts';
|
|
43
46
|
import {
|
|
44
47
|
cssFromDoc,
|
|
45
48
|
htmlFromDoc,
|
|
@@ -51,6 +54,7 @@ import {
|
|
|
51
54
|
import { commentKey } from './comment-identity.ts';
|
|
52
55
|
import type { CommentLedger } from './comment-ledger.ts';
|
|
53
56
|
import { hashBytes } from './echo-guard.ts';
|
|
57
|
+
import { cleanFolderName } from './held-deletes.ts';
|
|
54
58
|
import type { SyncJournal } from './journal.ts';
|
|
55
59
|
import type { DocProjection, ProjectionPaths, ProposalLane } from './projection.ts';
|
|
56
60
|
import { readRecoveryBody, readRecoveryCandidate, saveRecoveryBody } from './source-recovery.ts';
|
|
@@ -179,6 +183,15 @@ export interface AcceptedColdStartInput {
|
|
|
179
183
|
* cell wake), not an edit: it is materialized, never held.
|
|
180
184
|
*/
|
|
181
185
|
wasAccepted?: (content: string) => Promise<boolean | null>;
|
|
186
|
+
/**
|
|
187
|
+
* 2.1.1 T11 — this disk is a hub's own checkout (the paired studio of a cell or a self-hosted
|
|
188
|
+
* workspace hub, `cellPairing`): the project's cache, not a person's work (DDR-243; the hub is
|
|
189
|
+
* the sole committer, DDR-209). A source lane that would be HELD is materialized instead — the
|
|
190
|
+
* project's version wins and the checkout's bytes go to the recovery slot. A held conflict there
|
|
191
|
+
* is a dead end: the hub's proxy refuses the conflict route in a cell (v2-S9.24b), so Compare
|
|
192
|
+
* and Keep mine answer 404, and the lane stays blocked behind it.
|
|
193
|
+
*/
|
|
194
|
+
checkoutIsCache?: boolean;
|
|
182
195
|
createDoc: (lanes: Partial<Record<ProposalLane, string>>) => Promise<{
|
|
183
196
|
status: 'accepted' | 'rejected';
|
|
184
197
|
code?: string;
|
|
@@ -216,7 +229,12 @@ export function localCreateLanes(
|
|
|
216
229
|
export type AcceptedColdStartResult =
|
|
217
230
|
| { kind: 'created' }
|
|
218
231
|
| { kind: 'create-refused'; code?: string }
|
|
219
|
-
| {
|
|
232
|
+
| {
|
|
233
|
+
kind: 'reconciled';
|
|
234
|
+
verdicts: LaneVerdict[];
|
|
235
|
+
/** S1 — lanes whose local value the project's replaced; each is in its recovery slot. */
|
|
236
|
+
setAside?: ProposalLane[];
|
|
237
|
+
};
|
|
220
238
|
|
|
221
239
|
export async function acceptedColdStart(
|
|
222
240
|
i: AcceptedColdStartInput
|
|
@@ -250,6 +268,21 @@ export async function acceptedColdStart(
|
|
|
250
268
|
}
|
|
251
269
|
|
|
252
270
|
const verdicts: LaneVerdict[] = [];
|
|
271
|
+
/** S1 — lanes whose local value the project's replaced, kept in their recovery slot. */
|
|
272
|
+
const setAside: ProposalLane[] = [];
|
|
273
|
+
const saveQuietly = (file: string, text: string): boolean => {
|
|
274
|
+
if (!i.historyDir) return false;
|
|
275
|
+
try {
|
|
276
|
+
saveRecoveryBody(i.historyDir, file, 'local', text);
|
|
277
|
+
return true;
|
|
278
|
+
} catch {
|
|
279
|
+
return false; /* recovery is best-effort for these lanes */
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
const keepAside = (lane: ProposalLane, file: string, text: string): void => {
|
|
283
|
+
saveQuietly(file, text);
|
|
284
|
+
if (!setAside.includes(lane)) setAside.push(lane);
|
|
285
|
+
};
|
|
253
286
|
|
|
254
287
|
// ---- html — the canvas source
|
|
255
288
|
const acceptedHtml = htmlFromDoc(i.doc);
|
|
@@ -327,7 +360,13 @@ export async function acceptedColdStart(
|
|
|
327
360
|
verdicts.push({ lane: 'meta', decision: 'propose', base: '', local });
|
|
328
361
|
} else {
|
|
329
362
|
// No base is recorded for layout: the project's arrangement wins and the
|
|
330
|
-
// projection merges it into the local file's private keys.
|
|
363
|
+
// projection merges it into the local file's private keys. S1 — unless the
|
|
364
|
+
// project once had exactly this layout (an older accepted state), it is this
|
|
365
|
+
// Mac's own (a first link to a server that already holds the canvas): kept
|
|
366
|
+
// in its own recovery slot and reported as set aside, never dropped.
|
|
367
|
+
if (metaText !== null && (await i.wasAccepted?.(local)) !== true) {
|
|
368
|
+
keepAside('meta', i.paths.meta, metaText);
|
|
369
|
+
}
|
|
331
370
|
verdicts.push({ lane: 'meta', decision: 'materialize', local });
|
|
332
371
|
}
|
|
333
372
|
}
|
|
@@ -349,16 +388,48 @@ export async function acceptedColdStart(
|
|
|
349
388
|
continue;
|
|
350
389
|
}
|
|
351
390
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
391
|
+
// S1 (2.1.1) — "a difference on disk is an older accepted state" (the header)
|
|
392
|
+
// holds only for a value the project once accepted. One it never did is this
|
|
393
|
+
// Mac's own work: a first link to a server that already holds this canvas, or a
|
|
394
|
+
// raw edit made while the studio was down. Comments and board elements carry
|
|
395
|
+
// stable ids, so it joins the project as the accepted value plus what only this
|
|
396
|
+
// disk has; an id both sides changed keeps the project's, and this Mac's is set
|
|
397
|
+
// aside. A hub's checkout is the project's cache and owes it nothing (T11).
|
|
398
|
+
const onceAccepted = i.checkoutIsCache ? null : ((await i.wasAccepted?.(local)) ?? null);
|
|
399
|
+
if (onceAccepted === false) {
|
|
400
|
+
const joined = unionById(lane, local, accepted);
|
|
401
|
+
if (joined !== null) {
|
|
402
|
+
if (!joined.complete && text) keepAside(lane, p, text);
|
|
403
|
+
verdicts.push({ lane, decision: 'propose', base: accepted, local: joined.value });
|
|
404
|
+
continue;
|
|
357
405
|
}
|
|
358
406
|
}
|
|
407
|
+
if (text) {
|
|
408
|
+
// An older accepted state (or a hub checkout) is kept quietly, as before; anything
|
|
409
|
+
// else of this Mac's that the project's value replaces is reported.
|
|
410
|
+
if (onceAccepted === true || i.checkoutIsCache) saveQuietly(p, text);
|
|
411
|
+
else keepAside(lane, p, text);
|
|
412
|
+
}
|
|
359
413
|
verdicts.push({ lane, decision: 'materialize', local: text ?? undefined });
|
|
360
414
|
}
|
|
361
415
|
|
|
416
|
+
// ---- a hub checkout never holds (see `checkoutIsCache`)
|
|
417
|
+
if (i.checkoutIsCache) {
|
|
418
|
+
for (const v of verdicts) {
|
|
419
|
+
if (v.decision !== 'hold') continue;
|
|
420
|
+
const p = v.lane === 'html' ? i.paths.html : v.lane === 'css' ? i.paths.css : undefined;
|
|
421
|
+
if (i.historyDir && p && v.local !== undefined) {
|
|
422
|
+
try {
|
|
423
|
+
saveRecoveryBody(i.historyDir, p, 'local', v.local);
|
|
424
|
+
} catch {
|
|
425
|
+
/* best-effort, as for the other lanes the project's value wins on */
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
v.decision = 'materialize';
|
|
429
|
+
v.base = undefined;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
362
433
|
// ---- act
|
|
363
434
|
for (const v of verdicts) {
|
|
364
435
|
if (v.decision === 'propose' && v.local !== undefined) {
|
|
@@ -377,5 +448,70 @@ export async function acceptedColdStart(
|
|
|
377
448
|
`[sync/${i.slug}] cold start: ${moved.map((v) => `${v.lane}=${v.decision}`).join(', ')}`
|
|
378
449
|
);
|
|
379
450
|
}
|
|
380
|
-
|
|
451
|
+
if (setAside.length) {
|
|
452
|
+
log.warn(
|
|
453
|
+
`[sync/${i.slug}] cold start: the project's ${setAside.join(', ')} replaced this Mac's — kept in the recovery folder.`
|
|
454
|
+
);
|
|
455
|
+
}
|
|
456
|
+
return { kind: 'reconciled', verdicts, ...(setAside.length ? { setAside } : {}) };
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
const SET_ASIDE_WORDS: Partial<Record<ProposalLane, string>> = {
|
|
460
|
+
meta: 'layout',
|
|
461
|
+
annotations: 'sticky notes',
|
|
462
|
+
comments: 'comments',
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
/** S1 — the Sync notice for lanes set aside at cold start (CONTRACT §3–§4 voice). */
|
|
466
|
+
export function setAsideNotice(rel: string, slug: string, lanes: readonly ProposalLane[]): string {
|
|
467
|
+
// 2.1.1 N6 — the name can come from the server: no bidi/format/control characters in the sentence
|
|
468
|
+
const name =
|
|
469
|
+
cleanFolderName(
|
|
470
|
+
rel
|
|
471
|
+
.split('/')
|
|
472
|
+
.pop()
|
|
473
|
+
?.replace(/\.tsx$/i, '') ?? ''
|
|
474
|
+
) || cleanFolderName(rel);
|
|
475
|
+
slug = cleanFolderName(slug);
|
|
476
|
+
const words = lanes.map((l) => SET_ASIDE_WORDS[l] ?? l);
|
|
477
|
+
const list =
|
|
478
|
+
words.length > 1 ? `${words.slice(0, -1).join(', ')} and ${words[words.length - 1]}` : words[0];
|
|
479
|
+
return `${name}: the project’s ${list} replaced this Mac’s. This Mac’s copy is kept in _history/${slug}/sync-recovery/.`;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* S1 — an id-keyed lane (comments, board elements) joined the way a first link
|
|
484
|
+
* needs: the accepted value, plus the entries only `local` has. `complete` is
|
|
485
|
+
* false when an id both sides hold differs (the project's entry is kept). Null
|
|
486
|
+
* when `local` adds nothing.
|
|
487
|
+
*/
|
|
488
|
+
export function unionById(
|
|
489
|
+
lane: 'comments' | 'annotations',
|
|
490
|
+
local: string,
|
|
491
|
+
accepted: string
|
|
492
|
+
): { value: string; complete: boolean } | null {
|
|
493
|
+
if (lane === 'comments') {
|
|
494
|
+
const there = parseList(accepted);
|
|
495
|
+
const byKey = new Map(there.map((c) => [commentKey(c), JSON.stringify(c)]));
|
|
496
|
+
let complete = true;
|
|
497
|
+
const extra: unknown[] = [];
|
|
498
|
+
for (const c of parseList(local)) {
|
|
499
|
+
const theirs = byKey.get(commentKey(c));
|
|
500
|
+
if (theirs === undefined) extra.push(c);
|
|
501
|
+
else if (theirs !== JSON.stringify(c)) complete = false;
|
|
502
|
+
}
|
|
503
|
+
return extra.length ? { value: JSON.stringify([...there, ...extra]), complete } : null;
|
|
504
|
+
}
|
|
505
|
+
const there = accepted ? parseBoard(accepted).elements : [];
|
|
506
|
+
const byId = new Map(there.map((e) => [e.id, JSON.stringify(e)]));
|
|
507
|
+
let complete = true;
|
|
508
|
+
const extra: AnnotationElement[] = [];
|
|
509
|
+
for (const e of parseBoard(local).elements) {
|
|
510
|
+
const theirs = byId.get(e.id);
|
|
511
|
+
if (theirs === undefined) extra.push(e);
|
|
512
|
+
else if (theirs !== JSON.stringify(e)) complete = false;
|
|
513
|
+
}
|
|
514
|
+
if (!extra.length) return null;
|
|
515
|
+
const value = annotationsLaneValue(serializeBoard([...there, ...extra]));
|
|
516
|
+
return value ? { value, complete } : null;
|
|
381
517
|
}
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
} from 'node:fs';
|
|
25
25
|
import path from 'node:path';
|
|
26
26
|
|
|
27
|
+
import { cleanGestureLabel } from '../annotations/ops.ts';
|
|
27
28
|
import type { TrashListing } from '../history/trash.ts';
|
|
28
29
|
import { type ActionStageOptions, createActionStage, type StageSummary } from './action-stage.ts';
|
|
29
30
|
import { recordConflicts, recordFromResult } from './conflict-record.ts';
|
|
@@ -98,6 +99,15 @@ const LANE_LABEL: Record<LaneProposal['lane'], string> = {
|
|
|
98
99
|
comments: 'Edit comments',
|
|
99
100
|
};
|
|
100
101
|
|
|
102
|
+
/**
|
|
103
|
+
* T7.3b (#113) — an annotations edit goes out under the person's gesture in words when the canvas
|
|
104
|
+
* said it ("Ticked “Write the post”"), cleaned (untrusted canvas text); else the lane's label. The
|
|
105
|
+
* hub stores `label` as it stores any label, so a v1 hub needs nothing new.
|
|
106
|
+
*/
|
|
107
|
+
function laneLabel(p: LaneProposal): string {
|
|
108
|
+
return (p.lane === 'annotations' && cleanGestureLabel(p.label)) || LANE_LABEL[p.lane];
|
|
109
|
+
}
|
|
110
|
+
|
|
101
111
|
/**
|
|
102
112
|
* S9.24 — the elements the kernel held at the head's version (`merged[].conflicts`), shape-checked:
|
|
103
113
|
* the answer is the hub's, and only a well-formed record may reach the card.
|
|
@@ -267,6 +277,8 @@ export function createAcceptedLink(opts: AcceptedLinkOptions) {
|
|
|
267
277
|
newTransactionId: client.newTransactionId,
|
|
268
278
|
onChange: opts.onStage,
|
|
269
279
|
...(opts.attribute ? { attribute: opts.attribute } : {}),
|
|
280
|
+
// #164 B4 — an unclaimed parked write goes out as the lane edit it was, not a per-canvas default
|
|
281
|
+
release: (w) => releaseOutside(w),
|
|
270
282
|
log,
|
|
271
283
|
});
|
|
272
284
|
stage.restore();
|
|
@@ -358,6 +370,68 @@ export function createAcceptedLink(opts: AcceptedLinkOptions) {
|
|
|
358
370
|
return answer;
|
|
359
371
|
}
|
|
360
372
|
|
|
373
|
+
/** One lane edit as the hub takes it: an `edit` under the write's own transaction, label and write id. */
|
|
374
|
+
function sendLane(
|
|
375
|
+
slug: string,
|
|
376
|
+
doc: string,
|
|
377
|
+
p: LaneProposal,
|
|
378
|
+
dependsOn: string[] | undefined,
|
|
379
|
+
madeAt?: number
|
|
380
|
+
): Promise<ProposalOutcome> {
|
|
381
|
+
return propose({
|
|
382
|
+
kind: 'edit',
|
|
383
|
+
label: laneLabel(p),
|
|
384
|
+
transactionId: p.transactionId,
|
|
385
|
+
dependsOn,
|
|
386
|
+
...(madeAt ? { origin: { madeAt } } : {}),
|
|
387
|
+
operations: [
|
|
388
|
+
{
|
|
389
|
+
op: 'lane.replace',
|
|
390
|
+
doc,
|
|
391
|
+
lane: p.lane,
|
|
392
|
+
content: p.content,
|
|
393
|
+
baseContent: p.baseContent,
|
|
394
|
+
...(p.writeId ? { writeId: p.writeId } : {}),
|
|
395
|
+
// S9.24 — an element both sides changed is held, never char-merged into a third
|
|
396
|
+
// text nobody wrote (sync/object-conflict.ts). A v1 hub ignores the field.
|
|
397
|
+
...(p.lane === 'annotations' ? { objects: 'hold' } : {}),
|
|
398
|
+
},
|
|
399
|
+
],
|
|
400
|
+
}).then((r) => {
|
|
401
|
+
const o = outcome(r);
|
|
402
|
+
// S9.24 — the answer's own producer of the card (the onResult one covers a replay).
|
|
403
|
+
if (o.status === 'accepted' && o.objectConflicts)
|
|
404
|
+
recordConflicts(opts.designRoot, slug, o.objectConflicts, {
|
|
405
|
+
...(o.actionId ? { actionId: o.actionId } : {}),
|
|
406
|
+
});
|
|
407
|
+
return o;
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* #164 B4 — writes a call's window parked and no settle claimed go out as OUTSIDE edits, exactly as
|
|
413
|
+
* `laneLink` would have sent them with no window open: one `edit` per write, in arrival order (the
|
|
414
|
+
* client's one serialized queue keeps it). Their answer is the first refusal, else the last
|
|
415
|
+
* acceptance. A create (only the local home makes one today) goes out as the watcher's `doc.create`.
|
|
416
|
+
*/
|
|
417
|
+
function releaseOutside(w: {
|
|
418
|
+
slug: string;
|
|
419
|
+
doc: string;
|
|
420
|
+
writes: LaneProposal[];
|
|
421
|
+
}): Promise<ProposalOutcome> {
|
|
422
|
+
const create = w.writes.find((x) => x.create)?.create;
|
|
423
|
+
if (create) {
|
|
424
|
+
const lanes: Record<string, string> = {};
|
|
425
|
+
for (const x of w.writes) lanes[x.lane] = x.content;
|
|
426
|
+
for (const k of Object.keys(lanes)) if (lanes[k] === '') delete lanes[k];
|
|
427
|
+
return queueCreate({ op: 'doc.create', doc: w.doc, path: create, lanes });
|
|
428
|
+
}
|
|
429
|
+
const sent = w.writes.map((x) => sendLane(w.slug, w.doc, x, stage.mapDeps(x.dependsOn)));
|
|
430
|
+
return Promise.all(sent).then(
|
|
431
|
+
(all) => all.find((o) => o.status !== 'accepted') ?? (all.at(-1) as ProposalOutcome)
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
|
|
361
435
|
function laneLink(slug: string): AcceptedLaneLink {
|
|
362
436
|
return {
|
|
363
437
|
on,
|
|
@@ -367,34 +441,7 @@ export function createAcceptedLink(opts: AcceptedLinkOptions) {
|
|
|
367
441
|
if (stage.captures(slug, p.stageable === true, p.content))
|
|
368
442
|
return stage.capture(slug, doc, p);
|
|
369
443
|
const send = (dependsOn: string[] | undefined, madeAt?: number) =>
|
|
370
|
-
|
|
371
|
-
kind: 'edit',
|
|
372
|
-
label: LANE_LABEL[p.lane],
|
|
373
|
-
transactionId: p.transactionId,
|
|
374
|
-
dependsOn,
|
|
375
|
-
...(madeAt ? { origin: { madeAt } } : {}),
|
|
376
|
-
operations: [
|
|
377
|
-
{
|
|
378
|
-
op: 'lane.replace',
|
|
379
|
-
doc,
|
|
380
|
-
lane: p.lane,
|
|
381
|
-
content: p.content,
|
|
382
|
-
baseContent: p.baseContent,
|
|
383
|
-
...(p.writeId ? { writeId: p.writeId } : {}),
|
|
384
|
-
// S9.24 — an element both sides changed is held, never char-merged into a third
|
|
385
|
-
// text nobody wrote (sync/object-conflict.ts). A v1 hub ignores the field.
|
|
386
|
-
...(p.lane === 'annotations' ? { objects: 'hold' } : {}),
|
|
387
|
-
},
|
|
388
|
-
],
|
|
389
|
-
}).then((r) => {
|
|
390
|
-
const o = outcome(r);
|
|
391
|
-
// S9.24 — the answer's own producer of the card (the onResult one covers a replay).
|
|
392
|
-
if (o.status === 'accepted' && o.objectConflicts)
|
|
393
|
-
recordConflicts(opts.designRoot, slug, o.objectConflicts, {
|
|
394
|
-
...(o.actionId ? { actionId: o.actionId } : {}),
|
|
395
|
-
});
|
|
396
|
-
return o;
|
|
397
|
-
});
|
|
444
|
+
sendLane(slug, doc, p, dependsOn, madeAt);
|
|
398
445
|
if (p.undoes) {
|
|
399
446
|
// S2.20c — ⌘Z on a waiting edit: its inverse waits behind the same run, right after it
|
|
400
447
|
// (decision v2-lead-pending-inverse-via-stage), and lands as THAT edit's undo once the
|
|
@@ -426,7 +473,7 @@ export function createAcceptedLink(opts: AcceptedLinkOptions) {
|
|
|
426
473
|
// with it). It is the person's edit, made NOW: `origin.madeAt` keeps
|
|
427
474
|
// its place in their ⌘Z stack when it lands behind the run (V2-1.5 U2).
|
|
428
475
|
const madeAt = Date.now();
|
|
429
|
-
return waitBehind(p, slug,
|
|
476
|
+
return waitBehind(p, slug, laneLabel(p), madeAt, p.dependsOn ?? [], () =>
|
|
430
477
|
send(stage.mapDeps(p.dependsOn), madeAt)
|
|
431
478
|
);
|
|
432
479
|
}
|