moi-computer 0.12.0 → 0.12.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -27
- package/bin/moi.mjs +2 -2
- package/client/AGENTS.md +7 -4
- package/client/api/app-config.ts +3 -2
- package/client/api/app-ui-keys.ts +1 -1
- package/client/api/workspace-keys.ts +2 -4
- package/client/app/{AppRouter.tsx → app-router.tsx} +4 -4
- package/client/app/routes/{HomeRoute.tsx → home-route.tsx} +2 -2
- package/client/app/routes/{WorkspaceRoute.tsx → workspace-route.tsx} +20 -31
- package/client/app/shell/{SidebarLayout.tsx → sidebar-layout.tsx} +10 -10
- package/client/dev/index.html +43 -0
- package/client/dev/index.ts +15 -0
- package/client/features/applets/{AppletContainer.tsx → applet-container.tsx} +1 -1
- package/client/features/applets/applet-runtime.ts +11 -13
- package/client/features/applets/applet-thumbnail.ts +1 -1
- package/client/features/applets/{useApplet.ts → use-applet.ts} +2 -2
- package/client/features/applets/{WidgetShell.tsx → widget-shell.tsx} +4 -4
- package/client/features/chat/applet-chat-intents.ts +33 -14
- package/client/features/chat/{ChatPanel.tsx → chat-panel.tsx} +80 -59
- package/client/features/chat/chat-popup.tsx +171 -0
- package/client/features/chat/chat-send.ts +33 -1
- package/client/features/chat/chat-store.ts +10 -0
- package/client/features/chat/composer/attachments/{DrawingAttachmentChip.tsx → drawing-attachment-chip.tsx} +1 -1
- package/client/features/chat/composer/attachments/{FileAttachmentChip.tsx → file-attachment-chip.tsx} +1 -1
- package/client/features/chat/composer/attachments/{TextAttachmentChip.tsx → text-attachment-chip.tsx} +1 -1
- package/client/features/chat/composer/banners/{ComposerBanner.tsx → composer-banner.tsx} +0 -14
- package/client/features/chat/composer/banners/{ErrorBanner.tsx → error-banner.tsx} +1 -1
- package/client/features/chat/composer/banners/{SkillUpdateBanner.tsx → skill-update-banner.tsx} +3 -3
- package/client/features/chat/composer/{ChatComposer.tsx → chat-composer.tsx} +31 -33
- package/client/features/chat/composer/{ModelPicker.tsx → model-picker.tsx} +4 -4
- package/client/features/chat/composer/{useWorkspaceComposerState.tsx → use-workspace-composer-state.tsx} +14 -30
- package/client/features/chat/composer/{useWorkspaceSkillUpdates.ts → use-workspace-skill-updates.ts} +1 -1
- package/client/features/chat/connection/chat-frames.ts +15 -8
- package/client/features/chat/messages/{ChatEmptyState.tsx → chat-empty-state.tsx} +37 -23
- package/client/features/chat/messages/fork-history.ts +14 -0
- package/client/features/chat/messages/{MarkdownContent.tsx → markdown-content.tsx} +4 -4
- package/client/features/chat/messages/tool-group/index.ts +1 -1
- package/client/features/chat/messages/tool-group/{ReadImagePreview.tsx → read-image-preview.tsx} +2 -2
- package/client/features/chat/messages/tool-group/{SubagentCard.tsx → subagent-card.tsx} +3 -3
- package/client/features/chat/messages/tool-group/{TimelineRow.tsx → timeline-row.tsx} +1 -1
- package/client/features/chat/messages/tool-group/{ToolCallGroup.tsx → tool-call-group.tsx} +8 -8
- package/client/features/chat/messages/tool-group/{ToolOutput.tsx → tool-output.tsx} +1 -1
- package/client/features/chat/messages/{TurnView.tsx → turn-view.tsx} +4 -4
- package/client/features/chat/sessions/api.ts +109 -19
- package/client/features/chat/sessions/browser-tab-state.ts +30 -7
- package/client/features/chat/sessions/{ChatSelector.tsx → chat-selector.tsx} +139 -80
- package/client/features/chat/sessions/use-selected-session.ts +351 -0
- package/client/features/chat/{useChat.ts → use-chat.ts} +46 -48
- package/client/features/collab/client.ts +10 -11
- package/client/features/collab/hooks.tsx +6 -11
- package/client/features/collab/host-state.ts +57 -128
- package/client/features/collab/provider.tsx +3 -3
- package/client/features/collab/proxy-user.ts +1 -1
- package/client/features/collab/testing/fake-engine.ts +6 -27
- package/client/features/collab/workspace-users-menu.tsx +3 -7
- package/client/features/connectors/mcp-icons.ts +1 -1
- package/client/features/connectors/{McpServerCards.tsx → mcp-server-cards.tsx} +1 -1
- package/client/features/{home/workspace-setup/DemoDialog.tsx → demo/demo-dialog.tsx} +6 -6
- package/client/features/dev/chat-states-fixtures.ts +4 -4
- package/client/features/dev/{ChatStatesPage.tsx → chat-states-page.tsx} +6 -6
- package/client/features/dev/collab/local-user-settings.tsx +4 -4
- package/client/features/dev/{DevIndexPage.tsx → dev-index-page.tsx} +7 -1
- package/client/features/dev/{DevRoutes.tsx → dev-routes.tsx} +8 -6
- package/client/features/dev/workspace-setup-mocks.ts +102 -0
- package/client/features/dev/workspace-setup-page.tsx +11 -0
- package/client/features/dev/workspace-setup-preview.tsx +226 -0
- package/client/features/drawings/{DrawingToolbar.tsx → drawing-toolbar.tsx} +1 -1
- package/client/features/drawings/{useChatAnnotation.ts → use-chat-annotation.ts} +29 -23
- package/client/features/drawings/{useDrawingLayer.ts → use-drawing-layer.ts} +1 -1
- package/client/features/drawings/{useViewBuilderSketch.ts → use-view-sketch.ts} +8 -8
- package/client/features/harness/api.ts +36 -0
- package/client/features/harness/device-login-steps.tsx +97 -0
- package/client/features/home/api.ts +1 -81
- package/client/features/home/{HomeLogo.tsx → home-logo.tsx} +1 -1
- package/client/features/home/{HomePage.tsx → home-page.tsx} +16 -20
- package/client/features/overview/api.ts +2 -2
- package/client/features/overview/default/registry.tsx +3 -5
- package/client/features/overview/default/{ViewsWidget.tsx → views-widget.tsx} +6 -13
- package/client/features/overview/{HiddenPanel.tsx → hidden-panel.tsx} +2 -2
- package/client/features/overview/{Overview.tsx → overview.tsx} +9 -12
- package/client/features/overview/{WidgetCanvas.tsx → widget-canvas.tsx} +1 -1
- package/client/features/overview/{WidgetFrame.tsx → widget-frame.tsx} +1 -1
- package/client/features/overview/workspace-name.tsx +55 -0
- package/client/features/scratchpad/{Scratchpad.tsx → scratchpad.tsx} +7 -7
- package/client/features/scratchpad/{useScratchpadSnapshot.tsx → use-scratchpad-snapshot.tsx} +3 -3
- package/client/features/settings/api.ts +1 -1
- package/client/features/settings/{ConnectorsSettings.tsx → connectors-settings.tsx} +3 -3
- package/client/features/settings/{EnvironmentSettings.tsx → environment-settings.tsx} +3 -3
- package/client/features/settings/{GeneralSettings.tsx → general-settings.tsx} +5 -5
- package/client/features/settings/{useEnvVars.ts → use-env-vars.ts} +1 -1
- package/client/features/settings/{WorkspaceIconPicker.tsx → workspace-icon-picker.tsx} +1 -1
- package/client/features/settings/{WorkspaceSettingsDialog.tsx → workspace-settings-dialog.tsx} +3 -3
- package/client/features/update/api.ts +1 -1
- package/client/features/views/api.ts +64 -131
- package/client/features/views/pending-view-screen.tsx +282 -0
- package/client/features/views/use-view-actions.ts +151 -0
- package/client/features/views/use-view-drafts.ts +88 -0
- package/client/features/views/{ViewManager.tsx → view-manager.tsx} +13 -13
- package/client/features/views/view-presentation.ts +4 -5
- package/client/features/views/view-submission.ts +88 -0
- package/client/features/workspace/add/api.ts +80 -0
- package/client/features/{home/workspace-setup/CreateWorkspaceDialog.tsx → workspace/add/create-workspace-dialog.tsx} +56 -42
- package/client/features/workspace/add/import-workspace-dialog.tsx +81 -0
- package/client/features/{home/workspace-setup/useWorkspaceImport.ts → workspace/add/use-workspace-import.ts} +1 -1
- package/client/features/workspace/add/workspace-agent-options.ts +53 -0
- package/client/features/{home/workspace-setup/WorkspaceAgentStep.tsx → workspace/add/workspace-agent-selector.tsx} +59 -98
- package/client/features/{home/workspace-setup/WorkspaceDialogContent.tsx → workspace/add/workspace-dialog-content.tsx} +1 -1
- package/client/features/workspace/api.ts +24 -15
- package/client/features/workspace/browser-tab-state.ts +16 -9
- package/client/features/workspace/moi-context.ts +14 -16
- package/client/features/workspace/setup/workspace-login-state.tsx +175 -0
- package/client/features/workspace/setup/workspace-recovery-states.tsx +125 -0
- package/client/features/workspace/setup/workspace-setup-panel.tsx +18 -0
- package/client/features/workspace/setup/workspace-setup.tsx +77 -0
- package/client/features/workspace/setup/workspace-welcome-state.tsx +81 -0
- package/client/features/workspace/tab-resolution.ts +16 -29
- package/client/features/workspace/{ThemePanel.tsx → theme-panel.tsx} +3 -3
- package/client/features/workspace/use-workspace-navigation.ts +245 -0
- package/client/features/workspace/workspace-content.tsx +641 -0
- package/client/features/workspace/workspace-identity.tsx +40 -0
- package/client/features/workspace/workspace-menu.tsx +63 -0
- package/client/features/{home → workspace}/workspace-presentation.tsx +10 -3
- package/client/features/workspace/workspace-screen.tsx +28 -0
- package/client/features/workspace/{WorkspaceSplitLayout.tsx → workspace-split-layout.tsx} +1 -1
- package/client/features/workspace/{WorkspaceTabs.tsx → workspace-tabs.tsx} +2 -2
- package/client/index.css +2 -2
- package/client/index.html +1 -1
- package/client/index.tsx +5 -1
- package/client/lib/agent-availability.ts +0 -5
- package/client/main.tsx +1 -1
- package/client/runtime/{useWorkspaceEvents.ts → use-workspace-events.ts} +10 -18
- package/client/store/ui.ts +25 -29
- package/dist/chunk-08ndj2rg.js +2 -0
- package/dist/chunk-2x040tmg.js +68 -0
- package/dist/chunk-3smxq0ts.js +1 -0
- package/dist/chunk-68ch5hs8.js +2 -0
- package/dist/{chunk-z3byfve5.js → chunk-9vg3xa81.js} +2 -2
- package/dist/chunk-c2p00p9j.css +1 -0
- package/dist/chunk-cs833y9j.js +1 -0
- package/dist/{chunk-97eg9mjn.js → chunk-d7cbm65e.js} +1 -1
- package/dist/{chunk-efdyz6xp.js → chunk-hvh9f5h0.js} +1 -1
- package/dist/{chunk-vfpsc75k.js → chunk-jvyvwwv3.js} +1 -1
- package/dist/chunk-nwevqe86.js +10 -0
- package/dist/{chunk-3a48fyf7.js → chunk-q0gbdts4.js} +4 -4
- package/dist/chunk-rt30jbcm.js +1 -0
- package/dist/chunk-y5y3kj67.js +1 -0
- package/dist/index.html +2 -2
- package/lib/format.ts +1 -1
- package/lib/harness-instructions.ts +30 -0
- package/lib/ids.ts +3 -6
- package/lib/moi-context.ts +102 -75
- package/lib/navigation.ts +48 -87
- package/lib/scratchpad-skew.ts +3 -3
- package/lib/session-drafts.ts +10 -0
- package/lib/types.ts +92 -51
- package/lib/update.ts +1 -1
- package/lib/view-build-directives.ts +12 -0
- package/lib/workspace-layout.ts +1 -1
- package/lib/workspace-tabs.ts +12 -7
- package/package.json +7 -2
- package/server/AGENTS.md +10 -4
- package/server/README.md +102 -0
- package/server/agent-launcher.ts +27 -0
- package/server/api/harnesses.ts +56 -0
- package/server/{api.ts → api/index.ts} +197 -299
- package/server/app-config.ts +45 -14
- package/server/app-settings.ts +1 -1
- package/server/applets/applet-css.ts +1 -1
- package/server/applets/build-applet.ts +4 -4
- package/server/applets/build-worker.ts +3 -2
- package/server/applets/config.ts +1 -1
- package/server/{functions-worker.ts → applets/functions-worker.ts} +1 -1
- package/server/{functions.ts → applets/functions.ts} +3 -2
- package/server/applets/index.ts +2 -2
- package/server/{thumbnails.ts → applets/thumbnails.ts} +1 -1
- package/server/{applet-typecheck.ts → applets/typecheck.ts} +4 -4
- package/server/{ui-components.ts → applets/ui-components.ts} +2 -2
- package/server/applets/view-source.ts +7 -1
- package/server/{views.ts → applets/views.ts} +35 -46
- package/server/{widgets.ts → applets/widgets.ts} +2 -2
- package/server/cli/applet-selector.ts +19 -0
- package/server/cli/args.ts +5 -0
- package/server/{cli-colors.ts → cli/colors.ts} +1 -1
- package/server/cli/commands/bundle.ts +119 -0
- package/server/cli/commands/call-server-fn.ts +42 -0
- package/server/cli/commands/check.ts +53 -0
- package/server/cli/commands/config.ts +132 -0
- package/server/cli/commands/debug.ts +119 -0
- package/server/cli/commands/env.ts +162 -0
- package/server/cli/commands/hermes.ts +149 -0
- package/server/cli/commands/init.ts +286 -0
- package/server/cli/commands/navigate.ts +35 -0
- package/server/cli/commands/openclaw.ts +168 -0
- package/server/cli/commands/refresh.ts +39 -0
- package/server/cli/commands/scratch.ts +496 -0
- package/server/cli/commands/service.ts +298 -0
- package/server/cli/commands/skill.ts +122 -0
- package/server/cli/commands/start.ts +138 -0
- package/server/cli/commands/status.ts +80 -0
- package/server/cli/commands/tabs.ts +43 -0
- package/server/cli/commands/theme.ts +192 -0
- package/server/cli/commands/ui-components.ts +15 -0
- package/server/cli/commands/update.ts +192 -0
- package/server/cli/commands/version.ts +9 -0
- package/server/cli/commands/views.ts +87 -0
- package/server/cli/control.ts +89 -0
- package/server/{cli-env.ts → cli/env.ts} +78 -56
- package/server/cli/index.ts +171 -0
- package/server/{cli-pc.ts → cli/pc.ts} +1 -1
- package/server/cli/provider.ts +25 -0
- package/server/cli/server-version.ts +16 -0
- package/server/cli/server.ts +81 -0
- package/server/{cli-ui-components.ts → cli/ui-components.ts} +5 -5
- package/server/cli.ts +2 -3215
- package/server/collab/manager.ts +3 -3
- package/server/collab/skill/index.ts +2 -2
- package/server/control.ts +97 -78
- package/server/data-dir.ts +13 -0
- package/server/harness/README.md +55 -25
- package/server/harness/acp/NOTES.md +11 -11
- package/server/harness/acp/adapter.ts +2 -2
- package/server/harness/acp/archived.ts +3 -3
- package/server/harness/acp/client.ts +4 -3
- package/server/harness/acp/discovery.ts +3 -3
- package/server/harness/acp/run-durations.ts +1 -1
- package/server/harness/acp/session.ts +9 -12
- package/server/harness/auth.ts +303 -0
- package/server/harness/claude-code/NOTES.md +9 -7
- package/server/harness/claude-code/adapter.ts +13 -8
- package/server/harness/claude-code/auth.ts +127 -18
- package/server/harness/claude-code/cli.ts +3 -1
- package/server/harness/claude-code/git-worktree.ts +5 -2
- package/server/harness/claude-code/index.ts +7 -1
- package/server/harness/claude-code/mcp.ts +3 -1
- package/server/harness/claude-code/models.ts +2 -0
- package/server/harness/claude-code/session.ts +13 -39
- package/server/harness/claude-code/sessions.ts +8 -12
- package/server/harness/codex/NOTES.md +35 -16
- package/server/harness/codex/adapter.ts +5 -3
- package/server/harness/codex/auth.ts +86 -19
- package/server/harness/codex/client.ts +30 -34
- package/server/harness/codex/index.ts +20 -1
- package/server/harness/codex/permissions.ts +3 -3
- package/server/harness/codex/probe.ts +3 -5
- package/server/harness/codex/session.ts +20 -25
- package/server/harness/codex/thread-list.ts +74 -0
- package/server/harness/codex/transport.ts +5 -5
- package/server/harness/executable.ts +42 -18
- package/server/harness/fork.ts +12 -0
- package/server/harness/hermes/NOTES.md +70 -70
- package/server/harness/hermes/discovery.ts +1 -1
- package/server/harness/openclaw/NOTES.md +24 -24
- package/server/harness/openclaw/adapter.ts +4 -4
- package/server/harness/openclaw/compat.ts +1 -1
- package/server/harness/openclaw/session.ts +6 -31
- package/server/harness/registry.ts +1 -1
- package/server/harness/session-title.ts +12 -3
- package/server/harness/shell-path.ts +31 -21
- package/server/harness/types.ts +17 -5
- package/server/navigation-relay.ts +1 -1
- package/server/open-browser.ts +7 -0
- package/server/{scratchpad-assets.ts → scratchpad/assets.ts} +4 -4
- package/server/{scratchpad.ts → scratchpad/document.ts} +8 -8
- package/server/{scratchpad-executor.ts → scratchpad/executor.ts} +7 -7
- package/server/{scratchpad-relay.ts → scratchpad/relay.ts} +4 -5
- package/server/{scratchpad-shape-defaults.ts → scratchpad/shape-defaults.ts} +2 -2
- package/server/server-cwd.ts +1 -1
- package/server/service.ts +18 -4
- package/server/sessions/archive.ts +32 -0
- package/server/{attachment-message.ts → sessions/attachment-message.ts} +1 -1
- package/server/sessions/config.ts +41 -0
- package/server/sessions/lifecycle.ts +17 -0
- package/server/sessions/pending-views.ts +164 -0
- package/server/sessions/selected.ts +199 -0
- package/server/sessions/store.ts +127 -0
- package/server/sessions/view-sessions.ts +267 -0
- package/server/{skills-template.ts → skills/template.ts} +1 -1
- package/server/{skill-update.ts → skills/update.ts} +5 -5
- package/server/{skill-version.ts → skills/version.ts} +4 -4
- package/server/static.ts +1 -1
- package/server/status.ts +6 -4
- package/server/web.ts +58 -49
- package/server/{env-apply.ts → workspaces/env-apply.ts} +5 -5
- package/server/{workspace-env.ts → workspaces/env.ts} +30 -3
- package/server/{workspace-import.ts → workspaces/import.ts} +4 -4
- package/server/{workspace-init.ts → workspaces/init.ts} +10 -6
- package/server/{layout.ts → workspaces/layout.ts} +2 -2
- package/server/{preview.ts → workspaces/preview.ts} +1 -1
- package/server/{registry.ts → workspaces/registry.ts} +17 -7
- package/server/{required-env.ts → workspaces/required-env.ts} +3 -3
- package/server/{moi-scaffold.ts → workspaces/scaffold.ts} +4 -3
- package/server/{tabs.ts → workspaces/tabs.ts} +7 -10
- package/ui-components/button.tsx +1 -1
- package/ui-components/docs/attachment.md +2 -2
- package/ui-components/docs/button.md +1 -1
- package/ui-components/docs/calendar.md +1 -1
- package/ui-components/docs/chart.md +4 -4
- package/ui-components/docs/data-table.md +1 -1
- package/ui-components/docs/drawer.md +1 -1
- package/ui-components/docs/field.md +1 -1
- package/ui-components/docs/input.md +2 -2
- package/ui-components/docs/label.md +2 -2
- package/ui-components/docs/table.md +2 -2
- package/workspace/.claude/skills/moi-workspace/SKILL.md +61 -32
- package/workspace/.claude/skills/moi-workspace/references/COLLAB.md +4 -7
- package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +2 -2
- package/workspace/.claude/skills/moi-workspace/references/INTENTS.md +2 -2
- package/client/features/chat/ChatPopup.tsx +0 -98
- package/client/features/chat/composer/banners/AgentAvailabilityBanner.tsx +0 -101
- package/client/features/chat/sessions/useSelectedSession.ts +0 -185
- package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +0 -92
- package/client/features/overview/WorkspaceName.tsx +0 -60
- package/client/features/views/ViewBuilder.tsx +0 -239
- package/client/features/views/useViewBuilderActions.ts +0 -103
- package/client/features/views/useViewBuilderDrafts.ts +0 -68
- package/client/features/workspace/WorkspaceScreen.tsx +0 -839
- package/client/features/workspace/useWorkspaceNavigation.ts +0 -203
- package/dist/chunk-2jncyq65.js +0 -1
- package/dist/chunk-e2q5ken7.js +0 -68
- package/dist/chunk-h2kj1ysj.js +0 -1
- package/dist/chunk-jf6czgrz.js +0 -2
- package/dist/chunk-nez8sdta.js +0 -1
- package/dist/chunk-nzwgm8vc.css +0 -1
- package/dist/chunk-ph0h6h86.js +0 -1
- package/dist/chunk-ryg9z3kn.js +0 -10
- package/dist/chunk-tpn177bt.js +0 -2
- package/lib/view-builder-directives.ts +0 -16
- package/server/agent.ts +0 -223
- package/server/chat-selection.ts +0 -22
- package/server/selected-session.ts +0 -152
- package/server/session-config.ts +0 -136
- package/server/view-builders.ts +0 -453
- /package/client/components/shared/{AgentBlobatar.tsx → agent-blobatar.tsx} +0 -0
- /package/client/components/shared/{BottomPanel.tsx → bottom-panel.tsx} +0 -0
- /package/client/components/shared/{Composer.tsx → composer.tsx} +0 -0
- /package/client/components/shared/{LedLogo.tsx → led-logo.tsx} +0 -0
- /package/client/components/shared/{PanelHeader.tsx → panel-header.tsx} +0 -0
- /package/client/components/shared/{ReorderableList.tsx → reorderable-list.tsx} +0 -0
- /package/client/components/shared/{WorkspaceIcon.tsx → workspace-icon.tsx} +0 -0
- /package/client/features/applets/{WidgetErrorBoundary.tsx → widget-error-boundary.tsx} +0 -0
- /package/client/features/chat/composer/attachments/{AttachmentChip.tsx → attachment-chip.tsx} +0 -0
- /package/client/features/chat/messages/{ChatPromptBubbles.tsx → chat-prompt-bubbles.tsx} +0 -0
- /package/client/features/chat/messages/{ShimmerText.tsx → shimmer-text.tsx} +0 -0
- /package/client/features/chat/messages/tool-group/{CodeBlock.tsx → code-block.tsx} +0 -0
- /package/client/features/chat/messages/tool-group/{Collapse.tsx → collapse.tsx} +0 -0
- /package/client/features/chat/messages/{useStickToBottom.ts → use-stick-to-bottom.ts} +0 -0
- /package/client/features/connectors/{IconMcp.tsx → icon-mcp.tsx} +0 -0
- /package/client/features/dev/{BlobatarShapesPage.tsx → blobatar-shapes-page.tsx} +0 -0
- /package/client/features/dev/{HarnessDebugPage.tsx → harness-debug-page.tsx} +0 -0
- /package/client/features/dev/{TextureLabPage.tsx → texture-lab-page.tsx} +0 -0
- /package/client/features/dev/{ToolCallsPage.tsx → tool-calls-page.tsx} +0 -0
- /package/client/features/drawings/{DrawingLayer.tsx → drawing-layer.tsx} +0 -0
- /package/client/features/home/{WorkspacePreview.tsx → workspace-preview.tsx} +0 -0
- /package/client/features/overview/{useGridReconcile.ts → use-grid-reconcile.ts} +0 -0
- /package/client/features/scratchpad/{ScratchpadControls.tsx → scratchpad-controls.tsx} +0 -0
- /package/client/features/settings/{SettingsLayout.tsx → settings-layout.tsx} +0 -0
- /package/client/features/update/{UpdateControl.tsx → update-control.tsx} +0 -0
- /package/client/features/workspace/{UnavailablePage.tsx → unavailable-page.tsx} +0 -0
- /package/client/features/workspace/{useFitsSplitLayout.ts → use-fits-split-layout.ts} +0 -0
- /package/client/features/workspace/{WorkspaceContext.tsx → workspace-context.tsx} +0 -0
- /package/client/features/workspace/{WorkspaceLayoutContext.tsx → workspace-layout-context.tsx} +0 -0
- /package/server/{bundle-queue.ts → applets/bundle-queue.ts} +0 -0
- /package/server/{applet-log.ts → applets/log.ts} +0 -0
- /package/server/{cli-ui.ts → cli/ui.ts} +0 -0
- /package/server/{workspace-config.ts → workspaces/config.ts} +0 -0
- /package/server/{icon.ts → workspaces/icon.ts} +0 -0
- /package/server/{theme.ts → workspaces/theme.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Renders a mixed timeline of agent parts (reasoning + tool calls). Standalone —
|
|
2
|
-
// lifted from the chat transcript (client/components/
|
|
2
|
+
// lifted from the chat transcript (client/components/turn-view.tsx) so we can
|
|
3
3
|
// iterate on the design in isolation (see /playground/tool-calls). Takes
|
|
4
4
|
// `Part[]` directly and `cwd` as a prop, so it renders with no workspace
|
|
5
5
|
// provider mounted.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// Layout: each row is a two-column flex — a left timeline rail (one node per row
|
|
8
8
|
// linked by a 1px rule) and a collapsible header/body. The rail primitives live
|
|
9
9
|
// in ./TimelineRow; the subagent card in ./SubagentCard; the body animates open
|
|
10
|
-
// (./Collapse, height spring) and renders via ./
|
|
10
|
+
// (./Collapse, height spring) and renders via ./tool-output (syntax-highlighted
|
|
11
11
|
// code/json when detected, plain text otherwise). Formatting + detection live in
|
|
12
12
|
// ./format and ./detect.
|
|
13
13
|
import { type ReactNode, useState } from 'react'
|
|
@@ -15,13 +15,13 @@ import { type ReactNode, useState } from 'react'
|
|
|
15
15
|
import { IconLoader2, IconPackage } from '@tabler/icons-react'
|
|
16
16
|
|
|
17
17
|
import { cn } from '@/client/lib/cn'
|
|
18
|
-
import { PlainMarkdownText } from '@/client/features/chat/messages/
|
|
18
|
+
import { PlainMarkdownText } from '@/client/features/chat/messages/markdown-content'
|
|
19
19
|
import { formatMcpServerName, getMcpIcon } from '@/client/features/connectors/mcp-icons'
|
|
20
20
|
import type { Part, ToolCall } from '@/lib/types'
|
|
21
21
|
|
|
22
|
-
import { Collapse } from './
|
|
23
|
-
import { ReadImagePreview, readImageRelPath } from './
|
|
24
|
-
import { SubagentCard } from './
|
|
22
|
+
import { Collapse } from './collapse'
|
|
23
|
+
import { ReadImagePreview, readImageRelPath } from './read-image-preview'
|
|
24
|
+
import { SubagentCard } from './subagent-card'
|
|
25
25
|
import {
|
|
26
26
|
HEADER,
|
|
27
27
|
IconMarker,
|
|
@@ -29,8 +29,8 @@ import {
|
|
|
29
29
|
RowChevron,
|
|
30
30
|
type RowPosition,
|
|
31
31
|
TimelineRow
|
|
32
|
-
} from './
|
|
33
|
-
import { ToolOutput } from './
|
|
32
|
+
} from './timeline-row'
|
|
33
|
+
import { ToolOutput } from './tool-output'
|
|
34
34
|
import {
|
|
35
35
|
formatDuration,
|
|
36
36
|
formatInputBrief,
|
|
@@ -6,7 +6,7 @@ import { cn } from '@/client/lib/cn'
|
|
|
6
6
|
import type { ToolCall } from '@/lib/types'
|
|
7
7
|
|
|
8
8
|
import { Button } from '@/client/components/ui/button'
|
|
9
|
-
import { CodeBlock } from './
|
|
9
|
+
import { CodeBlock } from './code-block'
|
|
10
10
|
import { detectOutput } from './detect'
|
|
11
11
|
|
|
12
12
|
type ToolOutputProps = { call: ToolCall; output: string; isError: boolean }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TextAttachmentChip } from '../composer/attachments/
|
|
1
|
+
import { TextAttachmentChip } from '../composer/attachments/text-attachment-chip'
|
|
2
2
|
import { memo } from 'react'
|
|
3
3
|
|
|
4
4
|
import { IconChevronRight, IconFile } from '@tabler/icons-react'
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
CollapsibleContent,
|
|
11
11
|
CollapsibleTrigger
|
|
12
12
|
} from '@/client/components/ui/collapsible'
|
|
13
|
-
import { MarkdownContent } from '@/client/features/chat/messages/
|
|
14
|
-
import { ToolCallGroup } from '@/client/features/chat/messages/tool-group/
|
|
13
|
+
import { MarkdownContent } from '@/client/features/chat/messages/markdown-content'
|
|
14
|
+
import { ToolCallGroup } from '@/client/features/chat/messages/tool-group/tool-call-group'
|
|
15
15
|
import { formatDuration } from '@/client/features/chat/messages/tool-group/format'
|
|
16
|
-
import { useWorkspaceLayoutCtx } from '@/client/features/workspace/
|
|
16
|
+
import { useWorkspaceLayoutCtx } from '@/client/features/workspace/workspace-layout-context'
|
|
17
17
|
import { cn } from '@/client/lib/cn'
|
|
18
18
|
|
|
19
19
|
// A part either folds into a tool-group "run" (reasoning + tool calls — including
|
|
@@ -1,17 +1,79 @@
|
|
|
1
1
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
|
2
|
+
import type { QueryClient } from '@tanstack/react-query'
|
|
3
|
+
import { useCallback } from 'react'
|
|
2
4
|
|
|
3
5
|
import { jsonRequest, requestJson, requestVoid } from '@/client/api/http'
|
|
4
6
|
import { WORKSPACE_RESOURCE_OPTIONS } from '@/client/api/query-options'
|
|
5
7
|
import { workspaceKeys } from '@/client/api/workspace-keys'
|
|
6
8
|
import { sessionViewOptions } from '@/client/features/chat/sessions/session-view'
|
|
7
|
-
import
|
|
9
|
+
import { readSelectedSession, writeSelectedSession } from './browser-tab-state'
|
|
10
|
+
import {
|
|
11
|
+
selectedSessionKey,
|
|
12
|
+
selectedSessionOptions,
|
|
13
|
+
usePinnedSession,
|
|
14
|
+
useSelectedSession
|
|
15
|
+
} from './use-selected-session'
|
|
16
|
+
import { useCollabEnabled } from '@/client/features/collab'
|
|
17
|
+
import { useLatestRef } from '@/client/lib/use-latest-ref'
|
|
18
|
+
import { useWorkspaceId } from '@/client/features/workspace/workspace-context'
|
|
19
|
+
import type {
|
|
20
|
+
SessionConfig,
|
|
21
|
+
SessionInfo,
|
|
22
|
+
SessionRecord,
|
|
23
|
+
WorkspaceSessionSelection,
|
|
24
|
+
WorkspaceTabId
|
|
25
|
+
} from '@/lib/types'
|
|
8
26
|
|
|
9
|
-
export function
|
|
10
|
-
return
|
|
27
|
+
export function workspaceSessionsOptions(workspaceId: string) {
|
|
28
|
+
return {
|
|
11
29
|
queryKey: workspaceKeys.sessions(workspaceId),
|
|
12
|
-
queryFn: () => requestJson(`/api/workspaces/${workspaceId}/sessions`),
|
|
30
|
+
queryFn: () => requestJson<SessionInfo[]>(`/api/workspaces/${workspaceId}/sessions`),
|
|
13
31
|
...WORKSPACE_RESOURCE_OPTIONS
|
|
14
|
-
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function useWorkspaceSessions(workspaceId: string) {
|
|
36
|
+
return useQuery(workspaceSessionsOptions(workspaceId))
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Select the linked chat on the destination tab, unpinning a different chat first.
|
|
40
|
+
export function useSelectLinkedChat() {
|
|
41
|
+
const workspaceId = useWorkspaceId()
|
|
42
|
+
const queryClient = useQueryClient()
|
|
43
|
+
const collabEnabled = useCollabEnabled()
|
|
44
|
+
const [, , selectSessionForTab] = useSelectedSession()
|
|
45
|
+
const { pinAsync } = usePinnedSession()
|
|
46
|
+
const stateRef = useLatestRef({ collabEnabled, selectSessionForTab, pinAsync })
|
|
47
|
+
// Stable so selection updates do not restart a pending chat link.
|
|
48
|
+
return useCallback(
|
|
49
|
+
async (sessionId: string, tab: WorkspaceTabId, signal: AbortSignal): Promise<boolean> => {
|
|
50
|
+
const { collabEnabled, selectSessionForTab, pinAsync } = stateRef.current
|
|
51
|
+
signal.throwIfAborted()
|
|
52
|
+
let sessions =
|
|
53
|
+
queryClient.getQueryData<SessionInfo[]>(workspaceKeys.sessions(workspaceId)) ?? []
|
|
54
|
+
if (!sessions.some(session => session.sessionId === sessionId))
|
|
55
|
+
sessions = await queryClient.fetchQuery(workspaceSessionsOptions(workspaceId))
|
|
56
|
+
signal.throwIfAborted()
|
|
57
|
+
if (!sessions.some(session => session.sessionId === sessionId)) return false
|
|
58
|
+
await queryClient.ensureQueryData(selectedSessionOptions(workspaceId))
|
|
59
|
+
if (collabEnabled)
|
|
60
|
+
await queryClient.ensureQueryData(selectedSessionOptions(workspaceId, 'browser-tab'))
|
|
61
|
+
signal.throwIfAborted()
|
|
62
|
+
const pinned = queryClient.getQueryData<WorkspaceSessionSelection>(
|
|
63
|
+
selectedSessionKey(workspaceId)
|
|
64
|
+
)?.pinned
|
|
65
|
+
if (pinned && pinned !== sessionId) {
|
|
66
|
+
await pinAsync(null)
|
|
67
|
+
signal.throwIfAborted()
|
|
68
|
+
}
|
|
69
|
+
if (pinned !== sessionId) {
|
|
70
|
+
await selectSessionForTab(sessionId, tab)
|
|
71
|
+
signal.throwIfAborted()
|
|
72
|
+
}
|
|
73
|
+
return true
|
|
74
|
+
},
|
|
75
|
+
[queryClient, stateRef, workspaceId]
|
|
76
|
+
)
|
|
15
77
|
}
|
|
16
78
|
|
|
17
79
|
export function removeArchivedSession(
|
|
@@ -21,6 +83,41 @@ export function removeArchivedSession(
|
|
|
21
83
|
return sessions?.filter(session => session.sessionId !== sessionId)
|
|
22
84
|
}
|
|
23
85
|
|
|
86
|
+
export function applyArchivedSession(
|
|
87
|
+
queryClient: QueryClient,
|
|
88
|
+
workspaceId: string,
|
|
89
|
+
sessionId: string
|
|
90
|
+
) {
|
|
91
|
+
const sessionsKey = workspaceKeys.sessions(workspaceId)
|
|
92
|
+
void queryClient.cancelQueries({ queryKey: sessionsKey })
|
|
93
|
+
queryClient.setQueryData<SessionInfo[]>(sessionsKey, current =>
|
|
94
|
+
removeArchivedSession(current, sessionId)
|
|
95
|
+
)
|
|
96
|
+
queryClient.removeQueries({ queryKey: workspaceKeys.events(workspaceId, sessionId) })
|
|
97
|
+
queryClient.removeQueries({ queryKey: workspaceKeys.session(workspaceId, sessionId) })
|
|
98
|
+
for (const scope of ['shared', 'browser-tab'] as const) {
|
|
99
|
+
const key = selectedSessionKey(workspaceId, scope)
|
|
100
|
+
const current =
|
|
101
|
+
queryClient.getQueryData<WorkspaceSessionSelection>(key) ??
|
|
102
|
+
(scope === 'browser-tab' ? readSelectedSession(workspaceId) : undefined)
|
|
103
|
+
if (!current) continue
|
|
104
|
+
let changed = current.pinned === sessionId
|
|
105
|
+
const selected = Object.fromEntries(Object.entries(current.selected))
|
|
106
|
+
for (const [tabId, id] of Object.entries(selected)) {
|
|
107
|
+
if (id !== sessionId) continue
|
|
108
|
+
changed = true
|
|
109
|
+
// An explicit empty local choice prevents falling back to the server's chat.
|
|
110
|
+
if (scope === 'browser-tab') selected[tabId] = null
|
|
111
|
+
else delete selected[tabId]
|
|
112
|
+
}
|
|
113
|
+
if (!changed) continue
|
|
114
|
+
const next = { selected, pinned: current.pinned === sessionId ? null : current.pinned }
|
|
115
|
+
queryClient.setQueryData(key, next)
|
|
116
|
+
if (scope === 'browser-tab') writeSelectedSession(workspaceId, next)
|
|
117
|
+
}
|
|
118
|
+
void queryClient.invalidateQueries({ queryKey: selectedSessionKey(workspaceId), exact: true })
|
|
119
|
+
}
|
|
120
|
+
|
|
24
121
|
export function useArchiveWorkspaceSession(workspaceId: string) {
|
|
25
122
|
const queryClient = useQueryClient()
|
|
26
123
|
return useMutation<void, Error, string>({
|
|
@@ -31,11 +128,7 @@ export function useArchiveWorkspaceSession(workspaceId: string) {
|
|
|
31
128
|
'Couldn’t archive chat'
|
|
32
129
|
),
|
|
33
130
|
onSuccess: (_, sessionId) => {
|
|
34
|
-
queryClient
|
|
35
|
-
removeArchivedSession(current, sessionId)
|
|
36
|
-
)
|
|
37
|
-
queryClient.removeQueries({ queryKey: workspaceKeys.events(workspaceId, sessionId) })
|
|
38
|
-
queryClient.removeQueries({ queryKey: workspaceKeys.sessionConfig(workspaceId, sessionId) })
|
|
131
|
+
applyArchivedSession(queryClient, workspaceId, sessionId)
|
|
39
132
|
queryClient.invalidateQueries({ queryKey: workspaceKeys.preview(workspaceId) })
|
|
40
133
|
}
|
|
41
134
|
})
|
|
@@ -48,10 +141,10 @@ export function useSessionView(workspaceId: string, sessionId: string | null) {
|
|
|
48
141
|
})
|
|
49
142
|
}
|
|
50
143
|
|
|
51
|
-
export function
|
|
52
|
-
return useQuery<
|
|
53
|
-
queryKey: workspaceKeys.
|
|
54
|
-
queryFn: () => requestJson(`/api/workspaces/${workspaceId}/sessions/${sessionId}
|
|
144
|
+
export function useSession(workspaceId: string, sessionId: string | null) {
|
|
145
|
+
return useQuery<SessionRecord>({
|
|
146
|
+
queryKey: workspaceKeys.session(workspaceId, sessionId ?? ''),
|
|
147
|
+
queryFn: () => requestJson(`/api/workspaces/${workspaceId}/sessions/${sessionId}`),
|
|
55
148
|
enabled: Boolean(sessionId),
|
|
56
149
|
staleTime: Infinity,
|
|
57
150
|
gcTime: 5 * 60_000,
|
|
@@ -62,7 +155,7 @@ export function useSessionConfig(workspaceId: string, sessionId: string | null)
|
|
|
62
155
|
|
|
63
156
|
export function useSaveSessionConfig(workspaceId: string) {
|
|
64
157
|
const queryClient = useQueryClient()
|
|
65
|
-
return useMutation<
|
|
158
|
+
return useMutation<SessionRecord, Error, { sessionId: string; patch: SessionConfig }>({
|
|
66
159
|
mutationFn: ({ patch, sessionId }) =>
|
|
67
160
|
requestJson(
|
|
68
161
|
`/api/workspaces/${workspaceId}/sessions/${sessionId}/config`,
|
|
@@ -70,10 +163,7 @@ export function useSaveSessionConfig(workspaceId: string) {
|
|
|
70
163
|
'Failed to save chat settings'
|
|
71
164
|
),
|
|
72
165
|
onSuccess: (next, { sessionId }) => {
|
|
73
|
-
queryClient.setQueryData<
|
|
74
|
-
workspaceKeys.sessionConfig(workspaceId, sessionId),
|
|
75
|
-
next
|
|
76
|
-
)
|
|
166
|
+
queryClient.setQueryData<SessionRecord>(workspaceKeys.session(workspaceId, sessionId), next)
|
|
77
167
|
}
|
|
78
168
|
})
|
|
79
169
|
}
|
|
@@ -1,18 +1,41 @@
|
|
|
1
|
+
import type { WorkspaceSessionSelection } from '@/lib/types'
|
|
2
|
+
|
|
1
3
|
const keyFor = (workspaceId: string) => `moi:collab:${workspaceId}:session`
|
|
4
|
+
const emptySelection = (): WorkspaceSessionSelection => ({ selected: {}, pinned: null })
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
// Collab keeps each browser tab's unpinned chat choice, including a separate
|
|
7
|
+
// selection for every workspace tab. The workspace pin remains server-owned.
|
|
8
|
+
export function readSelectedSession(workspaceId: string): WorkspaceSessionSelection {
|
|
4
9
|
try {
|
|
5
|
-
|
|
10
|
+
const saved = sessionStorage.getItem(keyFor(workspaceId))
|
|
11
|
+
if (!saved) return emptySelection()
|
|
12
|
+
// The first Collab build stored only the overview chat ID.
|
|
13
|
+
if (!saved.startsWith('{')) return { selected: { overview: saved }, pinned: null }
|
|
14
|
+
const value: unknown = JSON.parse(saved)
|
|
15
|
+
if (!value || typeof value !== 'object' || !('selected' in value)) return emptySelection()
|
|
16
|
+
const selected = (value as { selected: unknown }).selected
|
|
17
|
+
if (!selected || typeof selected !== 'object' || Array.isArray(selected))
|
|
18
|
+
return emptySelection()
|
|
19
|
+
return {
|
|
20
|
+
selected: Object.fromEntries(
|
|
21
|
+
Object.entries(selected).filter(
|
|
22
|
+
([, sessionId]) => typeof sessionId === 'string' || sessionId === null
|
|
23
|
+
)
|
|
24
|
+
),
|
|
25
|
+
pinned: null
|
|
26
|
+
}
|
|
6
27
|
} catch {
|
|
7
|
-
return
|
|
28
|
+
return emptySelection()
|
|
8
29
|
}
|
|
9
30
|
}
|
|
10
31
|
|
|
11
|
-
export function writeSelectedSession(
|
|
32
|
+
export function writeSelectedSession(
|
|
33
|
+
workspaceId: string,
|
|
34
|
+
selection: WorkspaceSessionSelection
|
|
35
|
+
): void {
|
|
12
36
|
try {
|
|
13
|
-
|
|
14
|
-
else sessionStorage.setItem(keyFor(workspaceId), sessionId)
|
|
37
|
+
sessionStorage.setItem(keyFor(workspaceId), JSON.stringify({ selected: selection.selected }))
|
|
15
38
|
} catch {
|
|
16
|
-
|
|
39
|
+
// The in-memory query still works when browser storage is denied.
|
|
17
40
|
}
|
|
18
41
|
}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { useRef, useState } from 'react'
|
|
2
|
-
import { IconArchive,
|
|
2
|
+
import { IconArchive, IconEdit, IconHistory, IconPin, IconPinFilled } from '@tabler/icons-react'
|
|
3
3
|
|
|
4
4
|
import { useArchiveWorkspaceSession, useWorkspaceSessions } from './api'
|
|
5
5
|
import { useWorkspaceAgent } from '@/client/features/workspace/api'
|
|
6
|
-
import { useWorkspaceId } from '@/client/features/workspace/
|
|
7
|
-
import { useSelectedSession } from '@/client/features/chat/sessions/useSelectedSession'
|
|
8
|
-
import { cn } from '@/client/lib/cn'
|
|
6
|
+
import { useWorkspaceId } from '@/client/features/workspace/workspace-context'
|
|
9
7
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from '@/client/
|
|
15
|
-
import
|
|
8
|
+
useSelectedSession,
|
|
9
|
+
useCurrentTabId,
|
|
10
|
+
usePinnedSession
|
|
11
|
+
} from '@/client/features/chat/sessions/use-selected-session'
|
|
12
|
+
import { cn } from '@/client/lib/cn'
|
|
13
|
+
import { isSessionRunning, liveStore, useLive } from '@/client/features/chat/chat-store'
|
|
14
|
+
import type { SessionInfo, WorkspaceTabId } from '@/lib/types'
|
|
16
15
|
|
|
17
16
|
import { Button } from '@/client/components/ui/button'
|
|
18
17
|
import { toast } from '@/client/components/ui/toast'
|
|
@@ -23,17 +22,16 @@ import {
|
|
|
23
22
|
DropdownMenuGroup,
|
|
24
23
|
DropdownMenuItem,
|
|
25
24
|
DropdownMenuLabel,
|
|
26
|
-
DropdownMenuSeparator,
|
|
27
25
|
DropdownMenuTrigger
|
|
28
26
|
} from '@/client/components/ui/dropdown-menu'
|
|
29
27
|
import { Spinner } from '@/client/components/ui/spinner'
|
|
30
28
|
|
|
31
29
|
type ChatSelectorProps = {
|
|
32
|
-
|
|
30
|
+
className?: string
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
type
|
|
36
|
-
|
|
33
|
+
type SessionSelectorProps = ChatSelectorProps & {
|
|
34
|
+
sessions: SessionInfo[]
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
type ChatSessionGroup = {
|
|
@@ -42,10 +40,6 @@ type ChatSessionGroup = {
|
|
|
42
40
|
sessions: SessionInfo[]
|
|
43
41
|
}
|
|
44
42
|
|
|
45
|
-
function ChatHeaderLabel({ label }: ChatHeaderLabelProps) {
|
|
46
|
-
return <div className="flex h-7 items-center px-2.5 text-sm font-medium">{label}</div>
|
|
47
|
-
}
|
|
48
|
-
|
|
49
43
|
// One tiny text badge per row at most: a cron/subagent flavor wins; otherwise
|
|
50
44
|
// an external origin shows its provider lowercase (e.g. "irc", "telegram").
|
|
51
45
|
// Plain app chats get none.
|
|
@@ -239,33 +233,94 @@ export function groupSessionsByDate(sessions: SessionInfo[], now = new Date()):
|
|
|
239
233
|
return [...groups.values()]
|
|
240
234
|
}
|
|
241
235
|
|
|
242
|
-
export function
|
|
243
|
-
|
|
244
|
-
|
|
236
|
+
export function groupSessionsForTab(
|
|
237
|
+
sessions: SessionInfo[],
|
|
238
|
+
tabId: WorkspaceTabId,
|
|
239
|
+
now = new Date()
|
|
240
|
+
): ChatSessionGroup[] {
|
|
241
|
+
return groupSessionsByDate(
|
|
242
|
+
sessions.filter(session =>
|
|
243
|
+
tabId === 'overview' ? !session.tabId?.startsWith('views/') : session.tabId === tabId
|
|
244
|
+
),
|
|
245
|
+
now
|
|
246
|
+
)
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export function ChatSelector({ className }: ChatSelectorProps) {
|
|
250
|
+
const workspaceId = useWorkspaceId()
|
|
251
|
+
const { pinnedSessionId, loaded, pin } = usePinnedSession()
|
|
252
|
+
const [selectedSessionId] = useSelectedSession()
|
|
253
|
+
const { data: sessions = [] } = useWorkspaceSessions(workspaceId)
|
|
254
|
+
if (!loaded) return null
|
|
255
|
+
|
|
256
|
+
if (pinnedSessionId) {
|
|
257
|
+
const title = sessions.find(session => session.sessionId === pinnedSessionId)?.summary
|
|
258
|
+
if (!title) return null
|
|
259
|
+
return (
|
|
260
|
+
<div
|
|
261
|
+
className={cn(
|
|
262
|
+
'-my-0.5 -ml-0.5 box-content h-7 max-w-64 rounded-lg py-0.5 pr-0.5 pl-3',
|
|
263
|
+
'flex min-w-0 items-center gap-1 bg-accent text-sm font-medium'
|
|
264
|
+
)}
|
|
265
|
+
>
|
|
266
|
+
<span className="min-w-0 flex-1 truncate">{title}</span>
|
|
267
|
+
<Tooltip key="unpin">
|
|
268
|
+
<TooltipTrigger
|
|
269
|
+
render={
|
|
270
|
+
<Button
|
|
271
|
+
variant="ghost"
|
|
272
|
+
size="icon-sm"
|
|
273
|
+
className={className}
|
|
274
|
+
onClick={() => pin(null)}
|
|
275
|
+
aria-label="Unpin chat"
|
|
276
|
+
aria-pressed={true}
|
|
277
|
+
>
|
|
278
|
+
<IconPinFilled stroke={1.75} />
|
|
279
|
+
</Button>
|
|
280
|
+
}
|
|
281
|
+
/>
|
|
282
|
+
<TooltipContent>Unpin chat</TooltipContent>
|
|
283
|
+
</Tooltip>
|
|
284
|
+
</div>
|
|
285
|
+
)
|
|
245
286
|
}
|
|
246
287
|
|
|
247
|
-
return
|
|
288
|
+
return (
|
|
289
|
+
<div className="flex w-full min-w-0 items-center justify-between gap-1">
|
|
290
|
+
<SessionSelector className={className} sessions={sessions} />
|
|
291
|
+
{selectedSessionId && (
|
|
292
|
+
<Tooltip key="pin">
|
|
293
|
+
<TooltipTrigger
|
|
294
|
+
render={
|
|
295
|
+
<Button
|
|
296
|
+
variant="ghost"
|
|
297
|
+
size="icon-sm"
|
|
298
|
+
className={className}
|
|
299
|
+
onClick={() => pin(selectedSessionId)}
|
|
300
|
+
aria-label="Pin chat to workspace"
|
|
301
|
+
aria-pressed={false}
|
|
302
|
+
>
|
|
303
|
+
<IconPin stroke={1.75} />
|
|
304
|
+
</Button>
|
|
305
|
+
}
|
|
306
|
+
/>
|
|
307
|
+
<TooltipContent>Pin chat to workspace</TooltipContent>
|
|
308
|
+
</Tooltip>
|
|
309
|
+
)}
|
|
310
|
+
</div>
|
|
311
|
+
)
|
|
248
312
|
}
|
|
249
313
|
|
|
250
|
-
function SessionSelector() {
|
|
314
|
+
function SessionSelector({ className, sessions }: SessionSelectorProps) {
|
|
251
315
|
const workspaceId = useWorkspaceId()
|
|
252
|
-
const
|
|
253
|
-
const selectedSessionId =
|
|
316
|
+
const tabId = useCurrentTabId()
|
|
317
|
+
const [selectedSessionId, selectSession] = useSelectedSession()
|
|
254
318
|
const [confirmingSessionId, setConfirmingSessionId] = useState<string | null>(null)
|
|
255
|
-
const { data: sessions = [] } = useWorkspaceSessions(workspaceId)
|
|
256
319
|
const canArchive = useWorkspaceAgent(workspaceId).data?.supportsArchiving === true
|
|
257
320
|
const archiveSession = useArchiveWorkspaceSession(workspaceId)
|
|
258
|
-
const
|
|
259
|
-
hasRunningBackgroundSession(state.activity, workspaceId, selectedSessionId)
|
|
260
|
-
)
|
|
321
|
+
const sessionGroups = groupSessionsForTab(sessions, tabId)
|
|
261
322
|
|
|
262
|
-
if (
|
|
263
|
-
return <ChatHeaderLabel label="New chat" />
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
const active = sessions.find(s => s.sessionId === selectedSessionId)
|
|
267
|
-
const label = active?.summary ?? 'New chat'
|
|
268
|
-
const sessionGroups = groupSessionsByDate(sessions)
|
|
323
|
+
if (sessionGroups.length === 0 && !selectedSessionId) return null
|
|
269
324
|
|
|
270
325
|
function handleMenuOpenChange(open: boolean) {
|
|
271
326
|
if (!open) setConfirmingSessionId(null)
|
|
@@ -282,59 +337,63 @@ function SessionSelector() {
|
|
|
282
337
|
}
|
|
283
338
|
}
|
|
284
339
|
|
|
285
|
-
return (
|
|
286
|
-
<
|
|
287
|
-
<
|
|
340
|
+
return selectedSessionId ? (
|
|
341
|
+
<Tooltip>
|
|
342
|
+
<TooltipTrigger
|
|
288
343
|
render={
|
|
289
|
-
<Button
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
)
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
/>
|
|
298
|
-
)}
|
|
344
|
+
<Button
|
|
345
|
+
variant="ghost"
|
|
346
|
+
size="icon-sm"
|
|
347
|
+
aria-label="New chat"
|
|
348
|
+
onClick={() => selectSession(null)}
|
|
349
|
+
className={className}
|
|
350
|
+
>
|
|
351
|
+
<IconEdit stroke={1.75} />
|
|
299
352
|
</Button>
|
|
300
353
|
}
|
|
301
354
|
/>
|
|
355
|
+
<TooltipContent>New chat</TooltipContent>
|
|
356
|
+
</Tooltip>
|
|
357
|
+
) : (
|
|
358
|
+
<DropdownMenu onOpenChange={handleMenuOpenChange}>
|
|
359
|
+
<Tooltip>
|
|
360
|
+
<DropdownMenuTrigger
|
|
361
|
+
render={
|
|
362
|
+
<TooltipTrigger
|
|
363
|
+
render={
|
|
364
|
+
<Button variant="ghost" size="icon-sm" aria-label="History" className={className}>
|
|
365
|
+
<IconHistory stroke={1.75} />
|
|
366
|
+
</Button>
|
|
367
|
+
}
|
|
368
|
+
/>
|
|
369
|
+
}
|
|
370
|
+
/>
|
|
371
|
+
<TooltipContent>History</TooltipContent>
|
|
372
|
+
</Tooltip>
|
|
302
373
|
<DropdownMenuContent
|
|
303
374
|
align="start"
|
|
304
375
|
className="flex max-h-100 w-max max-w-72 min-w-40 flex-col overflow-hidden"
|
|
305
376
|
>
|
|
306
|
-
<
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
{
|
|
321
|
-
|
|
322
|
-
key={session.sessionId}
|
|
323
|
-
session={session}
|
|
324
|
-
active={selectedSessionId === session.sessionId}
|
|
325
|
-
canArchive={canArchive}
|
|
326
|
-
confirmingArchive={confirmingSessionId === session.sessionId}
|
|
327
|
-
onSelect={selectSession}
|
|
328
|
-
onArchive={handleArchive}
|
|
329
|
-
onRequestArchive={setConfirmingSessionId}
|
|
330
|
-
workspaceId={workspaceId}
|
|
331
|
-
/>
|
|
332
|
-
))}
|
|
333
|
-
</DropdownMenuGroup>
|
|
377
|
+
<div className="no-scrollbar flex min-h-0 flex-1 scroll-fade flex-col gap-1 overflow-y-auto overscroll-contain [--scroll-fade-reveal:8px]">
|
|
378
|
+
{sessionGroups.map(group => (
|
|
379
|
+
<DropdownMenuGroup key={group.key}>
|
|
380
|
+
<DropdownMenuLabel>{group.label}</DropdownMenuLabel>
|
|
381
|
+
{group.sessions.map(session => (
|
|
382
|
+
<ChatSessionItem
|
|
383
|
+
key={session.sessionId}
|
|
384
|
+
session={session}
|
|
385
|
+
active={selectedSessionId === session.sessionId}
|
|
386
|
+
canArchive={canArchive}
|
|
387
|
+
confirmingArchive={confirmingSessionId === session.sessionId}
|
|
388
|
+
onSelect={selectSession}
|
|
389
|
+
onArchive={handleArchive}
|
|
390
|
+
onRequestArchive={setConfirmingSessionId}
|
|
391
|
+
workspaceId={workspaceId}
|
|
392
|
+
/>
|
|
334
393
|
))}
|
|
335
|
-
</
|
|
336
|
-
|
|
337
|
-
|
|
394
|
+
</DropdownMenuGroup>
|
|
395
|
+
))}
|
|
396
|
+
</div>
|
|
338
397
|
</DropdownMenuContent>
|
|
339
398
|
</DropdownMenu>
|
|
340
399
|
)
|