@dexhq/canvas 0.14.0 → 0.16.0
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/CHANGELOG.md +70 -0
- package/README.md +5 -3
- package/app/canvas/activity-parts.tsx +50 -6
- package/app/canvas/activity.tsx +10 -18
- package/app/canvas/agent-changes.ts +18 -8
- package/app/canvas/anchoring.ts +15 -7
- package/app/canvas/canvas-context.tsx +6 -2
- package/app/canvas/canvas-input.ts +186 -14
- package/app/canvas/canvas-keys.ts +9 -0
- package/app/canvas/canvas-model.ts +7 -44
- package/app/canvas/canvas-panels.ts +1 -17
- package/app/canvas/canvas-scene.ts +250 -27
- package/app/canvas/canvas-ui.ts +13 -3
- package/app/canvas/canvas.css +147 -29
- package/app/canvas/change-notice.tsx +10 -1
- package/app/canvas/comment-layer.tsx +2 -1
- package/app/canvas/comments.tsx +270 -111
- package/app/canvas/element-link.ts +135 -0
- package/app/canvas/element-picker.ts +223 -27
- package/app/canvas/engine/canvas-gestures.ts +72 -17
- package/app/canvas/engine/canvas-store.ts +17 -1
- package/app/canvas/engine/engine.css +6 -3
- package/app/canvas/export-dialog.tsx +265 -0
- package/app/canvas/find-bar.tsx +817 -0
- package/app/canvas/find-model.ts +135 -0
- package/app/canvas/flow-canvas.tsx +83 -16
- package/app/canvas/follow-pin.ts +26 -6
- package/app/canvas/frame-context-menu.tsx +61 -7
- package/app/canvas/frame-node.tsx +19 -20
- package/app/canvas/imported-reviews.tsx +12 -22
- package/app/canvas/layout.ts +68 -22
- package/app/canvas/linked-element.tsx +196 -0
- package/app/canvas/live-page.ts +156 -19
- package/app/canvas/mentions.tsx +209 -0
- package/app/canvas/page-find.ts +220 -0
- package/app/canvas/page-style.ts +23 -0
- package/app/canvas/picked-box.tsx +21 -0
- package/app/canvas/removed-views-panel.tsx +4 -4
- package/app/canvas/request-node.tsx +151 -0
- package/app/canvas/review-panel.tsx +8 -3
- package/app/canvas/section-node.tsx +6 -133
- package/app/canvas/spec-margin.tsx +4 -1
- package/app/canvas/spec-threads.ts +24 -23
- package/app/canvas/teammates-layer.tsx +205 -0
- package/app/canvas/text-layer.tsx +103 -17
- package/app/canvas/thread-focus.tsx +14 -12
- package/app/canvas/tool-cursors.ts +7 -6
- package/app/canvas/tool-icons.tsx +24 -56
- package/app/canvas/typing.ts +12 -0
- package/app/canvas/use-activity.ts +0 -8
- package/app/canvas/use-agent-changes.tsx +40 -42
- package/app/canvas/use-canvas-clipboard.tsx +11 -14
- package/app/canvas/use-canvas-editor.ts +4 -2
- package/app/canvas/xray.ts +3 -12
- package/app/export/player-model.ts +159 -0
- package/app/export/player.tsx +198 -0
- package/app/export.html +31 -0
- package/app/export.tsx +9 -0
- package/app/frame/announce-refreshes.ts +21 -0
- package/app/frame/start-frame.tsx +50 -0
- package/app/frame/view-loads.ts +161 -0
- package/app/frame/views.ts +13 -49
- package/app/frame.tsx +2 -33
- package/app/i18n/locales/en/messages.po +233 -14
- package/app/i18n/locales/en/messages.ts +1 -1
- package/app/i18n/locales/pseudo/messages.po +232 -13
- package/app/i18n/locales/pseudo/messages.ts +1 -1
- package/app/icons/dex-glyphs.tsx +219 -0
- package/app/icons/glyphs.tsx +80 -80
- package/app/kit/use-flow.ts +2 -1
- package/app/live/canvas-teammates.ts +90 -0
- package/app/live/studio-api.ts +30 -20
- package/app/main.tsx +3 -0
- package/app/pages/canvas.tsx +45 -14
- package/app/pages/commands-settings.tsx +17 -3
- package/app/pages/render.tsx +39 -11
- package/app/shell/bell.tsx +15 -5
- package/app/shell/feedback-form.tsx +10 -21
- package/app/shell/feedback-link.tsx +2 -1
- package/app/shell/presence.tsx +123 -26
- package/app/shell/scaled-frame.tsx +21 -9
- package/app/shell/thread-list.tsx +25 -8
- package/app/shell/working-on.tsx +35 -3
- package/app/types.ts +21 -205
- package/app/ui/file-drop.ts +128 -0
- package/app/ui/prompt-editor.tsx +39 -11
- package/app/ui/reference.tsx +21 -8
- package/app/ui/shadcn/input-group.tsx +2 -2
- package/bin/sudio.mjs +1 -1
- package/dist/cli/banner.d.mts +4 -2
- package/dist/cli/banner.mjs +34 -11
- package/dist/cli/commands/app.mjs +19 -11
- package/dist/cli/commands/create.d.mts +5 -5
- package/dist/cli/commands/create.mjs +4 -4
- package/dist/cli/commands/export.d.mts +40 -0
- package/dist/cli/commands/export.mjs +66 -0
- package/dist/cli/commands/hook.mjs +2 -1
- package/dist/cli/commands/init.d.mts +2 -2
- package/dist/cli/commands/upgrade.mjs +1 -1
- package/dist/cli/help.d.mts +1 -1
- package/dist/cli/help.mjs +13 -7
- package/dist/cli/main.d.mts +42 -5
- package/dist/cli/main.mjs +1 -0
- package/dist/config/load.mjs +14 -2
- package/dist/config/project-files.d.mts +11 -0
- package/dist/config/project-files.mjs +23 -2
- package/dist/config/renamed.d.mts +7 -2
- package/dist/config/renamed.mjs +13 -3
- package/dist/content/capture.d.mts +2 -2
- package/dist/content/capture.mjs +2 -2
- package/dist/content/commands.d.mts +11 -9
- package/dist/content/commands.mjs +22 -16
- package/dist/content/comments-log.mjs +2 -1
- package/dist/content/content.d.mts +13 -143
- package/dist/content/content.mjs +55 -76
- package/dist/content/element-words.d.mts +42 -0
- package/dist/content/element-words.mjs +112 -0
- package/dist/content/flow-specs.mjs +1 -1
- package/dist/content/hosted-person.d.mts +31 -0
- package/dist/content/hosted-person.mjs +68 -0
- package/dist/content/merge-rules.d.mts +5 -0
- package/dist/content/merge-rules.mjs +17 -1
- package/dist/content/prototype-summary.d.mts +3 -39
- package/dist/content/prototype-summary.mjs +2 -3
- package/dist/content/prototypes.mjs +1 -1
- package/dist/content/screenshot.mjs +9 -0
- package/dist/content/text-edit.d.mts +24 -14
- package/dist/content/text-edit.mjs +92 -81
- package/dist/content/text-replace.d.mts +30 -0
- package/dist/content/text-replace.mjs +285 -0
- package/dist/content/thread-module.d.mts +2 -4
- package/dist/content/thread-module.mjs +4 -5
- package/dist/content/threads.mjs +1 -1
- package/dist/paste/paste.mjs +1 -1
- package/dist/paths.d.mts +0 -2
- package/dist/paths.mjs +1 -3
- package/dist/server/agent-env.d.mts +5 -1
- package/dist/server/agent-env.mjs +7 -2
- package/dist/server/agent-session.d.mts +14 -1
- package/dist/server/agent-session.mjs +84 -19
- package/dist/server/agents.d.mts +10 -0
- package/dist/server/agents.mjs +21 -6
- package/dist/server/build-pictures.mjs +1 -1
- package/dist/server/canvas-presence.d.mts +22 -0
- package/dist/server/canvas-presence.mjs +160 -0
- package/dist/server/channel.d.mts +13 -24
- package/dist/server/channel.mjs +55 -37
- package/dist/server/claimed-presence.d.mts +3 -2
- package/dist/server/claimed-presence.mjs +15 -7
- package/dist/server/close-check.mjs +2 -2
- package/dist/server/command-settings.mjs +1 -1
- package/dist/server/comments/actions.d.mts +145 -0
- package/dist/server/comments/actions.mjs +146 -0
- package/dist/server/comments/routes.d.mts +25 -0
- package/dist/server/comments/routes.mjs +67 -0
- package/dist/server/comments/tools.d.mts +6 -0
- package/dist/server/comments/tools.mjs +154 -0
- package/dist/server/dev-server.mjs +59 -23
- package/dist/server/export/build.d.mts +15 -0
- package/dist/server/export/build.mjs +220 -0
- package/dist/server/export/page.d.mts +25 -0
- package/dist/server/export/page.mjs +40 -0
- package/dist/server/export/plugin.d.mts +31 -0
- package/dist/server/export/plugin.mjs +69 -0
- package/dist/server/export/run.d.mts +9 -0
- package/dist/server/export/run.mjs +61 -0
- package/dist/server/export/save.d.mts +7 -0
- package/dist/server/export/save.mjs +29 -0
- package/dist/server/file-lock.d.mts +2 -2
- package/dist/server/file-lock.mjs +130 -36
- package/dist/server/hosted.d.mts +8 -0
- package/dist/server/hosted.mjs +78 -0
- package/dist/server/live-mirror.mjs +66 -10
- package/dist/server/live.mjs +28 -1
- package/dist/server/mcp.d.mts +0 -2
- package/dist/server/mcp.mjs +9 -8
- package/dist/server/me.d.mts +3 -1
- package/dist/server/me.mjs +8 -2
- package/dist/server/notices.d.mts +1 -1
- package/dist/server/notices.mjs +1 -1
- package/dist/server/open-page.d.mts +22 -0
- package/dist/server/open-page.mjs +20 -2
- package/dist/server/outcome.d.mts +22 -0
- package/dist/server/outcome.mjs +8 -0
- package/dist/server/own-copies.mjs +1 -1
- package/dist/server/people.d.mts +8 -3
- package/dist/server/people.mjs +6 -2
- package/dist/server/pictures.d.mts +1 -1
- package/dist/server/pictures.mjs +2 -2
- package/dist/server/port.d.mts +12 -0
- package/dist/server/port.mjs +66 -14
- package/dist/server/prebundle.d.mts +32 -0
- package/dist/server/prebundle.mjs +115 -0
- package/dist/server/presence.d.mts +4 -1
- package/dist/server/presence.mjs +2 -2
- package/dist/server/problems.d.mts +8 -0
- package/dist/server/problems.mjs +13 -0
- package/dist/server/requests.d.mts +5 -1
- package/dist/server/requests.mjs +76 -78
- package/dist/server/source-stamp.d.mts +4 -3
- package/dist/server/source-stamp.mjs +60 -31
- package/dist/server/state.d.mts +19 -10
- package/dist/server/state.mjs +27 -18
- package/dist/server/studio-for.d.mts +5 -0
- package/dist/server/studio-for.mjs +17 -3
- package/dist/server/sync-install.d.mts +8 -12
- package/dist/server/sync-install.mjs +12 -30
- package/dist/server/thread-source.d.mts +8 -0
- package/dist/server/thread-source.mjs +25 -6
- package/dist/server/tools/describe.d.mts +1 -1
- package/dist/server/tools/describe.mjs +1 -1
- package/dist/server/tools/export.d.mts +5 -0
- package/dist/server/tools/export.mjs +35 -0
- package/dist/server/tools/feedback.d.mts +1 -1
- package/dist/server/tools/place-frame.mjs +16 -16
- package/dist/server/tools/reading.mjs +13 -4
- package/dist/server/tools/show.d.mts +1 -1
- package/dist/server/tools/snapshot.d.mts +1 -1
- package/dist/server/tools/thread-list.mjs +2 -2
- package/dist/server/tools/watch.mjs +5 -3
- package/dist/server/vite.d.mts +9 -4
- package/dist/server/vite.mjs +65 -63
- package/dist/server/web-app.mjs +4 -7
- package/dist/server/welcome.mjs +2 -1
- package/dist/server/work-groups.mjs +1 -1
- package/dist/setup/apply.d.mts +4 -0
- package/dist/setup/apply.mjs +5 -4
- package/dist/setup/create.d.mts +4 -2
- package/dist/setup/create.mjs +72 -22
- package/dist/setup/design-system-checks.mjs +3 -17
- package/dist/setup/desktop-app-script.mjs +4 -3
- package/dist/setup/desktop-app-start.d.mts +8 -2
- package/dist/setup/desktop-app-start.mjs +64 -29
- package/dist/setup/desktop-app.d.mts +8 -0
- package/dist/setup/desktop-app.mjs +19 -3
- package/dist/setup/detect/workspace.d.mts +10 -10
- package/dist/setup/detect/workspace.mjs +10 -12
- package/dist/setup/detect.d.mts +0 -2
- package/dist/setup/detect.mjs +1 -3
- package/dist/setup/doctor.d.mts +4 -1
- package/dist/setup/doctor.mjs +8 -6
- package/dist/setup/migrate/dex-folder.d.mts +61 -0
- package/dist/setup/migrate/dex-folder.mjs +544 -0
- package/dist/setup/migrate/files-folder.mjs +1 -1
- package/dist/setup/migrate/guides.mjs +1 -1
- package/dist/setup/migrate/migrations.mjs +4 -0
- package/dist/setup/migrate/row-titles.mjs +1 -1
- package/dist/setup/migrate/setup-files.d.mts +5 -0
- package/dist/setup/migrate/setup-files.mjs +115 -0
- package/dist/setup/migrate/studio-state.d.mts +2 -2
- package/dist/setup/migrate/studio-state.mjs +4 -4
- package/dist/setup/placement.d.mts +1 -1
- package/dist/setup/placement.mjs +5 -4
- package/dist/setup/plan.d.mts +5 -5
- package/dist/setup/plan.mjs +8 -12
- package/dist/setup/project.d.mts +6 -1
- package/dist/setup/project.mjs +10 -10
- package/dist/setup/prompts.d.mts +2 -1
- package/dist/setup/prompts.mjs +4 -3
- package/dist/setup/questions.mjs +3 -2
- package/dist/setup/starters.d.mts +3 -1
- package/dist/setup/starters.mjs +9 -3
- package/dist/setup/write.d.mts +15 -3
- package/dist/setup/write.mjs +23 -3
- package/dist/shared/annotations-core.mjs +1 -1
- package/dist/shared/canvas-core.d.mts +22 -7
- package/dist/shared/canvas-core.mjs +39 -11
- package/dist/shared/canvas-file.d.mts +201 -0
- package/dist/shared/canvas-file.mjs +1 -0
- package/dist/shared/comments/routes.d.mts +55 -0
- package/dist/shared/comments/routes.mjs +39 -0
- package/dist/shared/export-core.d.mts +62 -0
- package/dist/shared/export-core.mjs +101 -0
- package/dist/shared/feedback.d.mts +8 -0
- package/dist/shared/feedback.mjs +10 -2
- package/dist/shared/live-core.d.mts +2 -0
- package/dist/shared/live-core.mjs +6 -1
- package/dist/shared/live-presence.d.mts +57 -2
- package/dist/shared/live-presence.mjs +90 -4
- package/dist/shared/page-messages.d.mts +14 -1
- package/dist/shared/page-messages.mjs +30 -3
- package/dist/shared/page-review.d.mts +2 -11
- package/dist/shared/page-review.mjs +4 -13
- package/dist/shared/people-core.d.mts +28 -0
- package/dist/shared/people-core.mjs +27 -1
- package/dist/shared/presence-core.d.mts +13 -0
- package/dist/shared/presence-core.mjs +11 -2
- package/dist/shared/references-core.d.mts +4 -0
- package/dist/shared/references-core.mjs +12 -4
- package/dist/shared/review-file.d.mts +5 -0
- package/dist/shared/review-file.mjs +23 -13
- package/dist/shared/server-page.mjs +1 -1
- package/dist/shared/signup.d.mts +2 -5
- package/dist/shared/signup.mjs +2 -35
- package/dist/shared/studio-events.d.mts +0 -6
- package/dist/shared/studio-events.mjs +1 -5
- package/dist/shared/studio-files.d.mts +21 -0
- package/dist/shared/studio-files.mjs +16 -2
- package/dist/shared/studio-routes.d.mts +29 -63
- package/dist/shared/studio-routes.mjs +1 -69
- package/dist/shared/threads-core.d.mts +29 -6
- package/dist/shared/threads-core.mjs +68 -13
- package/extension/dist/feedback.js +104 -284
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/picker.js +104 -284
- package/package.json +2 -2
- package/src/cli/banner.ts +45 -11
- package/src/cli/commands/app.ts +23 -8
- package/src/cli/commands/create.ts +4 -4
- package/src/cli/commands/export.ts +78 -0
- package/src/cli/commands/hook.ts +4 -1
- package/src/cli/commands/upgrade.ts +1 -1
- package/src/cli/help.ts +13 -7
- package/src/cli/main.ts +1 -0
- package/src/config/load.ts +26 -2
- package/src/config/project-files.ts +36 -6
- package/src/config/renamed.ts +19 -4
- package/src/content/capture.ts +6 -12
- package/src/content/commands.ts +30 -18
- package/src/content/comments-log.ts +4 -1
- package/src/content/content.ts +71 -257
- package/src/content/element-words.ts +175 -0
- package/src/content/flow-specs.ts +2 -1
- package/src/content/hosted-person.ts +107 -0
- package/src/content/merge-rules.ts +29 -0
- package/src/content/prototype-summary.ts +4 -44
- package/src/content/review-pages.ts +2 -1
- package/src/content/screenshot.ts +14 -0
- package/src/content/text-edit.ts +172 -105
- package/src/content/text-replace.ts +420 -0
- package/src/content/thread-module.ts +2 -4
- package/src/content/trash.ts +1 -1
- package/src/paths.ts +0 -8
- package/src/server/agent-env.ts +12 -2
- package/src/server/agent-session.ts +124 -34
- package/src/server/agents.ts +48 -17
- package/src/server/canvas-presence.ts +237 -0
- package/src/server/channel.ts +95 -53
- package/src/server/claimed-presence.ts +26 -10
- package/src/server/command-settings.ts +1 -1
- package/src/server/comments/actions.ts +333 -0
- package/src/server/comments/routes.ts +131 -0
- package/src/server/comments/tools.ts +317 -0
- package/src/server/dev-server.ts +94 -33
- package/src/server/export/build.ts +310 -0
- package/src/server/export/page.ts +85 -0
- package/src/server/export/plugin.ts +138 -0
- package/src/server/export/run.ts +79 -0
- package/src/server/export/save.ts +38 -0
- package/src/server/file-lock.ts +205 -54
- package/src/server/hosted.ts +113 -0
- package/src/server/live-mirror.ts +93 -8
- package/src/server/live.ts +46 -1
- package/src/server/machine-update.ts +3 -3
- package/src/server/mcp.ts +15 -14
- package/src/server/me.ts +12 -6
- package/src/server/notices.ts +2 -2
- package/src/server/open-page.ts +54 -4
- package/src/server/outcome.ts +26 -0
- package/src/server/people.ts +13 -3
- package/src/server/pictures.ts +2 -2
- package/src/server/port.ts +94 -20
- package/src/server/prebundle.ts +230 -0
- package/src/server/presence.ts +12 -4
- package/src/server/problems.ts +11 -0
- package/src/server/requests.ts +115 -110
- package/src/server/roster.ts +1 -1
- package/src/server/saved.ts +1 -1
- package/src/server/source-stamp.ts +118 -37
- package/src/server/state.ts +53 -31
- package/src/server/studio-for.ts +26 -2
- package/src/server/sync-install.ts +35 -26
- package/src/server/thread-place.ts +2 -4
- package/src/server/thread-source.ts +35 -3
- package/src/server/tools/export.ts +56 -0
- package/src/server/tools/place-frame.ts +23 -15
- package/src/server/tools/reading.ts +16 -3
- package/src/server/tools/thread-list.ts +1 -1
- package/src/server/tools/watch.ts +7 -7
- package/src/server/updates.ts +2 -2
- package/src/server/vite.ts +106 -110
- package/src/server/web-app.ts +11 -9
- package/src/server/welcome.ts +3 -1
- package/src/setup/apply.ts +8 -5
- package/src/setup/create.ts +101 -27
- package/src/setup/design-system-checks.ts +8 -21
- package/src/setup/desktop-app-script.ts +4 -3
- package/src/setup/desktop-app-start.ts +94 -26
- package/src/setup/desktop-app.ts +23 -2
- package/src/setup/detect/workspace.ts +20 -21
- package/src/setup/detect.ts +0 -4
- package/src/setup/doctor.ts +13 -6
- package/src/setup/migrate/dex-folder.ts +842 -0
- package/src/setup/migrate/files-folder.ts +1 -1
- package/src/setup/migrate/guides.ts +3 -1
- package/src/setup/migrate/migrations.ts +8 -2
- package/src/setup/migrate/setup-files.ts +198 -0
- package/src/setup/migrate/studio-state.ts +12 -10
- package/src/setup/own-app.ts +1 -1
- package/src/setup/placement.ts +7 -6
- package/src/setup/plan.ts +13 -18
- package/src/setup/project.ts +11 -10
- package/src/setup/prompts.ts +5 -4
- package/src/setup/questions.ts +6 -3
- package/src/setup/starters.ts +11 -4
- package/src/setup/write.ts +34 -3
- package/src/shared/canvas-core.ts +48 -9
- package/src/shared/canvas-file.ts +205 -0
- package/src/shared/comments/routes.ts +81 -0
- package/src/shared/export-core.ts +198 -0
- package/src/shared/feedback.ts +14 -4
- package/src/shared/live-core.ts +8 -0
- package/src/shared/live-presence.ts +171 -2
- package/src/shared/page-messages.ts +38 -2
- package/src/shared/page-review.ts +11 -16
- package/src/shared/people-core.ts +44 -0
- package/src/shared/presence-core.ts +18 -2
- package/src/shared/references-core.ts +22 -3
- package/src/shared/review-file.ts +28 -12
- package/src/shared/server-page.ts +2 -1
- package/src/shared/signup.ts +4 -28
- package/src/shared/studio-events.ts +0 -13
- package/src/shared/studio-files.ts +29 -1
- package/src/shared/studio-routes.ts +32 -65
- package/src/shared/threads-core.ts +134 -12
- package/templates/methods/explore.md +1 -1
- package/templates/methods/handoff.md +1 -1
- package/templates/methods/review.md +2 -1
- package/templates/rules/canvas-frames.md +6 -3
- package/templates/rules/commands.md +1 -0
- package/templates/rules/prototypes.md +1 -1
- package/templates/rules/studio.md +17 -11
- package/templates/skills/comprehend/SKILL.md +56 -0
- package/templates/skills/distill/SKILL.md +172 -0
- package/templates/skills/export-prototype/SKILL.md +35 -0
- package/templates/skills/riff/SKILL.md +21 -0
- package/templates/skills/riff-deep/SKILL.md +40 -0
- package/templates/skills/riff-max/SKILL.md +46 -0
- package/templates/skills/riff-state/SKILL.md +45 -0
- package/templates/skills/riff-up/SKILL.md +38 -0
- package/templates/skills/riff-wide/SKILL.md +40 -0
- package/templates/starters/standalone/README.md +1 -1
- package/templates/starters/turborepo/README.md +2 -2
- package/templates/starters/turborepo/apps/web/src/app.tsx +2 -2
- package/templates/starters/vite/README.md +1 -1
- package/dist/server/tools/close-reply.d.mts +0 -6
- package/dist/server/tools/close-reply.mjs +0 -138
- package/dist/server/tools/comment.d.mts +0 -6
- package/dist/server/tools/comment.mjs +0 -49
- package/src/server/tools/close-reply.ts +0 -271
- package/src/server/tools/comment.ts +0 -96
package/dist/shared/signup.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { postToRelay } from "./feedback.mjs";
|
|
1
2
|
//#region src/shared/signup.ts
|
|
2
3
|
/** Where sign-ups go: the relay on Dex's site. */
|
|
3
4
|
const SIGNUP_URL = "https://sudio-site.vercel.app/api/signup";
|
|
@@ -48,8 +49,6 @@ const receiveSignup = (form) => {
|
|
|
48
49
|
signup
|
|
49
50
|
};
|
|
50
51
|
};
|
|
51
|
-
const TOO_MANY_REQUESTS = 429;
|
|
52
|
-
const SERVICE_UNAVAILABLE = 503;
|
|
53
52
|
/** Send a sign-up to the relay, if it is ready; never throws. */
|
|
54
53
|
const sendSignup = async (signup, { fetch = globalThis.fetch, url = SIGNUP_URL } = {}) => {
|
|
55
54
|
if (checkSignup(signup).length > 0) return {
|
|
@@ -59,39 +58,7 @@ const sendSignup = async (signup, { fetch = globalThis.fetch, url = SIGNUP_URL }
|
|
|
59
58
|
const form = new FormData();
|
|
60
59
|
form.set("name", signup.name.trim());
|
|
61
60
|
form.set("email", signup.email.trim());
|
|
62
|
-
|
|
63
|
-
const response = await fetch(url, {
|
|
64
|
-
method: "POST",
|
|
65
|
-
body: form
|
|
66
|
-
});
|
|
67
|
-
if (response.ok) {
|
|
68
|
-
const { id } = await response.json();
|
|
69
|
-
return typeof id === "string" && id ? {
|
|
70
|
-
ok: true,
|
|
71
|
-
id
|
|
72
|
-
} : {
|
|
73
|
-
ok: false,
|
|
74
|
-
reason: "failed"
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
if (response.status === TOO_MANY_REQUESTS) return {
|
|
78
|
-
ok: false,
|
|
79
|
-
reason: "limited"
|
|
80
|
-
};
|
|
81
|
-
if (response.status === SERVICE_UNAVAILABLE) return {
|
|
82
|
-
ok: false,
|
|
83
|
-
reason: "unavailable"
|
|
84
|
-
};
|
|
85
|
-
return {
|
|
86
|
-
ok: false,
|
|
87
|
-
reason: "failed"
|
|
88
|
-
};
|
|
89
|
-
} catch {
|
|
90
|
-
return {
|
|
91
|
-
ok: false,
|
|
92
|
-
reason: "failed"
|
|
93
|
-
};
|
|
94
|
-
}
|
|
61
|
+
return await postToRelay(url, form, fetch);
|
|
95
62
|
};
|
|
96
63
|
//#endregion
|
|
97
64
|
export { SIGNUP_LIMITS, SIGNUP_URL, checkSignup, receiveSignup, sendSignup };
|
|
@@ -33,12 +33,6 @@ export interface ConnectedAgent {
|
|
|
33
33
|
*/
|
|
34
34
|
watching?: boolean;
|
|
35
35
|
}
|
|
36
|
-
/**
|
|
37
|
-
* How an agent comes by new feedback: pushed to it as it is left, pushed
|
|
38
|
-
* with nothing yet to say it arrives, or only when it is asked or watches.
|
|
39
|
-
*/
|
|
40
|
-
export type Hearing = "pushed" | "unproven" | "asked";
|
|
41
|
-
export declare const hearingOf: (agent: ConnectedAgent) => Hearing;
|
|
42
36
|
export type StudioEvent = {
|
|
43
37
|
type: "presence";
|
|
44
38
|
presence: PresenceEntry[];
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { UNSEEN_PARTS, splitPrototypePath } from "./prototypes-core.mjs";
|
|
2
2
|
import { classify } from "./studio-files.mjs";
|
|
3
3
|
//#region src/shared/studio-events.ts
|
|
4
|
-
const hearingOf = (agent) => {
|
|
5
|
-
if (agent.channel) return "pushed";
|
|
6
|
-
return agent.unproven ? "unproven" : "asked";
|
|
7
|
-
};
|
|
8
4
|
/** Each event, made from what it carries. */
|
|
9
5
|
const studioEvent = {
|
|
10
6
|
presence: (presence) => ({
|
|
@@ -92,4 +88,4 @@ function eventsForFile(file) {
|
|
|
92
88
|
return [];
|
|
93
89
|
}
|
|
94
90
|
//#endregion
|
|
95
|
-
export { STUDIO_EVENT_TYPES, eventMessage, eventsForFile, handleStudioEvent,
|
|
91
|
+
export { STUDIO_EVENT_TYPES, eventMessage, eventsForFile, handleStudioEvent, studioEvent };
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
//#region src/shared/studio-files.d.ts
|
|
2
|
+
export declare const DISCIPLINES: readonly ["product", "brand", "engineering"];
|
|
3
|
+
export type Discipline = (typeof DISCIPLINES)[number];
|
|
4
|
+
/** A person who makes prototypes, from contributors.json. */
|
|
5
|
+
export interface Contributor {
|
|
6
|
+
discipline: Discipline;
|
|
7
|
+
/** Git user names that identify this person, so the agent knows who it is working for. */
|
|
8
|
+
git: string[];
|
|
9
|
+
/** Their GitHub username, for their avatar. */
|
|
10
|
+
github?: string;
|
|
11
|
+
name: string;
|
|
12
|
+
slug: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The Dex folder's name: `dex/` in a project, `apps/web/dex/` in an app of
|
|
16
|
+
* a workspace. An app of its own (`apps/dex`) is its Dex folder.
|
|
17
|
+
*/
|
|
18
|
+
export declare const DEX_FOLDER = "dex";
|
|
19
|
+
/** Its name before, `studio/`: `dex upgrade` moves it to DEX_FOLDER. */
|
|
20
|
+
export declare const OLD_DEX_FOLDER = "studio";
|
|
2
21
|
/** Where each of the studio's own files is, relative to its content root. */
|
|
3
22
|
export declare const STUDIO_FILES: {
|
|
4
23
|
/** Who works in the studio, and the git users that are them. */
|
|
@@ -11,6 +30,8 @@ export declare const STUDIO_FILES: {
|
|
|
11
30
|
readonly context: "context";
|
|
12
31
|
/** Each person's folder: people/<slug>/guidelines.md. */
|
|
13
32
|
readonly people: "people";
|
|
33
|
+
/** The team's own skills: skills/<name>/SKILL.md. */
|
|
34
|
+
readonly skills: "skills";
|
|
14
35
|
};
|
|
15
36
|
/** A person's own guidelines, for their agents, on top of the workspace's. */
|
|
16
37
|
export declare const personGuidelinesPath: (slug: string) => string;
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { PROTOTYPES_FOLDER, isSlug, splitPrototypePath } from "./prototypes-core.mjs";
|
|
2
2
|
//#region src/shared/studio-files.ts
|
|
3
|
+
const DISCIPLINES = [
|
|
4
|
+
"product",
|
|
5
|
+
"brand",
|
|
6
|
+
"engineering"
|
|
7
|
+
];
|
|
8
|
+
/**
|
|
9
|
+
* The Dex folder's name: `dex/` in a project, `apps/web/dex/` in an app of
|
|
10
|
+
* a workspace. An app of its own (`apps/dex`) is its Dex folder.
|
|
11
|
+
*/
|
|
12
|
+
const DEX_FOLDER = "dex";
|
|
13
|
+
/** Its name before, `studio/`: `dex upgrade` moves it to DEX_FOLDER. */
|
|
14
|
+
const OLD_DEX_FOLDER = "studio";
|
|
3
15
|
/** Where each of the studio's own files is, relative to its content root. */
|
|
4
16
|
const STUDIO_FILES = {
|
|
5
17
|
/** Who works in the studio, and the git users that are them. */
|
|
@@ -11,7 +23,9 @@ const STUDIO_FILES = {
|
|
|
11
23
|
/** The folder of context files: context/<slug>.md. */
|
|
12
24
|
context: "context",
|
|
13
25
|
/** Each person's folder: people/<slug>/guidelines.md. */
|
|
14
|
-
people: "people"
|
|
26
|
+
people: "people",
|
|
27
|
+
/** The team's own skills: skills/<name>/SKILL.md. */
|
|
28
|
+
skills: "skills"
|
|
15
29
|
};
|
|
16
30
|
/** A person's own guidelines, for their agents, on top of the workspace's. */
|
|
17
31
|
const personGuidelinesPath = (slug) => {
|
|
@@ -55,4 +69,4 @@ function classify(file) {
|
|
|
55
69
|
return "other";
|
|
56
70
|
}
|
|
57
71
|
//#endregion
|
|
58
|
-
export { STUDIO_FILES, classify, guidelinesPerson, isEditableMarkdown, isInstructionsFile, personGuidelinesPath };
|
|
72
|
+
export { DEX_FOLDER, DISCIPLINES, OLD_DEX_FOLDER, STUDIO_FILES, classify, guidelinesPerson, isEditableMarkdown, isInstructionsFile, personGuidelinesPath };
|
|
@@ -7,6 +7,7 @@ import { PasteSource } from "./snapshot-clipboard.mjs";
|
|
|
7
7
|
import { Devices } from "./devices.mjs";
|
|
8
8
|
import { AvatarFile } from "./avatar-file.mjs";
|
|
9
9
|
import { BuildSettings } from "./build-settings.mjs";
|
|
10
|
+
import { CommentAnswers, CommentBodies } from "./comments/routes.mjs";
|
|
10
11
|
import { RemovedView } from "./removed-views-core.mjs";
|
|
11
12
|
import { ReviewImport } from "./review-file.mjs";
|
|
12
13
|
import { ConnectedAgent } from "./studio-events.mjs";
|
|
@@ -304,7 +305,7 @@ export type GitStepName = GitStepBody["step"];
|
|
|
304
305
|
* The bodies the contract declares, by request and method; the rest are
|
|
305
306
|
* unknown, checked by their handlers.
|
|
306
307
|
*/
|
|
307
|
-
export interface StudioBodies {
|
|
308
|
+
export interface StudioBodies extends CommentBodies {
|
|
308
309
|
"agent-launch": {
|
|
309
310
|
POST: {
|
|
310
311
|
agent: LaunchAgentId;
|
|
@@ -382,7 +383,7 @@ export type StudioBodyOf<Name extends StudioRouteName, Method extends StudioMeth
|
|
|
382
383
|
* Each request, by name, and its answer to each method it takes. The query
|
|
383
384
|
* a request needs is in its comment.
|
|
384
385
|
*/
|
|
385
|
-
export interface StudioAnswers<Own extends OwnTypes = OwnTypes> {
|
|
386
|
+
export interface StudioAnswers<Own extends OwnTypes = OwnTypes> extends CommentAnswers {
|
|
386
387
|
/**
|
|
387
388
|
* Open an agent, or a plain terminal, where agents start: in a terminal
|
|
388
389
|
* window on this Mac (`opened`), else the command to run. Only from this
|
|
@@ -492,6 +493,13 @@ export interface StudioAnswers<Own extends OwnTypes = OwnTypes> {
|
|
|
492
493
|
events: {
|
|
493
494
|
GET: unknown;
|
|
494
495
|
};
|
|
496
|
+
/**
|
|
497
|
+
* ?prototype=<name>: its frames as an exported prototype (export-core.ts),
|
|
498
|
+
* a zip (not JSON) named for the file. POST takes an ExportChoice.
|
|
499
|
+
*/
|
|
500
|
+
export: {
|
|
501
|
+
POST: Blob;
|
|
502
|
+
};
|
|
495
503
|
/**
|
|
496
504
|
* The browser extension, as a zip (not JSON) of the folder Chrome loads
|
|
497
505
|
* unpacked, its files at the root, named EXTENSION_FILE.
|
|
@@ -593,6 +601,11 @@ export interface StudioAnswers<Own extends OwnTypes = OwnTypes> {
|
|
|
593
601
|
* they make something.
|
|
594
602
|
*/
|
|
595
603
|
newcomer: Own["contributor"] | null;
|
|
604
|
+
/**
|
|
605
|
+
* In Dex in the browser, hosted for the workspace: viewers look and
|
|
606
|
+
* comment, and never change the files.
|
|
607
|
+
*/
|
|
608
|
+
viewer?: true;
|
|
596
609
|
};
|
|
597
610
|
};
|
|
598
611
|
/**
|
|
@@ -618,7 +631,7 @@ export interface StudioAnswers<Own extends OwnTypes = OwnTypes> {
|
|
|
618
631
|
}[];
|
|
619
632
|
};
|
|
620
633
|
};
|
|
621
|
-
/** The workspace's contributors, the latest to commit first. */
|
|
634
|
+
/** The workspace's contributors, the latest to commit first; ?commits=0 skips git's log. */
|
|
622
635
|
people: {
|
|
623
636
|
GET: {
|
|
624
637
|
people: Person[];
|
|
@@ -652,6 +665,19 @@ export interface StudioAnswers<Own extends OwnTypes = OwnTypes> {
|
|
|
652
665
|
views: string[];
|
|
653
666
|
};
|
|
654
667
|
};
|
|
668
|
+
/** A find and replace's changes, or what its undo put back. */
|
|
669
|
+
replace: {
|
|
670
|
+
POST: {
|
|
671
|
+
files: string[];
|
|
672
|
+
left?: number;
|
|
673
|
+
replaced: number;
|
|
674
|
+
skipped: number;
|
|
675
|
+
undo?: string;
|
|
676
|
+
} | {
|
|
677
|
+
kept: string[];
|
|
678
|
+
restored: string[];
|
|
679
|
+
};
|
|
680
|
+
};
|
|
655
681
|
/**
|
|
656
682
|
* GET: how a restart goes, from this Dex or, while none answers, its
|
|
657
683
|
* supervisor; POST: the run Dex restarts from.
|
|
@@ -697,11 +723,6 @@ export interface StudioAnswers<Own extends OwnTypes = OwnTypes> {
|
|
|
697
723
|
file: string;
|
|
698
724
|
};
|
|
699
725
|
};
|
|
700
|
-
/** ?slug= for one prototype's, or none for every one's. */
|
|
701
|
-
threads: {
|
|
702
|
-
GET: ThreadWithPrototype[];
|
|
703
|
-
POST: ThreadWithPrototype;
|
|
704
|
-
};
|
|
705
726
|
trash: {
|
|
706
727
|
DELETE: Done;
|
|
707
728
|
};
|
|
@@ -773,61 +794,6 @@ export interface StudioAnswers<Own extends OwnTypes = OwnTypes> {
|
|
|
773
794
|
export type StudioRouteName = keyof StudioAnswers;
|
|
774
795
|
/** The methods a request takes. */
|
|
775
796
|
export type StudioMethodOf<Name extends StudioRouteName> = keyof StudioAnswers[Name] & StudioMethod;
|
|
776
|
-
/**
|
|
777
|
-
* The requests and the methods each takes, for what has to know them as it
|
|
778
|
-
* runs: the server's test that it serves each one as declared.
|
|
779
|
-
*/
|
|
780
|
-
export declare const STUDIO_ROUTES: {
|
|
781
|
-
readonly canvas: readonly ["GET", "PUT"];
|
|
782
|
-
readonly annotations: readonly ["GET", "PUT", "DELETE"];
|
|
783
|
-
readonly events: readonly ["GET"];
|
|
784
|
-
readonly "removed-views": readonly ["GET", "POST"];
|
|
785
|
-
readonly reviews: readonly ["POST"];
|
|
786
|
-
readonly trash: readonly ["DELETE"];
|
|
787
|
-
readonly threads: readonly ["GET", "POST"];
|
|
788
|
-
readonly "spec-suggestion": readonly ["POST"];
|
|
789
|
-
readonly instructions: readonly ["GET", "PUT"];
|
|
790
|
-
readonly focus: readonly ["PUT"];
|
|
791
|
-
readonly me: readonly ["GET"];
|
|
792
|
-
readonly people: readonly ["GET"];
|
|
793
|
-
readonly prototypes: readonly ["POST"];
|
|
794
|
-
readonly paste: readonly ["POST"];
|
|
795
|
-
readonly frame: readonly ["POST"];
|
|
796
|
-
readonly show: readonly ["POST"];
|
|
797
|
-
readonly text: readonly ["POST"];
|
|
798
|
-
readonly props: readonly ["POST"];
|
|
799
|
-
readonly insert: readonly ["POST"];
|
|
800
|
-
readonly screenshot: readonly ["POST"];
|
|
801
|
-
readonly snapshot: readonly ["POST"];
|
|
802
|
-
readonly picture: readonly ["POST"];
|
|
803
|
-
readonly agents: readonly ["GET"];
|
|
804
|
-
readonly edited: readonly ["GET"];
|
|
805
|
-
readonly extension: readonly ["GET"];
|
|
806
|
-
readonly "agent-setup": readonly ["GET", "POST"];
|
|
807
|
-
readonly "agent-launch": readonly ["POST"];
|
|
808
|
-
readonly "agent-stop": readonly ["POST"];
|
|
809
|
-
readonly preferences: readonly ["GET", "PUT"];
|
|
810
|
-
readonly watch: readonly ["GET", "POST"];
|
|
811
|
-
readonly welcome: readonly ["GET", "POST"];
|
|
812
|
-
readonly update: readonly ["GET", "POST"];
|
|
813
|
-
readonly "machine-update": readonly ["GET", "POST"];
|
|
814
|
-
readonly "other-dexes": readonly ["GET", "POST"];
|
|
815
|
-
readonly restart: readonly ["GET", "POST"];
|
|
816
|
-
readonly "desktop-app": readonly ["GET", "POST"];
|
|
817
|
-
readonly devices: readonly ["GET", "PUT"];
|
|
818
|
-
readonly git: readonly ["GET", "POST"];
|
|
819
|
-
readonly "git-branches": readonly ["GET"];
|
|
820
|
-
readonly "git-sync": readonly ["POST"];
|
|
821
|
-
readonly "git-pull-base": readonly ["POST"];
|
|
822
|
-
readonly "git-saved": readonly ["GET", "POST"];
|
|
823
|
-
readonly "git-checks": readonly ["POST"];
|
|
824
|
-
readonly "git-settings": readonly ["GET", "PUT"];
|
|
825
|
-
readonly "build-settings": readonly ["GET", "PUT"];
|
|
826
|
-
readonly commands: readonly ["GET", "POST", "PUT", "DELETE"];
|
|
827
|
-
readonly "workspace-settings": readonly ["GET", "PUT"];
|
|
828
|
-
readonly "workspace-icon": readonly ["GET", "PUT", "DELETE"];
|
|
829
|
-
readonly avatar: readonly ["PUT", "DELETE"];
|
|
830
|
-
};
|
|
831
797
|
/** The web app manifest `dex dev` serves. */
|
|
832
798
|
export declare const MANIFEST_FILE = "manifest.webmanifest";
|
|
833
799
|
/**
|
|
@@ -52,74 +52,6 @@ const START_LINK_META = "dex-start-link";
|
|
|
52
52
|
* standalone display says in a browser.
|
|
53
53
|
*/
|
|
54
54
|
const DESKTOP_APP_AGENT = "DexApp";
|
|
55
|
-
/**
|
|
56
|
-
* The requests and the methods each takes, for what has to know them as it
|
|
57
|
-
* runs: the server's test that it serves each one as declared.
|
|
58
|
-
*/
|
|
59
|
-
const STUDIO_ROUTES = {
|
|
60
|
-
canvas: ["GET", "PUT"],
|
|
61
|
-
annotations: [
|
|
62
|
-
"GET",
|
|
63
|
-
"PUT",
|
|
64
|
-
"DELETE"
|
|
65
|
-
],
|
|
66
|
-
events: ["GET"],
|
|
67
|
-
"removed-views": ["GET", "POST"],
|
|
68
|
-
reviews: ["POST"],
|
|
69
|
-
trash: ["DELETE"],
|
|
70
|
-
threads: ["GET", "POST"],
|
|
71
|
-
"spec-suggestion": ["POST"],
|
|
72
|
-
instructions: ["GET", "PUT"],
|
|
73
|
-
focus: ["PUT"],
|
|
74
|
-
me: ["GET"],
|
|
75
|
-
people: ["GET"],
|
|
76
|
-
prototypes: ["POST"],
|
|
77
|
-
paste: ["POST"],
|
|
78
|
-
frame: ["POST"],
|
|
79
|
-
show: ["POST"],
|
|
80
|
-
text: ["POST"],
|
|
81
|
-
props: ["POST"],
|
|
82
|
-
insert: ["POST"],
|
|
83
|
-
screenshot: ["POST"],
|
|
84
|
-
snapshot: ["POST"],
|
|
85
|
-
picture: ["POST"],
|
|
86
|
-
agents: ["GET"],
|
|
87
|
-
edited: ["GET"],
|
|
88
|
-
extension: ["GET"],
|
|
89
|
-
"agent-setup": ["GET", "POST"],
|
|
90
|
-
"agent-launch": ["POST"],
|
|
91
|
-
"agent-stop": ["POST"],
|
|
92
|
-
preferences: ["GET", "PUT"],
|
|
93
|
-
watch: ["GET", "POST"],
|
|
94
|
-
welcome: ["GET", "POST"],
|
|
95
|
-
update: ["GET", "POST"],
|
|
96
|
-
"machine-update": ["GET", "POST"],
|
|
97
|
-
"other-dexes": ["GET", "POST"],
|
|
98
|
-
restart: ["GET", "POST"],
|
|
99
|
-
"desktop-app": ["GET", "POST"],
|
|
100
|
-
devices: ["GET", "PUT"],
|
|
101
|
-
git: ["GET", "POST"],
|
|
102
|
-
"git-branches": ["GET"],
|
|
103
|
-
"git-sync": ["POST"],
|
|
104
|
-
"git-pull-base": ["POST"],
|
|
105
|
-
"git-saved": ["GET", "POST"],
|
|
106
|
-
"git-checks": ["POST"],
|
|
107
|
-
"git-settings": ["GET", "PUT"],
|
|
108
|
-
"build-settings": ["GET", "PUT"],
|
|
109
|
-
commands: [
|
|
110
|
-
"GET",
|
|
111
|
-
"POST",
|
|
112
|
-
"PUT",
|
|
113
|
-
"DELETE"
|
|
114
|
-
],
|
|
115
|
-
"workspace-settings": ["GET", "PUT"],
|
|
116
|
-
"workspace-icon": [
|
|
117
|
-
"GET",
|
|
118
|
-
"PUT",
|
|
119
|
-
"DELETE"
|
|
120
|
-
],
|
|
121
|
-
avatar: ["PUT", "DELETE"]
|
|
122
|
-
};
|
|
123
55
|
/** The web app manifest `dex dev` serves. */
|
|
124
56
|
const MANIFEST_FILE = "manifest.webmanifest";
|
|
125
57
|
/**
|
|
@@ -134,4 +66,4 @@ const PROJECT_ID_HEADER = "x-dex-project";
|
|
|
134
66
|
*/
|
|
135
67
|
const OLD_PROJECT_ID_HEADER = "x-sudio-project";
|
|
136
68
|
//#endregion
|
|
137
|
-
export { DESKTOP_APP_AGENT, DESKTOP_APP_INSTALLED, DESKTOP_APP_KEY, EXTENSION_FILE, GITHUB_SIGN_IN_COMMAND, GIT_NAME_COMMAND, MANIFEST_FILE, ME_META, NOT_RECOGNISED, OLD_PROJECT_ID_HEADER, PROJECT_ID_HEADER, STALE_PICTURE_HEADER, START_LINK_META,
|
|
69
|
+
export { DESKTOP_APP_AGENT, DESKTOP_APP_INSTALLED, DESKTOP_APP_KEY, EXTENSION_FILE, GITHUB_SIGN_IN_COMMAND, GIT_NAME_COMMAND, MANIFEST_FILE, ME_META, NOT_RECOGNISED, OLD_PROJECT_ID_HEADER, PROJECT_ID_HEADER, STALE_PICTURE_HEADER, START_LINK_META, canLaunch, nameOfMe, youOf };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Viewport } from "./canvas-core.mjs";
|
|
1
|
+
import { PageSize, Viewport } from "./canvas-core.mjs";
|
|
2
2
|
import { Sketch, SketchBox } from "./sketch-core.mjs";
|
|
3
3
|
import { SpecQuote } from "./spec-quote.mjs";
|
|
4
4
|
//#region src/shared/threads-core.d.ts
|
|
@@ -73,8 +73,8 @@ export type ThreadTarget = {
|
|
|
73
73
|
selector?: string;
|
|
74
74
|
/**
|
|
75
75
|
* The start of the element's text, or its label or placeholder when it
|
|
76
|
-
* has none, to help find it in code
|
|
77
|
-
*
|
|
76
|
+
* has none, to help find it in code, and on the page when it moves.
|
|
77
|
+
* Its pin stays in its place when the words change.
|
|
78
78
|
*/
|
|
79
79
|
text?: string;
|
|
80
80
|
/**
|
|
@@ -111,10 +111,20 @@ export type ThreadTarget = {
|
|
|
111
111
|
params?: Record<string, string>;
|
|
112
112
|
viewport?: Viewport;
|
|
113
113
|
} | {
|
|
114
|
+
/**
|
|
115
|
+
* With no row: the row its new row goes right above, as the + on the
|
|
116
|
+
* line between two rows asks. None puts the new row below the others.
|
|
117
|
+
*/
|
|
118
|
+
above?: string;
|
|
114
119
|
kind: "view";
|
|
115
120
|
/** The row to add it to; leave out for a new row (a new iteration). */
|
|
116
121
|
row?: string;
|
|
117
122
|
section: string;
|
|
123
|
+
/**
|
|
124
|
+
* The size its frame takes, set by resizing the request on the canvas.
|
|
125
|
+
* Left out, it takes the size of the frame before it.
|
|
126
|
+
*/
|
|
127
|
+
size?: PageSize;
|
|
118
128
|
step: number;
|
|
119
129
|
} | (SpecQuote & {
|
|
120
130
|
kind: "spec";
|
|
@@ -169,6 +179,10 @@ export interface ThreadReaction {
|
|
|
169
179
|
export type ChangePlace = Extract<ThreadTarget, {
|
|
170
180
|
kind: "element" | "frame";
|
|
171
181
|
}>;
|
|
182
|
+
/** A request for a new view's target: the cell it waits in, and its size. */
|
|
183
|
+
export type ViewTarget = Extract<ThreadTarget, {
|
|
184
|
+
kind: "view";
|
|
185
|
+
}>;
|
|
172
186
|
/** What changed, or why not, when the thread was resolved or dismissed. */
|
|
173
187
|
export interface ThreadResolution {
|
|
174
188
|
agent?: boolean;
|
|
@@ -262,15 +276,21 @@ export interface ThreadChange {
|
|
|
262
276
|
/** The agent session making the change, kept on its reaction. */
|
|
263
277
|
session?: string;
|
|
264
278
|
status?: ThreadStatus;
|
|
279
|
+
/**
|
|
280
|
+
* A request for a new view, moved or resized on the canvas by a person:
|
|
281
|
+
* the cell it now waits in, and the size its frame takes.
|
|
282
|
+
*/
|
|
283
|
+
target?: ThreadTarget;
|
|
265
284
|
via?: string;
|
|
266
285
|
/** Resolving: where the change landed, kept with the note. */
|
|
267
286
|
where?: ChangePlace;
|
|
268
287
|
}
|
|
269
288
|
/**
|
|
270
289
|
* A person's change to a thread, before the studio adds who they are: a
|
|
271
|
-
* reply, a reaction, who it is for, or
|
|
290
|
+
* reply, a reaction, who it is for, its status, or where a request for a
|
|
291
|
+
* new view waits.
|
|
272
292
|
*/
|
|
273
|
-
export type PersonChange = Pick<ThreadChange, "authorId" | "body" | "edit" | "for" | "on" | "hidden" | "react" | "remove" | "status">;
|
|
293
|
+
export type PersonChange = Pick<ThreadChange, "authorId" | "body" | "edit" | "for" | "on" | "hidden" | "react" | "remove" | "status" | "target">;
|
|
274
294
|
/**
|
|
275
295
|
* A thread with the prototype it belongs to, as the thread module and the
|
|
276
296
|
* studio's requests return it.
|
|
@@ -332,6 +352,8 @@ export declare const THREAD_STATUSES: ThreadStatus[];
|
|
|
332
352
|
export declare const AUDIENCES: ThreadAudience[];
|
|
333
353
|
/** The reaction an agent leaves for each status it sets. */
|
|
334
354
|
export declare const STATUS_REACTIONS: Record<"acknowledged" | "resolved" | "dismissed", string>;
|
|
355
|
+
/** The names "@" calls an agent by: no frame goes by one in a comment. */
|
|
356
|
+
export declare const AGENT_NAMES: readonly string[];
|
|
335
357
|
/** Why an agent cannot acknowledge a thread another session has claimed. */
|
|
336
358
|
export declare const CLAIMED_PROBLEM = "Another agent is on this thread.";
|
|
337
359
|
/** Why an agent cannot let go of a thread it does not hold. */
|
|
@@ -394,10 +416,11 @@ export declare function changeConflicts(thread: Thread, change: ThreadChange): s
|
|
|
394
416
|
*/
|
|
395
417
|
export declare const isOwnMessage: (message: ThreadMessage, { author, authorId }: Pick<ThreadChange, "author" | "authorId">) => boolean;
|
|
396
418
|
/** Problems with a change to a thread, empty when it is fine. */
|
|
397
|
-
export declare function changeProblems({ status, for: audience, hidden }: {
|
|
419
|
+
export declare function changeProblems({ status, for: audience, hidden, target }: {
|
|
398
420
|
for?: unknown;
|
|
399
421
|
hidden?: unknown;
|
|
400
422
|
status?: unknown;
|
|
423
|
+
target?: unknown;
|
|
401
424
|
}): string[];
|
|
402
425
|
/**
|
|
403
426
|
* Apply a change to a thread in place: a message, a status, who it is for, a
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { prototypeFiles } from "./prototypes-core.mjs";
|
|
2
1
|
import { isOneOf, isRecord, isText } from "./checks.mjs";
|
|
2
|
+
import { prototypeFiles } from "./prototypes-core.mjs";
|
|
3
3
|
import { cleanSketch, describeSketch, threadSketchProblems } from "./sketch-core.mjs";
|
|
4
|
-
import { VIEWPORTS, isSpecPath } from "./canvas-core.mjs";
|
|
4
|
+
import { VIEWPORTS, isSpecPath, requestCell } from "./canvas-core.mjs";
|
|
5
5
|
import "./spec-quote.mjs";
|
|
6
6
|
//#region src/shared/threads-core.ts
|
|
7
7
|
const THREAD_STATUSES = [
|
|
@@ -34,7 +34,14 @@ const MAX_REACTION = 8;
|
|
|
34
34
|
* for; a longer one is kept, and shortened where it is shown.
|
|
35
35
|
*/
|
|
36
36
|
const MAX_NOTE = 2e3;
|
|
37
|
-
|
|
37
|
+
/** The names "@" calls an agent by: no frame goes by one in a comment. */
|
|
38
|
+
const AGENT_NAMES = [
|
|
39
|
+
"agent",
|
|
40
|
+
"claude",
|
|
41
|
+
"codex",
|
|
42
|
+
"cursor"
|
|
43
|
+
];
|
|
44
|
+
const MENTION_RE = new RegExp(`(?:^|\\s)@(?:${AGENT_NAMES.join("|")})(?![\\w-])`, "i");
|
|
38
45
|
/** Why an agent cannot acknowledge a thread another session has claimed. */
|
|
39
46
|
const CLAIMED_PROBLEM = "Another agent is on this thread.";
|
|
40
47
|
/** Why an agent cannot let go of a thread it does not hold. */
|
|
@@ -160,6 +167,7 @@ const claimOf = (thread) => thread.status === "acknowledged" ? (thread.reactions
|
|
|
160
167
|
*/
|
|
161
168
|
function changeConflicts(thread, change) {
|
|
162
169
|
if (change.hidden !== void 0 && !thread.review) return [HIDDEN_PROBLEM];
|
|
170
|
+
if (change.target !== void 0 && (change.agent || thread.target.kind !== "view" || isClosed(thread))) return [MOVE_PROBLEM];
|
|
163
171
|
if (!change.agent) return ownMessageProblems(thread, change);
|
|
164
172
|
const problems = [];
|
|
165
173
|
if (isText(change.edit) || change.remove) problems.push("Only a person edits or removes a comment, and only their own.");
|
|
@@ -186,6 +194,8 @@ const isOwnMessage = (message, { author, authorId }) => {
|
|
|
186
194
|
*/
|
|
187
195
|
/** Only a reviewer's imported comment is ever left off the published site. */
|
|
188
196
|
const HIDDEN_PROBLEM = "Only a review's comments can be hidden from the published site.";
|
|
197
|
+
/** Only a person moves a request for a new view, and only until it is built. */
|
|
198
|
+
const MOVE_PROBLEM = "Only a person moves or resizes a request for a new view, and only while it is still to be built.";
|
|
189
199
|
const ownMessageProblems = (thread, change) => {
|
|
190
200
|
if (!(isText(change.edit) || change.remove)) return [];
|
|
191
201
|
const message = messageOn(thread, change.on);
|
|
@@ -208,9 +218,24 @@ const changeMessage = (thread, { agent, author, authorId, edit, on, remove }, at
|
|
|
208
218
|
message.edited = at;
|
|
209
219
|
}
|
|
210
220
|
};
|
|
221
|
+
/** Whether a value is a size in pixels: a positive width and height. */
|
|
222
|
+
const isSize = (value) => isRecord(value) && [value.width, value.height].every((side) => typeof side === "number" && Number.isFinite(side) && side > 0);
|
|
223
|
+
/** What a request for a new view, moved or resized, must say. */
|
|
224
|
+
const movedRequestProblems = (target) => {
|
|
225
|
+
if (!(isRecord(target) && target.kind === "view")) return ["Only a request for a new view moves: give its cell, as a view's."];
|
|
226
|
+
const { above, row, section, size, step } = target;
|
|
227
|
+
return [
|
|
228
|
+
...isText(section) ? [] : ["A request for a view names its section."],
|
|
229
|
+
...row === void 0 || isText(row) ? [] : ["A request's row is a row's id; leave it out for a new row."],
|
|
230
|
+
...above === void 0 || isText(above) ? [] : ["A new row's `above` is the id of the row it goes above."],
|
|
231
|
+
...Number.isInteger(step) && Number(step) >= 1 ? [] : ["A request for a view needs the step it fills."],
|
|
232
|
+
...size === void 0 || isSize(size) ? [] : ["A request's size is a width and a height in pixels."]
|
|
233
|
+
];
|
|
234
|
+
};
|
|
211
235
|
/** Problems with a change to a thread, empty when it is fine. */
|
|
212
|
-
function changeProblems({ status, for: audience, hidden }) {
|
|
236
|
+
function changeProblems({ status, for: audience, hidden, target }) {
|
|
213
237
|
const problems = [];
|
|
238
|
+
if (target !== void 0) problems.push(...movedRequestProblems(target));
|
|
214
239
|
if (hidden !== void 0 && typeof hidden !== "boolean") problems.push("Hidden is true or false.");
|
|
215
240
|
if (status && !isOneOf(THREAD_STATUSES, status)) problems.push(`A status is one of: ${THREAD_STATUSES.join(", ")}.`);
|
|
216
241
|
if (audience !== void 0 && !isOneOf(AUDIENCES, audience)) problems.push(`A thread is for ${AUDIENCES.join(" or ")}.`);
|
|
@@ -230,6 +255,7 @@ function changeThread(thread, change, at = now()) {
|
|
|
230
255
|
at
|
|
231
256
|
};
|
|
232
257
|
changeMessage(thread, change, at);
|
|
258
|
+
moveRequest(thread, change.target);
|
|
233
259
|
addReaction(thread, change, who);
|
|
234
260
|
keepResolution(thread, change, who);
|
|
235
261
|
addMessage(thread, change, at);
|
|
@@ -239,6 +265,22 @@ function changeThread(thread, change, at = now()) {
|
|
|
239
265
|
thread.updated = at;
|
|
240
266
|
return thread;
|
|
241
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* A request for a new view, moved or resized: the cell it waits in (for a
|
|
270
|
+
* new row, the row it goes above) and the size its frame takes, nothing else.
|
|
271
|
+
*/
|
|
272
|
+
const moveRequest = (thread, target) => {
|
|
273
|
+
if (target?.kind !== "view" || thread.target.kind !== "view") return;
|
|
274
|
+
const { size } = target;
|
|
275
|
+
thread.target = given({
|
|
276
|
+
kind: "view",
|
|
277
|
+
...requestCell(target),
|
|
278
|
+
size: size && {
|
|
279
|
+
width: Math.round(size.width),
|
|
280
|
+
height: Math.round(size.height)
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
};
|
|
242
284
|
/** Leave an imported review's thread off the published site, or show it. */
|
|
243
285
|
const setHidden = (thread, hidden) => {
|
|
244
286
|
if (hidden === void 0 || !thread.review) return;
|
|
@@ -477,6 +519,20 @@ const frameFile = (files, { doc, view }) => {
|
|
|
477
519
|
* for, which it knows from `npx dex whoami`.
|
|
478
520
|
*/
|
|
479
521
|
const ownCanvas = (files) => files && `${files.people}/<you>/canvas.json`;
|
|
522
|
+
/** Where a request's new row goes, as an agent reads it. */
|
|
523
|
+
const newRowWhere = (above) => above ? `a new row, right above row "${above}"` : "a new row at the end of the section";
|
|
524
|
+
/**
|
|
525
|
+
* A request for a new view, as an agent reads it: the cell to put its frame
|
|
526
|
+
* in, and the size to put it at when the person gave it one.
|
|
527
|
+
*/
|
|
528
|
+
const requestWhere = ({ above, row, section, size, step }, files) => ({
|
|
529
|
+
what: `A request for a new view. Build it, then add a frame for it in this cell${size ? ", at this size" : ""}: with \`place_frame\` (pass this thread's id) where you have it, otherwise in canvas.json.`,
|
|
530
|
+
canvas: ownCanvas(files),
|
|
531
|
+
section,
|
|
532
|
+
row: row ?? newRowWhere(above),
|
|
533
|
+
step,
|
|
534
|
+
...size ? { size } : {}
|
|
535
|
+
});
|
|
480
536
|
/** Where a thread is, as an agent reads it: what it is on, and its file. */
|
|
481
537
|
const whereOf = (target, files) => {
|
|
482
538
|
switch (target.kind) {
|
|
@@ -522,13 +578,7 @@ const whereOf = (target, files) => {
|
|
|
522
578
|
canvas: ownCanvas(files),
|
|
523
579
|
point: target.point
|
|
524
580
|
};
|
|
525
|
-
case "view": return
|
|
526
|
-
what: "A request for a new view. Build it, then add a frame for it in this cell: with `place_frame` (pass this thread's id) where you have it, otherwise in canvas.json.",
|
|
527
|
-
canvas: ownCanvas(files),
|
|
528
|
-
section: target.section,
|
|
529
|
-
row: target.row ?? "a new row at the end of the section",
|
|
530
|
-
step: target.step
|
|
531
|
-
};
|
|
581
|
+
case "view": return requestWhere(target, files);
|
|
532
582
|
default: return {
|
|
533
583
|
what: "A comment on the file as a whole.",
|
|
534
584
|
folder: files?.folder
|
|
@@ -598,7 +648,12 @@ const publicTarget = (target) => {
|
|
|
598
648
|
kind: target.kind,
|
|
599
649
|
section: target.section,
|
|
600
650
|
step: target.step,
|
|
601
|
-
row: target.row
|
|
651
|
+
row: target.row,
|
|
652
|
+
above: target.above,
|
|
653
|
+
size: target.size && {
|
|
654
|
+
width: target.size.width,
|
|
655
|
+
height: target.size.height
|
|
656
|
+
}
|
|
602
657
|
});
|
|
603
658
|
case "spec": return given({
|
|
604
659
|
kind: target.kind,
|
|
@@ -675,4 +730,4 @@ const publicThread = ({ created, for: audience, id, messages, reactions, resolut
|
|
|
675
730
|
*/
|
|
676
731
|
const publicThreads = (threads) => threads.flatMap(({ status, ...thread }) => status === "dismissed" || thread.review?.hidden ? [] : [publicThread(thread, status)]);
|
|
677
732
|
//#endregion
|
|
678
|
-
export { AGENT_ACTIONS, AUDIENCES, CLAIMED_PROBLEM, LIST_STATUSES, RELEASE_PROBLEM, REPLY_PROBLEM, SKETCH_BODY, STATUS_REACTIONS, SUGGESTED_BODY, THREAD_ID_RE, THREAD_STATUSES, agentChange, audienceOf, changeConflicts, changePlace, changeProblems, changeThread, claimOf, describeThread, isClosed, isOwnMessage, isRenameSuggestion, keptFiles, mentionsAgent, needsAgent, needsPerson, newThread, newThreadId, publicThreads, statusFilter, threadProblems, threadState };
|
|
733
|
+
export { AGENT_ACTIONS, AGENT_NAMES, AUDIENCES, CLAIMED_PROBLEM, LIST_STATUSES, RELEASE_PROBLEM, REPLY_PROBLEM, SKETCH_BODY, STATUS_REACTIONS, SUGGESTED_BODY, THREAD_ID_RE, THREAD_STATUSES, agentChange, audienceOf, changeConflicts, changePlace, changeProblems, changeThread, claimOf, describeThread, isClosed, isOwnMessage, isRenameSuggestion, keptFiles, mentionsAgent, needsAgent, needsPerson, newThread, newThreadId, publicThreads, statusFilter, threadProblems, threadState };
|