From cbcc720c938db1facd0a8ab89d19d8e4e9c0967a Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Fri, 30 Oct 2026 14:00:40 -0400 Subject: [PATCH] Give Action one metaclass with both parents so Toad imports on Textual main textual#215 gave KeyDeclaration the KeyDeclarationType metaclass, while Action also inherits DeclaredFamily's FamilyMeta; neither metaclass subclasses the other, so `import toad.widget_actions` raises a metaclass conflict and agent-comms' debt-src/debt-tools die importing the Toad cutover tools on every head. KeyFamilyMeta(FamilyMeta, KeyDeclarationType) is the one class both bases require; same lines as toad#1338's fix, so its merge of main resolves to them. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01XbFMSoWgC3ZwKzjT4SwMDu --- src/toad/widget_actions.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/toad/widget_actions.py b/src/toad/widget_actions.py index aaefaa9f5..15c0bf34a 100644 --- a/src/toad/widget_actions.py +++ b/src/toad/widget_actions.py @@ -10,13 +10,13 @@ from typing import ClassVar, Generic, Literal, Self, TypeVar from agent_comms.command import Command -from agent_comms.declared_family import DeclaredFamily +from agent_comms.declared_family import DeclaredFamily, FamilyMeta from agent_comms.field_codec import FieldCodec, FieldPlan from textual.binding import Binding, BindingsMap, CommandBinding, ModeBinding from textual import events from textual._activation import PrimaryActivation from textual._callback import invoke -from textual.keys import KeyDeclaration +from textual.keys import KeyDeclaration, KeyDeclarationType from textual.widgets.text_area import EditingMode from textual.dom import DOMNode from toad.app_node import ToadNode @@ -26,7 +26,12 @@ Context = TypeVar("Context", bound=DOMNode) -class Action(KeyDeclaration[Context], Command, DeclaredFamily, Generic[Context], affix="Action"): +class KeyFamilyMeta(FamilyMeta, KeyDeclarationType): + """A named command family whose classes declare native key overlap.""" + + +class Action(KeyDeclaration[Context], Command, DeclaredFamily, Generic[Context], + metaclass=KeyFamilyMeta, affix="Action"): """Only the Textual boundary decodes an external action name. A member declares its keys, and its title and docstring are the only text any view shows for it."""