GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(assistant): hold the side button to talk to OpenCode (Experimental) · anomalyco/opencode-android@63afd10

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • app/src
    • main
      • AndroidManifest.xml
      • kotlin/ai/opencode/app
        • AppDependencies.kt
        • AppFeature.kt
        • AppFeatureClientTools.kt
        • AppView.kt
        • MainActivity.kt
        • SceneWindows.kt
        • assistant
          • AssistantActivity.kt
          • AssistantFlow.kt
          • AssistantOverlay.kt
          • AssistantSessionTarget.kt
          • OpenCodeAssistantService.kt
          • OpenCodeAssistantSession.kt
          • PhoneToolLab.kt
      • res/xml
        • assistant_recognition.xml
        • assistant_service.xml
    • test/kotlin/ai/opencode/app
      • AssistantClientToolsTests.kt
      • AssistantPanelStaysTests.kt
      • AssistantSessionTargetTests.kt
  • core/src/main
    • kotlin/ai/opencode/core
      • experiments
        • AssistantExperiment.kt
      • log
        • CallTrigger.kt
      • ui
        • SFSymbol.kt
    • res/drawable
      • ms_alarm.xml
      • ms_timer.xml
  • docs
    • parity
      • app.md
      • core-ui.md
      • core.md
      • drawer.md
      • server.md
      • settings.md
      • system.md
      • voice.md
    • releasing.md
  • feature
    • drawer/src
      • main/kotlin/ai/opencode/feature/drawer
        • HomeFeature.kt
        • HomeFeatureSystem.kt
        • HomeFeatureVoiceNavigation.kt
      • test/kotlin/ai/opencode/feature/drawer
        • AssistantCallTargetTests.kt
    • settings/src/main/kotlin/ai/opencode/feature/settings
      • AssistantSettingsView.kt
      • ExperimentalSettingsView.kt
      • HomeSettingsFeature.kt
      • SettingsFeature.kt
      • SettingsView.kt
      • VoiceDelegatorSettings.kt
    • system/src/main/kotlin/ai/opencode/feature/system
      • SystemAction.kt
      • assistant
        • AssistantSetupClient.kt
      • clienttools
        • ClientToolsFeature.kt
    • voice/src
      • main
        • AndroidManifest.xml
        • kotlin/ai/opencode/feature/voice
          • AssistantCallPanel.kt
          • AssistantVoiceReadiness.kt
          • FloatingCall.kt
          • LiveCallCoordinatorEvents.kt
          • LiveProtocol.kt
          • PhoneAccess.kt
          • PhoneCalls.kt
          • PhoneDetails.kt
          • PhoneDevice.kt
          • PhoneDisplay.kt
          • PhoneEvents.kt
          • PhoneInbox.kt
          • PhoneMedia.kt
          • PhoneNotificationListener.kt
          • PhoneNotifications.kt
          • PhonePeople.kt
          • PhonePhoto.kt
          • PhonePlaces.kt
          • PhoneScreen.kt
          • PhoneShare.kt
          • PhoneTools.kt
          • PhoneToolsClient.kt
          • RealtimeProtocol.kt
          • VoiceActionClaim.kt
          • VoiceCallService.kt
          • VoiceFeature.kt
          • VoiceFeatureStart.kt
          • VoiceLabDemo.kt
          • VoiceLabTriggers.kt
          • VoiceRoute.kt
          • VoiceTimeline.kt
          • VoiceTranscript.kt
        • res/xml
          • phone_photo_paths.xml
      • test/kotlin/ai/opencode/feature/voice
        • AssistantCallPanelTests.kt
        • PhoneToolsTests.kt
        • VoiceActionPhoneClaimTests.kt
  • scripts
    • material-symbols.txt
  • server/src/main/kotlin/ai/opencode/server
    • OpenCodeClient.kt
    • clienttools
      • ClientToolsClient.kt
      • PhoneToolSpecs.kt
    • live
      • LiveSessions.kt

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎app/src/main/AndroidManifest.xml‎

