1import{j as e}from"./app-C1iegf7Q.js";import{b as u,H as h,f as m}from"./inertia-BpyZy4w-.js";import{B as o}from"./badge-B51Owt1e.js";import{B as x}from"./button-BE4q1_FS.js";import{a as j}from"./admin-layout-BhXWbUlP.js";import{D as b}from"./database-D9VIgS0m.js";import{R as y}from"./refresh-cw-Cog2DILh.js";import{S as f}from"./sparkles-C0aC1RHI.js";/* empty css */import"./utils-BiuKVCuu.js";import"./index-CGXdj8xB.js";import"./app-logo-Dz0wogSq.js";import"./logo-light-DU4bWymm.js";import"./flash-toast-C6O0iVL1.js";import"./createLucideIcon-wqc1LSWg.js";import"./info-D2ZN_yLm.js";import"./triangle-alert-C7AVwNi-.js";import"./circle-x-Bp6Mbpgt.js";import"./circle-check-BMWvzPMx.js";import"./x-DQSeRCcH.js";import"./arrow-left-DCX0fhKH.js";import"./menu-BR3Nc3Gr.js";import"./users-BCcupCXV.js";import"./folder-open-I72SPUVk.js";import"./pound-sterling-D16GLaAZ.js";import"./book-open-DVFlG_9t.js";function N(a){if(!a)return"never";const i=new Date(a).getTime(),s=Math.round((Date.now()-i)/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const r=Math.round(s/60);return r<24?`${r}h ago`:`${Math.round(r/24)}d ago`}function q({corpora:a}){const[i,s]=u.useState(null),r=t=>`${t.journey}/${t.body}/${t.version_label}`,p=t=>{const n=r(t);s(`reindex:${n}`),m.post("/admin/corpus/reindex",{journey:t.journey,body:t.body,version_label:t.version_label,activate:!0},{preserveScroll:!0,onFinish:()=>s(null)})},c=t=>{const n=r(t);s(`templates:${n}`),m.post("/admin/corpus/generate-templates",{journey:t.journey,body:t.body,version_label:t.version_label},{preserveScroll:!0,onFinish:()=>s(null)})};return e.jsxs(j,{children:[e.jsx(h,{title:"Agent Corpus"}),e.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-6",children:[e.jsxs("div",{className:"mb-6 flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5 flex h-9 w-9 items-center justify-center rounded-card bg-bg-2 text-ink-2",children:e.jsx(b,{className:"h-4.5 w-4.5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"font-serif text-xl text-ink",children:"Agent corpus"}),e.jsx("p",{className:"mt-1 text-sm text-ink-3",children:"Every corpus version on disk. Reindex a version to re-embed its criteria, evidence types, and guidance after you edit the YAML. Reindexing also makes that version active for its body. The work runs in the background."})]})]}),e.jsx("div",{className:"overflow-x-auto rounded-card border border-line",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-line bg-bg-2 text-left text-2xs uppercase tracking-eyebrow text-ink-3",children:[e.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Journey"}),e.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Body"}),e.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Version"}),e.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Status"}),e.jsx("th",{className:"px-4 py-2.5 text-right font-medium",children:"Embeddings"}),e.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Templates"}),e.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Last indexed"}),e.jsx("th",{className:"px-4 py-2.5"})]})}),e.jsxs("tbody",{children:[a.map(t=>{const n=r(t),l=i===`reindex:${n}`,d=i===`templates:${n}`;return e.jsxs("tr",{className:"border-b border-line last:border-0",children:[e.jsx("td",{className:"px-4 py-2.5 text-ink",children:t.journey}),e.jsx("td",{className:"px-4 py-2.5 text-ink-2",children:t.body}),e.jsx("td",{className:"whitespace-nowrap px-4 py-2.5 font-mono text-xs text-ink-2",children:t.version_label}),e.jsx("td",{className:"px-4 py-2.5",children:t.is_active?e.jsx(o,{className:"bg-green/12 text-green-ink",children:"Active"}):t.embeddings>0?e.jsx(o,{className:"bg-bg-2 text-ink-3",children:"Indexed"}):e.jsx(o,{className:"bg-amber/12 text-amber-ink",children:"Not indexed"})}),e.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-ink-2",children:t.embeddings}),e.jsx("td",{className:"px-4 py-2.5 text-ink-2",children:t.templates_total>0?e.jsxs("span",{className:"inline-flex items-center gap-1.5 tabular-nums",children:[t.templates_total,t.templates_drafts>0&&e.jsxs(o,{className:"bg-amber/12 text-amber-ink",children:[t.templates_drafts," draft",t.templates_drafts===1?"":"s"]})]}):e.jsx("span",{className:"text-ink-3",children:"none"})}),e.jsx("td",{className:"whitespace-nowrap px-4 py-2.5 text-ink-3",children:N(t.imported_at)}),e.jsx("td",{className:"whitespace-nowrap px-4 py-2.5",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsxs(x,{size:"sm",variant:"outline",disabled:l,onClick:()=>p(t),children:[e.jsx(y,{className:`h-3.5 w-3.5 ${l?"animate-spin":""}`}),l?"Queuing":"Reindex"]}),e.jsxs(x,{size:"sm",variant:"outline",disabled:d,onClick:()=>c(t),children:[e.jsx(f,{className:`h-3.5 w-3.5 ${d?"animate-pulse":""}`}),d?"Queuing":"Generate"]})]})})]},n)}),a.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-4 py-8 text-center text-sm text-ink-3",children:"No corpus versions foun
1d on disk."})})]})]})})]})]})}export{q 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.