mirror of
https://github.com/block/buzz.git
synced 2026-10-30 05:51:46 +00:00
Uses MeshLLM built-in `mesh` collective intelligence / Mixture of Agents when Buzz Auto sees two or more distinct physical models. With zero or one model, Auto remains ordinary `auto`. This is an alternative way to improve tool responses, accuracy, and resistance to hallucination when a high-latency distributed mesh contains diverse models. Models and members may come and go: collective routing enables only after stable capacity, drops on confirmed contraction, and can recover later. Mesh-specific failures retry once through ordinary Auto. This update also pins MeshLLM to a v0.73.1-compatible backport of [MeshLLM #1074](https://github.com/Mesh-LLM/mesh-llm/pull/1074), so client-only Buzz nodes cannot enter model election or download a remote provider model. Buzz preserves the selected local sharing model and switches an existing client to sharing across a controlled app restart, retaining one runtime and one `:9337` / `:3131` pair per machine. Validation: - Full local `just ci` passes on the cleaned branch. - MeshLLM host-runtime suite: 1,568 passed, 0 failed; strict Clippy passes. - Buzz desktop Tauri suite with `mesh-llm`: 1,721 passed, 0 failed; strict feature Clippy passes. - Playwright covers client-to-share using the saved local model and no destructive stop. - Packaged two-machine testing proved single-model routing, dual-model collective routing, tool-markup fallback, and runtime reuse. - Packaged client-only recheck routed a real Mini Buzz turn through M5 while Mini stayed `is_client=true`, `is_host=false`, hosted no models, and created no Gemma cache. Builds on the recovery work merged in #2823; this PR does not duplicate it. --------- Signed-off-by: Michael Neale <michael.neale@gmail.com> Signed-off-by: Tyler Longwell <tlongwell@block.xyz> Co-authored-by: Michael Neale <michael.neale@gmail.com> Co-authored-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz> Co-authored-by: Tyler Longwell <tlongwell@block.xyz>
100 lines
2.6 KiB
TypeScript
100 lines
2.6 KiB
TypeScript
import {
|
|
AUTO_MODEL_DROPDOWN_VALUE,
|
|
buildTemplateModelDropdownOptions,
|
|
CUSTOM_MODEL_DROPDOWN_VALUE,
|
|
getModelSelectValue,
|
|
hasPersonaModelOption,
|
|
type PersonaDropdownOption,
|
|
type PersonaModelOption,
|
|
} from "./agentConfigOptions";
|
|
|
|
function withSharedComputeAutoOption(
|
|
options: readonly PersonaModelOption[],
|
|
): readonly PersonaModelOption[] {
|
|
const modelOptions = options.filter((option) => option.id.trim() !== "");
|
|
return [
|
|
{ id: "", label: "Auto (collective when available)" },
|
|
...modelOptions,
|
|
];
|
|
}
|
|
|
|
export function relayMeshModelPickerState({
|
|
discoveredOptions,
|
|
fallbackOptions,
|
|
knownOptions,
|
|
isCustomEditing,
|
|
model,
|
|
modelFieldVisible = true,
|
|
provider,
|
|
}: {
|
|
discoveredOptions: readonly PersonaModelOption[] | null;
|
|
fallbackOptions: readonly PersonaModelOption[];
|
|
knownOptions?: readonly PersonaModelOption[];
|
|
isCustomEditing: boolean;
|
|
model: string;
|
|
modelFieldVisible?: boolean;
|
|
provider: string;
|
|
}) {
|
|
const isRelayMesh = provider.trim() === "relay-mesh";
|
|
const trimmedModel = model.trim();
|
|
const options = isRelayMesh
|
|
? withSharedComputeAutoOption(discoveredOptions ?? [])
|
|
: (discoveredOptions ?? fallbackOptions);
|
|
const isKnownModel = hasPersonaModelOption(knownOptions ?? options, model);
|
|
const isCustom = !isRelayMesh && !isKnownModel;
|
|
const selectValue = isRelayMesh
|
|
? trimmedModel === "auto" || !isKnownModel
|
|
? AUTO_MODEL_DROPDOWN_VALUE
|
|
: trimmedModel || AUTO_MODEL_DROPDOWN_VALUE
|
|
: getModelSelectValue({
|
|
isCustomModelEditing: isCustomEditing,
|
|
isModelCustom: isCustom,
|
|
model,
|
|
});
|
|
return {
|
|
isCustom,
|
|
isRelayMesh,
|
|
options,
|
|
selectValue,
|
|
showCustomInput:
|
|
!isRelayMesh && modelFieldVisible && (isCustomEditing || isCustom),
|
|
};
|
|
}
|
|
|
|
export function modelDropdownOptions({
|
|
options,
|
|
loading,
|
|
loadingValue,
|
|
allowCustom,
|
|
globalModel,
|
|
globalModelLabel,
|
|
}: {
|
|
options: readonly PersonaModelOption[];
|
|
loading: boolean;
|
|
loadingValue: string;
|
|
allowCustom: boolean;
|
|
globalModel?: string;
|
|
globalModelLabel?: string;
|
|
}): PersonaDropdownOption[] {
|
|
const modelOptions =
|
|
globalModel === undefined
|
|
? options.map((option) => ({
|
|
label: option.label,
|
|
value: option.id || AUTO_MODEL_DROPDOWN_VALUE,
|
|
}))
|
|
: buildTemplateModelDropdownOptions(
|
|
options,
|
|
globalModel,
|
|
globalModelLabel,
|
|
);
|
|
return [
|
|
...modelOptions,
|
|
...(loading
|
|
? [{ disabled: true, label: "Loading models...", value: loadingValue }]
|
|
: []),
|
|
...(allowCustom
|
|
? [{ label: "Custom model...", value: CUSTOM_MODEL_DROPDOWN_VALUE }]
|
|
: []),
|
|
];
|
|
}
|