Module: Insika::Server::A2A::TaskProjection
- Defined in:
- lib/insika/server/a2a/task_projection.rb
Overview
Task (core) -> A2A Task projection. PURE.
Constant Summary collapse
- STATE =
State map. Unknown state -> "unknown".
{ queued: "submitted", running: "working", waiting: "input-required", paused: "working", completed: "completed", failed: "failed", cancelled: "canceled" }.freeze
Class Method Summary collapse
-
.call(task, at:, content: nil, error: nil) ⇒ Object
task (TaskStore::Task) + content/error (String|nil) + at (ISO8601) -> Hash A2A Task.
Class Method Details
.call(task, at:, content: nil, error: nil) ⇒ Object
task (TaskStore::Task) + content/error (String|nil) + at (ISO8601) -> Hash A2A Task.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/insika/server/a2a/task_projection.rb', line 17 def self.call(task, at:, content: nil, error: nil) state = STATE.fetch(task.status.to_sym, "unknown") status = { state: state, timestamp: at } msg = (state, content, error) status[:message] = msg if msg { id: task.id, contextId: task.session_id, kind: "task", status: status, artifacts: [], history: [] } end |