mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-30 23:14:37 +00:00
refactor: split tauri host from openhuman_core runtime (#43)
* chore: add Cargo.toml and Cargo.lock for rust-core workspace - Introduced a new workspace for the rust-core module with its own Cargo.toml. - Added Cargo.lock to manage dependencies for the rust-core module. - Updated .gitignore to exclude the target directory generated by Cargo. - Modified GitHub Actions workflow to build from the new rust-core path instead of src-tauri. * feat: enhance memory and authentication models in rust-core - Added new `memory` module to handle persistent memory operations for skills, including methods for storing and querying skill data. - Introduced `models` module with `auth` and `socket` submodules to manage user session and socket connection states. - Updated `lib.rs` to include new modules and ensure proper integration within the rust-core workspace. - Modified `eslint.config.js` to ignore target directories in linting processes. * feat: integrate Tauri and QuickJS support in rust-core - Added `tauri` and `rquickjs` as optional dependencies in `Cargo.toml` to enable Tauri integration and JavaScript execution. - Introduced `CronScheduler` and `PingScheduler` modules for managing scheduled tasks and health checks for skills. - Implemented `MemoryState` struct for shared app-state management in the memory client. - Updated the runtime module to include new schedulers and ensure proper integration with Tauri features. - Enhanced the skill registry to support new functionalities related to skill management and communication. * chore: update ESLint configuration and refactor Rust module imports - Added 'rust-core/**' to ESLint ignore list to streamline linting processes. - Refactored import paths in Rust modules to directly reference the `memory` module, enhancing clarity and maintainability. - Improved formatting in JavaScript files for better readability and consistency. * refactor: rename rust-core to openhuman-core and update dependencies - Renamed the `rust-core` module to `openhuman-core` across all files for consistency. - Updated `Cargo.lock` to include `openhuman-core` as a new dependency and removed `rust-core`. - Adjusted import paths in the codebase to reflect the new module name, ensuring all references are updated. - Enhanced the Tauri integration by modifying dependencies in `src-tauri/Cargo.toml` to point to `openhuman-core`. * refactor: simplify platform detection using match statements - Replaced multiple if-else statements with match expressions in `current_platform`, `get_platform`, and `register` functions for improved readability and maintainability. - Removed unnecessary conditional compilation for Android and iOS in the `SocketManager` and `tauri_bridge` modules, streamlining the codebase. - Enhanced the `send_notification` function to handle platform checks more efficiently. * refactor: update platform detection to use std::env::consts - Replaced `cfg!(target_os = "os_name")` checks with `std::env::consts::OS` for improved clarity and consistency across the codebase. - Added `rppal` as an optional dependency in `Cargo.toml` for Raspberry Pi support. - Cleaned up platform-specific code in various modules, enhancing maintainability. * refactor: streamline platform-specific code and improve readability - Replaced conditional compilation with `std::env::consts::OS` checks in various modules to enhance clarity and maintainability. - Simplified platform detection logic in `available_disk_space_mb`, `ensure_arduino_cli`, and `open_in_brave` functions. - Updated `screenshot_command_exists` test to conditionally skip based on the operating system. - Cleaned up unnecessary `#[cfg]` attributes, focusing on a more consistent approach across the codebase. * feat: introduce comprehensive AI configuration and memory management - Added multiple configuration files for OpenHuman AI, including `AGENTS.md`, `BOOTSTRAP.md`, `CONSCIOUS_LOOP.md`, `IDENTITY.md`, `MEMORY.md`, `README.md`, `SOUL.md`, `TOOLS.md`, and `USER.md` to define agent roles, onboarding processes, identity, memory management, and tool capabilities. - Implemented an encryption layer for AI memory storage in `encryption.rs`, utilizing AES-256-GCM for secure data handling. - Updated `lib.rs` to include the new AI module structure, enhancing the overall architecture and maintainability of the codebase. * refactor: update dependencies and configuration for improved structure - Removed `android_logger` and related packages from `Cargo.lock` and `Cargo.toml`, streamlining the dependency list. - Adjusted the `APP_IDENTIFIER` constant in `config.rs` to reflect the new application identifier. - Updated resource paths in `tauri.conf.json` for better organization. - Enhanced platform-specific dependency management in `Cargo.toml` for clarity and maintainability. * fix(core): gate ai module behind tauri-host feature * refactor: update AI loading mechanisms and improve platform handling - Refactored the AI configuration loading in `loader.ts` and `tools/loader.ts` to utilize Tauri commands for desktop environments, enhancing performance and reliability. - Updated paths for AI markdown files to reflect the new `rust-core` structure. - Introduced a new end-to-end test for Tauri command interactions in `tauriCoreBridge.e2e.test.ts`. - Cleaned up platform-specific code across various modules, ensuring a more consistent approach to handling desktop and web contexts. * feat: add sidecar core binary build and staging for Tauri bundler - Implemented build steps for the sidecar core binary in multiple workflows, targeting both x86_64-unknown-linux-gnu and aarch64-apple-darwin architectures. - Added staging steps to copy the built binaries into the Tauri resources directory, ensuring proper integration for application bundling. - Updated relevant workflows to enhance the build process and streamline artifact management. * refactor: enhance AI loading logic for Tauri integration - Updated `loader.ts` and `tools/loader.ts` to prioritize Tauri commands for loading configurations in desktop environments, with a fallback to bundled markdown files for web contexts. - Adjusted test mocks to reflect the new file paths for tools markdown. - Improved test setup to mock Tauri API behavior accurately. * docs: update CLAUDE.md and remove Android build scripts from package.json - Added a new section in CLAUDE.md detailing the runtime scope, clarifying that Tauri is desktop-only and should not include mobile or web branches. - Removed Android development and build scripts from package.json to streamline the project for desktop platforms only. * refactor: streamline import statements and enhance test mock structure - Reordered import statements in `loader.ts` and `tools/loader.ts` for consistency. - Simplified mock implementation in `tauriCoreBridge.e2e.test.ts` to improve readability and maintainability. - Added external binary configuration in `build.rs` to support resource management during local builds. * test: stabilize core/unit test paths and tauri build-test config * chore: update subproject commit reference in skills * chore: update Tauri build configuration to include custom environment variable - Modified the Tauri build command in the GitHub Actions workflow to set a custom configuration for updater artifacts, enhancing the build process for the x86_64-unknown-linux-gnu target.
This commit is contained in:
@@ -72,7 +72,18 @@ jobs:
|
||||
- name: Install skills dependencies
|
||||
run: cd skills && yarn install --frozen-lockfile
|
||||
|
||||
- name: Build sidecar core binary
|
||||
run: cargo build --manifest-path rust-core/Cargo.toml --release --target x86_64-unknown-linux-gnu --bin openhuman-core
|
||||
|
||||
- name: Stage sidecar for Tauri bundler
|
||||
run: |
|
||||
mkdir -p src-tauri/binaries
|
||||
cp rust-core/target/x86_64-unknown-linux-gnu/release/openhuman-core src-tauri/binaries/openhuman-core-x86_64-unknown-linux-gnu
|
||||
chmod +x src-tauri/binaries/openhuman-core-x86_64-unknown-linux-gnu
|
||||
|
||||
- name: Build Tauri app
|
||||
run: yarn tauri build --bundles none -- --target x86_64-unknown-linux-gnu
|
||||
run: |
|
||||
TAURI_CONFIG_OVERRIDE='{"bundle":{"createUpdaterArtifacts":false}}'
|
||||
yarn tauri build -c "$TAURI_CONFIG_OVERRIDE" --bundles none -- --target x86_64-unknown-linux-gnu
|
||||
env:
|
||||
NODE_ENV: production
|
||||
|
||||
@@ -87,6 +87,23 @@ jobs:
|
||||
VITE_SENTRY_DSN: ${{ vars.VITE_SENTRY_DSN }}
|
||||
VITE_DEBUG: ${{ vars.VITE_DEBUG }}
|
||||
|
||||
- name: Build sidecar core binary
|
||||
shell: bash
|
||||
run: |
|
||||
cargo build \
|
||||
--manifest-path rust-core/Cargo.toml \
|
||||
--release \
|
||||
--target aarch64-apple-darwin \
|
||||
--bin openhuman-core
|
||||
|
||||
- name: Stage sidecar for Tauri bundler
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p src-tauri/binaries
|
||||
cp rust-core/target/aarch64-apple-darwin/release/openhuman-core \
|
||||
src-tauri/binaries/openhuman-core-aarch64-apple-darwin
|
||||
chmod +x src-tauri/binaries/openhuman-core-aarch64-apple-darwin
|
||||
|
||||
- name: Build, package (no GitHub release upload)
|
||||
uses: tauri-apps/tauri-action@v0.6.2
|
||||
env:
|
||||
|
||||
@@ -167,8 +167,8 @@ jobs:
|
||||
args: '--target x86_64-apple-darwin'
|
||||
target: 'x86_64-apple-darwin'
|
||||
- platform: 'ubuntu-22.04'
|
||||
args: ''
|
||||
target: ''
|
||||
args: '--target x86_64-unknown-linux-gnu'
|
||||
target: 'x86_64-unknown-linux-gnu'
|
||||
runs-on: ${{ matrix.settings.platform }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -288,6 +288,28 @@ jobs:
|
||||
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }}
|
||||
VITE_DEBUG: ${{ vars.VITE_DEBUG }}
|
||||
|
||||
- name: Build sidecar core binary
|
||||
shell: bash
|
||||
run: |
|
||||
cargo build \
|
||||
--manifest-path rust-core/Cargo.toml \
|
||||
--release \
|
||||
--target "$MATRIX_TARGET" \
|
||||
--bin openhuman-core
|
||||
env:
|
||||
MATRIX_TARGET: ${{ matrix.settings.target }}
|
||||
|
||||
- name: Stage sidecar for Tauri bundler
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p src-tauri/binaries
|
||||
SOURCE="rust-core/target/$MATRIX_TARGET/release/openhuman-core"
|
||||
DEST="src-tauri/binaries/openhuman-core-$MATRIX_TARGET"
|
||||
cp "$SOURCE" "$DEST"
|
||||
chmod +x "$DEST"
|
||||
env:
|
||||
MATRIX_TARGET: ${{ matrix.settings.target }}
|
||||
|
||||
- name: Build, package and publish
|
||||
uses: tauri-apps/tauri-action@v0.6.2
|
||||
id: build-tauri
|
||||
@@ -305,7 +327,7 @@ jobs:
|
||||
# macOS 10.15+ required for std::filesystem used by llama.cpp
|
||||
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.settings.platform == 'macos-latest' && '10.15' || '' }}
|
||||
with:
|
||||
args: '-c ${{ steps.config-overrides.outputs.json }} ${{ matrix.settings.args }}'
|
||||
args: '-c ${{ steps.config-overrides.outputs.json }} ${{ matrix.settings.args }} -- -- --bin OpenHuman'
|
||||
includeDebug: ${{ needs.get-version.outputs.should-publish == '' && inputs.forceRelease != 'true' }}
|
||||
includeRelease: ${{ needs.get-version.outputs.should-publish != '' || inputs.forceRelease == 'true' }}
|
||||
# TDLib dylibs are now bundled natively via build.rs + tauri.conf.json macOS.frameworks
|
||||
|
||||
@@ -219,8 +219,8 @@ jobs:
|
||||
# target: x86_64-apple-darwin
|
||||
# artifact_suffix: x86_64-apple-darwin
|
||||
- platform: ubuntu-22.04
|
||||
args: ''
|
||||
target: ''
|
||||
args: --target x86_64-unknown-linux-gnu
|
||||
target: x86_64-unknown-linux-gnu
|
||||
artifact_suffix: ubuntu
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -305,6 +305,28 @@ jobs:
|
||||
VITE_SENTRY_DSN: ${{ vars.VITE_SENTRY_DSN }}
|
||||
VITE_DEBUG: ${{ vars.VITE_DEBUG }}
|
||||
|
||||
- name: Build sidecar core binary
|
||||
shell: bash
|
||||
run: |
|
||||
cargo build \
|
||||
--manifest-path rust-core/Cargo.toml \
|
||||
--release \
|
||||
--target "$MATRIX_TARGET" \
|
||||
--bin openhuman-core
|
||||
env:
|
||||
MATRIX_TARGET: ${{ matrix.settings.target }}
|
||||
|
||||
- name: Stage sidecar for Tauri bundler
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p src-tauri/binaries
|
||||
SOURCE="rust-core/target/$MATRIX_TARGET/release/openhuman-core"
|
||||
DEST="src-tauri/binaries/openhuman-core-$MATRIX_TARGET"
|
||||
cp "$SOURCE" "$DEST"
|
||||
chmod +x "$DEST"
|
||||
env:
|
||||
MATRIX_TARGET: ${{ matrix.settings.target }}
|
||||
|
||||
- name: Build, package and upload to release
|
||||
uses: tauri-apps/tauri-action@v0.6.2
|
||||
id: tauri-build
|
||||
@@ -328,51 +350,43 @@ jobs:
|
||||
# the desktop UI app binary is packaged.
|
||||
# Yarn v1 strips one "--" layer when invoking scripts, hence the
|
||||
# double-separator when forwarding flags to Cargo.
|
||||
args: -c ${{ steps.config-overrides.outputs.json }} ${{ matrix.settings.args }}
|
||||
args: -c ${{ steps.config-overrides.outputs.json }} ${{ matrix.settings.args }} -- -- --bin OpenHuman
|
||||
includeDebug: false
|
||||
includeRelease: true
|
||||
releaseId: ${{ needs.create-release.outputs.release_id }}
|
||||
owner: tinyhumansai
|
||||
repo: openhuman
|
||||
|
||||
- name: Verify macOS app bundle excludes standalone core binary
|
||||
- name: Verify macOS app bundle sidecar layout
|
||||
if: matrix.settings.platform == 'macos-latest'
|
||||
shell: bash
|
||||
run: |
|
||||
APP_PATH="src-tauri/target/${{ matrix.settings.target }}/release/bundle/macos/OpenHuman.app"
|
||||
echo "Inspecting bundle at: $APP_PATH"
|
||||
ls -la "$APP_PATH/Contents/MacOS"
|
||||
ls -la "$APP_PATH/Contents/Resources" | grep openhuman-core || true
|
||||
if [ -f "$APP_PATH/Contents/MacOS/openhuman-core" ]; then
|
||||
echo "Unexpected standalone binary found inside app bundle: openhuman-core"
|
||||
echo "Unexpected standalone core binary found in MacOS dir"
|
||||
exit 1
|
||||
fi
|
||||
if ! ls "$APP_PATH/Contents/Resources"/openhuman-core-* >/dev/null 2>&1; then
|
||||
echo "Sidecar core binary missing from app resources"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Build standalone CLI binaries
|
||||
- name: Build standalone CLI binary
|
||||
shell: bash
|
||||
run: |
|
||||
# Temporarily inject [[bin]] entries that were removed from Cargo.toml
|
||||
# to prevent Tauri's bundler from trying to copy them into app bundles.
|
||||
printf '\n[[bin]]\nname = "openhuman-core"\npath = "src/standalone/openhuman-core.rs"\n\n[[bin]]\nname = "openhuman-cli"\npath = "src/standalone/openhuman-cli.rs"\n' >> src-tauri/Cargo.toml
|
||||
|
||||
CARGO_TARGET=""
|
||||
if [ -n "$MATRIX_TARGET" ]; then
|
||||
CARGO_TARGET="--target $MATRIX_TARGET"
|
||||
fi
|
||||
cargo build --manifest-path src-tauri/Cargo.toml --release --features standalone-bins $CARGO_TARGET --bin openhuman-core --bin openhuman-cli
|
||||
cargo build --manifest-path rust-core/Cargo.toml --release --target "$MATRIX_TARGET" --bin openhuman-cli
|
||||
env:
|
||||
MATRIX_TARGET: ${{ matrix.settings.target }}
|
||||
|
||||
- name: Resolve standalone CLI artifact paths
|
||||
- name: Resolve standalone CLI artifact path
|
||||
id: cli-paths
|
||||
shell: bash
|
||||
run: |
|
||||
if [ -n "$MATRIX_TARGET" ]; then
|
||||
BASE_DIR="src-tauri/target/$MATRIX_TARGET/release"
|
||||
else
|
||||
BASE_DIR="src-tauri/target/release"
|
||||
fi
|
||||
BASE_DIR="rust-core/target/$MATRIX_TARGET/release"
|
||||
echo "base_dir=$BASE_DIR" >> "$GITHUB_OUTPUT"
|
||||
echo "core_path=$BASE_DIR/openhuman-core" >> "$GITHUB_OUTPUT"
|
||||
echo "cli_path=$BASE_DIR/openhuman-cli" >> "$GITHUB_OUTPUT"
|
||||
env:
|
||||
MATRIX_TARGET: ${{ matrix.settings.target }}
|
||||
@@ -382,7 +396,6 @@ jobs:
|
||||
with:
|
||||
name: standalone-bins-${{ matrix.settings.platform }}-${{ matrix.settings.artifact_suffix }}
|
||||
path: |
|
||||
${{ steps.cli-paths.outputs.core_path }}
|
||||
${{ steps.cli-paths.outputs.cli_path }}
|
||||
|
||||
cleanup-failed-release:
|
||||
|
||||
Reference in New Issue
Block a user