refactor(workflow): convert all plugins to class/struct + factory pattern

- Python: class extending NodeExecutor + factory.py (80+ plugins)
- TypeScript: class implements NodeExecutor + factory.ts (7 groups, 116 classes)
- Go: struct with methods + factory.go (36 plugins)
- Rust: struct impl NodeExecutor trait + factory.rs (54 plugins)
- Mojo: struct + factory.mojo (11 plugins)

All package.json files now include:
- files array listing source files
- metadata.class/struct field
- metadata.entrypoint field

This enables a unified plugin loading system across all languages
with no import side effects (Spring-style DI pattern).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-22 14:53:04 +00:00
parent 2562c2f55b
commit 7ce8b4ae8a
653 changed files with 13243 additions and 3034 deletions
@@ -1,14 +1,33 @@
"""Workflow plugin: get value from dictionary."""
from ...base import NodeExecutor
def run(_runtime, inputs):
class DictGet(NodeExecutor):
"""Get value from dictionary by key."""
obj = inputs.get("object", {})
key = inputs.get("key")
default = inputs.get("default")
if not isinstance(obj, dict):
return {"result": default, "found": False}
node_type = "dict.get"
category = "dict"
description = "Get value from dictionary by key"
result = obj.get(key, default)
return {"result": result, "found": key in obj}
def execute(self, inputs, runtime=None):
obj = inputs.get("object", inputs.get("dict", {}))
key = inputs.get("key", inputs.get("path"))
default = inputs.get("default")
if not isinstance(obj, dict):
return {"result": default, "found": False}
# Support dot notation paths
if key and "." in key:
parts = key.split(".")
current = obj
for part in parts:
if isinstance(current, dict):
current = current.get(part)
else:
return {"result": default, "found": False}
return {"result": current if current is not None else default, "found": current is not None}
result = obj.get(key, default)
return {"result": result, "found": key in obj}
@@ -0,0 +1,7 @@
"""Factory for DictGet plugin."""
from .dict_get import DictGet
def create():
return DictGet()
@@ -1,13 +1,16 @@
{
"name": "@metabuilder/dict_get",
"version": "1.0.0",
"description": "dict_get plugin",
"description": "Get value from dictionary by key",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["dict", "workflow", "plugin"],
"main": "dict_get.py",
"files": ["dict_get.py", "factory.py"],
"metadata": {
"plugin_type": "dict.get",
"category": "dict"
"category": "dict",
"class": "DictGet",
"entrypoint": "execute"
}
}
@@ -1,11 +1,21 @@
"""Workflow plugin: get dictionary items as key-value pairs."""
from ...base import NodeExecutor
def run(_runtime, inputs):
class DictItems(NodeExecutor):
"""Get dictionary items as list of [key, value] pairs."""
obj = inputs.get("object", {})
if not isinstance(obj, dict):
return {"result": []}
node_type = "dict.items"
category = "dict"
description = "Get dictionary items as list of [key, value] pairs"
return {"result": [[k, v] for k, v in obj.items()]}
def execute(self, inputs, runtime=None):
obj = inputs.get("object", inputs.get("dict", {}))
if isinstance(obj, dict):
result = [[k, v] for k, v in obj.items()]
else:
result = []
return {"result": result}
@@ -0,0 +1,7 @@
"""Factory for DictItems plugin."""
from .dict_items import DictItems
def create():
return DictItems()
@@ -1,13 +1,16 @@
{
"name": "@metabuilder/dict_items",
"version": "1.0.0",
"description": "dict_items plugin",
"description": "Get dictionary items as list of key-value pairs",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["dict", "workflow", "plugin"],
"main": "dict_items.py",
"files": ["dict_items.py", "factory.py"],
"metadata": {
"plugin_type": "dict.items",
"category": "dict"
"category": "dict",
"class": "DictItems",
"entrypoint": "execute"
}
}
@@ -1,11 +1,21 @@
"""Workflow plugin: get dictionary keys."""
from ...base import NodeExecutor
def run(_runtime, inputs):
class DictKeys(NodeExecutor):
"""Get all keys from dictionary."""
obj = inputs.get("object", {})
if not isinstance(obj, dict):
return {"result": []}
node_type = "dict.keys"
category = "dict"
description = "Get all keys from dictionary"
return {"result": list(obj.keys())}
def execute(self, inputs, runtime=None):
obj = inputs.get("object", inputs.get("dict", {}))
if isinstance(obj, dict):
result = list(obj.keys())
else:
result = []
return {"result": result}
@@ -0,0 +1,7 @@
"""Factory for DictKeys plugin."""
from .dict_keys import DictKeys
def create():
return DictKeys()
@@ -1,13 +1,16 @@
{
"name": "@metabuilder/dict_keys",
"version": "1.0.0",
"description": "dict_keys plugin",
"description": "Get all keys from dictionary",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["dict", "workflow", "plugin"],
"main": "dict_keys.py",
"files": ["dict_keys.py", "factory.py"],
"metadata": {
"plugin_type": "dict.keys",
"category": "dict"
"category": "dict",
"class": "DictKeys",
"entrypoint": "execute"
}
}
@@ -1,13 +1,19 @@
"""Workflow plugin: merge dictionaries."""
from ...base import NodeExecutor
def run(_runtime, inputs):
class DictMerge(NodeExecutor):
"""Merge multiple dictionaries."""
objects = inputs.get("objects", [])
result = {}
for obj in objects:
if isinstance(obj, dict):
result.update(obj)
node_type = "dict.merge"
category = "dict"
description = "Merge multiple dictionaries"
return {"result": result}
def execute(self, inputs, runtime=None):
objects = inputs.get("objects", [])
result = {}
for obj in objects:
if isinstance(obj, dict):
result.update(obj)
return {"result": result}
@@ -0,0 +1,7 @@
"""Factory for DictMerge plugin."""
from .dict_merge import DictMerge
def create():
return DictMerge()
@@ -1,13 +1,16 @@
{
"name": "@metabuilder/dict_merge",
"version": "1.0.0",
"description": "dict_merge plugin",
"description": "Merge multiple dictionaries",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["dict", "workflow", "plugin"],
"main": "dict_merge.py",
"files": ["dict_merge.py", "factory.py"],
"metadata": {
"plugin_type": "dict.merge",
"category": "dict"
"category": "dict",
"class": "DictMerge",
"entrypoint": "execute"
}
}
@@ -1,15 +1,22 @@
"""Workflow plugin: set value in dictionary."""
from ...base import NodeExecutor
def run(_runtime, inputs):
class DictSet(NodeExecutor):
"""Set value in dictionary by key."""
obj = inputs.get("object", {})
key = inputs.get("key")
value = inputs.get("value")
if not isinstance(obj, dict):
obj = {}
node_type = "dict.set"
category = "dict"
description = "Set value in dictionary by key"
result = dict(obj)
result[key] = value
return {"result": result}
def execute(self, inputs, runtime=None):
obj = inputs.get("object", inputs.get("dict", {}))
key = inputs.get("key", inputs.get("path"))
value = inputs.get("value")
if not isinstance(obj, dict):
obj = {}
result = {**obj, key: value}
return {"result": result}
@@ -0,0 +1,7 @@
"""Factory for DictSet plugin."""
from .dict_set import DictSet
def create():
return DictSet()
@@ -1,13 +1,16 @@
{
"name": "@metabuilder/dict_set",
"version": "1.0.0",
"description": "dict_set plugin",
"description": "Set value in dictionary by key",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["dict", "workflow", "plugin"],
"main": "dict_set.py",
"files": ["dict_set.py", "factory.py"],
"metadata": {
"plugin_type": "dict.set",
"category": "dict"
"category": "dict",
"class": "DictSet",
"entrypoint": "execute"
}
}
@@ -1,11 +1,21 @@
"""Workflow plugin: get dictionary values."""
from ...base import NodeExecutor
def run(_runtime, inputs):
class DictValues(NodeExecutor):
"""Get all values from dictionary."""
obj = inputs.get("object", {})
if not isinstance(obj, dict):
return {"result": []}
node_type = "dict.values"
category = "dict"
description = "Get all values from dictionary"
return {"result": list(obj.values())}
def execute(self, inputs, runtime=None):
obj = inputs.get("object", inputs.get("dict", {}))
if isinstance(obj, dict):
result = list(obj.values())
else:
result = []
return {"result": result}
@@ -0,0 +1,7 @@
"""Factory for DictValues plugin."""
from .dict_values import DictValues
def create():
return DictValues()
@@ -1,13 +1,16 @@
{
"name": "@metabuilder/dict_values",
"version": "1.0.0",
"description": "dict_values plugin",
"description": "Get all values from dictionary",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["dict", "workflow", "plugin"],
"main": "dict_values.py",
"files": ["dict_values.py", "factory.py"],
"metadata": {
"plugin_type": "dict.values",
"category": "dict"
"category": "dict",
"class": "DictValues",
"entrypoint": "execute"
}
}