Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions desktop/src-tauri/src/commands/mesh_llm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,20 @@ pub async fn mesh_stop_node(
Ok(mesh_llm::stopped_status())
}

/// Whether this build was compiled with the `mesh-llm` feature at all —
/// distinct from `mesh_node_status`, which reports whether a node is
/// *running*. The frontend uses this to decide whether "Buzz shared compute"
/// belongs in the persona/agent provider picker in the first place: offering
/// it on a build that lacks the feature (e.g. today's Windows release, which
/// windows-canary.yml's own comment documents as not building mesh-llm) led
/// every agent that picked it to fail deep inside buzz-agent's own process
/// with an opaque `BUZZ_AGENT_PROVIDER=relay-mesh not supported` (#269),
/// instead of the option simply not being offered.
#[tauri::command]
pub fn mesh_llm_feature_enabled() -> bool {
true
}

#[tauri::command]
pub async fn mesh_node_status(state: State<'_, AppState>) -> CmdResult<mesh_llm::MeshNodeStatus> {
let runtime = state.mesh_llm_runtime.lock().await;
Expand Down
8 changes: 8 additions & 0 deletions desktop/src-tauri/src/commands/mesh_llm_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
use super::*;
use crate::app_state::build_app_state;

#[test]
fn feature_enabled_reports_true_on_a_mesh_llm_build() {
// The frontend uses this to decide whether "Buzz shared compute" belongs
// in the provider picker at all (#269) -- must report true whenever this
// test itself can even compile, since it's gated the same way.
assert!(mesh_llm_feature_enabled());
}

fn target(model_id: &str, endpoint_addr: &str) -> mesh_llm::MeshServeTarget {
mesh_llm::MeshServeTarget {
model_id: model_id.to_string(),
Expand Down
1 change: 1 addition & 0 deletions desktop/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,7 @@ pub fn run() {
put_agent_session_config,
get_global_agent_config,
set_global_agent_config,
mesh_llm_feature_enabled,
mesh_start_node,
mesh_stop_node,
mesh_node_status,
Expand Down
20 changes: 20 additions & 0 deletions desktop/src-tauri/src/mesh_llm_stubs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ use crate::app_state::AppState;

type CmdResult<T> = Result<T, String>;

/// Stub counterpart of `commands::mesh_llm::mesh_llm_feature_enabled` — see
/// that function's doc comment for why this exists (#269).
#[tauri::command]
pub fn mesh_llm_feature_enabled() -> bool {
false
}

#[tauri::command]
pub async fn mesh_start_node(
_app: tauri::AppHandle,
Expand Down Expand Up @@ -42,3 +49,16 @@ pub async fn mesh_installed_models(
pub async fn mesh_model_catalog() -> CmdResult<serde_json::Value> {
Err("mesh-llm feature not enabled".to_string())
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn feature_enabled_reports_false_on_a_non_mesh_llm_build() {
// The frontend uses this to hide "Buzz shared compute" from the
// provider picker on a build that can't run it (#269) -- must report
// false whenever this stub (not the real command) is what's compiled.
assert!(!mesh_llm_feature_enabled());
}
}
28 changes: 12 additions & 16 deletions desktop/src/features/agents/ui/AgentConfigFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {
GlobalAgentConfig,
} from "@/shared/api/types";
import { cn } from "@/shared/lib/cn";
import { useMeshLlmFeatureEnabled } from "@/features/mesh-compute/hooks/useMeshLlmFeatureEnabled";
import { EnvVarsEditor } from "@/features/agents/ui/EnvVarsEditor";
import type { InheritedEnvRow } from "@/features/agents/ui/EnvVarsEditor";
import {
Expand All @@ -33,9 +34,9 @@ import {
} from "@/features/agents/ui/bakedEnvHelpers";
import {
AUTO_PROVIDER_DROPDOWN_VALUE,
BLOCK_BUILD_HIDDEN_PROVIDER_IDS,
CARD_MINT_KEY_ANNOTATIONS,
CUSTOM_PROVIDER_DROPDOWN_VALUE,
computeHideProviderIds,
getPersonaProviderOptions,
getProviderApiKeyEnvVar,
getProviderApiKeyLabel,
Expand Down Expand Up @@ -585,21 +586,16 @@ export function AgentConfigFields({
onConfigChange({ ...config, env_vars: next });
};

// On internal Block builds, BUZZ_AGENT_PROVIDER is baked in and a boot
// migration rewrites v1→v2. Hide the legacy v1 option so it is not offered
// for new selections; OSS builds show it.
const hideProviderIds = React.useMemo(() => {
const hidden = new Set<string>();
if (bakedEnvKeys.includes("BUZZ_AGENT_PROVIDER")) {
for (const providerId of BLOCK_BUILD_HIDDEN_PROVIDER_IDS) {
hidden.add(providerId);
}
}
if (selectedRuntimeId !== "buzz-agent") {
hidden.add("relay-mesh");
}
return hidden;
}, [bakedEnvKeys, selectedRuntimeId]);
const meshLlmFeatureEnabled = useMeshLlmFeatureEnabled();
const hideProviderIds = React.useMemo(
() =>
computeHideProviderIds({
bakedEnvKeys,
selectedRuntimeId,
meshLlmFeatureEnabled,
}),
[bakedEnvKeys, selectedRuntimeId, meshLlmFeatureEnabled],
);
const providerOptions = getPersonaProviderOptions(
providerValue,
credentialRuntimeId,
Expand Down
29 changes: 29 additions & 0 deletions desktop/src/features/agents/ui/agentConfigOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,35 @@ export const BLOCK_BUILD_HIDDEN_PROVIDER_IDS: ReadonlySet<string> = new Set([
"databricks",
]);

/**
* Provider ids to suppress from the picker for the current build/runtime
* combination: the Block-build legacy v1 set above, `relay-mesh` for any
* runtime other than `buzz-agent`, and `relay-mesh` again when this build
* was not compiled with the `mesh-llm` feature (#269) — offering it there
* let every agent that picked it fail deep inside buzz-agent's own process
* instead of the option simply not being offered.
*/
export function computeHideProviderIds({
bakedEnvKeys,
selectedRuntimeId,
meshLlmFeatureEnabled,
}: {
bakedEnvKeys: readonly string[];
selectedRuntimeId: string;
meshLlmFeatureEnabled: boolean;
}): Set<string> {
const hidden = new Set<string>();
if (bakedEnvKeys.includes("BUZZ_AGENT_PROVIDER")) {
for (const providerId of BLOCK_BUILD_HIDDEN_PROVIDER_IDS) {
hidden.add(providerId);
}
}
if (selectedRuntimeId !== "buzz-agent" || !meshLlmFeatureEnabled) {
hidden.add("relay-mesh");
}
return hidden;
}

export const PERSONA_FIELD_SHELL_CLASS =
"rounded-xl border border-input bg-muted/40 transition-colors duration-150 ease-out hover:border-muted-foreground/40 focus-within:border-muted-foreground/50";
export const PERSONA_FIELD_CONTROL_CLASS =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import * as React from "react";

import { meshLlmFeatureEnabled } from "@/shared/api/tauriMesh";

/**
* Whether this build was compiled with the `mesh-llm` feature. Defaults to
* `false` (fail closed) until the first successful check resolves, and stays
* `false` if the check itself errors — the option this gates ("Buzz shared
* compute" in the persona/agent provider picker) should never be offered on
* an uncertain answer, only on a confirmed `true` (#269).
*/
export function useMeshLlmFeatureEnabled(): boolean {
const [enabled, setEnabled] = React.useState(false);

React.useEffect(() => {
let cancelled = false;
meshLlmFeatureEnabled()
.then((value) => {
if (!cancelled) setEnabled(value);
})
.catch(() => {
// Stays false — see doc comment above.
});
return () => {
cancelled = true;
};
}, []);

return enabled;
}
13 changes: 13 additions & 0 deletions desktop/src/shared/api/tauriMesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ export async function meshNodeStatus(): Promise<MeshNodeStatus> {
return await invokeTauri<MeshNodeStatus>("mesh_node_status");
}

/**
* Whether this build was compiled with the `mesh-llm` feature at all —
* distinct from node status, which reports whether a node is *running*.
* Some platforms' release builds (Windows, as of writing) don't build
* mesh-llm; offering "Buzz shared compute" as a provider choice on one of
* those builds is what let every agent that picked it fail deep inside
* buzz-agent's own process instead of the option simply not being offered
* (#269).
*/
export async function meshLlmFeatureEnabled(): Promise<boolean> {
return await invokeTauri<boolean>("mesh_llm_feature_enabled");
}

/**
* Host-side usage of the compute this machine is sharing. The
* local/remote/endpoint attempt split distinguishes this machine's own agents
Expand Down
Loading