@canonry/canonry 4.180.4 → 4.180.6

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.
Files changed (25) hide show
  1. package/assets/assets/{AuditHistoryPanel-CdM_9qX1.js → AuditHistoryPanel-Cwgbldst.js} +1 -1
  2. package/assets/assets/{BacklinksPage-DWWMPSPn.js → BacklinksPage-h08vP0Of.js} +1 -1
  3. package/assets/assets/{HistoryPage-m7TtGFBQ.js → HistoryPage-Dwyad0V0.js} +1 -1
  4. package/assets/assets/{MeasurementPropertyPage-CYBfBtEz.js → MeasurementPropertyPage-DOyOHeiU.js} +1 -1
  5. package/assets/assets/{ProjectPage-CNPcNrIR.js → ProjectPage-D9e_1Gpz.js} +6 -6
  6. package/assets/assets/{RunRow-O4u505Fc.js → RunRow-CVl2cqfG.js} +1 -1
  7. package/assets/assets/{RunsPage-CCzFT4X0.js → RunsPage-zzN2iQbk.js} +1 -1
  8. package/assets/assets/{SettingsPage-DOmE3JbU.js → SettingsPage-qiQLOtpd.js} +1 -1
  9. package/assets/assets/{SiteHealthSection-BZFVE2h9.js → SiteHealthSection-R0MWiuZX.js} +3 -3
  10. package/assets/assets/{TrafficPage-DYxOEVbW.js → TrafficPage-CEA76iwx.js} +1 -1
  11. package/assets/assets/{TrafficSourceDetailPage-Qd5Zpx_8.js → TrafficSourceDetailPage-BnbNPkis.js} +1 -1
  12. package/assets/assets/{extract-error-message-B0bdIDVc.js → extract-error-message-Ctp1FqW1.js} +1 -1
  13. package/assets/assets/{index-HmdbSL4h.js → index-D-OGmIKF.js} +3 -3
  14. package/assets/assets/{react-sigma_core.esm.min-DXCrX1Ie.js → react-sigma_core.esm.min-DwnhdseV.js} +1 -1
  15. package/assets/index.html +1 -1
  16. package/dist/{chunk-JJIESVNL.js → chunk-CWXPBQR5.js} +1 -1
  17. package/dist/{chunk-UESVOQRS.js → chunk-RXXZ5BU5.js} +23 -2
  18. package/dist/{chunk-2J65ALIR.js → chunk-VZO6CLHY.js} +4 -4
  19. package/dist/{chunk-V4QGOJNH.js → chunk-WJFBNCVD.js} +121 -45
  20. package/dist/{chunk-DK23XZ6C.js → chunk-XYTSKRO3.js} +2 -2
  21. package/dist/cli.js +14 -20
  22. package/dist/index.js +4 -4
  23. package/dist/{intelligence-service-XNAKDGDQ.js → intelligence-service-MEPYXRBS.js} +2 -2
  24. package/dist/mcp.js +3 -3
  25. package/package.json +12 -12
