fix(android): add screenHash to screen responses, handle goal_failed
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import android.util.Base64
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.thisux.droidclaw.accessibility.DroidClawAccessibilityService
|
import com.thisux.droidclaw.accessibility.DroidClawAccessibilityService
|
||||||
import com.thisux.droidclaw.accessibility.GestureExecutor
|
import com.thisux.droidclaw.accessibility.GestureExecutor
|
||||||
|
import com.thisux.droidclaw.accessibility.ScreenTreeBuilder
|
||||||
import com.thisux.droidclaw.capture.ScreenCaptureManager
|
import com.thisux.droidclaw.capture.ScreenCaptureManager
|
||||||
import com.thisux.droidclaw.model.AgentStep
|
import com.thisux.droidclaw.model.AgentStep
|
||||||
import com.thisux.droidclaw.model.GoalStatus
|
import com.thisux.droidclaw.model.GoalStatus
|
||||||
@@ -65,6 +66,10 @@ class CommandRouter(
|
|||||||
currentGoalStatus.value = if (msg.success == true) GoalStatus.Completed else GoalStatus.Failed
|
currentGoalStatus.value = if (msg.success == true) GoalStatus.Completed else GoalStatus.Failed
|
||||||
Log.i(TAG, "Goal completed: success=${msg.success}, steps=${msg.stepsUsed}")
|
Log.i(TAG, "Goal completed: success=${msg.success}, steps=${msg.stepsUsed}")
|
||||||
}
|
}
|
||||||
|
"goal_failed" -> {
|
||||||
|
currentGoalStatus.value = GoalStatus.Failed
|
||||||
|
Log.i(TAG, "Goal failed: ${msg.message}")
|
||||||
|
}
|
||||||
|
|
||||||
else -> Log.w(TAG, "Unknown message type: ${msg.type}")
|
else -> Log.w(TAG, "Unknown message type: ${msg.type}")
|
||||||
}
|
}
|
||||||
@@ -86,9 +91,14 @@ class CommandRouter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val screenHash = if (elements.isNotEmpty()) {
|
||||||
|
ScreenTreeBuilder.computeScreenHash(elements)
|
||||||
|
} else null
|
||||||
|
|
||||||
val response = ScreenResponse(
|
val response = ScreenResponse(
|
||||||
requestId = requestId,
|
requestId = requestId,
|
||||||
elements = elements,
|
elements = elements,
|
||||||
|
screenHash = screenHash,
|
||||||
screenshot = screenshot,
|
screenshot = screenshot,
|
||||||
packageName = packageName
|
packageName = packageName
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ data class ScreenResponse(
|
|||||||
val type: String = "screen",
|
val type: String = "screen",
|
||||||
val requestId: String,
|
val requestId: String,
|
||||||
val elements: List<UIElement>,
|
val elements: List<UIElement>,
|
||||||
|
val screenHash: String? = null,
|
||||||
val screenshot: String? = null,
|
val screenshot: String? = null,
|
||||||
val packageName: String? = null
|
val packageName: String? = null
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user