()
| 58 | } |
| 59 | |
| 60 | func (t *TaskTool) InputSchema() map[string]any { |
| 61 | return map[string]any{ |
| 62 | "type": "object", |
| 63 | "properties": map[string]any{ |
| 64 | "action": map[string]any{ |
| 65 | "type": "string", |
| 66 | "description": "操作类型:run(启动任务)、status(查询状态)、list(列出任务)、cancel(取消任务)", |
| 67 | "enum": []string{"run", "status", "list", "cancel"}, |
| 68 | "default": "run", |
| 69 | }, |
| 70 | "task_id": map[string]any{ |
| 71 | "type": "string", |
| 72 | "description": "任务 ID(用于 status/cancel 操作)", |
| 73 | }, |
| 74 | "description": map[string]any{ |
| 75 | "type": "string", |
| 76 | "description": "任务的简短描述(3-5个词),概括任务目的", |
| 77 | }, |
| 78 | "subagent_type": map[string]any{ |
| 79 | "type": "string", |
| 80 | "description": "要启动的代理类型(用于 run 操作)", |
| 81 | "enum": []string{"general-purpose", "Explore", "Plan"}, |
| 82 | }, |
| 83 | "prompt": map[string]any{ |
| 84 | "type": "string", |
| 85 | "description": "要代理执行的任务描述,必须是详细的(用于 run 操作)", |
| 86 | }, |
| 87 | "model": map[string]any{ |
| 88 | "type": "string", |
| 89 | "description": "可选模型,如果未指定则继承自父级", |
| 90 | }, |
| 91 | "timeout_minutes": map[string]any{ |
| 92 | "type": "integer", |
| 93 | "description": "任务超时时间(分钟),默认为30", |
| 94 | }, |
| 95 | "async": map[string]any{ |
| 96 | "type": "boolean", |
| 97 | "description": "是否异步执行,默认为true", |
| 98 | }, |
| 99 | }, |
| 100 | "required": []string{}, |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | func (t *TaskTool) Execute(ctx context.Context, input map[string]any, tc *tools.ToolContext) (any, error) { |
| 105 | action := GetStringParam(input, "action", "run") |
no outgoing calls