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
@@ -33,6 +33,8 @@ const OPERATIONS = Object.freeze([
'run_cancellation_status',
'run_cancellation_blocked_list',
'run_cancellation_inspect',
'worker_list',
'worker_inspect',
'run_list',
'run_read',
'run_event_list',
@@ -62,6 +64,8 @@ const REQUEST_FIELDS: Readonly<Record<EvidenceOperation, readonly string[]>> =
'requestId',
'runId',
]),
worker_list: Object.freeze(['afterWorkerId', 'projectId', 'requestId']),
worker_inspect: Object.freeze(['projectId', 'requestId', 'workerId']),
run_list: Object.freeze([
'afterCreatedAtMs',
'afterRunId',
@@ -134,6 +138,7 @@ const IDENTIFIER_DOMAINS: Readonly<Record<string, string>> = Object.freeze({
afterStepKey: 'step',
afterStepRunId: 'step',
afterTaskId: 'task',
afterWorkerId: 'worker',
artifactId: 'artifact',
attemptId: 'attempt',
contentDigest: 'digest',
@@ -142,6 +147,7 @@ const IDENTIFIER_DOMAINS: Readonly<Record<string, string>> = Object.freeze({
executionId: 'execution',
id: 'identifier',
modelId: 'model',
nextAfterWorkerId: 'worker',
outputRef: 'artifact',
packageName: 'package',
projectId: 'project',
@@ -177,6 +183,10 @@ const SAFE_CONTAINERS = new Set([
'target',
'task',
'tasks',
'declaredCapacity',
'runtimes',
'worker',
'workers',
'usage',
'workflow',
'workflows',
@@ -187,6 +197,7 @@ const SAFE_BOOLEANS = new Set([
'available',
'cancelRequested',
'enabled',
'found',
'hasMore',
'outputAvailable',
'ready',
@@ -199,8 +210,11 @@ const SAFE_ENUM_KEYS = new Set([
'assessment',
'cancelReason',
'finishReason',
'architecture',
'compatibility',
'kind',
'lastResult',
'lifecycle',
'operation',
'operatorAction',
'outcome',
@@ -208,6 +222,8 @@ const SAFE_ENUM_KEYS = new Set([
'severity',
'stage',
'status',
'supportTier',
'operatingSystem',
]);
const SAFE_ENUM_VALUES = new Set([
'accepted',
@@ -215,6 +231,13 @@ const SAFE_ENUM_VALUES = new Set([
'admission',
'attention_required',
'available',
'amd64',
'arm64',
'ppc64le',
's390x',
'arm/v7',
'arm/v6',
'386',
'blocked',
'cancelled',
'completed',
@@ -225,6 +248,22 @@ const SAFE_ENUM_VALUES = new Set([
'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',
@@ -282,7 +321,7 @@ const SAFE_ENUM_VALUES = new Set([
'workflow',
]);
const NUMERIC_KEY =
/^(?: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 SCHEMA_VALUE = /^[a-z0-9][a-z0-9./_-]{0,126}@[a-z0-9._-]{1,16}$/u;
const SHA256 = /^[0-9a-f]{64}$/u;
const CONTROL = /[\0-\x1f\x7f]/u;