Implement resident app and bounded continuous diagnostics for 1.18.0; offline checks pass

这个提交包含在:
mac 于 2026-11-06 16:49:15 +08:00 提交
1 父节点 ecadafd8c3
当前提交 2b2a98d665
16 个文件已更改
+322 -98

没有与搜索条件相匹配的文件

@@ -12,10 +12,10 @@ final class Dayu_Color_Beta {
const EVENTS = array('process_start','process_exit','plugin_init','inspector_create','inspector_refresh',
'device_prepare','gpu_pipeline','first_render','render_error','main_thread_stall',
'operation_stall','previous_session_pending','crash_summary','registration','host_confirmed',
'update_check','update_download','update_validation','update_installer','diagnostic_summary');
'render','plugin_state','tracking_frame','process_health','performance_summary','hang_sample','update_check','update_download','update_validation','update_installer','diagnostic_summary');
const FIELDS = array('phase','stage','pipeline','duration_ms','status','error_domain','error_code',
'exception','signal','frames','report_time','count','pending','model','os_version','fcp_version',
'cpu_cores','memory_gb','gpu','main_delay_ms','active_stages','source_version');
'cpu_cores','memory_gb','gpu','main_delay_ms','active_stages','source_version','source_build','process_role','termination_namespace','termination_code','pid','resource_kind','memory_mb','cpu_percent','thread_count','uptime_s','max_duration_ms','average_ms','width','height','layer_count','mask_count','sample_status');
public static function boot() {
add_action('rest_api_init', array(__CLASS__, 'routes'));
@@ -90,7 +90,7 @@ final class Dayu_Color_Beta {
$out = array();
foreach (self::FIELDS as $key) {
if (!array_key_exists($key,$input) || !is_scalar($input[$key])) continue;
if (in_array($key,array('duration_ms','main_delay_ms','memory_gb','cpu_cores','count','pending','error_code'),true)) {
if (in_array($key,array('duration_ms','main_delay_ms','memory_gb','cpu_cores','count','pending','error_code','pid','termination_code','memory_mb','cpu_percent','thread_count','uptime_s','max_duration_ms','average_ms','width','height','layer_count','mask_count'),true)) {
if (is_numeric($input[$key]) && is_finite((float)$input[$key])) $out[$key]=max(-1000000,min(86400000,(float)$input[$key]));
continue;
}
@@ -165,15 +165,17 @@ final class Dayu_Color_Beta {
echo '<h2>公测更新</h2><p>'.($manifest?'当前版本:'.esc_html($manifest['version']).'('.esc_html($manifest['build']).')':'尚未发布更新包').'</p>';
echo '<h2>诊断事件</h2><form method="get"><input type="hidden" name="page" value="dayu-color-beta">';
foreach (array('build'=>'构建号','event'=>'事件','installation'=>'完整报告标识') as $key=>$label) echo '<label>'.esc_html($label).' <input name="'.esc_attr($key).'" value="'.esc_attr($request->get_param($key)).'"></label> ';
echo '<button class="button">筛选</button></form><table class="widefat striped"><thead><tr><th>时间(UTC)</th><th>版本</th><th>报告标识</th><th>来源/事件</th><th>内容</th></tr></thead><tbody>';
echo '<button class="button">筛选</button></form><table class="widefat striped"><thead><tr><th>时间(UTC)</th><th>上传版本 / 故障版本</th><th>报告标识</th><th>来源/事件</th><th>内容</th></tr></thead><tbody>';
foreach ($result['events'] as $row) {
echo '<tr><td>'.esc_html($row['occurred_at']).'<br>送达 '.esc_html($row['received_at']).'</td><td>'.esc_html($row['client_version'].' ('.$row['client_build'].')').'</td><td><code>'.esc_html($row['installation_id']).'</code><br>会话 '.esc_html(substr($row['session_id'],0,8)).'</td><td>'.esc_html($row['source'].' / '.$row['event']).'</td><td><pre style="white-space:pre-wrap;max-width:760px">'.esc_html(wp_json_encode(json_decode($row['fields_json'],true),JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE)).'</pre></td></tr>';
$fields=json_decode($row['fields_json'],true)?:array();
$crashed=$row['event']==='crash_summary' ? '<br>故障:'.esc_html(($fields['source_version']??'未知').' ('.($fields['source_build']??'未采集').')') : '';
echo '<tr><td>'.esc_html($row['occurred_at']).'<br>送达 '.esc_html($row['received_at']).'</td><td>'.esc_html($row['client_version'].' ('.$row['client_build'].')').$crashed.'</td><td><code>'.esc_html($row['installation_id']).'</code><br>会话 '.esc_html(substr($row['session_id'],0,8)).'</td><td>'.esc_html($row['source'].' / '.$row['event']).'</td><td><pre style="white-space:pre-wrap;max-width:760px">'.esc_html(wp_json_encode(json_decode($row['fields_json'],true),JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE)).'</pre></td></tr>';
}
echo '</tbody></table><p>';
$base=array('page'=>'dayu-color-beta','build'=>$request->get_param('build'),'event'=>$request->get_param('event'),'installation'=>$request->get_param('installation'));
if ($result['page']>1) echo '<a class="button" href="'.esc_url(add_query_arg(array_merge($base,array('paged'=>$result['page']-1)),admin_url('tools.php'))).'">上一页</a> ';
if (count($result['events'])===50) echo '<a class="button" href="'.esc_url(add_query_arg(array_merge($base,array('paged'=>$result['page']+1)),admin_url('tools.php'))).'">下一页</a>';
echo '</p><p>仅包含产品版本、环境、阶段耗时、错误代码及本插件崩溃摘要,不接收素材、预设、硬件UUID或账户凭据。</p></div>';
echo '</p><p>仅包含产品版本、环境、阶段耗时、资源使用、错误代码及本产品崩溃/卡顿调用栈摘要,不接收素材、预设、硬件UUID或账户凭据。</p></div>';
}
}
Dayu_Color_Beta::boot();