Fix agent pet overlay permission and GitHub setup (#2548)

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-12 22:38:22 -05:00
1 parent 827ab2d485
commit 1b732c1b65
5 files changed
+28 -35

No files matched your search

@@ -77,6 +77,9 @@ class AgentHostService : Service() {
private fun describe(context: Context): String {
val lab = AgentHost.lab?.takeIf { it.running }
if (lab != null) return context.getString(R.string.agent_lab_progress, lab.permille / 10, minutes(lab.etaSeconds.toLong().coerceAtLeast(0)))
AgentSetup.detail[AgentSetup.Step.GITHUB]?.takeIf {
AgentSetup.status[AgentSetup.Step.GITHUB] == AgentSetup.Status.WORKING && it.startsWith("GitHub device code:")
}?.let { return it }
if (AgentHost.state != AgentHost.State.WORKING) return context.getString(R.string.agent_setting_up)
val tool = AgentHost.running()
val elapsed = minutes((SystemClock.elapsedRealtime() - AgentHost.turnStarted) / 1000)
@@ -106,7 +106,10 @@ object AgentSetup {
child.inputStream.bufferedReader().forEachLine { line ->
log.appendLine(line)
val text = line.trim()
if (text.isNotEmpty() && !noise(text)) main.post { detail[step] = text.take(160) }
if (text.isNotEmpty() && !noise(text)) main.post {
detail[step] = text.take(160)
if (step == Step.GITHUB && text.startsWith("GitHub device code:")) AgentHostService.update(app)
}
}
child.waitFor().also { log.appendLine("exit $it") }
}
@@ -116,6 +116,10 @@ internal object AgentPet {
fun set(context: Context, on: Boolean) {
enabled = on
AgentHost.prefs(context).edit().putBoolean(KEY, on).apply()
if (on) {
allowed = PetWindows.allowed(context)
if (!allowed) requestFloating(context)
}
}
/** Opens the system page where the user lets DroidDeck draw over other apps. */