@canonry/canonry 5.11.0 → 5.12.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.
- package/assets/assets/{AuditHistoryPanel-Cq8CoZV5.js → AuditHistoryPanel-DL_NSpfm.js} +1 -1
- package/assets/assets/{BacklinksPage-B5_QeuXd.js → BacklinksPage-BtcBybtX.js} +1 -1
- package/assets/assets/{HistoryPage-Foj5--rM.js → HistoryPage-jXj-qi9c.js} +1 -1
- package/assets/assets/{MeasurementPropertyPage-2t8jVNFL.js → MeasurementPropertyPage-DKw401ok.js} +1 -1
- package/assets/assets/{ProjectPage-By0UYm8r.js → ProjectPage-og4qfFFD.js} +1 -1
- package/assets/assets/{RunRow-CbTtzDK5.js → RunRow-nK5iaZe1.js} +1 -1
- package/assets/assets/{RunsPage-Cjv7YiXR.js → RunsPage-CMgr3YSF.js} +1 -1
- package/assets/assets/{SettingsPage-DIQgJQ8Y.js → SettingsPage-QtElCcew.js} +1 -1
- package/assets/assets/{SiteHealthSection-CUNhD0To.js → SiteHealthSection-DNdVVl30.js} +3 -3
- package/assets/assets/{TrafficPage-abuZqCEU.js → TrafficPage-C0WgvfRj.js} +1 -1
- package/assets/assets/{TrafficSourceDetailPage-B-zVt0Sa.js → TrafficSourceDetailPage-jOTedQtt.js} +1 -1
- package/assets/assets/{extract-error-message-C5-X8IcG.js → extract-error-message-DO_053o0.js} +1 -1
- package/assets/assets/{index-Dzg_siX8.js → index-CnVwWE3V.js} +27 -27
- package/assets/assets/{react-sigma_core.esm.min-Ybxr8Ybd.js → react-sigma_core.esm.min-DJttq2UK.js} +1 -1
- package/assets/assets/{v2-overview-adapter-BMOnF8IE.js → v2-overview-adapter-BC_oa__K.js} +1 -1
- package/assets/index.html +1 -1
- package/dist/{chunk-SMYBGUVV.js → chunk-DOC4QQLS.js} +26 -4
- package/dist/{chunk-UYSTNPTX.js → chunk-KBSAEALE.js} +95 -27
- package/dist/{chunk-JNU6GLAV.js → chunk-LWGYRN3T.js} +2 -2
- package/dist/{chunk-MQMJJZ6W.js → chunk-NYRRWWEE.js} +6 -2
- package/dist/{chunk-NV3X6O5P.js → chunk-S4BIBUCK.js} +2 -2
- package/dist/{chunk-JW5DCORY.js → chunk-WJGUBZSW.js} +23 -1
- package/dist/cli.js +7 -7
- package/dist/{demo-server-76IZBMJ3.js → demo-server-OTXS6ZHS.js} +3 -3
- package/dist/index.d.ts +28 -1
- package/dist/index.js +5 -5
- package/dist/{intelligence-service-KF5WWPGR.js → intelligence-service-K4U55A2J.js} +2 -2
- package/dist/mcp.js +3 -3
- package/package.json +11 -11
package/assets/assets/{react-sigma_core.esm.min-Ybxr8Ybd.js → react-sigma_core.esm.min-DJttq2UK.js}
RENAMED
|
@@ -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-
|
|
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-DNdVVl30.js";import"./index-CnVwWE3V.js";import"./vendor-radix-twS1M3FF.js";import"./vendor-recharts-llkUFBGR.js";import"./vendor-lucide-N6vOpZmh.js";import"./vendor-markdown-B4giJcws.js";import"./vendor-yaml-GWJz5H2G.js";import"./ChartPrimitives-BQC2VH0O.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{j as s,r as C}from"./vendor-tanstack-ZXXkndVj.js";import{A as ie,B as oe}from"./index-Dzg_siX8.js";import{M as le}from"./vendor-markdown-B4giJcws.js";import{C as ue,$ as ce,g as J}from"./vendor-lucide-N6vOpZmh.js";const $e="Sources",B={copy:"Copy answer",copying:"Copying…",copied:"Copied",failed:"Could not copy. Select and copy the answer above."};function de({headingLevel:e}){return n=>{const l=[],u=c=>{c.type==="heading"&&c.depth&&l.push(c),c.children?.forEach(u)};u(n);const f=l.reduce((c,p)=>Math.min(c,p.depth),6);for(const c of l){const p=c.depth-f;c.depth=Math.min(6,e+p),c.data={...c.data,hProperties:{...c.data?.hProperties,"data-answer-heading-level":p+1}}}}}function pe({answer:e}){const[n,l]=C.useState("idle"),u=C.useRef(!1),f=async()=>{if(!u.current){u.current=!0,l("copying");try{await navigator.clipboard.writeText(e),l("copied")}catch{l("failed")}finally{u.current=!1}}};return s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-3",children:[s.jsx(oe,{type:"button",variant:"ghost",className:"min-h-11 px-2","aria-disabled":n==="copying","aria-busy":n==="copying",onClick:()=>{f()},children:n==="copying"?B.copying:B.copy}),s.jsx("span",{role:"status",className:"text-sm text-secondary",children:n==="copied"?B.copied:n==="failed"?B.failed:""})]})}function Me({children:e,headingLevel:n=4,copyable:l=!1}){return s.jsxs("div",{className:"answer-markdown",children:[s.jsx(le,{remarkPlugins:[[de,{headingLevel:n}]],components:{p:({children:u})=>s.jsx("p",{className:"mb-3 whitespace-pre-wrap last:mb-0",children:u}),ul:({children:u})=>s.jsx("ul",{className:"mb-3 ml-5 list-disc space-y-1",children:u}),ol:({children:u,start:f})=>s.jsx("ol",{start:f,className:"mb-3 ml-5 list-decimal space-y-1",children:u}),pre:({children:u})=>s.jsx("pre",{className:"mb-3 overflow-x-auto whitespace-pre-wrap",children:u}),a:({children:u,href:f})=>{const c=ie(f);return c?s.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"text-link underline",children:u}):s.jsx("span",{children:u})},img:({alt:u})=>s.jsx("span",{children:u})},children:e}),l&&e.trim()?s.jsx(pe,{answer:e},e):null]})}const 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",D="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",q=e=>e.kind==="project"?"Whole site":e.label,E={allMarkets:"All markets",browse:e=>`Browse ${e}`,select:e=>`Select ${e}`,browseAll:"Browse all properties"},me=e=>e?.kind==="group"&&e.marketKeys?.length===1?e.marketKeys[0]:void 0,ee=e=>`${e} ${e===1?"property":"properties"}`;function Ie({options:e,selected:n,onSelect:l,marketKey:u,label:f="Measurement scope",labelVisibility:c="visible",allowGroupSelect:p=!0}){const a=[...e].sort((t,o)=>t.label.localeCompare(o.label,void 0,{numeric:!0})||t.id.localeCompare(o.id)),[x,k]=C.useState(""),[M,I]=C.useState([]),[y,N]=C.useState(!1),b=C.useRef(null),v=C.useRef(null),r=C.useId(),g=a.filter(t=>t.kind==="group"),m=new Map(g.map(t=>[t.id,t])),i=m.get(M.at(-1)??""),U=m.get(M.at(-2)??""),h=x.trim().toLocaleLowerCase(),re=g.filter(t=>!t.parentGroupIds?.some(o=>m.has(o))),_=a.filter(t=>t.kind==="property"),L=t=>(t.parentGroupIds??[]).map(o=>m.get(o)?.label).filter(Boolean).join(" · "),R=t=>`${q(t)} ${L(t)}`.toLocaleLowerCase().includes(h),F=t=>{const o=[...t.parentGroupIds??[]],d=new Set;for(;o.length;){const j=o.pop();if(j===i?.id)return!0;d.has(j)||(d.add(j),o.push(...m.get(j)?.parentGroupIds??[]))}return!1},K=(y?[]:i?g.filter(t=>h?F(t):t.parentGroupIds?.includes(i.id)):h?g:re).filter(R),S=a.find(t=>t.kind==="market"&&t.id===(u??(n.kind==="market"?n.id:void 0))),H=i&&S&&(i.marketKeys?.includes(S.id)||S.parentGroupIds?.includes(i.id))?S.id:void 0,O=p?H??me(i):void 0,G=(i?_.filter(t=>t.parentGroupIds?.includes(i.id)&&(!O||t.marketKeys?.includes(O))):h||y||g.length===0?_:[]).filter(R),W=a.filter(t=>t.kind!=="market"||y||!p&&!i&&!h&&g.length>0||p&&i?.marketKeys?.length===1&&!h?!1:(i?h?F(t):t.parentGroupIds?.includes(i.id):h||!t.parentGroupIds?.some(d=>m.has(d)))&&R(t)),z=i||y?[]:a.filter(t=>t.kind==="project"&&R(t));C.useEffect(()=>{const t=o=>{b.current?.open&&o.target instanceof Node&&!b.current.contains(o.target)&&(b.current.open=!1)};return document.addEventListener("pointerdown",t),()=>document.removeEventListener("pointerdown",t)},[]);const se=t=>{b.current&&(b.current.open=!1,b.current.querySelector("summary")?.focus());const o=p?t.kind==="property"?O:t.kind==="group"&&t.id===i?.id?H:void 0:void 0;o?l(t,o):l(t)},T=t=>{const o=[];let d=m.get(t.parentGroupIds?.[0]??"");for(;d&&!o.includes(d.id)&&d.id!==t.id;)o.unshift(d.id),d=m.get(d.parentGroupIds?.[0]??"");return[...o,t.id]},ae=()=>{const t=n.kind==="group"?m.get(n.id):void 0,o=m.get(S?.parentGroupIds?.[0]??""),d=(n.parentGroupIds??[]).flatMap(A=>{const w=m.get(A);return w?[T(w)]:[]}),j=d.find(A=>A.at(-1)===i?.id)??d.sort((A,w)=>w.length-A.length)[0]??[],Z=o?T(o):n.marketKeys?.length?[]:j;I(t?T(t):Z),N(n.kind==="property"&&Z.length===0&&g.length>0),k("")},Q=t=>{I(T(t)),N(!1),k(""),v.current?.focus()},P=(t,o=q(t))=>s.jsxs("div",{className:"flex items-stretch",children:[s.jsxs("button",{type:"button",className:D,"aria-label":t.kind==="group"&&!p?E.browse(q(t)):E.select(q(t)),"aria-current":n.kind===t.kind&&n.id===t.id?"true":void 0,onClick:()=>t.kind==="group"&&!p?Q(t):se(t),children:[s.jsxs("span",{className:"min-w-0 break-words",children:[o,h&&L(t)?s.jsx("span",{className:"block text-[13px] text-secondary",children:L(t)}):null]}),s.jsx("span",{className:"shrink-0 text-right text-[13px] text-secondary",children:t.kind==="market"?p?"Query context":"Market":t.kind==="property"?"Property":ee(t.targetCount)})]}),p&&t.kind==="group"&&t.id!==i?.id&&a.some(d=>d.parentGroupIds?.includes(t.id))?s.jsx("button",{type:"button","aria-label":E.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:()=>Q(t),children:s.jsx(J,{size:18,"aria-hidden":"true"})}):null]},`${t.kind}:${t.id}`),V=(t,o)=>o.length>0?s.jsxs("section",{"aria-label":t,className:"mt-2",children:[s.jsx("h3",{className:"px-2 py-2 text-[13px] font-medium text-secondary",children:t}),o.map(d=>P(d))]}):null,Y=(t,o,d)=>o.length>0?s.jsxs("details",{open:d,className:"mt-2 border-y border-default",children:[s.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," (",o.length,")"]}),o.map(j=>P(j))]},`${i?.id??"root"}:${t}`):null;return s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{id:`${r}-label`,className:c==="sr-only"?"sr-only":"mb-1 block text-sm font-medium text-heading",children:f}),s.jsxs("details",{ref:b,className:"relative",onToggle:t=>{t.target===t.currentTarget&&t.currentTarget.open&&v.current?.focus()},onKeyDown:t=>{t.key==="Escape"&&(t.preventDefault(),t.currentTarget.open=!1,t.currentTarget.querySelector("summary")?.focus())},children:[s.jsxs("summary",{id:`${r}-value`,"aria-labelledby":`${r}-label ${r}-value`,className:`${X} visibility-scope-trigger`,onClick:()=>{b.current?.open||ae()},children:[`${q(n)}${n.kind==="group"?` · ${ee(n.targetCount)}`:n.kind==="property"?` · ${a.find(t=>t.kind==="market"&&t.id===u)?.label??(n.marketKeys?.length?E.allMarkets:"Property")}`:n.kind==="market"?" · Market":""}`,s.jsx(ue,{size:16,"aria-hidden":"true",className:"shrink-0 text-secondary"})]}),s.jsxs("div",{className:"visibility-scope-menu",children:[i||y?s.jsxs("div",{className:"mb-2 border-b border-default pb-2",children:[s.jsx("button",{type:"button",className:D,"aria-label":`Back to ${U?.label??"all groups"}`,onClick:()=>{I(M.slice(0,-1)),N(!1),k(""),v.current?.focus()},children:s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(ce,{size:16,"aria-hidden":"true"}),U?.label??"All groups"]})}),s.jsx("p",{className:"px-2 py-1 text-sm font-medium text-heading","aria-live":"polite",children:i?.label??"All properties"})]}):null,s.jsx("input",{ref:v,type:"search","aria-label":"Search scopes",className:X,placeholder:i?"Search within this group":y?"Search properties":"Search groups or properties",value:x,onChange:t=>k(t.target.value)}),s.jsxs("div",{className:"mt-2 max-h-80 overflow-y-auto",children:[p&&i&&!h?P(i,"All properties in this group"):null,z.map(t=>P(t)),i&&!h?Y("Subgroups",K,!0):V(i?"Subgroups":"Groups",K),h?V("Properties",G):Y(i&&K.length>0?"All properties":"Properties",G,!i||K.length===0),V("Markets",W),!i&&!y&&!h&&g.length>0&&_.length>0?s.jsxs("button",{type:"button",className:`${D} mt-2 border-t border-default`,"aria-label":E.browseAll,onClick:()=>{N(!0),v.current?.focus()},children:[s.jsx("span",{children:"All properties"}),s.jsx(J,{size:18,"aria-hidden":"true"})]}):null,h&&K.length+G.length+W.length+z.length===0?s.jsx("p",{className:"py-3 text-sm text-secondary",children:"No matching scopes."}):null]})]})]})]})}function Ke(e){const n=e[0];return n?e.every(l=>l.mode===n.mode&&l.scope.kind===n.scope.kind&&l.scope.key===n.scope.key&&l.queryClass===n.queryClass&&l.measurement.displayedRunId===n.measurement.displayedRunId):!0}function $(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}}function ge(e){return e.kind==="exact"?e.url:e.kind==="prefix"?`https://${e.host}${e.pathPrefix}/*`:`https://${e.host}/*`}function fe(e){return e==="assigned"?"this-property":e==="sibling"?"another-property":e==="ownedUnmapped"?"owned-unassigned":e==="external"?"external":e==="ambiguous"?"multiple-properties":"invalid-url"}function he(e){return e==="assigned"?"positive":e==="external"?"neutral":e==="invalid"?"negative":"caution"}function te(e){return`target:${e.targetKey}:${e.queryId}:${e.executionNodeKey}`}function ye(e,n,l){const u=new Map;if(!n)return u;const f=new Map(e.usageEdges.map(a=>[te(a),a.targetKey])),c=new Map(e.assignments.map(a=>[`${a.targetKey}:${a.queryId}`,a.queryClass])),p=new Map(e.usageEdges.map(a=>[te(a),c.get(`${a.targetKey}:${a.queryId}`)]));for(const a of n.evidence){if(l&&p.get(a.usageEdgeId)!==l)continue;const x=f.get(a.usageEdgeId);if(!x)continue;const k=u.get(x)??[];k.push({id:`${a.observationId}:${a.expectedSlotId}:${a.usageEdgeId}:${a.sourceUrl}`,kind:fe(a.classification),query:a.queryText,provider:a.provider,location:a.location,url:a.sourceUrl,tone:he(a.classification),historical:a.historical||a.bridged}),u.set(x,k)}return u}function be(e){if(e.flags>0)return{label:"Review",tone:"caution"};const n=[e.mentionCoverage,e.citationCoverage].filter(l=>l.state==="unavailable").map(l=>l.reason);return n.includes("no_completed_run")?{label:"Not measured",tone:"neutral"}:n.includes("plan_v1")?{label:"Update setup",tone:"caution"}:n.includes("evidence_incomplete")?{label:"Evidence incomplete",tone:"caution"}:n.includes("no_population")?{label:"No queries",tone:"neutral"}:n.includes("not_applicable")?{label:"Not applicable",tone:"neutral"}:{label:"Complete",tone:"positive"}}function xe(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 ke(e){if(!e)return"";const n=new Date(e);return Number.isFinite(n.getTime())?n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):""}function ne(e){const n=e.nextAction.count??e.flags.total;if(e.nextAction.kind==="review_flags")return`${n} flagged ${n===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 Se({overview:e,activePlan:n,report:l,reportState:u=l?"ready":"loading",sort:f}){if(n.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 c=n.plan,p=new Map(c.targets.map(r=>[r.stableKey,r])),a=new Map(c.querySnapshots.map(r=>[r.queryId,r.queryText])),x=new Map;for(const r of c.assignments){if(e.queryClass!=="all"&&r.queryClass!==e.queryClass)continue;const g=a.get(r.queryId);if(!g)continue;const m=x.get(r.targetKey)??new Set;m.add(g),x.set(r.targetKey,m)}const k=l?.revision===n.revision&&l.run?.id===e.measurement.displayedRunId?l:null,M=e.measurement.displayedRunId===void 0||k?"ready":u==="error"||l!=null?"error":"loading",I=ye(c,k,e.queryClass==="all"?void 0:e.queryClass),y=new Map;for(const r of c.groups)for(const g of r.targetKeys)y.has(g)||y.set(g,r.label);const N=e.properties.items.map(r=>{const g=p.get(r.targetKey),m=I.get(r.targetKey)??[];return{id:r.targetKey,name:r.label,mentionCoverage:$(r.mentionCoverage),citationCoverage:$(r.citationCoverage),status:be(r),providers:r.providers?.map(i=>({provider:i.provider,mentionCoverage:$(i.mentionCoverage),citationCoverage:$(i.citationCoverage)})),market:y.get(r.targetKey),assignedQueries:[...x.get(r.targetKey)??[]],urls:g?.urlMatchers.map(ge)??[],evidence:m,evidenceState:M,historical:m.some(i=>i.historical)}}),b=e.namedShareOfVoice?.entries.map(r=>({name:r.label,coverage:{numerator:r.credits,denominator:e.namedShareOfVoice.denominator}})),v=e.properties.items.flatMap(r=>r.flags>0?[{id:`property:${r.targetKey}`,property:r.label,summary:`${r.flags} ${r.flags===1?"result needs":"results need"} review.`,tone:"caution",count:r.flags}]:[]);return{classReporting:"available",latestMeasurement:{status:xe(e.measurement.state),completedSlots:e.measurement.completed,totalSlots:e.measurement.expected,date:ke(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:$(e.metrics.propertiesMentioned),mentionCoverage:$(e.metrics.mentionCoverage),citationCoverage:$(e.metrics.citationCoverage)},properties:N,...b?{shareOfVoice:b}:{}},propertyTotal:e.properties.totalEstimate??N.length,outcomes:e.outcomes,nextCursor:e.properties.nextCursor,...f?{sort:f}:{}},availableGroups:c.groups.map(r=>({id:r.stableKey,label:r.label})),...ne(e)?{nextActionText:ne(e)}:{},flaggedResultsTotal:e.flags.total,flaggedResults:v}}export{Me as A,E as M,Ie as V,$e as a,Ke as b,Se as c,ge as m};
|
|
1
|
+
import{j as s,r as C}from"./vendor-tanstack-ZXXkndVj.js";import{A as ie,B as oe}from"./index-CnVwWE3V.js";import{M as le}from"./vendor-markdown-B4giJcws.js";import{C as ue,$ as ce,g as J}from"./vendor-lucide-N6vOpZmh.js";const $e="Sources",B={copy:"Copy answer",copying:"Copying…",copied:"Copied",failed:"Could not copy. Select and copy the answer above."};function de({headingLevel:e}){return n=>{const l=[],u=c=>{c.type==="heading"&&c.depth&&l.push(c),c.children?.forEach(u)};u(n);const f=l.reduce((c,p)=>Math.min(c,p.depth),6);for(const c of l){const p=c.depth-f;c.depth=Math.min(6,e+p),c.data={...c.data,hProperties:{...c.data?.hProperties,"data-answer-heading-level":p+1}}}}}function pe({answer:e}){const[n,l]=C.useState("idle"),u=C.useRef(!1),f=async()=>{if(!u.current){u.current=!0,l("copying");try{await navigator.clipboard.writeText(e),l("copied")}catch{l("failed")}finally{u.current=!1}}};return s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-3",children:[s.jsx(oe,{type:"button",variant:"ghost",className:"min-h-11 px-2","aria-disabled":n==="copying","aria-busy":n==="copying",onClick:()=>{f()},children:n==="copying"?B.copying:B.copy}),s.jsx("span",{role:"status",className:"text-sm text-secondary",children:n==="copied"?B.copied:n==="failed"?B.failed:""})]})}function Me({children:e,headingLevel:n=4,copyable:l=!1}){return s.jsxs("div",{className:"answer-markdown",children:[s.jsx(le,{remarkPlugins:[[de,{headingLevel:n}]],components:{p:({children:u})=>s.jsx("p",{className:"mb-3 whitespace-pre-wrap last:mb-0",children:u}),ul:({children:u})=>s.jsx("ul",{className:"mb-3 ml-5 list-disc space-y-1",children:u}),ol:({children:u,start:f})=>s.jsx("ol",{start:f,className:"mb-3 ml-5 list-decimal space-y-1",children:u}),pre:({children:u})=>s.jsx("pre",{className:"mb-3 overflow-x-auto whitespace-pre-wrap",children:u}),a:({children:u,href:f})=>{const c=ie(f);return c?s.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"text-link underline",children:u}):s.jsx("span",{children:u})},img:({alt:u})=>s.jsx("span",{children:u})},children:e}),l&&e.trim()?s.jsx(pe,{answer:e},e):null]})}const 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",D="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",q=e=>e.kind==="project"?"Whole site":e.label,E={allMarkets:"All markets",browse:e=>`Browse ${e}`,select:e=>`Select ${e}`,browseAll:"Browse all properties"},me=e=>e?.kind==="group"&&e.marketKeys?.length===1?e.marketKeys[0]:void 0,ee=e=>`${e} ${e===1?"property":"properties"}`;function Ie({options:e,selected:n,onSelect:l,marketKey:u,label:f="Measurement scope",labelVisibility:c="visible",allowGroupSelect:p=!0}){const a=[...e].sort((t,o)=>t.label.localeCompare(o.label,void 0,{numeric:!0})||t.id.localeCompare(o.id)),[x,k]=C.useState(""),[M,I]=C.useState([]),[y,N]=C.useState(!1),b=C.useRef(null),v=C.useRef(null),r=C.useId(),g=a.filter(t=>t.kind==="group"),m=new Map(g.map(t=>[t.id,t])),i=m.get(M.at(-1)??""),U=m.get(M.at(-2)??""),h=x.trim().toLocaleLowerCase(),re=g.filter(t=>!t.parentGroupIds?.some(o=>m.has(o))),_=a.filter(t=>t.kind==="property"),L=t=>(t.parentGroupIds??[]).map(o=>m.get(o)?.label).filter(Boolean).join(" · "),R=t=>`${q(t)} ${L(t)}`.toLocaleLowerCase().includes(h),F=t=>{const o=[...t.parentGroupIds??[]],d=new Set;for(;o.length;){const j=o.pop();if(j===i?.id)return!0;d.has(j)||(d.add(j),o.push(...m.get(j)?.parentGroupIds??[]))}return!1},K=(y?[]:i?g.filter(t=>h?F(t):t.parentGroupIds?.includes(i.id)):h?g:re).filter(R),S=a.find(t=>t.kind==="market"&&t.id===(u??(n.kind==="market"?n.id:void 0))),H=i&&S&&(i.marketKeys?.includes(S.id)||S.parentGroupIds?.includes(i.id))?S.id:void 0,O=p?H??me(i):void 0,G=(i?_.filter(t=>t.parentGroupIds?.includes(i.id)&&(!O||t.marketKeys?.includes(O))):h||y||g.length===0?_:[]).filter(R),W=a.filter(t=>t.kind!=="market"||y||!p&&!i&&!h&&g.length>0||p&&i?.marketKeys?.length===1&&!h?!1:(i?h?F(t):t.parentGroupIds?.includes(i.id):h||!t.parentGroupIds?.some(d=>m.has(d)))&&R(t)),z=i||y?[]:a.filter(t=>t.kind==="project"&&R(t));C.useEffect(()=>{const t=o=>{b.current?.open&&o.target instanceof Node&&!b.current.contains(o.target)&&(b.current.open=!1)};return document.addEventListener("pointerdown",t),()=>document.removeEventListener("pointerdown",t)},[]);const se=t=>{b.current&&(b.current.open=!1,b.current.querySelector("summary")?.focus());const o=p?t.kind==="property"?O:t.kind==="group"&&t.id===i?.id?H:void 0:void 0;o?l(t,o):l(t)},T=t=>{const o=[];let d=m.get(t.parentGroupIds?.[0]??"");for(;d&&!o.includes(d.id)&&d.id!==t.id;)o.unshift(d.id),d=m.get(d.parentGroupIds?.[0]??"");return[...o,t.id]},ae=()=>{const t=n.kind==="group"?m.get(n.id):void 0,o=m.get(S?.parentGroupIds?.[0]??""),d=(n.parentGroupIds??[]).flatMap(A=>{const w=m.get(A);return w?[T(w)]:[]}),j=d.find(A=>A.at(-1)===i?.id)??d.sort((A,w)=>w.length-A.length)[0]??[],Z=o?T(o):n.marketKeys?.length?[]:j;I(t?T(t):Z),N(n.kind==="property"&&Z.length===0&&g.length>0),k("")},Q=t=>{I(T(t)),N(!1),k(""),v.current?.focus()},P=(t,o=q(t))=>s.jsxs("div",{className:"flex items-stretch",children:[s.jsxs("button",{type:"button",className:D,"aria-label":t.kind==="group"&&!p?E.browse(q(t)):E.select(q(t)),"aria-current":n.kind===t.kind&&n.id===t.id?"true":void 0,onClick:()=>t.kind==="group"&&!p?Q(t):se(t),children:[s.jsxs("span",{className:"min-w-0 break-words",children:[o,h&&L(t)?s.jsx("span",{className:"block text-[13px] text-secondary",children:L(t)}):null]}),s.jsx("span",{className:"shrink-0 text-right text-[13px] text-secondary",children:t.kind==="market"?p?"Query context":"Market":t.kind==="property"?"Property":ee(t.targetCount)})]}),p&&t.kind==="group"&&t.id!==i?.id&&a.some(d=>d.parentGroupIds?.includes(t.id))?s.jsx("button",{type:"button","aria-label":E.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:()=>Q(t),children:s.jsx(J,{size:18,"aria-hidden":"true"})}):null]},`${t.kind}:${t.id}`),V=(t,o)=>o.length>0?s.jsxs("section",{"aria-label":t,className:"mt-2",children:[s.jsx("h3",{className:"px-2 py-2 text-[13px] font-medium text-secondary",children:t}),o.map(d=>P(d))]}):null,Y=(t,o,d)=>o.length>0?s.jsxs("details",{open:d,className:"mt-2 border-y border-default",children:[s.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," (",o.length,")"]}),o.map(j=>P(j))]},`${i?.id??"root"}:${t}`):null;return s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{id:`${r}-label`,className:c==="sr-only"?"sr-only":"mb-1 block text-sm font-medium text-heading",children:f}),s.jsxs("details",{ref:b,className:"relative",onToggle:t=>{t.target===t.currentTarget&&t.currentTarget.open&&v.current?.focus()},onKeyDown:t=>{t.key==="Escape"&&(t.preventDefault(),t.currentTarget.open=!1,t.currentTarget.querySelector("summary")?.focus())},children:[s.jsxs("summary",{id:`${r}-value`,"aria-labelledby":`${r}-label ${r}-value`,className:`${X} visibility-scope-trigger`,onClick:()=>{b.current?.open||ae()},children:[`${q(n)}${n.kind==="group"?` · ${ee(n.targetCount)}`:n.kind==="property"?` · ${a.find(t=>t.kind==="market"&&t.id===u)?.label??(n.marketKeys?.length?E.allMarkets:"Property")}`:n.kind==="market"?" · Market":""}`,s.jsx(ue,{size:16,"aria-hidden":"true",className:"shrink-0 text-secondary"})]}),s.jsxs("div",{className:"visibility-scope-menu",children:[i||y?s.jsxs("div",{className:"mb-2 border-b border-default pb-2",children:[s.jsx("button",{type:"button",className:D,"aria-label":`Back to ${U?.label??"all groups"}`,onClick:()=>{I(M.slice(0,-1)),N(!1),k(""),v.current?.focus()},children:s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(ce,{size:16,"aria-hidden":"true"}),U?.label??"All groups"]})}),s.jsx("p",{className:"px-2 py-1 text-sm font-medium text-heading","aria-live":"polite",children:i?.label??"All properties"})]}):null,s.jsx("input",{ref:v,type:"search","aria-label":"Search scopes",className:X,placeholder:i?"Search within this group":y?"Search properties":"Search groups or properties",value:x,onChange:t=>k(t.target.value)}),s.jsxs("div",{className:"mt-2 max-h-80 overflow-y-auto",children:[p&&i&&!h?P(i,"All properties in this group"):null,z.map(t=>P(t)),i&&!h?Y("Subgroups",K,!0):V(i?"Subgroups":"Groups",K),h?V("Properties",G):Y(i&&K.length>0?"All properties":"Properties",G,!i||K.length===0),V("Markets",W),!i&&!y&&!h&&g.length>0&&_.length>0?s.jsxs("button",{type:"button",className:`${D} mt-2 border-t border-default`,"aria-label":E.browseAll,onClick:()=>{N(!0),v.current?.focus()},children:[s.jsx("span",{children:"All properties"}),s.jsx(J,{size:18,"aria-hidden":"true"})]}):null,h&&K.length+G.length+W.length+z.length===0?s.jsx("p",{className:"py-3 text-sm text-secondary",children:"No matching scopes."}):null]})]})]})]})}function Ke(e){const n=e[0];return n?e.every(l=>l.mode===n.mode&&l.scope.kind===n.scope.kind&&l.scope.key===n.scope.key&&l.queryClass===n.queryClass&&l.measurement.displayedRunId===n.measurement.displayedRunId):!0}function $(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}}function ge(e){return e.kind==="exact"?e.url:e.kind==="prefix"?`https://${e.host}${e.pathPrefix}/*`:`https://${e.host}/*`}function fe(e){return e==="assigned"?"this-property":e==="sibling"?"another-property":e==="ownedUnmapped"?"owned-unassigned":e==="external"?"external":e==="ambiguous"?"multiple-properties":"invalid-url"}function he(e){return e==="assigned"?"positive":e==="external"?"neutral":e==="invalid"?"negative":"caution"}function te(e){return`target:${e.targetKey}:${e.queryId}:${e.executionNodeKey}`}function ye(e,n,l){const u=new Map;if(!n)return u;const f=new Map(e.usageEdges.map(a=>[te(a),a.targetKey])),c=new Map(e.assignments.map(a=>[`${a.targetKey}:${a.queryId}`,a.queryClass])),p=new Map(e.usageEdges.map(a=>[te(a),c.get(`${a.targetKey}:${a.queryId}`)]));for(const a of n.evidence){if(l&&p.get(a.usageEdgeId)!==l)continue;const x=f.get(a.usageEdgeId);if(!x)continue;const k=u.get(x)??[];k.push({id:`${a.observationId}:${a.expectedSlotId}:${a.usageEdgeId}:${a.sourceUrl}`,kind:fe(a.classification),query:a.queryText,provider:a.provider,location:a.location,url:a.sourceUrl,tone:he(a.classification),historical:a.historical||a.bridged}),u.set(x,k)}return u}function be(e){if(e.flags>0)return{label:"Review",tone:"caution"};const n=[e.mentionCoverage,e.citationCoverage].filter(l=>l.state==="unavailable").map(l=>l.reason);return n.includes("no_completed_run")?{label:"Not measured",tone:"neutral"}:n.includes("plan_v1")?{label:"Update setup",tone:"caution"}:n.includes("evidence_incomplete")?{label:"Evidence incomplete",tone:"caution"}:n.includes("no_population")?{label:"No queries",tone:"neutral"}:n.includes("not_applicable")?{label:"Not applicable",tone:"neutral"}:{label:"Complete",tone:"positive"}}function xe(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 ke(e){if(!e)return"";const n=new Date(e);return Number.isFinite(n.getTime())?n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):""}function ne(e){const n=e.nextAction.count??e.flags.total;if(e.nextAction.kind==="review_flags")return`${n} flagged ${n===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 Se({overview:e,activePlan:n,report:l,reportState:u=l?"ready":"loading",sort:f}){if(n.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 c=n.plan,p=new Map(c.targets.map(r=>[r.stableKey,r])),a=new Map(c.querySnapshots.map(r=>[r.queryId,r.queryText])),x=new Map;for(const r of c.assignments){if(e.queryClass!=="all"&&r.queryClass!==e.queryClass)continue;const g=a.get(r.queryId);if(!g)continue;const m=x.get(r.targetKey)??new Set;m.add(g),x.set(r.targetKey,m)}const k=l?.revision===n.revision&&l.run?.id===e.measurement.displayedRunId?l:null,M=e.measurement.displayedRunId===void 0||k?"ready":u==="error"||l!=null?"error":"loading",I=ye(c,k,e.queryClass==="all"?void 0:e.queryClass),y=new Map;for(const r of c.groups)for(const g of r.targetKeys)y.has(g)||y.set(g,r.label);const N=e.properties.items.map(r=>{const g=p.get(r.targetKey),m=I.get(r.targetKey)??[];return{id:r.targetKey,name:r.label,mentionCoverage:$(r.mentionCoverage),citationCoverage:$(r.citationCoverage),status:be(r),providers:r.providers?.map(i=>({provider:i.provider,mentionCoverage:$(i.mentionCoverage),citationCoverage:$(i.citationCoverage)})),market:y.get(r.targetKey),assignedQueries:[...x.get(r.targetKey)??[]],urls:g?.urlMatchers.map(ge)??[],evidence:m,evidenceState:M,historical:m.some(i=>i.historical)}}),b=e.namedShareOfVoice?.entries.map(r=>({name:r.label,coverage:{numerator:r.credits,denominator:e.namedShareOfVoice.denominator}})),v=e.properties.items.flatMap(r=>r.flags>0?[{id:`property:${r.targetKey}`,property:r.label,summary:`${r.flags} ${r.flags===1?"result needs":"results need"} review.`,tone:"caution",count:r.flags}]:[]);return{classReporting:"available",latestMeasurement:{status:xe(e.measurement.state),completedSlots:e.measurement.completed,totalSlots:e.measurement.expected,date:ke(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:$(e.metrics.propertiesMentioned),mentionCoverage:$(e.metrics.mentionCoverage),citationCoverage:$(e.metrics.citationCoverage)},properties:N,...b?{shareOfVoice:b}:{}},propertyTotal:e.properties.totalEstimate??N.length,outcomes:e.outcomes,nextCursor:e.properties.nextCursor,...f?{sort:f}:{}},availableGroups:c.groups.map(r=>({id:r.stableKey,label:r.label})),...ne(e)?{nextActionText:ne(e)}:{},flaggedResultsTotal:e.flags.total,flaggedResults:v}}export{Me as A,E as M,Ie as V,$e as a,Ke as b,Se as c,ge as m};
|
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-
|
|
15
|
+
<script type="module" crossorigin src="./assets/index-CnVwWE3V.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-llkUFBGR.js">
|
|
@@ -776,7 +776,7 @@ import {
|
|
|
776
776
|
wordpressSchemaDeployResultDtoSchema,
|
|
777
777
|
wordpressSchemaStatusResultDtoSchema,
|
|
778
778
|
wordpressStatusDtoSchema
|
|
779
|
-
} from "./chunk-
|
|
779
|
+
} from "./chunk-NYRRWWEE.js";
|
|
780
780
|
|
|
781
781
|
// src/intelligence-service.ts
|
|
782
782
|
import { eq as eq69, desc as desc31, asc as asc12, and as and59, ne as ne10, or as or17, inArray as inArray26, gte as gte18, lte as lte15, isNull as isNull12, sql as sql27, exists } from "drizzle-orm";
|
|
@@ -42986,7 +42986,7 @@ var canonryLocalRouteCatalog = [
|
|
|
42986
42986
|
method: "get",
|
|
42987
42987
|
path: "/api/v1/projects/{name}/agent/providers",
|
|
42988
42988
|
summary: "List the LLM providers Aero can route to",
|
|
42989
|
-
description: "Returns every provider Aero knows about with its default model, whether a usable API key is configured, and where the key resolved from (`config` | `env`). `defaultProvider` is the
|
|
42989
|
+
description: "Returns every provider Aero knows about with its default model, whether a usable API key is configured, and where the key resolved from (`config` | `env`). `defaultProvider` is the provider a new session uses when a caller omits `provider` on the prompt endpoint: the `agent.provider` pin when one is set (even without a key), otherwise the first configured provider by priority. Path is project-scoped for auth symmetry; the response does not vary per project today. Administrator-only: a signed-in viewer, and any API key narrower than the install, are refused with 403, because each entry names a default model and which providers are configured is itself administrator knowledge.",
|
|
42990
42990
|
tags: ["agent"],
|
|
42991
42991
|
parameters: [nameParameter],
|
|
42992
42992
|
responses: {
|
|
@@ -80952,6 +80952,25 @@ var agentProvidersConfiguredCheck = {
|
|
|
80952
80952
|
keySource: entry.keySource
|
|
80953
80953
|
}))
|
|
80954
80954
|
};
|
|
80955
|
+
const pin = ctx.getAgentPin?.() ?? null;
|
|
80956
|
+
if (pin && !pin.configured) {
|
|
80957
|
+
return {
|
|
80958
|
+
status: CheckStatuses.warn,
|
|
80959
|
+
code: "agent-providers.pin-unconfigured",
|
|
80960
|
+
summary: `Aero is pinned to ${pin.provider} by agent.provider, but no key is configured for it, so every Aero turn fails.`,
|
|
80961
|
+
remediation: `Set \`providers.${pin.provider}.apiKey\` in ~/.canonry/config.yaml or export ${pin.envVar}, or change \`agent.provider\`.`,
|
|
80962
|
+
details: { ...details, pin }
|
|
80963
|
+
};
|
|
80964
|
+
}
|
|
80965
|
+
if (pin?.modelError) {
|
|
80966
|
+
return {
|
|
80967
|
+
status: CheckStatuses.warn,
|
|
80968
|
+
code: "agent-providers.pin-model-invalid",
|
|
80969
|
+
summary: `agent.model "${pin.model}" does not resolve for ${pin.provider}, so every Aero turn fails: ${pin.modelError}`,
|
|
80970
|
+
remediation: "Set `agent.model` to a model the pinned provider serves, or remove it to use that provider's default.",
|
|
80971
|
+
details: { ...details, pin }
|
|
80972
|
+
};
|
|
80973
|
+
}
|
|
80955
80974
|
if (configured.length === 0) {
|
|
80956
80975
|
return {
|
|
80957
80976
|
status: CheckStatuses.warn,
|
|
@@ -80964,9 +80983,9 @@ var agentProvidersConfiguredCheck = {
|
|
|
80964
80983
|
return {
|
|
80965
80984
|
status: CheckStatuses.ok,
|
|
80966
80985
|
code: "agent-providers.configured",
|
|
80967
|
-
summary: `${configured.length} of ${total} agent providers configured: ${configured.map((e) => e.id).join(", ")}
|
|
80986
|
+
summary: `${configured.length} of ${total} agent providers configured: ${configured.map((e) => e.id).join(", ")}.` + (pin ? ` Aero is pinned to ${pin.provider} (${pin.model}).` : ""),
|
|
80968
80987
|
remediation: null,
|
|
80969
|
-
details
|
|
80988
|
+
details: pin ? { ...details, pin } : details
|
|
80970
80989
|
};
|
|
80971
80990
|
}
|
|
80972
80991
|
};
|
|
@@ -82199,6 +82218,7 @@ async function doctorRoutes(app, opts) {
|
|
|
82199
82218
|
redirectUri,
|
|
82200
82219
|
providerSummary: opts.providerSummary,
|
|
82201
82220
|
getAgentProviderSummary: opts.getAgentProviderSummary,
|
|
82221
|
+
getAgentPin: opts.getAgentPin,
|
|
82202
82222
|
callerIsInstanceAdministrator: isInstanceAdministrator(request),
|
|
82203
82223
|
trafficSourceValidators: opts.trafficSourceValidators,
|
|
82204
82224
|
runtimeStatePaths: opts.runtimeStatePaths,
|
|
@@ -82230,6 +82250,7 @@ async function doctorRoutes(app, opts) {
|
|
|
82230
82250
|
redirectUri,
|
|
82231
82251
|
providerSummary: opts.providerSummary,
|
|
82232
82252
|
getAgentProviderSummary: opts.getAgentProviderSummary,
|
|
82253
|
+
getAgentPin: opts.getAgentPin,
|
|
82233
82254
|
callerIsInstanceAdministrator: isInstanceAdministrator(request),
|
|
82234
82255
|
trafficSourceValidators: opts.trafficSourceValidators,
|
|
82235
82256
|
runtimeStatePaths: opts.runtimeStatePaths,
|
|
@@ -85541,6 +85562,7 @@ async function apiRoutes(app, opts) {
|
|
|
85541
85562
|
publicUrl: opts.publicUrl,
|
|
85542
85563
|
providerSummary: opts.providerSummary,
|
|
85543
85564
|
getAgentProviderSummary: opts.getAgentProviderSummary,
|
|
85565
|
+
getAgentPin: opts.getAgentPin,
|
|
85544
85566
|
trafficSourceValidators: buildTrafficSourceValidators(opts),
|
|
85545
85567
|
runtimeStatePaths: opts.runtimeStatePaths,
|
|
85546
85568
|
bundledSkills: opts.bundledSkills,
|
|
@@ -17,12 +17,12 @@ import {
|
|
|
17
17
|
resolveOperatorApiKeyIds,
|
|
18
18
|
runWithUsageTags,
|
|
19
19
|
saveConfigPatch
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-WJGUBZSW.js";
|
|
21
21
|
import {
|
|
22
22
|
deleteSiteCrawlGraphLayout,
|
|
23
23
|
persistSiteCrawlGraphLayout,
|
|
24
24
|
prepareSiteCrawlGraphLayout
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-LWGYRN3T.js";
|
|
26
26
|
import {
|
|
27
27
|
PACKAGE_VERSION
|
|
28
28
|
} from "./chunk-AOJU5LKX.js";
|
|
@@ -179,7 +179,7 @@ import {
|
|
|
179
179
|
siteLivenessState,
|
|
180
180
|
toAlertView,
|
|
181
181
|
usageCounters
|
|
182
|
-
} from "./chunk-
|
|
182
|
+
} from "./chunk-DOC4QQLS.js";
|
|
183
183
|
import {
|
|
184
184
|
AGENT_MEMORY_VALUE_MAX_BYTES,
|
|
185
185
|
AGENT_NONE,
|
|
@@ -300,6 +300,7 @@ import {
|
|
|
300
300
|
isVertexGroundingRedirect,
|
|
301
301
|
mapWithConcurrency,
|
|
302
302
|
maskTelemetryAnonymousId,
|
|
303
|
+
missingDependency,
|
|
303
304
|
nextScheduleUpdatedAt,
|
|
304
305
|
normalizeAgentSlug,
|
|
305
306
|
normalizeIdTokens,
|
|
@@ -336,7 +337,7 @@ import {
|
|
|
336
337
|
visibilityReportRequestSchema,
|
|
337
338
|
winnabilityClassLabel,
|
|
338
339
|
withRetry
|
|
339
|
-
} from "./chunk-
|
|
340
|
+
} from "./chunk-NYRRWWEE.js";
|
|
340
341
|
|
|
341
342
|
// src/runtime-context.ts
|
|
342
343
|
function cliRuntimeContext(env = process.env, stdio = process) {
|
|
@@ -6482,7 +6483,7 @@ function nonBlank(value) {
|
|
|
6482
6483
|
return trimmed ? trimmed : void 0;
|
|
6483
6484
|
}
|
|
6484
6485
|
function resolveBuildCommit(env = process.env) {
|
|
6485
|
-
const embedded = true ? "
|
|
6486
|
+
const embedded = true ? "3cbbec137ff9c498f0b59f30a5e2b84c99af6f40" : void 0;
|
|
6486
6487
|
return nonBlank(embedded) ?? nonBlank(env.CANONRY_COMMIT);
|
|
6487
6488
|
}
|
|
6488
6489
|
function resolveInstanceIdentity(env = process.env) {
|
|
@@ -11776,7 +11777,7 @@ function readStoredGroundingSources(rawResponse) {
|
|
|
11776
11777
|
return result2;
|
|
11777
11778
|
}
|
|
11778
11779
|
async function backfillInsightsCommand(project, opts) {
|
|
11779
|
-
const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-
|
|
11780
|
+
const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-K4U55A2J.js");
|
|
11780
11781
|
const config = loadConfig();
|
|
11781
11782
|
const db = createClient(config.database);
|
|
11782
11783
|
migrate(db);
|
|
@@ -13865,13 +13866,15 @@ function resolveAgentId(providerOrPiAi) {
|
|
|
13865
13866
|
return void 0;
|
|
13866
13867
|
}
|
|
13867
13868
|
function buildAgentProvidersResponse(config) {
|
|
13869
|
+
const pinned = coerceAgentProvider(config.agent?.provider ?? void 0);
|
|
13870
|
+
const pinnedModel = pinned ? config.agent?.model ?? void 0 : void 0;
|
|
13868
13871
|
const providers = listAgentProviders().map((id) => {
|
|
13869
13872
|
const entry = AGENT_PROVIDERS[id];
|
|
13870
13873
|
const source = resolveApiKeySource(id, config);
|
|
13871
13874
|
return {
|
|
13872
13875
|
id,
|
|
13873
13876
|
label: entry.label,
|
|
13874
|
-
defaultModel: entry.defaultModel,
|
|
13877
|
+
defaultModel: id === pinned && pinnedModel ? pinnedModel : entry.defaultModel,
|
|
13875
13878
|
configured: source !== void 0,
|
|
13876
13879
|
keySource: source?.source ?? null
|
|
13877
13880
|
};
|
|
@@ -13879,7 +13882,7 @@ function buildAgentProvidersResponse(config) {
|
|
|
13879
13882
|
const firstConfigured = agentProvidersByPriority().find((p) => resolveApiKeySource(p, config));
|
|
13880
13883
|
return {
|
|
13881
13884
|
providers,
|
|
13882
|
-
defaultProvider: firstConfigured ?? null
|
|
13885
|
+
defaultProvider: pinned ?? firstConfigured ?? null
|
|
13883
13886
|
};
|
|
13884
13887
|
}
|
|
13885
13888
|
|
|
@@ -14845,6 +14848,27 @@ function missingProviderMessage() {
|
|
|
14845
14848
|
const envHints = agentProvidersByPriority().map(agentProviderApiKeyEnvVar).join(" / ");
|
|
14846
14849
|
return `No agent LLM provider configured. Add an API key for one of: ${configHints} in ~/.canonry/config.yaml, or export ${envHints}.`;
|
|
14847
14850
|
}
|
|
14851
|
+
function resolveConfiguredAgentProvider(config) {
|
|
14852
|
+
return coerceAgentProvider(config.agent?.provider);
|
|
14853
|
+
}
|
|
14854
|
+
function describeAgentPin(config) {
|
|
14855
|
+
const provider = resolveConfiguredAgentProvider(config);
|
|
14856
|
+
if (!provider) return null;
|
|
14857
|
+
const model = config.agent?.model ?? getAgentProvider(provider).defaultModel;
|
|
14858
|
+
let modelError = null;
|
|
14859
|
+
try {
|
|
14860
|
+
resolveAeroModel(provider, model);
|
|
14861
|
+
} catch (err) {
|
|
14862
|
+
modelError = err instanceof Error ? err.message : String(err);
|
|
14863
|
+
}
|
|
14864
|
+
return {
|
|
14865
|
+
provider,
|
|
14866
|
+
model,
|
|
14867
|
+
configured: Boolean(resolveApiKeyFor(provider, config)),
|
|
14868
|
+
envVar: agentProviderApiKeyEnvVar(provider),
|
|
14869
|
+
modelError
|
|
14870
|
+
};
|
|
14871
|
+
}
|
|
14848
14872
|
function detectAgentProvider(config) {
|
|
14849
14873
|
for (const provider of agentProvidersByPriority()) {
|
|
14850
14874
|
if (resolveApiKeyFor(provider, config)) return provider;
|
|
@@ -14915,9 +14939,11 @@ function createAeroSession(opts) {
|
|
|
14915
14939
|
return agent;
|
|
14916
14940
|
}
|
|
14917
14941
|
function resolveSessionProviderAndModel(config, opts) {
|
|
14918
|
-
const
|
|
14942
|
+
const pinned = resolveConfiguredAgentProvider(config);
|
|
14943
|
+
const provider = opts?.provider ?? pinned ?? detectAgentProvider(config);
|
|
14919
14944
|
if (!provider) throw new Error(missingProviderMessage());
|
|
14920
|
-
const
|
|
14945
|
+
const pinnedModelId = provider === pinned ? config.agent?.model : void 0;
|
|
14946
|
+
const modelId = opts?.modelId ?? pinnedModelId ?? getAgentProvider(provider).defaultModel;
|
|
14921
14947
|
return { provider, modelId };
|
|
14922
14948
|
}
|
|
14923
14949
|
|
|
@@ -15346,9 +15372,8 @@ var SessionRegistry = class {
|
|
|
15346
15372
|
if (row.systemPrompt !== systemPrompt) {
|
|
15347
15373
|
this.persistPromptSnapshot(projectId, systemPrompt);
|
|
15348
15374
|
}
|
|
15349
|
-
const effectiveProvider = preferences
|
|
15350
|
-
|
|
15351
|
-
if (preferences?.provider || preferences?.modelId) {
|
|
15375
|
+
const { provider: effectiveProvider, modelId: effectiveModelId } = this.resolveTurnModel(preferences, { provider: row.modelProvider, modelId: row.modelId });
|
|
15376
|
+
if (effectiveProvider !== row.modelProvider || effectiveModelId !== row.modelId) {
|
|
15352
15377
|
this.opts.db.update(agentSessions).set({
|
|
15353
15378
|
modelProvider: effectiveProvider,
|
|
15354
15379
|
modelId: effectiveModelId,
|
|
@@ -15481,17 +15506,19 @@ ${lines.join("\n")}
|
|
|
15481
15506
|
* - align `state.tools` to the requested scope/profile (CLI full vs
|
|
15482
15507
|
* dashboard read-only share the same cached Agent; each request
|
|
15483
15508
|
* re-scopes it).
|
|
15484
|
-
* - align `state.model`
|
|
15485
|
-
*
|
|
15486
|
-
*
|
|
15509
|
+
* - align `state.model` on every turn (see `resolveTurnModel`): an
|
|
15510
|
+
* explicit `provider` / `modelId` wins for this turn, then the
|
|
15511
|
+
* `agent.provider` pin, then the session's stored model.
|
|
15512
|
+
* - refuse, naming `agent.provider`, a pinned provider that has no key.
|
|
15487
15513
|
*
|
|
15488
|
-
* Persists the
|
|
15489
|
-
*
|
|
15514
|
+
* Persists the resolved model to the DB row as provenance. Without a pin an
|
|
15515
|
+
* override therefore sticks, as it always has; with a pin, the next turn
|
|
15516
|
+
* that names no provider returns to it.
|
|
15490
15517
|
*/
|
|
15491
15518
|
async acquireForTurn(projectName, preferences) {
|
|
15492
15519
|
preferences?.signal?.throwIfAborted();
|
|
15493
15520
|
if (this.acquisitions.has(projectName)) throw agentBusy(projectName);
|
|
15494
|
-
const agent = this.getOrCreate(projectName);
|
|
15521
|
+
const agent = this.getOrCreate(projectName, preferences);
|
|
15495
15522
|
if (agent.state.isStreaming) {
|
|
15496
15523
|
throw agentBusy(projectName);
|
|
15497
15524
|
}
|
|
@@ -15508,9 +15535,8 @@ ${lines.join("\n")}
|
|
|
15508
15535
|
scope: preferences?.toolScope ?? AeroToolScopes.all,
|
|
15509
15536
|
profile: preferences?.toolProfile ?? AeroToolProfiles.default
|
|
15510
15537
|
});
|
|
15511
|
-
|
|
15512
|
-
|
|
15513
|
-
}
|
|
15538
|
+
this.alignModel(projectName, agent, preferences ?? {});
|
|
15539
|
+
this.assertTurnProviderUsable(projectId);
|
|
15514
15540
|
await this.mergeExternalTools(agent);
|
|
15515
15541
|
const view = { client: this.opts.client, projectName, basePath: this.opts.config.basePath, context: preferences?.context };
|
|
15516
15542
|
const evidence = preferences?.context ? await readAeroViewEvidence(view) : void 0;
|
|
@@ -15589,15 +15615,56 @@ ${lines.join("\n")}
|
|
|
15589
15615
|
this.scopes.set(projectName, want.scope);
|
|
15590
15616
|
this.profiles.set(projectName, want.profile);
|
|
15591
15617
|
}
|
|
15618
|
+
/**
|
|
15619
|
+
* Throw a named, actionable error when the `agent.provider` pin chose this
|
|
15620
|
+
* turn's provider and that provider has no key. Auto-detection only ever
|
|
15621
|
+
* picks a keyed provider, so the pin is the one path that can land a turn on
|
|
15622
|
+
* a keyless one without anything saying so. An explicitly requested provider
|
|
15623
|
+
* keeps its existing behaviour: the caller named it, and the provider's own
|
|
15624
|
+
* error reports the missing key when the prompt is sent.
|
|
15625
|
+
*/
|
|
15626
|
+
assertTurnProviderUsable(projectId) {
|
|
15627
|
+
const provider = coerceAgentProvider(this.loadRow(projectId)?.modelProvider ?? void 0);
|
|
15628
|
+
if (!provider || provider !== resolveConfiguredAgentProvider(this.opts.config)) return;
|
|
15629
|
+
if (resolveApiKeyFor(provider, this.opts.config)) return;
|
|
15630
|
+
throw missingDependency(
|
|
15631
|
+
`Aero is pinned to ${provider} by agent.provider, but no key is configured for it. Set providers.${provider}.apiKey in config.yaml or export ${agentProviderApiKeyEnvVar(provider)}, or change agent.provider.`,
|
|
15632
|
+
{ provider, pinned: true }
|
|
15633
|
+
);
|
|
15634
|
+
}
|
|
15635
|
+
/**
|
|
15636
|
+
* Resolve the provider/model a turn should use: an explicit request outranks
|
|
15637
|
+
* the `agent.provider` pin, which outranks whatever the row last recorded.
|
|
15638
|
+
*
|
|
15639
|
+
* The row is provenance (what answered), not policy (what answers next), so
|
|
15640
|
+
* a configured pin reasserts itself every turn instead of being frozen at
|
|
15641
|
+
* whatever the first session happened to pick -- and survives the
|
|
15642
|
+
* conversation-delete path, which drops the row entirely. With a pin, an
|
|
15643
|
+
* explicit request therefore lasts one turn.
|
|
15644
|
+
*
|
|
15645
|
+
* The model is a function of the request and the config, never of which
|
|
15646
|
+
* provider ran last: naming the pinned provider gets `agent.model` whether or
|
|
15647
|
+
* not the session just came back from another one. The row's model is used
|
|
15648
|
+
* only when nothing is pinned and nothing was requested, which keeps an
|
|
15649
|
+
* unpinned install's override sticky as it always was. A model id is never
|
|
15650
|
+
* forwarded across providers: any other case takes the provider's default.
|
|
15651
|
+
*/
|
|
15652
|
+
resolveTurnModel(preferences, current) {
|
|
15653
|
+
const pinned = resolveConfiguredAgentProvider(this.opts.config);
|
|
15654
|
+
const provider = preferences?.provider ?? pinned ?? current.provider ?? AgentProviderIds.claude;
|
|
15655
|
+
const carried = !preferences?.provider && !pinned && provider === current.provider ? current.modelId ?? void 0 : void 0;
|
|
15656
|
+
const pinnedModelId = provider === pinned ? this.opts.config.agent?.model ?? void 0 : void 0;
|
|
15657
|
+
const modelId = preferences?.modelId ?? pinnedModelId ?? carried ?? getAgentProvider(provider).defaultModel;
|
|
15658
|
+
return { provider, modelId };
|
|
15659
|
+
}
|
|
15592
15660
|
alignModel(projectName, agent, preferences) {
|
|
15593
15661
|
const projectId = this.tryResolveProjectId(projectName);
|
|
15594
15662
|
if (!projectId) return;
|
|
15595
15663
|
const row = this.loadRow(projectId);
|
|
15596
|
-
|
|
15597
|
-
const
|
|
15598
|
-
const
|
|
15599
|
-
const nextModelId = preferences
|
|
15600
|
-
if (!nextModelId) return;
|
|
15664
|
+
if (!row) return;
|
|
15665
|
+
const currentProvider = row.modelProvider;
|
|
15666
|
+
const currentModelId = row.modelId;
|
|
15667
|
+
const { provider: nextProvider, modelId: nextModelId } = this.resolveTurnModel(preferences, { provider: row.modelProvider, modelId: row.modelId });
|
|
15601
15668
|
if (nextProvider === currentProvider && nextModelId === currentModelId) return;
|
|
15602
15669
|
agent.state.model = resolveAeroModel(nextProvider, nextModelId);
|
|
15603
15670
|
this.opts.db.update(agentSessions).set({
|
|
@@ -18981,6 +19048,7 @@ async function createServer(opts) {
|
|
|
18981
19048
|
// Resolved fresh each call so a key added at runtime (settings API) shows
|
|
18982
19049
|
// up immediately in the `config.agent-providers` doctor check.
|
|
18983
19050
|
getAgentProviderSummary: () => buildAgentProvidersResponse(opts.config).providers,
|
|
19051
|
+
getAgentPin: () => describeAgentPin(opts.config),
|
|
18984
19052
|
getGoogleMarketingDoctorInput: (ctx) => {
|
|
18985
19053
|
if (!ctx.project) return null;
|
|
18986
19054
|
const googleAds = opts.db.select().from(googleAdsConnections).where(eq25(googleAdsConnections.projectId, ctx.project.id)).get();
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
siteCrawlGraphNodes,
|
|
6
6
|
siteCrawlPages,
|
|
7
7
|
siteCrawlSnapshots
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-DOC4QQLS.js";
|
|
9
9
|
import {
|
|
10
10
|
SITE_CRAWL_GRAPH_MAX_EDGES,
|
|
11
11
|
SITE_CRAWL_GRAPH_MAX_NODES,
|
|
12
12
|
TEMPLATE_LINK_RATIO_THRESHOLD
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-NYRRWWEE.js";
|
|
14
14
|
|
|
15
15
|
// src/site-crawl-graph-layout.ts
|
|
16
16
|
import crypto from "crypto";
|
|
@@ -13962,8 +13962,11 @@ var agentProvidersResponseDtoSchema = z45.object({
|
|
|
13962
13962
|
*/
|
|
13963
13963
|
providers: z45.array(agentProviderOptionDtoSchema).default([]),
|
|
13964
13964
|
/**
|
|
13965
|
-
* Provider
|
|
13966
|
-
*
|
|
13965
|
+
* Provider a new session uses when the caller names none: the
|
|
13966
|
+
* `agent.provider` pin when set (reported even without a key, as its
|
|
13967
|
+
* `configured: false` entry), else the first configured provider by
|
|
13968
|
+
* priority. An existing unpinned session keeps its stored provider. Null
|
|
13969
|
+
* when nothing is pinned and nothing is configured.
|
|
13967
13970
|
*/
|
|
13968
13971
|
defaultProvider: agentProviderIdSchema.nullable()
|
|
13969
13972
|
});
|
|
@@ -19711,6 +19714,7 @@ export {
|
|
|
19711
19714
|
agentViewContextSchema,
|
|
19712
19715
|
agentTurnLimitsSchema,
|
|
19713
19716
|
agentVisibilityEvidence,
|
|
19717
|
+
agentProviderIdSchema,
|
|
19714
19718
|
agentProvidersResponseDtoSchema,
|
|
19715
19719
|
MemorySources,
|
|
19716
19720
|
AGENT_MEMORY_VALUE_MAX_BYTES,
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
installSkills,
|
|
5
5
|
loadConfigRaw,
|
|
6
6
|
saveConfigPatch
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WJGUBZSW.js";
|
|
8
8
|
import {
|
|
9
9
|
PACKAGE_VERSION
|
|
10
10
|
} from "./chunk-AOJU5LKX.js";
|
|
11
11
|
import {
|
|
12
12
|
SKILL_MANIFEST_FILENAME,
|
|
13
13
|
SkillsClients
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-NYRRWWEE.js";
|
|
15
15
|
|
|
16
16
|
// src/skills-autosync.ts
|
|
17
17
|
import fs from "fs";
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
AGENT_MEMORY_KEY_MAX_LENGTH,
|
|
6
6
|
AGENT_MEMORY_VALUE_MAX_BYTES,
|
|
7
|
+
AGENT_PROVIDER_IDS,
|
|
7
8
|
CANONRY_NPM_PACKAGE_URL,
|
|
8
9
|
CodingAgents,
|
|
9
10
|
DEFAULT_VIEWER_RESEARCH_DAILY_RUN_LIMIT,
|
|
@@ -28,6 +29,7 @@ import {
|
|
|
28
29
|
adsUnresolvedOperationListQuerySchema,
|
|
29
30
|
agentConversationCreateSchema,
|
|
30
31
|
agentPluginClientLabel,
|
|
32
|
+
agentProviderIdSchema,
|
|
31
33
|
apiKeyDtoSchema,
|
|
32
34
|
backlinkSourceSchema,
|
|
33
35
|
canonicalizeGtmAccountId,
|
|
@@ -131,7 +133,7 @@ import {
|
|
|
131
133
|
upgradeCaveatFor,
|
|
132
134
|
upgradeCommandFor,
|
|
133
135
|
visibilityReportRequestSchema
|
|
134
|
-
} from "./chunk-
|
|
136
|
+
} from "./chunk-NYRRWWEE.js";
|
|
135
137
|
|
|
136
138
|
// src/cli-error.ts
|
|
137
139
|
function isMachineFormat(format) {
|
|
@@ -206,6 +208,8 @@ var dashboardManagedSweepsSchema = z.boolean().nullish();
|
|
|
206
208
|
var researchAllowViewersSchema = z.boolean().nullish();
|
|
207
209
|
var researchViewerDailyRunLimitSchema = z.number().int().positive().nullish();
|
|
208
210
|
var dashboardManagedRunKindsSchema = z.array(schedulableRunKindSchema).nullish();
|
|
211
|
+
var agentProviderSchema = agentProviderIdSchema.nullish();
|
|
212
|
+
var agentModelSchema = z.string().trim().min(1).nullish();
|
|
209
213
|
function resolveOperatorApiKeyIds(source) {
|
|
210
214
|
const raw = source.CANONRY_OPERATOR_KEY_IDS?.trim();
|
|
211
215
|
if (!raw) return [];
|
|
@@ -460,6 +464,24 @@ Do not use "canonry init --force" for recovery. It replaces credentials without
|
|
|
460
464
|
message: `Invalid config at ${configPath}: research.viewerDailyRunLimit must be a positive integer or left blank.`
|
|
461
465
|
});
|
|
462
466
|
}
|
|
467
|
+
if (!agentProviderSchema.safeParse(parsed.agent?.provider).success) {
|
|
468
|
+
throw new CliError({
|
|
469
|
+
code: "CONFIG_INVALID",
|
|
470
|
+
message: `Invalid config at ${configPath}: agent.provider must be one of ${AGENT_PROVIDER_IDS.join(", ")}, or left blank.`
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
if (!agentModelSchema.safeParse(parsed.agent?.model).success) {
|
|
474
|
+
throw new CliError({
|
|
475
|
+
code: "CONFIG_INVALID",
|
|
476
|
+
message: `Invalid config at ${configPath}: agent.model must be a non-empty string or left blank.`
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
if (parsed.agent?.model && !parsed.agent?.provider) {
|
|
480
|
+
throw new CliError({
|
|
481
|
+
code: "CONFIG_INVALID",
|
|
482
|
+
message: `Invalid config at ${configPath}: agent.model requires agent.provider \u2014 a model id is only meaningful against the provider that serves it.`
|
|
483
|
+
});
|
|
484
|
+
}
|
|
463
485
|
if (parsed.geminiApiKey && !parsed.providers?.gemini) {
|
|
464
486
|
parsed.providers = {
|
|
465
487
|
...parsed.providers,
|
package/dist/cli.js
CHANGED
|
@@ -35,11 +35,11 @@ import {
|
|
|
35
35
|
trackCliCommandFinished,
|
|
36
36
|
trackEvent,
|
|
37
37
|
waitForServerRuntimeStartup
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-KBSAEALE.js";
|
|
39
39
|
import {
|
|
40
40
|
autoSyncSkills,
|
|
41
41
|
formatAutoSyncNotice
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-S4BIBUCK.js";
|
|
43
43
|
import {
|
|
44
44
|
CliError,
|
|
45
45
|
EXIT_SYSTEM_ERROR,
|
|
@@ -66,13 +66,13 @@ import {
|
|
|
66
66
|
shouldPrintServeSkillsNudge,
|
|
67
67
|
systemError,
|
|
68
68
|
usageError
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-WJGUBZSW.js";
|
|
70
70
|
import {
|
|
71
71
|
DEFAULT_DEMO_TRUSTED_PROXIES,
|
|
72
72
|
trustedProxiesProblem,
|
|
73
73
|
trustedProxyProblem
|
|
74
74
|
} from "./chunk-RB2F4D3Z.js";
|
|
75
|
-
import "./chunk-
|
|
75
|
+
import "./chunk-LWGYRN3T.js";
|
|
76
76
|
import "./chunk-AOJU5LKX.js";
|
|
77
77
|
import {
|
|
78
78
|
CLOUDFLARE_WORKER_BINDINGS,
|
|
@@ -88,7 +88,7 @@ import {
|
|
|
88
88
|
queries,
|
|
89
89
|
renderReportHtml,
|
|
90
90
|
runs
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-DOC4QQLS.js";
|
|
92
92
|
import {
|
|
93
93
|
AdsDeliverySnapshotStatuses,
|
|
94
94
|
AdsHistoricalCampaignRollupStatuses,
|
|
@@ -173,7 +173,7 @@ import {
|
|
|
173
173
|
snapshotProviderModeSchema,
|
|
174
174
|
visibilityReportRequestSchema,
|
|
175
175
|
winnabilityClassSchema
|
|
176
|
-
} from "./chunk-
|
|
176
|
+
} from "./chunk-NYRRWWEE.js";
|
|
177
177
|
|
|
178
178
|
// src/cli.ts
|
|
179
179
|
import { pathToFileURL } from "url";
|
|
@@ -438,7 +438,7 @@ function parseDemoTrustedProxies(values) {
|
|
|
438
438
|
async function demoCommand(options) {
|
|
439
439
|
const { host, port } = parseDemoListenOptions(options);
|
|
440
440
|
const trustProxy = parseDemoTrustedProxies(options.trustProxy);
|
|
441
|
-
const { createDemoServer } = await import("./demo-server-
|
|
441
|
+
const { createDemoServer } = await import("./demo-server-OTXS6ZHS.js");
|
|
442
442
|
const app = await createDemoServer({ trustProxy });
|
|
443
443
|
let stopping = false;
|
|
444
444
|
const stop = () => {
|