mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-27 21:08:00 +00:00
* chore: update AlphaHuman version to 0.49.3 and configure updater plugin in tauri.conf.json - Bumped the AlphaHuman package version in Cargo.lock to 0.49.3. - Added updater configuration in tauri.conf.json to enable automatic updates with specified endpoints. * refactor: rename AlphaHuman to OpenHuman across the codebase - Updated all instances of "AlphaHuman" to "OpenHuman" in comments, tooltips, and constants to reflect the new branding. - Adjusted relevant documentation and prompts to ensure consistency with the new name. * refactor: update documentation and configurations to reflect OpenHuman branding - Replaced all instances of "AlphaHuman" with "OpenHuman" in documentation, comments, and configuration files to ensure consistency with the new branding. - Updated deep link URLs and related authentication flows to use the new "openhuman://" scheme. - Adjusted paths and references in the skills system and other related files to align with the new project name.te * refactor: standardize OpenHuman references and update configurations - Replaced all instances of "AlphaHuman" with "OpenHuman" across documentation, comments, and configuration files to maintain branding consistency. - Updated URLs and paths to reflect the new "openhuman://" scheme. - Adjusted environment variable names and related settings to align with the new project identity. - Enhanced documentation for clarity and accuracy regarding the OpenHuman framework.r * chore: update subproject commit reference in skills directory * refactor: update backend URL to reflect new service domain - Changed default backend URL from "https://api.openhuman.xyz" to "https://api.tinyhumans.ai" in both JavaScript and Rust configuration files. - Ensured consistency across the codebase regarding the new backend service endpoint. * feat: introduce identity and migration modules for OpenHuman - Added a new identity module to support AIEOS v1.1 JSON format, including structures for identity, psychology, linguistics, motivations, capabilities, physicality, history, and interests. - Implemented a migration module to facilitate data migration from OpenClaw memory, including SQLite and Markdown sources, with detailed reporting on migration statistics and warnings. - Established utility functions for handling multimodal content and image processing within the OpenHuman framework. - Enhanced the agent system with new dispatcher and classifier functionalities to improve tool management and message classification. * chore: remove Android project files and configurations - Deleted various Android project files including .editorconfig, .gitignore, build.gradle.kts, gradle.properties, and others to clean up the project structure. - Removed all related resources, layouts, and source files from the Android app directory to streamline the codebase. - This cleanup is part of a larger effort to refactor and simplify the project structure. * refactor: update login flow and remove Telegram integration - Removed the TelegramLoginButton component and its references from the OAuthLoginSection, streamlining the login options. - Updated the AppRoutes to remove the login route, reflecting changes in the authentication flow. - Enhanced the RotatingTetrahedronCanvas component with improved geometry and lighting effects for better visual presentation. - Adjusted the TypewriterGreeting component's styling for consistency. - Cleaned up the Welcome page to integrate the OAuthLoginSection directly, improving user experience. * chore: update subproject commit reference in skills directory * chore: update test configurations and improve test assertions - Modified test scripts in package.json to use a specific Vitest configuration file for consistency. - Updated assertions in loader tests to ensure loading durations are non-negative. - Enhanced tool loading tests to clarify expected behavior regarding localStorage and cache management. - Adjusted agent tool registry tests to improve error handling and ensure accurate statistics. - Refined device detection tests to reflect updated fallback URLs. * fix: enhance parameter formatting and remove unused components - Updated the `formatParameters` function to handle cases where schema properties are empty, returning a more informative response. - Deleted the `DownloadScreen` component and associated device detection utilities to streamline the codebase and remove unused functionality. - Adjusted tests to reflect changes in the tool loading and agent tool registry, ensuring accuracy in assertions. * chore: simplify Vitest configuration by removing unused include patterns - Updated the Vitest configuration to remove unnecessary test file patterns, streamlining the test setup for better clarity and maintainability. * refactor: update paths and comments for AI configuration and file watching - Modified Vite configuration to ignore only the `src-tauri` directory. - Updated logging messages to reflect the correct path for writing AI configuration files. - Adjusted fetch calls in the file watcher to use the new path for `TOOLS.md`. - Revised comments and logic in Rust code to clarify the handling of AI configuration file paths, including legacy fallback options. * chore: remove unused updater secrets from GitHub Actions workflow - Deleted UPDATER_GIST_URL and UPDATER_GIST_ID environment variables from the package-and-publish workflow, streamlining the configuration. * chore: comment out Vitest thresholds for clarity - Commented out the thresholds section in the Vitest configuration to improve clarity and maintainability, as it is currently not in use. * ran formatter * chore: update updater public key in tauri configuration - Replaced the existing public key in the updater plugin configuration with a new value to ensure proper functionality and security. * chore: update ESLint configuration and refactor components - Added `localStorage` and `sessionStorage` as readonly globals in ESLint configuration for better linting support. - Removed unused imports from `SkillsPanel.tsx` to clean up the code. - Changed the type of `watcherInterval` in `file-watcher.ts` for improved type safety. - Refactored toast management logic in `Intelligence.tsx` to enhance clarity and maintainability. - Simplified import statements in `IntelligenceProvider.tsx` for consistency. - Streamlined object property shorthand in `agentToolRegistry.ts` for cleaner code. * refactor: improve error handling and type safety in Intelligence component - Enhanced toast notification logic to defer state updates, preventing potential issues with setState in effects. - Updated the source filter dispatch to use a more specific type for improved type safety. * refactor: enhance type safety across various components and services - Updated type definitions from `any` to `unknown` in multiple files to improve type safety and prevent potential runtime errors. - Refactored state management in `TauriCommandsPanel` to use more specific types. - Adjusted context and parameters in several interfaces to ensure consistent typing. - Added ESLint directive to `polyfills.ts` for intentional global assignments. - Streamlined type handling in utility functions and API responses for better clarity and maintainability. * refactor: streamline import statements and improve code clarity - Consolidated import statements in `agentToolRegistry.ts` and `intelligenceSlice.ts` for better readability. - Simplified the `createTestStore` function in `test-utils.tsx` to enhance code conciseness. - Cleaned up the `isExecutionStepProgressEvent` function in `intelligence-chat-api.ts` for improved clarity and maintainability.
270 lines
8.3 KiB
JavaScript
270 lines
8.3 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* OpenHuman Tools Discovery Script
|
|
*
|
|
* Discovers all available tools from the V8 skills runtime and generates
|
|
* a comprehensive TOOLS.md file following OpenClaw framework standards.
|
|
*
|
|
* Usage: node scripts/tools-generator/discover-tools.js
|
|
*/
|
|
import { existsSync, mkdirSync, writeFileSync } from 'fs';
|
|
import { dirname, join } from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
import { generateOpenClawMarkdown } from './openClaw-formatter.js';
|
|
import {
|
|
executeTauriDiscovery,
|
|
getTauriEnvironmentInfo,
|
|
prepareTauriEnvironment,
|
|
validateTauriEnvironment,
|
|
} from './tauri-integration.js';
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
const PROJECT_ROOT = join(__dirname, '../..');
|
|
const AI_DIR = join(PROJECT_ROOT, 'src-tauri', 'ai');
|
|
const TOOLS_OUTPUT = join(AI_DIR, 'TOOLS.md');
|
|
|
|
// Environment categories for OpenClaw compatibility
|
|
const ENVIRONMENTS = {
|
|
development: {
|
|
name: 'Development',
|
|
description: 'Local development environment with full access',
|
|
},
|
|
production: {
|
|
name: 'Production',
|
|
description: 'Production environment with security restrictions',
|
|
},
|
|
testing: { name: 'Testing', description: 'Testing environment for automated validation' },
|
|
};
|
|
|
|
/**
|
|
* Discovers available tools from V8 skills runtime or fallback sources
|
|
* @returns {Promise<Array>} Array of discovered tools with skill metadata
|
|
*/
|
|
async function discoverTools() {
|
|
console.log('🔍 Discovering tools from V8 skills runtime...');
|
|
|
|
// Check if Tauri environment is available
|
|
const tauriAvailable = await validateTauriEnvironment();
|
|
|
|
if (tauriAvailable) {
|
|
try {
|
|
console.log('🔧 Preparing Tauri environment...');
|
|
await prepareTauriEnvironment();
|
|
|
|
console.log('🚀 Executing Tauri tools discovery...');
|
|
const realTools = await executeTauriDiscovery({
|
|
timeout: 60000, // 60 seconds
|
|
retries: 2,
|
|
verbose: process.env.VERBOSE === 'true',
|
|
});
|
|
|
|
if (realTools && realTools.length > 0) {
|
|
console.log(
|
|
`✅ Discovered ${realTools.length} tools from ${new Set(realTools.map(t => t.skillId)).size} skills via Tauri`
|
|
);
|
|
return realTools;
|
|
}
|
|
} catch (error) {
|
|
console.warn('⚠️ Could not discover tools from Tauri runtime:', error.message);
|
|
console.log('📋 Using development mock data instead');
|
|
}
|
|
} else {
|
|
console.warn('⚠️ Tauri environment not available');
|
|
console.log('📋 Using development mock data instead');
|
|
}
|
|
|
|
// Fallback to mock data for development
|
|
const mockTools = generateMockToolsForDevelopment();
|
|
console.log(
|
|
`✅ Using mock data: ${mockTools.length} tools from ${new Set(mockTools.map(t => t.skillId)).size} skills`
|
|
);
|
|
return mockTools;
|
|
}
|
|
|
|
/**
|
|
* Generates mock tools data for development (until Tauri integration is complete)
|
|
* This simulates the structure returned by runtime_all_tools()
|
|
*/
|
|
function generateMockToolsForDevelopment() {
|
|
return [
|
|
{
|
|
skillId: 'telegram',
|
|
name: 'send_message',
|
|
description: 'Send a message to a Telegram chat or user',
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
chat_id: { type: 'string', description: 'Telegram chat ID or username' },
|
|
message: { type: 'string', description: 'Message text to send' },
|
|
parse_mode: {
|
|
type: 'string',
|
|
enum: ['HTML', 'Markdown'],
|
|
description: 'Message formatting mode',
|
|
},
|
|
},
|
|
required: ['chat_id', 'message'],
|
|
},
|
|
},
|
|
{
|
|
skillId: 'telegram',
|
|
name: 'get_chat_history',
|
|
description: 'Retrieve message history from a Telegram chat',
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
chat_id: { type: 'string', description: 'Telegram chat ID or username' },
|
|
limit: { type: 'number', description: 'Number of messages to retrieve (max 100)' },
|
|
offset: { type: 'number', description: 'Offset for pagination' },
|
|
},
|
|
required: ['chat_id'],
|
|
},
|
|
},
|
|
{
|
|
skillId: 'notion',
|
|
name: 'create_page',
|
|
description: 'Create a new page in Notion workspace',
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
parent_id: { type: 'string', description: 'Parent database or page ID' },
|
|
title: { type: 'string', description: 'Page title' },
|
|
content: { type: 'array', description: 'Page content blocks' },
|
|
properties: { type: 'object', description: 'Page properties for database pages' },
|
|
},
|
|
required: ['parent_id', 'title'],
|
|
},
|
|
},
|
|
{
|
|
skillId: 'gmail',
|
|
name: 'send_email',
|
|
description: 'Send an email via Gmail',
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
to: { type: 'string', description: 'Recipient email address' },
|
|
subject: { type: 'string', description: 'Email subject line' },
|
|
body: { type: 'string', description: 'Email body content' },
|
|
attachments: { type: 'array', description: 'File attachments' },
|
|
},
|
|
required: ['to', 'subject', 'body'],
|
|
},
|
|
},
|
|
];
|
|
}
|
|
|
|
// Removed duplicate functions - now using openClaw-formatter.js
|
|
|
|
/**
|
|
* Main execution function
|
|
*/
|
|
async function main() {
|
|
try {
|
|
console.log('🚀 Starting OpenHuman tools discovery...');
|
|
|
|
// Discover all available tools
|
|
const tools = await discoverTools();
|
|
|
|
if (tools.length === 0) {
|
|
console.warn(
|
|
'⚠️ No tools discovered. This might indicate an issue with the skills runtime.'
|
|
);
|
|
}
|
|
|
|
// Ensure AI directory exists
|
|
if (!existsSync(AI_DIR)) {
|
|
console.log(`📁 Creating AI directory: ${AI_DIR}`);
|
|
mkdirSync(AI_DIR, { recursive: true });
|
|
}
|
|
|
|
// Generate OpenClaw-compliant markdown
|
|
console.log('📝 Generating OpenClaw-compliant TOOLS.md content...');
|
|
const markdownContent = generateOpenClawMarkdown(tools);
|
|
|
|
// Write to output file
|
|
console.log(`💾 Writing TOOLS.md to: ${TOOLS_OUTPUT}`);
|
|
writeFileSync(TOOLS_OUTPUT, markdownContent, 'utf8');
|
|
|
|
console.log('✅ TOOLS.md generated successfully!');
|
|
console.log(
|
|
`📊 Generated documentation for ${tools.length} tools across ${new Set(tools.map(t => t.skillId)).size} skills`
|
|
);
|
|
} catch (error) {
|
|
console.error('❌ Error generating TOOLS.md:', error.message);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Attempts to discover tools from a running Tauri process
|
|
* @returns {Promise<Array>} Array of tools from Tauri runtime
|
|
*/
|
|
async function discoverToolsFromTauri() {
|
|
return new Promise((resolve, reject) => {
|
|
// Try to spawn a minimal Tauri process for tool discovery
|
|
const isWindows = process.platform === 'win32';
|
|
const tauriCommand = isWindows ? 'cargo.exe' : 'cargo';
|
|
|
|
const args = [
|
|
'run',
|
|
'--manifest-path',
|
|
join(PROJECT_ROOT, 'src-tauri', 'Cargo.toml'),
|
|
'--bin',
|
|
'openhuman-tools-discovery',
|
|
];
|
|
|
|
console.log('🔧 Attempting to run tools discovery via Cargo...');
|
|
|
|
const child = spawn(tauriCommand, args, {
|
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
cwd: PROJECT_ROOT,
|
|
env: { ...process.env, TAURI_TOOLS_DISCOVERY: 'true' },
|
|
});
|
|
|
|
let output = '';
|
|
let errorOutput = '';
|
|
|
|
child.stdout.on('data', data => {
|
|
output += data.toString();
|
|
});
|
|
|
|
child.stderr.on('data', data => {
|
|
errorOutput += data.toString();
|
|
});
|
|
|
|
child.on('close', code => {
|
|
if (code === 0 && output.trim()) {
|
|
try {
|
|
const result = JSON.parse(output.trim());
|
|
if (result.success && result.tools) {
|
|
resolve(result.tools);
|
|
} else {
|
|
reject(new Error(result.error || 'Unknown error from Tauri'));
|
|
}
|
|
} catch (parseError) {
|
|
reject(new Error(`Failed to parse Tauri output: ${parseError.message}`));
|
|
}
|
|
} else {
|
|
reject(new Error(`Tauri process failed (code ${code}): ${errorOutput}`));
|
|
}
|
|
});
|
|
|
|
child.on('error', error => {
|
|
reject(new Error(`Failed to spawn Tauri process: ${error.message}`));
|
|
});
|
|
|
|
// Timeout after 30 seconds
|
|
setTimeout(() => {
|
|
child.kill();
|
|
reject(new Error('Tauri discovery process timed out'));
|
|
}, 30000);
|
|
});
|
|
}
|
|
|
|
// Run if called directly
|
|
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
main();
|
|
}
|
|
|
|
export { discoverTools, discoverToolsFromTauri, generateMockToolsForDevelopment };
|