mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 15:56:01 +00:00
fix(agent): each harness has its own setup state and conversation
This commit is contained in:
1 parent
44e72258b1
commit
bdaa155baa
2 files changed
+6
-4
No files matched your search
@@ -69,9 +69,11 @@ object AgentHost {
|
||||
}
|
||||
}
|
||||
|
||||
/** Switches the agent CLI; a conversation belongs to one CLI, so a new one starts. */
|
||||
fun choose(context: Context, choice: AgentHarness) {
|
||||
if (choice == harness || state == State.WORKING) return
|
||||
prefs(context).edit().putString(HARNESS_KEY, choice.id).remove(CONVERSATION_KEY).apply()
|
||||
forget(context)
|
||||
prefs(context).edit().putString(HARNESS_KEY, choice.id).apply()
|
||||
refresh(context)
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@ object AgentSetup {
|
||||
val ready: Boolean get() = Step.entries.filter { it.required }.all { status[it] == Status.DONE }
|
||||
|
||||
/** Set once the required steps have all passed, so the chat opens without waiting for the checks. */
|
||||
fun completed(context: Context) = AgentHost.prefs(context).getBoolean(COMPLETED_KEY, false)
|
||||
fun completed(context: Context) = AgentHost.prefs(context).getBoolean(completedKey(), false)
|
||||
|
||||
private const val COMPLETED_KEY = "setup_completed"
|
||||
private fun completedKey() = "setup_completed_${AgentHost.harness.id}"
|
||||
|
||||
private val main = Handler(Looper.getMainLooper())
|
||||
private const val REPO = "https://github.com/Droid-Deck/DroidDeck.git"
|
||||
@@ -111,7 +111,7 @@ object AgentSetup {
|
||||
if (status[step] != Status.WORKING) status[step] = if (ok) Status.DONE else Status.TODO
|
||||
val last = output.lines().lastOrNull { it.isNotBlank() }?.trim()?.take(160)
|
||||
if (!ok && step.required && last != null) detail[step] = last else if (ok) detail.remove(step)
|
||||
if (ready) AgentHost.prefs(app).edit().putBoolean(COMPLETED_KEY, true).apply()
|
||||
if (ready) AgentHost.prefs(app).edit().putBoolean(completedKey(), true).apply()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user