| 337 | } |
| 338 | |
| 339 | func NewTaskWaitTool() coretools.Tool { |
| 340 | return newTaskTool("TaskWait", "Block without busy-polling until all specified direct child tasks reach a stable state, or until timeout_seconds elapses.", TaskWaitInput{}, func(ctx context.Context, execCtx coretools.ExecutionContext, input any) (string, error) { |
| 341 | rt, scope, err := runtimeAndScope(execCtx) |
| 342 | if err != "" { |
| 343 | return err, nil |
| 344 | } |
| 345 | in := derefTaskWait(input) |
| 346 | return jsonString(serializeTaskResult(rt.WaitForTasks(ctx, in.TaskIDs, scope, in.TimeoutSecond))), nil |
| 347 | }) |
| 348 | } |
| 349 | |
| 350 | func NewTaskStopTool() coretools.Tool { |
| 351 | return newTaskTool("TaskStop", "Stop one direct child task. Queued workers are killed immediately; running workers are cancelled and converge to killed.", TaskStopInput{}, func(_ context.Context, execCtx coretools.ExecutionContext, input any) (string, error) { |