Skip to content

Commit 599ee18

Browse files
zimegClaude
andcommitted
feat(web-api): thread session_status through chat_stream stop() helpers
Forward the session_status arg added to chat.stopStream through the sync and async chat_stream stop() convenience helpers, with docstring entries and forwarding assertions in the helper tests. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
1 parent 2b046cf commit 599ee18

4 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎slack_sdk/web/async_chat_stream.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ async def stop(
158158
chunks: Optional[Sequence[Union[Dict, Chunk]]] = None,
159159
blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None,
160160
metadata: Optional[Union[Dict, Metadata]] = None,
161+
session_status: Optional[str] = None,
161162
**kwargs,
162163
) -> AsyncSlackResponse:
163164
"""Stop the stream and finalize the message.
@@ -169,6 +170,7 @@ async def stop(
169170
what will be appended to the message received so far.
170171
metadata: JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you
171172
post to Slack is accessible to any app or user who is a member of that workspace.
173+
session_status: The status of the agent session associated with this stream.
172174
**kwargs: Additional arguments passed to the underlying API calls.
173175
174176
Returns:
@@ -217,6 +219,7 @@ async def stop(
217219
blocks=blocks,
218220
chunks=flushings,
219221
metadata=metadata,
222+
session_status=session_status,
220223
**kwargs,
221224
)
222225
self._state = "completed"

‎slack_sdk/web/chat_stream.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ def stop(
148148
chunks: Optional[Sequence[Union[Dict, Chunk]]] = None,
149149
blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None,
150150
metadata: Optional[Union[Dict, Metadata]] = None,
151+
session_status: Optional[str] = None,
151152
**kwargs,
152153
) -> SlackResponse:
153154
"""Stop the stream and finalize the message.
@@ -159,6 +160,7 @@ def stop(
159160
what will be appended to the message received so far.
160161
metadata: JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you
161162
post to Slack is accessible to any app or user who is a member of that workspace.
163+
session_status: The status of the agent session associated with this stream.
162164
**kwargs: Additional arguments passed to the underlying API calls.
163165
164166
Returns:
@@ -207,6 +209,7 @@ def stop(
207209
blocks=blocks,
208210
chunks=flushings,
209211
metadata=metadata,
212+
session_status=session_status,
210213
**kwargs,
211214
)
212215
self._state = "completed"

‎tests/slack_sdk/web/test_chat_stream.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def test_streams_a_long_message(self):
139139
)
140140
],
141141
markdown_text="*",
142+
session_status="processing",
142143
token="xoxb-chat_stream_test_token2",
143144
)
144145

@@ -176,6 +177,7 @@ def test_streams_a_long_message(self):
176177
json.dumps(stop_request.get("chunks")),
177178
'[{"text": "**", "type": "markdown_text"}]',
178179
)
180+
self.assertEqual(stop_request.get("session_status"), "processing")
179181
self.assertEqual(stop_request.get("token"), "xoxb-chat_stream_test_token2")
180182
self.assertEqual(stop_request.get("ts"), "123.123")
181183

‎tests/slack_sdk_async/web/test_async_chat_stream.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ async def test_streams_a_long_message(self):
142142
)
143143
],
144144
markdown_text="*",
145+
session_status="processing",
145146
token="xoxb-chat_stream_test_token2",
146147
)
147148

@@ -179,6 +180,7 @@ async def test_streams_a_long_message(self):
179180
json.dumps(stop_request.get("chunks")),
180181
'[{"text": "**", "type": "markdown_text"}]',
181182
)
183+
self.assertEqual(stop_request.get("session_status"), "processing")
182184
self.assertEqual(stop_request.get("token"), "xoxb-chat_stream_test_token2")
183185
self.assertEqual(stop_request.get("ts"), "123.123")
184186

0 commit comments

Comments
 (0)