@canonry/canonry 7.12.0 → 7.14.0

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 (34) hide show
  1. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +14 -7
  2. package/assets/assets/AuditHistoryPanel-gAkqWz9z.js +1 -0
  3. package/assets/assets/{BacklinksPage-CbRIZhu5.js → BacklinksPage-C67DtHo8.js} +1 -1
  4. package/assets/assets/{HistoryPage-Dfq1vK9k.js → HistoryPage-BQuW6Z6m.js} +1 -1
  5. package/assets/assets/{MeasurementPropertyPage-DcH0zYNN.js → MeasurementPropertyPage-B1XS6DR0.js} +1 -1
  6. package/assets/assets/ProjectPage-CV_7bOA7.js +8 -0
  7. package/assets/assets/{RunsPage-aOeJ60pX.js → RunsPage-CJYihZYC.js} +1 -1
  8. package/assets/assets/SettingsPage-Dd3J2DQE.js +1 -0
  9. package/assets/assets/{SiteHealthSection-CUOt7jeo.js → SiteHealthSection-iktyuzt2.js} +3 -3
  10. package/assets/assets/{TrafficPage-C0fVYizx.js → TrafficPage-CWjK7F3j.js} +2 -2
  11. package/assets/assets/{TrafficSourceDetailPage-LMhXbFlA.js → TrafficSourceDetailPage-D4_AXQNE.js} +1 -1
  12. package/assets/assets/{extract-error-message-5aHy0fsK.js → extract-error-message-Cxefvthz.js} +1 -1
  13. package/assets/assets/{index-BJh8cX5E.js → index-BbmiGIM_.js} +27 -27
  14. package/assets/assets/index-aBS1f2Bj.css +1 -0
  15. package/assets/assets/{react-sigma_core.esm.min-ldX35rMq.js → react-sigma_core.esm.min-DDEPa7AV.js} +1 -1
  16. package/assets/assets/{v2-overview-adapter-CaO9vY-l.js → v2-overview-adapter-CLxlMdb2.js} +1 -1
  17. package/assets/index.html +2 -2
  18. package/dist/{chunk-BTHEFJCI.js → chunk-4LQ4HKVK.js} +5 -5
  19. package/dist/{chunk-AU7OUDWR.js → chunk-A25FO3Z5.js} +64 -13
  20. package/dist/{chunk-GQMSJEMZ.js → chunk-EZRBFH77.js} +233 -54
  21. package/dist/{chunk-DXI2FTSW.js → chunk-KXHPQMBP.js} +93 -31
  22. package/dist/{chunk-EPSHIH63.js → chunk-LUQ5G5OO.js} +3 -3
  23. package/dist/{chunk-7I64KEGM.js → chunk-WHVEDCHY.js} +2 -2
  24. package/dist/{chunk-SM6ZZAPK.js → chunk-ZHXOR2LJ.js} +2 -2
  25. package/dist/cli.js +1300 -1244
  26. package/dist/{demo-server-WJUA4EIG.js → demo-server-SIATTXXS.js} +4 -4
  27. package/dist/index.js +6 -6
  28. package/dist/{intelligence-service-DJRH4Z3D.js → intelligence-service-UEEVETII.js} +2 -2
  29. package/dist/mcp.js +4 -4
  30. package/package.json +13 -13
  31. package/assets/assets/AuditHistoryPanel-Bpkuj-iF.js +0 -1
  32. package/assets/assets/ProjectPage-enF4twWt.js +0 -8
  33. package/assets/assets/SettingsPage-nA0_ImoQ.js +0 -1
  34. package/assets/assets/index-BNeiohKS.css +0 -1
