@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
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
import { Database } from 'bun:sqlite';
|
|
31
31
|
import { randomUUID } from 'node:crypto';
|
|
32
32
|
import {
|
|
33
|
+
appendFileSync,
|
|
33
34
|
closeSync,
|
|
34
35
|
existsSync,
|
|
35
36
|
mkdirSync,
|
|
@@ -39,6 +40,7 @@ import {
|
|
|
39
40
|
renameSync,
|
|
40
41
|
statSync,
|
|
41
42
|
unlinkSync,
|
|
43
|
+
writeFileSync,
|
|
42
44
|
writeSync,
|
|
43
45
|
} from 'node:fs';
|
|
44
46
|
import { homedir, hostname, uptime } from 'node:os';
|
|
@@ -50,17 +52,29 @@ import { createKernel, EMPTY_HASH, PROTOCOL } from '../../hub/src/project-transa
|
|
|
50
52
|
import { laneHash, mergeLane } from '../../hub/src/project-transactions/lanes.mjs';
|
|
51
53
|
import { createStoreCore } from '../../hub/src/project-transactions/store-core.mjs';
|
|
52
54
|
import { claimWrite, currentWriteClaim, recordClaim } from '../ai/write-claim.ts';
|
|
55
|
+
import { cleanGestureLabel } from '../annotations/ops.ts';
|
|
53
56
|
import { serializeBoard } from '../annotations/schema.ts';
|
|
54
57
|
import {
|
|
55
58
|
boardTextSlots,
|
|
56
59
|
changedTextSlots,
|
|
57
60
|
createTextStepLedger,
|
|
61
|
+
decodeTextStepLog,
|
|
62
|
+
encodeTextStepLine,
|
|
63
|
+
MAX_TEXT_STEP_LOG_BYTES,
|
|
64
|
+
MAX_TEXT_STEPS,
|
|
65
|
+
TEXT_STEP_LOG,
|
|
66
|
+
textStepLogHeader,
|
|
58
67
|
} from '../annotations/text-steps.ts';
|
|
59
68
|
import { isDraftWriteId } from '../annotations/ui/text-session.ts';
|
|
60
69
|
import { attributeArtboards } from '../attribute-artboards.ts';
|
|
61
70
|
import { canvasSlugFromRel } from '../canvas-slug.ts';
|
|
62
71
|
import { bumpTrashSeq, type TrashListing } from '../history/trash.ts';
|
|
63
|
-
import {
|
|
72
|
+
import {
|
|
73
|
+
createActionStage,
|
|
74
|
+
type RunFence,
|
|
75
|
+
type RunStageSummary,
|
|
76
|
+
shellClaimLane,
|
|
77
|
+
} from './action-stage.ts';
|
|
64
78
|
import { atomicWrite } from './atomic-write.ts';
|
|
65
79
|
import { validateCanvasPath } from './canvas-path.ts';
|
|
66
80
|
import { laneValueFromFile, mergeSharedMetaIntoLocal } from './codec.ts';
|
|
@@ -68,6 +82,7 @@ import { hashBytes } from './echo-guard.ts';
|
|
|
68
82
|
import { canvasLanes, namedField, type RowNamed } from './history-fields.ts';
|
|
69
83
|
import { type HubEffect, hubTextUndoConflict } from './hub-text-undo.ts';
|
|
70
84
|
import { mergeSource } from './source-merge.ts';
|
|
85
|
+
import { saveRecoveryBody } from './source-recovery.ts';
|
|
71
86
|
import { type ParkedCanvas, removeClearedCopies } from './trash-clear-copies.ts';
|
|
72
87
|
import {
|
|
73
88
|
asTarget,
|
|
@@ -565,6 +580,20 @@ export interface LocalRuntime {
|
|
|
565
580
|
}
|
|
566
581
|
): void;
|
|
567
582
|
claimAiWrite(key: string, repoRel: string, hash?: string | null): void;
|
|
583
|
+
/**
|
|
584
|
+
* #164 — run `key`'s call `call` settles: its window closes; the writes it parked join that run when
|
|
585
|
+
* their bytes are claimed (`claimed`: the repo-relative files the settle claimed), the rest land as
|
|
586
|
+
* outside. F5 — false (nothing resolved) when that run has no window for the call.
|
|
587
|
+
*/
|
|
588
|
+
settleShellCall(key: string, call: string, claimed?: readonly string[]): boolean;
|
|
589
|
+
/**
|
|
590
|
+
* F5/F6 — run `key`'s window for call `call`, or null: `covers` the repo-relative files it parks,
|
|
591
|
+
* `left` the ones the stage saw leave the disk while it was open (D4).
|
|
592
|
+
*/
|
|
593
|
+
shellCall(
|
|
594
|
+
key: string,
|
|
595
|
+
call: string
|
|
596
|
+
): { all: boolean; covers(repoRel: string): boolean; left(repoRel: string): boolean } | null;
|
|
568
597
|
/** p8-a1-claims (F17) — run `key` is about to delete canvas `repoRel`: the delete joins the run. */
|
|
569
598
|
claimAiDelete(key: string, repoRel: string): void;
|
|
570
599
|
/** p8-sec2-lows I1 — the delete claimed by `claimAiDelete` failed; drop the claim. */
|
|
@@ -597,6 +626,11 @@ export interface LocalRuntime {
|
|
|
597
626
|
* that board, as one step.
|
|
598
627
|
*/
|
|
599
628
|
draft?: boolean;
|
|
629
|
+
/**
|
|
630
|
+
* T7.3b (#113) — the person's gesture in words ("Ticked “Write the post”"): the stroke's row
|
|
631
|
+
* label, so ⌘Z names it. Untrusted canvas text, cleaned here again; none → the lane label.
|
|
632
|
+
*/
|
|
633
|
+
label?: string;
|
|
600
634
|
}
|
|
601
635
|
): null;
|
|
602
636
|
/**
|
|
@@ -644,6 +678,55 @@ export interface LocalHomeOptions {
|
|
|
644
678
|
log?: Pick<Console, 'warn' | 'error'>;
|
|
645
679
|
/** S1.7b — ctx.bus.emit: `trash:changed` when an accepted action changed the Trash. */
|
|
646
680
|
emit?: (event: string, payload: unknown) => void;
|
|
681
|
+
/** #168 — a `seen` entry unused this long may be swept (see `sweepSeen`). */
|
|
682
|
+
seenIdleMs?: number;
|
|
683
|
+
/** #168 — sweep `seen` this often; 0 = never by itself (tests sweep by hand). */
|
|
684
|
+
seenSweepMs?: number;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/** #168 T5.4 — defaults for the `seen` sweep: idle for 10 minutes, looked at every 5. */
|
|
688
|
+
export const SEEN_IDLE_MS = 10 * 60_000;
|
|
689
|
+
export const SEEN_SWEEP_MS = 5 * 60_000;
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* The local kernel's `seen` map, stamped with each entry's last use (a read or a write), so an
|
|
693
|
+
* idle sweep can find the entries nobody has needed for a while. `peek` reads without using.
|
|
694
|
+
*/
|
|
695
|
+
class SeenMap extends Map<string, string> {
|
|
696
|
+
private readonly used = new Map<string, number>();
|
|
697
|
+
constructor(private readonly clock: () => number) {
|
|
698
|
+
super();
|
|
699
|
+
}
|
|
700
|
+
override get(k: string): string | undefined {
|
|
701
|
+
const v = super.get(k);
|
|
702
|
+
if (v !== undefined) this.used.set(k, this.clock());
|
|
703
|
+
return v;
|
|
704
|
+
}
|
|
705
|
+
override set(k: string, v: string): this {
|
|
706
|
+
this.used.set(k, this.clock());
|
|
707
|
+
return super.set(k, v);
|
|
708
|
+
}
|
|
709
|
+
override delete(k: string): boolean {
|
|
710
|
+
this.used.delete(k);
|
|
711
|
+
return super.delete(k);
|
|
712
|
+
}
|
|
713
|
+
override clear(): void {
|
|
714
|
+
this.used.clear();
|
|
715
|
+
super.clear();
|
|
716
|
+
}
|
|
717
|
+
peek(k: string): string | undefined {
|
|
718
|
+
return super.get(k);
|
|
719
|
+
}
|
|
720
|
+
usedAt(k: string): number | undefined {
|
|
721
|
+
return this.used.get(k);
|
|
722
|
+
}
|
|
723
|
+
/** Keys unused since `before`, sorted (a stable answer). */
|
|
724
|
+
idleKeys(before: number): string[] {
|
|
725
|
+
return [...this.used]
|
|
726
|
+
.filter(([, at]) => at <= before)
|
|
727
|
+
.map(([k]) => k)
|
|
728
|
+
.sort();
|
|
729
|
+
}
|
|
647
730
|
}
|
|
648
731
|
|
|
649
732
|
export interface ForeignStore {
|
|
@@ -690,6 +773,8 @@ export interface LocalHome {
|
|
|
690
773
|
expectMove(fromRel: string, toRel: string): void;
|
|
691
774
|
/** Propose every pending observation now. */
|
|
692
775
|
flush(): Promise<void>;
|
|
776
|
+
/** #168 — drop the idle `seen` entries the store and the disk agree on now (keys dropped). */
|
|
777
|
+
sweepSeen(): Promise<string[]>;
|
|
693
778
|
/** Other machines' stores in `_state/`, read-only (C1). */
|
|
694
779
|
foreignStores(): ForeignStore[];
|
|
695
780
|
/** Read-only history of one foreign store. */
|
|
@@ -756,8 +841,14 @@ export function openLocalHome(opts: LocalHomeOptions): LocalHome {
|
|
|
756
841
|
// hold staged bytes the store has not accepted; `seen` remembers what each lane held when the
|
|
757
842
|
// watcher last read it — the `d0` a change is composed from (`R.mine = merge3(d0, d1, mine)`)
|
|
758
843
|
// and the base a person's edit made on top of staged bytes is proposed from.
|
|
759
|
-
/**
|
|
760
|
-
|
|
844
|
+
/**
|
|
845
|
+
* `${rel}|${lane}` → the lane's value on disk when last read (or written) here. #168 — swept
|
|
846
|
+
* when idle (`sweepSeen`), so it no longer holds every lane a session ever touched.
|
|
847
|
+
*/
|
|
848
|
+
const seen = new SeenMap(now);
|
|
849
|
+
const seenIdleMs = opts.seenIdleMs ?? SEEN_IDLE_MS;
|
|
850
|
+
const seenSweepMs = opts.seenSweepMs ?? SEEN_SWEEP_MS;
|
|
851
|
+
let seenTimer: ReturnType<typeof setInterval> | null = null;
|
|
761
852
|
/**
|
|
762
853
|
* `${canvas}|${lane}` → the studio's own write of that lane (api.ts `source-written` for the
|
|
763
854
|
* source, server.ts `proposeLane` for layout and board — S2.20b), until the watcher reads it.
|
|
@@ -812,10 +903,71 @@ export function openLocalHome(opts: LocalHomeOptions): LocalHome {
|
|
|
812
903
|
onRefused: (w) => {
|
|
813
904
|
if (!(LOCAL_LANES as readonly string[]).includes(w.lane)) return;
|
|
814
905
|
const lane = w.lane as LocalLane;
|
|
815
|
-
if (diskLane(w.slug, lane)
|
|
906
|
+
if (diskLane(w.slug, lane) !== w.content) return;
|
|
907
|
+
// the refused bytes leave the disk, never the project: they are kept in the canvas's
|
|
908
|
+
// recovery folder first, and a write that cannot keep them is not rolled back
|
|
909
|
+
try {
|
|
910
|
+
saveRecoveryBody(
|
|
911
|
+
path.join(opts.designRoot, '_history', canvasSlugFromRel(w.slug, designRel)),
|
|
912
|
+
lane === 'html' ? w.slug : `${w.slug}.${lane}`,
|
|
913
|
+
'local',
|
|
914
|
+
w.content
|
|
915
|
+
);
|
|
916
|
+
} catch (err) {
|
|
917
|
+
log.warn(`[local-kernel] ${w.slug}: refused write kept on disk (${String(err)})`);
|
|
918
|
+
return;
|
|
919
|
+
}
|
|
920
|
+
writeLane(w.slug, lane, w.base);
|
|
816
921
|
},
|
|
922
|
+
// #164 — writes a call's window parked and nobody claimed: recorded as outside, as the watcher
|
|
923
|
+
// would have recorded them (one action per canvas; the disk already holds the bytes)
|
|
924
|
+
release: (w) => serial(() => releaseOutside(w.slug, w.writes)),
|
|
925
|
+
// D1 — releaseOutside sends a canvas's parked writes as one change (first base, last bytes)
|
|
926
|
+
mergeParked: true,
|
|
817
927
|
});
|
|
818
928
|
|
|
929
|
+
async function releaseOutside(
|
|
930
|
+
rel: string,
|
|
931
|
+
writes: ReadonlyArray<{ lane: string; content: string; baseContent: string }>
|
|
932
|
+
): Promise<{ status: 'accepted' | 'rejected'; code?: string; actionId?: string }> {
|
|
933
|
+
if (!opened || !kernel) return { status: 'rejected', code: 'store-locked' };
|
|
934
|
+
const store = opened.store;
|
|
935
|
+
const lanes = [...new Set(writes.map((x) => x.lane))];
|
|
936
|
+
const last = (l: string) => writes.filter((x) => x.lane === l).at(-1)?.content ?? '';
|
|
937
|
+
const first = (l: string) => writes.find((x) => x.lane === l)?.baseContent ?? '';
|
|
938
|
+
const live: string | null = await store.docByPath(rel);
|
|
939
|
+
const action = { kind: OUTSIDE_KIND, label: NAME(rel) };
|
|
940
|
+
if (!live) {
|
|
941
|
+
const created = Object.fromEntries(
|
|
942
|
+
lanes.map((l) => [l, last(l)]).filter(([, v]) => v !== '')
|
|
943
|
+
);
|
|
944
|
+
if (!created.html) return { status: 'rejected', code: 'not-a-canvas' };
|
|
945
|
+
return submit(
|
|
946
|
+
[{ op: 'doc.create', doc: canvasSlugFromRel(rel, designRel), path: rel, lanes: created }],
|
|
947
|
+
action,
|
|
948
|
+
actor,
|
|
949
|
+
{},
|
|
950
|
+
true
|
|
951
|
+
);
|
|
952
|
+
}
|
|
953
|
+
const head = (await store.heads([live]))[live] as {
|
|
954
|
+
lanes: Record<string, { hash: string | null }>;
|
|
955
|
+
};
|
|
956
|
+
const ops = lanes
|
|
957
|
+
.map((l) => {
|
|
958
|
+
const base = first(l);
|
|
959
|
+
const content = last(l);
|
|
960
|
+
const headHash = hashOr(head?.lanes?.[l]?.hash);
|
|
961
|
+
if (laneHash(content) === headHash) return null;
|
|
962
|
+
return laneHash(base) === headHash
|
|
963
|
+
? { op: 'lane.replace', doc: live, lane: l, content, base: headHash }
|
|
964
|
+
: { op: 'lane.replace', doc: live, lane: l, content, baseContent: base };
|
|
965
|
+
})
|
|
966
|
+
.filter((o) => o !== null);
|
|
967
|
+
if (!ops.length) return { status: 'accepted' };
|
|
968
|
+
return submit(ops, action, actor, {}, true);
|
|
969
|
+
}
|
|
970
|
+
|
|
819
971
|
function noteWritten(
|
|
820
972
|
rel: string,
|
|
821
973
|
content: string,
|
|
@@ -1693,6 +1845,50 @@ export function openLocalHome(opts: LocalHomeOptions): LocalHome {
|
|
|
1693
1845
|
// p8-undo-collab-refuse — what each recorded stroke left in the text slots it changed, and the
|
|
1694
1846
|
// texts a collaborator changed during it (annotations/text-steps.ts). Session scope, like ⌘Z.
|
|
1695
1847
|
const textSteps = createTextStepLedger();
|
|
1848
|
+
// T5.2 (#165) — the ledger outlives a restart, as the op log does (annotations/text-steps.ts
|
|
1849
|
+
// TEXT_STEP_LOG): read back once per store (the writer's), appended to on every kept step,
|
|
1850
|
+
// rewritten compacted on load and whenever the appends double the cap.
|
|
1851
|
+
const textStepLog = path.join(stateDir, TEXT_STEP_LOG);
|
|
1852
|
+
let textStepsFor = '';
|
|
1853
|
+
let textStepLines = 0;
|
|
1854
|
+
function rewriteTextSteps(): void {
|
|
1855
|
+
const entries = textSteps.entries();
|
|
1856
|
+
const lines = [
|
|
1857
|
+
textStepLogHeader(projectId),
|
|
1858
|
+
...entries.map(([id, st]) => encodeTextStepLine(id, st)),
|
|
1859
|
+
];
|
|
1860
|
+
const tmp = `${textStepLog}.${pid}.tmp`;
|
|
1861
|
+
try {
|
|
1862
|
+
writeFileSync(tmp, `${lines.join('\n')}\n`);
|
|
1863
|
+
renameSync(tmp, textStepLog);
|
|
1864
|
+
textStepLines = entries.length;
|
|
1865
|
+
} catch (err) {
|
|
1866
|
+
log.warn(`[local-kernel] could not write ${TEXT_STEP_LOG}:`, err);
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
function loadTextSteps(): void {
|
|
1870
|
+
if (!lock || closed || !projectId || textStepsFor === projectId) return;
|
|
1871
|
+
textStepsFor = projectId;
|
|
1872
|
+
let text = '';
|
|
1873
|
+
try {
|
|
1874
|
+
if (statSync(textStepLog).size <= MAX_TEXT_STEP_LOG_BYTES)
|
|
1875
|
+
text = readFileSync(textStepLog, 'utf8');
|
|
1876
|
+
} catch {
|
|
1877
|
+
/* no log yet */
|
|
1878
|
+
}
|
|
1879
|
+
for (const [id, step] of decodeTextStepLog(text, projectId)) textSteps.restore(id, step);
|
|
1880
|
+
rewriteTextSteps();
|
|
1881
|
+
}
|
|
1882
|
+
textSteps.onNote((id, step) => {
|
|
1883
|
+
if (textStepsFor !== projectId || closed) return;
|
|
1884
|
+
if (textStepLines >= 2 * MAX_TEXT_STEPS) return rewriteTextSteps();
|
|
1885
|
+
try {
|
|
1886
|
+
appendFileSync(textStepLog, `${encodeTextStepLine(id, step)}\n`);
|
|
1887
|
+
textStepLines++;
|
|
1888
|
+
} catch (err) {
|
|
1889
|
+
log.warn(`[local-kernel] could not append to ${TEXT_STEP_LOG}:`, err);
|
|
1890
|
+
}
|
|
1891
|
+
});
|
|
1696
1892
|
/** The one dedupe key of a stroke — `proposeStroke` and `stageStroke` must agree on it. */
|
|
1697
1893
|
const strokeKey = (text: string, baseText: string | undefined) =>
|
|
1698
1894
|
`${baseText ?? '\u0000none'}\u0000${text}`;
|
|
@@ -1723,7 +1919,8 @@ export function openLocalHome(opts: LocalHomeOptions): LocalHome {
|
|
|
1723
1919
|
text: string,
|
|
1724
1920
|
baseText: string | undefined,
|
|
1725
1921
|
contested: readonly string[] = [],
|
|
1726
|
-
draft = false
|
|
1922
|
+
draft = false,
|
|
1923
|
+
label?: string
|
|
1727
1924
|
): void {
|
|
1728
1925
|
const held = draftsHeld.get(slug);
|
|
1729
1926
|
if (draft) {
|
|
@@ -1743,6 +1940,8 @@ export function openLocalHome(opts: LocalHomeOptions): LocalHome {
|
|
|
1743
1940
|
const key = strokeKey(text, baseText);
|
|
1744
1941
|
if (lastStroke.get(slug) === key) return;
|
|
1745
1942
|
lastStroke.set(slug, key);
|
|
1943
|
+
// T7.3b — the gesture's words name the row (a session's drafts carry none: its commit's words do)
|
|
1944
|
+
const said = cleanGestureLabel(label) ?? STUDIO_LANE_LABEL.annotations;
|
|
1746
1945
|
const run: Promise<unknown> = readyP
|
|
1747
1946
|
.then(() =>
|
|
1748
1947
|
serial(async () => {
|
|
@@ -1753,9 +1952,10 @@ export function openLocalHome(opts: LocalHomeOptions): LocalHome {
|
|
|
1753
1952
|
const r = await proposeLanesNow(
|
|
1754
1953
|
slug,
|
|
1755
1954
|
[{ lane: 'annotations', text, baseText: baseText ?? null }],
|
|
1756
|
-
{ kind: 'edit', label:
|
|
1955
|
+
{ kind: 'edit', label: said }
|
|
1757
1956
|
);
|
|
1758
1957
|
if (r.status === 'accepted' && r.actionId) {
|
|
1958
|
+
loadTextSteps();
|
|
1759
1959
|
textSteps.note(r.actionId, {
|
|
1760
1960
|
slug,
|
|
1761
1961
|
// an unknown base (null) records no slots: only the contest is known then
|
|
@@ -1941,6 +2141,46 @@ export function openLocalHome(opts: LocalHomeOptions): LocalHome {
|
|
|
1941
2141
|
return run;
|
|
1942
2142
|
};
|
|
1943
2143
|
|
|
2144
|
+
/**
|
|
2145
|
+
* #168 T5.4 — drop the `seen` entries nobody used for `seenIdleMs` whose value the store's head
|
|
2146
|
+
* AND the disk both hold. With the head equal to the entry, a missing entry decides every read
|
|
2147
|
+
* the same way: the watcher's "changed?" compares the disk with the head instead
|
|
2148
|
+
* (`laneHash(v) === headHash` ⇔ `prev === v`), and the base it proposes from is the head's
|
|
2149
|
+
* blob, which is `prev` (the disk check is a second guard on top). A run's staged bytes are
|
|
2150
|
+
* never swept: the store's head does not hold them. A head that moves later reaches the disk
|
|
2151
|
+
* through `publishChanges`, which sets the entry again. Runs in `serial`, so no proposal is in
|
|
2152
|
+
* flight while it looks; an entry used meanwhile is kept.
|
|
2153
|
+
* Returns the keys dropped (sorted).
|
|
2154
|
+
*/
|
|
2155
|
+
function sweepSeen(): Promise<string[]> {
|
|
2156
|
+
return serial(async () => {
|
|
2157
|
+
const o = opened;
|
|
2158
|
+
if (!o || !kernel || closed) return [];
|
|
2159
|
+
const before = now() - seenIdleMs;
|
|
2160
|
+
const dropped: string[] = [];
|
|
2161
|
+
for (const k of seen.idleKeys(before)) {
|
|
2162
|
+
const bar = k.lastIndexOf('|');
|
|
2163
|
+
const rel = k.slice(0, bar);
|
|
2164
|
+
const lane = k.slice(bar + 1) as LocalLane;
|
|
2165
|
+
const value = seen.peek(k);
|
|
2166
|
+
if (value === undefined || !(LOCAL_LANES as readonly string[]).includes(lane)) continue;
|
|
2167
|
+
if (notes.has(k) || superseded.has(k) || holdLive(rel)) continue;
|
|
2168
|
+
if (diskLane(rel, lane) !== value) continue;
|
|
2169
|
+
const doc: string | null = await o.store.docByPath(rel);
|
|
2170
|
+
if (!doc) continue;
|
|
2171
|
+
const head = (await o.store.heads([doc]))[doc] as
|
|
2172
|
+
| { lanes?: Record<string, { hash: string | null }> }
|
|
2173
|
+
| undefined;
|
|
2174
|
+
if (hashOr(head?.lanes?.[lane]?.hash) !== laneHash(value)) continue;
|
|
2175
|
+
// used (or changed) while the store answered: keep it
|
|
2176
|
+
if (seen.peek(k) !== value || (seen.usedAt(k) ?? 0) > before) continue;
|
|
2177
|
+
seen.delete(k);
|
|
2178
|
+
dropped.push(k);
|
|
2179
|
+
}
|
|
2180
|
+
return dropped;
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
2183
|
+
|
|
1944
2184
|
function drain(): Promise<void> {
|
|
1945
2185
|
if (timer) clearTimeout(timer);
|
|
1946
2186
|
timer = null;
|
|
@@ -2215,6 +2455,7 @@ export function openLocalHome(opts: LocalHomeOptions): LocalHome {
|
|
|
2215
2455
|
);
|
|
2216
2456
|
ids = found.ok ? found.actionIds : [];
|
|
2217
2457
|
}
|
|
2458
|
+
loadTextSteps();
|
|
2218
2459
|
const ledger = textSteps.conflict(ids, (slug) => {
|
|
2219
2460
|
if (!/^[a-z0-9][a-z0-9._-]*$/i.test(slug) || slug.includes('..')) return null;
|
|
2220
2461
|
try {
|
|
@@ -2384,7 +2625,7 @@ export function openLocalHome(opts: LocalHomeOptions): LocalHome {
|
|
|
2384
2625
|
// p8-fix-d F13 — the person's held typing is their step, never part of an AI run's stage.
|
|
2385
2626
|
if (!draft && o?.stageable === true && draftsHeld.has(slug)) releaseDrafts(slug);
|
|
2386
2627
|
if (!(!draft && o?.stageable === true && stageStroke(slug, text, o.baseText, o.writeId)))
|
|
2387
|
-
proposeStroke(slug, text, o?.baseText, o?.contested, draft);
|
|
2628
|
+
proposeStroke(slug, text, o?.baseText, o?.contested, draft, o?.label);
|
|
2388
2629
|
} else noteLane(slug, lane, text);
|
|
2389
2630
|
return null;
|
|
2390
2631
|
},
|
|
@@ -2393,6 +2634,34 @@ export function openLocalHome(opts: LocalHomeOptions): LocalHome {
|
|
|
2393
2634
|
const canvas = rel ? canvasOfRel(rel) : null;
|
|
2394
2635
|
if (canvas) stage.claim(key, canvas, hash ?? null);
|
|
2395
2636
|
},
|
|
2637
|
+
settleShellCall(key, call, claimed) {
|
|
2638
|
+
// N2 — each claimed file names its own lane of the canvas, never the whole canvas
|
|
2639
|
+
const lanes = (claimed ?? []).flatMap((repoRel) => {
|
|
2640
|
+
const rel = designRelOf(repoRel, designRel) ?? String(repoRel).replace(/^\/+/, '');
|
|
2641
|
+
const slug = rel ? canvasOfRel(rel) : null;
|
|
2642
|
+
return slug ? [{ slug, lane: shellClaimLane(rel as string) }] : [];
|
|
2643
|
+
});
|
|
2644
|
+
return stage.settleShellCall(key, call, lanes);
|
|
2645
|
+
},
|
|
2646
|
+
shellCall(key, call) {
|
|
2647
|
+
const w = stage.shellCall(key, call);
|
|
2648
|
+
if (!w) return null;
|
|
2649
|
+
const canvas = (repoRel: string) => {
|
|
2650
|
+
const rel = designRelOf(repoRel, designRel) ?? String(repoRel).replace(/^\/+/, '');
|
|
2651
|
+
return rel ? canvasOfRel(rel) : null;
|
|
2652
|
+
};
|
|
2653
|
+
return {
|
|
2654
|
+
all: w.all,
|
|
2655
|
+
covers: (repoRel) => {
|
|
2656
|
+
const c = canvas(repoRel);
|
|
2657
|
+
return !!c && w.covers(c);
|
|
2658
|
+
},
|
|
2659
|
+
left: (repoRel) => {
|
|
2660
|
+
const c = canvas(repoRel);
|
|
2661
|
+
return !!c && w.left(c);
|
|
2662
|
+
},
|
|
2663
|
+
};
|
|
2664
|
+
},
|
|
2396
2665
|
claimAiDelete(key, repoRel) {
|
|
2397
2666
|
const rel = designRelOf(repoRel, designRel) ?? String(repoRel).replace(/^\/+/, '');
|
|
2398
2667
|
const canvas = rel ? canvasOfRel(rel) : null;
|
|
@@ -2491,6 +2760,12 @@ export function openLocalHome(opts: LocalHomeOptions): LocalHome {
|
|
|
2491
2760
|
}
|
|
2492
2761
|
|
|
2493
2762
|
start();
|
|
2763
|
+
if (seenSweepMs > 0) {
|
|
2764
|
+
seenTimer = setInterval(() => {
|
|
2765
|
+
sweepSeen().catch((err) => log.warn(`[local-kernel] seen sweep failed: ${String(err)}`));
|
|
2766
|
+
}, seenSweepMs);
|
|
2767
|
+
(seenTimer as { unref?: () => void }).unref?.();
|
|
2768
|
+
}
|
|
2494
2769
|
|
|
2495
2770
|
return {
|
|
2496
2771
|
file,
|
|
@@ -2508,6 +2783,7 @@ export function openLocalHome(opts: LocalHomeOptions): LocalHome {
|
|
|
2508
2783
|
if (strokes.size) await Promise.allSettled([...strokes]);
|
|
2509
2784
|
await drain();
|
|
2510
2785
|
},
|
|
2786
|
+
sweepSeen,
|
|
2511
2787
|
foreignStores,
|
|
2512
2788
|
foreignHistory,
|
|
2513
2789
|
store: () => {
|
|
@@ -2519,6 +2795,8 @@ export function openLocalHome(opts: LocalHomeOptions): LocalHome {
|
|
|
2519
2795
|
closed = true;
|
|
2520
2796
|
if (timer) clearTimeout(timer);
|
|
2521
2797
|
if (retryTimer) clearInterval(retryTimer);
|
|
2798
|
+
if (seenTimer) clearInterval(seenTimer);
|
|
2799
|
+
seenTimer = null;
|
|
2522
2800
|
for (const o of foreignOpen.values()) o.db.close();
|
|
2523
2801
|
foreignOpen.clear();
|
|
2524
2802
|
try {
|
|
@@ -2672,7 +2950,15 @@ export function attachLocalHome<S extends SupervisorLike>(
|
|
|
2672
2950
|
// S2.20b (U20) — a collab room projecting its board (collab/index.ts): the person's strokes.
|
|
2673
2951
|
ctx.bus.on(
|
|
2674
2952
|
'annotations-projected',
|
|
2675
|
-
(
|
|
2953
|
+
(
|
|
2954
|
+
p: {
|
|
2955
|
+
slug?: unknown;
|
|
2956
|
+
board?: unknown;
|
|
2957
|
+
contested?: unknown;
|
|
2958
|
+
draft?: unknown;
|
|
2959
|
+
label?: unknown;
|
|
2960
|
+
} | null
|
|
2961
|
+
) => {
|
|
2676
2962
|
if (!isLocal() || typeof p?.slug !== 'string' || typeof p.board !== 'string') return;
|
|
2677
2963
|
// Emitted BEFORE the room's flush writes: the file still holds the board this stroke replaces.
|
|
2678
2964
|
const safe = /^[a-z0-9][a-z0-9._-]*$/i.test(p.slug) && !p.slug.includes('..');
|
|
@@ -2690,6 +2976,8 @@ export function attachLocalHome<S extends SupervisorLike>(
|
|
|
2690
2976
|
get()?.runtime.proposeLane(p.slug, 'annotations', p.board, {
|
|
2691
2977
|
...(before === undefined ? {} : { baseText: before }),
|
|
2692
2978
|
...(p.draft === true ? { draft: true } : {}),
|
|
2979
|
+
// T7.3b — the one gesture this projection flushes, in words (collab registry `takeFlushLabel`)
|
|
2980
|
+
...(typeof p.label === 'string' ? { label: p.label } : {}),
|
|
2693
2981
|
...(Array.isArray(p.contested)
|
|
2694
2982
|
? {
|
|
2695
2983
|
contested: p.contested
|
|
@@ -228,6 +228,11 @@ export interface LaneProposal {
|
|
|
228
228
|
* this proposal is its inverse (V2-1.5 §5.4), and lands as that edit's undo right behind it.
|
|
229
229
|
*/
|
|
230
230
|
undoes?: string;
|
|
231
|
+
/**
|
|
232
|
+
* T7.3b (#113) — the person's gesture in words ("Ticked “Write the post”"), the edit's label in
|
|
233
|
+
* place of the lane's. Untrusted canvas text: the hub link cleans it. A v1 hub stores it as any label.
|
|
234
|
+
*/
|
|
235
|
+
label?: string;
|
|
231
236
|
}
|
|
232
237
|
|
|
233
238
|
/** p8-fix-c2 — sends one lane proposal under the id (and dependency) the projection assigned. */
|
|
@@ -295,7 +300,7 @@ export interface DocProjection {
|
|
|
295
300
|
proposeLane(
|
|
296
301
|
lane: ProposalLane,
|
|
297
302
|
value: string,
|
|
298
|
-
opts?: { baseContent?: string; writeId?: string; stageable?: boolean }
|
|
303
|
+
opts?: { baseContent?: string; writeId?: string; stageable?: boolean; label?: string }
|
|
299
304
|
): Promise<ProposalOutcome> | null;
|
|
300
305
|
/**
|
|
301
306
|
* S2.20c — ⌘Z on the person's html edit `undoes` while it waits behind an AI run: put `value`
|
|
@@ -926,7 +931,8 @@ export function createDocProjection(opts: DocProjectionOptions): DocProjection {
|
|
|
926
931
|
op?: SourceOp,
|
|
927
932
|
replays = 0,
|
|
928
933
|
undoes?: string,
|
|
929
|
-
via?: ProposeVia
|
|
934
|
+
via?: ProposeVia,
|
|
935
|
+
label?: string
|
|
930
936
|
): Promise<ProposalOutcome> {
|
|
931
937
|
const link = opts.accepted as AcceptedLaneLink;
|
|
932
938
|
const prior = pending.get(lane);
|
|
@@ -1045,6 +1051,7 @@ export function createDocProjection(opts: DocProjectionOptions): DocProjection {
|
|
|
1045
1051
|
...(writeId ? { writeId } : {}),
|
|
1046
1052
|
...(stageable ? { stageable: true } : {}),
|
|
1047
1053
|
...(undoes ? { undoes } : {}),
|
|
1054
|
+
...(label ? { label } : {}),
|
|
1048
1055
|
});
|
|
1049
1056
|
return sent.then(settle, (err: unknown) => {
|
|
1050
1057
|
const code = (err as { code?: unknown })?.code;
|
|
@@ -1502,7 +1509,19 @@ export function createDocProjection(opts: DocProjectionOptions): DocProjection {
|
|
|
1502
1509
|
return Promise.resolve({ status: 'accepted' });
|
|
1503
1510
|
}
|
|
1504
1511
|
const base = o?.baseContent ?? (inFlight ? inFlight.lastValue : agreedValue(lane));
|
|
1505
|
-
return submit(
|
|
1512
|
+
return submit(
|
|
1513
|
+
lane,
|
|
1514
|
+
value,
|
|
1515
|
+
base,
|
|
1516
|
+
value,
|
|
1517
|
+
o?.writeId,
|
|
1518
|
+
o?.stageable === true,
|
|
1519
|
+
undefined,
|
|
1520
|
+
0,
|
|
1521
|
+
undefined,
|
|
1522
|
+
undefined,
|
|
1523
|
+
lane === 'annotations' ? o?.label : undefined
|
|
1524
|
+
);
|
|
1506
1525
|
},
|
|
1507
1526
|
proposeVia(lane, value, baseContent, via) {
|
|
1508
1527
|
if (!acceptedOn() || stopped) return null;
|
|
@@ -225,6 +225,12 @@ export function computeSeedProgress(input: SeedProgressInput): SeedProgress {
|
|
|
225
225
|
delivered += 1;
|
|
226
226
|
continue;
|
|
227
227
|
}
|
|
228
|
+
// 2.1.1 T14 — a conflict that already parked this Mac's version beside the file has nothing left to
|
|
229
|
+
// move (the hub holds both): delivered, though it stays listed for a person to look at.
|
|
230
|
+
if (state === 'conflict' && row.conflictCopy) {
|
|
231
|
+
delivered += 1;
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
228
234
|
if (state === 'ignored') {
|
|
229
235
|
ignored += 1;
|
|
230
236
|
continue;
|
|
@@ -241,6 +247,12 @@ export function computeSeedProgress(input: SeedProgressInput): SeedProgress {
|
|
|
241
247
|
heldDeletedHere += 1;
|
|
242
248
|
continue;
|
|
243
249
|
}
|
|
250
|
+
// 2.1.1 T13 — the project deleted it and this Mac is waiting for the person's answer, or kept the
|
|
251
|
+
// copy by choice: held here, never "waiting" to move.
|
|
252
|
+
if (state === 'delete-in-held' || state === 'kept-here') {
|
|
253
|
+
held += 1;
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
244
256
|
if (isHeldByConsent(row)) {
|
|
245
257
|
held += 1;
|
|
246
258
|
if (row.reason === CODE_MODULE_HELD_REASON) heldCode += 1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Bounded recovery slots, outside the rolling snapshot queue: a corrupt peer
|
|
2
2
|
// cannot evict the last valid source by flooding rejected updates (#121).
|
|
3
|
-
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
3
|
+
import { existsSync, lstatSync, readdirSync, readFileSync, realpathSync, statSync } from 'node:fs';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { atomicWrite } from './atomic-write.ts';
|
|
6
6
|
import { MAX_HTML_BYTES } from './limits.ts';
|
|
@@ -20,10 +20,63 @@ export interface RecoveryCandidate {
|
|
|
20
20
|
resolved: boolean;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* S1 (2.1.1) — the suffix of a file's recovery slots. A canvas's side files are all `.json`
|
|
25
|
+
* (`<slug>.annotations.json`, `<name>.meta.json`, `_comments/<slug>.json`), so naming a slot by the
|
|
26
|
+
* extension alone put the board, the layout and the comments in ONE `local.json`: the last lane a
|
|
27
|
+
* cold start set aside overwrote the copy of the one before (a first link lost the person's
|
|
28
|
+
* comments that way). Each lane keeps its own slot; `.tsx`/`.css` keep theirs.
|
|
29
|
+
*/
|
|
30
|
+
export function recoverySuffix(file: string): string {
|
|
31
|
+
const base = path.basename(file).toLowerCase();
|
|
32
|
+
if (base.endsWith('.annotations.json')) return '.annotations.json';
|
|
33
|
+
if (base.endsWith('.meta.json')) return '.meta.json';
|
|
34
|
+
if (path.basename(path.dirname(file)) === '_comments' && base.endsWith('.json'))
|
|
35
|
+
return '.comments.json';
|
|
36
|
+
return path.extname(file);
|
|
37
|
+
}
|
|
38
|
+
|
|
23
39
|
function candidatePath(historyDir: string, file: string): string {
|
|
24
40
|
return path.join(historyDir, 'sync-recovery', `candidate${path.extname(file)}.json`);
|
|
25
41
|
}
|
|
26
42
|
|
|
43
|
+
/**
|
|
44
|
+
* #168 T5.4 S1 — the recovery folder a WRITE may use, or a throw (callers report it as
|
|
45
|
+
* `snapshotFailed`). `historyDir` is `<designRoot>/_history/<slug>`: no folder from the design
|
|
46
|
+
* root down to `sync-recovery` may be a symlink, and the folder must resolve inside the design
|
|
47
|
+
* root, so a link planted under `_history` (a cloned repo can carry one) never carries the bytes
|
|
48
|
+
* elsewhere. The design root itself may sit behind a link (a shared design folder). The design
|
|
49
|
+
* root is the parent of the path's last `_history` segment; a path without one is anchored at
|
|
50
|
+
* `historyDir`'s parent.
|
|
51
|
+
*/
|
|
52
|
+
function writableRecoveryDir(historyDir: string): string {
|
|
53
|
+
const dir = path.resolve(historyDir, 'sync-recovery');
|
|
54
|
+
const parts = dir.split(path.sep);
|
|
55
|
+
const at = parts.lastIndexOf('_history');
|
|
56
|
+
const anchor =
|
|
57
|
+
at > 0 ? parts.slice(0, at).join(path.sep) || path.sep : path.dirname(path.resolve(historyDir));
|
|
58
|
+
let cur = anchor;
|
|
59
|
+
let deepest = anchor;
|
|
60
|
+
for (const seg of path.relative(anchor, dir).split(path.sep)) {
|
|
61
|
+
cur = path.join(cur, seg);
|
|
62
|
+
let st: ReturnType<typeof lstatSync>;
|
|
63
|
+
try {
|
|
64
|
+
st = lstatSync(cur);
|
|
65
|
+
} catch (error) {
|
|
66
|
+
if ((error as NodeJS.ErrnoException).code === 'ENOENT') break; // created as plain folders
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
if (st.isSymbolicLink()) throw new Error('Recovery folder is a symlink; not written');
|
|
70
|
+
if (!st.isDirectory()) throw new Error('Recovery folder is not a folder; not written');
|
|
71
|
+
deepest = cur;
|
|
72
|
+
}
|
|
73
|
+
const root = realpathSync(anchor);
|
|
74
|
+
const real = realpathSync(deepest);
|
|
75
|
+
if (real !== root && !real.startsWith(`${root}${path.sep}`))
|
|
76
|
+
throw new Error('Recovery folder is outside the design root; not written');
|
|
77
|
+
return dir;
|
|
78
|
+
}
|
|
79
|
+
|
|
27
80
|
function boundedBody(body: unknown): body is string | null {
|
|
28
81
|
return (
|
|
29
82
|
body === null || (typeof body === 'string' && Buffer.byteLength(body, 'utf8') <= MAX_HTML_BYTES)
|
|
@@ -66,6 +119,7 @@ export function preserveRecoveryCandidate(
|
|
|
66
119
|
throw new Error('Recovery source exceeds size limit');
|
|
67
120
|
const previous = readRecoveryCandidate(historyDir, file);
|
|
68
121
|
if (previous && !previous.resolved) return;
|
|
122
|
+
writableRecoveryDir(historyDir);
|
|
69
123
|
atomicWrite(
|
|
70
124
|
candidatePath(historyDir, file),
|
|
71
125
|
JSON.stringify({ version: 1, original, base, resolved: false })
|
|
@@ -76,6 +130,7 @@ export function preserveRecoveryCandidate(
|
|
|
76
130
|
export function resolveRecoveryCandidate(historyDir: string, file: string): void {
|
|
77
131
|
const previous = readRecoveryCandidate(historyDir, file);
|
|
78
132
|
if (!previous || previous.resolved) return;
|
|
133
|
+
writableRecoveryDir(historyDir);
|
|
79
134
|
atomicWrite(candidatePath(historyDir, file), JSON.stringify({ ...previous, resolved: true }));
|
|
80
135
|
}
|
|
81
136
|
|
|
@@ -87,7 +142,8 @@ export function saveRecoveryBody(
|
|
|
87
142
|
): string {
|
|
88
143
|
if (Buffer.byteLength(body, 'utf8') > MAX_HTML_BYTES)
|
|
89
144
|
throw new Error('Recovery source exceeds size limit');
|
|
90
|
-
const target = path.join(historyDir, 'sync-recovery', `${slot}${
|
|
145
|
+
const target = path.join(historyDir, 'sync-recovery', `${slot}${recoverySuffix(file)}`);
|
|
146
|
+
writableRecoveryDir(historyDir);
|
|
91
147
|
if (!existsSync(target) || readFileSync(target, 'utf8') !== body) atomicWrite(target, body);
|
|
92
148
|
return target;
|
|
93
149
|
}
|
|
@@ -98,7 +154,7 @@ export function readRecoveryBody(
|
|
|
98
154
|
file: string,
|
|
99
155
|
slot: RecoverySlot
|
|
100
156
|
): string | null {
|
|
101
|
-
const target = path.join(historyDir, 'sync-recovery', `${slot}${
|
|
157
|
+
const target = path.join(historyDir, 'sync-recovery', `${slot}${recoverySuffix(file)}`);
|
|
102
158
|
try {
|
|
103
159
|
if (statSync(target).size > MAX_HTML_BYTES) return null;
|
|
104
160
|
return readFileSync(target, 'utf8');
|