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:
2026-01-21 16:08:08 +00:00
parent c760bd7cd0
commit 5ac579a2ed
171 changed files with 2188 additions and 1565 deletions

View File

@@ -0,0 +1 @@
"""Type conversion plugins."""

View File

@@ -0,0 +1,13 @@
"""Workflow plugin: parse JSON string."""
import json
def run(_runtime, inputs):
"""Parse JSON string to object."""
text = inputs.get("text", "")
try:
result = json.loads(text)
return {"result": result}
except json.JSONDecodeError as e:
return {"result": None, "error": str(e)}

View File

@@ -0,0 +1,11 @@
"""Workflow plugin: convert to boolean."""
def run(_runtime, inputs):
"""Convert value to boolean."""
value = inputs.get("value")
if isinstance(value, str):
return {"result": value.lower() not in ("false", "0", "", "none", "null")}
return {"result": bool(value)}

View File

@@ -0,0 +1,17 @@
"""Workflow plugin: convert to dictionary."""
def run(_runtime, inputs):
"""Convert value to dictionary."""
value = inputs.get("value")
if isinstance(value, dict):
return {"result": value}
elif isinstance(value, list):
# Convert list of [key, value] pairs to dict
try:
return {"result": dict(value)}
except (TypeError, ValueError):
return {"result": {}, "error": "Cannot convert list to dict"}
else:
return {"result": {}}

View File

@@ -0,0 +1,14 @@
"""Workflow plugin: convert to JSON string."""
import json
def run(_runtime, inputs):
"""Convert value to JSON string."""
value = inputs.get("value")
indent = inputs.get("indent")
try:
result = json.dumps(value, indent=indent)
return {"result": result}
except (TypeError, ValueError) as e:
return {"result": None, "error": str(e)}

View File

@@ -0,0 +1,17 @@
"""Workflow plugin: convert to list."""
def run(_runtime, inputs):
"""Convert value to list."""
value = inputs.get("value")
if isinstance(value, list):
return {"result": value}
elif isinstance(value, (tuple, set)):
return {"result": list(value)}
elif isinstance(value, dict):
return {"result": list(value.items())}
elif value is None:
return {"result": []}
else:
return {"result": [value]}

View File

@@ -0,0 +1,14 @@
"""Workflow plugin: convert to number."""
def run(_runtime, inputs):
"""Convert value to number."""
value = inputs.get("value")
default = inputs.get("default", 0)
try:
if isinstance(value, str) and "." in value:
return {"result": float(value)}
return {"result": int(value)}
except (ValueError, TypeError):
return {"result": default, "error": "Cannot convert to number"}

View File

@@ -0,0 +1,7 @@
"""Workflow plugin: convert to string."""
def run(_runtime, inputs):
"""Convert value to string."""
value = inputs.get("value")
return {"result": str(value) if value is not None else ""}