rho-coding-agent 3.10.0

A fast Rust agent harness with a small footprint and opinionated defaults
Documentation
//! The daemon's side of `rho/config/*`, `rho/models/*`, `rho/mcp/*`,
//! `rho/hooks/*`, `rho/plugins/*`, and `rho/sync/*`: each method hands its
//! request to the module that owns it.

use super::*;

impl SettingsService for DaemonHost {
    async fn config_schema(&self) -> Result<ConfigSchema, RpcError> {
        Ok(self.sessions.settings().schema())
    }

    async fn register_config(
        &self,
        params: ConfigRegisterParams,
    ) -> Result<ConfigRegisterResponse, RpcError> {
        self.sessions.settings().register(params).await
    }

    async fn get_config(&self, params: ConfigGetParams) -> Result<ConfigWatch, RpcError> {
        self.sessions.settings().get(params).await
    }

    async fn set_config(&self, params: ConfigSetParams) -> Result<ConfigSetResponse, RpcError> {
        self.sessions.settings().set(params).await
    }

    async fn get_config_table(
        &self,
        params: ConfigTableGetParams,
    ) -> Result<ConfigTableGetResponse, RpcError> {
        self.sessions.settings().get_table(params).await
    }

    async fn set_config_table(
        &self,
        params: ConfigTableSetParams,
    ) -> Result<ConfigTableSetResponse, RpcError> {
        self.sessions.settings().set_table(params).await
    }

    async fn list_models(&self, params: ModelListParams) -> Result<ModelWatch, RpcError> {
        models::watch(params, &self.sessions).await
    }

    async fn refresh_models(
        &self,
        params: ModelRefreshParams,
    ) -> Result<ModelRefreshResponse, RpcError> {
        models::refresh(params, &self.sessions).await
    }

    async fn list_mcp_servers(&self, params: McpListParams) -> Result<McpListResponse, RpcError> {
        configured::mcp(params, self.sessions.settings()).await
    }

    async fn list_hooks(&self, params: HooksListParams) -> Result<HooksListResponse, RpcError> {
        configured::hooks(params)
    }

    async fn read_hooks_file(
        &self,
        _params: HooksFileGetParams,
    ) -> Result<HooksFileGetResponse, RpcError> {
        hooks_file::get(&self.hooks_store)
    }

    async fn write_hooks_file(
        &self,
        params: HooksFileSetParams,
    ) -> Result<HooksFileSetResponse, RpcError> {
        hooks_file::set(&self.hooks_store, params).await
    }

    async fn read_hooks_config(
        &self,
        params: HooksConfigGetParams,
    ) -> Result<HooksConfigGetResponse, RpcError> {
        hooks_config::get(&self.hooks_store, params)
    }

    async fn write_hooks_config(
        &self,
        params: HooksConfigSetParams,
    ) -> Result<HooksConfigSetResponse, RpcError> {
        hooks_config::set(&self.hooks_store, params).await
    }

    async fn list_plugins(
        &self,
        params: PluginsListParams,
    ) -> Result<PluginsListResponse, RpcError> {
        self.plugins.list(params).await
    }

    async fn install_plugin(
        &self,
        params: PluginsInstallParams,
    ) -> Result<PluginsInstallResponse, RpcError> {
        self.plugins.install(params).await
    }

    async fn update_plugins(
        &self,
        params: PluginsUpdateParams,
    ) -> Result<PluginsUpdateResponse, RpcError> {
        self.plugins.update(params).await
    }

    async fn set_plugin_enabled(
        &self,
        params: PluginsSetEnabledParams,
    ) -> Result<PluginsSetEnabledResponse, RpcError> {
        self.plugins.set_enabled(params).await
    }

    async fn remove_plugin(
        &self,
        params: PluginsRemoveParams,
    ) -> Result<PluginsRemoveResponse, RpcError> {
        self.plugins.remove(params).await
    }

    async fn sync_recipient(
        &self,
        _params: SyncRecipientParams,
    ) -> Result<SyncRecipientResponse, RpcError> {
        Ok(self.sync.recipient())
    }

    async fn sync_export(&self, params: SyncExportParams) -> Result<SyncExportResponse, RpcError> {
        self.sync.export(params, self.sessions.settings()).await
    }

    async fn sync_compare(
        &self,
        params: SyncCompareParams,
    ) -> Result<SyncCompareResponse, RpcError> {
        self.sync.compare(params, self.sessions.settings()).await
    }

    async fn sync_import_keys(
        &self,
        params: SyncImportKeysParams,
    ) -> Result<SyncImportKeysResponse, RpcError> {
        self.sync.import_keys(params, &self.sessions).await
    }

    async fn sync_status(&self, params: SyncStatusParams) -> Result<SyncStatusResponse, RpcError> {
        self.sync.status(params, self.sessions.settings()).await
    }

    async fn sync_revert(&self, params: SyncRevertParams) -> Result<SyncRevertResponse, RpcError> {
        let reverted = self.sync.revert(params, self.sessions.settings()).await?;
        if reverted.key_restored {
            auth::credentials_changed(&self.sessions).await;
        }
        Ok(reverted.response)
    }

    async fn sync_discard(
        &self,
        params: SyncDiscardParams,
    ) -> Result<SyncDiscardResponse, RpcError> {
        self.sync.discard(params).await
    }

    async fn mcp_config_get(
        &self,
        _params: McpConfigGetParams,
    ) -> Result<McpConfigGetResponse, RpcError> {
        self.sessions.settings().mcp_config()
    }

    async fn mcp_config_set(
        &self,
        params: McpConfigSetParams,
    ) -> Result<McpConfigSetResponse, RpcError> {
        self.sync.set_mcp(params, self.sessions.settings()).await
    }

    async fn mcp_secret_set(
        &self,
        params: McpSecretSetParams,
    ) -> Result<McpSecretSetResponse, RpcError> {
        mcp_secrets::set(params).await
    }

    async fn mcp_probe(&self, params: McpProbeParams) -> Result<McpProbeResponse, RpcError> {
        mcp_probe::probe(params, self.sessions.settings()).await
    }

    async fn mcp_secret_delete(
        &self,
        params: McpSecretDeleteParams,
    ) -> Result<McpSecretDeleteResponse, RpcError> {
        mcp_secrets::delete(params).await
    }
}