Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(chat): pick a project from the temporary home's title

vastsaf89c40d56fb1
diff --git a/apps/desktop/src/components/ChatSurface.tsx b/apps/desktop/src/components/ChatSurface.tsx
index 47177e1fa..82bbe08f2 100644
--- a/apps/desktop/src/components/ChatSurface.tsx
+++ b/apps/desktop/src/components/ChatSurface.tsx
@@ -108,6 +108,14 @@ export const ChatSurface = memo(function ChatSurface({
const [before = "", after = ""] = template.split(marker);
return { before, after };
}, [t]);
+ // A temporary home names its scope the same way: the scope word ("temporarily")
+ // is the switcher, so joining a project needs no extra control (#2455).
+ const temporaryTitleParts = useMemo(() => {
+ const marker = "__SCOPE__";
+ const template = t("chat.emptyTitleTemporaryScoped", { scope: marker });
+ const [before = "", after = ""] = template.split(marker);
+ return { before, after };
+ }, [t]);
// The head of the retained order is the session on screen. It equals
// `activeSessionId` except during a cold switch, where the destination has no
@@ -184,12 +192,15 @@ export const ChatSurface = memo(function ChatSurface({
{emptyTitleParts.after}
</>
) : isTemporarySession ? (
- t("chat.emptyTitleTemporary")
+ <>
+ {temporaryTitleParts.before}
+ <HomeProjectSwitcher temporary name={t("chat.temporaryScope")} />
+ {temporaryTitleParts.after}
+ </>
) : (
t("chat.emptyTitle")
)}
</h1>
- {heroProject ? null : <HomeProjectSwitcher variant="chip" />}
</div>
</div>
</div>
diff --git a/apps/desktop/src/components/HomeProjectSwitcher.tsx b/apps/desktop/src/components/HomeProjectSwitcher.tsx
index cd327a284..784946772 100644
--- a/apps/desktop/src/components/HomeProjectSwitcher.tsx
+++ b/apps/desktop/src/components/HomeProjectSwitcher.tsx
@@ -19,7 +19,6 @@ import {
IconBranch,
IconChat,
IconCheck,
- IconChevronDown,
IconChevronLeft,
IconFolder,
IconNewProject,
@@ -44,19 +43,20 @@ type ProjectMenuEntry = {
const TEMPORARY_KEY = "temporary";
/**
- * The empty home's project picker. Inside a project it is the underlined
- * project name in the title; for a temporary conversation (or no session) it
- * is a quiet "No project" caption under the title. Both list "No project" first so
- * the next task can leave or join a project from the same place (#2455).
+ * The empty home's project picker: the underlined word in the title. In a
+ * project it is the project name; in a temporary conversation it is the scope
+ * word ("temporarily"). Both menus list "No project" first so the next task
+ * can leave or join a project from the same place (#2455).
*/
export function HomeProjectSwitcher({
name,
path,
- variant = "inline",
+ temporary = false,
}: {
- name?: string;
+ name: string;
path?: string | null;
- variant?: "inline" | "chip";
+ /** The trigger is the temporary home's scope word rather than a project. */
+ temporary?: boolean;
}) {
const { t } = useTranslation();
const openProjectPaths = useAppStore((state) => state.openProjectPaths);
@@ -110,7 +110,7 @@ export function HomeProjectSwitcher({
);
const activeKey = isRemoteSession(activeSession) && activeSession?.remoteHostKey && activeSession.remoteProjectId
? `remote:${remoteProjectKey(activeSession.remoteHostKey, activeSession.remoteProjectId)}`
- : normalizeProjectPath(activeProjectPath ?? path) || (variant === "chip" ? TEMPORARY_KEY : "");
+ : normalizeProjectPath(activeProjectPath ?? path) || (temporary ? TEMPORARY_KEY : "");
const cloneTarget = parseGitCloneUrl(cloneUrl, {
allowInsecureHttp: allowInsecureUserEndpoints(settings),
});
@@ -282,22 +282,7 @@ export function HomeProjectSwitcher({
setCloneUrl("");
setOpen(true);
};
- return variant === "chip" ? (
- <button
- ref={ref}
- type="button"
- className="home-project-chip"
- data-testid="home-project-switcher"
- aria-label={`${t("project.switchProject")}: ${t("project.noProject")}`}
- aria-haspopup="menu"
- aria-expanded={open}
- disabled={busy}
- onClick={toggle}
- >
- <span>{t("project.noProject")}</span>
- <IconChevronDown size={12} aria-hidden />
- </button>
- ) : (
+ return (
<button
ref={ref}
type="button"
@@ -305,8 +290,8 @@ export function HomeProjectSwitcher({
data-testid="home-project-switcher"
aria-haspopup="menu"
aria-expanded={open}
- aria-label={`${t("project.switchProject")}: ${name ?? ""}`}
- title={(workspace?.path === path ? workspace?.remote?.path : undefined) || path || t("project.switchProject")}
+ aria-label={`${t("project.switchProject")}: ${temporary ? t("project.noProject") : name}`}
+ title={temporary ? t("project.noProjectHint") : (workspace?.path === path ? workspace?.remote?.path : undefined) || path || t("project.switchProject")}
disabled={busy}
onClick={toggle}
>
diff --git a/apps/desktop/src/styles/chat-shell.css b/apps/desktop/src/styles/chat-shell.css
index ec3124155..098f61f52 100644
--- a/apps/desktop/src/styles/chat-shell.css
+++ b/apps/desktop/src/styles/chat-shell.css
@@ -826,48 +826,6 @@
border-radius: var(--radius-3xs);
}
-/* A caption, not a control: it states the scope and only reveals itself on hover. */
-.empty-hero .home-project-chip {
- display: inline-flex;
- align-items: center;
- gap: 3px;
- margin-top: -4px;
- padding: 2px 6px;
- border: 0;
- border-radius: var(--radius-3xs);
- background: transparent;
- color: var(--ds-text-faint);
- font-size: var(--text-sm);
- line-height: var(--leading-compact);
- cursor: pointer;
- transition: color 150ms ease;
-}
-
-.empty-hero .home-project-chip svg {
- opacity: 0.7;
-}
-
-.empty-hero .home-project-chip:hover,
-.empty-hero .home-project-chip[aria-expanded="true"] {
- color: var(--ds-text-secondary);
-}
-
-.empty-hero .home-project-chip:focus-visible {
- outline: 2px solid var(--ds-focus);
- outline-offset: 2px;
-}
-
-.empty-hero .home-project-chip:disabled {
- cursor: default;
- opacity: 0.6;
-}
-
-@media (prefers-reduced-motion: reduce) {
- .empty-hero .home-project-chip {
- transition: none;
- }
-}
-
.home-project-switcher-menu {
position: fixed;
top: 0;
diff --git a/apps/desktop/test/home-project-name.test.mjs b/apps/desktop/test/home-project-name.test.mjs
index 6e27fbefe..568becbcb 100644
--- a/apps/desktop/test/home-project-name.test.mjs
+++ b/apps/desktop/test/home-project-name.test.mjs
@@ -104,11 +104,15 @@ test("the empty home names the project even before its first session exists", as
activeProjectPath: "/work/demo-app",
});
assert.equal(temporary.kind, "temporary");
+ // The title reads as the plain temporary copy, with its scope word as the
+ // project switcher, and never names the open project.
assert.equal(
- temporary.title,
+ temporary.title.replace(/<[^>]+>/g, ""),
catalogs.en.chat.emptyTitleTemporary,
"a temporary session must not inherit the open project's name",
);
+ assert.match(temporary.title, /class="project-underline-name">temporarily<\/span>/);
+ assert.doesNotMatch(temporary.title, /Demo App/);
// With no project and no session the generic home title is still correct.
const bare = render({});
diff --git a/apps/desktop/test/home-project-switcher.test.mjs b/apps/desktop/test/home-project-switcher.test.mjs
index 8a0594132..b445c6875 100644
--- a/apps/desktop/test/home-project-switcher.test.mjs
+++ b/apps/desktop/test/home-project-switcher.test.mjs
@@ -75,16 +75,13 @@ test("home project switcher trigger is the underlined name without a chevron", (
);
});
-test("home project switcher lists No project first and has a chip for temporary homes (#2455)", () => {
+test("home project switcher lists No project first; a temporary home underlines its scope (#2455)", () => {
assert.match(switcher, /key: TEMPORARY_KEY, name: temporaryLabel/);
assert.match(switcher, /if \(project\.temporary\) return selectTemporary\(\);/);
assert.match(switcher, /await newSession\(\{ projectPath: null \}\)/);
- assert.match(switcher, /className="home-project-chip"/);
- // The temporary home states its scope quietly instead of a bordered chip.
- assert.match(switcher, /<span>\{t\("project\.noProject"\)\}<\/span>/);
- // A temporary or projectless home offers the chip; a project home keeps
- // the underlined name in its title.
- assert.match(chatSurface, /\{heroProject \? null : <HomeProjectSwitcher variant="chip" \/>\}/);
- assert.match(styles, /\.empty-hero \.home-project-chip \{[\s\S]*?color:\s*var\(--ds-text-faint\);/);
- assert.doesNotMatch(styles, /\.empty-hero \.home-project-chip \{[^}]*border:\s*1px/);
+ // No extra control under the title: the scope word in the title is the trigger.
+ assert.doesNotMatch(switcher, /home-project-chip/);
+ assert.doesNotMatch(styles, /home-project-chip/);
+ assert.match(chatSurface, /<HomeProjectSwitcher temporary name=\{t\("chat\.temporaryScope"\)\} \/>/);
+ assert.match(chatSurface, /t\("chat\.emptyTitleTemporaryScoped", \{ scope: marker \}\)/);
});
diff --git a/apps/desktop/test/temporary-session-workspace.test.mjs b/apps/desktop/test/temporary-session-workspace.test.mjs
index 19ea5d148..96dd7606e 100644
--- a/apps/desktop/test/temporary-session-workspace.test.mjs
+++ b/apps/desktop/test/temporary-session-workspace.test.mjs
@@ -17,14 +17,14 @@ test("temporary empty home has a distinct session state without project actions"
/const isTemporarySession = Boolean\([\s\S]*!activeSession\.projectPath\?\.trim\(\)/,
);
assert.match(chatSurface, /data-home-session-kind/);
- assert.match(chatSurface, /t\("chat\.emptyTitleTemporary"\)/);
+ assert.match(chatSurface, /t\("chat\.emptyTitleTemporaryScoped"/);
assert.doesNotMatch(
chatSurface,
/empty-hero-subtitle|emptySubtitle(?:Temporary)?/,
);
assert.match(
chatSurface,
- /heroProject \? \([\s\S]*?\) : isTemporarySession \? \([\s\S]*?emptyTitleTemporary/,
+ /heroProject \? \([\s\S]*?\) : isTemporarySession \? \([\s\S]*?temporaryTitleParts/,
);
assert.match(en, /emptyTitleTemporary:/);
assert.doesNotMatch(en, /emptySubtitle(?:Temporary)?:/);
diff --git a/docs/spec/04-ux/01-ui-ia.md b/docs/spec/04-ux/01-ui-ia.md
index 68ada0595..b1a4bca6a 100644
--- a/docs/spec/04-ux/01-ui-ia.md
+++ b/docs/spec/04-ux/01-ui-ia.md
@@ -502,10 +502,10 @@ shared capability contract:
switcher of the sidebar's open projects instead of the folder picker. An
open project with no session yet names the hero the same way, because that
empty home already belongs to it and a task started there lands in the
- project. A temporary session shows dedicated temporary-chat copy, and with
- no project open the generic welcome title stands; both show a quiet,
- borderless "No project" caption under the title that opens the same
- switcher. The switcher
+ project. A temporary session shows dedicated temporary-chat copy whose scope
+ word ("temporarily" / 临时) is underlined like a project name and opens the
+ same switcher; with no project and no session the generic welcome title
+ stands. The switcher
lists "No project" first, so the next task can leave or join a project from
the empty home.
- New task resolves the temporary group by its most recent session: if that
diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.ts
index f891bebd9..d872113e1 100644
--- a/packages/i18n/src/locales/de/index.ts
+++ b/packages/i18n/src/locales/de/index.ts
@@ -369,6 +369,8 @@ export const de = {
"emptyTitle": "Was kann ich Ihnen beim Aufbau helfen?",
"emptyTitleInProject": "Was können wir in {{project}} bauen?",
"emptyTitleTemporary": "Was würden Sie gerne vorübergehend erkunden?",
+ "emptyTitleTemporaryScoped": "Was würden Sie gerne {{scope}} erkunden?",
+ "temporaryScope": "vorübergehend",
"placeholder": "Bitten Sie PI-Desktop um Hilfe bei allem",
"placeholderHome": "Fragen Sie alles",
"placeholderHint": "Geben Sie / für Befehle · @ für Dateien ein",
diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.ts
index efe039712..bf296bb47 100644
--- a/packages/i18n/src/locales/en/index.ts
+++ b/packages/i18n/src/locales/en/index.ts
@@ -376,6 +376,8 @@ deleteRunningSessionBlocked: "Stop the running session before deleting it.",
emptyTitle: "What can I help you build?",
emptyTitleInProject: "What can we build in {{project}}?",
emptyTitleTemporary: "What would you like to explore temporarily?",
+ emptyTitleTemporaryScoped: "What would you like to explore {{scope}}?",
+ temporaryScope: "temporarily",
placeholder: "Ask PI-Desktop to help with anything",
placeholderHome: "Ask anything",
placeholderHint: "Type / for commands · @ for files",
diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.ts
index b8221cca6..fd267f413 100644
--- a/packages/i18n/src/locales/es/index.ts
+++ b/packages/i18n/src/locales/es/index.ts
@@ -369,6 +369,8 @@ export const es = {
"emptyTitle": "¿Qué puedo ayudarte a construir?",
"emptyTitleInProject": "¿Qué podemos construir en {{project}}?",
"emptyTitleTemporary": "¿Qué te gustaría explorar temporalmente?",
+ "emptyTitleTemporaryScoped": "¿Qué te gustaría explorar {{scope}}?",
+ "temporaryScope": "temporalmente",
"placeholder": "Pídale ayuda a PI-Desktop con cualquier cosa",
"placeholderHome": "Pregunte cualquier cosa",
"placeholderHint": "Escriba / para comandos · @ para archivos",
diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.ts
index d9de75c96..126ea6bc9 100644
--- a/packages/i18n/src/locales/fr/index.ts
+++ b/packages/i18n/src/locales/fr/index.ts
@@ -369,6 +369,8 @@ export const fr = {
"emptyTitle": "Que puis-je vous aider à créer ?",
"emptyTitleInProject": "Que pouvons-nous construire dans {{project}} ?",
"emptyTitleTemporary": "Qu'aimeriez-vous explorer temporairement ?",
+ "emptyTitleTemporaryScoped": "Qu'aimeriez-vous explorer {{scope}} ?",
+ "temporaryScope": "temporairement",
"placeholder": "Demandez à PI-Desktop de vous aider pour tout",
"placeholderHome": "Demandez n'importe quoi",
"placeholderHint": "Tapez / pour les commandes · @ pour les fichiers",
diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.ts
index b9589f5a2..27e194de1 100644
--- a/packages/i18n/src/locales/ko/index.ts
+++ b/packages/i18n/src/locales/ko/index.ts
@@ -378,6 +378,8 @@ export const ko = {
emptyTitle: "무엇을 만들어 볼까요?",
emptyTitleInProject: "{{project}}에서 무엇을 만들어 볼까요?",
emptyTitleTemporary: "무엇을 임시로 탐색해 볼까요?",
+ emptyTitleTemporaryScoped: "무엇을 {{scope}} 탐색해 볼까요?",
+ temporaryScope: "임시로",
placeholder: "PI-Desktop에 무엇이든 도움을 요청하세요",
placeholderHome: "무엇이든 물어보세요",
placeholderHint: "명령은 / · 파일은 @ 입력",
diff --git a/packages/i18n/src/locales/pt-BR/index.ts b/packages/i18n/src/locales/pt-BR/index.ts
index d108dd456..49d72ab1c 100644
--- a/packages/i18n/src/locales/pt-BR/index.ts
+++ b/packages/i18n/src/locales/pt-BR/index.ts
@@ -368,6 +368,8 @@ export const ptBR = {
emptyTitle: "Como posso ajudar você a construir?",
emptyTitleInProject: "O que podemos construir em {{project}}?",
emptyTitleTemporary: "O que você gostaria de explorar temporariamente?",
+ emptyTitleTemporaryScoped: "O que você gostaria de explorar {{scope}}?",
+ temporaryScope: "temporariamente",
placeholder: "Peça ajuda ao PI-Desktop para qualquer tarefa",
placeholderHome: "Pergunte qualquer coisa",
placeholderHint: "Digite / para comandos · @ para arquivos",
diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.ts
index 1cc7d7c21..033a875f1 100644
--- a/packages/i18n/src/locales/tr/index.ts
+++ b/packages/i18n/src/locales/tr/index.ts
@@ -378,6 +378,8 @@ export const tr = {
emptyTitle: "Neyi birlikte oluşturalım?",
emptyTitleInProject: "{{project}} içinde ne oluşturalım?",
emptyTitleTemporary: "Geçici olarak neyi keşfetmek istersiniz?",
+ emptyTitleTemporaryScoped: "{{scope}} neyi keşfetmek istersiniz?",
+ temporaryScope: "Geçici olarak",
placeholder: "PI-Desktop’tan herhangi bir konuda yardım isteyin",
placeholderHome: "Bir şey sorun",
placeholderHint: "Komutlar için / · dosyalar için @ yazın",
diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.ts
index d75a0819d..14f6a8197 100644
--- a/packages/i18n/src/locales/zh-CN/index.ts
+++ b/packages/i18n/src/locales/zh-CN/index.ts
@@ -371,6 +371,8 @@ deleteRunningSessionBlocked: "请先停止运行中的会话,再删除它。",
emptyTitle: "今天想做点什么?",
emptyTitleInProject: "今天想在 {{project}} 里做点什么?",
emptyTitleTemporary: "临时聊点什么?",
+ emptyTitleTemporaryScoped: "{{scope}}聊点什么?",
+ temporaryScope: "临时",
placeholder: "让 PI-Desktop 帮你做任何事",
placeholderHome: "随便问问",
placeholderHint: "输入 / 使用命令 · @ 引用文件",
diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.ts
index 7ce89e530..1a150d488 100644
--- a/packages/i18n/src/locales/zh-TW/index.ts
+++ b/packages/i18n/src/locales/zh-TW/index.ts
@@ -371,6 +371,8 @@ deleteRunningSessionBlocked: "請先停止執行中的會話,再刪除它。",
emptyTitle: "今天想做點什麼?",
emptyTitleInProject: "今天想在 {{project}} 裡做點什麼?",
emptyTitleTemporary: "臨時聊點什麼?",
+ emptyTitleTemporaryScoped: "{{scope}}聊點什麼?",
+ temporaryScope: "臨時",
placeholder: "讓 PI-Desktop 幫你做任何事",
placeholderHome: "隨便問問",
placeholderHint: "輸入 / 使用命令 · @ 引用檔案",