Files
WoW-Hybrid-gateway/ops/native_gameplay_ready.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

30 lines
2.0 KiB
Python

#!/usr/bin/env python3
"""Enable/reuse the existing guarded outgoing native route in a real world.
No engine calls are invented; the existing owner validates every binding.
"""
import json,time
from client_session import Session
from native_engine_character_test import Controller,ROOT,local_listeners
from native_test_guard import require_local_turtle_ports,require_authenticated_turtle_realm,require_native_gameplay_policy
import client_ui as ui
def main():
started=time.monotonic();require_local_turtle_ports(local_listeners());c=Controller(int((ROOT/'runtime/native-client.pid').read_text()))
require_authenticated_turtle_realm(c.rpc('inspect-wire-account'));policy=c.rpc('inspect-native-channel-policy');pipe=c.rpc('inspect-engine-pipe')
if pipe['error'] or pipe['closed'] or not pipe['world_auth'] or not pipe['world']['self_create']:raise RuntimeError('Require live authenticated self-create; preserve stalled session')
with Session(c.pid) as s:
s.wait_world()
if policy['enabled']:
require_native_gameplay_policy(policy);print(json.dumps(dict(reused=True,pid=c.pid,elapsed_seconds=round(time.monotonic()-started,3))));return
if not all(x['prefix_matches'] and x['executable'] for x in policy['code_contracts']):
# Ordinary local SAY naturally prepares original send code. No GM
# permission or command is required for the shared native route.
# Do not unprotect or call the cold code ourselves.
old=ui.KEY_DELAY;ui.KEY_DELAY=.03
try:s.macro('/s GW native local transport readiness')
finally:ui.KEY_DELAY=old
c.wait(lambda:all(x['prefix_matches'] and x['executable'] for x in c.rpc('inspect-native-channel-policy')['code_contracts']),8)
c.action('enable-native-channel-policy');require_native_gameplay_policy(c.rpc('inspect-native-channel-policy'))
print(json.dumps(dict(reused=False,pid=c.pid,elapsed_seconds=round(time.monotonic()-started,3),new_engine_code_patch=False)))
if __name__=='__main__':main()