@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
|
@@ -10,7 +10,15 @@
|
|
|
10
10
|
// MAIN ORIGIN ONLY (DDR-088): never in `CANVAS_SAFE_API`, never in the `startCanvasServer` routes
|
|
11
11
|
// map — test/agent-routes-origin.test.ts pins both lists.
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { createHash } from 'node:crypto';
|
|
14
|
+
import {
|
|
15
|
+
existsSync,
|
|
16
|
+
mkdirSync,
|
|
17
|
+
readFileSync,
|
|
18
|
+
realpathSync,
|
|
19
|
+
statSync,
|
|
20
|
+
writeFileSync,
|
|
21
|
+
} from 'node:fs';
|
|
14
22
|
import path from 'node:path';
|
|
15
23
|
import { parseSync } from 'oxc-parser';
|
|
16
24
|
import { designWritesSince } from '../../../cli/lib/bash-guard.mjs';
|
|
@@ -33,9 +41,10 @@ import {
|
|
|
33
41
|
import type { RunRecord } from '../ai/run-lifecycle.ts';
|
|
34
42
|
import type { RunRegistry } from '../ai/runs.ts';
|
|
35
43
|
import { saveHold } from '../ai/save-hold.ts';
|
|
36
|
-
import { claimedSince } from '../ai/write-claim.ts';
|
|
44
|
+
import { CLAIM_MAX_BYTES, claimedSince } from '../ai/write-claim.ts';
|
|
37
45
|
import { artboardIdsOfSource, checkFile, checkIntroduced, type Finding } from '../check/index.ts';
|
|
38
46
|
import { checkIds, walkIdElements } from '../element-ids.ts';
|
|
47
|
+
import { MAX_ANNOTATIONS_BYTES, MAX_HTML_BYTES, MAX_META_BYTES } from '../sync/limits.ts';
|
|
39
48
|
import type { RouteSpec } from './table.ts';
|
|
40
49
|
|
|
41
50
|
/** A person's hold on an element (A10: the awareness `holding` field, foreign and local). */
|
|
@@ -59,7 +68,7 @@ export interface AgentRouteDeps {
|
|
|
59
68
|
/** §5.4 edit/check `read-only`: this session may not write the project (role / format gate) */
|
|
60
69
|
readOnly?: () => boolean;
|
|
61
70
|
/** run lifecycle side effects (beginAiAction / ai-activity until V2-1.15) */
|
|
62
|
-
bracket?: RunBracket;
|
|
71
|
+
bracket?: RunBracket & SettleBracket;
|
|
63
72
|
/** the run registry; one is created per table when absent */
|
|
64
73
|
runs?: AgentRuns;
|
|
65
74
|
/**
|
|
@@ -79,11 +88,33 @@ export interface AgentRouteDeps {
|
|
|
79
88
|
) => { runId: string } | null;
|
|
80
89
|
}
|
|
81
90
|
|
|
91
|
+
/**
|
|
92
|
+
* #164 — POST /_api/agent/bash/settle's side effect (ai/write-claim.ts `hookClaims.settle`): claim the
|
|
93
|
+
* call's post-call bytes the studio re-read (`changed`, design-root-relative; `text` null = deleted)
|
|
94
|
+
* for run `run`, then settle the call — its parked writes join the run or go out as outside.
|
|
95
|
+
*/
|
|
96
|
+
export interface SettleBracket {
|
|
97
|
+
/** F5 / F6 — run `run`'s window for call `call` (design-root-relative paths), or null: no window. */
|
|
98
|
+
scope?(
|
|
99
|
+
run: { run: string },
|
|
100
|
+
call: string
|
|
101
|
+
): { all: boolean; covers(rel: string): boolean; left(rel: string): boolean } | null;
|
|
102
|
+
settle?(
|
|
103
|
+
run: { run: string; label: string | null },
|
|
104
|
+
call: string,
|
|
105
|
+
changed: ReadonlyArray<{ rel: string; text: string | null }>,
|
|
106
|
+
/** false = the hook sends more batches of this call (`more: true`): claim and settle at the last */
|
|
107
|
+
final?: boolean
|
|
108
|
+
): { ok: boolean; code?: string };
|
|
109
|
+
}
|
|
110
|
+
|
|
82
111
|
/** POST /_api/agent/write/claim — at most this many files per call, this many bytes in all. */
|
|
83
112
|
export const CLAIM_MAX_FILES = 32;
|
|
84
|
-
export
|
|
85
|
-
|
|
86
|
-
|
|
113
|
+
export { CLAIM_MAX_BYTES };
|
|
114
|
+
|
|
115
|
+
/** The canvas lanes a claim may name: a canvas source (#164: `.jsx` too), its sidecar, its board. */
|
|
116
|
+
const CLAIM_LANE_RE = /\.(?:tsx|jsx|meta\.json|annotations\.json)$/i;
|
|
117
|
+
const SHA256_RE = /^[0-9a-f]{64}$/;
|
|
87
118
|
|
|
88
119
|
const json = (status: number, body: unknown) =>
|
|
89
120
|
Response.json(body, { status, headers: { 'Cache-Control': 'no-store' } });
|
|
@@ -464,6 +495,31 @@ function readDesignFile(deps: AgentRouteDeps, rel: string): string | null {
|
|
|
464
495
|
}
|
|
465
496
|
}
|
|
466
497
|
|
|
498
|
+
/** D6 — the most a lane file may hold (sync/limits.ts): a bigger one is never read for a claim. */
|
|
499
|
+
const laneCap = (rel: string) =>
|
|
500
|
+
/\.meta\.json$/i.test(rel)
|
|
501
|
+
? MAX_META_BYTES
|
|
502
|
+
: /\.annotations\.json$/i.test(rel)
|
|
503
|
+
? MAX_ANNOTATIONS_BYTES
|
|
504
|
+
: MAX_HTML_BYTES;
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* A design file's bytes (inside the design root, symlinks resolved), or null. `max`: stat first and
|
|
508
|
+
* refuse a file bigger than that without reading it (D6).
|
|
509
|
+
*/
|
|
510
|
+
function readDesignBytes(deps: AgentRouteDeps, rel: string, max = Infinity): Buffer | null {
|
|
511
|
+
const designRoot = path.join(deps.repoRoot, deps.designRel);
|
|
512
|
+
try {
|
|
513
|
+
const real = realpathSync(path.join(designRoot, rel));
|
|
514
|
+
if (!real.startsWith(realpathSync(designRoot) + path.sep)) return null;
|
|
515
|
+
const st = statSync(real);
|
|
516
|
+
if (!st.isFile() || st.size > max) return null;
|
|
517
|
+
return readFileSync(real);
|
|
518
|
+
} catch {
|
|
519
|
+
return null;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
467
523
|
/** What the tool will write, from the current bytes + the hook's `edit`. null = can't tell. */
|
|
468
524
|
function applyToolEdit(before: string | null, edit: unknown): string | null {
|
|
469
525
|
if (!edit || typeof edit !== 'object') return null;
|
|
@@ -865,7 +921,13 @@ function hookRouteSpecs(deps: AgentRouteDeps): RouteSpec[] {
|
|
|
865
921
|
return bad('snapshot is a run snapshot under _runs/');
|
|
866
922
|
const text = readDesignFile(deps, rel);
|
|
867
923
|
if (text === null) return json(404, { error: `no file ${rel}`, code: 'not-found' });
|
|
868
|
-
|
|
924
|
+
let against = typeof b.snapshot === 'string' ? readDesignFile(deps, b.snapshot) : null;
|
|
925
|
+
// #168 E1: the hook sent the hash of the snapshot bytes it verified. Bytes that differ now were
|
|
926
|
+
// swapped since: never `against` (the file is then checked as a new one — every finding counts).
|
|
927
|
+
if (against !== null && typeof b.snapshotSha === 'string' && SHA256_RE.test(b.snapshotSha)) {
|
|
928
|
+
if (createHash('sha256').update(against, 'utf8').digest('hex') !== b.snapshotSha)
|
|
929
|
+
against = null;
|
|
930
|
+
}
|
|
869
931
|
// S3.5 — a sidecar's Present ids are checked against its canvas's artboards.
|
|
870
932
|
const srcRel = rel.endsWith('.meta.json') ? rel.replace(/\.meta\.json$/, '.tsx') : null;
|
|
871
933
|
const src = srcRel ? readDesignFile(deps, srcRel) : null;
|
|
@@ -916,7 +978,8 @@ function hookRouteSpecs(deps: AgentRouteDeps): RouteSpec[] {
|
|
|
916
978
|
}),
|
|
917
979
|
// p8-a1-claims — a Bash call that cannot claim its writes (S7 interpreter, a terminal-lane verb)
|
|
918
980
|
// opens / closes its window, for the canvases its command names (cli/lib/bash-guard.mjs
|
|
919
|
-
// `namedDesignFiles`).
|
|
981
|
+
// `namedDesignFiles`). #164 — the window only PARKS those canvases' unclaimed writes; they join
|
|
982
|
+
// the run only when the call's settle (bash/settle, below) claims their bytes.
|
|
920
983
|
spec({ path: '/_api/agent/bash/window' }, (b) => {
|
|
921
984
|
const session = key(b, 'session');
|
|
922
985
|
const toolUseId = key(b, 'toolUseId');
|
|
@@ -937,7 +1000,7 @@ function hookRouteSpecs(deps: AgentRouteDeps): RouteSpec[] {
|
|
|
937
1000
|
}
|
|
938
1001
|
if (b.all !== undefined && typeof b.all !== 'boolean') return bad('all is a boolean');
|
|
939
1002
|
// p8-sec2-attrib A1 — a call that may write but names no canvas (a glob, `find -exec`, a computed
|
|
940
|
-
// name):
|
|
1003
|
+
// name): its window parks outside writes on EVERY canvas while it runs (#164). No hold — a person’s
|
|
941
1004
|
// save lands at once as theirs, and the call's end binds only the bytes it changed.
|
|
942
1005
|
const all = b.all === true;
|
|
943
1006
|
const self = runs.get(session, chat);
|
|
@@ -953,6 +1016,122 @@ function hookRouteSpecs(deps: AgentRouteDeps): RouteSpec[] {
|
|
|
953
1016
|
deps.bracket?.window?.(self, toolUseId, b.open, files, all);
|
|
954
1017
|
return json(200, { window: true });
|
|
955
1018
|
}),
|
|
1019
|
+
// #164 T5.1 — a Bash call that could not claim ends: the design hook diffed its pre/post lane
|
|
1020
|
+
// snapshot and sends what changed with the sha256 of the post-call bytes. The studio re-reads each
|
|
1021
|
+
// file; bytes still on disk (sha equal) and not a person's landed save are CLAIMED for the session's
|
|
1022
|
+
// run, then the call settles (sync/action-stage.ts `settleShellCall`): what its window parked joins
|
|
1023
|
+
// the run when its bytes are claimed, everything else lands as outside. A hook route: non-browser
|
|
1024
|
+
// only (`hookBody`), main origin only, never in a canvas allowlist. An older studio answers 404 and
|
|
1025
|
+
// the hook falls back to `edit/touched {via:'bash'}`.
|
|
1026
|
+
spec({ path: '/_api/agent/bash/settle' }, (b) => {
|
|
1027
|
+
const session = key(b, 'session');
|
|
1028
|
+
const toolUseId = key(b, 'toolUseId');
|
|
1029
|
+
if (!session || !toolUseId) return bad('session and toolUseId are hook keys');
|
|
1030
|
+
const chat = chatOf(b);
|
|
1031
|
+
if (chat === undefined) return bad(BAD_CHAT);
|
|
1032
|
+
if (!Array.isArray(b.changed))
|
|
1033
|
+
return bad('changed is a list of {path, sha, created?, deleted?}');
|
|
1034
|
+
if (b.changed.length > CLAIM_MAX_FILES)
|
|
1035
|
+
return bad(`changed is at most ${CLAIM_MAX_FILES} files: send the rest in another batch`);
|
|
1036
|
+
const entries: Array<{ rel: string; sha: string | null; deleted: boolean }> = [];
|
|
1037
|
+
for (const raw of b.changed as unknown[]) {
|
|
1038
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
1039
|
+
return bad('changed is a list of {path, sha, created?, deleted?}');
|
|
1040
|
+
const e = raw as Record<string, unknown>;
|
|
1041
|
+
const rel = designPathRel(e.path);
|
|
1042
|
+
if (!rel || !CLAIM_LANE_RE.test(rel) || isRuntimeRel(rel))
|
|
1043
|
+
return bad(
|
|
1044
|
+
'path is a canvas, its .meta.json or its .annotations.json in the design root'
|
|
1045
|
+
);
|
|
1046
|
+
if (e.sha !== null && (typeof e.sha !== 'string' || !SHA256_RE.test(e.sha)))
|
|
1047
|
+
return bad('sha is the sha256 (hex) of the post-call bytes, or null');
|
|
1048
|
+
for (const f of ['created', 'deleted'] as const)
|
|
1049
|
+
if (e[f] !== undefined && typeof e[f] !== 'boolean') return bad(`${f} is a boolean`);
|
|
1050
|
+
entries.push({ rel, sha: e.sha as string | null, deleted: e.deleted === true });
|
|
1051
|
+
}
|
|
1052
|
+
if (b.more !== undefined && typeof b.more !== 'boolean') return bad('more is a boolean');
|
|
1053
|
+
// more than CLAIM_MAX_FILES changed: the hook sends batches, every one but the last with
|
|
1054
|
+
// `more: true`; the call settles (and its window closes) on the last
|
|
1055
|
+
const final = b.more !== true;
|
|
1056
|
+
const self = runs.get(session, chat);
|
|
1057
|
+
const out = {
|
|
1058
|
+
bound: [] as string[],
|
|
1059
|
+
person: [] as string[],
|
|
1060
|
+
artboards: [] as string[],
|
|
1061
|
+
lostIds: [] as string[],
|
|
1062
|
+
trashed: [] as string[],
|
|
1063
|
+
};
|
|
1064
|
+
// No live run of this session (a foreign chat, an ended run): nothing is claimed, and the call's
|
|
1065
|
+
// window is left to its own end (close + SETTLE_WAIT_MS, stale, the run's end) — all outside.
|
|
1066
|
+
if (!self) return json(200, out);
|
|
1067
|
+
// F5 — only a call this run has a window for settles (its own; never another run's)
|
|
1068
|
+
const scope = deps.bracket?.scope?.(self, toolUseId) ?? null;
|
|
1069
|
+
if (!scope) return json(409, { error: 'this call has no open window', code: 'no-window' });
|
|
1070
|
+
const designRoot = path.join(deps.repoRoot, deps.designRel);
|
|
1071
|
+
const changed: Array<{ rel: string; text: string | null }> = [];
|
|
1072
|
+
for (const e of entries) {
|
|
1073
|
+
// F6 — a `named` window claims only the files it covered; anything else is not the call's
|
|
1074
|
+
if (!scope.all && !scope.covers(e.rel)) continue;
|
|
1075
|
+
if (e.deleted) {
|
|
1076
|
+
// D4 — only a canvas the stage saw leave the disk while this window was open
|
|
1077
|
+
if (scope.left(e.rel) && !existsSync(path.join(designRoot, e.rel))) {
|
|
1078
|
+
changed.push({ rel: e.rel, text: null });
|
|
1079
|
+
out.bound.push(e.rel);
|
|
1080
|
+
}
|
|
1081
|
+
continue;
|
|
1082
|
+
}
|
|
1083
|
+
// past the hook's budget with no pre-hash: never a claim
|
|
1084
|
+
if (e.sha === null) continue;
|
|
1085
|
+
// D6 — stat before read: a file past its lane cap is never read (nor claimed)
|
|
1086
|
+
const bytes = readDesignBytes(deps, e.rel, laneCap(e.rel));
|
|
1087
|
+
// a later save changed the file since the call: those bytes are not the call's
|
|
1088
|
+
if (!bytes || createHash('sha256').update(bytes).digest('hex') !== e.sha) continue;
|
|
1089
|
+
const text = bytes.toString('utf8');
|
|
1090
|
+
// p8-a1-save-hold — the person's held save landed these bytes during the call: theirs
|
|
1091
|
+
if (saveHold().landedByPerson(path.join(designRoot, e.rel), text)) {
|
|
1092
|
+
out.person.push(e.rel);
|
|
1093
|
+
continue;
|
|
1094
|
+
}
|
|
1095
|
+
changed.push({ rel: e.rel, text });
|
|
1096
|
+
out.bound.push(e.rel);
|
|
1097
|
+
}
|
|
1098
|
+
const settled = deps.bracket?.settle?.(self, toolUseId, changed, final) ?? {
|
|
1099
|
+
ok: false,
|
|
1100
|
+
code: 'no-window',
|
|
1101
|
+
};
|
|
1102
|
+
// refused (no window, or the call failed — what it parked went out as outside): nothing is bound
|
|
1103
|
+
if (!settled.ok)
|
|
1104
|
+
return json(409, {
|
|
1105
|
+
error: 'this call could not be settled',
|
|
1106
|
+
code: settled.code ?? 'settle-failed',
|
|
1107
|
+
});
|
|
1108
|
+
// the call's held saves (named files) land now as the person's, never in the run — F5: only
|
|
1109
|
+
// the hold this run opened for its own call
|
|
1110
|
+
if (final) saveHold().window(toolUseId, false, [], `run:${self.run}`);
|
|
1111
|
+
// attribution of what the call changed (the artboards, lost ids, trashed artboards)
|
|
1112
|
+
const mark = readDesignFile(deps, `_runs/${session}/bash/${toolUseId}.json`);
|
|
1113
|
+
let snaps: Record<string, unknown> = {};
|
|
1114
|
+
try {
|
|
1115
|
+
const m = mark ? JSON.parse(mark) : null;
|
|
1116
|
+
if (m && typeof m.snaps === 'object' && m.snaps) snaps = m.snaps;
|
|
1117
|
+
} catch {
|
|
1118
|
+
/* no snapshots: every artboard of a changed canvas */
|
|
1119
|
+
}
|
|
1120
|
+
for (const c of changed) {
|
|
1121
|
+
if (c.text === null || !CANVAS_RE.test(c.rel)) continue;
|
|
1122
|
+
const name = snaps[c.rel];
|
|
1123
|
+
const snap =
|
|
1124
|
+
typeof name === 'string' && /^[A-Za-z0-9_.-]{1,160}$/.test(name)
|
|
1125
|
+
? `_runs/${session}/snap/${name}`
|
|
1126
|
+
: null;
|
|
1127
|
+
const ch = canvasChange(c.rel, snap, session);
|
|
1128
|
+
for (const a of ch.artboards) if (!out.artboards.includes(a)) out.artboards.push(a);
|
|
1129
|
+
out.lostIds.push(...ch.lostIds);
|
|
1130
|
+
out.trashed.push(...ch.trashed);
|
|
1131
|
+
runs.touch(self.session || session, c.rel, ch.artboards, chat, ch.elements);
|
|
1132
|
+
}
|
|
1133
|
+
return json(200, out);
|
|
1134
|
+
}),
|
|
956
1135
|
// p8-a1-claims — a disk-writing verb (reel-place, canvas-edit, ds-check --fix, import-figma) claims
|
|
957
1136
|
// the bytes it is about to write for its chat's live run, BEFORE they land (bin/_write-claim.mjs).
|
|
958
1137
|
// A hook route: non-browser only (`hookBody`), main origin only, never in a canvas allowlist.
|
package/apps/studio/routes/ai.ts
CHANGED
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
// beside it, re-scope the waiting ask to it, start it
|
|
10
10
|
// POST /_api/ai/runs/stop-all {reason: quit | close-tab} → {stopped, published} ≤ 5 s
|
|
11
11
|
// GET /_api/ai v1 banner entries, DERIVED from the registry (canvas-safe)
|
|
12
|
-
// POST /_api/ai/start|heartbeat|end
|
|
12
|
+
// POST /_api/ai/start|heartbeat|end RETIRED (T2.5b, #163): 410 Gone, pointing at the run registry
|
|
13
|
+
// (`/_api/agent/run/begin` … `/run/end`, the design plugin's hooks)
|
|
13
14
|
//
|
|
14
15
|
// `mine` is YOUR runs on this Mac (RunView: never the queued prompt); `others` is RunPublic, which
|
|
15
16
|
// never carries prompt, question or doing.
|
|
@@ -23,6 +24,7 @@ import type { RunRegistry } from '../ai/runs.ts';
|
|
|
23
24
|
import { claimHashOf } from '../ai/write-claim.ts';
|
|
24
25
|
import { CanvasEditError, copyArtboard } from '../canvas-edit.ts';
|
|
25
26
|
import { filterAiEntries } from '../collab/ai-activity.ts';
|
|
27
|
+
import { e2eSwitch, IS_RELEASE_BUILD } from '../release-build.ts';
|
|
26
28
|
import { hashBytes } from '../sync/echo-guard.ts';
|
|
27
29
|
import type { RouteSpec } from './table.ts';
|
|
28
30
|
|
|
@@ -40,9 +42,13 @@ export interface AiRouteDeps {
|
|
|
40
42
|
}>;
|
|
41
43
|
/** S9.11 (V2-1.16 L13) — the request's seer; null = a project session (the identity) */
|
|
42
44
|
seerFor?: (req: Request) => Seer | null;
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
/**
|
|
46
|
+
* T2.5b — the retired v1 bracket kept alive as a TEST seam: start/heartbeat/end plant, renew and end
|
|
47
|
+
* a lease-only `design-edit` run on the registry (no claim, no project action), so the ACL cell tests
|
|
48
|
+
* and the two-Mac lease e2e can put a run on a canvas. Default: `legacyBracketSeam()` — off in every
|
|
49
|
+
* release build whatever the environment holds.
|
|
50
|
+
*/
|
|
51
|
+
legacyBracket?: boolean;
|
|
46
52
|
/** `_active.json`'s selected artboard of a canvas, else null (lazy) — injectable for tests */
|
|
47
53
|
selectedArtboard?: (canvasRel: string) => string | null;
|
|
48
54
|
/**
|
|
@@ -88,8 +94,34 @@ async function body(req: Request): Promise<Record<string, unknown> | null> {
|
|
|
88
94
|
|
|
89
95
|
const CANVAS_RE = /\.(?:tsx|jsx)$/;
|
|
90
96
|
|
|
97
|
+
/** T2.5b — the e2e switch that keeps the retired v1 bracket answering, as a test seam. */
|
|
98
|
+
export const LEGACY_AI_BRACKET_SWITCH = 'MAUDE_E2E_LEGACY_AI_BRACKET';
|
|
99
|
+
|
|
100
|
+
/** True only outside a release build and only for an explicit `1` (release-build.ts `e2eSwitch`). */
|
|
101
|
+
export function legacyBracketSeam(
|
|
102
|
+
env: Record<string, string | undefined> = process.env,
|
|
103
|
+
release: boolean = IS_RELEASE_BUILD
|
|
104
|
+
): boolean {
|
|
105
|
+
return e2eSwitch(env, LEGACY_AI_BRACKET_SWITCH, release) === '1';
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* T2.5b (#163) — the v1 bracket's answer: 410 Gone for one release, then the routes go. Since p8-a1-claims
|
|
110
|
+
* every run is claim-only and this bracket has no way to claim, so a write made under it landed as the
|
|
111
|
+
* person's; no v2 agent path uses it (S12.9), and a 1.x plugin in a terminal is told where the run lives now.
|
|
112
|
+
*/
|
|
113
|
+
const gone = () =>
|
|
114
|
+
json(410, {
|
|
115
|
+
error:
|
|
116
|
+
"The v1 AI bracket is retired. The design plugin's hooks open and close the run on the run registry; update the Maude plugin (/plugin marketplace update maude).",
|
|
117
|
+
code: 'gone',
|
|
118
|
+
use: '/_api/agent/run/begin',
|
|
119
|
+
runs: '/_api/ai/runs',
|
|
120
|
+
});
|
|
121
|
+
|
|
91
122
|
export function createAiRoutes(deps: AiRouteDeps): RouteSpec[] {
|
|
92
123
|
const reg = deps.registry;
|
|
124
|
+
const legacy = deps.legacyBracket ?? legacyBracketSeam();
|
|
93
125
|
const designRoot = () => path.join(deps.repoRoot, deps.designRel);
|
|
94
126
|
|
|
95
127
|
/** v1 `file` (`.design/x.tsx`) → the designRoot-relative canvas, or null when outside it. */
|
|
@@ -331,7 +363,9 @@ export function createAiRoutes(deps: AiRouteDeps): RouteSpec[] {
|
|
|
331
363
|
},
|
|
332
364
|
},
|
|
333
365
|
|
|
334
|
-
// ── v1 (Phase 8 Task 4):
|
|
366
|
+
// ── v1 (Phase 8 Task 4): the banner is derived; the POST bracket is retired (T2.5b) ─────
|
|
367
|
+
// The routes stay in the table (writer-registry, hub manifest, CSRF and canvas-origin parity
|
|
368
|
+
// classify them) and answer 410; `legacyBracket` keeps them as a lease-only test seam.
|
|
335
369
|
{
|
|
336
370
|
method: 'GET',
|
|
337
371
|
path: '/_api/ai',
|
|
@@ -353,6 +387,7 @@ export function createAiRoutes(deps: AiRouteDeps): RouteSpec[] {
|
|
|
353
387
|
origin: 'main',
|
|
354
388
|
readOnly: 'refused',
|
|
355
389
|
async handle(req) {
|
|
390
|
+
if (!legacy) return gone();
|
|
356
391
|
const b = await body(req);
|
|
357
392
|
const file = typeof b?.file === 'string' ? b.file.trim() : '';
|
|
358
393
|
if (!file) return new Response('body.file required', { status: 400 });
|
|
@@ -374,7 +409,6 @@ export function createAiRoutes(deps: AiRouteDeps): RouteSpec[] {
|
|
|
374
409
|
agent: author,
|
|
375
410
|
...(artboard ? {} : { lazy: true }),
|
|
376
411
|
});
|
|
377
|
-
deps.beginAction?.(`edit:${file}`, `${author} edited ${name}`);
|
|
378
412
|
} else {
|
|
379
413
|
run = reg.hookEvent(run.runId, {}) ?? run;
|
|
380
414
|
}
|
|
@@ -387,6 +421,7 @@ export function createAiRoutes(deps: AiRouteDeps): RouteSpec[] {
|
|
|
387
421
|
origin: 'main',
|
|
388
422
|
readOnly: 'refused',
|
|
389
423
|
async handle(req) {
|
|
424
|
+
if (!legacy) return gone();
|
|
390
425
|
const b = await body(req);
|
|
391
426
|
const file = typeof b?.file === 'string' ? b.file.trim() : '';
|
|
392
427
|
if (!file) return new Response('body.file required', { status: 400 });
|
|
@@ -404,18 +439,15 @@ export function createAiRoutes(deps: AiRouteDeps): RouteSpec[] {
|
|
|
404
439
|
origin: 'main',
|
|
405
440
|
readOnly: 'refused',
|
|
406
441
|
async handle(req) {
|
|
442
|
+
if (!legacy) return gone();
|
|
407
443
|
const b = await body(req);
|
|
408
444
|
const file = typeof b?.file === 'string' ? b.file.trim() : '';
|
|
409
445
|
if (!file) return new Response('body.file required', { status: 400 });
|
|
410
446
|
const failed = b?.outcome === 'failed';
|
|
411
|
-
// T16 — close the action BEFORE the run clears: `done` publishes, `failed` holds
|
|
412
|
-
const action = await Promise.resolve(
|
|
413
|
-
deps.endAction?.(`edit:${file}`, failed ? 'failed' : 'done')
|
|
414
|
-
).catch(() => null);
|
|
415
447
|
const canvas = canvasOf(file);
|
|
416
448
|
const run = canvas ? v1Run(canvas) : null;
|
|
417
449
|
const cleared = !!run && isLive(run) && !!reg.endNow(run.runId, failed ? 'failed' : 'done');
|
|
418
|
-
return json(cleared ? 200 : 404, { cleared
|
|
450
|
+
return json(cleared ? 200 : 404, { cleared });
|
|
419
451
|
},
|
|
420
452
|
},
|
|
421
453
|
];
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
// body — `from` enters the record only through the trusted `OpContext.from`.
|
|
23
23
|
|
|
24
24
|
import { randomBytes } from 'node:crypto';
|
|
25
|
+
import { itemsByList, toTaskLines } from '../annotations/elements/checkitem.model.ts';
|
|
25
26
|
import { arrivalLine, guardFigjamOps, parseFigjamBody } from '../annotations/figjam-into.ts';
|
|
26
27
|
import { keyBetween } from '../annotations/fractional-index.ts';
|
|
27
28
|
import type { Op as AnnotationOp } from '../annotations/ops.ts';
|
|
@@ -218,6 +219,11 @@ export function convertOps(
|
|
|
218
219
|
): Array<{ op: 'delete'; id: string }> {
|
|
219
220
|
const ids = [stickyId];
|
|
220
221
|
for (const el of board) {
|
|
222
|
+
// #113 - a checklist's entries are part of the sticky: they leave with it (undo brings them all back)
|
|
223
|
+
if (el.type === 'checkitem' && el.list === stickyId) {
|
|
224
|
+
ids.push(el.id);
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
221
227
|
if (el.type !== 'arrow') continue;
|
|
222
228
|
const a = el as AnnotationElement & { start?: { el?: string } };
|
|
223
229
|
if (a.start?.el === stickyId) ids.push(el.id);
|
|
@@ -225,6 +231,26 @@ export function convertOps(
|
|
|
225
231
|
return ids.map((id) => ({ op: 'delete' as const, id }));
|
|
226
232
|
}
|
|
227
233
|
|
|
234
|
+
/**
|
|
235
|
+
* The words a sticky carries into a comment: its text, and for a checklist its entries as Markdown task lines
|
|
236
|
+
* (`toTaskLines`), so the thread keeps what was ticked and what was not.
|
|
237
|
+
*/
|
|
238
|
+
export function stickyCommentText(
|
|
239
|
+
board: readonly AnnotationElement[],
|
|
240
|
+
el: AnnotationElement
|
|
241
|
+
): string {
|
|
242
|
+
const title = typeof el.text === 'string' ? el.text.trim() : '';
|
|
243
|
+
const items = itemsByList(board).get(el.id) ?? [];
|
|
244
|
+
if (!items.length) return title;
|
|
245
|
+
return toTaskLines(
|
|
246
|
+
title,
|
|
247
|
+
items.map((i) => ({
|
|
248
|
+
text: typeof i.text === 'string' ? i.text : '',
|
|
249
|
+
done: i.done !== undefined && i.done !== null,
|
|
250
|
+
}))
|
|
251
|
+
).trim();
|
|
252
|
+
}
|
|
253
|
+
|
|
228
254
|
const num = (v: unknown): number | null => (typeof v === 'number' && Number.isFinite(v) ? v : null);
|
|
229
255
|
|
|
230
256
|
/** A foreign reply on any of `ids` — the person who wrote it, else null. */
|
|
@@ -347,7 +373,7 @@ export function createAnnotationRoutes(deps: AnnotationRouteDeps) {
|
|
|
347
373
|
if (!el) return { ok: false, status: 404, body: { ok: false, reason: 'gone' } };
|
|
348
374
|
if (el.type !== 'sticky')
|
|
349
375
|
return { ok: false, status: 409, body: { ok: false, reason: 'not-a-sticky' } };
|
|
350
|
-
const text =
|
|
376
|
+
const text = stickyCommentText(board, el);
|
|
351
377
|
if (!text) return { ok: false, status: 409, body: { ok: false, reason: 'empty' } };
|
|
352
378
|
label = toCommentLabel(text);
|
|
353
379
|
const x = num(el.x) ?? 0;
|
|
@@ -18,7 +18,10 @@
|
|
|
18
18
|
// cross-origin + DNS-rebinding pair; the role gate is here: a project-level write into `assets/` — Can edit on the
|
|
19
19
|
// project, and a canvas-only session is refused (as `/_api/assets/trash`).
|
|
20
20
|
|
|
21
|
+
import path from 'node:path';
|
|
22
|
+
|
|
21
23
|
import type { Access } from '../access/scope.ts';
|
|
24
|
+
import { addedRelOf, recordAssetAdded } from '../asset-added.ts';
|
|
22
25
|
import {
|
|
23
26
|
CONVERT_MAX_BYTES,
|
|
24
27
|
CONVERT_OUT_MAX_BYTES,
|
|
@@ -48,6 +51,12 @@ export interface AssetImportRouteDeps {
|
|
|
48
51
|
access: (req: Request) => Access;
|
|
49
52
|
/** A file joined the project (the studio's change announcement; workspace mode only). */
|
|
50
53
|
announce?: (rel: string) => void;
|
|
54
|
+
/**
|
|
55
|
+
* #172 — who is importing, for "Added by" on every peer (`assets/<stem>.added.json`, contract 172-asset-origins.md):
|
|
56
|
+
* a cell's vouched member, else this Mac's git user. Cleaned before it is written (an e-mail becomes its words, a
|
|
57
|
+
* machine actor names nobody). Absent → no record.
|
|
58
|
+
*/
|
|
59
|
+
addedBy?: (req: Request) => string | null | undefined | Promise<string | null | undefined>;
|
|
51
60
|
/** Seams for the tests (the SVG canary drives a browser; `sips` is macOS only). The studio passes none. */
|
|
52
61
|
importSvg?: (text: string, opts: ImportOpts) => Promise<Imported>;
|
|
53
62
|
importConvertible?: (bytes: Buffer, opts: ImportOpts) => Promise<Imported>;
|
|
@@ -179,7 +188,15 @@ export function createAssetImportRoutes(deps: AssetImportRouteDeps): RouteSpec[]
|
|
|
179
188
|
else if (sniffRasterKind(bytes)) r = doRaster(bytes, opts());
|
|
180
189
|
else if (looksLikeSvg(bytes)) r = await doSvg(bytes.toString('utf8'), opts());
|
|
181
190
|
else throw new ImportAssetError(5, 'not a picture Maude can bring in', 'unsupported');
|
|
182
|
-
if (!r.reused)
|
|
191
|
+
if (!r.reused) {
|
|
192
|
+
deps.announce?.(r.path);
|
|
193
|
+
// #172 — a fresh import says who brought it in; write-once, so the same bytes again keep the first name.
|
|
194
|
+
// A record that cannot be written is a missing line, never a failed import.
|
|
195
|
+
const who = await Promise.resolve(deps.addedBy?.(req)).catch(() => null);
|
|
196
|
+
const design = path.join(deps.root, deps.designRel);
|
|
197
|
+
if (recordAssetAdded(design, r.path, who))
|
|
198
|
+
deps.announce?.(addedRelOf(r.path) as string);
|
|
199
|
+
}
|
|
183
200
|
return json(201, {
|
|
184
201
|
ok: true,
|
|
185
202
|
path: r.path,
|
|
@@ -47,8 +47,11 @@ function canvasOriginMeta(handler: Handler): Handler {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export function canvasOriginRoutes(
|
|
50
|
-
http: Pick<Http, 'routes' | 'canvasRoutes' | 'tableCanvasPaths'>
|
|
50
|
+
http: Pick<Http, 'routes' | 'canvasRoutes' | 'tableCanvasPaths' | 'unclaimed'>
|
|
51
51
|
): Record<string, Handler> {
|
|
52
|
+
// F2 — the legacy canvas-safe handlers come from `http.unclaimed`: the main origin's `routes` copy
|
|
53
|
+
// answers inside an AI run's write claim, which a canvas-origin request must never reach. (Keep the
|
|
54
|
+
// `'<path>': http.…` shape: test/_acl-gate.ts reads this map's keys from the source.)
|
|
52
55
|
// Hard allowlist of route-table endpoints (Bun matches `routes` before
|
|
53
56
|
// `fetch`). Only the collab/display-data endpoints the canvas runtime needs
|
|
54
57
|
// — see http.isCanvasSafeRoute for the trust rationale. The dynamic
|
|
@@ -57,8 +60,8 @@ export function canvasOriginRoutes(
|
|
|
57
60
|
'/_health': http.routes['/_health'],
|
|
58
61
|
// V2-8.9 r2 L1 — NOT the main-origin handler: no OS-account fallback for the canvas (canvasUserName).
|
|
59
62
|
'/_api/git-user': http.canvasRoutes['/_api/git-user'],
|
|
60
|
-
'/_api/canvas-meta': canvasOriginMeta(http.
|
|
61
|
-
'/_api/annotations': http.
|
|
63
|
+
'/_api/canvas-meta': canvasOriginMeta(http.unclaimed['/_api/canvas-meta'] as Handler),
|
|
64
|
+
'/_api/annotations': http.unclaimed['/_api/annotations'],
|
|
62
65
|
// T-S4.5b — NOT the main-origin handler: the canvas variant refuses a `run:<id>` tag (400
|
|
63
66
|
// run-tag-main-origin-only), so a planted canvas cannot slip its writes into an AI run.
|
|
64
67
|
'/_api/annotations/ops': http.canvasRoutes['/_api/annotations/ops'],
|
|
@@ -67,19 +70,19 @@ export function canvasOriginRoutes(
|
|
|
67
70
|
// Bun matches `routes` BEFORE `fetch`, so the route must be listed here
|
|
68
71
|
// explicitly — the CANVAS_SAFE_API entry alone only opens the fetch
|
|
69
72
|
// fall-through (which serves files, not route handlers). See DDR (Task 9).
|
|
70
|
-
'/_api/asset': http.
|
|
73
|
+
'/_api/asset': http.unclaimed['/_api/asset'],
|
|
71
74
|
// Issue #126 — chunked upload; MIRROR of the CANVAS_SAFE_API entries (http.ts).
|
|
72
|
-
'/_api/asset/chunk-start': http.
|
|
73
|
-
'/_api/asset/chunk': http.
|
|
74
|
-
'/_api/asset/chunk-finish': http.
|
|
75
|
+
'/_api/asset/chunk-start': http.unclaimed['/_api/asset/chunk-start'],
|
|
76
|
+
'/_api/asset/chunk': http.unclaimed['/_api/asset/chunk'],
|
|
77
|
+
'/_api/asset/chunk-finish': http.unclaimed['/_api/asset/chunk-finish'],
|
|
75
78
|
// feature-photo-editor — PhotoEdit sidecar GET/PUT. MUST be here AND in
|
|
76
79
|
// CANVAS_SAFE_API (http.ts): Bun matches `routes` before `fetch`, so a
|
|
77
80
|
// one-list entry 404s from the canvas iframe (the DDR-088 rollout bug).
|
|
78
|
-
'/_api/photo-edit': http.
|
|
81
|
+
'/_api/photo-edit': http.unclaimed['/_api/photo-edit'],
|
|
79
82
|
// V2-2.8 S6 — NOT the main-origin handler: the canvas origin gets the
|
|
80
83
|
// no-e-mail projection (names + commit counts) for @mention suggestions.
|
|
81
84
|
'/_api/git-committers': http.canvasRoutes['/_api/git-committers'],
|
|
82
|
-
'/_comments': http.
|
|
85
|
+
'/_comments': http.unclaimed['/_comments'],
|
|
83
86
|
} as Record<string, Handler>;
|
|
84
87
|
// V2-2.5 — the table's `origin: 'canvas'` specs: the SAME guarded handler the
|
|
85
88
|
// main origin mounts (`http.routes` is behind readOnlyRefusal + guardTableRoute).
|
|
@@ -26,6 +26,7 @@ import { join } from 'node:path';
|
|
|
26
26
|
import { boundCloudToken, cloudConfigPath } from '../cloud/config-path.ts';
|
|
27
27
|
import { type CloudEndpointResult, cloudUrl } from '../cloud/endpoints.ts';
|
|
28
28
|
import { createHubFormatClient } from '../migrate/hub.ts';
|
|
29
|
+
import { worktreeOf } from '../shell/worktree.ts';
|
|
29
30
|
import { getHubRecord, normalizeUrl } from '../sync/hubs-config.ts';
|
|
30
31
|
import type { RouteSpec } from './table.ts';
|
|
31
32
|
|
|
@@ -47,6 +48,11 @@ export interface CloudMoveDeps {
|
|
|
47
48
|
cloudConfigPath?: () => string;
|
|
48
49
|
/** this profile's hubs.json; absent = `hubsConfigPath()` */
|
|
49
50
|
hubsConfigPath?: string;
|
|
51
|
+
/**
|
|
52
|
+
* #206 §5 — the main project's name when this server serves a worktree tab (`shell/worktree.ts`,
|
|
53
|
+
* default: from the env the app spawned it with). A worktree is never linked, so it never moves.
|
|
54
|
+
*/
|
|
55
|
+
worktreeOf?: () => string | null;
|
|
50
56
|
/** seams for tests */
|
|
51
57
|
fetchImpl?: typeof fetch;
|
|
52
58
|
pollMs?: number;
|
|
@@ -340,6 +346,15 @@ export function createCloudMoveRoutes(deps: CloudMoveDeps): RouteSpec[] {
|
|
|
340
346
|
// (cli/lib/bash-guard.mjs `human-only`). Checked before the body, the job file or the cloud.
|
|
341
347
|
if (req.headers.get('sec-fetch-site') !== 'same-origin')
|
|
342
348
|
return json(403, { ok: false, reason: 'window-only', error: WORDS.windowOnly });
|
|
349
|
+
// #206 §5 (T6.3g): a worktree tab syncs from its main project — moving it would make a
|
|
350
|
+
// second linked copy. Refused before the body, the job file or any call to Maude Cloud.
|
|
351
|
+
const main = (deps.worktreeOf ?? worktreeOf)();
|
|
352
|
+
if (main)
|
|
353
|
+
return json(409, {
|
|
354
|
+
ok: false,
|
|
355
|
+
reason: 'worktree',
|
|
356
|
+
error: `This folder syncs from ${main}. Move ${main} to the cloud instead.`,
|
|
357
|
+
});
|
|
343
358
|
const next = gate.then(() => startMove(req));
|
|
344
359
|
gate = next.catch(() => null);
|
|
345
360
|
return next;
|
|
@@ -57,6 +57,7 @@ import {
|
|
|
57
57
|
import type { ReferenceLanes } from '../edit-ops/references.ts';
|
|
58
58
|
import { createWriteLog, type WriteLog } from '../edit-ops/revert.ts';
|
|
59
59
|
import { type ClipScope, type EditOp, type LayoutPatch, MAX_BODY } from '../edit-ops/types.ts';
|
|
60
|
+
import { moduleOwningId } from '../imported-module-ids.ts';
|
|
60
61
|
import { sourceHold, type WriteHold } from '../sync/write-hold.ts';
|
|
61
62
|
import { isWorkspaceMode } from '../workspace-mode.ts';
|
|
62
63
|
import { heldByAi } from './agent.ts';
|
|
@@ -461,6 +462,8 @@ export function createEditRoutes(deps: EditRouteDeps): RouteSpec[] {
|
|
|
461
462
|
return serialized(key, () =>
|
|
462
463
|
dispatchEditOp(body, {
|
|
463
464
|
resolve: (f) => resolveCanvasRel(deps.designRoot, deps.designRel, f),
|
|
465
|
+
// #151 T2.3b — an element of an imported module is selectable but edit-read-only: say which file
|
|
466
|
+
moduleOf: (rel, id) => moduleOwningId(abs(rel), deps.designRoot, id),
|
|
464
467
|
// S11.17 — through the hold: an edit made while the disk is full builds on the held bytes
|
|
465
468
|
read: readSource,
|
|
466
469
|
// S2.23 (G4): say what the source became, like api.ts does for the studio's other writes — the
|