diff --git a/.vscode/settings.json b/.vscode/settings.json index cb162e50a..cf941992b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -20,6 +20,5 @@ "rust-analyzer.checkOnSave": true, "rust-analyzer.check.allTargets": true, "rust-analyzer.cargo.targetDir": "target/analyzer", - "rust-analyzer.cargo.extraEnv": { "MACOSX_DEPLOYMENT_TARGET": "14.2" }, - "rust-analyzer.cargo.features": ["v1"] + "rust-analyzer.cargo.extraEnv": { "MACOSX_DEPLOYMENT_TARGET": "14.2" } } diff --git a/Cargo.lock b/Cargo.lock index e917b07bf..d6038cf94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14149,27 +14149,6 @@ dependencies = [ "thiserror 2.0.17", ] -[[package]] -name = "tauri-plugin-connector" -version = "0.1.0" -dependencies = [ - "reqwest 0.12.24", - "serde", - "serde_json", - "specta", - "specta-typescript", - "strum 0.26.3", - "tauri", - "tauri-plugin", - "tauri-plugin-auth", - "tauri-plugin-local-llm", - "tauri-plugin-local-stt", - "tauri-plugin-store2", - "tauri-specta", - "thiserror 2.0.17", - "url", -] - [[package]] name = "tauri-plugin-db" version = "0.1.0" @@ -14283,8 +14262,6 @@ dependencies = [ "chrono", "codes-iso-639", "data", - "db-core", - "db-user", "dirs 6.0.0", "futures-util", "hound", @@ -14306,8 +14283,6 @@ dependencies = [ "tauri", "tauri-plugin", "tauri-plugin-auth", - "tauri-plugin-connector", - "tauri-plugin-db", "tauri-plugin-local-stt", "tauri-plugin-shell", "tauri-plugin-tray", diff --git a/Cargo.toml b/Cargo.toml index 70f136cfc..1ed66bebc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -112,7 +112,6 @@ tauri-plugin-updater = "2.9" tauri-plugin-analytics = { path = "plugins/analytics" } tauri-plugin-apple-calendar = { path = "plugins/apple-calendar" } tauri-plugin-auth = { path = "plugins/auth" } -tauri-plugin-connector = { path = "plugins/connector" } tauri-plugin-db = { path = "plugins/db" } tauri-plugin-db2 = { path = "plugins/db2" } tauri-plugin-listener = { path = "plugins/listener" } diff --git a/apps/desktop2/package.json b/apps/desktop2/package.json index df2db9431..2f42f119a 100644 --- a/apps/desktop2/package.json +++ b/apps/desktop2/package.json @@ -52,6 +52,7 @@ "dompurify": "^3.3.0", "lucide-react": "^0.544.0", "motion": "^11.18.2", + "mutative": "^1.3.0", "re-resizable": "^6.11.2", "react": "^19.2.0", "react-dom": "^19.2.0", diff --git a/apps/desktop2/src-tauri/Cargo.toml b/apps/desktop2/src-tauri/Cargo.toml index eb019055e..ec6a01958 100644 --- a/apps/desktop2/src-tauri/Cargo.toml +++ b/apps/desktop2/src-tauri/Cargo.toml @@ -26,8 +26,8 @@ tauri-plugin-db2 = { workspace = true } tauri-plugin-deep-link = { workspace = true } tauri-plugin-dialog = { workspace = true } tauri-plugin-fs = { workspace = true } -tauri-plugin-listener = { workspace = true, features = ["v1"] } -tauri-plugin-local-stt = { workspace = true, features = ["v1"] } +tauri-plugin-listener = { workspace = true } +tauri-plugin-local-stt = { workspace = true } tauri-plugin-opener = { workspace = true } tauri-plugin-os = { workspace = true } tauri-plugin-process = { workspace = true } @@ -36,9 +36,9 @@ tauri-plugin-single-instance = { workspace = true } tauri-plugin-store = { workspace = true } tauri-plugin-store2 = { workspace = true } tauri-plugin-tracing = { workspace = true } -tauri-plugin-tray = { workspace = true, features = ["v1"] } +tauri-plugin-tray = { workspace = true } tauri-plugin-updater = { workspace = true } -tauri-plugin-windows = { workspace = true, default-features = false, features = ["v1"] } +tauri-plugin-windows = { workspace = true, default-features = false } specta = { workspace = true } specta-typescript = { workspace = true } diff --git a/apps/desktop2/src-tauri/capabilities/default.json b/apps/desktop2/src-tauri/capabilities/default.json index de40b7cd1..dd6b57991 100644 --- a/apps/desktop2/src-tauri/capabilities/default.json +++ b/apps/desktop2/src-tauri/capabilities/default.json @@ -30,6 +30,7 @@ "store:default", "process:default", "local-stt:default", - "dialog:default" + "dialog:default", + "listener:default" ] } diff --git a/apps/desktop2/src/components/chat/index.tsx b/apps/desktop2/src/components/chat/index.tsx index daca31e91..7c7ee2187 100644 --- a/apps/desktop2/src/components/chat/index.tsx +++ b/apps/desktop2/src/components/chat/index.tsx @@ -1,6 +1,6 @@ import { useCallback } from "react"; -import { commands as windowsCommands } from "@hypr/plugin-windows/v1"; +import { commands as windowsCommands } from "@hypr/plugin-windows"; import { useShell } from "../../contexts/shell"; import { useAutoCloser } from "../../hooks/useAutoCloser"; import { InteractiveContainer } from "./interactive"; diff --git a/apps/desktop2/src/components/main/body/sessions/floating/generate.tsx b/apps/desktop2/src/components/main/body/sessions/floating/generate.tsx index 47e68c820..2efc6c447 100644 --- a/apps/desktop2/src/components/main/body/sessions/floating/generate.tsx +++ b/apps/desktop2/src/components/main/body/sessions/floating/generate.tsx @@ -56,7 +56,6 @@ export function GenerateButton() { } - style={{ zIndex: 10 }} onMouseEnter={() => setShowTemplates(true)} onMouseLeave={() => setShowTemplates(false)} onClick={() => { diff --git a/apps/desktop2/src/components/main/body/sessions/floating/listen.tsx b/apps/desktop2/src/components/main/body/sessions/floating/listen.tsx index 233a25686..dc118c0b3 100644 --- a/apps/desktop2/src/components/main/body/sessions/floating/listen.tsx +++ b/apps/desktop2/src/components/main/body/sessions/floating/listen.tsx @@ -1,24 +1,44 @@ import { Icon } from "@iconify-icon/react"; import { openUrl } from "@tauri-apps/plugin-opener"; +import { useListener } from "../../../../../contexts/listener"; import * as persisted from "../../../../../store/tinybase/persisted"; import { type Tab } from "../../../../../store/zustand/tabs"; import { FloatingButton } from "./shared"; type RemoteMeeting = - | { type: "zoom"; url: string } - | { type: "google-meet"; url: string }; + | { type: "zoom"; url: string | null } + | { type: "google-meet"; url: string | null }; export function ListenButton({ tab }: { tab: Extract }) { const remote = useRemoteMeeting(tab.id); + const { status, loading, start, stop } = useListener((state) => ({ + status: state.status, + loading: state.loading, + start: state.start, + stop: state.stop, + })); + + const isActive = status === "running_active"; + + const handleClick = () => { + if (isActive) { + stop(); + } else { + start(); + if (remote?.url) { + openUrl(remote.url); + } + } + }; if (remote?.type === "zoom") { return ( openUrl(remote.url)} + onClick={handleClick} icon={} > - Join Zoom & Start listening + {loading ? "Loading..." : isActive ? "Stop listening" : "Join Zoom & Start listening"} ); } @@ -26,27 +46,29 @@ export function ListenButton({ tab }: { tab: Extract if (remote?.type === "google-meet") { return ( openUrl(remote.url)} + onClick={handleClick} icon={} > - Join Google Meet & Start listening + {loading ? "Loading..." : isActive ? "Stop listening" : "Join Google Meet & Start listening"} ); } return ( - +
- Start listening + {loading ? "Loading..." : isActive ? "Stop listening" : "Start listening"} ); } function useRemoteMeeting(sessionId: string): RemoteMeeting | null { const note = persisted.UI.useCell("sessions", sessionId, "raw_md", persisted.STORE_ID); + console.log(note); + const remote = { type: "google-meet", - url: note, + url: null, } as RemoteMeeting | null; return remote; diff --git a/apps/desktop2/src/components/main/body/sessions/note-input/transcript.tsx b/apps/desktop2/src/components/main/body/sessions/note-input/transcript.tsx index e80c161fd..bc5bb3292 100644 --- a/apps/desktop2/src/components/main/body/sessions/note-input/transcript.tsx +++ b/apps/desktop2/src/components/main/body/sessions/note-input/transcript.tsx @@ -1,6 +1,3 @@ -import { type Word2 } from "@hypr/plugin-listener"; -import TranscriptEditor, { type SpeakerViewInnerProps } from "@hypr/tiptap/transcript"; - import * as persisted from "../../../../../store/tinybase/persisted"; export function TranscriptEditorWrapper({ @@ -10,38 +7,5 @@ export function TranscriptEditorWrapper({ }) { const value = persisted.UI.useCell("sessions", sessionId, "transcript", persisted.STORE_ID); - const handleTranscriptChange = persisted.UI.useSetPartialRowCallback( - "sessions", - sessionId, - (input: Word2[]) => ({ transcript: JSON.stringify(input) }), - [], - persisted.STORE_ID, - ); - - const parseTranscript = (value: string): Word2[] | null => { - if (!value) { - return null; - } - try { - const parsed = JSON.parse(value); - return parsed.words ?? null; - } catch { - return null; - } - }; - - return ( - - ); -} - -function SpeakerSelector({ speakerLabel, speakerIndex }: SpeakerViewInnerProps) { - const displayLabel = speakerLabel || `Speaker ${speakerIndex ?? 0}`; - return {displayLabel}; + return
{JSON.stringify(value, null, 2)}
; } diff --git a/apps/desktop2/src/components/main/body/sessions/transcript.tsx b/apps/desktop2/src/components/main/body/sessions/transcript.tsx index efbf85562..7d68eb538 100644 --- a/apps/desktop2/src/components/main/body/sessions/transcript.tsx +++ b/apps/desktop2/src/components/main/body/sessions/transcript.tsx @@ -1,7 +1,7 @@ import { ChevronDownIcon } from "lucide-react"; import { useCallback, useEffect, useRef, useState } from "react"; -import { events as listenerEvents, type Word2 } from "@hypr/plugin-listener"; +import { events as listenerEvents, type Word } from "@hypr/plugin-listener"; import { Button } from "@hypr/ui/components/ui/button"; import * as persisted from "../../../../store/tinybase/persisted"; import { rowIdfromTab, type Tab } from "../../../../store/zustand/tabs"; @@ -10,8 +10,8 @@ export function TranscriptView({ tab }: { tab: Tab }) { const sessionId = rowIdfromTab(tab); const sessionRow = persisted.UI.useRow("sessions", sessionId, persisted.STORE_ID); - const [finalWords, setFinalWords] = useState([]); - const [partialWords, setPartialWords] = useState([]); + const [finalWords, setFinalWords] = useState([]); + const [partialWords, setPartialWords] = useState([]); const [isAtBottom, setIsAtBottom] = useState(true); const scrollContainerRef = useRef(null); @@ -28,10 +28,10 @@ export function TranscriptView({ tab }: { tab: Tab }) { listenerEvents.sessionEvent.listen(({ payload }: { payload: any }) => { if (payload.type === "finalWords") { - const words = Object.values(payload.words).flat().filter((v): v is Word2 => !!v); + const words = Object.values(payload.words).flat().filter((v): v is Word => !!v); setFinalWords((existing) => [...existing, ...words]); } else if (payload.type === "partialWords") { - const words = Object.values(payload.words).flat().filter((v): v is Word2 => !!v); + const words = Object.values(payload.words).flat().filter((v): v is Word => !!v); setPartialWords(words); } }).then((fn: () => void) => { @@ -93,12 +93,12 @@ export function TranscriptView({ tab }: { tab: Tab }) { >
- {finalWords.map(word => word.text).join(" ")} + {finalWords.map(word => word.word).join(" ")} {partialWords.length > 0 && ( {" "} - {partialWords.map(word => word.text).join(" ")} + {partialWords.map(word => word.word).join(" ")} )}
diff --git a/apps/desktop2/src/components/main/sidebar/profile/index.tsx b/apps/desktop2/src/components/main/sidebar/profile/index.tsx index 2f348e9f7..dd140dbed 100644 --- a/apps/desktop2/src/components/main/sidebar/profile/index.tsx +++ b/apps/desktop2/src/components/main/sidebar/profile/index.tsx @@ -2,7 +2,7 @@ import { clsx } from "clsx"; import { Calendar, ChevronUpIcon, FolderOpen, Settings, Users } from "lucide-react"; import { useCallback, useState } from "react"; -import { commands as windowsCommands } from "@hypr/plugin-windows/v1"; +import { commands as windowsCommands } from "@hypr/plugin-windows"; import { useAutoCloser } from "../../../../hooks/useAutoCloser"; import { useTabs } from "../../../../store/zustand/tabs"; import { Trial } from "./banner"; diff --git a/apps/desktop2/src/components/settings/developers.tsx b/apps/desktop2/src/components/settings/developers.tsx index 72e1d2ee7..9824e1765 100644 --- a/apps/desktop2/src/components/settings/developers.tsx +++ b/apps/desktop2/src/components/settings/developers.tsx @@ -1,4 +1,4 @@ -import { commands as windowsCommands } from "@hypr/plugin-windows/v1"; +import { commands as windowsCommands } from "@hypr/plugin-windows"; import { useAuth } from "../../auth"; diff --git a/apps/desktop2/src/contexts/listener.tsx b/apps/desktop2/src/contexts/listener.tsx new file mode 100644 index 000000000..951a8fc8e --- /dev/null +++ b/apps/desktop2/src/contexts/listener.tsx @@ -0,0 +1,42 @@ +import React, { createContext, useContext, useRef } from "react"; +import { useStore } from "zustand"; +import { useShallow } from "zustand/shallow"; + +import { createListenerStore, type ListenerStore } from "../store/zustand/listener"; + +const ListenerContext = createContext(null); + +export const ListenerProvider = ({ + children, + store, +}: { + children: React.ReactNode; + store: ListenerStore; +}) => { + const storeRef = useRef(null); + if (!storeRef.current) { + storeRef.current = store; + } + + return ( + + {children} + + ); +}; + +export const useListener = ( + selector: Parameters< + typeof useStore, T> + >[1], +) => { + const store = useContext(ListenerContext); + + if (!store) { + throw new Error( + "'useListener' must be used within a 'ListenerProvider'", + ); + } + + return useStore(store, useShallow(selector)); +}; diff --git a/apps/desktop2/src/devtool/index.tsx b/apps/desktop2/src/devtool/index.tsx index 77fdf825c..03eb53579 100644 --- a/apps/desktop2/src/devtool/index.tsx +++ b/apps/desktop2/src/devtool/index.tsx @@ -2,7 +2,7 @@ import { useNavigate } from "@tanstack/react-router"; import { useCallback, useEffect, useState } from "react"; import { useStores } from "tinybase/ui-react"; -import { commands as windowsCommands } from "@hypr/plugin-windows/v1"; +import { commands as windowsCommands } from "@hypr/plugin-windows"; import { cn } from "@hypr/ui/lib/utils"; import { useAutoCloser } from "../hooks/useAutoCloser"; import { type Store as PersistedStore, STORE_ID as STORE_ID_PERSISTED } from "../store/tinybase/persisted"; diff --git a/apps/desktop2/src/main.tsx b/apps/desktop2/src/main.tsx index 8c465d7da..003f4bb33 100644 --- a/apps/desktop2/src/main.tsx +++ b/apps/desktop2/src/main.tsx @@ -16,10 +16,10 @@ import { StoreComponent as StoreComponentPersisted, } from "./store/tinybase/persisted"; -import { createOngoingSessionStore2 } from "@hypr/utils/stores"; import { routeTree } from "./routeTree.gen"; +import { createListenerStore } from "./store/zustand/listener"; -const ongoingSessionStore = createOngoingSessionStore2(); +const listenerStore = createListenerStore(); const router = createRouter({ routeTree, context: undefined }); @@ -45,7 +45,7 @@ function App() { context={{ persistedStore, internalStore, - ongoingSessionStore, + listenerStore, }} /> ); diff --git a/apps/desktop2/src/routes/__root.tsx b/apps/desktop2/src/routes/__root.tsx index 347f08f65..2d743ea86 100644 --- a/apps/desktop2/src/routes/__root.tsx +++ b/apps/desktop2/src/routes/__root.tsx @@ -8,7 +8,7 @@ import { import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow"; import { lazy, Suspense, useEffect } from "react"; -import { events as windowsEvents } from "@hypr/plugin-windows/v1"; +import { events as windowsEvents } from "@hypr/plugin-windows"; import { AuthProvider } from "../auth"; import type { Context } from "../types"; diff --git a/apps/desktop2/src/routes/app.tsx b/apps/desktop2/src/routes/app.tsx index 03fcfa62f..6a7ba59ca 100644 --- a/apps/desktop2/src/routes/app.tsx +++ b/apps/desktop2/src/routes/app.tsx @@ -1,19 +1,20 @@ -import { OngoingSessionProvider2 } from "@hypr/utils/contexts"; import { createFileRoute, Outlet } from "@tanstack/react-router"; +import { ListenerProvider } from "../contexts/listener"; + export const Route = createFileRoute("/app")({ component: Component, - loader: async ({ context: { ongoingSessionStore } }) => { - return { ongoingSessionStore: ongoingSessionStore! }; + loader: async ({ context: { listenerStore } }) => { + return { listenerStore: listenerStore! }; }, }); function Component() { - const { ongoingSessionStore } = Route.useLoaderData(); + const { listenerStore } = Route.useLoaderData(); return ( - + - + ); } diff --git a/apps/desktop2/src/routes/app/onboarding.tsx b/apps/desktop2/src/routes/app/onboarding.tsx index 8c6784d0e..4903b8483 100644 --- a/apps/desktop2/src/routes/app/onboarding.tsx +++ b/apps/desktop2/src/routes/app/onboarding.tsx @@ -8,7 +8,7 @@ import { useCallback, useState } from "react"; import { z } from "zod"; import { commands as listenerCommands } from "@hypr/plugin-listener"; -import { commands as windowsCommands } from "@hypr/plugin-windows/v1"; +import { commands as windowsCommands } from "@hypr/plugin-windows"; import { Button } from "@hypr/ui/components/ui/button"; import PushableButton from "@hypr/ui/components/ui/pushable-button"; import { Spinner } from "@hypr/ui/components/ui/spinner"; diff --git a/apps/desktop2/src/store/tinybase/persisted.ts b/apps/desktop2/src/store/tinybase/persisted.ts index fb2a9890a..c8f718858 100644 --- a/apps/desktop2/src/store/tinybase/persisted.ts +++ b/apps/desktop2/src/store/tinybase/persisted.ts @@ -231,6 +231,10 @@ export const StoreComponent = () => { const [changedTables, _changedValues] = store.getTransactionChanges(); Object.entries(changedTables).forEach(([tableId, rows]) => { + if (!rows) { + return; + } + Object.entries(rows).forEach(([rowId, cells]) => { const id = internal.rowIdOfChange(tableId, rowId); diff --git a/apps/desktop2/src/store/zustand/listener.ts b/apps/desktop2/src/store/zustand/listener.ts new file mode 100644 index 000000000..f76c1b14d --- /dev/null +++ b/apps/desktop2/src/store/zustand/listener.ts @@ -0,0 +1,103 @@ +import { create as mutate } from "mutative"; +import { createStore } from "zustand"; + +import { commands as listenerCommands, events as listenerEvents } from "@hypr/plugin-listener"; + +type State = { + sessionEventUnlisten?: () => void; + loading: boolean; + status: "inactive" | "running_active"; + amplitude: { mic: number; speaker: number }; +}; + +type Actions = { + get: () => State & Actions; + start: () => void; + stop: () => void; +}; + +const initialState: State = { + status: "inactive", + loading: false, + amplitude: { mic: 0, speaker: 0 }, +}; + +export type ListenerStore = ReturnType; + +export const createListenerStore = () => { + return createStore((set, get) => ({ + ...initialState, + get: () => get(), + start: () => { + set((state) => + mutate(state, (draft) => { + draft.loading = true; + }) + ); + + listenerEvents.sessionEvent.listen(({ payload }) => { + if (payload.type === "audioAmplitude") { + set((state) => + mutate(state, (draft) => { + draft.amplitude = { + mic: payload.mic, + speaker: payload.speaker, + }; + }) + ); + } else if (payload.type === "running_active") { + set((state) => + mutate(state, (draft) => { + draft.status = "running_active"; + draft.loading = false; + }) + ); + } else if (payload.type === "inactive") { + set((state) => + mutate(state, (draft) => { + draft.status = "inactive"; + draft.loading = false; + }) + ); + } else if (payload.type === "streamResponse") { + set((state) => + mutate(state, (_draft) => { + console.log(payload.response); + }) + ); + } + }).then((unlisten) => { + set((state) => + mutate(state, (draft) => { + draft.sessionEventUnlisten = unlisten; + }) + ); + }); + + listenerCommands.startSession("").then(() => { + set({ status: "running_active", loading: false }); + }).catch((error) => { + console.error(error); + set(initialState); + }); + }, + stop: () => { + set((state) => + mutate(state, (draft) => { + draft.loading = true; + }) + ); + + listenerCommands.stopSession().then(() => { + set(initialState); + }).catch((error) => { + console.error("Failed to stop session:", error); + set((state) => + mutate(state, (draft) => { + draft.loading = false; + }) + ); + }); + }, + })); +}; diff --git a/apps/desktop2/src/types/index.ts b/apps/desktop2/src/types/index.ts index 2980fa0f4..56a924a04 100644 --- a/apps/desktop2/src/types/index.ts +++ b/apps/desktop2/src/types/index.ts @@ -1,10 +1,10 @@ import { type Store as InternalStore } from "../store/tinybase/internal"; import { type Store as PersistedStore } from "../store/tinybase/persisted"; -import type { OngoingSessionStore2 } from "@hypr/utils/stores"; +import type { ListenerStore } from "../store/zustand/listener"; export type Context = { persistedStore: PersistedStore; internalStore: InternalStore; - ongoingSessionStore: OngoingSessionStore2; + listenerStore: ListenerStore; }; diff --git a/crates/am/src/model.rs b/crates/am/src/model.rs index 02860150e..63a80791f 100644 --- a/crates/am/src/model.rs +++ b/crates/am/src/model.rs @@ -59,6 +59,7 @@ impl AmModel { base_dir: impl AsRef, ) -> Result { let model_path = base_dir.as_ref().join(self.model_dir()); + if !model_path.exists() { return Ok(false); } diff --git a/package.json b/package.json index d3c246255..a3035cb4b 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "packageManager": "pnpm@10.11.1", + "packageManager": "pnpm@10.18.3", "devDependencies": { "turbo": "^2.5.8" }, diff --git a/plugins/connector/.gitignore b/plugins/connector/.gitignore deleted file mode 100644 index 50d8e32e8..000000000 --- a/plugins/connector/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -/.vs -.DS_Store -.Thumbs.db -*.sublime* -.idea/ -debug.log -package-lock.json -.vscode/settings.json -yarn.lock - -/.tauri -/target -Cargo.lock -node_modules/ - -dist-js -dist diff --git a/plugins/connector/Cargo.toml b/plugins/connector/Cargo.toml deleted file mode 100644 index 01853130f..000000000 --- a/plugins/connector/Cargo.toml +++ /dev/null @@ -1,31 +0,0 @@ -[package] -name = "tauri-plugin-connector" -version = "0.1.0" -authors = ["You"] -edition = "2021" -exclude = ["/js", "/node_modules"] -links = "tauri-plugin-connector" -description = "" - -[build-dependencies] -tauri-plugin = { workspace = true, features = ["build"] } - -[dev-dependencies] -specta-typescript = { workspace = true } - -[dependencies] -tauri-plugin-auth = { workspace = true } -tauri-plugin-local-llm = { workspace = true } -tauri-plugin-local-stt = { workspace = true } -tauri-plugin-store2 = { workspace = true } - -specta = { workspace = true } -tauri = { workspace = true, features = ["test"] } -tauri-specta = { workspace = true, features = ["derive", "typescript"] } - -reqwest = { workspace = true, features = ["json"] } -serde = { workspace = true } -serde_json = { workspace = true } -strum = { workspace = true, features = ["derive"] } -thiserror = { workspace = true } -url = { workspace = true } diff --git a/plugins/connector/build.rs b/plugins/connector/build.rs deleted file mode 100644 index f5b4970dc..000000000 --- a/plugins/connector/build.rs +++ /dev/null @@ -1,37 +0,0 @@ -const COMMANDS: &[&str] = &[ - "list_custom_llm_models", - "get_custom_llm_model", - "set_custom_llm_model", - "get_custom_llm_enabled", - "set_custom_llm_enabled", - "get_local_llm_connection", - "get_custom_llm_connection", - "set_custom_llm_connection", - "get_llm_connection", - "get_openai_api_key", - "set_openai_api_key", - "get_gemini_api_key", - "set_gemini_api_key", - "get_provider_source", - "set_provider_source", - "get_others_api_key", - "set_others_api_key", - "get_others_api_base", - "set_others_api_base", - "get_others_model", - "set_others_model", - "get_openai_model", - "set_openai_model", - "get_gemini_model", - "set_gemini_model", - "get_openrouter_model", - "set_openrouter_model", - "get_openrouter_api_key", - "set_openrouter_api_key", - "get_hyprcloud_enabled", - "set_hyprcloud_enabled", -]; - -fn main() { - tauri_plugin::Builder::new(COMMANDS).build(); -} diff --git a/plugins/connector/js/bindings.gen.ts b/plugins/connector/js/bindings.gen.ts deleted file mode 100644 index 7c06ba93f..000000000 --- a/plugins/connector/js/bindings.gen.ts +++ /dev/null @@ -1,176 +0,0 @@ -// @ts-nocheck - - -// This file was generated by [tauri-specta](https://github.com/oscartbeaumont/tauri-specta). Do not edit this file manually. - -/** user-defined commands **/ - - -export const commands = { -async listCustomLlmModels() : Promise { - return await TAURI_INVOKE("plugin:connector|list_custom_llm_models"); -}, -async getCustomLlmModel() : Promise { - return await TAURI_INVOKE("plugin:connector|get_custom_llm_model"); -}, -async setCustomLlmModel(model: string) : Promise { - return await TAURI_INVOKE("plugin:connector|set_custom_llm_model", { model }); -}, -async getCustomLlmEnabled() : Promise { - return await TAURI_INVOKE("plugin:connector|get_custom_llm_enabled"); -}, -async setCustomLlmEnabled(enabled: boolean) : Promise { - return await TAURI_INVOKE("plugin:connector|set_custom_llm_enabled", { enabled }); -}, -async getCustomLlmConnection() : Promise { - return await TAURI_INVOKE("plugin:connector|get_custom_llm_connection"); -}, -async setCustomLlmConnection(connection: Connection) : Promise { - return await TAURI_INVOKE("plugin:connector|set_custom_llm_connection", { connection }); -}, -async getLocalLlmConnection() : Promise { - return await TAURI_INVOKE("plugin:connector|get_local_llm_connection"); -}, -async getLlmConnection() : Promise { - return await TAURI_INVOKE("plugin:connector|get_llm_connection"); -}, -async getOpenaiApiKey() : Promise { - return await TAURI_INVOKE("plugin:connector|get_openai_api_key"); -}, -async setOpenaiApiKey(apiKey: string) : Promise { - return await TAURI_INVOKE("plugin:connector|set_openai_api_key", { apiKey }); -}, -async getGeminiApiKey() : Promise { - return await TAURI_INVOKE("plugin:connector|get_gemini_api_key"); -}, -async setGeminiApiKey(apiKey: string) : Promise { - return await TAURI_INVOKE("plugin:connector|set_gemini_api_key", { apiKey }); -}, -async getProviderSource() : Promise { - return await TAURI_INVOKE("plugin:connector|get_provider_source"); -}, -async setProviderSource(source: string) : Promise { - return await TAURI_INVOKE("plugin:connector|set_provider_source", { source }); -}, -async getOthersApiKey() : Promise { - return await TAURI_INVOKE("plugin:connector|get_others_api_key"); -}, -async setOthersApiKey(apiKey: string) : Promise { - return await TAURI_INVOKE("plugin:connector|set_others_api_key", { apiKey }); -}, -async getOthersApiBase() : Promise { - return await TAURI_INVOKE("plugin:connector|get_others_api_base"); -}, -async setOthersApiBase(apiBase: string) : Promise { - return await TAURI_INVOKE("plugin:connector|set_others_api_base", { apiBase }); -}, -async getOthersModel() : Promise { - return await TAURI_INVOKE("plugin:connector|get_others_model"); -}, -async setOthersModel(model: string) : Promise { - return await TAURI_INVOKE("plugin:connector|set_others_model", { model }); -}, -async getOpenaiModel() : Promise { - return await TAURI_INVOKE("plugin:connector|get_openai_model"); -}, -async setOpenaiModel(model: string) : Promise { - return await TAURI_INVOKE("plugin:connector|set_openai_model", { model }); -}, -async getGeminiModel() : Promise { - return await TAURI_INVOKE("plugin:connector|get_gemini_model"); -}, -async setGeminiModel(model: string) : Promise { - return await TAURI_INVOKE("plugin:connector|set_gemini_model", { model }); -}, -async getOpenrouterModel() : Promise { - return await TAURI_INVOKE("plugin:connector|get_openrouter_model"); -}, -async setOpenrouterModel(model: string) : Promise { - return await TAURI_INVOKE("plugin:connector|set_openrouter_model", { model }); -}, -async getOpenrouterApiKey() : Promise { - return await TAURI_INVOKE("plugin:connector|get_openrouter_api_key"); -}, -async setOpenrouterApiKey(apiKey: string) : Promise { - return await TAURI_INVOKE("plugin:connector|set_openrouter_api_key", { apiKey }); -}, -async getHyprcloudEnabled() : Promise { - return await TAURI_INVOKE("plugin:connector|get_hyprcloud_enabled"); -}, -async setHyprcloudEnabled(enabled: boolean) : Promise { - return await TAURI_INVOKE("plugin:connector|set_hyprcloud_enabled", { enabled }); -} -} - -/** user-defined events **/ - - - -/** user-defined constants **/ - - - -/** user-defined types **/ - -export type Connection = { api_base: string; api_key: string | null } -export type ConnectionLLM = { type: "HyprCloud"; connection: Connection } | { type: "HyprLocal"; connection: Connection } | { type: "Custom"; connection: Connection } - -/** tauri-specta globals **/ - -import { - invoke as TAURI_INVOKE, - Channel as TAURI_CHANNEL, -} from "@tauri-apps/api/core"; -import * as TAURI_API_EVENT from "@tauri-apps/api/event"; -import { type WebviewWindow as __WebviewWindow__ } from "@tauri-apps/api/webviewWindow"; - -type __EventObj__ = { - listen: ( - cb: TAURI_API_EVENT.EventCallback, - ) => ReturnType>; - once: ( - cb: TAURI_API_EVENT.EventCallback, - ) => ReturnType>; - emit: null extends T - ? (payload?: T) => ReturnType - : (payload: T) => ReturnType; -}; - -export type Result = - | { status: "ok"; data: T } - | { status: "error"; error: E }; - -function __makeEvents__>( - mappings: Record, -) { - return new Proxy( - {} as unknown as { - [K in keyof T]: __EventObj__ & { - (handle: __WebviewWindow__): __EventObj__; - }; - }, - { - get: (_, event) => { - const name = mappings[event as keyof T]; - - return new Proxy((() => {}) as any, { - apply: (_, __, [window]: [__WebviewWindow__]) => ({ - listen: (arg: any) => window.listen(name, arg), - once: (arg: any) => window.once(name, arg), - emit: (arg: any) => window.emit(name, arg), - }), - get: (_, command: keyof __EventObj__) => { - switch (command) { - case "listen": - return (arg: any) => TAURI_API_EVENT.listen(name, arg); - case "once": - return (arg: any) => TAURI_API_EVENT.once(name, arg); - case "emit": - return (arg: any) => TAURI_API_EVENT.emit(name, arg); - } - }, - }); - }, - }, - ); -} diff --git a/plugins/connector/js/index.ts b/plugins/connector/js/index.ts deleted file mode 100644 index a96e122f0..000000000 --- a/plugins/connector/js/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./bindings.gen"; diff --git a/plugins/connector/package.json b/plugins/connector/package.json deleted file mode 100644 index ce8722ed4..000000000 --- a/plugins/connector/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "@hypr/plugin-connector", - "private": true, - "main": "./js/index.ts", - "scripts": { - "codegen": "cargo test -p tauri-plugin-connector" - }, - "dependencies": { - "@tauri-apps/api": "^2.8.0" - } -} diff --git a/plugins/connector/permissions/autogenerated/commands/get_custom_llm_connection.toml b/plugins/connector/permissions/autogenerated/commands/get_custom_llm_connection.toml deleted file mode 100644 index 5ca19ebd2..000000000 --- a/plugins/connector/permissions/autogenerated/commands/get_custom_llm_connection.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-get-custom-llm-connection" -description = "Enables the get_custom_llm_connection command without any pre-configured scope." -commands.allow = ["get_custom_llm_connection"] - -[[permission]] -identifier = "deny-get-custom-llm-connection" -description = "Denies the get_custom_llm_connection command without any pre-configured scope." -commands.deny = ["get_custom_llm_connection"] diff --git a/plugins/connector/permissions/autogenerated/commands/get_custom_llm_enabled.toml b/plugins/connector/permissions/autogenerated/commands/get_custom_llm_enabled.toml deleted file mode 100644 index b46123a50..000000000 --- a/plugins/connector/permissions/autogenerated/commands/get_custom_llm_enabled.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-get-custom-llm-enabled" -description = "Enables the get_custom_llm_enabled command without any pre-configured scope." -commands.allow = ["get_custom_llm_enabled"] - -[[permission]] -identifier = "deny-get-custom-llm-enabled" -description = "Denies the get_custom_llm_enabled command without any pre-configured scope." -commands.deny = ["get_custom_llm_enabled"] diff --git a/plugins/connector/permissions/autogenerated/commands/get_custom_llm_model.toml b/plugins/connector/permissions/autogenerated/commands/get_custom_llm_model.toml deleted file mode 100644 index ccfe0115b..000000000 --- a/plugins/connector/permissions/autogenerated/commands/get_custom_llm_model.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-get-custom-llm-model" -description = "Enables the get_custom_llm_model command without any pre-configured scope." -commands.allow = ["get_custom_llm_model"] - -[[permission]] -identifier = "deny-get-custom-llm-model" -description = "Denies the get_custom_llm_model command without any pre-configured scope." -commands.deny = ["get_custom_llm_model"] diff --git a/plugins/connector/permissions/autogenerated/commands/get_gemini_api_key.toml b/plugins/connector/permissions/autogenerated/commands/get_gemini_api_key.toml deleted file mode 100644 index f07041c49..000000000 --- a/plugins/connector/permissions/autogenerated/commands/get_gemini_api_key.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-get-gemini-api-key" -description = "Enables the get_gemini_api_key command without any pre-configured scope." -commands.allow = ["get_gemini_api_key"] - -[[permission]] -identifier = "deny-get-gemini-api-key" -description = "Denies the get_gemini_api_key command without any pre-configured scope." -commands.deny = ["get_gemini_api_key"] diff --git a/plugins/connector/permissions/autogenerated/commands/get_gemini_model.toml b/plugins/connector/permissions/autogenerated/commands/get_gemini_model.toml deleted file mode 100644 index 900afa2d6..000000000 --- a/plugins/connector/permissions/autogenerated/commands/get_gemini_model.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-get-gemini-model" -description = "Enables the get_gemini_model command without any pre-configured scope." -commands.allow = ["get_gemini_model"] - -[[permission]] -identifier = "deny-get-gemini-model" -description = "Denies the get_gemini_model command without any pre-configured scope." -commands.deny = ["get_gemini_model"] diff --git a/plugins/connector/permissions/autogenerated/commands/get_hyprcloud_enabled.toml b/plugins/connector/permissions/autogenerated/commands/get_hyprcloud_enabled.toml deleted file mode 100644 index ab587b015..000000000 --- a/plugins/connector/permissions/autogenerated/commands/get_hyprcloud_enabled.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-get-hyprcloud-enabled" -description = "Enables the get_hyprcloud_enabled command without any pre-configured scope." -commands.allow = ["get_hyprcloud_enabled"] - -[[permission]] -identifier = "deny-get-hyprcloud-enabled" -description = "Denies the get_hyprcloud_enabled command without any pre-configured scope." -commands.deny = ["get_hyprcloud_enabled"] diff --git a/plugins/connector/permissions/autogenerated/commands/get_llm_connection.toml b/plugins/connector/permissions/autogenerated/commands/get_llm_connection.toml deleted file mode 100644 index 15f32e60e..000000000 --- a/plugins/connector/permissions/autogenerated/commands/get_llm_connection.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-get-llm-connection" -description = "Enables the get_llm_connection command without any pre-configured scope." -commands.allow = ["get_llm_connection"] - -[[permission]] -identifier = "deny-get-llm-connection" -description = "Denies the get_llm_connection command without any pre-configured scope." -commands.deny = ["get_llm_connection"] diff --git a/plugins/connector/permissions/autogenerated/commands/get_local_llm_connection.toml b/plugins/connector/permissions/autogenerated/commands/get_local_llm_connection.toml deleted file mode 100644 index e1b1d1ddf..000000000 --- a/plugins/connector/permissions/autogenerated/commands/get_local_llm_connection.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-get-local-llm-connection" -description = "Enables the get_local_llm_connection command without any pre-configured scope." -commands.allow = ["get_local_llm_connection"] - -[[permission]] -identifier = "deny-get-local-llm-connection" -description = "Denies the get_local_llm_connection command without any pre-configured scope." -commands.deny = ["get_local_llm_connection"] diff --git a/plugins/connector/permissions/autogenerated/commands/get_openai_api_key.toml b/plugins/connector/permissions/autogenerated/commands/get_openai_api_key.toml deleted file mode 100644 index a9c092a3e..000000000 --- a/plugins/connector/permissions/autogenerated/commands/get_openai_api_key.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-get-openai-api-key" -description = "Enables the get_openai_api_key command without any pre-configured scope." -commands.allow = ["get_openai_api_key"] - -[[permission]] -identifier = "deny-get-openai-api-key" -description = "Denies the get_openai_api_key command without any pre-configured scope." -commands.deny = ["get_openai_api_key"] diff --git a/plugins/connector/permissions/autogenerated/commands/get_openai_model.toml b/plugins/connector/permissions/autogenerated/commands/get_openai_model.toml deleted file mode 100644 index 9c4b18e39..000000000 --- a/plugins/connector/permissions/autogenerated/commands/get_openai_model.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-get-openai-model" -description = "Enables the get_openai_model command without any pre-configured scope." -commands.allow = ["get_openai_model"] - -[[permission]] -identifier = "deny-get-openai-model" -description = "Denies the get_openai_model command without any pre-configured scope." -commands.deny = ["get_openai_model"] diff --git a/plugins/connector/permissions/autogenerated/commands/get_openrouter_api_key.toml b/plugins/connector/permissions/autogenerated/commands/get_openrouter_api_key.toml deleted file mode 100644 index a58563918..000000000 --- a/plugins/connector/permissions/autogenerated/commands/get_openrouter_api_key.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-get-openrouter-api-key" -description = "Enables the get_openrouter_api_key command without any pre-configured scope." -commands.allow = ["get_openrouter_api_key"] - -[[permission]] -identifier = "deny-get-openrouter-api-key" -description = "Denies the get_openrouter_api_key command without any pre-configured scope." -commands.deny = ["get_openrouter_api_key"] diff --git a/plugins/connector/permissions/autogenerated/commands/get_openrouter_model.toml b/plugins/connector/permissions/autogenerated/commands/get_openrouter_model.toml deleted file mode 100644 index 404d53aaa..000000000 --- a/plugins/connector/permissions/autogenerated/commands/get_openrouter_model.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-get-openrouter-model" -description = "Enables the get_openrouter_model command without any pre-configured scope." -commands.allow = ["get_openrouter_model"] - -[[permission]] -identifier = "deny-get-openrouter-model" -description = "Denies the get_openrouter_model command without any pre-configured scope." -commands.deny = ["get_openrouter_model"] diff --git a/plugins/connector/permissions/autogenerated/commands/get_others_api_base.toml b/plugins/connector/permissions/autogenerated/commands/get_others_api_base.toml deleted file mode 100644 index 7634b0f8c..000000000 --- a/plugins/connector/permissions/autogenerated/commands/get_others_api_base.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-get-others-api-base" -description = "Enables the get_others_api_base command without any pre-configured scope." -commands.allow = ["get_others_api_base"] - -[[permission]] -identifier = "deny-get-others-api-base" -description = "Denies the get_others_api_base command without any pre-configured scope." -commands.deny = ["get_others_api_base"] diff --git a/plugins/connector/permissions/autogenerated/commands/get_others_api_key.toml b/plugins/connector/permissions/autogenerated/commands/get_others_api_key.toml deleted file mode 100644 index 3d9d1a5bc..000000000 --- a/plugins/connector/permissions/autogenerated/commands/get_others_api_key.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-get-others-api-key" -description = "Enables the get_others_api_key command without any pre-configured scope." -commands.allow = ["get_others_api_key"] - -[[permission]] -identifier = "deny-get-others-api-key" -description = "Denies the get_others_api_key command without any pre-configured scope." -commands.deny = ["get_others_api_key"] diff --git a/plugins/connector/permissions/autogenerated/commands/get_others_model.toml b/plugins/connector/permissions/autogenerated/commands/get_others_model.toml deleted file mode 100644 index 97d67be52..000000000 --- a/plugins/connector/permissions/autogenerated/commands/get_others_model.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-get-others-model" -description = "Enables the get_others_model command without any pre-configured scope." -commands.allow = ["get_others_model"] - -[[permission]] -identifier = "deny-get-others-model" -description = "Denies the get_others_model command without any pre-configured scope." -commands.deny = ["get_others_model"] diff --git a/plugins/connector/permissions/autogenerated/commands/get_provider_source.toml b/plugins/connector/permissions/autogenerated/commands/get_provider_source.toml deleted file mode 100644 index 4e2b9713d..000000000 --- a/plugins/connector/permissions/autogenerated/commands/get_provider_source.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-get-provider-source" -description = "Enables the get_provider_source command without any pre-configured scope." -commands.allow = ["get_provider_source"] - -[[permission]] -identifier = "deny-get-provider-source" -description = "Denies the get_provider_source command without any pre-configured scope." -commands.deny = ["get_provider_source"] diff --git a/plugins/connector/permissions/autogenerated/commands/get_stt_connection.toml b/plugins/connector/permissions/autogenerated/commands/get_stt_connection.toml deleted file mode 100644 index 0895d2bfd..000000000 --- a/plugins/connector/permissions/autogenerated/commands/get_stt_connection.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-get-stt-connection" -description = "Enables the get_stt_connection command without any pre-configured scope." -commands.allow = ["get_stt_connection"] - -[[permission]] -identifier = "deny-get-stt-connection" -description = "Denies the get_stt_connection command without any pre-configured scope." -commands.deny = ["get_stt_connection"] diff --git a/plugins/connector/permissions/autogenerated/commands/list_custom_llm_models.toml b/plugins/connector/permissions/autogenerated/commands/list_custom_llm_models.toml deleted file mode 100644 index ae431c74d..000000000 --- a/plugins/connector/permissions/autogenerated/commands/list_custom_llm_models.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-list-custom-llm-models" -description = "Enables the list_custom_llm_models command without any pre-configured scope." -commands.allow = ["list_custom_llm_models"] - -[[permission]] -identifier = "deny-list-custom-llm-models" -description = "Denies the list_custom_llm_models command without any pre-configured scope." -commands.deny = ["list_custom_llm_models"] diff --git a/plugins/connector/permissions/autogenerated/commands/set_custom_llm_connection.toml b/plugins/connector/permissions/autogenerated/commands/set_custom_llm_connection.toml deleted file mode 100644 index a9aecd890..000000000 --- a/plugins/connector/permissions/autogenerated/commands/set_custom_llm_connection.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-set-custom-llm-connection" -description = "Enables the set_custom_llm_connection command without any pre-configured scope." -commands.allow = ["set_custom_llm_connection"] - -[[permission]] -identifier = "deny-set-custom-llm-connection" -description = "Denies the set_custom_llm_connection command without any pre-configured scope." -commands.deny = ["set_custom_llm_connection"] diff --git a/plugins/connector/permissions/autogenerated/commands/set_custom_llm_enabled.toml b/plugins/connector/permissions/autogenerated/commands/set_custom_llm_enabled.toml deleted file mode 100644 index 49c2c5b13..000000000 --- a/plugins/connector/permissions/autogenerated/commands/set_custom_llm_enabled.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-set-custom-llm-enabled" -description = "Enables the set_custom_llm_enabled command without any pre-configured scope." -commands.allow = ["set_custom_llm_enabled"] - -[[permission]] -identifier = "deny-set-custom-llm-enabled" -description = "Denies the set_custom_llm_enabled command without any pre-configured scope." -commands.deny = ["set_custom_llm_enabled"] diff --git a/plugins/connector/permissions/autogenerated/commands/set_custom_llm_model.toml b/plugins/connector/permissions/autogenerated/commands/set_custom_llm_model.toml deleted file mode 100644 index c0eb4bdd5..000000000 --- a/plugins/connector/permissions/autogenerated/commands/set_custom_llm_model.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-set-custom-llm-model" -description = "Enables the set_custom_llm_model command without any pre-configured scope." -commands.allow = ["set_custom_llm_model"] - -[[permission]] -identifier = "deny-set-custom-llm-model" -description = "Denies the set_custom_llm_model command without any pre-configured scope." -commands.deny = ["set_custom_llm_model"] diff --git a/plugins/connector/permissions/autogenerated/commands/set_gemini_api_key.toml b/plugins/connector/permissions/autogenerated/commands/set_gemini_api_key.toml deleted file mode 100644 index 1d681eca6..000000000 --- a/plugins/connector/permissions/autogenerated/commands/set_gemini_api_key.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-set-gemini-api-key" -description = "Enables the set_gemini_api_key command without any pre-configured scope." -commands.allow = ["set_gemini_api_key"] - -[[permission]] -identifier = "deny-set-gemini-api-key" -description = "Denies the set_gemini_api_key command without any pre-configured scope." -commands.deny = ["set_gemini_api_key"] diff --git a/plugins/connector/permissions/autogenerated/commands/set_gemini_model.toml b/plugins/connector/permissions/autogenerated/commands/set_gemini_model.toml deleted file mode 100644 index 5fce6e568..000000000 --- a/plugins/connector/permissions/autogenerated/commands/set_gemini_model.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-set-gemini-model" -description = "Enables the set_gemini_model command without any pre-configured scope." -commands.allow = ["set_gemini_model"] - -[[permission]] -identifier = "deny-set-gemini-model" -description = "Denies the set_gemini_model command without any pre-configured scope." -commands.deny = ["set_gemini_model"] diff --git a/plugins/connector/permissions/autogenerated/commands/set_hyprcloud_enabled.toml b/plugins/connector/permissions/autogenerated/commands/set_hyprcloud_enabled.toml deleted file mode 100644 index 8d82bf312..000000000 --- a/plugins/connector/permissions/autogenerated/commands/set_hyprcloud_enabled.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-set-hyprcloud-enabled" -description = "Enables the set_hyprcloud_enabled command without any pre-configured scope." -commands.allow = ["set_hyprcloud_enabled"] - -[[permission]] -identifier = "deny-set-hyprcloud-enabled" -description = "Denies the set_hyprcloud_enabled command without any pre-configured scope." -commands.deny = ["set_hyprcloud_enabled"] diff --git a/plugins/connector/permissions/autogenerated/commands/set_openai_api_key.toml b/plugins/connector/permissions/autogenerated/commands/set_openai_api_key.toml deleted file mode 100644 index 052ddff72..000000000 --- a/plugins/connector/permissions/autogenerated/commands/set_openai_api_key.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-set-openai-api-key" -description = "Enables the set_openai_api_key command without any pre-configured scope." -commands.allow = ["set_openai_api_key"] - -[[permission]] -identifier = "deny-set-openai-api-key" -description = "Denies the set_openai_api_key command without any pre-configured scope." -commands.deny = ["set_openai_api_key"] diff --git a/plugins/connector/permissions/autogenerated/commands/set_openai_model.toml b/plugins/connector/permissions/autogenerated/commands/set_openai_model.toml deleted file mode 100644 index c7e1d8040..000000000 --- a/plugins/connector/permissions/autogenerated/commands/set_openai_model.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-set-openai-model" -description = "Enables the set_openai_model command without any pre-configured scope." -commands.allow = ["set_openai_model"] - -[[permission]] -identifier = "deny-set-openai-model" -description = "Denies the set_openai_model command without any pre-configured scope." -commands.deny = ["set_openai_model"] diff --git a/plugins/connector/permissions/autogenerated/commands/set_openrouter_api_key.toml b/plugins/connector/permissions/autogenerated/commands/set_openrouter_api_key.toml deleted file mode 100644 index 18edeae09..000000000 --- a/plugins/connector/permissions/autogenerated/commands/set_openrouter_api_key.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-set-openrouter-api-key" -description = "Enables the set_openrouter_api_key command without any pre-configured scope." -commands.allow = ["set_openrouter_api_key"] - -[[permission]] -identifier = "deny-set-openrouter-api-key" -description = "Denies the set_openrouter_api_key command without any pre-configured scope." -commands.deny = ["set_openrouter_api_key"] diff --git a/plugins/connector/permissions/autogenerated/commands/set_openrouter_model.toml b/plugins/connector/permissions/autogenerated/commands/set_openrouter_model.toml deleted file mode 100644 index 6dca94512..000000000 --- a/plugins/connector/permissions/autogenerated/commands/set_openrouter_model.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-set-openrouter-model" -description = "Enables the set_openrouter_model command without any pre-configured scope." -commands.allow = ["set_openrouter_model"] - -[[permission]] -identifier = "deny-set-openrouter-model" -description = "Denies the set_openrouter_model command without any pre-configured scope." -commands.deny = ["set_openrouter_model"] diff --git a/plugins/connector/permissions/autogenerated/commands/set_others_api_base.toml b/plugins/connector/permissions/autogenerated/commands/set_others_api_base.toml deleted file mode 100644 index 62bac7303..000000000 --- a/plugins/connector/permissions/autogenerated/commands/set_others_api_base.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-set-others-api-base" -description = "Enables the set_others_api_base command without any pre-configured scope." -commands.allow = ["set_others_api_base"] - -[[permission]] -identifier = "deny-set-others-api-base" -description = "Denies the set_others_api_base command without any pre-configured scope." -commands.deny = ["set_others_api_base"] diff --git a/plugins/connector/permissions/autogenerated/commands/set_others_api_key.toml b/plugins/connector/permissions/autogenerated/commands/set_others_api_key.toml deleted file mode 100644 index ada565e65..000000000 --- a/plugins/connector/permissions/autogenerated/commands/set_others_api_key.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-set-others-api-key" -description = "Enables the set_others_api_key command without any pre-configured scope." -commands.allow = ["set_others_api_key"] - -[[permission]] -identifier = "deny-set-others-api-key" -description = "Denies the set_others_api_key command without any pre-configured scope." -commands.deny = ["set_others_api_key"] diff --git a/plugins/connector/permissions/autogenerated/commands/set_others_model.toml b/plugins/connector/permissions/autogenerated/commands/set_others_model.toml deleted file mode 100644 index 81657d80b..000000000 --- a/plugins/connector/permissions/autogenerated/commands/set_others_model.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-set-others-model" -description = "Enables the set_others_model command without any pre-configured scope." -commands.allow = ["set_others_model"] - -[[permission]] -identifier = "deny-set-others-model" -description = "Denies the set_others_model command without any pre-configured scope." -commands.deny = ["set_others_model"] diff --git a/plugins/connector/permissions/autogenerated/commands/set_provider_source.toml b/plugins/connector/permissions/autogenerated/commands/set_provider_source.toml deleted file mode 100644 index 2ef801eeb..000000000 --- a/plugins/connector/permissions/autogenerated/commands/set_provider_source.toml +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically generated - DO NOT EDIT! - -"$schema" = "../../schemas/schema.json" - -[[permission]] -identifier = "allow-set-provider-source" -description = "Enables the set_provider_source command without any pre-configured scope." -commands.allow = ["set_provider_source"] - -[[permission]] -identifier = "deny-set-provider-source" -description = "Denies the set_provider_source command without any pre-configured scope." -commands.deny = ["set_provider_source"] diff --git a/plugins/connector/permissions/autogenerated/reference.md b/plugins/connector/permissions/autogenerated/reference.md deleted file mode 100644 index 57fdb7446..000000000 --- a/plugins/connector/permissions/autogenerated/reference.md +++ /dev/null @@ -1,879 +0,0 @@ -## Default Permission - -Default permissions for the plugin - -#### This default permission set includes the following: - -- `allow-list-custom-llm-models` -- `allow-get-custom-llm-model` -- `allow-set-custom-llm-model` -- `allow-get-custom-llm-enabled` -- `allow-set-custom-llm-enabled` -- `allow-get-custom-llm-connection` -- `allow-set-custom-llm-connection` -- `allow-get-local-llm-connection` -- `allow-get-llm-connection` -- `allow-get-openai-api-key` -- `allow-set-openai-api-key` -- `allow-get-gemini-api-key` -- `allow-set-gemini-api-key` -- `allow-get-provider-source` -- `allow-set-provider-source` -- `allow-set-others-api-base` -- `allow-get-others-api-base` -- `allow-set-others-api-key` -- `allow-get-others-api-key` -- `allow-set-others-model` -- `allow-get-others-model` -- `allow-get-openai-model` -- `allow-set-openai-model` -- `allow-get-gemini-model` -- `allow-set-gemini-model` -- `allow-get-openrouter-api-key` -- `allow-set-openrouter-api-key` -- `allow-set-openrouter-model` -- `allow-get-openrouter-model` -- `allow-get-hyprcloud-enabled` -- `allow-set-hyprcloud-enabled` - -## Permission Table - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IdentifierDescription
- -`connector:allow-get-custom-llm-connection` - - - -Enables the get_custom_llm_connection command without any pre-configured scope. - -
- -`connector:deny-get-custom-llm-connection` - - - -Denies the get_custom_llm_connection command without any pre-configured scope. - -
- -`connector:allow-get-custom-llm-enabled` - - - -Enables the get_custom_llm_enabled command without any pre-configured scope. - -
- -`connector:deny-get-custom-llm-enabled` - - - -Denies the get_custom_llm_enabled command without any pre-configured scope. - -
- -`connector:allow-get-custom-llm-model` - - - -Enables the get_custom_llm_model command without any pre-configured scope. - -
- -`connector:deny-get-custom-llm-model` - - - -Denies the get_custom_llm_model command without any pre-configured scope. - -
- -`connector:allow-get-gemini-api-key` - - - -Enables the get_gemini_api_key command without any pre-configured scope. - -
- -`connector:deny-get-gemini-api-key` - - - -Denies the get_gemini_api_key command without any pre-configured scope. - -
- -`connector:allow-get-gemini-model` - - - -Enables the get_gemini_model command without any pre-configured scope. - -
- -`connector:deny-get-gemini-model` - - - -Denies the get_gemini_model command without any pre-configured scope. - -
- -`connector:allow-get-hyprcloud-enabled` - - - -Enables the get_hyprcloud_enabled command without any pre-configured scope. - -
- -`connector:deny-get-hyprcloud-enabled` - - - -Denies the get_hyprcloud_enabled command without any pre-configured scope. - -
- -`connector:allow-get-llm-connection` - - - -Enables the get_llm_connection command without any pre-configured scope. - -
- -`connector:deny-get-llm-connection` - - - -Denies the get_llm_connection command without any pre-configured scope. - -
- -`connector:allow-get-local-llm-connection` - - - -Enables the get_local_llm_connection command without any pre-configured scope. - -
- -`connector:deny-get-local-llm-connection` - - - -Denies the get_local_llm_connection command without any pre-configured scope. - -
- -`connector:allow-get-openai-api-key` - - - -Enables the get_openai_api_key command without any pre-configured scope. - -
- -`connector:deny-get-openai-api-key` - - - -Denies the get_openai_api_key command without any pre-configured scope. - -
- -`connector:allow-get-openai-model` - - - -Enables the get_openai_model command without any pre-configured scope. - -
- -`connector:deny-get-openai-model` - - - -Denies the get_openai_model command without any pre-configured scope. - -
- -`connector:allow-get-openrouter-api-key` - - - -Enables the get_openrouter_api_key command without any pre-configured scope. - -
- -`connector:deny-get-openrouter-api-key` - - - -Denies the get_openrouter_api_key command without any pre-configured scope. - -
- -`connector:allow-get-openrouter-model` - - - -Enables the get_openrouter_model command without any pre-configured scope. - -
- -`connector:deny-get-openrouter-model` - - - -Denies the get_openrouter_model command without any pre-configured scope. - -
- -`connector:allow-get-others-api-base` - - - -Enables the get_others_api_base command without any pre-configured scope. - -
- -`connector:deny-get-others-api-base` - - - -Denies the get_others_api_base command without any pre-configured scope. - -
- -`connector:allow-get-others-api-key` - - - -Enables the get_others_api_key command without any pre-configured scope. - -
- -`connector:deny-get-others-api-key` - - - -Denies the get_others_api_key command without any pre-configured scope. - -
- -`connector:allow-get-others-model` - - - -Enables the get_others_model command without any pre-configured scope. - -
- -`connector:deny-get-others-model` - - - -Denies the get_others_model command without any pre-configured scope. - -
- -`connector:allow-get-provider-source` - - - -Enables the get_provider_source command without any pre-configured scope. - -
- -`connector:deny-get-provider-source` - - - -Denies the get_provider_source command without any pre-configured scope. - -
- -`connector:allow-get-stt-connection` - - - -Enables the get_stt_connection command without any pre-configured scope. - -
- -`connector:deny-get-stt-connection` - - - -Denies the get_stt_connection command without any pre-configured scope. - -
- -`connector:allow-list-custom-llm-models` - - - -Enables the list_custom_llm_models command without any pre-configured scope. - -
- -`connector:deny-list-custom-llm-models` - - - -Denies the list_custom_llm_models command without any pre-configured scope. - -
- -`connector:allow-set-custom-llm-connection` - - - -Enables the set_custom_llm_connection command without any pre-configured scope. - -
- -`connector:deny-set-custom-llm-connection` - - - -Denies the set_custom_llm_connection command without any pre-configured scope. - -
- -`connector:allow-set-custom-llm-enabled` - - - -Enables the set_custom_llm_enabled command without any pre-configured scope. - -
- -`connector:deny-set-custom-llm-enabled` - - - -Denies the set_custom_llm_enabled command without any pre-configured scope. - -
- -`connector:allow-set-custom-llm-model` - - - -Enables the set_custom_llm_model command without any pre-configured scope. - -
- -`connector:deny-set-custom-llm-model` - - - -Denies the set_custom_llm_model command without any pre-configured scope. - -
- -`connector:allow-set-gemini-api-key` - - - -Enables the set_gemini_api_key command without any pre-configured scope. - -
- -`connector:deny-set-gemini-api-key` - - - -Denies the set_gemini_api_key command without any pre-configured scope. - -
- -`connector:allow-set-gemini-model` - - - -Enables the set_gemini_model command without any pre-configured scope. - -
- -`connector:deny-set-gemini-model` - - - -Denies the set_gemini_model command without any pre-configured scope. - -
- -`connector:allow-set-hyprcloud-enabled` - - - -Enables the set_hyprcloud_enabled command without any pre-configured scope. - -
- -`connector:deny-set-hyprcloud-enabled` - - - -Denies the set_hyprcloud_enabled command without any pre-configured scope. - -
- -`connector:allow-set-openai-api-key` - - - -Enables the set_openai_api_key command without any pre-configured scope. - -
- -`connector:deny-set-openai-api-key` - - - -Denies the set_openai_api_key command without any pre-configured scope. - -
- -`connector:allow-set-openai-model` - - - -Enables the set_openai_model command without any pre-configured scope. - -
- -`connector:deny-set-openai-model` - - - -Denies the set_openai_model command without any pre-configured scope. - -
- -`connector:allow-set-openrouter-api-key` - - - -Enables the set_openrouter_api_key command without any pre-configured scope. - -
- -`connector:deny-set-openrouter-api-key` - - - -Denies the set_openrouter_api_key command without any pre-configured scope. - -
- -`connector:allow-set-openrouter-model` - - - -Enables the set_openrouter_model command without any pre-configured scope. - -
- -`connector:deny-set-openrouter-model` - - - -Denies the set_openrouter_model command without any pre-configured scope. - -
- -`connector:allow-set-others-api-base` - - - -Enables the set_others_api_base command without any pre-configured scope. - -
- -`connector:deny-set-others-api-base` - - - -Denies the set_others_api_base command without any pre-configured scope. - -
- -`connector:allow-set-others-api-key` - - - -Enables the set_others_api_key command without any pre-configured scope. - -
- -`connector:deny-set-others-api-key` - - - -Denies the set_others_api_key command without any pre-configured scope. - -
- -`connector:allow-set-others-model` - - - -Enables the set_others_model command without any pre-configured scope. - -
- -`connector:deny-set-others-model` - - - -Denies the set_others_model command without any pre-configured scope. - -
- -`connector:allow-set-provider-source` - - - -Enables the set_provider_source command without any pre-configured scope. - -
- -`connector:deny-set-provider-source` - - - -Denies the set_provider_source command without any pre-configured scope. - -
diff --git a/plugins/connector/permissions/default.toml b/plugins/connector/permissions/default.toml deleted file mode 100644 index 98fac2171..000000000 --- a/plugins/connector/permissions/default.toml +++ /dev/null @@ -1,35 +0,0 @@ -[default] -description = "Default permissions for the plugin" -permissions = [ - "allow-list-custom-llm-models", - "allow-get-custom-llm-model", - "allow-set-custom-llm-model", - "allow-get-custom-llm-enabled", - "allow-set-custom-llm-enabled", - "allow-get-custom-llm-connection", - "allow-set-custom-llm-connection", - "allow-get-local-llm-connection", - "allow-get-llm-connection", - "allow-get-openai-api-key", - "allow-set-openai-api-key", - "allow-get-gemini-api-key", - "allow-set-gemini-api-key", - "allow-get-provider-source", - "allow-set-provider-source", - "allow-set-others-api-base", - "allow-get-others-api-base", - "allow-set-others-api-key", - "allow-get-others-api-key", - "allow-set-others-model", - "allow-get-others-model", - "allow-get-openai-model", - "allow-set-openai-model", - "allow-get-gemini-model", - "allow-set-gemini-model", - "allow-get-openrouter-api-key", - "allow-set-openrouter-api-key", - "allow-set-openrouter-model", - "allow-get-openrouter-model", - "allow-get-hyprcloud-enabled", - "allow-set-hyprcloud-enabled", -] diff --git a/plugins/connector/permissions/schemas/schema.json b/plugins/connector/permissions/schemas/schema.json deleted file mode 100644 index d967bf02a..000000000 --- a/plugins/connector/permissions/schemas/schema.json +++ /dev/null @@ -1,690 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "PermissionFile", - "description": "Permission file that can define a default permission, a set of permissions or a list of inlined permissions.", - "type": "object", - "properties": { - "default": { - "description": "The default permission set for the plugin", - "anyOf": [ - { - "$ref": "#/definitions/DefaultPermission" - }, - { - "type": "null" - } - ] - }, - "set": { - "description": "A list of permissions sets defined", - "type": "array", - "items": { - "$ref": "#/definitions/PermissionSet" - } - }, - "permission": { - "description": "A list of inlined permissions", - "default": [], - "type": "array", - "items": { - "$ref": "#/definitions/Permission" - } - } - }, - "definitions": { - "DefaultPermission": { - "description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.", - "type": "object", - "required": [ - "permissions" - ], - "properties": { - "version": { - "description": "The version of the permission.", - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 1.0 - }, - "description": { - "description": "Human-readable description of what the permission does. Tauri convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", - "type": [ - "string", - "null" - ] - }, - "permissions": { - "description": "All permissions this set contains.", - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "PermissionSet": { - "description": "A set of direct permissions grouped together under a new name.", - "type": "object", - "required": [ - "description", - "identifier", - "permissions" - ], - "properties": { - "identifier": { - "description": "A unique identifier for the permission.", - "type": "string" - }, - "description": { - "description": "Human-readable description of what the permission does.", - "type": "string" - }, - "permissions": { - "description": "All permissions this set contains.", - "type": "array", - "items": { - "$ref": "#/definitions/PermissionKind" - } - } - } - }, - "Permission": { - "description": "Descriptions of explicit privileges of commands.\n\nIt can enable commands to be accessible in the frontend of the application.\n\nIf the scope is defined it can be used to fine grain control the access of individual or multiple commands.", - "type": "object", - "required": [ - "identifier" - ], - "properties": { - "version": { - "description": "The version of the permission.", - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 1.0 - }, - "identifier": { - "description": "A unique identifier for the permission.", - "type": "string" - }, - "description": { - "description": "Human-readable description of what the permission does. Tauri internal convention is to use `

` headings in markdown content for Tauri documentation generation purposes.", - "type": [ - "string", - "null" - ] - }, - "commands": { - "description": "Allowed or denied commands when using this permission.", - "default": { - "allow": [], - "deny": [] - }, - "allOf": [ - { - "$ref": "#/definitions/Commands" - } - ] - }, - "scope": { - "description": "Allowed or denied scoped when using this permission.", - "allOf": [ - { - "$ref": "#/definitions/Scopes" - } - ] - }, - "platforms": { - "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Target" - } - } - } - }, - "Commands": { - "description": "Allowed and denied commands inside a permission.\n\nIf two commands clash inside of `allow` and `deny`, it should be denied by default.", - "type": "object", - "properties": { - "allow": { - "description": "Allowed command.", - "default": [], - "type": "array", - "items": { - "type": "string" - } - }, - "deny": { - "description": "Denied command, which takes priority.", - "default": [], - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "Scopes": { - "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", - "type": "object", - "properties": { - "allow": { - "description": "Data that defines what is allowed by the scope.", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Value" - } - }, - "deny": { - "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - "Value": { - "description": "All supported ACL values.", - "anyOf": [ - { - "description": "Represents a null JSON value.", - "type": "null" - }, - { - "description": "Represents a [`bool`].", - "type": "boolean" - }, - { - "description": "Represents a valid ACL [`Number`].", - "allOf": [ - { - "$ref": "#/definitions/Number" - } - ] - }, - { - "description": "Represents a [`String`].", - "type": "string" - }, - { - "description": "Represents a list of other [`Value`]s.", - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - }, - { - "description": "Represents a map of [`String`] keys to [`Value`]s.", - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/Value" - } - } - ] - }, - "Number": { - "description": "A valid ACL number.", - "anyOf": [ - { - "description": "Represents an [`i64`].", - "type": "integer", - "format": "int64" - }, - { - "description": "Represents a [`f64`].", - "type": "number", - "format": "double" - } - ] - }, - "Target": { - "description": "Platform target.", - "oneOf": [ - { - "description": "MacOS.", - "type": "string", - "enum": [ - "macOS" - ] - }, - { - "description": "Windows.", - "type": "string", - "enum": [ - "windows" - ] - }, - { - "description": "Linux.", - "type": "string", - "enum": [ - "linux" - ] - }, - { - "description": "Android.", - "type": "string", - "enum": [ - "android" - ] - }, - { - "description": "iOS.", - "type": "string", - "enum": [ - "iOS" - ] - } - ] - }, - "PermissionKind": { - "type": "string", - "oneOf": [ - { - "description": "Enables the get_custom_llm_connection command without any pre-configured scope.", - "type": "string", - "const": "allow-get-custom-llm-connection", - "markdownDescription": "Enables the get_custom_llm_connection command without any pre-configured scope." - }, - { - "description": "Denies the get_custom_llm_connection command without any pre-configured scope.", - "type": "string", - "const": "deny-get-custom-llm-connection", - "markdownDescription": "Denies the get_custom_llm_connection command without any pre-configured scope." - }, - { - "description": "Enables the get_custom_llm_enabled command without any pre-configured scope.", - "type": "string", - "const": "allow-get-custom-llm-enabled", - "markdownDescription": "Enables the get_custom_llm_enabled command without any pre-configured scope." - }, - { - "description": "Denies the get_custom_llm_enabled command without any pre-configured scope.", - "type": "string", - "const": "deny-get-custom-llm-enabled", - "markdownDescription": "Denies the get_custom_llm_enabled command without any pre-configured scope." - }, - { - "description": "Enables the get_custom_llm_model command without any pre-configured scope.", - "type": "string", - "const": "allow-get-custom-llm-model", - "markdownDescription": "Enables the get_custom_llm_model command without any pre-configured scope." - }, - { - "description": "Denies the get_custom_llm_model command without any pre-configured scope.", - "type": "string", - "const": "deny-get-custom-llm-model", - "markdownDescription": "Denies the get_custom_llm_model command without any pre-configured scope." - }, - { - "description": "Enables the get_gemini_api_key command without any pre-configured scope.", - "type": "string", - "const": "allow-get-gemini-api-key", - "markdownDescription": "Enables the get_gemini_api_key command without any pre-configured scope." - }, - { - "description": "Denies the get_gemini_api_key command without any pre-configured scope.", - "type": "string", - "const": "deny-get-gemini-api-key", - "markdownDescription": "Denies the get_gemini_api_key command without any pre-configured scope." - }, - { - "description": "Enables the get_gemini_model command without any pre-configured scope.", - "type": "string", - "const": "allow-get-gemini-model", - "markdownDescription": "Enables the get_gemini_model command without any pre-configured scope." - }, - { - "description": "Denies the get_gemini_model command without any pre-configured scope.", - "type": "string", - "const": "deny-get-gemini-model", - "markdownDescription": "Denies the get_gemini_model command without any pre-configured scope." - }, - { - "description": "Enables the get_hyprcloud_enabled command without any pre-configured scope.", - "type": "string", - "const": "allow-get-hyprcloud-enabled", - "markdownDescription": "Enables the get_hyprcloud_enabled command without any pre-configured scope." - }, - { - "description": "Denies the get_hyprcloud_enabled command without any pre-configured scope.", - "type": "string", - "const": "deny-get-hyprcloud-enabled", - "markdownDescription": "Denies the get_hyprcloud_enabled command without any pre-configured scope." - }, - { - "description": "Enables the get_llm_connection command without any pre-configured scope.", - "type": "string", - "const": "allow-get-llm-connection", - "markdownDescription": "Enables the get_llm_connection command without any pre-configured scope." - }, - { - "description": "Denies the get_llm_connection command without any pre-configured scope.", - "type": "string", - "const": "deny-get-llm-connection", - "markdownDescription": "Denies the get_llm_connection command without any pre-configured scope." - }, - { - "description": "Enables the get_local_llm_connection command without any pre-configured scope.", - "type": "string", - "const": "allow-get-local-llm-connection", - "markdownDescription": "Enables the get_local_llm_connection command without any pre-configured scope." - }, - { - "description": "Denies the get_local_llm_connection command without any pre-configured scope.", - "type": "string", - "const": "deny-get-local-llm-connection", - "markdownDescription": "Denies the get_local_llm_connection command without any pre-configured scope." - }, - { - "description": "Enables the get_openai_api_key command without any pre-configured scope.", - "type": "string", - "const": "allow-get-openai-api-key", - "markdownDescription": "Enables the get_openai_api_key command without any pre-configured scope." - }, - { - "description": "Denies the get_openai_api_key command without any pre-configured scope.", - "type": "string", - "const": "deny-get-openai-api-key", - "markdownDescription": "Denies the get_openai_api_key command without any pre-configured scope." - }, - { - "description": "Enables the get_openai_model command without any pre-configured scope.", - "type": "string", - "const": "allow-get-openai-model", - "markdownDescription": "Enables the get_openai_model command without any pre-configured scope." - }, - { - "description": "Denies the get_openai_model command without any pre-configured scope.", - "type": "string", - "const": "deny-get-openai-model", - "markdownDescription": "Denies the get_openai_model command without any pre-configured scope." - }, - { - "description": "Enables the get_openrouter_api_key command without any pre-configured scope.", - "type": "string", - "const": "allow-get-openrouter-api-key", - "markdownDescription": "Enables the get_openrouter_api_key command without any pre-configured scope." - }, - { - "description": "Denies the get_openrouter_api_key command without any pre-configured scope.", - "type": "string", - "const": "deny-get-openrouter-api-key", - "markdownDescription": "Denies the get_openrouter_api_key command without any pre-configured scope." - }, - { - "description": "Enables the get_openrouter_model command without any pre-configured scope.", - "type": "string", - "const": "allow-get-openrouter-model", - "markdownDescription": "Enables the get_openrouter_model command without any pre-configured scope." - }, - { - "description": "Denies the get_openrouter_model command without any pre-configured scope.", - "type": "string", - "const": "deny-get-openrouter-model", - "markdownDescription": "Denies the get_openrouter_model command without any pre-configured scope." - }, - { - "description": "Enables the get_others_api_base command without any pre-configured scope.", - "type": "string", - "const": "allow-get-others-api-base", - "markdownDescription": "Enables the get_others_api_base command without any pre-configured scope." - }, - { - "description": "Denies the get_others_api_base command without any pre-configured scope.", - "type": "string", - "const": "deny-get-others-api-base", - "markdownDescription": "Denies the get_others_api_base command without any pre-configured scope." - }, - { - "description": "Enables the get_others_api_key command without any pre-configured scope.", - "type": "string", - "const": "allow-get-others-api-key", - "markdownDescription": "Enables the get_others_api_key command without any pre-configured scope." - }, - { - "description": "Denies the get_others_api_key command without any pre-configured scope.", - "type": "string", - "const": "deny-get-others-api-key", - "markdownDescription": "Denies the get_others_api_key command without any pre-configured scope." - }, - { - "description": "Enables the get_others_model command without any pre-configured scope.", - "type": "string", - "const": "allow-get-others-model", - "markdownDescription": "Enables the get_others_model command without any pre-configured scope." - }, - { - "description": "Denies the get_others_model command without any pre-configured scope.", - "type": "string", - "const": "deny-get-others-model", - "markdownDescription": "Denies the get_others_model command without any pre-configured scope." - }, - { - "description": "Enables the get_provider_source command without any pre-configured scope.", - "type": "string", - "const": "allow-get-provider-source", - "markdownDescription": "Enables the get_provider_source command without any pre-configured scope." - }, - { - "description": "Denies the get_provider_source command without any pre-configured scope.", - "type": "string", - "const": "deny-get-provider-source", - "markdownDescription": "Denies the get_provider_source command without any pre-configured scope." - }, - { - "description": "Enables the get_stt_connection command without any pre-configured scope.", - "type": "string", - "const": "allow-get-stt-connection", - "markdownDescription": "Enables the get_stt_connection command without any pre-configured scope." - }, - { - "description": "Denies the get_stt_connection command without any pre-configured scope.", - "type": "string", - "const": "deny-get-stt-connection", - "markdownDescription": "Denies the get_stt_connection command without any pre-configured scope." - }, - { - "description": "Enables the list_custom_llm_models command without any pre-configured scope.", - "type": "string", - "const": "allow-list-custom-llm-models", - "markdownDescription": "Enables the list_custom_llm_models command without any pre-configured scope." - }, - { - "description": "Denies the list_custom_llm_models command without any pre-configured scope.", - "type": "string", - "const": "deny-list-custom-llm-models", - "markdownDescription": "Denies the list_custom_llm_models command without any pre-configured scope." - }, - { - "description": "Enables the set_custom_llm_connection command without any pre-configured scope.", - "type": "string", - "const": "allow-set-custom-llm-connection", - "markdownDescription": "Enables the set_custom_llm_connection command without any pre-configured scope." - }, - { - "description": "Denies the set_custom_llm_connection command without any pre-configured scope.", - "type": "string", - "const": "deny-set-custom-llm-connection", - "markdownDescription": "Denies the set_custom_llm_connection command without any pre-configured scope." - }, - { - "description": "Enables the set_custom_llm_enabled command without any pre-configured scope.", - "type": "string", - "const": "allow-set-custom-llm-enabled", - "markdownDescription": "Enables the set_custom_llm_enabled command without any pre-configured scope." - }, - { - "description": "Denies the set_custom_llm_enabled command without any pre-configured scope.", - "type": "string", - "const": "deny-set-custom-llm-enabled", - "markdownDescription": "Denies the set_custom_llm_enabled command without any pre-configured scope." - }, - { - "description": "Enables the set_custom_llm_model command without any pre-configured scope.", - "type": "string", - "const": "allow-set-custom-llm-model", - "markdownDescription": "Enables the set_custom_llm_model command without any pre-configured scope." - }, - { - "description": "Denies the set_custom_llm_model command without any pre-configured scope.", - "type": "string", - "const": "deny-set-custom-llm-model", - "markdownDescription": "Denies the set_custom_llm_model command without any pre-configured scope." - }, - { - "description": "Enables the set_gemini_api_key command without any pre-configured scope.", - "type": "string", - "const": "allow-set-gemini-api-key", - "markdownDescription": "Enables the set_gemini_api_key command without any pre-configured scope." - }, - { - "description": "Denies the set_gemini_api_key command without any pre-configured scope.", - "type": "string", - "const": "deny-set-gemini-api-key", - "markdownDescription": "Denies the set_gemini_api_key command without any pre-configured scope." - }, - { - "description": "Enables the set_gemini_model command without any pre-configured scope.", - "type": "string", - "const": "allow-set-gemini-model", - "markdownDescription": "Enables the set_gemini_model command without any pre-configured scope." - }, - { - "description": "Denies the set_gemini_model command without any pre-configured scope.", - "type": "string", - "const": "deny-set-gemini-model", - "markdownDescription": "Denies the set_gemini_model command without any pre-configured scope." - }, - { - "description": "Enables the set_hyprcloud_enabled command without any pre-configured scope.", - "type": "string", - "const": "allow-set-hyprcloud-enabled", - "markdownDescription": "Enables the set_hyprcloud_enabled command without any pre-configured scope." - }, - { - "description": "Denies the set_hyprcloud_enabled command without any pre-configured scope.", - "type": "string", - "const": "deny-set-hyprcloud-enabled", - "markdownDescription": "Denies the set_hyprcloud_enabled command without any pre-configured scope." - }, - { - "description": "Enables the set_openai_api_key command without any pre-configured scope.", - "type": "string", - "const": "allow-set-openai-api-key", - "markdownDescription": "Enables the set_openai_api_key command without any pre-configured scope." - }, - { - "description": "Denies the set_openai_api_key command without any pre-configured scope.", - "type": "string", - "const": "deny-set-openai-api-key", - "markdownDescription": "Denies the set_openai_api_key command without any pre-configured scope." - }, - { - "description": "Enables the set_openai_model command without any pre-configured scope.", - "type": "string", - "const": "allow-set-openai-model", - "markdownDescription": "Enables the set_openai_model command without any pre-configured scope." - }, - { - "description": "Denies the set_openai_model command without any pre-configured scope.", - "type": "string", - "const": "deny-set-openai-model", - "markdownDescription": "Denies the set_openai_model command without any pre-configured scope." - }, - { - "description": "Enables the set_openrouter_api_key command without any pre-configured scope.", - "type": "string", - "const": "allow-set-openrouter-api-key", - "markdownDescription": "Enables the set_openrouter_api_key command without any pre-configured scope." - }, - { - "description": "Denies the set_openrouter_api_key command without any pre-configured scope.", - "type": "string", - "const": "deny-set-openrouter-api-key", - "markdownDescription": "Denies the set_openrouter_api_key command without any pre-configured scope." - }, - { - "description": "Enables the set_openrouter_model command without any pre-configured scope.", - "type": "string", - "const": "allow-set-openrouter-model", - "markdownDescription": "Enables the set_openrouter_model command without any pre-configured scope." - }, - { - "description": "Denies the set_openrouter_model command without any pre-configured scope.", - "type": "string", - "const": "deny-set-openrouter-model", - "markdownDescription": "Denies the set_openrouter_model command without any pre-configured scope." - }, - { - "description": "Enables the set_others_api_base command without any pre-configured scope.", - "type": "string", - "const": "allow-set-others-api-base", - "markdownDescription": "Enables the set_others_api_base command without any pre-configured scope." - }, - { - "description": "Denies the set_others_api_base command without any pre-configured scope.", - "type": "string", - "const": "deny-set-others-api-base", - "markdownDescription": "Denies the set_others_api_base command without any pre-configured scope." - }, - { - "description": "Enables the set_others_api_key command without any pre-configured scope.", - "type": "string", - "const": "allow-set-others-api-key", - "markdownDescription": "Enables the set_others_api_key command without any pre-configured scope." - }, - { - "description": "Denies the set_others_api_key command without any pre-configured scope.", - "type": "string", - "const": "deny-set-others-api-key", - "markdownDescription": "Denies the set_others_api_key command without any pre-configured scope." - }, - { - "description": "Enables the set_others_model command without any pre-configured scope.", - "type": "string", - "const": "allow-set-others-model", - "markdownDescription": "Enables the set_others_model command without any pre-configured scope." - }, - { - "description": "Denies the set_others_model command without any pre-configured scope.", - "type": "string", - "const": "deny-set-others-model", - "markdownDescription": "Denies the set_others_model command without any pre-configured scope." - }, - { - "description": "Enables the set_provider_source command without any pre-configured scope.", - "type": "string", - "const": "allow-set-provider-source", - "markdownDescription": "Enables the set_provider_source command without any pre-configured scope." - }, - { - "description": "Denies the set_provider_source command without any pre-configured scope.", - "type": "string", - "const": "deny-set-provider-source", - "markdownDescription": "Denies the set_provider_source command without any pre-configured scope." - }, - { - "description": "Default permissions for the plugin\n#### This default permission set includes:\n\n- `allow-list-custom-llm-models`\n- `allow-get-custom-llm-model`\n- `allow-set-custom-llm-model`\n- `allow-get-custom-llm-enabled`\n- `allow-set-custom-llm-enabled`\n- `allow-get-custom-llm-connection`\n- `allow-set-custom-llm-connection`\n- `allow-get-local-llm-connection`\n- `allow-get-llm-connection`\n- `allow-get-openai-api-key`\n- `allow-set-openai-api-key`\n- `allow-get-gemini-api-key`\n- `allow-set-gemini-api-key`\n- `allow-get-provider-source`\n- `allow-set-provider-source`\n- `allow-set-others-api-base`\n- `allow-get-others-api-base`\n- `allow-set-others-api-key`\n- `allow-get-others-api-key`\n- `allow-set-others-model`\n- `allow-get-others-model`\n- `allow-get-openai-model`\n- `allow-set-openai-model`\n- `allow-get-gemini-model`\n- `allow-set-gemini-model`\n- `allow-get-openrouter-api-key`\n- `allow-set-openrouter-api-key`\n- `allow-set-openrouter-model`\n- `allow-get-openrouter-model`\n- `allow-get-hyprcloud-enabled`\n- `allow-set-hyprcloud-enabled`", - "type": "string", - "const": "default", - "markdownDescription": "Default permissions for the plugin\n#### This default permission set includes:\n\n- `allow-list-custom-llm-models`\n- `allow-get-custom-llm-model`\n- `allow-set-custom-llm-model`\n- `allow-get-custom-llm-enabled`\n- `allow-set-custom-llm-enabled`\n- `allow-get-custom-llm-connection`\n- `allow-set-custom-llm-connection`\n- `allow-get-local-llm-connection`\n- `allow-get-llm-connection`\n- `allow-get-openai-api-key`\n- `allow-set-openai-api-key`\n- `allow-get-gemini-api-key`\n- `allow-set-gemini-api-key`\n- `allow-get-provider-source`\n- `allow-set-provider-source`\n- `allow-set-others-api-base`\n- `allow-get-others-api-base`\n- `allow-set-others-api-key`\n- `allow-get-others-api-key`\n- `allow-set-others-model`\n- `allow-get-others-model`\n- `allow-get-openai-model`\n- `allow-set-openai-model`\n- `allow-get-gemini-model`\n- `allow-set-gemini-model`\n- `allow-get-openrouter-api-key`\n- `allow-set-openrouter-api-key`\n- `allow-set-openrouter-model`\n- `allow-get-openrouter-model`\n- `allow-get-hyprcloud-enabled`\n- `allow-set-hyprcloud-enabled`" - } - ] - } - } -} \ No newline at end of file diff --git a/plugins/connector/src/commands.rs b/plugins/connector/src/commands.rs deleted file mode 100644 index e0382ff14..000000000 --- a/plugins/connector/src/commands.rs +++ /dev/null @@ -1,330 +0,0 @@ -use crate::{Connection, ConnectionLLM, ConnectorPluginExt, StoreKey}; - -#[tauri::command] -#[specta::specta] -pub async fn list_custom_llm_models( - app: tauri::AppHandle, -) -> Result, String> { - app.list_custom_llm_models() - .await - .map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn get_custom_llm_model( - app: tauri::AppHandle, -) -> Result, String> { - app.get_custom_llm_model().map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn set_custom_llm_model( - app: tauri::AppHandle, - model: String, -) -> Result<(), String> { - app.set_custom_llm_model(model).map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn get_custom_llm_enabled( - app: tauri::AppHandle, -) -> Result { - app.get_custom_llm_enabled().map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn set_custom_llm_enabled( - app: tauri::AppHandle, - enabled: bool, -) -> Result<(), String> { - app.set_custom_llm_enabled(enabled) - .map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn get_hyprcloud_enabled( - app: tauri::AppHandle, -) -> Result { - app.get_hyprcloud_enabled().map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn set_hyprcloud_enabled( - app: tauri::AppHandle, - enabled: bool, -) -> Result<(), String> { - app.set_hyprcloud_enabled(enabled) - .map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn get_custom_llm_connection( - app: tauri::AppHandle, -) -> Result, String> { - app.get_custom_llm_connection().map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn set_custom_llm_connection( - app: tauri::AppHandle, - connection: Connection, -) -> Result<(), String> { - app.set_custom_llm_connection(connection) - .map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn get_local_llm_connection( - app: tauri::AppHandle, -) -> Result { - app.get_local_llm_connection() - .await - .map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn get_llm_connection( - app: tauri::AppHandle, -) -> Result { - app.get_llm_connection().await.map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn get_openai_api_key( - app: tauri::AppHandle, -) -> Result { - let store = app.connector_store(); - let v = store - .get::(StoreKey::OpenaiApiKey) - .map_err(|e| e.to_string())?; - Ok(v.unwrap_or_default()) -} - -#[tauri::command] -#[specta::specta] -pub async fn get_openrouter_api_key( - app: tauri::AppHandle, -) -> Result { - let store = app.connector_store(); - let v = store - .get::(StoreKey::OpenrouterApiKey) - .map_err(|e| e.to_string())?; - Ok(v.unwrap_or_default()) -} - -#[tauri::command] -#[specta::specta] -pub async fn get_gemini_api_key( - app: tauri::AppHandle, -) -> Result { - let store = app.connector_store(); - let v = store - .get::(StoreKey::GeminiApiKey) - .map_err(|e| e.to_string())?; - Ok(v.unwrap_or_default()) -} - -#[tauri::command] -#[specta::specta] -pub async fn set_openai_api_key( - app: tauri::AppHandle, - api_key: String, -) -> Result<(), String> { - app.connector_store() - .set(StoreKey::OpenaiApiKey, api_key) - .map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn set_openrouter_api_key( - app: tauri::AppHandle, - api_key: String, -) -> Result<(), String> { - app.connector_store() - .set(StoreKey::OpenrouterApiKey, api_key) - .map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn set_gemini_api_key( - app: tauri::AppHandle, - api_key: String, -) -> Result<(), String> { - app.connector_store() - .set(StoreKey::GeminiApiKey, api_key) - .map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn get_provider_source( - app: tauri::AppHandle, -) -> Result { - let store = app.connector_store(); - let v = store - .get::(StoreKey::ProviderSource) - .map_err(|e| e.to_string())?; - Ok(v.unwrap_or_default()) -} - -#[tauri::command] -#[specta::specta] -pub async fn set_provider_source( - app: tauri::AppHandle, - source: String, -) -> Result<(), String> { - app.connector_store() - .set(StoreKey::ProviderSource, source) - .map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn get_others_api_key( - app: tauri::AppHandle, -) -> Result { - let store = app.connector_store(); - let v = store - .get::(StoreKey::OthersApiKey) - .map_err(|e| e.to_string())?; - Ok(v.unwrap_or_default()) -} - -#[tauri::command] -#[specta::specta] -pub async fn set_others_api_key( - app: tauri::AppHandle, - api_key: String, -) -> Result<(), String> { - app.connector_store() - .set(StoreKey::OthersApiKey, api_key) - .map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn get_others_api_base( - app: tauri::AppHandle, -) -> Result { - let store = app.connector_store(); - let v = store - .get::(StoreKey::OthersApiBase) - .map_err(|e| e.to_string())?; - Ok(v.unwrap_or_default()) -} - -#[tauri::command] -#[specta::specta] -pub async fn set_others_api_base( - app: tauri::AppHandle, - api_base: String, -) -> Result<(), String> { - app.connector_store() - .set(StoreKey::OthersApiBase, api_base) - .map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn get_others_model( - app: tauri::AppHandle, -) -> Result { - let store = app.connector_store(); - let v = store - .get::(StoreKey::OthersModel) - .map_err(|e| e.to_string())?; - Ok(v.unwrap_or_default()) -} - -#[tauri::command] -#[specta::specta] -pub async fn set_others_model( - app: tauri::AppHandle, - model: String, -) -> Result<(), String> { - app.connector_store() - .set(StoreKey::OthersModel, model) - .map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn set_openai_model( - app: tauri::AppHandle, - model: String, -) -> Result<(), String> { - app.connector_store() - .set(StoreKey::OpenaiModel, model) - .map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn get_openai_model( - app: tauri::AppHandle, -) -> Result { - let store = app.connector_store(); - let v = store - .get::(StoreKey::OpenaiModel) - .map_err(|e| e.to_string())?; - Ok(v.unwrap_or_default()) -} - -#[tauri::command] -#[specta::specta] -pub async fn set_gemini_model( - app: tauri::AppHandle, - model: String, -) -> Result<(), String> { - app.connector_store() - .set(StoreKey::GeminiModel, model) - .map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn get_gemini_model( - app: tauri::AppHandle, -) -> Result { - let store = app.connector_store(); - let v = store - .get::(StoreKey::GeminiModel) - .map_err(|e| e.to_string())?; - Ok(v.unwrap_or_default()) -} - -#[tauri::command] -#[specta::specta] -pub async fn set_openrouter_model( - app: tauri::AppHandle, - model: String, -) -> Result<(), String> { - app.connector_store() - .set(StoreKey::OpenrouterModel, model) - .map_err(|e| e.to_string()) -} - -#[tauri::command] -#[specta::specta] -pub async fn get_openrouter_model( - app: tauri::AppHandle, -) -> Result { - let store = app.connector_store(); - let v = store - .get::(StoreKey::OpenrouterModel) - .map_err(|e| e.to_string())?; - Ok(v.unwrap_or_default()) -} diff --git a/plugins/connector/src/error.rs b/plugins/connector/src/error.rs deleted file mode 100644 index 90992d282..000000000 --- a/plugins/connector/src/error.rs +++ /dev/null @@ -1,30 +0,0 @@ -use serde::{ser::Serializer, Serialize}; - -#[derive(Debug, thiserror::Error)] -pub enum Error { - #[error(transparent)] - AuthError(#[from] tauri_plugin_auth::Error), - #[error(transparent)] - LocalLlmError(#[from] tauri_plugin_local_llm::Error), - #[error(transparent)] - LocalSttError(#[from] tauri_plugin_local_stt::Error), - #[error(transparent)] - StoreError(#[from] tauri_plugin_store2::Error), - #[error(transparent)] - ReqwestError(#[from] reqwest::Error), - #[error(transparent)] - UrlParseError(#[from] url::ParseError), - #[error("no models found")] - NoModelsFound, - #[error("custom error: {0}")] - UnknownError(String), -} - -impl Serialize for Error { - fn serialize(&self, serializer: S) -> std::result::Result - where - S: Serializer, - { - serializer.serialize_str(self.to_string().as_ref()) - } -} diff --git a/plugins/connector/src/ext.rs b/plugins/connector/src/ext.rs deleted file mode 100644 index 4285ac764..000000000 --- a/plugins/connector/src/ext.rs +++ /dev/null @@ -1,224 +0,0 @@ -use std::future::Future; - -use crate::{Connection, ConnectionLLM, StoreKey}; -use tauri_plugin_store2::StorePluginExt; - -pub trait ConnectorPluginExt { - fn connector_store(&self) -> tauri_plugin_store2::ScopedStore; - - fn list_custom_llm_models(&self) -> impl Future, crate::Error>>; - - fn get_custom_llm_model(&self) -> Result, crate::Error>; - fn set_custom_llm_model(&self, model: String) -> Result<(), crate::Error>; - - fn set_custom_llm_enabled(&self, enabled: bool) -> Result<(), crate::Error>; - fn get_custom_llm_enabled(&self) -> Result; - - fn get_hyprcloud_enabled(&self) -> Result; - fn set_hyprcloud_enabled(&self, enabled: bool) -> Result<(), crate::Error>; - - fn get_local_llm_connection(&self) - -> impl Future>; - - fn get_custom_llm_connection(&self) -> Result, crate::Error>; - fn set_custom_llm_connection(&self, connection: Connection) -> Result<(), crate::Error>; - - fn get_llm_connection(&self) -> impl Future>; - - fn get_admin_connection(&self) -> Result, crate::Error>; - fn set_admin_connection(&self, connection: Connection) -> Result<(), crate::Error>; -} - -impl> ConnectorPluginExt for T { - fn connector_store(&self) -> tauri_plugin_store2::ScopedStore { - self.scoped_store(crate::PLUGIN_NAME).unwrap() - } - - async fn list_custom_llm_models(&self) -> Result, crate::Error> { - let conn = self.get_custom_llm_connection()?; - - match conn { - Some(c) => { - let llm_conn = ConnectionLLM::Custom(Connection { - api_base: c.api_base, - api_key: c.api_key, - }); - - llm_conn.models().await - } - _ => Ok(vec![]), - } - } - - fn get_custom_llm_model(&self) -> Result, crate::Error> { - Ok(self.connector_store().get(StoreKey::CustomModel)?.flatten()) - } - - fn set_custom_llm_model(&self, model: String) -> Result<(), crate::Error> { - self.connector_store().set(StoreKey::CustomModel, model)?; - Ok(()) - } - - fn set_custom_llm_enabled(&self, enabled: bool) -> Result<(), crate::Error> { - self.connector_store() - .set(StoreKey::CustomEnabled, enabled)?; - Ok(()) - } - - fn get_hyprcloud_enabled(&self) -> Result { - Ok(self - .connector_store() - .get(StoreKey::HyprCloudEnabled)? - .unwrap_or(false)) - } - - fn set_hyprcloud_enabled(&self, enabled: bool) -> Result<(), crate::Error> { - self.connector_store() - .set(StoreKey::HyprCloudEnabled, enabled)?; - Ok(()) - } - - fn get_custom_llm_enabled(&self) -> Result { - Ok(self - .connector_store() - .get(StoreKey::CustomEnabled)? - .unwrap_or(false)) - } - - fn set_custom_llm_connection(&self, connection: Connection) -> Result<(), crate::Error> { - self.connector_store() - .set(StoreKey::CustomApiBase, connection.api_base)?; - self.connector_store() - .set(StoreKey::CustomApiKey, connection.api_key)?; - - Ok(()) - } - - fn get_custom_llm_connection(&self) -> Result, crate::Error> { - let api_base = self.connector_store().get(StoreKey::CustomApiBase)?; - let api_key = self.connector_store().get(StoreKey::CustomApiKey)?; - - match (api_base, api_key) { - (Some(api_base), Some(api_key)) => Ok(Some(Connection { api_base, api_key })), - _ => Ok(None), - } - } - - async fn get_local_llm_connection(&self) -> Result { - use tauri_plugin_local_llm::{LocalLlmPluginExt, SharedState}; - - let api_base = if self.is_server_running().await { - let state = self.state::(); - let guard = state.lock().await; - guard.api_base.clone().unwrap() - } else { - self.start_server().await? - }; - - let conn = ConnectionLLM::HyprLocal(Connection { - api_base, - api_key: None, - }); - Ok(conn) - } - - async fn get_llm_connection(&self) -> Result { - let store = self.connector_store(); - let custom_enabled = self.get_custom_llm_enabled()?; - let hyprcloud_enabled = self.get_hyprcloud_enabled()?; - - if custom_enabled { - // If HyprCloud is enabled, override with HyprCloud connection - if hyprcloud_enabled { - let conn = ConnectionLLM::Custom(Connection { - api_base: "https://pro.hyprnote.com".to_string(), - api_key: None, - }); - Ok(conn) - } else { - // Regular custom endpoint - let api_base = store - .get::>(StoreKey::CustomApiBase)? - .flatten() - .unwrap_or_default(); - let api_key = store - .get::>(StoreKey::CustomApiKey)? - .flatten(); - - let conn = ConnectionLLM::Custom(Connection { api_base, api_key }); - Ok(conn) - } - } else { - let conn = self.get_local_llm_connection().await?; - Ok(conn) - } - } - - fn get_admin_connection(&self) -> Result, crate::Error> { - let api_base = self.connector_store().get(StoreKey::AdminApiBase)?; - let api_key = self.connector_store().get(StoreKey::AdminApiKey)?; - - match (api_base, api_key) { - (Some(api_base), Some(api_key)) => Ok(Some(Connection { api_base, api_key })), - _ => Ok(None), - } - } - - fn set_admin_connection(&self, connection: Connection) -> Result<(), crate::Error> { - self.connector_store() - .set(StoreKey::AdminApiBase, connection.api_base)?; - self.connector_store() - .set(StoreKey::AdminApiKey, connection.api_key)?; - - Ok(()) - } -} - -trait OpenaiCompatible { - fn models(&self) -> impl Future, crate::Error>>; -} - -impl OpenaiCompatible for ConnectionLLM { - async fn models(&self) -> Result, crate::Error> { - let conn = self.as_ref(); - let api_base = &conn.api_base; - let api_key = &conn.api_key; - - let url = { - let mut u = url::Url::parse(api_base)?; - u.set_path("/v1/models"); - u - }; - - let mut req = reqwest::Client::new().get(url); - if let Some(api_key) = api_key { - req = req.bearer_auth(api_key); - } - - let res: serde_json::Value = req.send().await?.json().await?; - let data = res["data"].as_array(); - let models = match data { - None => return Err(crate::Error::UnknownError(format!("no_models: {:?}", res))), - Some(models) => models - .iter() - .filter_map(|v| v["id"].as_str().map(String::from)) - .filter(|id| { - ![ - "audio", - "video", - "image", - "tts", - "dall-e", - "moderation", - "transcribe", - "embedding", - ] - .iter() - .any(|&excluded| id.contains(excluded)) - }) - .collect(), - }; - - Ok(models) - } -} diff --git a/plugins/connector/src/lib.rs b/plugins/connector/src/lib.rs deleted file mode 100644 index 0e363d06c..000000000 --- a/plugins/connector/src/lib.rs +++ /dev/null @@ -1,89 +0,0 @@ -mod commands; -mod error; -mod ext; -mod store; -mod types; - -pub use error::*; -pub use ext::*; -pub use store::*; -pub use types::*; - -const PLUGIN_NAME: &str = "connector"; - -fn make_specta_builder() -> tauri_specta::Builder { - tauri_specta::Builder::::new() - .plugin_name(PLUGIN_NAME) - .commands(tauri_specta::collect_commands![ - commands::list_custom_llm_models::, - commands::get_custom_llm_model::, - commands::set_custom_llm_model::, - commands::get_custom_llm_enabled::, - commands::set_custom_llm_enabled::, - commands::get_custom_llm_connection::, - commands::set_custom_llm_connection::, - commands::get_local_llm_connection::, - commands::get_llm_connection::, - commands::get_openai_api_key::, - commands::set_openai_api_key::, - commands::get_gemini_api_key::, - commands::set_gemini_api_key::, - commands::get_provider_source::, - commands::set_provider_source::, - commands::get_others_api_key::, - commands::set_others_api_key::, - commands::get_others_api_base::, - commands::set_others_api_base::, - commands::get_others_model::, - commands::set_others_model::, - commands::get_openai_model::, - commands::set_openai_model::, - commands::get_gemini_model::, - commands::set_gemini_model::, - commands::get_openrouter_model::, - commands::set_openrouter_model::, - commands::get_openrouter_api_key::, - commands::set_openrouter_api_key::, - commands::get_hyprcloud_enabled::, - commands::set_hyprcloud_enabled::, - ]) - .error_handling(tauri_specta::ErrorHandlingMode::Throw) -} - -pub fn init() -> tauri::plugin::TauriPlugin { - let specta_builder = make_specta_builder(); - - tauri::plugin::Builder::new(PLUGIN_NAME) - .invoke_handler(specta_builder.invoke_handler()) - .build() -} - -#[cfg(test)] -mod test { - use super::*; - - #[test] - fn export_types() { - make_specta_builder::() - .export( - specta_typescript::Typescript::default() - .header("// @ts-nocheck\n\n") - .formatter(specta_typescript::formatter::prettier) - .bigint(specta_typescript::BigIntExportBehavior::Number), - "./js/bindings.gen.ts", - ) - .unwrap() - } - - fn create_app(builder: tauri::Builder) -> tauri::App { - builder - .plugin(init()) - .build(tauri::test::mock_context(tauri::test::noop_assets())) - .unwrap() - } - - #[test] - fn test_connector() { - let _app = create_app(tauri::test::mock_builder()); - } -} diff --git a/plugins/connector/src/store.rs b/plugins/connector/src/store.rs deleted file mode 100644 index ec3422d38..000000000 --- a/plugins/connector/src/store.rs +++ /dev/null @@ -1,24 +0,0 @@ -use tauri_plugin_store2::ScopedStoreKey; - -#[derive(serde::Deserialize, specta::Type, PartialEq, Eq, Hash, strum::Display)] -pub enum StoreKey { - CustomEnabled, - CustomApiBase, - CustomApiKey, - CustomModel, - AdminApiBase, - AdminApiKey, - OpenaiApiKey, - OpenrouterApiKey, - GeminiApiKey, - ProviderSource, - OthersApiKey, - OthersApiBase, - OthersModel, - OpenaiModel, - GeminiModel, - OpenrouterModel, - HyprCloudEnabled, -} - -impl ScopedStoreKey for StoreKey {} diff --git a/plugins/connector/src/types.rs b/plugins/connector/src/types.rs deleted file mode 100644 index 85f5016bf..000000000 --- a/plugins/connector/src/types.rs +++ /dev/null @@ -1,33 +0,0 @@ -#[derive(Debug, serde::Deserialize, serde::Serialize, specta::Type)] -pub struct Connection { - pub api_base: String, - pub api_key: Option, -} - -#[derive(Debug, serde::Deserialize, serde::Serialize, specta::Type)] -#[serde(tag = "type", content = "connection")] -pub enum ConnectionLLM { - HyprCloud(Connection), - HyprLocal(Connection), - Custom(Connection), -} - -impl From for Connection { - fn from(value: ConnectionLLM) -> Self { - match value { - ConnectionLLM::HyprCloud(conn) => conn, - ConnectionLLM::HyprLocal(conn) => conn, - ConnectionLLM::Custom(conn) => conn, - } - } -} - -impl AsRef for ConnectionLLM { - fn as_ref(&self) -> &Connection { - match self { - ConnectionLLM::HyprCloud(conn) => conn, - ConnectionLLM::HyprLocal(conn) => conn, - ConnectionLLM::Custom(conn) => conn, - } - } -} diff --git a/plugins/connector/tsconfig.json b/plugins/connector/tsconfig.json deleted file mode 100644 index 13b985325..000000000 --- a/plugins/connector/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": "../tsconfig.base.json", - "include": ["./js/*.ts"], - "exclude": ["node_modules"] -} diff --git a/plugins/listener/Cargo.toml b/plugins/listener/Cargo.toml index e13b72e8e..471eee7b1 100644 --- a/plugins/listener/Cargo.toml +++ b/plugins/listener/Cargo.toml @@ -22,8 +22,6 @@ hypr-agc = { workspace = true } hypr-audio = { workspace = true } hypr-audio-utils = { workspace = true } hypr-data = { workspace = true } -hypr-db-core = { workspace = true } -hypr-db-user = { workspace = true } hypr-language = { workspace = true } hypr-llm = { workspace = true } hypr-tcc = { workspace = true } @@ -33,8 +31,6 @@ owhisper-client = { workspace = true } owhisper-interface = { workspace = true } tauri-plugin-auth = { workspace = true } -tauri-plugin-connector = { workspace = true } -tauri-plugin-db = { workspace = true } tauri-plugin-local-stt = { workspace = true } tauri-plugin-shell = { workspace = true } tauri-plugin-tray = { workspace = true } @@ -70,18 +66,3 @@ tracing = { workspace = true } [target."cfg(target_os = \"macos\")".dependencies] objc2 = { workspace = true } objc2-foundation = { workspace = true } - -[features] -default = [] -v0 = [ - "tauri-plugin-windows", - "tauri-plugin-windows/v0", - "tauri-plugin-local-stt/v0", - "tauri-plugin-tray/v0", -] -v1 = [ - "tauri-plugin-windows", - "tauri-plugin-windows/v1", - "tauri-plugin-local-stt/v1", - "tauri-plugin-tray/v1", -] diff --git a/plugins/listener/js/bindings.gen.ts b/plugins/listener/js/bindings.gen.ts index 9a67aa645..98f5fa72f 100644 --- a/plugins/listener/js/bindings.gen.ts +++ b/plugins/listener/js/bindings.gen.ts @@ -76,7 +76,7 @@ export type Alternatives = { transcript: string; words: Word[]; confidence: numb export type Channel = { alternatives: Alternatives[] } export type Metadata = { request_id: string; model_info: ModelInfo; model_uuid: string } export type ModelInfo = { name: string; version: string; arch: string } -export type SessionEvent = { type: "inactive" } | { type: "running_active" } | { type: "audioAmplitude"; mic: number; speaker: number } | { type: "micMuted"; value: boolean } | { type: "speakerMuted"; value: boolean } | { type: "finalWords"; response: StreamResponse } +export type SessionEvent = { type: "inactive" } | { type: "running_active" } | { type: "audioAmplitude"; mic: number; speaker: number } | { type: "micMuted"; value: boolean } | { type: "speakerMuted"; value: boolean } | { type: "streamResponse"; response: StreamResponse } export type StreamResponse = { type: string; start: number; duration: number; is_final: boolean; speech_final: boolean; from_finalize: boolean; channel: Channel; metadata: Metadata; channel_index: number[] } | { request_id: string; created: string; duration: number; channels: number } | { type: string; channel: number[]; timestamp: number } | { type: string; channel: number[]; last_word_end: number } export type Word = { word: string; start: number; end: number; confidence: number; speaker: number | null; punctuated_word: string | null; language: string | null } diff --git a/plugins/listener/src/actors/session.rs b/plugins/listener/src/actors/session.rs index c7a797e7e..2227bed88 100644 --- a/plugins/listener/src/actors/session.rs +++ b/plugins/listener/src/actors/session.rs @@ -57,33 +57,20 @@ impl Actor for SessionActor { myself: ActorRef, args: Self::Arguments, ) -> Result { - use tauri_plugin_db::{DatabasePluginExt, UserDatabase}; - let session_id = args.session_id.clone(); - let onboarding_session_id = UserDatabase::onboarding_session_id(); - let onboarding = session_id == onboarding_session_id; - let user_id = args.app.db_user_id().await?.unwrap(); - - let config = args.app.db_get_config(&user_id).await?; - let record_enabled = config - .as_ref() - .is_none_or(|c| c.general.save_recordings.unwrap_or(true)); - let languages = config.as_ref().map_or_else( - || vec![hypr_language::ISO639::En.into()], - |c| c.general.spoken_languages.clone(), - ); - let cancellation_token = CancellationToken::new(); - if let Ok(Some(mut session)) = args.app.db_get_session(&args.session_id).await { - session.record_start = Some(chrono::Utc::now()); - let _ = args.app.db_upsert_session(session).await; - } + let cancellation_token = CancellationToken::new(); { use tauri_plugin_tray::TrayPluginExt; let _ = args.app.set_start_disabled(true); } + // TODO + let languages = vec![hypr_language::ISO639::En.into()]; + let onboarding = false; + let record_enabled = false; + let state = SessionState { app: args.app, session_id, @@ -223,13 +210,6 @@ impl Actor for SessionActor { Self::stop_all_actors().await; } - use tauri_plugin_db::DatabasePluginExt; - - if let Ok(Some(mut session)) = state.app.db_get_session(&state.session_id).await { - session.record_end = Some(chrono::Utc::now()); - let _ = state.app.db_upsert_session(session).await; - } - { use tauri_plugin_tray::TrayPluginExt; let _ = state.app.set_start_disabled(false); diff --git a/plugins/listener/src/error.rs b/plugins/listener/src/error.rs index e3d6f8481..6a3952b10 100644 --- a/plugins/listener/src/error.rs +++ b/plugins/listener/src/error.rs @@ -11,11 +11,7 @@ pub enum Error { #[error(transparent)] CpalDevicesError(#[from] hypr_audio::cpal::DevicesError), #[error(transparent)] - DatabaseError(#[from] tauri_plugin_db::Error), - #[error(transparent)] LocalSttError(#[from] tauri_plugin_local_stt::Error), - #[error(transparent)] - ConnectorError(#[from] tauri_plugin_connector::Error), #[error("no session")] NoneSession, #[error("start session failed")] diff --git a/plugins/listener/src/events.rs b/plugins/listener/src/events.rs index 8e2799102..dde66a374 100644 --- a/plugins/listener/src/events.rs +++ b/plugins/listener/src/events.rs @@ -19,7 +19,7 @@ common_event_derives! { MicMuted { value: bool }, #[serde(rename = "speakerMuted")] SpeakerMuted { value: bool }, - #[serde(rename = "finalWords")] + #[serde(rename = "streamResponse")] StreamResponse { response: owhisper_interface::StreamResponse }, } } diff --git a/plugins/local-llm/Cargo.toml b/plugins/local-llm/Cargo.toml index d164f2c2d..89c97d965 100644 --- a/plugins/local-llm/Cargo.toml +++ b/plugins/local-llm/Cargo.toml @@ -13,8 +13,6 @@ metal = ["hypr-llama/metal"] cuda = ["hypr-llama/cuda"] vulkan = ["hypr-llama/vulkan"] native = ["hypr-llama/native"] -v0 = ["tauri-plugin-windows", "tauri-plugin-windows/v0"] -v1 = ["tauri-plugin-windows", "tauri-plugin-windows/v1"] [build-dependencies] tauri-plugin = { workspace = true, features = ["build"] } diff --git a/plugins/local-stt/Cargo.toml b/plugins/local-stt/Cargo.toml index 4364ee2ef..86b7b5deb 100644 --- a/plugins/local-stt/Cargo.toml +++ b/plugins/local-stt/Cargo.toml @@ -18,8 +18,6 @@ metal = ["hypr-transcribe-whisper-local/metal"] vulkan = ["hypr-transcribe-whisper-local/vulkan"] openmp = ["hypr-transcribe-whisper-local/openmp"] load-dynamic = ["hypr-transcribe-whisper-local/load-dynamic"] -v0 = ["tauri-plugin-windows", "tauri-plugin-windows/v0"] -v1 = ["tauri-plugin-windows", "tauri-plugin-windows/v1"] [build-dependencies] tauri-plugin = { workspace = true, features = ["build"] } diff --git a/plugins/notification/Cargo.toml b/plugins/notification/Cargo.toml index 0c6de14fc..6aa070ddf 100644 --- a/plugins/notification/Cargo.toml +++ b/plugins/notification/Cargo.toml @@ -42,8 +42,3 @@ tauri-specta = { workspace = true, features = ["derive", "typescript"] } apalis = { workspace = true } apalis-cron = { workspace = true } chrono = { workspace = true } - -[features] -default = [] -v0 = ["tauri-plugin-windows", "tauri-plugin-windows/v0"] -v1 = ["tauri-plugin-windows", "tauri-plugin-windows/v1"] diff --git a/plugins/tray/Cargo.toml b/plugins/tray/Cargo.toml index eed0eaa54..ea6d8f218 100644 --- a/plugins/tray/Cargo.toml +++ b/plugins/tray/Cargo.toml @@ -25,8 +25,3 @@ tauri-plugin-windows = { workspace = true, optional = true } serde_json = { workspace = true } specta = { workspace = true } - -[features] -default = [] -v0 = ["tauri-plugin-windows", "tauri-plugin-windows/v0"] -v1 = ["tauri-plugin-windows", "tauri-plugin-windows/v1"] diff --git a/plugins/windows/Cargo.toml b/plugins/windows/Cargo.toml index 875521797..23a84a5ee 100644 --- a/plugins/windows/Cargo.toml +++ b/plugins/windows/Cargo.toml @@ -38,8 +38,3 @@ once_cell = { workspace = true } thiserror = { workspace = true } tokio = { workspace = true, features = ["time"] } tracing = { workspace = true } - -[features] -default = [] -v0 = [] -v1 = [] diff --git a/plugins/windows/js/bindings.gen.ts b/plugins/windows/js/bindings.gen.ts index efd0a3b01..3a73d96f6 100644 --- a/plugins/windows/js/bindings.gen.ts +++ b/plugins/windows/js/bindings.gen.ts @@ -19,6 +19,9 @@ async windowNavigate(window: AppWindow, path: string) : Promise { async windowEmitNavigate(window: AppWindow, event: Navigate) : Promise { return await TAURI_INVOKE("plugin:windows|window_emit_navigate", { window, event }); }, +async windowIsExists(window: AppWindow) : Promise { + return await TAURI_INVOKE("plugin:windows|window_is_exists", { window }); +}, async setFakeWindowBounds(name: string, bounds: OverlayBound) : Promise { return await TAURI_INVOKE("plugin:windows|set_fake_window_bounds", { name, bounds }); }, @@ -46,7 +49,7 @@ windowDestroyed: "plugin:windows:window-destroyed" /** user-defined types **/ -export type AppWindow = { type: "main" } | { type: "note"; value: string } | { type: "human"; value: string } | { type: "organization"; value: string } | { type: "finder" } | { type: "settings" } | { type: "video"; value: string } | { type: "control" } +export type AppWindow = { type: "onboarding" } | { type: "main" } | { type: "settings" } | { type: "auth" } | { type: "chat" } export type JsonValue = null | boolean | number | string | JsonValue[] | Partial<{ [key in string]: JsonValue }> export type MainWindowState = { left_sidebar_expanded: boolean | null; right_panel_expanded: boolean | null } export type Navigate = { path: string; search: Partial<{ [key in string]: JsonValue }> | null } diff --git a/plugins/windows/js/bindings.v1.gen.ts b/plugins/windows/js/bindings.v1.gen.ts deleted file mode 100644 index 3a73d96f6..000000000 --- a/plugins/windows/js/bindings.v1.gen.ts +++ /dev/null @@ -1,117 +0,0 @@ -// @ts-nocheck - - -// This file was generated by [tauri-specta](https://github.com/oscartbeaumont/tauri-specta). Do not edit this file manually. - -/** user-defined commands **/ - - -export const commands = { -async windowShow(window: AppWindow) : Promise { - return await TAURI_INVOKE("plugin:windows|window_show", { window }); -}, -async windowDestroy(window: AppWindow) : Promise { - return await TAURI_INVOKE("plugin:windows|window_destroy", { window }); -}, -async windowNavigate(window: AppWindow, path: string) : Promise { - return await TAURI_INVOKE("plugin:windows|window_navigate", { window, path }); -}, -async windowEmitNavigate(window: AppWindow, event: Navigate) : Promise { - return await TAURI_INVOKE("plugin:windows|window_emit_navigate", { window, event }); -}, -async windowIsExists(window: AppWindow) : Promise { - return await TAURI_INVOKE("plugin:windows|window_is_exists", { window }); -}, -async setFakeWindowBounds(name: string, bounds: OverlayBound) : Promise { - return await TAURI_INVOKE("plugin:windows|set_fake_window_bounds", { name, bounds }); -}, -async removeFakeWindow(name: string) : Promise { - return await TAURI_INVOKE("plugin:windows|remove_fake_window", { name }); -} -} - -/** user-defined events **/ - - -export const events = __makeEvents__<{ -mainWindowState: MainWindowState, -navigate: Navigate, -windowDestroyed: WindowDestroyed -}>({ -mainWindowState: "plugin:windows:main-window-state", -navigate: "plugin:windows:navigate", -windowDestroyed: "plugin:windows:window-destroyed" -}) - -/** user-defined constants **/ - - - -/** user-defined types **/ - -export type AppWindow = { type: "onboarding" } | { type: "main" } | { type: "settings" } | { type: "auth" } | { type: "chat" } -export type JsonValue = null | boolean | number | string | JsonValue[] | Partial<{ [key in string]: JsonValue }> -export type MainWindowState = { left_sidebar_expanded: boolean | null; right_panel_expanded: boolean | null } -export type Navigate = { path: string; search: Partial<{ [key in string]: JsonValue }> | null } -export type OverlayBound = { x: number; y: number; width: number; height: number } -export type WindowDestroyed = { window: AppWindow } - -/** tauri-specta globals **/ - -import { - invoke as TAURI_INVOKE, - Channel as TAURI_CHANNEL, -} from "@tauri-apps/api/core"; -import * as TAURI_API_EVENT from "@tauri-apps/api/event"; -import { type WebviewWindow as __WebviewWindow__ } from "@tauri-apps/api/webviewWindow"; - -type __EventObj__ = { - listen: ( - cb: TAURI_API_EVENT.EventCallback, - ) => ReturnType>; - once: ( - cb: TAURI_API_EVENT.EventCallback, - ) => ReturnType>; - emit: null extends T - ? (payload?: T) => ReturnType - : (payload: T) => ReturnType; -}; - -export type Result = - | { status: "ok"; data: T } - | { status: "error"; error: E }; - -function __makeEvents__>( - mappings: Record, -) { - return new Proxy( - {} as unknown as { - [K in keyof T]: __EventObj__ & { - (handle: __WebviewWindow__): __EventObj__; - }; - }, - { - get: (_, event) => { - const name = mappings[event as keyof T]; - - return new Proxy((() => {}) as any, { - apply: (_, __, [window]: [__WebviewWindow__]) => ({ - listen: (arg: any) => window.listen(name, arg), - once: (arg: any) => window.once(name, arg), - emit: (arg: any) => window.emit(name, arg), - }), - get: (_, command: keyof __EventObj__) => { - switch (command) { - case "listen": - return (arg: any) => TAURI_API_EVENT.listen(name, arg); - case "once": - return (arg: any) => TAURI_API_EVENT.once(name, arg); - case "emit": - return (arg: any) => TAURI_API_EVENT.emit(name, arg); - } - }, - }); - }, - }, - ); -} diff --git a/plugins/windows/src/lib.rs b/plugins/windows/src/lib.rs index 255649d21..41afef28e 100644 --- a/plugins/windows/src/lib.rs +++ b/plugins/windows/src/lib.rs @@ -88,10 +88,6 @@ mod test { #[test] fn export_types() { - #[cfg(feature = "v1")] - const OUTPUT_FILE: &str = "./js/bindings.v1.gen.ts"; - - #[cfg(not(feature = "v1"))] const OUTPUT_FILE: &str = "./js/bindings.gen.ts"; make_specta_builder() diff --git a/plugins/windows/src/window/mod.rs b/plugins/windows/src/window/mod.rs index 754f00bc1..b2712e41f 100644 --- a/plugins/windows/src/window/mod.rs +++ b/plugins/windows/src/window/mod.rs @@ -1,17 +1,5 @@ -#[cfg(all(feature = "v0", feature = "v1"))] -compile_error!("Cannot enable both 'v0' and 'v1' features at the same time"); +mod v1; -#[cfg(not(any(feature = "v0", feature = "v1")))] -compile_error!("Either 'v0' or 'v1' feature must be enabled"); - -#[cfg(feature = "v0")] -pub mod v0; -#[cfg(feature = "v1")] -pub mod v1; - -#[cfg(feature = "v0")] -pub type AppWindow = v0::AppWindow; -#[cfg(feature = "v1")] pub type AppWindow = v1::AppWindow; pub trait WindowImpl: diff --git a/plugins/windows/src/window/v0.rs b/plugins/windows/src/window/v0.rs deleted file mode 100644 index 39ad39002..000000000 --- a/plugins/windows/src/window/v0.rs +++ /dev/null @@ -1,268 +0,0 @@ -use crate::WindowImpl; - -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, specta::Type, PartialEq, Eq, Hash)] -#[serde(tag = "type", content = "value")] -pub enum AppWindow { - #[serde(rename = "main")] - Main, - #[serde(rename = "note")] - Note(String), - #[serde(rename = "human")] - Human(String), - #[serde(rename = "organization")] - Organization(String), - #[serde(rename = "finder")] - Finder, - #[serde(rename = "settings")] - Settings, - #[serde(rename = "video")] - Video(String), - #[serde(rename = "control")] - Control, -} - -impl std::fmt::Display for AppWindow { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Main => write!(f, "main"), - Self::Note(id) => write!(f, "note-{}", id), - Self::Human(id) => write!(f, "human-{}", id), - Self::Organization(id) => write!(f, "organization-{}", id), - Self::Finder => write!(f, "finder"), - Self::Settings => write!(f, "settings"), - Self::Video(id) => write!(f, "video-{}", id), - Self::Control => write!(f, "control"), - } - } -} - -impl std::str::FromStr for AppWindow { - type Err = strum::ParseError; - - fn from_str(s: &str) -> Result { - match s { - "main" => return Ok(Self::Main), - "finder" => return Ok(Self::Finder), - "settings" => return Ok(Self::Settings), - _ => {} - } - - if let Some((prefix, id)) = s.split_once('-') { - match prefix { - "note" => return Ok(Self::Note(id.to_string())), - "human" => return Ok(Self::Human(id.to_string())), - "organization" => return Ok(Self::Organization(id.to_string())), - "video" => return Ok(Self::Video(id.to_string())), - _ => {} - } - } - - Err(strum::ParseError::VariantNotFound) - } -} - -impl AppWindow { - fn window_builder<'a>( - &'a self, - app: &'a tauri::AppHandle, - url: impl Into, - ) -> tauri::WebviewWindowBuilder<'a, tauri::Wry, tauri::AppHandle> { - use tauri::{WebviewUrl, WebviewWindow}; - - let mut builder = WebviewWindow::builder(app, self.label(), WebviewUrl::App(url.into())) - .title(self.title()) - .disable_drag_drop_handler(); - - #[cfg(target_os = "macos")] - { - builder = builder - .decorations(true) - .hidden_title(true) - .theme(Some(tauri::Theme::Light)) - .traffic_light_position(tauri::LogicalPosition::new(12.0, 20.0)) - .title_bar_style(tauri::TitleBarStyle::Overlay); - } - - #[cfg(target_os = "windows")] - { - builder = builder.decorations(false); - } - - builder - } -} - -impl WindowImpl for AppWindow { - fn title(&self) -> String { - match self { - Self::Main => "Hyprnote".into(), - Self::Note(_) => "Note".into(), - Self::Human(_) => "Human".into(), - Self::Organization(_) => "Organization".into(), - Self::Finder => "Finder".into(), - Self::Settings => "Settings".into(), - Self::Video(_) => "Video".into(), - Self::Control => "Control".into(), - } - } - - fn build_window( - &self, - app: &tauri::AppHandle, - ) -> Result { - use tauri::LogicalSize; - - let monitor = app - .primary_monitor()? - .ok_or_else(|| crate::Error::MonitorNotFound)?; - - let window = match self { - Self::Main => { - let builder = self - .window_builder(app, "/app/new") - .maximizable(true) - .minimizable(true) - .min_inner_size(620.0, 500.0); - let window = builder.build()?; - window.set_size(LogicalSize::new(910.0, 600.0))?; - window - } - Self::Note(id) => self - .window_builder(app, &format!("/app/note/{}", id)) - .inner_size(480.0, 500.0) - .min_inner_size(480.0, 360.0) - .center() - .build()?, - Self::Human(id) => self - .window_builder(app, &format!("/app/human/{}", id)) - .inner_size(480.0, 500.0) - .min_inner_size(480.0, 360.0) - .center() - .build()?, - Self::Organization(id) => self - .window_builder(app, &format!("/app/organization/{}", id)) - .inner_size(480.0, 500.0) - .min_inner_size(480.0, 360.0) - .center() - .build()?, - Self::Finder => self - .window_builder(app, "/app/finder") - .inner_size(900.0, 650.0) - .min_inner_size(800.0, 600.0) - .build()?, - Self::Settings => { - let window = self - .window_builder(app, "/app/settings") - .resizable(true) - .min_inner_size(800.0, 600.0) - .build()?; - - let desired_size = LogicalSize::new(800.0, 600.0); - window.set_size(LogicalSize::new(1.0, 1.0))?; - std::thread::sleep(std::time::Duration::from_millis(10)); - window.set_size(desired_size)?; - window - } - Self::Video(id) => self - .window_builder(app, &format!("/video?id={}", id)) - .maximizable(false) - .minimizable(false) - .inner_size(640.0, 360.0) - .min_inner_size(640.0, 360.0) - .build()?, - Self::Control => { - use tauri::{WebviewUrl, WebviewWindow}; - - let window_width = (monitor.size().width as f64) / monitor.scale_factor(); - let window_height = (monitor.size().height as f64) / monitor.scale_factor(); - - let mut builder = WebviewWindow::builder( - app, - self.label(), - WebviewUrl::App("/app/control".into()), - ) - .title("") - .disable_drag_drop_handler() - .maximized(false) - .resizable(false) - .fullscreen(false) - .shadow(false) - .always_on_top(true) - .visible_on_all_workspaces(true) - .accept_first_mouse(true) - .content_protected(true) - .inner_size(window_width, window_height) - .skip_taskbar(true) - .position(0.0, 0.0) - .transparent(true); - - #[cfg(target_os = "macos")] - { - builder = builder - .title_bar_style(tauri::TitleBarStyle::Overlay) - .hidden_title(true); - } - - #[cfg(not(target_os = "macos"))] - { - builder = builder.decorations(false); - } - - let window = builder.build()?; - - #[cfg(target_os = "macos")] - { - #[allow(deprecated, unexpected_cfgs)] - app.run_on_main_thread({ - let window = window.clone(); - move || { - use objc2::runtime::AnyObject; - use objc2::msg_send; - - if let Ok(ns_window) = window.ns_window() { - unsafe { - let ns_window = ns_window as *mut AnyObject; - let ns_window = &*ns_window; - - const NS_WINDOW_CLOSE_BUTTON: u64 = 0; - const NS_WINDOW_MINIATURIZE_BUTTON: u64 = 1; - const NS_WINDOW_ZOOM_BUTTON: u64 = 2; - - let close_button: *mut AnyObject = msg_send![ns_window, standardWindowButton: NS_WINDOW_CLOSE_BUTTON]; - let miniaturize_button: *mut AnyObject = msg_send![ns_window, standardWindowButton: NS_WINDOW_MINIATURIZE_BUTTON]; - let zoom_button: *mut AnyObject = msg_send![ns_window, standardWindowButton: NS_WINDOW_ZOOM_BUTTON]; - - if !close_button.is_null() { - let _: () = msg_send![close_button, setHidden: true]; - } - if !miniaturize_button.is_null() { - let _: () = msg_send![miniaturize_button, setHidden: true]; - } - if !zoom_button.is_null() { - let _: () = msg_send![zoom_button, setHidden: true]; - } - - // Make title bar transparent instead of changing style mask - let _: () = msg_send![ns_window, setTitlebarAppearsTransparent: true]; - let _: () = msg_send![ns_window, setMovableByWindowBackground: true]; - } - } - } - }).map_err(|e| tracing::warn!("Failed to run window setup on main thread: {}", e)).ok(); - } - - crate::spawn_overlay_listener(app.clone(), window.clone()); - - window.on_window_event(move |event| { - if let tauri::WindowEvent::CloseRequested { .. } = event { - crate::abort_overlay_join_handle(); - } - }); - - window - } - }; - - Ok(window) - } -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 009f5be68..0b6ddf8ba 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -132,6 +132,9 @@ importers: motion: specifier: ^11.18.2 version: 11.18.2(@emotion/is-prop-valid@0.8.8)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) + mutative: + specifier: ^1.3.0 + version: 1.3.0 re-resizable: specifier: ^6.11.2 version: 6.11.2(react-dom@19.2.0(react@19.2.0))(react@19.2.0)