Files
baji-vc/scripts/probe-action-calling-path.py
T

38 lines
2.0 KiB
Python

#!/usr/bin/env python3
"""One isolated socket chain + four fixed local-Qwen samples; never a live pack approval."""
import argparse
import base64
import hashlib
import json
from pathlib import Path
import subprocess
ROOT=Path(__file__).resolve().parents[1]
def main():
parser=argparse.ArgumentParser(description=__doc__)
parser.add_argument('--output',type=Path,required=True,help='New ignored numeric evidence file')
args=parser.parse_args()
output=args.output.resolve()
if output.exists() or not output.is_relative_to(ROOT/'logs'): raise ValueError('new logs evidence required')
source={p.name:base64.b64encode(p.read_bytes()).decode() for p in (ROOT/'gateway').glob('*.py')}
baseline=json.loads((ROOT/'gateway/SOURCE_MANIFEST.json').read_text())['deployment_baseline']['files']
expected={name:digest for name,digest in baseline.items() if name in source and name!='tests_fake.py'}
payload='sources='+repr(source)+'\nexpected='+repr(expected)+'\n'+(ROOT/'scripts/action-calling-path-remote.py').read_text()
run=subprocess.run(['ssh','-o','BatchMode=yes','-o','ConnectTimeout=5',
'gorios-spark-2@192.168.31.61','cd /home/gorios-spark-2/lan-voice && exec .venv/bin/python -'],
input=payload.encode(),capture_output=True,timeout=210)
if run.stdout:
report=json.loads(run.stdout)
report['workspace_source_hashes']={str(p.relative_to(ROOT)):hashlib.sha256(p.read_bytes()).hexdigest()
for p in [ROOT/'scripts/probe-action-calling-path.py',ROOT/'scripts/action-calling-path-remote.py',*(ROOT/'gateway').glob('*.py')]}
output.parent.mkdir(parents=True,exist_ok=True)
output.write_text(json.dumps(report,ensure_ascii=False,indent=2)+'\n')
print(json.dumps({k:report.get(k) for k in ('status','scope','reason','error_type','llm_requests','tts_requests','chain','semantic_rows')},ensure_ascii=False,indent=2))
if run.stderr: print('Remote stderr present; content suppressed.')
raise SystemExit(run.returncode)
if __name__=='__main__': main()