moi-computer 0.10.1-next.6 → 0.11.1-dev.1c52199
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 -2
- package/client/AGENTS.md +2 -2
- package/client/api/app-config.ts +2 -1
- package/client/app/AppRouter.tsx +2 -2
- package/client/app/routes/WorkspaceRoute.tsx +33 -27
- package/client/app/shell/SidebarLayout.tsx +18 -15
- package/client/components/shared/BottomPanel.tsx +26 -14
- package/client/components/shared/PanelHeader.tsx +1 -1
- package/client/components/shared/ReorderableList.tsx +7 -2
- package/client/components/shared/WorkspaceIcon.tsx +92 -0
- package/client/components/ui/alert-dialog.tsx +1 -0
- package/client/components/ui/button.tsx +1 -53
- package/client/components/ui/checkbox.tsx +1 -0
- package/client/components/ui/collapsible.tsx +1 -15
- package/client/components/ui/dialog.tsx +1 -58
- package/client/components/ui/dropdown-menu.tsx +1 -254
- package/client/components/ui/hover-card.tsx +1 -44
- package/client/components/ui/inline-input.tsx +84 -0
- package/client/components/ui/input.tsx +1 -21
- package/client/components/ui/popover.tsx +1 -88
- package/client/components/ui/resizable.tsx +1 -40
- package/client/components/ui/skeleton.tsx +1 -13
- package/client/components/ui/slider.tsx +1 -70
- package/client/components/ui/spinner.tsx +1 -18
- package/client/components/ui/switch.tsx +1 -23
- package/client/components/ui/tabs.tsx +1 -0
- package/client/components/ui/textarea.tsx +1 -18
- package/client/components/ui/toast.tsx +2 -2
- package/client/components/ui/tooltip.tsx +1 -51
- package/client/features/applets/AppletMount.tsx +5 -2
- package/client/features/applets/applet-cache.ts +3 -3
- package/client/features/applets/applet-runtime.ts +158 -108
- package/client/features/applets/applet-styles.ts +2 -2
- package/client/features/applets/applet-thumbnail.ts +6 -8
- package/client/features/applets/useApplet.ts +10 -9
- package/client/features/chat/ChatPanel.tsx +24 -15
- package/client/features/chat/ChatPopup.tsx +9 -5
- package/client/features/chat/applet-chat-intents.ts +179 -0
- package/client/features/chat/chat-send.ts +116 -64
- package/client/features/chat/chat-store.ts +51 -62
- package/client/features/chat/composer/ChatComposer.tsx +43 -128
- package/client/features/chat/composer/ModelPicker.tsx +47 -60
- package/client/features/chat/composer/attachments/AttachmentChip.tsx +99 -0
- package/client/features/chat/composer/attachments/DrawingAttachmentChip.tsx +37 -0
- package/client/features/chat/composer/attachments/FileAttachmentChip.tsx +22 -0
- package/client/features/chat/composer/attachments/TextAttachmentChip.tsx +11 -0
- package/client/features/chat/composer/attachments/draft-attachments.ts +168 -0
- package/client/features/chat/composer/attachments/types.ts +25 -0
- package/client/features/chat/composer/attachments/uploads.ts +26 -0
- package/client/features/chat/composer/banners/ErrorBanner.tsx +20 -12
- package/client/features/chat/composer/model-order.ts +15 -0
- package/client/features/chat/composer/useWorkspaceComposerState.tsx +15 -7
- package/client/features/chat/{chat-connection.ts → connection/chat-connection.ts} +1 -1
- package/client/features/chat/{chat-frames.ts → connection/chat-frames.ts} +10 -8
- package/client/features/chat/{ChatEmptyState.tsx → messages/ChatEmptyState.tsx} +16 -11
- package/client/features/chat/{MarkdownContent.tsx → messages/MarkdownContent.tsx} +16 -1
- package/client/features/chat/{TurnView.tsx → messages/TurnView.tsx} +27 -19
- package/client/features/chat/{group-turns.ts → messages/group-turns.ts} +12 -0
- package/client/features/chat/{interleave-notices.ts → messages/interleave-notices.ts} +7 -11
- package/client/features/chat/{tool-group → messages/tool-group}/SubagentCard.tsx +1 -1
- package/client/features/chat/{tool-group → messages/tool-group}/TimelineRow.tsx +2 -2
- package/client/features/chat/{tool-group → messages/tool-group}/ToolCallGroup.tsx +2 -5
- package/client/features/chat/{tool-group → messages/tool-group}/format/codex.ts +4 -1
- package/client/features/chat/{ChatSelector.tsx → sessions/ChatSelector.tsx} +3 -3
- package/client/features/chat/{api.ts → sessions/api.ts} +5 -14
- package/client/features/chat/sessions/session-view.ts +53 -0
- package/client/features/chat/{useSelectedSession.ts → sessions/useSelectedSession.ts} +64 -20
- package/client/features/chat/useChat.ts +46 -24
- package/client/features/collab/DevCollabIdentity.tsx +170 -0
- package/client/features/collab/DevCollabKit.tsx +501 -0
- package/client/features/collab/DevCollabPage.tsx +25 -0
- package/client/features/collab/WorkspaceCollabControls.tsx +313 -0
- package/client/features/collab/client.ts +146 -0
- package/client/features/collab/components.tsx +307 -0
- package/client/features/collab/dev-persona.ts +66 -0
- package/client/features/collab/engine.ts +96 -0
- package/client/features/collab/entry.tsx +35 -0
- package/client/features/collab/facehash-avatar.ts +132 -0
- package/client/features/collab/fake-engine.ts +130 -0
- package/client/features/collab/hooks.tsx +253 -0
- package/client/features/collab/identity.ts +305 -0
- package/client/features/collab/index.ts +45 -0
- package/client/features/collab/people.ts +102 -0
- package/client/features/collab/personal-state.ts +61 -0
- package/client/features/collab/presence-publisher.ts +29 -0
- package/client/features/collab/presence-target.ts +10 -0
- package/client/features/collab/primitives.tsx +398 -0
- package/client/features/collab/proxy-identity.ts +24 -0
- package/client/features/collab/store.ts +156 -0
- package/client/features/dev/ChatStatesPage.tsx +8 -7
- package/client/features/dev/DevIndexPage.tsx +10 -0
- package/client/features/dev/DevRoutes.tsx +16 -1
- package/client/features/dev/HarnessDebugPage.tsx +11 -8
- package/client/features/dev/ToolCallsPage.tsx +1 -1
- package/client/features/dev/UiComponentPreviews.tsx +855 -0
- package/client/features/dev/UiComponentsPage.tsx +60 -0
- package/client/features/dev/chat-states-fixtures.ts +13 -2
- package/client/features/drawings/capture-element.ts +13 -1
- package/client/features/drawings/useChatAnnotation.ts +17 -17
- package/client/features/drawings/useDrawingLayer.ts +7 -9
- package/client/features/drawings/useViewBuilderSketch.ts +18 -15
- package/client/features/home/HomePage.tsx +8 -7
- package/client/features/home/WorkspacePreview.tsx +2 -2
- package/client/features/home/workspace-presentation.tsx +1 -11
- package/client/features/home/workspace-setup/DemoDialog.tsx +3 -2
- package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +5 -8
- package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +2 -4
- package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +7 -20
- package/client/features/overview/HiddenPanel.tsx +109 -0
- package/client/features/overview/Overview.tsx +302 -0
- package/client/features/overview/WidgetCanvas.tsx +164 -0
- package/client/features/{widgets → overview}/WidgetFrame.tsx +25 -17
- package/client/features/overview/WorkspaceName.tsx +60 -0
- package/client/features/overview/api.ts +30 -0
- package/client/features/overview/default/ViewsWidget.tsx +252 -0
- package/client/features/overview/default/registry.tsx +36 -0
- package/client/features/{widgets → overview}/grid.ts +36 -0
- package/client/features/overview/useGridReconcile.ts +94 -0
- package/client/features/scratchpad/Scratchpad.tsx +7 -8
- package/client/features/scratchpad/ScratchpadControls.tsx +0 -1
- package/client/features/scratchpad/useScratchpadSnapshot.tsx +23 -13
- package/client/features/settings/GeneralSettings.tsx +55 -58
- package/client/features/settings/SettingsLayout.tsx +2 -2
- package/client/features/settings/WorkspaceIconPicker.tsx +318 -0
- package/client/features/settings/WorkspaceSettingsDialog.tsx +65 -0
- package/client/features/settings/api.ts +48 -24
- package/client/features/views/ViewBuilder.tsx +5 -4
- package/client/features/views/ViewManager.tsx +28 -22
- package/client/features/views/api.ts +36 -2
- package/client/features/views/useViewBuilderActions.ts +11 -5
- package/client/features/views/useViewBuilderDrafts.ts +23 -21
- package/client/features/views/view-presentation.ts +13 -0
- package/client/features/workspace/{CustomizePanel.tsx → ThemePanel.tsx} +26 -31
- package/client/features/workspace/UnavailablePage.tsx +21 -0
- package/client/features/workspace/WorkspaceLayoutContext.tsx +22 -10
- package/client/features/workspace/WorkspaceScreen.tsx +228 -172
- package/client/features/workspace/WorkspaceSplitLayout.tsx +7 -2
- package/client/features/workspace/WorkspaceTabs.tsx +2 -0
- package/client/features/workspace/api.ts +5 -31
- package/client/features/workspace/layout-save.ts +13 -0
- package/client/features/workspace/moi-context.ts +15 -11
- package/client/features/workspace/tab-resolution.ts +10 -33
- package/client/features/workspace/useWorkspaceNavigation.ts +173 -101
- package/client/index.css +23 -30
- package/client/index.tsx +4 -3
- package/client/lib/app-icon-registry.ts +2 -0
- package/client/lib/use-latest-ref.ts +11 -0
- package/client/main.tsx +1 -1
- package/client/runtime/useWorkspaceEvents.ts +59 -14
- package/client/theme.css +5 -5
- package/dist/chunk-1ftessc8.js +2 -0
- package/dist/chunk-3802vh2p.js +2 -0
- package/dist/chunk-542a2m9m.js +1 -0
- package/dist/chunk-5745d83v.js +2 -0
- package/dist/chunk-5zxdsjym.js +1 -0
- package/dist/{chunk-tqd3pkg8.css → chunk-60q353jq.css} +1 -1
- package/dist/chunk-7r4z77ry.js +2 -0
- package/dist/chunk-9cm0wjah.js +79 -0
- package/dist/{chunk-11cab5dq.css → chunk-cq2r11fg.css} +1 -1
- package/dist/chunk-cvgdm1hq.js +2 -0
- package/dist/chunk-gptm4jpd.js +546 -0
- package/dist/chunk-nf2wkvf9.js +14 -0
- package/dist/chunk-wnmf38ta.js +5 -0
- package/dist/chunk-xaehhr1j.css +1 -0
- package/dist/chunk-xpt063fx.js +1 -0
- package/dist/index.html +1 -1
- package/lib/app-icons.ts +1 -0
- package/lib/applet-selector.ts +24 -0
- package/lib/chat-title.ts +6 -1
- package/lib/collab/colors.ts +24 -0
- package/lib/collab/protocol.ts +83 -0
- package/lib/collab/types.ts +63 -0
- package/lib/default-widgets.ts +32 -0
- package/lib/experimental.ts +14 -0
- package/lib/format.ts +67 -7
- package/lib/message-attachments.ts +40 -0
- package/lib/moi-attachments.ts +204 -0
- package/lib/moi-context.ts +27 -35
- package/lib/navigation.ts +84 -0
- package/lib/themes.ts +6 -6
- package/lib/types.ts +103 -40
- package/lib/workspace-icon.ts +20 -0
- package/lib/workspace-layout.ts +22 -2
- package/lib/workspace-tabs.ts +9 -33
- package/package.json +44 -32
- package/registry.json +656 -0
- package/server/AGENTS.md +2 -0
- package/server/agent.ts +1 -1
- package/server/api.ts +162 -68
- package/server/app-config.ts +127 -34
- package/server/applet-typecheck.ts +100 -0
- package/server/applets/applet-css.ts +55 -0
- package/server/{bundler → applets}/build-applet.ts +21 -240
- package/server/applets/build-worker.ts +178 -0
- package/server/applets/config.ts +226 -0
- package/server/applets/dependencies.ts +206 -0
- package/server/{applets.ts → applets/index.ts} +44 -189
- package/server/applets/runtime/base.ts +4 -0
- package/server/applets/runtime/moi.ts +42 -0
- package/server/applets/runtime/rpc.ts +17 -0
- package/server/applets/view-source.ts +67 -0
- package/server/attachment-message.ts +95 -0
- package/server/chat-selection.ts +23 -0
- package/server/cli-ui-components.ts +28 -33
- package/server/cli.ts +226 -120
- package/server/collab/applet-module.ts +50 -0
- package/server/collab/cloudflare-access.ts +77 -0
- package/server/collab/config.ts +18 -0
- package/server/collab/ipc.ts +10 -0
- package/server/collab/manager.ts +407 -0
- package/server/collab/service.ts +137 -0
- package/server/collab/skill/collab-env.d.ts +92 -0
- package/server/collab/skill/index.ts +59 -0
- package/server/collab/worker.ts +52 -0
- package/server/control.ts +63 -42
- package/server/data-dir.ts +1 -1
- package/server/harness/README.md +45 -50
- package/server/harness/acp/NOTES.md +426 -0
- package/server/harness/acp/adapter.ts +7 -21
- package/server/harness/acp/discovery.ts +27 -30
- package/server/harness/acp/model-state.ts +57 -0
- package/server/harness/acp/session.ts +49 -56
- package/server/harness/claude-code/NOTES.md +54 -13
- package/server/harness/claude-code/adapter.ts +8 -25
- package/server/harness/claude-code/cli.ts +40 -0
- package/server/harness/claude-code/index.ts +13 -5
- package/server/harness/claude-code/models.ts +72 -19
- package/server/harness/claude-code/session.ts +447 -343
- package/server/harness/claude-code/sessions.ts +9 -4
- package/server/harness/codex/NOTES.md +222 -350
- package/server/harness/codex/adapter.ts +102 -52
- package/server/harness/codex/auth.ts +1 -3
- package/server/harness/codex/client.ts +169 -249
- package/server/harness/codex/discovery.ts +9 -17
- package/server/harness/codex/index.ts +3 -1
- package/server/harness/codex/pagination.ts +24 -0
- package/server/harness/codex/permissions.ts +32 -8
- package/server/harness/codex/probe.ts +10 -13
- package/server/harness/codex/session.ts +567 -181
- package/server/harness/codex/transport.ts +184 -0
- package/server/harness/debug.ts +1 -1
- package/server/harness/hermes/NOTES.md +19 -1
- package/server/harness/hermes/discovery.ts +20 -0
- package/server/harness/hermes/index.ts +13 -0
- package/server/harness/hermes/models.ts +28 -8
- package/server/harness/openclaw/NOTES.md +1 -1
- package/server/harness/openclaw/adapter.ts +22 -4
- package/server/harness/openclaw/gateway.ts +5 -3
- package/server/harness/openclaw/session.ts +27 -27
- package/server/harness/types.ts +9 -5
- package/server/layout.ts +24 -16
- package/server/moi-scaffold.ts +22 -14
- package/server/navigation-relay.ts +110 -0
- package/server/preview.ts +3 -1
- package/server/registry.ts +71 -41
- package/server/scratchpad-executor.ts +79 -56
- package/server/scratchpad-shape-defaults.ts +82 -0
- package/server/selected-session.ts +24 -4
- package/server/skill-update.ts +5 -3
- package/server/skill-version.ts +4 -7
- package/server/skills-template.ts +60 -9
- package/server/tabs.ts +19 -33
- package/server/tldraw-package.d.ts +4 -0
- package/server/ui-components.ts +101 -434
- package/server/uploads.ts +0 -0
- package/server/view-builders.ts +20 -2
- package/server/views.ts +126 -6
- package/server/web.ts +108 -30
- package/server/widgets.ts +12 -5
- package/server/workspace-config.ts +13 -9
- package/server/workspace-env.ts +3 -2
- package/tsconfig.json +0 -1
- package/ui-components/accordion.tsx +71 -0
- package/ui-components/alert-dialog.tsx +165 -0
- package/ui-components/alert.tsx +68 -0
- package/ui-components/attachment.tsx +195 -0
- package/ui-components/avatar.tsx +91 -0
- package/ui-components/badge.tsx +49 -0
- package/ui-components/button-group.tsx +78 -0
- package/ui-components/button.tsx +55 -0
- package/ui-components/calendar.tsx +180 -0
- package/ui-components/card.tsx +84 -0
- package/ui-components/carousel.tsx +235 -0
- package/ui-components/chart.tsx +338 -0
- package/ui-components/checkbox.tsx +28 -0
- package/ui-components/collapsible.tsx +15 -0
- package/ui-components/combobox.tsx +267 -0
- package/ui-components/context-menu.tsx +244 -0
- package/ui-components/dialog.tsx +138 -0
- package/ui-components/docs/accordion.md +463 -0
- package/ui-components/docs/alert-dialog.md +481 -0
- package/ui-components/docs/alert.md +301 -0
- package/ui-components/docs/attachment.md +689 -0
- package/ui-components/docs/avatar.md +495 -0
- package/ui-components/docs/badge.md +258 -0
- package/ui-components/docs/button-group.md +879 -0
- package/ui-components/docs/button.md +26 -0
- package/ui-components/docs/calendar.md +862 -0
- package/ui-components/docs/card.md +265 -0
- package/ui-components/docs/carousel.md +627 -0
- package/ui-components/docs/chart.md +1256 -0
- package/ui-components/docs/checkbox.md +477 -0
- package/ui-components/docs/collapsible.md +446 -0
- package/ui-components/docs/combobox.md +1003 -0
- package/ui-components/docs/context-menu.md +860 -0
- package/ui-components/docs/data-table.md +1580 -0
- package/ui-components/docs/date-picker.md +614 -0
- package/ui-components/docs/dialog.md +414 -0
- package/ui-components/docs/drawer.md +51 -0
- package/ui-components/docs/dropdown-menu.md +1000 -0
- package/ui-components/docs/field.md +1192 -0
- package/ui-components/docs/hover-card.md +275 -0
- package/ui-components/docs/input-group.md +866 -0
- package/ui-components/docs/input.md +456 -0
- package/ui-components/docs/kbd.md +191 -0
- package/ui-components/docs/label.md +295 -0
- package/ui-components/docs/pagination.md +416 -0
- package/ui-components/docs/popover.md +348 -0
- package/ui-components/docs/progress.md +214 -0
- package/ui-components/docs/radio-group.md +389 -0
- package/ui-components/docs/resizable.md +265 -0
- package/ui-components/docs/select.md +616 -0
- package/ui-components/docs/separator.md +216 -0
- package/ui-components/docs/skeleton.md +205 -0
- package/ui-components/docs/slider.md +226 -0
- package/ui-components/docs/spinner.md +332 -0
- package/ui-components/docs/switch.md +236 -0
- package/ui-components/docs/table.md +551 -0
- package/ui-components/docs/tabs.md +379 -0
- package/ui-components/docs/textarea.md +187 -0
- package/ui-components/docs/toggle-group.md +370 -0
- package/ui-components/docs/toggle.md +91 -0
- package/ui-components/docs/tooltip.md +290 -0
- package/ui-components/drawer.tsx +213 -0
- package/ui-components/dropdown-menu.tsx +263 -0
- package/ui-components/field.tsx +224 -0
- package/ui-components/hover-card.tsx +46 -0
- package/ui-components/input-group.tsx +146 -0
- package/ui-components/input.tsx +20 -0
- package/ui-components/kbd.tsx +32 -0
- package/ui-components/label.tsx +17 -0
- package/ui-components/pagination.tsx +124 -0
- package/ui-components/popover.tsx +81 -0
- package/ui-components/progress.tsx +63 -0
- package/ui-components/radio-group.tsx +38 -0
- package/ui-components/resizable.tsx +40 -0
- package/ui-components/scoped-portal.tsx +31 -0
- package/ui-components/select.tsx +195 -0
- package/ui-components/separator.tsx +18 -0
- package/ui-components/skeleton.tsx +15 -0
- package/ui-components/slider.tsx +75 -0
- package/ui-components/spinner.tsx +20 -0
- package/ui-components/switch.tsx +27 -0
- package/ui-components/table.tsx +86 -0
- package/ui-components/tabs.tsx +75 -0
- package/ui-components/textarea.tsx +17 -0
- package/ui-components/toggle-group.tsx +85 -0
- package/ui-components/toggle.tsx +42 -0
- package/ui-components/tooltip.tsx +61 -0
- package/ui-components/utils.ts +8 -0
- package/workspace/.claude/skills/moi-workspace/SKILL.md +295 -248
- package/workspace/.claude/skills/moi-workspace/references/COLLABORATIVE.md +151 -0
- package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +100 -152
- package/workspace/.claude/skills/moi-workspace/references/INTENTS.md +156 -0
- package/workspace/.claude/skills/moi-workspace/references/UI-COMPONENTS.md +67 -203
- package/client/features/chat/attachment-staging.ts +0 -153
- package/client/features/chat/uploads.ts +0 -18
- package/client/features/chat/useAppletChatMessage.ts +0 -68
- package/client/features/settings/IconPicker.tsx +0 -442
- package/client/features/settings/WorkspaceSettings.tsx +0 -92
- package/client/features/settings/render-icon.ts +0 -173
- package/client/features/widgets/HiddenPanel.tsx +0 -80
- package/client/features/widgets/WidgetGrid.tsx +0 -123
- package/client/features/widgets/Widgets.tsx +0 -260
- package/client/features/widgets/useGridReconcile.ts +0 -73
- package/dist/chunk-104m57qw.js +0 -2
- package/dist/chunk-7paadv61.js +0 -1
- package/dist/chunk-bj3akjs2.js +0 -1
- package/dist/chunk-c9pjqx9m.js +0 -14
- package/dist/chunk-j2w2vak4.js +0 -546
- package/dist/chunk-k2r9c95m.js +0 -10
- package/dist/chunk-kmbxhgwv.js +0 -1
- package/dist/chunk-pcnahct1.js +0 -5
- package/dist/chunk-r8s1b672.css +0 -1
- package/dist/chunk-tny85yt2.js +0 -2
- package/dist/chunk-v7wr1df4.js +0 -2
- package/dist/chunk-vwzshv0d.js +0 -83
- package/server/bundler/applet-css.ts +0 -155
- /package/client/features/chat/{ChatPromptBubbles.tsx → messages/ChatPromptBubbles.tsx} +0 -0
- /package/client/features/chat/{ShimmerText.tsx → messages/ShimmerText.tsx} +0 -0
- /package/client/features/chat/{preview-turn.ts → messages/preview-turn.ts} +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/CodeBlock.tsx +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/Collapse.tsx +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/ReadImagePreview.tsx +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/ToolOutput.tsx +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/detect.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/fixtures.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/claude.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/hermes.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/index.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/mcp.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/openclaw.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/shared.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/shell.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/index.ts +0 -0
- /package/client/features/chat/{useStickToBottom.ts → messages/useStickToBottom.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { lazy, Suspense, useEffect, useRef, useState } from 'react'
|
|
1
|
+
import { lazy, Suspense, useCallback, useEffect, useRef, useState } from 'react'
|
|
2
2
|
|
|
3
3
|
import { AnimatePresence } from 'motion/react'
|
|
4
4
|
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
IconLayoutSidebarRight,
|
|
10
10
|
IconLetterCase,
|
|
11
11
|
IconMessages,
|
|
12
|
+
IconSettings,
|
|
12
13
|
IconSketching
|
|
13
14
|
} from '@tabler/icons-react'
|
|
14
15
|
|
|
@@ -16,20 +17,34 @@ import { DrawingLayer } from '@/client/features/drawings/DrawingLayer'
|
|
|
16
17
|
import { DrawingToolbar } from '@/client/features/drawings/DrawingToolbar'
|
|
17
18
|
import { useChatAnnotation } from '@/client/features/drawings/useChatAnnotation'
|
|
18
19
|
import { ChatPanel } from '@/client/features/chat/ChatPanel'
|
|
19
|
-
import type { WelcomeDestination } from '@/client/features/chat/ChatEmptyState'
|
|
20
|
+
import type { WelcomeDestination } from '@/client/features/chat/messages/ChatEmptyState'
|
|
20
21
|
import { ChatPopup } from '@/client/features/chat/ChatPopup'
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
22
|
+
import { ThemePanel } from '@/client/features/workspace/ThemePanel'
|
|
23
|
+
import { Overview } from '@/client/features/overview/Overview'
|
|
24
|
+
import { CollabControls } from '@/client/features/collab/entry'
|
|
24
25
|
import { PanelHeader } from '@/client/components/shared/PanelHeader'
|
|
25
|
-
import {
|
|
26
|
+
import { WorkspaceIcon } from '@/client/components/shared/WorkspaceIcon'
|
|
26
27
|
import { Button } from '@/client/components/ui/button'
|
|
28
|
+
import {
|
|
29
|
+
DropdownMenu,
|
|
30
|
+
DropdownMenuContent,
|
|
31
|
+
DropdownMenuGroup,
|
|
32
|
+
DropdownMenuItem,
|
|
33
|
+
DropdownMenuTrigger
|
|
34
|
+
} from '@/client/components/ui/dropdown-menu'
|
|
27
35
|
import { Tooltip, TooltipContent, TooltipTrigger } from '@/client/components/ui/tooltip'
|
|
28
|
-
import {
|
|
29
|
-
|
|
36
|
+
import {
|
|
37
|
+
useAppletChatMessage,
|
|
38
|
+
useAppletChatAttachment
|
|
39
|
+
} from '@/client/features/chat/applet-chat-intents'
|
|
30
40
|
import { useChat } from '@/client/features/chat/useChat'
|
|
41
|
+
import {
|
|
42
|
+
WorkspaceSettingsDialog,
|
|
43
|
+
WorkspaceSettingsDialogTrigger
|
|
44
|
+
} from '@/client/features/settings/WorkspaceSettingsDialog'
|
|
31
45
|
import { ViewBuilder, type ViewBuilderHandle } from '@/client/features/views/ViewBuilder'
|
|
32
46
|
import { ViewManager } from '@/client/features/views/ViewManager'
|
|
47
|
+
import { getViewIcon, getViewLabel } from '@/client/features/views/view-presentation'
|
|
33
48
|
import { useViewBuilderActions } from '@/client/features/views/useViewBuilderActions'
|
|
34
49
|
import { useViewBuilderDrafts } from '@/client/features/views/useViewBuilderDrafts'
|
|
35
50
|
import { useFitsSplitLayout } from '@/client/features/workspace/useFitsSplitLayout'
|
|
@@ -57,6 +72,7 @@ import {
|
|
|
57
72
|
type WorkspaceTabItem,
|
|
58
73
|
WorkspaceTabs
|
|
59
74
|
} from '@/client/features/workspace/WorkspaceTabs'
|
|
75
|
+
import { isDefaultWidget } from '@/lib/default-widgets'
|
|
60
76
|
import type {
|
|
61
77
|
LayoutMode,
|
|
62
78
|
ViewBuilder as ViewBuilderData,
|
|
@@ -72,6 +88,7 @@ import {
|
|
|
72
88
|
} from '@/lib/workspace-tabs'
|
|
73
89
|
|
|
74
90
|
import { WorkspaceSplitLayout } from './WorkspaceSplitLayout'
|
|
91
|
+
import { UnavailablePage } from './UnavailablePage'
|
|
75
92
|
|
|
76
93
|
const Scratchpad = lazy(() =>
|
|
77
94
|
import('@/client/features/scratchpad/Scratchpad').then(module => ({
|
|
@@ -79,70 +96,15 @@ const Scratchpad = lazy(() =>
|
|
|
79
96
|
}))
|
|
80
97
|
)
|
|
81
98
|
|
|
82
|
-
// Tab label for a view: its configured title, or the file-name id as fallback.
|
|
83
|
-
const viewLabel = (v: ViewInfo) => v.config.title || v.id
|
|
84
|
-
|
|
85
99
|
const viewBuilderIcon = (builder: ViewBuilderData) => resolveAppIcon(builder.icon) ?? IconArticle
|
|
86
100
|
|
|
87
|
-
function viewIcon(view: ViewInfo, builders: ViewBuilderData[]) {
|
|
88
|
-
const builder = builders.find(candidate => candidate.viewId === view.id)
|
|
89
|
-
return resolveAppIcon(view.config.icon) ?? resolveAppIcon(builder?.icon) ?? IconArticle
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
type SectionControlsProps = {
|
|
93
|
-
onToggleMode: () => void
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Full-screen workspace action: open the chat as a docked split column.
|
|
97
|
-
function SectionControls({ onToggleMode }: SectionControlsProps) {
|
|
98
|
-
return (
|
|
99
|
-
<Tooltip>
|
|
100
|
-
<TooltipTrigger
|
|
101
|
-
render={
|
|
102
|
-
<Button variant="ghost" size="icon-sm" onClick={onToggleMode} aria-label="Dock agent">
|
|
103
|
-
<IconLayoutSidebarRight stroke={1.75} />
|
|
104
|
-
</Button>
|
|
105
|
-
}
|
|
106
|
-
/>
|
|
107
|
-
<TooltipContent>Dock agent</TooltipContent>
|
|
108
|
-
</Tooltip>
|
|
109
|
-
)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
type WorkspaceCustomizeActionProps = {
|
|
113
|
-
active: boolean
|
|
114
|
-
onToggle: () => void
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function WorkspaceCustomizeAction({ active, onToggle }: WorkspaceCustomizeActionProps) {
|
|
118
|
-
return (
|
|
119
|
-
<Tooltip>
|
|
120
|
-
<TooltipTrigger
|
|
121
|
-
render={
|
|
122
|
-
<Button
|
|
123
|
-
variant="ghost"
|
|
124
|
-
size="icon-sm"
|
|
125
|
-
aria-label="Customize"
|
|
126
|
-
aria-pressed={active}
|
|
127
|
-
onClick={onToggle}
|
|
128
|
-
className={cn(active && 'bg-accent')}
|
|
129
|
-
>
|
|
130
|
-
<IconLetterCase stroke={1.75} />
|
|
131
|
-
</Button>
|
|
132
|
-
}
|
|
133
|
-
/>
|
|
134
|
-
<TooltipContent>Customize</TooltipContent>
|
|
135
|
-
</Tooltip>
|
|
136
|
-
)
|
|
137
|
-
}
|
|
138
|
-
|
|
139
101
|
type WorkspaceScreenProps = {
|
|
140
102
|
widgets: WidgetInfo[]
|
|
141
103
|
views: ViewInfo[]
|
|
142
104
|
builders: ViewBuilderData[]
|
|
143
105
|
}
|
|
144
106
|
|
|
145
|
-
type WidgetMode = 'idle' | '
|
|
107
|
+
type WidgetMode = 'idle' | 'customizing' | 'theming'
|
|
146
108
|
|
|
147
109
|
function tabItemFor(
|
|
148
110
|
tab: WorkspaceTabId,
|
|
@@ -161,12 +123,13 @@ function tabItemFor(
|
|
|
161
123
|
loading: agentRunning
|
|
162
124
|
}
|
|
163
125
|
}
|
|
164
|
-
if (tab === '
|
|
126
|
+
if (tab === 'overview') {
|
|
165
127
|
return {
|
|
166
128
|
key: tab,
|
|
167
129
|
Icon: IconLayout2,
|
|
168
|
-
label: '
|
|
169
|
-
closable
|
|
130
|
+
label: 'Overview',
|
|
131
|
+
closable: false,
|
|
132
|
+
reorderable: false
|
|
170
133
|
}
|
|
171
134
|
}
|
|
172
135
|
if (tab === 'scratchpad') {
|
|
@@ -193,8 +156,8 @@ function tabItemFor(
|
|
|
193
156
|
return view
|
|
194
157
|
? {
|
|
195
158
|
key: tab,
|
|
196
|
-
Icon:
|
|
197
|
-
label:
|
|
159
|
+
Icon: getViewIcon(view, builders),
|
|
160
|
+
label: getViewLabel(view),
|
|
198
161
|
closable
|
|
199
162
|
}
|
|
200
163
|
: null
|
|
@@ -210,8 +173,54 @@ function applyVisibleTabOrder(
|
|
|
210
173
|
return open.map(tab => (visibleSet.has(tab) ? orderedVisible[cursor++] : tab))
|
|
211
174
|
}
|
|
212
175
|
|
|
176
|
+
type WorkspaceMenuProps = {
|
|
177
|
+
onOpenTheme: () => void
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function WorkspaceMenu({ onOpenTheme }: WorkspaceMenuProps) {
|
|
181
|
+
const { layout, name, provider } = useWorkspaceLayoutCtx()
|
|
182
|
+
const [iconHovered, setIconHovered] = useState(false)
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<WorkspaceSettingsDialog>
|
|
186
|
+
<DropdownMenu>
|
|
187
|
+
<DropdownMenuTrigger
|
|
188
|
+
className="flex min-w-0 cursor-pointer items-center gap-2 rounded-sm outline-none focus-visible:ring-3 focus-visible:ring-ring/50"
|
|
189
|
+
aria-label={`${name ?? 'Workspace'} menu`}
|
|
190
|
+
onPointerEnter={() => setIconHovered(true)}
|
|
191
|
+
onPointerLeave={() => setIconHovered(false)}
|
|
192
|
+
>
|
|
193
|
+
<WorkspaceIcon
|
|
194
|
+
icon={iconHovered ? { ...layout.icon, type: 'glyph', value: 'dots' } : layout.icon}
|
|
195
|
+
workspaceType={provider}
|
|
196
|
+
workspaceTheme={layout.theme}
|
|
197
|
+
className="size-5 rounded-sm"
|
|
198
|
+
/>
|
|
199
|
+
{name && <span className="truncate text-sm font-medium text-foreground">{name}</span>}
|
|
200
|
+
</DropdownMenuTrigger>
|
|
201
|
+
<DropdownMenuContent align="start" sideOffset={6} className="w-36">
|
|
202
|
+
<DropdownMenuGroup>
|
|
203
|
+
<DropdownMenuItem onClick={onOpenTheme}>
|
|
204
|
+
<IconLetterCase stroke={1.75} />
|
|
205
|
+
Theme
|
|
206
|
+
</DropdownMenuItem>
|
|
207
|
+
<DropdownMenuItem
|
|
208
|
+
nativeButton
|
|
209
|
+
render={<WorkspaceSettingsDialogTrigger />}
|
|
210
|
+
className="w-full"
|
|
211
|
+
>
|
|
212
|
+
<IconSettings stroke={1.75} />
|
|
213
|
+
Settings
|
|
214
|
+
</DropdownMenuItem>
|
|
215
|
+
</DropdownMenuGroup>
|
|
216
|
+
</DropdownMenuContent>
|
|
217
|
+
</DropdownMenu>
|
|
218
|
+
</WorkspaceSettingsDialog>
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
|
|
213
222
|
export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenProps) {
|
|
214
|
-
const { layout, setLayout,
|
|
223
|
+
const { layout, setLayout, workspaceId } = useWorkspaceLayoutCtx()
|
|
215
224
|
const theme = resolveWorkspaceTheme(layout.theme)
|
|
216
225
|
const builderActions = useViewBuilderActions()
|
|
217
226
|
const {
|
|
@@ -237,10 +246,13 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
237
246
|
// Split needs the open set to decide whether it's available at all, and the
|
|
238
247
|
// navigation hook needs split to resolve the active tab — so the open set is
|
|
239
248
|
// derived from the raw layout here, before either.
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
249
|
+
const hasWorkspaceContent = effectiveOpenTabs(
|
|
250
|
+
normalizeTabsState(layout.tabs),
|
|
251
|
+
views,
|
|
252
|
+
builders
|
|
253
|
+
).some(tab => tab !== 'agent')
|
|
254
|
+
const hasAppletWidgets = widgets.some(widget => !isDefaultWidget(widget.id))
|
|
255
|
+
const hasWorkspaceApplets = hasAppletWidgets || views.length > 0
|
|
244
256
|
|
|
245
257
|
// Effective layout mode. Split is only visible with workspace content and
|
|
246
258
|
// enough row width; the saved mode remains the user's intent.
|
|
@@ -250,7 +262,15 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
250
262
|
|
|
251
263
|
// The tab address: URL in, active tab + applet params out, plus the persisted
|
|
252
264
|
// tab state it keeps in sync. See useWorkspaceNavigation for the invariants.
|
|
253
|
-
const {
|
|
265
|
+
const {
|
|
266
|
+
tabsState,
|
|
267
|
+
activeTab,
|
|
268
|
+
appletParams,
|
|
269
|
+
navigateToTab,
|
|
270
|
+
setTabs,
|
|
271
|
+
isUnavailable,
|
|
272
|
+
onNavigationClick
|
|
273
|
+
} = useWorkspaceNavigation({
|
|
254
274
|
views,
|
|
255
275
|
builders,
|
|
256
276
|
split: dockedSplit
|
|
@@ -266,6 +286,8 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
266
286
|
sessionId,
|
|
267
287
|
processing,
|
|
268
288
|
error,
|
|
289
|
+
loadError,
|
|
290
|
+
retryLoad,
|
|
269
291
|
send,
|
|
270
292
|
stop,
|
|
271
293
|
selectSession,
|
|
@@ -275,10 +297,14 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
275
297
|
workspaceId,
|
|
276
298
|
{
|
|
277
299
|
chatError: error,
|
|
278
|
-
onDismissChatError: dismissError
|
|
300
|
+
onDismissChatError: dismissError,
|
|
301
|
+
chatLoadError: loadError,
|
|
302
|
+
onRetryChatLoad: retryLoad
|
|
279
303
|
}
|
|
280
304
|
)
|
|
281
305
|
|
|
306
|
+
const openTabIds = effectiveOpenTabs(tabsState, views, builders)
|
|
307
|
+
const nonAgentOpenTabs = openTabIds.filter(tab => tab !== 'agent')
|
|
282
308
|
const openSet = new Set(tabsState.open)
|
|
283
309
|
|
|
284
310
|
// Entering split with the agent tab on screen needs no special-casing
|
|
@@ -316,8 +342,14 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
316
342
|
const activeDraftBuilderId = activeDraftBuilder?.id
|
|
317
343
|
const canAnnotate =
|
|
318
344
|
widgetMode === 'idle' &&
|
|
319
|
-
((activeTab === '
|
|
320
|
-
const
|
|
345
|
+
((activeTab === 'overview' && hasAppletWidgets) || activeView !== undefined)
|
|
346
|
+
const {
|
|
347
|
+
controls: annotationControls,
|
|
348
|
+
docked: dockedAnnotation,
|
|
349
|
+
layerProps: annotationLayerProps,
|
|
350
|
+
popup: popupAnnotation,
|
|
351
|
+
targetRef: annotationTargetRef
|
|
352
|
+
} = useChatAnnotation({
|
|
321
353
|
workspaceId,
|
|
322
354
|
sessionId,
|
|
323
355
|
activeTab,
|
|
@@ -331,13 +363,11 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
331
363
|
const open = tabsState.open.filter(tab => tabAvailable(tab, views, builders))
|
|
332
364
|
if (open.length === tabsState.open.length) return
|
|
333
365
|
const nextOpen = effectiveOpenTabs(tabsState, views, builders)
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
active: nextOpen.includes(tabsState.active) ? tabsState.active : nextOpen[0]
|
|
338
|
-
}
|
|
366
|
+
setTabs({
|
|
367
|
+
open: nextOpen,
|
|
368
|
+
active: nextOpen.includes(tabsState.active) ? tabsState.active : nextOpen[0]
|
|
339
369
|
})
|
|
340
|
-
}, [builders,
|
|
370
|
+
}, [builders, setTabs, tabsState, views])
|
|
341
371
|
|
|
342
372
|
useEffect(() => {
|
|
343
373
|
const replacements = new Map<WorkspaceTabId, WorkspaceTabId>()
|
|
@@ -350,7 +380,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
350
380
|
|
|
351
381
|
// The URL follows a replaced builder tab to the view that took its place.
|
|
352
382
|
const urlReplacement = replacements.get(activeTab)
|
|
353
|
-
if (urlReplacement) navigateToTab(urlReplacement)
|
|
383
|
+
if (urlReplacement) navigateToTab(urlReplacement, { replace: true })
|
|
354
384
|
|
|
355
385
|
const replacementViews = new Set(replacements.values())
|
|
356
386
|
const sourceForView = new Map(
|
|
@@ -371,8 +401,8 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
371
401
|
}
|
|
372
402
|
if (!changed) return
|
|
373
403
|
const active = replacements.get(tabsState.active) ?? tabsState.active
|
|
374
|
-
|
|
375
|
-
}, [activeTab, builders, navigateToTab,
|
|
404
|
+
setTabs({ open: open.length > 0 ? open : ['overview'], active })
|
|
405
|
+
}, [activeTab, builders, navigateToTab, setTabs, tabsState, views])
|
|
376
406
|
|
|
377
407
|
useEffect(() => {
|
|
378
408
|
if (mode !== 'fullscreen' || activeTab === 'agent') {
|
|
@@ -388,52 +418,55 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
388
418
|
|
|
389
419
|
// Tab switching is navigation; the saved default and the open set follow via
|
|
390
420
|
// the navigation hook. Only the chat side effects belong to the screen.
|
|
391
|
-
const openTab = (tab: WorkspaceTabId
|
|
392
|
-
navigateToTab(tab
|
|
421
|
+
const openTab = (tab: WorkspaceTabId) => {
|
|
422
|
+
navigateToTab(tab)
|
|
393
423
|
if (tab === 'agent') {
|
|
394
424
|
setFloatingChatOpen(false)
|
|
395
425
|
setChatFocusRequest(request => request + 1)
|
|
396
426
|
}
|
|
397
427
|
}
|
|
398
428
|
|
|
429
|
+
const createView = () => {
|
|
430
|
+
// Do NOT select the draft's pre-minted sessionId here: no session exists
|
|
431
|
+
// behind it until submit. Submit selects it once the chat actually starts.
|
|
432
|
+
void builderActions.create().then(builder => openTab(viewBuilderTabId(builder.id)))
|
|
433
|
+
}
|
|
434
|
+
|
|
399
435
|
const navigateFromWelcome = (destination: WelcomeDestination) => {
|
|
400
436
|
if (destination === 'views') {
|
|
401
437
|
const firstView = views[0]
|
|
402
438
|
if (firstView) openTab(viewTabId(firstView.id))
|
|
403
|
-
else
|
|
439
|
+
else createView()
|
|
404
440
|
} else {
|
|
405
441
|
openTab(destination)
|
|
406
442
|
}
|
|
407
443
|
setFloatingChatOpen(false)
|
|
408
444
|
}
|
|
409
445
|
|
|
410
|
-
// Focus requests from applet bridges arrive here already validated — the
|
|
411
|
-
// applet runtime narrows the untrusted tab id and params shape at the trust
|
|
412
|
-
// boundary (applet-runtime.ts). A well-formed id for a missing view just
|
|
413
|
-
// resolves to the default like any dead URL.
|
|
414
|
-
useAppletEvent(workspaceId, 'focusTab', openTab)
|
|
415
|
-
|
|
416
|
-
// `moi tab focus` — a workspace event, not an applet call: the control
|
|
417
|
-
// server validated the target and params before publishing.
|
|
418
446
|
useWorkspaceEvent(event => {
|
|
419
|
-
if (
|
|
420
|
-
|
|
447
|
+
if (
|
|
448
|
+
event.type === 'view:deleted' &&
|
|
449
|
+
event.workspaceId === workspaceId &&
|
|
450
|
+
activeTab === viewTabId(event.name)
|
|
451
|
+
) {
|
|
452
|
+
openTab('overview')
|
|
421
453
|
}
|
|
422
454
|
})
|
|
423
455
|
|
|
424
456
|
const closeTab = (tab: WorkspaceTabId) => {
|
|
457
|
+
if (tab === 'overview') return
|
|
425
458
|
const builderId = viewBuilderIdFromTab(tab)
|
|
426
459
|
const builder = builderId ? builders.find(candidate => candidate.id === builderId) : undefined
|
|
427
460
|
if ((!canCloseTabs && !builder) || !openSet.has(tab)) return
|
|
428
461
|
let open = tabsState.open.filter(t => t !== tab)
|
|
429
|
-
if (open.length === 0) open = ['
|
|
462
|
+
if (open.length === 0) open = ['overview']
|
|
430
463
|
// The neighbor that takes over when the tab on screen closes.
|
|
431
464
|
const visibleIndex = visibleTabIds.indexOf(tab)
|
|
432
465
|
const nextTab =
|
|
433
466
|
visibleTabIds[visibleIndex + 1] ??
|
|
434
467
|
visibleTabIds[visibleIndex - 1] ??
|
|
435
468
|
open.find(t => tabAvailable(t, views, builders)) ??
|
|
436
|
-
'
|
|
469
|
+
'overview'
|
|
437
470
|
const active =
|
|
438
471
|
tabsState.active === tab || !open.includes(tabsState.active) ? nextTab : tabsState.active
|
|
439
472
|
// Persist the open set BEFORE navigating so the sync effect (which reads
|
|
@@ -451,7 +484,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
451
484
|
const tab = viewBuilderTabId(builder.id)
|
|
452
485
|
if (openSet.has(tab)) {
|
|
453
486
|
let open = tabsState.open.filter(item => item !== tab)
|
|
454
|
-
if (open.length === 0) open = ['
|
|
487
|
+
if (open.length === 0) open = ['overview']
|
|
455
488
|
setTabs({ open, active: tabsState.active === tab ? open[0] : tabsState.active })
|
|
456
489
|
if (activeTab === tab) navigateToTab(open[0])
|
|
457
490
|
}
|
|
@@ -483,7 +516,8 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
483
516
|
// Chat messages fired from applet UI. `openChat` is the reveal: on a view tab
|
|
484
517
|
// in full-screen mode the chat is a closed popover, and a run the user can't
|
|
485
518
|
// see is worse than a panel that opens itself.
|
|
486
|
-
useAppletChatMessage({ send, revealChat: openChat, agentAvailability })
|
|
519
|
+
useAppletChatMessage({ sessionId, send, revealChat: openChat, agentAvailability })
|
|
520
|
+
useAppletChatAttachment(sessionId, openChat)
|
|
487
521
|
|
|
488
522
|
const createItems: CreateWorkspaceTabItem[] = [
|
|
489
523
|
...(!dockedSplit && !openSet.has('agent')
|
|
@@ -496,16 +530,6 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
496
530
|
}
|
|
497
531
|
] satisfies CreateWorkspaceTabItem[])
|
|
498
532
|
: []),
|
|
499
|
-
...(!openSet.has('widgets')
|
|
500
|
-
? ([
|
|
501
|
-
{
|
|
502
|
-
key: 'widgets',
|
|
503
|
-
Icon: IconLayout2,
|
|
504
|
-
label: 'Widgets',
|
|
505
|
-
onClick: () => openTab('widgets')
|
|
506
|
-
}
|
|
507
|
-
] satisfies CreateWorkspaceTabItem[])
|
|
508
|
-
: []),
|
|
509
533
|
...(!openSet.has('scratchpad')
|
|
510
534
|
? ([
|
|
511
535
|
{
|
|
@@ -522,8 +546,8 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
522
546
|
.map(
|
|
523
547
|
({ view, tab }): CreateWorkspaceTabItem => ({
|
|
524
548
|
key: tab,
|
|
525
|
-
Icon:
|
|
526
|
-
label:
|
|
549
|
+
Icon: getViewIcon(view, builders),
|
|
550
|
+
label: getViewLabel(view),
|
|
527
551
|
onClick: () => openTab(tab)
|
|
528
552
|
})
|
|
529
553
|
),
|
|
@@ -543,32 +567,41 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
543
567
|
key: 'create-view',
|
|
544
568
|
Icon: IconBrowserPlus,
|
|
545
569
|
label: 'New view',
|
|
546
|
-
onClick:
|
|
547
|
-
// Do NOT select the draft's pre-minted sessionId here: no session
|
|
548
|
-
// exists behind it until submit, so making it the chat selection turns
|
|
549
|
-
// the chat into a dead "New chat" whose sends try to resume a session
|
|
550
|
-
// that isn't there. Submit selects it once the chat actually starts.
|
|
551
|
-
void builderActions.create().then(builder => openTab(viewBuilderTabId(builder.id)))
|
|
552
|
-
}
|
|
570
|
+
onClick: createView
|
|
553
571
|
}
|
|
554
572
|
]
|
|
555
573
|
|
|
574
|
+
const changeBuilderDraft = useCallback(
|
|
575
|
+
(value: string) => {
|
|
576
|
+
if (activeDraftBuilder) builderDrafts.change(activeDraftBuilder.id, value)
|
|
577
|
+
},
|
|
578
|
+
[activeDraftBuilder, builderDrafts]
|
|
579
|
+
)
|
|
580
|
+
const removeBuilderDrawing = useCallback(() => {
|
|
581
|
+
if (activeDraftBuilder) {
|
|
582
|
+
void builderRefs.current.get(activeDraftBuilder.id)?.resetSketch()
|
|
583
|
+
}
|
|
584
|
+
}, [activeDraftBuilder])
|
|
585
|
+
const submitBuilderDraft = useCallback(
|
|
586
|
+
async (value: string) => {
|
|
587
|
+
if (!activeDraftBuilder) return
|
|
588
|
+
const builderView = builderRefs.current.get(activeDraftBuilder.id)
|
|
589
|
+
await builderView?.prepareSketchForSend()
|
|
590
|
+
await builderActions.submit(activeDraftBuilder, value)
|
|
591
|
+
// Submit clears the sent attachment. Keep the canvas until the built view replaces it.
|
|
592
|
+
builderDrafts.clear(activeDraftBuilder.id)
|
|
593
|
+
},
|
|
594
|
+
[activeDraftBuilder, builderActions, builderDrafts]
|
|
595
|
+
)
|
|
596
|
+
|
|
556
597
|
const builderChatDraft = activeDraftBuilder
|
|
557
598
|
? {
|
|
558
599
|
sessionId: activeDraftBuilder.sessionId,
|
|
559
600
|
builderId: activeDraftBuilder.id,
|
|
560
601
|
initialValue: activeDraftBuilder.input.requirements,
|
|
561
|
-
onChange:
|
|
562
|
-
onRemoveDrawing:
|
|
563
|
-
|
|
564
|
-
},
|
|
565
|
-
onSubmit: async (value: string) => {
|
|
566
|
-
const builderView = builderRefs.current.get(activeDraftBuilder.id)
|
|
567
|
-
await builderView?.prepareSketchForSend()
|
|
568
|
-
await builderActions.submit(activeDraftBuilder, value)
|
|
569
|
-
// Submit clears the sent attachment. Keep the canvas until the built view replaces it.
|
|
570
|
-
builderDrafts.clear(activeDraftBuilder.id)
|
|
571
|
-
}
|
|
602
|
+
onChange: changeBuilderDraft,
|
|
603
|
+
onRemoveDrawing: removeBuilderDrawing,
|
|
604
|
+
onSubmit: submitBuilderDraft
|
|
572
605
|
}
|
|
573
606
|
: undefined
|
|
574
607
|
|
|
@@ -584,13 +617,13 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
584
617
|
previewTurn={previewTurn}
|
|
585
618
|
sessionId={sessionId}
|
|
586
619
|
processing={processing}
|
|
587
|
-
composerBanner={
|
|
620
|
+
composerBanner={activeDraftBuilder ? builderComposerBanner : composerBanner}
|
|
588
621
|
agentAvailability={agentAvailability}
|
|
589
622
|
send={send}
|
|
590
623
|
stop={stop}
|
|
591
624
|
onNavigateFromWelcome={navigateFromWelcome}
|
|
592
625
|
onClose={() => setMode('fullscreen')}
|
|
593
|
-
annotation={
|
|
626
|
+
annotation={dockedAnnotation}
|
|
594
627
|
builderDraft={builderChatDraft}
|
|
595
628
|
docked
|
|
596
629
|
/>
|
|
@@ -623,18 +656,28 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
623
656
|
>
|
|
624
657
|
<div className="relative flex min-h-0 flex-1">
|
|
625
658
|
<div
|
|
626
|
-
ref={
|
|
627
|
-
inert={
|
|
628
|
-
aria-hidden={
|
|
659
|
+
ref={annotationTargetRef}
|
|
660
|
+
inert={annotationControls.active || undefined}
|
|
661
|
+
aria-hidden={annotationControls.active || undefined}
|
|
629
662
|
className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background transition-colors duration-100 ease-out motion-reduce:transition-none"
|
|
630
663
|
>
|
|
631
|
-
{
|
|
664
|
+
{isUnavailable ? (
|
|
665
|
+
<UnavailablePage onOpenOverview={() => openTab('overview')} />
|
|
666
|
+
) : activeTab === 'agent' ? (
|
|
632
667
|
tabbedChat
|
|
633
|
-
) : activeTab === '
|
|
634
|
-
<
|
|
635
|
-
|
|
636
|
-
|
|
668
|
+
) : activeTab === 'overview' ? (
|
|
669
|
+
<Overview
|
|
670
|
+
customizing={widgetMode === 'customizing'}
|
|
671
|
+
theming={widgetMode === 'theming'}
|
|
672
|
+
onThemingChange={theming => setWidgetMode(theming ? 'theming' : 'idle')}
|
|
673
|
+
onCustomizingChange={customizing =>
|
|
674
|
+
setWidgetMode(customizing ? 'customizing' : 'idle')
|
|
675
|
+
}
|
|
637
676
|
widgets={widgets}
|
|
677
|
+
views={views}
|
|
678
|
+
builders={builders}
|
|
679
|
+
onOpenView={viewId => openTab(viewTabId(viewId))}
|
|
680
|
+
onCreateView={createView}
|
|
638
681
|
onCreateWidget={() => {
|
|
639
682
|
selectSession(null)
|
|
640
683
|
openChat('Create widget')
|
|
@@ -655,7 +698,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
655
698
|
if (handle) builderRefs.current.set(builder.id, handle)
|
|
656
699
|
else builderRefs.current.delete(builder.id)
|
|
657
700
|
}}
|
|
658
|
-
active={activeBuilder?.id === builder.id}
|
|
701
|
+
active={!isUnavailable && activeBuilder?.id === builder.id}
|
|
659
702
|
builder={builder}
|
|
660
703
|
chatDocked={mode === 'split'}
|
|
661
704
|
workspaceId={workspaceId}
|
|
@@ -675,33 +718,30 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
675
718
|
mounted across tab switches (and collapses to nothing while
|
|
676
719
|
another tab is on screen), which is what makes a switch back
|
|
677
720
|
instant. */}
|
|
678
|
-
<ViewManager
|
|
721
|
+
<ViewManager
|
|
722
|
+
views={views}
|
|
723
|
+
activeViewId={isUnavailable ? null : (activeView?.id ?? null)}
|
|
724
|
+
params={appletParams}
|
|
725
|
+
/>
|
|
679
726
|
</div>
|
|
680
727
|
|
|
681
|
-
<DrawingLayer {...
|
|
728
|
+
<DrawingLayer {...annotationLayerProps}>
|
|
682
729
|
<DrawingToolbar
|
|
683
|
-
controls={
|
|
730
|
+
controls={annotationControls}
|
|
684
731
|
title="Draw annotation"
|
|
685
|
-
busy={
|
|
686
|
-
onComplete={() => void
|
|
732
|
+
busy={annotationControls.finishing}
|
|
733
|
+
onComplete={() => void annotationControls.finish()}
|
|
687
734
|
/>
|
|
688
735
|
</DrawingLayer>
|
|
689
736
|
</div>
|
|
690
737
|
|
|
691
738
|
<AnimatePresence>
|
|
692
|
-
{widgetMode === '
|
|
739
|
+
{widgetMode === 'theming' && <ThemePanel onClose={() => setWidgetMode('idle')} />}
|
|
693
740
|
</AnimatePresence>
|
|
694
741
|
|
|
695
742
|
<PanelHeader>
|
|
696
743
|
<div className="flex min-w-0 flex-1 items-center gap-4">
|
|
697
|
-
<
|
|
698
|
-
<img
|
|
699
|
-
src={icon ?? workspaceProviderIcon[provider ?? 'claude-code']}
|
|
700
|
-
alt=""
|
|
701
|
-
className="size-5 shrink-0 rounded-xs"
|
|
702
|
-
/>
|
|
703
|
-
{name && <span className="truncate text-sm font-medium text-foreground">{name}</span>}
|
|
704
|
-
</div>
|
|
744
|
+
<WorkspaceMenu onOpenTheme={() => setWidgetMode('theming')} />
|
|
705
745
|
<WorkspaceTabs
|
|
706
746
|
tabs={tabItems}
|
|
707
747
|
active={activeTab}
|
|
@@ -711,22 +751,38 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
711
751
|
onReorder={reorderTabs}
|
|
712
752
|
/>
|
|
713
753
|
</div>
|
|
714
|
-
<
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
<
|
|
722
|
-
|
|
723
|
-
|
|
754
|
+
<CollabControls
|
|
755
|
+
workspaceId={workspaceId}
|
|
756
|
+
describeTab={tab => tabItemFor(tab, views, builders, false, false, () => false)}
|
|
757
|
+
onOpenTab={openTab}
|
|
758
|
+
/>
|
|
759
|
+
{hasWorkspaceContent && canUseSplit && mode === 'fullscreen' && (
|
|
760
|
+
<Tooltip>
|
|
761
|
+
<TooltipTrigger
|
|
762
|
+
render={
|
|
763
|
+
<Button
|
|
764
|
+
variant="ghost"
|
|
765
|
+
size="icon-sm"
|
|
766
|
+
onClick={() => setMode('split')}
|
|
767
|
+
aria-label="Dock agent"
|
|
768
|
+
className="text-muted-foreground"
|
|
769
|
+
>
|
|
770
|
+
<IconLayoutSidebarRight stroke={1.75} />
|
|
771
|
+
</Button>
|
|
772
|
+
}
|
|
773
|
+
/>
|
|
774
|
+
<TooltipContent>Dock agent</TooltipContent>
|
|
775
|
+
</Tooltip>
|
|
776
|
+
)}
|
|
724
777
|
</PanelHeader>
|
|
725
778
|
</div>
|
|
726
779
|
)
|
|
727
780
|
|
|
728
781
|
return (
|
|
729
|
-
<div
|
|
782
|
+
<div
|
|
783
|
+
onClick={onNavigationClick}
|
|
784
|
+
className="relative flex h-full min-h-0 flex-col font-sans text-foreground"
|
|
785
|
+
>
|
|
730
786
|
<div ref={rowRef} className="flex min-h-0 flex-1">
|
|
731
787
|
{hasWorkspaceContent && canUseSplit && splitLayoutConstraints ? (
|
|
732
788
|
<WorkspaceSplitLayout
|
|
@@ -766,13 +822,13 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
766
822
|
previewTurn={previewTurn}
|
|
767
823
|
sessionId={sessionId}
|
|
768
824
|
processing={processing}
|
|
769
|
-
composerBanner={
|
|
825
|
+
composerBanner={activeDraftBuilder ? builderComposerBanner : composerBanner}
|
|
770
826
|
agentAvailability={agentAvailability}
|
|
771
827
|
send={send}
|
|
772
828
|
stop={stop}
|
|
773
829
|
onNavigateFromWelcome={navigateFromWelcome}
|
|
774
830
|
onClose={onClose}
|
|
775
|
-
annotation={
|
|
831
|
+
annotation={popupAnnotation}
|
|
776
832
|
builderDraft={builderChatDraft}
|
|
777
833
|
/>
|
|
778
834
|
)}
|