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

View File

@@ -0,0 +1,7 @@
"""Factory for VarDelete plugin."""
from .var_delete import VarDelete
def create():
return VarDelete()

View File

@@ -1,13 +1,16 @@
{
"name": "@metabuilder/var_delete",
"version": "1.0.0",
"description": "var_delete plugin",
"description": "Delete variable from workflow store",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["var", "workflow", "plugin"],
"main": "var_delete.py",
"files": ["var_delete.py", "factory.py"],
"metadata": {
"plugin_type": "var.delete",
"category": "var"
"category": "var",
"class": "VarDelete",
"entrypoint": "execute"
}
}

View File

@@ -1,15 +1,24 @@
"""Workflow plugin: delete variable from workflow store."""
from ...base import NodeExecutor
def run(runtime, inputs):
"""Delete variable from workflow store."""
key = inputs.get("key")
if key is None:
return {"result": False, "deleted": False, "error": "key is required"}
class VarDelete(NodeExecutor):
"""Delete a variable from the workflow store."""
if key in runtime.store:
del runtime.store[key]
return {"result": True, "deleted": True}
node_type = "var.delete"
category = "var"
description = "Delete variable from workflow store"
return {"result": False, "deleted": False}
def execute(self, inputs, runtime=None):
"""Delete variable from workflow store."""
key = inputs.get("key")
if key is None:
return {"result": False, "deleted": False, "error": "key is required"}
if key in runtime.store:
del runtime.store[key]
return {"result": True, "deleted": True}
return {"result": False, "deleted": False}

View File

@@ -0,0 +1,7 @@
"""Factory for VarExists plugin."""
from .var_exists import VarExists
def create():
return VarExists()

View File

@@ -1,13 +1,16 @@
{
"name": "@metabuilder/var_exists",
"version": "1.0.0",
"description": "var_exists plugin",
"description": "Check if variable exists in workflow store",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["var", "workflow", "plugin"],
"main": "var_exists.py",
"files": ["var_exists.py", "factory.py"],
"metadata": {
"plugin_type": "var.exists",
"category": "var"
"category": "var",
"class": "VarExists",
"entrypoint": "execute"
}
}

View File

@@ -1,13 +1,22 @@
"""Workflow plugin: check if variable exists in workflow store."""
from ...base import NodeExecutor
def run(runtime, inputs):
"""Check if variable exists in workflow store."""
key = inputs.get("key")
if key is None:
return {"result": False, "error": "key is required"}
class VarExists(NodeExecutor):
"""Check if a variable exists in the workflow store."""
exists = key in runtime.store
node_type = "var.exists"
category = "var"
description = "Check if variable exists in workflow store"
return {"result": exists}
def execute(self, inputs, runtime=None):
"""Check if variable exists in workflow store."""
key = inputs.get("key")
if key is None:
return {"result": False, "error": "key is required"}
exists = key in runtime.store
return {"result": exists}

View File

@@ -0,0 +1,7 @@
"""Factory for VarGet plugin."""
from .var_get import VarGet
def create():
return VarGet()

View File

@@ -1,13 +1,16 @@
{
"name": "@metabuilder/var_get",
"version": "1.0.0",
"description": "var_get plugin",
"description": "Get variable from workflow store",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["var", "workflow", "plugin"],
"main": "var_get.py",
"files": ["var_get.py", "factory.py"],
"metadata": {
"plugin_type": "var.get",
"category": "var"
"category": "var",
"class": "VarGet",
"entrypoint": "execute"
}
}

View File

@@ -1,15 +1,24 @@
"""Workflow plugin: get variable from workflow store."""
from ...base import NodeExecutor
def run(runtime, inputs):
"""Get variable value from workflow store."""
key = inputs.get("key")
default = inputs.get("default")
if key is None:
return {"result": default, "exists": False, "error": "key is required"}
class VarGet(NodeExecutor):
"""Get a variable value from the workflow store."""
exists = key in runtime.store
value = runtime.store.get(key, default)
node_type = "var.get"
category = "var"
description = "Get variable from workflow store"
return {"result": value, "exists": exists}
def execute(self, inputs, runtime=None):
"""Get variable value from workflow store."""
key = inputs.get("key")
default = inputs.get("default")
if key is None:
return {"result": default, "exists": False, "error": "key is required"}
exists = key in runtime.store
value = runtime.store.get(key, default)
return {"result": value, "exists": exists}

View File

@@ -0,0 +1,7 @@
"""Factory for VarSet plugin."""
from .var_set import VarSet
def create():
return VarSet()

View File

@@ -1,13 +1,16 @@
{
"name": "@metabuilder/var_set",
"version": "1.0.0",
"description": "var_set plugin",
"description": "Set variable in workflow store",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["var", "workflow", "plugin"],
"main": "var_set.py",
"files": ["var_set.py", "factory.py"],
"metadata": {
"plugin_type": "var.set",
"category": "var"
"category": "var",
"class": "VarSet",
"entrypoint": "execute"
}
}

View File

@@ -1,14 +1,23 @@
"""Workflow plugin: set variable in workflow store."""
from ...base import NodeExecutor
def run(runtime, inputs):
"""Set variable value in workflow store."""
key = inputs.get("key")
value = inputs.get("value")
if key is None:
return {"result": None, "key": None, "error": "key is required"}
class VarSet(NodeExecutor):
"""Set a variable value in the workflow store."""
runtime.store[key] = value
node_type = "var.set"
category = "var"
description = "Set variable in workflow store"
return {"result": value, "key": key}
def execute(self, inputs, runtime=None):
"""Set variable value in workflow store."""
key = inputs.get("key")
value = inputs.get("value")
if key is None:
return {"result": None, "key": None, "error": "key is required"}
runtime.store[key] = value
return {"result": value, "key": key}