@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$comment": "Lead-owned (contract V2-1.11 §5.7). humanMax/pendingMax may only be lowered; raising either, or adding a humanDecisions reason, is a lead change citing a decision id.",
|
|
3
|
-
"humanMax":
|
|
3
|
+
"humanMax": 192,
|
|
4
4
|
"pendingMax": 0,
|
|
5
5
|
"pending": [],
|
|
6
6
|
"humanDecisions": {
|
|
@@ -298,6 +298,24 @@
|
|
|
298
298
|
"from": 184,
|
|
299
299
|
"by": "decision:maude/v2-207-7b-held-delete-answers",
|
|
300
300
|
"why": "2.0.7 #7b registers sync.delete-held-on-hub and sync.keep-held-on-hub (Sync details › Deleted on this Mac, held: Delete on the hub too… / Keep on the hub). Human 'hub-link': deleting a batch on the project's hub reaches every teammate, and which deleted files stay on the hub is the person's choice. Two human rows."
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"to": 188,
|
|
304
|
+
"from": 186,
|
|
305
|
+
"by": "decision:maude/v2-T5.3-held-row-actions-human",
|
|
306
|
+
"why": "#167 T5.3 registers sync.adopt-as-code and sync.open-canvas-folders (Sync details › a file the hub holds back from the code lane). Human 'hub-link' for Adopt as code: adopting teammate bytes as the owner's code is the owner's call (implicit adoption was rejected, v2-p8-holds-fix-no-implicit-owner-adoption). Human 'native-window' for Open canvas folders: it opens the person's editor on config.json, like canvas.open-in-editor. Two human rows."
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"to": 190,
|
|
310
|
+
"from": 188,
|
|
311
|
+
"by": "decision:maude/v2-2.1.1-t13-incoming-held-delete-answers",
|
|
312
|
+
"why": "2.1.1 T13 registers sync.remove-held-here and sync.keep-held-here (Sync details › Deleted by the project, held: Remove here too / Keep them here). Human 'hub-link': removing a batch of the project's files from this Mac, and which deleted files stay on it, is the person's choice. Two human rows."
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"to": 192,
|
|
316
|
+
"from": 190,
|
|
317
|
+
"by": "decision:maude/v2-211-t4-switch-account-existing-profile",
|
|
318
|
+
"why": "2.1.1 B1/B2 register account.add-cloud (a new Maude Cloud account signs in in the person's browser) and account.link-server (a server sign-in on that server's page). Human 'native-window': an agent never signs anyone in. Two human rows."
|
|
301
319
|
}
|
|
302
320
|
],
|
|
303
321
|
"humanMaxRaisedNote": "V2-5 A1 integration: the three slice raises stack on 86 (84 -> 86 by decision:maude/v2-4-gate-github-doors, human 'accounts'). S4.1/S4.3/S4.4 and S2.2-S2.4 add no human row. 86 + 4 + 6 + 4 = 100 human actions in the merged registry. V2-5 A2 integration: S5.4 builds `maude design runs list|stop`, so ai.runs.list and ai.stop turn cli (decision:maude/v2-S5.3-run-actions-human-until-s5.4 resolved by decision:maude/v2-S5.4-runs-fallback-prompts) and the cap lowers 100 -> 98; S3.1, S4.2, S4.5, S9.4, S2.5 and S1.4 add no human row. V2-5 A4 integration: measured 107 human actions in the merged registry (98 on feat + tool.pointer from S3.2b + 7 chat.advanced.* from S5.12 + object.select-matching from S2.6); every other A4 slice adds no human row. V2-5 A5 integration: measured 113 human actions in the merged registry (107 on feat + trash.clear from S1.7b + four ai.attach-* from S5.10 + present.presenter-view from S3.6b); every other A5 slice adds no human row. V2-5 A6a integration: measured 118 human actions in the merged registry (113 on feat + artboard.ask-ai S2.10 + element.set-id S2.2b/lead + edit.undo-history S2.20 + history.filter S1.12b − view.trash S1.17 (cli) + tab.overview + tab.rename S1.22b); every other A6a slice adds no human row."
|
|
@@ -402,7 +402,8 @@ export function createSaveHold(opts: SaveHoldOptions = {}) {
|
|
|
402
402
|
return;
|
|
403
403
|
}
|
|
404
404
|
const w = windows.get(call);
|
|
405
|
-
|
|
405
|
+
// F5 — a close that names its owner ends only that owner's window (never another run's)
|
|
406
|
+
if (!w || (owner !== undefined && w.owner !== owner)) return;
|
|
406
407
|
windows.delete(call);
|
|
407
408
|
const t = now();
|
|
408
409
|
for (const f of w.files) closedAt.set(f, t);
|
|
@@ -11,6 +11,11 @@ export interface WriteClaimRun {
|
|
|
11
11
|
runId: string;
|
|
12
12
|
chatId: string;
|
|
13
13
|
label: string;
|
|
14
|
+
/**
|
|
15
|
+
* D5 — is the run still live? A claim rides every continuation of the request that set it (a timer,
|
|
16
|
+
* a job it started), so it is re-checked whenever it is read: an ended run claims nothing more.
|
|
17
|
+
*/
|
|
18
|
+
live?: () => boolean;
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
/**
|
|
@@ -35,5 +40,6 @@ export function noWriteClaim<T>(fn: () => T): T {
|
|
|
35
40
|
/** The run the current request writes for, or null (a person's request, or none at all). */
|
|
36
41
|
export function currentWriteClaim(): WriteClaimRun | null {
|
|
37
42
|
const s = scope.getStore();
|
|
38
|
-
|
|
43
|
+
if (s === undefined || s === NONE) return null;
|
|
44
|
+
return s.live && !s.live() ? null : s;
|
|
39
45
|
}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
// A canvas-origin request never reaches either door — the table routes wrapped here are main-only (an
|
|
22
22
|
// `origin: 'canvas'` spec is never wrapped), and the agent routes refuse any browser request.
|
|
23
23
|
|
|
24
|
+
import { SETTLE_WAIT_MS, SHELL_STALE_MS } from '../sync/action-stage.ts';
|
|
24
25
|
import { laneValueFromFile } from '../sync/codec.ts';
|
|
25
26
|
import { hashBytes } from '../sync/echo-guard.ts';
|
|
26
27
|
import { CHAT_HEADER, type CreateClaimRuns, runForCreate } from './create-claim.ts';
|
|
@@ -48,7 +49,10 @@ export function routeWriteClaim(
|
|
|
48
49
|
runs: CreateClaimRuns | null | undefined
|
|
49
50
|
): WriteClaimRun | null {
|
|
50
51
|
if (req.method === 'GET' || req.method === 'HEAD' || req.method === 'OPTIONS') return null;
|
|
51
|
-
|
|
52
|
+
const run = runForCreate(req, runs);
|
|
53
|
+
if (!run) return null;
|
|
54
|
+
// D5 — the claim lasts only while that run is this chat's live run
|
|
55
|
+
return { ...run, live: () => runForChat(run.chatId, runs)?.runId === run.runId };
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
/** The slice of a sync runtime a claim needs (sync/index.ts / sync/local-kernel.ts). */
|
|
@@ -59,11 +63,32 @@ export interface ClaimControl {
|
|
|
59
63
|
meta?: { runId?: string; chatId?: string; actor?: string; claimOnly?: boolean }
|
|
60
64
|
): void;
|
|
61
65
|
claimAiWrite?(key: string, repoRel: string, hash?: string | null): void;
|
|
66
|
+
/** p8-a1-claims (F17) — run `key` is about to delete canvas `repoRel`: the delete joins the run. */
|
|
67
|
+
claimAiDelete?(key: string, repoRel: string): void;
|
|
68
|
+
/**
|
|
69
|
+
* #164 — run `key`'s call `call` settled: its parked writes join that run when their bytes are
|
|
70
|
+
* claimed, or go outside. F5 — false when that run has no window for the call (nothing resolved).
|
|
71
|
+
*/
|
|
72
|
+
settleShellCall?(key: string, call: string, claimed?: readonly string[]): boolean;
|
|
73
|
+
/** F5 / F6 — run `key`'s window for call `call` (repo-relative paths), or null. */
|
|
74
|
+
shellCall?(
|
|
75
|
+
key: string,
|
|
76
|
+
call: string
|
|
77
|
+
): { all: boolean; covers(repoRel: string): boolean; left(repoRel: string): boolean } | null;
|
|
62
78
|
}
|
|
63
79
|
|
|
80
|
+
/** POST /_api/agent/write/claim and a settle — at most this many bytes per call. */
|
|
81
|
+
export const CLAIM_MAX_BYTES = 16 * 1024 * 1024;
|
|
82
|
+
/** F4 — a settle's pending batches: calls at once, files per call, bytes in all. */
|
|
83
|
+
const PENDING_MAX_CALLS = 64;
|
|
84
|
+
const PENDING_MAX_FILES = 1_024;
|
|
85
|
+
const PENDING_MAX_TOTAL_BYTES = 4 * CLAIM_MAX_BYTES;
|
|
86
|
+
/** F4 — failed calls remembered (so their last batch claims nothing), at most this many. */
|
|
87
|
+
const FAILED_MAX = 256;
|
|
88
|
+
|
|
64
89
|
/** The hash the stage keys a lane value by (`${slug}|${hashBytes(value)}`), from the file's bytes. */
|
|
65
90
|
export function claimHashOf(repoRel: string, text: string): string | null {
|
|
66
|
-
if (/\.tsx$/i.test(repoRel)) return hashBytes(text);
|
|
91
|
+
if (/\.(?:tsx|jsx)$/i.test(repoRel)) return hashBytes(text);
|
|
67
92
|
const lane = /\.meta\.json$/i.test(repoRel)
|
|
68
93
|
? 'meta'
|
|
69
94
|
: /\.annotations\.json$/i.test(repoRel)
|
|
@@ -124,9 +149,135 @@ export function claimWritesForChat(
|
|
|
124
149
|
*/
|
|
125
150
|
export function hookClaims(
|
|
126
151
|
control: () => (ClaimControl & { beginAiAction?: ShellBegin }) | null | undefined,
|
|
127
|
-
designRel: string
|
|
152
|
+
designRel: string,
|
|
153
|
+
opts: { log?: Pick<Console, 'warn'> } = {}
|
|
128
154
|
) {
|
|
155
|
+
const log = opts.log ?? console;
|
|
156
|
+
/**
|
|
157
|
+
* F4 / D3 — run+call → the batches of its settle that said `more` (claimed only once the last one
|
|
158
|
+
* arrives). Bounded: at most PENDING_MAX_CALLS calls, PENDING_MAX_FILES files and CLAIM_MAX_BYTES
|
|
159
|
+
* bytes per call (PENDING_MAX_TOTAL_BYTES in all); a call idle for SETTLE_WAIT_MS expires. A call that
|
|
160
|
+
* hits any of these FAILS: what it parked goes out as outside at once, its later batches are refused,
|
|
161
|
+
* and the log says so. A live call is never evicted to make room.
|
|
162
|
+
*/
|
|
163
|
+
const pending = new Map<
|
|
164
|
+
string,
|
|
165
|
+
{ changed: Map<string, string | null>; bytes: number; timer?: ReturnType<typeof setTimeout> }
|
|
166
|
+
>();
|
|
167
|
+
/** Calls that failed (key → when): their last batch claims nothing. */
|
|
168
|
+
const failed = new Map<string, number>();
|
|
169
|
+
const keyOf = (run: string, call: string) => `${run}\u0000${call}`;
|
|
170
|
+
const sizeOf = (t: string | null) => (t === null ? 0 : Buffer.byteLength(t));
|
|
171
|
+
let total = 0;
|
|
172
|
+
const drop = (k: string) => {
|
|
173
|
+
const p = pending.get(k);
|
|
174
|
+
if (!p) return;
|
|
175
|
+
if (p.timer) clearTimeout(p.timer);
|
|
176
|
+
total -= p.bytes;
|
|
177
|
+
pending.delete(k);
|
|
178
|
+
};
|
|
179
|
+
const fail = (run: string, call: string, why: string) => {
|
|
180
|
+
const k = keyOf(run, call);
|
|
181
|
+
drop(k);
|
|
182
|
+
const t = Date.now();
|
|
183
|
+
for (const [f, at] of failed) if (t - at > SHELL_STALE_MS) failed.delete(f);
|
|
184
|
+
while (failed.size >= FAILED_MAX) failed.delete(failed.keys().next().value as string);
|
|
185
|
+
failed.set(k, t);
|
|
186
|
+
log.warn(
|
|
187
|
+
`[ai/write-claim] an AI call's changes could not be matched (${why}): they are recorded as outside changes.`
|
|
188
|
+
);
|
|
189
|
+
control()?.settleShellCall?.(run, call, []);
|
|
190
|
+
};
|
|
129
191
|
return {
|
|
192
|
+
/**
|
|
193
|
+
* F5 / F6 — run `r`'s window for call `call` (`covers` / `left` take design-root-relative paths), or
|
|
194
|
+
* null when it has none: a settle for it is refused.
|
|
195
|
+
*/
|
|
196
|
+
scope(
|
|
197
|
+
r: { run: string },
|
|
198
|
+
call: string
|
|
199
|
+
): { all: boolean; covers(rel: string): boolean; left(rel: string): boolean } | null {
|
|
200
|
+
const w = control()?.shellCall?.(r.run, call) ?? null;
|
|
201
|
+
if (!w) return null;
|
|
202
|
+
return {
|
|
203
|
+
all: w.all,
|
|
204
|
+
covers: (rel) => w.covers(`${designRel}/${rel}`),
|
|
205
|
+
left: (rel) => w.left(`${designRel}/${rel}`),
|
|
206
|
+
};
|
|
207
|
+
},
|
|
208
|
+
/**
|
|
209
|
+
* #164 — POST /_api/agent/bash/settle's server half: the call's post-call bytes the studio re-read
|
|
210
|
+
* from the disk (`changed`, design-root-relative; `text` null = deleted) are claimed for `r`, then the
|
|
211
|
+
* call settles — its parked writes join the run when their bytes are claimed, else go out as outside.
|
|
212
|
+
* A batch with more to come (`final` false) only waits. `ok: false` = refused (no window of `r` for
|
|
213
|
+
* the call, or the call failed): nothing is claimed.
|
|
214
|
+
*/
|
|
215
|
+
settle(
|
|
216
|
+
r: { run: string; label: string | null },
|
|
217
|
+
call: string,
|
|
218
|
+
batch: ReadonlyArray<{ rel: string; text: string | null }>,
|
|
219
|
+
final = true
|
|
220
|
+
): { ok: boolean; code?: string } {
|
|
221
|
+
const k = keyOf(r.run, call);
|
|
222
|
+
const c = control();
|
|
223
|
+
if (failed.has(k)) {
|
|
224
|
+
if (final) failed.delete(k);
|
|
225
|
+
return { ok: false, code: 'settle-failed' };
|
|
226
|
+
}
|
|
227
|
+
if (!c?.shellCall?.(r.run, call)) {
|
|
228
|
+
drop(k);
|
|
229
|
+
return { ok: false, code: 'no-window' };
|
|
230
|
+
}
|
|
231
|
+
let p = pending.get(k);
|
|
232
|
+
if (!p) {
|
|
233
|
+
if (!final && pending.size >= PENDING_MAX_CALLS) {
|
|
234
|
+
fail(r.run, call, 'too many calls settling at once');
|
|
235
|
+
return { ok: false, code: 'settle-failed' };
|
|
236
|
+
}
|
|
237
|
+
p = { changed: new Map(), bytes: 0 };
|
|
238
|
+
pending.set(k, p);
|
|
239
|
+
}
|
|
240
|
+
// paths dedupe: a later batch's bytes for the same file replace the earlier ones
|
|
241
|
+
for (const w of batch) {
|
|
242
|
+
const prev = p.changed.get(w.rel);
|
|
243
|
+
const delta = sizeOf(w.text) - (prev === undefined ? 0 : sizeOf(prev));
|
|
244
|
+
p.changed.set(w.rel, w.text);
|
|
245
|
+
p.bytes += delta;
|
|
246
|
+
total += delta;
|
|
247
|
+
}
|
|
248
|
+
if (
|
|
249
|
+
p.changed.size > PENDING_MAX_FILES ||
|
|
250
|
+
p.bytes > CLAIM_MAX_BYTES ||
|
|
251
|
+
total > PENDING_MAX_TOTAL_BYTES
|
|
252
|
+
) {
|
|
253
|
+
fail(r.run, call, 'too large');
|
|
254
|
+
return { ok: false, code: 'settle-failed' };
|
|
255
|
+
}
|
|
256
|
+
if (p.timer) clearTimeout(p.timer);
|
|
257
|
+
if (!final) {
|
|
258
|
+
const live = p;
|
|
259
|
+
live.timer = setTimeout(() => {
|
|
260
|
+
if (pending.get(k) === live) fail(r.run, call, 'its last batch never arrived');
|
|
261
|
+
}, SETTLE_WAIT_MS);
|
|
262
|
+
(live.timer as { unref?: () => void }).unref?.();
|
|
263
|
+
return { ok: true };
|
|
264
|
+
}
|
|
265
|
+
const changed = [...p.changed];
|
|
266
|
+
drop(k);
|
|
267
|
+
const run = { runId: r.run, chatId: '', label: r.label || 'Claude Code' };
|
|
268
|
+
const claimed: string[] = [];
|
|
269
|
+
for (const [rel, text] of changed) {
|
|
270
|
+
// D4 — a delete the stage saw happen is already recorded; it arms no claim that would outlive
|
|
271
|
+
// the settle (a later delete or create of that canvas is not this call's)
|
|
272
|
+
if (text === null) continue;
|
|
273
|
+
const repoRel = `${designRel}/${rel}`;
|
|
274
|
+
claimWrite(c, run, repoRel, text);
|
|
275
|
+
claimed.push(repoRel);
|
|
276
|
+
}
|
|
277
|
+
return c.settleShellCall?.(r.run, call, claimed) === false
|
|
278
|
+
? { ok: false, code: 'no-window' }
|
|
279
|
+
: { ok: true };
|
|
280
|
+
},
|
|
130
281
|
claim(r: { run: string; label: string | null }, rel: string, after: string): void {
|
|
131
282
|
claimWrite(
|
|
132
283
|
control(),
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
import type { HostLookup } from './ai-write.ts';
|
|
27
27
|
import { parseHostRef } from './elements/_shared.ts';
|
|
28
|
+
import { itemsByList, progressOf } from './elements/checkitem.model.ts';
|
|
28
29
|
import { stripUnsafe } from './fields.ts';
|
|
29
30
|
import { defOf } from './registry.ts';
|
|
30
31
|
import { Scene } from './scene.ts';
|
|
@@ -165,7 +166,11 @@ function projectExtensions(el: AnnotationElement, out: ProjectedElement): void {
|
|
|
165
166
|
const h = el[field];
|
|
166
167
|
if (isRec(h)) out[key] = { ref: h.ref, label: h.label };
|
|
167
168
|
}
|
|
168
|
-
if (el.type === '
|
|
169
|
+
if (el.type === 'checkitem') {
|
|
170
|
+
out.list = el.list;
|
|
171
|
+
out.done = isRec(el.done);
|
|
172
|
+
if (isRec(el.done)) out.doneBy = el.done.by;
|
|
173
|
+
} else if (el.type === 'stamp') {
|
|
169
174
|
out.stamp = { kind: el.kind, ...(typeof el.target === 'string' ? { target: el.target } : {}) };
|
|
170
175
|
} else if (el.type === 'vote') {
|
|
171
176
|
out.vote = {
|
|
@@ -177,7 +182,28 @@ function projectExtensions(el: AnnotationElement, out: ProjectedElement): void {
|
|
|
177
182
|
}
|
|
178
183
|
}
|
|
179
184
|
|
|
180
|
-
|
|
185
|
+
/** A checklist sticky's entries and progress — the AI reads the list as one thing (#113). */
|
|
186
|
+
function projectChecklist(
|
|
187
|
+
out: ProjectedElement,
|
|
188
|
+
entries: readonly AnnotationElement[] | undefined
|
|
189
|
+
): void {
|
|
190
|
+
if (!entries?.length) return;
|
|
191
|
+
out.items = entries.map((e) => ({
|
|
192
|
+
id: e.id,
|
|
193
|
+
text: typeof e.text === 'string' ? e.text : '',
|
|
194
|
+
done: isRec(e.done),
|
|
195
|
+
...(isRec(e.done) ? { doneBy: e.done.by } : {}),
|
|
196
|
+
}));
|
|
197
|
+
const p = progressOf(entries);
|
|
198
|
+
out.progress = `${p.done}/${p.total}`;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function projectOne(
|
|
202
|
+
scene: Scene,
|
|
203
|
+
el: AnnotationElement,
|
|
204
|
+
full: boolean,
|
|
205
|
+
lists: ReadonlyMap<string, AnnotationElement[]>
|
|
206
|
+
): ProjectedElement {
|
|
181
207
|
const out: ProjectedElement = { id: el.id, type: el.type };
|
|
182
208
|
if (el.type === 'arrow') {
|
|
183
209
|
const from = endHost(el.start);
|
|
@@ -205,12 +231,15 @@ function projectOne(scene: Scene, el: AnnotationElement, full: boolean): Project
|
|
|
205
231
|
// #137 — an agent must see the lock before it tries to move the element.
|
|
206
232
|
if (el.locked === true) out.locked = true;
|
|
207
233
|
projectExtensions(el, out);
|
|
234
|
+
if (el.type === 'sticky') projectChecklist(out, lists.get(el.id));
|
|
208
235
|
// Style of KNOWN types only: an unknown type's keys are arbitrary peer data.
|
|
209
236
|
const known = defOf(el.type);
|
|
210
237
|
if (full && known) {
|
|
211
238
|
const style: Record<string, unknown> = {};
|
|
212
239
|
for (const [k, v] of Object.entries(el)) {
|
|
213
240
|
if (STRUCTURAL.has(k) || !Object.hasOwn(known.fields, k)) continue;
|
|
241
|
+
// A checkitem's `list` / `done` are projected as `list` / `done` above (not a sticky's bullet style).
|
|
242
|
+
if (el.type === 'checkitem' && (k === 'list' || k === 'done')) continue;
|
|
214
243
|
// The shape label's text is already `text`; keep only its styling.
|
|
215
244
|
if (k === 'label' && defOf(el.type)?.caps.textSlot === 'label') {
|
|
216
245
|
const { text: _t, ...rest } = (v ?? {}) as Record<string, unknown>;
|
|
@@ -306,10 +335,12 @@ export function projectBoard(
|
|
|
306
335
|
elements: Iterable<AnnotationElement>,
|
|
307
336
|
opts: ProjectOpts = {}
|
|
308
337
|
): Projection {
|
|
309
|
-
const
|
|
338
|
+
const all = [...elements];
|
|
339
|
+
const scene = new Scene(all);
|
|
340
|
+
const lists = itemsByList(all);
|
|
310
341
|
const full = opts.full === true;
|
|
311
342
|
const build = (el: AnnotationElement): ProjectedElement => {
|
|
312
|
-
const out = projectOne(scene, el, full);
|
|
343
|
+
const out = projectOne(scene, el, full, lists);
|
|
313
344
|
if (defOf(el.type)?.caps.container) out.members = readingOrder(scene, el.id).map(build);
|
|
314
345
|
return out;
|
|
315
346
|
};
|
|
@@ -321,10 +352,15 @@ export function projectBoard(
|
|
|
321
352
|
}
|
|
322
353
|
roots = [sec];
|
|
323
354
|
} else {
|
|
324
|
-
|
|
355
|
+
// Q5: ballots stay secret. A checkitem is part of its sticky (`items`), never a top-level element —
|
|
356
|
+
// unless asked for by `--type checkitem`, then only the genuine ones (an orphan is inert).
|
|
357
|
+
roots = scene.childrenOf(null).filter((e) => e.type !== 'ballot' && e.type !== 'checkitem');
|
|
325
358
|
}
|
|
326
|
-
let tree = roots.map(build);
|
|
327
359
|
const types = opts.types?.size ? opts.types : null;
|
|
360
|
+
if (!opts.within && types?.has('checkitem')) {
|
|
361
|
+
for (const entries of lists.values()) roots.push(...entries);
|
|
362
|
+
}
|
|
363
|
+
let tree = roots.map(build);
|
|
328
364
|
if (types) tree = pruneTree(tree, (e) => types.has(e.type));
|
|
329
365
|
return { untrusted: UNTRUSTED_NOTE, elements: tree };
|
|
330
366
|
}
|
|
@@ -18,8 +18,12 @@
|
|
|
18
18
|
* instead of overwriting it (DDR-242 §4).
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
+
import { guardLockedLists, withItemDeletes } from './checklist-ops.ts';
|
|
22
|
+
import { DEFAULT_FONT_SIZE } from './constants.ts';
|
|
21
23
|
import { type ParsedHostRef, parseHostRef } from './elements/_shared.ts';
|
|
22
24
|
import { anchorPoint, facingAnchor } from './elements/arrow.model.ts';
|
|
25
|
+
import { itemsOf, MAX_CHECK_ITEMS } from './elements/checkitem.model.ts';
|
|
26
|
+
import { fitSticky } from './elements/sticky.model.ts';
|
|
23
27
|
import { compareOrder, keyBetween } from './fractional-index.ts';
|
|
24
28
|
import { guardLockedOps, isLocked } from './lock.ts';
|
|
25
29
|
import { type ApplyResult, applyOps, type Op } from './ops.ts';
|
|
@@ -94,6 +98,37 @@ export interface AiBatchOptions {
|
|
|
94
98
|
now?: () => Date;
|
|
95
99
|
}
|
|
96
100
|
|
|
101
|
+
/** Entries of a new checklist, as the agent wrote them: `["text", { "text", "done"? }, …]`. */
|
|
102
|
+
export interface ChecklistEntry {
|
|
103
|
+
text: string;
|
|
104
|
+
done: boolean;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The `items` shorthand of a sticky create (contract 113-checklist §5.7), validated: at most
|
|
109
|
+
* `MAX_CHECK_ITEMS` entries, each a string or `{ text, done? }`. It is expanded into `checkitem`
|
|
110
|
+
* records and never stored on the sticky.
|
|
111
|
+
*/
|
|
112
|
+
export function parseChecklistEntries(raw: unknown, what: string): ChecklistEntry[] {
|
|
113
|
+
if (!Array.isArray(raw)) throw new AiOpError(`${what}: items must be an array`);
|
|
114
|
+
if (raw.length > MAX_CHECK_ITEMS) {
|
|
115
|
+
throw new AiOpError(
|
|
116
|
+
`${what}: a checklist holds ${MAX_CHECK_ITEMS} items at most (got ${raw.length})`
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
return raw.map((e, i) => {
|
|
120
|
+
if (typeof e === 'string') return { text: e, done: false };
|
|
121
|
+
if (isRec(e) && (e.text === undefined || typeof e.text === 'string')) {
|
|
122
|
+
const done = e.done;
|
|
123
|
+
if (done !== undefined && typeof done !== 'boolean' && done !== null) {
|
|
124
|
+
throw new AiOpError(`${what}: items[${i}].done is true or false`);
|
|
125
|
+
}
|
|
126
|
+
return { text: typeof e.text === 'string' ? e.text : '', done: done === true };
|
|
127
|
+
}
|
|
128
|
+
throw new AiOpError(`${what}: items[${i}] is a string or { "text", "done"? }`);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
97
132
|
export function mintId(prefix = 's'): string {
|
|
98
133
|
return `${prefix}_${Math.random().toString(36).slice(2, 10).padEnd(8, '0')}`;
|
|
99
134
|
}
|
|
@@ -195,6 +230,16 @@ export class AiBatch {
|
|
|
195
230
|
`unlock it first with {"op":"update","id":"${id}","locked":false} only if the user asked`
|
|
196
231
|
);
|
|
197
232
|
}
|
|
233
|
+
// #113 — a checklist's entries are their own records, so the sticky's lock does not cover them:
|
|
234
|
+
// a locked list still ticks, but its entries are not added, reworded, removed or reordered.
|
|
235
|
+
const lockedLists = guardLockedLists(this.state, ops);
|
|
236
|
+
if (lockedLists.blocked) {
|
|
237
|
+
throw new AiOpError(
|
|
238
|
+
`${what}: "${lockedLists.ids[0]}" is an item of a locked checklist — the user pinned it ` +
|
|
239
|
+
'(ticking is still allowed); unlock the checklist first with ' +
|
|
240
|
+
'{"op":"update","id":"<its sticky id>","locked":false} only if the user asked'
|
|
241
|
+
);
|
|
242
|
+
}
|
|
198
243
|
const r = applyOps(this.state, ops);
|
|
199
244
|
if (r.rejected.length) {
|
|
200
245
|
const x = r.rejected[0] as ApplyResult['rejected'][number];
|
|
@@ -273,6 +318,13 @@ export class AiBatch {
|
|
|
273
318
|
else set[k] = v;
|
|
274
319
|
};
|
|
275
320
|
for (const [k0, v] of Object.entries(raw)) {
|
|
321
|
+
if (k0 === 'items') {
|
|
322
|
+
// Only `create sticky` takes the shorthand (create() strips it first); it is never a field.
|
|
323
|
+
throw new AiOpError(
|
|
324
|
+
`${what}: "items" is only for creating a checklist sticky — to change one, ` +
|
|
325
|
+
'create / update / delete its checkitem records'
|
|
326
|
+
);
|
|
327
|
+
}
|
|
276
328
|
if (v === undefined || PLUMBING.has(k0) || k0 === 'x' || k0 === 'y') continue;
|
|
277
329
|
let k = k0;
|
|
278
330
|
let val = v;
|
|
@@ -293,6 +345,11 @@ export class AiBatch {
|
|
|
293
345
|
} else if (v === 'square') val = 'rect';
|
|
294
346
|
else if (v === 'circle') val = 'ellipse';
|
|
295
347
|
}
|
|
348
|
+
if (type === 'checkitem' && k === 'list' && cur) {
|
|
349
|
+
throw new AiOpError(
|
|
350
|
+
`${what}: an item can't move to another checklist — add it there instead`
|
|
351
|
+
);
|
|
352
|
+
}
|
|
296
353
|
if (IMMUTABLE.has(k)) {
|
|
297
354
|
throw new AiOpError(
|
|
298
355
|
`${what}: "${k}" can't be set here${k === 'parent' ? ' — use reparent' : ''}`
|
|
@@ -322,6 +379,23 @@ export class AiBatch {
|
|
|
322
379
|
);
|
|
323
380
|
}
|
|
324
381
|
}
|
|
382
|
+
if (type === 'checkitem' && k === 'done') {
|
|
383
|
+
// Like `resolved`: the agent says `true` (tick now, as the AI) or `false` / `null` (untick);
|
|
384
|
+
// it never forges who ticked or when.
|
|
385
|
+
if (val === true)
|
|
386
|
+
val = {
|
|
387
|
+
by: AI_RESOLVER,
|
|
388
|
+
at: this.now()
|
|
389
|
+
.toISOString()
|
|
390
|
+
.replace(/\.\d+Z$/, 'Z'),
|
|
391
|
+
};
|
|
392
|
+
else if (val === false) val = null;
|
|
393
|
+
else if (val !== null) {
|
|
394
|
+
throw new AiOpError(
|
|
395
|
+
`${what}: done is true (tick) or false (untick) — the board stamps who and when`
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
325
399
|
const parser = extField ?? spec[k];
|
|
326
400
|
if (val !== null && parser?.parse(val) === undefined) {
|
|
327
401
|
throw new AiOpError(`${what}: invalid value for ${type}.${k}: ${JSON.stringify(val)}`);
|
|
@@ -344,12 +418,34 @@ export class AiBatch {
|
|
|
344
418
|
`create: unknown type "${type}" (types: ${[...REGISTRY.keys()].join(', ')})`
|
|
345
419
|
);
|
|
346
420
|
}
|
|
421
|
+
// #113 — `items` is the checklist shorthand of a sticky: validated here, expanded into checkitem
|
|
422
|
+
// records after the sticky exists, and never stored. Any other type refuses it.
|
|
423
|
+
let entries: ChecklistEntry[] | null = null;
|
|
424
|
+
if (op.items !== undefined) {
|
|
425
|
+
if (type !== 'sticky') {
|
|
426
|
+
throw new AiOpError(
|
|
427
|
+
`${what}: "items" is only for a sticky (a checklist) — ${type} has no items`
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
entries = parseChecklistEntries(op.items, what);
|
|
431
|
+
const { items: _items, ...rest } = op;
|
|
432
|
+
op = rest;
|
|
433
|
+
}
|
|
434
|
+
if (type === 'checkitem') return this.createCheckItem(op, what);
|
|
347
435
|
const { set } = this.fields(type, op, null, what);
|
|
348
436
|
const world: Record<string, unknown> = { ...set };
|
|
349
437
|
if (def.caps.box) {
|
|
350
438
|
const size = CREATE_SIZE[type];
|
|
351
439
|
let w = num(op.w) ? op.w : size?.w;
|
|
352
440
|
let h = num(op.h) ? op.h : size?.h;
|
|
441
|
+
if (entries?.length && num(w) && num(h)) {
|
|
442
|
+
// Room for the entries (grows only) — the same fit the layer applies when a person adds one.
|
|
443
|
+
h = fitSticky(
|
|
444
|
+
{ w, h, fontSize: num(op.fontSize) ? op.fontSize : DEFAULT_FONT_SIZE },
|
|
445
|
+
typeof op.text === 'string' ? op.text : '',
|
|
446
|
+
entries
|
|
447
|
+
).h;
|
|
448
|
+
}
|
|
353
449
|
if (type === 'text' && (w === undefined || h === undefined)) {
|
|
354
450
|
const tb = textBox(
|
|
355
451
|
typeof op.text === 'string' ? op.text : '',
|
|
@@ -396,6 +492,51 @@ export class AiBatch {
|
|
|
396
492
|
this.apply([{ op: 'put', el: draft }], what);
|
|
397
493
|
if (typeof op.ref === 'string' && op.ref.startsWith('@')) this.refs.set(op.ref, id);
|
|
398
494
|
this.created.push(id);
|
|
495
|
+
for (const entry of entries ?? []) {
|
|
496
|
+
this.createCheckItem(
|
|
497
|
+
{ list: id, text: entry.text, ...(entry.done ? { done: true } : {}) },
|
|
498
|
+
`${what} items`
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
return id;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Create one checklist entry (`{ "op":"create", "type":"checkitem", "list": <sticky|@ref>, "text"?,
|
|
506
|
+
* "done"? }`). It has no position: `list` names the sticky, and the entry is appended after the
|
|
507
|
+
* list's last one.
|
|
508
|
+
*/
|
|
509
|
+
private createCheckItem(op: Record<string, unknown>, what: string): string {
|
|
510
|
+
if (op.list === undefined) {
|
|
511
|
+
throw new AiOpError(`${what}: needs list (the sticky id or @ref this item belongs to)`);
|
|
512
|
+
}
|
|
513
|
+
if (op.parent !== undefined && op.parent !== null) {
|
|
514
|
+
throw new AiOpError(`${what}: an item belongs to a list, not a section — use list`);
|
|
515
|
+
}
|
|
516
|
+
const list = this.resolve(op.list, what);
|
|
517
|
+
if (this.get(list).type !== 'sticky') {
|
|
518
|
+
throw new AiOpError(
|
|
519
|
+
`${what}: "${list}" is a ${this.get(list).type} — a checklist is a sticky`
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
const siblings = itemsOf(this.state.values(), list);
|
|
523
|
+
if (siblings.length >= MAX_CHECK_ITEMS) {
|
|
524
|
+
throw new AiOpError(
|
|
525
|
+
`${what}: "${list}" already has ${MAX_CHECK_ITEMS} items — the most a checklist holds`
|
|
526
|
+
);
|
|
527
|
+
}
|
|
528
|
+
const { set } = this.fields('checkitem', { ...op, list }, null, what);
|
|
529
|
+
const id = mintId('ck');
|
|
530
|
+
const draft = {
|
|
531
|
+
id,
|
|
532
|
+
type: 'checkitem',
|
|
533
|
+
index: keyBetween(siblings[siblings.length - 1]?.index ?? null, null),
|
|
534
|
+
...set,
|
|
535
|
+
author: { kind: 'ai' },
|
|
536
|
+
} as AnnotationElement;
|
|
537
|
+
this.apply([{ op: 'put', el: draft }], what);
|
|
538
|
+
if (typeof op.ref === 'string' && op.ref.startsWith('@')) this.refs.set(op.ref, id);
|
|
539
|
+
this.created.push(id);
|
|
399
540
|
return id;
|
|
400
541
|
}
|
|
401
542
|
|
|
@@ -800,7 +941,9 @@ export class AiBatch {
|
|
|
800
941
|
/** Delete (a section's children move up; arrows bound to it keep their endpoint). */
|
|
801
942
|
delete(op: Record<string, unknown>): void {
|
|
802
943
|
const id = this.resolve(op.id, 'delete');
|
|
803
|
-
|
|
804
|
-
this.
|
|
944
|
+
// A checklist sticky takes its entries with it, in the same batch (#113).
|
|
945
|
+
const ops = withItemDeletes(this.state, [{ op: 'delete', id }]);
|
|
946
|
+
this.apply(ops, `delete ${id}`);
|
|
947
|
+
for (const o of ops) if (o.op === 'delete') this.deleted.push(o.id);
|
|
805
948
|
}
|
|
806
949
|
}
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
* `annotate: <message>` and exits 2, as it always did).
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
import { DEFAULT_FONT_SIZE } from './constants.ts';
|
|
15
|
+
import { fitSticky } from './elements/sticky.model.ts';
|
|
16
|
+
|
|
14
17
|
export class BoardSpecError extends Error {}
|
|
15
18
|
|
|
16
19
|
/** One expanded op: the verb's op vocabulary, plus the relative `flowX/flowY` / `boardX/boardY` offsets. */
|
|
@@ -29,6 +32,8 @@ interface FlowEdge {
|
|
|
29
32
|
interface Card {
|
|
30
33
|
text?: unknown;
|
|
31
34
|
color?: unknown;
|
|
35
|
+
/** #113 — a checklist card: `["entry", { text, done? }]`, expanded into checkitem records. */
|
|
36
|
+
items?: unknown;
|
|
32
37
|
}
|
|
33
38
|
interface Group {
|
|
34
39
|
title?: unknown;
|
|
@@ -152,6 +157,26 @@ function cardText(card: unknown): string {
|
|
|
152
157
|
return typeof t === 'string' ? t : '';
|
|
153
158
|
}
|
|
154
159
|
|
|
160
|
+
/** A card's checklist entries as the agent wrote them (validated when the sticky is created), or none. */
|
|
161
|
+
function cardItems(card: unknown): unknown[] | undefined {
|
|
162
|
+
const i = card && typeof card === 'object' ? (card as Card).items : undefined;
|
|
163
|
+
return Array.isArray(i) ? i : undefined;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** The card's height: the fixed card, grown to hold its checklist entries (same fit the layer applies). */
|
|
167
|
+
function cardHeight(card: unknown): number {
|
|
168
|
+
const items = cardItems(card);
|
|
169
|
+
if (!items?.length) return BOARD_CARD_H;
|
|
170
|
+
const rows = items.map((e) => ({
|
|
171
|
+
text: typeof e === 'string' ? e : (e as { text?: unknown } | null)?.text,
|
|
172
|
+
}));
|
|
173
|
+
return fitSticky(
|
|
174
|
+
{ w: BOARD_CARD_W, h: BOARD_CARD_H, fontSize: DEFAULT_FONT_SIZE },
|
|
175
|
+
cardText(card),
|
|
176
|
+
rows
|
|
177
|
+
).h;
|
|
178
|
+
}
|
|
179
|
+
|
|
155
180
|
function cardColor(card: unknown): string | undefined {
|
|
156
181
|
const c = card && typeof card === 'object' ? (card as Card).color : undefined;
|
|
157
182
|
return typeof c === 'string' ? c : undefined;
|
|
@@ -218,8 +243,9 @@ function boardColumns(groups: Group[]): BoardOp[] {
|
|
|
218
243
|
const ops: BoardOp[] = [];
|
|
219
244
|
groups.forEach((g, i) => {
|
|
220
245
|
const cards = cardsOf(g);
|
|
246
|
+
const heights = cards.map(cardHeight);
|
|
221
247
|
const h = cards.length
|
|
222
|
-
? BOARD_HEADER_H +
|
|
248
|
+
? BOARD_HEADER_H + heights.reduce((sum, ch) => sum + ch + BOARD_CARD_GAP, 0)
|
|
223
249
|
: BOARD_EMPTY_SECTION_H;
|
|
224
250
|
const colX = i * (BOARD_COL_W + BOARD_COL_GAP);
|
|
225
251
|
ops.push({
|
|
@@ -234,19 +260,23 @@ function boardColumns(groups: Group[]): BoardOp[] {
|
|
|
234
260
|
h,
|
|
235
261
|
parent: null,
|
|
236
262
|
});
|
|
263
|
+
let y = BOARD_HEADER_H;
|
|
237
264
|
cards.forEach((c, j) => {
|
|
265
|
+
const items = cardItems(c);
|
|
238
266
|
ops.push({
|
|
239
267
|
op: 'create',
|
|
240
268
|
type: 'sticky',
|
|
241
269
|
ref: `@sec${i}card${j}`,
|
|
242
270
|
text: cardText(c),
|
|
243
271
|
color: cardColor(c),
|
|
272
|
+
...(items ? { items } : {}),
|
|
244
273
|
boardX: colX + (BOARD_COL_W - BOARD_CARD_W) / 2,
|
|
245
|
-
boardY:
|
|
274
|
+
boardY: y,
|
|
246
275
|
w: BOARD_CARD_W,
|
|
247
|
-
h:
|
|
276
|
+
h: heights[j],
|
|
248
277
|
parent: `@sec${i}`,
|
|
249
278
|
});
|
|
279
|
+
y += (heights[j] as number) + BOARD_CARD_GAP;
|
|
250
280
|
});
|
|
251
281
|
});
|
|
252
282
|
return ops;
|
|
@@ -280,6 +310,7 @@ function boardRadial(spec: { title?: unknown }, groups: Group[]): BoardOp[] {
|
|
|
280
310
|
ref: `@idea${i}`,
|
|
281
311
|
text: cardText(c),
|
|
282
312
|
color: cardColor(c),
|
|
313
|
+
...(cardItems(c) ? { items: cardItems(c) } : {}),
|
|
283
314
|
boardX: cx - BOARD_RADIAL_CARD_W / 2,
|
|
284
315
|
boardY: cy - BOARD_RADIAL_CARD_H / 2,
|
|
285
316
|
w: BOARD_RADIAL_CARD_W,
|