openai 0.115.0 → 0.116.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -159,11 +159,14 @@ session's connection; collection overflow leaves raw events and other lanes usab
159
159
 
160
160
  `OpenAI::Responses::IncrementalResponse` builds provisional output from events
161
161
  you feed it. Use a separate instance for each lane. It does not read, close, or
162
- write to the connection. Tools remain data. Its `output` may be unavailable
163
- if the events do not contain enough information; its admitted terminal event
162
+ write to the connection. Tools remain data. Its typed `output` is a truthful provisional prefix; its admitted terminal event
164
163
  stays exact, including an absent output field. Call `reset` to discard only
165
164
  the preview's state.
166
165
 
166
+ MCP call argument deltas update an observed MCP call item. The arguments-done
167
+ event replaces its provisional arguments. These updates preserve the item's
168
+ other fields and do not execute the tool.
169
+
167
170
  Session limits govern the session's queues and final-response collector.
168
171
  They do not bound a separate `IncrementalResponse`. Choose a finite budget
169
172
  for the encoded events that you feed to each preview and a finite lifetime.
@@ -171,6 +174,41 @@ Check the complete event before every `add`, including unknowns, errors, and
171
174
  terminal events. Stop feeding when an event would exceed the budget. Never
172
175
  report a completed preview for a terminal event that you did not admit.
173
176
 
177
+ `output` returns a detached typed prefix during provisional progress. Sparse or
178
+ incomplete records stop that prefix; higher wire indices never shift into lower
179
+ positions. Use `detailed_snapshot` for sparse facts and response metadata:
180
+
181
+ ```ruby
182
+ preview.add(event)
183
+ facts = preview.detailed_snapshot
184
+ facts&.fetch(:output)&.each do |row|
185
+ puts [row.fetch(:output_index), row.fetch(:item)].inspect
186
+ end
187
+ ```
188
+
189
+ The detailed Hash uses symbol keys and JSON values. Its `response` excludes the
190
+ separately indexed output, while `stream_id`, `response_id`, `terminal_type` and
191
+ `phase` describe the observations. Output rows retain actual `output_index`
192
+ values. Nested `content`, `summary`, `commands` and annotation rows retain their
193
+ actual indices. `output_text` joins only observed message text in wire-index
194
+ order; it excludes reasoning and refusals. Missing item or part types stay missing; this view is not a
195
+ complete `Response`. Unknown fields and absent, null and empty metadata remain
196
+ distinct. A null annotation stays at its detailed index and stops the typed
197
+ annotation prefix. The view is `nil` before observations and when the preview is
198
+ unavailable. Terminal views use only the supplied terminal event, and typed
199
+ `output` remains `nil` after a terminal.
200
+
201
+ Shell output needs separate views. The item's `output` stays the last supplied
202
+ full-item flat array. Detailed `content` rows use `command_index`: they contain
203
+ observed stdout/stderr, or `{output: [...]}` after done. That array preserves all
204
+ chunks for that one command, including an empty array. It does not imply a flat
205
+ position, a missing exit code or an outcome. A later full item or terminal
206
+ replaces provisional command facts. A missing companion call leaves command
207
+ bounds unknown.
208
+
209
+ Both views copy their results; the detailed view also sorts observed indices.
210
+ Use raw deltas for per-event progress and take snapshots at useful boundaries.
211
+
174
212
  The runnable [preview example](examples/responses/websocket_workflows.rb)
175
213
  sets a decoded per-message cap, uses the session's separate limits, and applies
176
214
  a 4 MiB cumulative preview budget with a 15-second lifetime:
@@ -5,6 +5,7 @@ module OpenAI
5
5
  attr_reader phase: (:provisional | :unavailable | :terminal)?
6
6
  def initialize: -> void
7
7
  def output: -> Array[(response_output_item | Hash[Symbol, untyped])]?
8
+ def detailed_snapshot: -> Hash[Symbol, untyped]?
8
9
  def terminal_event: -> connection_server_event?
9
10
  def add: (connection_server_event event) -> void
10
11
  def reset: -> void