feat(android-agent): APK von ARIA empfangen und installieren
Neues Brain-Tool host_install_apk: ARIA schickt eine APK unter /shared/ an einen Android-Agenten, der Installationsdialog von Android oeffnet sich. - Bridge: file_request kann mit offset/length einzelne Stuecke liefern (max. 8 MB); der bisherige Abruf am Stueck bleibt unveraendert - Agent: holt die APK in 4-MB-Stuecken (gezielte file_response vom RVS, nicht an alle im Raum), prueft sha256, oeffnet den Dialog direkt oder per Benachrichtigung; prueft "Unbekannte Apps installieren" vor dem Download - Still installieren geht nicht (Android-Regel), Bestaetigung am Geraet noetig - README: Abschnitt beim Android-Agenten Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3315,6 +3315,43 @@ class ARIABridge:
|
||||
"timestamp": int(asyncio.get_event_loop().time() * 1000),
|
||||
})
|
||||
return
|
||||
# Stueckweiser Abruf (z.B. Android-Agent holt eine APK): mit
|
||||
# "offset" kommt nur ein Teil zurueck. So muss niemand eine grosse
|
||||
# Datei am Stueck in den Speicher nehmen (Fire TV hat wenig RAM).
|
||||
if "offset" in payload:
|
||||
CHUNK_MAX = 8 * 1024 * 1024
|
||||
try:
|
||||
offset = max(0, int(payload.get("offset") or 0))
|
||||
length = int(payload.get("length") or CHUNK_MAX)
|
||||
except (TypeError, ValueError):
|
||||
offset, length = 0, CHUNK_MAX
|
||||
length = max(1, min(length, CHUNK_MAX))
|
||||
try:
|
||||
total = os.path.getsize(server_path)
|
||||
with open(server_path, "rb") as f:
|
||||
f.seek(offset)
|
||||
chunk = f.read(length)
|
||||
except OSError as exc:
|
||||
await self._send_to_rvs({
|
||||
"type": "file_response",
|
||||
"payload": {"requestId": req_id, "error": f"Lesen fehlgeschlagen: {exc}"},
|
||||
"timestamp": int(asyncio.get_event_loop().time() * 1000),
|
||||
})
|
||||
return
|
||||
await self._send_to_rvs({
|
||||
"type": "file_response",
|
||||
"payload": {
|
||||
"requestId": req_id,
|
||||
"serverPath": server_path,
|
||||
"name": os.path.basename(server_path),
|
||||
"offset": offset,
|
||||
"sizeBytes": total,
|
||||
"eof": offset + len(chunk) >= total,
|
||||
"base64": base64.b64encode(chunk).decode("ascii"),
|
||||
},
|
||||
"timestamp": int(asyncio.get_event_loop().time() * 1000),
|
||||
})
|
||||
return
|
||||
# Groessen-Check VOR base64-Encode + Send. Sonst zerreisst's bei
|
||||
# grossen Files (>~70 MB binaer) die WebSocket-Verbindung mit
|
||||
# Code 1009 (message too big) — RVS-Server droppt, Bridge crasht
|
||||
|
||||
Reference in New Issue
Block a user