Class: Rubino::Tools::TaskResultTool

Inherits:
Base
  • Object
show all
Defined in:
lib/rubino/tools/task_result_tool.rb

Overview

Reads the status and result of a background subagent started by ‘task` (the default background path). The BashOutput / TaskOutput analogue: lets the model poll a background subagent deterministically even if it hasn’t yet received the auto-injected ‘[background-task] … completed` notice.

Returns ‘running` (still working), `completed` (with the full final result — not the truncated notice), or `failed` (with the error). With no `task_id` it lists every tracked background subagent (the /tasks analogue).

Instance Attribute Summary

Attributes inherited from Base

#cancel_token, #read_tracker, #stream_chunk

Instance Method Summary collapse

Methods inherited from Base

#cancellation_requested?, #emit_chunk, #risky?, #to_tool_definition, workspace_root, workspace_roots

Instance Method Details

#call(arguments) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/rubino/tools/task_result_tool.rb', line 47

def call(arguments)
  task_id = (arguments["task_id"] || arguments[:task_id]).to_s.strip
  registry = BackgroundTasks.instance

  return list_all(registry) if task_id.empty?

  entry = registry.find(task_id)
  return "Error: no background subagent with task_id=#{task_id}" unless entry

  render(entry)
end

#config_keyObject

Shares the ‘task` config gate — disabling delegation disables its companion poll/stop tools too.



20
21
22
# File 'lib/rubino/tools/task_result_tool.rb', line 20

def config_key
  "task"
end

#descriptionObject



24
25
26
27
28
29
# File 'lib/rubino/tools/task_result_tool.rb', line 24

def description
  "Fetch the status and result of a background subagent started by `task`. " \
    "Returns `running` (still working), `completed` (with the full final " \
    "result), or `failed` (with the error). Call without a task_id to list " \
    "all tracked background subagents."
end

#input_schemaObject



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rubino/tools/task_result_tool.rb', line 31

def input_schema
  {
    type: "object",
    properties: {
      task_id: {
        type: "string",
        description: "The task id (sa_…) returned by `task`. Omit to list all background subagents."
      }
    }
  }
end

#nameObject



14
15
16
# File 'lib/rubino/tools/task_result_tool.rb', line 14

def name
  "task_result"
end

#risk_levelObject



43
44
45
# File 'lib/rubino/tools/task_result_tool.rb', line 43

def risk_level
  :low
end