diff --git a/tools/ui/package-lock.json b/tools/ui/package-lock.json
index ecc260e03b61..79a0ba8b2c33 100644
--- a/tools/ui/package-lock.json
+++ b/tools/ui/package-lock.json
@@ -84,6 +84,7 @@
"typescript-eslint": "8.60.1",
"unified": "11.0.5",
"unist-util-visit": "5.1.0",
+ "uqr": "0.1.3",
"uuid": "13.0.2",
"vaul-svelte": "1.0.0-next.7",
"vite": "7.3.7",
@@ -17234,6 +17235,13 @@
"browserslist": ">= 4.21.0"
}
},
+ "node_modules/uqr": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/uqr/-/uqr-0.1.3.tgz",
+ "integrity": "sha512-0rjE8iEJe4YmT9TOhwsZtqCMRLc5DXZUI2UEYUUg63ikBkqqE5EYWaI0etFe/5KUcmcYwLih2RND1kq+hrUJXA==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/uri-js": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
diff --git a/tools/ui/package.json b/tools/ui/package.json
index 36eb320c4b84..4228063516bb 100644
--- a/tools/ui/package.json
+++ b/tools/ui/package.json
@@ -109,6 +109,7 @@
"typescript-eslint": "8.60.1",
"unified": "11.0.5",
"unist-util-visit": "5.1.0",
+ "uqr": "0.1.3",
"uuid": "13.0.2",
"vaul-svelte": "1.0.0-next.7",
"vite": "7.3.7",
diff --git a/tools/ui/src/app.css b/tools/ui/src/app.css
index c5d01ed6b78e..ad6849ea712f 100644
--- a/tools/ui/src/app.css
+++ b/tools/ui/src/app.css
@@ -45,6 +45,11 @@
--safe-area-bottom: env(safe-area-inset-bottom, 0px);
/* where the phone's corner controls (menu toggle, context gauge, sidebar logo) sit */
--corner-control-top: calc(1rem + var(--safe-area-top));
+ /* where the phone's bottom corner actions (a page's floating key) sit: as far in from
+ the side as up from the bottom, which keeps a 56px key about concentric with an
+ iPhone's rounded screen corner */
+ --corner-control-side: 1.75rem;
+ --corner-control-bottom: calc(var(--corner-control-side) + var(--safe-area-bottom));
/* where a phone page's title starts: a row below the corner controls */
--page-top: calc(var(--corner-control-top) + 3.75rem);
/* expanded desktop sidebar width, overridden once the user drags its edge */
@@ -117,6 +122,9 @@
/* the installed app's status bar already sets them apart from the screen's edge */
:root {
--corner-control-top: calc(0.25rem + var(--safe-area-top));
+ /* the home indicator is a short bar in the middle, so the corners beside it are
+ free: a corner action ignores its inset and keeps the same gap as from the side */
+ --corner-control-bottom: var(--corner-control-side);
}
html {
@@ -420,11 +428,15 @@
}
/* While something is dragged, what it passes over takes no hover: only the
- sections themselves stay targets, for the drop */
+ sections themselves, and the projects in them, stay targets, for the drop */
body[data-sidebar-dragging] [data-sidebar-section] * {
pointer-events: none;
}
+ body[data-sidebar-dragging] [data-sidebar-section] [data-sidebar-section] {
+ pointer-events: auto;
+ }
+
.sidebar-drag-overlay {
position: fixed;
z-index: 1000;
@@ -479,6 +491,21 @@
animation: none;
}
}
+
+ /* A page's entrance, for pages that remount on every navigation into them:
+ * the whole page fades in at once. A plain ease over 350ms spreads the
+ * fade evenly instead of front-loading it, so it reads as a calm arrival.
+ * Opacity only, so it runs on the compositor and stays for reduced motion
+ * too: a fade does not move anything. */
+ .page-enter {
+ animation: page-enter 350ms ease;
+ }
+
+ @keyframes page-enter {
+ from {
+ opacity: 0;
+ }
+ }
}
.mermaidTooltip {
diff --git a/tools/ui/src/app.d.ts b/tools/ui/src/app.d.ts
index 5c039063ad29..c3d210c9e69e 100644
--- a/tools/ui/src/app.d.ts
+++ b/tools/ui/src/app.d.ts
@@ -12,6 +12,7 @@ import type {
ApiChatCompletionStreamChunk,
ApiChatCompletionToolCall,
ApiChatCompletionToolCallDelta,
+ ApiChatCompletionUsage,
ApiChatMessageContentPart,
ApiChatMessageData,
ApiContextSizeError,
@@ -74,6 +75,7 @@ declare global {
ApiChatCompletionResponse,
ApiChatCompletionStreamChunk,
ApiChatCompletionToolCall,
+ ApiChatCompletionUsage,
ApiChatCompletionToolCallDelta,
ApiChatMessageData,
ApiChatMessageContentPart,
diff --git a/tools/ui/src/lib/components/app/actions/FloatingActionButton.svelte b/tools/ui/src/lib/components/app/actions/FloatingActionButton.svelte
new file mode 100644
index 000000000000..d3e4109c6887
--- /dev/null
+++ b/tools/ui/src/lib/components/app/actions/FloatingActionButton.svelte
@@ -0,0 +1,30 @@
+
+
+
+
+
+
diff --git a/tools/ui/src/lib/components/app/actions/GlassKey.svelte b/tools/ui/src/lib/components/app/actions/GlassKey.svelte
new file mode 100644
index 000000000000..b2ccffe6a16b
--- /dev/null
+++ b/tools/ui/src/lib/components/app/actions/GlassKey.svelte
@@ -0,0 +1,67 @@
+
+
+{#snippet key(props: Record = {})}
+
+{/snippet}
+
+
+{#if tooltip && !deviceStore.isMobile}
+
+
+ {#snippet child({ props })}
+ {@render key(props)}
+ {/snippet}
+
+
+
+
{label}
+
+
+{:else}
+ {@render key()}
+{/if}
diff --git a/tools/ui/src/lib/components/app/actions/index.ts b/tools/ui/src/lib/components/app/actions/index.ts
index 4bb2a58d6672..bd395d1a5f05 100644
--- a/tools/ui/src/lib/components/app/actions/index.ts
+++ b/tools/ui/src/lib/components/app/actions/index.ts
@@ -11,3 +11,9 @@ export { default as ActionIcon } from './ActionIcon.svelte';
/** Copy-to-clipboard icon button with clipboard logic. */
export { default as ActionIconCopyToClipboard } from './ActionIconCopyToClipboard.svelte';
+
+/** A round matte glass key: a phone's corner keys and the key back to a chat's bottom. */
+export { default as GlassKey } from './GlassKey.svelte';
+
+/** A page's main action on a phone: a round key pinned to the bottom-right corner. */
+export { default as FloatingActionButton } from './FloatingActionButton.svelte';
diff --git a/tools/ui/src/lib/components/app/chat/ChatForm/ChatForm.svelte b/tools/ui/src/lib/components/app/chat/ChatForm/ChatForm.svelte
index 44bf366665f3..d5d88767c7be 100644
--- a/tools/ui/src/lib/components/app/chat/ChatForm/ChatForm.svelte
+++ b/tools/ui/src/lib/components/app/chat/ChatForm/ChatForm.svelte
@@ -9,6 +9,7 @@
ChatFormInputFileInputInvisible,
ChatFormMcpResourcesList,
ChatFormPickers,
+ ChatFormProjectChip,
DialogMcpResourcesBrowser
} from '$lib/components/app';
import { hasMarkdownStructure } from '$lib/components/app/content/MarkdownEditor/markdown-structure';
@@ -41,6 +42,7 @@
deviceStore,
mcpStore,
modelsStore,
+ projectsStore,
serverStore,
settingsStore,
toolsStore,
@@ -97,6 +99,7 @@
onStop?: () => void;
onSubmit?: () => void;
onSystemPromptClick?: (draft: { message: string; files: ChatUploadedFile[] }) => void;
+ onSystemPromptWithContent?: (content: string, promptId: string, title: string) => void;
onUploadedFileRemove?: (fileId: string) => void;
onUploadedFilesChange?: (files: ChatUploadedFile[]) => void;
onValueChange?: (value: string) => void;
@@ -113,6 +116,7 @@
onStop,
onSubmit,
onSystemPromptClick,
+ onSystemPromptWithContent,
onUploadedFileRemove,
onUploadedFilesChange,
onValueChange,
@@ -128,8 +132,12 @@
let audioRecorder: AudioRecorder | undefined;
let chatFormActionsRef: ChatFormActions | undefined = $state(undefined);
let fileInputRef: ChatFormInputFileInputInvisible | undefined = $state(undefined);
- let pickersRef: { handleKeydown: (event: KeyboardEvent) => boolean } | undefined =
- $state(undefined);
+ let pickersRef:
+ | {
+ handleKeydown: (event: KeyboardEvent) => boolean;
+ openPromptArguments: (prompt: MCPPromptInfo) => void;
+ }
+ | undefined = $state(undefined);
let inputRef: ChatFormInput | undefined = $state(undefined);
// Audio Recording State
@@ -148,10 +156,19 @@
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 active = conversationsStore.activeConversation;
+ const projectId = active ? active.projectId : conversationsStore.preferences.pendingProjectId;
+
+ return projectId ? projectsStore.get(projectId) : undefined;
+ });
+
let showWorkingDirectory = $derived(conversationsStore.preferences.hasEnabledCwdTools());
// A phone has no chip for the working directory under the form: a chat shows it in its
// header (see ChatScreenMobileHeader), and a new chat, which has no header yet, offers it in
// the + menu
+ let showWorkingDirectoryChip = $derived(showWorkingDirectory && !deviceStore.isMobile);
let isWorkingDirectoryInAddMenu = $derived(
showWorkingDirectory && deviceStore.isMobile && !conversationsStore.activeConversation
);
@@ -788,6 +805,12 @@
}
}
+ async function handleMcpPromptArguments(prompt: MCPPromptInfo) {
+ pickers.openPromptPicker();
+ await tick();
+ pickersRef?.openPromptArguments(prompt);
+ }
+
function handlePromptLoadStart(
placeholderId: string,
promptInfo: MCPPromptInfo,
@@ -1111,10 +1134,12 @@
{isRecording}
micWarning={micUnavailableReason ?? micError}
onFileUpload={handleFileUpload}
+ onMcpPromptClick={handleMcpPromptArguments}
onMicClick={handleMicClick}
{onStop}
onSystemPromptClick={() =>
onSystemPromptClick?.({ files: uploadedFiles, message: value })}
+ {onSystemPromptWithContent}
onWorkingDirectoryClick={isWorkingDirectoryInAddMenu
? pickers.handleWorkingDirectoryOpen
: undefined}
@@ -1141,30 +1166,44 @@
>
{/if}
- {#if showWorkingDirectory && !deviceStore.isMobile}
+ {#if project || showWorkingDirectoryChip}
+