MCPcopy Create free account
hub / github.com/echoVic/blade-code / startTask

Method startTask

src/prompt/WorkflowManager.ts:387–406  ·  view source on GitHub ↗

* 开始任务

(id: string)

Source from the content-addressed store, hash-verified

385 * 开始任务
386 */
387 public startTask(id: string): WorkflowTask {
388 // 检查并发任务限制
389 const inProgressTasks = this.getTasksByStatus('in-progress');
390 if (inProgressTasks.length >= this.config.maxConcurrentTasks) {
391 throw new Error(`已达到最大并发任务数限制: ${this.config.maxConcurrentTasks}`);
392 }
393
394 const task = this.getTask(id);
395 if (!task) {
396 throw new Error(`任务不存在: ${id}`);
397 }
398
399 // 检查依赖
400 const executableTasks = this.getExecutableTasks();
401 if (!executableTasks.find(t => t.id === id)) {
402 throw new Error(`任务有未完成的依赖,无法开始: ${id}`);
403 }
404
405 return this.updateTask(id, { status: 'in-progress' });
406 }
407
408 /**
409 * 完成任务

Callers

nothing calls this directly

Calls 4

getTasksByStatusMethod · 0.95
getTaskMethod · 0.95
getExecutableTasksMethod · 0.95
updateTaskMethod · 0.95

Tested by

no test coverage detected