From 518c3093ef6e23124dacb01b31ff03392cb90851 Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Mon, 9 Nov 2026 10:48:13 +0100 Subject: [PATCH 01/23] ui: share the working directory row between chat and projects A project's folder shows the same row as a chat's working directory change. Master draws that row inline in ChatMessageCwdChange; move it into its own component so both use it. Assisted-by: Claude (Opus 5.5 Medium) --- .../ChatMessage/ChatMessageCwdChange.svelte | 21 +++++++------------ .../ChatMessageCwdChangeRow.svelte | 21 +++++++++++++++++++ .../chat/src/lib/components/app/chat/index.ts | 6 ++++++ 3 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageCwdChangeRow.svelte diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageCwdChange.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageCwdChange.svelte index 959016a26538..515dca042fa9 100644 --- a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageCwdChange.svelte +++ b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageCwdChange.svelte @@ -1,5 +1,6 @@ {#if info} -
- {#if info.path === null} + {#if info.path === null} +
Working directory cleared - {:else} - - - Set working directory to  - - - {info.display} - - {/if} -
+
+ {:else} + + {/if} {/if} diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageCwdChangeRow.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageCwdChangeRow.svelte new file mode 100644 index 000000000000..999f000279e4 --- /dev/null +++ b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageCwdChangeRow.svelte @@ -0,0 +1,21 @@ + + +
+ + + Set working directory to  + + {display} +
diff --git a/ui/apps/chat/src/lib/components/app/chat/index.ts b/ui/apps/chat/src/lib/components/app/chat/index.ts index 10a0e63ca17d..8adf742d5d35 100644 --- a/ui/apps/chat/src/lib/components/app/chat/index.ts +++ b/ui/apps/chat/src/lib/components/app/chat/index.ts @@ -476,6 +476,12 @@ export { default as ChatMessageStatisticsBadge } from './ChatMessages/ChatMessag */ export { default as ChatMessageCwdChange } from './ChatMessages/ChatMessage/ChatMessageCwdChange.svelte'; +/** + * The `Set working directory to ` row itself, shared by the synthetic + * cwd message and by the project folder row. + */ +export { default as ChatMessageCwdChangeRow } from './ChatMessages/ChatMessage/ChatMessageCwdChangeRow.svelte'; + /** * Generic wrapper for UI-generated (synthetic) messages. Routes the * working-directory change to ChatMessageCwdChange and renders a muted From b54c69b06adf575c23dfc02f22774c10047c9c98 Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Thu, 29 Oct 2026 19:32:56 +0100 Subject: [PATCH 02/23] ui : projects (parked) The projects work as it stood before groups split out of it, kept on top of groups until it is reworked into its own PR. Not for review. Projects live in their own IndexedDB table (schema version 3) with a name, a goal, instructions, context items, a working directory and a hidden flag, and are configured in one dialog. A new chat in a project starts from its instructions and context and in its folder. Every visible project is a sidebar section beside the groups. A chat's menus and the chat form add it to a project, and a chip under the chat form shows it. Tabs and pinned chats lead with their project's name, the search dialog lists projects, and the agent can read and edit them. A chat in a project shows in the project's section, not its group's. Assisted-by: Claude (Opus 5.5 Medium) --- .../app/chat/ChatForm/ChatForm.svelte | 45 +++- .../ChatFormActionAddDrawer.svelte | 25 ++- .../ChatFormActionAddDropdown.svelte | 14 +- .../ChatFormProjectChip.svelte | 63 ++++++ .../app/chat/ChatTabs/ChatTabs.svelte | 27 ++- .../app/chat/ChatTabs/ChatTabsItem.svelte | 15 +- .../chat/src/lib/components/app/chat/index.ts | 8 + .../app/dialogs/DialogSearch.svelte | 39 +++- ui/apps/chat/src/lib/components/app/index.ts | 1 + .../SidebarNavigation.svelte | 6 + .../SidebarNavigationConversationItem.svelte | 75 ++++++- .../SidebarNavigationConversationList.svelte | 72 +++++- .../SidebarNavigationProjectSection.svelte | 182 ++++++++++++++++ .../SidebarNavigationSearchResults.svelte | 2 + .../app/projects/DialogProject.svelte | 199 +++++++++++++++++ .../app/projects/DialogProjectPicker.svelte | 100 +++++++++ .../app/projects/ProjectContextList.svelte | 174 +++++++++++++++ .../app/projects/ProjectFolderPicker.svelte | 74 +++++++ .../app/projects/ProjectPrefix.svelte | 21 ++ .../app/projects/ProjectSubmenu.svelte | 137 ++++++++++++ .../src/lib/components/app/projects/index.ts | 50 +++++ .../constants/attachment-menu.constants.ts | 1 + .../src/lib/constants/database.constants.ts | 14 +- .../chat/src/lib/constants/icons.constants.ts | 9 +- ui/apps/chat/src/lib/constants/index.ts | 2 + .../lib/constants/message-export.constants.ts | 8 + .../chat/src/lib/constants/project-tools.ts | 82 +++++++ .../src/lib/constants/projects.constants.ts | 2 + .../src/lib/constants/tool-ui.constants.ts | 23 ++ .../chat/src/lib/constants/ui.constants.ts | 2 + ui/apps/chat/src/lib/enums/index.ts | 1 + ui/apps/chat/src/lib/enums/tools.enums.ts | 4 + ui/apps/chat/src/lib/enums/ui.enums.ts | 11 + .../services/conversation-transfer.service.ts | 117 +++++++--- .../chat/src/lib/services/database.service.ts | 58 ++++- .../src/lib/services/project-tools.service.ts | 157 +++++++++++++ .../src/lib/stores/agentic/index.svelte.ts | 11 +- .../chat/src/lib/stores/chat/index.svelte.ts | 26 ++- .../lib/stores/conversations/index.svelte.ts | 56 +++++ .../conversations/preferences.svelte.ts | 16 ++ ui/apps/chat/src/lib/stores/index.ts | 3 + ui/apps/chat/src/lib/stores/init.ts | 2 + .../chat/src/lib/stores/projects.svelte.ts | 206 ++++++++++++++++++ ui/apps/chat/src/lib/stores/tools.svelte.ts | 5 + ui/apps/chat/src/lib/stores/ui.svelte.ts | 32 ++- ui/apps/chat/src/lib/types/database.d.ts | 2 + ui/apps/chat/src/lib/types/index.ts | 2 + ui/apps/chat/src/lib/types/projects.d.ts | 42 ++++ ui/apps/chat/src/lib/utils/index.ts | 2 + ui/apps/chat/src/lib/utils/project-prompt.ts | 66 ++++++ .../tests/client/project-tools.svelte.test.ts | 100 +++++++++ .../tests/client/projects-db.svelte.test.ts | 74 +++++++ 52 files changed, 2382 insertions(+), 83 deletions(-) create mode 100644 ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormProjectChip/ChatFormProjectChip.svelte create mode 100644 ui/apps/chat/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigationProjectSection.svelte create mode 100644 ui/apps/chat/src/lib/components/app/projects/DialogProject.svelte create mode 100644 ui/apps/chat/src/lib/components/app/projects/DialogProjectPicker.svelte create mode 100644 ui/apps/chat/src/lib/components/app/projects/ProjectContextList.svelte create mode 100644 ui/apps/chat/src/lib/components/app/projects/ProjectFolderPicker.svelte create mode 100644 ui/apps/chat/src/lib/components/app/projects/ProjectPrefix.svelte create mode 100644 ui/apps/chat/src/lib/components/app/projects/ProjectSubmenu.svelte create mode 100644 ui/apps/chat/src/lib/components/app/projects/index.ts create mode 100644 ui/apps/chat/src/lib/constants/project-tools.ts create mode 100644 ui/apps/chat/src/lib/constants/projects.constants.ts create mode 100644 ui/apps/chat/src/lib/services/project-tools.service.ts create mode 100644 ui/apps/chat/src/lib/stores/projects.svelte.ts create mode 100644 ui/apps/chat/src/lib/types/projects.d.ts create mode 100644 ui/apps/chat/src/lib/utils/project-prompt.ts create mode 100644 ui/apps/chat/tests/client/project-tools.svelte.test.ts create mode 100644 ui/apps/chat/tests/client/projects-db.svelte.test.ts diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatForm.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatForm.svelte index 2d368fd80bac..765ebc9663f6 100644 --- a/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatForm.svelte +++ b/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatForm.svelte @@ -9,7 +9,8 @@ ChatFormCurrentWorkingDirectory, ChatFormInput, ChatFormInputFileInputInvisible, - ChatFormPickers + ChatFormPickers, + ChatFormProjectChip } from '#lib/components/app/index.ts'; import { CHAT_FORM_SINGLE_ROW_MAX_TEXT_PX, @@ -35,6 +36,7 @@ conversationsStore, deviceStore, modelsStore, + projectsStore, serverStore, settingsStore, toolsStore, @@ -139,6 +141,15 @@ conversationsStore.activeConversation?.cwd ?? conversationsStore.preferences.pendingCwd ); + // the project the chat is in, or the one picked for the chat about to start + let project = $derived.by(() => { + const projectId = + conversationsStore.activeConversation?.projectId ?? + conversationsStore.preferences.pendingProjectId; + + return projectId ? projectsStore.get(projectId) : undefined; + }); + let showWorkingDirectory = $derived(conversationsStore.preferences.hasEnabledCwdTools()); // On a desktop the chip under the form shows a directory once one is set, and the + menu // sets one until then. A phone has no chip: a chat shows it in its header (see @@ -806,7 +817,37 @@ > {/if} - {#if showWorkingDirectory} + {#if project} + +
+ + + {#if showWorkingDirectoryChip} + + {/if} + + {#if showWorkingDirectory} + + {/if} +
+ {:else if showWorkingDirectory} + + + {/snippet} + + + +

Change project

+
+ + +
+ void conversationsStore.assignActiveConversationProject(null)} + tooltip="Remove from project" + /> +
+ diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabs.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabs.svelte index c4a68a2dbfc8..ae228177317a 100644 --- a/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabs.svelte +++ b/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabs.svelte @@ -12,7 +12,13 @@ UNNAMED_CHAT_LABEL } from '#lib/constants/index.ts'; import { useScrollCarousel } from '#lib/hooks/use-scroll-carousel.svelte.ts'; - import { chatStore, conversationsStore, tabsStore, uiStore } from '#lib/stores/index.ts'; + import { + chatStore, + conversationsStore, + projectsStore, + tabsStore, + uiStore + } from '#lib/stores/index.ts'; import type { MenuAction } from '#lib/types/index.ts'; import { resolveTabView } from '#lib/utils/index.ts'; import { page } from '$app/state'; @@ -28,15 +34,22 @@ view.ids.map((id) => id === NEW_CHAT_TAB_ID ? { href: view.hrefFor(id), icon: SquarePen, id, name: NEW_CHAT_LABEL } - : { - href: view.hrefFor(id), - id, - name: - conversationsStore.conversations.find((c) => c.id === id)?.name ?? UNNAMED_CHAT_LABEL - } + : chatTab(id) ) ); + // a project chat carries its project name before the title, like a breadcrumb + function chatTab(id: string) { + const conversation = conversationsStore.conversations.find((c) => c.id === id); + + return { + href: view.hrefFor(id), + id, + name: conversation?.name ?? UNNAMED_CHAT_LABEL, + prefix: conversation?.projectId ? projectsStore.get(conversation.projectId)?.name : undefined + }; + } + // hide the New chat button while a new-chat tab is already open let showNewChatButton = $derived(!view.ids.includes(NEW_CHAT_TAB_ID)); diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabsItem.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabsItem.svelte index c01af20d6f4b..54486ec19498 100644 --- a/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabsItem.svelte +++ b/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabsItem.svelte @@ -2,6 +2,7 @@ import * as Tooltip from '@ggml-org/llama-ui/ui/tooltip'; import { cn } from '@ggml-org/llama-ui/utils'; import { Loader2, Square, X } from '@lucide/svelte'; + import { ProjectPrefix } from '#lib/components/app/index.ts'; import { ICON_CLASS_SM, ICON_CLASS_XS, @@ -18,6 +19,8 @@ icon?: Component; id: string; name: string; + /** Name of the project the chat belongs to, shown muted before the title. */ + prefix?: string; } interface Props { @@ -69,14 +72,15 @@ TAB_SURFACE_CLASS, // each tab sits in its context-menu trigger, so the first trigger marks // the first tab - 'relative max-w-52 min-w-0 shrink-0 gap-1 pr-1 [:first-child>&]:ml-2', + 'relative min-w-0 shrink-0 gap-1 pr-1 [:first-child>&]:ml-2', + tab.prefix ? 'max-w-80' : 'max-w-52', isLoading ? 'pl-1' : 'pl-3', isActive ? TAB_SURFACE_ACTIVE_CLASS : TAB_SURFACE_IDLE_CLASS )} > onAuxClick?.(tab.id, e)} @@ -116,6 +120,13 @@ /> {/if} + {#if tab.prefix} + + {/if} + {tab.name} diff --git a/ui/apps/chat/src/lib/components/app/chat/index.ts b/ui/apps/chat/src/lib/components/app/chat/index.ts index 8adf742d5d35..5526caf15a20 100644 --- a/ui/apps/chat/src/lib/components/app/chat/index.ts +++ b/ui/apps/chat/src/lib/components/app/chat/index.ts @@ -259,6 +259,14 @@ export { default as ChatFormInput } from './ChatForm/ChatFormInput/ChatFormInput */ export { default as ChatFormCurrentWorkingDirectory } from './ChatForm/ChatFormCurrentWorkingDirectory/ChatFormCurrentWorkingDirectory.svelte'; +/** + * **ChatFormProjectChip** - The chat's project under the chat form + * + * Shown beside the working directory. A click changes the project and the + * hover × takes the chat out of it. + */ +export { default as ChatFormProjectChip } from './ChatForm/ChatFormProjectChip/ChatFormProjectChip.svelte'; + /** * Shared popover wrapper for inline picker popovers (prompts, resources). * Provides consistent positioning, styling, and open/close behavior. diff --git a/ui/apps/chat/src/lib/components/app/dialogs/DialogSearch.svelte b/ui/apps/chat/src/lib/components/app/dialogs/DialogSearch.svelte index bf502fc36784..85c78911b02f 100644 --- a/ui/apps/chat/src/lib/components/app/dialogs/DialogSearch.svelte +++ b/ui/apps/chat/src/lib/components/app/dialogs/DialogSearch.svelte @@ -6,12 +6,13 @@ ICON_CLASS_DEFAULT, ICON_CLASS_SM, ICON_CLASS_XS, + PROJECT_ICON, SIDEBAR_ACTIONS_ITEMS } from '#lib/constants/index.ts'; import { KeyboardKey, SidebarAction } from '#lib/enums/index.ts'; import { extensions, type NavigationItem } from '#lib/extensions/index.ts'; import { RouterService } from '#lib/services/router.service.ts'; - import { conversationsStore, deviceStore } from '#lib/stores/index.ts'; + import { conversationsStore, deviceStore, projectsStore, uiStore } from '#lib/stores/index.ts'; import { formatRelativeTime, isIMEComposing, sidebarFooterItems } from '#lib/utils/index.ts'; import { goto } from '$app/navigation'; import type { Component } from 'svelte'; @@ -62,13 +63,34 @@ .filter((conversation) => matches(conversation.name)) .sort((a, b) => b.lastModified - a.lastModified) .slice(0, limit) - .map((conversation) => ({ - icon: MessageSquare, - id: `chat-${conversation.id}`, - label: conversation.name, - meta: formatRelativeTime(conversation.lastModified), - pinned: conversation.pinned, - run: () => close(() => goto(RouterService.chat(conversation.id))) + .map((conversation) => { + const project = conversation.projectId + ? projectsStore.get(conversation.projectId) + : undefined; + const time = formatRelativeTime(conversation.lastModified); + + return { + icon: MessageSquare, + id: `chat-${conversation.id}`, + label: conversation.name, + meta: project ? `${project.name} · ${time}` : time, + pinned: conversation.pinned, + run: () => close(() => goto(RouterService.chat(conversation.id))) + }; + }) + ); + + // hidden ones too: this is where a hidden project is found and shown again + const projectEntries = $derived.by((): SearchEntry[] => + projectsStore.projects + .filter((project) => matches(project.name)) + .slice(0, limit) + .map((project) => ({ + icon: PROJECT_ICON, + id: `project-${project.id}`, + label: project.name, + meta: project.hidden ? 'Hidden' : undefined, + run: () => close(() => uiStore.openProjectDialog({ projectId: project.id })) })) ); @@ -99,6 +121,7 @@ const sections = $derived( [ { entries: chatEntries, title: needle ? 'Chats' : 'Recents' }, + { entries: projectEntries, title: 'Projects' }, { entries: actionEntries, title: 'Actions' } ].filter((section) => section.entries.length > 0) ); diff --git a/ui/apps/chat/src/lib/components/app/index.ts b/ui/apps/chat/src/lib/components/app/index.ts index a1ea03a74b8d..302f0a2f06ad 100644 --- a/ui/apps/chat/src/lib/components/app/index.ts +++ b/ui/apps/chat/src/lib/components/app/index.ts @@ -9,3 +9,4 @@ export * from './settings'; export * from './models'; export * from './navigation'; export * from './servers'; +export * from './projects'; diff --git a/ui/apps/chat/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte b/ui/apps/chat/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte index d920274352c3..b4869463a842 100644 --- a/ui/apps/chat/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte +++ b/ui/apps/chat/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte @@ -7,6 +7,8 @@ DialogDiscoverModels, DialogGroup, DialogGroupPicker, + DialogProject, + DialogProjectPicker, DialogSearch, DialogSettingsChat, Logo, @@ -793,6 +795,10 @@ + + + +