diff --git a/app/src/main/java/com/droiddeck/launcher/agent/AgentHarness.kt b/app/src/main/java/com/droiddeck/launcher/agent/AgentHarness.kt index 3488feb7f..e410be3c1 100644 --- a/app/src/main/java/com/droiddeck/launcher/agent/AgentHarness.kt +++ b/app/src/main/java/com/droiddeck/launcher/agent/AgentHarness.kt @@ -11,6 +11,8 @@ interface AgentHarness { val name: String /** Absolute guest path of the CLI. */ val binary: String + /** Guest paths of everything the CLI needs installed, [binary] included. */ + val files: List get() = listOf(binary) /** A guest shell script that installs the CLI. */ val install: String /** A guest command whose exit status is 0 when the CLI is signed in. */ @@ -169,12 +171,18 @@ object Codex : AgentHarness { override val id = "codex" override val name = "Codex" override val binary = "/root/.local/bin/codex" + // Code mode runs in a helper that each release ships as its own download. + private const val HOST = "/root/.local/bin/codex-code-mode-host" + override val files get() = listOf(binary, HOST) override val install = """ set -e - url=${'$'}(curl -fsSL https://api.github.com/repos/openai/codex/releases/latest | grep -o 'https://[^"]*codex-aarch64-unknown-linux-musl.tar.gz' | head -1) + release=${'$'}(curl -fsSL https://api.github.com/repos/openai/codex/releases/latest) mkdir -p /root/.local/bin - curl -fsSL "${'$'}url" | tar -xz -C /tmp - install -m755 /tmp/codex-aarch64-unknown-linux-musl $binary + for name in codex codex-code-mode-host; do + url=${'$'}(printf '%s' "${'$'}release" | grep -o "https://[^\"]*/${'$'}name-aarch64-unknown-linux-musl.tar.gz" | head -1) + curl -fsSL "${'$'}url" | tar -xz -C /tmp + install -m755 /tmp/${'$'}name-aarch64-unknown-linux-musl /root/.local/bin/${'$'}name + done """.trimIndent() override val signedIn = listOf(binary, "login", "status") override val signIn = listOf(binary, "login") diff --git a/app/src/main/java/com/droiddeck/launcher/agent/AgentHost.kt b/app/src/main/java/com/droiddeck/launcher/agent/AgentHost.kt index 1b42fa094..9176e6676 100644 --- a/app/src/main/java/com/droiddeck/launcher/agent/AgentHost.kt +++ b/app/src/main/java/com/droiddeck/launcher/agent/AgentHost.kt @@ -124,7 +124,7 @@ object AgentHost { model = prefs(app).getString(modelKey(harness), null) plan = prefs(app).getBoolean(PLAN_KEY, false) available = LinuxRuntime.isInstalled(app) - installed = guestFileExists(app, harness.binary) + installed = harness.files.all { guestFileExists(app, it) } if (!installed) state = State.MISSING else if (state == State.MISSING) state = State.IDLE if (!loaded) { loaded = true diff --git a/app/src/main/java/com/droiddeck/launcher/agent/AgentSetup.kt b/app/src/main/java/com/droiddeck/launcher/agent/AgentSetup.kt index 0092f6adc..a6de1e44c 100644 --- a/app/src/main/java/com/droiddeck/launcher/agent/AgentSetup.kt +++ b/app/src/main/java/com/droiddeck/launcher/agent/AgentSetup.kt @@ -47,7 +47,7 @@ object AgentSetup { val probes = mutableListOf>>() for (step in Step.entries) if (status[step] != Status.WORKING) { when (step) { - Step.INSTALL -> set(step, if (AgentHost.guestFileExists(app, harness.binary)) Status.DONE else Status.TODO) + Step.INSTALL -> set(step, if (harness.files.all { AgentHost.guestFileExists(app, it) }) Status.DONE else Status.TODO) Step.BUILD_TOOLS -> set(step, if (buildToolsInstalled(app)) Status.DONE else Status.TODO) Step.PREPARE -> set(step, if (prepared(app)) Status.DONE else Status.TODO) Step.CONNECTION -> probes += step to listOf("sh", "-c", diff --git a/app/src/main/java/com/droiddeck/launcher/agent/AgentStorage.kt b/app/src/main/java/com/droiddeck/launcher/agent/AgentStorage.kt index 855fd1370..9eacc4a6b 100644 --- a/app/src/main/java/com/droiddeck/launcher/agent/AgentStorage.kt +++ b/app/src/main/java/com/droiddeck/launcher/agent/AgentStorage.kt @@ -22,7 +22,7 @@ import java.nio.file.attribute.BasicFileAttributes object AgentStorage { enum class Item(val paths: List) { CLAUDE_CODE(listOf("/root/.local/share/claude", "/root/.local/bin/claude", "/root/cc")), - CODEX(listOf("/root/.local/bin/codex")), + CODEX(listOf("/root/.local/bin/codex", "/root/.local/bin/codex-code-mode-host")), BUILD_TOOLS(listOf("/root/android-sdk", "/root/aapt2", "/root/x86root", "/root/.gradle")), SOURCE(listOf("/root/DroidDeck")), CACHES(listOf("/root/.cache", "/root/.npm")),