@@ -1,4 +1,4 @@
1
- import{g as Bt,t as S,r as C}from"./vendor-tanstack-ZXXkndVj.js";import{e as Ht,G as Wt}from"./SiteHealthSection-CUOt7jeo.js";import"./index-BJh8cX5E.js";import"./vendor-radix-twS1M3FF.js";import"./vendor-recharts-D-cUuLZo.js";import"./vendor-lucide-N6vOpZmh.js";import"./vendor-markdown-B4giJcws.js";import"./vendor-yaml-GWJz5H2G.js";import"./ChartPrimitives-CYlrwLJs.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-ZXXkndVj.js";import{e as Ht,G as Wt}from"./SiteHealthSection-iktyuzt2.js";import"./index-BbmiGIM_.js";import"./vendor-radix-twS1M3FF.js";import"./vendor-recharts-D-cUuLZo.js";import"./vendor-lucide-N6vOpZmh.js";import"./vendor-markdown-B4giJcws.js";import"./vendor-yaml-GWJz5H2G.js";import"./ChartPrimitives-CYlrwLJs.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
@@ -1 +1 @@
1
- import{r as j,j as i}from"./vendor-tanstack-ZXXkndVj.js";import{Q as ae,ef as oe,B as le,aZ as ue}from"./index-BJh8cX5E.js";import{M as ce}from"./vendor-markdown-B4giJcws.js";import{C as de,$ as pe,g as J}from"./vendor-lucide-N6vOpZmh.js";const Ae="Sources",B={copy:"Copy answer",copying:"Copying…",copied:"Copied",failed:"Could not copy. Select and copy the answer above."};function me({previewLength:e,highlight:r}){return o=>{if(e!==void 0&&Number.isFinite(e)){let c=Math.max(0,Math.floor(e));const d={field:"value",omitted:!1},p=n=>{if(n.type==="definition")return!0;if(n.children)return n.children=n.children.filter(p),n.children.length>0;const s=n.type==="image"||n.type==="imageReference"?"alt":"value",f=n[s];if(f===void 0)return c>0;const b=Array.from(f);if(b.length===0)return c>0;if(c===0)return d.omitted=!0,!1;const N=b.length>c,k=b.slice(0,c);if(N&&!/\s/.test(b[c])){let g=k.length-1;for(;g>=0&&!/\s/.test(k[g]);)g--;g>=0&&g>c-40&&(k.length=g)}return d.omitted||=N,n[s]=k.join(""),c=N?0:c-k.length,k.length===0?!1:(d.lastNode=n,d.field=s,!0)};p(o),d.omitted&&(d.lastNode?d.lastNode[d.field]=`${d.lastNode[d.field].trimEnd()}…`:o.children?.push({type:"paragraph",children:[{type:"text",value:"…"}]}))}if(r){const c=d=>{["link","linkReference","code","inlineCode"].includes(d.type)||(d.type==="text"&&(d.data={...d.data,hName:"span"}),d.children?.forEach(c))};c(o)}}}function fe({headingLevel:e}){return r=>{const o=[],c=p=>{p.type==="heading"&&p.depth&&o.push(p),p.children?.forEach(c)};c(r);const d=o.reduce((p,n)=>Math.min(p,n.depth),6);for(const p of o){const n=p.depth-d;p.depth=Math.min(6,e+n),p.data={...p.data,hProperties:{...p.data?.hProperties,"data-answer-heading-level":n+1}}}}}function ge({answer:e}){const[r,o]=j.useState("idle"),c=j.useRef(!1),d=async()=>{if(!c.current){c.current=!0,o("copying");try{await navigator.clipboard.writeText(e),o("copied")}catch{o("failed")}finally{c.current=!1}}};return i.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-3",children:[i.jsx(le,{type:"button",variant:"ghost",className:"min-h-11 px-2","aria-disabled":r==="copying","aria-busy":r==="copying",onClick:()=>{d()},children:r==="copying"?B.copying:B.copy}),i.jsx("span",{role:"status",className:"text-sm text-secondary",children:r==="copied"?B.copied:r==="failed"?B.failed:""})]})}const Se=j.memo(function({children:r,headingLevel:o=4,copyable:c=!1,highlightGroups:d,previewLength:p}){return i.jsxs("div",{className:"answer-markdown",children:[i.jsx(ce,{remarkPlugins:[[fe,{headingLevel:o}],[me,{previewLength:p,highlight:!!d?.length}]],components:{p:({children:n})=>i.jsx("p",{className:"mb-3 whitespace-pre-wrap last:mb-0",children:n}),ul:({children:n})=>i.jsx("ul",{className:"mb-3 ml-5 list-disc space-y-1",children:n}),ol:({children:n,start:s})=>i.jsx("ol",{start:s,className:"mb-3 ml-5 list-decimal space-y-1",children:n}),pre:({children:n})=>i.jsx("pre",{className:"mb-3 overflow-x-auto whitespace-pre-wrap",children:n}),span:({children:n})=>i.jsx("span",{children:typeof n=="string"&&d?n.split(/(https?:\/\/[^\s<>]+)/i).map((s,f)=>f%2?s:i.jsx(j.Fragment,{children:oe(s,d)},f)):n}),a:({children:n,href:s})=>{const f=ae(s);return f?i.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"text-link underline",children:n}):i.jsx("span",{children:n})},img:({alt:n})=>i.jsx("span",{children:n})},children:r}),c&&r.trim()?i.jsx(ge,{answer:r},r):null]})}),X="min-h-11 w-full rounded-md border border-default bg-surface px-3 py-2 text-sm text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",G="flex min-h-11 w-full items-center justify-between gap-3 rounded px-2 text-left text-sm text-primary hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",E=e=>e.kind==="project"?"Whole site":e.label,q={allMarkets:"All markets",browse:e=>`Browse ${e}`,select:e=>`Select ${e}`,browseAll:"Browse all properties"},he=e=>e?.kind==="group"&&e.marketKeys?.length===1?e.marketKeys[0]:void 0,ee=e=>`${e} ${e===1?"property":"properties"}`;function Ke({options:e,selected:r,onSelect:o,marketKey:c,label:d="Measurement scope",labelVisibility:p="visible",allowGroupSelect:n=!0}){const s=[...e].sort((t,u)=>t.label.localeCompare(u.label,void 0,{numeric:!0})||t.id.localeCompare(u.id)),[f,b]=j.useState(""),[N,k]=j.useState([]),[g,$]=j.useState(!1),C=j.useRef(null),I=j.useRef(null),a=j.useId(),y=s.filter(t=>t.kind==="group"),h=new Map(y.map(t=>[t.id,t])),l=h.get(N.at(-1)??""),F=h.get(N.at(-2)??""),x=f.trim().toLocaleLowerCase(),ne=y.filter(t=>!t.parentGroupIds?.some(u=>h.has(u))),_=s.filter(t=>t.kind==="property"),O=t=>(t.parentGroupIds??[]).map(u=>h.get(u)?.label).filter(Boolean).join(" · "),P=t=>`${E(t)} ${O(t)}`.toLocaleLowerCase().includes(x),U=t=>{const u=[...t.parentGroupIds??[]],m=new Set;for(;u.length;){const v=u.pop();if(v===l?.id)return!0;m.has(v)||(m.add(v),u.push(...h.get(v)?.parentGroupIds??[]))}return!1},A=(g?[]:l?y.filter(t=>x?U(t):t.parentGroupIds?.includes(l.id)):x?y:ne).filter(P),S=s.find(t=>t.kind==="market"&&t.id===(c??(r.kind==="market"?r.id:void 0))),H=l&&S&&(l.marketKeys?.includes(S.id)||S.parentGroupIds?.includes(l.id))?S.id:void 0,L=n?H??he(l):void 0,V=(l?_.filter(t=>t.parentGroupIds?.includes(l.id)&&(!L||t.marketKeys?.includes(L))):x||g||y.length===0?_:[]).filter(P),W=s.filter(t=>t.kind!=="market"||g||!n&&!l&&!x&&y.length>0||n&&l?.marketKeys?.length===1&&!x?!1:(l?x?U(t):t.parentGroupIds?.includes(l.id):x||!t.parentGroupIds?.some(m=>h.has(m)))&&P(t)),Y=l||g?[]:s.filter(t=>t.kind==="project"&&P(t));j.useEffect(()=>{const t=u=>{C.current?.open&&u.target instanceof Node&&!C.current.contains(u.target)&&(C.current.open=!1)};return document.addEventListener("pointerdown",t),()=>document.removeEventListener("pointerdown",t)},[]);const se=t=>{C.current&&(C.current.open=!1,C.current.querySelector("summary")?.focus());const u=n?t.kind==="property"?L:t.kind==="group"&&t.id===l?.id?H:void 0:void 0;u?o(t,u):o(t)},T=t=>{const u=[];let m=h.get(t.parentGroupIds?.[0]??"");for(;m&&!u.includes(m.id)&&m.id!==t.id;)u.unshift(m.id),m=h.get(m.parentGroupIds?.[0]??"");return[...u,t.id]},ie=()=>{const t=r.kind==="group"?h.get(r.id):void 0,u=h.get(S?.parentGroupIds?.[0]??""),m=(r.parentGroupIds??[]).flatMap(K=>{const R=h.get(K);return R?[T(R)]:[]}),v=m.find(K=>K.at(-1)===l?.id)??m.sort((K,R)=>R.length-K.length)[0]??[],Z=u?T(u):r.marketKeys?.length?[]:v;k(t?T(t):Z),$(r.kind==="property"&&Z.length===0&&y.length>0),b("")},z=t=>{k(T(t)),$(!1),b(""),I.current?.focus()},w=(t,u=E(t))=>i.jsxs("div",{className:"flex items-stretch",children:[i.jsxs("button",{type:"button",className:G,"aria-label":t.kind==="group"&&!n?q.browse(E(t)):q.select(E(t)),"aria-current":r.kind===t.kind&&r.id===t.id?"true":void 0,onClick:()=>t.kind==="group"&&!n?z(t):se(t),children:[i.jsxs("span",{className:"min-w-0 break-words",children:[u,x&&O(t)?i.jsx("span",{className:"block text-[13px] text-secondary",children:O(t)}):null]}),i.jsx("span",{className:"shrink-0 text-right text-[13px] text-secondary",children:t.kind==="market"?n?"Query context":"Market":t.kind==="property"?"Property":ee(t.targetCount)})]}),n&&t.kind==="group"&&t.id!==l?.id&&s.some(m=>m.parentGroupIds?.includes(t.id))?i.jsx("button",{type:"button","aria-label":q.browse(t.label),title:`Browse ${t.label}`,className:"flex min-h-11 min-w-11 items-center justify-center rounded text-secondary hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",onClick:()=>z(t),children:i.jsx(J,{size:18,"aria-hidden":"true"})}):null]},`${t.kind}:${t.id}`),D=(t,u)=>u.length>0?i.jsxs("section",{"aria-label":t,className:"mt-2",children:[i.jsx("h3",{className:"px-2 py-2 text-[13px] font-medium text-secondary",children:t}),u.map(m=>w(m))]}):null,Q=(t,u,m)=>u.length>0?i.jsxs("details",{open:m,className:"mt-2 border-y border-default",children:[i.jsxs("summary",{className:"min-h-11 cursor-pointer px-2 py-3 text-sm text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",children:[t," (",u.length,")"]}),u.map(v=>w(v))]},`${l?.id??"root"}:${t}`):null;return i.jsxs("div",{className:"min-w-0",children:[i.jsx("span",{id:`${a}-label`,className:p==="sr-only"?"sr-only":"mb-1 block text-sm font-medium text-heading",children:d}),i.jsxs("details",{ref:C,className:"relative",onToggle:t=>{t.target===t.currentTarget&&t.currentTarget.open&&I.current?.focus()},onKeyDown:t=>{t.key==="Escape"&&(t.preventDefault(),t.currentTarget.open=!1,t.currentTarget.querySelector("summary")?.focus())},children:[i.jsxs("summary",{id:`${a}-value`,"aria-labelledby":`${a}-label ${a}-value`,className:`${X} visibility-scope-trigger`,onClick:()=>{C.current?.open||ie()},children:[`${E(r)}${r.kind==="group"?` · ${ee(r.targetCount)}`:r.kind==="property"?` · ${s.find(t=>t.kind==="market"&&t.id===c)?.label??(r.marketKeys?.length?q.allMarkets:"Property")}`:r.kind==="market"?" · Market":""}`,i.jsx(de,{size:16,"aria-hidden":"true",className:"shrink-0 text-secondary"})]}),i.jsxs("div",{className:"visibility-scope-menu",children:[l||g?i.jsxs("div",{className:"mb-2 border-b border-default pb-2",children:[i.jsx("button",{type:"button",className:G,"aria-label":`Back to ${F?.label??"all groups"}`,onClick:()=>{k(N.slice(0,-1)),$(!1),b(""),I.current?.focus()},children:i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(pe,{size:16,"aria-hidden":"true"}),F?.label??"All groups"]})}),i.jsx("p",{className:"px-2 py-1 text-sm font-medium text-heading","aria-live":"polite",children:l?.label??"All properties"})]}):null,i.jsx("input",{ref:I,type:"search","aria-label":"Search scopes",className:X,placeholder:l?"Search within this group":g?"Search properties":"Search groups or properties",value:f,onChange:t=>b(t.target.value)}),i.jsxs("div",{className:"mt-2 max-h-80 overflow-y-auto",children:[n&&l&&!x?w(l,"All properties in this group"):null,Y.map(t=>w(t)),l&&!x?Q("Subgroups",A,!0):D(l?"Subgroups":"Groups",A),x?D("Properties",V):Q(l&&A.length>0?"All properties":"Properties",V,!l||A.length===0),D("Markets",W),!l&&!g&&!x&&y.length>0&&_.length>0?i.jsxs("button",{type:"button",className:`${G} mt-2 border-t border-default`,"aria-label":q.browseAll,onClick:()=>{$(!0),I.current?.focus()},children:[i.jsx("span",{children:"All properties"}),i.jsx(J,{size:18,"aria-hidden":"true"})]}):null,x&&A.length+V.length+W.length+Y.length===0?i.jsx("p",{className:"py-3 text-sm text-secondary",children:"No matching scopes."}):null]})]})]})]})}function Ee(e){const r=e[0];return r?e.every(o=>o.mode===r.mode&&o.scope.kind===r.scope.kind&&o.scope.key===r.scope.key&&o.queryClass===r.queryClass&&o.measurement.displayedRunId===r.measurement.displayedRunId):!0}function M(e){return e.state==="unavailable"?{numerator:null,denominator:null,reason:e.reason}:e.numerator===void 0||e.denominator===void 0||e.denominator<=0?{numerator:null,denominator:null,reason:"not_applicable"}:{numerator:e.numerator,denominator:e.denominator,...e.unattributed===void 0?{}:{unattributed:e.unattributed},...e.unchecked===void 0?{}:{unchecked:e.unchecked}}}function ye(e){return e.kind==="exact"?e.url:e.kind==="prefix"?`https://${e.host}${e.pathPrefix}/*`:`https://${e.host}/*`}function be(e){return e==="assigned"?"this-property":e==="sibling"?"another-property":e==="ownedUnmapped"?"owned-unassigned":e==="external"?"external":e==="ambiguous"?"multiple-properties":"invalid-url"}function xe(e){return e==="assigned"?"positive":e==="external"?"neutral":e==="invalid"?"negative":"caution"}function te(e){return`target:${e.targetKey}:${e.queryId}:${e.executionNodeKey}`}function ke(e,r,o){const c=new Map;if(!r)return c;const d=new Map(e.usageEdges.map(s=>[te(s),s.targetKey])),p=new Map(e.assignments.map(s=>[`${s.targetKey}:${s.queryId}`,s.queryClass])),n=new Map(e.usageEdges.map(s=>[te(s),p.get(`${s.targetKey}:${s.queryId}`)]));for(const s of r.evidence){if(o&&n.get(s.usageEdgeId)!==o)continue;const f=d.get(s.usageEdgeId);if(!f)continue;const b=c.get(f)??[];b.push({id:`${s.observationId}:${s.expectedSlotId}:${s.usageEdgeId}:${s.sourceUrl}`,kind:be(s.classification),query:s.queryText,provider:s.provider,location:s.location,url:s.sourceUrl,tone:xe(s.classification),historical:s.historical||s.bridged}),c.set(f,b)}return c}function Ce(e){if(e.flags>0)return{label:"Review",tone:"caution"};const r=[e.mentionCoverage,e.citationCoverage].filter(o=>o.state==="unavailable").map(o=>o.reason);return r.includes("no_completed_run")?{label:"Not measured",tone:"neutral"}:r.includes("plan_v1")?{label:"Update setup",tone:"caution"}:r.includes("evidence_incomplete")?{label:"Evidence incomplete",tone:"caution"}:r.includes("identity_ambiguous")?{label:ue.ambiguous,tone:"caution"}:r.includes("no_population")?{label:"No queries",tone:"neutral"}:r.includes("not_applicable")?{label:"Not applicable",tone:"neutral"}:{label:"Complete",tone:"positive"}}function je(e){return e==="complete"?{label:"Complete",tone:"positive"}:e==="partial"?{label:"Partial",tone:"caution"}:e==="queued"?{label:"Queued",tone:"neutral"}:e==="running"?{label:"Running",tone:"neutral"}:e==="failed"?{label:"Failed",tone:"negative"}:{label:"Not measured",tone:"neutral"}}function Ne(e){if(!e)return"";const r=new Date(e);return Number.isFinite(r.getTime())?r.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):""}function re(e){const r=e.nextAction.count??e.flags.total;if(e.nextAction.kind==="review_flags")return`${r} flagged ${r===1?"result needs":"results need"} review.`;if(e.nextAction.kind==="complete_setup")return"Finish setup.";if(e.nextAction.kind==="republish_setup")return"Setup update required.";if(e.nextAction.kind==="run_measurement")return"Ready to measure."}function qe({overview:e,activePlan:r,report:o,reportState:c=o?"ready":"loading",sort:d}){if(r.plan.schemaVersion!==2||e.mode!=="active-v2")throw new Error("The current overview requires an active version-two setup.");if(e.scope.kind!=="all"&&e.scope.kind!=="group")throw new Error("The current overview requires an All Properties or group scope.");const p=r.plan,n=new Map(p.targets.map(a=>[a.stableKey,a])),s=new Map(p.querySnapshots.map(a=>[a.queryId,a.queryText])),f=new Map;for(const a of p.assignments){if(e.queryClass!=="all"&&a.queryClass!==e.queryClass)continue;const y=s.get(a.queryId);if(!y)continue;const h=f.get(a.targetKey)??new Set;h.add(y),f.set(a.targetKey,h)}const b=o?.revision===r.revision&&o.run?.id===e.measurement.displayedRunId?o:null,N=e.measurement.displayedRunId===void 0||b?"ready":c==="error"||o!=null?"error":"loading",k=ke(p,b,e.queryClass==="all"?void 0:e.queryClass),g=new Map;for(const a of p.groups)for(const y of a.targetKeys)g.has(y)||g.set(y,a.label);const $=e.properties.items.map(a=>{const y=n.get(a.targetKey),h=k.get(a.targetKey)??[];return{id:a.targetKey,name:a.label,mentionCoverage:M(a.mentionCoverage),citationCoverage:M(a.citationCoverage),status:Ce(a),providers:a.providers?.map(l=>({provider:l.provider,mentionCoverage:M(l.mentionCoverage),citationCoverage:M(l.citationCoverage)})),market:g.get(a.targetKey),assignedQueries:[...f.get(a.targetKey)??[]],urls:y?.urlMatchers.map(ye)??[],evidence:h,evidenceState:N,historical:h.some(l=>l.historical)}}),C=e.namedShareOfVoice?.entries.map(a=>({name:a.label,coverage:{numerator:a.credits,denominator:e.namedShareOfVoice.denominator}})),I=e.properties.items.flatMap(a=>a.flags>0?[{id:`property:${a.targetKey}`,property:a.label,summary:`${a.flags} ${a.flags===1?"result needs":"results need"} review.`,tone:"caution",count:a.flags}]:[]);return{classReporting:"available",latestMeasurement:{status:je(e.measurement.state),completedSlots:e.measurement.completed,totalSlots:e.measurement.expected,date:Ne(e.measurement.completedAt),includesBridgedHistory:e.measurement.includesHistoricalData===!0},currentView:{scope:e.scope.kind==="group"?{kind:"group",...e.scope.key?{key:e.scope.key}:{}}:{kind:"all"},queryClass:e.queryClass,aggregate:{metrics:{propertiesMentioned:M(e.metrics.propertiesMentioned),mentionCoverage:M(e.metrics.mentionCoverage),citationCoverage:M(e.metrics.citationCoverage)},properties:$,...C?{shareOfVoice:C}:{}},propertyTotal:e.properties.totalEstimate??$.length,outcomes:e.outcomes,nextCursor:e.properties.nextCursor,...d?{sort:d}:{}},availableGroups:p.groups.map(a=>({id:a.stableKey,label:a.label})),...re(e)?{nextActionText:re(e)}:{},flaggedResultsTotal:e.flags.total,flaggedResults:I}}export{Se as A,q as M,Ke as V,Ae as a,Ee as b,qe as c,ye as m};
1
+ import{r as j,j as i}from"./vendor-tanstack-ZXXkndVj.js";import{Q as ae,eh as oe,B as le,aZ as ue}from"./index-BbmiGIM_.js";import{M as ce}from"./vendor-markdown-B4giJcws.js";import{C as de,$ as pe,g as J}from"./vendor-lucide-N6vOpZmh.js";const Ae="Sources",B={copy:"Copy answer",copying:"Copying…",copied:"Copied",failed:"Could not copy. Select and copy the answer above."};function me({previewLength:e,highlight:r}){return o=>{if(e!==void 0&&Number.isFinite(e)){let c=Math.max(0,Math.floor(e));const d={field:"value",omitted:!1},p=n=>{if(n.type==="definition")return!0;if(n.children)return n.children=n.children.filter(p),n.children.length>0;const s=n.type==="image"||n.type==="imageReference"?"alt":"value",f=n[s];if(f===void 0)return c>0;const b=Array.from(f);if(b.length===0)return c>0;if(c===0)return d.omitted=!0,!1;const N=b.length>c,k=b.slice(0,c);if(N&&!/\s/.test(b[c])){let g=k.length-1;for(;g>=0&&!/\s/.test(k[g]);)g--;g>=0&&g>c-40&&(k.length=g)}return d.omitted||=N,n[s]=k.join(""),c=N?0:c-k.length,k.length===0?!1:(d.lastNode=n,d.field=s,!0)};p(o),d.omitted&&(d.lastNode?d.lastNode[d.field]=`${d.lastNode[d.field].trimEnd()}…`:o.children?.push({type:"paragraph",children:[{type:"text",value:"…"}]}))}if(r){const c=d=>{["link","linkReference","code","inlineCode"].includes(d.type)||(d.type==="text"&&(d.data={...d.data,hName:"span"}),d.children?.forEach(c))};c(o)}}}function fe({headingLevel:e}){return r=>{const o=[],c=p=>{p.type==="heading"&&p.depth&&o.push(p),p.children?.forEach(c)};c(r);const d=o.reduce((p,n)=>Math.min(p,n.depth),6);for(const p of o){const n=p.depth-d;p.depth=Math.min(6,e+n),p.data={...p.data,hProperties:{...p.data?.hProperties,"data-answer-heading-level":n+1}}}}}function ge({answer:e}){const[r,o]=j.useState("idle"),c=j.useRef(!1),d=async()=>{if(!c.current){c.current=!0,o("copying");try{await navigator.clipboard.writeText(e),o("copied")}catch{o("failed")}finally{c.current=!1}}};return i.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-3",children:[i.jsx(le,{type:"button",variant:"ghost",className:"min-h-11 px-2","aria-disabled":r==="copying","aria-busy":r==="copying",onClick:()=>{d()},children:r==="copying"?B.copying:B.copy}),i.jsx("span",{role:"status",className:"text-sm text-secondary",children:r==="copied"?B.copied:r==="failed"?B.failed:""})]})}const Se=j.memo(function({children:r,headingLevel:o=4,copyable:c=!1,highlightGroups:d,previewLength:p}){return i.jsxs("div",{className:"answer-markdown",children:[i.jsx(ce,{remarkPlugins:[[fe,{headingLevel:o}],[me,{previewLength:p,highlight:!!d?.length}]],components:{p:({children:n})=>i.jsx("p",{className:"mb-3 whitespace-pre-wrap last:mb-0",children:n}),ul:({children:n})=>i.jsx("ul",{className:"mb-3 ml-5 list-disc space-y-1",children:n}),ol:({children:n,start:s})=>i.jsx("ol",{start:s,className:"mb-3 ml-5 list-decimal space-y-1",children:n}),pre:({children:n})=>i.jsx("pre",{className:"mb-3 overflow-x-auto whitespace-pre-wrap",children:n}),span:({children:n})=>i.jsx("span",{children:typeof n=="string"&&d?n.split(/(https?:\/\/[^\s<>]+)/i).map((s,f)=>f%2?s:i.jsx(j.Fragment,{children:oe(s,d)},f)):n}),a:({children:n,href:s})=>{const f=ae(s);return f?i.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"text-link underline",children:n}):i.jsx("span",{children:n})},img:({alt:n})=>i.jsx("span",{children:n})},children:r}),c&&r.trim()?i.jsx(ge,{answer:r},r):null]})}),X="min-h-11 w-full rounded-md border border-default bg-surface px-3 py-2 text-sm text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",G="flex min-h-11 w-full items-center justify-between gap-3 rounded px-2 text-left text-sm text-primary hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",E=e=>e.kind==="project"?"Whole site":e.label,q={allMarkets:"All markets",browse:e=>`Browse ${e}`,select:e=>`Select ${e}`,browseAll:"Browse all properties"},he=e=>e?.kind==="group"&&e.marketKeys?.length===1?e.marketKeys[0]:void 0,ee=e=>`${e} ${e===1?"property":"properties"}`;function Ke({options:e,selected:r,onSelect:o,marketKey:c,label:d="Measurement scope",labelVisibility:p="visible",allowGroupSelect:n=!0}){const s=[...e].sort((t,u)=>t.label.localeCompare(u.label,void 0,{numeric:!0})||t.id.localeCompare(u.id)),[f,b]=j.useState(""),[N,k]=j.useState([]),[g,$]=j.useState(!1),C=j.useRef(null),I=j.useRef(null),a=j.useId(),y=s.filter(t=>t.kind==="group"),h=new Map(y.map(t=>[t.id,t])),l=h.get(N.at(-1)??""),F=h.get(N.at(-2)??""),x=f.trim().toLocaleLowerCase(),ne=y.filter(t=>!t.parentGroupIds?.some(u=>h.has(u))),_=s.filter(t=>t.kind==="property"),O=t=>(t.parentGroupIds??[]).map(u=>h.get(u)?.label).filter(Boolean).join(" · "),P=t=>`${E(t)} ${O(t)}`.toLocaleLowerCase().includes(x),U=t=>{const u=[...t.parentGroupIds??[]],m=new Set;for(;u.length;){const v=u.pop();if(v===l?.id)return!0;m.has(v)||(m.add(v),u.push(...h.get(v)?.parentGroupIds??[]))}return!1},A=(g?[]:l?y.filter(t=>x?U(t):t.parentGroupIds?.includes(l.id)):x?y:ne).filter(P),S=s.find(t=>t.kind==="market"&&t.id===(c??(r.kind==="market"?r.id:void 0))),H=l&&S&&(l.marketKeys?.includes(S.id)||S.parentGroupIds?.includes(l.id))?S.id:void 0,L=n?H??he(l):void 0,V=(l?_.filter(t=>t.parentGroupIds?.includes(l.id)&&(!L||t.marketKeys?.includes(L))):x||g||y.length===0?_:[]).filter(P),W=s.filter(t=>t.kind!=="market"||g||!n&&!l&&!x&&y.length>0||n&&l?.marketKeys?.length===1&&!x?!1:(l?x?U(t):t.parentGroupIds?.includes(l.id):x||!t.parentGroupIds?.some(m=>h.has(m)))&&P(t)),Y=l||g?[]:s.filter(t=>t.kind==="project"&&P(t));j.useEffect(()=>{const t=u=>{C.current?.open&&u.target instanceof Node&&!C.current.contains(u.target)&&(C.current.open=!1)};return document.addEventListener("pointerdown",t),()=>document.removeEventListener("pointerdown",t)},[]);const se=t=>{C.current&&(C.current.open=!1,C.current.querySelector("summary")?.focus());const u=n?t.kind==="property"?L:t.kind==="group"&&t.id===l?.id?H:void 0:void 0;u?o(t,u):o(t)},T=t=>{const u=[];let m=h.get(t.parentGroupIds?.[0]??"");for(;m&&!u.includes(m.id)&&m.id!==t.id;)u.unshift(m.id),m=h.get(m.parentGroupIds?.[0]??"");return[...u,t.id]},ie=()=>{const t=r.kind==="group"?h.get(r.id):void 0,u=h.get(S?.parentGroupIds?.[0]??""),m=(r.parentGroupIds??[]).flatMap(K=>{const R=h.get(K);return R?[T(R)]:[]}),v=m.find(K=>K.at(-1)===l?.id)??m.sort((K,R)=>R.length-K.length)[0]??[],Z=u?T(u):r.marketKeys?.length?[]:v;k(t?T(t):Z),$(r.kind==="property"&&Z.length===0&&y.length>0),b("")},z=t=>{k(T(t)),$(!1),b(""),I.current?.focus()},w=(t,u=E(t))=>i.jsxs("div",{className:"flex items-stretch",children:[i.jsxs("button",{type:"button",className:G,"aria-label":t.kind==="group"&&!n?q.browse(E(t)):q.select(E(t)),"aria-current":r.kind===t.kind&&r.id===t.id?"true":void 0,onClick:()=>t.kind==="group"&&!n?z(t):se(t),children:[i.jsxs("span",{className:"min-w-0 break-words",children:[u,x&&O(t)?i.jsx("span",{className:"block text-[13px] text-secondary",children:O(t)}):null]}),i.jsx("span",{className:"shrink-0 text-right text-[13px] text-secondary",children:t.kind==="market"?n?"Query context":"Market":t.kind==="property"?"Property":ee(t.targetCount)})]}),n&&t.kind==="group"&&t.id!==l?.id&&s.some(m=>m.parentGroupIds?.includes(t.id))?i.jsx("button",{type:"button","aria-label":q.browse(t.label),title:`Browse ${t.label}`,className:"flex min-h-11 min-w-11 items-center justify-center rounded text-secondary hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",onClick:()=>z(t),children:i.jsx(J,{size:18,"aria-hidden":"true"})}):null]},`${t.kind}:${t.id}`),D=(t,u)=>u.length>0?i.jsxs("section",{"aria-label":t,className:"mt-2",children:[i.jsx("h3",{className:"px-2 py-2 text-[13px] font-medium text-secondary",children:t}),u.map(m=>w(m))]}):null,Q=(t,u,m)=>u.length>0?i.jsxs("details",{open:m,className:"mt-2 border-y border-default",children:[i.jsxs("summary",{className:"min-h-11 cursor-pointer px-2 py-3 text-sm text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400",children:[t," (",u.length,")"]}),u.map(v=>w(v))]},`${l?.id??"root"}:${t}`):null;return i.jsxs("div",{className:"min-w-0",children:[i.jsx("span",{id:`${a}-label`,className:p==="sr-only"?"sr-only":"mb-1 block text-sm font-medium text-heading",children:d}),i.jsxs("details",{ref:C,className:"relative",onToggle:t=>{t.target===t.currentTarget&&t.currentTarget.open&&I.current?.focus()},onKeyDown:t=>{t.key==="Escape"&&(t.preventDefault(),t.currentTarget.open=!1,t.currentTarget.querySelector("summary")?.focus())},children:[i.jsxs("summary",{id:`${a}-value`,"aria-labelledby":`${a}-label ${a}-value`,className:`${X} visibility-scope-trigger`,onClick:()=>{C.current?.open||ie()},children:[`${E(r)}${r.kind==="group"?` · ${ee(r.targetCount)}`:r.kind==="property"?` · ${s.find(t=>t.kind==="market"&&t.id===c)?.label??(r.marketKeys?.length?q.allMarkets:"Property")}`:r.kind==="market"?" · Market":""}`,i.jsx(de,{size:16,"aria-hidden":"true",className:"shrink-0 text-secondary"})]}),i.jsxs("div",{className:"visibility-scope-menu",children:[l||g?i.jsxs("div",{className:"mb-2 border-b border-default pb-2",children:[i.jsx("button",{type:"button",className:G,"aria-label":`Back to ${F?.label??"all groups"}`,onClick:()=>{k(N.slice(0,-1)),$(!1),b(""),I.current?.focus()},children:i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(pe,{size:16,"aria-hidden":"true"}),F?.label??"All groups"]})}),i.jsx("p",{className:"px-2 py-1 text-sm font-medium text-heading","aria-live":"polite",children:l?.label??"All properties"})]}):null,i.jsx("input",{ref:I,type:"search","aria-label":"Search scopes",className:X,placeholder:l?"Search within this group":g?"Search properties":"Search groups or properties",value:f,onChange:t=>b(t.target.value)}),i.jsxs("div",{className:"mt-2 max-h-80 overflow-y-auto",children:[n&&l&&!x?w(l,"All properties in this group"):null,Y.map(t=>w(t)),l&&!x?Q("Subgroups",A,!0):D(l?"Subgroups":"Groups",A),x?D("Properties",V):Q(l&&A.length>0?"All properties":"Properties",V,!l||A.length===0),D("Markets",W),!l&&!g&&!x&&y.length>0&&_.length>0?i.jsxs("button",{type:"button",className:`${G} mt-2 border-t border-default`,"aria-label":q.browseAll,onClick:()=>{$(!0),I.current?.focus()},children:[i.jsx("span",{children:"All properties"}),i.jsx(J,{size:18,"aria-hidden":"true"})]}):null,x&&A.length+V.length+W.length+Y.length===0?i.jsx("p",{className:"py-3 text-sm text-secondary",children:"No matching scopes."}):null]})]})]})]})}function Ee(e){const r=e[0];return r?e.every(o=>o.mode===r.mode&&o.scope.kind===r.scope.kind&&o.scope.key===r.scope.key&&o.queryClass===r.queryClass&&o.measurement.displayedRunId===r.measurement.displayedRunId):!0}function M(e){return e.state==="unavailable"?{numerator:null,denominator:null,reason:e.reason}:e.numerator===void 0||e.denominator===void 0||e.denominator<=0?{numerator:null,denominator:null,reason:"not_applicable"}:{numerator:e.numerator,denominator:e.denominator,...e.unattributed===void 0?{}:{unattributed:e.unattributed},...e.unchecked===void 0?{}:{unchecked:e.unchecked}}}function ye(e){return e.kind==="exact"?e.url:e.kind==="prefix"?`https://${e.host}${e.pathPrefix}/*`:`https://${e.host}/*`}function be(e){return e==="assigned"?"this-property":e==="sibling"?"another-property":e==="ownedUnmapped"?"owned-unassigned":e==="external"?"external":e==="ambiguous"?"multiple-properties":"invalid-url"}function xe(e){return e==="assigned"?"positive":e==="external"?"neutral":e==="invalid"?"negative":"caution"}function te(e){return`target:${e.targetKey}:${e.queryId}:${e.executionNodeKey}`}function ke(e,r,o){const c=new Map;if(!r)return c;const d=new Map(e.usageEdges.map(s=>[te(s),s.targetKey])),p=new Map(e.assignments.map(s=>[`${s.targetKey}:${s.queryId}`,s.queryClass])),n=new Map(e.usageEdges.map(s=>[te(s),p.get(`${s.targetKey}:${s.queryId}`)]));for(const s of r.evidence){if(o&&n.get(s.usageEdgeId)!==o)continue;const f=d.get(s.usageEdgeId);if(!f)continue;const b=c.get(f)??[];b.push({id:`${s.observationId}:${s.expectedSlotId}:${s.usageEdgeId}:${s.sourceUrl}`,kind:be(s.classification),query:s.queryText,provider:s.provider,location:s.location,url:s.sourceUrl,tone:xe(s.classification),historical:s.historical||s.bridged}),c.set(f,b)}return c}function Ce(e){if(e.flags>0)return{label:"Review",tone:"caution"};const r=[e.mentionCoverage,e.citationCoverage].filter(o=>o.state==="unavailable").map(o=>o.reason);return r.includes("no_completed_run")?{label:"Not measured",tone:"neutral"}:r.includes("plan_v1")?{label:"Update setup",tone:"caution"}:r.includes("evidence_incomplete")?{label:"Evidence incomplete",tone:"caution"}:r.includes("identity_ambiguous")?{label:ue.ambiguous,tone:"caution"}:r.includes("no_population")?{label:"No queries",tone:"neutral"}:r.includes("not_applicable")?{label:"Not applicable",tone:"neutral"}:{label:"Complete",tone:"positive"}}function je(e){return e==="complete"?{label:"Complete",tone:"positive"}:e==="partial"?{label:"Partial",tone:"caution"}:e==="queued"?{label:"Queued",tone:"neutral"}:e==="running"?{label:"Running",tone:"neutral"}:e==="failed"?{label:"Failed",tone:"negative"}:{label:"Not measured",tone:"neutral"}}function Ne(e){if(!e)return"";const r=new Date(e);return Number.isFinite(r.getTime())?r.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):""}function re(e){const r=e.nextAction.count??e.flags.total;if(e.nextAction.kind==="review_flags")return`${r} flagged ${r===1?"result needs":"results need"} review.`;if(e.nextAction.kind==="complete_setup")return"Finish setup.";if(e.nextAction.kind==="republish_setup")return"Setup update required.";if(e.nextAction.kind==="run_measurement")return"Ready to measure."}function qe({overview:e,activePlan:r,report:o,reportState:c=o?"ready":"loading",sort:d}){if(r.plan.schemaVersion!==2||e.mode!=="active-v2")throw new Error("The current overview requires an active version-two setup.");if(e.scope.kind!=="all"&&e.scope.kind!=="group")throw new Error("The current overview requires an All Properties or group scope.");const p=r.plan,n=new Map(p.targets.map(a=>[a.stableKey,a])),s=new Map(p.querySnapshots.map(a=>[a.queryId,a.queryText])),f=new Map;for(const a of p.assignments){if(e.queryClass!=="all"&&a.queryClass!==e.queryClass)continue;const y=s.get(a.queryId);if(!y)continue;const h=f.get(a.targetKey)??new Set;h.add(y),f.set(a.targetKey,h)}const b=o?.revision===r.revision&&o.run?.id===e.measurement.displayedRunId?o:null,N=e.measurement.displayedRunId===void 0||b?"ready":c==="error"||o!=null?"error":"loading",k=ke(p,b,e.queryClass==="all"?void 0:e.queryClass),g=new Map;for(const a of p.groups)for(const y of a.targetKeys)g.has(y)||g.set(y,a.label);const $=e.properties.items.map(a=>{const y=n.get(a.targetKey),h=k.get(a.targetKey)??[];return{id:a.targetKey,name:a.label,mentionCoverage:M(a.mentionCoverage),citationCoverage:M(a.citationCoverage),status:Ce(a),providers:a.providers?.map(l=>({provider:l.provider,mentionCoverage:M(l.mentionCoverage),citationCoverage:M(l.citationCoverage)})),market:g.get(a.targetKey),assignedQueries:[...f.get(a.targetKey)??[]],urls:y?.urlMatchers.map(ye)??[],evidence:h,evidenceState:N,historical:h.some(l=>l.historical)}}),C=e.namedShareOfVoice?.entries.map(a=>({name:a.label,coverage:{numerator:a.credits,denominator:e.namedShareOfVoice.denominator}})),I=e.properties.items.flatMap(a=>a.flags>0?[{id:`property:${a.targetKey}`,property:a.label,summary:`${a.flags} ${a.flags===1?"result needs":"results need"} review.`,tone:"caution",count:a.flags}]:[]);return{classReporting:"available",latestMeasurement:{status:je(e.measurement.state),completedSlots:e.measurement.completed,totalSlots:e.measurement.expected,date:Ne(e.measurement.completedAt),includesBridgedHistory:e.measurement.includesHistoricalData===!0},currentView:{scope:e.scope.kind==="group"?{kind:"group",...e.scope.key?{key:e.scope.key}:{}}:{kind:"all"},queryClass:e.queryClass,aggregate:{metrics:{propertiesMentioned:M(e.metrics.propertiesMentioned),mentionCoverage:M(e.metrics.mentionCoverage),citationCoverage:M(e.metrics.citationCoverage)},properties:$,...C?{shareOfVoice:C}:{}},propertyTotal:e.properties.totalEstimate??$.length,outcomes:e.outcomes,nextCursor:e.properties.nextCursor,...d?{sort:d}:{}},availableGroups:p.groups.map(a=>({id:a.stableKey,label:a.label})),...re(e)?{nextActionText:re(e)}:{},flaggedResultsTotal:e.flags.total,flaggedResults:I}}export{Se as A,q as M,Ke as V,Ae as a,Ee as b,qe as c,ye as m};
package/assets/index.html CHANGED
@@ -12,14 +12,14 @@
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-BJh8cX5E.js"></script>
15
+ <script type="module" crossorigin src="./assets/index-BbmiGIM_.js"></script>
16
16
  <link rel="modulepreload" crossorigin href="./assets/vendor-tanstack-ZXXkndVj.js">
17
17
  <link rel="modulepreload" crossorigin href="./assets/vendor-radix-twS1M3FF.js">
18
18
  <link rel="modulepreload" crossorigin href="./assets/vendor-recharts-D-cUuLZo.js">
19
19
  <link rel="modulepreload" crossorigin href="./assets/vendor-lucide-N6vOpZmh.js">
20
20
  <link rel="modulepreload" crossorigin href="./assets/vendor-markdown-B4giJcws.js">
21
21
  <link rel="modulepreload" crossorigin href="./assets/vendor-yaml-GWJz5H2G.js">
22
- <link rel="stylesheet" crossorigin href="./assets/index-BNeiohKS.css">
22
+ <link rel="stylesheet" crossorigin href="./assets/index-aBS1f2Bj.css">
23
23
  </head>
24
24
  <body>
25
25
  <div id="root"></div>
@@ -139,7 +139,7 @@ import {
139
139
  trafficSeriesGranularitySchema,
140
140
  visibilityCompareSelectionSchema,
141
141
  visibilityReportRequestSchema
142
- } from "./chunk-AU7OUDWR.js";
142
+ } from "./chunk-A25FO3Z5.js";
143
143
 
144
144
  // src/cli-error.ts
145
145
  function isMachineFormat(format) {
@@ -1482,7 +1482,7 @@ var canonryMcpTools = [
1482
1482
  defineTool({
1483
1483
  name: "canonry_project_overview",
1484
1484
  title: "Get project overview (composite)",
1485
- description: `Sentiment headline is sentiment.branded; nonBrand is a separate exception population. pooledOverall and deprecated overall are explicitly pooled compatibility figures and must never be reported as a class-specific headline. One-call summary for "how is project X doing?". Returns independent mention and citation coverage, separate query-level movement for each signal, query-basket comparability with added/removed counts, latest run and health, insights, provider/model breakdowns, competitors, attention items, and recent history. Movement excludes queries not shared by both sweeps. Filterable by location and time window. Prefer this over fanning out to separate read tools for the same question. queryClassScope says which figures pool branded and non-brand: the coverage, scores (except scores.mentionShare) and movement count queries across both classes, so never report them as one class or as answers. The latest run's status and health are not a completeness check: for expected, executed and missing answers read canonry_measurement_data_quality or, for a plan run, canonry_run_completeness. canonry_doctor checks configuration and integrations, not sweeps. SCOPE LIMIT: this returns nothing about Advanced Measurement: no plan, Targets, Properties, groups, or segments. Its silence is not evidence that a project lacks them. When the system prompt has no Project shape line, call canonry_measurement_plan_get before stating that a project has no Properties, no Advanced plan, or cannot break out per-Property performance; use canonry_measurement_portfolio_summary to rank Properties.`,
1485
+ description: `Sentiment headline is sentiment.branded; nonBrand is a separate exception population. pooledOverall and deprecated overall are explicitly pooled compatibility figures and must never be reported as a class-specific headline. One-call summary for "how is project X doing?". Returns independent mention and citation coverage, separate query-level movement for each signal, query-basket comparability with added/removed counts, latest run and health, insights, provider/model breakdowns, competitors, attention items, and recent history. Movement excludes queries not shared by both sweeps. Filterable by location and time window. Prefer this over fanning out to separate read tools for the same question. queryClassScope says which figures pool branded and non-brand: the coverage, scores (except scores.mentionShare) and movement count queries across both classes, so never report them as one class or as answers. latestRun.admission describes the scheduled sweep; latestRun.manualAdmission describes a default full manual sweep. Each says whether its provider scope would be refused or skip providers that keep failing on their accounts. They can differ when the schedule names fewer providers; use manualAdmission before a default manual sweep. The latest run's status and health are not a completeness check: for expected, executed and missing answers read canonry_measurement_data_quality or, for a plan run, canonry_run_completeness. canonry_doctor checks configuration and integrations, not sweeps. SCOPE LIMIT: this returns nothing about Advanced Measurement: no plan, Targets, Properties, groups, or segments. Its silence is not evidence that a project lacks them. When the system prompt has no Project shape line, call canonry_measurement_plan_get before stating that a project has no Properties, no Advanced plan, or cannot break out per-Property performance; use canonry_measurement_portfolio_summary to rank Properties.`,
1486
1486
  access: "read",
1487
1487
  tier: "core",
1488
1488
  inputSchema: z3.object({
@@ -1656,7 +1656,7 @@ var canonryMcpTools = [
1656
1656
  defineTool({
1657
1657
  name: "canonry_runs_latest",
1658
1658
  title: "Get latest project run",
1659
- description: "Get the latest run and total run count for a Canonry project.",
1659
+ description: "Get the latest run and total run count for a Canonry project, plus scheduled admission and default full-sweep manualAdmission: whether each would be refused (PROVIDERS_FAILING) and which providers it would skip because each keeps failing on its account, with each code and retryAfter. They can differ when the schedule names fewer providers. Read manualAdmission before a default manual sweep; admission describes the schedule. A refused scheduled sweep leaves no run, so read admission to tell whether scheduled sweeps are running.",
1660
1660
  access: "read",
1661
1661
  tier: "monitoring",
1662
1662
  inputSchema: projectInputSchema,
@@ -1667,7 +1667,7 @@ var canonryMcpTools = [
1667
1667
  defineTool({
1668
1668
  name: "canonry_run_get",
1669
1669
  title: "Get run",
1670
- description: "Get a Canonry run with its snapshots.",
1670
+ description: "Get a Canonry run with its snapshots. skippedProviders records the providers this run did not call because they kept failing on their accounts; error.providers marks their entries skipped. This is a stored run, not the next sweep's admission: read canonry_runs_latest for scheduled admission and default full-sweep manualAdmission, which can differ when a schedule names fewer providers.",
1671
1671
  access: "read",
1672
1672
  tier: "monitoring",
1673
1673
  inputSchema: runGetInputSchema,
@@ -3182,7 +3182,7 @@ var canonryMcpTools = [
3182
3182
  defineTool({
3183
3183
  name: "canonry_run_trigger",
3184
3184
  title: "Trigger run",
3185
- description: `Trigger an answer-visibility run for a Canonry project. Omit both scoping fields for a full sweep. Pass request.queries[] to measure only some of the project's tracked questions. On a project with a published measurement plan, pass request.measurementScope with at least one group or target to measure one slice of that plan \u2014 a group stands for its member Targets, and only the questions those Targets selected are measured. A scope naming nothing is rejected rather than treated as a full sweep, so omit the field entirely when you want everything. Either kind of slice is recorded as a spot check: it never replaces a full sweep in the dashboard, analytics or report. For verification scenarios (testing whether a provider migration worked, reproducing a regression, sanity-checking after a code change), set request.trigger='probe' \u2014 probe runs write a snapshot you can inspect via canonry_runs_get but are EXCLUDED from dashboard, analytics, intelligence, report, and notifications. Use 'probe' whenever you are testing on your own initiative rather than producing data the user/dashboard will consume. request.dispatchMode='batch' sends every provider that can (a full sweep of a published plan, a batch-capable provider enabled in config.yaml, every answer's model frozen) to its asynchronous batch API at the batch price; the rest run sync and the run stays running until the batch ends (up to its deadline, 24h by default). A batch request no provider can honour is refused with each provider's reason. Omit it for the ordinary sync sweep. A run is refused with PROVIDERS_FAILING when every provider it would call failed on its account (rejected key, denied access, no credit) in each of its last ${PROVIDER_ACCOUNT_FAILURE_STREAK} runs; details.providers names each provider's code and details.retryAfter when one run is let through again (${PROVIDER_ACCOUNT_RETRY_HOURS}h after the newest failure). Tell the user to fix the key, access or billing; saving a new key, model or endpoint in the provider's settings lets the next run through at once. A probe (request.trigger='probe') is never refused, and one that succeeds clears the refusal, so use a probe to check a fix. Set request.force=true only when the user asks to run anyway.`,
3185
+ description: `Trigger an answer-visibility run for a Canonry project. Omit both scoping fields for a full sweep. Pass request.queries[] to measure only some of the project's tracked questions. On a project with a published measurement plan, pass request.measurementScope with at least one group or target to measure one slice of that plan \u2014 a group stands for its member Targets, and only the questions those Targets selected are measured. A scope naming nothing is rejected rather than treated as a full sweep, so omit the field entirely when you want everything. Either kind of slice is recorded as a spot check: it never replaces a full sweep in the dashboard, analytics or report. For verification scenarios (testing whether a provider migration worked, reproducing a regression, sanity-checking after a code change), set request.trigger='probe' \u2014 probe runs write a snapshot you can inspect via canonry_runs_get but are EXCLUDED from dashboard, analytics, intelligence, report, and notifications. Use 'probe' whenever you are testing on your own initiative rather than producing data the user/dashboard will consume. request.dispatchMode='batch' sends every provider that can (a full sweep of a published plan, a batch-capable provider enabled in config.yaml, every answer's model frozen) to its asynchronous batch API at the batch price; the rest run sync and the run stays running until the batch ends (up to its deadline, 24h by default). A batch request no provider can honour is refused with each provider's reason. Omit it for the ordinary sync sweep. A run is refused with PROVIDERS_FAILING when every provider it would call failed on its account (rejected key, denied access, no credit) in each of its last ${PROVIDER_ACCOUNT_FAILURE_STREAK} runs; details.providers names each provider's code and details.retryAfter when one run is let through again (${PROVIDER_ACCOUNT_RETRY_HOURS}h after the newest failure). Tell the user to fix the key, access or billing; saving a new key, model or endpoint in the provider's settings lets the next run through at once. A probe (request.trigger='probe') is never refused, and one that succeeds clears the refusal, so use a probe to check a fix. When only some providers keep failing that way, the run is queued without them: skippedProviders on the returned run names each with its code and retryAfter, and the run ends partial. Set request.force=true (call every provider) only when the user asks to run anyway.`,
3186
3186
  access: "write",
3187
3187
  tier: "core",
3188
3188
  inputSchema: runTriggerInputSchema,
@@ -4953,7 +4953,7 @@ function classifyProviderErrorMessage(message) {
4953
4953
  if (/timeout|timed out|ETIMEDOUT/i.test(message)) {
4954
4954
  return "TIMEOUT";
4955
4955
  }
4956
- if (/ECONNRESET|ECONNREFUSED|ENOTFOUND|EAI_AGAIN|network|fetch failed|socket hang up/i.test(message)) {
4956
+ if (/ECONNRESET|ECONNREFUSED|ENOTFOUND|EAI_AGAIN|EHOSTUNREACH|ENETUNREACH|network|fetch failed|socket hang up|connection error|APIConnectionError/i.test(message)) {
4957
4957
  return "NETWORK";
4958
4958
  }
4959
4959
  if (/parse|unexpected token|invalid json|malformed|JSON\.parse/i.test(message)) {
@@ -4961,15 +4961,9 @@ function classifyProviderErrorMessage(message) {
4961
4961
  }
4962
4962
  return "UNKNOWN";
4963
4963
  }
4964
- function classifyProviderErrorMessages(messages) {
4965
- const codes = /* @__PURE__ */ new Set();
4966
- for (const message of messages) {
4967
- codes.add(classifyProviderErrorMessage(message));
4968
- }
4969
- for (const code of PROVIDER_ERROR_PRIORITY) {
4970
- if (codes.has(code)) return code;
4971
- }
4972
- return "UNKNOWN";
4964
+ function mostActionableProviderErrorCode(codes) {
4965
+ const present = new Set(codes);
4966
+ return PROVIDER_ERROR_PRIORITY.find((code) => present.has(code)) ?? "UNKNOWN";
4973
4967
  }
4974
4968
  function extractProviderHttpStatus(message) {
4975
4969
  const text = message.replace(/^(?:\[[^\]]+\]\s*)+/, "");
@@ -5115,6 +5109,18 @@ var runTriggerRequestSchema = z10.object({
5115
5109
  );
5116
5110
  var PROVIDER_ACCOUNT_FAILURE_STREAK = 10;
5117
5111
  var PROVIDER_ACCOUNT_RETRY_HOURS = 24;
5112
+ var providerAccountStreakSchema = z10.object({
5113
+ /** How its newest failure was classified: `PROVIDER_AUTH` or `PROVIDER_BILLING`. */
5114
+ code: providerErrorCodeSchema,
5115
+ /** Runs in a row it failed this way (the threshold). */
5116
+ consecutiveRuns: z10.number().int().positive(),
5117
+ /** When the oldest run of the streak was created. */
5118
+ since: z10.string(),
5119
+ /** The newest run it failed in. */
5120
+ latestRunId: z10.string(),
5121
+ /** When it is next called without `force`: the retry interval after its newest failure finished. */
5122
+ retryAfter: z10.string()
5123
+ });
5118
5124
  var runProviderErrorSchema = z10.object({
5119
5125
  /** Human-readable error message (best-effort extracted from `raw.error.message` / `raw.message`, otherwise the raw text with any `[provider-X]` prefix stripped). */
5120
5126
  message: z10.string(),
@@ -5125,7 +5131,13 @@ var runProviderErrorSchema = z10.object({
5125
5131
  * text when it happened. Absent on errors stored before per-provider codes
5126
5132
  * existed and on entries that are not a provider's own failure.
5127
5133
  */
5128
- code: providerErrorCodeSchema.optional()
5134
+ code: providerErrorCodeSchema.optional(),
5135
+ /**
5136
+ * True when the run did not call this provider because it keeps failing on
5137
+ * its account (the run's `skippedProviders`). `code` is that failure. A
5138
+ * skipped provider neither extends nor ends its failure streak.
5139
+ */
5140
+ skipped: z10.boolean().optional()
5129
5141
  });
5130
5142
  var runErrorSchema = z10.object({
5131
5143
  /** Top-level message for runs that failed without a per-provider error (e.g. user cancellation, internal scheduling failures). */
@@ -5199,8 +5211,23 @@ var runDtoSchema = z10.object({
5199
5211
  * measured a published plan; planless runs, which never batch, omit it.
5200
5212
  */
5201
5213
  dispatchModes: runDispatchModesSchema.optional(),
5214
+ /**
5215
+ * Providers this run does not call because each keeps failing on its
5216
+ * account, decided when it was queued. A probe or a `force` run skips none.
5217
+ * Each has an `error.providers` entry with `skipped: true` once the run
5218
+ * finishes. Omitted when the run skips none.
5219
+ */
5220
+ skippedProviders: z10.record(z10.string(), providerAccountStreakSchema).optional(),
5202
5221
  createdAt: z10.string()
5203
5222
  });
5223
+ var runAdmissionDtoSchema = z10.object({
5224
+ /** Every provider the sweep would call is held back, so it is refused (`PROVIDERS_FAILING`); a scheduled one skips its slot. */
5225
+ refused: z10.boolean(),
5226
+ /** When a refused sweep is next let through without `force`: the earliest provider `retryAfter`. Null when not refused. */
5227
+ retryAfter: z10.string().nullable(),
5228
+ /** Each provider the sweep would call that is held back. Empty when none is. */
5229
+ providers: z10.record(z10.string(), providerAccountStreakSchema)
5230
+ });
5204
5231
  var PROVIDER_PREFIX = /^\[provider-[\w-]+\]\s+/;
5205
5232
  function parseProviderErrorMessage(msg) {
5206
5233
  const stripped = msg.replace(PROVIDER_PREFIX, "");
@@ -5253,6 +5280,24 @@ function buildProviderRunError(messages) {
5253
5280
  }
5254
5281
  return { providers };
5255
5282
  }
5283
+ function skippedProviderRunError(provider, streak) {
5284
+ return {
5285
+ message: `Not called: ${provider} failed on its account (${streak.code}) in each of its last ${streak.consecutiveRuns} runs. It is called again after ${streak.retryAfter}, or as soon as a new key, model or endpoint is saved for it (canonry settings provider ${provider}). Pass force (canonry run --force) to call it now.`,
5286
+ code: streak.code,
5287
+ skipped: true
5288
+ };
5289
+ }
5290
+ function withSkippedProviders(error, skipped) {
5291
+ const entries = Object.entries(skipped);
5292
+ if (entries.length === 0) return error;
5293
+ return {
5294
+ ...error,
5295
+ providers: {
5296
+ ...error.providers,
5297
+ ...Object.fromEntries(entries.map(([provider, streak]) => [provider, skippedProviderRunError(provider, streak)]))
5298
+ }
5299
+ };
5300
+ }
5256
5301
  function serializeRunError(err) {
5257
5302
  return JSON.stringify(err);
5258
5303
  }
@@ -5396,7 +5441,11 @@ var runDetailDtoSchema = runDtoSchema.extend({
5396
5441
  });
5397
5442
  var latestProjectRunDtoSchema = z10.object({
5398
5443
  totalRuns: z10.number().int().nonnegative(),
5399
- run: runDetailDtoSchema.nullable()
5444
+ run: runDetailDtoSchema.nullable(),
5445
+ /** Whether the next full sweep would be admitted, and which providers it would skip. Absent from servers before it existed. */
5446
+ admission: runAdmissionDtoSchema.optional(),
5447
+ /** Admission for a manual full sweep, using the project's providers rather than a schedule override. */
5448
+ manualAdmission: runAdmissionDtoSchema.optional()
5400
5449
  });
5401
5450
  var auditLogEntrySchema = z10.object({
5402
5451
  id: z10.string(),
@@ -22274,7 +22323,7 @@ export {
22274
22323
  canonicalMeasurementPlanJson,
22275
22324
  isProviderAccountFailure,
22276
22325
  classifyProviderErrorMessage,
22277
- classifyProviderErrorMessages,
22326
+ mostActionableProviderErrorCode,
22278
22327
  extractProviderHttpStatus,
22279
22328
  runStatusSchema,
22280
22329
  RunStatuses,
@@ -22289,9 +22338,11 @@ export {
22289
22338
  PROVIDER_ACCOUNT_FAILURE_STREAK,
22290
22339
  PROVIDER_ACCOUNT_RETRY_HOURS,
22291
22340
  runDtoSchema,
22341
+ runAdmissionDtoSchema,
22292
22342
  parseRunError,
22293
22343
  buildRunErrorFromMessages,
22294
22344
  buildProviderRunError,
22345
+ withSkippedProviders,
22295
22346
  serializeRunError,
22296
22347
  formatRunErrorOneLine,
22297
22348
  snapshotListResponseSchema,