mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 06:14:59 +00:00
feat: Add Python plugins from AutoMetabuilder + restructure workflow folder
Restructure workflow/ for multi-language plugin support:
- Rename src/ to core/ (engine code: DAG executor, registry, types)
- Create executor/{cpp,python,ts}/ for language-specific runtimes
- Consolidate plugins to plugins/{ts,python}/ by language then category
Add 80+ Python plugins from AutoMetabuilder in 14 categories:
- control: bot control, switch logic, state management
- convert: type conversions (json, boolean, dict, list, number, string)
- core: AI requests, context management, tool calls
- dict: dictionary operations (get, set, keys, values, merge)
- list: list operations (concat, find, sort, slice, filter)
- logic: boolean logic (and, or, xor, equals, comparisons)
- math: arithmetic operations (add, subtract, multiply, power, etc.)
- string: string manipulation (concat, split, replace, format)
- notifications: Slack, Discord integrations
- test: assertion helpers and test suite runner
- tools: file operations, git, docker, testing utilities
- utils: filtering, mapping, reducing, condition branching
- var: variable store operations (get, set, delete, exists)
- web: Flask server, environment variables, JSON handling
Add language executor runtimes:
- TypeScript: direct import execution (default, fast startup)
- Python: child process with JSON stdin/stdout communication
- C++: placeholder for native FFI bindings (Phase 3)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1
workflow/plugins/python/math/__init__.py
Normal file
1
workflow/plugins/python/math/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Mathematical operations plugins."""
|
||||
7
workflow/plugins/python/math/math_abs.py
Normal file
7
workflow/plugins/python/math/math_abs.py
Normal file
@@ -0,0 +1,7 @@
|
||||
"""Workflow plugin: absolute value."""
|
||||
|
||||
|
||||
def run(_runtime, inputs):
|
||||
"""Calculate absolute value."""
|
||||
value = inputs.get("value", 0)
|
||||
return {"result": abs(value)}
|
||||
7
workflow/plugins/python/math/math_add.py
Normal file
7
workflow/plugins/python/math/math_add.py
Normal file
@@ -0,0 +1,7 @@
|
||||
"""Workflow plugin: add numbers."""
|
||||
|
||||
|
||||
def run(_runtime, inputs):
|
||||
"""Add two or more numbers."""
|
||||
numbers = inputs.get("numbers", [])
|
||||
return {"result": sum(numbers)}
|
||||
12
workflow/plugins/python/math/math_divide.py
Normal file
12
workflow/plugins/python/math/math_divide.py
Normal file
@@ -0,0 +1,12 @@
|
||||
"""Workflow plugin: divide numbers."""
|
||||
|
||||
|
||||
def run(_runtime, inputs):
|
||||
"""Divide a by b."""
|
||||
a = inputs.get("a", 0)
|
||||
b = inputs.get("b", 1)
|
||||
|
||||
if b == 0:
|
||||
return {"result": None, "error": "Division by zero"}
|
||||
|
||||
return {"result": a / b}
|
||||
11
workflow/plugins/python/math/math_max.py
Normal file
11
workflow/plugins/python/math/math_max.py
Normal file
@@ -0,0 +1,11 @@
|
||||
"""Workflow plugin: maximum value."""
|
||||
|
||||
|
||||
def run(_runtime, inputs):
|
||||
"""Find maximum value in numbers."""
|
||||
numbers = inputs.get("numbers", [])
|
||||
|
||||
if not numbers:
|
||||
return {"result": None}
|
||||
|
||||
return {"result": max(numbers)}
|
||||
11
workflow/plugins/python/math/math_min.py
Normal file
11
workflow/plugins/python/math/math_min.py
Normal file
@@ -0,0 +1,11 @@
|
||||
"""Workflow plugin: minimum value."""
|
||||
|
||||
|
||||
def run(_runtime, inputs):
|
||||
"""Find minimum value in numbers."""
|
||||
numbers = inputs.get("numbers", [])
|
||||
|
||||
if not numbers:
|
||||
return {"result": None}
|
||||
|
||||
return {"result": min(numbers)}
|
||||
12
workflow/plugins/python/math/math_modulo.py
Normal file
12
workflow/plugins/python/math/math_modulo.py
Normal file
@@ -0,0 +1,12 @@
|
||||
"""Workflow plugin: modulo operation."""
|
||||
|
||||
|
||||
def run(_runtime, inputs):
|
||||
"""Calculate a modulo b."""
|
||||
a = inputs.get("a", 0)
|
||||
b = inputs.get("b", 1)
|
||||
|
||||
if b == 0:
|
||||
return {"result": None, "error": "Modulo by zero"}
|
||||
|
||||
return {"result": a % b}
|
||||
10
workflow/plugins/python/math/math_multiply.py
Normal file
10
workflow/plugins/python/math/math_multiply.py
Normal file
@@ -0,0 +1,10 @@
|
||||
"""Workflow plugin: multiply numbers."""
|
||||
|
||||
|
||||
def run(_runtime, inputs):
|
||||
"""Multiply two or more numbers."""
|
||||
numbers = inputs.get("numbers", [])
|
||||
result = 1
|
||||
for num in numbers:
|
||||
result *= num
|
||||
return {"result": result}
|
||||
8
workflow/plugins/python/math/math_power.py
Normal file
8
workflow/plugins/python/math/math_power.py
Normal file
@@ -0,0 +1,8 @@
|
||||
"""Workflow plugin: power operation."""
|
||||
|
||||
|
||||
def run(_runtime, inputs):
|
||||
"""Calculate a to the power of b."""
|
||||
a = inputs.get("a", 0)
|
||||
b = inputs.get("b", 1)
|
||||
return {"result": a ** b}
|
||||
8
workflow/plugins/python/math/math_round.py
Normal file
8
workflow/plugins/python/math/math_round.py
Normal file
@@ -0,0 +1,8 @@
|
||||
"""Workflow plugin: round number."""
|
||||
|
||||
|
||||
def run(_runtime, inputs):
|
||||
"""Round number to specified precision."""
|
||||
value = inputs.get("value", 0)
|
||||
precision = inputs.get("precision", 0)
|
||||
return {"result": round(value, precision)}
|
||||
8
workflow/plugins/python/math/math_subtract.py
Normal file
8
workflow/plugins/python/math/math_subtract.py
Normal file
@@ -0,0 +1,8 @@
|
||||
"""Workflow plugin: subtract numbers."""
|
||||
|
||||
|
||||
def run(_runtime, inputs):
|
||||
"""Subtract b from a."""
|
||||
a = inputs.get("a", 0)
|
||||
b = inputs.get("b", 0)
|
||||
return {"result": a - b}
|
||||
Reference in New Issue
Block a user