feat(ql3): add optional console run drilldown

This commit is contained in:
whyour
2026-08-20 09:23:19 +08:00
parent cf21e984cb
commit 0a5f1448f1
29 changed files with 1193 additions and 68 deletions
@@ -30,6 +30,9 @@ const LIMITS = Object.freeze({
const OPERATIONS = Object.freeze([
'inspect',
'output',
'run_cancellation_status',
'run_cancellation_blocked_list',
'run_cancellation_inspect',
'run_list',
'run_read',
'run_event_list',
@@ -48,6 +51,17 @@ const REQUEST_FIELDS: Readonly<Record<EvidenceOperation, readonly string[]>> =
Object.freeze({
inspect: Object.freeze(['projectId', 'requestId', 'sourceRunId']),
output: Object.freeze(['projectId', 'requestId', 'sourceRunId']),
run_cancellation_status: Object.freeze(['projectId', 'requestId']),
run_cancellation_blocked_list: Object.freeze([
'cursor',
'projectId',
'requestId',
]),
run_cancellation_inspect: Object.freeze([
'projectId',
'requestId',
'runId',
]),
run_list: Object.freeze([
'afterCreatedAtMs',
'afterRunId',
@@ -121,7 +135,9 @@ const IDENTIFIER_DOMAINS: Readonly<Record<string, string>> = Object.freeze({
afterStepRunId: 'step',
afterTaskId: 'task',
artifactId: 'artifact',
attemptId: 'attempt',
contentDigest: 'digest',
cursor: 'cursor',
diagnosisRunId: 'run',
executionId: 'execution',
id: 'identifier',
@@ -142,7 +158,10 @@ const IDENTIFIER_DOMAINS: Readonly<Record<string, string>> = Object.freeze({
});
const SAFE_CONTAINERS = new Set([
'attempts',
'blockingResults',
'counts',
'dispatch',
'dispatches',
'events',
'items',
'metadata',
@@ -151,6 +170,7 @@ const SAFE_CONTAINERS = new Set([
'run',
'runs',
'source',
'signals',
'step',
'steps',
'summary',
@@ -176,10 +196,16 @@ const SAFE_BOOLEANS = new Set([
'truncated',
]);
const SAFE_ENUM_KEYS = new Set([
'assessment',
'cancelReason',
'finishReason',
'kind',
'lastResult',
'operation',
'operatorAction',
'outcome',
'runStatus',
'severity',
'stage',
'status',
]);
@@ -187,11 +213,15 @@ const SAFE_ENUM_VALUES = new Set([
'accepted',
'active',
'admission',
'attention_required',
'available',
'blocked',
'cancelled',
'completed',
'completion',
'converging',
'critical',
'clear',
'dispatch',
'dispatching',
'disabled',
@@ -200,12 +230,18 @@ const SAFE_ENUM_VALUES = new Set([
'failed',
'finalization',
'installed',
'inspect',
'invalid',
'identity_mismatch',
'local',
'lost',
'missing',
'model',
'none',
'not_found',
'pending',
'pid_mismatch',
'policy',
'post_model',
'pre_model',
'prompt',
@@ -213,6 +249,8 @@ const SAFE_ENUM_VALUES = new Set([
'queued',
'ready',
'recovery',
'rearm',
'reconcile',
'rejected',
'remote',
'retained',
@@ -226,18 +264,25 @@ const SAFE_ENUM_VALUES = new Set([
'step',
'stop',
'succeeded',
'shutdown',
'system',
'task',
'terminal',
'timed_out',
'timeout',
'tool',
'trigger',
'unknown',
'unsupported',
'user',
'wait',
'warning',
'ok',
'unavailable',
'workflow',
]);
const NUMERIC_KEY =
/^(?:schemaVersion|version|revision|sequence|attempt|priority|limit|offset|size|total|count|[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|[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;