The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
/**
* Service and daemon management commands.
*/
import { invoke } from '@tauri-apps/api/core';
import { callCoreRpc } from '../../services/coreRpcClient';
import { CommandResponse, isTauri, parseServiceCliOutput } from './common';
export type ServiceState = 'Running' | 'Stopped' | 'NotInstalled' | { Unknown: string };
export interface ServiceStatus {
state: ServiceState;
unit_path?: string | null;
label: string;
details?: string | null;
}
export interface AgentServerStatus {
running: boolean;
url: string;
}
export interface DaemonHostConfig {
show_tray: boolean;
}
export interface RestartStatus {
accepted: boolean;
source: string;
reason: string;
}
export async function openhumanServiceInstall(): Promise<CommandResponse<ServiceStatus>> {
try {
return await callCoreRpc<CommandResponse<ServiceStatus>>({
method: 'openhuman.service_install',
});
} catch (err) {
// The direct CLI fallback is a Tauri shell command; outside the shell
// surface the core RPC error instead.
if (!isTauri()) throw err;
const raw = await invoke<string>('service_install_direct');
return parseServiceCliOutput<ServiceStatus>(raw);
}
}
export async function openhumanServiceStart(): Promise<CommandResponse<ServiceStatus>> {
try {
return await callCoreRpc<CommandResponse<ServiceStatus>>({ method: 'openhuman.service_start' });
} catch (err) {
// The direct CLI fallback is a Tauri shell command; outside the shell
// surface the core RPC error instead.
if (!isTauri()) throw err;
const raw = await invoke<string>('service_start_direct');
return parseServiceCliOutput<ServiceStatus>(raw);
}
}
export async function openhumanServiceStop(): Promise<CommandResponse<ServiceStatus>> {
try {
return await callCoreRpc<CommandResponse<ServiceStatus>>({ method: 'openhuman.service_stop' });
} catch (err) {
// The direct CLI fallback is a Tauri shell command; outside the shell
// surface the core RPC error instead.
if (!isTauri()) throw err;
const raw = await invoke<string>('service_stop_direct');
return parseServiceCliOutput<ServiceStatus>(raw);
}
}
export async function openhumanServiceStatus(): Promise<CommandResponse<ServiceStatus>> {
try {
return await callCoreRpc<CommandResponse<ServiceStatus>>({
method: 'openhuman.service_status',
});
} catch (err) {
// The direct CLI fallback is a Tauri shell command; outside the shell
// surface the core RPC error instead.
if (!isTauri()) throw err;
const raw = await invoke<string>('service_status_direct');
return parseServiceCliOutput<ServiceStatus>(raw);
}
}
export async function openhumanServiceUninstall(): Promise<CommandResponse<ServiceStatus>> {
try {
return await callCoreRpc<CommandResponse<ServiceStatus>>({
method: 'openhuman.service_uninstall',
});
} catch (err) {
// The direct CLI fallback is a Tauri shell command; outside the shell
// surface the core RPC error instead.
if (!isTauri()) throw err;
const raw = await invoke<string>('service_uninstall_direct');
return parseServiceCliOutput<ServiceStatus>(raw);
}
}
export async function openhumanServiceRestart(
source?: string,
reason?: string
): Promise<CommandResponse<RestartStatus>> {
return await callCoreRpc<CommandResponse<RestartStatus>>({
method: 'openhuman.service_restart',
params: { source, reason },
});
}
export async function openhumanAgentServerStatus(): Promise<CommandResponse<AgentServerStatus>> {
return await callCoreRpc<CommandResponse<AgentServerStatus>>({
method: 'openhuman.agent_server_status',
});
}
export async function openhumanGetDaemonHostConfig(): Promise<CommandResponse<DaemonHostConfig>> {
return await callCoreRpc<CommandResponse<DaemonHostConfig>>({
method: 'openhuman.service_daemon_host_get',
});
}
export async function openhumanSetDaemonHostConfig(
showTray: boolean
): Promise<CommandResponse<DaemonHostConfig>> {
return await callCoreRpc<CommandResponse<DaemonHostConfig>>({
method: 'openhuman.service_daemon_host_set',
params: { show_tray: showTray },
});
}