Repository navigation
Add the App assistant public API to AppService - #941
Open
Michael Lee (michaellee1019) wants to merge 8 commits into
Open
Michael Lee (michaellee1019) wants to merge 8 commits into
Michael Lee (michaellee1019) wants to merge 8 commits into
Conversation
AppAssistantService is the shared chat contract for the web app and Viam mobile: one server stream for a turn, plus list and get for the server-owned transcript. Approval and client-tool pauses end the stream so a phone can drop the connection while a person decides. Co-authored-by: Michael Lee <michaellee1019@gmail.com>
GetConversationResponse now returns the open client tool and the stored conversation context. ApprovalRequired carries a structured diff. List conversations is defined as newest updated_at first. Co-authored-by: Michael Lee <michaellee1019@gmail.com>
Contributor
|
For security reasons, this PR must be labeled with |
The app server never sends approval_required and refuses an approval input: a staged change is confirmed with the builder's Save, and backend writes run on the call. The API is unreleased, so the remaining fields take the freed numbers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JLuWqczk3u5gmMh7nSxMA1
ListModels lists the models a conversation can use, and StreamTurn takes one in model. Each stream that ran the model reports the conversation's billed cost and, to a caller who may see it, the paying organization's month-to-date AI cost. GetConversation returns the conversation's model and cost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JLuWqczk3u5gmMh7nSxMA1
The per-conversation cost is dropped from TurnUsage and GetConversation. The API is unreleased, so the remaining field takes the freed number. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JLuWqczk3u5gmMh7nSxMA1
The four RPCs move from their own AppAssistantService into AppService as StreamAssistantTurn, ListAssistantConversations, GetAssistantConversation and ListAssistantModels, so the app's existing routes carry them. Their messages move into viam.app.v1 with an Assistant prefix, and the stream's response is StreamAssistantTurnResponse, so the lint exception goes away. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JLuWqczk3u5gmMh7nSxMA1
- A text delta carries its block index, and complete names the first block of the final answer, so a client can collapse the narration. - A transcript reply holds its steps (narration and tool calls) and how long it took, so a reopened chat shows the work behind each answer. - GetAssistantConversation and the list say whether a turn is running. A turn finishes on the server when the client disconnects. - Failed RPCs carry an AssistantError detail with a typed reason, and the stop reason is an enum, so clients never match message text. - ListAssistantConversations is paginated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JLuWqczk3u5gmMh7nSxMA1
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.
Adds the assistant (the chat on the web app and on Viam mobile) to the existing
AppService. The messages live in a newproto/viam/app/v1/assistant.proto(sameviam.app.v1package), imported byapp.proto. Putting the RPCs onAppServicemeans they ride the routes the load balancer already has, so no new service routing is needed.RPCs on
AppServiceStreamAssistantTurnis the only turn RPC. The server owns the transcript, so a request carries either the user's new message or the result of one tool the client ran. The stream sends text deltas, atool_statusfor each backend tool, and ausageevent once the model has run. It ends oncompleteor on oneclient_toolfor the client to run.ListAssistantConversationslists the caller's conversations, newestupdated_atfirst, one page at a time (page_size,page_token,next_page_token).GetAssistantConversationreturns the transcript, whether a turn is running, the client tool the conversation is waiting on, the stored conversation context, and the conversation's model.ListAssistantModelslists the models a conversation can use and the default.For mobile clients
AssistantTextDeltahas ablock_index; a new index starts a new text block.AssistantTurnComplete.answer_block_indexis the first block of the final answer. Blocks before it are narration between tool calls.stepsin order (narration, and tool calls with the same name and label as the stream'stool_status), its answer intext, andworked_for, the time from the user's message to the answer.GetAssistantConversation.runningandAssistantConversationListItem.runningsay a turn is in progress, and the steps stored so far are in the transcript. A client polls untilrunningis false. A message sent meanwhile fails withTURN_RUNNING.AssistantErrorin its gRPC status details, whoseAssistantErrorReasoncovers: conversation too long, turn running, conversation changed, turn failed, assistant unavailable, no billing organization, unknown model, no client tool waiting, and empty input.AssistantTurnComplete.stop_reasonis theAssistantStopReasonenum. Clients never match message text.Models and cost
StreamAssistantTurnRequest.modelpicks a model fromListAssistantModels. The conversation keeps it for later turns, and an empty value keeps the current pick.AssistantTurnUsagereports the model that served the turn and the paying organization's month-to-date AI cost. The cost is set only for a caller who may see that organization's billing. Billing is entirely server side; a client does nothing for it.Notes
stop_reasonchanged from a string to an enum in place).ready-for-protos.go.modreplace on viamrobotics/app#14301.🤖 Generated with Claude Code
https://claude.ai/code/session_01JLuWqczk3u5gmMh7nSxMA1