From b25434de04724d992b246e68da8af7e9e47b97cb Mon Sep 17 00:00:00 2001 From: M3gA-Mind Date: Wed, 25 Mar 2026 11:49:08 +0530 Subject: [PATCH] Update dependencies and refactor Login component - Downgraded @tauri-apps/api to version 2.9.1 and updated @tauri-apps/cli to 2.9.6 in package.json. - Added three.js library with version 0.183.2. - Modified Login component to accept isWeb prop and refactored its structure for improved user experience. - Updated build.rs for local builds and adjusted memory client references in memory module. - Updated Welcome component to navigate to login based on isWeb prop. --- package.json | 8 ++-- skills | 2 +- src-tauri/Cargo.lock | 3 +- src-tauri/Cargo.toml | 2 +- src-tauri/build.rs | 61 ++++++++++++------------- src-tauri/src/memory/mod.rs | 12 ++--- src/AppRoutes.tsx | 2 +- src/pages/Login.tsx | 90 +++++++++++++------------------------ src/pages/Welcome.tsx | 11 +++-- yarn.lock | 16 +++---- 10 files changed, 93 insertions(+), 114 deletions(-) diff --git a/package.json b/package.json index 66397acbb..ba0e692c7 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "@scure/bip32": "^2.0.1", "@scure/bip39": "^2.0.1", "@sentry/react": "^10.38.0", - "@tauri-apps/api": "2.10.1", + "@tauri-apps/api": "2.9.1", "@tauri-apps/plugin-deep-link": "^2", "@tauri-apps/plugin-opener": "^2", "@tauri-apps/plugin-os": "^2.3.2", @@ -70,6 +70,7 @@ "redux-persist": "^6.0.0", "socket.io-client": "^4.8.3", "telegram": "^2.26.22", + "three": "^0.183.2", "util": "^0.12.5", "zustand": "^5.0.10" }, @@ -77,7 +78,7 @@ "@eslint/js": "^9.39.2", "@tailwindcss/forms": "^0.5.11", "@tailwindcss/typography": "^0.5.19", - "@tauri-apps/cli": "^2", + "@tauri-apps/cli": "2.9.6", "@testing-library/dom": "^10.4.1", "@testing-library/jest-dom": "^6.9.1", "@testing-library/react": "^16.3.2", @@ -113,5 +114,6 @@ "vite": "^7.0.4", "vite-plugin-node-polyfills": "^0.25.0", "vitest": "^4.0.18" - } + }, + "packageManager": "pnpm@10.27.0+sha512.72d699da16b1179c14ba9e64dc71c9a40988cbdc65c264cb0e489db7de917f20dcf4d64d8723625f2969ba52d4b7e2a1170682d9ac2a5dcaeaab732b7e16f04a" } diff --git a/skills b/skills index 0bb1cef55..14217d3ae 160000 --- a/skills +++ b/skills @@ -1 +1 @@ -Subproject commit 0bb1cef5573e568c2c122a03e8fbc382abd58ffb +Subproject commit 14217d3aee6b92f7cb6d4c891095de8947ba1397 diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index c171f5d00..600d2ddaf 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -8406,9 +8406,8 @@ dependencies = [ [[package]] name = "tinyhumansai" version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a88dba7fe194a507d0351c5f8b5cd8518fb30f8307dd788333f9715f51c44e" dependencies = [ + "log", "reqwest", "serde", "serde_json", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 8c10bf938..f4270b4b8 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -131,7 +131,7 @@ opentelemetry_sdk = { version = "0.31", default-features = false, features = ["t opentelemetry-otlp = { version = "0.31", default-features = false, features = ["trace", "metrics", "http-proto", "reqwest-client", "reqwest-rustls-webpki-roots"] } tokio-stream = { version = "0.1.18", features = ["full"] } url = "2" -tinyhumansai = "0.1.4" +tinyhumansai = { path = "../../neocortex/packages/sdk-rust" } # Optional integrations matrix-sdk = { version = "0.16", optional = true, default-features = false, features = ["e2e-encryption", "rustls-tls", "markdown"] } diff --git a/src-tauri/build.rs b/src-tauri/build.rs index 6f2942191..62efffafd 100644 --- a/src-tauri/build.rs +++ b/src-tauri/build.rs @@ -2,46 +2,47 @@ use std::env; use std::path::PathBuf; fn main() { - maybe_override_tauri_config_for_tests(); + maybe_override_tauri_config_for_local_builds(); tauri_build::build(); } -fn maybe_override_tauri_config_for_tests() { +fn maybe_override_tauri_config_for_local_builds() { let profile = env::var("PROFILE").unwrap_or_default(); let skip_resources = env::var("TAURI_SKIP_RESOURCES").is_ok() || profile == "test"; - if !skip_resources { - return; - } - + let is_release = profile == "release"; let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set")); - let config_path = manifest_dir.join("tauri.conf.json"); - let Ok(raw) = std::fs::read_to_string(&config_path) else { - println!("cargo:warning=Failed to read tauri.conf.json; keeping default config"); + let tdlib_framework_path = manifest_dir.join("libraries/libtdjson.1.8.29.dylib"); + let skip_missing_frameworks = !is_release && !tdlib_framework_path.exists(); + + if !skip_resources && !skip_missing_frameworks { return; - }; - - let mut value: serde_json::Value = match serde_json::from_str(&raw) { - Ok(value) => value, - Err(err) => { - println!("cargo:warning=Failed to parse tauri.conf.json: {err}"); - return; - } - }; - - if let Some(bundle) = value.get_mut("bundle").and_then(|b| b.as_object_mut()) { - bundle.insert("resources".to_string(), serde_json::Value::Array(Vec::new())); } - let out_dir = env::var("OUT_DIR").unwrap_or_else(|_| ".".into()); - let override_path = PathBuf::from(out_dir).join("tauri.conf.test.json"); - if std::fs::write(&override_path, serde_json::to_string_pretty(&value).unwrap_or(raw)).is_ok() - { - env::set_var("TAURI_CONFIG", &override_path); - println!( - "cargo:warning=TAURI resources disabled for test build (using {})", - override_path.display() - ); + let mut merge_config = serde_json::json!({}); + if skip_resources { + merge_config["bundle"]["resources"] = serde_json::json!([]); + } + if skip_missing_frameworks { + merge_config["bundle"]["macOS"]["frameworks"] = serde_json::json!([]); + } + + match serde_json::to_string(&merge_config) { + Ok(json) => { + env::set_var("TAURI_CONFIG", json); + if skip_resources { + println!("cargo:warning=TAURI resources disabled for local build"); + } + if skip_missing_frameworks { + println!( + "cargo:warning=TAURI macOS frameworks disabled because {} is missing", + tdlib_framework_path.display() + ); + } + } + Err(err) => { + println!("cargo:warning=Failed to serialize TAURI_CONFIG override: {err}"); + } } } diff --git a/src-tauri/src/memory/mod.rs b/src-tauri/src/memory/mod.rs index f5084fcd5..ca22482b6 100644 --- a/src-tauri/src/memory/mod.rs +++ b/src-tauri/src/memory/mod.rs @@ -7,14 +7,15 @@ use std::sync::Arc; use tinyhumansai::{ DeleteMemoryParams, InsertMemoryParams, QueryMemoryParams, RecallMemoryParams, - TinyHumanConfig, TinyHumanMemoryClient, + TinyHumanConfig, TinyHumansMemoryClient, }; +use uuid::Uuid; /// Shared, cloneable handle to the memory client. pub type MemoryClientRef = Arc; pub struct MemoryClient { - inner: TinyHumanMemoryClient, + inner: TinyHumansMemoryClient, } impl MemoryClient { @@ -38,7 +39,7 @@ impl MemoryClient { TinyHumanConfig::new(jwt_token) } }; - match TinyHumanMemoryClient::new(config) { + match TinyHumansMemoryClient::new(config) { Ok(inner) => { log::info!("[memory] from_token: exit — client created successfully"); Some(Self { inner }) @@ -66,9 +67,10 @@ impl MemoryClient { "[memory] store_skill_sync: payload → namespace={namespace} | title={title} | content={}", content ); - log::info!("[memory] insert_memory: calling SDK (namespace={namespace}, title={title:?})"); + log::info!("[memory] insert_memory: calling SDK (namespace={namespace}, title={title:?}), content_len={}", content.len()); let result = self.inner .insert_memory(InsertMemoryParams { + document_id: Some(Uuid::new_v4().to_string()), title: title.to_string(), content: content.to_string(), namespace: namespace.clone(), @@ -175,7 +177,7 @@ impl MemoryClient { } } -fn classify_insert_error(e: &tinyhumansai::TinyHumanError) -> &'static str { +fn classify_insert_error(e: &tinyhumansai::TinyHumansError) -> &'static str { let msg = e.to_string(); if msg.contains("dns") || msg.contains("resolve") || msg.contains("lookup") { "dns_failure" diff --git a/src/AppRoutes.tsx b/src/AppRoutes.tsx index a1790e197..51be35665 100644 --- a/src/AppRoutes.tsx +++ b/src/AppRoutes.tsx @@ -80,7 +80,7 @@ const AppRoutes = () => { path="/login" element={ - + } /> diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx index 5a44ec23a..e29c76570 100644 --- a/src/pages/Login.tsx +++ b/src/pages/Login.tsx @@ -1,69 +1,39 @@ -import { useEffect, useState } from 'react'; -import { useNavigate, useSearchParams } from 'react-router-dom'; +import DownloadScreen from '../components/DownloadScreen'; +import OAuthLoginSection from '../components/oauth/OAuthLoginSection'; +import TypewriterGreeting from '../components/TypewriterGreeting'; -import { consumeLoginToken } from '../services/api/authApi'; -import { setToken } from '../store/authSlice'; -import { useAppDispatch } from '../store/hooks'; -import { syncMemoryClientToken } from '../utils/tauriCommands'; +interface WelcomeProps { + isWeb: boolean; +} -const Login = () => { - const navigate = useNavigate(); - const [searchParams] = useSearchParams(); - const dispatch = useAppDispatch(); - const [consumeError, setConsumeError] = useState(null); - - // Handle login token from URL (e.g. from Telegram bot or OAuth provider callback) - // Consume the token with the backend and store the returned JWT - useEffect(() => { - const loginToken = searchParams.get('token'); - if (!loginToken) return; - - let cancelled = false; - - (async () => { - setConsumeError(null); - try { - const jwtToken = await consumeLoginToken(loginToken); - if (cancelled) return; - - dispatch(setToken(jwtToken)); - console.info('[memory] Login: dispatching syncMemoryClientToken after setToken'); - await syncMemoryClientToken(jwtToken); - navigate('/onboarding/', { replace: true }); - } catch (err) { - if (!cancelled) { - setConsumeError(err instanceof Error ? err.message : 'Login failed'); - } - } - })(); - - return () => { - cancelled = true; - }; - }, [searchParams, dispatch, navigate]); - - if (consumeError) { - return ( -
-
-
-

{consumeError}

-

- Please try logging in again with your preferred method. -

-
-
-
- ); - } +const Login = ({ isWeb }: WelcomeProps) => { + const greetings = ['Hello HAL9000! 👋', "Let's cook! 🔥", 'The A-Team is here! 👊']; return (
-
-
-
-

Completing login...

+ {/* Main content */} +
+ {/* Welcome card */} +
+ {/* Greeting */} + + +

+ Welcome to AlphaHuman. Your Telegram assistant here to get you 10x more done in your + journey. +

+ +

Are you ready for this?

+ + {/* Show OAuth login options in Tauri app, download screen on web */} + {!isWeb && ( +
+ +
+ )}
+ + {isWeb && }
); diff --git a/src/pages/Welcome.tsx b/src/pages/Welcome.tsx index dc161a89d..1b12b2308 100644 --- a/src/pages/Welcome.tsx +++ b/src/pages/Welcome.tsx @@ -1,3 +1,5 @@ +import { useNavigate } from 'react-router-dom'; + import RotatingTetrahedronCanvas from '../components/RotatingTetrahedronCanvas'; interface WelcomeProps { @@ -5,6 +7,8 @@ interface WelcomeProps { } const Welcome = ({ isWeb }: WelcomeProps) => { + const navigate = useNavigate(); + return (
@@ -21,14 +25,15 @@ const Welcome = ({ isWeb }: WelcomeProps) => {

- A focused command center for AI-driven execution. Minimal surfaces, hard edges, and - no visual noise. + A focused command center for AI-driven execution. Minimal surfaces, hard edges, and no + visual noise.