diff --git a/extension/app/src/components/auth/AuthProvider.tsx b/extension/app/src/components/auth/AuthProvider.tsx index 8a83f23264c2..bb4df4c99eb6 100644 --- a/extension/app/src/components/auth/AuthProvider.tsx +++ b/extension/app/src/components/auth/AuthProvider.tsx @@ -1,4 +1,4 @@ -import type { LightWorkspaceType } from "@dust-tt/client"; +import type { ExtensionWorkspaceType } from "@dust-tt/client"; import { useAuthHook } from "@extension/components/auth/useAuth"; import type { AuthError } from "@extension/lib/auth"; import type { StoredUser } from "@extension/lib/storage"; @@ -11,7 +11,7 @@ type AuthContextType = { authError: AuthError | null; setAuthError: (error: AuthError | null) => void; user: StoredUser | null; - workspace: LightWorkspaceType | undefined; + workspace: ExtensionWorkspaceType | undefined; isUserSetup: boolean; isLoading: boolean; handleLogin: (isForceLogin: boolean) => void; diff --git a/extension/app/src/components/auth/ProtectedRoute.tsx b/extension/app/src/components/auth/ProtectedRoute.tsx index 6001f3de5473..fd0d69cb9788 100644 --- a/extension/app/src/components/auth/ProtectedRoute.tsx +++ b/extension/app/src/components/auth/ProtectedRoute.tsx @@ -1,4 +1,4 @@ -import type { LightWorkspaceType } from "@dust-tt/client"; +import type { ExtensionWorkspaceType } from "@dust-tt/client"; import { Button, LogoHorizontalColorLogo, @@ -19,7 +19,7 @@ type ProtectedRouteProps = { export type ProtectedRouteChildrenProps = { user: StoredUser; - workspace: LightWorkspaceType; + workspace: ExtensionWorkspaceType; handleLogout: () => void; }; diff --git a/extension/app/src/components/conversation/ConversationContainer.tsx b/extension/app/src/components/conversation/ConversationContainer.tsx index d0ecf34b4074..1c142114bf7a 100644 --- a/extension/app/src/components/conversation/ConversationContainer.tsx +++ b/extension/app/src/components/conversation/ConversationContainer.tsx @@ -1,7 +1,7 @@ import type { AgentMentionType, ContentFragmentType, - LightWorkspaceType, + ExtensionWorkspaceType, } from "@dust-tt/client"; import { Page, useSendNotification } from "@dust-tt/sparkle"; import { ConversationViewer } from "@extension/components/conversation/ConversationViewer"; @@ -35,7 +35,7 @@ import { useNavigate } from "react-router-dom"; interface ConversationContainerProps { conversationId: string | null; - owner: LightWorkspaceType; + owner: ExtensionWorkspaceType; user: StoredUser; } diff --git a/extension/app/src/components/input_bar/InputBar.tsx b/extension/app/src/components/input_bar/InputBar.tsx index 9f005944d0d0..5c09a0c0feaf 100644 --- a/extension/app/src/components/input_bar/InputBar.tsx +++ b/extension/app/src/components/input_bar/InputBar.tsx @@ -1,8 +1,8 @@ import type { AgentMentionType, ConversationPublicType, + ExtensionWorkspaceType, LightAgentConfigurationType, - LightWorkspaceType, } from "@dust-tt/client"; import { Button, Page, Spinner, StopIcon } from "@dust-tt/sparkle"; import { usePublicAgentConfigurations } from "@extension/components/assistants/usePublicAgentConfigurations"; @@ -37,7 +37,7 @@ export function AssistantInputBar({ setIncludeTab, isSubmitting, }: { - owner: LightWorkspaceType; + owner: ExtensionWorkspaceType; onSubmit: ( input: string, mentions: AgentMentionType[], diff --git a/extension/app/src/components/input_bar/InputBarContainer.tsx b/extension/app/src/components/input_bar/InputBarContainer.tsx index 34a4327fa4f8..a0247550fc2f 100644 --- a/extension/app/src/components/input_bar/InputBarContainer.tsx +++ b/extension/app/src/components/input_bar/InputBarContainer.tsx @@ -1,7 +1,7 @@ import type { AgentMentionType, + ExtensionWorkspaceType, LightAgentConfigurationType, - LightWorkspaceType, } from "@dust-tt/client"; import { SplitButton } from "@dust-tt/sparkle"; import { AssistantPicker } from "@extension/components/assistants/AssistantPicker"; @@ -21,7 +21,7 @@ export interface InputBarContainerProps { allAssistants: LightAgentConfigurationType[]; agentConfigurations: LightAgentConfigurationType[]; onEnterKeyDown: CustomEditorProps["onEnterKeyDown"]; - owner: LightWorkspaceType; + owner: ExtensionWorkspaceType; selectedAssistant: AgentMentionType | null; stickyMentions?: AgentMentionType[]; disableAutoFocus: boolean; diff --git a/extension/app/src/lib/auth.ts b/extension/app/src/lib/auth.ts index 3a9271ed51f8..48a7b572e4a4 100644 --- a/extension/app/src/lib/auth.ts +++ b/extension/app/src/lib/auth.ts @@ -8,7 +8,7 @@ import { import type { StoredTokens, StoredUser, - UserTypeWithWorkspaces, + UserTypeWithExtensionWorkspaces, } from "@extension/lib/storage"; import { clearStoredData, @@ -115,7 +115,7 @@ export const getAccessToken = async (): Promise => { // Fetch me sends a request to the /me route to get the user info. const fetchMe = async ( token: string -): Promise> => { +): Promise> => { const response = await fetch(`${process.env.DUST_DOMAIN}/api/v1/me`, { headers: { Authorization: `Bearer ${token}`, diff --git a/extension/app/src/lib/storage.ts b/extension/app/src/lib/storage.ts index 0eaaaece3def..10658bf5b3a9 100644 --- a/extension/app/src/lib/storage.ts +++ b/extension/app/src/lib/storage.ts @@ -1,8 +1,14 @@ -import type { ContentFragmentType, MeResponseType } from "@dust-tt/client"; +import type { + ContentFragmentType, + ExtensionWorkspaceType, + UserType, +} from "@dust-tt/client"; import type { Auth0AuthorizeResponse } from "@extension/lib/messages"; import type { UploadedFileWithKind } from "@extension/lib/types"; -export type UserTypeWithWorkspaces = MeResponseType["user"]; +export type UserTypeWithExtensionWorkspaces = UserType & { + workspaces: ExtensionWorkspaceType[]; +}; export type StoredTokens = { accessToken: string; @@ -10,7 +16,7 @@ export type StoredTokens = { expiresAt: number; }; -export type StoredUser = UserTypeWithWorkspaces & { +export type StoredUser = UserTypeWithExtensionWorkspaces & { selectedWorkspace: string | null; }; @@ -75,7 +81,7 @@ export const setConversationsContext = async ( */ export const saveUser = async ( - user: UserTypeWithWorkspaces + user: UserTypeWithExtensionWorkspaces ): Promise => { const storedUser: StoredUser = { ...user,