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

@@ -1,20 +1,19 @@
"""Workflow plugin: start bot execution in background thread."""
import os
import subprocess
import sys
import threading
import time
from .control_get_bot_status import (
from ...base import NodeExecutor
from ..control_get_bot_status.control_get_bot_status import (
get_bot_state,
reset_bot_state,
_bot_process,
_mock_running,
_current_run_config
)
# Import global state
import workflow.plugins.python.control.control_get_bot_status as bot_status
import workflow.plugins.python.control.control_get_bot_status.control_get_bot_status as bot_status
def _run_bot_task(mode: str, iterations: int, yolo: bool, stop_at_mvp: bool) -> None:
@@ -61,37 +60,44 @@ def _run_bot_task(mode: str, iterations: int, yolo: bool, stop_at_mvp: bool) ->
reset_bot_state()
def run(_runtime, inputs):
"""Start bot execution in background thread.
class ControlStartBot(NodeExecutor):
"""Start bot execution in background thread."""
Args:
inputs: Dictionary with keys:
- mode: str (default: "once") - Execution mode ("once", "iterations", etc.)
- iterations: int (default: 1) - Number of iterations for "iterations" mode
- yolo: bool (default: True) - Run in YOLO mode
- stop_at_mvp: bool (default: False) - Stop when MVP is reached
node_type = "control.start_bot"
category = "control"
description = "Start bot execution in background thread"
Returns:
Dictionary with:
- started: bool - Whether the bot was started successfully
- error: str (optional) - Error message if bot is already running
"""
mode = inputs.get("mode", "once")
iterations = inputs.get("iterations", 1)
yolo = inputs.get("yolo", True)
stop_at_mvp = inputs.get("stop_at_mvp", False)
def execute(self, inputs, runtime=None):
"""Start bot execution in background thread.
# Check if bot is already running
state = get_bot_state()
if state["is_running"]:
return {"started": False, "error": "Bot already running"}
Args:
inputs: Dictionary with keys:
- mode: str (default: "once") - Execution mode ("once", "iterations", etc.)
- iterations: int (default: 1) - Number of iterations for "iterations" mode
- yolo: bool (default: True) - Run in YOLO mode
- stop_at_mvp: bool (default: False) - Stop when MVP is reached
# Start bot in background thread
thread = threading.Thread(
target=_run_bot_task,
args=(mode, iterations, yolo, stop_at_mvp),
daemon=True
)
thread.start()
Returns:
Dictionary with:
- started: bool - Whether the bot was started successfully
- error: str (optional) - Error message if bot is already running
"""
mode = inputs.get("mode", "once")
iterations = inputs.get("iterations", 1)
yolo = inputs.get("yolo", True)
stop_at_mvp = inputs.get("stop_at_mvp", False)
return {"started": True}
# Check if bot is already running
state = get_bot_state()
if state["is_running"]:
return {"started": False, "error": "Bot already running"}
# Start bot in background thread
thread = threading.Thread(
target=_run_bot_task,
args=(mode, iterations, yolo, stop_at_mvp),
daemon=True
)
thread.start()
return {"started": True}

View File

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

View File

@@ -1,13 +1,16 @@
{
"name": "@metabuilder/control_start_bot",
"version": "1.0.0",
"description": "control_start_bot plugin",
"description": "Start bot execution in background thread",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["control", "workflow", "plugin"],
"main": "control_start_bot.py",
"files": ["control_start_bot.py", "factory.py"],
"metadata": {
"plugin_type": "control.start_bot",
"category": "control"
"category": "control",
"class": "ControlStartBot",
"entrypoint": "execute"
}
}