Files
html/api/opus5-blade-wake.php
2026-04-17 14:35:01 +02:00

47 lines
2.0 KiB
PHP

<?php
// OPUS5 Blade Wake Helper - prepares PS1 wake command + validates blade-status
header('Content-Type: application/json');
$R = ['ts'=>date('c'), 'source'=>'opus5-blade-wake'];
// Read current blade status
$status = @file_get_contents('https://weval-consulting.com/api/blade-status.json');
$d = @json_decode($status, true) ?: [];
$R['last_seen'] = $d['last_seen'] ?? 'never';
if (!empty($d['last_seen'])) {
$ts = strtotime($d['last_seen']);
$R['age_hours'] = round((time() - $ts) / 3600, 1);
$R['verdict'] = $R['age_hours'] < 1 ? 'HEALTHY' : ($R['age_hours'] < 24 ? 'STALE' : 'DEAD');
} else {
$R['verdict'] = 'UNKNOWN';
}
// Wake instructions for Yacine (Razer PowerShell admin)
$R['wake_instructions'] = [
'target_machine' => 'Razer Blade workstation',
'method' => 'PowerShell admin (10 seconds)',
'commands' => [
'# Open PowerShell as Administrator on Razer:',
'Start-Service -Name "WevalSentinel" -ErrorAction SilentlyContinue',
'& "C:\\ProgramData\\WEVAL\\sentinel-agent.ps1"',
'Start-ScheduledTask -TaskName "WEVAL-Sentinel" -ErrorAction SilentlyContinue',
'# Verify after 60s:',
'curl https://weval-consulting.com/api/blade-status.json'
],
'expected' => 'last_seen updated within 60s (auto-sync interval)',
'impact_if_not' => 'Blade agent stays stale. No impact on core infra (S204 + S95 autonomous). Only loses local Razer dev monitoring.'
];
// Attempt programmatic wake via blade-agent.php relay (if Blade online locally at some pokey address)
$R['programmatic_wake_attempted'] = false;
$ch = curl_init('https://weval-consulting.com/api/blade-agent.php?k=BLADE2026&action=ping');
curl_setopt_array($ch, [CURLOPT_TIMEOUT=>3, CURLOPT_RETURNTRANSFER=>true, CURLOPT_SSL_VERIFYPEER=>false]);
$resp = curl_exec($ch);
$http = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$R['programmatic_wake_attempted'] = true;
$R['blade_agent_http'] = $http;
$R['blade_agent_response'] = substr((string)$resp, 0, 200);
echo json_encode($R, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);