Repository navigation
Adding agent session, streaming chunk and task/plan block support - #262
Merged
Merged
Conversation
Owner
|
Thanks @we4sz, looks solid. Will get a release out later this week with these changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Slack's newer agent features (sessions with a status and a Stop button, streamed task and plan updates, task and plan blocks) have no SlackNet support yet. This adds it in four commits. Each one builds and passes the tests.
TaskCardBlock,PlanBlockandUrlSourceElement: thetask_cardandplanblocks, and the sources a task can cite.AgentsSessionsApi.SetStatusforagents.sessions.setStatus, exposed asISlackApiClient.AgentsSessions, withAgentSessionStatusandAgentSessionStatusResponse.AgentSessionStoppedevent (agent_session_stopped), which Slack sends when a user presses the Stop button.ChatApi.StartStream,AppendStreamandStopStream:chunks(StreamChunk: markdown text, task update, plan update, blocks),taskDisplayMode,sessionStatus, and theiconEmoji,iconUrlandusernameoverrides on start.AppendStream'smarkdownTextis optional now, since a chunk stream has none.Compatibility
Nothing changes meaning. The new parameters are optional and sit before
cancellationToken, so existing code compiles unchanged. A caller built against an older SlackNet binary has to be rebuilt.Testing
The unit tests follow the existing patterns: request bodies, JSON round trips, event deserialization, and
ApiLintTestsandBlockLintTestsextended for the new types. One existing test,UtilsTests.ToDateTime_FromTimestampString_ValidTimestamp_ReturnsDateTime, fails on an untouched v0.18.0 here, before and after these changes.I also ran the changes against a real Slack app in a real workspace:
task_display_modevalues andsession_status; sources, icons andhide_title; and thestreaming_mode_mismatcherror.planandtask_cardmessages. They render, and Slack's read-back returns the same block types.agents.sessions.setStatus: request and response against an app in agent mode,processingthenactive. The response is{ok, status, agent_status, title}, whichAgentSessionStatusResponsematches. Before the app was declared an agent, the same call answerednot_authorized. The call needs only thechat:writescope.processingand the app was subscribed toagent_session_stopped, Slack showed its native Stop button, and a user pressed it.Not verified: the payload of
agent_session_stopped. I couldn't capture the event in my test setup, soAgentSessionStoppedfollows the documentation only.What the documentation doesn't say
Found while testing:
markdown_textchunk is sent with the keytext. Slack rejectsmarkdown_textas the key.planblock andtask_cardblocks (invalid_blocks).blocks.validateaccepts such a message.pendingis accepted for tasks in a plan block and in streamed task updates. A standalonetask_cardrejects it.iconis the name of one of a fixed list of icons, not a URL, so it is a string here.agents.sessions.setStatusstored my title with the:replaced by_("Dispatch probe: agent session status" came back as "Dispatch probe_ agent session status"). The title is only applied when the session is created, as documented.