🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(project): load desktop conversations opened by project slug, restore sandbox picker padding (#22600)
Arvin Xu2e3979b2652d
diff --git a/src/features/ChatInput/ControlBar/SandboxDrivePicker.tsx b/src/features/ChatInput/ControlBar/SandboxDrivePicker.tsxindex 05a529db4a8..714b4fc0af2 100644--- a/src/features/ChatInput/ControlBar/SandboxDrivePicker.tsx+++ b/src/features/ChatInput/ControlBar/SandboxDrivePicker.tsx@@ -35,6 +35,7 @@ const styles = stylex.create({gap: 6,justifyContent: 'space-between',paddingBlock: 4,+ paddingInline: 8,},headerInfo: {color: cssVar.colorTextQuaternary,@@ -53,10 +54,6 @@ const styles = stylex.create({paddingBlock: 8,paddingInline: 8,},- // Applied after the row's defaults through xstyle.- option: {- paddingInline: 0,- },warning: {color: cssVar.colorWarning,},@@ -212,7 +209,6 @@ const SandboxDrivePicker = memo<SandboxDrivePickerProps>(desc={t('sandboxStorage.ephemeralDesc')}icon={<Icon icon={TimerIcon} size={16} />}label={t('sandboxStorage.ephemeral')}- xstyle={styles.option}onClick={() => void select({})}/>@@ -221,7 +217,6 @@ const SandboxDrivePicker = memo<SandboxDrivePickerProps>(activeicon={<Icon icon={currentIcon} size={16} />}label={currentLabel}- xstyle={styles.option}desc={value.instanceId? t('sandboxDrive.environmentDesc')@@ -243,7 +238,6 @@ const SandboxDrivePicker = memo<SandboxDrivePickerProps>(desc={t('sandboxDrive.browseDesc')}icon={<Icon icon={persistent ? FolderOpenIcon : HardDriveIcon} size={16} />}label={t(persistent ? 'sandboxDrive.browseOther' : 'sandboxDrive.browse')}- xstyle={styles.option}onClick={openBrowser}/>)}@@ -257,7 +251,6 @@ const SandboxDrivePicker = memo<SandboxDrivePickerProps>(icon={<Icon icon={FolderClockIcon} size={16} />}label={t('sandboxDrive.upsell')}tag={t('pro', { ns: 'common' })}- xstyle={styles.option}onClick={() => {setOpen(false);openSandboxStorageUpsell();diff --git a/src/features/ChatInput/ControlBar/SandboxEnvironmentPicker.tsx b/src/features/ChatInput/ControlBar/SandboxEnvironmentPicker.tsxindex 6510fd8123b..6a7265afe8e 100644--- a/src/features/ChatInput/ControlBar/SandboxEnvironmentPicker.tsx+++ b/src/features/ChatInput/ControlBar/SandboxEnvironmentPicker.tsx@@ -26,6 +26,7 @@ const styles = stylex.create({gap: 6,justifyContent: 'space-between',paddingBlock: 4,+ paddingInline: 8,},headerTitle: {color: cssVar.colorTextTertiary,@@ -36,6 +37,7 @@ const styles = stylex.create({color: cssVar.colorTextDescription,fontSize: 11,paddingBlockEnd: 4,+ paddingInline: 8,},list: {maxHeight: 280,@@ -53,10 +55,6 @@ const styles = stylex.create({padding: 0,transition: 'color 0.2s',},- // Applied after the row's defaults through xstyle.- option: {- paddingInline: 0,- },});interface SandboxEnvironmentPickerProps {@@ -132,7 +130,6 @@ const SandboxEnvironmentPicker = memo<SandboxEnvironmentPickerProps>(({ onChangedesc={t('sandboxEnvironment.noneDesc')}icon={<Icon icon={CircleSlashIcon} size={16} />}label={t('sandboxEnvironment.none')}- xstyle={styles.option}onClick={() => void select(undefined)}/><div {...stylex.props(styles.list)}>@@ -143,7 +140,6 @@ const SandboxEnvironmentPicker = memo<SandboxEnvironmentPickerProps>(({ onChangeicon={<Icon icon={PackageIcon} size={16} />}key={environment.id}label={environment.name}- xstyle={styles.option}onClick={() => void select(environment.id)}/>))}diff --git a/src/features/Conversation/useAgentConversationCoordinate.desktop.test.ts b/src/features/Conversation/useAgentConversationCoordinate.desktop.test.tsindex 31f44d125ec..af3ec413535 100644--- a/src/features/Conversation/useAgentConversationCoordinate.desktop.test.ts+++ b/src/features/Conversation/useAgentConversationCoordinate.desktop.test.ts@@ -6,6 +6,8 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';import { initialState as initialChatState } from '@/store/chat/initialState';import { useChatStore } from '@/store/chat/store';+import { useProjectStore } from '@/store/project';+import { PROJECT_LIST_KEY } from '@/store/project/projection';import { useProjectDirectoryStore } from '@/store/projectWorkingDirectory';import { useAgentConversationCoordinate } from './useAgentConversationCoordinate.desktop';@@ -71,6 +73,26 @@ describe('useAgentConversationCoordinate (desktop)', () => {expect(result.current).toEqual(['agent-of-topic', 'tpc_1', null]);});+ /** @example A project opened by slug left the conversation without an agent, so it never loaded. */+ it('resolves the agent when the project route carries its slug', () => {+ route.params = { projectId: 'my-project', topicId: 'tpc_1' };+ route.search = new URLSearchParams();+ useProjectStore.setState(+ {+ projectListMap: { [PROJECT_LIST_KEY]: [{ id: 'prj_1', slug: 'my-project' } as never] },+ },+ false,+ );+ useProjectDirectoryStore.setState(+ { projectTopicsMap: { prj_1: [{ agentId: 'agent-of-topic', id: 'tpc_1' } as never] } },+ false,+ );++ const { result } = renderHook(() => useAgentConversationCoordinate());++ expect(result.current).toEqual(['agent-of-topic', 'tpc_1', null]);+ });+/** @example Review: on desktop the sidebar "+" draft had no agent, so its first send was a no-op. */it('takes the agent of a blank project draft from its route', () => {route.params = { projectId: 'prj_1' };diff --git a/src/features/Conversation/useAgentConversationCoordinate.desktop.ts b/src/features/Conversation/useAgentConversationCoordinate.desktop.tsindex 7ba4adc8863..b7f7ae610b0 100644--- a/src/features/Conversation/useAgentConversationCoordinate.desktop.ts+++ b/src/features/Conversation/useAgentConversationCoordinate.desktop.ts@@ -1,6 +1,7 @@import { useParams, useSearchParams } from 'react-router';import { useResolvedAgentRouteId } from '@/features/AgentRoute/useResolvedAgentRouteId';+import { useProjectIdByRef } from '@/store/project';import { useProjectTopics } from '@/store/projectWorkingDirectory';export const useAgentConversationCoordinate = () => {@@ -10,7 +11,9 @@ export const useAgentConversationCoordinate = () => {// Project conversation routes carry :projectId/:topicId instead of :aid, so the// owning agent resolves from the project topic — still route-derived per tab,// never the global pointer (another tab may own it).- const projectTopics = useProjectTopics(params.aid ? undefined : params.projectId);+ // The route param may be the project's slug, while the topics are keyed by its id.+ const { id: projectId } = useProjectIdByRef(params.aid ? undefined : params.projectId);+ const projectTopics = useProjectTopics(projectId);// A blank draft a sidebar "+" opened has no topic yet; its owner rides in the// route (`?agent=`) and stays there through the first send's topic switch,// until the project list has the new topic.