Files
WoW-Hybrid-gateway/ops/windows_spice_probe.py
praxisandClaude Fable 5.2 8a24c445b0 Content pipeline and operator tools
367 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

19 lines
1.2 KiB
Python

#!/usr/bin/env python3
"""Bounded read-only SPICE agent availability for the owned win11 VM."""
import json,pathlib
import gi
gi.require_version('SpiceClientGLib','2.0')
from gi.repository import SpiceClientGLib as S,GLib,GObject
ROOT=pathlib.Path(__file__).resolve().parents[1];OUT=ROOT/'runtime/windows-build-storage-20261022'
uri=json.loads((OUT/'guest-network-display-private.json').read_text())['display_uri']
session=S.Session.new();session.set_property('uri',uri);loop=GLib.MainLoop();result={'channels':[],'agent_connected':False};channels=[]
def added(s,channel):
channels.append(channel);result['channels'].append(type(channel).__name__)
if isinstance(channel,S.MainChannel):
def update(*a):result['agent_connected']=bool(channel.get_property('agent-connected'))
GObject.Object.connect(channel,'notify::agent-connected',update);update()
channel.connect()
GObject.Object.connect(session,'channel-new',added);session.connect();GLib.timeout_add_seconds(6,lambda:(loop.quit(),False)[1]);loop.run();session.disconnect()
p=OUT/'spice-agent-availability.json';p.write_text(json.dumps(result,indent=2)+'\n');p.chmod(0o600)
print('SPICE agent connected:',result['agent_connected'],'; input channel:',any('Inputs' in x for x in result['channels']))