PageSourceSearch

https://app.meetstorm.ai/assets/BrainPage-Dkw0RPSx.js

js meetstorm.ai collected 2026-10-09 22:59:03 UTC 71,050 bytes, 433 lines download raw bytes

1import{c as js,r as m,u as rt,j as e,e as ot,as as rs,L as it,W as at,E as Y,I as Le,b as os,s as Z,d as oe,F as $,a as we,a8 as ks,z as lt,D as dt,O as ct,ab as ut,ac as mt,ad as pt,K as _t}from"./main-C-kKf1tr.js";import{C as T,a as B,b as M,c as W,d as Q}from"./card-vla6AO-c.js";import{T as ft}from"./textarea-BRrno1rH.js";import{S as ye}from"./switch-BrLzpt7G.js";import{B as C}from"./badge-BWQuo6sg.js";import{D as Ns,a as Ss,b as ht,c as gt,d as bt}from"./dialog-8pW81dP2.js";import{S as yt,a as xt,b as vt,c as wt,d as jt}from"./sheet-CSU6uOD3.js";import{S as kt}from"./scroll-area-D_e1KtUP.js";import{C as Nt}from"./clock-C5_w-k9t.js";import{R as Cs}from"./rotate-ccw-C7NMFnJ7.js";import{S as is,a as as,b as ls,c as ds,d as te}from"./select-BluAycEh.js";import{S as St}from"./skeleton-D2jGO_Cs.js";import{T as Ct,a as Et,b as cs,c as ce,d as It,e as ue}from"./table-CvoVy4ka.js";import{F as Ot}from"./filter-DD99ixsm.js";import{E as At}from"./external-link-Bb7Zcajh.js";import{f as qt}from"./formatDistanceToNow-_m-ieCqh.js";import{_ as me}from"./index-C_XCTd9B.js";import{C as Lt}from"./index-6ta8p8NP.js";import{S as Rt}from"./save-BWTQfAuy.js";import{C as Dt}from"./circle-s5_pO3j8.js";import{C as Tt}from"./circle-play-bZgifeHK.js";import{C as Bt}from"./circle-check-TKiVhzW2.js";import{C as Pt}from"./calendar-days-Bha2123w.js";import{T as Ft}from"./trending-up-DcV-b3p4.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Mt=js("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Wt=js("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]),$t="61bef207-e7c5-4d9e-bed7-8d467eb23e1f",Ae="all",us="all";function Ut(t){return new Date(`${t}T00:00:00.000Z`).toISOString()}function Gt(t){return new Date(`${t}T23:59:59.999Z`).toISOString()}function ms(){return new Date().toISOString().slice(0,10)}function zt(t){return String(t||"unknown").replace(/[_-]+/g," ").trim().replace(/\b\w/g,n=>n.toUpperCase())}function ps(t){const s=String(t||"unknown").toLowerCase();return s==="rss"?"RSS":s==="viral_trend"?"Viral Trends":s==="fathom"?"Fathom Calls":s==="linkedin"?"LinkedIn":s==="podcast"?"Podcast":s==="reddit"?"Reddit":zt(s)}function Vt(t){return t===null||Number.isNaN(t)?"bg-muted text-muted-foreground border-border":t>=.75?"bg-jarvis-success/10 text-jarvis-success border-jarvis-success/30":t>=.5?"bg-jarvis-warning/10 text-jarvis-warning border-jarvis-warning/30":"bg-muted text-muted-foreground border-border"}function Ht(t){const s=String(t).toLowerCase();return["drafted","published","scheduled","qc_passed","vision_passed","done"].includes(s)?"bg-jarvis-success/10 text-jarvis-success border-jarvis-success/30":s.includes("processing")||s==="scored"||s==="briefed"||s==="picked"?"bg-primary/10 text-primary border-primary/30":s.includes("failed")||s==="cost_capped"?"bg-destructive/10 text-destructive border-destructive/30":"bg-muted text-muted-foreground border-border"}async function Jt(t){var c;const{data:s}=await Z.auth.getSession(),n=((c=s.session)==null?void 0:c.user.id)||$t,r=Ut(t),a=Gt(t),i=Z,[o,u]=await Promise.all([i.from("content_raw_signals").select("id,user_id,source_type,source_id,source_url,source_title,raw_text,captured_at,status").eq("user_id",n).gte("captured_at",r).lte("captured_at",a).order("captured_at",{ascending:!1}).limit(200),i.from("content_queue").select("id,raw_signal_id,topic,score,status,source_type,source_url,created_at").eq("user_id",n).gte("created_at",r).lte("created_at",a).order("score",{ascending:!1,nullsFirst:!1}).limit(250)]);if(o.error)throw o.error;if(u.error)throw u.error;const p=u.data||[],d=new Map,f=new Map;p.forEach(_=>
11{_.raw_signal_id&&d.set(_.raw_signal_id,_),_.source_url&&!f.has(_.source_url)&&f.set(_.source_url,_)});const E=(o.data||[]).map(_=>{const w=d.get(_.id)||(_.source_url?f.get(_.source_url):void 0)||null,A=Number((w==null?void 0:w.score)??NaN);return{..._,queue:w,displayScore:Number.isFinite(A)?A:null}}).sort((_,w)=>(w.displayScore??-1)-(_.displayScore??-1));return{userId:n,signals:E,queueRows:p}}function Qt(){const[t,s]=m.useState(Ae),[n,r]=m.useState(us),[a,i]=m.useState(ms()),{data:o,isLoading:u,error:p}=rt({queryKey:["gtm-signal-intake",a],queryFn:()=>Jt(a)}),d=m.useMemo(()=>{const c=new Set(["rss","linkedin","viral_trend","fathom","reddit"]);return o==null||o.signals.forEach(_=>c.add(String(_.source_type||"unknown"))),Array.from(c)},[o==null?void 0:o.signals]),f=m.useMemo(()=>((o==null?void 0:o.signals)||[]).filter(c=>!(t!==Ae&&c.source_type!==t||n==="high"&&(c.displayScore??0)<.75||n==="medium"&&((c.displayScore??0)<.5||(c.displayScore??0)>=.75)||n==="low"&&(c.displayScore??0)>=.5)),[o==null?void 0:o.signals,n,t]),E=m.useMemo(()=>{const c=new Set;return o==null||o.signals.forEach(_=>c.add(String(_.source_type||"unknown"))),c.size},[o==null?void 0:o.signals]);return u?e.jsx(St,{className:"h-96"}):p?e.jsx(T,{className:"border-destructive/30",children:e.jsxs(B,{className:"py-8",children:[e.jsx("p",{className:"font-medium text-destructive",children:"Signal Intake failed to load"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:ot(p,"Unknown Supabase error")})]})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(T,{className:"border-primary/20 bg-primary/5",children:e.jsx(B,{className:"py-5",children:e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(rs,{size:18,className:"text-primary"}),e.jsx("h2",{className:"text-xl font-medium text-foreground",children:"Signal Intake"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Raw discovery signals flowing into the content pipeline for ",a,"."," ",e.jsx(it,{to:at.journeyHealth,className:"text-primary underline underline-offset-2",children:"Source health lives on Engine Health"}),"."]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 text-center",children:[e.jsxs("div",{className:"rounded-lg border border-border bg-background px-4 py-2",children:[e.jsx("p",{className:"text-2xl font-mono text-foreground",children:(o==null?void 0:o.signals.length)||0}),e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"signals"})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-background px-4 py-2",children:[e.jsx("p",{className:"text-2xl font-mono text-foreground",children:(o==null?void 0:o.queueRows.length)||0}),e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"queued"})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-background px-4 py-2",children:[e.jsx("p",{className:"text-2xl font-mono text-foreground",children:E}),e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"active sources"})]})]})]})})}),e.jsxs(T,{children:[e.jsx(M,{className:"pb-3",children:e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-end md:justify-between",children:[e.jsxs("div",{children:[e.jsxs(W,{className:"text-base flex items-center gap-2",children:[e.jsx(Ot,{size:16})," Signal Feed"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Highest-scoring signals first, with queue status when the pipeline picked them up."})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 w-full md:w-auto",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(Y,{className:"text-xs",children:"Source"}),e.jsxs(is,{value:t,onValueChange:s,children:[e.jsx(as,{className:"h-8",children:e.jsx(ls,{})}),e.jsxs(ds,{children:[e.jsx(te,{value:Ae,children:"All sources"}),d.map(c=>e.jsx(te,{value:c,children:ps(c)},c))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(Y,{className:"text-xs",children:"Score"}),e.jsxs(is,{value:n,onValueChange:r,children:[e.jsx(as,{className:"h-8",children:e.jsx(ls,{})}),e.jsxs(ds,{children:[e.jsx(te,{value:us,children:"All scores"}),e.jsx(te,{value:"high",children:"≥ 0.75"}),e.jsx(te,{value:"medium",children:"0.50–0.74"}),e.jsx(te,{value:"low",children:"< 0.50 / raw"})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(Y,{className:"text-xs",children:"Date"}),e.jsx(Le,{className:"h-8",type:"date",value:a,onChange:c=>i(c.target.value||ms())})]})]})]})}),e.jsx(B,{children:f.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-14 border border-dashed rounded-xl",children:[e.jsx(rs,{size:42,className:"text-muted-foreground
vendor: 6,451 bytes, line 11
11/30 mb-3"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No signals match these filters."})]}):e.jsx("div",{className:"rounded-xl border border-border overflow-hidden",children:e.jsxs(Ct,{children:[e.jsx(Et,{children:e.jsxs(cs,{children:[e.jsx(ce,{className:"w-24",children:"Score"}),e.jsx(ce,{children:"Signal"}),e.jsx(ce,{className:"w-36",children:"Source"}),e.jsx(ce,{className:"w-36",children:"Pipeline"}),e.jsx(ce,{className:"w-36",children:"Captured"})]})}),e.jsx(It,{children:f.map(c=>{var A,U,N,y;const _=((A=c.queue)==null?void 0:A.status)||c.status||"raw",w=c.source_title||((U=c.queue)==null?void 0:U.topic)||((N=c.raw_text)==null?void 0:N.slice(0,90))||"Untitled signal";return e.jsxs(cs,{children:[e.jsx(ue,{children:e.jsx(C,{variant:"outline",className:os("font-mono",Vt(c.displayScore)),children:c.displayScore===null?"raw":c.displayScore.toFixed(2)})}),e.jsx(ue,{children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground line-clamp-1",children:w}),c.source_url&&e.jsx("a",{href:c.source_url,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 text-primary hover:text-primary/80",children:e.jsx(At,{size:13})})]}),((y=c.queue)==null?void 0:y.topic)&&c.queue.topic!==w&&e.jsxs("p",{className:"text-xs text-muted-foreground line-clamp-1",children:["Queued as: ",c.queue.topic]})]})}),e.jsx(ue,{children:e.jsx(C,{variant:"secondary",className:"text-[10px]",children:ps(c.source_type)})}),e.jsx(ue,{children:e.jsx(C,{variant:"outline",className:os("text-[10px]",Ht(_)),children:_})}),e.jsx(ue,{className:"text-xs text-muted-foreground",children:qt(new Date(c.captured_at),{addSuffix:!0})})]},c.id)})})]})})})]})]})}const _s={content:{label:"Content",count:19,desc:"Publishing brain"},signals:{label:"Signals",count:0,desc:"Content signal intake"},outbound:{label:"Outbound",count:14,desc:"Sales motion brain"},discovery:{label:"Discovery",count:11,desc:"Lead-source brain"}};function Yt({active:t,onChange:s}){return e.jsx("div",{className:"flex flex-wrap gap-2 rounded-xl border bg-card p-2",children:Object.keys(_s).map(n=>{const r=_s[n],a=t===n;return e.jsxs(oe,{type:"button",variant:a?"default":"ghost",className:"h-auto justify-start gap-3 px-4 py-3",onClick:()=>s(n),children:[e.jsxs("span",{className:"text-left",children:[e.jsx("span",{className:"block font-semibold",children:r.label}),e.jsx("span",{className:"block text-xs opacity-80",children:r.desc})]}),e.jsx(C,{variant:a?"secondary":"outline",children:r.count})]},n)})})}class Xt{diff(s,n,r={}){let a;typeof r=="function"?(a=r,r={}):"callback"in r&&(a=r.callback);const i=this.castInput(s,r),o=this.castInput(n,r),u=this.removeEmpty(this.tokenize(i,r)),p=this.removeEmpty(this.tokenize(o,r));return this.diffWithOptionsObj(u,p,r,a)}diffWithOptionsObj(s,n,r,a){var i;const o=y=>{if(y=this.postProcess(y,r),a){setTimeout(function(){a(y)},0);return}else return y},u=n.length,p=s.length;let d=1,f=u+p;r.maxEditLength!=null&&(f=Math.min(f,r.maxEditLength));const E=(i=r.timeout)!==null&&i!==void 0?i:1/0,c=Date.now()+E,_=[{oldPos:-1,lastComponent:void 0}];let w=this.extractCommon(_[0],n,s,0,r);if(_[0].oldPos+1>=p&&w+1>=u)return o(this.buildValues(_[0].lastComponent,n,s));let A=-1/0,U=1/0;const N=()=>{for(let y=Math.max(A,-d);y<=Math.min(U,d);y+=2){let j;const G=_[y-1],b=_[y+1];G&&(_[y-1]=void 0);let ie=!1;if(b){const K=b.oldPos-y;ie=b&&0<=K&&K<u}const X=G&&G.oldPos+1<p;if(!ie&&!X){_[y]=void 0;continue}if(!X||ie&&G.oldPos<b.oldPos?j=this.addToPath(b,!0,!1,0,r):j=this.addToPath(G,!1,!0,1,r),w=this.extractCommon(j,n,s,y,r),j.oldPos+1>=p&&w+1>=u)return o(this.buildValues(j.lastComponent,n,s))||!0;_[y]=j,j.oldPos+1>=p&&(U=Math.min(U,y-1)),w+1>=u&&(A=Math.max(A,y+1))}d++};if(a)(function y(){setTimeout(function(){if(d>f||Date.now()>c)return a(void 0);N()||y()},0)})();else for(;d<=f&&Date.now()<=c;){const y=N();if(y)return y}}addToPath(s,n,r,a,i){const o=s.lastComponent;return o&&!i.oneChangePerToken&&o.added===n&&o.removed===r?{oldPos:s.oldPos+a,lastComponent:{count:o.count+1,added:n,removed:r,previousComponent:o.previousComponent}}:{oldPos:s.oldPos+a,lastComponent:{count:1,added:n,removed:r,previousComponent:o}}}extractCommon(s,n,r,a,i){const o=n.length,u=r.length;let p=s.oldPos,d=p-a,f=0;for(;d+1<o&&p+1<u&&this.equals(r[p+1],n[d+1],i);)d++,p++,f++,i.oneChangePerToken&&(s.lastComponent={count:1,previousComponent:s.lastComponent,added:!1,removed:!1});return f&&!i.oneChangePerToken&&(s.lastComponent={count:f,previousComponent:s.lastComponent,added:!1,removed:!1}),s.oldPos=p,d}equals(s,n,r){return r.comparator?r.comparator(s,n):s===n||!!r.ignoreCase&&s.toLowerCase()===n.toLowerCase()}removeEmpty(s){const n=[];for(let r=0;r<s.length;r++)s[r]&&n.push(s[r]);return n}castInput(s,n){return s}tokenize(s,n){return Array.from(s)}join(s){return s.join("")}postProcess(s,n){return s}get useLongestToken(){return!1}buildValues(s,n,r){const a=[];let i;for(;s;)a.push(s),i=s.previousComponent,delete s.previousComponent,s=i;a.reverse();const o=a.length;let u=0,p=0,d=0;for(;u<o;u++){const f=a[u];if(f.removed)f.value=this.join(r.slice(d,d+f.count)),d+=f.count;else{if(!f.added&&this.useLongestToken){let E=n.slice(p,p+f.count);E=E.map(function(c,_){const w=r[d+_];return w.length>c.length?w:c}),f.value=this.join(E)}else f.value=this.join(n.slice(p,p+f.count));p+=f.count,f.added||(d+=f.count)}}return a}}function fs(t,s){let n;for(n=0;n<t.length&&n<s.length;n++)if(t[n]!=s[n])return t.slice(0,n);return t.slice(0,n)}function hs(t,s){let n;if(!t||!s||t[t.length-1]!=s[s.length-1])return"";for(n=0;n<t.length&&n<s.length;n++)if(t[t.length-(n+1)]!=s[s.length-(n+1)])return t.slice(-n);return t.slice(-n)}function Re(t,s,n){if(t.slice(0,s.length)!=s)throw Error(`string ${JSON.stringify(t)} doesn't start with prefix ${JSON.stringify(s)}; this is a bug`);return n+t.slice(s.length)}function De(t,s,n){if(!s)return t+n;if(t.slice(-s.length)!=s)throw Error(`string ${JSON.stringify(t)} doesn't end with suffix ${JSON.stringify(s)}; this is a bug`);return t.slice(0,-s.length)+n}function pe(t,s){return Re(t,s,"")}function xe(t,s){return De(t,s,"")}function gs(t,s){return s.slice(0,Zt(t,s))}function Zt(t,s){let n=0;t.length>s.length&&(n=t.length-s.length);let r=s.length;t.length<s.length&&(r=t.length);const a=Array(r);let i=0;a[0]=0;for(let o=1;o<r;o++){for(s[o]==s[i]?a[o]=a[i]:a[o]=i;i>0&&s[o]!=s[i];)i=a[i];s[o]==s[i]&&i++}
11i=0;for(let o=n;o<t.length;o++){for(;i>0&&t[o]!=s[i];)i=a[i];t[o]==s[i]&&i++}return i}function Es(t,s){const n=[];for(const r of Array.from(s.segment(t))){const a=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(a)?n[n.length-1]+=a:n.push(a)}return n}function Te(t,s){if(s)return _e(t,s)[1];let n;for(n=t.length-1;n>=0&&t[n].match(/\s/);n--);return t.substring(n+1)}function ne(t,s){if(s)return _e(t,s)[0];const n=t.match(/^\s*/);return n?n[0]:""}function _e(t,s){if(!s)return[ne(t),Te(t)];if(s.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=Es(t,s),r=n[0],a=n[n.length-1],i=/\s/.test(r)?r:"",o=/\s/.test(a)?a:"";return[i,o]}const bs="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",Kt=new RegExp(`[${bs}]+|\\s+|[^${bs}]`,"ug");class en extends Xt{equals(s,n,r){return r.ignoreCase&&(s=s.toLowerCase(),n=n.toLowerCase()),s.trim()===n.trim()}tokenize(s,n={}){let r;if(n.intlSegmenter){const o=n.intlSegmenter;if(o.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=Es(s,o)}else r=s.match(Kt)||[];const a=[];let i=null;return r.forEach(o=>{/\s/.test(o)?i==null?a.push(o):a.push(a.pop()+o):i!=null&&/\s/.test(i)?a[a.length-1]==i?a.push(a.pop()+o):a.push(i+o):a.push(o),i=o}),a}join(s){return s.map((n,r)=>r==0?n:n.replace(/^\s+/,"")).join("")}postProcess(s,n){if(!s||n.oneChangePerToken)return s;let r=null,a=null,i=null;return s.forEach(o=>{o.added?a=o:o.removed?i=o:((a||i)&&ys(r,i,a,o,n.intlSegmenter),r=o,a=null,i=null)}),(a||i)&&ys(r,i,a,null,n.intlSegmenter),s}}const sn=new en;function tn(t,s,n){return sn.diff(t,s,n)}function ys(t,s,n,r,a){if(s&&n){const[i,o]=_e(s.value,a),[u,p]=_e(n.value,a);if(t){const d=fs(i,u);t.value=De(t.value,u,d),s.value=pe(s.value,d),n.value=pe(n.value,d)}if(r){const d=hs(o,p);r.value=Re(r.value,p,d),s.value=xe(s.value,d),n.value=xe(n.value,d)}}else if(n){if(t){const i=ne(n.value,a);n.value=n.value.substring(i.length)}if(r){const i=ne(r.value,a);r.value=r.value.substring(i.length)}}else if(t&&r){const i=ne(r.value,a),[o,u]=_e(s.value,a),p=fs(i,o);s.value=pe(s.value,p);const d=hs(pe(i,p),u);s.value=xe(s.value,d),r.value=Re(r.value,i,d),t.value=De(t.value,i,i.slice(0,i.length-d.length))}else if(r){const i=ne(r.value,a),o=Te(s.value,a),u=gs(o,i);s.value=xe(s.value,u)}else if(t){const i=Te(t.value,a),o=ne(s.value,a),u=gs(i,o);s.value=pe(s.value,u)}}function nn({open:t,onOpenChange:s,userId:n,fileKey:r,currentContent:a,onRestore:i}){const[o,u]=m.useState([]),[p,d]=m.useState(!1),f=m.useCallback(async()=>{if(!t)return;d(!0);const E=Z,{data:c,error:_}=await E.from("content_user_settings_versions").select("id,file_key,content,saved_at").eq("user_id",n).eq("file_key",r).order("saved_at",{ascending:!1}).limit(20);d(!1),_?$.error(`Could not load history: ${_.message}`):u(c||[])},[r,t,n]);return m.useEffect(()=>{f()},[f]),e.jsx(yt,{open:t,onOpenChange:s,children:e.jsxs(xt,{side:"right",className:"w-full overflow-hidden sm:max-w-2xl",children:[e.jsxs(vt,{children:[e.jsxs(wt,{children:["History: ",r]}),e.jsx(jt,{children:"Last 20 saved versions. Green text was added versus the current editor; red was removed."})]}),e.jsxs(kt,{className:"mt-6 h-[calc(100vh-120px)] pr-4",children:[p?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(we,{className:"h-4 w-4 animate-spin"}),"Loading history…"]}):null,!p&&!o.length?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No versions saved yet."}):null,e.jsx("div",{className:"space-y-4",children:o.map(E=>{const c=E.content||"",_=tn(a,c).slice(0,80);return e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between gap-2",children:[e.jsxs(C,{variant:"outline",className:"gap-1",children:[e.jsx(Nt,{className:"h-3 w-3"}),new Date(E.saved_at).toLocaleString()]}),e.jsxs(oe,{size:"sm",variant:"outline",onClick:async()=>{await i(c),$.success("Version restored into live brain"),s(!1)},children:[e.jsx(Cs,{className:"mr-2 h-4 w-4"}),"Restore"]})]}),e.jsx("div",{className:"line-clamp-6 whitespace-pre-wrap rounded bg-muted/40 p-3 font-mono text-xs",children:_.map((w,A)=>e.jsx("span",{className:w.added?"bg-emerald-100 text-emerald-900":w.removed?"bg-red-100 text-red-900 line-through":"",children:w.value},A))})]},E.id)})})]})]})})}function rn({files:t,onSelect:s}){const[n,r]=m.useState(!1),a=m.useMemo(()=>t,[t]);return m.useEffect(()=>{const i=o=>{(o.metaKey||o.ctrlKey)&&o.key.toLowerCase()==="p"&&(o.preventDefault(),r(u=>!u))};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[]),e.jsx(Ns,{open:n,onOpenChange:r,children:e.jsx(Ss,{className:"overflow-hidden p-0 sm:max-w-2xl",children:e.jsxs(me,{label:"Jump to brain file",className:"[&_[cmdk-input]]:h-12 [&_[cmdk-input]]:w-full [&_[cmdk-input]]:border-b [&_[cmdk-input]]:bg-transparent [&_[cmdk-input]]:px-4 [&_[cmdk-input]]:outline-none [&_[cmdk-item]]:cursor-pointer",children:[e.jsx(me.Input,{autoFocus:!0,placeholder:"Jump to file…"}),e.jsx(me.Empty,{className:"p-4 text-sm text-muted-foreground",children:"No brain file found."}),e.jsx(me.List,{className:"max-h-[420px] overflow-auto p-2",children:a.map(i=>e.jsxs(me.Item,{value:`${i.tab} ${i.folder} ${i.label} ${i.description}`,onSelect:()=>{s(i),r(!1)},className:"flex items-center gap-3 rounded-md px-3 py-2 aria-selected:bg-muted",children:[e.jsx(ks,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate font-mono text-sm",children:i.label}),e.jsxs("div",{className:"truncate text-xs text-muted-foreground",children:[i.tab," / ",i.folder," · ",i.description]})]})]},`${i.tab}:${i.key}`))})]})})})}const on=`# voice.md
12
13Write as Vijay Jacob: direct, operator-first, specific, no fluff. Use concrete proof. No em dashes. No generic AI hype.`,an=`# founder-profile.md
14
15Vijay Jacob is the founder of AEO Engine. He writes from the perspective of an operator building answer-engine visibility systems tied to pipeline, not vanity traffic.`,ln=`# core-beliefs.md
16
17- AI search rewards evidence, entity clarity, and third-party trust.
18- Content engines should score, revise, and learn before publishing.
19- Visibility only matters when it creates qualified pipeline.`,dn=`# story-vault.md
20
21Add founder, customer, implementation, and failure stories here. Tag each story by ICP, pain, proof, and usable formats.`,cn=`# icp.md
22
23B2B founders, marketers, and operators who need measurable AI-search visibility, citations, and qualified pipeline.`,un=`# pains-and-desires.md
24
25Pains: invisible in answer engines, content that does not convert, unclear attribution. Desires: defensible visibility, cited answers, qualified pipeline.`,mn=`# objections.md
26
27- Is AEO just SEO renamed?
28- Can this produce revenue, not just impressions?
29- Will AI platforms cite a smaller brand?`,pn=`# swipe-file.md
30
31Store top performing posts, why they worked, and what pattern should be reused.`,_n=`# quality-rubric.md
32
33Score 0-10: hook, signal density, specificity, POV, CTA, brand fit. Kill anything below the configured floor. Kill generic AI hype.`,fn=`# editorial-rules.md
34
35No em dashes. No generic AI hype. No hashtags by default. Short paragraphs. Concrete nouns. One idea per post.`,hn=`# offer-stack.md
36
37Primary offer: AEO Engine. Promise: become visible and cited in AI search with a system tied to measurable growth outcomes.`,gn=`# 
37cta-library.md
38
39- DM for an AEO audit
40- Comment for the checklist
41- Book a strategy call
42- Read the teardown`,bn=`# design.md
43
44Clean Google-inspired clarity. High contrast. Generous whitespace. Proof-first overlays. Mobile-readable editorial graphics.`,yn=`# metrics.md
45
46Weekly: impressions, saves, comments, DMs, meetings booked, AI citation movement, assisted pipeline.`,xn=`# system-prompt.md
47
48## Format: default
49files: voice, founder_profile, core_beliefs, icp, pains_and_desires, objections, offer_stack, cta_library
50
51## Format: viral_trend
52files: voice, core_beliefs, objections, swipe_file, quality_rubric, editorial_rules
53
54## Format: educational
55files: voice, founder_profile, pains_and_desires, offer_stack, cta_library, quality_rubric`,vn=`## Drafter
56You are Vijay Jacob's content drafter focused on AI search and AEO growth. Return strict JSON with LinkedIn and X/Twitter drafts.
57
58## Scorer
59Score incoming signals for brand fit and quality. Return strict JSON.
60
61## QC
62Be adversarial but practical. Return JSON with score and feedback.
63
64## Briefer
65Return source-grounded briefs.
66
67## Daily QC
68Final gate before scheduling.
69
70## ICP Matcher
71Map topics to the best ICP.`,wn=`# sources.md
72
73| name | url | active | fetch_frequency_min |
74| --- | --- | --- | --- |
75| AEO Engine Blog | https://aeoengine.ai/blog/rss.xml | true | 360 |`,jn=`# creators.md
76
77| name | linkedin_url | scrape_frequency_min | max_posts | active |
78| --- | --- | --- | --- | --- |
79| Vijay Jacob | https://www.linkedin.com/in/vijayjacob/ | 360 | 5 | true |`,kn=`# signal-scoring.md
80
81score_floor: 0.70
82freshness_decay: 0.15
83
84## weights
85novelty: 0.30
86data_density: 0.25
87source_authority: 0.25
88brand_fit: 0.20`,Nn=`# daily-research.md
89
90dedup_window_hours: 72
91
92## sources_active
93rss: true
94linkedin: true
95
96## daily_caps
97rss: 50
98linkedin: 40`,Sn=`# sender.md
99
100## Goal
101Represent Vijay and AEO Engine with useful, concise, evidence-led outbound.
102
103## Rules
104- No fake familiarity.
105- No pressure.
106- Lead with a specific business reason.
107- Keep emails under 120 words.`,Cn=`# personas.md
108
109## Goal
110Define buyer personas for AEO Engine outbound.
111
112## Rules
113| persona | pains | proof_needed |
114| --- | --- | --- |
115| Founder | invisible in AI answers | revenue impact |
116| Marketing lead | content not converting | citation and pipeline lift |`,En=`# blacklist.md
117
118## Goal
119Prevent bad-fit or risky outreach.
120
121## Rules
122- Exclude agencies reselling generic SEO.
123- Exclude students, recruiters, and vendors.
124- Exclude anyone who opted out.`,In=`# segments.md
125
126## Goal
127Route accounts by urgency and fit.
128
129## Rules
130| segment | trigger | motion |
131| --- | --- | --- |
132| A | high-intent AI/SEO content | multichannel |
133| B | ICP fit with weaker signal | email-first |`,On=`# cold-email-step-1.md
134
135## Goal
136Start a relevant conversation.
137
138## Rules
139Subject: quick AEO idea
140
141Mention one specific signal, connect it to AI-search visibility, and offer a low-friction audit.`,An=`# cold-email-step-2.md
142
143## Goal
144Follow up with a useful angle.
145
146## Rules
147Add one proof point or teardown idea. Do not guilt-trip or bump with empty copy.`,qn=`# linkedin-connect.md
148
149## Goal
150Earn a connection without pitching.
151
152## Rules
153One sentence, context-specific, no links.`,Ln=`# followup.md
154
155## Goal
156Keep follow-ups valuable.
157
158## Rules
159Each follow-up must add a new reason, proof point, or relevant observation.`,Rn=`# objection-handlers.md
160
161## Goal
162Respond clearly to common objections.
163
164## Rules
165| objection | response |
166| --- | --- |
167| We do SEO | AEO is the layer where AI systems decide who to cite. |
168| Not a priority | Offer a small visibility baseline first. |`,Dn=`# booking-flow.md
169
170## Goal
171Move interested replies to a call.
172
173## Rules
174Offer two times or the booking link. Confirm agenda: current AI visibility, missed demand, next best fixes.`,Tn=`# outbound-agent-prompts.md
175
176## Goal
177Guide personalizer, classifier, and reply agents.
178
179## Rules
180Personalize from verified signals only. Classify replies conservatively. Never invent case studies.`,Bn=`# deliverability.md
181
182## Goal
183Protect warmed mailboxes.
184
185## Rules
186Keep copy plain text. Avoid spammy punctuation. Respect caps and suppression lists.`,Pn=`# compliance.md
187
188## Goal
189Keep outbound compliant and respectful.
190
191## Rules
192Honor opt-outs immediately. Include truthful identity. Do not imply prior relationship.`,Fn=`# outbound-system-prompt.md
193
194## Goal
195Load the correct outbound files by stage.
196
197## Rules
198Cold emails use sender, personas, segments, blacklist, sequence step, deliverability, compliance. Replies use objection handlers and booking flow.`,Mn=`# ocean.md
199
200## Sources
201| source | use | active |
202| --- | --- | --- |
203| Ocean.io | lookalike company discovery | true |
204
205## Rules
206Prefer B2B companies with visible category demand.`,Wn=`# exa-web-search.md
207
208## Sources
209| name | query | active |
210| --- | --- | --- |
211| AEO category | "answer engine optimization" | true |
212
213## Rules
214Prefer recent pages with buyer intent or category education.`,$n=`# linkedin-sales.md
215
216## Sources
217| name | filter | active |
218| --- | --- | --- |
219| Founders | title founder OR ceo | true |
220
221## Rules
222Prioritize decision-makers at ICP-fit companies.`,Un=`# reddit.md
223
224## Sources
225| subreddit | signal | active |
226| --- | --- | --- |
227| r/SEO | AI search pain | true |
228
229## Rules
230Use Reddit for pain language and emerging objections, not direct prospecting spam.`,Gn=`# lookalike-seeds.md
231
232## Sources
233| company | reason |
234| --- | --- |
235| AEO Engine customers | proven ICP fit |
236
237## Rules
238Use seeds to find similar companies, then filter aggressively.`,zn=`# exclude.md
239
240## Sources
241Manual suppression lists and known bad-fit categories.
242
243## Rules
244Exclude agencies, students, vendors, recruiters, opt-outs, competitors, and irrelevant geos.`,Vn=`# title-allowlist.md
245
246## Sources
247| title | priority |
248| --- | --- |
249| Founder | high |
250| CEO | high |
251| Head of Marketing | medium |
252
253## Rules
254Prefer owner-level roles. Avoid junior ICs unless buying intent is explicit.`,Hn=`# discovery-agent-prompts.md
255
256## Sources
257Company pages, web search, LinkedIn, Reddit, and enrichment providers.
258
259## Rules
260Find evidence before scoring. Return source URLs and confidence.`,Jn=`# discovery-system-prompt.md
261
262## Sources
263Load source, seed, filter, and budget files before discovery runs.
264
265## Rules
266Score fit, suppress bad matches, and keep source evidence attached.`,Qn=`# daily-budget.md
267
268## Sources
269Daily queue and provider quota state.
270
271## Rules
272daily_company_cap: 500
273daily_enrichment_cap: 250
274min_fit_score: 0.72`,Yn=`# rb2b.md
275
276## Source
277RB2B identifies people visiting owned website pages. Treat this as warm inbound intent, not generic cold discovery.
278
279## Weighting
280intent_multiplier: 1.35
281freshness_window_days: 14
282priority_score_floor: 85
283
284## Rules
285- Promote visitors into GTM contacts with discovery_source=rb2b and import_source=website_visitor.
286- Keep captured_url, referrer, seen_at, and tags attached as context for personalization.
287- If a business email is present, still verify before outreach.
288- Prioritize recent pricing, demo, comparison, and case-study page visits over blog-only visits.
289- Deduplicate by LinkedIn URL per user before enrichment.
290
291## Enrichment priority
292RB2B visitors should enter the enrichment queue ahead of cold-source contacts because they already showed site intent. Do not auto-send without normal verification, suppression, and sequencing gates.`,xs={voice_md:on,founder_profile_md:an,core_beliefs_md:ln,story_vault_md:dn,icp_md:cn,pains_and_desires_md:un,objections_md:mn,swipe_file_md:pn,quality_rubric_md:_n,editorial_rules_md:fn,offer_stack_md:hn,cta_library_md:gn,design_md:bn,metrics_md:yn,system_prompt_md:xn,agent_prompts_md:vn,research_sources_md:wn,research_creators_md:jn,research_signal_scoring_md:kn,research_daily_md:Nn,outbound_sender_md:Sn,outbound_personas_md:Cn,outbound_blacklist_md:En,outbound_segments_md:In,outbound_seq_cold_step1_md:On,outbound_seq_cold_step2_md:An,outbound_seq_linkedin_connect_md:qn,outbound_seq_followup_md:Ln,outbound_objection_handlers_md:Rn,outbound_booking_flow_md:Dn,outbound_agent_prompts_md:Tn,outbound_deliverability_md:Bn,outbound_compliance_md:Pn,outbound_system_prompt_md:Fn,discovery_sources_ocean_md:Mn,discovery_sources_exa_md:Wn,discovery_sources_linkedin_
292sales_md:$n,discovery_sources_reddit_md:Un,discovery_lookalike_seeds_md:Gn,discovery_exclude_md:zn,discovery_title_allowlist_md:Vn,discovery_agent_prompts_md:Hn,discovery_system_prompt_md:Jn,discovery_daily_budget_md:Qn,discovery_sources_rb2b_md:Yn};function Is(t){return(t==null?void 0:t.is_active)!==!1}const Xn=["comment-to-dm-pipeline-15m","content-comment-monitor-30m","Daily Social Listening"],Zn=["Daily GTM Report","Weekly GTM Report","Weekly Marketing Autopilot","content-trend-scanner-weekly"];function Os(t){return(t==null?void 0:t.linkedin_outbound_active)!==!1}const R={voice_md:["drafter","scorer","qc","daily_qc"],pov_md:["drafter","briefer","icp_matcher","scorer"],icp_md:["planner","trend_scanner","briefer","scorer"],proof_md:["drafter"],objections_md:["drafter","briefer","icp_matcher"],offer_stack_md:["drafter","briefer"],cta_library_md:["drafter"],design_md:["image"],system_prompt_md:["orchestrator"],agent_prompts_md:["drafter","scorer","qc","briefer","daily_qc","icp_matcher"],research_sources_md:["briefer","scorer"],research_creators_md:["scraper","briefer"],research_signal_scoring_md:["scorer","daily_qc"],research_daily_md:["orchestrator","research_cron"]},Me=[{name:"Identity",slug:"identity",files:[{folder:"identity",slug:"voice",label:"voice.md",key:"voice_md",description:"Founder bio, speech patterns, editorial rules. How you sound.",usedBy:R.voice_md}]},{name:"POV",slug:"pov",files:[{folder:"pov",slug:"pov",label:"pov.md",key:"pov_md",description:"Core beliefs + ICP angle. Gives posts a stance.",usedBy:R.pov_md}]},{name:"ICP",slug:"icp",files:[{folder:"icp",slug:"icp",label:"icp.md",key:"icp_md",description:"Target verticals and buyer context that steer research, planning, and scoring.",usedBy:R.icp_md}]},{name:"Proof",slug:"proof",files:[{folder:"proof",slug:"proof",label:"proof.md",key:"proof_md",description:"Story vault + client wins. Real names, numbers, quotes.",usedBy:R.proof_md}]},{name:"Objections",slug:"objections",files:[{folder:"objections",slug:"objections",label:"objections.md",key:"objections_md",description:"Objections + prospect pain points. Real customer language for hooks.",usedBy:R.objections_md}]},{name:"Visual",slug:"visual",files:[{folder:"visual",slug:"design",label:"design.md",key:"design_md",description:"Image generator visual direction.",usedBy:R.design_md}]},{name:"Conversion",slug:"conversion",files:[{folder:"conversion",slug:"offer-stack",label:"offer-stack.md",key:"offer_stack_md",description:"Offers and lead magnets — only loaded on CTA-flagged posts.",usedBy:R.offer_stack_md},{folder:"conversion",slug:"cta-library",label:"cta-library.md",key:"cta_library_md",description:"Tested CTAs — only loaded on CTA-flagged posts.",usedBy:R.cta_library_md}]},{name:"Operations",slug:"operations",files:[{folder:"operations",slug:"system-prompt",label:"system-prompt.md",key:"system_prompt_md",description:"Master file-loading rules per post format.",usedBy:R.system_prompt_md,leverage:!0},{folder:"operations",slug:"agent-prompts",label:"agent-prompts.md",key:"agent_prompts_md",description:"The six agent system prompts.",usedBy:R.agent_prompts_md}]},{name:"Research",slug:"research",files:[{folder:"research",slug:"sources",label:"sources.md",key:"research_sources_md",description:"RSS and web sources feeding the research engine.",usedBy:R.research_sources_md},{folder:"research",slug:"creators",label:"creators.md",key:"research_creators_md",description:"LinkedIn creators and accounts the scraper watches.",usedBy:R.research_creators_md},{folder:"research",slug:"signal-scoring",label:"signal-scoring.md",key:"research_signal_scoring_md",description:"Weights, floors, multipliers, and decay for signal scoring.",usedBy:R.research_signal_scoring_md},{folder:"research",slug:"daily-research",label:"daily-research.md",key:"research_daily_md",description:"Daily caps, dedup windows, and per-source switches.",usedBy:R.research_daily_md}]}],We=Me.flatMap(t=>t.files),fe=We,he=[{name:"Sender",slug:"sender",files:[{folder:"sender",slug:"sender",label:"sender.md",key:"outbound_sender_md",description:"Sender identity, tone, and outbound voice."},{folder:"sender",slug:"personas",label:"personas.md",key:"outbound_personas_md",description:"Buyer personas and proof needs for outreach."}
292,{folder:"sender",slug:"blacklist",label:"blacklist.md",key:"outbound_blacklist_md",description:"Bad-fit categories, suppressions, and opt-out rules."}]},{name:"Audience",slug:"audience",files:[{folder:"audience",slug:"segments",label:"segments.md",key:"outbound_segments_md",description:"Segment logic for outbound routing and motion."}]},{name:"Sequences",slug:"sequences",files:[{folder:"sequences",slug:"cold-email-step-1",label:"cold-email-step-1.md",key:"outbound_seq_cold_step1_md",description:"First cold email rules and structure."},{folder:"sequences",slug:"cold-email-step-2",label:"cold-email-step-2.md",key:"outbound_seq_cold_step2_md",description:"Second cold email follow-up rules."},{folder:"sequences",slug:"linkedin-connect",label:"linkedin-connect.md",key:"outbound_seq_linkedin_connect_md",description:"LinkedIn connection request rules."},{folder:"sequences",slug:"followup",label:"followup.md",key:"outbound_seq_followup_md",description:"General follow-up principles and constraints."}]},{name:"Playbooks",slug:"playbooks",files:[{folder:"playbooks",slug:"objection-handlers",label:"objection-handlers.md",key:"outbound_objection_handlers_md",description:"Common reply objections and response patterns."},{folder:"playbooks",slug:"booking-flow",label:"booking-flow.md",key:"outbound_booking_flow_md",description:"Rules for moving interested replies to calls."}]},{name:"Agents",slug:"agents",files:[{folder:"agents",slug:"outbound-agent-prompts",label:"outbound-agent-prompts.md",key:"outbound_agent_prompts_md",description:"Prompts for personalizer, classifier, and reply agents."}]},{name:"Quality",slug:"quality",files:[{folder:"quality",slug:"deliverability",label:"deliverability.md",key:"outbound_deliverability_md",description:"Plain-text and mailbox-protection rules."},{folder:"quality",slug:"compliance",label:"compliance.md",key:"outbound_compliance_md",description:"Identity, opt-out, and respectful outreach rules."}]},{name:"Orchestrator",slug:"orchestrator",files:[{folder:"orchestrator",slug:"outbound-system-prompt",label:"outbound-system-prompt.md",key:"outbound_system_prompt_md",description:"Which outbound files load by stage."}]}],$e=he.flatMap(t=>t.files),ge=[{name:"Sources",slug:"sources",files:[{folder:"sources",slug:"ocean",label:"ocean.md",key:"discovery_sources_ocean_md",description:"Ocean.io lookalike discovery rules."},{folder:"sources",slug:"exa-web-search",label:"exa-web-search.md",key:"discovery_sources_exa_md",description:"Exa/web-search source queries and rules."},{folder:"sources",slug:"linkedin-sales",label:"linkedin-sales.md",key:"discovery_sources_linkedin_
292sales_md",description:"LinkedIn Sales Navigator source filters."},{folder:"sources",slug:"reddit",label:"reddit.md",key:"discovery_sources_reddit_md",description:"Reddit signal-mining rules."},{folder:"sources",slug:"rb2b",label:"rb2b.md",key:"discovery_sources_rb2b_md",description:"Website visitor intent signals from RB2B."}]},{name:"ICP",slug:"icp",files:[{folder:"icp",slug:"lookalike-seeds",label:"lookalike-seeds.md",key:"discovery_lookalike_seeds_md",description:"Seed companies for lookalike discovery."}]},{name:"Filters",slug:"filters",files:[{folder:"filters",slug:"exclude",label:"exclude.md",key:"discovery_exclude_md",description:"Suppression and exclusion rules."},{folder:"filters",slug:"title-allowlist",label:"title-allowlist.md",key:"discovery_title_allowlist_md",description:"Allowed titles and persona priority."}]},{name:"Agents",slug:"agents",files:[{folder:"agents",slug:"discovery-agent-prompts",label:"discovery-agent-prompts.md",key:"discovery_agent_prompts_md",description:"Prompts for discovery and scoring agents."}]},{name:"Orchestrator",slug:"orchestrator",files:[{folder:"orchestrator",slug:"discovery-system-prompt",label:"discovery-system-prompt.md",key:"discovery_system_prompt_md",description:"Which discovery files load by stage."},{folder:"orchestrator",slug:"daily-budget",label:"daily-budget.md",key:"discovery_daily_budget_md",description:"Daily provider budgets and minimum score floors."}]}],Ue=ge.flatMap(t=>t.files),je=[...fe.map(t=>({...t,brainTab:"content"})),...$e.map(t=>({...t,brainTab:"outbound"})),...Ue.map(t=>({...t,brainTab:"discovery"}))],As={content:Me,signals:[],outbound:he,discovery:ge},qs={content:fe,signals:[],outbound:$e,discovery:Ue};function Kn(t,s){const n=t.files.filter(r=>s.has(r.key));return n.length?{...t,files:n}:null}function ke(t,s){const n=new Set(s);return t.map(r=>Kn(r,n)).filter(Boolean)}const Be=["outbound_sender_md","outbound_personas_md","outbound_segments_md","outbound_seq_linkedin_connect_md","outbound_seq_followup_md","outbound_objection_handlers_md","outbound_booking_flow_md","outbound_agent_prompts_md","outbound_compliance_md","outbound_system_prompt_md","discovery_sources_linkedin_
292sales_md"],Pe=["outbound_sender_md","outbound_personas_md","outbound_blacklist_md","outbound_segments_md","outbound_seq_cold_step1_md","outbound_seq_cold_step2_md","outbound_seq_followup_md","outbound_objection_handlers_md","outbound_booking_flow_md","outbound_agent_prompts_md","outbound_deliverability_md","outbound_compliance_md","outbound_system_prompt_md","discovery_sources_ocean_md","discovery_sources_exa_md","discovery_sources_reddit_md","discovery_sources_rb2b_md","discovery_lookalike_seeds_md","discovery_exclude_md","discovery_title_allowlist_md","discovery_agent_prompts_md","discovery_system_prompt_md","discovery_daily_budget_md"],Ls=[...ke(he,Be),...ke(ge,Be)],er=Ls.flatMap(t=>t.files),Rs=[...ke(he,Pe),...ke(ge,Pe)],sr=Rs.flatMap(t=>t.files),vs=new Set(["voice_md","founder_profile_md","core_beliefs_md","story_vault_md","icp_md","pains_and_desires_md","objections_md","swipe_file_md","quality_rubric_md","editorial_rules_md","offer_stack_md","cta_library_md","system_prompt_md","agent_prompts_md","research_sources_md","research_signal_scoring_md"]),ws=["Drafter","Scorer","QC","Briefer","Daily QC","ICP Matcher"],v=xs.default||xs,re={voice_md:`# voice.md
293
294Write as Vijay Jacob: direct, opinionated, operator-first, specific, no fluff. Use concrete proof and avoid generic AI hype.`,pov_md:`# pov.md
295
296Declare the operator point of view in 2-3 sentences. What do we believe that the market does not yet?`,proof_md:`# proof.md
297
298List named proof points: customers, results, case studies, and citations. One per line.`,founder_profile_md:`# founder-profile.md
299
300Founder: Vijay Jacob. Operator and founder of AEO Engine. Seed this with verified bio, credentials, and proof points.`,core_beliefs_md:`# core-beliefs.md
301
302- AI search rewards evidence, entity clarity, and third-party trust more than generic blog volume.
303- Good content engines score and revise before they publish.`,story_vault_md:`# story-vault.md
304
305Add tagged founder/customer/operator stories here.`,icp_md:`# icp.md
306
307Founders and operators who need measurable AI-search visibility and revenue impact.`,pains_and_desires_md:`# pains-and-desires.md
308
309Pains: invisible in answer engines, content that does not convert, unclear attribution. Desires: defensible visibility, cited answers, qualified pipeline.`,objections_md:`# objections.md
310
311- Is AEO just SEO renamed?
312- Can this produce revenue, not just impressions?
313- Will AI platforms cite a smaller brand?`,swipe_file_md:`# swipe-file.md
314
315Seed top performers here with why they worked. Auto-append stays off unless explicitly enabled.`,quality_rubric_md:`# quality-rubric.md
316
317Score each item 0-10 and convert to 0-1 overall. Kill anything below the user score floor.
318
319- Hook: specific, timely, non-generic.
320- Signal density: concrete data, named entities, proof, or pattern.
321- Specificity: no vague AI hype.
322- POV: clear operator opinion.
323- CTA: natural next step when appropriate.
324- Brand fit: AI search, AEO growth, visibility, citations, or revenue outcomes.`,editorial_rules_md:`# editorial-rules.md
325
326No em dashes. No generic AI hype. No hashtags by default. Use short paragraphs and concrete nouns.`,offer_stack_md:`# offer-stack.md
327
328Document services, lead magnets, offers, proof assets, and where posts may point.`,cta_library_md:`# cta-library.md
329
330- DM for audit
331- Comment for checklist
332- Book a strategy call
333- Read the teardown`,design_md:`# design.md
334
335Clean Google-inspired clarity. High contrast. Generous whitespace. Proof-first overlays. Mobile-readable. Use simple editorial graphics, data callouts, and no clutter.`,metrics_md:`# metrics.md
336
337Weekly: impressions, saves, comments, DMs, meetings booked, AI citation movement, assisted pipeline.`,system_prompt_md:`# system-prompt.md
338
339## Format: default
340files: voice, founder_profile, core_beliefs, icp, pains_and_desires, objections, offer_stack, cta_library
341
342## Format: viral_trend
343files: voice, core_beliefs, objections, swipe_file, quality_rubric, editorial_rules
344
345## Format: educational
346files: voice, founder_profile, pains_and_desires, offer_stack, cta_library, quality_rubric`,agent_prompts_md:`## Drafter
347You are Vijay Jacob's content drafter for AEO Engine. Return strict JSON with LinkedIn and X/Twitter drafts.
348
349RULES (violating any = hard fail):
3501. The post MUST be about the EXACT topic in the brief. Never substitute a different subject.
3512. Take the signal's specific insight and add AEO Engine's perspective/stance — do not write generic marketing fluff that c
351ould apply to any brand.
3523. Ground every claim in the brief's data_points or the signal's original source text.
3534. NEVER output template placeholders like [Client Name], [client result], [Company], [time period] — write real specifics from the source or omit.
3545. Self-check before outputting: Does this post address the signal's core topic, or did I drift into generic AEO advice?
3556. If the source is too thin or unrelated, return NO drafts rather than forcing generic content.
356
357## Scorer
358You are scoring incoming content signals for fit with the brand kit and quality rubric. Return strict JSON with score components and on_brand.
359
360## QC
361You are an adversarial QC text agent. Return strict JSON with score, faithfulness, voice_match, novelty, hook_strength, and feedback.
362
363## Briefer
364You are a Stage 1 content briefer. Return strict JSON only and stay source-grounded.
365
366## Daily QC
367You are the final Claude QC gate for daily social content. Be strict but practical. Return ONLY JSON.
368
369## ICP Matcher
370Given a content topic and a list of ICPs, determine which ICP the topic is most relevant to. Return ONLY valid JSON.`,research_sources_md:`# sources.md
371
372| name | url | active | fetch_frequency_min |
373| --- | --- | --- | --- |
374| AEO Engine Blog | https://aeoengine.ai/blog/rss.xml | true | 360 |`,research_creators_md:`# creators.md
375
376| name | linkedin_url | scrape_frequency_min | max_posts | active |
377| --- | --- | --- | --- | --- |
378| Vijay Jacob | https://www.linkedin.com/in/vijayjacob/ | 360 | 5 | true |`,research_signal_scoring_md:`# signal-scoring.md
379
380score_floor: 0.70
381freshness_decay: 0.15
382
383## weights
384novelty: 0.30
385data_density: 0.25
386source_authority: 0.25
387brand_fit: 0.20
388
389## source_multipliers
390rss: 1.00
391linkedin: 1.10
392reddit: 0.90`,research_daily_md:`# daily-research.md
393
394dedup_window_hours: 72
395
396## sources_active
397rss: true
398linkedin: true
399
400## daily_caps
401rss: 50
402linkedin: 40`,outbound_sender_md:v.outbound_sender_md||`# outbound-sender.md
403`,outbound_personas_md:v.outbound_personas_md||`# outbound-personas.md
404`,outbound_blacklist_md:v.outbound_blacklist_md||`# outbound-blacklist.md
405`,outbound_segments_md:v.outbound_segments_md||`# outbound-segments.md
406`,outbound_seq_cold_step1_md:v.outbound_seq_cold_step1_md||`# outbound-seq-cold-step1.md
407`,outbound_seq_cold_step2_md:v.outbound_seq_cold_step2_md||`# outbound-seq-cold-step2.md
408`,outbound_seq_linkedin_connect_md:v.outbound_seq_linkedin_connect_md||`# outbound-seq-linkedin-connect.md
409`,outbound_seq_followup_md:v.outbound_seq_followup_md||`# outbound-seq-followup.md
410`,outbound_objection_handlers_md:v.outbound_objection_handlers_md||`# outbound-objection-handlers.md
411`,outbound_booking_flow_md:v.outbound_booking_flow_md||`# outbound-booking-flow.md
412`,outbound_agent_prompts_md:v.outbound_agent_prompts_md||`# outbound-agent-prompts.md
413`,outbound_deliverability_md:v.outbound_deliverability_md||`# outbound-deliverability.md
414`,outbound_compliance_md:v.outbound_compliance_md||`# outbound-compliance.md
415`,outbound_system_prompt_md:v.outbound_system_prompt_md||`# outbound-system-prompt.md
416`,discovery_sources_ocean_md:v.discovery_sources_ocean_md||`# discovery-sources-ocean.md
417`,discovery_sources_exa_md:v.discovery_sources_exa_md||`# discovery-sources-exa.md
418`,discovery_sources_linkedin_sales_md:v.discovery_sources_linkedin_sales_md||`# discovery-sources-linkedin-sales.md
419`,discovery_sources_reddit_md:v.discovery_sources_reddit_md||`# discovery-sources-reddit.md
420`,discovery_sources_rb2b_md:v.discovery_sources_rb2b_md||`# rb2b.md
421
422RB2B website visitors are warm inbound intent signals. Promote identified visitors into Discovery with discovery_source=site_visitor and prioritize enrichment before cold outbound sources.
423`,discovery_lookalike_seeds_md:v.discovery_lookalike_seeds_md||`# discovery-lookalike-seeds.md
424`,discovery_exclude_md:v.discovery_exclude_md||`# discovery-exclude.md
425`,discovery_title_allowlist_md:v.discovery_title_allowlist_md||`# discovery-title-allowlist.md
426`,discovery_agent_prompts_md:v.discovery_agent_prompts_md||`# discovery-agent-prompts.md
427`,discovery_system_prompt_md:v.discovery_system_prompt_md||`# discovery-system-prompt.md
428`,discovery_daily_budget_md:v.discovery_daily_budget_md||`# discovery-daily-budget.md
429`};function Ds(t){const s=new Map,n=new Set;for(const r of t.split(/\r?\n/)){const a=r.match(/^##\s*(Drafter|Scorer|QC|Briefer|Daily QC|ICP Matcher)\s*$/i);if(!a)continue;const i=ws.find(u=>u.toLowerCase()===a[1].toLowerCase()),o=(s.get(i)||0)+1;s.set(i,o),o>1&&n.add(i)}return ws.map(r=>({title:r,present:s.has(r),duplicate:n.has(r)}))}function Ts(t){const s=new Set(["voice","founder_profile","core_beliefs","story_vault","icp","pains_and_desires","objections","swipe_file","quality_rubric","editorial_rules","offer_stack","cta_library","metrics","design"]);return[...t.matchAll(/files\s*:\s*([^\n]+)/gi)].flatMap(r=>r[1].split(",").map(a=>a.trim().replace(/-/g,"_")).filter(Boolean)).map(r=>({ref:r,valid:s.has(r)}))}function Fe(t,s){if({research_sources_md:["name","url"],research_creators_md:["name","linkedin_url"]}[t]){let r=!1;for(const[a,i]of s.replace(/\r\n/g,`
430`).split(`
431`).entries()){const o=a+1,u=i.trim();if(!u||u.startsWith("#")||!u.includes("|")||/^\|?\s*:?-{3,}/.test(u))continue;const p=u.split("|").map(d=>d.trim()).filter(Boolean);if(!r){r=!0;continue}if(t==="research_sources_md"&&!/^https?:\/\//i.test(p[1]||""))return{ok:!1,line:o,message:"source url must start with http(s)"};if(t==="research_creators_md"&&!/^https?:\/\/(www\.)?linkedin\.com\//i.test(p[1]||""))return{ok:!1,line:o,message:"linkedin_url must be a LinkedIn URL"};for(const[d,f]of t==="research_sources_md"?[[3,"frequency"]]:[[2,"scrape frequency"],[3,"max posts"]])if(p[d]&&(!Number.isInteger(Number(p[d]))||Number(p[d])<=0))return{ok:!1,line:o,message:`${f} must be a positive integer`}}}if(t==="research_signal_scoring_md"||t==="research_daily_md")for(const[r,a]of s.split(/\r?\n/).entries()){const i=a.trim();if(!i||i.startsWith("#"))continue;const o=i.match(/^[\w.-]+\s*:\s*(.+)$/);if(o&&o[1].trim()==="")return{ok:!1,line:r+1,message:"value is required"}}return{ok:!0}}function tr(){const t=window.location.pathname.split("/").filter(Boolean),s=t.findIndex(n=>n==="brain"||n==="brand-kit");if(s>=0&&t[s+1]&&t[s+2])return je.find(n=>n.folder===t[s+1]&&n.slug===t[s+2])}function nr(){const t=new URLSearchParams(window.location.search).get("tab");return t==="outbound"||t==="discovery"||t==="signals"||t==="content"?t:"content"}function rr(t,s){return`/dashboard/brain/${t.folder}/${t.slug}?tab=${s}`}function ve(t){return t.startsWith("research_")}function or(t){const s=(t==null?void 0:t.metadata)||{},n=[s.promptMdHashes,s.prompt_md_hashes,s.fileHashes,s.file_hashes],r=new Set;for(const a of n)Array.isArray(a)&&a.forEach(i=>{const o=typeof i=="string"?i:i==null?void 0:i.file;o&&r.add(`${o}.md`.replace(/\.md\.md$/,".md"))}),a&&typeof a=="object"&&!Array.isArray(a)&&Object.keys(a).forEach(i=>r.add(i.replace(/_md$/,"")+".md"));return[...r].slice(0,8)}function qe(t,s){const n=(t==null?void 0:t.raw_engagement)||{},r=(t==null?void 0:t.metadata)||{},a=n[s]??r[s]??r[`delta_${s}`];return typeof a=="number"?a:null}function Bs({title:t="Brain",description:s="Markdown files drive content, outbound, discovery, scoring, QC, visuals, and learning.",embedded:n=!1,initialTab:r,tabs:a,foldersByTab:i,filesByTab:o}={}){var ts,ns;const{user:u}=lt(),{effectiveUserId:p}=dt(),d=p||(u==null?void 0:u.id),f=m.useMemo(()=>a&&a.length?a:["content","signals","outbound","discovery"],[a]),E=m.useMemo(()=>({...As,...i||{}}),[i]),c=m.useMemo(()=>({...qs,...o||{}}),[o]),_=n?void 0:tr(),w=n?void 0:nr(),A=r||(_==null?void 0:_.brainTab)||(w&&f.includes(w)?w:f[0])||"content",U=_||((ts=c[A])==null?void 0:ts[0])||fe.find(l=>l.key==="voice_md"),[N,y]=m.useState(A),[j,G]=m.useState(re),[b,ie]=m.useState(U),[X,K]=m.useState(""),[z,Ge]=m.useState(!0),[V,ze]=m.useState(!0),[H,Ve]=m.useState(!0),[ae,He]=m.useState(.8),[le,Je]=m.useState(!1),[Ps,Qe]=m.useState(!0),[Fs,Ne]=m.useState(!1),[Ms,Ye]=m.useState(new Set),[P,Ws]=m.useState(null),[ee,$s]=m.useState(null),[Us,Se]=m.useState(!1),[Xe,Ze]=m.useState(!1),[O,Gs]=m.useState(null),[zs,Ke]=m.useState(!1),es=m.useRef(!1),Ce=m.useRef(null);m.useEffect(()=>{if(!u||!d)return;let l=!1;return(async()=>{Qe(!0);const h=Z,g=`${je.map(I=>I.key).join(",")},fathom_injection_enabled,is_active,linkedin_outbound_active,min_acceptable_score,swipe_file_auto_append`,{data:x,error:q}=await h.from("content_user_settings").select(g).eq("user_id",d).maybeSingle();q&&$.error(`Could not load brain: ${q.message}`);const S=x||{},{data:k,error:J}
431=await h.rpc("content_icp_markdown_get",{p_user_id:d});J&&$.error(`Could not load ICP: ${J.message}`);const F=k&&typeof k=="object"&&!Array.isArray(k)?String(k.icp_md||""):"",L=Object.fromEntries(je.map(I=>[I.key,I.key==="icp_md"?F||S[I.key]||re[I.key]:S[I.key]||re[I.key]])),de=We.filter(I=>ve(I.key)&&!S[I.key]);if(de.length)try{const[I,Oe]=await Promise.all([h.from("content_sources_rss").select("name,url,is_active").eq("user_id",d).limit(100),h.from("gtm_watch_lists").select("name,linkedin_url,scrape_frequency_hours,max_posts_per_scrape,is_active").eq("user_id",d).not("linkedin_url","is",null).limit(100)]);!S.research_sources_md&&Array.isArray(I.data)&&I.data.length&&(L.research_sources_md=["# sources.md","","| name | url | active | fetch_frequency_min |","| --- | --- | --- | --- |",...I.data.map(D=>`| ${D.name||"Source"} | ${D.url} | ${D.is_active!==!1} | 360 |`)].join(`
432`)),!S.research_creators_md&&Array.isArray(Oe.data)&&Oe.data.length&&(L.research_creators_md=["# creators.md","","| name | linkedin_url | scrape_frequency_min | max_posts | active |","| --- | --- | --- | --- | --- |",...Oe.data.map(D=>`| ${D.name||"Creator"} | ${D.linkedin_url} | ${(D.scrape_frequency_hours||6)*60} | ${D.max_posts_per_scrape||5} | ${D.is_active!==!1} |`)].join(`
433`));const nt=Object.fromEntries(de.map(D=>[D.key,L[D.key]]));await h.from("content_user_settings").upsert({user_id:d,...nt},{onConflict:"user_id"})}catch(I){console.warn("research backfill skipped",I)}l||(G(L),Ge(S.fathom_injection_enabled!==!1),ze(Is(S)),Ve(Os(S)),He(Number(S.min_acceptable_score||.8)),Je(S.swipe_file_auto_append===!0),es.current=!0,Qe(!1))})(),()=>{l=!0}},[u,d]),m.useEffect(()=>{if(!u||!d)return;const l=Z;Promise.all([l.from("content_posts").select("id,platform,status,content,scheduled_at,qc_score,metadata").eq("user_id",d).order("created_at",{ascending:!1}).limit(1).maybeSingle(),l.from("content_agent_logs").select("agent,metadata,created_at").eq("user_id",d).order("created_at",{ascending:!1}).limit(1).maybeSingle()]).then(([h,g])=>{if(!h.error&&h.data){const x=h.data,q=typeof x.scheduled_at=="string"?x.scheduled_at:null,S=x.metadata&&typeof x.metadata=="object"&&!Array.isArray(x.metadata)?x.metadata:null;Ws({id:String(x.id),platform:typeof x.platform=="string"?x.platform:null,status:typeof x.status=="string"?x.status:null,content:typeof x.content=="string"?x.content:null,scheduled_date:(q==null?void 0:q.slice(0,10))??null,scheduled_time:(q==null?void 0:q.slice(11,16))??null,performance_score:typeof x.qc_score=="number"?x.qc_score:null,metadata:S,raw_engagement:(S==null?void 0:S.raw_engagement)??null})}!g.error&&g.data&&$s(g.data)}).catch(()=>{})},[u,d]);const Vs=async(l=j,h=z,g=V,x=H,q=ae,S=le,k)=>{if(!d||!es.current)return;Ne(!0);const J=Z;let F=null;if(k==="icp_md")({error:F}=await J.rpc("sync_content_icp_markdown",{p_user_id:d,p_markdown:l.icp_md}));else if(k&&ve(k)){const L=Fe(k,l[k]);if(L.ok===!1){Ne(!1),$.error(`Couldn't parse line ${L.line}: ${L.message}`);return}({error:F}=await J.rpc("sync_research_markdown",{p_user_id:d,p_file_key:k,p_markdown:l[k]}))}else if(!k)({error:F}=await J.rpc("sync_linkedin_outbound_toggle",{p_user_id:d,p_enabled:x,p_fathom_injection_enabled:h,p_is_active:g,p_min_acceptable_score:q,p_swipe_file_auto_append:S}));else{const L={user_id:d,[k]:l[k],fathom_injection_enabled:h,is_active:g,linkedin_outbound_active:x,min_acceptable_score:q,swipe_file_auto_append:S};({error:F}=await J.from("content_user_settings").upsert(L,{onConflict:"user_id"}))}if(!F&&k)try{await J.from("content_user_settings_versions").insert({user_id:d,file_key:k,content:l[k]})}catch(L){console.warn("version insert skipped",L)}Ne(!1),k&&Ye(L=>{const de=new Set(L);return de.delete(k),de}),F?$.error(`Save failed: ${F.message}`):$.success(k&&ve(k)?"Research file synced":"Brain saved")},se=(l=j,h=z,g=V,x=H,q=ae,S=le,k)=>{Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(()=>Vs(l,h,g,x,q,S,k),900)},Ee=(l,h=N)=>{ie(l),n||window.history.replaceState(null,"",rr(l,h))},Hs=l=>{var g;const h=(g=c[l])==null?void 0:g[0];y(l),K(""),Se(!1),h?Ee(h,l):n||window.history.replaceState(null,"",`/dashboard/brain?tab=${l}`)},be=(l,h)=>{const g={...j,[l]:h};G(g),Ye(x=>new Set(x).add(l)),se(g,z,V,H,ae,le,l)},Js=async l=>be(b.key,l),Qs=()=>
433{const l=v[b.key];l&&window.confirm("Replace current content with the AEO Engine starter? Unsaved changes will be lost.")&&(be(b.key,l),$.success("Starter loaded into editor"))},Ys=async()=>{if(!u||!vs.has(b.key))return;Ze(!0);const{data:l,error:h}=await Z.functions.invoke("brain-test-run",{body:{user_id:d,file_key:b.key,draft_with_current:!0}});if(Ze(!1),h){$.error(`Test run failed: ${h.message}`);return}Gs(l||{}),Ke(!0)},Xs=E[N]||[],Ie=m.useMemo(()=>c[N]||[],[c,N]),Zs=m.useMemo(()=>Ie.filter(l=>`${l.folder} ${l.label}`.toLowerCase().includes(X.toLowerCase())),[Ie,X]),Ks=m.useMemo(()=>f.flatMap(l=>(c[l]||[]).map(h=>({tab:l,folder:h.folder,slug:h.slug,label:h.label,key:h.key,description:h.description}))),[f,c]),et=m.useMemo(()=>Ds(j.agent_prompts_md),[j.agent_prompts_md]),st=m.useMemo(()=>Ts(j.system_prompt_md),[j.system_prompt_md]),ss=m.useMemo(()=>or(ee),[ee]),tt=[{label:"Saves",value:qe(P,"saves")},{label:"Profile views",value:qe(P,"profile_views")},{label:"Booked calls",value:qe(P,"booked_calls")}];return!u||Ps?e.jsx("div",{className:"console-page flex min-h-screen items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-2 text-stone-500",children:[e.jsx(we,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"text-[13px]",children:"Loading Brain…"})]})}):e.jsxs("div",{className:n?"console-page flex flex-col gap-6":"console-page mx-auto flex max-w-[1500px] flex-col gap-6 p-6",children:[!n&&e.jsx(rn,{files:Ks,onSelect:l=>{y(l.tab),K(""),Ee(l,l.tab)}}),e.jsx(nn,{open:Us,onOpenChange:Se,userId:d??"",fileKey:b.key,currentContent:j[b.key],onRestore:Js}),e.jsx(Ns,{open:zs,onOpenChange:Ke,children:e.jsxs(Ss,{className:"sm:max-w-4xl",children:[e.jsxs(ht,{children:[e.jsx(gt,{children:"Brain test run"}),e.jsx(bt,{children:"Last published versus a draft using the current editor state."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(C,{variant:"secondary",children:["Score"," ",typeof(O==null?void 0:O.score)=="number"?Math.round(O.score*100)+"%":"—"]}),((O==null?void 0:O.files_used)||[]).map(l=>e.jsx(C,{variant:"outline",children:l},l))]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"Last published"}),e.jsx("div",{className:"min-h-[260px] whitespace-pre-wrap rounded border bg-muted/30 p-3 text-sm",children:(O==null?void 0:O.last_published)||"No published baseline returned."})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"With current settings"}),e.jsx("div",{className:"min-h-[260px] whitespace-pre-wrap rounded border bg-muted/30 p-3 text-sm",children:(O==null?void 0:O.with_current_settings)||(O==null?void 0:O.preview_text)||"No current-settings draft returned."})]})]})]})}),e.jsx(Lt,{kicker:"GTM Engine",title:t,meta:s,action:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 rounded border border-emerald-200 bg-emerald-50 px-2 py-0.5 font-mono text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:[N==="content"?"Content":N==="signals"?"Signals":N==="outbound"?"Outbound":"Discovery"," enabled"]}),Fs?e.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] uppercase tracking-wide text-stone-500",children:[e.jsx(we,{className:"h-3 w-3 animate-spin"}),"Saving"]}):e.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] uppercase tracking-wide text-stone-400",children:[e.jsx(Rt,{className:"h-3 w-3"}),"Saved"]})]})}),f.length>1?e.jsx("div",{children:e.jsx(Yt,{active:N,onChange:Hs})}):null,e.jsxs("div",{className:"console-surface flex flex-col gap-3 px-4 py-3 sm:flex-row sm:flex-wrap sm:items-center sm:gap-6",children:[e.jsx("span",{className:"text-console-label",children:"Engine controls"}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(ye,{id:"fathom-toggle",checked:z,onCheckedChange:l=>{Ge(l),se(j,l,V,H)}}),e.jsx(Y,{htmlFor:"fathom-toggle",className:"cursor-pointer text-[13px] font-medium text-stone-700",children:"Fathom always-on"})]}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(ye,{id:"content-engine-toggle",checked:V,onCheckedChange:l=>{ze(l),se(j,z,l,H)}}),e.jsx(Y,{htmlFor:"content-engine-toggle",className:"cursor-pointer text-[13px] font-medium text-stone-700",children:"Content Engine posting"})]}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(ye,{id:"linkedin-outboun
433d-toggle",checked:H,onCheckedChange:l=>{Ve(l),se(j,z,V,l)}}),e.jsx(Y,{htmlFor:"linkedin-outbound-toggle",className:"cursor-pointer text-[13px] font-medium text-stone-700",children:"LinkedIn Outbound"})]})]}),N==="signals"?e.jsx(Qt,{}):e.jsxs("div",{className:"grid gap-6 xl:grid-cols-[300px_minmax(0,1fr)_340px]",children:[e.jsxs(T,{className:"h-fit",children:[e.jsxs(M,{children:[e.jsx(W,{children:"Files"}),e.jsxs(Q,{children:[N==="outbound"?"Outbound brain source files.":N==="discovery"?"Discovery brain source files.":"Brain source files."," ","Green dot means unsaved local edit."]}),e.jsxs("div",{className:"relative",children:[e.jsx(ct,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(Le,{"aria-label":"Search brain files",className:"pl-8",value:X,onChange:l=>K(l.target.value),placeholder:"Search files..."})]})]}),e.jsx(B,{className:"space-y-4",children:Xs.map(l=>{const h=X?l.files.filter(g=>Zs.includes(g)):l.files;return h.length?e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs font-semibold uppercase text-muted-foreground",children:l.name}),h.map(g=>{var x;return e.jsxs("button",{className:`flex w-full items-center justify-between gap-2 rounded px-3 py-2 text-left font-mono text-sm ${b.key===g.key?"bg-primary text-primary-foreground":"hover:bg-muted"}`,onClick:()=>Ee(g),children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:"truncate",children:g.label}),g.leverage&&e.jsx(Wt,{className:"h-3 w-3 fill-current"}),Ms.has(g.key)&&e.jsx(Dt,{className:"h-2 w-2 fill-emerald-500 text-emerald-500"})]}),(x=g.usedBy)!=null&&x.length?e.jsxs(ut,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(C,{variant:b.key===g.key?"secondary":"outline",className:"h-5 shrink-0 px-1.5 text-[10px]",children:g.usedBy.length})}),e.jsxs(pt,{children:["Used by ",g.usedBy.join(", ")]})]}):null]},g.key)})]},l.slug):null})})]}),e.jsxs("div",{className:"space-y-6",children:[b.folder==="quality"&&N==="content"&&e.jsxs(T,{children:[e.jsxs(M,{children:[e.jsx(W,{children:"Quality controls"}),e.jsx(Q,{children:"Score floor is editable. Swipe auto-append remains off by default."})]}),e.jsxs(B,{className:"flex flex-wrap items-center gap-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(Y,{htmlFor:"min-score",children:"Minimum acceptable score"}),e.jsx(Le,{id:"min-score","aria-label":"Minimum acceptable score",type:"number",min:"0",max:"1",step:"0.01",value:ae,onChange:l=>{const h=Number(l.target.value);He(h),se(j,z,V,H,h,le)},className:"w-32"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Y,{htmlFor:"swipe-auto",children:"Swipe auto-append"}),e.jsx(ye,{id:"swipe-auto",checked:le,onCheckedChange:l=>{Je(l),se(j,z,V,H,ae,l)}})]})]})]}),N!=="content"&&Ie.every(l=>j[l.key]===re[l.key])&&e.jsx(T,{children:e.jsxs(B,{className:"py-4 text-sm text-muted-foreground",children:["No ",N," brain customized yet — click"," ",e.jsx("span",{className:"font-medium text-foreground",children:"Use AEO Engine starter"})," ","on any file to get going."]})}),e.jsxs(T,{children:[e.jsxs(M,{className:"flex flex-row items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(W,{className:"font-mono text-base",children:b.label}),e.jsx(Q,{children:b.description})]}),e.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[e.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>Se(!0),children:[e.jsx(Mt,{className:"mr-2 h-4 w-4"}),"History"]}),e.jsxs(oe,{variant:"outline",size:"sm",disabled:!v[b.key],onClick:Qs,children:[e.jsx(_t,{className:"mr-2 h-4 w-4"}),"Use AEO Engine starter"]}),e.jsxs(oe,{variant:"outline",size:"sm",disabled:!vs.has(b.key)||Xe,onClick:Ys,children:[Xe?e.jsx(we,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(Tt,{className:"mr-2 h-4 w-4"}),"Test this"]}),e.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>be(b.key,re[b.key]),children:[e.jsx(Cs,{className:"mr-2 h-4 w-4"}),"Reset to default"]})]})]}),e.jsx(B,{children:e.jsx(ft,{"aria-label":b.label,value:j[b.key],onChange:l=>be(b.key,l.target.value),className:"min-h-[600px] font-mono text-sm"})})]}),e.jsxs(T,{children:[e.jsxs(M,{children:[e.jsx(W,{children:"Validate all"}),e.jsx(Q,{children:"Parser checks for required agent sections, broken orchestrator file refs, and research table syntax."})]}),e.jsxs(B,{className:"grid gap-3 md:grid-cols-2",children:[et.map(l=>e.jsxs("div",{className:"flex items-center justify-between rounded border p-2",children:[e.jsx("span",{children:l.title}),l.duplicate?e.jsx(C,{variant:"destructive",children:"Duplicate"}):l.present?e.jsxs(C,{variant:"secondary",children:[e.jsx(Bt,{className:"mr-1 h-3 w-3"}),"OK"]}):e.jsx(C,{variant:"outline",children:"Default fallback"})]},l.title)),st.map(l=>e.jsxs("div",{className:"flex items-center justify-between rounded border p-2",children:[e.jsx("span",{className:"font-mono",children:l.ref}),l.valid?e.jsx(C,{variant:"secondary",children:"OK"}):e.jsx(C,{variant:"destructive",children:"Broken ref"})]},l.ref)),fe.filter(l=>ve(l.key)).map(l=>{const h=Fe(l.key,j[l.key]);return e.jsxs("div",{className:"flex items-center justify-between rounded border p-2",children:[e.jsx("span",{className:"font-mono",children:l.label}),h.ok===!0?e.jsx(C,{variant:"secondary",children:"OK"}):e.jsxs(C,{variant:"destructive",children:["Line ",h.line]})]},l.key)})]})]})]}),e.jsxs("aside",{className:"space-y-4",children:[e.jsxs(T,{children:[e.jsxs(M,{children:[e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(ks,{className:"h-4 w-4"}),"Next Post Preview"]}),e.jsx(Q,{children:"Latest content calendar draft for this user."})]}),e.jsx(B,{className:"space-y-3",children:P?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"secondary",children:P.platform||"content"}),e.jsx(C,{variant:"outline",children:P.status||"draft"}),typeof P.performance_score=="number"&&e.jsxs(C,{children:[Math.round(P.performance_score*100),"%"]})]}),e.jsx("p",{className:"line-clamp-6 whitespace-pre-wrap text-sm text-muted-foreground",children:P.content||"Draft content is not populated yet."}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(Pt,{className:"h-3.5 w-3.5"}),P.scheduled_date||"unscheduled"," ",P.scheduled_time||""]})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No content calendar draft yet."})})]}),e.jsxs(T,{children:[e.jsxs(M,{children:[e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(Ft,{className:"h-4 w-4"}),"7-day impact of ",b.label]}),e.jsx(Q,{children:"Shows live metrics when post engagement is available."})]}),e.jsx(B,{className:"grid grid-cols-3 gap-2",children:tt.map(l=>e.jsxs("div",{className:"rounded-lg border bg-muted/30 p-3 text-center",children:[e.jsx("div",{className:"text-lg font-semibold",children:l.value??"—"}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:l.label})]},l.label))})]}),e.jsxs(T,{children:[e.jsxs(M,{children:[e.jsx(W,{className:"text-base",children:"Files this draft used"}),e.jsx(Q,{children:ee!=null&&ee.agent?`Latest agent: ${ee.agent}`:"From latest content_agent_logs metadata."})]}),e.jsx(B,{className:"flex flex-wrap gap-2",children:ss.length?ss.map(l=>e.jsx(C,{variant:"outline",children:l},l)):e.jsx("span",{className:"text-sm text-muted-foreground",children:"No prompt hash file metadata recorded yet."})})]}),e.jsxs(T,{children:[e.jsxs(M,{children:[e.jsx(W,{className:"text-base",children:"Used by"}),e.jsx(Q,{children:"Agents and jobs that consume this file."})]}),e.jsxs(B,{className:"flex flex-wrap gap-2",children:[(b.usedBy||[]).map(l
433=>e.jsx(C,{variant:"secondary",children:l},l)),!((ns=b.usedBy)!=null&&ns.length)&&e.jsx("span",{className:"text-sm text-muted-foreground",children:"No direct consumer mapped yet."})]})]})]})]})]})}function ir(){return e.jsx(Bs,{})}const Ar=Object.freeze(Object.defineProperty({__proto__:null,ALL_BRAIN_FILES:je,BRAIN_FILES_BY_TAB:qs,BRAIN_FOLDERS_BY_TAB:As,BRAND_KIT_FILES:We,BRAND_KIT_FOLDERS:Me,BrainMarkdownWorkspace:Bs,COLD_EMAIL_BRAIN_FILES:sr,COLD_EMAIL_BRAIN_FOLDERS:Rs,COLD_EMAIL_BRAIN_KEYS:Pe,CONTENT_FILES:fe,DEFAULT_MARKDOWNS:re,DISCOVERY_FILES:Ue,DISCOVERY_FOLDERS:ge,LINKEDIN_BRAIN_FILES:er,LINKEDIN_BRAIN_FOLDERS:Ls,LINKEDIN_BRAIN_KEYS:Be,LINKEDIN_OUTBOUND_TRIGGER_NAMES:Xn,NON_LINKEDIN_OUTBOUND_TRIGGER_NAMES:Zn,OUTBOUND_FILES:$e,OUTBOUND_FOLDERS:he,default:ir,isContentEngineActive:Is,isLinkedInOutboundActive:Os,validatePromptSections:Ds,validateResearchMarkdown:Fe,validateSystemPromptRefs:Ts},Symbol.toStringTag,{value:"Module"}));export{Bs as B,Qt as G,qs as a,As as b,Ar as c};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.