Repository navigation
feat(ai-components): agent reply steps (reasoning, tool calls, approvals) - #3924
Merged
Merged
Conversation
2 of 6 tasks
isekovanic
force-pushed
the
feat/ai-reply-steps
branch
from
November 5, 2026 16:57
05db29d to
bc59d36
Compare
Contributor
SDK Size
|
isekovanic
added a commit
that referenced
this pull request
Nov 6, 2026
β¦ll sign-in (#3926) Ticket: https://linear.app/stream/issue/RN-485 Stacked on #3924. ## π― Goal Let a person sign in when an agent's tool needs a connector account (Linear, GitHub, β¦), and give each install a stable id so the router can ask only this device. This needs a small native module, `AIAgent`, which works the same way as Swift's and Android's AI SDKs. ## π Implementation details **Native `AIAgent` TurboModule** (in both wrappers, sources in `shared-native/`) - `installId()` is synchronous and creates an id on first use, then keeps it. - iOS stores `ios-<UUID>` in `UserDefaults`. - Android writes `android-<UUID>` to a file in `noBackupFilesDir`, so a device restored from a backup gets its own id. The file name and format match the Android AI SDK. - `openAuthSession(url, callbackScheme)` resolves with the redirect URL, or `''` when the person closes the sign-in. - iOS uses `ASWebAuthenticationSession`, ported from Swift's `AIWebAuthentication`. It needs no usage description, so it's always compiled; the podspecs only add `AuthenticationServices`. - Android uses an Auth Tab where the app and the browser support it (Chrome 137+). Otherwise it opens a Custom Tab and catches the redirect through the app's scheme in `onNewIntent`. Coming back to the app without a redirect counts as closed. - Auth Tab needs `androidx.browser` 1.9.0, and 1.9.0 needs compileSdk 36 and AGP 8.9.1. Our minimum, RN 0.76, ships with 35. The wrappers' Gradle files check both: - when both are met, the wrappers build with 1.9.0 and the Auth Tab sources; - otherwise they use 1.8.0 and the Custom Tab-only sources. `sync-shared-native.sh` copies both variants over. - No new permission. The manifest adds a `<queries>` entry for Custom Tabs services, which Android 11+ needs in order to find the browser. - The codegen spec is copied into each wrapper, and `validate-entry-isolation` keeps the copies identical. **JS (`ai-components`)** - `AIClientIdentity.installId()` reads the native id. If the module isn't there, it falls back to an id kept in memory. - `createAuthSessionAuthorizer({ callbackScheme, decline })` opens the tool's sign-in at `url#handoff_token=β¦` and reads `status` from the return. "Not now" calls `decline`. - `AIToolAuthorization` and `AIToolAuthorizationCard`, shown under a tool call that's waiting for a sign-in, have these states: - Connect, then Connecting... while the sign-in is open, which stays after a `connected` return until the step changes; - Not now; - connected or not connected; - expired; - didn't complete, or couldn't be opened. - The theme gets a new `messageParts.authorizationCard` section. - New strings are in all 13 locales. As before, `ar` and `he` could use a native speaker's look. **ExpoChatGPTSample** - It sends the install id as the session's `client_id`, and its sessions set a `return_url` on `io.getstream.expochatgptsample://sign-in`. The router only accepts https or reverse-domain schemes there. - `+native-intent.tsx` keeps Expo Router from opening that return URL as a screen. - A reply's row reads its message from the channel's state. The stand-in `MessageList` doesn't re-render a row when only an attachment changes, such as a tool call starting to wait for a sign-in. - It hides the router's duplicate `connector_authorization` attachment. ## π¨ UI Changes The sign-in card under a tool call: Connect / Not now, Connecting..., and its outcomes. ## π§ͺ Testing - Unit tests cover the launch URL, reading the return, the authorizer, and the card's states. - On an Android emulator (API 36), against a local Vision-Agents router with the Linear connector: - the card shows; - Connect opens the sign-in; - closing it resets the card; - a `connected` return shows Connecting...; - Not now declines. The return was sent with `adb`. I didn't sign into a real Linear account. I ran both Gradle variants, the Auth Tab one and a forced Custom Tab one. - On an API 34 emulator (Chrome 113, no Auth Tab), the same flow works through the Custom Tab. - On the iOS simulator: the card, the `ASWebAuthenticationSession` prompt, Cancel resetting the card, and Not now. - On the minimum supported setup, a bare RN 0.76.9 app (compileSdk 35, AGP 8.6) that uses the packed `stream-chat-react-native` builds against `androidx.browser` 1.8.0. On Android 7.0 (API 24) and Android 14, `installId()`, an app-scheme return and closing the browser all work. - The RN CLI wrapper also builds in SampleApp (compileSdk 37, so 1.9.0). I didn't run SampleApp itself. - Not tested: RTL and screen readers. - `yarn lint`, `yarn typecheck`, `yarn build` and `yarn test:unit` pass. ## βοΈ Checklist - [x] I have signed the [Stream CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) (required) - [ ] PR targets the `develop` branch (stacked on #3924) - [ ] Documentation is updated - [ ] New code is tested in main example apps, including all possible scenarios - [ ] SampleApp iOS and Android - [x] Expo iOS and Android
4 of 6 tasks
isekovanic
added a commit
that referenced
this pull request
Nov 12, 2026
Ticket: https://linear.app/stream/issue/RN-485 ## π― Goal Bring the AI agent work we shipped on `v9-release` to V10: the same components, APIs and sample apps, adapted to stream-chat 10 and the V10 i18n. The long-press Copy/Edit menu on the person's own messages isn't here. It isn't on v9 either, and it comes later as a V10 feature. ## π Implementation details The branch is one commit per v9 PR, in merge order, then the V10-only changes, so it can be reviewed commit by commit. **Ported from v9** - #3920 parse agent reply steps from message attachments - #3921 AI translations through the chat SDK, sample on the agents router - #3924 agent reply steps: reasoning, tool calls, approvals - #3926 native `AIAgent` module for the install id and tool-call sign-in - #3928 message views, reply actions and icon overrides - #3929 `AIConversation` on LegendList - #3931 chat options, suggestions and attachment preview fixes - #3933 client tool runner - #3934 polish of agent conversations - #3936 generated UI with an A2UI renderer - #3944 follow-up polish of agent conversations - #3958 A2UI list-row secrets and malformed messages - #3957 conversation state with `AIConversationController` - #3960 `AIConversation` in its own entry point - #3963 the crew assistant demo app - #3974 alignment with the other SDKs - #3975 StrictMode-safe controller lifecycle and `custom.uiAction` docs - #3976 crew drawer layout - #3978 the samples on `@stream-io/stream-agents` 0.4.2, in place of calypso and their own chat layer Where `develop` had already changed the same lines (comment cleanups, the i18n move, a11y docs), `develop`'s version wins. **What's different on V10** - **Fields under `custom`.** stream-chat 10 keeps `mime_type`, `file_size`, `ai_generated`, `generating`, `ai_ui` and the step fields under `custom`. `parseMessageParts` and `fromStreamMessage` lift them with a small `withCustomFields` helper, as the React SDK does. - **Translation keys.** The 55 AI and A2UI strings use catalog keys with their English inline, named after React's (`aiComponents.replyActions.copy.accessibilityLabel`, `a2ui.modal.close.label`, β¦), and `keys.ts` is regenerated. `useAITranslation` returns core's typed `t`. - **Entry isolation.** The AI entry points may reach V10's translation context. `@legendapp/list` and `react-native-keyboard-controller` are AI-only packages. - **LegendList stays at 3.7.1**, the version v9 resolves. 3.7.2 keeps fewer rows mounted after a jump, so the reused-rows test now only compares rows that stay mounted. It passes on both versions. - **Sample data layer.** Both samples use stream-agents' `AgentChat`, whose stream-chat 10 reader reads `channel.messagePaginator`, activates the channel so the client reloads it after a reconnect, and loads older pages with `toTail()`. The samples read the reply fields from `custom`, and the crew sample uploads voice memos with `uploadChannelFile`. - **Sample dependencies.** Both samples depend on `@stream-io/state-store` and `use-sync-external-store`, and pin `@stream-io/state-store` to one copy in `tsconfig` paths. They stay on stream-chat `^10.0.1`: stream-agents asks for `^10.0.2`, but only when it builds its own client, and the samples hand it theirs. ## π¨ UI Changes None compared with v9. The screenshots are in the v9 PRs above. ## π§ͺ Testing `yarn lint`, `yarn typecheck`, `test:typecheck`, the unit tests and `yarn build` pass, and both samples typecheck. On an Android emulator and an iOS simulator: - **ChatGPT sample:** reasoning, the device time tool, the generated Lisbon plan, the drawer, reopening a conversation from history, and starters on a new one. - **Crew sample:** - all eight flows, including the approval cards, the checklist and form actions, and the agent-first ones; - the equipment deep link, photo troubleshooting and the team lead view; - voice memos, recorded on the simulator with `say` and answered; - the clock-out form on iOS. - **Reconnect:** the network was dropped mid-reply on both samples. The client recovered the active channel, and the full reply appeared. - **Older messages:** with the page size briefly set to 3, older pages loaded until there were none left. After the move to stream-agents, both samples were checked again on both platforms: replies, the device time tool, the agent-first Clock in flow, the drawer, reopening from history, handbook sources, and an approval card into A2UI. Reconnect, older pages and voice memos were tested on the samples' previous chat layer, not again since. Not tested here: voice mode (the simulator's speech recognition doesn't hear `say`), dictation, Cal.com sign-in, and charts or photos in the ChatGPT sample. ## βοΈ Checklist - [x] I have signed the [Stream CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) (required) - [x] PR targets the `develop` branch - [x] Documentation is updated - [ ] New code is tested in main example apps, including all possible scenarios - [ ] SampleApp iOS and Android - [x] Expo iOS and Android
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.
Ticket: https://linear.app/stream/issue/RN-485
Stacked on #3921.
π― Goal
Show an agent reply's steps: its rounds of reasoning, its tool calls, and the questions a tool asks before it runs. The views are ported from React's AI components (#3376). Effects follow the native SDKs instead.
π Implementation details
Views (all props-only, none of them reads
<Channel>)AIReasoningshows a header that counts up while the agent thinks ("Thinking... 7s") and then reads "Thought for 12s" with the step's summary.AIThinking.AIThinkingis the same header for a turn that hasn't shown any reasoning yet.AIToolCallshows the call's title, a detail line, a status icon and its duration. The detail line covers waiting for approval, a sign-in or the device, and declined, didn't complete or cancelled.AIToolApprovalandAIToolApprovalCardask the person a tool's question, such as "Share your location?", with the agent's reason and Allow / Don't Allow.AIMessageParts/AIMessagePartrender a reply's steps in order, with a neutral line for a kind this version can't show.AIToolApproverProvider/useAIToolApproversay who answers the questions on this device.Shared bits
NativeShimmerViewthrough a small internalShimmer, whichAITypingIndicatorViewnow uses too. Running calls use the platformActivityIndicator. This matches Swift and Android, not React's CSS.Intl, so we fall back the same way React does.messagePartssection in the AI theme.Thinking...key. Thearandhetranslations are new and could use a native speaker's look.ExpoChatGPTSample
LiveReasoning, fed bymessage.updated, and "thinking" comes from the session's state.session.decide.MessageListsizes bubbles to their content, andAIConversationreplaces it later anyway.π¨ UI Changes
Reasoning steps (folded, open, streaming), tool calls (running, waiting, done, failed, declined) and the approval card.
π§ͺ Testing
AIMessagePartViewssuite, plus duration formatting, including the iOS fallback./respondwithclient_id). calypso 0.2.3'sresponses.createdoesn't send one. Both come with the client tool runner later in this stack.yarn lint,yarn typecheck,yarn buildandyarn test:unitpass.βοΈ Checklist
developbranch (stacked on feat(ai-components): AI translations via the chat SDK, AI sample on the agents routerΒ #3921)