diff --git a/pyproject.toml b/pyproject.toml index 315b80c..12f952f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "agent-task-queue" -version = "0.3.1" +version = "0.3.2" description = "MCP server for sequential task execution via FIFO queue" readme = "README.md" requires-python = ">=3.10" diff --git a/task_queue.py b/task_queue.py index 826b096..f5003cb 100644 --- a/task_queue.py +++ b/task_queue.py @@ -231,7 +231,7 @@ def get_memory_mb() -> float: # --- Core Queue Logic --- -async def wait_for_turn(queue_name: str) -> int: +async def wait_for_turn(queue_name: str, command: str | None = None) -> int: """Register task, wait for turn, return task ID when acquired.""" # Ensure database exists and is valid ensure_db() @@ -250,8 +250,8 @@ async def wait_for_turn(queue_name: str) -> int: with get_db() as conn: cursor = conn.execute( - "INSERT INTO queue (queue_name, status, pid, server_id) VALUES (?, ?, ?, ?)", - (queue_name, "waiting", my_pid, SERVER_INSTANCE_ID), + "INSERT INTO queue (queue_name, status, pid, server_id, command) VALUES (?, ?, ?, ?, ?)", + (queue_name, "waiting", my_pid, SERVER_INSTANCE_ID, command), ) task_id = cursor.lastrowid @@ -440,7 +440,7 @@ async def run_task( key, value = pair.split("=", 1) env[key.strip()] = value.strip() - task_id = await wait_for_turn(queue_name) + task_id = await wait_for_turn(queue_name, command) mem_before = get_memory_mb() start = time.time()