#!/bin/bash # 验证 API 是否返回 input/output TASK_ID=$(curl -s http://localhost:3000/api/tasks | python3 -c " import sys, json data = json.load(sys.stdin) tasks = data.get('tasks', []) if tasks: print(tasks[0]['id']) else: print('NO_TASKS') " 2>/dev/null) echo "Task ID: $TASK_ID" if [ "$TASK_ID" = "NO_TASKS" ]; then echo "No tasks found" exit 0 fi curl -s "http://localhost:3000/api/tasks/$TASK_ID/executions" | python3 -c " import sys, json data = json.load(sys.stdin) if isinstance(data, dict) and 'error' in data: print('API ERROR:', data['error']) sys.exit(1) print(f'Executions count: {len(data)}') for i, ex in enumerate(data): print(f'--- execution {i} ---') print(f' id: {ex.get(\"id\")}') print(f' agent: {ex.get(\"agent_name\")}') print(f' status: {ex.get(\"status\")}') has_input = bool(ex.get('input')) has_output = bool(ex.get('output')) print(f' has input: {has_input} ({len(ex.get(\"input\", \"\"))} chars)') print(f' has output: {has_output} ({len(ex.get(\"output\", \"\"))} chars)') print(f' acpEvents: {len(ex.get(\"acpEvents\", []))}') print(f' keys: {list(ex.keys())}') "