Skip to content

Add openStop AppFunction (opens a stop via PendingIntent) - #153

Merged
joreilly merged 1 commit into
mainfrom
open-stop-appfunction
Nov 29, 2026
Merged

joreilly merged 1 commit into
mainfrom
open-stop-appfunction

Conversation

@joreilly

Copy link
Copy Markdown
Owner

Summary

  • New openStop(stop) AppFunction, following the AppFunctions quality guidelines: returns the stop plus intentToOpen, an explicit FLAG_IMMUTABLE PendingIntent that opens the stop's departures sheet. Takes a stop number, or a name only one stop has; a name covering several stops is refused with each stop's number and direction.
  • OpenStopIntent builds and reads the intent. Each stop gets its own data URI, so earlier PendingIntents aren't redirected by FLAG_UPDATE_CURRENT.
  • MainActivity handles it on launch and in onNewIntent. App(stopToOpen, onStopOpened) passes it to GalwayBusViewModel.openStop(), which waits for the stop list and then opens the same sheet a map tap opens. iOS and desktop are unchanged, because the parameters default to nothing.
  • Ask GalwayBus now builds its tools with AppFunctionAgentTools.discover() minus openStop. Nothing in the app sends the intent, so the model could claim to have opened a stop.
  • app_metadata.xml describes openStop.

Test plan

  • :androidApp:assembleDebug, :androidApp:testDebugUnitTest, :desktopApp:compileKotlin, :shared:compileKotlinIosSimulatorArm64, :shared:jvmTest
  • Pixel 10 Pro XL: openStop with a number returns the stop; with "Eyre Square" or "Galway Cathdrl", it returns an error listing the stops
  • Sent the intent with --pending-intent-path "property/androidAppfunctionsReturnValue.property/intentToOpen": the stop sheet opened from a cold start, and switched stop with the app already open (single activity instance)
  • Ask GalwayBus logs five tools without openStop, and still answers departures questions

🤖 Generated with Claude Code

https://claude.ai/code/session_01XcDRQnBoiM8GnCbW7b4Dts

The AppFunctions quality guidelines say a function that opens a screen
should return an explicit, FLAG_IMMUTABLE PendingIntent for it. openStop
gives assistants that for a stop's departures sheet. A name covering
several stops is refused with their numbers, rather than guessing a side
of the road.

Ask GalwayBus leaves it out of its tools: nothing there sends the intent,
so the model could claim to have opened a stop when nothing happened.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XcDRQnBoiM8GnCbW7b4Dts
@joreilly
joreilly merged commit c8fb2f4 into main Nov 29, 2026
4 of 5 checks passed
@joreilly
joreilly deleted the open-stop-appfunction branch November 29, 2026 10:13
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.

1 participant