diff --git a/apps/shinkai-app/src/components/ui/Avatar.tsx b/apps/shinkai-app/src/components/ui/Avatar.tsx index ad0b831f1..7c7aba6c2 100644 --- a/apps/shinkai-app/src/components/ui/Avatar.tsx +++ b/apps/shinkai-app/src/components/ui/Avatar.tsx @@ -1,7 +1,5 @@ import { IonAvatar } from '@ionic/react'; - -import { cn } from '../../theme/lib/utils'; - +import { cn } from '@shinkai_network/shinkai-ui/utils'; export default function Avatar({ url, className, @@ -11,11 +9,11 @@ export default function Avatar({ }) { return ( diff --git a/apps/shinkai-app/src/components/ui/Button.tsx b/apps/shinkai-app/src/components/ui/Button.tsx index 2e3aeafed..60434ff90 100644 --- a/apps/shinkai-app/src/components/ui/Button.tsx +++ b/apps/shinkai-app/src/components/ui/Button.tsx @@ -1,11 +1,10 @@ import './Button.css'; import { IonButton } from '@ionic/react'; +import { cn } from '@shinkai_network/shinkai-ui/utils'; import { Loader2 } from 'lucide-react'; import React from 'react'; -import { cn } from '../../theme/lib/utils'; - export default function Button({ onClick, disabled, @@ -28,14 +27,14 @@ export default function Button({ className={cn( 'ion-button-custom w-full', 'variant-' + variant, - className + className, )} disabled={disabled || isLoading} onClick={onClick} shape={'round'} type={type} > - {isLoading ? : null} + {isLoading ? : null} {children} ); diff --git a/apps/shinkai-app/src/components/ui/Input.tsx b/apps/shinkai-app/src/components/ui/Input.tsx index 0de33c00e..861140af4 100644 --- a/apps/shinkai-app/src/components/ui/Input.tsx +++ b/apps/shinkai-app/src/components/ui/Input.tsx @@ -3,11 +3,10 @@ import './Input.css'; import { InputCustomEvent } from '@ionic/core/dist/types/components/input/input-interface'; import { InputChangeEventDetail, IonInput } from '@ionic/react'; +import { cn } from '@shinkai_network/shinkai-ui/utils'; import type { Ref } from 'react'; import React from 'react'; -import { cn } from '../../theme/lib/utils'; - type InputProps = { onChange: (event: InputCustomEvent) => void; value: string; @@ -18,7 +17,7 @@ type InputProps = { const Input = React.forwardRef( ( { onChange, value, label, className }: InputProps, - ref: Ref + ref: Ref, ) => { return ( ); - } + }, ); Input.displayName = 'Input'; diff --git a/apps/shinkai-app/src/pages/Chat.tsx b/apps/shinkai-app/src/pages/Chat.tsx index e8df49f92..850c00c29 100644 --- a/apps/shinkai-app/src/pages/Chat.tsx +++ b/apps/shinkai-app/src/pages/Chat.tsx @@ -19,6 +19,7 @@ import { useSendMessageWithFilesToInbox } from '@shinkai_network/shinkai-node-st import { ChatConversationMessage } from '@shinkai_network/shinkai-node-state/lib/queries/getChatConversation/types'; import { useGetChatConversationWithPagination } from '@shinkai_network/shinkai-node-state/lib/queries/getChatConversation/useGetChatConversationWithPagination'; import { groupMessagesByDate } from '@shinkai_network/shinkai-node-state/lib/utils/date'; +import { cn } from '@shinkai_network/shinkai-ui/utils'; import MarkdownPreview from '@uiw/react-markdown-preview'; import { cameraOutline } from 'ionicons/icons'; import { send } from 'ionicons/icons'; @@ -34,7 +35,6 @@ import { IonHeaderCustom, } from '../components/ui/Layout'; import { useAuth } from '../store/auth'; -import { cn } from '../theme/lib/utils'; import { extractReceiverShinkaiName, getOtherPersonIdentity, diff --git a/apps/shinkai-app/src/pages/JobChat.tsx b/apps/shinkai-app/src/pages/JobChat.tsx index 2b25f1888..817a5fa70 100644 --- a/apps/shinkai-app/src/pages/JobChat.tsx +++ b/apps/shinkai-app/src/pages/JobChat.tsx @@ -25,6 +25,7 @@ import { useSendMessageToJob } from '@shinkai_network/shinkai-node-state/lib/mut import { useSendMessageWithFilesToInbox } from '@shinkai_network/shinkai-node-state/lib/mutations/sendMesssageWithFilesToInbox/useSendMessageWithFilesToInbox'; import { ChatConversationMessage } from '@shinkai_network/shinkai-node-state/lib/queries/getChatConversation/types'; import { useGetChatConversationWithPagination } from '@shinkai_network/shinkai-node-state/lib/queries/getChatConversation/useGetChatConversationWithPagination'; +import { cn } from '@shinkai_network/shinkai-ui/utils'; import MarkdownPreview from '@uiw/react-markdown-preview'; import { send } from 'ionicons/icons'; import { cameraOutline } from 'ionicons/icons'; @@ -39,7 +40,6 @@ import { IonHeaderCustom, } from '../components/ui/Layout'; import { useAuth } from '../store/auth'; -import { cn } from '../theme/lib/utils'; const groupMessagesByDate = (messages: ChatConversationMessage[]) => { const groupedMessages: Record = {}; diff --git a/apps/shinkai-desktop/src/components/chat/message.tsx b/apps/shinkai-desktop/src/components/chat/message.tsx index 299c52bf0..6a2a35f28 100644 --- a/apps/shinkai-desktop/src/components/chat/message.tsx +++ b/apps/shinkai-desktop/src/components/chat/message.tsx @@ -1,6 +1,6 @@ import type { ShinkaiMessage } from '@shinkai_network/shinkai-message-ts/models'; import { MessageSchemaType } from '@shinkai_network/shinkai-message-ts/models'; -import { extractErrorPropertyOrContent } from '@shinkai_network/shinkai-message-ts/utils/shinkai_message_handler'; +import { extractErrorPropertyOrContent } from '@shinkai_network/shinkai-message-ts/utils'; import { ChatConversationMessage } from '@shinkai_network/shinkai-node-state/lib/queries/getChatConversation/types'; import { Avatar, @@ -9,9 +9,9 @@ import { CopyToClipboardIcon, MarkdownPreview, } from '@shinkai_network/shinkai-ui'; +import { cn } from '@shinkai_network/shinkai-ui/utils'; import icon from '../../assets/icon.png'; -import { cn } from '../../lib/utils'; import { FileList } from '../../pages/create-job'; export const getMessageFilesInbox = ( diff --git a/apps/shinkai-desktop/src/lib/utils.ts b/apps/shinkai-desktop/src/lib/utils.ts deleted file mode 100644 index 9ad0df426..000000000 --- a/apps/shinkai-desktop/src/lib/utils.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { type ClassValue, clsx } from 'clsx'; -import { twMerge } from 'tailwind-merge'; - -export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)); -} diff --git a/apps/shinkai-desktop/src/pages/chat/chat-conversation.tsx b/apps/shinkai-desktop/src/pages/chat/chat-conversation.tsx index a3f94baea..c93d4f427 100644 --- a/apps/shinkai-desktop/src/pages/chat/chat-conversation.tsx +++ b/apps/shinkai-desktop/src/pages/chat/chat-conversation.tsx @@ -44,6 +44,7 @@ import { DirectoryTypeIcon, FileTypeIcon, } from '@shinkai_network/shinkai-ui/assets'; +import { cn } from '@shinkai_network/shinkai-ui/utils'; import { Placeholder } from '@tiptap/extension-placeholder'; import { EditorContent, Extension, useEditor } from '@tiptap/react'; import { StarterKit } from '@tiptap/starter-kit'; @@ -72,10 +73,8 @@ import { z } from 'zod'; import Message from '../../components/chat/message'; import { useGetCurrentInbox } from '../../hooks/use-current-inbox'; -import { cn } from '../../lib/utils'; import { useAuth } from '../../store/auth'; import { isImageOrPdf } from '../create-job'; - const chatSchema = z.object({ message: z.string(), file: z.any().optional(), diff --git a/apps/shinkai-desktop/src/pages/chat/layout.tsx b/apps/shinkai-desktop/src/pages/chat/layout.tsx index 9e7792a22..942198baf 100644 --- a/apps/shinkai-desktop/src/pages/chat/layout.tsx +++ b/apps/shinkai-desktop/src/pages/chat/layout.tsx @@ -1,6 +1,6 @@ import { zodResolver } from '@hookform/resolvers/zod'; // import { PlusCircledIcon } from '@radix-ui/react-icons'; -import { SmartInbox } from '@shinkai_network/shinkai-message-ts/models/ShinkaiMessage'; +import { SmartInbox } from '@shinkai_network/shinkai-message-ts/models'; import { getMessageContent, isJobInbox, @@ -35,6 +35,7 @@ import { ChatBubbleIcon, JobBubbleIcon, } from '@shinkai_network/shinkai-ui/assets'; +import { cn } from '@shinkai_network/shinkai-ui/utils'; import { Edit3, PlusIcon } from 'lucide-react'; import React, { useEffect, useMemo, useRef, useState } from 'react'; import { useForm } from 'react-hook-form'; @@ -43,7 +44,6 @@ import { toast } from 'sonner'; import { z } from 'zod'; import { handleSendNotification } from '../../lib/notifications'; -import { cn } from '../../lib/utils'; import { useAuth } from '../../store/auth'; const updateInboxNameSchema = z.object({ diff --git a/apps/shinkai-desktop/src/pages/create-agent.tsx b/apps/shinkai-desktop/src/pages/create-agent.tsx index cf47542a7..8d01aea77 100644 --- a/apps/shinkai-desktop/src/pages/create-agent.tsx +++ b/apps/shinkai-desktop/src/pages/create-agent.tsx @@ -1,5 +1,5 @@ import { zodResolver } from '@hookform/resolvers/zod'; -import { AgentAPIModel } from '@shinkai_network/shinkai-message-ts/models/SchemaTypes'; +import { AgentAPIModel } from '@shinkai_network/shinkai-message-ts/models'; import { useCreateAgent } from '@shinkai_network/shinkai-node-state/lib/mutations/createAgent/useCreateAgent'; import { useScanOllamaModels } from '@shinkai_network/shinkai-node-state/lib/queries/scanOllamaModels/useScanOllamaModels'; import { diff --git a/apps/shinkai-desktop/src/pages/create-job.tsx b/apps/shinkai-desktop/src/pages/create-job.tsx index d5ab43197..7d96f836f 100644 --- a/apps/shinkai-desktop/src/pages/create-job.tsx +++ b/apps/shinkai-desktop/src/pages/create-job.tsx @@ -1,5 +1,5 @@ import { zodResolver } from '@hookform/resolvers/zod'; -import { buildInboxIdFromJobId } from '@shinkai_network/shinkai-message-ts/utils/inbox_name_handler'; +import { buildInboxIdFromJobId } from '@shinkai_network/shinkai-message-ts/utils'; import { useCreateJob } from '@shinkai_network/shinkai-node-state/lib/mutations/createJob/useCreateJob'; import { useAgents } from '@shinkai_network/shinkai-node-state/lib/queries/getAgents/useGetAgents'; import { diff --git a/apps/shinkai-desktop/src/pages/restore-connection.tsx b/apps/shinkai-desktop/src/pages/restore-connection.tsx index 765f2de82..3c0ef42b7 100644 --- a/apps/shinkai-desktop/src/pages/restore-connection.tsx +++ b/apps/shinkai-desktop/src/pages/restore-connection.tsx @@ -1,5 +1,5 @@ import { zodResolver } from '@hookform/resolvers/zod'; -import { decryptMessageWithPassphrase } from '@shinkai_network/shinkai-message-ts/cryptography/shinkai-encryption'; +import { decryptMessageWithPassphrase } from '@shinkai_network/shinkai-message-ts/cryptography'; import { Button, buttonVariants, diff --git a/apps/shinkai-desktop/src/windows/toasts-utils.tsx b/apps/shinkai-desktop/src/windows/toasts-utils.tsx index 7e8220ae1..1cfd1b695 100644 --- a/apps/shinkai-desktop/src/windows/toasts-utils.tsx +++ b/apps/shinkai-desktop/src/windows/toasts-utils.tsx @@ -1,6 +1,6 @@ +import { cn } from '@shinkai_network/shinkai-ui/utils'; import { ExternalToast, toast } from 'sonner'; -import { cn } from '../lib/utils'; import { openShinkaiNodeManagerWindow } from './utils'; const ShinkaiNodeLogsLabel = ({ @@ -78,8 +78,8 @@ export const stoppingShinkaiNodeToast = () => { export const shinkaiNodeStopErrorToast = () => { toast.error(
- Error stopping your local Shinkai Node, see - {' '} for more information + Error stopping your local Shinkai Node, see for + more information
, { ...defaultToastOptions, @@ -100,8 +100,8 @@ export const stoppingOllamaToast = () => { export const ollamaStopErrorToast = () => { toast.error(
- Error stopping your local Ollama, see - {' '} for more information + Error stopping your local Ollama, see for more + information
, { ...defaultToastOptions, @@ -124,7 +124,7 @@ export const errorRemovingShinkaiNodeStorageToast = () => { return toast.error(
Error removing your local Shinkai Node storage, see{' '} - {' '} for more information + for more information
, { ...defaultToastOptions }, ); @@ -173,8 +173,8 @@ export const pullingModelDoneToast = (model: string) => { export const pullingModelErrorToast = (model: string) => { return toast.error(
- Error downloading AI model {model}, see - {' '} for more information + Error downloading AI model {model}, see for more + information
, { ...defaultToastOptions, diff --git a/apps/shinkai-desktop/tsconfig.json b/apps/shinkai-desktop/tsconfig.json index 8419ed2ff..5df8327c6 100644 --- a/apps/shinkai-desktop/tsconfig.json +++ b/apps/shinkai-desktop/tsconfig.json @@ -9,7 +9,25 @@ "types": ["vite/client", "vitest"], "noUnusedLocals": true, "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true + "noFallthroughCasesInSwitch": true, + "paths": { + "@shinkai_network/shinkai-ui": [ + "libs/shinkai-ui/src/components/index.ts" + ], + "@shinkai_network/shinkai-ui/hooks": [ + "libs/shinkai-ui/src/hooks/index.ts" + ], + "@shinkai_network/shinkai-ui/utils": ["libs/shinkai-ui/src/utils.ts"], + "@shinkai_network/shinkai-ui/assets": [ + "libs/shinkai-ui/src/assets/index.ts" + ], + "@shinkai_network/shinkai-message-ts/*": [ + "dist/libs/shinkai-message-ts/*" + ], + "@shinkai_network/shinkai-node-state/*": [ + "libs/shinkai-node-state/src/*.ts" + ] + } }, "files": [], "include": [], diff --git a/apps/shinkai-visor/src/components/node-files/all-files.tsx b/apps/shinkai-visor/src/components/node-files/all-files.tsx index 4ef51137b..a35cef018 100644 --- a/apps/shinkai-visor/src/components/node-files/all-files.tsx +++ b/apps/shinkai-visor/src/components/node-files/all-files.tsx @@ -33,13 +33,13 @@ import { FileTypeIcon, GenerateDocIcon, } from '@shinkai_network/shinkai-ui/assets'; +import { useDebounce } from '@shinkai_network/shinkai-ui/hooks'; import { cn } from '@shinkai_network/shinkai-ui/utils'; import { motion } from 'framer-motion'; import { ChevronRight, PlusIcon, SearchIcon, X, XIcon } from 'lucide-react'; import React, { useEffect } from 'react'; import { useHistory, useLocation } from 'react-router-dom'; -import { useDebounce } from '../../hooks/use-debounce'; import { useQuery } from '../../hooks/use-query'; import { useAuth } from '../../store/auth/auth'; import { useVectorFsStore, VectorFSLayout } from './node-file-context'; diff --git a/apps/shinkai-visor/src/components/subscriptions/public-shared-folders.tsx b/apps/shinkai-visor/src/components/subscriptions/public-shared-folders.tsx index a21e79841..e24c7cafe 100644 --- a/apps/shinkai-visor/src/components/subscriptions/public-shared-folders.tsx +++ b/apps/shinkai-visor/src/components/subscriptions/public-shared-folders.tsx @@ -22,13 +22,13 @@ import { ToggleGroupItem, } from '@shinkai_network/shinkai-ui'; import { SharedFolderIcon } from '@shinkai_network/shinkai-ui/assets'; +import { useDebounce } from '@shinkai_network/shinkai-ui/hooks'; import { useInView } from 'framer-motion'; import { Maximize2, Minimize2, SearchIcon, XIcon } from 'lucide-react'; import { Tree, TreeExpandedKeysType } from 'primereact/tree'; import { TreeNode as PrimeTreeNode } from 'primereact/treenode'; import React, { Fragment, useEffect, useRef, useState } from 'react'; -import { useDebounce } from '../../hooks/use-debounce'; import { useAuth } from '../../store/auth/auth'; import { treeOptions } from '../create-job/constants'; import { diff --git a/apps/shinkai-visor/src/helpers/cn-utils.ts b/apps/shinkai-visor/src/helpers/cn-utils.ts deleted file mode 100644 index 1f5046c65..000000000 --- a/apps/shinkai-visor/src/helpers/cn-utils.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { type ClassValue,clsx } from 'clsx'; -import { twMerge } from 'tailwind-merge'; - -export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)); -}