rivet-design 0.11.13 → 0.11.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/flags.d.ts +1 -1
- package/dist/config/flags.js +1 -1
- package/dist/config/proxy.d.ts +6 -0
- package/dist/config/proxy.d.ts.map +1 -1
- package/dist/config/proxy.js +36 -19
- package/dist/config/proxy.js.map +1 -1
- package/dist/install/harnesses.d.ts.map +1 -1
- package/dist/install/harnesses.js +78 -42
- package/dist/install/harnesses.js.map +1 -1
- package/dist/mcp/agent-variants/WorktreeOrchestrator.d.ts +29 -0
- package/dist/mcp/agent-variants/WorktreeOrchestrator.d.ts.map +1 -1
- package/dist/mcp/agent-variants/WorktreeOrchestrator.js +472 -8
- package/dist/mcp/agent-variants/WorktreeOrchestrator.js.map +1 -1
- package/dist/mcp/agent-variants/WorktreeOrchestrator.testHelpers.d.ts.map +1 -1
- package/dist/mcp/agent-variants/WorktreeOrchestrator.testHelpers.js +64 -0
- package/dist/mcp/agent-variants/WorktreeOrchestrator.testHelpers.js.map +1 -1
- package/dist/mcp/agent-variants/contracts.d.ts +378 -378
- package/dist/mcp/agent-variants/tools.d.ts +29 -1
- package/dist/mcp/agent-variants/tools.d.ts.map +1 -1
- package/dist/mcp/agent-variants/tools.js +142 -13
- package/dist/mcp/agent-variants/tools.js.map +1 -1
- package/dist/mcp/auth/tools.d.ts.map +1 -1
- package/dist/mcp/auth/tools.js +68 -2
- package/dist/mcp/auth/tools.js.map +1 -1
- package/dist/mcp/server.d.ts +54 -2
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +190 -41
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/toolAnalytics.d.ts +15 -0
- package/dist/mcp/toolAnalytics.d.ts.map +1 -0
- package/dist/mcp/toolAnalytics.js +87 -0
- package/dist/mcp/toolAnalytics.js.map +1 -0
- package/dist/onboarding/signin.d.ts +10 -0
- package/dist/onboarding/signin.d.ts.map +1 -1
- package/dist/onboarding/signin.js +41 -3
- package/dist/onboarding/signin.js.map +1 -1
- package/dist/routes/agentVariants.d.ts +2 -2
- package/dist/routes/agentVariants.d.ts.map +1 -1
- package/dist/routes/agentVariants.js +12 -7
- package/dist/routes/agentVariants.js.map +1 -1
- package/dist/routes/mcp.d.ts.map +1 -1
- package/dist/routes/mcp.js +153 -2
- package/dist/routes/mcp.js.map +1 -1
- package/dist/server.d.ts +6 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +52 -37
- package/dist/server.js.map +1 -1
- package/dist/services/BridgeBatchPipeline.d.ts +4 -0
- package/dist/services/BridgeBatchPipeline.d.ts.map +1 -1
- package/dist/services/BridgeBatchPipeline.js +18 -1
- package/dist/services/BridgeBatchPipeline.js.map +1 -1
- package/dist/services/MCPOnboardingTelemetry.d.ts +41 -0
- package/dist/services/MCPOnboardingTelemetry.d.ts.map +1 -0
- package/dist/services/MCPOnboardingTelemetry.js +158 -0
- package/dist/services/MCPOnboardingTelemetry.js.map +1 -0
- package/dist/services/MCPVariantsTelemetry.d.ts +59 -0
- package/dist/services/MCPVariantsTelemetry.d.ts.map +1 -0
- package/dist/services/MCPVariantsTelemetry.js +153 -0
- package/dist/services/MCPVariantsTelemetry.js.map +1 -0
- package/dist/services/SessionBridgeService.d.ts +28 -7
- package/dist/services/SessionBridgeService.d.ts.map +1 -1
- package/dist/services/SessionBridgeService.js +46 -9
- package/dist/services/SessionBridgeService.js.map +1 -1
- package/dist/services/TelemetryService.d.ts +108 -0
- package/dist/services/TelemetryService.d.ts.map +1 -1
- package/dist/services/TelemetryService.js +269 -1
- package/dist/services/TelemetryService.js.map +1 -1
- package/dist/services/WorktreeManager.d.ts.map +1 -1
- package/dist/services/WorktreeManager.js +3 -0
- package/dist/services/WorktreeManager.js.map +1 -1
- package/package.json +2 -2
- package/src/ui/dist/assets/main-CNVy90lr.css +1 -0
- package/src/ui/dist/assets/main-tL2Lt1OL.js +655 -0
- package/src/ui/dist/index.html +2 -2
- package/src/ui/dist/assets/main-DREt3GGU.css +0 -1
- package/src/ui/dist/assets/main-Dt7ShmjM.js +0 -655
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.summarizeMCPConversationTurn = exports.normalizeMCPFailureReason = exports.categorizeMCPHandoffPath = void 0;
|
|
4
|
+
const hasPathSegment = (pathname, segment) => pathname.split('/').filter(Boolean).includes(segment);
|
|
5
|
+
/**
|
|
6
|
+
* Categorizes an onboarding handoff URL without returning raw URL components.
|
|
7
|
+
*/
|
|
8
|
+
const categorizeMCPHandoffPath = (input) => {
|
|
9
|
+
if (!input) {
|
|
10
|
+
return 'unknown';
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
const parsed = input instanceof URL ? input : new URL(input);
|
|
14
|
+
const hostname = parsed.hostname.toLowerCase();
|
|
15
|
+
const pathname = parsed.pathname.toLowerCase();
|
|
16
|
+
const protocol = parsed.protocol.toLowerCase();
|
|
17
|
+
const isLoopback = hostname === 'localhost' ||
|
|
18
|
+
hostname === '127.0.0.1' ||
|
|
19
|
+
hostname === '::1';
|
|
20
|
+
if (protocol === 'rivet:' || hasPathSegment(pathname, 'desktop')) {
|
|
21
|
+
return 'desktop';
|
|
22
|
+
}
|
|
23
|
+
if (pathname.includes('callback') ||
|
|
24
|
+
pathname.endsWith('/complete') ||
|
|
25
|
+
pathname.includes('/oauth/')) {
|
|
26
|
+
return 'oauth_callback';
|
|
27
|
+
}
|
|
28
|
+
if (isLoopback && hasPathSegment(pathname, 'rivet')) {
|
|
29
|
+
return 'local_rivet';
|
|
30
|
+
}
|
|
31
|
+
if (hasPathSegment(pathname, 'connect') ||
|
|
32
|
+
pathname.includes('mcp-client-connect')) {
|
|
33
|
+
return 'mcp_client_connect';
|
|
34
|
+
}
|
|
35
|
+
if (hasPathSegment(pathname, 'try')) {
|
|
36
|
+
return 'hosted_demo';
|
|
37
|
+
}
|
|
38
|
+
if (hostname.endsWith('rivet.design') || hostname.includes('rivet')) {
|
|
39
|
+
return 'landing';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return 'unknown';
|
|
44
|
+
}
|
|
45
|
+
return 'unknown';
|
|
46
|
+
};
|
|
47
|
+
exports.categorizeMCPHandoffPath = categorizeMCPHandoffPath;
|
|
48
|
+
/**
|
|
49
|
+
* Maps errors to coarse analytics buckets without preserving raw messages.
|
|
50
|
+
*/
|
|
51
|
+
const normalizeMCPFailureReason = (input) => {
|
|
52
|
+
const text = input instanceof Error
|
|
53
|
+
? `${input.name} ${input.message}`
|
|
54
|
+
: String(input ?? '');
|
|
55
|
+
const normalized = text.toLowerCase();
|
|
56
|
+
if (normalized.includes('timeout') || normalized.includes('timed out')) {
|
|
57
|
+
return 'timeout';
|
|
58
|
+
}
|
|
59
|
+
if (normalized.includes('auth_required') ||
|
|
60
|
+
normalized.includes('authentication required')) {
|
|
61
|
+
return 'auth_required';
|
|
62
|
+
}
|
|
63
|
+
if (normalized.includes('missing code')) {
|
|
64
|
+
return 'missing_code';
|
|
65
|
+
}
|
|
66
|
+
if (normalized.includes('missing state')) {
|
|
67
|
+
return 'missing_state';
|
|
68
|
+
}
|
|
69
|
+
if (normalized.includes('state mismatch')) {
|
|
70
|
+
return 'state_mismatch';
|
|
71
|
+
}
|
|
72
|
+
if (normalized.includes('credential') ||
|
|
73
|
+
normalized.includes('store auth') ||
|
|
74
|
+
normalized.includes('write failed')) {
|
|
75
|
+
return 'credential_store_failed';
|
|
76
|
+
}
|
|
77
|
+
if (normalized.includes('network') ||
|
|
78
|
+
normalized.includes('fetch') ||
|
|
79
|
+
normalized.includes('econn')) {
|
|
80
|
+
return 'network_error';
|
|
81
|
+
}
|
|
82
|
+
if (normalized.includes('invalid response') ||
|
|
83
|
+
normalized.includes('invalid oauth callback') ||
|
|
84
|
+
normalized.includes('missing session')) {
|
|
85
|
+
return 'invalid_response';
|
|
86
|
+
}
|
|
87
|
+
if (normalized.includes('exchange') ||
|
|
88
|
+
normalized.includes('authentication failed')) {
|
|
89
|
+
return 'exchange_failed';
|
|
90
|
+
}
|
|
91
|
+
return 'unknown';
|
|
92
|
+
};
|
|
93
|
+
exports.normalizeMCPFailureReason = normalizeMCPFailureReason;
|
|
94
|
+
const commentElements = (item) => [
|
|
95
|
+
item.element,
|
|
96
|
+
...(item.elements ?? []),
|
|
97
|
+
];
|
|
98
|
+
const getTargetKind = (isStaticPreviewTarget, isVariantTarget) => {
|
|
99
|
+
if (isStaticPreviewTarget) {
|
|
100
|
+
return 'static_preview';
|
|
101
|
+
}
|
|
102
|
+
if (isVariantTarget) {
|
|
103
|
+
return 'variant';
|
|
104
|
+
}
|
|
105
|
+
return 'app';
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Builds metadata-only UI-to-agent send counts for MCP queue telemetry.
|
|
109
|
+
*/
|
|
110
|
+
const summarizeMCPConversationTurn = (request, round, sessionId) => {
|
|
111
|
+
let messageCount = 0;
|
|
112
|
+
let instructionLengthTotal = 0;
|
|
113
|
+
let maxInstructionLength = 0;
|
|
114
|
+
let imageCount = 0;
|
|
115
|
+
let elementCount = 0;
|
|
116
|
+
let isVariantTarget = Boolean(request.target);
|
|
117
|
+
let isStaticPreviewTarget = Boolean(request.staticPreviewTarget);
|
|
118
|
+
for (const item of request.changes) {
|
|
119
|
+
if (item.kind === 'comment') {
|
|
120
|
+
messageCount++;
|
|
121
|
+
instructionLengthTotal += item.instruction.length;
|
|
122
|
+
maxInstructionLength = Math.max(maxInstructionLength, item.instruction.length);
|
|
123
|
+
imageCount += item.images?.length ?? 0;
|
|
124
|
+
elementCount += commentElements(item).length;
|
|
125
|
+
isVariantTarget = isVariantTarget || Boolean(item.target);
|
|
126
|
+
isStaticPreviewTarget =
|
|
127
|
+
isStaticPreviewTarget || Boolean(item.staticPreviewTarget);
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (item.kind === 'chat') {
|
|
131
|
+
messageCount++;
|
|
132
|
+
instructionLengthTotal += item.instruction.length;
|
|
133
|
+
maxInstructionLength = Math.max(maxInstructionLength, item.instruction.length);
|
|
134
|
+
imageCount += item.images?.length ?? 0;
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if ('element' in item) {
|
|
138
|
+
elementCount++;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
sessionId,
|
|
143
|
+
round,
|
|
144
|
+
messageCount,
|
|
145
|
+
instructionLengthTotal,
|
|
146
|
+
maxInstructionLength,
|
|
147
|
+
imageCount,
|
|
148
|
+
elementCount,
|
|
149
|
+
sourceFileCount: new Set(request.sourceFiles ?? []).size,
|
|
150
|
+
targetKind: getTargetKind(isStaticPreviewTarget, isVariantTarget),
|
|
151
|
+
traceId: request.traceId,
|
|
152
|
+
agentRunId: request.agentRunId,
|
|
153
|
+
browserSessionId: request.telemetryContext?.browserSessionId,
|
|
154
|
+
browserDistinctId: request.telemetryContext?.browserDistinctId,
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
exports.summarizeMCPConversationTurn = summarizeMCPConversationTurn;
|
|
158
|
+
//# sourceMappingURL=MCPOnboardingTelemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MCPOnboardingTelemetry.js","sourceRoot":"","sources":["../../src/services/MCPOnboardingTelemetry.ts"],"names":[],"mappings":";;;AAkDA,MAAM,cAAc,GAAG,CAAC,QAAgB,EAAE,OAAe,EAAW,EAAE,CACpE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAExD;;GAEG;AACI,MAAM,wBAAwB,GAAG,CACtC,KAAsC,EACd,EAAE;IAC1B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,M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e,EAAE,IAAI,GAAG,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI;QACxD,UAAU,EAAE,aAAa,CAAC,qBAAqB,EAAE,eAAe,CAAC;QACjE,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,EAAE,gBAAgB;QAC5D,iBAAiB,EAAE,OAAO,CAAC,gBAAgB,EAAE,iBAAiB;KAC/D,CAAC;AACJ,CAAC,CAAC;AA1DW,QAAA,4BAA4B,gCA0DvC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export type MCPVariantsEntryPoint = 'mcp_tool' | 'visual_editor_comment' | 'variants_panel' | 'history' | 'watch_loop' | 'route' | 'unknown';
|
|
2
|
+
export type MCPVariantsMode = 'initial_generation' | 'zero_to_one' | 'source_grounded' | 'comment_refine' | 'vary' | 'history_adoption' | 'commit' | 'unknown';
|
|
3
|
+
export type MCPVariantsProjectContextKind = 'existing' | 'fresh';
|
|
4
|
+
export type MCPVariantsRunTopology = 'code_gen' | 'static_preview';
|
|
5
|
+
export type MCPVariantsPreviewKind = 'dev_server' | 'static_artifact';
|
|
6
|
+
export type MCPVariantsRequestStatus = 'accepted' | 'rejected' | 'completed' | 'failed' | 'cancelled' | 'degraded' | 'superseded';
|
|
7
|
+
export type MCPVariantsFailureReason = 'ack_failed' | 'active_session' | 'destination_not_empty' | 'feature_disabled' | 'invalid_stage_action' | 'lease_expired' | 'missing_artifact' | 'missing_required_input' | 'pending_change_conflict' | 'queue_full' | 'runtime_validation_failed' | 'schema_validation_failed' | 'source_context_invalid' | 'target_not_editable' | 'timeout' | 'unknown' | 'work_item_not_found';
|
|
8
|
+
export type MCPVariantsTelemetryMetadata = {
|
|
9
|
+
sessionId?: string;
|
|
10
|
+
requestId?: string;
|
|
11
|
+
traceId?: string;
|
|
12
|
+
agentRunId?: string;
|
|
13
|
+
roundIndex?: number;
|
|
14
|
+
targetVariantId?: string;
|
|
15
|
+
sourceVariantId?: string;
|
|
16
|
+
workItemId?: string;
|
|
17
|
+
leaseId?: string;
|
|
18
|
+
entryPoint?: MCPVariantsEntryPoint;
|
|
19
|
+
mode?: MCPVariantsMode;
|
|
20
|
+
projectContextKind?: MCPVariantsProjectContextKind;
|
|
21
|
+
runTopology?: MCPVariantsRunTopology;
|
|
22
|
+
previewKind?: MCPVariantsPreviewKind;
|
|
23
|
+
requestStatus?: MCPVariantsRequestStatus;
|
|
24
|
+
requestedCount?: number;
|
|
25
|
+
acceptedCount?: number;
|
|
26
|
+
rejectedCount?: number;
|
|
27
|
+
approvedCount?: number;
|
|
28
|
+
workItemCount?: number;
|
|
29
|
+
completedCount?: number;
|
|
30
|
+
failedCount?: number;
|
|
31
|
+
cancelledCount?: number;
|
|
32
|
+
commentCount?: number;
|
|
33
|
+
imageCount?: number;
|
|
34
|
+
sourceCount?: number;
|
|
35
|
+
briefCount?: number;
|
|
36
|
+
briefLabelCount?: number;
|
|
37
|
+
sourceUrlCount?: number;
|
|
38
|
+
sourceFileCount?: number;
|
|
39
|
+
sourceDirectoryCount?: number;
|
|
40
|
+
sourceTextCount?: number;
|
|
41
|
+
actionCount?: number;
|
|
42
|
+
metadataCount?: number;
|
|
43
|
+
bindingCount?: number;
|
|
44
|
+
resultVariantCount?: number;
|
|
45
|
+
changedFilesCount?: number;
|
|
46
|
+
instructionLength?: number;
|
|
47
|
+
commentLength?: number;
|
|
48
|
+
durationMs?: number;
|
|
49
|
+
dwellMs?: number;
|
|
50
|
+
queueWaitMs?: number;
|
|
51
|
+
leaseDurationMs?: number;
|
|
52
|
+
failureReason?: unknown;
|
|
53
|
+
};
|
|
54
|
+
export declare const VARIANTS_SENSITIVE_TELEMETRY_KEYS: readonly ["prompt", "instruction", "comment", "brief", "brief_body", "brief_label", "source_text", "url", "final_url", "path", "file_path", "destination_path", "html", "code", "diff", "dom_text", "screenshot", "image", "arguments", "response", "error_message"];
|
|
55
|
+
/** Reduces variants failures to stable analytics enums without storing messages. */
|
|
56
|
+
export declare const normalizeMCPVariantsFailureReason: (input: unknown) => MCPVariantsFailureReason;
|
|
57
|
+
/** Builds the shared metadata-only variants telemetry payload. */
|
|
58
|
+
export declare const buildMCPVariantsTelemetryProperties: (data: MCPVariantsTelemetryMetadata) => Record<string, unknown>;
|
|
59
|
+
//# sourceMappingURL=MCPVariantsTelemetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MCPVariantsTelemetry.d.ts","sourceRoot":"","sources":["../../src/services/MCPVariantsTelemetry.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAC7B,UAAU,GACV,uBAAuB,GACvB,gBAAgB,GAChB,SAAS,GACT,YAAY,GACZ,OAAO,GACP,SAAS,CAAC;AAEd,MAAM,MAAM,eAAe,GACvB,oBAAoB,GACpB,aAAa,GACb,iBAAiB,GACjB,gBAAgB,GAChB,MAAM,GACN,kBAAkB,GAClB,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,MAAM,6BAA6B,GAAG,UAAU,GAAG,OAAO,CAAC;AACjE,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,gBAAgB,CAAC;AACnE,MAAM,MAAM,sBAAsB,GAAG,YAAY,GAAG,iBAAiB,CAAC;AACtE,MAAM,MAAM,wBAAwB,GAChC,UAAU,GACV,UAAU,GACV,WAAW,GACX,QAAQ,GACR,WAAW,GACX,UAAU,GACV,YAAY,CAAC;AAEjB,MAAM,MAAM,wBAAwB,GAChC,YAAY,GACZ,gBAAgB,GAChB,uBAAuB,GACvB,kBAAkB,GAClB,sBAAsB,GACtB,eAAe,GACf,kBAAkB,GAClB,wBAAwB,GACxB,yBAAyB,GACzB,YAAY,GACZ,2BAA2B,GAC3B,0BAA0B,GAC1B,wBAAwB,GACxB,qBAAqB,GACrB,SAAS,GACT,SAAS,GACT,qBAAqB,CAAC;AAE1B,MAAM,MAAM,4BAA4B,GA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AAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,iCAAiC,sQAsBpC,CAAC;AA8BX,oFAAoF;AACpF,eAAO,MAAM,iCAAiC,GAC5C,OAAO,OAAO,KACb,wBAiCF,CAAC;AAYF,kEAAkE;AAClE,eAAO,MAAM,mCAAmC,GAC9C,MAAM,4BAA4B,KACjC,MAAM,CAAC,MAAM,EAAE,OAAO,CAmDxB,CAAC"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildMCPVariantsTelemetryProperties = exports.normalizeMCPVariantsFailureReason = exports.VARIANTS_SENSITIVE_TELEMETRY_KEYS = void 0;
|
|
4
|
+
exports.VARIANTS_SENSITIVE_TELEMETRY_KEYS = [
|
|
5
|
+
'prompt',
|
|
6
|
+
'instruction',
|
|
7
|
+
'comment',
|
|
8
|
+
'brief',
|
|
9
|
+
'brief_body',
|
|
10
|
+
'brief_label',
|
|
11
|
+
'source_text',
|
|
12
|
+
'url',
|
|
13
|
+
'final_url',
|
|
14
|
+
'path',
|
|
15
|
+
'file_path',
|
|
16
|
+
'destination_path',
|
|
17
|
+
'html',
|
|
18
|
+
'code',
|
|
19
|
+
'diff',
|
|
20
|
+
'dom_text',
|
|
21
|
+
'screenshot',
|
|
22
|
+
'image',
|
|
23
|
+
'arguments',
|
|
24
|
+
'response',
|
|
25
|
+
'error_message',
|
|
26
|
+
];
|
|
27
|
+
const KNOWN_FAILURE_REASONS = new Set([
|
|
28
|
+
'ack_failed',
|
|
29
|
+
'active_session',
|
|
30
|
+
'destination_not_empty',
|
|
31
|
+
'feature_disabled',
|
|
32
|
+
'invalid_stage_action',
|
|
33
|
+
'lease_expired',
|
|
34
|
+
'missing_artifact',
|
|
35
|
+
'missing_required_input',
|
|
36
|
+
'pending_change_conflict',
|
|
37
|
+
'queue_full',
|
|
38
|
+
'runtime_validation_failed',
|
|
39
|
+
'schema_validation_failed',
|
|
40
|
+
'source_context_invalid',
|
|
41
|
+
'target_not_editable',
|
|
42
|
+
'timeout',
|
|
43
|
+
'unknown',
|
|
44
|
+
'work_item_not_found',
|
|
45
|
+
]);
|
|
46
|
+
const normalizeCode = (value) => value
|
|
47
|
+
.trim()
|
|
48
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1_$2')
|
|
49
|
+
.replace(/[^a-zA-Z0-9]+/g, '_')
|
|
50
|
+
.replace(/^_+|_+$/g, '')
|
|
51
|
+
.toLowerCase();
|
|
52
|
+
/** Reduces variants failures to stable analytics enums without storing messages. */
|
|
53
|
+
const normalizeMCPVariantsFailureReason = (input) => {
|
|
54
|
+
const raw = input instanceof Error
|
|
55
|
+
? input.message
|
|
56
|
+
: typeof input === 'string'
|
|
57
|
+
? input
|
|
58
|
+
: '';
|
|
59
|
+
const normalized = normalizeCode(raw);
|
|
60
|
+
if (KNOWN_FAILURE_REASONS.has(normalized)) {
|
|
61
|
+
return normalized;
|
|
62
|
+
}
|
|
63
|
+
if (normalized.includes('timed_out') || normalized.includes('timeout')) {
|
|
64
|
+
return 'timeout';
|
|
65
|
+
}
|
|
66
|
+
if (normalized.includes('lease_expired'))
|
|
67
|
+
return 'lease_expired';
|
|
68
|
+
if (normalized.includes('queue_full'))
|
|
69
|
+
return 'queue_full';
|
|
70
|
+
if (normalized.includes('not_enabled') || normalized.includes('feature')) {
|
|
71
|
+
return 'feature_disabled';
|
|
72
|
+
}
|
|
73
|
+
if (normalized.includes('destination') && normalized.includes('not_empty')) {
|
|
74
|
+
return 'destination_not_empty';
|
|
75
|
+
}
|
|
76
|
+
if (normalized.includes('not_editable'))
|
|
77
|
+
return 'target_not_editable';
|
|
78
|
+
if (normalized.includes('not_found'))
|
|
79
|
+
return 'work_item_not_found';
|
|
80
|
+
if (normalized.includes('missing'))
|
|
81
|
+
return 'missing_required_input';
|
|
82
|
+
if (normalized.includes('schema') || normalized.includes('validation_failed')) {
|
|
83
|
+
return 'schema_validation_failed';
|
|
84
|
+
}
|
|
85
|
+
if (normalized.includes('invalid_stage'))
|
|
86
|
+
return 'invalid_stage_action';
|
|
87
|
+
if (normalized.includes('source_context'))
|
|
88
|
+
return 'source_context_invalid';
|
|
89
|
+
if (normalized.includes('failed_to_apply'))
|
|
90
|
+
return 'runtime_validation_failed';
|
|
91
|
+
if (normalized.includes('ack'))
|
|
92
|
+
return 'ack_failed';
|
|
93
|
+
return 'unknown';
|
|
94
|
+
};
|
|
95
|
+
exports.normalizeMCPVariantsFailureReason = normalizeMCPVariantsFailureReason;
|
|
96
|
+
const setIfDefined = (properties, key, value) => {
|
|
97
|
+
if (value !== undefined) {
|
|
98
|
+
properties[key] = value;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
/** Builds the shared metadata-only variants telemetry payload. */
|
|
102
|
+
const buildMCPVariantsTelemetryProperties = (data) => {
|
|
103
|
+
const properties = { source: 'mcp' };
|
|
104
|
+
setIfDefined(properties, 'session_id', data.sessionId);
|
|
105
|
+
setIfDefined(properties, 'request_id', data.requestId);
|
|
106
|
+
setIfDefined(properties, 'trace_id', data.traceId);
|
|
107
|
+
setIfDefined(properties, 'agent_run_id', data.agentRunId);
|
|
108
|
+
setIfDefined(properties, 'round_index', data.roundIndex);
|
|
109
|
+
setIfDefined(properties, 'target_variant_id', data.targetVariantId);
|
|
110
|
+
setIfDefined(properties, 'source_variant_id', data.sourceVariantId);
|
|
111
|
+
setIfDefined(properties, 'work_item_id', data.workItemId);
|
|
112
|
+
setIfDefined(properties, 'lease_id', data.leaseId);
|
|
113
|
+
setIfDefined(properties, 'entry_point', data.entryPoint);
|
|
114
|
+
setIfDefined(properties, 'mode', data.mode);
|
|
115
|
+
setIfDefined(properties, 'project_context_kind', data.projectContextKind);
|
|
116
|
+
setIfDefined(properties, 'run_topology', data.runTopology);
|
|
117
|
+
setIfDefined(properties, 'preview_kind', data.previewKind);
|
|
118
|
+
setIfDefined(properties, 'request_status', data.requestStatus);
|
|
119
|
+
setIfDefined(properties, 'requested_count', data.requestedCount);
|
|
120
|
+
setIfDefined(properties, 'accepted_count', data.acceptedCount);
|
|
121
|
+
setIfDefined(properties, 'rejected_count', data.rejectedCount);
|
|
122
|
+
setIfDefined(properties, 'approved_count', data.approvedCount);
|
|
123
|
+
setIfDefined(properties, 'work_item_count', data.workItemCount);
|
|
124
|
+
setIfDefined(properties, 'completed_count', data.completedCount);
|
|
125
|
+
setIfDefined(properties, 'failed_count', data.failedCount);
|
|
126
|
+
setIfDefined(properties, 'cancelled_count', data.cancelledCount);
|
|
127
|
+
setIfDefined(properties, 'comment_count', data.commentCount);
|
|
128
|
+
setIfDefined(properties, 'image_count', data.imageCount);
|
|
129
|
+
setIfDefined(properties, 'source_count', data.sourceCount);
|
|
130
|
+
setIfDefined(properties, 'brief_count', data.briefCount);
|
|
131
|
+
setIfDefined(properties, 'brief_label_count', data.briefLabelCount);
|
|
132
|
+
setIfDefined(properties, 'source_url_count', data.sourceUrlCount);
|
|
133
|
+
setIfDefined(properties, 'source_file_count', data.sourceFileCount);
|
|
134
|
+
setIfDefined(properties, 'source_directory_count', data.sourceDirectoryCount);
|
|
135
|
+
setIfDefined(properties, 'source_text_count', data.sourceTextCount);
|
|
136
|
+
setIfDefined(properties, 'action_count', data.actionCount);
|
|
137
|
+
setIfDefined(properties, 'metadata_count', data.metadataCount);
|
|
138
|
+
setIfDefined(properties, 'binding_count', data.bindingCount);
|
|
139
|
+
setIfDefined(properties, 'result_variant_count', data.resultVariantCount);
|
|
140
|
+
setIfDefined(properties, 'changed_files_count', data.changedFilesCount);
|
|
141
|
+
setIfDefined(properties, 'instruction_length', data.instructionLength);
|
|
142
|
+
setIfDefined(properties, 'comment_length', data.commentLength);
|
|
143
|
+
setIfDefined(properties, 'duration_ms', data.durationMs);
|
|
144
|
+
setIfDefined(properties, 'dwell_ms', data.dwellMs);
|
|
145
|
+
setIfDefined(properties, 'queue_wait_ms', data.queueWaitMs);
|
|
146
|
+
setIfDefined(properties, 'lease_duration_ms', data.leaseDurationMs);
|
|
147
|
+
if (data.failureReason !== undefined) {
|
|
148
|
+
properties.failure_reason = (0, exports.normalizeMCPVariantsFailureReason)(data.failureReason);
|
|
149
|
+
}
|
|
150
|
+
return properties;
|
|
151
|
+
};
|
|
152
|
+
exports.buildMCPVariantsTelemetryProperties = buildMCPVariantsTelemetryProperties;
|
|
153
|
+
//# sourceMappingURL=MCPVariantsTelemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MCPVariantsTelemetry.js","sourceRoot":"","sources":["../../src/services/MCPVariantsTelemetry.ts"],"names":[],"mappings":";;;AAiGa,QAAA,iCAAiC,GAAG;IAC/C,QAAQ;IACR,aAAa;IACb,SAAS;IACT,OAAO;IACP,YAAY;IACZ,aAAa;IACb,aAAa;IACb,KAAK;IACL,WAAW;IACX,MAAM;IACN,WAAW;IACX,kBAAkB;IAClB,MAAM;IACN,MAAM;IACN,MAAM;IACN,UAAU;IACV,YAAY;IACZ,OAAO;IACP,WAAW;IACX,UAAU;IACV,eAAe;CACP,CAAC;AAEX,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAA2B;IAC9D,YAAY;IACZ,gBAAgB;IAChB,uBAAuB;IACvB,kBAAkB;IAClB,sBAAsB;IACtB,eAAe;IACf,kBAAkB;IAClB,wBAAwB;IACxB,yBAAyB;IACzB,YAAY;IACZ,2BAA2B;IAC3B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AE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC7D,YAAY,CAAC,UAAU,EAAE,sBAAsB,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC1E,YAAY,CAAC,UAAU,EAAE,qBAAqB,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACxE,YAAY,CAAC,UAAU,EAAE,oBAAoB,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACvE,YAAY,CAAC,UAAU,EAAE,gBAAgB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC/D,YAAY,CAAC,UAAU,EAAE,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACzD,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACnD,YAAY,CAAC,UAAU,EAAE,eAAe,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC5D,YAAY,CAAC,UAAU,EAAE,mBAAmB,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;IACpE,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;QACrC,UAAU,CAAC,cAAc,GAAG,IAAA,yCAAiC,EAC3D,IAAI,CAAC,aAAa,CACnB,CAAC;IACJ,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AArDW,QAAA,mCAAmC,uCAqD9C"}
|
|
@@ -63,19 +63,32 @@ export type ChannelDepth = {
|
|
|
63
63
|
queued: number;
|
|
64
64
|
leased: number;
|
|
65
65
|
};
|
|
66
|
+
export type ActiveLeaseMetadata = {
|
|
67
|
+
kind: BatchChannelKind;
|
|
68
|
+
requestId: string;
|
|
69
|
+
leaseId: string;
|
|
70
|
+
leasedAt: number;
|
|
71
|
+
ageMs: number;
|
|
72
|
+
changeCount: number;
|
|
73
|
+
sourceFileCount: number;
|
|
74
|
+
mergedFrom: number;
|
|
75
|
+
mergedRequestCount: number;
|
|
76
|
+
};
|
|
66
77
|
/**
|
|
67
78
|
* Real liveness of the change pipeline, derived from the live queue + waiter
|
|
68
|
-
* state (NOT from elapsed silence — a `watch_for_changes` long-poll
|
|
69
|
-
* quiet for up to 600s and still be perfectly healthy). Surfaced so the
|
|
70
|
-
* tell "the host agent stopped draining" (
|
|
71
|
-
* from "the host agent is patiently long-polling" (watcher active,
|
|
72
|
-
* queued).
|
|
79
|
+
* and lease state (NOT from elapsed silence — a `watch_for_changes` long-poll
|
|
80
|
+
* can sit quiet for up to 600s and still be perfectly healthy). Surfaced so the
|
|
81
|
+
* UI can tell "the host agent stopped draining" (unfinished work, no watcher)
|
|
82
|
+
* apart from "the host agent is patiently long-polling" (watcher active,
|
|
83
|
+
* nothing queued).
|
|
73
84
|
*/
|
|
74
85
|
export type WatcherLiveness = {
|
|
75
86
|
/** True while at least one `watch_for_changes` waiter is blocked/registered. */
|
|
76
87
|
watcherActive: boolean;
|
|
77
|
-
/** Unconsumed changes across
|
|
88
|
+
/** Unconsumed changes across both bridge channels. */
|
|
78
89
|
pendingCount: number;
|
|
90
|
+
/** Variant-request/refine batches currently leased to an agent/tool. */
|
|
91
|
+
leasedVariantRequests: number;
|
|
79
92
|
/** Epoch-ms the oldest unconsumed change was queued, or null when none. */
|
|
80
93
|
oldestPendingChangeEnqueuedAt: number | null;
|
|
81
94
|
/** Age of the oldest unconsumed change against the caller's clock, or null. */
|
|
@@ -160,6 +173,12 @@ export declare class SessionBridgeService {
|
|
|
160
173
|
pendingVariantRequestCount(): number;
|
|
161
174
|
/** Non-destructive snapshot of queued variant-request/refine batches. */
|
|
162
175
|
peekVariantRequests(): ChangeRequest[];
|
|
176
|
+
/**
|
|
177
|
+
* Resolve the active visual editor project for a queued or leased variant
|
|
178
|
+
* request. Returns null for unrelated request ids so direct variant runs keep
|
|
179
|
+
* their caller/cwd defaults.
|
|
180
|
+
*/
|
|
181
|
+
resolveVariantRequestProjectPath(requestId: string): string | null;
|
|
163
182
|
/**
|
|
164
183
|
* Lease the oldest eligible batch across apply and variant channels.
|
|
165
184
|
* Global FIFO uses oldest `enqueuedAt` among channels that can lease.
|
|
@@ -208,6 +227,8 @@ export declare class SessionBridgeService {
|
|
|
208
227
|
completeActiveRunCorrelation(): ActiveRunCorrelation | null;
|
|
209
228
|
/** Active apply lease, if any (at most one). */
|
|
210
229
|
findActiveApplyLease(): LeasedBatchRecord | null;
|
|
230
|
+
/** Active lease metadata safe to expose for agent recovery. */
|
|
231
|
+
getActiveLeaseMetadata(now?: number): ActiveLeaseMetadata[];
|
|
211
232
|
/** Get the number of completed editing rounds in this session */
|
|
212
233
|
getRoundsCompleted(): number;
|
|
213
234
|
/** Get telemetry correlation data for the active session */
|
|
@@ -277,7 +298,7 @@ export declare class SessionBridgeService {
|
|
|
277
298
|
* waiter register/settle, session start/end). Returns an unsubscribe fn.
|
|
278
299
|
*/
|
|
279
300
|
onWatcherLivenessChange(listener: () => void): () => void;
|
|
280
|
-
/** Oldest enqueue time across queued apply
|
|
301
|
+
/** Oldest enqueue time across queued apply work or unfinished variant work. */
|
|
281
302
|
private oldestPendingChangeEnqueuedAt;
|
|
282
303
|
private notifyLivenessChange;
|
|
283
304
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionBridgeService.d.ts","sourceRoot":"","sources":["../../src/services/SessionBridgeService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EACjB,MAAM,+BAA+B,CAAC;AAMvC,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"SessionBridgeService.d.ts","sourceRoot":"","sources":["../../src/services/SessionBridgeService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EACjB,MAAM,+BAA+B,CAAC;AAMvC,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAK/B,KAAK,aAAa,GAA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MAAM,GAAG,IAAI,GAAG,IAAI;IAiC5C;;;OAGG;IACH,UAAU,IAAI,MAAM;IAgDpB;;;;;;OAMG;IACH,kBAAkB,CAAC,GAAG,GAAE,MAAmB,GAAG,eAAe;IAkB7D;;;OAGG;IACH,uBAAuB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAOzD,+EAA+E;IAC/E,OAAO,CAAC,6BAA6B;IAarC,OAAO,CAAC,oBAAoB;CAS7B"}
|
|
@@ -232,7 +232,8 @@ class SessionBridgeService {
|
|
|
232
232
|
this.updateTelemetryContext(intent.telemetryContext);
|
|
233
233
|
let enqueueResult;
|
|
234
234
|
if (!(0, changeBatchClassification_1.isMixedVariantBatch)(intent) &&
|
|
235
|
-
((0, changeBatchClassification_1.isSingleVariantRequestBatch)(intent) ||
|
|
235
|
+
((0, changeBatchClassification_1.isSingleVariantRequestBatch)(intent) ||
|
|
236
|
+
(0, changeBatchClassification_1.isStaticPreviewRefineBatch)(intent))) {
|
|
236
237
|
const approxBytes = Buffer.byteLength(JSON.stringify(intent));
|
|
237
238
|
if (approxBytes > exports.MAX_VARIANT_REQUEST_BYTES) {
|
|
238
239
|
log.warn(`Variant-request batch too large (${approxBytes} bytes > ${exports.MAX_VARIANT_REQUEST_BYTES}); rejecting`);
|
|
@@ -288,6 +289,17 @@ class SessionBridgeService {
|
|
|
288
289
|
peekVariantRequests() {
|
|
289
290
|
return this.variantPipeline.peekQueuedIntents();
|
|
290
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* Resolve the active visual editor project for a queued or leased variant
|
|
294
|
+
* request. Returns null for unrelated request ids so direct variant runs keep
|
|
295
|
+
* their caller/cwd defaults.
|
|
296
|
+
*/
|
|
297
|
+
resolveVariantRequestProjectPath(requestId) {
|
|
298
|
+
if (!this.projectPath || !this.variantPipeline.hasRequestId(requestId)) {
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
return this.projectPath;
|
|
302
|
+
}
|
|
291
303
|
/**
|
|
292
304
|
* Lease the oldest eligible batch across apply and variant channels.
|
|
293
305
|
* Global FIFO uses oldest `enqueuedAt` among channels that can lease.
|
|
@@ -373,7 +385,10 @@ class SessionBridgeService {
|
|
|
373
385
|
if (!lease) {
|
|
374
386
|
return null;
|
|
375
387
|
}
|
|
376
|
-
this.variantPipeline.ack({
|
|
388
|
+
this.variantPipeline.ack({
|
|
389
|
+
leaseId: lease.leaseId,
|
|
390
|
+
requestId: lease.requestId,
|
|
391
|
+
});
|
|
377
392
|
this.persistQueue();
|
|
378
393
|
this.notifyLivenessChange();
|
|
379
394
|
return lease.intent;
|
|
@@ -499,8 +514,7 @@ class SessionBridgeService {
|
|
|
499
514
|
log.info('Pending intent changed while rejecting mixed variant request; preserving newer intent');
|
|
500
515
|
return undefined;
|
|
501
516
|
}
|
|
502
|
-
const nextChanges = intent.changes.filter((change) => !(change.kind === 'comment' &&
|
|
503
|
-
change.variantRequest !== undefined));
|
|
517
|
+
const nextChanges = intent.changes.filter((change) => !(change.kind === 'comment' && change.variantRequest !== undefined));
|
|
504
518
|
if (nextChanges.length === intent.changes.length) {
|
|
505
519
|
return intent;
|
|
506
520
|
}
|
|
@@ -552,6 +566,26 @@ class SessionBridgeService {
|
|
|
552
566
|
const leased = this.applyPipeline.snapshot().leased;
|
|
553
567
|
return leased[0] ?? null;
|
|
554
568
|
}
|
|
569
|
+
/** Active lease metadata safe to expose for agent recovery. */
|
|
570
|
+
getActiveLeaseMetadata(now = Date.now()) {
|
|
571
|
+
const leases = [
|
|
572
|
+
...this.applyPipeline.snapshot().leased,
|
|
573
|
+
...this.variantPipeline.snapshot().leased,
|
|
574
|
+
];
|
|
575
|
+
return leases
|
|
576
|
+
.sort((a, b) => a.leasedAt - b.leasedAt)
|
|
577
|
+
.map((lease) => ({
|
|
578
|
+
kind: lease.kind,
|
|
579
|
+
requestId: lease.requestId,
|
|
580
|
+
leaseId: lease.leaseId,
|
|
581
|
+
leasedAt: lease.leasedAt,
|
|
582
|
+
ageMs: Math.max(0, now - lease.leasedAt),
|
|
583
|
+
changeCount: lease.intent.changes.length,
|
|
584
|
+
sourceFileCount: lease.intent.sourceFiles.length,
|
|
585
|
+
mergedFrom: lease.mergedFrom,
|
|
586
|
+
mergedRequestCount: lease.mergedRequestIds.length,
|
|
587
|
+
}));
|
|
588
|
+
}
|
|
555
589
|
/** Get the number of completed editing rounds in this session */
|
|
556
590
|
getRoundsCompleted() {
|
|
557
591
|
return this.roundsCompleted;
|
|
@@ -767,10 +801,13 @@ class SessionBridgeService {
|
|
|
767
801
|
*/
|
|
768
802
|
getWatcherLiveness(now = Date.now()) {
|
|
769
803
|
const oldestPendingChangeEnqueuedAt = this.oldestPendingChangeEnqueuedAt();
|
|
770
|
-
const pendingCount = this.applyPipeline.queuedDepth() +
|
|
804
|
+
const pendingCount = this.applyPipeline.queuedDepth() +
|
|
805
|
+
this.variantPipeline.queuedDepth() +
|
|
806
|
+
this.variantPipeline.leasedDepth();
|
|
771
807
|
return {
|
|
772
808
|
watcherActive: this.waitResolvers.length > 0,
|
|
773
809
|
pendingCount,
|
|
810
|
+
leasedVariantRequests: this.variantPipeline.leasedDepth(),
|
|
774
811
|
oldestPendingChangeEnqueuedAt,
|
|
775
812
|
oldestPendingChangeAgeMs: oldestPendingChangeEnqueuedAt === null
|
|
776
813
|
? null
|
|
@@ -787,16 +824,16 @@ class SessionBridgeService {
|
|
|
787
824
|
this.livenessListeners.delete(listener);
|
|
788
825
|
};
|
|
789
826
|
}
|
|
790
|
-
/** Oldest enqueue time across queued apply
|
|
827
|
+
/** Oldest enqueue time across queued apply work or unfinished variant work. */
|
|
791
828
|
oldestPendingChangeEnqueuedAt() {
|
|
792
829
|
const times = [];
|
|
793
830
|
const applyAt = this.applyPipeline.oldestQueuedEnqueuedAt();
|
|
794
831
|
if (applyAt !== null) {
|
|
795
832
|
times.push(applyAt);
|
|
796
833
|
}
|
|
797
|
-
const
|
|
798
|
-
if (
|
|
799
|
-
times.push(
|
|
834
|
+
const variantAt = this.variantPipeline.oldestUnfinishedEnqueuedAt();
|
|
835
|
+
if (variantAt !== null) {
|
|
836
|
+
times.push(variantAt);
|
|
800
837
|
}
|
|
801
838
|
return times.length > 0 ? Math.min(...times) : null;
|
|
802
839
|
}
|