feat(ql3): expose worker observations in console

This commit is contained in:
whyour
2026-08-20 14:02:01 +08:00
parent af5d5bfc0b
commit 344680d64a
25 changed files with 840 additions and 49 deletions
@@ -8,8 +8,9 @@
run_cancellation_status: '/api/v1/run-management/cancellation-status',
run_cancellation_blocked_list:
'/api/v1/run-management/blocked-cancellations',
run_cancellation_inspect:
'/api/v1/run-management/cancellation-inspect',
run_cancellation_inspect: '/api/v1/run-management/cancellation-inspect',
worker_list: '/api/v1/worker-management/workers',
worker_inspect: '/api/v1/worker-management/worker',
run_list: '/api/v1/observe/run-list',
run_read: '/api/v1/observe/run',
run_event_list: '/api/v1/observe/run-events',
@@ -28,6 +29,8 @@
run_cancellation_status: '取消可用性',
run_cancellation_blocked_list: 'Blocked Cancellations',
run_cancellation_inspect: '取消诊断',
worker_list: 'Worker 目录',
worker_inspect: 'Worker 详情',
run_list: 'Run 目录',
run_read: 'Run 详情',
run_event_list: 'Run Events',
@@ -124,6 +127,10 @@
result.cursor = null;
} else if (operation === 'run_cancellation_inspect') {
result.runId = value('cancellation-run-id');
} else if (operation === 'worker_list') {
result.afterWorkerId = null;
} else if (operation === 'worker_inspect') {
result.workerId = value('worker-id');
} else if (operation === 'run_list') {
result.afterCreatedAtMs = null;
result.afterRunId = null;
@@ -176,6 +183,11 @@
typeof fact.nextCursor === 'string'
) {
next.cursor = fact.nextCursor;
} else if (
operation === 'worker_list' &&
typeof fact.nextAfterWorkerId === 'string'
) {
next.afterWorkerId = fact.nextAfterWorkerId;
} else if (operation === 'run_list' && fact.hasMore === true && fact.next) {
next.afterCreatedAtMs = fact.next.createdAtMs;
next.afterRunId = fact.next.runId;
@@ -234,6 +246,20 @@
entry.append(button);
return;
}
if (operation === 'worker_list' && Array.isArray(fact.workers)) {
fact.workers.forEach(function (worker) {
if (!worker || typeof worker.workerId !== 'string') return;
const button = document.createElement('button');
button.type = 'button';
button.textContent = '显式检查 ' + worker.workerId;
button.addEventListener('click', function () {
document.getElementById('worker-id').value = worker.workerId;
void execute('worker_inspect');
});
entry.append(button);
});
return;
}
if (
operation !== 'run_cancellation_blocked_list' ||
!Array.isArray(fact.items)
@@ -31,6 +31,8 @@
'run_cancellation_status',
'run_cancellation_blocked_list',
'run_cancellation_inspect',
'worker_list',
'worker_inspect',
'run_list',
'run_read',
'run_event_list',
@@ -50,6 +52,8 @@
run_cancellation_status: ['projectId', 'requestId'],
run_cancellation_blocked_list: ['cursor', 'projectId', 'requestId'],
run_cancellation_inspect: ['projectId', 'requestId', 'runId'],
worker_list: ['afterWorkerId', 'projectId', 'requestId'],
worker_inspect: ['projectId', 'requestId', 'workerId'],
run_list: [
'afterCreatedAtMs',
'afterRunId',
@@ -117,6 +121,7 @@
afterStepKey: 'step',
afterStepRunId: 'step',
afterTaskId: 'task',
afterWorkerId: 'worker',
artifactId: 'artifact',
attemptId: 'attempt',
contentDigest: 'digest',
@@ -125,6 +130,7 @@
executionId: 'execution',
id: 'identifier',
modelId: 'model',
nextAfterWorkerId: 'worker',
outputRef: 'artifact',
packageName: 'package',
projectId: 'project',
@@ -160,6 +166,10 @@
'target',
'task',
'tasks',
'declaredCapacity',
'runtimes',
'worker',
'workers',
'usage',
'workflow',
'workflows',
@@ -170,6 +180,7 @@
'available',
'cancelRequested',
'enabled',
'found',
'hasMore',
'outputAvailable',
'ready',
@@ -183,6 +194,9 @@
'assessment',
'cancelReason',
'kind',
'architecture',
'compatibility',
'lifecycle',
'lastResult',
'operation',
'operatorAction',
@@ -191,6 +205,8 @@
'severity',
'stage',
'status',
'supportTier',
'operatingSystem',
]);
const safeEnumValues = new Set([
'accepted',
@@ -198,6 +214,13 @@
'admission',
'attention_required',
'available',
'amd64',
'arm64',
'ppc64le',
's390x',
'arm/v7',
'arm/v6',
'386',
'blocked',
'cancelled',
'completed',
@@ -208,6 +231,22 @@
'dispatch',
'dispatching',
'disabled',
'default_placement',
'explicit_placement_required',
'protocol_incompatible',
'online',
'draining',
'offline',
'lease_expired',
'tier1',
'candidate',
'experimental',
'legacy-only',
'linux',
'darwin',
'win32',
'freebsd',
'aix',
'enabled',
'execution',
'failed',
@@ -269,7 +308,7 @@
const freeTextKey =
/text|content|stdout|stderr|command|input|output|environment|reason|error|message|description|name|path|url|uri|host|endpoint/iu;
const numericKey =
/^(?:schemaVersion|version|revision|sequence|attempt|priority|limit|offset|size|total|count|exitCode|pending|leased|retryWait|dispatched|blocked|due|expiredLease|identityMismatch|pidMismatch|unsupported|invalid|[A-Za-z0-9_]*(?:AtMs|TimeMs|DurationMs|Bytes|Tokens|Micros|Sequence|Version|Count|Limit|Offset|Size|Total))$/u;
/^(?:schemaVersion|version|revision|sequence|attempt|priority|limit|offset|size|total|count|exitCode|pending|leased|retryWait|dispatched|blocked|due|expiredLease|identityMismatch|pidMismatch|unsupported|invalid|availableSlots|maxConcurrentRuns|cpuCores|[A-Za-z0-9_]*(?:AtMs|TimeMs|DurationMs|Bytes|Tokens|Micros|Sequence|Version|Count|Limit|Offset|Size|Total))$/u;
const schemaValue = /^[a-z0-9][a-z0-9./_-]{0,126}@[a-z0-9._-]{1,16}$/u;
class ClusterConsoleEvidenceBundleError extends TypeError {
@@ -24,7 +24,7 @@
<div class="boundary" aria-label="当前权限边界">
<span class="boundary-dot" aria-hidden="true"></span>
<span>本机只读 BFF</span>
<strong>Run · Task · Workflow · Copilot · Optional management</strong>
<strong>Run · Task · Workflow · Worker · Copilot</strong>
</div>
</header>
@@ -52,6 +52,7 @@
<nav class="mode-tabs" aria-label="观察面">
<button type="button" class="mode-tab active" data-panel="runtime-panel" aria-pressed="true">运行态</button>
<button type="button" class="mode-tab" data-panel="management-panel" aria-pressed="false">取消可用性</button>
<button type="button" class="mode-tab" data-panel="worker-panel" aria-pressed="false">Worker</button>
<button type="button" class="mode-tab" data-panel="workflow-panel" aria-pressed="false">工作流</button>
<button type="button" class="mode-tab" data-panel="copilot-panel" aria-pressed="false">Copilot</button>
</nav>
@@ -80,6 +81,20 @@
</div>
</section>
<section id="worker-panel" class="mode-panel" hidden>
<div class="control-group">
<div class="control-title"><span>01</span><strong>Worker 目录</strong></div>
<button type="button" class="primary" data-read="worker_list">读取首屏 Workers</button>
<p class="field-note">只有启动进程显式提供独立 Worker management 配置与短期 assertion 时可用;固定 16 项,下一页必须再次点击。</p>
</div>
<div class="control-group">
<div class="control-title"><span>02</span><strong>单 Worker 状态</strong></div>
<input id="worker-id" type="text" maxlength="128" autocomplete="off" spellcheck="false" placeholder="worker-id" />
<button type="button" data-read="worker_inspect">读取 Worker 详情</button>
<p class="field-note">只投影在线状态、兼容性、架构与容量;没有 credential、drain、revoke 或调度 mutation。</p>
</div>
</section>
<section id="management-panel" class="mode-panel" hidden>
<div class="control-group">
<div class="control-title"><span>01</span><strong>Project 状态</strong></div>
@@ -130,7 +145,7 @@
<aside class="trust-note">
<span>Authority boundary</span>
<p>Project credential可选 Run management authority 只由本机进程从彼此独立的私有文件读取。浏览器无法提交任意路径,也没有 start、stop、retry、rearm 或 diagnose 权限入口。脱敏导出只处理本页已读事实,不补读或上传。</p>
<p>Project credential可选 Run authority 与可选 Worker authority 只由本机进程从彼此独立的私有文件读取。浏览器无法提交任意路径,也没有 start、stop、retry、rearm、drain、revoke 或 diagnose 权限入口。脱敏导出只处理本页已读事实,不补读或上传。</p>
</aside>
</aside>
@@ -161,7 +176,7 @@
<footer>
<span>Loopback only · explicit reads · zero polling</span>
<span>QingLong 3.0 incubation / D-369</span>
<span>QingLong 3.0 incubation / D-375</span>
</footer>
</div>
</body>