PageSourceSearch

https://vettarasearch.com/assets/RepairPage-Vw_mJKwE.js

js vettarasearch.com collected 2026-09-24 14:56:52 UTC 13,910 bytes, 1 lines download raw bytes

1import{r as x,z as A,j as e,s as B,c as q}from"./index-D85-h3Cd.js";/* empty css                     */function k(r){const i=String(r||"").trim().toLowerCase();return i==="ok"||i==="healthy"||i==="completed"||i==="repaired"?"good":i==="warning"||i==="stale"?"warn":i==="failed"||i==="error"||i==="stopped"?"bad":"neutral"}function C(r){const i=String(r||"").trim().toLowerCase();return i==="ok"?"Healthy":i==="warning"?"Attention":i==="failed"?"Degraded":i==="repaired"?"Repaired":i==="skipped"?"Checked":String(r||"Loading").trim()||"Loading"}function F(r){return String(r?.title||r?.name||r?.roleTitle||"Search").trim()}function G(r){const i=r?.preflight&&typeof r.preflight=="object"?r.preflight:{};return i.briefConfig&&typeof i.briefConfig=="object"?i.briefConfig:i.brief_config&&typeof i.brief_config=="object"?i.brief_config:{}}function J(r){const i=G(r),a=i.ui_meta&&typeof i.ui_meta=="object"?i.ui_meta:{},t=r?.filters&&typeof r.filters=="object"?r.filters:{};return[i.session_source,i.sessionSource,i.source,i.origin,i.channel,a.session_source,a.sessionSource,a.source,a.origin,a.channel,a.mcp_session?"mcp":"",t.session_source,t.sessionSource,t.source,t.origin,t.channel,t?.mcp?.source].map(n=>String(n||"").trim().toLowerCase()).some(n=>n.includes("mcp")||n.includes("chatgpt")||n==="gpt")}function U(r){return String(r?.project_id||r?.projectId||"").trim()}function K(r){const i=r?.preflight&&typeof r.preflight=="object"?r.preflight:{},a=i.extracted&&typeof i.extracted=="object"?i.extracted:{};return String(r?.title||i.title||a.roleTitle||a.role_title||"Session").trim()}function Q(r=[],i=[]){const a=new Map;for(const t of Array.isArray(r)?r:[]){const c=String(t?.id||"").trim();c&&a.set(c,{...t,id:c,targetType:"project",isMcpSession:!!t?.isMcpSession,isAiSession:!!(t?.isAiSearchProject||t?.aiSearchSessionId)})}for(const t of Array.isArray(i)?i:[]){const c=String(t?.id||"").trim();if(!c)continue;const n=U(t),_=J(t);if(n&&a.has(n)){const d=a.get(n);a.set(n,{...d,sessionId:c,isMcpSession:!!(d.isMcpSession||_),isAiSession:!0});continue}const p=n||`ai-session:${c}`;a.has(p)||a.set(p,{id:p,title:K(t),sessionId:c,projectId:n,targetType:n?"project":"session",isSessionOnly:!n,isMcpSession:_,isAiSession:!0,updatedAt:t?.updated_at||t?.updatedAt||t?.created_at||"",createdAt:t?.created_at||t?.createdAt||""})}return Array.from(a.values()).sort((t,c)=>{const n=new Date(t.updatedAt||t.createdAt||0).getTime();return new Date(c.updatedAt||c.createdAt||0).getTime()-n})}function Y(){const[r,i]=x.useState([]),[a,t]=x.useState(""),[c,n]=x.useState(null),[_,p]=x.useState(!0),[d,g]=x.useState({loading:!1,message:"",actions:[],projects:[]});x.useEffect(()=>{let s=!0;async function l(){try{const[h,f,O]=await Promise.all([B.list(),q.listSessions({limit:100,timeout:12e3}).catch(()=>({data:{sessions:[]}})),A.getDiagnostics()]);if(!s)return;const v=Array.isArray(h?.data)?h.data:[],N=Array.isArray(f?.data?.sessions)?f.data.sessions:[];i(Q(v,N)),n(O?.data||null)}catch(h){if(!s)return;n({platform:{serviceStatus:"warning",generatedAt:new Date().toISOString()},error:h?.message||"Repair diagnostics could not be loaded."})}finally{s&&p(!1)}}return l(),()=>{s=!1}},[]),x.useEffect(()=>{let s=!0;p(!0);const l=String(a||"").startsWith("ai-session:")?"":a;return A.getDiagnostics(l).then(h=>{s&&n(h?.data||null)}).catch(h=>{s&&n(f=>({...f||{},error:h?.message||"Project diagnostics could not be loaded."}))}).finally(()=>{s&&p(!1)}),()=>{s=!1}},[a]);const m=c?.platform||{},j=c?.project||null,b=j?.project||null,I=Array.isArray(j?.issues)?j.issues:[],P=Array.isArray(j?.recommendations)?j.recommendations:[],y=j?.autoRepair||{},u=j?.aiSession||null,D=r.find(s=>String(s?.id||"").trim()===a)||null,S=D?.targetType==="session"?String(D?.sessionId||"").trim():"",M=Array.isArray(d.projects)?d.projects:[],w=M.slice(0,12),T=Math.max(0,M.length-w.length),L=Array.isArray(d.actions)?d.actions:[],R=L.slice(0,20),H=Math.max(0,L.length-R.length);async function $(){p(!0);try{const s=S?"":a,l=await A.getDiagnostics(s);n(l?.data||null)}catch(s){n(l=>({...l||{},error:s?.message||"Repair diagnostics could not be refreshed."}))}finally{p(!1)}}async function E(){const s=S?"session":a?"project":"workspace";g({loading:!0,message:"",actions:[],projects:[]});try{const l=await A.selfHeal({project_id:S?"":a,ai_session_id:S,scope:s,action:"auto"}),h=String(l?.data?.job_id||l?.data?.jobId||"").trim();if(!h){g({loading:!1,message:"Automated repair was queued.",actions:[],projects:[]});return}for(let f=0;f<160;f+=1){await new Promise(o=>window.setTimeout(o,1500));const v=(await B.getJobStatus(h))?.data||{},N=String(v.status||"").trim().toLowerCase(),W=String(v.progress?.message||"").trim();if(W&&g(o=>({...o,loading:N!=="completed"&&N!=="failed",message:W})),N==="completed"){const o=v.result||{};o.diagnostics&&n(s==="project"?z=>({...z||{},project:o.diagnostics?.project?o.diagnostics.project:o.diagnostics}):o.diagnostics),g({loading:!1,message:s==="session"?"Session repair completed.":s==="project"?"Search repair completed.":"Workspace repair completed.",actions:Array.isArray(o.actionsTaken)?o.actionsTaken:[],projects:Array.isArray(o.projects)?o.projects:[]}),s!=="session"&&await $();return}if(N==="failed"){g({loading:!1,message:String(v.error||"Automated repair failed.").trim(),actions:[],projects:[]});return}}g({loading:!1,message:"Repair is still running. Refresh diagnostics in a moment.",actions:[],projects:[]})}catch(l){g({loading:!1,message:l?.response?.data?.detail||l?.message||"Automated repair failed.",actions:[],projects:[]})}}return e.jsxs("div",{className:"rich-page repair-page",children:[e.jsx("section",{className:"rich-hero",children:e.jsxs("div",{className:"rich-hero__inner",children:[e.jsxs("div",{className:"rich-hero__left app-page-hero-copy",children:[e.jsx("h1",{className:"rich-hero__title app-page-hero-title",children:"Repair"}),e.jsx("p",{className:"rich-hero__subtitle app-page-hero-subtitle",children:"Diagnostics and automatic self-heal for stale shortlist counts, visible rows, linked AI or MCP session snapshots, and latest-run state. It refreshes stale session state and exposes quality gaps without pretending weak searches are fixed."})]}),e.jsxs("div",{className:"rich-hero__right",children:[e.jsxs("div",{className:"rich-hero__stats",children:[e.jsxs("div",{className:"rich-hero__stat",children:[e.jsx("span",{className:"rich-hero__stat-value",children:m.searchRunCount??"-"}),e.jsx("span",{className:"rich-hero__stat-label",children:"Runs"})]}),e.jsxs("div",{className:"rich-hero__stat",children:[e.jsx("span",{className:"rich-hero__stat-value",children:m.candidateRegistryCount??"-"}),e.jsx("span",{className:"rich-hero__stat-label",children:"Profiles"})]}),e.jsxs("div",{className:"rich-hero__stat",children:[e.jsx("span",{className:"rich-hero__stat-value",children:C(m.serviceStatus)}),e.jsx("span",{className:"rich-hero__stat-label",children:"Health"})]})]}),e.jsx("button",{type:"button",className:"rich-button rich-button--ghost",onClick:$,children:"Refresh"})]})]})}),e.jsxs("div",{className:"rich-content",children:[e.jsxs("section",{className:"rich-panel",children:[e.jsx("div",{className:"rich-panel__header",children:e.jsxs("div",{children:[e.jsx("h2",{children:"Repair workspace"}),e.jsx("p",{children:"Leave Platform overview selected to repair every accessible search, or choose one search or session for focused shortlist and session repair."})]})}),e.jsxs("div",{className:"rich-panel__body",children:[e.jsxs("div",{className:"rich-toolbar",children:[e.jsxs("label",{className:"rich-field",style:{minWidth:"min(100%, 340px)"},children:[e.jsx("span",{children:"Select search"}),e.jsxs("select",{value:a,onChange:s=>t(s.target.value),children:[e.jsx("option",{value:"",children:"Platform overview"}),r.map(s=>e.jsxs("option",{value:s.id,children:[F(s),s.isMcpSession?" - MCP Session":s.isAiSession?" - AI Session":""]},s.id))]})]}),e.jsx("div",{className:"rich-pill-row",children:e.jsx("button",{type:"button",className:"rich-button rich-button--primary",onClick:E,disabled:d.loading,children:d.loading?"Repairing...":S?"Run Session Self-Heal":a?"Run Search Self-Heal":"Run Workspace Self-Heal"})})]}),e.jsx("div",{className:"rich-note",children:"Repair refreshes latest-run pointers, visible shortlist caches, stale project counts, and linked AI or MCP session snapshots. It does not invent candidates, widen the brief, relax proof standards, or hide thin executive coverage."}),a&&y.available?e.jsxs("div",{className:`rich-callout rich-callout--${y.recommended?"good":"warn"}`,children:[e.jsx("strong",{children:y.recommended?"Repair recommended":"Repair available"}),e.jsx("span",{children:y.recommended?"The visible shortlist or linked session snapshot can be rebuilt safely from the latest completed run.":"This search or session can be repaired 
1if shortlist counts, visible state, or MCP snapshot metadata drift away from the latest completed run."})]}):null,d.message?e.jsxs("div",{className:`rich-callout rich-callout--${d.actions.length?"good":"warn"}`,children:[e.jsx("strong",{children:d.message}),R.length?e.jsxs("ul",{className:"rich-action-list",children:[R.map(s=>e.jsx("li",{children:s},s)),H?e.jsxs("li",{children:[H," more repair actions completed."]}):null]}):null,w.length?e.jsxs("div",{className:"rich-list",style:{marginTop:12},children:[w.map(s=>e.jsxs("article",{className:"rich-list-item",children:[e.jsxs("div",{className:"rich-toolbar",children:[e.jsx("strong",{children:s.name||s.projectId||s.project_id||"Search"}),e.jsx("span",{className:`rich-badge rich-badge--${k(s.status)}`,children:C(s.status)})]}),s.reason?e.jsx("span",{children:s.reason}):null]},s.projectId||s.project_id||s.name)),T?e.jsx("article",{className:"rich-list-item",children:e.jsxs("strong",{children:[T," more searches repaired or checked"]})}):null]}):null]}):null,_?e.jsx("div",{className:"rich-empty",children:"Diagnostics unavailable."}):e.jsxs("div",{className:"rich-grid rich-grid--2",children:[e.jsxs("div",{className:"rich-panel",children:[e.jsxs("div",{className:"rich-panel__header",children:[e.jsxs("div",{children:[e.jsx("h3",{children:"Platform snapshot"}),e.jsx("p",{children:"What the live service is reporting right now."})]}),e.jsx("span",{className:`rich-badge rich-badge--${k(m.serviceStatus)}`,children:C(m.serviceStatus)})]}),e.jsxs("div",{className:"rich-panel__body",children:[e.jsxs("div",{className:"rich-kpis",children:[e.jsxs("article",{className:"rich-kpi",children:[e.jsx("span",{className:"rich-kpi__value",children:m.searchRunCount??"-"}),e.jsx("span",{className:"rich-kpi__label",children:"Completed runs"})]}),e.jsxs("article",{className:"rich-kpi",children:[e.jsx("span",{className:"rich-kpi__value",children:m.candidateRegistryCount??"-"}),e.jsx("span",{className:"rich-kpi__label",children:"Indexed profiles"})]}),e.jsxs("article",{className:"rich-kpi",children:[e.jsx("span",{className:"rich-kpi__value",children:m.generatedAt?new Date(m.generatedAt).toLocaleString():"-"}),e.jsx("span",{className:"rich-kpi__label",children:"Generated"})]})]}),c?.error?e.jsx("div",{className:"rich-callout rich-callout--bad",children:c.error}):null]})]}),e.jsxs("div",{className:"rich-panel",children:[e.jsx("div",{className:"rich-panel__header",children:e.jsxs("div",{children:[e.jsx("h3",{children:"Selected search"}),e.jsx("p",{children:b?"Live search state and shortlist readiness.":"Choose a search to inspect its current shortlist state."})]})}),e.jsx("div",{className:"rich-panel__body",children:b?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rich-pill-row",children:[e.jsx("span",{className:"rich-pill",children:b.roleTitle||"Role title not saved yet"}),e.jsxs("span",{className:"rich-pill",children:[b.visibleCount," visible"]}),e.jsxs("span",{className:"rich-pill",children:[b.approvedCount," approved"]}),e.jsxs("span",{className:"rich-pill",children:[b.verifiedCount," verified"]})]}),I.length?e.jsx("div",{className:"rich-list",children:I.map(s=>e.jsxs("article",{className:"rich-list-item",children:[e.jsxs("div",{className:"rich-toolbar",children:[e.jsx("strong",{children:s.label}),e.jsx("span",{className:`rich-badge rich-badge--${k(s.severity)}`,children:s.repairable?"Repairable":"Review"})]}),e.jsx("span",{children:s.detail})]},s.code))}):e.jsx("div",{className:"rich-empty",children:"No project-level issues were flagged for this search."}),P.length?e.jsx("div",{className:"rich-list",children:P.map(s=>e.jsxs("article",{className:"rich-list-item",children:[e.jsx("strong",{children:s.label}),e.jsx("span",{children:s.detail})]},s.code))}):null,u?.id?e.jsx("div",{className:"rich-list",children:e.jsxs("article",{className:"rich-list-item",children:[e.jsxs("div",{className:"rich-toolbar",children:[e.jsx("strong",{children:u.isMcpSession?"Linked MCP session":"Linked AI session"}),e.jsx("span",{className:`rich-badge rich-badge--${u.repairable?"warn":"good"}`,children:u.repairable?"Needs refresh":"Aligned"})]}),e.jsx("span",{children:u.title||u.id}),u.summary?e.jsx("span",{children:u.summary}):null]})}):null]}):e.jsx("div",{className:"rich-empty",children:"Choose a search to inspect stale counts, shortlist consistency, and safe repair options."})})]})]})]})]}),e.jsxs("section",{className:"rich-panel",children:[e.jsx("div",{className:"rich-panel__header",children:e.jsxs("div",{children:[e.jsx("h2",{children:"Need human help?"}),e.jsx("p",{children:"Repair is now for diagnostics and self-heal only. Use Help & Support for human review and issue reporting."})]})}),e.jsx("div",{className:"rich-panel__body",children:e.jsxs("div",{className:"rich-pill-row",children:[e.jsx("a",{href:"/searches",className:"rich-link-button rich-link-button--primary",children:"Open Searches"}),e.jsx("a",{href:"/help",className:"rich-link-button",children:"Open Help & Support"}),e.jsx("a",{href:"/settings",className:"rich-link-button",children:"Open Settings"})]})})]})]})]})}export{Y as default};

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.