@nuxtseo/protocol 0.5.0 → 0.5.3

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.
@@ -2656,6 +2656,36 @@ export declare const scanThirdPartySchema: import("./core.js").CompatibleRespons
2656
2656
  readonly mainThreadTime: z.ZodNullable<z.ZodNumber>;
2657
2657
  readonly transferSize: z.ZodNullable<z.ZodNumber>;
2658
2658
  }, z.core.$strip>>;
2659
+ /** Trace timings are separate from the reported metric under simulated throttling. */
2660
+ export declare const lcpObservedTraceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2661
+ _tag: z.ZodLiteral<"available">;
2662
+ basis: z.ZodLiteral<"observed">;
2663
+ throttlingMethod: z.ZodEnum<{
2664
+ devtools: "devtools";
2665
+ provided: "provided";
2666
+ simulate: "simulate";
2667
+ }>;
2668
+ observedLcpMs: z.ZodNumber;
2669
+ phases: z.ZodArray<z.ZodObject<{
2670
+ id: z.ZodEnum<{
2671
+ elementRenderDelay: "elementRenderDelay";
2672
+ resourceLoadDelay: "resourceLoadDelay";
2673
+ resourceLoadDuration: "resourceLoadDuration";
2674
+ timeToFirstByte: "timeToFirstByte";
2675
+ }>;
2676
+ durationMs: z.ZodNumber;
2677
+ }, z.core.$strict>>;
2678
+ }, z.core.$strict>, z.ZodObject<{
2679
+ _tag: z.ZodLiteral<"unavailable">;
2680
+ reason: z.ZodEnum<{
2681
+ "invalid-report-data": "invalid-report-data";
2682
+ "legacy-projection": "legacy-projection";
2683
+ "missing-report-data": "missing-report-data";
2684
+ "projection-missing": "projection-missing";
2685
+ "projection-unavailable": "projection-unavailable";
2686
+ }>;
2687
+ }, z.core.$strict>], "_tag">;
2688
+ export type LcpObservedTrace = z.output<typeof lcpObservedTraceSchema>;
2659
2689
  export declare const performanceScanDetailDataSchema: import("./core.js").CompatibleResponseSchema<z.ZodObject<{
2660
2690
  readonly id: z.ZodString;
2661
2691
  readonly url: z.ZodString;
@@ -2674,6 +2704,39 @@ export declare const performanceScanDetailDataSchema: import("./core.js").Compat
2674
2704
  readonly speedIndex: z.ZodNullable<z.ZodNumber>;
2675
2705
  readonly ttfb: z.ZodNullable<z.ZodNumber>;
2676
2706
  readonly completedAt: z.ZodNullable<z.ZodString>;
2707
+ readonly javascript: z.ZodNullable<z.ZodObject<{
2708
+ transferBytes: z.ZodNullable<z.ZodNumber>;
2709
+ decodedBytes: z.ZodNullable<z.ZodNumber>;
2710
+ scriptCount: z.ZodNullable<z.ZodNumber>;
2711
+ }, z.core.$strict>>;
2712
+ readonly observedTrace: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2713
+ _tag: z.ZodLiteral<"available">;
2714
+ basis: z.ZodLiteral<"observed">;
2715
+ throttlingMethod: z.ZodEnum<{
2716
+ devtools: "devtools";
2717
+ provided: "provided";
2718
+ simulate: "simulate";
2719
+ }>;
2720
+ observedLcpMs: z.ZodNumber;
2721
+ phases: z.ZodArray<z.ZodObject<{
2722
+ id: z.ZodEnum<{
2723
+ elementRenderDelay: "elementRenderDelay";
2724
+ resourceLoadDelay: "resourceLoadDelay";
2725
+ resourceLoadDuration: "resourceLoadDuration";
2726
+ timeToFirstByte: "timeToFirstByte";
2727
+ }>;
2728
+ durationMs: z.ZodNumber;
2729
+ }, z.core.$strict>>;
2730
+ }, z.core.$strict>, z.ZodObject<{
2731
+ _tag: z.ZodLiteral<"unavailable">;
2732
+ reason: z.ZodEnum<{
2733
+ "invalid-report-data": "invalid-report-data";
2734
+ "legacy-projection": "legacy-projection";
2735
+ "missing-report-data": "missing-report-data";
2736
+ "projection-missing": "projection-missing";
2737
+ "projection-unavailable": "projection-unavailable";
2738
+ }>;
2739
+ }, z.core.$strict>], "_tag">>;
2677
2740
  readonly performanceIssues: z.ZodArray<z.ZodObject<{
2678
2741
  readonly type: z.ZodString;
2679
2742
  readonly subtype: z.ZodNullable<z.ZodString>;
@@ -2765,6 +2828,39 @@ export declare const performanceScanDetailDataSchema: import("./core.js").Compat
2765
2828
  readonly speedIndex: z.ZodNullable<z.ZodNumber>;
2766
2829
  readonly ttfb: z.ZodNullable<z.ZodNumber>;
2767
2830
  readonly completedAt: z.ZodNullable<z.ZodString>;
2831
+ readonly javascript: z.ZodOptional<z.ZodNullable<z.ZodObject<{
2832
+ transferBytes: z.ZodNullable<z.ZodNumber>;
2833
+ decodedBytes: z.ZodNullable<z.ZodNumber>;
2834
+ scriptCount: z.ZodNullable<z.ZodNumber>;
2835
+ }, z.core.$loose>>>;
2836
+ readonly observedTrace: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2837
+ _tag: z.ZodLiteral<"available">;
2838
+ basis: z.ZodLiteral<"observed">;
2839
+ throttlingMethod: z.ZodEnum<{
2840
+ devtools: "devtools";
2841
+ provided: "provided";
2842
+ simulate: "simulate";
2843
+ }>;
2844
+ observedLcpMs: z.ZodNumber;
2845
+ phases: z.ZodArray<z.ZodObject<{
2846
+ id: z.ZodEnum<{
2847
+ elementRenderDelay: "elementRenderDelay";
2848
+ resourceLoadDelay: "resourceLoadDelay";
2849
+ resourceLoadDuration: "resourceLoadDuration";
2850
+ timeToFirstByte: "timeToFirstByte";
2851
+ }>;
2852
+ durationMs: z.ZodNumber;
2853
+ }, z.core.$strict>>;
2854
+ }, z.core.$strict>, z.ZodObject<{
2855
+ _tag: z.ZodLiteral<"unavailable">;
2856
+ reason: z.ZodEnum<{
2857
+ "invalid-report-data": "invalid-report-data";
2858
+ "legacy-projection": "legacy-projection";
2859
+ "missing-report-data": "missing-report-data";
2860
+ "projection-missing": "projection-missing";
2861
+ "projection-unavailable": "projection-unavailable";
2862
+ }>;
2863
+ }, z.core.$strict>], "_tag">>;
2768
2864
  readonly performanceIssues: z.ZodArray<z.ZodObject<{
2769
2865
  readonly type: z.ZodString;
2770
2866
  readonly subtype: z.ZodNullable<z.ZodString>;
@@ -2856,6 +2952,39 @@ export declare const performanceScanDetailResponseSchema: import("./core.js").Co
2856
2952
  readonly speedIndex: z.ZodNullable<z.ZodNumber>;
2857
2953
  readonly ttfb: z.ZodNullable<z.ZodNumber>;
2858
2954
  readonly completedAt: z.ZodNullable<z.ZodString>;
2955
+ readonly javascript: z.ZodNullable<z.ZodObject<{
2956
+ transferBytes: z.ZodNullable<z.ZodNumber>;
2957
+ decodedBytes: z.ZodNullable<z.ZodNumber>;
2958
+ scriptCount: z.ZodNullable<z.ZodNumber>;
2959
+ }, z.core.$strict>>;
2960
+ readonly observedTrace: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2961
+ _tag: z.ZodLiteral<"available">;
2962
+ basis: z.ZodLiteral<"observed">;
2963
+ throttlingMethod: z.ZodEnum<{
2964
+ devtools: "devtools";
2965
+ provided: "provided";
2966
+ simulate: "simulate";
2967
+ }>;
2968
+ observedLcpMs: z.ZodNumber;
2969
+ phases: z.ZodArray<z.ZodObject<{
2970
+ id: z.ZodEnum<{
2971
+ elementRenderDelay: "elementRenderDelay";
2972
+ resourceLoadDelay: "resourceLoadDelay";
2973
+ resourceLoadDuration: "resourceLoadDuration";
2974
+ timeToFirstByte: "timeToFirstByte";
2975
+ }>;
2976
+ durationMs: z.ZodNumber;
2977
+ }, z.core.$strict>>;
2978
+ }, z.core.$strict>, z.ZodObject<{
2979
+ _tag: z.ZodLiteral<"unavailable">;
2980
+ reason: z.ZodEnum<{
2981
+ "invalid-report-data": "invalid-report-data";
2982
+ "legacy-projection": "legacy-projection";
2983
+ "missing-report-data": "missing-report-data";
2984
+ "projection-missing": "projection-missing";
2985
+ "projection-unavailable": "projection-unavailable";
2986
+ }>;
2987
+ }, z.core.$strict>], "_tag">>;
2859
2988
  readonly performanceIssues: z.ZodArray<z.ZodObject<{
2860
2989
  readonly type: z.ZodString;
2861
2990
  readonly subtype: z.ZodNullable<z.ZodString>;
@@ -2953,6 +3082,39 @@ export declare const performanceScanDetailResponseSchema: import("./core.js").Co
2953
3082
  readonly speedIndex: z.ZodNullable<z.ZodNumber>;
2954
3083
  readonly ttfb: z.ZodNullable<z.ZodNumber>;
2955
3084
  readonly completedAt: z.ZodNullable<z.ZodString>;
3085
+ readonly javascript: z.ZodOptional<z.ZodNullable<z.ZodObject<{
3086
+ transferBytes: z.ZodNullable<z.ZodNumber>;
3087
+ decodedBytes: z.ZodNullable<z.ZodNumber>;
3088
+ scriptCount: z.ZodNullable<z.ZodNumber>;
3089
+ }, z.core.$loose>>>;
3090
+ readonly observedTrace: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
3091
+ _tag: z.ZodLiteral<"available">;
3092
+ basis: z.ZodLiteral<"observed">;
3093
+ throttlingMethod: z.ZodEnum<{
3094
+ devtools: "devtools";
3095
+ provided: "provided";
3096
+ simulate: "simulate";
3097
+ }>;
3098
+ observedLcpMs: z.ZodNumber;
3099
+ phases: z.ZodArray<z.ZodObject<{
3100
+ id: z.ZodEnum<{
3101
+ elementRenderDelay: "elementRenderDelay";
3102
+ resourceLoadDelay: "resourceLoadDelay";
3103
+ resourceLoadDuration: "resourceLoadDuration";
3104
+ timeToFirstByte: "timeToFirstByte";
3105
+ }>;
3106
+ durationMs: z.ZodNumber;
3107
+ }, z.core.$strict>>;
3108
+ }, z.core.$strict>, z.ZodObject<{
3109
+ _tag: z.ZodLiteral<"unavailable">;
3110
+ reason: z.ZodEnum<{
3111
+ "invalid-report-data": "invalid-report-data";
3112
+ "legacy-projection": "legacy-projection";
3113
+ "missing-report-data": "missing-report-data";
3114
+ "projection-missing": "projection-missing";
3115
+ "projection-unavailable": "projection-unavailable";
3116
+ }>;
3117
+ }, z.core.$strict>], "_tag">>;
2956
3118
  readonly performanceIssues: z.ZodArray<z.ZodObject<{
2957
3119
  readonly type: z.ZodString;
2958
3120
  readonly subtype: z.ZodNullable<z.ZodString>;
@@ -3030,7 +3192,7 @@ export declare const performanceScanDetailResponseSchema: import("./core.js").Co
3030
3192
  version: z.ZodLiteral<"1.0">;
3031
3193
  }, z.core.$loose>;