Copy file name to clipboardExpand all lines: app/src/main/AndroidManifest.xml
+43Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,48 @@
5858
<data android:path="/pair/" />
5959
</intent-filter>
6060
</activity>
61+
62+
<!--
63+
Android only: OpenCode as the phone's assistant (holding the side button). The
64+
system binds the service while OpenCode holds the assistant role; each press opens a
65+
session, which hands off to the panel. The recognition service is the stub the
66+
platform requires of an assistant; it can't be picked as the phone's speech service.
67+
-->
68+
<service
69+
android:name=".assistant.OpenCodeAssistantService"
70+
android:exported="true"
71+
android:label="@string/app_name"
72+
android:permission="android.permission.BIND_VOICE_INTERACTION">
73+
<meta-data
74+
android:name="android.voice_interaction"
75+
android:resource="@xml/assistant_service" />
76+
<intent-filter>
77+
<action android:name="android.service.voice.VoiceInteractionService" />
78+
</intent-filter>
79+
</service>
80+
<service
81+
android:name=".assistant.OpenCodeAssistantSessionService"
82+
android:exported="true"
83+
android:permission="android.permission.BIND_VOICE_INTERACTION" />
84+
<service
85+
android:name=".assistant.OpenCodeRecognitionService"
86+
android:exported="true"
87+
android:label="@string/app_name"
88+
android:permission="android.permission.BIND_VOICE_INTERACTION">
89+
<intent-filter>
90+
<action android:name="android.speech.RecognitionService" />
91+
</intent-filter>
92+
<meta-data
93+
android:name="android.speech"
94+
android:resource="@xml/assistant_recognition" />
95+
</service>
96+
<activity
97+
android:name=".assistant.AssistantActivity"
98+
android:exported="false"
99+
android:excludeFromRecents="true"
100+
android:launchMode="singleTask"
101+
android:showWhenLocked="true"
102+
android:taskAffinity=""
103+
android:theme="@style/Theme.OpenCode.SystemDialog" />
61104
</application>
62105
</manifest>
Collapse file

‎app/src/main/kotlin/ai/opencode/app/AppDependencies.kt‎

