Class: Rubino::API::Operations::Tasks::IndexOperation

Inherits:
Object
  • Object
show all
Defined in:
lib/rubino/api/operations/tasks/index_operation.rb

Overview

GET /v1/tasks Lists background subagents started by the ‘task` tool, newest first. Each row is the summary shape (no full result body — see the show endpoint for that). The registry is process-local and not persisted, so this reflects only the current server process’s children.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(registry: nil) ⇒ IndexOperation

Accepts an alternate registry for tests.



18
19
20
# File 'lib/rubino/api/operations/tasks/index_operation.rb', line 18

def initialize(registry: nil)
  @registry = registry || ::Rubino::Tools::BackgroundTasks.instance
end

Class Method Details

.call(request) ⇒ Object



13
14
15
# File 'lib/rubino/api/operations/tasks/index_operation.rb', line 13

def self.call(request)
  new.call(request)
end

Instance Method Details

#call(_request) ⇒ Object



22
23
24
25
# File 'lib/rubino/api/operations/tasks/index_operation.rb', line 22

def call(_request)
  tasks = @registry.list.map { |entry| Serializer.summary(entry) }
  [200, { tasks: tasks }]
end