class RubyLLM::AgUI::Reservation

The answer to a run reservation: the record that owns the identity, and how the reservation was obtained.

A retried request whose input digest matches an existing reservation gets ATTACHED, so the host streams or reports the run already in progress instead of executing it a second time.

Constants

ATTACHED

The identity was already claimed by an identical request.

CREATED

The identity was free and is now claimed by this call.

Attributes

record[R]

The record that owns the run identity.

status[R]

:created or :attached.

Public Class Methods

new(record:, status:) click to toggle source
# File lib/ruby_llm/ag_ui/reservation.rb, line 23
def initialize(record:, status:)
  @record = record
  @status = status
  freeze
end

Public Instance Methods

attached?() click to toggle source

Whether the identity was already claimed by an identical request.

# File lib/ruby_llm/ag_ui/reservation.rb, line 35
def attached?
  status == ATTACHED
end
created?() click to toggle source

Whether this call claimed the identity.

# File lib/ruby_llm/ag_ui/reservation.rb, line 30
def created?
  status == CREATED
end
digest() click to toggle source
# File lib/ruby_llm/ag_ui/reservation.rb, line 47
def digest
  record.digest
end
run_id() click to toggle source
# File lib/ruby_llm/ag_ui/reservation.rb, line 43
def run_id
  record.run_id
end
thread_id() click to toggle source
# File lib/ruby_llm/ag_ui/reservation.rb, line 39
def thread_id
  record.thread_id
end
to_h() click to toggle source
# File lib/ruby_llm/ag_ui/reservation.rb, line 51
def to_h
  { 'status' => status.to_s, 'threadId' => thread_id, 'runId' => run_id, 'digest' => digest }
end