@canonry/canonry 7.90.0 → 7.90.1
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/{AgentSetupPage-oSoM5flN.js → AgentSetupPage-BSfsbQXZ.js} +1 -1
- package/assets/assets/MeasurementPropertyPage-BHPa2zdE.js +4 -0
- package/assets/assets/{ProjectPage-p-rDlzSq.js → ProjectPage-C1AI_aAQ.js} +7 -7
- package/assets/assets/{RunsPage-CjkPCc9Z.js → RunsPage-DKIktkY1.js} +1 -1
- package/assets/assets/SettingsPage-CTXfqNZs.js +1 -0
- package/assets/assets/{SiteHealthSection-BZhulwSy.js → SiteHealthSection-CRwvLfHd.js} +2 -2
- package/assets/assets/{TrafficPage-Dr8NTQpA.js → TrafficPage-C4R3X5lf.js} +4 -4
- package/assets/assets/index-DdG9gR0r.js +60 -0
- package/assets/assets/{react-sigma_core.esm.min-OHqBWE8n.js → react-sigma_core.esm.min-BoCIEnkF.js} +1 -1
- package/assets/index.html +1 -1
- package/dist/{chunk-YPJCZD5H.js → chunk-CHTADAEC.js} +1 -1
- package/dist/{chunk-C2XWWIJZ.js → chunk-T7OH3YPX.js} +3 -3
- package/dist/{chunk-OVUFIG22.js → chunk-YFZHRYCM.js} +6 -1
- package/dist/{cli-commands-5ISZA43S.js → cli-commands-EXWAMK7Z.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +21 -21
- package/dist/index.js +1 -1
- package/dist/{init-K4623VOY.js → init-2WZWYSDW.js} +1 -1
- package/dist/{serve-TVODHNFU.js → serve-VVG3VYMU.js} +1 -1
- package/package.json +1 -1
- package/assets/assets/MeasurementPropertyPage-BZKiS1V0.js +0 -4
- package/assets/assets/SettingsPage-BNHMlx6C.js +0 -1
- package/assets/assets/index-BrHemYsG.js +0 -60
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{C as t,G as n,R as r,U as i,V as a,Z as o,at as s,ct as c,et as l,f as u,o as d,ot as f}from"./vendor-lucide-Bo69m9KC.js";import{r as p}from"./vendor-markdown-BiRP51B0.js";import{b as m,d as h,u as g,x as _}from"./vendor-tanstack-tBjrfzKu.js";import{mt as v,pn as ee,r as y,t as te,wt as b}from"./ToneBadge-B3rD6bDF.js";import{t as ne}from"./async-handler-Bj3TnIRw.js";import{d as re}from"./query-client-DjRrRIsq.js";import{fn as x,sn as S}from"./react-query-B8JD_K7g.js";import{t as C}from"./InfoTooltip-CNLlIWeP.js";import{t as w}from"./card-CgdGerYK.js";import{T as ie,dt as T,ft as E,lt as ae,mn as D,pt as O,ut as oe}from"./index-BrHemYsG.js";import{d as k,i as A,n as se,r as ce,s as le,t as ue}from"./server-traffic-Bt9bexaP.js";var j=e(c(),1),M=p();function de({open:e,onOpenChange:t,projectName:n}){let[r,i]=(0,j.useState)(`pick`);(0,j.useEffect)(()=>{e&&i(`pick`)},[e]);let a=()=>{t(!1),i(`pick`)};return(0,M.jsx)(ae,{open:e,onOpenChange:e=>{e?t(!0):a()},children:(0,M.jsx)(oe,{children:r===`pick`?(0,M.jsx)(pe,{onPick:i}):r===`cloudflare`?(0,M.jsx)(Q,{projectName:n,onBack:()=>i(`pick`),onClose:a}):r===`wordpress`?(0,M.jsx)(L,{projectName:n,onBack:()=>i(`pick`),onClose:a}):r===`vercel`?(0,M.jsx)(z,{projectName:n,onBack:()=>i(`pick`),onClose:a}):(0,M.jsx)(R,{projectName:n,onBack:()=>i(`pick`),onClose:a})})})}var fe=[{type:`cloudflare`,name:`Cloudflare`,needs:`A zone you manage. Set up from the terminal.`,icon:u},{type:`wordpress`,name:`WordPress`,needs:`wp-admin access to install a plugin`,icon:r},{type:`vercel`,name:`Vercel`,needs:`A Vercel access token`,icon:d},{type:`cloud-run`,name:`Google Cloud Run`,needs:`A service account that can read logs`,icon:n}];function pe({onPick:e}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(E,{children:[(0,M.jsx)(O,{children:`Connect a traffic source`}),(0,M.jsx)(T,{children:`Pick where your site runs. Canonry reads AI crawler visits and AI referrals from there.`})]}),(0,M.jsx)(`div`,{className:`mt-6 flex flex-col gap-3`,children:fe.map(({type:t,name:n,needs:r,icon:i})=>(0,M.jsxs)(`button`,{type:`button`,onClick:()=>e(t),className:`group flex items-center gap-3 rounded-md border border-base bg-bg-elevated/30 px-3 py-3 text-left transition-colors hover:border-mono-600 hover:bg-bg-elevated/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[(0,M.jsx)(`span`,{className:`mt-0.5 inline-flex size-9 shrink-0 items-center justify-center rounded-md border border-base bg-bg text-neutral group-hover:text-heading`,children:(0,M.jsx)(i,{className:`size-4`})}),(0,M.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,M.jsx)(`span`,{className:`text-label-14-strong text-heading`,children:n}),(0,M.jsx)(`span`,{className:`text-label-13 text-secondary`,children:r})]})]},t))}),(0,M.jsx)(`p`,{className:`mt-6 text-copy-13 text-secondary`,children:`Your agent can set up any of these for you. Pick a source to copy instructions for it.`})]})}function N({title:e,description:t,onBack:n}){return(0,M.jsxs)(E,{children:[(0,M.jsxs)(`button`,{type:`button`,onClick:n,className:`mb-1 inline-flex w-fit items-center gap-1 rounded text-button-14 text-secondary transition-colors hover:text-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[(0,M.jsx)(f,{className:`size-3`}),`Choose a different source`]}),(0,M.jsx)(O,{children:e}),(0,M.jsx)(T,{children:t})]})}function P(e,t){let n=h();return async(r,i)=>{i.startInitialBackfill&&await ee(e,r),i.afterConnected?.(),t(),n({to:`/traffic/$projectName/$sourceId`,params:{projectName:e,sourceId:r}})}}function F(e,t){let[n,r]=(0,j.useState)(null),i=P(e,t);return{error:n,runConnect:async e=>{r(null);let t=e.validate();if(t){r(t);return}let n;try{n=await e.mutate()}catch(e){r(k(e));return}try{await i(n.id,{startInitialBackfill:e.startInitialBackfill??!0,afterConnected:e.onConnected})}catch(e){r(`Source connected, but starting the initial backfill failed: ${k(e)}`)}}}}function I({title:e,description:t,projectName:n,onBack:r,onClose:i,onSubmit:a,isPending:o,error:s,guide:c,children:l}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{title:e,description:t,onBack:r}),(0,M.jsxs)(`div`,{className:`-mr-1 mt-6 min-h-0 flex-1 overflow-y-auto pr-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,M.jsx)(Y,{request:c.agentRequest,docsUrl:c.docsUrl}),(0,M.jsx)(X,{steps:c.steps})]}),(0,M.jsxs)(`form`,{onSubmit:ne(async e=>{e.preventDefault(),await a()}),className:`mt-6 flex flex-col gap-5 border-t border-default pt-5`,children:[(0,M.jsxs)(`p`,{className:`text-copy-14-strong text-heading`,children:[`Then connect it to `,(0,M.jsx)(`span`,{className:`text-label-13-mono`,children:n})]}),l,s?(0,M.jsx)(`p`,{className:`rounded-md border border-negative-800/50 bg-negative-950/30 px-3 py-2 text-copy-13 text-negative-200`,children:s}):null,(0,M.jsxs)(`div`,{className:`mt-2 flex items-center justify-end gap-2 border-t border-default pt-4`,children:[(0,M.jsx)(y,{type:`button`,variant:`ghost`,size:`sm`,onClick:i,children:`Close`}),(0,M.jsx)(y,{type:`submit`,disabled:o,size:`sm`,children:o?`Connecting…`:`Connect`})]})]})]})]})}function L({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),d=A(e||null),{error:f,runConnect:p}=F(e,n);return(0,M.jsxs)(I,{title:`Connect a WordPress site`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from the Canonry Traffic Logger plugin.`,(0,M.jsx)(C,{text:`${K(`Application Password`)} Pages served from a full-page cache never reach the plugin, so exclude AI crawlers from your cache. The docs list the user agents.`})]}),guide:me(e,r),projectName:e,onBack:t,onClose:n,onSubmit:()=>p({validate:()=>r.trim()?a.trim()?s.trim()?null:`Application Password is required.`:`Username is required.`:`WordPress site URL is required.`,mutate:()=>d.mutateAsync({baseUrl:r.trim(),username:a.trim(),applicationPassword:s.trim(),displayName:l.trim()||void 0}),onConnected:()=>c(``)}),isPending:d.isPending,error:f,children:[(0,M.jsx)(B,{label:`WordPress site URL`,description:`Base URL of the site running the Canonry Traffic Logger plugin.`,required:!0,children:(0,M.jsx)(`input`,{type:`url`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`url`,placeholder:`https://example.com`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Username`,description:`WordPress user that owns the Application Password.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),required:!0,autoComplete:`username`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Application Password`,description:`Create one in wp-admin under Users -> Profile -> Application Passwords.`,required:!0,children:(0,M.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),required:!0,autoComplete:`new-password`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(Z,{children:(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the WordPress host.`,children:(0,M.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})})})]})}function R({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(``),p=se(e||null),{error:m,runConnect:h}=F(e,n),g=()=>h({validate:()=>r.trim()?d.trim()?null:`Service-account JSON content is required.`:`GCP project ID is required.`,mutate:()=>p.mutateAsync({gcpProjectId:r.trim(),serviceName:a.trim()||void 0,location:s.trim()||void 0,displayName:l.trim()||void 0,keyJson:d.trim()}),onConnected:()=>f(``)}),_=async e=>{if(!e)return;let t=await e.text();f(t)};return(0,M.jsxs)(I,{title:`Connect a Cloud Run service`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from your Cloud Run request logs.`,(0,M.jsx)(C,{text:K(`service-account private key`)})]}),guide:ge(e,r),projectName:e,onBack:t,onClose:n,onSubmit:g,isPending:p.isPending,error:m,children:[(0,M.jsx)(B,{label:`GCP project ID`,description:`The Google Cloud project hosting the Cloud Run service (e.g. my-prod-foo).`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsxs)(B,{label:`Service-account JSON`,description:`Paste the contents of the SA key (JSON). The SA needs roles/logging.viewer (or any role granting logging.logEntries.list).`,required:!0,children:[(0,M.jsx)(`textarea`,{value:d,onChange:e=>f(e.target.value),rows:6,spellCheck:!1,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-copy-14-mono text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`,placeholder:`{"type":"service_account","project_id":"…","private_key":"…"}`,required:!0}),(0,M.jsxs)(`label`,{className:`mt-2 inline-flex cursor-pointer items-center gap-2 text-label-14 text-secondary hover:text-strong`,children:[(0,M.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>void _(e.target.files?.[0]??null)}),(0,M.jsx)(`span`,{className:`rounded-md border border-base px-2 py-1`,children:`Or upload a key file`})]})]}),(0,M.jsxs)(Z,{children:[(0,M.jsx)(B,{label:`Service name (optional)`,description:`Restrict log pulls to a specific Cloud Run service. Omit to pull all services in the project.`,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Location (optional)`,description:`Region of the Cloud Run service (e.g. us-central1). Helpful when multiple regions emit logs.`,children:(0,M.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the project + service combo.`,children:(0,M.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})})]})]})}function z({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(`production`),[d,f]=(0,j.useState)(``),p=ce(e||null),{error:m,runConnect:h}=F(e,n);return(0,M.jsxs)(I,{title:`Connect a Vercel project`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from Vercel request logs. Nothing to install on your site.`,(0,M.jsx)(C,{text:K(`access token`)})]}),guide:he(e),projectName:e,onBack:t,onClose:n,onSubmit:()=>h({validate:()=>r.trim()?a.trim()?s.trim()?null:`Vercel personal access token is required.`:`Vercel team / account ID is required.`:`Vercel project ID is required.`,mutate:()=>p.mutateAsync({projectId:r.trim(),teamId:a.trim(),token:s.trim(),environment:l,displayName:d.trim()||void 0}),startInitialBackfill:!1,onConnected:()=>c(``)}),isPending:p.isPending,error:m,children:[(0,M.jsx)(B,{label:`Vercel project ID`,description:`The prj_… id from the Vercel dashboard or .vercel/project.json.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`off`,placeholder:`prj_…`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Vercel team / account ID`,description:`The Vercel team or personal account that owns the project. Find it as orgId in your .vercel/project.json.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),required:!0,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Personal access token`,description:`Create a Vercel personal access token under Account Settings → Tokens. Tokens can expire, so use a long-lived one.`,required:!0,children:(0,M.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),required:!0,autoComplete:`new-password`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsxs)(Z,{children:[(0,M.jsx)(B,{label:`Environment`,description:`Which deployment environment's request logs to pull.`,children:(0,M.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong focus:border-mono-500 focus:outline-none`,children:[(0,M.jsx)(`option`,{value:`production`,children:`production`}),(0,M.jsx)(`option`,{value:`preview`,children:`preview`})]})}),(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the Vercel project ID.`,children:(0,M.jsx)(`input`,{type:`text`,value:d,onChange:e=>f(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})})]})]})}function B({label:e,description:t,required:n,children:r}){return(0,M.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,M.jsxs)(`span`,{className:`text-label-14-strong text-strong`,children:[e,n?(0,M.jsx)(`span`,{className:`ml-1 text-negative-400`,children:`*`}):null]}),r,(0,M.jsx)(`span`,{className:`text-label-13 text-secondary`,children:t})]})}var V=`https://github.com/Canonry/canonry/blob/main`,H=`${V}/skills/canonry/references/server-side-traffic.md`,U=`${V}/docs/cloudflare-traffic-setup.md`,W=`1.1.1`,G=`https://github.com/Canonry/canonry/releases/download/wp-traffic-logger-v${W}/canonry-traffic-logger-${W}.zip`;function K(e){return`The ${e} is stored in ~/.canonry/config.yaml on the Canonry server and never sent back to the dashboard.`}var q=`Never ask me to paste a password, token, or key into this chat. When a command needs one, give me the exact command to run myself, or read it from a file I point you to.`;function J(e,t){try{let n=new URL(e.trim());return n.protocol!==`https:`&&n.protocol!==`http:`?null:`${n.origin}${n.pathname.replace(/\/+$/,``)}/wp-admin/${t}`}catch{return null}}function me(e,t){let n=D(e),r=J(t,`plugin-install.php?tab=upload`),i=J(t,`profile.php#application-passwords-section`);return{docsUrl:`${H}#connecting-a-wordpress-source`,steps:[{title:`Download the Canonry Traffic Logger plugin`,link:{label:`Download v${W} (.zip)`,href:G}},{title:`Upload and activate it in wp-admin`,detail:`Plugins → Add New → Upload Plugin, then Activate.`,...r?{link:{label:`Open the upload page`,href:r}}:{}},{title:`Create an Application Password`,detail:`Users → Profile → Application Passwords. Name it “Canonry” and copy the password it shows once.`,...i?{link:{label:`Open your profile`,href:i}}:{}},{title:`Using a page cache or CDN? Exclude AI crawlers from it`,detail:`Cached pages never reach the plugin, so crawler visits go uncounted.`,link:{label:`User agents to exclude`,href:`${H}#connecting-a-wordpress-source`}}],agentRequest:`Help me connect my WordPress site to the Canonry project "${e}" for server-side traffic.
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{C as t,G as n,R as r,U as i,V as a,Z as o,at as s,ct as c,et as l,f as u,o as d,ot as f}from"./vendor-lucide-Bo69m9KC.js";import{r as p}from"./vendor-markdown-BiRP51B0.js";import{b as m,d as h,u as g,x as _}from"./vendor-tanstack-tBjrfzKu.js";import{mt as v,pn as ee,r as y,t as te,wt as b}from"./ToneBadge-B3rD6bDF.js";import{t as ne}from"./async-handler-Bj3TnIRw.js";import{d as re}from"./query-client-DjRrRIsq.js";import{fn as x,sn as S}from"./react-query-B8JD_K7g.js";import{t as C}from"./InfoTooltip-CNLlIWeP.js";import{t as w}from"./card-CgdGerYK.js";import{T as ie,dt as ae,ft as T,hn as E,mt as D,pt as O,ut as oe}from"./index-DdG9gR0r.js";import{d as k,i as A,n as se,r as ce,s as le,t as ue}from"./server-traffic-Bt9bexaP.js";var j=e(c(),1),M=p();function de({open:e,onOpenChange:t,projectName:n}){let[r,i]=(0,j.useState)(`pick`);(0,j.useEffect)(()=>{e&&i(`pick`)},[e]);let a=()=>{t(!1),i(`pick`)};return(0,M.jsx)(oe,{open:e,onOpenChange:e=>{e?t(!0):a()},children:(0,M.jsx)(ae,{children:r===`pick`?(0,M.jsx)(pe,{onPick:i}):r===`cloudflare`?(0,M.jsx)(Q,{projectName:n,onBack:()=>i(`pick`),onClose:a}):r===`wordpress`?(0,M.jsx)(L,{projectName:n,onBack:()=>i(`pick`),onClose:a}):r===`vercel`?(0,M.jsx)(z,{projectName:n,onBack:()=>i(`pick`),onClose:a}):(0,M.jsx)(R,{projectName:n,onBack:()=>i(`pick`),onClose:a})})})}var fe=[{type:`cloudflare`,name:`Cloudflare`,needs:`A zone you manage. Set up from the terminal.`,icon:u},{type:`wordpress`,name:`WordPress`,needs:`wp-admin access to install a plugin`,icon:r},{type:`vercel`,name:`Vercel`,needs:`A Vercel access token`,icon:d},{type:`cloud-run`,name:`Google Cloud Run`,needs:`A service account that can read logs`,icon:n}];function pe({onPick:e}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(O,{children:[(0,M.jsx)(D,{children:`Connect a traffic source`}),(0,M.jsx)(T,{children:`Pick where your site runs. Canonry reads AI crawler visits and AI referrals from there.`})]}),(0,M.jsx)(`div`,{className:`mt-6 flex flex-col gap-3`,children:fe.map(({type:t,name:n,needs:r,icon:i})=>(0,M.jsxs)(`button`,{type:`button`,onClick:()=>e(t),className:`group flex items-center gap-3 rounded-md border border-base bg-bg-elevated/30 px-3 py-3 text-left transition-colors hover:border-mono-600 hover:bg-bg-elevated/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[(0,M.jsx)(`span`,{className:`mt-0.5 inline-flex size-9 shrink-0 items-center justify-center rounded-md border border-base bg-bg text-neutral group-hover:text-heading`,children:(0,M.jsx)(i,{className:`size-4`})}),(0,M.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,M.jsx)(`span`,{className:`text-label-14-strong text-heading`,children:n}),(0,M.jsx)(`span`,{className:`text-label-13 text-secondary`,children:r})]})]},t))}),(0,M.jsx)(`p`,{className:`mt-6 text-copy-13 text-secondary`,children:`Your agent can set up any of these for you. Pick a source to copy instructions for it.`})]})}function N({title:e,description:t,onBack:n}){return(0,M.jsxs)(O,{children:[(0,M.jsxs)(`button`,{type:`button`,onClick:n,className:`mb-1 inline-flex w-fit items-center gap-1 rounded text-button-14 text-secondary transition-colors hover:text-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-mono-400`,children:[(0,M.jsx)(f,{className:`size-3`}),`Choose a different source`]}),(0,M.jsx)(D,{children:e}),(0,M.jsx)(T,{children:t})]})}function P(e,t){let n=h();return async(r,i)=>{i.startInitialBackfill&&await ee(e,r),i.afterConnected?.(),t(),n({to:`/traffic/$projectName/$sourceId`,params:{projectName:e,sourceId:r}})}}function F(e,t){let[n,r]=(0,j.useState)(null),i=P(e,t);return{error:n,runConnect:async e=>{r(null);let t=e.validate();if(t){r(t);return}let n;try{n=await e.mutate()}catch(e){r(k(e));return}try{await i(n.id,{startInitialBackfill:e.startInitialBackfill??!0,afterConnected:e.onConnected})}catch(e){r(`Source connected, but starting the initial backfill failed: ${k(e)}`)}}}}function I({title:e,description:t,projectName:n,onBack:r,onClose:i,onSubmit:a,isPending:o,error:s,guide:c,children:l}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{title:e,description:t,onBack:r}),(0,M.jsxs)(`div`,{className:`-mr-1 mt-6 min-h-0 flex-1 overflow-y-auto pr-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,M.jsx)(Y,{request:c.agentRequest,docsUrl:c.docsUrl}),(0,M.jsx)(X,{steps:c.steps})]}),(0,M.jsxs)(`form`,{onSubmit:ne(async e=>{e.preventDefault(),await a()}),className:`mt-6 flex flex-col gap-5 border-t border-default pt-5`,children:[(0,M.jsxs)(`p`,{className:`text-copy-14-strong text-heading`,children:[`Then connect it to `,(0,M.jsx)(`span`,{className:`text-label-13-mono`,children:n})]}),l,s?(0,M.jsx)(`p`,{className:`rounded-md border border-negative-800/50 bg-negative-950/30 px-3 py-2 text-copy-13 text-negative-200`,children:s}):null,(0,M.jsxs)(`div`,{className:`mt-2 flex items-center justify-end gap-2 border-t border-default pt-4`,children:[(0,M.jsx)(y,{type:`button`,variant:`ghost`,size:`sm`,onClick:i,children:`Close`}),(0,M.jsx)(y,{type:`submit`,disabled:o,size:`sm`,children:o?`Connecting…`:`Connect`})]})]})]})]})}function L({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),d=A(e||null),{error:f,runConnect:p}=F(e,n);return(0,M.jsxs)(I,{title:`Connect a WordPress site`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from the Canonry Traffic Logger plugin.`,(0,M.jsx)(C,{text:`${K(`Application Password`)} Pages served from a full-page cache never reach the plugin, so exclude AI crawlers from your cache. The docs list the user agents.`})]}),guide:me(e,r),projectName:e,onBack:t,onClose:n,onSubmit:()=>p({validate:()=>r.trim()?a.trim()?s.trim()?null:`Application Password is required.`:`Username is required.`:`WordPress site URL is required.`,mutate:()=>d.mutateAsync({baseUrl:r.trim(),username:a.trim(),applicationPassword:s.trim(),displayName:l.trim()||void 0}),onConnected:()=>c(``)}),isPending:d.isPending,error:f,children:[(0,M.jsx)(B,{label:`WordPress site URL`,description:`Base URL of the site running the Canonry Traffic Logger plugin.`,required:!0,children:(0,M.jsx)(`input`,{type:`url`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`url`,placeholder:`https://example.com`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Username`,description:`WordPress user that owns the Application Password.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),required:!0,autoComplete:`username`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Application Password`,description:`Create one in wp-admin under Users -> Profile -> Application Passwords.`,required:!0,children:(0,M.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),required:!0,autoComplete:`new-password`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(Z,{children:(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the WordPress host.`,children:(0,M.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})})})]})}function R({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(``),p=se(e||null),{error:m,runConnect:h}=F(e,n),g=()=>h({validate:()=>r.trim()?d.trim()?null:`Service-account JSON content is required.`:`GCP project ID is required.`,mutate:()=>p.mutateAsync({gcpProjectId:r.trim(),serviceName:a.trim()||void 0,location:s.trim()||void 0,displayName:l.trim()||void 0,keyJson:d.trim()}),onConnected:()=>f(``)}),_=async e=>{if(!e)return;let t=await e.text();f(t)};return(0,M.jsxs)(I,{title:`Connect a Cloud Run service`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from your Cloud Run request logs.`,(0,M.jsx)(C,{text:K(`service-account private key`)})]}),guide:ge(e,r),projectName:e,onBack:t,onClose:n,onSubmit:g,isPending:p.isPending,error:m,children:[(0,M.jsx)(B,{label:`GCP project ID`,description:`The Google Cloud project hosting the Cloud Run service (e.g. my-prod-foo).`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsxs)(B,{label:`Service-account JSON`,description:`Paste the contents of the SA key (JSON). The SA needs roles/logging.viewer (or any role granting logging.logEntries.list).`,required:!0,children:[(0,M.jsx)(`textarea`,{value:d,onChange:e=>f(e.target.value),rows:6,spellCheck:!1,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-copy-14-mono text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`,placeholder:`{"type":"service_account","project_id":"…","private_key":"…"}`,required:!0}),(0,M.jsxs)(`label`,{className:`mt-2 inline-flex cursor-pointer items-center gap-2 text-label-14 text-secondary hover:text-strong`,children:[(0,M.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>void _(e.target.files?.[0]??null)}),(0,M.jsx)(`span`,{className:`rounded-md border border-base px-2 py-1`,children:`Or upload a key file`})]})]}),(0,M.jsxs)(Z,{children:[(0,M.jsx)(B,{label:`Service name (optional)`,description:`Restrict log pulls to a specific Cloud Run service. Omit to pull all services in the project.`,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Location (optional)`,description:`Region of the Cloud Run service (e.g. us-central1). Helpful when multiple regions emit logs.`,children:(0,M.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the project + service combo.`,children:(0,M.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})})]})]})}function z({projectName:e,onBack:t,onClose:n}){let[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(`production`),[d,f]=(0,j.useState)(``),p=ce(e||null),{error:m,runConnect:h}=F(e,n);return(0,M.jsxs)(I,{title:`Connect a Vercel project`,description:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Reads AI crawler visits from Vercel request logs. Nothing to install on your site.`,(0,M.jsx)(C,{text:K(`access token`)})]}),guide:he(e),projectName:e,onBack:t,onClose:n,onSubmit:()=>h({validate:()=>r.trim()?a.trim()?s.trim()?null:`Vercel personal access token is required.`:`Vercel team / account ID is required.`:`Vercel project ID is required.`,mutate:()=>p.mutateAsync({projectId:r.trim(),teamId:a.trim(),token:s.trim(),environment:l,displayName:d.trim()||void 0}),startInitialBackfill:!1,onConnected:()=>c(``)}),isPending:p.isPending,error:m,children:[(0,M.jsx)(B,{label:`Vercel project ID`,description:`The prj_… id from the Vercel dashboard or .vercel/project.json.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),required:!0,autoComplete:`off`,placeholder:`prj_…`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Vercel team / account ID`,description:`The Vercel team or personal account that owns the project. Find it as orgId in your .vercel/project.json.`,required:!0,children:(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),required:!0,autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsx)(B,{label:`Personal access token`,description:`Create a Vercel personal access token under Account Settings → Tokens. Tokens can expire, so use a long-lived one.`,required:!0,children:(0,M.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),required:!0,autoComplete:`new-password`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})}),(0,M.jsxs)(Z,{children:[(0,M.jsx)(B,{label:`Environment`,description:`Which deployment environment's request logs to pull.`,children:(0,M.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong focus:border-mono-500 focus:outline-none`,children:[(0,M.jsx)(`option`,{value:`production`,children:`production`}),(0,M.jsx)(`option`,{value:`preview`,children:`preview`})]})}),(0,M.jsx)(B,{label:`Display name (optional)`,description:`Friendly label shown in the dashboard. Defaults to the Vercel project ID.`,children:(0,M.jsx)(`input`,{type:`text`,value:d,onChange:e=>f(e.target.value),autoComplete:`off`,className:`w-full rounded border border-strong bg-transparent px-2 py-1.5 text-label-14 text-strong placeholder-mono-400 focus:border-mono-500 focus:outline-none`})})]})]})}function B({label:e,description:t,required:n,children:r}){return(0,M.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,M.jsxs)(`span`,{className:`text-label-14-strong text-strong`,children:[e,n?(0,M.jsx)(`span`,{className:`ml-1 text-negative-400`,children:`*`}):null]}),r,(0,M.jsx)(`span`,{className:`text-label-13 text-secondary`,children:t})]})}var V=`https://github.com/Canonry/canonry/blob/main`,H=`${V}/skills/canonry/references/server-side-traffic.md`,U=`${V}/docs/cloudflare-traffic-setup.md`,W=`1.1.1`,G=`https://github.com/Canonry/canonry/releases/download/wp-traffic-logger-v${W}/canonry-traffic-logger-${W}.zip`;function K(e){return`The ${e} is stored in ~/.canonry/config.yaml on the Canonry server and never sent back to the dashboard.`}var q=`Never ask me to paste a password, token, or key into this chat. When a command needs one, give me the exact command to run myself, or read it from a file I point you to.`;function J(e,t){try{let n=new URL(e.trim());return n.protocol!==`https:`&&n.protocol!==`http:`?null:`${n.origin}${n.pathname.replace(/\/+$/,``)}/wp-admin/${t}`}catch{return null}}function me(e,t){let n=E(e),r=J(t,`plugin-install.php?tab=upload`),i=J(t,`profile.php#application-passwords-section`);return{docsUrl:`${H}#connecting-a-wordpress-source`,steps:[{title:`Download the Canonry Traffic Logger plugin`,link:{label:`Download v${W} (.zip)`,href:G}},{title:`Upload and activate it in wp-admin`,detail:`Plugins → Add New → Upload Plugin, then Activate.`,...r?{link:{label:`Open the upload page`,href:r}}:{}},{title:`Create an Application Password`,detail:`Users → Profile → Application Passwords. Name it “Canonry” and copy the password it shows once.`,...i?{link:{label:`Open your profile`,href:i}}:{}},{title:`Using a page cache or CDN? Exclude AI crawlers from it`,detail:`Cached pages never reach the plugin, so crawler visits go uncounted.`,link:{label:`User agents to exclude`,href:`${H}#connecting-a-wordpress-source`}}],agentRequest:`Help me connect my WordPress site to the Canonry project "${e}" for server-side traffic.
|
|
2
2
|
|
|
3
3
|
Follow the WordPress section of the Canonry docs: ${H}#connecting-a-wordpress-source
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ Follow the WordPress section of the Canonry docs: ${H}#connecting-a-wordpress-so
|
|
|
9
9
|
5. Give me the exact command to connect: cnry traffic connect wordpress ${n} --url <site-url> --username <user> --app-password '<app-password>'
|
|
10
10
|
6. After it connects, run cnry traffic sources ${n} --format json and cnry doctor --project ${n} --check 'traffic.source.*' --format json, and tell me in plain words whether events are arriving.
|
|
11
11
|
|
|
12
|
-
${q}`}}function he(e){let t=
|
|
12
|
+
${q}`}}function he(e){let t=E(e);return{docsUrl:`${H}#connecting-a-vercel-source`,steps:[{title:`Create a Vercel access token`,detail:`Give it access to the team that owns the project. Tokens can expire, so pick a long lifetime.`,link:{label:`Open Vercel tokens`,href:`https://vercel.com/account/tokens`}},{title:`Find the project ID and team ID`,detail:`Both are in the project’s Settings → General, or in .vercel/project.json (projectId and orgId) after vercel link.`}],agentRequest:`Help me connect my Vercel project to the Canonry project "${e}" for server-side traffic.
|
|
13
13
|
|
|
14
14
|
Follow the Vercel section of the Canonry docs: ${H}#connecting-a-vercel-source
|
|
15
15
|
|
|
@@ -18,7 +18,7 @@ Follow the Vercel section of the Canonry docs: ${H}#connecting-a-vercel-source
|
|
|
18
18
|
3. Connect with: cnry traffic connect vercel ${t} --project-id <prj_...> --team-id <team_...> --token-file <path>
|
|
19
19
|
4. Confirm the source with cnry traffic sources ${t} --format json and cnry doctor --project ${t} --check 'traffic.source.*' --format json. Vercel keeps about 14 days of request logs, so tell me before starting any history backfill.
|
|
20
20
|
|
|
21
|
-
${q}`}}function ge(e,t){let n=
|
|
21
|
+
${q}`}}function ge(e,t){let n=E(e),r=t.trim(),i=`https://console.cloud.google.com/iam-admin/serviceaccounts${r?`?project=${encodeURIComponent(r)}`:``}`;return{docsUrl:`${H}#connecting-a-cloud-run-source`,steps:[{title:`Create a service account in the Google Cloud project`,detail:`Grant it the Logs Viewer role (roles/logging.viewer). Nothing broader is needed.`,link:{label:`Open service accounts`,href:i}},{title:`Create a JSON key for it`,detail:`Keys → Add key → Create new key → JSON. Upload the file below.`}],agentRequest:`Help me connect my Cloud Run service to the Canonry project "${e}" for server-side traffic.
|
|
22
22
|
|
|
23
23
|
Follow the Cloud Run section of the Canonry docs: ${H}#connecting-a-cloud-run-source
|
|
24
24
|
|
|
@@ -27,7 +27,7 @@ Follow the Cloud Run section of the Canonry docs: ${H}#connecting-a-cloud-run-so
|
|
|
27
27
|
3. Connect with: cnry traffic connect cloud-run ${n} --gcp-project <project-id> --service-account-key <path/to/key.json> (add --service and --location to narrow it).
|
|
28
28
|
4. Confirm with cnry doctor --project ${n} --check 'traffic.source.*' --format json and tell me in plain words whether logs are readable.
|
|
29
29
|
|
|
30
|
-
${q}`}}function _e(e){let t=
|
|
30
|
+
${q}`}}function _e(e){let t=E(e);return{docsUrl:U,steps:[{title:`Check your request volume first`,detail:`The Worker runs on every request to your zone. A busy site can pass the Workers free allowance of 100,000 requests a day.`,link:{label:`How to size it`,href:`${U}#before-you-start-size-the-request-volume`}},{title:`Find your zone ID and account ID`,detail:`Both are on the zone’s Overview page in the Cloudflare dashboard, under API.`,link:{label:`Open Cloudflare`,href:`https://dash.cloudflare.com/`}},{title:`Run the connect command where Canonry runs`,detail:`cnry traffic connect cloudflare ${t} --zone-id <zone-id> --account-id <account-id>`}],agentRequest:`Help me connect my Cloudflare zone to the Canonry project "${e}" for server-side traffic.
|
|
31
31
|
|
|
32
32
|
Follow the Canonry Cloudflare guide: ${U}
|
|
33
33
|
|