Let a function node's own settings be edited

A python node's params reach process() as whatever its author put there,
but there was no way to put anything there: the settings form is built
from a type's declared schema, and a function node declares none.

Node types now say whether they take settings beyond their schema, and
the panel offers a key/value editor for the ones that do — named, typed
as text, number, on/off or JSON, and laid out like the port list beside
it. Rows are keyed by position rather than by name, so renaming a setting
does not remount the row and lose what was being typed into it.

Verified in the running app in both themes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011LF61rxW1FG5YCD2J9YqjY
This commit is contained in:
root
2026-08-16 08:20:17 +02:00
co-authored by Claude Fable 5
parent 55bdc49510
commit fef0545ae4
7 changed files with 265 additions and 0 deletions
+3
View File
@@ -101,6 +101,7 @@ class NodeType:
# Constructor signatures differ per node type.
cls: Any
has_source: bool = False
free_params: bool = False
params_schema: dict[str, Any] = field(default_factory=dict)
#: Which installed package supplied this type, for the ones that are not
#: built in.
@@ -118,6 +119,7 @@ NODE_TYPES: dict[str, NodeType] = {
description="Your own Python code, run on every incoming message.",
cls=Node,
has_source=True,
free_params=True,
),
"mqtt": NodeType(
title="MQTT",
@@ -214,6 +216,7 @@ def node_type_info() -> list[NodeTypeInfo]:
description=spec.description,
params_schema=spec.params_schema,
has_source=spec.has_source,
free_params=spec.free_params,
plugin=spec.plugin,
)
for key, spec in NODE_TYPES.items()
+4
View File
@@ -155,5 +155,9 @@ class NodeTypeInfo(BaseModel):
description: str
params_schema: dict[str, Any] = Field(default_factory=dict)
has_source: bool = False
#: Whether this type takes settings beyond the ones its schema declares.
#: A function node's params are its author's to name, and reach `process`
#: as whatever they put there.
free_params: bool = False
#: The package a connector came from; empty for the built-in types.
plugin: str | None = None