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 @@
"""List manipulation plugins."""

View File

@@ -0,0 +1,11 @@
"""Workflow plugin: concatenate lists."""
def run(_runtime, inputs):
"""Concatenate multiple lists."""
lists = inputs.get("lists", [])
result = []
for lst in lists:
if isinstance(lst, list):
result.extend(lst)
return {"result": result}

View File

@@ -0,0 +1,18 @@
"""Workflow plugin: check if all items match condition."""
def run(_runtime, inputs):
"""Check if all items match condition."""
items = inputs.get("items", [])
key = inputs.get("key")
value = inputs.get("value")
if not items:
return {"result": True}
if key is not None and value is not None:
result = all(isinstance(item, dict) and item.get(key) == value for item in items)
else:
result = all(items)
return {"result": result}

View File

@@ -0,0 +1,14 @@
"""Workflow plugin: find item in list."""
def run(_runtime, inputs):
"""Find first item matching condition."""
items = inputs.get("items", [])
key = inputs.get("key")
value = inputs.get("value")
for item in items:
if isinstance(item, dict) and item.get(key) == value:
return {"result": item, "found": True}
return {"result": None, "found": False}

View File

@@ -0,0 +1,7 @@
"""Workflow plugin: get list length."""
def run(_runtime, inputs):
"""Get length of a list or string."""
items = inputs.get("items", [])
return {"result": len(items) if items is not None else 0}

View File

@@ -0,0 +1,15 @@
"""Workflow plugin: slice a list."""
def run(_runtime, inputs):
"""Extract slice from list."""
items = inputs.get("items", [])
start = inputs.get("start", 0)
end = inputs.get("end")
if end is None:
result = items[start:]
else:
result = items[start:end]
return {"result": result}

View File

@@ -0,0 +1,15 @@
"""Workflow plugin: check if some items match condition."""
def run(_runtime, inputs):
"""Check if at least one item matches condition."""
items = inputs.get("items", [])
key = inputs.get("key")
value = inputs.get("value")
if key is not None and value is not None:
result = any(isinstance(item, dict) and item.get(key) == value for item in items)
else:
result = any(items)
return {"result": result}

View File

@@ -0,0 +1,17 @@
"""Workflow plugin: sort a list."""
def run(_runtime, inputs):
"""Sort list by key or naturally."""
items = inputs.get("items", [])
key = inputs.get("key")
reverse = inputs.get("reverse", False)
try:
if key:
result = sorted(items, key=lambda x: x.get(key) if isinstance(x, dict) else x, reverse=reverse)
else:
result = sorted(items, reverse=reverse)
return {"result": result}
except (TypeError, AttributeError):
return {"result": items, "error": "Cannot sort items"}