mirror of
https://github.com/block/buzz.git
synced 2026-11-12 20:31:12 +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>
66 lines
2.5 KiB
TypeScript
66 lines
2.5 KiB
TypeScript
import type { MeshNodeStatus } from "@/shared/api/tauriMesh";
|
|
|
|
/**
|
|
* Derived Share-compute toggle model.
|
|
*
|
|
* The single mesh runtime slot is shared by BOTH roles: serve mode (this
|
|
* machine SHARING compute) and client mode (this machine CONSUMING a peer's
|
|
* compute). Both report `state: "running"`. The Share toggle must therefore
|
|
* key off `mode`, not `state` alone — otherwise consuming a peer's compute
|
|
* lights up the Share switch and (worse) clicking it tears down the unrelated
|
|
* client session. See `deriveMeshShareToggle`.
|
|
*/
|
|
export type MeshShareToggleModel = {
|
|
/**
|
|
* The Share switch is on: a serve-mode node occupies the slot. Stays true
|
|
* while it is starting or even if it later fails health (the runtime still
|
|
* occupies the slot, and the user must be able to turn it off to clear/retry
|
|
* — see `StatusLine` for the health sub-state). A serve node that also routes
|
|
* a peer's model is still sharing: routing is a capability, not a role.
|
|
*/
|
|
isSharing: boolean;
|
|
/**
|
|
* A client-mode runtime occupies the single slot (this machine is consuming
|
|
* a peer's compute). The Share switch reads off while true, but the member
|
|
* may replace this client with a serve runtime by turning sharing on.
|
|
*/
|
|
isConsuming: boolean;
|
|
/**
|
|
* ANY runtime occupies the single slot (serve or client, healthy or failed).
|
|
* This remains useful for disabling edits around an existing serve runtime;
|
|
* the backend supports the intentional client-to-serve replacement.
|
|
*/
|
|
slotOccupied: boolean;
|
|
};
|
|
|
|
/**
|
|
* A runtime object occupies the slot once it is starting or running — and also
|
|
* when it has `failed` (it started, then errored; the runtime is still in the
|
|
* slot and blocks a fresh start). `off`/`stopping` do not occupy it.
|
|
*/
|
|
function occupiesSlot(status: MeshNodeStatus | null): boolean {
|
|
return (
|
|
status?.state === "running" ||
|
|
status?.state === "starting" ||
|
|
status?.state === "failed"
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Project a mesh node status into the Share toggle's on/consuming state.
|
|
*
|
|
* Pure and total (accepts `null` = status not yet fetched). This is the single
|
|
* source of truth for "is this machine sharing?" — the component and its
|
|
* regression tests both consume it so the `state`-only bug cannot come back.
|
|
*/
|
|
export function deriveMeshShareToggle(
|
|
status: MeshNodeStatus | null,
|
|
): MeshShareToggleModel {
|
|
const occupied = occupiesSlot(status);
|
|
return {
|
|
isSharing: occupied && status?.mode === "serve",
|
|
isConsuming: occupied && status?.mode === "client",
|
|
slotOccupied: occupied,
|
|
};
|
|
}
|