@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
|
@@ -226,6 +226,9 @@ function documentBounds(root: FigmaNode): Bounds {
|
|
|
226
226
|
return { minX, minY, maxX, maxY };
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
+
/** Space between two pages laid out side by side, in board units. */
|
|
230
|
+
const PAGE_GAP = 400;
|
|
231
|
+
|
|
229
232
|
let idCounter = 0;
|
|
230
233
|
/** Deterministic per-run stroke ids — derived from the NODE ID, never text. */
|
|
231
234
|
function strokeId(nodeId: string, suffix = ''): string {
|
|
@@ -306,13 +309,35 @@ export function toStrokes(doc: NormalizedDocument, opts: ToStrokesOptions = {}):
|
|
|
306
309
|
const pendingImages: PendingImage[] = [];
|
|
307
310
|
const bounds = documentBounds(doc.root);
|
|
308
311
|
const origin = opts.originOverride ?? { x: bounds.minX, y: bounds.minY };
|
|
312
|
+
|
|
313
|
+
// PAGES (#155 §7). Every FigJam page lives in its own coordinate space, and
|
|
314
|
+
// they overlap freely — a second page drawn at (100, 100) is NOT next to the
|
|
315
|
+
// first. Translating the whole document by one origin stacked them on top of
|
|
316
|
+
// each other. With two or more visible pages each is normalised to its own
|
|
317
|
+
// corner and laid out in a row, left to right, in page order. A caller that
|
|
318
|
+
// pins an origin (a design page's annotation layer) keeps the single shift.
|
|
319
|
+
const pages = (doc.root.type === 'DOCUMENT' ? (doc.root.children ?? []) : []).filter(
|
|
320
|
+
(n) => n.type === 'CANVAS' && n.visible
|
|
321
|
+
);
|
|
322
|
+
const pageDeltas = new Map<FigmaNode, { dx: number; dy: number }>();
|
|
323
|
+
let layoutW = bounds.maxX - bounds.minX;
|
|
324
|
+
let layoutH = bounds.maxY - bounds.minY;
|
|
325
|
+
if (pages.length >= 2 && !opts.originOverride) {
|
|
326
|
+
let cursor = 0;
|
|
327
|
+
layoutH = 0;
|
|
328
|
+
for (const pg of pages) {
|
|
329
|
+
const pb = documentBounds(pg);
|
|
330
|
+
pageDeltas.set(pg, { dx: cursor - pb.minX, dy: -pb.minY });
|
|
331
|
+
cursor += pb.maxX - pb.minX + PAGE_GAP;
|
|
332
|
+
layoutH = Math.max(layoutH, pb.maxY - pb.minY);
|
|
333
|
+
}
|
|
334
|
+
layoutW = cursor - PAGE_GAP;
|
|
335
|
+
}
|
|
336
|
+
/** The shift of the page being visited. */
|
|
337
|
+
let delta = { dx: -origin.x, dy: -origin.y };
|
|
338
|
+
|
|
309
339
|
// Post-shift bounds, for D6b's geometry clamp.
|
|
310
|
-
const shifted: Bounds = {
|
|
311
|
-
minX: 0,
|
|
312
|
-
minY: 0,
|
|
313
|
-
maxX: bounds.maxX - bounds.minX,
|
|
314
|
-
maxY: bounds.maxY - bounds.minY,
|
|
315
|
-
};
|
|
340
|
+
const shifted: Bounds = { minX: 0, minY: 0, maxX: layoutW, maxY: layoutH };
|
|
316
341
|
|
|
317
342
|
const strokes: Stroke[] = [];
|
|
318
343
|
/** Figma node id → the stroke id it produced, for connector binding. */
|
|
@@ -320,9 +345,13 @@ export function toStrokes(doc: NormalizedDocument, opts: ToStrokesOptions = {}):
|
|
|
320
345
|
/** Figma node id → its shifted bbox, for the group-endpoint fallback. */
|
|
321
346
|
const nodeBBox = new Map<string, { x: number; y: number; w: number; h: number }>();
|
|
322
347
|
/** Connectors are resolved in a second pass — their hosts must exist first. */
|
|
323
|
-
const connectors: Array<{
|
|
348
|
+
const connectors: Array<{
|
|
349
|
+
node: FigmaNode;
|
|
350
|
+
groupIds: string[];
|
|
351
|
+
delta: { dx: number; dy: number };
|
|
352
|
+
}> = [];
|
|
324
353
|
|
|
325
|
-
const shift = (x: number, y: number) => ({ x: x
|
|
354
|
+
const shift = (x: number, y: number) => ({ x: x + delta.dx, y: y + delta.dy });
|
|
326
355
|
|
|
327
356
|
const emitText = (
|
|
328
357
|
node: FigmaNode,
|
|
@@ -406,9 +435,12 @@ export function toStrokes(doc: NormalizedDocument, opts: ToStrokesOptions = {}):
|
|
|
406
435
|
|
|
407
436
|
switch (node.type) {
|
|
408
437
|
case 'DOCUMENT':
|
|
409
|
-
case 'CANVAS':
|
|
438
|
+
case 'CANVAS': {
|
|
439
|
+
const pageDelta = pageDeltas.get(node);
|
|
440
|
+
if (pageDelta) delta = pageDelta;
|
|
410
441
|
for (const c of node.children ?? []) visit(c, groupIds, silent);
|
|
411
442
|
return;
|
|
443
|
+
}
|
|
412
444
|
|
|
413
445
|
case 'GROUP':
|
|
414
446
|
case 'FRAME': {
|
|
@@ -555,7 +587,7 @@ export function toStrokes(doc: NormalizedDocument, opts: ToStrokesOptions = {}):
|
|
|
555
587
|
|
|
556
588
|
case 'CONNECTOR':
|
|
557
589
|
// Deferred — hosts must exist before endpoints can bind.
|
|
558
|
-
connectors.push({ node, groupIds });
|
|
590
|
+
connectors.push({ node, groupIds, delta });
|
|
559
591
|
return;
|
|
560
592
|
|
|
561
593
|
case 'VECTOR':
|
|
@@ -733,7 +765,8 @@ export function toStrokes(doc: NormalizedDocument, opts: ToStrokesOptions = {}):
|
|
|
733
765
|
|
|
734
766
|
// ── Connector pass ────────────────────────────────────────────────────────
|
|
735
767
|
const strokeById = new Map(strokes.map((s) => [s.id, s]));
|
|
736
|
-
for (const { node, groupIds } of connectors) {
|
|
768
|
+
for (const { node, groupIds, delta: connectorDelta } of connectors) {
|
|
769
|
+
delta = connectorDelta;
|
|
737
770
|
const startNode = node.connectorStart;
|
|
738
771
|
const endNode = node.connectorEnd;
|
|
739
772
|
|
|
@@ -142,7 +142,9 @@ export interface FigmaPaint {
|
|
|
142
142
|
/** Present on IMAGE paints — the handle `/v1/images` resolves. */
|
|
143
143
|
imageRef?: string;
|
|
144
144
|
gradientStops?: Array<{ position: number; color: FigmaColor }>;
|
|
145
|
+
/** REST: three handles in the node's normalised box — start/centre, end/x-radius, width/y-radius. */
|
|
145
146
|
gradientHandlePositions?: Array<{ x: number; y: number }>;
|
|
147
|
+
blendMode?: string;
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
export interface FigmaEffect {
|
|
@@ -312,6 +314,17 @@ function paints(v: unknown): FigmaPaint[] | undefined {
|
|
|
312
314
|
if (col) entry.color = col;
|
|
313
315
|
const ref = str(p.imageRef);
|
|
314
316
|
if (ref) entry.imageRef = ref;
|
|
317
|
+
const blend = str(p.blendMode);
|
|
318
|
+
if (blend) entry.blendMode = blend;
|
|
319
|
+
if (Array.isArray(p.gradientHandlePositions)) {
|
|
320
|
+
const hs: Array<{ x: number; y: number }> = [];
|
|
321
|
+
for (const h of p.gradientHandlePositions.slice(0, 3)) {
|
|
322
|
+
const hx = num((h as Record<string, unknown> | null)?.x);
|
|
323
|
+
const hy = num((h as Record<string, unknown> | null)?.y);
|
|
324
|
+
if (hx !== undefined && hy !== undefined) hs.push({ x: hx, y: hy });
|
|
325
|
+
}
|
|
326
|
+
if (hs.length >= 2) entry.gradientHandlePositions = hs;
|
|
327
|
+
}
|
|
315
328
|
if (Array.isArray(p.gradientStops)) {
|
|
316
329
|
const stops: Array<{ position: number; color: FigmaColor }> = [];
|
|
317
330
|
for (const s of p.gradientStops.slice(0, 32)) {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* cut). Per-project-cut.
|
|
16
16
|
*
|
|
17
17
|
* Both are *metadata only* — never pixels, never re-encoded video.
|
|
18
|
-
* The `/design:reel` codegen reads the `Edl` and emits a
|
|
18
|
+
* The `/design-video:reel` codegen reads the `Edl` and emits a
|
|
19
19
|
* Timeline-parseable `<TransitionSeries>` video-comp TSX (video-comp
|
|
20
20
|
* SKILL.md is the authoring contract).
|
|
21
21
|
*
|
|
@@ -151,8 +151,8 @@ export interface FootageAnalysis {
|
|
|
151
151
|
/** Cross-cutting tags ("rebrand", "exterior", "people"). */
|
|
152
152
|
tags?: string[];
|
|
153
153
|
/** Optional audio/speech note — gist + language of what is said, filled ONLY when
|
|
154
|
-
* an orchestrator (e.g. /design:video-analyze) hands the analyst a transcript.
|
|
155
|
-
* Absent for the default vision-only path (e.g. /design:reel). */
|
|
154
|
+
* an orchestrator (e.g. /design-video:video-analyze) hands the analyst a transcript.
|
|
155
|
+
* Absent for the default vision-only path (e.g. /design-video:reel). */
|
|
156
156
|
speech?: string;
|
|
157
157
|
}
|
|
158
158
|
|
|
@@ -312,7 +312,13 @@ export function createElevenLabsAdapter(ctx: AdapterContext): ProviderAdapter {
|
|
|
312
312
|
.filter((w) => (w.type ?? 'word') === 'word' && typeof w.text === 'string')
|
|
313
313
|
.map((w) => ({ text: String(w.text), start: Number(w.start) || 0, end: Number(w.end) || 0 }));
|
|
314
314
|
const srt = wordsToSrt(words);
|
|
315
|
-
const asset: GenAsset = {
|
|
315
|
+
const asset: GenAsset = {
|
|
316
|
+
kind: 'transcription',
|
|
317
|
+
mime: 'application/x-subrip',
|
|
318
|
+
text: srt,
|
|
319
|
+
words,
|
|
320
|
+
wordTiming: 'provider',
|
|
321
|
+
};
|
|
316
322
|
return { assets: [asset], usage: { ms: Date.now() - started }, raw: { text: json.text } };
|
|
317
323
|
}
|
|
318
324
|
|
|
@@ -225,7 +225,14 @@ export function createGroqAdapter(ctx: AdapterContext): ProviderAdapter {
|
|
|
225
225
|
const json = JSON.parse(text) as GroqVerbose;
|
|
226
226
|
const words = groqVerboseToWords(json);
|
|
227
227
|
const srt = wordsToSrt(words);
|
|
228
|
-
const asset: GenAsset = {
|
|
228
|
+
const asset: GenAsset = {
|
|
229
|
+
kind: 'transcription',
|
|
230
|
+
mime: 'application/x-subrip',
|
|
231
|
+
text: srt,
|
|
232
|
+
words,
|
|
233
|
+
// no per-word granularity -> groqVerboseToWords fell back to segments: say so
|
|
234
|
+
wordTiming: Array.isArray(json.words) && json.words.length > 0 ? 'provider' : 'segment',
|
|
235
|
+
};
|
|
229
236
|
return { assets: [asset], usage: { ms: Date.now() - started }, raw: { text: json.text } };
|
|
230
237
|
}
|
|
231
238
|
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
// generation/spend.ts — the spend cap on paid media generation (Michal, 2026-11-08).
|
|
2
|
+
//
|
|
3
|
+
// Generation stays open to the AI, but it cannot run up a bill: every priced job is estimated before it is
|
|
4
|
+
// sent, counted against a per-run and a per-day cap for THIS project, and a single job above a threshold waits
|
|
5
|
+
// for the person's OK in the app. The three numbers are per-Mac settings (prefs.json `generateSpend`) with
|
|
6
|
+
// bounds; the defaults are $2 per run, $10 per day, confirm above $1.
|
|
7
|
+
//
|
|
8
|
+
// - "run" = this project's server session (one open of the project tab). The day total is on disk, so a
|
|
9
|
+
// restart or a rested tab cannot reset it.
|
|
10
|
+
// - The estimate is conservative (a per-kind figure, higher for the known pro/video models), not the
|
|
11
|
+
// provider's invoice: the cap exists to stop a runaway loop, not to account for cents.
|
|
12
|
+
// - Counted at admission, given back if the job fails. Nothing here ever reads, logs or stores a key or a
|
|
13
|
+
// prompt: the day ledger holds a date and an amount.
|
|
14
|
+
|
|
15
|
+
import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
16
|
+
import path from 'node:path';
|
|
17
|
+
|
|
18
|
+
import type { Modality } from './types.ts';
|
|
19
|
+
|
|
20
|
+
export interface SpendSettings {
|
|
21
|
+
/** USD a project may spend in one run (this server session). */
|
|
22
|
+
perRun: number;
|
|
23
|
+
/** USD a project may spend in one local day. */
|
|
24
|
+
perDay: number;
|
|
25
|
+
/** A single job estimated above this waits for the person's OK. 0 = every priced job asks. */
|
|
26
|
+
confirmOver: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const SPEND_DEFAULTS: Readonly<SpendSettings> = Object.freeze({
|
|
30
|
+
perRun: 2,
|
|
31
|
+
perDay: 10,
|
|
32
|
+
confirmOver: 1,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const SPEND_BOUNDS: Readonly<Record<keyof SpendSettings, { min: number; max: number }>> =
|
|
36
|
+
Object.freeze({
|
|
37
|
+
perRun: { min: 0.1, max: 100 },
|
|
38
|
+
perDay: { min: 0.1, max: 500 },
|
|
39
|
+
confirmOver: { min: 0, max: 50 },
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const KEYS = Object.keys(SPEND_DEFAULTS) as Array<keyof SpendSettings>;
|
|
43
|
+
|
|
44
|
+
const inBounds = (k: keyof SpendSettings, v: unknown): v is number =>
|
|
45
|
+
typeof v === 'number' &&
|
|
46
|
+
Number.isFinite(v) &&
|
|
47
|
+
v >= SPEND_BOUNDS[k].min &&
|
|
48
|
+
v <= SPEND_BOUNDS[k].max;
|
|
49
|
+
|
|
50
|
+
const round2 = (n: number) => Math.round(n * 100) / 100;
|
|
51
|
+
|
|
52
|
+
/** The stored settings, each value kept only when it is in bounds (else its default). Never throws. */
|
|
53
|
+
export function readSpendSettings(raw: unknown): SpendSettings {
|
|
54
|
+
const o =
|
|
55
|
+
raw && typeof raw === 'object' && !Array.isArray(raw) ? (raw as Record<string, unknown>) : {};
|
|
56
|
+
const out = { ...SPEND_DEFAULTS };
|
|
57
|
+
for (const k of KEYS) if (inBounds(k, o[k])) out[k] = o[k] as number;
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** A patch from Settings: known keys only, numbers inside the bounds. */
|
|
62
|
+
export function validateSpendSettings(
|
|
63
|
+
raw: unknown
|
|
64
|
+
): { ok: true; value: Partial<SpendSettings> } | { ok: false; error: string } {
|
|
65
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
66
|
+
return { ok: false, error: 'generateSpend must be an object' };
|
|
67
|
+
const o = raw as Record<string, unknown>;
|
|
68
|
+
const value: Partial<SpendSettings> = {};
|
|
69
|
+
for (const key of Object.keys(o)) {
|
|
70
|
+
if (!KEYS.includes(key as keyof SpendSettings))
|
|
71
|
+
return { ok: false, error: `generateSpend has an unknown key: ${key}` };
|
|
72
|
+
const k = key as keyof SpendSettings;
|
|
73
|
+
if (!inBounds(k, o[k]))
|
|
74
|
+
return {
|
|
75
|
+
ok: false,
|
|
76
|
+
error: `generateSpend.${k} must be a number from ${SPEND_BOUNDS[k].min} to ${SPEND_BOUNDS[k].max}`,
|
|
77
|
+
};
|
|
78
|
+
value[k] = round2(o[k] as number);
|
|
79
|
+
}
|
|
80
|
+
return { ok: true, value };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// ── the estimate ─────────────────────────────────────────────────────────────────────────────────
|
|
84
|
+
|
|
85
|
+
/** A conservative USD figure per job. Higher than the list price on purpose (the `costNote`s say ~$0.04). */
|
|
86
|
+
const PER_KIND: Record<Modality, number> = {
|
|
87
|
+
image: 0.1,
|
|
88
|
+
audio: 0.25,
|
|
89
|
+
video: 3.5,
|
|
90
|
+
transcription: 0.1,
|
|
91
|
+
};
|
|
92
|
+
/** Models known to cost more than their kind's figure. */
|
|
93
|
+
const PER_MODEL: Record<string, number> = {
|
|
94
|
+
'gemini-3-pro-image-preview': 0.3,
|
|
95
|
+
};
|
|
96
|
+
/** Providers that run on this Mac and cost nothing. */
|
|
97
|
+
const LOCAL_PROVIDERS = new Set(['whisper', 'local', 'gemma']);
|
|
98
|
+
|
|
99
|
+
export interface EstimateInput {
|
|
100
|
+
modality: Modality | string;
|
|
101
|
+
provider: string;
|
|
102
|
+
model?: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** The estimated USD for `n` jobs of this kind (cents). A local engine is 0. */
|
|
106
|
+
export function estimateJobCost(job: EstimateInput, n = 1): number {
|
|
107
|
+
if (LOCAL_PROVIDERS.has(job.provider)) return 0;
|
|
108
|
+
const unit =
|
|
109
|
+
(job.model ? PER_MODEL[job.model] : undefined) ?? PER_KIND[job.modality as Modality] ?? 0.25;
|
|
110
|
+
return round2(unit * Math.max(1, Math.floor(n)));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ── the guard ────────────────────────────────────────────────────────────────────────────────────
|
|
114
|
+
|
|
115
|
+
export interface Approval {
|
|
116
|
+
id: string;
|
|
117
|
+
/** Plain words for the card: "a video from Google". */
|
|
118
|
+
summary: string;
|
|
119
|
+
estimate: number;
|
|
120
|
+
at: number;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
interface Pending extends Approval {
|
|
124
|
+
key: string;
|
|
125
|
+
approved: boolean;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export type Admit =
|
|
129
|
+
| {
|
|
130
|
+
ok: true;
|
|
131
|
+
estimate: number /** give back all of it, or part (one failed take of n) */;
|
|
132
|
+
refund(part?: number): void;
|
|
133
|
+
}
|
|
134
|
+
| {
|
|
135
|
+
ok: false;
|
|
136
|
+
status: 402 | 409;
|
|
137
|
+
reason: 'run-cap' | 'day-cap' | 'needs-confirm';
|
|
138
|
+
message: string;
|
|
139
|
+
estimate: number;
|
|
140
|
+
/** needs-confirm only: the id the person approves in the app. */
|
|
141
|
+
approvalId?: string;
|
|
142
|
+
cap?: number;
|
|
143
|
+
spent?: number;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export interface SpendGuardOptions {
|
|
147
|
+
designRoot: string;
|
|
148
|
+
settings(): SpendSettings;
|
|
149
|
+
/** wall clock as a Date (the day boundary) — tests move it */
|
|
150
|
+
now?(): Date;
|
|
151
|
+
/** monotonic-ish ms (approval expiry) — tests move it */
|
|
152
|
+
clock?(): number;
|
|
153
|
+
/** a new approval is waiting: the app shows it (bus → WebSocket) */
|
|
154
|
+
onApproval?(a: Approval): void;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const APPROVAL_TTL_MS = 10 * 60_000;
|
|
158
|
+
const money = (n: number) => `$${n.toFixed(2)}`;
|
|
159
|
+
|
|
160
|
+
export interface SpendGuard {
|
|
161
|
+
/** Check the caps and the threshold; on success the estimate is counted until `refund()`. */
|
|
162
|
+
admit(job: {
|
|
163
|
+
/** identity of the request, so an approval only covers the job it was asked for */
|
|
164
|
+
key: string;
|
|
165
|
+
estimate: number;
|
|
166
|
+
summary?: string;
|
|
167
|
+
approvalId?: string;
|
|
168
|
+
/** the caller already asked the person (the takes consent card): skip the threshold, never a cap */
|
|
169
|
+
confirmed?: boolean;
|
|
170
|
+
}): Admit;
|
|
171
|
+
spent(): { run: number; day: number };
|
|
172
|
+
pending(): Approval[];
|
|
173
|
+
/** The person said yes in the app. */
|
|
174
|
+
approve(id: string): boolean;
|
|
175
|
+
/** The person said no in the app. */
|
|
176
|
+
decline(id: string): boolean;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export function createSpendGuard(o: SpendGuardOptions): SpendGuard {
|
|
180
|
+
const now = o.now ?? (() => new Date());
|
|
181
|
+
const clock = o.clock ?? (() => Date.now());
|
|
182
|
+
const ledgerPath = path.join(o.designRoot, '_state', 'generate-spend.json');
|
|
183
|
+
let run = 0;
|
|
184
|
+
const approvals = new Map<string, Pending>();
|
|
185
|
+
|
|
186
|
+
const dayKey = () => {
|
|
187
|
+
const d = now();
|
|
188
|
+
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
function readDay(): number {
|
|
192
|
+
try {
|
|
193
|
+
const j = JSON.parse(readFileSync(ledgerPath, 'utf8')) as { day?: unknown; usd?: unknown };
|
|
194
|
+
if (j.day === dayKey() && typeof j.usd === 'number' && Number.isFinite(j.usd) && j.usd >= 0)
|
|
195
|
+
return j.usd;
|
|
196
|
+
} catch {
|
|
197
|
+
/* no ledger, a torn file, a stranger's JSON: the day starts at zero */
|
|
198
|
+
}
|
|
199
|
+
return 0;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function writeDay(usd: number): void {
|
|
203
|
+
try {
|
|
204
|
+
mkdirSync(path.dirname(ledgerPath), { recursive: true });
|
|
205
|
+
const tmp = `${ledgerPath}.tmp-${process.pid}`;
|
|
206
|
+
writeFileSync(tmp, `${JSON.stringify({ day: dayKey(), usd: round2(Math.max(0, usd)) })}\n`);
|
|
207
|
+
renameSync(tmp, ledgerPath);
|
|
208
|
+
} catch {
|
|
209
|
+
/* the in-memory run total still holds; a read-only disk must not stop the person working */
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function sweep(): void {
|
|
214
|
+
const t = clock();
|
|
215
|
+
for (const [id, a] of approvals) if (t - a.at > APPROVAL_TTL_MS) approvals.delete(id);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const stop = (
|
|
219
|
+
reason: 'run-cap' | 'day-cap',
|
|
220
|
+
cap: number,
|
|
221
|
+
spent: number,
|
|
222
|
+
estimate: number
|
|
223
|
+
): Admit => {
|
|
224
|
+
const when = reason === 'run-cap' ? 'in this session' : 'today';
|
|
225
|
+
const name = reason === 'run-cap' ? 'per-session' : 'daily';
|
|
226
|
+
return {
|
|
227
|
+
ok: false,
|
|
228
|
+
status: 402,
|
|
229
|
+
reason,
|
|
230
|
+
estimate,
|
|
231
|
+
cap,
|
|
232
|
+
spent,
|
|
233
|
+
message: `Nothing was generated and nothing was charged. This would take generation spending ${when} to about ${money(spent + estimate)}, over the ${money(cap)} ${name} limit. Raise the limit in Settings › Advanced › Generation spend.`,
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
return {
|
|
238
|
+
admit(job) {
|
|
239
|
+
sweep();
|
|
240
|
+
const s = o.settings();
|
|
241
|
+
const est = round2(Math.max(0, job.estimate));
|
|
242
|
+
const day = readDay();
|
|
243
|
+
if (est > 0) {
|
|
244
|
+
if (day + est > s.perDay + 1e-9) return stop('day-cap', s.perDay, day, est);
|
|
245
|
+
if (run + est > s.perRun + 1e-9) return stop('run-cap', s.perRun, run, est);
|
|
246
|
+
}
|
|
247
|
+
if (est > 0 && est > s.confirmOver + 1e-9 && !job.confirmed) {
|
|
248
|
+
// the id the verb printed, or — asking the same job again after the person approved it — the approval
|
|
249
|
+
// that job already has
|
|
250
|
+
const given = job.approvalId
|
|
251
|
+
? approvals.get(job.approvalId)
|
|
252
|
+
: [...approvals.values()].find((a) => a.approved && a.key === job.key);
|
|
253
|
+
if (given && given.approved && given.key === job.key) {
|
|
254
|
+
approvals.delete(given.id); // single use
|
|
255
|
+
} else {
|
|
256
|
+
let p = [...approvals.values()].find((a) => a.key === job.key && !a.approved);
|
|
257
|
+
if (!p) {
|
|
258
|
+
p = {
|
|
259
|
+
id: `ok_${crypto.randomUUID().slice(0, 12)}`,
|
|
260
|
+
key: job.key,
|
|
261
|
+
summary: job.summary ?? 'a generation',
|
|
262
|
+
estimate: est,
|
|
263
|
+
at: clock(),
|
|
264
|
+
approved: false,
|
|
265
|
+
};
|
|
266
|
+
approvals.set(p.id, p);
|
|
267
|
+
o.onApproval?.({ id: p.id, summary: p.summary, estimate: p.estimate, at: p.at });
|
|
268
|
+
}
|
|
269
|
+
return {
|
|
270
|
+
ok: false,
|
|
271
|
+
status: 409,
|
|
272
|
+
reason: 'needs-confirm',
|
|
273
|
+
estimate: est,
|
|
274
|
+
approvalId: p.id,
|
|
275
|
+
message: `Needs your OK. ${p.summary[0].toUpperCase()}${p.summary.slice(1)} costs about ${money(est)}. Nothing was generated and nothing was charged. Approve it in Maude, then ask again.`,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
run += est;
|
|
280
|
+
writeDay(day + est);
|
|
281
|
+
let left = est;
|
|
282
|
+
return {
|
|
283
|
+
ok: true,
|
|
284
|
+
estimate: est,
|
|
285
|
+
refund(part) {
|
|
286
|
+
const back = Math.min(left, part === undefined ? left : Math.max(0, part));
|
|
287
|
+
if (back <= 0) return;
|
|
288
|
+
left = round2(left - back);
|
|
289
|
+
run = Math.max(0, run - back);
|
|
290
|
+
writeDay(readDay() - back);
|
|
291
|
+
},
|
|
292
|
+
};
|
|
293
|
+
},
|
|
294
|
+
spent: () => ({ run: round2(run), day: round2(readDay()) }),
|
|
295
|
+
pending: () => {
|
|
296
|
+
sweep();
|
|
297
|
+
return [...approvals.values()]
|
|
298
|
+
.filter((a) => !a.approved)
|
|
299
|
+
.map(({ id, summary, estimate, at }) => ({ id, summary, estimate, at }));
|
|
300
|
+
},
|
|
301
|
+
approve(id) {
|
|
302
|
+
sweep();
|
|
303
|
+
const a = approvals.get(id);
|
|
304
|
+
if (!a) return false;
|
|
305
|
+
a.approved = true;
|
|
306
|
+
return true;
|
|
307
|
+
},
|
|
308
|
+
decline(id) {
|
|
309
|
+
return approvals.delete(id);
|
|
310
|
+
},
|
|
311
|
+
};
|
|
312
|
+
}
|
|
@@ -126,6 +126,18 @@ export interface GenAsset {
|
|
|
126
126
|
bytes?: Uint8Array;
|
|
127
127
|
/** Text payload (SRT/VTT captions from a transcription provider). */
|
|
128
128
|
text?: string;
|
|
129
|
+
/** Transcription only: the provider's words, `{text,start,end}[]` in seconds — the input of
|
|
130
|
+
* the `assets/<sha8>.transcript.json` sidecar every engine leaves (#128 §7). */
|
|
131
|
+
words?: GenWord[];
|
|
132
|
+
/** Transcription only: were `words` timed per word (`provider`) or per segment (`segment`)? */
|
|
133
|
+
wordTiming?: 'provider' | 'segment';
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** One timed word as a transcription provider reports it (seconds in the source). */
|
|
137
|
+
export interface GenWord {
|
|
138
|
+
text: string;
|
|
139
|
+
start: number;
|
|
140
|
+
end: number;
|
|
129
141
|
}
|
|
130
142
|
|
|
131
143
|
/** The normalized result once a Job is `done`. */
|
|
@@ -120,7 +120,7 @@ export function handoffPrompt(req: HandoffRequest, designRel: string): string {
|
|
|
120
120
|
break;
|
|
121
121
|
case 'lottie':
|
|
122
122
|
lines.push(
|
|
123
|
-
`Follow /design:to-lottie for "${req.canvas}" --verify and write the animation to ${req.outRel}.`
|
|
123
|
+
`Follow /design-video:to-lottie for "${req.canvas}" --verify and write the animation to ${req.outRel}.`
|
|
124
124
|
);
|
|
125
125
|
break;
|
|
126
126
|
default:
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// route (routes/handoff.ts) reads the config and the canvas; the sheet reads what the route answers.
|
|
8
8
|
//
|
|
9
9
|
// The commands under Advanced are today's, unchanged: `/design:handoff`, `/design:to-rn`,
|
|
10
|
-
// `/design:to-lottie`, and the `maude design handoff` verb.
|
|
10
|
+
// `/design-video:to-lottie`, and the `maude design handoff` verb.
|
|
11
11
|
|
|
12
12
|
export type HandoffKind = 'web' | 'rn' | 'lottie' | 'tokens';
|
|
13
13
|
export const HANDOFF_KINDS: readonly HandoffKind[] = ['web', 'rn', 'lottie', 'tokens'];
|
|
@@ -314,7 +314,7 @@ export function readyFacts(
|
|
|
314
314
|
copy: snippet,
|
|
315
315
|
writes: o.outRel,
|
|
316
316
|
snippet,
|
|
317
|
-
lines: [{ note: 'Claude Code', text: `/design:to-lottie "${canvas}" --verify` }],
|
|
317
|
+
lines: [{ note: 'Claude Code', text: `/design-video:to-lottie "${canvas}" --verify` }],
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
320
|
default:
|
|
@@ -18,7 +18,7 @@ export const HANDOFF_CHAT_RE = /^handoff-[a-z0-9]{6,40}$/;
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* gate-b-sec2 finding 3 — the `maude design` verbs a Handoff to production run runs (handoffPrompt:
|
|
21
|
-
* `handoff` for web, /design:to-lottie's `to-lottie` + `bootstrap-check`, and `check`). The bridge
|
|
21
|
+
* `handoff` for web, /design-video:to-lottie's `to-lottie` + `bootstrap-check`, and `check`). The bridge
|
|
22
22
|
* auto-approves only these in the run (acp/bridge.ts scopedAllowedTools); the design plugin's
|
|
23
23
|
* pre-bash hook denies every other maude verb (cli/lib/design-hook.mjs HANDOFF_RUN_VERBS, which a
|
|
24
24
|
* test keeps equal to this list).
|
|
@@ -29,6 +29,7 @@ const TYPES: Record<string, TypeWords> = {
|
|
|
29
29
|
stamp: { one: 'Stamp', many: 'stamps' },
|
|
30
30
|
vote: { one: 'Vote', many: 'votes' },
|
|
31
31
|
ballot: { one: 'Ballot', many: 'ballots' },
|
|
32
|
+
checkitem: { one: 'Checklist item', many: 'checklist items' },
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
/** Housekeeping: never a visible change of the element. */
|
|
@@ -49,6 +50,7 @@ const TEXT_SLOT: Record<string, string> = {
|
|
|
49
50
|
text: 'text',
|
|
50
51
|
shape: 'label',
|
|
51
52
|
section: 'label',
|
|
53
|
+
checkitem: 'text',
|
|
52
54
|
};
|
|
53
55
|
|
|
54
56
|
const typeOf = (t: string): TypeWords =>
|
|
@@ -147,6 +149,8 @@ export function describeAnnotations(ctx: LaneContext): Change[] {
|
|
|
147
149
|
for (const k of keys) {
|
|
148
150
|
if (k === 'resolved') {
|
|
149
151
|
count(n.type, n[k] ? 'resolved' : 'reopened', artboards);
|
|
152
|
+
} else if (k === 'done' && n.type === 'checkitem') {
|
|
153
|
+
count(n.type, n[k] ? 'ticked' : 'unticked', artboards);
|
|
150
154
|
} else if (k === 'locked') {
|
|
151
155
|
count(n.type, n[k] ? 'locked' : 'unlocked', artboards);
|
|
152
156
|
} else if (k === slot && typeof o[k] === 'string' && typeof n[k] === 'string') {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// home/accounts.ts — 2.0.5 W4b: the accounts each profile on this Mac is signed in with, for Home's
|
|
2
2
|
// avatar, and the per-account sign-outs it offers.
|
|
3
3
|
//
|
|
4
|
-
// GET /_home/accounts?profiles=a,b → { ok, profiles: [{ id, hubs: [{ url, account }] }] }
|
|
4
|
+
// GET /_home/accounts?profiles=a,b → { ok, profiles: [{ id, hubs: [{ url, account, state }] }] }
|
|
5
|
+
// `state` (2.1.1): ok · rejected · unreachable · unknown — whether
|
|
6
|
+
// that sign-in still works (hub-health.ts; cached, never a token)
|
|
5
7
|
// POST /_home/hub/signout { profile, url } → forget that profile's sign-in for that server
|
|
6
8
|
// POST /_home/cloud/signout { profile } → forget that profile's Maude Cloud sign-in
|
|
7
9
|
//
|
|
@@ -17,6 +19,7 @@ import { existsSync, unlinkSync } from 'node:fs';
|
|
|
17
19
|
import { deleteHubCredential } from '../sync/hub-link.ts';
|
|
18
20
|
import { loadHubsConfig, normalizeUrl, safeAccount } from '../sync/hubs-config.ts';
|
|
19
21
|
import { profileCloudPath, profileHubsPath } from './cloud.ts';
|
|
22
|
+
import { createHubHealth, type HubHealth, type HubState } from './hub-health.ts';
|
|
20
23
|
import type { HomeAnswer } from './signin.ts';
|
|
21
24
|
|
|
22
25
|
const MAX_PROFILES = 16;
|
|
@@ -24,11 +27,18 @@ const MAX_HUBS = 50;
|
|
|
24
27
|
|
|
25
28
|
export interface ProfileHubs {
|
|
26
29
|
id: string;
|
|
27
|
-
hubs: Array<{ url: string; account: string | null }>;
|
|
30
|
+
hubs: Array<{ url: string; account: string | null; state: HubState }>;
|
|
28
31
|
}
|
|
29
32
|
|
|
30
|
-
/**
|
|
31
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Each named profile's team-server sign-ins (no tokens), each with whether it still works. Unknown /
|
|
35
|
+
* invalid ids are skipped. The servers are asked together (and each answer is cached), so the call
|
|
36
|
+
* takes about one round trip, not one per server.
|
|
37
|
+
*/
|
|
38
|
+
export async function profileAccounts(
|
|
39
|
+
ids: string[],
|
|
40
|
+
health: HubHealth = createHubHealth()
|
|
41
|
+
): Promise<ProfileHubs[]> {
|
|
32
42
|
const out: ProfileHubs[] = [];
|
|
33
43
|
for (const id of [...new Set(ids)].slice(0, MAX_PROFILES)) {
|
|
34
44
|
const file = profileHubsPath(id);
|
|
@@ -36,10 +46,16 @@ export function profileAccounts(ids: string[]): ProfileHubs[] {
|
|
|
36
46
|
let hubs: ProfileHubs['hubs'] = [];
|
|
37
47
|
try {
|
|
38
48
|
const cfg = loadHubsConfig(file);
|
|
39
|
-
hubs =
|
|
40
|
-
.
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
hubs = await Promise.all(
|
|
50
|
+
Object.entries(cfg.hubs ?? {})
|
|
51
|
+
.filter(([, rec]) => rec && typeof rec.token === 'string' && rec.token)
|
|
52
|
+
.slice(0, MAX_HUBS)
|
|
53
|
+
.map(async ([url, rec]) => ({
|
|
54
|
+
url,
|
|
55
|
+
account: safeAccount(rec.account),
|
|
56
|
+
state: await health.state(url, rec.token).catch(() => 'unknown' as const),
|
|
57
|
+
}))
|
|
58
|
+
);
|
|
43
59
|
} catch {
|
|
44
60
|
hubs = [];
|
|
45
61
|
}
|
|
@@ -50,11 +66,14 @@ export function profileAccounts(ids: string[]): ProfileHubs[] {
|
|
|
50
66
|
|
|
51
67
|
const bad = (error: string): HomeAnswer => ({ status: 400, body: { ok: false, error } });
|
|
52
68
|
|
|
53
|
-
export function createHomeAccounts(
|
|
69
|
+
export function createHomeAccounts(
|
|
70
|
+
deps: { forgetCloud?: (profile: string) => void; hubHealth?: HubHealth } = {}
|
|
71
|
+
) {
|
|
72
|
+
const health = deps.hubHealth ?? createHubHealth();
|
|
54
73
|
return {
|
|
55
|
-
list(param: string | null): HomeAnswer {
|
|
74
|
+
async list(param: string | null): Promise<HomeAnswer> {
|
|
56
75
|
const ids = (param ?? '').split(',').filter(Boolean);
|
|
57
|
-
return { status: 200, body: { ok: true, profiles: profileAccounts(ids) } };
|
|
76
|
+
return { status: 200, body: { ok: true, profiles: await profileAccounts(ids, health) } };
|
|
58
77
|
},
|
|
59
78
|
|
|
60
79
|
hubSignOut(b: Record<string, unknown>): HomeAnswer {
|