Module: RobotLab::Streaming::Events

Defined in:
lib/robot_lab/streaming/events.rb

Overview

Event type definitions for streaming

Defines the structure and types of events emitted during robot and network execution.

Constant Summary collapse

RUN_STARTED =

Run lifecycle events

"run.started"
RUN_COMPLETED =
"run.completed"
RUN_FAILED =
"run.failed"
RUN_INTERRUPTED =
"run.interrupted"
STEP_STARTED =

Step events (for durable execution)

"step.started"
STEP_COMPLETED =
"step.completed"
STEP_FAILED =
"step.failed"
PART_CREATED =

Part events (message composition)

"part.created"
PART_COMPLETED =
"part.completed"
PART_FAILED =
"part.failed"
TEXT_DELTA =

Content delta events (token streaming)

"text.delta"
TOOL_CALL_ARGUMENTS_DELTA =
"tool_call.arguments.delta"
TOOL_CALL_OUTPUT_DELTA =
"tool_call.output.delta"
REASONING_DELTA =
"reasoning.delta"
DATA_DELTA =
"data.delta"
HITL_REQUESTED =

Human-in-the-loop events

"hitl.requested"
HITL_RESOLVED =
"hitl.resolved"
USAGE_UPDATED =

Metadata events

"usage.updated"
METADATA_UPDATED =
"metadata.updated"
STREAM_ENDED =

Terminal event

"stream.ended"
ALL_EVENTS =

All event types

[
  RUN_STARTED, RUN_COMPLETED, RUN_FAILED, RUN_INTERRUPTED,
  STEP_STARTED, STEP_COMPLETED, STEP_FAILED,
  PART_CREATED, PART_COMPLETED, PART_FAILED,
  TEXT_DELTA, TOOL_CALL_ARGUMENTS_DELTA, TOOL_CALL_OUTPUT_DELTA,
  REASONING_DELTA, DATA_DELTA,
  HITL_REQUESTED, HITL_RESOLVED,
  USAGE_UPDATED, METADATA_UPDATED,
  STREAM_ENDED
].freeze
LIFECYCLE_EVENTS =

Lifecycle events

[
  RUN_STARTED, RUN_COMPLETED, RUN_FAILED, RUN_INTERRUPTED
].freeze
DELTA_EVENTS =

Delta events (content streaming)

[
  TEXT_DELTA, TOOL_CALL_ARGUMENTS_DELTA, TOOL_CALL_OUTPUT_DELTA,
  REASONING_DELTA, DATA_DELTA
].freeze

Class Method Summary collapse

Class Method Details

.delta?(event) ⇒ Boolean

Checks if the event is a delta (content streaming) event.

Parameters:

  • event (String)

    the event type

Returns:

  • (Boolean)


81
82
83
# File 'lib/robot_lab/streaming/events.rb', line 81

def delta?(event)
  DELTA_EVENTS.include?(event)
end

.lifecycle?(event) ⇒ Boolean

Checks if the event is a lifecycle event.

Parameters:

  • event (String)

    the event type

Returns:

  • (Boolean)


73
74
75
# File 'lib/robot_lab/streaming/events.rb', line 73

def lifecycle?(event)
  LIFECYCLE_EVENTS.include?(event)
end

.valid?(event) ⇒ Boolean

Checks if the event is a valid event type.

Parameters:

  • event (String)

    the event type

Returns:

  • (Boolean)


89
90
91
# File 'lib/robot_lab/streaming/events.rb', line 89

def valid?(event)
  ALL_EVENTS.include?(event)
end