3032
3194
  }, z.core.$strip>>;
3033
- export type PerformanceScanDetail = z.output<typeof performanceScanDetailDataSchema.producer>;
3195
+ export type PerformanceScanDetail = z.output<typeof performanceScanDetailDataSchema.client>;
3034
3196
  export declare const performanceScanDetailOperation: {
3035
3197
  readonly id: 'page.performance.scan';
3036
3198
  readonly method: 'GET';
@@ -3077,6 +3239,39 @@ export declare const performanceScanDetailOperation: {
3077
3239
  readonly speedIndex: z.ZodNullable<z.ZodNumber>;
3078
3240
  readonly ttfb: z.ZodNullable<z.ZodNumber>;
3079
3241
  readonly completedAt: z.ZodNullable<z.ZodString>;
3242
+ readonly javascript: z.ZodNullable<z.ZodObject<{
3243
+ transferBytes: z.ZodNullable<z.ZodNumber>;
3244
+ decodedBytes: z.ZodNullable<z.ZodNumber>;
3245
+ scriptCount: z.ZodNullable<z.ZodNumber>;
3246
+ }, z.core.$strict>>;
3247
+ readonly observedTrace: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
3248
+ _tag: z.ZodLiteral<"available">;
3249
+ basis: z.ZodLiteral<"observed">;
3250
+ throttlingMethod: z.ZodEnum<{
3251
+ devtools: "devtools";
3252
+ provided: "provided";
3253
+ simulate: "simulate";
3254
+ }>;
3255
+ observedLcpMs: z.ZodNumber;
3256
+ phases: z.ZodArray<z.ZodObject<{
3257
+ id: z.ZodEnum<{
3258
+ elementRenderDelay: "elementRenderDelay";
3259
+ resourceLoadDelay: "resourceLoadDelay";
3260
+ resourceLoadDuration: "resourceLoadDuration";
3261
+ timeToFirstByte: "timeToFirstByte";
3262
+ }>;
3263
+ durationMs: z.ZodNumber;
3264
+ }, z.core.$strict>>;
3265
+ }, z.core.$strict>, z.ZodObject<{
3266
+ _tag: z.ZodLiteral<"unavailable">;
3267
+ reason: z.ZodEnum<{
3268
+ "invalid-report-data": "invalid-report-data";
3269
+ "legacy-projection": "legacy-projection";
3270
+ "missing-report-data": "missing-report-data";
3271
+ "projection-missing": "projection-missing";
3272
+ "projection-unavailable": "projection-unavailable";
3273
+ }>;
3274
+ }, z.core.$strict>], "_tag">>;
3080
3275
  readonly performanceIssues: z.ZodArray<z.ZodObject<{
3081
3276
  readonly type: z.ZodString;
3082
3277
  readonly subtype: z.ZodNullable<z.ZodString>;
@@ -3174,6 +3369,39 @@ export declare const performanceScanDetailOperation: {
3174
3369
  readonly speedIndex: z.ZodNullable<z.ZodNumber>;
3175
3370
  readonly ttfb: z.ZodNullable<z.ZodNumber>;
3176
3371
  readonly completedAt: z.ZodNullable<z.ZodString>;
3372
+ readonly javascript: z.ZodOptional<z.ZodNullable<z.ZodObject<{
3373
+ transferBytes: z.ZodNullable<z.ZodNumber>;
3374
+ decodedBytes: z.ZodNullable<z.ZodNumber>;
3375
+ scriptCount: z.ZodNullable<z.ZodNumber>;
3376
+ }, z.core.$loose>>>;
3377
+ readonly observedTrace: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
3378
+ _tag: z.ZodLiteral<"available">;
3379
+ basis: z.ZodLiteral<"observed">;
3380
+ throttlingMethod: z.ZodEnum<{
3381
+ devtools: "devtools";
3382
+ provided: "provided";
3383
+ simulate: "simulate";
3384
+ }>;
3385
+ observedLcpMs: z.ZodNumber;
3386
+ phases: z.ZodArray<z.ZodObject<{
3387
+ id: z.ZodEnum<{
3388
+ elementRenderDelay: "elementRenderDelay";
3389
+ resourceLoadDelay: "resourceLoadDelay";
3390
+ resourceLoadDuration: "resourceLoadDuration";
3391
+ timeToFirstByte: "timeToFirstByte";
3392
+ }>;
3393
+ durationMs: z.ZodNumber;
3394
+ }, z.core.$strict>>;
3395
+ }, z.core.$strict>, z.ZodObject<{
3396
+ _tag: z.ZodLiteral<"unavailable">;
3397
+ reason: z.ZodEnum<{
3398
+ "invalid-report-data": "invalid-report-data";
3399
+ "legacy-projection": "legacy-projection";
3400
+ "missing-report-data": "missing-report-data";
3401
+ "projection-missing": "projection-missing";
3402
+ "projection-unavailable": "projection-unavailable";
3403
+ }>;
3404
+ }, z.core.$strict>], "_tag">>;
3177
3405
  readonly performanceIssues: z.ZodArray<z.ZodObject<{
3178
3406
  readonly type: z.ZodString;
3179
3407
  readonly subtype: z.ZodNullable<z.ZodString>;
@@ -3354,6 +3582,7 @@ export declare const performanceScanDetailOperation: {
3354
3582
  readonly speedIndex: 2400;
3355
3583
  readonly ttfb: 210;
3356
3584
  readonly completedAt: '2026-08-10T01:00:00.000Z';
3585
+ readonly javascript: null;
3357
3586
  readonly performanceIssues: readonly [];
3358
3587
  readonly cachePolicy: readonly [];
3359
3588
  readonly thirdParties: readonly [];
@@ -4701,6 +4930,39 @@ export declare const performanceV1Registry: import("./core.js").PublicV1Registry
4701
4930
  readonly speedIndex: z.ZodNullable<z.ZodNumber>;
4702
4931
  readonly ttfb: z.ZodNullable<z.ZodNumber>;
4703
4932
  readonly completedAt: z.ZodNullable<z.ZodString>;
4933
+ readonly javascript: z.ZodNullable<z.ZodObject<{
4934
+ transferBytes: z.ZodNullable<z.ZodNumber>;
4935
+ decodedBytes: z.ZodNullable<z.ZodNumber>;
4936
+ scriptCount: z.ZodNullable<z.ZodNumber>;
4937
+ }, z.core.$strict>>;
4938
+ readonly observedTrace: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
4939
+ _tag: z.ZodLiteral<"available">;
4940
+ basis: z.ZodLiteral<"observed">;
4941
+ throttlingMethod: z.ZodEnum<{
4942
+ devtools: "devtools";
4943
+ provided: "provided";
4944
+ simulate: "simulate";
4945
+ }>;
4946
+ observedLcpMs: z.ZodNumber;
4947
+ phases: z.ZodArray<z.ZodObject<{
4948
+ id: z.ZodEnum<{
4949
+ elementRenderDelay: "elementRenderDelay";
4950
+ resourceLoadDelay: "resourceLoadDelay";
4951
+ resourceLoadDuration: "resourceLoadDuration";
4952
+ timeToFirstByte: "timeToFirstByte";
4953
+ }>;
4954
+ durationMs: z.ZodNumber;
4955
+ }, z.core.$strict>>;
4956
+ }, z.core.$strict>, z.ZodObject<{
4957
+ _tag: z.ZodLiteral<"unavailable">;
4958
+ reason: z.ZodEnum<{
4959
+ "invalid-report-data": "invalid-report-data";
4960
+ "legacy-projection": "legacy-projection";
4961
+ "missing-report-data": "missing-report-data";
4962
+ "projection-missing": "projection-missing";
4963
+ "projection-unavailable": "projection-unavailable";
4964
+ }>;
4965
+ }, z.core.$strict>], "_tag">>;
4704
4966
  readonly performanceIssues: z.ZodArray<z.ZodObject<{
4705
4967
  readonly type: z.ZodString;
4706
4968
  readonly subtype: z.ZodNullable<z.ZodString>;
@@ -4798,6 +5060,39 @@ export declare const performanceV1Registry: import("./core.js").PublicV1Registry
4798
5060
  readonly speedIndex: z.ZodNullable<z.ZodNumber>;
4799
5061
  readonly ttfb: z.ZodNullable<z.ZodNumber>;
4800
5062
  readonly completedAt: z.ZodNullable<z.ZodString>;
5063
+ readonly javascript: z.ZodOptional<z.ZodNullable<z.ZodObject<{
5064
+ transferBytes: z.ZodNullable<z.ZodNumber>;
5065
+ decodedBytes: z.ZodNullable<z.ZodNumber>;
5066
+ scriptCount: z.ZodNullable<z.ZodNumber>;
5067
+ }, z.core.$loose>>>;
5068
+ readonly observedTrace: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
5069
+ _tag: z.ZodLiteral<"available">;
5070
+ basis: z.ZodLiteral<"observed">;
5071
+ throttlingMethod: z.ZodEnum<{
5072
+ devtools: "devtools";
5073
+ provided: "provided";
5074
+ simulate: "simulate";
5075
+ }>;
5076
+ observedLcpMs: z.ZodNumber;
5077
+ phases: z.ZodArray<z.ZodObject<{
5078
+ id: z.ZodEnum<{
5079
+ elementRenderDelay: "elementRenderDelay";
5080
+ resourceLoadDelay: "resourceLoadDelay";
5081
+ resourceLoadDuration: "resourceLoadDuration";
5082
+ timeToFirstByte: "timeToFirstByte";
5083
+ }>;
5084
+ durationMs: z.ZodNumber;
5085
+ }, z.core.$strict>>;
5086
+ }, z.core.$strict>, z.ZodObject<{
5087
+ _tag: z.ZodLiteral<"unavailable">;
5088
+ reason: z.ZodEnum<{
5089
+ "invalid-report-data": "invalid-report-data";
5090
+ "legacy-projection": "legacy-projection";
5091
+ "missing-report-data": "missing-report-data";
5092
+ "projection-missing": "projection-missing";
5093
+ "projection-unavailable": "projection-unavailable";
5094
+ }>;
5095
+ }, z.core.$strict>], "_tag">>;
4801
5096
  readonly performanceIssues: z.ZodArray<z.ZodObject<{
4802
5097
  readonly type: z.ZodString;
4803
5098
  readonly subtype: z.ZodNullable<z.ZodString>;
@@ -4978,6 +5273,7 @@ export declare const performanceV1Registry: import("./core.js").PublicV1Registry
4978
5273
  readonly speedIndex: 2400;
4979
5274
  readonly ttfb: 210;
4980
5275
  readonly completedAt: '2026-08-10T01:00:00.000Z';
5276
+ readonly javascript: null;
4981
5277
  readonly performanceIssues: readonly [];
4982
5278
  readonly cachePolicy: readonly [];
4983
5279
  readonly thirdParties: readonly [];
@@ -726,6 +726,41 @@ const scanCoverageShape = {
726
726
  bestPracticesChecksTotal: schema.number().int().nonnegative(),
727
727
  possiblyTruncated: schema.boolean(),
728
728
  };
729
+ const scanJavascriptShape = {
730
+ transferBytes: nullableMetricSchema,
731
+ decodedBytes: nullableMetricSchema,
732
+ scriptCount: schema.number().int().nonnegative().nullable(),
733
+ };
734
+ /** Trace timings are separate from the reported metric under simulated throttling. */
735
+ export const lcpObservedTraceSchema = schema.discriminatedUnion('_tag', [
736
+ schema.strictObject({
737
+ _tag: schema.literal('available'),
738
+ basis: schema.literal('observed'),
739
+ throttlingMethod: schema.enum(['simulate', 'provided', 'devtools']),
740
+ observedLcpMs: schema.number().positive(),
741
+ phases: schema.array(schema.strictObject({
742
+ id: schema.enum(['timeToFirstByte', 'resourceLoadDelay', 'resourceLoadDuration', 'elementRenderDelay']),
743
+ durationMs: schema.number().nonnegative(),
744
+ })).min(2).max(4),
745
+ }),
746
+ schema.strictObject({
747
+ _tag: schema.literal('unavailable'),
748
+ reason: schema.enum(['missing-report-data', 'invalid-report-data', 'legacy-projection', 'projection-missing', 'projection-unavailable']),
749
+ }),
750
+ ]).superRefine((trace, context) => {
751
+ if (trace._tag !== 'available')
752
+ return;
753
+ const ids = new Set(trace.phases.map(phase => phase.id));
754
+ const totalMs = trace.phases.reduce((total, phase) => total + phase.durationMs, 0);
755
+ // The metrics audit rounds observed LCP. Allow rounding, never substitute
756
+ // the separately reported metric as the phase total.
757
+ if (ids.size !== trace.phases.length
758
+ || !ids.has('timeToFirstByte') || !ids.has('elementRenderDelay')
759
+ || ids.has('resourceLoadDelay') !== ids.has('resourceLoadDuration')
760
+ || Math.abs(totalMs - trace.observedLcpMs) > 2) {
761
+ context.addIssue({ code: 'custom', message: 'Trace phases must describe the observed LCP' });
762
+ }
763
+ });
729
764
  export const performanceScanDetailDataSchema = defineResponseObject({
730
765
  id: schema.string().min(1),
731
766
  url: schema.string().min(1),
@@ -739,6 +774,8 @@ export const performanceScanDetailDataSchema = defineResponseObject({
739
774
  speedIndex: nullableMetricSchema,
740
775
  ttfb: nullableMetricSchema,
741
776
  completedAt: schema.string().datetime().nullable(),
777
+ javascript: schema.strictObject(scanJavascriptShape).nullable(),
778
+ observedTrace: lcpObservedTraceSchema.optional(),
742
779
  performanceIssues: schema.array(scanPerformanceIssueSchema.producer),
743
780
  cachePolicy: schema.array(scanCachePolicySchema.producer),
744
781
  thirdParties: schema.array(scanThirdPartySchema.producer),
@@ -763,6 +800,8 @@ export const performanceScanDetailDataSchema = defineResponseObject({
763
800
  speedIndex: nullableMetricSchema,
764
801
  ttfb: nullableMetricSchema,
765
802
  completedAt: schema.string().datetime().nullable(),
803
+ javascript: schema.looseObject(scanJavascriptShape).nullable().optional(),
804
+ observedTrace: lcpObservedTraceSchema.optional(),
766
805
  performanceIssues: schema.array(scanPerformanceIssueSchema.client),
767
806
  cachePolicy: schema.array(scanCachePolicySchema.client),
768
807
  thirdParties: schema.array(scanThirdPartySchema.client),
@@ -832,6 +871,7 @@ export const performanceScanDetailOperation = defineOperation({
832
871
  speedIndex: 2400,
833
872
  ttfb: 210,
834
873
  completedAt: '2026-08-10T01:00:00.000Z',
874
+ javascript: null,
835
875
  performanceIssues: [],
836
876
  cachePolicy: [],
837
877
  thirdParties: [],