Copy file name to clipboardExpand all lines: app/src/main/kotlin/ai/opencode/app/AppDependencies.kt
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import ai.opencode.core.tuning.DeveloperMode
99
import ai.opencode.feature.composer.PendingPrompt
1010
import ai.opencode.feature.composer.PromptOutbox
1111
import ai.opencode.feature.composer.ComposerFileAttachment
12+
import ai.opencode.app.assistant.AssistantFlow
13+
import ai.opencode.app.assistant.OpenCodeAssistantService
14+
import ai.opencode.feature.voice.AssistantPanelClient
1215
import ai.opencode.feature.voice.ShutterSystemSound
1316
import ai.opencode.feature.voice.VoiceAdmissionRecorder
1417
import ai.opencode.feature.voice.VoiceCallDiagnostics
@@ -51,6 +54,15 @@ internal object AppDependencies {
5154
dependency(AudioSessionOwner).onHolderActivating(stop)
5255
}
5356
this[ScreenCaptureShutterSound] = ShutterSystemSound.live()
57+
// Android only: the side-button panel asks before a phone tool that needs a yes (reading
58+
// notifications, a call, a text), shows a chip for what the tools did, and asks Android
59+
// for the screen.
60+
this[AssistantPanelClient] = AssistantPanelClient(
61+
confirm = { AssistantFlow.shared.confirm(it) },
62+
acted = { AssistantFlow.shared.acted(it) },
63+
showedScreen = { AssistantFlow.shared.showedScreen() },
64+
readScreen = { OpenCodeAssistantService.readScreen() },
65+
)
5466
// `PromptOutbox.recordAdmitted` with the send voice made.
5567
this[VoiceAdmissionRecorder] = VoiceAdmissionRecorder { prompt, sessionID, serverKey ->
5668
dependency(PromptOutbox).recordAdmitted(
Collapse file

‎app/src/main/kotlin/ai/opencode/app/AppFeature.kt‎

Copy file name to clipboardExpand all lines: app/src/main/kotlin/ai/opencode/app/AppFeature.kt
+29-1Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import ai.opencode.feature.drawer.keepingSettings
3030
import ai.opencode.feature.drawer.persistingSnapshot
3131
import ai.opencode.feature.media.BrowserFeature
3232
import ai.opencode.feature.session.SessionFeature
33+
import ai.opencode.feature.settings.SettingsPage
3334
import ai.opencode.feature.settings.onboarding.WelcomeFeature
3435
import ai.opencode.feature.system.NotificationDestination
3536
import ai.opencode.feature.system.SessionDirectory
@@ -93,6 +94,10 @@ class AppFeature : Reducer<AppFeature.State, AppFeature.Action> {
9394
val delegatorClientTools: ClientToolsFeature.State = ClientToolsFeature.State(slot = ClientToolsFeature.State.Slot.Delegator),
9495
/** Where that delegator session lives, once read. */
9596
val voiceDelegatorLocation: ClientToolsLocation? = null,
97+
/** Android only: the session the side-button assistant talks to, which gets the phone's tools. */
98+
val assistantScope: AssistantScope? = null,
99+
/** Android only: Settings › Assistant › Phone Tools is All Calls, so in-app calls get the phone's tools too. */
100+
val phoneToolsInAllCalls: Boolean = false,
96101
val voiceOpenSession: VoiceOpenSessionFeature.State = VoiceOpenSessionFeature.State(),
97102
val connection: Connection = Connection.Idle,
98103
val connectionGeneration: Int = 0,
@@ -468,6 +473,8 @@ class AppFeature : Reducer<AppFeature.State, AppFeature.Action> {
468473
/** A session the action names that the list doesn't have. */
469474
data class SystemSessionLoaded(val action: SystemAction, val sessionID: String, val result: Result<OpenCodeSession>) : Action
470475
data object SystemActionErrorDismissed : Action
476+
/** Android only: the assistant panel opens Settings at a page (Voice, Experimental). */
477+
data class SettingsPageRequested(val page: SettingsPage) : Action
471478
/** The app became active: take what the share sheet left. */
472479
data object PendingSharesRequested : Action
473480
data class SharesReceived(val shares: List<ReceivedShare>) : Action
@@ -496,6 +503,18 @@ class AppFeature : Reducer<AppFeature.State, AppFeature.Action> {
496503
data class ClientTools(val action: ClientToolsFeature.Action) : Action
497504
data class DelegatorClientTools(val action: ClientToolsFeature.Action) : Action
498505
data class VoiceDelegatorLocated(val location: ClientToolsLocation) : Action
506+
507+
/**
508+
* Android only: the assistant's panel opened for [scope]'s session, or closed (null). The
509+
* phone's tools stay offered until that session's turn finishes.
510+
*/
511+
data class AssistantPanelChanged(val scope: AssistantScope?) : Action
512+
513+
/** Android only: the short wait after the panel closed, for the session to start its turn, is over. */
514+
data object AssistantGraceElapsed : Action
515+
516+
/** Android only: Settings › Assistant › Phone Tools changed (All Calls when [allCalls]). */
517+
data class PhoneToolsReachChanged(val allCalls: Boolean) : Action
499518
data class VoiceOpenSession(val action: VoiceOpenSessionFeature.Action) : Action
500519
data class HomeResponse(val attemptID: Int, val result: Result<OpenCodeHomeSnapshot>) : Action
501520
/** Server Flow: the switch's server didn't answer in time. */
@@ -577,6 +596,13 @@ class AppFeature : Reducer<AppFeature.State, AppFeature.Action> {
577596
return Reduced(reduced.state.copy(home = home.copy(drawerOpenRequest = null)), reduced.effect)
578597
}
579598

599+
private fun settingsPageRequested(state: State, page: SettingsPage): Reduced<State, Action> {
600+
val home = state.home ?: return Reduced(state)
601+
val shown = home.showingSettings()
602+
val settings = shown.settings ?: return Reduced(state.copy(home = shown))
603+
return Reduced(state.copy(home = shown.copy(settings = settings.copy(path = listOf(page)))))
604+
}
605+
580606
private fun reduceCore(state: State, action: Action): Reduced<State, Action> = when (action) {
581607
Action.Task -> {
582608
migrateSettingsIfNeeded(state.knownServers)
@@ -610,6 +636,7 @@ class AppFeature : Reducer<AppFeature.State, AppFeature.Action> {
610636
}
611637
Action.SystemActionsTaskEnded -> Reduced(state, Effect.cancel(CancelID.SystemActions))
612638
is Action.SystemActionReceived -> systemActionReceived(state, action.action)
639+
is Action.SettingsPageRequested -> settingsPageRequested(state, action.page)
613640
is Action.SystemSessionLoaded -> systemSessionLoaded(state, action)
614641
Action.SystemActionErrorDismissed -> Reduced(state.copy(systemActionError = null))
615642
Action.PendingSharesRequested -> {
@@ -679,7 +706,8 @@ class AppFeature : Reducer<AppFeature.State, AppFeature.Action> {
679706
is Action.HomeResponse -> homeResponse(state, action)
680707
is Action.ServerSwitchTimedOut -> serverSwitchTimedOut(action.attemptID, state)
681708
is Action.Home -> home(state, action.action)
682-
is Action.Welcome, is Action.ClientTools, is Action.DelegatorClientTools, is Action.VoiceDelegatorLocated, is Action.VoiceOpenSession -> Reduced(state)
709+
is Action.Welcome, is Action.ClientTools, is Action.DelegatorClientTools, is Action.VoiceDelegatorLocated, is Action.VoiceOpenSession,
710+
is Action.AssistantPanelChanged, Action.AssistantGraceElapsed, is Action.PhoneToolsReachChanged -> Reduced(state)
683711
}
684712

685713
/**

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.