moi-computer 0.11.0 → 0.11.1-dev.be1ed10
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/app/AppRouter.tsx +2 -2
- package/client/app/routes/WorkspaceRoute.tsx +7 -9
- 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 +1 -1
- package/client/features/applets/applet-cache.ts +3 -3
- package/client/features/applets/applet-runtime.ts +147 -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 +170 -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/useChat.ts +42 -24
- package/client/features/dev/ChatStatesPage.tsx +8 -7
- package/client/features/dev/DevIndexPage.tsx +5 -0
- package/client/features/dev/DevRoutes.tsx +2 -0
- 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/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 +25 -22
- package/client/features/views/api.ts +36 -2
- package/client/features/views/useViewBuilderActions.ts +8 -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 +4 -7
- package/client/features/workspace/WorkspaceScreen.tsx +210 -162
- package/client/features/workspace/WorkspaceSplitLayout.tsx +7 -2
- package/client/features/workspace/WorkspaceTabs.tsx +2 -0
- package/client/features/workspace/api.ts +2 -30
- package/client/features/workspace/moi-context.ts +8 -9
- package/client/features/workspace/tab-resolution.ts +10 -33
- package/client/features/workspace/useWorkspaceNavigation.ts +164 -101
- package/client/index.css +23 -30
- 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-tqd3pkg8.css → chunk-60q353jq.css} +1 -1
- package/dist/chunk-691pqsj6.js +2 -0
- package/dist/chunk-7a5nm4k9.css +1 -0
- package/dist/chunk-amb8y04y.js +1 -0
- package/dist/chunk-cf3pgy7j.js +546 -0
- package/dist/{chunk-11cab5dq.css → chunk-cq2r11fg.css} +1 -1
- package/dist/chunk-mzrgr577.js +5 -0
- package/dist/chunk-nf2wkvf9.js +14 -0
- package/dist/chunk-q6a0g26x.js +1 -0
- package/dist/chunk-twgdemkc.js +74 -0
- package/dist/chunk-x90k0f5c.js +2 -0
- package/dist/chunk-yq00csvd.js +2 -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/default-widgets.ts +32 -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 +20 -35
- package/lib/navigation.ts +84 -0
- package/lib/themes.ts +6 -6
- package/lib/types.ts +91 -34
- package/lib/workspace-icon.ts +20 -0
- package/lib/workspace-layout.ts +22 -2
- package/lib/workspace-tabs.ts +9 -33
- package/package.json +42 -32
- package/registry.json +656 -0
- package/server/AGENTS.md +2 -0
- package/server/agent.ts +1 -1
- package/server/api.ts +139 -66
- package/server/applet-typecheck.ts +95 -0
- package/server/applets/applet-css.ts +55 -0
- package/server/{bundler → applets}/build-applet.ts +13 -242
- 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/cli-ui-components.ts +28 -33
- package/server/cli.ts +169 -108
- 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 +9 -14
- 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 +48 -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 +46 -13
- 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 +90 -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/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 -264
- package/client/features/widgets/useGridReconcile.ts +0 -73
- package/dist/chunk-104m57qw.js +0 -2
- package/dist/chunk-59zf0m6n.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-p1yqa71k.js +0 -83
- package/dist/chunk-pcnahct1.js +0 -5
- package/dist/chunk-r5xrenjy.css +0 -1
- package/dist/chunk-tny85yt2.js +0 -2
- package/dist/chunk-v7wr1df4.js +0 -2
- 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
- /package/client/features/chat/{useSelectedSession.ts → sessions/useSelectedSession.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,33 @@ 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 { Widgets } from '@/client/features/widgets/Widgets'
|
|
22
|
+
import { ThemePanel } from '@/client/features/workspace/ThemePanel'
|
|
23
|
+
import { Overview } from '@/client/features/overview/Overview'
|
|
24
24
|
import { PanelHeader } from '@/client/components/shared/PanelHeader'
|
|
25
|
-
import {
|
|
25
|
+
import { WorkspaceIcon } from '@/client/components/shared/WorkspaceIcon'
|
|
26
26
|
import { Button } from '@/client/components/ui/button'
|
|
27
|
+
import {
|
|
28
|
+
DropdownMenu,
|
|
29
|
+
DropdownMenuContent,
|
|
30
|
+
DropdownMenuGroup,
|
|
31
|
+
DropdownMenuItem,
|
|
32
|
+
DropdownMenuTrigger
|
|
33
|
+
} from '@/client/components/ui/dropdown-menu'
|
|
27
34
|
import { Tooltip, TooltipContent, TooltipTrigger } from '@/client/components/ui/tooltip'
|
|
28
|
-
import {
|
|
29
|
-
|
|
35
|
+
import {
|
|
36
|
+
useAppletChatMessage,
|
|
37
|
+
useAppletChatAttachment
|
|
38
|
+
} from '@/client/features/chat/applet-chat-intents'
|
|
30
39
|
import { useChat } from '@/client/features/chat/useChat'
|
|
40
|
+
import {
|
|
41
|
+
WorkspaceSettingsDialog,
|
|
42
|
+
WorkspaceSettingsDialogTrigger
|
|
43
|
+
} from '@/client/features/settings/WorkspaceSettingsDialog'
|
|
31
44
|
import { ViewBuilder, type ViewBuilderHandle } from '@/client/features/views/ViewBuilder'
|
|
32
45
|
import { ViewManager } from '@/client/features/views/ViewManager'
|
|
46
|
+
import { getViewIcon, getViewLabel } from '@/client/features/views/view-presentation'
|
|
33
47
|
import { useViewBuilderActions } from '@/client/features/views/useViewBuilderActions'
|
|
34
48
|
import { useViewBuilderDrafts } from '@/client/features/views/useViewBuilderDrafts'
|
|
35
49
|
import { useFitsSplitLayout } from '@/client/features/workspace/useFitsSplitLayout'
|
|
@@ -57,6 +71,7 @@ import {
|
|
|
57
71
|
type WorkspaceTabItem,
|
|
58
72
|
WorkspaceTabs
|
|
59
73
|
} from '@/client/features/workspace/WorkspaceTabs'
|
|
74
|
+
import { isDefaultWidget } from '@/lib/default-widgets'
|
|
60
75
|
import type {
|
|
61
76
|
LayoutMode,
|
|
62
77
|
ViewBuilder as ViewBuilderData,
|
|
@@ -72,6 +87,7 @@ import {
|
|
|
72
87
|
} from '@/lib/workspace-tabs'
|
|
73
88
|
|
|
74
89
|
import { WorkspaceSplitLayout } from './WorkspaceSplitLayout'
|
|
90
|
+
import { UnavailablePage } from './UnavailablePage'
|
|
75
91
|
|
|
76
92
|
const Scratchpad = lazy(() =>
|
|
77
93
|
import('@/client/features/scratchpad/Scratchpad').then(module => ({
|
|
@@ -79,70 +95,15 @@ const Scratchpad = lazy(() =>
|
|
|
79
95
|
}))
|
|
80
96
|
)
|
|
81
97
|
|
|
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
98
|
const viewBuilderIcon = (builder: ViewBuilderData) => resolveAppIcon(builder.icon) ?? IconArticle
|
|
86
99
|
|
|
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
100
|
type WorkspaceScreenProps = {
|
|
140
101
|
widgets: WidgetInfo[]
|
|
141
102
|
views: ViewInfo[]
|
|
142
103
|
builders: ViewBuilderData[]
|
|
143
104
|
}
|
|
144
105
|
|
|
145
|
-
type WidgetMode = 'idle' | '
|
|
106
|
+
type WidgetMode = 'idle' | 'customizing' | 'theming'
|
|
146
107
|
|
|
147
108
|
function tabItemFor(
|
|
148
109
|
tab: WorkspaceTabId,
|
|
@@ -161,12 +122,13 @@ function tabItemFor(
|
|
|
161
122
|
loading: agentRunning
|
|
162
123
|
}
|
|
163
124
|
}
|
|
164
|
-
if (tab === '
|
|
125
|
+
if (tab === 'overview') {
|
|
165
126
|
return {
|
|
166
127
|
key: tab,
|
|
167
128
|
Icon: IconLayout2,
|
|
168
|
-
label: '
|
|
169
|
-
closable
|
|
129
|
+
label: 'Overview',
|
|
130
|
+
closable: false,
|
|
131
|
+
reorderable: false
|
|
170
132
|
}
|
|
171
133
|
}
|
|
172
134
|
if (tab === 'scratchpad') {
|
|
@@ -193,8 +155,8 @@ function tabItemFor(
|
|
|
193
155
|
return view
|
|
194
156
|
? {
|
|
195
157
|
key: tab,
|
|
196
|
-
Icon:
|
|
197
|
-
label:
|
|
158
|
+
Icon: getViewIcon(view, builders),
|
|
159
|
+
label: getViewLabel(view),
|
|
198
160
|
closable
|
|
199
161
|
}
|
|
200
162
|
: null
|
|
@@ -210,8 +172,54 @@ function applyVisibleTabOrder(
|
|
|
210
172
|
return open.map(tab => (visibleSet.has(tab) ? orderedVisible[cursor++] : tab))
|
|
211
173
|
}
|
|
212
174
|
|
|
175
|
+
type WorkspaceMenuProps = {
|
|
176
|
+
onOpenTheme: () => void
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function WorkspaceMenu({ onOpenTheme }: WorkspaceMenuProps) {
|
|
180
|
+
const { layout, name, provider } = useWorkspaceLayoutCtx()
|
|
181
|
+
const [iconHovered, setIconHovered] = useState(false)
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
<WorkspaceSettingsDialog>
|
|
185
|
+
<DropdownMenu>
|
|
186
|
+
<DropdownMenuTrigger
|
|
187
|
+
className="flex min-w-0 cursor-pointer items-center gap-2 rounded-sm outline-none focus-visible:ring-3 focus-visible:ring-ring/50"
|
|
188
|
+
aria-label={`${name ?? 'Workspace'} menu`}
|
|
189
|
+
onPointerEnter={() => setIconHovered(true)}
|
|
190
|
+
onPointerLeave={() => setIconHovered(false)}
|
|
191
|
+
>
|
|
192
|
+
<WorkspaceIcon
|
|
193
|
+
icon={iconHovered ? { ...layout.icon, type: 'glyph', value: 'dots' } : layout.icon}
|
|
194
|
+
workspaceType={provider}
|
|
195
|
+
workspaceTheme={layout.theme}
|
|
196
|
+
className="size-5 rounded-sm"
|
|
197
|
+
/>
|
|
198
|
+
{name && <span className="truncate text-sm font-medium text-foreground">{name}</span>}
|
|
199
|
+
</DropdownMenuTrigger>
|
|
200
|
+
<DropdownMenuContent align="start" sideOffset={6} className="w-36">
|
|
201
|
+
<DropdownMenuGroup>
|
|
202
|
+
<DropdownMenuItem onClick={onOpenTheme}>
|
|
203
|
+
<IconLetterCase stroke={1.75} />
|
|
204
|
+
Theme
|
|
205
|
+
</DropdownMenuItem>
|
|
206
|
+
<DropdownMenuItem
|
|
207
|
+
nativeButton
|
|
208
|
+
render={<WorkspaceSettingsDialogTrigger />}
|
|
209
|
+
className="w-full"
|
|
210
|
+
>
|
|
211
|
+
<IconSettings stroke={1.75} />
|
|
212
|
+
Settings
|
|
213
|
+
</DropdownMenuItem>
|
|
214
|
+
</DropdownMenuGroup>
|
|
215
|
+
</DropdownMenuContent>
|
|
216
|
+
</DropdownMenu>
|
|
217
|
+
</WorkspaceSettingsDialog>
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
|
|
213
221
|
export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenProps) {
|
|
214
|
-
const { layout, setLayout,
|
|
222
|
+
const { layout, setLayout, workspaceId } = useWorkspaceLayoutCtx()
|
|
215
223
|
const theme = resolveWorkspaceTheme(layout.theme)
|
|
216
224
|
const builderActions = useViewBuilderActions()
|
|
217
225
|
const {
|
|
@@ -240,7 +248,8 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
240
248
|
const openTabIds = effectiveOpenTabs(normalizeTabsState(layout.tabs), views, builders)
|
|
241
249
|
const nonAgentOpenTabs = openTabIds.filter(tab => tab !== 'agent')
|
|
242
250
|
const hasWorkspaceContent = nonAgentOpenTabs.length > 0
|
|
243
|
-
const
|
|
251
|
+
const hasAppletWidgets = widgets.some(widget => !isDefaultWidget(widget.id))
|
|
252
|
+
const hasWorkspaceApplets = hasAppletWidgets || views.length > 0
|
|
244
253
|
|
|
245
254
|
// Effective layout mode. Split is only visible with workspace content and
|
|
246
255
|
// enough row width; the saved mode remains the user's intent.
|
|
@@ -250,7 +259,15 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
250
259
|
|
|
251
260
|
// The tab address: URL in, active tab + applet params out, plus the persisted
|
|
252
261
|
// tab state it keeps in sync. See useWorkspaceNavigation for the invariants.
|
|
253
|
-
const {
|
|
262
|
+
const {
|
|
263
|
+
tabsState,
|
|
264
|
+
activeTab,
|
|
265
|
+
appletParams,
|
|
266
|
+
navigateToTab,
|
|
267
|
+
setTabs,
|
|
268
|
+
isUnavailable,
|
|
269
|
+
onNavigationClick
|
|
270
|
+
} = useWorkspaceNavigation({
|
|
254
271
|
views,
|
|
255
272
|
builders,
|
|
256
273
|
split: dockedSplit
|
|
@@ -266,6 +283,8 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
266
283
|
sessionId,
|
|
267
284
|
processing,
|
|
268
285
|
error,
|
|
286
|
+
loadError,
|
|
287
|
+
retryLoad,
|
|
269
288
|
send,
|
|
270
289
|
stop,
|
|
271
290
|
selectSession,
|
|
@@ -275,7 +294,9 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
275
294
|
workspaceId,
|
|
276
295
|
{
|
|
277
296
|
chatError: error,
|
|
278
|
-
onDismissChatError: dismissError
|
|
297
|
+
onDismissChatError: dismissError,
|
|
298
|
+
chatLoadError: loadError,
|
|
299
|
+
onRetryChatLoad: retryLoad
|
|
279
300
|
}
|
|
280
301
|
)
|
|
281
302
|
|
|
@@ -316,8 +337,14 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
316
337
|
const activeDraftBuilderId = activeDraftBuilder?.id
|
|
317
338
|
const canAnnotate =
|
|
318
339
|
widgetMode === 'idle' &&
|
|
319
|
-
((activeTab === '
|
|
320
|
-
const
|
|
340
|
+
((activeTab === 'overview' && hasAppletWidgets) || activeView !== undefined)
|
|
341
|
+
const {
|
|
342
|
+
controls: annotationControls,
|
|
343
|
+
docked: dockedAnnotation,
|
|
344
|
+
layerProps: annotationLayerProps,
|
|
345
|
+
popup: popupAnnotation,
|
|
346
|
+
targetRef: annotationTargetRef
|
|
347
|
+
} = useChatAnnotation({
|
|
321
348
|
workspaceId,
|
|
322
349
|
sessionId,
|
|
323
350
|
activeTab,
|
|
@@ -350,7 +377,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
350
377
|
|
|
351
378
|
// The URL follows a replaced builder tab to the view that took its place.
|
|
352
379
|
const urlReplacement = replacements.get(activeTab)
|
|
353
|
-
if (urlReplacement) navigateToTab(urlReplacement)
|
|
380
|
+
if (urlReplacement) navigateToTab(urlReplacement, { replace: true })
|
|
354
381
|
|
|
355
382
|
const replacementViews = new Set(replacements.values())
|
|
356
383
|
const sourceForView = new Map(
|
|
@@ -371,7 +398,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
371
398
|
}
|
|
372
399
|
if (!changed) return
|
|
373
400
|
const active = replacements.get(tabsState.active) ?? tabsState.active
|
|
374
|
-
setLayout({ tabs: { open: open.length > 0 ? open : ['
|
|
401
|
+
setLayout({ tabs: { open: open.length > 0 ? open : ['overview'], active } })
|
|
375
402
|
}, [activeTab, builders, navigateToTab, setLayout, tabsState, views])
|
|
376
403
|
|
|
377
404
|
useEffect(() => {
|
|
@@ -388,52 +415,55 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
388
415
|
|
|
389
416
|
// Tab switching is navigation; the saved default and the open set follow via
|
|
390
417
|
// the navigation hook. Only the chat side effects belong to the screen.
|
|
391
|
-
const openTab = (tab: WorkspaceTabId
|
|
392
|
-
navigateToTab(tab
|
|
418
|
+
const openTab = (tab: WorkspaceTabId) => {
|
|
419
|
+
navigateToTab(tab)
|
|
393
420
|
if (tab === 'agent') {
|
|
394
421
|
setFloatingChatOpen(false)
|
|
395
422
|
setChatFocusRequest(request => request + 1)
|
|
396
423
|
}
|
|
397
424
|
}
|
|
398
425
|
|
|
426
|
+
const createView = () => {
|
|
427
|
+
// Do NOT select the draft's pre-minted sessionId here: no session exists
|
|
428
|
+
// behind it until submit. Submit selects it once the chat actually starts.
|
|
429
|
+
void builderActions.create().then(builder => openTab(viewBuilderTabId(builder.id)))
|
|
430
|
+
}
|
|
431
|
+
|
|
399
432
|
const navigateFromWelcome = (destination: WelcomeDestination) => {
|
|
400
433
|
if (destination === 'views') {
|
|
401
434
|
const firstView = views[0]
|
|
402
435
|
if (firstView) openTab(viewTabId(firstView.id))
|
|
403
|
-
else
|
|
436
|
+
else createView()
|
|
404
437
|
} else {
|
|
405
438
|
openTab(destination)
|
|
406
439
|
}
|
|
407
440
|
setFloatingChatOpen(false)
|
|
408
441
|
}
|
|
409
442
|
|
|
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
443
|
useWorkspaceEvent(event => {
|
|
419
|
-
if (
|
|
420
|
-
|
|
444
|
+
if (
|
|
445
|
+
event.type === 'view:deleted' &&
|
|
446
|
+
event.workspaceId === workspaceId &&
|
|
447
|
+
activeTab === viewTabId(event.name)
|
|
448
|
+
) {
|
|
449
|
+
openTab('overview')
|
|
421
450
|
}
|
|
422
451
|
})
|
|
423
452
|
|
|
424
453
|
const closeTab = (tab: WorkspaceTabId) => {
|
|
454
|
+
if (tab === 'overview') return
|
|
425
455
|
const builderId = viewBuilderIdFromTab(tab)
|
|
426
456
|
const builder = builderId ? builders.find(candidate => candidate.id === builderId) : undefined
|
|
427
457
|
if ((!canCloseTabs && !builder) || !openSet.has(tab)) return
|
|
428
458
|
let open = tabsState.open.filter(t => t !== tab)
|
|
429
|
-
if (open.length === 0) open = ['
|
|
459
|
+
if (open.length === 0) open = ['overview']
|
|
430
460
|
// The neighbor that takes over when the tab on screen closes.
|
|
431
461
|
const visibleIndex = visibleTabIds.indexOf(tab)
|
|
432
462
|
const nextTab =
|
|
433
463
|
visibleTabIds[visibleIndex + 1] ??
|
|
434
464
|
visibleTabIds[visibleIndex - 1] ??
|
|
435
465
|
open.find(t => tabAvailable(t, views, builders)) ??
|
|
436
|
-
'
|
|
466
|
+
'overview'
|
|
437
467
|
const active =
|
|
438
468
|
tabsState.active === tab || !open.includes(tabsState.active) ? nextTab : tabsState.active
|
|
439
469
|
// Persist the open set BEFORE navigating so the sync effect (which reads
|
|
@@ -451,7 +481,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
451
481
|
const tab = viewBuilderTabId(builder.id)
|
|
452
482
|
if (openSet.has(tab)) {
|
|
453
483
|
let open = tabsState.open.filter(item => item !== tab)
|
|
454
|
-
if (open.length === 0) open = ['
|
|
484
|
+
if (open.length === 0) open = ['overview']
|
|
455
485
|
setTabs({ open, active: tabsState.active === tab ? open[0] : tabsState.active })
|
|
456
486
|
if (activeTab === tab) navigateToTab(open[0])
|
|
457
487
|
}
|
|
@@ -483,7 +513,8 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
483
513
|
// Chat messages fired from applet UI. `openChat` is the reveal: on a view tab
|
|
484
514
|
// in full-screen mode the chat is a closed popover, and a run the user can't
|
|
485
515
|
// see is worse than a panel that opens itself.
|
|
486
|
-
useAppletChatMessage({ send, revealChat: openChat, agentAvailability })
|
|
516
|
+
useAppletChatMessage({ sessionId, send, revealChat: openChat, agentAvailability })
|
|
517
|
+
useAppletChatAttachment(sessionId, openChat)
|
|
487
518
|
|
|
488
519
|
const createItems: CreateWorkspaceTabItem[] = [
|
|
489
520
|
...(!dockedSplit && !openSet.has('agent')
|
|
@@ -496,16 +527,6 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
496
527
|
}
|
|
497
528
|
] satisfies CreateWorkspaceTabItem[])
|
|
498
529
|
: []),
|
|
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
530
|
...(!openSet.has('scratchpad')
|
|
510
531
|
? ([
|
|
511
532
|
{
|
|
@@ -522,8 +543,8 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
522
543
|
.map(
|
|
523
544
|
({ view, tab }): CreateWorkspaceTabItem => ({
|
|
524
545
|
key: tab,
|
|
525
|
-
Icon:
|
|
526
|
-
label:
|
|
546
|
+
Icon: getViewIcon(view, builders),
|
|
547
|
+
label: getViewLabel(view),
|
|
527
548
|
onClick: () => openTab(tab)
|
|
528
549
|
})
|
|
529
550
|
),
|
|
@@ -543,32 +564,41 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
543
564
|
key: 'create-view',
|
|
544
565
|
Icon: IconBrowserPlus,
|
|
545
566
|
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
|
-
}
|
|
567
|
+
onClick: createView
|
|
553
568
|
}
|
|
554
569
|
]
|
|
555
570
|
|
|
571
|
+
const changeBuilderDraft = useCallback(
|
|
572
|
+
(value: string) => {
|
|
573
|
+
if (activeDraftBuilder) builderDrafts.change(activeDraftBuilder.id, value)
|
|
574
|
+
},
|
|
575
|
+
[activeDraftBuilder, builderDrafts]
|
|
576
|
+
)
|
|
577
|
+
const removeBuilderDrawing = useCallback(() => {
|
|
578
|
+
if (activeDraftBuilder) {
|
|
579
|
+
void builderRefs.current.get(activeDraftBuilder.id)?.resetSketch()
|
|
580
|
+
}
|
|
581
|
+
}, [activeDraftBuilder])
|
|
582
|
+
const submitBuilderDraft = useCallback(
|
|
583
|
+
async (value: string) => {
|
|
584
|
+
if (!activeDraftBuilder) return
|
|
585
|
+
const builderView = builderRefs.current.get(activeDraftBuilder.id)
|
|
586
|
+
await builderView?.prepareSketchForSend()
|
|
587
|
+
await builderActions.submit(activeDraftBuilder, value)
|
|
588
|
+
// Submit clears the sent attachment. Keep the canvas until the built view replaces it.
|
|
589
|
+
builderDrafts.clear(activeDraftBuilder.id)
|
|
590
|
+
},
|
|
591
|
+
[activeDraftBuilder, builderActions, builderDrafts]
|
|
592
|
+
)
|
|
593
|
+
|
|
556
594
|
const builderChatDraft = activeDraftBuilder
|
|
557
595
|
? {
|
|
558
596
|
sessionId: activeDraftBuilder.sessionId,
|
|
559
597
|
builderId: activeDraftBuilder.id,
|
|
560
598
|
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
|
-
}
|
|
599
|
+
onChange: changeBuilderDraft,
|
|
600
|
+
onRemoveDrawing: removeBuilderDrawing,
|
|
601
|
+
onSubmit: submitBuilderDraft
|
|
572
602
|
}
|
|
573
603
|
: undefined
|
|
574
604
|
|
|
@@ -584,13 +614,13 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
584
614
|
previewTurn={previewTurn}
|
|
585
615
|
sessionId={sessionId}
|
|
586
616
|
processing={processing}
|
|
587
|
-
composerBanner={
|
|
617
|
+
composerBanner={activeDraftBuilder ? builderComposerBanner : composerBanner}
|
|
588
618
|
agentAvailability={agentAvailability}
|
|
589
619
|
send={send}
|
|
590
620
|
stop={stop}
|
|
591
621
|
onNavigateFromWelcome={navigateFromWelcome}
|
|
592
622
|
onClose={() => setMode('fullscreen')}
|
|
593
|
-
annotation={
|
|
623
|
+
annotation={dockedAnnotation}
|
|
594
624
|
builderDraft={builderChatDraft}
|
|
595
625
|
docked
|
|
596
626
|
/>
|
|
@@ -623,18 +653,28 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
623
653
|
>
|
|
624
654
|
<div className="relative flex min-h-0 flex-1">
|
|
625
655
|
<div
|
|
626
|
-
ref={
|
|
627
|
-
inert={
|
|
628
|
-
aria-hidden={
|
|
656
|
+
ref={annotationTargetRef}
|
|
657
|
+
inert={annotationControls.active || undefined}
|
|
658
|
+
aria-hidden={annotationControls.active || undefined}
|
|
629
659
|
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
660
|
>
|
|
631
|
-
{
|
|
661
|
+
{isUnavailable ? (
|
|
662
|
+
<UnavailablePage onOpenOverview={() => openTab('overview')} />
|
|
663
|
+
) : activeTab === 'agent' ? (
|
|
632
664
|
tabbedChat
|
|
633
|
-
) : activeTab === '
|
|
634
|
-
<
|
|
635
|
-
|
|
636
|
-
|
|
665
|
+
) : activeTab === 'overview' ? (
|
|
666
|
+
<Overview
|
|
667
|
+
customizing={widgetMode === 'customizing'}
|
|
668
|
+
theming={widgetMode === 'theming'}
|
|
669
|
+
onThemingChange={theming => setWidgetMode(theming ? 'theming' : 'idle')}
|
|
670
|
+
onCustomizingChange={customizing =>
|
|
671
|
+
setWidgetMode(customizing ? 'customizing' : 'idle')
|
|
672
|
+
}
|
|
637
673
|
widgets={widgets}
|
|
674
|
+
views={views}
|
|
675
|
+
builders={builders}
|
|
676
|
+
onOpenView={viewId => openTab(viewTabId(viewId))}
|
|
677
|
+
onCreateView={createView}
|
|
638
678
|
onCreateWidget={() => {
|
|
639
679
|
selectSession(null)
|
|
640
680
|
openChat('Create widget')
|
|
@@ -655,7 +695,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
655
695
|
if (handle) builderRefs.current.set(builder.id, handle)
|
|
656
696
|
else builderRefs.current.delete(builder.id)
|
|
657
697
|
}}
|
|
658
|
-
active={activeBuilder?.id === builder.id}
|
|
698
|
+
active={!isUnavailable && activeBuilder?.id === builder.id}
|
|
659
699
|
builder={builder}
|
|
660
700
|
chatDocked={mode === 'split'}
|
|
661
701
|
workspaceId={workspaceId}
|
|
@@ -675,33 +715,30 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
675
715
|
mounted across tab switches (and collapses to nothing while
|
|
676
716
|
another tab is on screen), which is what makes a switch back
|
|
677
717
|
instant. */}
|
|
678
|
-
<ViewManager
|
|
718
|
+
<ViewManager
|
|
719
|
+
views={views}
|
|
720
|
+
activeViewId={isUnavailable ? null : (activeView?.id ?? null)}
|
|
721
|
+
params={appletParams}
|
|
722
|
+
/>
|
|
679
723
|
</div>
|
|
680
724
|
|
|
681
|
-
<DrawingLayer {...
|
|
725
|
+
<DrawingLayer {...annotationLayerProps}>
|
|
682
726
|
<DrawingToolbar
|
|
683
|
-
controls={
|
|
727
|
+
controls={annotationControls}
|
|
684
728
|
title="Draw annotation"
|
|
685
|
-
busy={
|
|
686
|
-
onComplete={() => void
|
|
729
|
+
busy={annotationControls.finishing}
|
|
730
|
+
onComplete={() => void annotationControls.finish()}
|
|
687
731
|
/>
|
|
688
732
|
</DrawingLayer>
|
|
689
733
|
</div>
|
|
690
734
|
|
|
691
735
|
<AnimatePresence>
|
|
692
|
-
{widgetMode === '
|
|
736
|
+
{widgetMode === 'theming' && <ThemePanel onClose={() => setWidgetMode('idle')} />}
|
|
693
737
|
</AnimatePresence>
|
|
694
738
|
|
|
695
739
|
<PanelHeader>
|
|
696
740
|
<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>
|
|
741
|
+
<WorkspaceMenu onOpenTheme={() => setWidgetMode('theming')} />
|
|
705
742
|
<WorkspaceTabs
|
|
706
743
|
tabs={tabItems}
|
|
707
744
|
active={activeTab}
|
|
@@ -711,22 +748,33 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
711
748
|
onReorder={reorderTabs}
|
|
712
749
|
/>
|
|
713
750
|
</div>
|
|
714
|
-
|
|
715
|
-
<
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
751
|
+
{hasWorkspaceContent && canUseSplit && mode === 'fullscreen' && (
|
|
752
|
+
<Tooltip>
|
|
753
|
+
<TooltipTrigger
|
|
754
|
+
render={
|
|
755
|
+
<Button
|
|
756
|
+
variant="ghost"
|
|
757
|
+
size="icon-sm"
|
|
758
|
+
onClick={() => setMode('split')}
|
|
759
|
+
aria-label="Dock agent"
|
|
760
|
+
className="text-muted-foreground"
|
|
761
|
+
>
|
|
762
|
+
<IconLayoutSidebarRight stroke={1.75} />
|
|
763
|
+
</Button>
|
|
764
|
+
}
|
|
765
|
+
/>
|
|
766
|
+
<TooltipContent>Dock agent</TooltipContent>
|
|
767
|
+
</Tooltip>
|
|
768
|
+
)}
|
|
724
769
|
</PanelHeader>
|
|
725
770
|
</div>
|
|
726
771
|
)
|
|
727
772
|
|
|
728
773
|
return (
|
|
729
|
-
<div
|
|
774
|
+
<div
|
|
775
|
+
onClick={onNavigationClick}
|
|
776
|
+
className="relative flex h-full min-h-0 flex-col font-sans text-foreground"
|
|
777
|
+
>
|
|
730
778
|
<div ref={rowRef} className="flex min-h-0 flex-1">
|
|
731
779
|
{hasWorkspaceContent && canUseSplit && splitLayoutConstraints ? (
|
|
732
780
|
<WorkspaceSplitLayout
|
|
@@ -766,13 +814,13 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
766
814
|
previewTurn={previewTurn}
|
|
767
815
|
sessionId={sessionId}
|
|
768
816
|
processing={processing}
|
|
769
|
-
composerBanner={
|
|
817
|
+
composerBanner={activeDraftBuilder ? builderComposerBanner : composerBanner}
|
|
770
818
|
agentAvailability={agentAvailability}
|
|
771
819
|
send={send}
|
|
772
820
|
stop={stop}
|
|
773
821
|
onNavigateFromWelcome={navigateFromWelcome}
|
|
774
822
|
onClose={onClose}
|
|
775
|
-
annotation={
|
|
823
|
+
annotation={popupAnnotation}
|
|
776
824
|
builderDraft={builderChatDraft}
|
|
777
825
|
/>
|
|
778
826
|
)}
|
|
@@ -31,7 +31,7 @@ export function WorkspaceSplitLayout({
|
|
|
31
31
|
const transitionFrameRef = useRef<number | null>(null)
|
|
32
32
|
const [transitionsEnabled, setTransitionsEnabled] = useState(false)
|
|
33
33
|
const openChatWidth = Math.min(Math.max(chatWidth, chatMinWidth), chatMaxWidth)
|
|
34
|
-
const defaultChatSize =
|
|
34
|
+
const [defaultChatSize] = useState(() => (open ? openChatWidth : 0))
|
|
35
35
|
|
|
36
36
|
useLayoutEffect(() => {
|
|
37
37
|
const chatPanel = chatPanelRef.current
|
|
@@ -75,7 +75,12 @@ export function WorkspaceSplitLayout({
|
|
|
75
75
|
{workspace}
|
|
76
76
|
</div>
|
|
77
77
|
</ResizablePanel>
|
|
78
|
-
<ResizableHandle
|
|
78
|
+
<ResizableHandle
|
|
79
|
+
aria-label="Resize chat"
|
|
80
|
+
showDivider={false}
|
|
81
|
+
hidden={!open}
|
|
82
|
+
disabled={!open}
|
|
83
|
+
/>
|
|
79
84
|
<ResizablePanel
|
|
80
85
|
id="chat"
|
|
81
86
|
aria-hidden={!open}
|