feat(desktop): add verified install rollback and paged inspection
This commit is contained in:
+2
-9
@@ -14,6 +14,7 @@ import { ConfigImporter } from '../core/models/config-import.mjs';
|
||||
import { ProjectMemoryManager } from '../core/memory/project-memory.mjs';
|
||||
import { workerForProject, workerConflict, assertWorkersResolved } from '../shared/contracts/workers.mjs';
|
||||
import { hostAuthority } from '../core/desktop/host-authority.mjs';
|
||||
import { inspectOperations } from './operations.mjs';
|
||||
|
||||
export function createSessionPublisher(clients) {
|
||||
return session => {
|
||||
@@ -170,15 +171,7 @@ return async (request, response) => {
|
||||
}
|
||||
}
|
||||
if (method === 'GET' && route === '/api/operations') {
|
||||
const checks = [];
|
||||
const inspect = (id, title, action) => { try { checks.push({ id, title, status: 'passed', detail: action() }); } catch (cause) { checks.push({ id, title, status: 'failed', detail: provider.redact(cause.message) }); } };
|
||||
inspect('node', '执行宿主', () => { if (Number(process.versions.node.split('.')[0]) < 24) throw new Error('需要Node.js24或以上。'); return process.version + ' · PID ' + process.pid; });
|
||||
inspect('database', '任务数据库', () => { const rows = store.storage.database.prepare('PRAGMA quick_check').all(); if (rows.some(row => Object.values(row)[0] !== 'ok')) throw new Error('数据库一致性检查未通过。'); return 'SQLite quick_check通过;' + store.sessions.size + '个会话。'; });
|
||||
inspect('artifacts', '最近执行工件', () => { const values = [...store.core.artifact.values()].slice(-50); for (const value of values) store.artifactStore.readBytes(value); return '逐字节核对最近' + values.length + '个工件;更早记录未在本次范围内。'; });
|
||||
const center = provider.modelHub(store).view();
|
||||
checks.push({ id: 'models', title: '模型连接', status: center.connections.some(value => value.status === 'configured' && value.model) ? 'configured' : 'attention', detail: center.connections.filter(value => value.enabled).length + '个启用连接;配置状态与真实模型响应分别记录。' });
|
||||
return json(response, { version: APP_VERSION, checkedAt: new Date().toISOString(), checks, activeTasks: runtime.active.size,
|
||||
queue: center.waiting, modelAttempts: center.attempts.length, modelRequests: 0, scope: '本地只读巡检;不发送模型请求、不执行项目命令。' });
|
||||
return json(response, inspectOperations({ store, provider, runtime, server, appDirectory, version: APP_VERSION, parameters: url.searchParams }));
|
||||
}
|
||||
if (method === 'GET' && route === '/api/bootstrap') return json(response, {
|
||||
token, version: APP_VERSION, config: { ...store.config, hasKey: provider.hasKey() },
|
||||
|
||||
Reference in New Issue
Block a user