Skip to content

Dev/jebransyed/android register - #2845

Merged
jebrans merged 2 commits into
microsoft:mainfrom
jebrans:dev/jebransyed/android-register
Aug 11, 2026
Merged

Dev/jebransyed/android register#2845
jebrans merged 2 commits into
microsoft:mainfrom
jebrans:dev/jebransyed/android-register

Conversation

@jebrans

@jebrans jebrans commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Enable the mobile-2 Android sample to register itself with TypeAgent as
a client-hosted androidDevice agent using registerClientAgent.

The app supplies an inline schema for alarm and timer actions, receives
typed executeAction callbacks over the existing WebSocket connection,
dispatches them through Android intents, and returns success or failure
results to TypeAgent.

The existing takeAction handlers remain available for compatibility
with the static androidMobile agent.

Example

Before

The Android app depended on the server-side androidMobile agent and
received fire-and-forget client actions:

TypeAgent androidMobile agent -> takeAction("set-timer", ...) -> Android intent

The app could not register its own schema or report the device operation
result to TypeAgent.

After

The Android app registers its own schema and action implementation:

Android app -> registerClientAgent("androidDevice", inlineSchema) -> executeAction(setTimer) -> Android intent -> ActionResult

A deterministic action can be tested with:

@action --parameters {"originalRequest":"timer","durationInSeconds":30} androidDevice setTimer

Timer request sent for 30 seconds

jebrans and others added 2 commits August 10, 2026 16:31
Register an inline Android device schema from the mobile sample, route executeAction callbacks to alarm and timer intents, return action results, and cover the registration and parsing contract with focused tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jebrans
jebrans added this pull request to the merge queue Aug 11, 2026
Merged via the queue into microsoft:main with commit cabcb84 Aug 11, 2026
22 checks passed
jebrans added a commit to jebrans/TypeAgent that referenced this pull request Aug 12, 2026
Integrates upstream microsoft#2845 (client-hosted Android agent) with the
conversation-persistence work in this PR. Resolution notes:

- WebSocketManager.connect() now takes both schemaContent (upstream) and
  resumeConversationId (this PR); the connect-time synchronized block
  seeds requestedConversationId, agentSchemaContent and resets
  isClientAgentRegistered. The "Conversation not found" fallback rejoin
  reuses the same onResult path, so registerClientAgent still runs after
  falling back to the default conversation.

- MainActivity collects clientActionEvents in a plain lifecycleScope
  launch rather than repeatOnLifecycle(RESUMED). Upstream's executeAction
  holds a server RPC open until the completion callback fires, so gating
  on RESUMED would hang that RPC while backgrounded. launchExternalIntent
  already does its own RESUMED check and fails fast, matching upstream's
  behavior; the unbounded channel still buffers across configuration
  changes.

- ClientAction.Alarm/.Timer carry upstream's completion callback.
  dispatchClientAction fails the completion when the channel is closed so
  the RPC can never leak.

- Upstream's onDestroy teardown is intentionally not carried over: the
  socket is owned by the ViewModel and tearing it down in onDestroy would
  disconnect on every rotation.

- README keeps both the renamed "Client-hosted Android agent" section and
  the rewritten "Conversation persistence" section.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants