@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
|
@@ -17,8 +17,22 @@
|
|
|
17
17
|
// `guardTableRoute` (http.ts) runs first, so the loopback-Host (DNS-rebinding) gate applies too.
|
|
18
18
|
//
|
|
19
19
|
// MAIN ORIGIN ONLY: `origin: 'main'`, so it is in neither canvas allowlist (DDR-054/088).
|
|
20
|
-
// The answer is four counts and a public version string — never a chat id, a
|
|
21
|
-
// a prompt.
|
|
20
|
+
// The answer is four counts, the store mode and a public version string — never a chat id, a
|
|
21
|
+
// title, a path or a prompt. `storeMode` (#206): `read-only` while this server waits for another
|
|
22
|
+
// server on the same root to let go of the project store lock, so the tab can say "Finishing the
|
|
23
|
+
// terminal's run…" (contract 206-cli-reuses-desktop.md §6 step 5).
|
|
24
|
+
//
|
|
25
|
+
// `GET /_api/shell/attest?n=<32 hex>` (#206, DDR-250 decision 2, contract §3): how the terminal
|
|
26
|
+
// tells a desktop sidecar from a squatter on its port — challenge-response over the per-spawn
|
|
27
|
+
// MAUDE_SHELL_ATTEST_KEY (shell/attest.ts has the MAC). Gates, in order (test/shell-attest.test.ts):
|
|
28
|
+
// no key → 404 (a terminal server is never attestable) · a browser → 403 · `n` not exactly 32 hex
|
|
29
|
+
// characters → 400. No shell token: the key IS the credential, and the answer is one MAC.
|
|
30
|
+
//
|
|
31
|
+
// #122 (122-C) `GET /_api/shell/clip-export?id=` · `GET /_api/shell/clip-asset?id=&rel=` ·
|
|
32
|
+
// `POST /_api/shell/clip-import`: the desktop shell (clip_bridge.rs) carrying a clip from one project's
|
|
33
|
+
// server to another's, after the person said Paste in the target tab. The shell-token gates above, in the
|
|
34
|
+
// same order (test/shell-clip-routes.test.ts); main origin only, never canvas-safe; shell/clip-transfer.ts
|
|
35
|
+
// has every check (items re-checked, modules by sha256, assets against their `<sha8>` names).
|
|
22
36
|
|
|
23
37
|
import { createHash, timingSafeEqual } from 'node:crypto';
|
|
24
38
|
|
|
@@ -28,16 +42,38 @@ import type { AgentRuns } from '../agent-runs.ts';
|
|
|
28
42
|
import { saveHold } from '../ai/save-hold.ts';
|
|
29
43
|
import type { Outbox } from '../outbox/index.ts';
|
|
30
44
|
import { FINAL_STATES } from '../outbox/types.ts';
|
|
45
|
+
import { ATTEST_NONCE_RE, attestMac, bootAttestKey } from '../shell/attest.ts';
|
|
46
|
+
import {
|
|
47
|
+
assetForShell,
|
|
48
|
+
CLIP_FRAME_MAX_BYTES,
|
|
49
|
+
GONE as CLIP_GONE,
|
|
50
|
+
TOO_BIG as CLIP_TOO_BIG,
|
|
51
|
+
exportForShell,
|
|
52
|
+
importFromShell,
|
|
53
|
+
parseFrame,
|
|
54
|
+
type Refusal,
|
|
55
|
+
} from '../shell/clip-transfer.ts';
|
|
31
56
|
import { resolveMaudeVersion } from '../whats-new.ts';
|
|
32
57
|
import type { RouteSpec } from './table.ts';
|
|
33
58
|
|
|
34
59
|
export const SHELL_TOKEN_HEADER = 'x-maude-shell';
|
|
35
60
|
|
|
61
|
+
export type StoreMode = 'writer' | 'read-only';
|
|
62
|
+
|
|
36
63
|
export interface ShellStatus {
|
|
37
64
|
version: string;
|
|
38
65
|
ai: { running: number; awaiting: number };
|
|
39
66
|
unsent: number;
|
|
40
67
|
jobs: number;
|
|
68
|
+
/** #206 — present once the server has bound it (server.ts `bindShellRuntime`). */
|
|
69
|
+
storeMode?: StoreMode;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** What `/_api/shell/attest` signs with: the key, and the identity it binds into the MAC. */
|
|
73
|
+
export interface AttestFacts {
|
|
74
|
+
key: string;
|
|
75
|
+
rootId: string;
|
|
76
|
+
port: number;
|
|
41
77
|
}
|
|
42
78
|
|
|
43
79
|
export interface ShellRouteDeps {
|
|
@@ -55,6 +91,37 @@ export interface ShellRouteDeps {
|
|
|
55
91
|
version?: () => string;
|
|
56
92
|
/** injected in tests; default: the studio's save hold (ai/save-hold.ts) */
|
|
57
93
|
heldSaves?: () => number;
|
|
94
|
+
/** #206 — injected in tests; default: MAUDE_SHELL_ATTEST_KEY (read once) + the bound identity */
|
|
95
|
+
attest?: () => AttestFacts | null;
|
|
96
|
+
/** #206 — injected in tests; default: the local store's mode, once bound */
|
|
97
|
+
storeMode?: () => StoreMode | undefined;
|
|
98
|
+
/** #122 (122-C) — the design root the clip routes read modules / assets from and write assets to;
|
|
99
|
+
* absent = the clip routes answer 404 (routes/index.ts passes it) */
|
|
100
|
+
designRoot?: string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* #206 — facts the server learns only after the route table exists (its bound port, its store),
|
|
105
|
+
* set once by server.ts. Module state on purpose: http.ts builds the shell deps before Bun.serve
|
|
106
|
+
* has a port, and these are process-wide facts, not per-request ones.
|
|
107
|
+
*/
|
|
108
|
+
const runtime: { rootId?: string; port?: number; storeMode?: () => StoreMode } = {};
|
|
109
|
+
|
|
110
|
+
/** Bind what is known; the identity right after the listener binds, the store once it is attached. */
|
|
111
|
+
export function bindShellRuntime(facts: {
|
|
112
|
+
rootId?: string;
|
|
113
|
+
port?: number;
|
|
114
|
+
storeMode?: () => StoreMode;
|
|
115
|
+
}): void {
|
|
116
|
+
if (facts.rootId !== undefined) runtime.rootId = facts.rootId;
|
|
117
|
+
if (facts.port !== undefined) runtime.port = facts.port;
|
|
118
|
+
if (facts.storeMode !== undefined) runtime.storeMode = facts.storeMode;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function defaultAttest(): AttestFacts | null {
|
|
122
|
+
const key = bootAttestKey();
|
|
123
|
+
if (!key || !runtime.rootId || !runtime.port) return null;
|
|
124
|
+
return { key, rootId: runtime.rootId, port: runtime.port };
|
|
58
125
|
}
|
|
59
126
|
|
|
60
127
|
const json = (status: number, body: unknown) =>
|
|
@@ -70,7 +137,7 @@ export function tokenMatches(got: string | null, want: string): boolean {
|
|
|
70
137
|
|
|
71
138
|
const LIVE_JOB = new Set(['queued', 'running']);
|
|
72
139
|
|
|
73
|
-
/** The four counts. Each source failing reads as 0 — a probe must never throw. */
|
|
140
|
+
/** The four counts (+ the store mode). Each source failing reads as 0 — a probe must never throw. */
|
|
74
141
|
export function shellStatus(deps: ShellRouteDeps): ShellStatus {
|
|
75
142
|
const count = (fn: () => number) => {
|
|
76
143
|
try {
|
|
@@ -85,6 +152,12 @@ export function shellStatus(deps: ShellRouteDeps): ShellStatus {
|
|
|
85
152
|
const terminalRuns = count(
|
|
86
153
|
() => deps.runs?.openRuns().filter((r) => r.actor !== 'maude-chat').length ?? 0
|
|
87
154
|
);
|
|
155
|
+
let storeMode: StoreMode | undefined;
|
|
156
|
+
try {
|
|
157
|
+
storeMode = (deps.storeMode ?? (() => runtime.storeMode?.()))();
|
|
158
|
+
} catch {
|
|
159
|
+
storeMode = undefined;
|
|
160
|
+
}
|
|
88
161
|
return {
|
|
89
162
|
version: (deps.version ?? resolveMaudeVersion)(),
|
|
90
163
|
ai: {
|
|
@@ -105,6 +178,7 @@ export function shellStatus(deps: ShellRouteDeps): ShellStatus {
|
|
|
105
178
|
LIVE_JOB.has(j.status ?? '')
|
|
106
179
|
).length
|
|
107
180
|
),
|
|
181
|
+
...(storeMode ? { storeMode } : {}),
|
|
108
182
|
};
|
|
109
183
|
}
|
|
110
184
|
|
|
@@ -116,7 +190,125 @@ function safeActivity(deps: ShellRouteDeps): ChatActivity[] {
|
|
|
116
190
|
}
|
|
117
191
|
}
|
|
118
192
|
|
|
193
|
+
/** The deps the live route table was built with (the yield watcher counts with them). */
|
|
194
|
+
let liveDeps: ShellRouteDeps | null = null;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* #206 — what a CLI-role server finishes before it steps down (shell/cli-yield.ts): live export +
|
|
198
|
+
* generation jobs and unsent work. 0 before the route table exists.
|
|
199
|
+
*/
|
|
200
|
+
export function shellPendingWork(): number {
|
|
201
|
+
if (!liveDeps) return 0;
|
|
202
|
+
const s = shellStatus(liveDeps);
|
|
203
|
+
return s.jobs + s.unsent;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const fromBrowser = (req: Request) =>
|
|
207
|
+
req.headers.has('origin') || req.headers.has('sec-fetch-site');
|
|
208
|
+
|
|
209
|
+
/** The shell-token gates `/_api/shell/status` applies, in its order (404 · 403 · 401); null = the shell. */
|
|
210
|
+
function shellGate(req: Request, deps: ShellRouteDeps): Response | null {
|
|
211
|
+
const want = (deps.token ?? (() => process.env.MAUDE_SHELL_TOKEN))();
|
|
212
|
+
if (!want) return new Response('Not found', { status: 404 });
|
|
213
|
+
if (fromBrowser(req)) return json(403, { error: 'browser-refused' });
|
|
214
|
+
if (!tokenMatches(req.headers.get(SHELL_TOKEN_HEADER), want))
|
|
215
|
+
return json(401, { error: 'shell-token' });
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const refused = (r: Refusal) =>
|
|
220
|
+
json(r.status, { error: r.error, ...(r.message ? { message: r.message } : {}) });
|
|
221
|
+
|
|
222
|
+
/** The body, aborted past `max` (a content-length that says more is refused before any read). */
|
|
223
|
+
async function readCapped(req: Request, max: number): Promise<Uint8Array | null> {
|
|
224
|
+
const cl = Number(req.headers.get('content-length'));
|
|
225
|
+
if (Number.isFinite(cl) && cl > max) return null;
|
|
226
|
+
if (!req.body) return new Uint8Array(0);
|
|
227
|
+
const reader = req.body.getReader();
|
|
228
|
+
const chunks: Uint8Array[] = [];
|
|
229
|
+
let size = 0;
|
|
230
|
+
for (;;) {
|
|
231
|
+
const { done, value } = await reader.read();
|
|
232
|
+
if (done) break;
|
|
233
|
+
size += value.byteLength;
|
|
234
|
+
if (size > max) {
|
|
235
|
+
await reader.cancel().catch(() => {});
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
chunks.push(value);
|
|
239
|
+
}
|
|
240
|
+
const out = new Uint8Array(size);
|
|
241
|
+
let at = 0;
|
|
242
|
+
for (const c of chunks) {
|
|
243
|
+
out.set(c, at);
|
|
244
|
+
at += c.byteLength;
|
|
245
|
+
}
|
|
246
|
+
return out;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* #122 (122-C) — the three clip routes the desktop shell carries a clip between two project servers with
|
|
251
|
+
* (shell/clip-transfer.ts has the rules). Same gates as `/_api/shell/status`; main origin only, in neither
|
|
252
|
+
* canvas allowlist; a server with no design root wired answers 404 like one with no shell.
|
|
253
|
+
*/
|
|
254
|
+
function clipRoutes(deps: ShellRouteDeps): RouteSpec[] {
|
|
255
|
+
const root = () => deps.designRoot;
|
|
256
|
+
return [
|
|
257
|
+
{
|
|
258
|
+
method: 'GET',
|
|
259
|
+
path: '/_api/shell/clip-export',
|
|
260
|
+
origin: 'main',
|
|
261
|
+
readOnly: 'allowed',
|
|
262
|
+
handle: (req) => {
|
|
263
|
+
const gate = shellGate(req, deps);
|
|
264
|
+
if (gate) return gate;
|
|
265
|
+
const designRoot = root();
|
|
266
|
+
if (!designRoot) return new Response('Not found', { status: 404 });
|
|
267
|
+
const out = exportForShell(new URL(req.url).searchParams.get('id') ?? '', designRoot);
|
|
268
|
+
return out.ok ? json(200, out.body) : refused(out);
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
method: 'GET',
|
|
273
|
+
path: '/_api/shell/clip-asset',
|
|
274
|
+
origin: 'main',
|
|
275
|
+
readOnly: 'allowed',
|
|
276
|
+
handle: (req) => {
|
|
277
|
+
const gate = shellGate(req, deps);
|
|
278
|
+
if (gate) return gate;
|
|
279
|
+
const designRoot = root();
|
|
280
|
+
if (!designRoot) return new Response('Not found', { status: 404 });
|
|
281
|
+
const q = new URL(req.url).searchParams;
|
|
282
|
+
const abs = assetForShell(q.get('id') ?? '', q.get('rel') ?? '', designRoot);
|
|
283
|
+
if (!abs) return json(404, { error: 'gone', message: CLIP_GONE });
|
|
284
|
+
return new Response(Bun.file(abs), {
|
|
285
|
+
headers: { 'Content-Type': 'application/octet-stream', 'Cache-Control': 'no-store' },
|
|
286
|
+
});
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
method: 'POST',
|
|
291
|
+
path: '/_api/shell/clip-import',
|
|
292
|
+
origin: 'main',
|
|
293
|
+
readOnly: 'refused',
|
|
294
|
+
handle: async (req) => {
|
|
295
|
+
const gate = shellGate(req, deps);
|
|
296
|
+
if (gate) return gate;
|
|
297
|
+
const designRoot = root();
|
|
298
|
+
if (!designRoot) return new Response('Not found', { status: 404 });
|
|
299
|
+
const buf = await readCapped(req, CLIP_FRAME_MAX_BYTES);
|
|
300
|
+
if (!buf) return json(413, { error: 'too-big', message: CLIP_TOO_BIG });
|
|
301
|
+
const frame = parseFrame(buf);
|
|
302
|
+
if (!frame) return json(400, { error: 'invalid' });
|
|
303
|
+
const out = importFromShell(frame, designRoot);
|
|
304
|
+
return out.ok ? json(200, { handle: out.handle }) : refused(out);
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
];
|
|
308
|
+
}
|
|
309
|
+
|
|
119
310
|
export function createShellRoutes(deps: ShellRouteDeps): RouteSpec[] {
|
|
311
|
+
liveDeps = deps;
|
|
120
312
|
return [
|
|
121
313
|
{
|
|
122
314
|
method: 'GET',
|
|
@@ -126,12 +318,32 @@ export function createShellRoutes(deps: ShellRouteDeps): RouteSpec[] {
|
|
|
126
318
|
handle: (req) => {
|
|
127
319
|
const want = (deps.token ?? (() => process.env.MAUDE_SHELL_TOKEN))();
|
|
128
320
|
if (!want) return new Response('Not found', { status: 404 });
|
|
129
|
-
if (req
|
|
130
|
-
return json(403, { error: 'browser-refused' });
|
|
321
|
+
if (fromBrowser(req)) return json(403, { error: 'browser-refused' });
|
|
131
322
|
if (!tokenMatches(req.headers.get(SHELL_TOKEN_HEADER), want))
|
|
132
323
|
return json(401, { error: 'shell-token' });
|
|
133
324
|
return json(200, shellStatus(deps));
|
|
134
325
|
},
|
|
135
326
|
},
|
|
327
|
+
{
|
|
328
|
+
method: 'GET',
|
|
329
|
+
path: '/_api/shell/attest',
|
|
330
|
+
origin: 'main',
|
|
331
|
+
readOnly: 'allowed',
|
|
332
|
+
handle: (req) => {
|
|
333
|
+
let facts: AttestFacts | null = null;
|
|
334
|
+
try {
|
|
335
|
+
facts = (deps.attest ?? defaultAttest)();
|
|
336
|
+
} catch {
|
|
337
|
+
facts = null;
|
|
338
|
+
}
|
|
339
|
+
if (!facts) return new Response('Not found', { status: 404 });
|
|
340
|
+
if (fromBrowser(req)) return json(403, { error: 'browser-refused' });
|
|
341
|
+
const all = new URL(req.url).searchParams.getAll('n');
|
|
342
|
+
const n = all.length === 1 ? all[0] : '';
|
|
343
|
+
if (!n || !ATTEST_NONCE_RE.test(n)) return json(400, { error: 'nonce' });
|
|
344
|
+
return json(200, { mac: attestMac(facts.key, n, facts.rootId, facts.port) });
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
...clipRoutes(deps),
|
|
136
348
|
];
|
|
137
349
|
}
|
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
// POST /_api/sync/resync → { ok, sync, resync? } · 409 busy · 200 { ok:false, reason } when there
|
|
4
4
|
// is nothing to restart · 403 { ok:false, reason, detail } at the gates
|
|
5
5
|
// GET /_api/sync/code-consent → { consent: CodeConsentView | null } (fix/207)
|
|
6
|
+
// GET /_api/sync/unsynced-refs → { linked, syncFiles, canvases, refs[] } (#158: the files a canvas
|
|
7
|
+
// uses that will not reach the workspace, each with its reason; a disk read)
|
|
6
8
|
// POST /_api/sync/code-consent/set { allow } → { ok, consent } · 403 window-only / read-only ·
|
|
7
9
|
// 409 not-linked / not-signed-in / cell
|
|
8
|
-
// POST /_api/sync/held-deletes { answer: delete|keep, folder
|
|
9
|
-
// window-only / read-only / not-owner · 409 not-linked / nothing-held / busy
|
|
10
|
+
// POST /_api/sync/held-deletes { answer: delete|keep|remove-here|keep-here, folder?, digest } → { ok, how, count } · 403
|
|
11
|
+
// window-only / read-only / not-owner · 409 not-linked / nothing-held / busy / changed
|
|
12
|
+
// POST /_api/sync/adopt-held { path, sha256 } → { ok } · 403 window-only / read-only / not-owner ·
|
|
13
|
+
// 409 not-linked / not-held / changed / update / unreachable (#167 T5.3,
|
|
14
|
+
// the hub decides; it adopts only the version `sha256` names)
|
|
10
15
|
//
|
|
11
16
|
// MAIN ORIGIN ONLY (never `origin: 'canvas'`): resync re-handshakes every document against the
|
|
12
17
|
// person's own hub and re-runs a whole-project comparison — an amplification primitive a canvas must
|
|
@@ -26,10 +31,13 @@
|
|
|
26
31
|
|
|
27
32
|
import { currentAccess, notInScopeResponse } from '../access/request.ts';
|
|
28
33
|
import type { Access } from '../access/scope.ts';
|
|
34
|
+
import { worktreeOf } from '../shell/worktree.ts';
|
|
35
|
+
import { ADOPT_UPDATE, type AdoptHeldControl, SHA256_HEX } from '../sync/adopt-held.ts';
|
|
29
36
|
import type { CodeConsentControl } from '../sync/code-module-consent.ts';
|
|
30
37
|
import type { HeldDeletesControl } from '../sync/held-deletes.ts';
|
|
31
38
|
import type { LinkGate } from '../sync/link-consent.ts';
|
|
32
39
|
import type { ResyncTrace } from '../sync/resync-trace.ts';
|
|
40
|
+
import { unsyncedRefsOnDisk } from '../sync/unsynced-refs.ts';
|
|
33
41
|
import type { RouteSpec } from './table.ts';
|
|
34
42
|
|
|
35
43
|
/** The slice of `ctx.syncControl` (sync/supervisor.ts SyncSupervisor) this route calls. */
|
|
@@ -44,6 +52,7 @@ export interface SyncControlLike {
|
|
|
44
52
|
interface ConsentRuntime {
|
|
45
53
|
codeConsent?(): CodeConsentControl | null;
|
|
46
54
|
heldDeletes?(): HeldDeletesControl | null;
|
|
55
|
+
adoptHeld?(): AdoptHeldControl | null;
|
|
47
56
|
pullRemoteNow?(): Promise<void>;
|
|
48
57
|
}
|
|
49
58
|
const consentRuntime = (c: SyncControlLike | null | undefined): ConsentRuntime | null => {
|
|
@@ -63,6 +72,13 @@ export interface SyncRouteDeps {
|
|
|
63
72
|
link?: LinkGate;
|
|
64
73
|
/** This request's session (default `currentAccess()`). */
|
|
65
74
|
access?: () => Access;
|
|
75
|
+
/** #158 — the design root `GET /_api/sync/unsynced-refs` reads; absent = nothing to check. */
|
|
76
|
+
designRoot?: string;
|
|
77
|
+
/**
|
|
78
|
+
* #206 §5 — the main project's name when this server serves a worktree tab (`shell/worktree.ts`,
|
|
79
|
+
* default: from the env the app spawned it with). A worktree is never linked.
|
|
80
|
+
*/
|
|
81
|
+
worktreeOf?: () => string | null;
|
|
66
82
|
}
|
|
67
83
|
|
|
68
84
|
const json = (status: number, body: unknown) =>
|
|
@@ -88,6 +104,7 @@ export function resyncRefusal(
|
|
|
88
104
|
|
|
89
105
|
export function createSyncRoutes(deps: SyncRouteDeps): RouteSpec[] {
|
|
90
106
|
const access = () => (deps.access ?? currentAccess)();
|
|
107
|
+
const worktree = () => (deps.worktreeOf ?? worktreeOf)();
|
|
91
108
|
return [
|
|
92
109
|
// gate-b-sec4 (M1) — a committed `linkedHub` this Mac never linked waits here; the Share sheet
|
|
93
110
|
// asks "This project says it syncs with <host>. Connect?". MAIN ORIGIN ONLY: a canvas never
|
|
@@ -98,10 +115,13 @@ export function createSyncRoutes(deps: SyncRouteDeps): RouteSpec[] {
|
|
|
98
115
|
origin: 'main',
|
|
99
116
|
readOnly: 'allowed',
|
|
100
117
|
// A project-class answer: a canvas-only session hears the missing-scope refusal (U3).
|
|
101
|
-
handle: async () =>
|
|
102
|
-
access().can('read', null)
|
|
103
|
-
|
|
104
|
-
|
|
118
|
+
handle: async () => {
|
|
119
|
+
if (!access().can('read', null)) return notInScopeResponse();
|
|
120
|
+
// #206 §5: a worktree tab says "Syncs from <main>" and offers no Connect.
|
|
121
|
+
const main = worktree();
|
|
122
|
+
if (main) return json(200, { pending: null, worktreeOf: main });
|
|
123
|
+
return json(200, { pending: deps.link?.pending() ?? null });
|
|
124
|
+
},
|
|
105
125
|
},
|
|
106
126
|
// Connect: record on THIS Mac that the folder's hub may receive this Mac's credential, then
|
|
107
127
|
// start syncing with exactly the parked value. Can edit and up (like Resync); a person's
|
|
@@ -147,6 +167,14 @@ export function createSyncRoutes(deps: SyncRouteDeps): RouteSpec[] {
|
|
|
147
167
|
message: 'Ask the owner to change this.',
|
|
148
168
|
});
|
|
149
169
|
}
|
|
170
|
+
const main = worktree();
|
|
171
|
+
if (main) {
|
|
172
|
+
return json(409, {
|
|
173
|
+
ok: false,
|
|
174
|
+
reason: 'worktree',
|
|
175
|
+
detail: `This folder syncs from ${main}. Connect ${main} instead.`,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
150
178
|
if (!deps.link) {
|
|
151
179
|
return json(409, {
|
|
152
180
|
ok: false,
|
|
@@ -173,6 +201,22 @@ export function createSyncRoutes(deps: SyncRouteDeps): RouteSpec[] {
|
|
|
173
201
|
return json(200, { consent: consent ? consent.view() : null });
|
|
174
202
|
},
|
|
175
203
|
},
|
|
204
|
+
// #158 — the files a canvas uses that will not reach the workspace. Sync details renders it as an
|
|
205
|
+
// issue row per canvas. A read of the disk against the sync set (sync/unsynced-refs.ts); it never
|
|
206
|
+
// changes what syncs. MAIN ORIGIN ONLY, project-class: a canvas-only session does not learn what
|
|
207
|
+
// else the project holds.
|
|
208
|
+
{
|
|
209
|
+
method: 'GET',
|
|
210
|
+
path: '/_api/sync/unsynced-refs',
|
|
211
|
+
origin: 'main',
|
|
212
|
+
readOnly: 'allowed',
|
|
213
|
+
handle: async () => {
|
|
214
|
+
if (!access().can('read', null)) return notInScopeResponse();
|
|
215
|
+
if (!deps.designRoot)
|
|
216
|
+
return json(200, { linked: false, syncFiles: true, canvases: 0, refs: [] });
|
|
217
|
+
return json(200, unsyncedRefsOnDisk(deps.designRoot));
|
|
218
|
+
},
|
|
219
|
+
},
|
|
176
220
|
// fix/207 — the person's answer: "Allow shared code from <host>" / "Stop allowing shared code".
|
|
177
221
|
// Code modules land OUTSIDE the sandboxed canvas origin — the agent and every `maude design *`
|
|
178
222
|
// helper read them (DDR-054) — so this is the same class of act as Connect: the person's, in the
|
|
@@ -296,7 +340,10 @@ export function createSyncRoutes(deps: SyncRouteDeps): RouteSpec[] {
|
|
|
296
340
|
const answer = (body as { answer?: unknown } | null)?.answer;
|
|
297
341
|
const folder = (body as { folder?: unknown } | null)?.folder ?? null;
|
|
298
342
|
if (
|
|
299
|
-
(answer !== 'delete' &&
|
|
343
|
+
(answer !== 'delete' &&
|
|
344
|
+
answer !== 'keep' &&
|
|
345
|
+
answer !== 'remove-here' &&
|
|
346
|
+
answer !== 'keep-here') ||
|
|
300
347
|
(folder !== null && (typeof folder !== 'string' || folder.length > 1024))
|
|
301
348
|
) {
|
|
302
349
|
return json(400, { ok: false, reason: 'bad-request', detail: 'Say delete or keep.' });
|
|
@@ -309,8 +356,89 @@ export function createSyncRoutes(deps: SyncRouteDeps): RouteSpec[] {
|
|
|
309
356
|
detail: 'This project isn’t syncing with a hub right now.',
|
|
310
357
|
});
|
|
311
358
|
}
|
|
312
|
-
|
|
359
|
+
// 2.1.1 T13 — the same card family for a batch the PROJECT deleted: `remove-here` files this
|
|
360
|
+
// Mac's copies into the trash in one pass, `keep-here` leaves them and never sends them back.
|
|
361
|
+
// 2.1.1 T8 / N4 — the set the person was shown, for every answer; a missing or stale one
|
|
362
|
+
// answers `changed` and nothing is applied
|
|
363
|
+
const digest =
|
|
364
|
+
typeof (body as { digest?: unknown } | null)?.digest === 'string'
|
|
365
|
+
? String((body as { digest: string }).digest).slice(0, 128)
|
|
366
|
+
: '';
|
|
367
|
+
const r =
|
|
368
|
+
answer === 'remove-here' || answer === 'keep-here'
|
|
369
|
+
? await control.answerIncoming(
|
|
370
|
+
answer === 'remove-here' ? 'remove' : 'keep',
|
|
371
|
+
folder as string | null,
|
|
372
|
+
digest
|
|
373
|
+
)
|
|
374
|
+
: await control.answer(answer, folder as string | null, digest);
|
|
375
|
+
if (r.ok) return json(200, r);
|
|
376
|
+
return json(r.reason === 'not-owner' ? 403 : 409, r);
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
// #167 T5.3 — Sync details › a file the hub holds back from the code lane: "Adopt as code"
|
|
380
|
+
// (`sync.adopt-as-code`). The owner's explicit act, so the held-deletes posture: window-only,
|
|
381
|
+
// Can edit, never canvas-safe, refused in a cell. The hub's own owner gate decides; this route
|
|
382
|
+
// only carries the path (the hub journals the bytes on its own disk).
|
|
383
|
+
{
|
|
384
|
+
method: 'POST',
|
|
385
|
+
path: '/_api/sync/adopt-held',
|
|
386
|
+
origin: 'main',
|
|
387
|
+
readOnly: 'refused',
|
|
388
|
+
refuse: (reason) => {
|
|
389
|
+
(deps.warn ?? ((m: string) => console.warn(m)))(
|
|
390
|
+
`[sync] ${reason} request to the adopt-held route — refused.`
|
|
391
|
+
);
|
|
392
|
+
return json(403, {
|
|
393
|
+
ok: false,
|
|
394
|
+
reason,
|
|
395
|
+
detail:
|
|
396
|
+
reason === 'cross-origin'
|
|
397
|
+
? 'Answer this from Maude itself, not from inside a canvas.'
|
|
398
|
+
: "Answer this from the Maude app or this machine's own browser tab.",
|
|
399
|
+
});
|
|
400
|
+
},
|
|
401
|
+
async handle(req) {
|
|
402
|
+
if (req.headers.get('sec-fetch-site') !== 'same-origin') {
|
|
403
|
+
return json(403, {
|
|
404
|
+
ok: false,
|
|
405
|
+
reason: 'window-only',
|
|
406
|
+
detail: 'Answer this in Sync details in the Maude window.',
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
if (!access().can('edit', null)) {
|
|
410
|
+
return json(403, {
|
|
411
|
+
error: 'read-only',
|
|
412
|
+
reason: 'not-allowed',
|
|
413
|
+
message: 'Ask the owner to change this.',
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
let body: unknown = null;
|
|
417
|
+
try {
|
|
418
|
+
body = await req.json();
|
|
419
|
+
} catch {
|
|
420
|
+
body = null;
|
|
421
|
+
}
|
|
422
|
+
const path = (body as { path?: unknown } | null)?.path;
|
|
423
|
+
if (typeof path !== 'string' || path.length === 0 || path.length > 1024) {
|
|
424
|
+
return json(400, { ok: false, reason: 'bad-request', detail: 'Name one held file.' });
|
|
425
|
+
}
|
|
426
|
+
// The version the person was shown: the hub adopts those bytes and no others.
|
|
427
|
+
const sha256 = (body as { sha256?: unknown } | null)?.sha256;
|
|
428
|
+
if (typeof sha256 !== 'string' || !SHA256_HEX.test(sha256)) {
|
|
429
|
+
return json(400, { ok: false, reason: 'bad-request', detail: ADOPT_UPDATE });
|
|
430
|
+
}
|
|
431
|
+
const control = consentRuntime(deps.control())?.adoptHeld?.() ?? null;
|
|
432
|
+
if (!control) {
|
|
433
|
+
return json(409, {
|
|
434
|
+
ok: false,
|
|
435
|
+
reason: 'not-linked',
|
|
436
|
+
detail: 'This project isn’t syncing with a hub right now.',
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
const r = await control.adopt(path, sha256);
|
|
313
440
|
if (r.ok) return json(200, r);
|
|
441
|
+
if (r.reason === 'bad-request') return json(400, r);
|
|
314
442
|
return json(r.reason === 'not-owner' ? 403 : 409, r);
|
|
315
443
|
},
|
|
316
444
|
},
|
|
@@ -435,7 +435,8 @@ export function createVoteRoutes(deps: VoteRouteDeps): RouteSpec[] {
|
|
|
435
435
|
: hubRefusal(one.r);
|
|
436
436
|
let row = one.row;
|
|
437
437
|
if (row.state !== 'ended') {
|
|
438
|
-
|
|
438
|
+
// the hub reads a JSON object from every vote POST and answers `invalid` without one
|
|
439
|
+
const r = await hub(home, 'POST', `votes/${encodeURIComponent(id)}/end`, {});
|
|
439
440
|
const ended = r.status === 200 ? asRow(r.json?.vote) : null;
|
|
440
441
|
if (ended) row = ended;
|
|
441
442
|
else if (r.status === 409) {
|
|
@@ -61,6 +61,9 @@
|
|
|
61
61
|
{
|
|
62
62
|
"$ref": "#/$defs/el-ballot"
|
|
63
63
|
},
|
|
64
|
+
{
|
|
65
|
+
"$ref": "#/$defs/el-checkitem"
|
|
66
|
+
},
|
|
64
67
|
{
|
|
65
68
|
"$ref": "#/$defs/unknown"
|
|
66
69
|
}
|
|
@@ -93,7 +96,8 @@
|
|
|
93
96
|
"section",
|
|
94
97
|
"stamp",
|
|
95
98
|
"vote",
|
|
96
|
-
"ballot"
|
|
99
|
+
"ballot",
|
|
100
|
+
"checkitem"
|
|
97
101
|
]
|
|
98
102
|
}
|
|
99
103
|
},
|
|
@@ -2298,6 +2302,144 @@
|
|
|
2298
2302
|
}
|
|
2299
2303
|
},
|
|
2300
2304
|
"additionalProperties": false
|
|
2305
|
+
},
|
|
2306
|
+
"el-checkitem": {
|
|
2307
|
+
"type": "object",
|
|
2308
|
+
"required": ["id", "type", "index", "list"],
|
|
2309
|
+
"properties": {
|
|
2310
|
+
"id": {
|
|
2311
|
+
"type": "string",
|
|
2312
|
+
"minLength": 1,
|
|
2313
|
+
"maxLength": 64,
|
|
2314
|
+
"pattern": "^[A-Za-z0-9_-]{1,64}$"
|
|
2315
|
+
},
|
|
2316
|
+
"type": {
|
|
2317
|
+
"const": "checkitem"
|
|
2318
|
+
},
|
|
2319
|
+
"parent": {
|
|
2320
|
+
"type": "string",
|
|
2321
|
+
"minLength": 1,
|
|
2322
|
+
"maxLength": 64,
|
|
2323
|
+
"pattern": "^[A-Za-z0-9_-]{1,64}$"
|
|
2324
|
+
},
|
|
2325
|
+
"index": {
|
|
2326
|
+
"type": "string",
|
|
2327
|
+
"minLength": 1,
|
|
2328
|
+
"maxLength": 64,
|
|
2329
|
+
"pattern": "^[0-9A-Za-z]{1,64}$"
|
|
2330
|
+
},
|
|
2331
|
+
"list": {
|
|
2332
|
+
"type": "string",
|
|
2333
|
+
"minLength": 1,
|
|
2334
|
+
"maxLength": 64,
|
|
2335
|
+
"pattern": "^[A-Za-z0-9_-]{1,64}$"
|
|
2336
|
+
},
|
|
2337
|
+
"text": {
|
|
2338
|
+
"type": "string",
|
|
2339
|
+
"maxLength": 2000
|
|
2340
|
+
},
|
|
2341
|
+
"done": {
|
|
2342
|
+
"type": "object",
|
|
2343
|
+
"required": ["by", "at"],
|
|
2344
|
+
"properties": {
|
|
2345
|
+
"by": {
|
|
2346
|
+
"type": "string",
|
|
2347
|
+
"minLength": 1,
|
|
2348
|
+
"maxLength": 64
|
|
2349
|
+
},
|
|
2350
|
+
"at": {
|
|
2351
|
+
"type": "string",
|
|
2352
|
+
"minLength": 1,
|
|
2353
|
+
"maxLength": 32,
|
|
2354
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,3})?Z$"
|
|
2355
|
+
}
|
|
2356
|
+
},
|
|
2357
|
+
"additionalProperties": false
|
|
2358
|
+
},
|
|
2359
|
+
"groups": {
|
|
2360
|
+
"type": "array",
|
|
2361
|
+
"maxItems": 16,
|
|
2362
|
+
"uniqueItems": true,
|
|
2363
|
+
"items": {
|
|
2364
|
+
"type": "string",
|
|
2365
|
+
"minLength": 1,
|
|
2366
|
+
"maxLength": 64,
|
|
2367
|
+
"pattern": "^[A-Za-z0-9_-]{1,64}$"
|
|
2368
|
+
}
|
|
2369
|
+
},
|
|
2370
|
+
"author": {
|
|
2371
|
+
"type": "object",
|
|
2372
|
+
"required": ["kind"],
|
|
2373
|
+
"properties": {
|
|
2374
|
+
"kind": {
|
|
2375
|
+
"type": "string",
|
|
2376
|
+
"enum": ["ai", "human"]
|
|
2377
|
+
},
|
|
2378
|
+
"name": {
|
|
2379
|
+
"type": "string",
|
|
2380
|
+
"minLength": 1,
|
|
2381
|
+
"maxLength": 64
|
|
2382
|
+
},
|
|
2383
|
+
"id": {
|
|
2384
|
+
"type": "string",
|
|
2385
|
+
"minLength": 1,
|
|
2386
|
+
"maxLength": 64
|
|
2387
|
+
}
|
|
2388
|
+
},
|
|
2389
|
+
"additionalProperties": false
|
|
2390
|
+
},
|
|
2391
|
+
"locked": {
|
|
2392
|
+
"type": "boolean"
|
|
2393
|
+
},
|
|
2394
|
+
"parentArtboard": {
|
|
2395
|
+
"type": "string",
|
|
2396
|
+
"minLength": 1,
|
|
2397
|
+
"maxLength": 128,
|
|
2398
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$"
|
|
2399
|
+
},
|
|
2400
|
+
"source": {
|
|
2401
|
+
"type": "object",
|
|
2402
|
+
"required": ["kind"],
|
|
2403
|
+
"properties": {
|
|
2404
|
+
"kind": {
|
|
2405
|
+
"type": "string",
|
|
2406
|
+
"minLength": 1,
|
|
2407
|
+
"maxLength": 32,
|
|
2408
|
+
"pattern": "^[a-z][a-z0-9-]{0,31}$"
|
|
2409
|
+
},
|
|
2410
|
+
"author": {
|
|
2411
|
+
"type": "string",
|
|
2412
|
+
"minLength": 1,
|
|
2413
|
+
"maxLength": 64
|
|
2414
|
+
}
|
|
2415
|
+
},
|
|
2416
|
+
"additionalProperties": false
|
|
2417
|
+
},
|
|
2418
|
+
"timeRange": {
|
|
2419
|
+
"type": "object",
|
|
2420
|
+
"required": ["artboard", "start", "end"],
|
|
2421
|
+
"properties": {
|
|
2422
|
+
"artboard": {
|
|
2423
|
+
"type": "string",
|
|
2424
|
+
"minLength": 1,
|
|
2425
|
+
"maxLength": 128,
|
|
2426
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$"
|
|
2427
|
+
},
|
|
2428
|
+
"start": {
|
|
2429
|
+
"type": "number",
|
|
2430
|
+
"minimum": 0,
|
|
2431
|
+
"maximum": 86400
|
|
2432
|
+
},
|
|
2433
|
+
"end": {
|
|
2434
|
+
"type": "number",
|
|
2435
|
+
"minimum": 0,
|
|
2436
|
+
"maximum": 86400
|
|
2437
|
+
}
|
|
2438
|
+
},
|
|
2439
|
+
"additionalProperties": false
|
|
2440
|
+
}
|
|
2441
|
+
},
|
|
2442
|
+
"additionalProperties": false
|
|
2301
2443
|
}
|
|
2302
2444
|
}
|
|
2303
2445
|
}
|