feat(hands): restructure Hands UI with Chinese localization
Major changes: - Add HandList.tsx component for left sidebar - Add HandTaskPanel.tsx for middle content area - Restructure Sidebar tabs: 分身/HANDS/Workflow - Remove Hands tab from RightPanel - Localize all UI text to Chinese - Archive legacy OpenClaw documentation - Add Hands integration lessons document - Update feature checklist with new components UI improvements: - Left sidebar now shows Hands list with status icons - Middle area shows selected Hand's tasks and results - Consistent styling with Tailwind CSS - Chinese status labels and buttons Documentation: - Create docs/archive/openclaw-legacy/ for old docs - Add docs/knowledge-base/hands-integration-lessons.md - Update docs/knowledge-base/feature-checklist.md - Update docs/knowledge-base/README.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
33
desktop/src/lib/gateway-config.ts
Normal file
33
desktop/src/lib/gateway-config.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* OpenFang Gateway Configuration Types
|
||||
*
|
||||
* Types for gateway configuration and model choices.
|
||||
*/
|
||||
|
||||
export interface GatewayModelChoice {
|
||||
id: string;
|
||||
name: string;
|
||||
provider?: string;
|
||||
contextWindow?: number;
|
||||
maxOutput?: number;
|
||||
}
|
||||
|
||||
export interface GatewayConfigSnapshot {
|
||||
agentName?: string;
|
||||
agentRole?: string;
|
||||
userName?: string;
|
||||
userRole?: string;
|
||||
model?: string;
|
||||
workspaceDir?: string;
|
||||
gatewayUrl?: string;
|
||||
gatewayToken?: string;
|
||||
skillsExtraDirs?: string[];
|
||||
mcpServices?: Array<{ id: string; name: string; enabled: boolean }>;
|
||||
theme?: 'light' | 'dark';
|
||||
autoStart?: boolean;
|
||||
showToolCalls?: boolean;
|
||||
restrictFiles?: boolean;
|
||||
autoSaveContext?: boolean;
|
||||
fileWatching?: boolean;
|
||||
privacyOptIn?: boolean;
|
||||
}
|
||||
218
desktop/src/lib/tauri-gateway.ts
Normal file
218
desktop/src/lib/tauri-gateway.ts
Normal file
@@ -0,0 +1,218 @@
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
|
||||
export interface LocalGatewayStatus {
|
||||
supported: boolean;
|
||||
cliAvailable: boolean;
|
||||
runtimeSource: string | null;
|
||||
runtimePath: string | null;
|
||||
serviceLabel: string | null;
|
||||
serviceLoaded: boolean;
|
||||
serviceStatus: string | null;
|
||||
configOk: boolean;
|
||||
port: number | null;
|
||||
portStatus: string | null;
|
||||
probeUrl: string | null;
|
||||
listenerPids: number[];
|
||||
error: string | null;
|
||||
raw: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface LocalGatewayAuth {
|
||||
configPath: string | null;
|
||||
gatewayToken: string | null;
|
||||
}
|
||||
|
||||
export interface LocalGatewayPrepareResult {
|
||||
configPath: string | null;
|
||||
originsUpdated: boolean;
|
||||
gatewayRestarted: boolean;
|
||||
}
|
||||
|
||||
export interface LocalGatewayPairingApprovalResult {
|
||||
approved: boolean;
|
||||
requestId: string | null;
|
||||
deviceId: string | null;
|
||||
}
|
||||
|
||||
function buildFallbackStatus(supported: boolean, error: string | null = null): LocalGatewayStatus {
|
||||
return {
|
||||
supported,
|
||||
cliAvailable: false,
|
||||
runtimeSource: null,
|
||||
runtimePath: null,
|
||||
serviceLabel: null,
|
||||
serviceLoaded: false,
|
||||
serviceStatus: null,
|
||||
configOk: false,
|
||||
port: null,
|
||||
portStatus: null,
|
||||
probeUrl: null,
|
||||
listenerPids: [],
|
||||
error,
|
||||
raw: {},
|
||||
};
|
||||
}
|
||||
|
||||
export function isTauriRuntime(): boolean {
|
||||
return typeof window !== 'undefined' && '__TAURI_INTERNALS__' in window;
|
||||
}
|
||||
|
||||
async function callLocalGateway(command: string): Promise<LocalGatewayStatus> {
|
||||
if (!isTauriRuntime()) {
|
||||
return buildFallbackStatus(false);
|
||||
}
|
||||
|
||||
return invoke<LocalGatewayStatus>(command);
|
||||
}
|
||||
|
||||
export function getUnsupportedLocalGatewayStatus(): LocalGatewayStatus {
|
||||
return buildFallbackStatus(false);
|
||||
}
|
||||
|
||||
export async function getLocalGatewayStatus(): Promise<LocalGatewayStatus> {
|
||||
return callLocalGateway('gateway_status');
|
||||
}
|
||||
|
||||
export async function startLocalGateway(): Promise<LocalGatewayStatus> {
|
||||
return callLocalGateway('gateway_start');
|
||||
}
|
||||
|
||||
export async function stopLocalGateway(): Promise<LocalGatewayStatus> {
|
||||
return callLocalGateway('gateway_stop');
|
||||
}
|
||||
|
||||
export async function restartLocalGateway(): Promise<LocalGatewayStatus> {
|
||||
return callLocalGateway('gateway_restart');
|
||||
}
|
||||
|
||||
export async function getLocalGatewayAuth(): Promise<LocalGatewayAuth> {
|
||||
if (!isTauriRuntime()) {
|
||||
return {
|
||||
configPath: null,
|
||||
gatewayToken: null,
|
||||
};
|
||||
}
|
||||
|
||||
return invoke<LocalGatewayAuth>('gateway_local_auth');
|
||||
}
|
||||
|
||||
export async function prepareLocalGatewayForTauri(): Promise<LocalGatewayPrepareResult> {
|
||||
if (!isTauriRuntime()) {
|
||||
return {
|
||||
configPath: null,
|
||||
originsUpdated: false,
|
||||
gatewayRestarted: false,
|
||||
};
|
||||
}
|
||||
|
||||
return invoke<LocalGatewayPrepareResult>('gateway_prepare_for_tauri');
|
||||
}
|
||||
|
||||
export async function approveLocalGatewayDevicePairing(deviceId: string, publicKeyBase64: string, url?: string): Promise<LocalGatewayPairingApprovalResult> {
|
||||
if (!isTauriRuntime()) {
|
||||
return {
|
||||
approved: false,
|
||||
requestId: null,
|
||||
deviceId: null,
|
||||
};
|
||||
}
|
||||
|
||||
return invoke<LocalGatewayPairingApprovalResult>('gateway_approve_device_pairing', {
|
||||
deviceId,
|
||||
publicKeyBase64,
|
||||
url,
|
||||
});
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Process Monitoring Types and Functions
|
||||
// ============================================================================
|
||||
|
||||
export interface ProcessInfo {
|
||||
pid: number;
|
||||
name: string;
|
||||
status: string;
|
||||
cpuPercent: number | null;
|
||||
memoryMb: number | null;
|
||||
uptimeSeconds: number | null;
|
||||
}
|
||||
|
||||
export interface ProcessListResponse {
|
||||
processes: ProcessInfo[];
|
||||
totalCount: number;
|
||||
runtimeSource: string | null;
|
||||
}
|
||||
|
||||
export interface ProcessLogsResponse {
|
||||
pid: number | null;
|
||||
logs: string;
|
||||
lines: number;
|
||||
runtimeSource: string | null;
|
||||
}
|
||||
|
||||
export interface VersionResponse {
|
||||
version: string;
|
||||
commit: string | null;
|
||||
buildDate: string | null;
|
||||
runtimeSource: string | null;
|
||||
raw: Record<string, unknown>;
|
||||
}
|
||||
|
||||
/**
|
||||
* List OpenFang processes
|
||||
* @returns List of running OpenFang processes with their status
|
||||
*/
|
||||
export async function getOpenFangProcessList(): Promise<ProcessListResponse> {
|
||||
if (!isTauriRuntime()) {
|
||||
return {
|
||||
processes: [],
|
||||
totalCount: 0,
|
||||
runtimeSource: null,
|
||||
};
|
||||
}
|
||||
|
||||
return invoke<ProcessListResponse>('openfang_process_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get OpenFang process logs
|
||||
* @param pid - Optional process ID to get logs for. If not specified, gets main process logs.
|
||||
* @param lines - Number of log lines to retrieve (default: 100)
|
||||
* @returns Process logs
|
||||
*/
|
||||
export async function getOpenFangProcessLogs(
|
||||
pid?: number,
|
||||
lines?: number
|
||||
): Promise<ProcessLogsResponse> {
|
||||
if (!isTauriRuntime()) {
|
||||
return {
|
||||
pid: pid ?? null,
|
||||
logs: '',
|
||||
lines: 0,
|
||||
runtimeSource: null,
|
||||
};
|
||||
}
|
||||
|
||||
return invoke<ProcessLogsResponse>('openfang_process_logs', {
|
||||
pid,
|
||||
lines,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get OpenFang version information
|
||||
* @returns Version information including version string, commit hash, and build date
|
||||
*/
|
||||
export async function getOpenFangVersion(): Promise<VersionResponse> {
|
||||
if (!isTauriRuntime()) {
|
||||
return {
|
||||
version: 'unknown',
|
||||
commit: null,
|
||||
buildDate: null,
|
||||
runtimeSource: null,
|
||||
raw: {},
|
||||
};
|
||||
}
|
||||
|
||||
return invoke<VersionResponse>('openfang_version');
|
||||
}
|
||||
Reference in New Issue
Block a user