@ainyc/canonry 4.194.0 → 5.0.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/LICENSE +21 -105
- package/README.md +4 -1
- package/assets/agent-workspace/skills/canonry/SKILL.md +71 -1
- package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +30 -0
- package/assets/assets/{AuditHistoryPanel-C8hUWnaD.js → AuditHistoryPanel-vWUtVXOI.js} +1 -1
- package/assets/assets/{BacklinksPage-BcIdghvA.js → BacklinksPage-CSzuMEuv.js} +1 -1
- package/assets/assets/{HistoryPage-DF7PLFi1.js → HistoryPage-DtCTQ7CQ.js} +1 -1
- package/assets/assets/{MeasurementPropertyPage-BTlXQbYt.js → MeasurementPropertyPage-B7gTMWNs.js} +1 -1
- package/assets/assets/{ProjectPage-YiZ_i5eX.js → ProjectPage-Bsm0_jUY.js} +1 -1
- package/assets/assets/{RunRow-CfzuyTSM.js → RunRow-D5k4Rdo4.js} +1 -1
- package/assets/assets/{RunsPage-Diu_-YWl.js → RunsPage-DIXBB2Om.js} +1 -1
- package/assets/assets/{SettingsPage-g93aqkg2.js → SettingsPage-wYhBm6Az.js} +1 -1
- package/assets/assets/{SiteHealthSection-DroMQJVF.js → SiteHealthSection-YebzsgDh.js} +3 -3
- package/assets/assets/{TrafficPage-BhHjy5Ee.js → TrafficPage-DtnSRFO8.js} +1 -1
- package/assets/assets/{TrafficSourceDetailPage-DI3aZIHo.js → TrafficSourceDetailPage-DYQ6mpYq.js} +1 -1
- package/assets/assets/{extract-error-message-DjXzzSl3.js → extract-error-message-BdChrkmo.js} +1 -1
- package/assets/assets/{index-33ZEL6A5.js → index-C_E2NRYY.js} +26 -26
- package/assets/assets/{react-sigma_core.esm.min-BlfsZb5G.js → react-sigma_core.esm.min-sKWUk_tG.js} +1 -1
- package/assets/assets/{v2-overview-adapter-C6cROMod.js → v2-overview-adapter-CkPt-sRK.js} +1 -1
- package/assets/index.html +1 -1
- package/dist/{chunk-X5AE3GNC.js → chunk-3WODA4JF.js} +276 -5
- package/dist/{chunk-ZA2QVBQO.js → chunk-67NX4KVE.js} +73 -36
- package/dist/{chunk-7XXXNNE2.js → chunk-B2XM6AQ6.js} +280 -26
- package/dist/{chunk-AO5QJJE6.js → chunk-LJKAB4CX.js} +2 -2
- package/dist/{chunk-QVYGI6CL.js → chunk-UMU3IBXM.js} +1225 -474
- package/dist/cli.js +233 -154
- package/dist/index.js +4 -4
- package/dist/{intelligence-service-M4V3YPFZ.js → intelligence-service-MGQRJW4V.js} +2 -2
- package/dist/mcp.js +4 -4
- package/package.json +12 -11
package/assets/assets/{react-sigma_core.esm.min-BlfsZb5G.js → react-sigma_core.esm.min-sKWUk_tG.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-YebzsgDh.js";import"./index-C_E2NRYY.js";import"./vendor-radix-twS1M3FF.js";import"./vendor-recharts-D-cUuLZo.js";import"./vendor-lucide-CW2qe0uH.js";import"./vendor-markdown-B-Oq2NYq.js";import"./vendor-yaml-GWJz5H2G.js";import"./ChartPrimitives-Bxa_vFmq.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 o,r as C}from"./vendor-tanstack-ZXXkndVj.js";import{y as M,B as A}from"./index-
|
|
1
|
+
import{j as o,r as C}from"./vendor-tanstack-ZXXkndVj.js";import{y as M,B as A}from"./index-C_E2NRYY.js";import{M as $}from"./vendor-markdown-B-Oq2NYq.js";const H="Sources",y={copy:"Copy answer",copying:"Copying…",copied:"Copied",failed:"Could not copy. Select and copy the answer above."};function N({headingLevel:e}){return n=>{const r=[],s=i=>{i.type==="heading"&&i.depth&&r.push(i),i.children?.forEach(s)};s(n);const l=r.reduce((i,u)=>Math.min(i,u.depth),6);for(const i of r){const u=i.depth-l;i.depth=Math.min(6,e+u),i.data={...i.data,hProperties:{...i.data?.hProperties,"data-answer-heading-level":u+1}}}}}function R({answer:e}){const[n,r]=C.useState("idle"),s=C.useRef(!1),l=async()=>{if(!s.current){s.current=!0,r("copying");try{await navigator.clipboard.writeText(e),r("copied")}catch{r("failed")}finally{s.current=!1}}};return o.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-3",children:[o.jsx(A,{type:"button",variant:"ghost",className:"min-h-11 px-2","aria-disabled":n==="copying","aria-busy":n==="copying",onClick:()=>{l()},children:n==="copying"?y.copying:y.copy}),o.jsx("span",{role:"status",className:"text-sm text-secondary",children:n==="copied"?y.copied:n==="failed"?y.failed:""})]})}function L({children:e,headingLevel:n=4,copyable:r=!1}){return o.jsxs("div",{className:"answer-markdown",children:[o.jsx($,{remarkPlugins:[[N,{headingLevel:n}]],components:{p:({children:s})=>o.jsx("p",{className:"mb-3 whitespace-pre-wrap last:mb-0",children:s}),ul:({children:s})=>o.jsx("ul",{className:"mb-3 ml-5 list-disc space-y-1",children:s}),ol:({children:s,start:l})=>o.jsx("ol",{start:l,className:"mb-3 ml-5 list-decimal space-y-1",children:s}),pre:({children:s})=>o.jsx("pre",{className:"mb-3 overflow-x-auto whitespace-pre-wrap",children:s}),a:({children:s,href:l})=>{const i=M(l);return i?o.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-link underline",children:s}):o.jsx("span",{children:s})},img:({alt:s})=>o.jsx("span",{children:s})},children:e}),r&&e.trim()?o.jsx(R,{answer:e},e):null]})}function F(e){const n=e[0];return n?e.every(r=>r.mode===n.mode&&r.scope.kind===n.scope.kind&&r.scope.key===n.scope.key&&r.queryClass===n.queryClass&&r.measurement.displayedRunId===n.measurement.displayedRunId):!0}function p(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 I(e){return e.kind==="exact"?e.url:e.kind==="prefix"?`https://${e.host}${e.pathPrefix}/*`:`https://${e.host}/*`}function T(e){return e==="assigned"?"this-property":e==="sibling"?"another-property":e==="ownedUnmapped"?"owned-unassigned":e==="external"?"external":e==="ambiguous"?"multiple-properties":"invalid-url"}function _(e){return e==="assigned"?"positive":e==="external"?"neutral":e==="invalid"?"negative":"caution"}function k(e){return`target:${e.targetKey}:${e.queryId}:${e.executionNodeKey}`}function j(e,n,r){const s=new Map;if(!n)return s;const l=new Map(e.usageEdges.map(a=>[k(a),a.targetKey])),i=new Map(e.assignments.map(a=>[`${a.targetKey}:${a.queryId}`,a.queryClass])),u=new Map(e.usageEdges.map(a=>[k(a),i.get(`${a.targetKey}:${a.queryId}`)]));for(const a of n.evidence){if(r&&u.get(a.usageEdgeId)!==r)continue;const c=l.get(a.usageEdgeId);if(!c)continue;const m=s.get(c)??[];m.push({id:`${a.observationId}:${a.expectedSlotId}:${a.usageEdgeId}:${a.sourceUrl}`,kind:T(a.classification),query:a.queryText,provider:a.provider,location:a.location,url:a.sourceUrl,tone:_(a.classification),historical:a.historical||a.bridged}),s.set(c,m)}return s}function B(e){if(e.flags>0)return{label:"Review",tone:"caution"};const n=[e.mentionCoverage,e.citationCoverage].filter(r=>r.state==="unavailable").map(r=>r.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 O(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 U(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 q(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 W({overview:e,activePlan:n,report:r,reportState:s=r?"ready":"loading",sort:l}){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 i=n.plan,u=new Map(i.targets.map(t=>[t.stableKey,t])),a=new Map(i.querySnapshots.map(t=>[t.queryId,t.queryText])),c=new Map;for(const t of i.assignments){if(e.queryClass!=="all"&&t.queryClass!==e.queryClass)continue;const d=a.get(t.queryId);if(!d)continue;const g=c.get(t.targetKey)??new Set;g.add(d),c.set(t.targetKey,g)}const m=r?.revision===n.revision&&r.run?.id===e.measurement.displayedRunId?r:null,K=e.measurement.displayedRunId===void 0||m?"ready":s==="error"||r!=null?"error":"loading",S=j(i,m,e.queryClass==="all"?void 0:e.queryClass),h=new Map;for(const t of i.groups)for(const d of t.targetKeys)h.has(d)||h.set(d,t.label);const x=e.properties.items.map(t=>{const d=u.get(t.targetKey),g=S.get(t.targetKey)??[];return{id:t.targetKey,name:t.label,mentionCoverage:p(t.mentionCoverage),citationCoverage:p(t.citationCoverage),status:B(t),providers:t.providers?.map(f=>({provider:f.provider,mentionCoverage:p(f.mentionCoverage),citationCoverage:p(f.citationCoverage)})),market:h.get(t.targetKey),assignedQueries:[...c.get(t.targetKey)??[]],urls:d?.urlMatchers.map(I)??[],evidence:g,evidenceState:K,historical:g.some(f=>f.historical)}}),b=e.namedShareOfVoice?.entries.map(t=>({name:t.label,coverage:{numerator:t.credits,denominator:e.namedShareOfVoice.denominator}})),E=e.properties.items.flatMap(t=>t.flags>0?[{id:`property:${t.targetKey}`,property:t.label,summary:`${t.flags} ${t.flags===1?"result needs":"results need"} review.`,tone:"caution",count:t.flags}]:[]);return{classReporting:"available",latestMeasurement:{status:O(e.measurement.state),completedSlots:e.measurement.completed,totalSlots:e.measurement.expected,date:U(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:p(e.metrics.propertiesMentioned),mentionCoverage:p(e.metrics.mentionCoverage),citationCoverage:p(e.metrics.citationCoverage)},properties:x,...b?{shareOfVoice:b}:{}},propertyTotal:e.properties.totalEstimate??x.length,outcomes:e.outcomes,nextCursor:e.properties.nextCursor,...l?{sort:l}:{}},availableGroups:i.groups.map(t=>({id:t.stableKey,label:t.label})),...q(e)?{nextActionText:q(e)}:{},flaggedResultsTotal:e.flags.total,flaggedResults:E}}export{L as A,H as a,F as b,W as c,I 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-C_E2NRYY.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">
|
|
@@ -5655,6 +5655,10 @@ var auditLogEntrySchema = z9.object({
|
|
|
5655
5655
|
userAgent: z9.string().nullable().optional(),
|
|
5656
5656
|
/** Optional caller-supplied correlation key for grouping related mutations. */
|
|
5657
5657
|
actorSession: z9.string().nullable().optional(),
|
|
5658
|
+
/** Server-issued request correlation id for an HTTP mutation. */
|
|
5659
|
+
requestId: z9.string().nullable().optional(),
|
|
5660
|
+
/** API credential id used to authenticate an HTTP mutation, when applicable. */
|
|
5661
|
+
credentialId: z9.string().nullable().optional(),
|
|
5658
5662
|
createdAt: z9.string()
|
|
5659
5663
|
});
|
|
5660
5664
|
|
|
@@ -5681,7 +5685,7 @@ function intersectScopes(authority, requested) {
|
|
|
5681
5685
|
return effective.length > 0 ? effective : [READ_ONLY_SCOPE];
|
|
5682
5686
|
}
|
|
5683
5687
|
function isReadOnlyKey(scopes) {
|
|
5684
|
-
return scopes.
|
|
5688
|
+
return scopes.some((scope) => scope === READ_ONLY_SCOPE || scope.endsWith(".read")) && !scopes.some(grantsWrite);
|
|
5685
5689
|
}
|
|
5686
5690
|
|
|
5687
5691
|
// ../contracts/src/api-keys.ts
|
|
@@ -8519,14 +8523,14 @@ function roundSignificant(value, sig = 6) {
|
|
|
8519
8523
|
const factor = 10 ** (sig - magnitude);
|
|
8520
8524
|
return (Math.round(value * factor) + 0) / factor;
|
|
8521
8525
|
}
|
|
8522
|
-
function wilsonInterval(successes, n,
|
|
8526
|
+
function wilsonInterval(successes, n, z62 = 1.96) {
|
|
8523
8527
|
if (!Number.isFinite(n) || n <= 0) return null;
|
|
8524
8528
|
const s = Math.max(0, Math.min(successes, n));
|
|
8525
8529
|
const p = s / n;
|
|
8526
|
-
const z210 =
|
|
8530
|
+
const z210 = z62 * z62;
|
|
8527
8531
|
const denom = 1 + z210 / n;
|
|
8528
8532
|
const center = (p + z210 / (2 * n)) / denom;
|
|
8529
|
-
const margin =
|
|
8533
|
+
const margin = z62 / denom * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
|
|
8530
8534
|
return {
|
|
8531
8535
|
low: round(Math.max(0, center - margin)),
|
|
8532
8536
|
high: round(Math.min(1, center + margin))
|
|
@@ -17637,6 +17641,39 @@ function classifyProviderErrorMessages(messages) {
|
|
|
17637
17641
|
|
|
17638
17642
|
// ../contracts/src/telemetry.ts
|
|
17639
17643
|
import { z as z60 } from "zod";
|
|
17644
|
+
var telemetryEffectiveReasonSchema = z60.enum([
|
|
17645
|
+
"enabled",
|
|
17646
|
+
"configured_disabled",
|
|
17647
|
+
"CANONRY_TELEMETRY_DISABLED",
|
|
17648
|
+
"DO_NOT_TRACK",
|
|
17649
|
+
"CI",
|
|
17650
|
+
"NO_CONFIG",
|
|
17651
|
+
"CONFIG_UNAVAILABLE"
|
|
17652
|
+
]);
|
|
17653
|
+
var telemetryTargetSchema = z60.enum(["server", "local"]);
|
|
17654
|
+
var telemetryStatusDtoSchema = z60.object({
|
|
17655
|
+
enabled: z60.boolean(),
|
|
17656
|
+
configuredEnabled: z60.boolean(),
|
|
17657
|
+
reason: telemetryEffectiveReasonSchema,
|
|
17658
|
+
anonymousId: z60.string().regex(/^[0-9a-f]{8}\.\.\.$/i).optional(),
|
|
17659
|
+
target: telemetryTargetSchema.optional()
|
|
17660
|
+
}).strict();
|
|
17661
|
+
function normalizeTelemetryStatus(status, target = "server") {
|
|
17662
|
+
const reason = telemetryEffectiveReasonSchema.safeParse(status.reason);
|
|
17663
|
+
const anonymousId = maskTelemetryAnonymousId(status.anonymousId);
|
|
17664
|
+
return telemetryStatusDtoSchema.parse({
|
|
17665
|
+
enabled: status.enabled,
|
|
17666
|
+
configuredEnabled: status.configuredEnabled ?? status.enabled,
|
|
17667
|
+
reason: reason.success ? reason.data : status.enabled ? "enabled" : "configured_disabled",
|
|
17668
|
+
target,
|
|
17669
|
+
...anonymousId ? { anonymousId } : {}
|
|
17670
|
+
});
|
|
17671
|
+
}
|
|
17672
|
+
function maskTelemetryAnonymousId(value) {
|
|
17673
|
+
if (!value) return void 0;
|
|
17674
|
+
if (/^[0-9a-f]{8}\.\.\.$/i.test(value)) return value;
|
|
17675
|
+
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value) ? `${value.slice(0, 8)}...` : void 0;
|
|
17676
|
+
}
|
|
17640
17677
|
var ONBOARDING_FLOW_VERSION = 1;
|
|
17641
17678
|
var onboardingStepSchema = z60.enum([
|
|
17642
17679
|
"system",
|
|
@@ -17750,6 +17787,228 @@ function isTrendBaseline(points) {
|
|
|
17750
17787
|
return points.length < MIN_TREND_POINTS;
|
|
17751
17788
|
}
|
|
17752
17789
|
|
|
17790
|
+
// ../contracts/src/operational-logs.ts
|
|
17791
|
+
import { z as z61 } from "zod";
|
|
17792
|
+
var operationalLogLevelSchema = z61.enum(["trace", "debug", "info", "warn", "error", "fatal"]);
|
|
17793
|
+
var diagnosticContextSchema = z61.object({
|
|
17794
|
+
runId: z61.string().min(1).max(256).optional(),
|
|
17795
|
+
projectId: z61.string().min(1).max(256).optional(),
|
|
17796
|
+
requestId: z61.string().min(1).max(256).optional(),
|
|
17797
|
+
actor: z61.string().min(1).max(512).optional(),
|
|
17798
|
+
credentialId: z61.string().min(1).max(512).optional(),
|
|
17799
|
+
userAgent: z61.string().min(1).max(512).optional(),
|
|
17800
|
+
actorSession: z61.string().min(1).max(512).optional(),
|
|
17801
|
+
method: z61.string().min(1).max(16).optional(),
|
|
17802
|
+
route: z61.string().min(1).max(256).optional(),
|
|
17803
|
+
operationId: z61.string().min(1).max(256).optional(),
|
|
17804
|
+
jobId: z61.string().min(1).max(256).optional(),
|
|
17805
|
+
taskId: z61.string().min(1).max(256).optional(),
|
|
17806
|
+
traceId: z61.string().min(1).max(256).optional(),
|
|
17807
|
+
errorCode: z61.string().min(1).max(128).optional(),
|
|
17808
|
+
attempt: z61.number().finite().optional(),
|
|
17809
|
+
count: z61.number().finite().optional(),
|
|
17810
|
+
total: z61.number().finite().optional(),
|
|
17811
|
+
progress: z61.number().finite().optional(),
|
|
17812
|
+
httpStatus: z61.number().finite().optional(),
|
|
17813
|
+
statusCode: z61.number().finite().optional(),
|
|
17814
|
+
durationMs: z61.number().finite().optional(),
|
|
17815
|
+
bytes: z61.number().finite().optional(),
|
|
17816
|
+
retryAfterMs: z61.number().finite().optional(),
|
|
17817
|
+
retriable: z61.boolean().optional(),
|
|
17818
|
+
retrying: z61.boolean().optional(),
|
|
17819
|
+
cancelled: z61.boolean().optional(),
|
|
17820
|
+
success: z61.boolean().optional()
|
|
17821
|
+
}).strict();
|
|
17822
|
+
var operationalLogEntryDtoSchema = z61.object({
|
|
17823
|
+
cursor: z61.string().min(1).max(512),
|
|
17824
|
+
ts: z61.string().datetime(),
|
|
17825
|
+
level: operationalLogLevelSchema,
|
|
17826
|
+
module: z61.string().min(1).max(256),
|
|
17827
|
+
action: z61.string().min(1).max(256),
|
|
17828
|
+
message: z61.string().max(4096).optional(),
|
|
17829
|
+
runId: z61.string().min(1).max(256).optional(),
|
|
17830
|
+
projectId: z61.string().min(1).max(256).optional(),
|
|
17831
|
+
context: diagnosticContextSchema
|
|
17832
|
+
}).strict();
|
|
17833
|
+
var logQuerySchema = z61.object({
|
|
17834
|
+
level: operationalLogLevelSchema.optional(),
|
|
17835
|
+
module: z61.string().trim().min(1).max(256).optional(),
|
|
17836
|
+
runId: z61.string().trim().min(1).max(256).optional(),
|
|
17837
|
+
projectId: z61.string().trim().min(1).max(256).optional(),
|
|
17838
|
+
actor: z61.string().trim().min(1).max(512).optional(),
|
|
17839
|
+
requestId: z61.string().trim().min(1).max(256).optional(),
|
|
17840
|
+
since: z61.string().datetime().optional(),
|
|
17841
|
+
until: z61.string().datetime().optional(),
|
|
17842
|
+
limit: z61.coerce.number().int().min(1).max(200).default(100),
|
|
17843
|
+
cursor: z61.string().trim().min(1).max(512).optional()
|
|
17844
|
+
}).strict().superRefine((query, ctx) => {
|
|
17845
|
+
if (query.since && query.until && Date.parse(query.since) > Date.parse(query.until)) {
|
|
17846
|
+
ctx.addIssue({ code: z61.ZodIssueCode.custom, path: ["until"], message: '"until" must be on or after "since".' });
|
|
17847
|
+
}
|
|
17848
|
+
});
|
|
17849
|
+
var operationalLogListDtoSchema = z61.object({
|
|
17850
|
+
entries: z61.array(operationalLogEntryDtoSchema),
|
|
17851
|
+
nextCursor: z61.string().min(1).max(512).nullable(),
|
|
17852
|
+
/** Matching entries left after this page. */
|
|
17853
|
+
truncated: z61.number().int().nonnegative(),
|
|
17854
|
+
/** Entries evicted by the active retention policy. */
|
|
17855
|
+
dropped: z61.number().int().nonnegative(),
|
|
17856
|
+
retention: z61.enum(["process", "durable"]),
|
|
17857
|
+
retentionPolicy: z61.object({
|
|
17858
|
+
maxEntries: z61.number().int().positive(),
|
|
17859
|
+
maxAgeSeconds: z61.number().int().positive()
|
|
17860
|
+
}).strict().optional(),
|
|
17861
|
+
/** Best-effort persistence failures observed by this store. */
|
|
17862
|
+
captureErrors: z61.number().int().nonnegative().optional(),
|
|
17863
|
+
observedAt: z61.string().datetime()
|
|
17864
|
+
}).strict();
|
|
17865
|
+
|
|
17866
|
+
// ../contracts/src/log-redaction.ts
|
|
17867
|
+
var REDACTED = "[REDACTED]";
|
|
17868
|
+
var TRUNCATED = "[TRUNCATED]";
|
|
17869
|
+
var CIRCULAR = "[CIRCULAR]";
|
|
17870
|
+
var UNREADABLE = "[UNREADABLE]";
|
|
17871
|
+
var OMITTED = "[OMITTED]";
|
|
17872
|
+
var MAX_DEPTH = 6;
|
|
17873
|
+
var MAX_ARRAY_ITEMS = 50;
|
|
17874
|
+
var MAX_OBJECT_KEYS = 100;
|
|
17875
|
+
var MAX_STRING_LENGTH = 4096;
|
|
17876
|
+
var secretKey = /api[ _-]?key|authorization|auth(?:entication)?|cookie|password|secret|token|credential/i;
|
|
17877
|
+
var escapedSecretAssignment = /\\+["'][\w -]*(?:api[ _-]?key|auth|cookie|password|secret|token|credential)[\w -]*\\+["']\s*:/i;
|
|
17878
|
+
var unsafeGraphKey = /^(?:req|res|request|reply|raw|socket|headers?|body|responsebody|apiresponse|rawresponse|provider(?:body|response)?)$/i;
|
|
17879
|
+
function isSensitiveDiagnosticQueryKey(key) {
|
|
17880
|
+
return secretKey.test(key) || /^key$/i.test(key);
|
|
17881
|
+
}
|
|
17882
|
+
function redactLogValue(value) {
|
|
17883
|
+
try {
|
|
17884
|
+
return redactValue(value, 0, /* @__PURE__ */ new WeakSet());
|
|
17885
|
+
} catch {
|
|
17886
|
+
return UNREADABLE;
|
|
17887
|
+
}
|
|
17888
|
+
}
|
|
17889
|
+
function redactLogString(value) {
|
|
17890
|
+
try {
|
|
17891
|
+
const clipped = value.length > MAX_STRING_LENGTH ? `${value.slice(0, MAX_STRING_LENGTH)}${TRUNCATED}` : value;
|
|
17892
|
+
if (escapedSecretAssignment.test(clipped)) return REDACTED;
|
|
17893
|
+
return redactEmbeddedUrls(clipped).replace(/\b((?:set-cookie|cookie)\s*[:=]\s*)[^\r\n]*(?:\r?\n[ \t][^\r\n]*)*/gi, `$1${REDACTED}`).replace(
|
|
17894
|
+
/(["']?[\w-]*(?:api[ _-]?key|auth|cookie|password|secret|token|credential)[\w-]*["']?\s*[=:]\s*)(?:"(?:\\.|[^"\\])*(?:"|$)|'(?:\\.|[^'\\])*(?:'|$))/gi,
|
|
17895
|
+
`$1${REDACTED}`
|
|
17896
|
+
).replace(/\b(Bearer|Basic)\s+[^\s,;]+/gi, (_match, scheme) => `${scheme} ${REDACTED}`).replace(
|
|
17897
|
+
/(api[ _-]?key|authorization|auth(?:entication)?|cookie|password|secret|token|credential)\s*([=:])\s*(?!\[REDACTED\])[^\s&,'")\]}]+/gi,
|
|
17898
|
+
`$1$2${REDACTED}`
|
|
17899
|
+
).slice(0, MAX_STRING_LENGTH);
|
|
17900
|
+
} catch {
|
|
17901
|
+
return UNREADABLE;
|
|
17902
|
+
}
|
|
17903
|
+
}
|
|
17904
|
+
function redactValue(value, depth, seen, key) {
|
|
17905
|
+
if (key && diagnosticIdentity(key, value) !== void 0) return value;
|
|
17906
|
+
if (key && secretKey.test(key)) return REDACTED;
|
|
17907
|
+
if (key && unsafeGraphKey.test(key)) return OMITTED;
|
|
17908
|
+
if (value === null || typeof value === "boolean") return value;
|
|
17909
|
+
if (typeof value === "number") return Number.isFinite(value) ? value : String(value);
|
|
17910
|
+
if (typeof value === "string") return redactLogString(value);
|
|
17911
|
+
if (typeof value === "bigint") return value.toString();
|
|
17912
|
+
if (typeof value === "undefined") return void 0;
|
|
17913
|
+
if (typeof value === "symbol" || typeof value === "function") return `[${typeof value}]`;
|
|
17914
|
+
if (depth >= MAX_DEPTH) return TRUNCATED;
|
|
17915
|
+
if (typeof value !== "object") return UNREADABLE;
|
|
17916
|
+
if (seen.has(value)) return CIRCULAR;
|
|
17917
|
+
seen.add(value);
|
|
17918
|
+
try {
|
|
17919
|
+
if (value instanceof Error) return redactError(value, depth, seen);
|
|
17920
|
+
if (Array.isArray(value)) {
|
|
17921
|
+
const output2 = [];
|
|
17922
|
+
const length = safeArrayLength(value);
|
|
17923
|
+
for (let index = 0; index < Math.min(length, MAX_ARRAY_ITEMS); index++) {
|
|
17924
|
+
output2.push(redactValue(safeProperty(value, String(index)), depth + 1, seen));
|
|
17925
|
+
}
|
|
17926
|
+
if (length > MAX_ARRAY_ITEMS) output2.push(TRUNCATED);
|
|
17927
|
+
return output2;
|
|
17928
|
+
}
|
|
17929
|
+
const output = {};
|
|
17930
|
+
const keys = safeKeys(value);
|
|
17931
|
+
for (const nestedKey of keys.slice(0, MAX_OBJECT_KEYS)) {
|
|
17932
|
+
output[nestedKey] = redactValue(safeProperty(value, nestedKey), depth + 1, seen, nestedKey);
|
|
17933
|
+
}
|
|
17934
|
+
if (keys.length > MAX_OBJECT_KEYS) output.__truncated = true;
|
|
17935
|
+
return output;
|
|
17936
|
+
} catch {
|
|
17937
|
+
return UNREADABLE;
|
|
17938
|
+
} finally {
|
|
17939
|
+
seen.delete(value);
|
|
17940
|
+
}
|
|
17941
|
+
}
|
|
17942
|
+
function diagnosticIdentity(key, value) {
|
|
17943
|
+
if (typeof value !== "string") return void 0;
|
|
17944
|
+
if (key === "actor" && /^(?:api-key|user):[\w.-]{1,256}$/.test(value)) return value;
|
|
17945
|
+
if (key === "credentialId" && /^[\w.-]{1,256}$/.test(value)) return value;
|
|
17946
|
+
return void 0;
|
|
17947
|
+
}
|
|
17948
|
+
function redactError(error, depth, seen) {
|
|
17949
|
+
const output = {
|
|
17950
|
+
name: redactLogString(safeErrorString(error, "name")),
|
|
17951
|
+
message: redactLogString(safeErrorString(error, "message"))
|
|
17952
|
+
};
|
|
17953
|
+
const stack = safeErrorString(error, "stack");
|
|
17954
|
+
if (stack) output.stack = redactLogString(stack);
|
|
17955
|
+
for (const key of safeKeys(error).slice(0, MAX_OBJECT_KEYS)) {
|
|
17956
|
+
output[key] = redactValue(safeProperty(error, key), depth + 1, seen, key);
|
|
17957
|
+
}
|
|
17958
|
+
return output;
|
|
17959
|
+
}
|
|
17960
|
+
function safeKeys(value) {
|
|
17961
|
+
try {
|
|
17962
|
+
return Object.keys(value);
|
|
17963
|
+
} catch {
|
|
17964
|
+
return [];
|
|
17965
|
+
}
|
|
17966
|
+
}
|
|
17967
|
+
function safeArrayLength(value) {
|
|
17968
|
+
try {
|
|
17969
|
+
return Number.isSafeInteger(value.length) && value.length >= 0 ? value.length : 0;
|
|
17970
|
+
} catch {
|
|
17971
|
+
return 0;
|
|
17972
|
+
}
|
|
17973
|
+
}
|
|
17974
|
+
function safeProperty(value, key) {
|
|
17975
|
+
try {
|
|
17976
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
17977
|
+
if (!descriptor || !("value" in descriptor)) return UNREADABLE;
|
|
17978
|
+
return descriptor.value;
|
|
17979
|
+
} catch {
|
|
17980
|
+
return UNREADABLE;
|
|
17981
|
+
}
|
|
17982
|
+
}
|
|
17983
|
+
function safeErrorString(error, key) {
|
|
17984
|
+
try {
|
|
17985
|
+
const value = error[key];
|
|
17986
|
+
return typeof value === "string" ? value : "";
|
|
17987
|
+
} catch {
|
|
17988
|
+
return UNREADABLE;
|
|
17989
|
+
}
|
|
17990
|
+
}
|
|
17991
|
+
function redactEmbeddedUrls(value) {
|
|
17992
|
+
return value.replace(/https?:\/\/[^\s<>"']+/gi, (candidate) => {
|
|
17993
|
+
if (candidate.includes(TRUNCATED)) return "[TRUNCATED_URL]";
|
|
17994
|
+
const suffix = candidate.match(/[),.;!?\]}]+$/)?.[0] ?? "";
|
|
17995
|
+
const rawUrl = suffix ? candidate.slice(0, -suffix.length) : candidate;
|
|
17996
|
+
try {
|
|
17997
|
+
const url = new URL(rawUrl);
|
|
17998
|
+
if (url.username || url.password) {
|
|
17999
|
+
url.username = REDACTED;
|
|
18000
|
+
url.password = REDACTED;
|
|
18001
|
+
}
|
|
18002
|
+
for (const key of [...url.searchParams.keys()]) {
|
|
18003
|
+
if (isSensitiveDiagnosticQueryKey(key)) url.searchParams.set(key, REDACTED);
|
|
18004
|
+
}
|
|
18005
|
+
return `${url.toString()}${suffix}`;
|
|
18006
|
+
} catch {
|
|
18007
|
+
return `[REDACTED_URL]${suffix}`;
|
|
18008
|
+
}
|
|
18009
|
+
});
|
|
18010
|
+
}
|
|
18011
|
+
|
|
17753
18012
|
export {
|
|
17754
18013
|
__export,
|
|
17755
18014
|
apiKeyDtoSchema,
|
|
@@ -18138,6 +18397,8 @@ export {
|
|
|
18138
18397
|
isAgentProviderId,
|
|
18139
18398
|
LlmCapabilities,
|
|
18140
18399
|
LLM_CAPABILITIES,
|
|
18400
|
+
providerSummaryEntryDtoSchema,
|
|
18401
|
+
integrationSettingsSummaryDtoSchema,
|
|
18141
18402
|
settingsDtoSchema,
|
|
18142
18403
|
runStatusSchema,
|
|
18143
18404
|
RunStatuses,
|
|
@@ -18521,6 +18782,9 @@ export {
|
|
|
18521
18782
|
serializeForInlineScript,
|
|
18522
18783
|
classifyProviderErrorMessage,
|
|
18523
18784
|
classifyProviderErrorMessages,
|
|
18785
|
+
telemetryStatusDtoSchema,
|
|
18786
|
+
normalizeTelemetryStatus,
|
|
18787
|
+
maskTelemetryAnonymousId,
|
|
18524
18788
|
ONBOARDING_FLOW_VERSION,
|
|
18525
18789
|
bucketOnboardingCount,
|
|
18526
18790
|
onboardingTelemetryEventSchema,
|
|
@@ -18528,5 +18792,12 @@ export {
|
|
|
18528
18792
|
telemetryEventAcceptedDtoSchema,
|
|
18529
18793
|
isGhostTelemetryEvent,
|
|
18530
18794
|
MIN_TREND_POINTS,
|
|
18531
|
-
isTrendBaseline
|
|
18795
|
+
isTrendBaseline,
|
|
18796
|
+
operationalLogEntryDtoSchema,
|
|
18797
|
+
logQuerySchema,
|
|
18798
|
+
operationalLogListDtoSchema,
|
|
18799
|
+
isSensitiveDiagnosticQueryKey,
|
|
18800
|
+
redactLogValue,
|
|
18801
|
+
redactLogString,
|
|
18802
|
+
diagnosticIdentity
|
|
18532
18803
|
};
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
CANONRY_MCP_TOOLKIT_NAMES,
|
|
5
5
|
CanonryMcpToolNames,
|
|
6
6
|
CliError,
|
|
7
|
+
PACKAGE_VERSION,
|
|
7
8
|
canonryMcpTools,
|
|
8
9
|
configExists,
|
|
9
10
|
createCanonryMcpServer,
|
|
@@ -14,7 +15,7 @@ import {
|
|
|
14
15
|
loadConfig,
|
|
15
16
|
loadConfigRaw,
|
|
16
17
|
saveConfigPatch
|
|
17
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-B2XM6AQ6.js";
|
|
18
19
|
import {
|
|
19
20
|
CC_CACHE_DIR,
|
|
20
21
|
DUCKDB_SPEC,
|
|
@@ -22,8 +23,10 @@ import {
|
|
|
22
23
|
GSC_DATA_LAG_DAYS,
|
|
23
24
|
GSC_REPORTING_TIME_ZONE,
|
|
24
25
|
IntelligenceService,
|
|
26
|
+
OperationalLogStore,
|
|
25
27
|
PLUGIN_DIR,
|
|
26
28
|
USER_SESSION_COOKIE_NAME,
|
|
29
|
+
addLogListener,
|
|
27
30
|
adsAdGroups,
|
|
28
31
|
adsAds,
|
|
29
32
|
adsCampaigns,
|
|
@@ -56,6 +59,7 @@ import {
|
|
|
56
59
|
crawlerEventsHourly,
|
|
57
60
|
createClient,
|
|
58
61
|
createCredentialChecker,
|
|
62
|
+
createFastifyLogger,
|
|
59
63
|
createLogger,
|
|
60
64
|
createUserSession,
|
|
61
65
|
deliverWebhook,
|
|
@@ -162,7 +166,7 @@ import {
|
|
|
162
166
|
siteCrawlSnapshots,
|
|
163
167
|
toAlertView,
|
|
164
168
|
usageCounters
|
|
165
|
-
} from "./chunk-
|
|
169
|
+
} from "./chunk-UMU3IBXM.js";
|
|
166
170
|
import {
|
|
167
171
|
AGENT_MEMORY_VALUE_MAX_BYTES,
|
|
168
172
|
AGENT_PROVIDER_IDS,
|
|
@@ -276,6 +280,7 @@ import {
|
|
|
276
280
|
isSelfLink,
|
|
277
281
|
isVertexGroundingRedirect,
|
|
278
282
|
mapWithConcurrency,
|
|
283
|
+
maskTelemetryAnonymousId,
|
|
279
284
|
nextScheduleUpdatedAt,
|
|
280
285
|
normalizeIdTokens,
|
|
281
286
|
normalizeMeasurementExecutionQueryText,
|
|
@@ -306,7 +311,7 @@ import {
|
|
|
306
311
|
validationError,
|
|
307
312
|
winnabilityClassLabel,
|
|
308
313
|
withRetry
|
|
309
|
-
} from "./chunk-
|
|
314
|
+
} from "./chunk-3WODA4JF.js";
|
|
310
315
|
|
|
311
316
|
// src/telemetry.ts
|
|
312
317
|
import crypto from "crypto";
|
|
@@ -360,18 +365,51 @@ function envSourceOverride() {
|
|
|
360
365
|
function setTelemetrySource(source) {
|
|
361
366
|
CURRENT_SOURCE = source;
|
|
362
367
|
}
|
|
363
|
-
function
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
+
function resolveTelemetryStatus(input) {
|
|
369
|
+
const base = {
|
|
370
|
+
configuredEnabled: input.configuredEnabled,
|
|
371
|
+
...input.anonymousId ? { anonymousId: maskAnonymousId(input.anonymousId) } : {},
|
|
372
|
+
target: "local"
|
|
373
|
+
};
|
|
374
|
+
if (input.canonryTelemetryDisabled === "1") {
|
|
375
|
+
return { ...base, enabled: false, reason: "CANONRY_TELEMETRY_DISABLED" };
|
|
376
|
+
}
|
|
377
|
+
if (input.doNotTrack === "1") {
|
|
378
|
+
return { ...base, enabled: false, reason: "DO_NOT_TRACK" };
|
|
379
|
+
}
|
|
380
|
+
if (input.ci) return { ...base, enabled: false, reason: "CI" };
|
|
381
|
+
if (!input.configuredEnabled) return { ...base, enabled: false, reason: "configured_disabled" };
|
|
382
|
+
if (input.configState === "absent") return { ...base, enabled: true, reason: "NO_CONFIG" };
|
|
383
|
+
if (input.configState === "unavailable") return { ...base, enabled: true, reason: "CONFIG_UNAVAILABLE" };
|
|
384
|
+
return { ...base, enabled: true, reason: "enabled" };
|
|
385
|
+
}
|
|
386
|
+
function maskAnonymousId(value) {
|
|
387
|
+
return maskTelemetryAnonymousId(value);
|
|
388
|
+
}
|
|
389
|
+
function getTelemetryStatus() {
|
|
390
|
+
const env = {
|
|
391
|
+
canonryTelemetryDisabled: process.env.CANONRY_TELEMETRY_DISABLED,
|
|
392
|
+
doNotTrack: process.env.DO_NOT_TRACK,
|
|
393
|
+
ci: process.env.CI
|
|
394
|
+
};
|
|
395
|
+
if (!configExists()) {
|
|
396
|
+
return resolveTelemetryStatus({ ...env, configuredEnabled: true, configState: "absent" });
|
|
397
|
+
}
|
|
368
398
|
try {
|
|
369
399
|
const config = loadConfig();
|
|
370
|
-
return
|
|
400
|
+
return resolveTelemetryStatus({
|
|
401
|
+
...env,
|
|
402
|
+
configuredEnabled: config.telemetry !== false,
|
|
403
|
+
configState: "present",
|
|
404
|
+
anonymousId: config.anonymousId
|
|
405
|
+
});
|
|
371
406
|
} catch {
|
|
372
|
-
return true;
|
|
407
|
+
return resolveTelemetryStatus({ ...env, configuredEnabled: true, configState: "unavailable" });
|
|
373
408
|
}
|
|
374
409
|
}
|
|
410
|
+
function isTelemetryEnabled() {
|
|
411
|
+
return getTelemetryStatus().enabled;
|
|
412
|
+
}
|
|
375
413
|
function getOrCreateAnonymousId() {
|
|
376
414
|
const fromEnv = readEnvAnonymousId();
|
|
377
415
|
if (fromEnv) return fromEnv;
|
|
@@ -6247,7 +6285,7 @@ function nonBlank(value) {
|
|
|
6247
6285
|
return trimmed ? trimmed : void 0;
|
|
6248
6286
|
}
|
|
6249
6287
|
function resolveBuildCommit(env = process.env) {
|
|
6250
|
-
const embedded = true ? "
|
|
6288
|
+
const embedded = true ? "b510dfd8c0f64721829f5edb0df5afd951d7b960" : void 0;
|
|
6251
6289
|
return nonBlank(embedded) ?? nonBlank(env.CANONRY_COMMIT);
|
|
6252
6290
|
}
|
|
6253
6291
|
function resolveInstanceIdentity(env = process.env) {
|
|
@@ -12058,7 +12096,7 @@ function readStoredGroundingSources(rawResponse) {
|
|
|
12058
12096
|
return result;
|
|
12059
12097
|
}
|
|
12060
12098
|
async function backfillInsightsCommand(project, opts) {
|
|
12061
|
-
const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-
|
|
12099
|
+
const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-MGQRJW4V.js");
|
|
12062
12100
|
const config = loadConfig();
|
|
12063
12101
|
const db = createClient(config.database);
|
|
12064
12102
|
migrate(db);
|
|
@@ -15812,7 +15850,12 @@ function registerMcpHttpRoutes(scope, opts) {
|
|
|
15812
15850
|
if (!request.apiKey && request.principal?.kind === "user") {
|
|
15813
15851
|
sessionKey = mintSessionKey(opts.db, scopes, request.principal.id);
|
|
15814
15852
|
}
|
|
15815
|
-
const client = new ApiClient(opts.selfApiUrl, sessionKey?.raw ?? bearer, {
|
|
15853
|
+
const client = new ApiClient(opts.selfApiUrl, sessionKey?.raw ?? bearer, {
|
|
15854
|
+
skipProbe: true,
|
|
15855
|
+
clientName: `canonry-mcp/${PACKAGE_VERSION}`,
|
|
15856
|
+
// Correlation only: this is never accepted as caller identity or authority.
|
|
15857
|
+
actorSession: crypto26.randomUUID()
|
|
15858
|
+
});
|
|
15816
15859
|
let server;
|
|
15817
15860
|
try {
|
|
15818
15861
|
server = createCanonryMcpServer({
|
|
@@ -17657,20 +17700,14 @@ function createGoogleMarketingConfigCredentialStore(input) {
|
|
|
17657
17700
|
}
|
|
17658
17701
|
async function createServer(opts) {
|
|
17659
17702
|
const dashboardManagedRunKinds = resolveDashboardManagedRunKinds(process.env, opts.config);
|
|
17660
|
-
const
|
|
17661
|
-
|
|
17662
|
-
|
|
17663
|
-
|
|
17664
|
-
colorize: true,
|
|
17665
|
-
translateTime: "HH:MM:ss",
|
|
17666
|
-
ignore: "pid,hostname,reqId",
|
|
17667
|
-
messageFormat: "{msg} {req.method} {req.url}"
|
|
17668
|
-
}
|
|
17669
|
-
}
|
|
17670
|
-
} : true;
|
|
17703
|
+
const operationalLogs = new OperationalLogStore(opts.db, {
|
|
17704
|
+
retention: opts.config.database === ":memory:" ? "process" : "durable"
|
|
17705
|
+
});
|
|
17706
|
+
const logger = createFastifyLogger({ enabled: opts.logger !== false, module: "Server" });
|
|
17671
17707
|
const trustProxy = resolveTrustProxy(process.env.CANONRY_TRUST_PROXY);
|
|
17672
17708
|
const app = Fastify({
|
|
17673
|
-
logger,
|
|
17709
|
+
loggerInstance: logger,
|
|
17710
|
+
genReqId: () => crypto27.randomUUID(),
|
|
17674
17711
|
trustProxy
|
|
17675
17712
|
});
|
|
17676
17713
|
const registry = new ProviderRegistry();
|
|
@@ -19128,7 +19165,7 @@ async function createServer(opts) {
|
|
|
19128
19165
|
},
|
|
19129
19166
|
getRunnableProviderNames: () => registry.getAll().map((provider) => provider.adapter.name),
|
|
19130
19167
|
getEffectiveProviderModels: () => effectiveProviderModels(registry),
|
|
19131
|
-
onProviderUpdate: (providerName, apiKey, model, baseUrl, incomingQuota) => {
|
|
19168
|
+
onProviderUpdate: (providerName, apiKey, model, baseUrl, incomingQuota, auditContext) => {
|
|
19132
19169
|
const name = providerName;
|
|
19133
19170
|
if (!adapterMap[name]) return null;
|
|
19134
19171
|
if (!opts.config.providers) opts.config.providers = {};
|
|
@@ -19188,7 +19225,11 @@ async function createServer(opts) {
|
|
|
19188
19225
|
targetProjectIds.map((projectId) => ({
|
|
19189
19226
|
id: crypto27.randomUUID(),
|
|
19190
19227
|
projectId,
|
|
19191
|
-
actor: "api",
|
|
19228
|
+
actor: auditContext?.actor ?? "api",
|
|
19229
|
+
userAgent: auditContext?.userAgent ?? null,
|
|
19230
|
+
actorSession: auditContext?.actorSession ?? null,
|
|
19231
|
+
credentialId: auditContext?.credentialId ?? null,
|
|
19232
|
+
requestId: auditContext?.requestId ?? null,
|
|
19192
19233
|
action: existing ? "provider.updated" : "provider.created",
|
|
19193
19234
|
entityType: "provider",
|
|
19194
19235
|
entityId: name,
|
|
@@ -19264,15 +19305,8 @@ async function createServer(opts) {
|
|
|
19264
19305
|
}
|
|
19265
19306
|
});
|
|
19266
19307
|
},
|
|
19267
|
-
|
|
19268
|
-
|
|
19269
|
-
return {
|
|
19270
|
-
enabled,
|
|
19271
|
-
// Only read/create the anonymous ID if telemetry is enabled.
|
|
19272
|
-
// Don't mutate config for opted-out users.
|
|
19273
|
-
anonymousId: enabled ? getOrCreateAnonymousId() : void 0
|
|
19274
|
-
};
|
|
19275
|
-
},
|
|
19308
|
+
listOperationalLogs: (query) => operationalLogs.list(query),
|
|
19309
|
+
getTelemetryStatus,
|
|
19276
19310
|
setTelemetryEnabled: (enabled) => {
|
|
19277
19311
|
const config = loadConfig();
|
|
19278
19312
|
config.telemetry = enabled;
|
|
@@ -19543,7 +19577,9 @@ async function createServer(opts) {
|
|
|
19543
19577
|
rejectRuntimeStartup(error);
|
|
19544
19578
|
}
|
|
19545
19579
|
});
|
|
19580
|
+
const stopLogCapture = addLogListener((entry) => operationalLogs.append(entry));
|
|
19546
19581
|
app.addHook("onClose", async () => {
|
|
19582
|
+
stopLogCapture();
|
|
19547
19583
|
scheduler.stop();
|
|
19548
19584
|
});
|
|
19549
19585
|
return app;
|
|
@@ -19608,6 +19644,7 @@ function parseQueryResponse(raw, count2) {
|
|
|
19608
19644
|
export {
|
|
19609
19645
|
trackCliCommandFinished,
|
|
19610
19646
|
setTelemetrySource,
|
|
19647
|
+
getTelemetryStatus,
|
|
19611
19648
|
isTelemetryEnabled,
|
|
19612
19649
|
getOrCreateAnonymousId,
|
|
19613
19650
|
isFirstRun,
|