Commit 1ed4e77f4 for llama.cpp
commit 1ed4e77f4d1ea68e1d4fe877f7933b779fbcada6
Author: Aleksander Grygier <aleksander.grygier@gmail.com>
Date: Wed Nov 25 13:14:03 2026 +0100
ui: search home by default in the working-directory picker and pin tool call chevrons (#33028)
* ui: search home by default in the working-directory picker
A plain query now navigates home as if typed after `~/`, and Enter on a
plain query commits that folder under home. Queries starting from a root
(`/`, `C:\`, `\\host\share`) or `~` still navigate the absolute tree.
Assisted-by: Claude (Opus 5.5 Medium)
* ui: pin the tool call chevron and timer to the end of the row
Tool call, group, reasoning and search result headers span the full
width: the title takes the rest of the row and truncates, while the
timer and the chevron stay at the right end, so a title that changes
while it streams no longer moves them.
Assisted-by: Claude (Opus 5.5 Medium)
diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormCurrentWorkingDirectory/ChatFormCurrentWorkingDirectory.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormCurrentWorkingDirectory/ChatFormCurrentWorkingDirectory.svelte
index cff5eb1da..e4b7d81c9 100644
--- a/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormCurrentWorkingDirectory/ChatFormCurrentWorkingDirectory.svelte
+++ b/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormCurrentWorkingDirectory/ChatFormCurrentWorkingDirectory.svelte
@@ -19,7 +19,11 @@
import { useScrollActiveRow } from '#lib/hooks/use-scroll-active-row.svelte.ts';
import { ToolsService } from '#lib/services/tools.service.ts';
import { conversationsStore, deviceStore, toolsStore } from '#lib/stores/index.ts';
- import { abbreviateHome, runGlobSearchWithChildren } from '#lib/utils/index.ts';
+ import {
+ abbreviateHome,
+ runGlobSearchWithChildren,
+ toHomeRelativeQuery
+ } from '#lib/utils/index.ts';
import { page } from '$app/state';
import { cubicInOut } from 'svelte/easing';
@@ -159,8 +163,10 @@
try {
// Generous limit: ranking is client-side, only the top
// MAX_RESULTS_SHOWN are shown.
+ // A plain query navigates home as if typed after `~/`; a query
+ // starting from a root or `~` navigates the absolute tree.
const res = await runGlobSearchWithChildren(
- trimmed,
+ toHomeRelativeQuery(trimmed, homeBase),
homeBase ?? HOME_TILDE,
SEARCH.MAX_DEPTH,
SEARCH.LIMIT,
@@ -251,7 +257,7 @@
return;
}
- setDirectory(value);
+ setDirectory(toHomeRelativeQuery(value, homeBase));
closePicker();
}
diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockSearchResults.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockSearchResults.svelte
index efbbde974..97e65b432 100644
--- a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockSearchResults.svelte
+++ b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockSearchResults.svelte
@@ -148,9 +148,9 @@
<CollapsibleContentBlock
class="my-2"
- inlineChevron
{onToggle}
{open}
+ pinnedChevron
shimmerTitle={showSpinner}
{title}
>
diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallGroup.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallGroup.svelte
index 3f8acb39e..cc2154879 100644
--- a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallGroup.svelte
+++ b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallGroup.svelte
@@ -54,7 +54,7 @@
</script>
<div class="tool-call-group min-w-0">
- <CollapsibleContentBlock inlineChevron {onToggle} {open} shimmerTitle={Boolean(activity)}>
+ <CollapsibleContentBlock {onToggle} {open} pinnedChevron shimmerTitle={Boolean(activity)}>
{#snippet titleSnippet()}
<span class="flex min-w-0 items-baseline gap-x-2">
<!-- collapsed, the summary steps back behind the answer; a live title keeps its shimmer -->
@@ -65,7 +65,7 @@
</span>
{/snippet}
- {#snippet titleSuffix()}
+ {#snippet trailing()}
{#if elapsedStartedAt !== null}
<ToolCallElapsed startedAt={elapsedStartedAt} />
{/if}
diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ToolCallBlock.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ToolCallBlock.svelte
index 2f45f9a37..76505b465 100644
--- a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ToolCallBlock.svelte
+++ b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ToolCallBlock.svelte
@@ -124,9 +124,9 @@
<CollapsibleContentBlock
class="my-2"
- inlineChevron
{onToggle}
{open}
+ pinnedChevron
shimmerTitle={showSpinner}
{subtitle}
>
@@ -138,11 +138,13 @@
{/if}
{/snippet}
- {#snippet titleSuffix()}
+ {#snippet trailing()}
{#if elapsedStart !== null}
<ToolCallElapsed startedAt={elapsedStart} />
{/if}
+ {/snippet}
+ {#snippet titleSuffix()}
{#if images.length > 0 && !open}
<span
transition:fade={{ duration: 150 }}
diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessageReasoningBlock.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessageReasoningBlock.svelte
index b417f4256..2f3cc8db9 100644
--- a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessageReasoningBlock.svelte
+++ b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessageReasoningBlock.svelte
@@ -124,9 +124,9 @@
<CollapsibleContentBlock
class="my-2"
- inlineChevron
{onToggle}
{open}
+ pinnedChevron
{shimmerTitle}
{subtitle}
{title}
diff --git a/ui/apps/chat/src/lib/components/app/content/CollapsibleContentBlock.svelte b/ui/apps/chat/src/lib/components/app/content/CollapsibleContentBlock.svelte
index 328ced020..00c6c9d66 100644
--- a/ui/apps/chat/src/lib/components/app/content/CollapsibleContentBlock.svelte
+++ b/ui/apps/chat/src/lib/components/app/content/CollapsibleContentBlock.svelte
@@ -36,10 +36,12 @@
/** Shown right after the title, e.g. a live timer. */
titleSuffix?: Snippet;
/**
- * Put the chevron right after the title and keep it visible, for rows
- * that read as a line of text ( the tool call trace ) instead of a bar.
+ * Keep the chevron visible at the end of the row, pointing right until
+ * open, for rows that read as a line of text ( the tool call trace ).
+ * The title takes the rest of the width, so a title that changes while
+ * it streams never moves the chevron or the trailing content.
*/
- inlineChevron?: boolean;
+ pinnedChevron?: boolean;
onToggle?: () => void;
children: Snippet;
}
@@ -52,9 +54,9 @@
icon: IconComponent,
iconClass = ICON_CLASS_DEFAULT,
iconUrl = null,
- inlineChevron = false,
onToggle,
open = $bindable(false),
+ pinnedChevron = false,
shimmerTitle = false,
subtitle,
title = '',
@@ -103,14 +105,14 @@
<span aria-hidden="true" class="h-px min-w-4 flex-1 bg-current opacity-25"></span>
{/snippet}
-<!-- Beside the title it is always visible and points right until open; at the
- end of the row it appears on hover and flips. -->
+<!-- Pinned, it is always visible and points right until open; otherwise it
+ appears on hover and flips. -->
{#snippet chevron()}
<ChevronDown
class={cn(
'shrink-0 text-muted-foreground/60 duration-150 ease-out',
- inlineChevron
- ? ['size-3.5 self-center transition-transform', !open && '-rotate-90']
+ pinnedChevron
+ ? ['mt-1 size-3.5 transition-transform', !open && '-rotate-90']
: [
'mt-0.75 size-4 opacity-0 transition-all group-hover/collapsible:opacity-100',
open && 'rotate-180'
@@ -175,14 +177,15 @@
'py-1.5 pr-1'
)}
>
- <div class="flex min-w-0 items-start gap-2 text-muted-foreground">
+ <div
+ class={cn(
+ 'flex min-w-0 items-start gap-2 text-muted-foreground',
+ pinnedChevron && 'flex-1'
+ )}
+ >
{@render toggleIcon('mt-0.75')}
{@render toggleTitle('overflow-x-auto text-body-sm')}
-
- {#if inlineChevron}
- {@render chevron()}
- {/if}
</div>
{#if trailing}
@@ -191,9 +194,7 @@
</div>
{/if}
- {#if !inlineChevron}
- {@render chevron()}
- {/if}
+ {@render chevron()}
<span class="sr-only">Toggle content</span>
</Collapsible.Trigger>
diff --git a/ui/apps/chat/src/lib/utils/index.ts b/ui/apps/chat/src/lib/utils/index.ts
index 2dae4a575..915b9d671 100644
--- a/ui/apps/chat/src/lib/utils/index.ts
+++ b/ui/apps/chat/src/lib/utils/index.ts
@@ -227,6 +227,7 @@ export {
// Working-directory picker search helpers
export {
splitPathQuery,
+ toHomeRelativeQuery,
buildCaseInsensitiveGlob,
buildGlobSearchArgs,
rankEntries,
diff --git a/ui/apps/chat/src/lib/utils/working-directory.ts b/ui/apps/chat/src/lib/utils/working-directory.ts
index 21b65e296..b3e115740 100644
--- a/ui/apps/chat/src/lib/utils/working-directory.ts
+++ b/ui/apps/chat/src/lib/utils/working-directory.ts
@@ -2,13 +2,15 @@
* Pure helpers for the working-directory picker search, backed by the
* server's `file_glob_search` tool. Queries starting from a root (`/`,
* `C:\`, `\\host\share`) or `~` navigate the tree (search the parent for
- * the last segment); anything else glob-matches home-relative entries.
+ * the last segment); anything else glob-matches entries under the scope
+ * path, unless the caller anchors it in home with `toHomeRelativeQuery`.
*/
import { lastPathSegment } from './path-display';
import {
GLOB,
HOME_TILDE,
+ HOME_TILDE_PREFIX,
LEADING_SLASHES_REGEX,
PATH_SEPARATOR,
SEARCH,
@@ -72,6 +74,18 @@ export function splitPathQuery(query: string): PathQuery | null {
return { last: rest.slice(idx + 1), parent: parentOf(rest.slice(0, idx)) };
}
+/**
+ * Anchor a plain query in home, as if it were typed after `~/` (under the
+ * resolved `home` when known). Queries that already start from a root (`/`,
+ * `C:\`, `\\host\share`) or `~` are kept, so they still navigate the
+ * absolute tree.
+ */
+export function toHomeRelativeQuery(query: string, home?: string | null): string {
+ if (!query || splitPathQuery(query)) return query;
+
+ return home ? joinPath(home, query) : HOME_TILDE_PREFIX + query;
+}
+
export function buildCaseInsensitiveGlob(query: string): string {
let out = GLOB.WILDCARD;
diff --git a/ui/apps/chat/tests/unit/working-directory.test.ts b/ui/apps/chat/tests/unit/working-directory.test.ts
index 34580a3dd..43cc830ae 100644
--- a/ui/apps/chat/tests/unit/working-directory.test.ts
+++ b/ui/apps/chat/tests/unit/working-directory.test.ts
@@ -5,7 +5,8 @@ import {
highlightMatch,
joinPath,
rankEntries,
- splitPathQuery
+ splitPathQuery,
+ toHomeRelativeQuery
} from '#lib/utils/index.ts';
import { describe, expect, it } from 'vitest';
@@ -171,3 +172,42 @@ describe('buildGlobSearchArgs', () => {
expect(args.last).toBe('bin');
});
});
+
+describe('toHomeRelativeQuery', () => {
+ it('anchors a plain query in home as if typed after `~/`', () => {
+ expect(toHomeRelativeQuery('docs')).toBe('~/docs');
+ expect(toHomeRelativeQuery('git/llama')).toBe('~/git/llama');
+ });
+
+ it('anchors a plain query under the resolved home when known', () => {
+ expect(toHomeRelativeQuery('docs', '/Users/al')).toBe('/Users/al/docs');
+ expect(toHomeRelativeQuery('docs', '/Users/al/')).toBe('/Users/al/docs');
+ });
+
+ it('keeps queries that start from a root or `~`', () => {
+ for (const q of [
+ '/',
+ '/usr/local',
+ '~',
+ '~/docs',
+ 'C:\\repos',
+ 'D:/repos',
+ '\\\\host\\share'
+ ]) {
+ expect(toHomeRelativeQuery(q, '/Users/al')).toBe(q);
+ }
+ });
+
+ it('keeps an empty query empty', () => {
+ expect(toHomeRelativeQuery('', '/Users/al')).toBe('');
+ });
+
+ it('navigates home children for a plain query', () => {
+ const args = buildGlobSearchArgs(toHomeRelativeQuery('proj'), '/home', 6);
+
+ expect(args.path).toBe('~');
+ expect(args.include).toBe(buildCaseInsensitiveGlob('proj'));
+ expect(args.maxDepth).toBe(SEARCH.PATH_NAV_MAX_DEPTH);
+ expect(args.last).toBe('proj');
+ });
+});