@@ -1,4 +1,4 @@
1
- import{g as Bt,t as S,r as C}from"./vendor-tanstack-Dock0eH1.js";import{e as Ht,G as Wt}from"./SiteHealthSection-BZFVE2h9.js";import"./index-HmdbSL4h.js";import"./vendor-radix-4UOaVWza.js";import"./vendor-recharts-D8rt5lKn.js";import"./vendor-lucide-nYKv-BB7.js";import"./vendor-markdown-Bn7fRwrx.js";import"./vendor-yaml-GWJz5H2G.js";import"./ChartPrimitives-DG35TyhH.js";function Vt(r,n){if(typeof r!="object"||!r)return r;var i=r[Symbol.toPrimitive];if(i!==void 0){var e=i.call(r,n);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function ae(r){var n=Vt(r,"string");return typeof n=="symbol"?n:n+""}function A(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}function He(r,n){for(var i=0;i<n.length;i++){var e=n[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(r,ae(e.key),e)}}function L(r,n,i){return n&&He(r.prototype,n),i&&He(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r}function Q(r){return Q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Q(r)}function yt(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yt=function(){return!!r})()}function jt(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Zt(r,n){if(n&&(typeof n=="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jt(r)}function I(r,n,i){return n=Q(n),Zt(r,yt()?Reflect.construct(n,i||[],Q(r).constructor):n.apply(r,i))}function xe(r,n){return xe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,e){return i.__proto__=e,i},xe(r,n)}function G(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(n&&n.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),n&&xe(r,n)}function qt(r){if(Array.isArray(r))return r}function Yt(r,n){var i=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(i!=null){var e,t,a,o,s=[],l=!0,h=!1;try{if(a=(i=i.call(r)).next,n===0){if(Object(i)!==i)return;l=!1}else for(;!(l=(e=a.call(i)).done)&&(s.push(e.value),s.length!==n);l=!0);}catch(u){h=!0,t=u}finally{try{if(!l&&i.return!=null&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw t}}return s}}function Se(r,n){(n==null||n>r.length)&&(n=r.length);for(var i=0,e=Array(n);i<n;i++)e[i]=r[i];return e}function Tt(r,n){if(r){if(typeof r=="string")return Se(r,n);var i={}.toString.call(r).slice(8,-1);return i==="Object"&&r.constructor&&(i=r.constructor.name),i==="Map"||i==="Set"?Array.from(r):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Se(r,n):void 0}}function Xt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{g as Bt,t as S,r as C}from"./vendor-tanstack-Dock0eH1.js";import{e as Ht,G as Wt}from"./SiteHealthSection-R0MWiuZX.js";import"./index-D-OGmIKF.js";import"./vendor-radix-4UOaVWza.js";import"./vendor-recharts-D8rt5lKn.js";import"./vendor-lucide-nYKv-BB7.js";import"./vendor-markdown-Bn7fRwrx.js";import"./vendor-yaml-GWJz5H2G.js";import"./ChartPrimitives-DG35TyhH.js";function Vt(r,n){if(typeof r!="object"||!r)return r;var i=r[Symbol.toPrimitive];if(i!==void 0){var e=i.call(r,n);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function ae(r){var n=Vt(r,"string");return typeof n=="symbol"?n:n+""}function A(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}function He(r,n){for(var i=0;i<n.length;i++){var e=n[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(r,ae(e.key),e)}}function L(r,n,i){return n&&He(r.prototype,n),i&&He(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r}function Q(r){return Q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Q(r)}function yt(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yt=function(){return!!r})()}function jt(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Zt(r,n){if(n&&(typeof n=="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jt(r)}function I(r,n,i){return n=Q(n),Zt(r,yt()?Reflect.construct(n,i||[],Q(r).constructor):n.apply(r,i))}function xe(r,n){return xe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,e){return i.__proto__=e,i},xe(r,n)}function G(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(n&&n.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),n&&xe(r,n)}function qt(r){if(Array.isArray(r))return r}function Yt(r,n){var i=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(i!=null){var e,t,a,o,s=[],l=!0,h=!1;try{if(a=(i=i.call(r)).next,n===0){if(Object(i)!==i)return;l=!1}else for(;!(l=(e=a.call(i)).done)&&(s.push(e.value),s.length!==n);l=!0);}catch(u){h=!0,t=u}finally{try{if(!l&&i.return!=null&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw t}}return s}}function Se(r,n){(n==null||n>r.length)&&(n=r.length);for(var i=0,e=Array(n);i<n;i++)e[i]=r[i];return e}function Tt(r,n){if(r){if(typeof r=="string")return Se(r,n);var i={}.toString.call(r).slice(8,-1);return i==="Object"&&r.constructor&&(i=r.constructor.name),i==="Map"||i==="Set"?Array.from(r):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Se(r,n):void 0}}function Xt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ee(r,n){return qt(r)||Yt(r,n)||Tt(r,n)||Xt()}var pe={black:"#000000",silver:"#C0C0C0",gray:"#808080",grey:"#808080",white:"#FFFFFF",maroon:"#800000",red:"#FF0000",purple:"#800080",fuchsia:"#FF00FF",green:"#008000",lime:"#00FF00",olive:"#808000",yellow:"#FFFF00",navy:"#000080",blue:"#0000FF",teal:"#008080",aqua:"#00FFFF",darkblue:"#00008B",mediumblue:"#0000CD",darkgreen:"#006400",darkcyan:"#008B8B",deepskyblue:"#00BFFF",darkturquoise:"#00CED1",mediumspringgreen:"#00FA9A",springgreen:"#00FF7F",cyan:"#00FFFF",midnightblue:"#191970",dodgerblue:"#1E90FF",lightseagreen:"#20B2AA",forestgreen:"#228B22",seagreen:"#2E8B57",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",limegreen:"#32CD32",mediumseagreen:"#3CB371",turquoise:"#40E0D0",royalblue:"#4169E1",steelblue:"#4682B4",darkslateblue:"#483D8B",mediumturquoise:"#48D1CC",indigo:"#4B0082",darkolivegreen:"#556B2F",cadetblue:"#5F9EA0",cornflowerblue:"#6495ED",rebeccapurple:"#663399",mediumaquamarine:"#66CDAA",dimgray:"#696969",dimgrey:"#696969",slateblue:"#6A5ACD",olivedrab:"#6B8E23",slategray:"#708090",slategrey:"#708090",lightslategray:"#778899",lightslategrey:"#778899",mediumslateblue:"#7B68EE",lawngreen:"#7CFC00",chartreuse:"#7FFF00",aquamarine:"#7FFFD4",skyblue:"#87CEEB",lightskyblue:"#87CEFA",blueviolet:"#8A2BE2",darkred:"#8B0000",darkmagenta:"#8B008B",saddlebrown:"#8B4513",darkseagreen:"#8FBC8F",lightgreen:"#90EE90",mediumpurple:"#9370DB",darkviolet:"#9400D3",palegreen:"#98FB98",darkorchid:"#9932CC",yellowgreen:"#9ACD32",sienna:"#A0522D",brown:"#A52A2A",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",lightblue:"#ADD8E6",greenyellow:"#ADFF2F",paleturquoise:"#AFEEEE",lightsteelblue:"#B0C4DE",powderblue:"#B0E0E6",firebrick:"#B22222",darkgoldenrod:"#B8860B",mediumorchid:"#BA55D3",rosybrown:"#BC8F8F",darkkhaki:"#BDB76B",mediumvioletred:"#C71585",indianred:"#CD5C5C",peru:"#CD853F",chocolate:"#D2691E",tan:"#D2B48C",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",thistle:"#D8BFD8",orchid:"#DA70D6",goldenrod:"#DAA520",palevioletred:"#DB7093",crimson:"#DC143C",gainsboro:"#DCDCDC",plum:"#DDA0DD",burlywood:"#DEB887",lightcyan:"#E0FFFF",lavender:"#E6E6FA",darksalmon:"#E9967A",violet:"#EE82EE",palegoldenrod:"#EEE8AA",lightcoral:"#F08080",khaki:"#F0E68C",aliceblue:"#F0F8FF",honeydew:"#F0FFF0",azure:"#F0FFFF",sandybrown:"#F4A460",wheat:"#F5DEB3",beige:"#F5F5DC",whitesmoke:"#F5F5F5",mintcream:"#F5FFFA",ghostwhite:"#F8F8FF",salmon:"#FA8072",antiquewhite:"#FAEBD7",linen:"#FAF0E6",lightgoldenrodyellow:"#FAFAD2",oldlace:"#FDF5E6",magenta:"#FF00FF",deeppink:"#FF1493",orangered:"#FF4500",tomato:"#FF6347",hotpink:"#FF69B4",coral:"#FF7F50",darkorange:"#FF8C00",lightsalmon:"#FFA07A",orange:"#FFA500",lightpink:"#FFB6C1",pink:"#FFC0CB",gold:"#FFD700",peachpuff:"#FFDAB9",navajowhite:"#FFDEAD",moccasin:"#FFE4B5",bisque:"#FFE4C4",mistyrose:"#FFE4E1",blanchedalmond:"#FFEBCD",papayawhip:"#FFEFD5",lavenderblush:"#FFF0F5",seashell:"#FFF5EE",cornsilk:"#FFF8DC",lemonchiffon:"#FFFACD",floralwhite:"#FFFAF0",snow:"#FFFAFA",lightyellow:"#FFFFE0",ivory:"#FFFFF0"},Ct=new Int8Array(4),be=new Int32Array(Ct.buffer,0,1),$t=new Float32Array(Ct.buffer,0,1),Kt=/^\s*rgba?\s*\(/,Jt=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;function Qt(r){var n=0,i=0,e=0,t=1;if(r[0]==="#")r.length===4?(n=parseInt(r.charAt(1)+r.charAt(1),16),i=parseInt(r.charAt(2)+r.charAt(2),16),e=parseInt(r.charAt(3)+r.charAt(3),16)):(n=parseInt(r.charAt(1)+r.charAt(2),16),i=parseInt(r.charAt(3)+r.charAt(4),16),e=parseInt(r.charAt(5)+r.charAt(6),16)),r.length===9&&(t=parseInt(r.charAt(7)+r.charAt(8),16)/255);else if(Kt.test(r)){var a=r.match(Jt);a&&(n=+a[1],i=+a[2],e=+a[3],a[4]&&(t=+a[4]))}return{r:n,g:i,b:e,a:t}}var J={};for(var le in pe)J[le]=oe(pe[le]),J[pe[le]]=J[le];function Rt(r,n,i,e,t){return be[0]=e<<24|i<<16|n<<8|r,be[0]=be[0]&4278190079,$t[0]}function oe(r){if(r=r.toLowerCase(),typeof J[r]<"u")return J[r];var n=Qt(r),i=n.r,e=n.g,t=n.b,a=n.a;a=a*255|0;var o=Rt(i,e,t,a);return J[r]=o,o}var Ee={};function _t(r){if(typeof Ee[r]<"u")return Ee[r];var n=(r&16711680)>>>16,i=(r&65280)>>>8,e=r&255,t=255,a=Rt(n,i,e,t);return Ee[r]=a,a}function We(r,n,i,e){return i+(n<<8)+(r<<16)}function Ve(r,n,i,e,t,a){var o=Math.floor(i/a*t),s=Math.floor(r.drawingBufferHeight/a-e/a*t),l=new Uint8Array(4);r.bindFramebuffer(r.FRAMEBUFFER,n),r.readPixels(o,s,1,1,r.RGBA,r.UNSIGNED_BYTE,l);var h=ee(l,4),u=h[0],d=h[1],f=h[2],g=h[3];return[u,d,f,g]}function c(r,n,i){return(n=ae(n))in r?Object.defineProperty(r,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[n]=i,r}function je(r,n){var i=Object.keys(r);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(r);n&&(e=e.filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})),i.push.apply(i,e)}return i}function b(r){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?je(Object(i),!0).forEach(function(e){c(r,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):je(Object(i)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))})}return r}function ei(r,n){for(;!{}.hasOwnProperty.call(r,n)&&(r=Q(r))!==null;);return r}function Ae(){return Ae=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(r,n,i){var e=ei(r,n);if(e){var t=Object.getOwnPropertyDescriptor(e,n);return t.get?t.get.call(arguments.length<3?r:i):t.value}},Ae.apply(null,arguments)}function wt(r,n,i,e){var t=Ae(Q(r.prototype),n,i);return typeof t=="function"?function(a){return t.apply(i,a)}:t}function ti(r){return r.normalized?1:r.size}function ye(r){var n=0;return r.forEach(function(i){return n+=ti(i)}),n}function xt(r,n,i){var e=r==="VERTEX"?n.VERTEX_SHADER:n.FRAGMENT_SHADER,t=n.createShader(e);if(t===null)throw new Error("loadShader: error while creating the shader");n.shaderSource(t,i),n.compileShader(t);var a=n.getShaderParameter(t,n.COMPILE_STATUS);if(!a){var o=n.getShaderInfoLog(t);throw n.deleteShader(t),new Error(`loadShader: error while compiling the shader:
3
3
  `.concat(o,`
4
4
  `).concat(i))}return t}function ii(r,n){return xt("VERTEX",r,n)}function ri(r,n){return xt("FRAGMENT",r,n)}function ni(r,n){var i=r.createProgram();if(i===null)throw new Error("loadProgram: error while creating the program.");var e,t;for(e=0,t=n.length;e<t;e++)r.attachShader(i,n[e]);r.linkProgram(i);var a=r.getProgramParameter(i,r.LINK_STATUS);if(!a){var o=r.getProgramInfoLog(i);throw r.deleteProgram(i),new Error("loadProgram: error while linking the program: ".concat(o))}return i}function Ze(r){var n=r.gl,i=r.buffer,e=r.program,t=r.vertexShader,a=r.fragmentShader;n.deleteShader(t),n.deleteShader(a),n.deleteProgram(e),n.deleteBuffer(i)}var qe=`#define PICKING_MODE
package/assets/index.html CHANGED
@@ -12,7 +12,7 @@
12
12
  <link rel="icon" type="image/png" sizes="32x32" href="./favicon-32.png" />
13
13
  <link rel="apple-touch-icon" href="./apple-touch-icon.png" />
14
14
  <title>Canonry</title>
15
- <script type="module" crossorigin src="./assets/index-HmdbSL4h.js"></script>
15
+ <script type="module" crossorigin src="./assets/index-D-OGmIKF.js"></script>
16
16
  <link rel="modulepreload" crossorigin href="./assets/vendor-tanstack-Dock0eH1.js">
17
17
  <link rel="modulepreload" crossorigin href="./assets/vendor-radix-4UOaVWza.js">
18
18
  <link rel="modulepreload" crossorigin href="./assets/vendor-recharts-D8rt5lKn.js">
@@ -92,7 +92,7 @@ import {
92
92
  trafficConnectWordpressRequestSchema,
93
93
  trafficEventKindSchema,
94
94
  trafficSeriesGranularitySchema
95
- } from "./chunk-UESVOQRS.js";
95
+ } from "./chunk-RXXZ5BU5.js";
96
96
 
97
97
  // src/config.ts
98
98
  import fs from "fs";
@@ -12370,7 +12370,12 @@ var ga4TrafficSummaryDtoSchema = z39.object({
12370
12370
  /** Total social sessions (session-scoped, no cross-dimension dedup needed). */
12371
12371
  socialSessions: z39.number(),
12372
12372
  /** Total social users (session-scoped, no cross-dimension dedup needed). */
12373
- socialUsers: z39.number(),
12373
+ /**
12374
+ * @deprecated Never emitted. ga_social_referrals stores users as GA's
12375
+ * COUNT DISTINCT at (date, source, medium, channel group), so summing it
12376
+ * across the window counts a returning visitor once per day.
12377
+ */
12378
+ socialUsers: z39.number().optional(),
12374
12379
  /** Five disjoint buckets used for the channel breakdown. Known AI session-source matches are removed from their native GA4 bucket before shares are computed. */
12375
12380
  channelBreakdown: ga4ChannelBreakdownDtoSchema,
12376
12381
  /** Organic sessions as a percentage of total sessions (0–100, rounded). */
@@ -13706,7 +13711,13 @@ var gaTrafficSectionSchema = z47.object({
13706
13711
  topLandingPages: z47.array(z47.object({
13707
13712
  page: z47.string(),
13708
13713
  sessions: z47.number(),
13709
- users: z47.number(),
13714
+ /**
13715
+ * @deprecated Never emitted. A per-landing-page user count cannot be
13716
+ * summed: GA evaluates users as a COUNT DISTINCT at the requested grain,
13717
+ * so a visitor is counted once per page and per day. Kept optional so
13718
+ * existing consumers keep parsing.
13719
+ */
13720
+ users: z47.number().optional(),
13710
13721
  organicSessions: z47.number()
13711
13722
  })),
13712
13723
  channelBreakdown: z47.array(z47.object({
@@ -13840,6 +13851,14 @@ var serverActivitySectionSchema = z47.object({
13840
13851
  topCrawledPaths: z47.array(z47.object({
13841
13852
  path: z47.string(),
13842
13853
  verifiedHits: z47.number(),
13854
+ /**
13855
+ * Hits from a crawler that identified itself but whose source IP could not
13856
+ * be matched against the operator's published ranges. Additive, not an
13857
+ * alternative: some log sources carry no client IP at all (Vercel request
13858
+ * logs, for one), so for those projects every hit lands here and a
13859
+ * verified-only view reports zero against real crawl activity.
13860
+ */
13861
+ unverifiedHits: z47.number().default(0),
13843
13862
  /** How many distinct AI operators crawled this path in the window. */
13844
13863
  distinctOperators: z47.number()
13845
13864
  })),
@@ -13853,6 +13872,8 @@ var serverActivitySectionSchema = z47.object({
13853
13872
  dailyTrend: z47.array(z47.object({
13854
13873
  date: z47.string(),
13855
13874
  verifiedCrawlerHits: z47.number(),
13875
+ /** See topCrawledPaths.unverifiedHits. Plotted alongside, never instead. */
13876
+ unverifiedCrawlerHits: z47.number().default(0),
13856
13877
  userFetchHits: z47.number(),
13857
13878
  referralArrivals: z47.number()
13858
13879
  })),
@@ -11,7 +11,7 @@ import {
11
11
  loadConfig,
12
12
  loadConfigRaw,
13
13
  saveConfigPatch
14
- } from "./chunk-JJIESVNL.js";
14
+ } from "./chunk-CWXPBQR5.js";
15
15
  import {
16
16
  CC_CACHE_DIR,
17
17
  DUCKDB_SPEC,
@@ -157,7 +157,7 @@ import {
157
157
  siteCrawlSnapshots,
158
158
  toAlertView,
159
159
  usageCounters
160
- } from "./chunk-V4QGOJNH.js";
160
+ } from "./chunk-WJFBNCVD.js";
161
161
  import {
162
162
  AGENT_MEMORY_VALUE_MAX_BYTES,
163
163
  AGENT_PROVIDER_IDS,
@@ -295,7 +295,7 @@ import {
295
295
  validationError,
296
296
  winnabilityClassLabel,
297
297
  withRetry
298
- } from "./chunk-UESVOQRS.js";
298
+ } from "./chunk-RXXZ5BU5.js";
299
299
 
300
300
  // src/telemetry.ts
301
301
  import crypto from "crypto";
@@ -11866,7 +11866,7 @@ function readStoredGroundingSources(rawResponse) {
11866
11866
  return result;
11867
11867
  }
11868
11868
  async function backfillInsightsCommand(project, opts) {
11869
- const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-XNAKDGDQ.js");
11869
+ const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-MEPYXRBS.js");
11870
11870
  const config = loadConfig();
11871
11871
  const db = createClient(config.database);
11872
11872
  migrate(db);
@@ -643,7 +643,7 @@ import {
643
643
  wordpressSchemaDeployResultDtoSchema,
644
644
  wordpressSchemaStatusResultDtoSchema,
645
645
  wordpressStatusDtoSchema
646
- } from "./chunk-UESVOQRS.js";
646
+ } from "./chunk-RXXZ5BU5.js";
647
647
 
648
648
  // src/intelligence-service.ts
649
649
  import { eq as eq62, desc as desc27, asc as asc11, and as and51, ne as ne8, or as or14, inArray as inArray22, gte as gte15, lte as lte13, isNull as isNull9, sql as sql25, exists } from "drizzle-orm";
@@ -22762,8 +22762,9 @@ function loadOrchestratorInput(db, project, locationFilter = void 0, gscWindowDa
22762
22762
  sitemapUrls: [],
22763
22763
  wpPosts: []
22764
22764
  });
22765
- const gaTrafficByPage = buildGaTrafficByPage(db, projectId);
22766
- const totalAiReferralSessions = sumAiReferralSessions(db, projectId);
22765
+ const gaWindow = resolveContentGaWindow(db, projectId, gscWindowDays);
22766
+ const gaTrafficByPage = buildGaTrafficByPage(db, projectId, gaWindow);
22767
+ const totalAiReferralSessions = sumAiReferralSessions(db, projectId, gaWindow);
22767
22768
  const domainClasses = loadDomainClasses(db, projectId);
22768
22769
  return {
22769
22770
  projectId,
@@ -22890,24 +22891,42 @@ function listGa4LandingPagesForProject(db, projectId) {
22890
22891
  const rows = db.selectDistinct({ landingPage: gaTrafficSnapshots.landingPage }).from(gaTrafficSnapshots).where(eq27(gaTrafficSnapshots.projectId, projectId)).all();
22891
22892
  return rows.map((r) => r.landingPage);
22892
22893
  }
22893
- function buildGaTrafficByPage(db, projectId) {
22894
+ function buildGaTrafficByPage(db, projectId, window) {
22895
+ if (!window) return /* @__PURE__ */ new Map();
22894
22896
  const rows = db.select({
22895
22897
  landingPage: gaTrafficSnapshots.landingPage,
22896
- sessions: gaTrafficSnapshots.sessions
22897
- }).from(gaTrafficSnapshots).where(eq27(gaTrafficSnapshots.projectId, projectId)).all();
22898
+ organicSessions: gaTrafficSnapshots.organicSessions
22899
+ }).from(gaTrafficSnapshots).where(and22(
22900
+ eq27(gaTrafficSnapshots.projectId, projectId),
22901
+ gte5(gaTrafficSnapshots.date, window.startDate),
22902
+ lte3(gaTrafficSnapshots.date, window.endDate)
22903
+ )).all();
22898
22904
  const map = /* @__PURE__ */ new Map();
22899
22905
  for (const row of rows) {
22900
22906
  const path8 = extractPath2(row.landingPage);
22901
22907
  if (!path8) continue;
22902
- map.set(path8, (map.get(path8) ?? 0) + (row.sessions ?? 0));
22908
+ map.set(path8, (map.get(path8) ?? 0) + (row.organicSessions ?? 0));
22903
22909
  }
22904
22910
  return map;
22905
22911
  }
22906
- function sumAiReferralSessions(db, projectId) {
22912
+ function resolveContentGaWindow(db, projectId, windowDays2) {
22913
+ const latest = db.select({ date: gaTrafficSnapshots.date }).from(gaTrafficSnapshots).where(eq27(gaTrafficSnapshots.projectId, projectId)).orderBy(desc10(gaTrafficSnapshots.date)).limit(1).get();
22914
+ if (!latest?.date) return null;
22915
+ const end = /* @__PURE__ */ new Date(`${latest.date}T00:00:00Z`);
22916
+ end.setUTCDate(end.getUTCDate() - (Math.max(1, windowDays2) - 1));
22917
+ return { startDate: end.toISOString().slice(0, 10), endDate: latest.date };
22918
+ }
22919
+ function sumAiReferralSessions(db, projectId, window) {
22920
+ if (!window) return 0;
22907
22921
  const rows = db.select({ sessions: gaAiReferrals.sessions }).from(gaAiReferrals).where(
22908
22922
  and22(
22909
22923
  eq27(gaAiReferrals.projectId, projectId),
22910
- eq27(gaAiReferrals.sourceDimension, "session")
22924
+ eq27(gaAiReferrals.sourceDimension, "session"),
22925
+ // Bounded for the same reason the per-page read is: this scales every
22926
+ // opportunity score, so a lifetime total quietly weights the ranking
22927
+ // toward whatever was true months ago.
22928
+ gte5(gaAiReferrals.date, window.startDate),
22929
+ lte3(gaAiReferrals.date, window.endDate)
22911
22930
  )
22912
22931
  ).all();
22913
22932
  return rows.reduce((acc, r) => acc + (r.sessions ?? 0), 0);
@@ -22954,13 +22973,15 @@ function buildCandidateQueries(opts) {
22954
22973
  });
22955
22974
  }
22956
22975
  var DEFAULT_CONTENT_GSC_WINDOW_DAYS = 30;
22957
- function resolveContentGscWindow(db, projectId, windowDays2) {
22958
- const endDate = readLatestGscDataDate(db, projectId);
22959
- if (!endDate) return null;
22976
+ function windowEndingOn(endDate, windowDays2) {
22960
22977
  const end = /* @__PURE__ */ new Date(`${endDate}T00:00:00Z`);
22961
22978
  end.setUTCDate(end.getUTCDate() - (Math.max(1, windowDays2) - 1));
22962
22979
  return { startDate: end.toISOString().slice(0, 10), endDate };
22963
22980
  }
22981
+ function resolveContentGscWindow(db, projectId, windowDays2) {
22982
+ const endDate = readLatestGscDataDate(db, projectId);
22983
+ return endDate ? windowEndingOn(endDate, windowDays2) : null;
22984
+ }
22964
22985
  function pageDayFallback(rows) {
22965
22986
  const byDay = /* @__PURE__ */ new Map();
22966
22987
  for (const r of rows) {
@@ -25054,7 +25075,6 @@ function renderGa(report) {
25054
25075
  <tr>
25055
25076
  <td class="page-cell">${formatLandingPageHtml(p.page)}</td>
25056
25077
  <td class="numeric">${formatNumber(p.sessions)}</td>
25057
- <td class="numeric">${formatNumber(p.users)}</td>
25058
25078
  <td class="numeric">${formatNumber(p.organicSessions)}</td>
25059
25079
  </tr>`).join("");
25060
25080
  const channelBars = renderShareBars(
@@ -25076,7 +25096,7 @@ function renderGa(report) {
25076
25096
  </div>
25077
25097
  <div class="chart-card"><h3>Top landing pages</h3>
25078
25098
  <table class="report-table">
25079
- <thead><tr><th>Page</th><th class="numeric">Sessions</th><th class="numeric">Users</th><th class="numeric">Organic</th></tr></thead>
25099
+ <thead><tr><th>Page</th><th class="numeric">Sessions</th><th class="numeric">Organic</th></tr></thead>
25080
25100
  <tbody>${pageRows}</tbody>
25081
25101
  </table>
25082
25102
  </div>
@@ -25267,7 +25287,8 @@ function renderServerActivity(report, audience) {
25267
25287
  const pathRows = sa.topCrawledPaths.map((p) => `
25268
25288
  <tr>
25269
25289
  <td class="page-cell">${formatLandingPageHtml(p.path)}</td>
25270
- <td class="numeric">${formatNumber(p.verifiedHits)}</td>
25290
+ <td class="numeric">${formatNumber(p.verifiedHits + (p.unverifiedHits ?? 0))}</td>
25291
+ <td class="numeric meta">${formatNumber(p.verifiedHits)}</td>
25271
25292
  <td class="numeric">${p.distinctOperators}</td>
25272
25293
  </tr>`).join("");
25273
25294
  const referralProductRows = sa.referralProducts.map((p) => `
@@ -25322,7 +25343,7 @@ function renderServerActivity(report, audience) {
25322
25343
  ${pathRows ? `<div class="chart-card"><h3>Top crawled paths</h3>
25323
25344
  <p class="meta">Pages AI bots fetched most often (verified only, last ${windowLabel}).</p>
25324
25345
  <table class="report-table">
25325
- <thead><tr><th>Path</th><th class="numeric">Verified hits</th><th class="numeric">Distinct operators</th></tr></thead>
25346
+ <thead><tr><th>Path</th><th class="numeric">Hits</th><th class="numeric">Verified</th><th class="numeric">Distinct operators</th></tr></thead>
25326
25347
  <tbody>${pathRows}</tbody>
25327
25348
  </table>
25328
25349
  </div>` : ""}
@@ -26024,11 +26045,9 @@ function buildGscSection(db, projectId, projectBrandNames, canonicalDomain, trac
26024
26045
  ).all();
26025
26046
  const dailyTotals = readGscDailyTotals(db, projectId, startDate, maxDate);
26026
26047
  if (rows.length === 0 && dailyTotals.length === 0) return null;
26027
- let dimensionedClicks = 0;
26028
26048
  const queryDayAgg = /* @__PURE__ */ new Map();
26029
26049
  const dimensionedTrendAgg = /* @__PURE__ */ new Map();
26030
26050
  for (const r of rows) {
26031
- dimensionedClicks += r.clicks;
26032
26051
  const dayKey = `${r.date} ${r.query}`;
26033
26052
  const q = queryDayAgg.get(dayKey) ?? { date: r.date, query: r.query, clicks: 0, impressions: 0, weightedPositionSum: 0 };
26034
26053
  q.clicks += r.clicks;
@@ -26087,11 +26106,12 @@ function buildGscSection(db, projectId, projectBrandNames, canonicalDomain, trac
26087
26106
  bucket.impressions += agg.impressions;
26088
26107
  categoryAgg.set(cat, bucket);
26089
26108
  }
26109
+ const categoryTotalClicks = queryTotals.reduce((sum, q) => sum + q.clicks, 0);
26090
26110
  const categoryBreakdown = [...categoryAgg.entries()].map(([category, agg]) => ({
26091
26111
  category,
26092
26112
  clicks: agg.clicks,
26093
26113
  impressions: agg.impressions,
26094
- sharePct: dimensionedClicks > 0 ? Math.round(agg.clicks / dimensionedClicks * 100) : 0
26114
+ sharePct: categoryTotalClicks > 0 ? Math.round(agg.clicks / categoryTotalClicks * 100) : 0
26095
26115
  })).sort((a, b) => b.clicks - a.clicks);
26096
26116
  const periodStart = trend[0]?.date ?? "";
26097
26117
  const periodEnd = trend.at(-1)?.date ?? "";
@@ -26152,7 +26172,6 @@ function buildGaSection(db, projectId, windowDays2) {
26152
26172
  const topLandingPages = [...pageAgg.entries()].map(([page2, data]) => ({
26153
26173
  page: page2,
26154
26174
  sessions: data.sessions,
26155
- users: data.users,
26156
26175
  organicSessions: data.organic
26157
26176
  })).sort((a, b) => b.sessions - a.sessions).slice(0, TOP_LANDING_PAGES_LIMIT);
26158
26177
  const aiConditions = [
@@ -26213,8 +26232,13 @@ function buildGaSection(db, projectId, windowDays2) {
26213
26232
  channelBreakdown
26214
26233
  };
26215
26234
  }
26216
- function buildSocialReferrals(db, projectId) {
26217
- const rows = db.select().from(gaSocialReferrals).where(eq29(gaSocialReferrals.projectId, projectId)).all();
26235
+ function buildSocialReferrals(db, projectId, windowDays2) {
26236
+ const window = resolveAiReferralWindow(db, projectId, windowDays2);
26237
+ const rows = db.select().from(gaSocialReferrals).where(and24(
26238
+ eq29(gaSocialReferrals.projectId, projectId),
26239
+ gte6(gaSocialReferrals.date, window.start),
26240
+ lte4(gaSocialReferrals.date, window.end)
26241
+ )).all();
26218
26242
  if (rows.length === 0) return null;
26219
26243
  let total = 0;
26220
26244
  let organic = 0;
@@ -26425,7 +26449,6 @@ function buildServerActivity(db, projectId, windowDays2) {
26425
26449
  }).from(crawlerEventsHourly).where(
26426
26450
  and24(
26427
26451
  eq29(crawlerEventsHourly.projectId, projectId),
26428
- eq29(crawlerEventsHourly.verificationStatus, VerificationStatuses.verified),
26429
26452
  gte6(crawlerEventsHourly.tsHour, priorStart),
26430
26453
  lt6(crawlerEventsHourly.tsHour, headlineStart)
26431
26454
  )
@@ -26480,25 +26503,26 @@ function buildServerActivity(db, projectId, windowDays2) {
26480
26503
  unverifiedHits: v.unverified,
26481
26504
  userFetchHits: v.userFetch,
26482
26505
  referralArrivals: v.referrals,
26483
- deltaPct: deltaPercent(v.verified, v.prior)
26506
+ deltaPct: deltaPercent(v.verified + v.unverified, v.prior)
26484
26507
  })).sort(
26485
26508
  (a, b) => b.verifiedHits - a.verifiedHits || b.userFetchHits - a.userFetchHits || b.unverifiedHits - a.unverifiedHits || b.referralArrivals - a.referralArrivals
26486
26509
  );
26487
26510
  const topPathsRows = db.select({
26488
26511
  path: crawlerEventsHourly.pathNormalized,
26489
- hits: sql10`COALESCE(SUM(${crawlerEventsHourly.hits}), 0)`,
26512
+ verifiedHits: sql10`COALESCE(SUM(CASE WHEN ${crawlerEventsHourly.verificationStatus} = ${VerificationStatuses.verified} THEN ${crawlerEventsHourly.hits} ELSE 0 END), 0)`,
26513
+ unverifiedHits: sql10`COALESCE(SUM(CASE WHEN ${crawlerEventsHourly.verificationStatus} <> ${VerificationStatuses.verified} THEN ${crawlerEventsHourly.hits} ELSE 0 END), 0)`,
26490
26514
  operators: sql10`COUNT(DISTINCT ${crawlerEventsHourly.operator})`
26491
26515
  }).from(crawlerEventsHourly).where(
26492
26516
  and24(
26493
26517
  eq29(crawlerEventsHourly.projectId, projectId),
26494
- eq29(crawlerEventsHourly.verificationStatus, VerificationStatuses.verified),
26495
26518
  gte6(crawlerEventsHourly.tsHour, headlineStart),
26496
26519
  lte4(crawlerEventsHourly.tsHour, headlineEnd)
26497
26520
  )
26498
26521
  ).groupBy(crawlerEventsHourly.pathNormalized).orderBy(desc12(sql10`SUM(${crawlerEventsHourly.hits})`)).limit(SERVER_ACTIVITY_TOP_PATHS_LIMIT).all();
26499
26522
  const topCrawledPaths = topPathsRows.map((r) => ({
26500
26523
  path: r.path,
26501
- verifiedHits: Number(r.hits),
26524
+ verifiedHits: Number(r.verifiedHits),
26525
+ unverifiedHits: Number(r.unverifiedHits),
26502
26526
  distinctOperators: Number(r.operators)
26503
26527
  }));
26504
26528
  const referralProductsRows = db.select({
@@ -26537,11 +26561,11 @@ function buildServerActivity(db, projectId, windowDays2) {
26537
26561
  }));
26538
26562
  const crawlerTrendRows = db.select({
26539
26563
  date: sql10`SUBSTR(${crawlerEventsHourly.tsHour}, 1, 10)`,
26540
- hits: sql10`COALESCE(SUM(${crawlerEventsHourly.hits}), 0)`
26564
+ verifiedHits: sql10`COALESCE(SUM(CASE WHEN ${crawlerEventsHourly.verificationStatus} = ${VerificationStatuses.verified} THEN ${crawlerEventsHourly.hits} ELSE 0 END), 0)`,
26565
+ unverifiedHits: sql10`COALESCE(SUM(CASE WHEN ${crawlerEventsHourly.verificationStatus} <> ${VerificationStatuses.verified} THEN ${crawlerEventsHourly.hits} ELSE 0 END), 0)`
26541
26566
  }).from(crawlerEventsHourly).where(
26542
26567
  and24(
26543
26568
  eq29(crawlerEventsHourly.projectId, projectId),
26544
- eq29(crawlerEventsHourly.verificationStatus, VerificationStatuses.verified),
26545
26569
  gte6(crawlerEventsHourly.tsHour, trendStart),
26546
26570
  lte4(crawlerEventsHourly.tsHour, headlineEnd)
26547
26571
  )
@@ -26567,11 +26591,12 @@ function buildServerActivity(db, projectId, windowDays2) {
26567
26591
  lte4(aiUserFetchEventsHourly.tsHour, headlineEnd)
26568
26592
  )
26569
26593
  ).groupBy(sql10`SUBSTR(${aiUserFetchEventsHourly.tsHour}, 1, 10)`).all();
26570
- const emptyTrendEntry = () => ({ verifiedCrawlerHits: 0, userFetchHits: 0, referralArrivals: 0 });
26594
+ const emptyTrendEntry = () => ({ verifiedCrawlerHits: 0, unverifiedCrawlerHits: 0, userFetchHits: 0, referralArrivals: 0 });
26571
26595
  const dailyTrendMap = /* @__PURE__ */ new Map();
26572
26596
  for (const r of crawlerTrendRows) {
26573
26597
  const e = dailyTrendMap.get(r.date) ?? emptyTrendEntry();
26574
- e.verifiedCrawlerHits += Number(r.hits);
26598
+ e.verifiedCrawlerHits += Number(r.verifiedHits);
26599
+ e.unverifiedCrawlerHits += Number(r.unverifiedHits);
26575
26600
  dailyTrendMap.set(r.date, e);
26576
26601
  }
26577
26602
  for (const r of userFetchTrendRows) {
@@ -27321,13 +27346,13 @@ function buildProjectReport(db, projectName, periodDays) {
27321
27346
  periodDays
27322
27347
  );
27323
27348
  const gaSection = buildGaSection(db, project.id, periodDays);
27324
- const socialSection = buildSocialReferrals(db, project.id);
27349
+ const socialSection = buildSocialReferrals(db, project.id, periodDays);
27325
27350
  const aiReferralsSection = buildAiReferrals(db, project.id, periodDays);
27326
27351
  const serverActivitySection = buildServerActivity(db, project.id, periodDays);
27327
27352
  const indexingHealthSection = buildIndexingHealth(db, project.id);
27328
27353
  const citationsTrend = buildCitationsTrend(db, project.id, queryLookup, latestRunLocation);
27329
27354
  const insightList = buildInsightList(db, project.id, latestRunLocation);
27330
- const orchestratorInput = loadOrchestratorInput(db, project, latestRunLocation, periodDays);
27355
+ const orchestratorInput = loadOrchestratorInput(db, project, latestRunLocation);
27331
27356
  const dismissedTargetRefs = loadDismissedTargetRefs(db, project.id);
27332
27357
  const rawContentOpportunities = buildContentTargetRows(orchestratorInput);
27333
27358
  const contentOpportunities = dismissedTargetRefs.size > 0 ? rawContentOpportunities.filter((r) => !dismissedTargetRefs.has(r.targetRef)) : rawContentOpportunities;
@@ -50259,12 +50284,15 @@ async function ga4Routes(app, opts) {
50259
50284
  source: gaSocialReferrals.source,
50260
50285
  medium: gaSocialReferrals.medium,
50261
50286
  channelGroup: gaSocialReferrals.channelGroup,
50262
- sessions: sql18`SUM(${gaSocialReferrals.sessions})`,
50263
- users: sql18`SUM(${gaSocialReferrals.users})`
50287
+ // No `users`. ga_social_referrals is keyed
50288
+ // (project, date, source, medium, channel_group) and its users column
50289
+ // is GA's COUNT DISTINCT at that grain, so summing over the window's
50290
+ // dates counts a returning visitor once per day they returned. Same
50291
+ // conclusion the AI-referral surfaces reached in 4.135.0.
50292
+ sessions: sql18`SUM(${gaSocialReferrals.sessions})`
50264
50293
  }).from(gaSocialReferrals).where(and38(...socialConditions)).groupBy(gaSocialReferrals.source, gaSocialReferrals.medium, gaSocialReferrals.channelGroup).orderBy(sql18`SUM(${gaSocialReferrals.sessions}) DESC`).all();
50265
50294
  const socialTotals = app.db.select({
50266
- sessions: sql18`SUM(${gaSocialReferrals.sessions})`,
50267
- users: sql18`SUM(${gaSocialReferrals.users})`
50295
+ sessions: sql18`SUM(${gaSocialReferrals.sessions})`
50268
50296
  }).from(gaSocialReferrals).where(and38(...socialConditions)).get();
50269
50297
  const latestSync = app.db.select({ syncedAt: gaTrafficSummaries.syncedAt }).from(gaTrafficSummaries).where(eq46(gaTrafficSummaries.projectId, project.id)).orderBy(desc21(gaTrafficSummaries.syncedAt)).limit(1).get();
50270
50298
  const total = summaryRow?.totalSessions ?? 0;
@@ -50328,11 +50356,9 @@ async function ga4Routes(app, opts) {
50328
50356
  source: r.source,
50329
50357
  medium: r.medium,
50330
50358
  channelGroup: r.channelGroup,
50331
- sessions: r.sessions ?? 0,
50332
- users: r.users ?? 0
50359
+ sessions: r.sessions ?? 0
50333
50360
  })),
50334
50361
  socialSessions,
50335
- socialUsers: socialTotals?.users ?? 0,
50336
50362
  channelBreakdown,
50337
50363
  organicSharePct: total > 0 ? Math.round(totalOrganicSessions / total * 100) : 0,
50338
50364
  aiSharePct: total > 0 ? Math.round(aiSummary.deduped.sessions / total * 100) : 0,
@@ -50383,8 +50409,11 @@ async function ga4Routes(app, opts) {
50383
50409
  trafficClass: gaAiReferrals.trafficClass,
50384
50410
  landingPage: sql18`COALESCE(${gaAiReferrals.landingPageNormalized}, ${gaAiReferrals.landingPage})`,
50385
50411
  sourceDimension: gaAiReferrals.sourceDimension,
50386
- sessions: sql18`SUM(${gaAiReferrals.sessions})`,
50387
- users: sql18`SUM(${gaAiReferrals.users})`
50412
+ // No `users`: ga-ai-referral-aggregation states the rule for this
50413
+ // table, that there is no grain at which the stored users column may be
50414
+ // added up. ga4AiReferralDtoSchema.users was deprecated for this in
50415
+ // 4.135.0; the history endpoint kept emitting one.
50416
+ sessions: sql18`SUM(${gaAiReferrals.sessions})`
50388
50417
  }).from(gaAiReferrals).where(and38(...conditions)).groupBy(
50389
50418
  gaAiReferrals.date,
50390
50419
  gaAiReferrals.source,
@@ -79386,6 +79415,12 @@ function parseGbpInsightId(id) {
79386
79415
  if (parts.length !== 4 || parts[1] !== "gbp") return null;
79387
79416
  return { location: parts[2], slot: gbpInsightSlot(parts[3]) };
79388
79417
  }
79418
+ var SEVERITY_GSC_WINDOW_DAYS = 30;
79419
+ function severityGscWindow(endDate) {
79420
+ const end = /* @__PURE__ */ new Date(`${endDate}T00:00:00Z`);
79421
+ end.setUTCDate(end.getUTCDate() - (SEVERITY_GSC_WINDOW_DAYS - 1));
79422
+ return { startDate: end.toISOString().slice(0, 10), endDate };
79423
+ }
79389
79424
  var IntelligenceService = class {
79390
79425
  constructor(db) {
79391
79426
  this.db = db;
@@ -79865,6 +79900,42 @@ var IntelligenceService = class {
79865
79900
  });
79866
79901
  log.info("intelligence.persisted", { runId, insights: result.insights.length });
79867
79902
  }
79903
+ /**
79904
+ * Per-(date, query) rows folded from the page-keyed table, for days the
79905
+ * accurate per-query table has not backfilled. Impressions here are a page
79906
+ * fanout sum and therefore an over-count; this exists only so an un-backfilled
79907
+ * day reads as "some demand" rather than "none".
79908
+ */
79909
+ readGscPageSummedFallback(projectId, window) {
79910
+ const rows = this.db.select({
79911
+ date: gscSearchData.date,
79912
+ query: gscSearchData.query,
79913
+ clicks: gscSearchData.clicks,
79914
+ impressions: gscSearchData.impressions,
79915
+ position: gscSearchData.position
79916
+ }).from(gscSearchData).where(and51(
79917
+ eq62(gscSearchData.projectId, projectId),
79918
+ gte15(gscSearchData.date, window.startDate),
79919
+ lte13(gscSearchData.date, window.endDate)
79920
+ )).all();
79921
+ const byDay = /* @__PURE__ */ new Map();
79922
+ for (const r of rows) {
79923
+ if (!r.query) continue;
79924
+ const key = `${r.date}\0${r.query}`;
79925
+ const acc = byDay.get(key) ?? { date: r.date, query: r.query, clicks: 0, impressions: 0, weighted: 0 };
79926
+ acc.clicks += r.clicks;
79927
+ acc.impressions += r.impressions;
79928
+ acc.weighted += (Number(r.position) || 0) * r.impressions;
79929
+ byDay.set(key, acc);
79930
+ }
79931
+ return [...byDay.values()].map((a) => ({
79932
+ date: a.date,
79933
+ query: a.query,
79934
+ clicks: a.clicks,
79935
+ impressions: a.impressions,
79936
+ position: a.impressions > 0 ? a.weighted / a.impressions : 0
79937
+ }));
79938
+ }
79868
79939
  /**
79869
79940
  * Apply severity tiering to the insights of an AnalysisResult and return a
79870
79941
  * new result. Wraps `applySeverityTiering` so callers (analyzeAndPersist,
@@ -79884,10 +79955,15 @@ var IntelligenceService = class {
79884
79955
  applySeverityTiering(rawInsights, excludeRunId, projectId) {
79885
79956
  const regressions = rawInsights.filter((i) => i.type === "regression");
79886
79957
  if (regressions.length === 0) return rawInsights;
79887
- const gscRows = this.db.select({ query: gscSearchData.query, impressions: gscSearchData.impressions }).from(gscSearchData).where(eq62(gscSearchData.projectId, projectId)).all();
79888
- const gscConnected = gscRows.length > 0;
79958
+ const gscEnd = readLatestGscDataDate(this.db, projectId);
79959
+ const gscWindow = gscEnd ? severityGscWindow(gscEnd) : null;
79960
+ const gscTotals = gscWindow ? mergeGscQueryTotalsWithFallback(
79961
+ readGscQueryDailyRows(this.db, projectId, gscWindow.startDate, gscWindow.endDate),
79962
+ this.readGscPageSummedFallback(projectId, gscWindow)
79963
+ ) : [];
79964
+ const gscConnected = gscEnd !== null;
79889
79965
  const gscImpressionsByQuery = /* @__PURE__ */ new Map();
79890
- for (const row of gscRows) {
79966
+ for (const row of gscTotals) {
79891
79967
  const key = row.query.toLowerCase();
79892
79968
  gscImpressionsByQuery.set(key, (gscImpressionsByQuery.get(key) ?? 0) + row.impressions);
79893
79969
  }
@@ -5,11 +5,11 @@ import {
5
5
  installSkills,
6
6
  loadConfigRaw,
7
7
  saveConfigPatch
8
- } from "./chunk-JJIESVNL.js";
8
+ } from "./chunk-CWXPBQR5.js";
9
9
  import {
10
10
  SKILL_MANIFEST_FILENAME,
11
11
  SkillsClients
12
- } from "./chunk-UESVOQRS.js";
12
+ } from "./chunk-RXXZ5BU5.js";
13
13
 
14
14
  // src/skills-autosync.ts
15
15
  import fs from "fs";