mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-27 21:08:00 +00:00
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.
This commit is contained in:
+5
-3
@@ -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"
|
||||
}
|
||||
|
||||
+1
-1
Submodule skills updated: 0bb1cef557...14217d3aee
Generated
+1
-2
@@ -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",
|
||||
|
||||
@@ -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"] }
|
||||
|
||||
+31
-30
@@ -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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<MemoryClient>;
|
||||
|
||||
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"
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ const AppRoutes = () => {
|
||||
path="/login"
|
||||
element={
|
||||
<PublicRoute>
|
||||
<Login />
|
||||
<Login isWeb={isWeb} />
|
||||
</PublicRoute>
|
||||
}
|
||||
/>
|
||||
|
||||
+30
-60
@@ -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<string | null>(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 (
|
||||
<div className="min-h-full relative flex items-center justify-center">
|
||||
<div className="relative z-10 max-w-md w-full mx-4 text-center">
|
||||
<div className="glass rounded-3xl p-8 shadow-large animate-fade-up">
|
||||
<p className="opacity-90 text-coral mb-4">{consumeError}</p>
|
||||
<p className="text-sm opacity-70">
|
||||
Please try logging in again with your preferred method.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
const Login = ({ isWeb }: WelcomeProps) => {
|
||||
const greetings = ['Hello HAL9000! 👋', "Let's cook! 🔥", 'The A-Team is here! 👊'];
|
||||
|
||||
return (
|
||||
<div className="min-h-full relative flex items-center justify-center">
|
||||
<div className="relative z-10 max-w-md w-full mx-4 text-center">
|
||||
<div className="glass rounded-3xl p-8 shadow-large animate-fade-up">
|
||||
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-white mx-auto mb-4"></div>
|
||||
<p className="opacity-70">Completing login...</p>
|
||||
{/* Main content */}
|
||||
<div className="relative z-10 max-w-md w-full mx-4 space-y-6">
|
||||
{/* Welcome card */}
|
||||
<div className="glass rounded-3xl p-8 text-center animate-fade-up shadow-large">
|
||||
{/* Greeting */}
|
||||
<TypewriterGreeting greetings={greetings} />
|
||||
|
||||
<p className="opacity-70 mb-8 leading-relaxed">
|
||||
Welcome to AlphaHuman. Your Telegram assistant here to get you 10x more done in your
|
||||
journey.
|
||||
</p>
|
||||
|
||||
<p className="opacity-70 leading-relaxed">Are you ready for this?</p>
|
||||
|
||||
{/* Show OAuth login options in Tauri app, download screen on web */}
|
||||
{!isWeb && (
|
||||
<div className="mt-6">
|
||||
<OAuthLoginSection />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{isWeb && <DownloadScreen />}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -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 (
|
||||
<div className="min-h-full w-full bg-[#090b12] px-4 py-6 md:px-10 md:py-10">
|
||||
<div className="mx-auto grid min-h-[calc(100vh-3.5rem)] w-full max-w-5xl grid-rows-[1fr_auto] border border-[#24293d] bg-[#0b0f18] text-white">
|
||||
@@ -21,14 +25,15 @@ const Welcome = ({ isWeb }: WelcomeProps) => {
|
||||
</h1>
|
||||
|
||||
<p className="max-w-xl text-sm text-[#8e96b8] md:text-base">
|
||||
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.
|
||||
</p>
|
||||
|
||||
<div className="flex flex-wrap items-center justify-center gap-3">
|
||||
<button
|
||||
className="border border-[#3d2f68] bg-[#201732] px-5 py-2 text-sm font-medium tracking-wide text-[#d4c8ff] transition-colors hover:bg-[#2a1d44]"
|
||||
type="button">
|
||||
type="button"
|
||||
onClick={() => navigate('/login')}>
|
||||
{isWeb ? 'Download AlphaHuman' : 'Continue'}
|
||||
</button>
|
||||
<button
|
||||
|
||||
@@ -1294,12 +1294,7 @@
|
||||
dependencies:
|
||||
postcss-selector-parser "6.0.10"
|
||||
|
||||
"@tauri-apps/api@2.10.1":
|
||||
version "2.10.1"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/api/-/api-2.10.1.tgz#57c1bae6114ec33d977eb2b50dfefc25fa84fc93"
|
||||
integrity sha512-hKL/jWf293UDSUN09rR69hrToyIXBb8CjGaWC7gfinvnQrBVvnLr08FeFi38gxtugAVyVcTa5/FD/Xnkb1siBw==
|
||||
|
||||
"@tauri-apps/api@^2.8.0":
|
||||
"@tauri-apps/api@2.9.1", "@tauri-apps/api@^2.8.0":
|
||||
version "2.9.1"
|
||||
resolved "https://registry.npmjs.org/@tauri-apps/api/-/api-2.9.1.tgz"
|
||||
integrity sha512-IGlhP6EivjXHepbBic618GOmiWe4URJiIeZFlB7x3czM0yDHHYviH1Xvoiv4FefdkQtn6v7TuwWCRfOGdnVUGw==
|
||||
@@ -1359,9 +1354,9 @@
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-2.9.6.tgz#d58c9f8af835b7e4fc30e201e979342c70bea426"
|
||||
integrity sha512-ldWuWSSkWbKOPjQMJoYVj9wLHcOniv7diyI5UAJ4XsBdtaFB0pKHQsqw/ItUma0VXGC7vB4E9fZjivmxur60aw==
|
||||
|
||||
"@tauri-apps/cli@^2":
|
||||
"@tauri-apps/cli@2.9.6":
|
||||
version "2.9.6"
|
||||
resolved "https://registry.npmjs.org/@tauri-apps/cli/-/cli-2.9.6.tgz"
|
||||
resolved "https://registry.yarnpkg.com/@tauri-apps/cli/-/cli-2.9.6.tgz#f15ae8e03bf48308055c15ab25b439bed9906bc9"
|
||||
integrity sha512-3xDdXL5omQ3sPfBfdC8fCtDKcnyV7OqyzQgfyT5P3+zY6lcPqIYKQBvUasNvppi21RSdfhy44ttvJmftb0PCDw==
|
||||
optionalDependencies:
|
||||
"@tauri-apps/cli-darwin-arm64" "2.9.6"
|
||||
@@ -7689,6 +7684,11 @@ thenify-all@^1.0.0:
|
||||
dependencies:
|
||||
any-promise "^1.0.0"
|
||||
|
||||
three@^0.183.2:
|
||||
version "0.183.2"
|
||||
resolved "https://registry.yarnpkg.com/three/-/three-0.183.2.tgz#606e3195bf210ef8d1eaaca2ab8c59d92d2bbc18"
|
||||
integrity sha512-di3BsL2FEQ1PA7Hcvn4fyJOlxRRgFYBpMTcyOgkwJIaDOdJMebEFPA+t98EvjuljDx4hNulAGwF6KIjtwI5jgQ==
|
||||
|
||||
timers-browserify@^2.0.4:
|
||||
version "2.0.12"
|
||||
resolved "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.12.tgz"
|
||||
|
||||
Reference in New Issue
Block a user