Skip to content

Free, open-source AI video generator for Mac. Run LTX-2.5 and MiniMax H3 (Hailuo) locally on Apple Silicon: text-to-video and image-to-video with sound, lip-sync, character LoRA training, songs from lyrics (YuE2) and image editing (Qwen-Image-Edit). One-click install via Pinokio. Offline: no cloud, no API key, no NVIDIA GPU.

feat(agent): list_loras tool — agent can read installed LoRAs

mrbizarro09b8d5ebd92e
diff --git a/agent/runtime.py b/agent/runtime.py
index 27d0602..d856f3c 100644
--- a/agent/runtime.py
+++ b/agent/runtime.py
@@ -385,7 +385,7 @@ def render_tools_doc() -> str:
order = [
"estimate_shot", "submit_shot", "get_queue_status",
"wait_for_shot", "extract_frame", "upload_image",
- "read_document",
+ "read_document", "list_loras",
"read_project_notes", "append_project_notes",
"write_session_manifest", "finish",
]
diff --git a/agent/tools.py b/agent/tools.py
index 952b08f..62567a5 100644
--- a/agent/tools.py
+++ b/agent/tools.py
@@ -69,6 +69,11 @@ class PanelOps:
# plan to what this Mac can actually render.
capabilities: dict
+ # Optional callback returning the list of installed user LoRAs.
+ # Wired by the panel; tests pass a lambda. None means "no LoRA
+ # browser available in this host" — list_loras returns empty.
+ list_loras_fn: Callable[[], list[dict]] | None = None
+
# Persistent state root (for project notes, sessions, configs). The
# agent's project-memory tools write under here so notes survive
# across sessions and panel restarts.
@@ -1018,6 +1023,51 @@ def _read_document(args: dict, ops: PanelOps, session: dict) -> dict:
return out
+@tool("list_loras")
+def _list_loras(args: dict, ops: PanelOps, session: dict) -> dict:
+ """List the LoRAs installed in this Phosphene panel.
+
+ Returns the user's installed LoRAs from `mlx_models/loras/` —
+ each with name, trigger words, recommended strength, base model,
+ and the absolute file path. Use this BEFORE recommending a LoRA
+ on a shot so you only suggest ones the user actually has.
+
+ To USE a LoRA on a shot, pass its filename (e.g. "noir_style.safetensors")
+ in the `loras` arg of `submit_shot`:
+ loras: [{"name": "noir_style.safetensors", "strength": 0.8}]
+ The panel matches by filename and applies the weights.
+
+ INSTALLING a new LoRA requires the user — the CivitAI browser is
+ behind a consent gate (NSFW LoRAs in particular). If the user
+ asks for a look you don't have a LoRA for, point them at
+ Settings → LoRAs → Browse rather than trying to install it.
+
+ Returns: { count, loras: [ {filename, name, description, base_model,
+ trigger_words, recommended_strength, path}, ... ] }.
+ """
+ fn = getattr(ops, "list_loras_fn", None)
+ if fn is None:
+ return {"count": 0, "loras": [], "note": "No LoRA picker available."}
+ try:
+ raw = fn() or []
+ except Exception as e: # noqa: BLE001
+ raise _ToolValidationError(f"list_loras failed: {e}") from e
+ # Slim to what the agent needs — strip preview URLs etc. that
+ # bloat the response.
+ out = []
+ for l in raw:
+ out.append({
+ "filename": l.get("filename"),
+ "name": l.get("name"),
+ "description": (l.get("description") or "")[:240],
+ "base_model": l.get("base_model"),
+ "trigger_words": l.get("trigger_words") or [],
+ "recommended_strength": l.get("recommended_strength") or 1.0,
+ "path": l.get("path"),
+ })
+ return {"count": len(out), "loras": out}
+
+
@tool("read_project_notes")
def _read_project_notes(args: dict, ops: PanelOps, session: dict) -> dict:
"""Read the full project-notes file.
diff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.py
index 25ea462..83955d5 100644
--- a/mlx_ltx_panel.py
+++ b/mlx_ltx_panel.py
@@ -3746,6 +3746,11 @@ def _build_panel_ops() -> agent_tools.PanelOps:
uploads_dir=UPLOADS,
capabilities=_agent_capabilities(include_secrets=True),
state_dir=STATE_DIR,
+ # Wire the LoRA listing so the agent's `list_loras` tool can read
+ # installed LoRAs. The agent can then recommend them on shots
+ # via submit_shot's `loras` arg. INSTALL stays user-driven (the
+ # CivitAI browser has a consent gate).
+ list_loras_fn=list_user_loras,
)