@akasecurity/cli 0.9.10 → 0.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- package/dist/cli.js +1466 -766
- package/extension/manifest.json +1 -1
- package/native-host/host.js +756 -528
- package/native-host/scan-worker.js +153 -58
- package/native-host/sync.js +284 -103
- package/package.json +5 -5
- package/web-ui/package.json +1 -1
- package/web-ui/web-ui/.next/BUILD_ID +1 -1
- package/web-ui/web-ui/.next/app-build-manifest.json +64 -64
- package/web-ui/web-ui/.next/app-path-routes-manifest.json +5 -5
- package/web-ui/web-ui/.next/build-manifest.json +2 -2
- package/web-ui/web-ui/.next/prerender-manifest.json +14 -14
- package/web-ui/web-ui/.next/server/app/(app)/activity/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/activity/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/activity/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/data-shares/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/data-shares/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/data-shares/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/detections/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/detections/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/detections/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/exceptions/[id]/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/exceptions/[id]/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/exceptions/[id]/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/exceptions/new/page.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/exceptions/new/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/exceptions/new/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/exceptions/page.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/exceptions/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/exceptions/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/findings/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/findings/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/findings/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/inventory/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/inventory/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/inventory/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/policies/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/policies/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/policies/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/scan/page.js +3 -3
- package/web-ui/web-ui/.next/server/app/(app)/scan/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/scan/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/security/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/security/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/security/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/settings/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/settings/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/settings/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/updates/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/updates/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/updates/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/vault/page.js +2 -2
- package/web-ui/web-ui/.next/server/app/(app)/vault/page.js.nft.json +1 -1
- package/web-ui/web-ui/.next/server/app/(app)/vault/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app/_not-found.html +1 -1
- package/web-ui/web-ui/.next/server/app/_not-found.rsc +2 -2
- package/web-ui/web-ui/.next/server/app/index.html +1 -1
- package/web-ui/web-ui/.next/server/app/index.rsc +2 -2
- package/web-ui/web-ui/.next/server/app/page_client-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/app-paths-manifest.json +5 -5
- package/web-ui/web-ui/.next/server/chunks/471.js +950 -0
- package/web-ui/web-ui/.next/server/chunks/475.js +1 -1
- package/web-ui/web-ui/.next/server/chunks/7.js +1 -1
- package/web-ui/web-ui/.next/server/chunks/739.js +1 -0
- package/web-ui/web-ui/.next/server/chunks/766.js +6 -0
- package/web-ui/web-ui/.next/server/chunks/851.js +1 -1
- package/web-ui/web-ui/.next/server/chunks/905.js +959 -0
- package/web-ui/web-ui/.next/server/functions-config-manifest.json +5 -5
- package/web-ui/web-ui/.next/server/middleware-manifest.json +5 -5
- package/web-ui/web-ui/.next/server/pages/404.html +1 -1
- package/web-ui/web-ui/.next/server/pages/500.html +1 -1
- package/web-ui/web-ui/.next/server/server-reference-manifest.js +1 -1
- package/web-ui/web-ui/.next/server/server-reference-manifest.json +1 -1
- package/web-ui/web-ui/.next/static/chunks/907-2ba9428e7818b656.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/activity/page-c5a55618d187c906.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/data-shares/page-b1c76b8c00e1ae2a.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/detections/page-159167b47a005b33.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/error-dead9507fc349f26.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/[id]/page-5e872a82af85ef64.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/new/page-0695d0006518b2cb.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/page-adec99f2f4bbc180.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/findings/page-d013384d2ddb3036.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/inventory/page-42c1b48a01fdecb0.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/layout-dc7ae7664dcdc3c5.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/policies/page-9b6d7cc4ce9fb33e.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/scan/page-f3ee9ecde06df153.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/security/page-24a003c709776317.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/settings/page-4ea49ce2e765fffb.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/updates/page-6c7b94b070de8986.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/vault/page-f37ab8e1edc67663.js +1 -0
- package/web-ui/web-ui/.next/static/css/c6954dd65f2115e6.css +2 -0
- package/web-ui/web-ui/dist/scan-worker.js +153 -58
- package/web-ui/web-ui/.next/server/chunks/389.js +0 -903
- package/web-ui/web-ui/.next/server/chunks/667.js +0 -894
- package/web-ui/web-ui/.next/server/chunks/950.js +0 -6
- package/web-ui/web-ui/.next/static/chunks/907-207847c57011ba44.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/activity/page-e4f94a75c631ce86.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/data-shares/page-d70fcc5612f380b7.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/detections/page-e1823ce15bb6277d.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/error-14165283b00c8626.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/[id]/page-0fcffe4b9dff201f.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/new/page-c95079a2acd284fd.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/page-4b9f034bd078f5d3.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/findings/page-b97fc083884ef341.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/inventory/page-e96e7e947ed5f279.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/layout-83072d434c6b6b0e.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/policies/page-b90748d139a546c9.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/scan/page-7a46abe149271870.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/security/page-f4a1ee202d6e60a4.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/settings/page-2ec6d863f1a31792.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/updates/page-b388003fb0d3efd1.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/vault/page-6bda74d234a1376a.js +0 -1
- package/web-ui/web-ui/.next/static/css/81a7ed955b02c959.css +0 -2
- /package/web-ui/web-ui/.next/static/{k7tk0MLkPITbi_x6JL01X → osEmGZG6yEV-XkQlklt-B}/_buildManifest.js +0 -0
- /package/web-ui/web-ui/.next/static/{k7tk0MLkPITbi_x6JL01X → osEmGZG6yEV-XkQlklt-B}/_ssgManifest.js +0 -0
|
@@ -1,894 +0,0 @@
|
|
|
1
|
-
exports.id=667,exports.ids=[667],exports.modules={60:()=>{},4022:(a,b,c)=>{Promise.resolve().then(c.bind(c,60692))},4543:(a,b,c)=>{"use strict";c.d(b,{$F:()=>j,Ai:()=>k,Jk:()=>m,Zp:()=>l});var d=c(15008),e=c(71378),f=c(16820),g=c(65366),h=c(87038);function i({tone:a,icon:b,children:c,className:f}){let[g,h]=(0,e.vV)(a);return(0,d.jsxs)("span",{className:"inline-flex h-[22px] items-center gap-1.5 whitespace-nowrap rounded-full px-2 text-xs font-semibold "+(f??""),style:{color:g,background:h},children:[b&&(0,d.jsx)(b,{"aria-hidden":!0,focusable:!1,className:"size-3"}),c]})}function j({policy:a,floor:b}){let c=(0,h.N2)(a,b),i=(0,h.H1)(a,b),j=(0,g.ES)(c),[k,l]=(0,e.vV)(j.tone),m=j.icon,n=i&&b?(0,h.xf)(b):void 0;return(0,d.jsxs)("span",{className:"inline-flex h-5 items-center gap-1.5 whitespace-nowrap rounded-full px-2 text-xs font-semibold",style:{color:k,background:l},title:n,children:[(0,d.jsx)(m,{"aria-hidden":!0,focusable:!1,className:"size-3"}),j.label,void 0!==n&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.ai,{"aria-hidden":!0,focusable:!1,className:"size-3"}),(0,d.jsx)("span",{className:"sr-only",children:n})]})]})}function k({origin:a}){let b=g.H9[a];return(0,d.jsx)(i,{tone:b.tone,icon:b.icon,children:b.label})}function l({version:a}){return(0,d.jsxs)("span",{className:"inline-flex h-6 items-center gap-1.5 whitespace-nowrap rounded-full bg-sev-high-fill px-2 text-xs font-semibold text-sev-high-ink",children:[(0,d.jsx)(f.Kp,{"aria-hidden":!0,focusable:!1,className:"size-3"}),a?"Update \xb7 v"+a:"Update"]})}function m({publisher:a,kind:b}){let c=g.jP[b],[f]=(0,e.vV)(c.tone),h=c.icon;return(0,d.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-xs font-semibold text-text-2",children:[(0,d.jsx)(h,{"aria-hidden":!0,focusable:!1,className:"size-3.5 shrink-0",style:{color:f}}),(0,d.jsx)("span",{className:"truncate",title:a,children:a}),c.verified&&(0,d.jsx)("span",{title:c.label,className:"text-[10px] font-bold",style:{color:f},children:"✓"})]})}},5265:(a,b,c)=>{"use strict";c.d(b,{K:()=>f});let d=new Intl.RelativeTimeFormat("en",{numeric:"auto"}),e=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60]];function f(a,b){if(!a)return"";let c=Date.parse(a);if(Number.isNaN(c))return"";let f=(c-b)/1e3,g=Math.abs(f);if(g<45)return"just now";for(let[a,b]of e)if(g>=b)return d.format(Math.round(f/b),a);return"just now"}},5475:(a,b,c)=>{"use strict";c.r(b),c.d(b,{AreaChart:()=>p,Donut:()=>l,Sparkline:()=>m,useMeasuredWidth:()=>o});var d=c(15008),e=c(92998),f=c(87333),g=c(57351),h=c(93630),i=c(66632),j=c(1505),k=c(60004);function l({segments:a,size:b=120,thickness:c=16,children:g}){let h=b/2,i=(0,e.A)().value(a=>a.value).sort(null)(a),j=(0,f.A)().innerRadius(h-c).outerRadius(h);return(0,d.jsxs)("div",{className:"relative shrink-0",style:{width:b,height:b},children:[(0,d.jsx)("div",{"aria-hidden":!0,children:(0,d.jsx)("svg",{width:b,height:b,children:(0,d.jsx)("g",{transform:`translate(${String(h)},${String(h)})`,children:i.map(a=>(0,d.jsx)("path",{d:j(a)??void 0,fill:a.data.color,stroke:"none"},a.data.label))})})}),g&&(0,d.jsx)("div",{className:"absolute inset-0 grid place-items-center text-center",children:g})]})}function m({data:a,color:b,height:c=34,fill:e=!0,strokeWidth:f=2,labels:l,formatValue:m}){let n=`spark-${(0,j.useId)().replace(/:/g,"")}`,[o,p]=(0,j.useState)(null),q=Math.max(...a),r=Math.min(...a),s=q-r||1,t=b=>a.length<=1?50:2+b/(a.length-1)*96,u=a=>c-2-(a-r)/s*(c-4),v=a.map((a,b)=>[t(b),u(a)]),w=(0,g.A)().x(a=>a[0]).y(a=>a[1]).curve(h.G)(v)??void 0,x=(0,i.A)().x(a=>a[0]).y0(c).y1(a=>a[1]).curve(h.G)(v)??void 0,y=(0,d.jsxs)("svg",{"aria-hidden":!0,width:"100%",height:c,viewBox:`0 0 ${String(100)} ${String(c)}`,preserveAspectRatio:"none",className:"block",children:[e&&(0,d.jsx)("defs",{children:(0,d.jsxs)("linearGradient",{id:n,x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,d.jsx)("stop",{offset:"0%",stopColor:b,stopOpacity:.18}),(0,d.jsx)("stop",{offset:"100%",stopColor:b,stopOpacity:0})]})}),e&&(0,d.jsx)("path",{d:x,fill:`url(#${n})`,stroke:"none"}),(0,d.jsx)("path",{d:w,fill:"none",stroke:b,strokeWidth:f,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"})]});if(!(l?.length===a.length&&a.length>0))return y;let z=null===o?void 0:a[o],A=null===o?void 0:l[o];return(0,d.jsxs)("div",{"aria-hidden":!0,className:"relative",onMouseMove:b=>{let c=b.currentTarget.getBoundingClientRect();if(0===c.width)return;let d=(b.clientX-c.left)/c.width*100,e=a.length<=1?0:Math.round((d-2)/96*(a.length-1));p(Math.min(a.length-1,Math.max(0,e)))},onMouseLeave:()=>{p(null)},children:[y,null!==o&&void 0!==z&&void 0!==A&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"pointer-events-none absolute size-2 -translate-x-1/2 -translate-y-1/2 rounded-full border border-surface/80",style:{left:`${String(t(o)/100*100)}%`,top:u(z),background:b}}),(0,d.jsxs)("div",{className:"pointer-events-none absolute z-10 -translate-x-1/2 whitespace-nowrap",style:{left:`clamp(36px, ${String(t(o)/100*100)}%, calc(100% - 36px))`,bottom:c+6,borderRadius:8,border:`1px solid ${k.l.border}`,background:k.l.surface,padding:"4px 8px",fontSize:12,boxShadow:"0 4px 12px rgb(0 0 0 / 0.08)"},children:[(0,d.jsx)("div",{style:{color:k.l.text3,fontSize:11},children:A}),(0,d.jsx)("div",{className:"font-semibold",style:{color:k.l.text2},children:(m??String)(z)})]})]})]})}let n={top:6,right:6,bottom:0,left:6};function o(){let a=(0,j.useRef)(null),[b,c]=(0,j.useState)(0);return[a,b]}function p({data:a,series:b,height:c=160,valueFormat:e=a=>String(a)}){let f=(0,j.useId)().replace(/:/g,""),[l,m]=o(),[p,q]=(0,j.useState)(null),r=Math.max(0,m-n.left-n.right),s=Math.max(0,c-n.top-n.bottom),t=[];for(let c of a)for(let a of b){let b=c[a.key];"number"==typeof b&&t.push(b)}let u=Math.max(1,...t),v=b=>a.length<=1?0:b/(a.length-1)*r,w=a=>s-a/u*s,x=null===p?null:a[p];return(0,d.jsxs)("div",{ref:l,"aria-hidden":!0,className:"relative",style:{height:c},children:[m>0&&(0,d.jsxs)("svg",{width:m,height:c,onMouseMove:function(b){if(!l.current||0===a.length)return;let c=l.current.getBoundingClientRect(),d=b.clientX-c.left-n.left,e=a.length<=1?0:r/(a.length-1),f=0===e?0:Math.round(d/e);q(Math.min(a.length-1,Math.max(0,f)))},onMouseLeave:()=>{q(null)},children:[(0,d.jsx)("defs",{children:b.map(a=>(0,d.jsxs)("linearGradient",{id:`${f}-${a.key}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,d.jsx)("stop",{offset:"0%",stopColor:a.color,stopOpacity:.16}),(0,d.jsx)("stop",{offset:"100%",stopColor:a.color,stopOpacity:0})]},a.key))}),(0,d.jsxs)("g",{transform:`translate(${String(n.left)},${String(n.top)})`,children:[[0,.25,.5,.75,1].map(a=>(0,d.jsx)("line",{x1:0,x2:r,y1:s*a,y2:s*a,stroke:k.l.border,strokeOpacity:.6},a)),b.map(b=>{let c=(0,i.A)().defined(a=>null!==a[b.key]).x((a,b)=>v(b)).y0(w(0)).y1(a=>w(a[b.key]??0)).curve(h.G)(a)??void 0,e=(0,g.A)().defined(a=>null!==a[b.key]).x((a,b)=>v(b)).y(a=>w(a[b.key]??0)).curve(h.G)(a)??void 0;return(0,d.jsxs)("g",{children:[(0,d.jsx)("path",{d:c,fill:`url(#${f}-${b.key})`,stroke:"none"}),(0,d.jsx)("path",{d:e,fill:"none",stroke:b.color,strokeWidth:2})]},b.key)}),x&&null!==p&&(0,d.jsxs)("g",{children:[(0,d.jsx)("line",{x1:v(p),x2:v(p),y1:0,y2:s,stroke:k.l.border}),b.map(a=>{let b=x[a.key];return null===b?null:(0,d.jsx)("circle",{cx:v(p),cy:w(b),r:3,fill:a.color},a.key)})]})]})]}),x&&null!==p&&(0,d.jsxs)("div",{className:"pointer-events-none absolute top-0 -translate-x-1/2",style:{left:Math.min(m-60,Math.max(60,n.left+v(p))),borderRadius:8,border:`1px solid ${k.l.border}`,background:k.l.surface,padding:"6px 8px",fontSize:12,boxShadow:"0 4px 12px rgb(0 0 0 / 0.08)"},children:[(0,d.jsx)("div",{style:{color:k.l.text3,fontSize:11,marginBottom:4},children:x.label}),b.map(a=>{let b=x[a.key];return null===b?null:(0,d.jsxs)("div",{className:"flex items-center gap-1.5",style:{color:k.l.text2},children:[(0,d.jsx)("span",{className:"size-2 rounded-xs",style:{background:a.color,display:"inline-block"}}),(0,d.jsx)("span",{className:"font-semibold",children:e(b,a.key)})]},a.key)})]})]})}},6824:(a,b,c)=>{"use strict";c.d(b,{ExceptionDetailView:()=>k});var d=c(15008),e=c(71378),f=c(1505),g=c(5265),h=c(76836),i=c(18389),j=c(77292);function k({exception:a,onRevoke:b,busy:c,error:k,renderedAt:l}){let[m,n]=(0,f.useState)(""),o=(0,j.rO)(a,l);return(0,d.jsxs)("div",{className:"flex flex-col gap-6 rounded-xl border border-border bg-surface p-5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("span",{className:"font-mono text-sm font-semibold text-text",children:a.id.slice(0,8)}),(0,d.jsx)(i.StateTagFor,{exception:a,now:l}),(0,d.jsx)(i._,{exception:a})]}),"reveal_to_model"===a.capability&&(0,d.jsxs)("div",{className:"rounded-lg border border-sev-critical-fill bg-sev-critical-fill p-3",children:[(0,d.jsx)(h.e,{className:"text-sev-critical-ink",children:"Reveal to model"}),(0,d.jsx)("p",{className:"text-sm text-text-2",children:"While this grant is active, the model can receive this value's raw form at tool boundaries. Every crossing is audited in the vault's de-reference trail."})]}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-x-6 gap-y-4 md:grid-cols-3",children:[(0,d.jsx)(h.p,{label:"Rule",children:(0,d.jsx)("span",{className:"font-mono text-xs",children:a.ruleId})}),(0,d.jsx)(h.p,{label:"Category",children:a.category}),(0,d.jsx)(h.p,{label:"Approved value",children:(0,d.jsx)("span",{className:"font-mono text-xs",children:a.maskedValue})}),(0,d.jsxs)(h.p,{label:"Scope",children:[j.yr[a.scope],"permanent"===a.scope&&" — until revoked"]}),(0,d.jsx)(h.p,{label:"Expires",children:null===a.expiresAt?"—":(0,g.K)(a.expiresAt,l)}),(0,d.jsxs)(h.p,{label:"Uses",children:[null===a.maxUses?String(a.useCount):`${String(a.useCount)}/${String(a.maxUses)}`,a.lastUsedAt&&` \xb7 last ${(0,g.K)(a.lastUsedAt,l)}`]}),(0,d.jsxs)(h.p,{label:"Created",children:[(0,g.K)(a.createdAt,l)," by ",a.createdBy," via"," ",j.gi[a.createdVia]]}),(0,d.jsx)(h.p,{label:"Key version",children:String(a.keyVersion)})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(h.e,{children:"Justification"}),(0,d.jsx)("p",{className:"text-sm text-text-2",children:a.justification})]}),null!==a.revokedAt&&(0,d.jsxs)("div",{className:"rounded-lg border border-sev-critical-fill bg-sev-critical-fill p-3",children:[(0,d.jsx)(h.e,{className:"text-sev-critical-ink",children:"Revoked"}),(0,d.jsxs)("p",{className:"text-sm text-text-2",children:[(0,g.K)(a.revokedAt,l)," by ",a.revokedBy??"unknown",a.revokeReason?` — ${a.revokeReason}`:""]})]}),b&&"active"===o&&(0,d.jsxs)("div",{className:"border-t border-border pt-4",children:[(0,d.jsx)(h.e,{children:"Revoke this grant"}),(0,d.jsx)("p",{className:"mb-2 text-xs text-text-3",children:"Revocation is immediate and terminal; the row is retained as audit evidence."}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(e.pd,{value:m,onChange:a=>{n(a.target.value)},placeholder:"Reason (recorded in the audit trail)",className:"max-w-sm"}),(0,d.jsx)(e.$n,{variant:"solid",tone:"danger",size:"sm",disabled:c,onClick:()=>{b(m.trim())},children:"Revoke"})]}),k&&(0,d.jsx)("p",{className:"mt-2 text-xs text-sev-critical-ink",children:k})]})]})}},10985:(a,b,c)=>{"use strict";c.d(b,{FindingsFlatTableView:()=>m});var d=c(15008),e=c(71378),f=c(5265),g=c(16820),h=c(98937),i=c(14129),j=c(66755),k=c(13182);let l={severity:"min-w-[110px] whitespace-nowrap",sources:"min-w-[140px] whitespace-nowrap",user:"min-w-[140px]",action:"min-w-[130px] whitespace-nowrap",status:"min-w-[110px] whitespace-nowrap",latest:"min-w-[100px] whitespace-nowrap",location:"min-w-[200px]",type:"min-w-[200px]"};function m({items:a,selectedId:b,onSelect:c,onNextPage:m,onPreviousPage:n,hasNextPage:o=!1,hasPreviousPage:p=!1,loadingNextPage:q=!1,pageStart:r,total:s,isLoading:t=!1,emptyState:u,showUserColumn:v=!1,renderedAt:w}){return(0,d.jsxs)(e.Zp,{className:"flex h-full min-h-0 flex-col overflow-hidden shadow-sm",children:[(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:t?(0,d.jsx)("div",{className:"flex flex-col gap-2 py-2",children:Array.from({length:8},(a,b)=>(0,d.jsx)("div",{className:"h-11 animate-pulse rounded-md bg-surface-3"},b))}):0===a.length?u??(0,d.jsx)("p",{className:"py-8 text-center text-sm text-text-3",children:"No findings match these filters."}):(0,d.jsxs)(e.XI,{children:[(0,d.jsx)(e.A0,{children:(0,d.jsxs)(e.Hj,{children:[(0,d.jsx)(e.nd,{className:l.severity,children:"Severity"}),(0,d.jsx)(e.nd,{className:l.type,children:"Type"}),(0,d.jsx)(e.nd,{className:l.sources,children:"Source"}),v&&(0,d.jsx)(e.nd,{className:l.user,title:i.O,children:"User"}),(0,d.jsx)(e.nd,{className:l.location,children:"Location"}),(0,d.jsx)(e.nd,{className:l.action,children:"Action"}),(0,d.jsx)(e.nd,{className:l.status,children:"Status"}),(0,d.jsx)(e.nd,{className:l.latest,children:"Detected"})]})}),(0,d.jsx)(e.BF,{children:a.map(a=>{let m=i.y7[a.category]??g.RY;return(0,d.jsxs)(e.Hj,{"data-state":b===a.id?"selected":void 0,className:"cursor-pointer hover:bg-surface-2",onClick:()=>{c(a)},children:[(0,d.jsx)(e.nA,{className:l.severity,children:(0,d.jsx)(e.Pt,{severity:a.severity})}),(0,d.jsx)(e.nA,{className:l.type,children:(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)("span",{className:(0,e.cn)("flex size-7 shrink-0 items-center justify-center rounded-lg",(0,i.i9)(a.category)),children:(0,d.jsx)(m,{"aria-hidden":!0,focusable:!1,className:"size-3.5"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("div",{className:"text-ui font-semibold text-text wrap-anywhere",children:a.subtype}),(0,d.jsx)("div",{className:"font-mono text-xs text-text-3 wrap-anywhere",children:a.match.maskedValue})]})]})}),(0,d.jsx)(e.nA,{className:l.sources,children:(0,d.jsx)(j.i,{provider:a.provider})}),v&&(0,d.jsx)(e.nA,{className:l.user,children:(0,d.jsx)(k.c,{user:a.user})}),(0,d.jsx)(e.nA,{className:l.location,children:(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("div",{className:"font-mono text-xs text-text-2 wrap-anywhere",children:(0,i.xE)(a)}),a.repo&&(0,d.jsx)("div",{className:"text-xs text-text-3 wrap-anywhere",children:a.repo})]})}),(0,d.jsx)(e.nA,{className:l.action,children:(0,d.jsx)(h.T,{action:a.action})}),(0,d.jsx)(e.nA,{className:l.status,children:void 0===a.status?(0,d.jsx)("span",{className:"text-text-3",children:"—"}):(0,d.jsx)(e.Ex,{variant:(0,i.Dx)(a.status).badge,className:"h-6",children:(0,i.Dx)(a.status).label})}),(0,d.jsx)(e.nA,{className:l.latest,children:(0,d.jsx)("span",{className:"text-text-3 text-xs",children:(0,f.K)(a.detectedAt,w)})})]},a.id)})})]})}),m&&a.length>0&&(0,d.jsxs)(e.dK,{children:[(0,d.jsx)(e.Eb,{disabled:!p||q,onClick:n}),(0,d.jsx)(e.D2,{children:void 0===s||void 0===r?`${String(a.length)} shown`:`${String(r)}–${String(r+a.length-1)} of ${String(s)} findings`}),(0,d.jsx)(e.WA,{disabled:!o||q,loading:q,onClick:m})]})]})}},12696:(a,b,c)=>{"use strict";c.d(b,{AssetDetail:()=>k});var d=c(15008),e=c(71378),f=c(1505),g=c(93946),h=c(97769),i=c(14728);let j={skill:"Skill",mcp:"MCP server",hook:"Hook",config:"Configuration file"};function k({asset:a,onTrust:b,onClose:c}){let f="mcp"===a.type,k=a.trust,m=(0,h.TW)(a.type),n=j[a.type];return(0,d.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 border-b border-border px-5 py-3.5",children:[(0,d.jsx)("span",{className:(0,e.cn)("grid size-8.5 shrink-0 place-items-center rounded-lg",m.bg,m.fg),children:(0,d.jsx)(i.m,{name:m.icon,className:"size-4.5"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"truncate font-mono text-sm font-semibold text-text",title:a.name,children:a.name}),(0,d.jsx)("div",{className:"mt-px text-xs text-text-3",children:n})]}),c&&(0,d.jsx)(e.$n,{variant:"ghost",size:"icon","aria-label":"Back to harness",title:"Back to harness",onClick:c,children:(0,d.jsx)(i.m,{name:"x"})})]}),(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-4.5 overflow-y-auto p-5",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[f&&k&&(0,d.jsx)(g.As,{value:k}),(0,d.jsx)(g.Kh,{flags:a.flags})]}),a.description&&(0,d.jsx)("div",{className:"text-sm leading-relaxed text-text-2",children:a.description}),f&&k&&(0,d.jsx)(g.wn,{label:"Trust classification",children:(0,d.jsx)(g.AC,{order:h.yx,meta:h.ZY,value:k,onChange:b,accentOf:a=>a.iconBg})}),a.finding&&(0,d.jsx)(g.wn,{label:"Related finding",children:(0,d.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-lg border border-border bg-sev-critical-fill px-3 py-2.5 text-left",children:[(0,d.jsx)(i.m,{name:"alert",className:"size-4 shrink-0 text-sev-critical-ink"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"text-xs font-semibold text-text",children:a.finding.title}),a.finding.note&&(0,d.jsx)("div",{className:"mt-0.5 font-mono text-xs text-text-3",children:a.finding.note})]}),(0,d.jsx)(i.m,{name:"chevron-right",className:"size-4 shrink-0 text-text-3"})]})}),(0,d.jsx)(g.wn,{label:"Details",children:(0,d.jsx)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-3.5",children:Object.entries(a.meta).map(([a,b])=>(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"mb-1 text-label font-semibold uppercase tracking-wider text-text-3",children:a}),(0,d.jsx)("div",{className:"wrap-break-word font-mono text-xs font-medium",children:String(b)})]},a))})}),f&&a.tools&&(0,d.jsx)(l,{tools:a.tools,blocked:"unapproved"===k}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:function(a,b){let c;if("skill"===a.type){let b="string"==typeof a.meta.Latest?a.meta.Latest:"";c=a.flags.includes("update")?[{key:"u",primary:!0,icon:"arrow-up",label:`Update to ${b}`.trim()},{key:"c",icon:"book",label:"Changelog"}]:[{key:"r",icon:"refresh",label:"Check for updates"}]}else c="mcp"===a.type?"unapproved"===b?[{key:"a",primary:!0,icon:"shield-check",label:"Approve & allow-list"},{key:"b",icon:"slash-circle",label:"Block server"}]:[{key:"v",icon:"eye",label:"View tools"},{key:"r",icon:"refresh",label:"Re-verify"}]:"hook"===a.type?a.flags.includes("conflict")?[{key:"r",primary:!0,icon:"branch",label:"Resolve run order"},{key:"d",icon:"eye-off",label:"Disable hook"}]:a.flags.includes("unknown")?[{key:"v",primary:!0,icon:"shield-check",label:"Review & verify"},{key:"b",icon:"slash-circle",label:"Block"}]:[{key:"v",icon:"eye",label:"View script"}]:a.flags.includes("risk")?[{key:"r",primary:!0,icon:"shield-check",label:"Review change"},{key:"d",icon:"swap",label:"View diff"}]:a.flags.length?[{key:"d",icon:"swap",label:"View diff"},{key:"m",icon:"check",label:"Mark reviewed"}]:[{key:"o",icon:"eye",label:"Open file"}];return c.map(a=>(0,d.jsxs)(e.$n,{variant:a.primary?"solid":"outline",tone:a.primary?"primary":"neutral",size:"sm",children:[(0,d.jsx)(i.m,{name:a.icon,className:"size-3.5"}),a.label]},a.key))}(a,k)})]})]})}function l({tools:a,blocked:b}){let[c,g]=(0,f.useState)(!1),h=c?a:a.slice(0,4);return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-label font-semibold uppercase tracking-wider text-text-3",children:"Exposed tools"}),(0,d.jsx)("span",{className:"text-xs font-semibold text-text-3",children:a.length}),b&&(0,d.jsxs)("span",{className:"ml-auto inline-flex items-center gap-1.5 text-xs font-semibold text-sev-critical-ink",children:[(0,d.jsx)(i.m,{name:"slash-circle",className:"size-3"})," Calls blocked"]})]}),(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:h.map(a=>(0,d.jsxs)("div",{className:(0,e.cn)("flex items-start gap-2.5 rounded-lg border px-3 py-2.5",a.risk?"border-sev-high-fill bg-sev-high-fill":"border-border bg-surface",b&&"opacity-70"),children:[(0,d.jsx)("span",{className:(0,e.cn)("mt-px grid size-5.5 shrink-0 place-items-center rounded-md",a.risk?"bg-sev-high-ink text-on-accent":a.write?"bg-surface-2 text-text-2":"bg-teal-fill text-teal-ink"),children:(0,d.jsx)(i.m,{name:a.risk?"alert":a.write?"edit":"eye",className:"size-3"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-baseline gap-1.5",children:[(0,d.jsx)("span",{className:"font-mono text-xs font-semibold text-text",children:a.name}),(0,d.jsx)("span",{className:"font-mono text-xs text-text-3",children:a.signature}),a.write&&!a.risk&&(0,d.jsx)("span",{className:"rounded-full bg-surface-2 px-2 py-px text-xs font-semibold text-text-2",children:"write"})]}),(0,d.jsx)("div",{className:"mt-0.5 text-xs leading-relaxed text-text-2",children:a.description}),a.risk&&(0,d.jsxs)("div",{className:"mt-1 flex items-center gap-1.5 text-xs font-semibold text-sev-high-ink",children:[(0,d.jsx)(i.m,{name:"alert",className:"size-3"})," ",a.risk]})]})]},a.name))}),a.length>4&&(0,d.jsxs)(e.$n,{variant:"ghost",tone:"primary",size:"sm",className:"mt-2 px-0",onClick:()=>{g(!c)},children:[(0,d.jsx)(i.m,{name:"chevron-down",className:(0,e.cn)("size-3.5 transition-transform",c&&"rotate-180")}),c?"Show fewer":`Show all ${String(a.length)} tools`]})]})}},13182:(a,b,c)=>{"use strict";c.d(b,{c:()=>e,l:()=>f});var d=c(15008);function e({user:a}){return a?(0,d.jsx)("span",{className:"text-xs text-text-2 wrap-anywhere",title:a.name,children:a.name}):(0,d.jsx)("span",{className:"text-text-3",children:"—"})}function f({users:a}){let b=a?.[0];return b?1===a.length?(0,d.jsx)(e,{user:b}):(0,d.jsxs)("span",{className:"text-xs text-text-2",children:[a.length," users"]}):(0,d.jsx)("span",{className:"text-text-3",children:"—"})}},14129:(a,b,c)=>{"use strict";c.d(b,{y7:()=>l,VN:()=>g,nU:()=>s,gs:()=>f,qW:()=>x,pM:()=>v,B5:()=>t,oC:()=>h,O:()=>r,C$:()=>p,Jm:()=>n,i9:()=>m,EQ:()=>w,Dx:()=>u,xE:()=>q});var d=c(71378),e=c(16820);let f=["grouped","flat","files"],g="grouped",h=["critical","high","medium","low"],i={secret:"Secret",pii:"PII",source_code:"Source code",code_flaw:"Code flaw",external_share:"External share",mcp_server:"MCP server",customer_data:"Customer data",financial:"Financial",phi:"PHI",custom:"Custom"},j={secret:e.RY,pii:e.ny,source_code:e.lo,code_flaw:e._0,external_share:e._G,mcp_server:e.RR,customer_data:e.bN,financial:e.bN,phi:e.ny,custom:e.RY},k={secret:"critical",pii:"low",source_code:"violet",code_flaw:"high",external_share:"teal",mcp_server:"high",customer_data:"high",financial:"high",phi:"low",custom:"neutral"},l=Object.assign(Object.create(null),j),m=a=>{let b=Object.hasOwn(k,a)?k[a]:void 0;return d.id[b??"neutral"]},n=a=>(Object.hasOwn(i,a)?i[a]:void 0)??a,o={blocked:{label:"Blocked",icon:e.pD,className:d.id.critical},redacted:{label:"Redacted",icon:e.jZ,className:d.id.primary},warned:{label:"Warned",icon:e._0,className:d.id.high},allowed:{label:"Allowed",icon:e.Sr,className:d.id.ok},monitored:{label:"Monitored",icon:e.bM,className:d.id.neutral},quarantined:{label:"Quarantined",icon:e.lm,className:d.id.critical}},p=a=>(Object.hasOwn(o,a)?o[a]:void 0)??{label:a,icon:e.RY,className:d.id.neutral};function q(a){return a.file?a.file:a.toolName?`via ${a.toolName}`:"—"}let r="Ingested by — the session user, or the owner of the api key that posted the event. An org-level ingest key names the key’s owner, not whoever ran the job.",s=[{id:"severity",header:"Severity"},{id:"subtype",header:"Type"},{id:"sources",header:"Sources"},{id:"user",header:"User",title:r},{id:"locations",header:"Locations"},{id:"action",header:"Action"},{id:"status",header:"Status"},{id:"latest",header:"Latest"}],t={open:{label:"Open",badge:"high"},handled:{label:"Handled",badge:"primary"},resolved:{label:"Resolved",badge:"success"},dismissed:{label:"Dismissed",badge:"default"}},u=a=>(Object.hasOwn(t,a)?t[a]:void 0)??{label:a,badge:"default"},v=Object.keys(t);function w(a,b){return b&&0!==b.length?a.filter(a=>void 0!==a.status&&b.includes(a.status)):a}let x={grouped:"By type",flat:"All findings",files:"By location"}},14728:(a,b,c)=>{"use strict";c.d(b,{m:()=>h});var d=c(71378),e=c(1505),f=c(16820);let g={alert:f._0,"alert-octagon":f.rX,"arrow-up":f.Kp,bolt:f.DQ,book:f.oS,branch:f.OK,check:f.Sr,"check-circle":f.C1,"chevron-down":f.D3,"chevron-right":f.vK,clock:f.O4,cloud:f.hp,code:f.lo,database:f.bN,edit:f.qU,"external-share":f._G,eye:f.bM,"eye-off":f.aR,file:f.oS,flag:f.iF,folder:f.sj,globe:f.fC,help:f.mo,info:f.mo,layers:f.mL,list:f.kp,lock:f.XA,plus:f.c1,redact:f.jZ,refresh:f.fN,repo:f.SY,route:f.hF,search:f.WI,server:f.RR,settings:f.Ze,"shield-check":f.Zu,"slash-circle":f.pD,sliders:f.Qf,sparkles:f.BZ,swap:f.f6,terminal:f.k3,x:f.uv,"x-circle":f.pD};function h({name:a,className:b}){return(0,e.createElement)(g[a],{"aria-hidden":!0,focusable:!1,className:(0,d.cn)("size-4",b)})}},14998:(a,b,c)=>{"use strict";function d(a,b){return()=>{a(b)}}function e(a,b,c){return()=>{a(b,c)}}c.d(b,{T:()=>d,i:()=>e})},15009:(a,b,c)=>{"use strict";c.d(b,{AddExceptionForm:()=>h});var d=c(15008),e=c(71378),f=c(1505),g=c(18389);function h({rules:a,onSubmit:b,busy:c,error:h}){let[i,j]=(0,f.useState)(""),[k,l]=(0,f.useState)(""),[m,n]=(0,f.useState)(null),[o,p]=(0,f.useState)(""),[q,r]=(0,f.useState)(""),s="permanent"===m,t=""!==i&&""!==k&&null!==m&&""!==o.trim()&&(!s||q===k);return(0,d.jsxs)("div",{className:"flex max-w-xl flex-col gap-4 rounded-xl border border-border bg-surface p-5",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"mb-1.5 text-label font-semibold uppercase tracking-wider text-text-3",children:"Detection rule"}),(0,d.jsxs)(e.l6,{value:i,onValueChange:j,children:[(0,d.jsx)(e.bq,{children:(0,d.jsx)(e.yv,{placeholder:"Pick the rule this value matches"})}),(0,d.jsx)(e.gC,{children:a.map(a=>(0,d.jsx)(e.eb,{value:a.id,children:(0,d.jsx)("span",{className:"font-mono text-xs",children:a.id})},a.id))})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"mb-1.5 text-label font-semibold uppercase tracking-wider text-text-3",children:"Value to pre-authorize"}),(0,d.jsx)(e.pd,{type:"password",autoComplete:"off",value:k,onChange:a=>{l(a.target.value)},placeholder:"Pasted once; stored only as a keyed fingerprint + masked preview",className:"font-mono"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"mb-1.5 text-label font-semibold uppercase tracking-wider text-text-3",children:"Scope — pick one"}),(0,d.jsx)(g.ScopePicker,{value:m,onChange:n})]}),s&&(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"mb-1.5 text-label font-semibold uppercase tracking-wider text-text-3",children:"Retype the value to confirm a permanent grant"}),(0,d.jsx)(e.pd,{type:"password",autoComplete:"off",value:q,onChange:a=>{r(a.target.value)},className:"font-mono"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"mb-1.5 text-label font-semibold uppercase tracking-wider text-text-3",children:"Reason (required — the audit trail)"}),(0,d.jsx)(e.pd,{value:o,onChange:a=>{p(a.target.value)},placeholder:"Why this value may pass"})]}),h&&(0,d.jsx)("p",{className:"text-xs text-sev-critical-ink",children:h}),(0,d.jsx)("div",{children:(0,d.jsx)(e.$n,{variant:"solid",tone:"primary",size:"sm",disabled:!t||c,onClick:()=>{m&&b({ruleId:i,value:k,scope:m,reason:o.trim(),...s?{confirmation:q}:{}})},children:c?"Verifying…":"Grant exception"})})]})}},16254:(a,b,c)=>{"use strict";c.d(b,{HarnessOverview:()=>l});var d=c(15008),e=c(71378),f=c(21459),g=c(63407),h=c(93946),i=c(97769),j=c(14728);let k=["block","redact","warn"];function l({harness:a,events:b,onSelect:c,onSelectProject:l,renderedAt:o}){let p=(a.categories.find(a=>"mcp"===a.type)?.assets??[]).filter(a=>"unapproved"===a.trust).length,q=b?.items??[],r=b?.counts,s=r?r.block+r.redact+r.warn:0;return(0,d.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 border-b border-border px-5 py-4",children:[(0,d.jsx)(g.K,{id:a.id,size:38}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"font-display text-base font-semibold",children:a.label}),(0,d.jsxs)("div",{className:"mt-px text-xs text-text-3",children:[a.kind," \xb7 ",a.version]})]})]}),(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-4.5 overflow-y-auto p-5",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"mb-2.5 flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-label font-semibold uppercase tracking-wider text-text-3",children:"Recent blocks, redactions & warnings"}),r&&(0,d.jsx)("span",{className:"ml-auto inline-flex items-center gap-1.5",children:k.map(a=>{let b=r[a];return b>0?(0,d.jsxs)(e.Ex,{variant:i.iL[a].tone,children:[b," ",i.iL[a].label.toLowerCase()]},a):null})})]}),0===q.length?(0,d.jsxs)("div",{className:"flex items-center gap-2.5 rounded-lg border border-dashed border-border-strong px-3 py-3.5 text-text-3",children:[(0,d.jsx)(j.m,{name:"check-circle",className:"size-4 text-ok-ink"}),(0,d.jsx)("span",{className:"text-xs",children:"No blocks, redactions or warnings from this harness"})]}):(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[q.map(a=>{let b=i.iL[a.kind],{day:c,time:g}=function(a,b){let c=new Date(a).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return{day:(0,f.nt)(a,new Date(b)),time:c}}(a.occurredAt,o);return(0,d.jsxs)("div",{className:"flex items-start gap-2.5 rounded-lg border border-border bg-surface px-3 py-2.5",children:[(0,d.jsx)("span",{className:(0,e.cn)("grid size-7 shrink-0 place-items-center rounded-md",b.bg,b.fg),children:(0,d.jsx)(j.m,{name:b.icon,className:"size-3.5"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"text-xs font-semibold text-text",children:a.title}),(0,d.jsx)("div",{className:"mt-0.5 font-mono text-xs text-text-3",children:a.detail})]}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[(0,d.jsx)(e.Ex,{variant:b.tone,children:b.label}),(0,d.jsxs)("span",{className:"font-mono text-xs text-text-3",children:[c," \xb7 ",g]})]})]},`${a.occurredAt}\xb7${a.title}`)}),s>q.length&&(0,d.jsxs)("div",{className:"pt-0.5 text-center text-xs text-text-3",children:["Showing ",q.length," of ",s," events"]})]})]}),(a.flagCount>0||p>0)&&(0,d.jsxs)("div",{className:"flex items-center gap-2.5 rounded-lg border border-border bg-sev-high-fill px-3 py-2.5",children:[(0,d.jsx)(j.m,{name:"flag",className:"size-4 shrink-0 text-sev-high-ink"}),(0,d.jsxs)("div",{className:"text-xs font-medium text-text",children:[a.flagCount>0&&`${String(a.flagCount)} item${1===a.flagCount?"":"s"} need review`,a.flagCount>0&&p>0&&" \xb7 ",p>0&&`${String(p)} unapproved MCP${1===p?"":"s"}`]})]}),a.projects.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"mb-2 flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"text-label font-semibold uppercase tracking-wider text-text-3",children:"Projects"}),(0,d.jsx)("span",{className:"text-xs font-semibold text-text-3",children:a.projects.length})]}),(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:a.projects.map(a=>(0,d.jsx)(m,{p:a,onSelect:l},a.id))})]}),0===a.categories.length&&0===a.projects.length&&(0,d.jsx)(h.EmptyState,{message:"No projects, skills, MCP servers, hooks or configuration for this harness"}),a.categories.map(a=>{let b=i.pA[a.type];return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"mb-2 flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"text-label font-semibold uppercase tracking-wider text-text-3",children:b.label}),(0,d.jsx)("span",{className:"text-xs font-semibold text-text-3",children:a.assets.length})]}),(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:a.assets.map(a=>(0,d.jsx)(n,{it:a,onSelect:c},a.id))})]},a.type)})]})]})}function m({p:a,onSelect:b}){let c=a.accessCounts;return(0,d.jsxs)("button",{type:"button",onClick:()=>{b(a.id)},className:"flex w-full items-center gap-2.5 rounded-lg border border-border bg-surface px-2.5 py-2 text-left cursor-pointer hover:bg-surface-2",children:[(0,d.jsx)("span",{className:"size-2.5 shrink-0 rounded-full",style:{background:(0,i.Cs)(a.language)}}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"truncate text-xs font-semibold text-text",children:a.name}),(0,d.jsx)(h.yk,{v:a.visibility})]}),(0,d.jsxs)("div",{className:"mt-0.5 flex items-center gap-1.5 truncate font-mono text-xs text-text-3",children:[(0,d.jsx)(j.m,{name:"repo",className:"size-3 shrink-0"}),a.repo]})]}),(0,d.jsx)(h.AJ,{counts:c}),c.blocked>0&&(0,d.jsxs)("span",{className:"text-xs font-semibold text-sev-critical-ink",children:[c.blocked," blocked"]}),a.findingsCount>0&&(0,d.jsx)(h.Kh,{flags:["findings"],mini:!0}),(0,d.jsx)(j.m,{name:"chevron-right",className:"size-4 shrink-0 text-text-3"})]})}function n({it:a,onSelect:b}){let c=(0,i.TW)(a.type),f="mcp"===a.type?a.trust:void 0;return(0,d.jsxs)("button",{type:"button",onClick:()=>{b(a)},className:"flex w-full items-center gap-2.5 rounded-lg border border-border bg-surface px-2.5 py-2 text-left cursor-pointer hover:bg-surface-2",children:[(0,d.jsx)("span",{className:(0,e.cn)("grid size-6.5 shrink-0 place-items-center rounded-md",c.bg,c.fg),children:(0,d.jsx)(j.m,{name:c.icon,className:"size-3.5"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"truncate font-mono text-xs font-semibold text-text",children:a.name}),(0,d.jsx)("div",{className:"truncate font-mono text-xs text-text-3 mt-0.5",children:a.sub})]}),f&&(0,d.jsx)(h.As,{value:f}),a.flags.length>0&&(0,d.jsx)(h.Kh,{flags:a.flags,mini:!0}),(0,d.jsx)(j.m,{name:"chevron-right",className:"size-4 shrink-0 text-text-3"})]})}},16696:(a,b,c)=>{"use strict";c.d(b,{VaultInventoryView:()=>j});var d=c(15008),e=c(71378),f=c(5265),g=c(55343),h=c(40229);let i={occurrences:"min-w-[120px] whitespace-nowrap",firstSeen:"min-w-[110px] whitespace-nowrap",lastSeen:"min-w-[110px] whitespace-nowrap",grant:"min-w-[140px] whitespace-nowrap",action:"min-w-[120px] whitespace-nowrap"};function j({entries:a,onReveal:b,onRevoke:c,hasNextPage:f=!1,hasPreviousPage:g=!1,onNextPage:h,onPreviousPage:j,loadingNextPage:l=!1,pageStart:m,total:n,renderedAt:o}){let p=0===a.length;if(p&&!g&&!f)return(0,d.jsx)("div",{className:"rounded-xl border border-border bg-surface py-10 text-center text-sm text-text-3",children:"Nothing vaulted yet — values land here when a redact policy fires with vault consent granted."});let q=void 0!==b||void 0!==c;return(0,d.jsxs)("div",{className:"overflow-x-auto rounded-xl border border-border bg-surface p-4",children:[p?(0,d.jsx)("div",{className:"py-10 text-center text-sm text-text-3",children:"These rows moved while you were reading. Step back to see the rest."}):(0,d.jsxs)(e.XI,{children:[(0,d.jsx)(e.A0,{children:(0,d.jsxs)(e.Hj,{children:[(0,d.jsx)(e.nd,{children:"Value"}),(0,d.jsx)(e.nd,{className:i.occurrences,children:"Occurrences"}),(0,d.jsx)(e.nd,{className:i.firstSeen,children:"First seen"}),(0,d.jsx)(e.nd,{className:i.lastSeen,children:"Last seen"}),(0,d.jsx)(e.nd,{className:i.grant,children:"Grant"}),q?(0,d.jsx)(e.nd,{className:i.action,children:"Actions"}):null]})}),(0,d.jsx)(e.BF,{children:a.map(a=>(0,d.jsx)(k,{entry:a,hasActions:q,onReveal:b,onRevoke:c,renderedAt:o},a.pointerId))})]}),h?(0,d.jsxs)(e.dK,{children:[(0,d.jsx)(e.Eb,{disabled:!g||l,onClick:j}),(0,d.jsx)(e.D2,{children:void 0===n||void 0===m?`${String(a.length)} shown`:p?`0 of ${String(n)} values`:`${String(m)}–${String(m+a.length-1)} of ${String(n)} values`}),(0,d.jsx)(e.WA,{disabled:!f||l,loading:l,onClick:h})]}):f&&(0,d.jsxs)("p",{className:"mt-4 text-center text-xs text-text-3",children:["Showing the first ",a.length," values — the rest are in the store."]})]})}function k({entry:a,hasActions:b,onReveal:c,onRevoke:j,renderedAt:k}){let l=a.revealGrantId;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(e.Hj,{children:[(0,d.jsx)(e.nA,{children:(0,d.jsx)(g.Y,{value:null,descriptor:a})}),(0,d.jsx)(e.nA,{className:i.occurrences,children:(0,d.jsx)("span",{className:"text-xs text-text-2",children:String(a.occurrences)})}),(0,d.jsx)(e.nA,{className:i.firstSeen,children:(0,d.jsx)("span",{className:"text-xs text-text-2",children:(0,f.K)(a.firstSeen,k)})}),(0,d.jsx)(e.nA,{className:i.lastSeen,children:(0,d.jsx)("span",{className:"text-xs text-text-2",children:(0,f.K)(a.lastSeen,k)})}),(0,d.jsx)(e.nA,{className:i.grant,children:null===l?null:(0,d.jsx)(h.$$,{})}),b?(0,d.jsx)(e.nA,{className:i.action,children:(0,d.jsxs)("span",{className:"inline-flex items-center gap-2",children:[void 0===c?null:(0,d.jsx)(e.$n,{variant:"outline",tone:"neutral",size:"sm",onClick:()=>{c(a.pointerId)},children:"Reveal"}),null!==l&&void 0!==j?(0,d.jsx)(e.$n,{variant:"ghost",tone:"danger",size:"sm",onClick:()=>{j(l)},children:"Revoke grant"}):null]})}):null]}),a.sightings.length>0?(0,d.jsx)(e.Hj,{children:(0,d.jsx)(e.nA,{colSpan:b?6:5,className:"py-2",children:(0,d.jsxs)("details",{children:[(0,d.jsxs)("summary",{className:"cursor-pointer text-xs font-medium text-text-2",children:["Written to ",String(a.sightings.length)," ",1===a.sightings.length?"location":"locations"," — anyone who can read them sees the correlation"]}),(0,d.jsx)("ul",{className:"mt-2 flex flex-col gap-2",children:a.sightings.map(a=>(0,d.jsxs)("li",{className:"grid grid-cols-[1fr_110px_100px] items-center gap-2 text-xs text-text-2",children:[(0,d.jsx)("code",{className:"break-all font-mono",children:a.location}),(0,d.jsx)("div",{children:(0,d.jsx)(h.Ec,{kind:a.kind})}),(0,d.jsx)("span",{className:"text-text-3",children:(0,f.K)(a.lastSeen,k)})]},`${a.kind}:${a.location}`))})]})})}):null]})}},16820:(a,b,c)=>{"use strict";c.d(b,{BH:()=>V,BZ:()=>q,C1:()=>O,CT:()=>D,D3:()=>C,DQ:()=>ae,Ey:()=>J,JM:()=>S,K$:()=>U,Kp:()=>j,O4:()=>ad,OK:()=>p,Qf:()=>G,Qq:()=>$,RR:()=>t,RY:()=>r,SY:()=>Z,Sr:()=>x,Uy:()=>m,WI:()=>B,XA:()=>R,YJ:()=>F,ZL:()=>l,Ze:()=>ab,Zu:()=>n,_0:()=>v,_G:()=>i,aR:()=>H,ai:()=>L,bM:()=>y,bN:()=>u,c1:()=>N,cZ:()=>I,f6:()=>aj,fC:()=>K,fN:()=>ai,fl:()=>k,hF:()=>T,hp:()=>aa,iB:()=>_,iF:()=>w,jZ:()=>h,k3:()=>ac,kp:()=>Q,lm:()=>z,lo:()=>s,mL:()=>A,mS:()=>al,mo:()=>X,np:()=>W,ny:()=>o,oS:()=>ag,pD:()=>g,qU:()=>af,rX:()=>f,s3:()=>ak,sj:()=>ah,ts:()=>Y,uv:()=>P,vK:()=>E,wy:()=>M});var d=c(15008);let e={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"},f=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M8 2.5h8L21.5 8v8L16 21.5H8L2.5 16V8L8 2.5Z"}),(0,d.jsx)("path",{d:"M12 8v4"}),(0,d.jsx)("circle",{cx:"12",cy:"16",r:"1",fill:"currentColor",stroke:"none"})]}),g=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,d.jsx)("path",{d:"m6 6 12 12"})]}),h=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("rect",{x:"3",y:"9",width:"18",height:"6",rx:"1.5",fill:"currentColor",stroke:"none"}),(0,d.jsx)("path",{d:"M3 5h18M3 19h12"})]}),i=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M14 4h6v6"}),(0,d.jsx)("path",{d:"M20 4 11 13"}),(0,d.jsx)("path",{d:"M18 14v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4"})]}),j=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"M12 19V5M6 11l6-6 6 6"})}),k=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"M5 12h14M13 6l6 6-6 6"})}),l=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"M12 5v14M6 13l6 6 6-6"})}),m=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"M4 20V10M10 20V4M16 20v-7M22 20H2"})}),n=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M12 3 4.5 6v5.5c0 4.6 3.2 7.6 7.5 9 4.3-1.4 7.5-4.4 7.5-9V6L12 3Z"}),(0,d.jsx)("path",{d:"m9 12 2 2 4-4"})]}),o=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("circle",{cx:"12",cy:"8",r:"3.6"}),(0,d.jsx)("path",{d:"M5.5 20a6.5 6.5 0 0 1 13 0"})]}),p=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M6 8.4v7.2"}),(0,d.jsx)("circle",{cx:"6",cy:"6",r:"2.4"}),(0,d.jsx)("circle",{cx:"6",cy:"18",r:"2.4"}),(0,d.jsx)("circle",{cx:"18",cy:"7",r:"2.4"}),(0,d.jsx)("path",{d:"M18 9.4a8.6 8.6 0 0 1-8.6 8.6"})]}),q=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M12 3.5 13.6 9 19 10.5 13.6 12 12 17.5 10.4 12 5 10.5 10.4 9 12 3.5Z"}),(0,d.jsx)("path",{d:"M18 16.5 18.7 19 21 19.7 18.7 20.4 18 23 17.3 20.4 15 19.7 17.3 19 18 16.5Z"})]}),r=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("circle",{cx:"8",cy:"12",r:"4"}),(0,d.jsx)("path",{d:"M11.5 12H21l-2 2.4M16.5 12v3"})]}),s=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"m8 8-4 4 4 4M16 8l4 4-4 4M13.5 6l-3 12"})}),t=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("rect",{x:"4",y:"4",width:"16",height:"7",rx:"2"}),(0,d.jsx)("rect",{x:"4",y:"13",width:"16",height:"7",rx:"2"}),(0,d.jsx)("circle",{cx:"8",cy:"7.5",r:"1",fill:"currentColor",stroke:"none"}),(0,d.jsx)("circle",{cx:"8",cy:"16.5",r:"1",fill:"currentColor",stroke:"none"})]}),u=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("ellipse",{cx:"12",cy:"6",rx:"7",ry:"3"}),(0,d.jsx)("path",{d:"M5 6v12c0 1.7 3.1 3 7 3s7-1.3 7-3V6"}),(0,d.jsx)("path",{d:"M5 12c0 1.7 3.1 3 7 3s7-1.3 7-3"})]}),v=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M12 3 2 20h20L12 3Z"}),(0,d.jsx)("path",{d:"M12 9v5"}),(0,d.jsx)("circle",{cx:"12",cy:"17",r:"1",fill:"currentColor",stroke:"none"})]}),w=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"M5 21V4M5 4h11l-2 3 2 3H5"})}),x=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"m5 12 4.5 4.5L19 7"})}),y=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"2.6"})]}),z=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"M12 3 4.5 6v5.5c0 4.6 3.2 7.6 7.5 9 4.3-1.4 7.5-4.4 7.5-9V6L12 3Z"})}),A=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"m12 3 9 5-9 5-9-5 9-5Z"}),(0,d.jsx)("path",{d:"m3 13 9 5 9-5M3 16.5l9 5 9-5"})]}),B=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,d.jsx)("path",{d:"m20 20-3.2-3.2"})]}),C=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"m6 9 6 6 6-6"})}),D=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("rect",{x:"4",y:"5",width:"16",height:"16",rx:"2"}),(0,d.jsx)("path",{d:"M4 9h16M8 3v4M16 3v4"})]}),E=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"m9 6 6 6-6 6"})}),F=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"m15 6-6 6 6 6"})}),G=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M4 8h10M18 8h2M4 16h2M10 16h10"}),(0,d.jsx)("circle",{cx:"16",cy:"8",r:"2.2"}),(0,d.jsx)("circle",{cx:"8",cy:"16",r:"2.2"})]}),H=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M4 4 20 20"}),(0,d.jsx)("path",{d:"M9.5 9.6A2.6 2.6 0 0 0 12 14.6c.7 0 1.3-.25 1.8-.7M6.5 6.7C3.8 8.3 2.5 12 2.5 12S6 18.5 12 18.5c1.5 0 2.8-.4 4-1M17.5 17.3C20.2 15.7 21.5 12 21.5 12S18 5.5 12 5.5c-.5 0-1 0-1.4.1"})]}),I=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"M8 4c-2 0-2 2-2 4s0 3-2 4c2 1 2 2 2 4s0 4 2 4M16 4c2 0 2 2 2 4s0 3 2 4c-2 1-2 2-2 4s0 4-2 4"})}),J=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M2 12C2 6.5 6.5 2 12 2a10 10 0 0 1 8 4"}),(0,d.jsx)("path",{d:"M5 19.5C5.5 18 6 15 6 12c0-.7.12-1.37.34-2"}),(0,d.jsx)("path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02"}),(0,d.jsx)("path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4"}),(0,d.jsx)("path",{d:"M8.65 22c.21-.66.45-1.32.57-2"}),(0,d.jsx)("path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88"}),(0,d.jsx)("path",{d:"M2 16h.01"}),(0,d.jsx)("path",{d:"M21.8 16c.2-2 .13-5.354 0-6"}),(0,d.jsx)("path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2"})]}),K=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,d.jsx)("path",{d:"M3 12h18"}),(0,d.jsx)("path",{d:"M12 3c2.6 2.6 2.6 15.4 0 18M12 3c-2.6 2.6-2.6 15.4 0 18"})]}),L=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M4 21V5a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v16"}),(0,d.jsx)("path",{d:"M15 9h4a1 1 0 0 1 1 1v11"}),(0,d.jsx)("path",{d:"M3 21h18"}),(0,d.jsx)("path",{d:"M8 8h3M8 12h3M8 16h3"})]}),M=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("circle",{cx:"12",cy:"5",r:"1.4",fill:"currentColor",stroke:"none"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"}),(0,d.jsx)("circle",{cx:"12",cy:"19",r:"1.4",fill:"currentColor",stroke:"none"})]}),N=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"M12 5v14M5 12h14"})}),O=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,d.jsx)("path",{d:"m8.5 12 2.3 2.3 4.7-4.6"})]}),P=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"M6 6 18 18M18 6 6 18"})}),Q=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M8 6h12M8 12h12M8 18h12"}),(0,d.jsx)("circle",{cx:"3.6",cy:"6",r:"1.1",fill:"currentColor",stroke:"none"}),(0,d.jsx)("circle",{cx:"3.6",cy:"12",r:"1.1",fill:"currentColor",stroke:"none"}),(0,d.jsx)("circle",{cx:"3.6",cy:"18",r:"1.1",fill:"currentColor",stroke:"none"})]}),R=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("rect",{x:"5",y:"11",width:"14",height:"9",rx:"2"}),(0,d.jsx)("path",{d:"M8 11V8a4 4 0 0 1 8 0v3"})]}),S=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"M12 20V9M7 13l5-5 5 5M5 4h14"})}),T=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("circle",{cx:"6",cy:"18",r:"2.4"}),(0,d.jsx)("path",{d:"M8.4 18H16a3 3 0 0 0 0-6H8a3 3 0 0 1 0-6h7.6"}),(0,d.jsx)("circle",{cx:"18",cy:"6",r:"2.4"})]}),U=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M3 13h5l1.5 3h5L16 13h5"}),(0,d.jsx)("path",{d:"M5 5h14l2 8v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5L5 5Z"})]}),V=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"M3 12h3l2-5 4 14 3-9 2 2h4"})}),W=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"M3 12h4l3 8 4-16 3 8h4"})}),X=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,d.jsx)("path",{d:"M12 11v5"}),(0,d.jsx)("circle",{cx:"12",cy:"7.7",r:"1",fill:"currentColor",stroke:"none"})]}),Y=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M12 21s7-6.3 7-11a7 7 0 1 0-14 0c0 4.7 7 11 7 11Z"}),(0,d.jsx)("circle",{cx:"12",cy:"10",r:"2.4"})]}),Z=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M6 3h11a1 1 0 0 1 1 1v17l-3-2-3 2-3-2-3 2V4a1 1 0 0 1 1-1Z"}),(0,d.jsx)("path",{d:"M9 8h6M9 12h5"})]}),$=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"M7 17 17 7M8 7h9v9"})}),_=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M6 3h9l3 3v15H6z"}),(0,d.jsx)("path",{d:"M15 3v3h3"}),(0,d.jsx)("path",{d:"M9 12h6M9 16h4"})]}),aa=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"M7 18a4 4 0 0 1-.5-7.97A5.5 5.5 0 0 1 17 9.5a3.75 3.75 0 0 1 .5 7.5H7Z"})}),ab=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2Z"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}),ac=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),(0,d.jsx)("path",{d:"m7 9 3 3-3 3M13 15h4"})]}),ad=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,d.jsx)("path",{d:"M12 7.5V12l3 2"})]}),ae=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"M13 2 4 14h7l-1 8 9-12h-7l1-8Z"})}),af=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M4 20h4L19 9l-4-4L4 16v4Z"}),(0,d.jsx)("path",{d:"m14 6 4 4"})]}),ag=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M6 3h8l4 4v14H6z"}),(0,d.jsx)("path",{d:"M14 3v4h4"})]}),ah=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"M3 6a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"})}),ai=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M3 12a9 9 0 0 1 15-6.7L21 8"}),(0,d.jsx)("path",{d:"M21 3v5h-5"}),(0,d.jsx)("path",{d:"M21 12a9 9 0 0 1-15 6.7L3 16"}),(0,d.jsx)("path",{d:"M3 21v-5h5"})]}),aj=a=>(0,d.jsxs)("svg",{...e,...a,children:[(0,d.jsx)("path",{d:"M7 4 3 8l4 4"}),(0,d.jsx)("path",{d:"M3 8h14"}),(0,d.jsx)("path",{d:"m17 20 4-4-4-4"}),(0,d.jsx)("path",{d:"M21 16H7"})]}),ak=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"M12 4v11M7 11l5 5 5-5M5 20h14"})}),al=a=>(0,d.jsx)("svg",{...e,...a,children:(0,d.jsx)("path",{d:"M14 4h6v6M20 4l-7 7M10 20H4v-6M4 20l7-7"})})},16980:(a,b,c)=>{"use strict";c.d(b,{NeedsReviewStripView:()=>f});var d=c(15008),e=c(16820);function f({items:a,onOpen:b}){return 0===a.length?null:(0,d.jsx)("div",{className:"mb-3.5 overflow-hidden rounded-xl border border-sev-critical-fill bg-sev-critical-fill",children:(0,d.jsxs)("button",{type:"button",onClick:b,"aria-haspopup":"dialog",className:"flex w-full cursor-pointer items-center gap-2.5 px-3.5 py-3 text-left",children:[(0,d.jsx)("span",{className:"grid size-6.5 shrink-0 place-items-center rounded-md bg-sev-critical-ink text-on-accent",children:(0,d.jsx)(e._0,{"aria-hidden":!0,focusable:!1,className:"size-4"})}),(0,d.jsx)("span",{className:"text-sm font-semibold text-text",children:"Needs review"}),(0,d.jsx)("span",{className:"rounded-full bg-sev-critical-ink px-2 text-xs py-0.5 font-bold text-on-accent",children:a.length}),(0,d.jsx)("span",{className:"text-xs text-text-2",children:"Raw IPs, plaintext transfers & unverified domains"}),(0,d.jsx)(e.vK,{"aria-hidden":!0,focusable:!1,className:"ml-auto size-4.5 text-text-3"})]})})}},17139:(a,b,c)=>{"use strict";c.d(b,{BlockedWindowSelect:()=>h});var d=c(15008),e=c(71378),f=c(22567),g=c(16820);function h({value:a,onChange:b}){let c=f.Jy.find(b=>b.value===a)?.label??a;return(0,d.jsxs)(e.rI,{children:[(0,d.jsx)(e.ty,{asChild:!0,children:(0,d.jsxs)(e.$n,{variant:"outline",tone:"neutral",size:"sm",children:[(0,d.jsx)(g.CT,{"aria-hidden":!0,focusable:!1,className:"size-3.5 text-text-3"}),c,(0,d.jsx)(g.D3,{"aria-hidden":!0,focusable:!1,className:"size-3.5 text-text-3"})]})}),(0,d.jsx)(e.SQ,{align:"end",className:"w-40",children:(0,d.jsx)(e.Hr,{value:a,onValueChange:a=>{b(a)},children:f.Jy.map(a=>(0,d.jsx)(e.Ht,{value:a.value,children:a.label},a.value))})})]})}},17737:(a,b,c)=>{"use strict";c.d(b,{NavigationTransitionProvider:()=>h,n:()=>i,p:()=>j});var d=c(15008),e=c(50734),f=c(1505);let g=(0,f.createContext)(null);function h({children:a}){let b=(0,e.useRouter)(),[c,h]=(0,f.useTransition)(),i=(0,f.useCallback)(a=>{h(()=>{b.push(a)})},[b]),j=(0,f.useCallback)(a=>{h(()=>{b.replace(a)})},[b]),k=(0,f.useMemo)(()=>({isPending:c,push:i,replace:j}),[c,i,j]);return(0,d.jsx)(g.Provider,{value:k,children:a})}function i(){let a=(0,f.useContext)(g);if(null===a)throw Error("useNavigationTransition must be used within NavigationTransitionProvider");return a}function j(){let{isPending:a}=i(),[b,c]=(0,f.useState)(!1);return a&&b?(0,d.jsx)("div",{role:"progressbar","aria-label":"Loading",className:"pointer-events-none absolute inset-x-0 top-0 z-50 h-0.5 overflow-hidden",children:(0,d.jsx)("div",{className:"h-full w-full origin-left animate-nav-progress bg-primary-solid"})}):null}},18389:(a,b,c)=>{"use strict";c.d(b,{ScopePicker:()=>j,StateTag:()=>g,StateTagFor:()=>h,_:()=>i});var d=c(15008),e=c(71378),f=c(77292);function g({state:a}){return(0,d.jsx)(e.Ex,{variant:f.hv[a],children:a})}function h({exception:a,now:b}){return(0,d.jsx)(g,{state:(0,f.rO)(a,b)})}function i({exception:a}){return"reveal_to_model"!==a.capability?null:(0,d.jsx)(e.Ex,{variant:"critical",children:f.y3.reveal_to_model})}function j({value:a,onChange:b}){return(0,d.jsx)(e.Iz,{value:a??"",onValueChange:a=>{a&&b(a)},children:f.rU.map(a=>(0,d.jsx)(e.tR,{value:a,children:f.DU[a]},a))})}},19037:(a,b,c)=>{"use strict";c.d(b,{FileDetailDrawer:()=>j});var d=c(15008),e=c(71378),f=c(76836),g=c(93946),h=c(97769),i=c(14728);function j({file:a,onChange:b}){let c=h.Gb[a.origin],j=a.project;return(0,d.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,d.jsxs)(e.Fm,{className:"flex-row items-center gap-2.5 py-4 px-5",children:[(0,d.jsx)("span",{className:"grid size-7.5 shrink-0 place-items-center rounded-lg bg-surface-2 text-text-2",children:(0,d.jsx)(i.m,{name:"file",className:"size-4.5"})}),(0,d.jsx)(e.qp,{className:"min-w-0 truncate font-mono text-sm",children:a.name})]}),(0,d.jsxs)("div",{className:"mt-1 flex min-h-0 flex-1 flex-col gap-4.5 overflow-y-auto border-t border-border py-4 px-5",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"break-all font-mono text-xs text-text-3",children:[j.repo," › ",a.path]}),(0,d.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,d.jsx)(g.TJ,{origin:a.origin}),(0,d.jsx)(g.yk,{v:j.visibility}),a.findings>0&&(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-sev-critical-fill px-2 py-0.5 text-xs font-semibold text-sev-critical-ink",children:[(0,d.jsx)(i.m,{name:"alert",className:"size-3"}),a.findings," finding",1===a.findings?"":"s"]})]})]}),(0,d.jsx)(g.wn,{label:"LLM access",children:(0,d.jsx)(g.AC,{order:h.IF,meta:h.Pe,value:a.access,onChange:b,accentOf:a=>a.accent})}),(0,d.jsxs)("div",{className:"flex gap-2.5 rounded-lg border border-border bg-surface-2 px-3 py-2.5",children:[(0,d.jsx)(i.m,{name:c.icon,className:"size-4.5 shrink-0 text-text-2"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"mb-0.5 text-xs font-semibold",children:"Why this default"}),(0,d.jsx)("div",{className:"text-xs leading-relaxed text-text-2",children:(0,h._t)(j,a.origin)})]})]}),a.findingsRefs.length>0&&(0,d.jsx)(g.wn,{label:"Related findings",children:(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:a.findingsRefs.map(b=>(0,d.jsxs)("button",{type:"button",className:"flex w-full cursor-pointer items-center gap-2.5 rounded-lg border border-border bg-primary-tint px-3 py-2.5 text-left",children:[(0,d.jsx)(i.m,{name:"alert",className:"size-4 shrink-0 text-sev-critical-ink"}),(0,d.jsx)("span",{className:"flex-1 text-xs font-medium text-text",children:b.title||a.note}),(0,d.jsx)("span",{className:"text-xs text-primary",children:"Open in Findings"}),(0,d.jsx)(i.m,{name:"chevron-right",className:"size-4 text-text-3"})]},b.id))})}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-x-3 gap-y-3.5",children:[(0,d.jsx)(f.p,{label:"Repository",children:(0,d.jsx)("span",{className:"font-mono text-xs",children:j.repo})}),(0,d.jsx)(f.p,{label:"Visibility",children:"public"===j.visibility?"Public":"Private"}),(0,d.jsx)(f.p,{label:"Origin",children:c.label}),(0,d.jsx)(f.p,{label:"Set by",children:a.isCustom?(0,d.jsx)("span",{className:"text-primary",children:"You"}):"Default policy"}),(0,d.jsx)(f.p,{label:"Language",children:j.language}),(0,d.jsx)(f.p,{label:"Last activity",children:(0,h.v7)(a.blockedAt??j.updatedAt)})]})]})]})}},21459:(a,b,c)=>{"use strict";c.d(b,{Sk:()=>o,UK:()=>d.UKt,fz:()=>n,gE:()=>l,nt:()=>h,rw:()=>j,u3:()=>p,vV:()=>m,xd:()=>d.xdw});var d=c(64145);let e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],f=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function g(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime()}function h(a,b){let c=new Date(a);if(Number.isNaN(c.getTime()))return"";let d=Math.round((g(b)-g(c))/864e5);return 0===d?"Today":1===d?"Yesterday":`${f[c.getDay()]??""}, ${e[c.getMonth()]??""} ${String(c.getDate())}`}let i=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});function j(a){let b=Date.parse(a);return Number.isNaN(b)?"":i.format(b)}let k=new Intl.DateTimeFormat("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"});function l(a){let b=Date.parse(a);return Number.isNaN(b)?"":k.format(b)}function m(a,b,c,d){let e=Date.parse(a);if(Number.isNaN(e))return"";let f=Math.max(0,Math.round(((b?Date.parse(b):d)-e)/6e4)),g=Math.floor(f/60),h=f%60,i=g>0?`${String(g)}h ${String(h)}m`:`${String(h)}m`;return"active"===c?`${i} \xb7 live`:i}function n(a){let b=a.cacheRead+a.inputTokens;return b>0?Math.round(100*a.cacheRead/b):0}function o(a){return(0,d.ap_)(a)}function p(a,b){let c=[];for(let d of a){let a=h(d.startedAt,b),e=c.find(b=>b.day===a);e||(e={day:a,items:[]},c.push(e)),e.items.push(d)}return c}},21462:(a,b,c)=>{"use strict";c.d(b,{HarnessSelect:()=>i});var d=c(15008),e=c(71378),f=c(16820),g=c(63407),h=c(24061);function i({value:a,onChange:b,options:c}){let i=c?h.oo.filter(b=>c.includes(b)||a.includes(b)):h.oo,j=0===a.length,k=a[0],l=j?"All harnesses":1===a.length&&k?g.x[k].label:`${String(a.length)} harnesses`;return(0,d.jsxs)(e.rI,{children:[(0,d.jsxs)(e.ty,{className:(0,e.cn)("group flex h-8.5 w-full items-center gap-2 rounded-lg border bg-surface-2 px-2.5 text-sm focus:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40",j?"border-border-field":"border-primary"),children:[(0,d.jsx)(f.k3,{"aria-hidden":!0,focusable:!1,className:(0,e.cn)("size-3.5 shrink-0",j?"text-text-3":"text-primary")}),(0,d.jsx)("span",{className:"flex-1 text-left font-medium text-text",children:l}),!j&&(0,d.jsx)(e.Ex,{variant:"primary",className:"px-1.5 py-0 text-label bg-surface-2",children:a.length}),(0,d.jsx)(f.D3,{"aria-hidden":!0,focusable:!1,className:"size-3.5 shrink-0 text-text-3 transition-transform group-data-[state=open]:rotate-180"})]}),(0,d.jsxs)(e.SQ,{align:"start",className:"w-(--radix-dropdown-menu-trigger-width)",children:[(0,d.jsx)(e.hO,{checked:j,onCheckedChange:()=>{b([])},onSelect:a=>{a.preventDefault()},children:"All harnesses"}),(0,d.jsx)(e.mB,{}),i.map(c=>(0,d.jsx)(e.hO,{checked:a.includes(c),onCheckedChange:()=>{let d=a.includes(c)?a.filter(a=>a!==c):[...a,c];b(d.length===i.length?[]:d)},onSelect:a=>{a.preventDefault()},children:(0,d.jsxs)("span",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"size-2 shrink-0 rounded-xs",style:{background:g.x[c].color}}),g.x[c].label]})},c))]})]})}},22022:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(28326).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/ai-tc/ai-tc/web-ui/app/(app)/error.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/ai-tc/ai-tc/web-ui/app/(app)/error.tsx","default")},22567:(a,b,c)=>{"use strict";c.d(b,{Jy:()=>g,QT:()=>f,hn:()=>e,sp:()=>d.spO,sr:()=>h});var d=c(64145);let e=[{value:"7d",label:"Last 7 days"},{value:"30d",label:"Last 30 days"},{value:"3m",label:"Last 3 months"},{value:"6m",label:"Last 6 months"}];function f(a){return e.find(b=>b.value===a)?.label??a}let g=[{value:"30m",label:"Last 30 minutes"},{value:"1h",label:"Last hour"},{value:"4h",label:"Last 4 hours"},{value:"24h",label:"Last 24 hours"}],h={"30m":"the last 30 minutes","1h":"the last hour","4h":"the last 4 hours","24h":"the last 24 hours"}},23757:(a,b,c)=>{"use strict";c.d(b,{ROTATE_CONFIRMATION:()=>h,RotateKeyDialog:()=>i});var d=c(15008),e=c(71378),f=c(1505),g=c(77292);let h="rotate";function i({open:a,onOpenChange:b,activePermanent:c,approvableBlocked:i,keyVersion:j,onConfirm:k,busy:l,error:m}){let[n,o]=(0,f.useState)(""),p=(0,g.y6)(i);return(0,d.jsx)(e.lG,{open:a,onOpenChange:a=>{a||o(""),b(a)},children:(0,d.jsxs)(e.Cf,{children:[(0,d.jsxs)(e.c7,{children:[(0,d.jsx)(e.L3,{children:"Rotate the fingerprint key"}),(0,d.jsxs)(e.rr,{children:["Rotation mints a fresh key",null!==j&&` (v${String(j)} → v${String(j+1)})`," and"," ",(0,d.jsx)("strong",{children:"invalidates every existing exception"})," — grants cannot be re-keyed and simply stop matching. They remain listed for audit."]})]}),(0,d.jsxs)(e.R4,{children:[c.length>0&&(0,d.jsxs)("div",{className:"rounded-lg border border-sev-high-fill bg-sev-high-fill p-3",children:[(0,d.jsx)("div",{className:"mb-2 text-label font-semibold uppercase tracking-wider text-sev-high-ink",children:"Active permanent grants that will stop applying"}),(0,d.jsx)("ul",{className:"flex flex-col gap-1",children:c.map(a=>(0,d.jsxs)("li",{className:"font-mono text-xs text-text-2",children:[a.ruleId," \xb7 ",a.maskedValue]},a.id))})]}),i>0?(0,d.jsxs)("div",{className:"rounded-lg border border-sev-high-fill bg-sev-high-fill p-3",children:[(0,d.jsx)("div",{className:"mb-2 text-label font-semibold uppercase tracking-wider text-sev-high-ink",children:"Blocked detections that will stop being approvable"}),(0,d.jsx)("p",{className:"text-xs text-text-2",children:p})]}):(0,d.jsx)("p",{className:"text-xs text-text-3",children:p}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"mb-1.5 text-label font-semibold uppercase tracking-wider text-text-3",children:["Type"," ",(0,d.jsxs)("span",{className:"font-mono normal-case tracking-normal",children:["“",h,"”"]})," ","to confirm"]}),(0,d.jsx)(e.pd,{value:n,onChange:a=>{o(a.target.value)},autoComplete:"off",className:"font-mono"})]}),m&&(0,d.jsx)("p",{className:"text-xs text-sev-critical-ink",children:m})]}),(0,d.jsxs)(e.Es,{children:[(0,d.jsx)(e.$n,{variant:"ghost",tone:"neutral",size:"sm",onClick:()=>{b(!1)},children:"Cancel"}),(0,d.jsx)(e.$n,{variant:"solid",tone:"danger",size:"sm",disabled:n!==h||l,onClick:()=>{k(n)},children:l?"Rotating…":"Rotate key"})]})]})})}},24061:(a,b,c)=>{"use strict";c.d(b,{$x:()=>i,Ay:()=>g,Oy:()=>m,Tp:()=>n,ek:()=>k,nR:()=>l,ni:()=>o,oo:()=>h,pS:()=>j});var d=c(64145),e=c(71378),f=c(16820);let g={[d.tLs.ClaudeCode]:"CLI agent",[d.tLs.Cursor]:"IDE",[d.tLs.Copilot]:"IDE",[d.tLs.Codex]:"CLI agent",[d.tLs.Antigravity]:"CLI agent",[d.tLs.Windsurf]:"IDE",[d.tLs.ClaudeDesktop]:"Desktop app",[d.tLs.ChatGpt]:"Web app",[d.tLs.ClaudeAi]:"Web app",[d.tLs.Api]:"API"},h=Object.values(d.tLs),i={session:{label:"Session",icon:f.k3,...e.cH.neutral},prompt:{label:"Prompt",icon:f.ny,...e.cH.primary},response:{label:"Response",icon:f.BZ,...e.cH.violet},tool:{label:"Tool",icon:f.k3,...e.cH.neutral},hook:{label:"Hook",icon:f.hF,...e.cH.low},detection:{label:"Detection",icon:f.Zu,...e.cH.critical},share:{label:"Egress",icon:f._G,...e.cH.teal},permission:{label:"Permission",icon:f.XA,...e.cH.high},commit:{label:"Commit",icon:f.OK,...e.cH.neutral},error:{label:"Error",icon:f._0,...e.cH.critical},active:{label:"In progress",icon:f.DQ,...e.cH.primary}},j={Bash:f.k3,Edit:f.qU,Write:f.qU,Read:f.oS,Grep:f.WI,WebFetch:f.fC,Task:f.hF,Agent:f.hF},k=f.k3,l={active:{label:"Live",badge:"success",dot:"bg-ok"},completed:{label:"Completed",badge:"default",dot:"bg-text-3"},interrupted:{label:"Interrupted",badge:"high",dot:"bg-sev-high"},error:{label:"Error",badge:"critical",dot:"bg-sev-critical"}},m={detections:"Findings",shares:"Data Shares",inventory:"Inventory"};function n(a){return Object.entries(a).map(([a,b])=>({name:a,n:b})).sort((a,b)=>b.n-a.n)}function o(a){return Object.values(a).reduce((a,b)=>a+b,0)}},25836:(a,b,c)=>{Promise.resolve().then(c.bind(c,46205)),Promise.resolve().then(c.bind(c,58435))},31527:(a,b,c)=>{"use strict";c.d(b,{AvailablePluginsCardView:()=>g});var d=c(15008),e=c(71378),f=c(16820);function g({plugins:a,onInstall:b,installingId:c,outcomes:g}){return 0===a.length?null:(0,d.jsxs)(e.Zp,{className:"shadow-sm",children:[(0,d.jsxs)(e.aR,{children:[(0,d.jsx)(e.AG,{tone:"teal",children:(0,d.jsx)(f.BZ,{"aria-hidden":!0,focusable:!1,className:"size-4"})}),(0,d.jsxs)(e.Lc,{children:[(0,d.jsx)(e.ZB,{children:"Available plugins"}),(0,d.jsx)(e.BT,{children:"Agent integrations you haven’t installed yet"})]})]}),(0,d.jsx)(e.Wu,{children:(0,d.jsx)("div",{className:"flex flex-col",children:a.map((a,f)=>{let h=g[a.id];return(0,d.jsxs)("div",{className:(0,e.cn)("py-3",f>0&&"border-t border-hairline"),children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"text-sm font-semibold text-text",children:a.name}),a.latest&&(0,d.jsxs)("div",{className:"mt-0.5 font-mono text-xs text-text-3",children:["v",a.latest]})]}),(0,d.jsx)(e.$n,{variant:"solid",tone:"primary",size:"sm",disabled:null!==c,onClick:()=>{b(a.id)},children:c===a.id?"Installing…":"Install"})]}),h&&(0,d.jsxs)("div",{className:(0,e.cn)("mt-2 rounded-lg border p-2",h.ok?"border-ok-fill bg-ok-fill":"border-sev-critical-fill bg-sev-critical-fill"),children:[(0,d.jsx)("div",{className:"text-xs font-semibold text-text",children:h.ok?"Installed — restart Claude Code to load it.":"Install failed"}),h.output&&(0,d.jsx)("pre",{className:"mt-1 max-h-40 overflow-auto whitespace-pre-wrap font-mono text-label text-text-2",children:h.output})]})]},a.id)})})})]})}},31999:(a,b,c)=>{Promise.resolve().then(c.bind(c,32071)),Promise.resolve().then(c.bind(c,39904)),Promise.resolve().then(c.bind(c,3867)),Promise.resolve().then(c.bind(c,12278)),Promise.resolve().then(c.bind(c,33348)),Promise.resolve().then(c.bind(c,46450)),Promise.resolve().then(c.bind(c,79568))},32502:(a,b,c)=>{"use strict";c.d(b,{Qv:()=>k,Rm:()=>i,TH:()=>m,U5:()=>j,Z3:()=>g,vy:()=>f,x_:()=>h});var d=c(13726),e=c(95043);function f({actions:a=!1}){return(0,d.jsxs)("div",{className:"flex items-start justify-between gap-4 pb-6",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)(e.EA,{className:"h-8 w-44"}),(0,d.jsx)(e.EA,{className:"h-5 w-72"})]}),a&&(0,d.jsx)(e.EA,{className:"h-8 w-32"})]})}function g(){return(0,d.jsxs)("div",{className:"flex items-center gap-2 pb-1",children:[(0,d.jsx)(e.EA,{className:"h-8 w-64"}),(0,d.jsx)(e.EA,{className:"h-8 w-24"}),(0,d.jsx)(e.EA,{className:"h-8 w-24"}),(0,d.jsx)(e.EA,{className:"h-8 w-24"}),(0,d.jsx)(e.EA,{className:"ml-auto h-8 w-20"})]})}function h({rows:a=8}){return(0,d.jsxs)("div",{className:"mt-4 overflow-hidden rounded-lg border border-border",children:[(0,d.jsxs)("div",{className:"flex items-center gap-4 border-b border-border bg-surface-2 px-4 py-2.5",children:[(0,d.jsx)(e.EA,{className:"h-3.5 w-20"}),(0,d.jsx)(e.EA,{className:"h-3.5 w-40"}),(0,d.jsx)(e.EA,{className:"h-3.5 w-24"}),(0,d.jsx)(e.EA,{className:"ml-auto h-3.5 w-16"})]}),Array.from({length:a},(a,b)=>(0,d.jsxs)("div",{className:"flex items-center gap-4 border-b border-border px-4 py-3 last:border-b-0",children:[(0,d.jsx)(e.EA,{className:"h-5 w-16"}),(0,d.jsx)(e.EA,{className:"h-4 w-56"}),(0,d.jsx)(e.EA,{className:"h-4 w-28"}),(0,d.jsx)(e.EA,{className:"ml-auto h-4 w-14"})]},b))]})}function i({className:a}){return(0,d.jsx)(e.EA,{className:(0,e.cn)("mb-3 h-12.5 w-full shrink-0 rounded-xl",a)})}function j({cards:a=3,className:b}){return(0,d.jsx)("div",{className:(0,e.cn)("grid grid-cols-1 gap-4 lg:grid-cols-3",b),children:Array.from({length:a},(a,b)=>(0,d.jsx)(e.EA,{className:"h-56"},b))})}function k({className:a}){return(0,d.jsx)(e.EA,{className:(0,e.cn)("h-64 w-full",a)})}let l={"w-80":"lg:w-80","w-85":"lg:w-85","w-88":"lg:w-88"};function m({listWidth:a="w-85",stacksBelowLg:b=!1}){return(0,d.jsxs)("div",{className:(0,e.cn)("flex flex-1 gap-4",b?"min-h-128 flex-col lg:min-h-0 lg:flex-row":"min-h-0"),children:[(0,d.jsx)("div",{className:(0,e.cn)("flex shrink-0 flex-col gap-2 rounded-lg border border-border p-3",b?l[a]:a),children:Array.from({length:8},(a,b)=>(0,d.jsx)(e.EA,{className:"h-14"},b))}),(0,d.jsxs)("div",{className:"min-h-0 flex-1 rounded-lg border border-border p-4",children:[(0,d.jsx)(e.EA,{className:"h-8 w-64"}),(0,d.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-3",children:Array.from({length:6},(a,b)=>(0,d.jsx)(e.EA,{className:"h-10"},b))}),(0,d.jsx)(e.EA,{className:"mt-6 h-72 w-full"})]})]})}},33443:(a,b,c)=>{"use strict";c.d(b,{HB:()=>d});let d='(function(){try{var p=localStorage.getItem("aka-theme");var d=p==="dark"||(p!=="light"&&matchMedia("(prefers-color-scheme: dark)").matches);document.documentElement.classList.toggle("dark",d);}catch(e){}})();'},37231:(a,b,c)=>{"use strict";c.d(b,{UpdateModal:()=>h});var d=c(15008),e=c(71378),f=c(16820),g=c(4543);function h({det:a,isUpdating:b,onClose:c,onConfirm:h}){let i=a?a.update?.latestVersion??a.latestVersion??a.version:"",j=a?.update?.latestRuleCount,k=!!a&&i!==a.version;return(0,d.jsx)(e.lG,{open:!!a,onOpenChange:a=>{a||c()},children:(0,d.jsx)(e.Cf,{className:"w-155 max-w-[96vw]","aria-describedby":void 0,children:a&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(e.L3,{className:"sr-only",children:["Update \xb7 ",a.name]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-5 py-4",children:[(0,d.jsx)("span",{className:"grid size-9.5 shrink-0 place-items-center rounded-lg bg-sev-high-fill text-sev-high-ink",children:(0,d.jsx)(f.Kp,{"aria-hidden":!0,focusable:!1,className:"size-5"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"font-display text-base font-semibold text-text",children:["Update “",a.name,"”"]}),(0,d.jsxs)("div",{className:"text-xs text-text-3",children:["From the detection library \xb7 ",a.publisher??a.namespace]})]}),(0,d.jsx)(e.$n,{variant:"ghost",tone:"neutral",size:"icon",onClick:c,"aria-label":"Close",className:"size-8 text-text-3",children:(0,d.jsx)(f.uv,{"aria-hidden":!0,focusable:!1})})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-5 overflow-y-auto p-5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("span",{className:"rounded-lg border border-border bg-surface-2 px-3 py-1.5 font-mono text-sm font-semibold text-text-2",children:k?`v${a.version}`:`${String(a.ruleCount)} rules`}),(0,d.jsx)(f.fl,{"aria-hidden":!0,focusable:!1,className:"size-4 text-text-3"}),(0,d.jsx)("span",{className:"rounded-lg border border-sev-high bg-sev-high-fill px-3 py-1.5 font-mono text-sm font-bold text-sev-high-ink",children:k?`v${i}`:`${String(j??a.ruleCount)} rules`}),(0,d.jsx)("span",{className:"flex-1"}),(0,d.jsx)(g.Jk,{publisher:a.publisher??a.namespace,kind:a.publisherKind??"user"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2.5 rounded-lg border border-ok bg-ok-fill px-3 py-2.5",children:[(0,d.jsx)(f.C1,{"aria-hidden":!0,focusable:!1,className:"size-4 shrink-0 text-ok-ink"}),(0,d.jsx)("div",{className:"text-sm text-text-2",children:"Updates are never applied automatically — your enabled state and policy assignment are preserved."})]})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2.5 border-t border-border px-5 py-4",children:[(0,d.jsx)("span",{className:"flex-1"}),(0,d.jsx)(e.$n,{variant:"outline",tone:"neutral",onClick:c,children:"Cancel"}),(0,d.jsxs)(e.$n,{variant:"solid",tone:"primary",disabled:b,onClick:()=>{h(a.id)},children:[(0,d.jsx)(f.s3,{"aria-hidden":!0,focusable:!1,className:"size-4"}),b?"Updating…":k?`Update to v${i}`:"Update rules"]})]})]})})})}},37769:(a,b,c)=>{"use strict";c.d(b,{DataSharesKindTabsView:()=>i});var d=c(15008),e=c(71378),f=c(16820),g=c(52833);function h({group:a}){let b="ip"===a.kind||"external"===a.kind;return(0,d.jsxs)(d.Fragment,{children:[g.CF[a.kind],(0,d.jsx)(e.Ex,{variant:"outline",className:"px-1.5 text-label",children:a.total}),b&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f._0,{"aria-hidden":!0,focusable:!1,className:"ip"===a.kind?"text-sev-critical-ink":"text-sev-high-ink"}),(0,d.jsx)("span",{className:"sr-only",children:"review recommended"})]})]})}function i({groups:a}){return(0,d.jsx)(e.j7,{className:"shrink-0",children:a.map(a=>(0,d.jsx)(e.Xi,{value:a.kind,children:(0,d.jsx)(h,{group:a})},a.kind))})}},37827:(a,b,c)=>{"use strict";c.d(b,{WorkspaceSettingsFormView:()=>s});var d=c(15008),e=c(64145),f=c(71378),g=c(1505);let h=[{value:"session-only",label:"Session only",description:"Only activity from after install is inspected (default — never assumed)."},{value:"full",label:"Full",description:"Pre-install surfaces (existing configs, history) may be scanned too. This grant covers reading them only — sending what the scan finds to the model API is the separate Model-judge consent below, which this one does not give. Switching back to Session only stops future scans; it cannot recall data already sent."}],i=[{value:"revoked",label:"Not granted",description:"The setup scan will not send findings to the model API (default — never assumed)."},{value:"granted",label:"Granted",description:"The setup scan may send each finding — its raw, unmasked value including any secret, plus about 120 characters of surrounding context on either side of it with any secrets in that window masked — to the model API to sort real leaks from noise."}],j=[{value:"revoked",label:"Not shared",description:"Anything not delivered live is dropped, as it was before this setting existed (default — never assumed)."},{value:"granted",label:"Shared",description:"Undelivered activity may be sent later — including the text of captured prompts, replies and tool results, in which a value is masked only where the detection that flagged it is set to redact or block."}],k=[{value:"off",label:"Off (default)",description:"Nothing recoverable is stored. Detections set to Redact & Vault fall back to one-way Redact, so values are destroyed as they are redacted."},{value:"on",label:"Allow vaulting",description:"A detected value is replaced by a pointer, and an encrypted, recoverable copy is kept in the local vault under ~/.aka — this machine holds recoverable copies of detected secrets, encrypted at rest. The pointers written into files and transcripts show where each secret is used, and which places share the same secret, to anyone who can read those files. Switching back to Off stops new vaulting but does not erase what is already stored — purging the vault from the dashboard's Vault page is what erases it."}],l=[{value:"masked",label:"Masked badge (default)",description:"Pointers render as a masked badge (category and partial value). No raw value is resolved and nothing is written to the audit trail."},{value:"full",label:"Full reveal",description:"Pointers resolve to the real value on screen, capped at two per message and never inside code blocks or quotes. The risk is real: anything the model is induced to mention renders in plaintext where it can be shoulder-surfed, screen-shared, or copy-pasted onward. Every reveal is audited."},{value:"off",label:"Off",description:"Replies are not modified; pointers show as-is."}];function m(a){return a?"on":"off"}function n(a){return void 0!==a&&!(0,e.hds)(a)}function o({label:a,description:b,name:c,choices:e,value:f,onChange:g,managed:h,notice:i,alert:j,defaultOpen:k,children:l}){let m=e.find(a=>a.value===f),n=`${c}-label`;return(0,d.jsxs)("details",{className:"group border-b border-border last:border-b-0","data-slot":"setting-row",open:!0===k,children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-3 px-4 py-3 hover:bg-surface-2",children:[(0,d.jsx)(p,{}),(0,d.jsxs)("span",{className:"flex-1",children:[(0,d.jsx)("span",{id:n,className:"block text-sm font-medium text-text",children:a}),(0,d.jsx)("span",{className:"mt-0.5 block text-xs text-text-3",children:b})]}),void 0!==j&&(0,d.jsx)("span",{className:"shrink-0 rounded-full bg-sev-high-fill px-2 py-0.5 text-xs font-medium text-sev-high-ink","data-slot":"row-alert",children:j}),void 0===h?(0,d.jsx)("span",{className:"shrink-0 text-xs font-medium text-text-2","data-slot":"current-value",children:m?.label??f}):(0,d.jsxs)("span",{className:"shrink-0 rounded-full bg-surface-2 px-2 py-0.5 text-xs text-text-3","data-slot":"managed-badge",title:h,children:[m?.label??f," \xb7 locked"]})]}),(0,d.jsxs)("div",{className:"px-4 pb-4 pl-11",children:[i,void 0!==h&&(0,d.jsxs)("p",{className:"mb-3 text-xs text-text-3","data-slot":"managed-notice",children:[h,". This setting cannot be changed here."]}),(0,d.jsx)("fieldset",{disabled:void 0!==h,className:"contents",children:(0,d.jsx)(q,{name:c,labelledBy:n,choices:e,value:f,onChange:g,disabled:void 0!==h})}),l]})]})}function p(){return(0,d.jsx)("svg",{className:"size-4 shrink-0 text-text-3 transition-transform group-open:rotate-90",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})})}function q({name:a,labelledBy:b,choices:c,value:e,onChange:g,disabled:h}){return(0,d.jsx)("div",{className:"flex flex-col gap-2",role:"radiogroup","aria-labelledby":b,children:c.map(b=>(0,d.jsxs)("label",{className:(0,f.cn)("flex items-start gap-3 rounded-lg border p-3 transition-colors",h?"cursor-not-allowed opacity-60":"cursor-pointer",e===b.value?"border-primary bg-primary-tint":(0,f.cn)("border-border bg-surface",!h&&"hover:bg-surface-2")),children:[(0,d.jsx)("input",{type:"radio",name:a,checked:e===b.value,disabled:h,onChange:()=>{g(b.value)},className:"mt-1 accent-primary"}),(0,d.jsxs)("span",{children:[(0,d.jsx)("span",{className:"block text-sm font-semibold text-text",children:b.label}),(0,d.jsx)("span",{className:"mt-0.5 block text-xs text-text-2",children:b.description})]})]},b.value))})}function r({title:a,children:b}){return(0,d.jsxs)("section",{children:[(0,d.jsx)("h2",{className:"mb-2 text-label font-semibold uppercase tracking-wider text-text-3",children:a}),(0,d.jsx)("div",{className:"overflow-hidden rounded-xl border border-border bg-surface",children:b})]})}function s({settings:a,managed:b=e.MhX,onSave:c,onAttach:p,onDetach:q,credentialState:s,detectionsHref:u="/detections",busy:v,error:w,saved:x}){let[y,z]=(0,g.useState)(a.historicalAccess),A=(0,e.DLF)(a.modelJudgeConsent)?"granted":"revoked",[B,C]=(0,g.useState)(A),[D,E]=(0,g.useState)(!1),F=(0,e.EL9)(a.historySyncConsent,a.controlPlane?.endpoint)?"granted":"revoked",[G,H]=(0,g.useState)(F),[I,J]=(0,g.useState)(!1),K=(0,e.bkE)(a.historySyncConsent,a.controlPlane?.endpoint),[L,M]=(0,g.useState)(m(a.vaultConsent)),[N,O]=(0,g.useState)(a.vaultInlineReveal),P=a=>(0,e.O2m)(b,a)?(0,e.Ly$)(b):void 0,Q=y!==a.historicalAccess||B!==A||G!==F||L!==m(a.vaultConsent)||N!==a.vaultInlineReveal||"on"===L&&n(a.vaultConsent)||I||D;return(0,d.jsxs)("div",{className:"flex max-w-4xl flex-col gap-7",children:[(0,d.jsx)(r,{title:"Connection",children:(0,d.jsx)(t,{settings:a,credentialState:s,managedLabel:P("runMode"),onAttach:p,onDetach:q,busy:v})}),(0,d.jsx)(r,{title:"Enforcement",children:(0,d.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3","data-slot":"enforcement-pointer",children:[(0,d.jsx)("span",{className:"flex-1 text-xs text-text-3",children:"What happens when a detection fires — Monitor, Warn, Redact, Redact & Vault or Block — is assigned per detection on the Detections page. There is no global handling setting: one detection can block while another only logs, and this page would not be able to say which."}),(0,d.jsx)("a",{href:u,className:"shrink-0 text-xs font-medium text-primary hover:underline",children:"Configure detections"})]})}),(0,d.jsxs)(r,{title:"Data access",children:[(0,d.jsx)(o,{label:"Historical access",description:"Consent to inspect surfaces that existed before AKA was installed.",name:"historicalAccess",choices:h,value:y,onChange:z,managed:P("historicalAccess")}),(0,d.jsx)(o,{label:"Model-judge consent",description:"Whether the setup scan may send findings to the model API.",name:"modelJudgeConsent",choices:i,value:B,onChange:a=>{E(!0),C(a)},managed:P("modelJudgeConsent"),notice:(0,d.jsx)("p",{className:"mb-3 text-xs text-text-3","data-slot":"model-judge-disclosure",children:"A separate consent from historical access: this governs whether the /aka:setup scan may send findings to the model API to sort real leaks from noise. Per finding that is the raw, unmasked value including any secret, about 120 characters of surrounding transcript text on either side of it, the rule, category, severity, masked value and confidence it was scored with, and a sequential counter the model echoes back. The file path is never sent, and any secrets in the surrounding context are masked before it goes. Revoking stops future scans; it cannot recall data already sent."})}),(0,e.lgf)(a)&&(0,d.jsx)(o,{label:"Unsent activity",description:"Whether activity this machine has not delivered may be sent later.",name:"historySyncConsent",choices:j,value:G,onChange:a=>{J(!0),H(a)},alert:K?"Paused":void 0,defaultOpen:K,notice:(0,d.jsxs)(d.Fragment,{children:[K&&(0,d.jsx)("p",{className:"mb-3 text-xs text-sev-high-ink","data-slot":"history-sync-stale-notice",children:'Your grant was recorded against an older version of this setting, which did not cover the text of captured prompts, replies and tool results — sending is paused until you re-consent. Saving with "Shared" selected re-consents to the current version.'}),(0,d.jsx)("p",{className:"mb-3 text-xs text-text-3","data-slot":"history-sync-disclosure",children:"Whether activity this machine has not delivered to the deployment it is attached to may be sent later. Two kinds qualify: what was already recorded before it attached, and anything a live send could not deliver because the deployment was unreachable or refused the credential. The first is the record of activity only: which sessions ran and when, in which project, repo and branch, token usage and model per call, which tools were called with their inputs truncated and every detected secret already masked, and what was detected in those inputs. The second is what was captured, and for a prompt, an assistant reply or a tool result that INCLUDES ITS TEXT. What is masked in that text follows the policy assigned to the detection that flagged the value: it is masked only where that policy is redact or block, and under monitor or warn the value is sent as it was seen, as is everything outside a flagged span. Every detection ships on monitor, so on a default install nothing in that text is masked. Live sending is part of being attached and this setting does not change it: declining means an undelivered item is dropped rather than kept and retried. Sending happens in the background over later sessions. Revoking stops what has not been sent; it cannot recall what has."})]})}),(0,d.jsx)(o,{label:"Reversible secret vault",description:"Permission for AKA to keep recoverable copies of what it redacts. This grant does not by itself vault anything — a detection has to be set to Redact & Vault on the Detections page. Without the grant, those detections fall back to one-way Redact.",name:"vaultConsent",choices:k,value:L,onChange:M,managed:P("vaultConsent"),alert:n(a.vaultConsent)?"Paused":void 0,defaultOpen:n(a.vaultConsent),notice:n(a.vaultConsent)?(0,d.jsx)("p",{className:"mb-3 text-xs text-sev-high-ink","data-slot":"vault-stale-notice",children:'Your grant was recorded against an older version of the vault — vaulting is paused until you re-consent. Saving with "Allow vaulting" selected re-consents to the current version.'}):null})]}),(0,d.jsx)(r,{title:"Display",children:(0,d.jsx)(o,{label:"Inline reveal in the terminal",description:"How a vault pointer renders inside Claude's on-screen replies. Display-only — the transcript and what the model sees always keep the pointer.",name:"vaultInlineReveal",choices:l,value:N,onChange:O,managed:P("vaultInlineReveal")})}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(f.$n,{variant:"solid",tone:"primary",size:"sm",disabled:!Q||v,onClick:()=>{c({historicalAccess:y,modelJudgeConsent:D?"granted"===B?"granted":"revoked":"unchanged",historySyncConsent:I?"granted"===G?"granted":"revoked":"unchanged",vaultConsent:L,vaultInlineReveal:N})},children:v?"Saving…":"Save changes"}),x&&!Q&&(0,d.jsx)("span",{className:"text-xs text-ok-ink",children:"Saved."}),w&&(0,d.jsx)("span",{className:"text-xs text-sev-critical-ink",children:w})]})]})}function t({settings:a,credentialState:b,managedLabel:c,onAttach:h,onDetach:i,busy:j}){let[k,l]=(0,g.useState)(""),[m,n]=(0,g.useState)(""),[o,p]=(0,g.useState)(""),q=(0,e.lgf)(a),r=void 0!==c,s=q?function(a){if(void 0===a||a.usable)return null;if("absent"===a.reason)return"This machine is registered, but there is no access key stored on it — so nothing is being sent or received. Attach it again to restore the connection.";if("endpoint-mismatch"===a.reason){var b,c;return b=a.credentialEndpoint,c=a.settingsEndpoint,`This machine is set to ${c}, but the access key stored on it was issued for ${b} — so nothing is being sent or received. Attach it again to ${c}, or point it back at ${b}.`}return"This machine is registered, but the access key stored on it cannot be used — so nothing is being sent or received. Attach it again to replace it."}(b):null;return(0,d.jsxs)("div",{className:"px-4 py-3","data-slot":"connection-row",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsxs)("span",{className:"flex-1",children:[(0,d.jsx)("span",{className:"block text-sm font-medium text-text",children:"Run mode"}),(0,d.jsx)("span",{className:"mt-0.5 block text-xs text-text-3",children:q?"This machine is registered against your organization’s deployment. Detection, policy and history still run against the local store under ~/.aka.":"Everything stays on this machine: detection, policy and history all run against the local store under ~/.aka. Nothing is sent anywhere."}),q&&a.controlPlane&&(0,d.jsx)("span",{className:"mt-1 block text-xs text-text-2","data-slot":"control-plane-name",children:(0,e.F$B)(a.controlPlane)})]}),(0,d.jsxs)("span",{className:(0,f.cn)("shrink-0 rounded-full px-2 py-0.5 text-xs font-medium",null!==s?"bg-sev-high-fill text-sev-high-ink":q?"bg-teal-fill text-teal-ink":"bg-surface-2 text-text-3"),"data-slot":"run-mode-badge",children:[null!==s?"Not connected":q?"Attached":"Standalone",r&&" \xb7 locked"]})]}),null!==s&&(0,d.jsx)("p",{className:"mt-3 text-xs text-sev-high-ink","data-slot":"connection-credential-notice",children:s}),q&&(0,d.jsx)("p",{className:"mt-3 text-xs text-text-3","data-slot":"connection-forwarding",children:"While this machine is attached, the plugin forwards the activity that deployment is entitled to see and pulls the policy it sets. This page reads only your local store, so it cannot report what the deployment received. Detach to stop sending."}),r?(0,d.jsxs)("p",{className:"mt-3 text-xs text-text-3","data-slot":"connection-managed-notice",children:[c,". ",q?"Your organization set this connection, so this machine cannot be detached here.":""]}):q&&i?(0,d.jsxs)("div",{className:"mt-3",children:[(0,d.jsx)(f.$n,{variant:"outline",tone:"danger",size:"sm",disabled:j,onClick:()=>{l(""),n(""),p(""),i()},"data-slot":"detach-button",children:"Detach"}),(0,d.jsx)("p",{className:"mt-2 text-xs text-text-3",children:"Detaching clears the connection and returns this machine to standalone. Findings and history already in the local store stay where they are."})]}):q?(0,d.jsx)("p",{className:"mt-3 text-xs text-text-3","data-slot":"detach-unavailable",children:"This machine is registered, and this build offers no way to detach it here."}):h?(0,d.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-2","data-slot":"attach-form",children:[(0,d.jsx)(f.pd,{value:k,placeholder:"Deployment endpoint","aria-label":"Deployment endpoint",onChange:a=>{l(a.target.value)}}),(0,d.jsx)(f.pd,{value:m,placeholder:"Name (optional)","aria-label":"Deployment name",onChange:a=>{n(a.target.value)}}),(0,d.jsx)(f.pd,{className:"sm:col-span-2",type:"password",name:"aka-access-key",value:o,placeholder:"Access key","aria-label":"Access key",autoComplete:"new-password",spellCheck:!1,autoCorrect:"off",onChange:a=>{p(a.target.value)}}),(0,d.jsx)("p",{className:"text-xs text-text-3 sm:col-span-2","data-slot":"attach-key-hint",children:"Create a plugin key in your deployment and paste it here. It is stored on this machine only, in ~/.aka/settings."}),(0,d.jsx)("div",{className:"sm:col-span-2",children:(0,d.jsx)(f.$n,{variant:"solid",tone:"primary",size:"sm",disabled:!0===j||""===k.trim()||""===o.trim(),onClick:()=>{!function(a,b,c){let d=a.accessKey.trim();b(),c(a.endpoint.trim(),a.label.trim(),d)}({endpoint:k,label:m,accessKey:o},()=>{p("")},h)},"data-slot":"attach-button",children:"Attach"})})]}):(0,d.jsx)("p",{className:"mt-3 text-xs text-text-3","data-slot":"connection-unavailable",children:"This view cannot change the connection. Attach from the AKA dashboard, or with `aka attach` in a terminal."})]})}},38564:(a,b,c)=>{"use strict";c.d(b,{VaultReuseView:()=>h});var d=c(15008),e=c(71378),f=c(55343);function g(a){return a.occurrences>1||a.sightings.length>1}function h({entries:a,hasNextPage:b=!1,hasPreviousPage:c=!1,onNextPage:h,onPreviousPage:i,loadingNextPage:j=!1,pageStart:k,total:l}){let m=a.filter(g).sort((a,b)=>b.occurrences-a.occurrences),n=0===m.length;return!n||c||b?(0,d.jsxs)("div",{className:"overflow-x-auto rounded-xl border border-border bg-surface p-4",children:[(0,d.jsx)("p",{className:"mb-3 text-xs text-text-3",children:"Values detected more than once on this machine, most-reused first."}),n?(0,d.jsx)("div",{className:"py-10 text-center text-sm text-text-3",children:"These rows moved while you were reading. Step back to see the rest."}):(0,d.jsxs)(e.XI,{children:[(0,d.jsx)(e.A0,{children:(0,d.jsxs)(e.Hj,{children:[(0,d.jsx)(e.nd,{children:"Value"}),(0,d.jsx)(e.nd,{children:"Occurrences"}),(0,d.jsx)(e.nd,{children:"Seen in"})]})}),(0,d.jsx)(e.BF,{children:m.map(a=>{let b=[...new Set(a.sightings.map(a=>a.location))];return(0,d.jsxs)(e.Hj,{children:[(0,d.jsx)(e.nA,{children:(0,d.jsx)(f.Y,{value:null,descriptor:a})}),(0,d.jsx)(e.nA,{className:"text-xs text-text-2",children:String(a.occurrences)}),(0,d.jsx)(e.nA,{children:(0,d.jsx)("ul",{className:"space-y-0.5 pl-3",children:b.map(a=>(0,d.jsx)("li",{className:"font-mono text-xs text-text-2 list-disc py-1",children:a},a))})})]},a.pointerId)})})]}),h?(0,d.jsxs)(e.dK,{children:[(0,d.jsx)(e.Eb,{disabled:!c||j,onClick:i}),(0,d.jsx)(e.D2,{children:void 0===l||void 0===k?`${String(m.length)} shown`:n?`0 of ${String(l)} reused values`:`${String(k)}–${String(k+m.length-1)} of ${String(l)} reused values`}),(0,d.jsx)(e.WA,{disabled:!b||j,loading:j,onClick:h})]}):b&&(0,d.jsxs)("p",{className:"mt-4 text-center text-xs text-text-3",children:["Showing the first ",m.length," reused values — the rest are in the store."]})]}):(0,d.jsx)("div",{className:"rounded-xl border border-border bg-surface py-10 text-center text-sm text-text-3",children:"No reused values detected on this machine."})}},40229:(a,b,c)=>{"use strict";c.d(b,{$$:()=>h,Ec:()=>i,V:()=>g});var d=c(15008),e=c(71378);let f={prompt:"Prompt","tool-input":"Tool input","tool-output":"Tool output",file:"File",transcript:"Transcript"},g={display:"Display render","explicit-reveal":"Explicit reveal","view-render":"View render","model-input":"Model input",remediation:"Remediation",purge:"Purge"};function h(){return(0,d.jsx)(e.Ex,{variant:"critical",children:"Reveal to model"})}function i({kind:a}){return(0,d.jsx)(e.Ex,{variant:"outline",children:f[a]})}},40974:(a,b,c)=>{Promise.resolve().then(c.bind(c,22022))},41002:(a,b,c)=>{"use strict";c.d(b,{FI:()=>az,WR:()=>ax,KS:()=>aT,tI:()=>aR,eS:()=>bV,Ji:()=>bT,XK:()=>m,$i:()=>aY,y9:()=>bU,xR:()=>aW,VL:()=>aS});var d=c(73024),e=c(76760),f=c(47644);c(75919);let g="aka.db";function h(a,b){if(!function(a){try{return(0,d.lstatSync)(a).isSymbolicLink()}catch{return!1}}(a))try{(0,d.chmodSync)(a,b)}catch{}}function i(a,b=!1){(0,d.mkdirSync)(a,{recursive:b,mode:448})}function j(a){return[`${a}-wal`,`${a}-shm`,`${a}-journal`]}function k(a){for(let b of[a,...j(a)])h(b,384)}let l=new Set(["localhost","127.0.0.1","::1","[::1]"]);function m(a,b){let c=function(a,b){let c,g,h=(0,e.join)(a,f.leE),i=function(a){let b=(0,d.lstatSync)(a,{throwIfNoEntry:!1});if(void 0===b)return"absent";if(b.isSymbolicLink())return"untrusted";let c=(0,d.statSync)(a,{throwIfNoEntry:!1});if(void 0===c)return"absent";let e=process.getuid?.();if(void 0!==e&&c.uid!==e)return"untrusted";if("win32"!==process.platform&&(511&c.mode)!=384)try{(0,d.chmodSync)(a,384)}catch{return"untrusted"}return"ok"}(h);if("absent"===i)return{usable:!1,reason:"absent"};if("untrusted"===i)return{usable:!1,reason:"untrusted-file"};try{c=(0,d.readFileSync)(h,"utf8")}catch(a){return{usable:!1,reason:"ENOENT"===a.code?"absent":"unreadable"}}try{g=JSON.parse(c)}catch{return{usable:!1,reason:"malformed"}}let j=f.yi_.safeParse(g);return j.success?!function(a){let b;try{b=new URL(a)}catch{return!1}return"https:"===b.protocol||"http:"===b.protocol&&l.has(b.hostname)}(j.data.endpoint)?{usable:!1,reason:"unsafe-endpoint"}:void 0!==b&&b.endpoint!==j.data.endpoint?{usable:!1,reason:"endpoint-mismatch",credentialEndpoint:j.data.endpoint,settingsEndpoint:b.endpoint}:{usable:!0,credential:j.data}:{usable:!1,reason:"malformed"}}(a,b);return c.usable?{usable:!0}:c}var n=c(77598),o=c(79868);function p(a){return(0,n.createHash)("sha256").update(a).digest("hex")}function q(a){return p((0,f.tTV)(["source_project",a]))}function r(a,b){return p((0,f.tTV)(["inspection_definition",a,b]))}function s(a,b){return`${a}.${b}.${String(Date.now())}.${(0,n.randomUUID)().slice(0,8)}.bak`}let t=".partial",u=`.bak${t}`,v="copy";function w(a){let b,c=(0,e.dirname)(a),f=`${(0,e.basename)(a)}.`;try{b=(0,d.readdirSync)(c)}catch{return}for(let a of b){if(!a.startsWith(f)||!a.endsWith(u))continue;let b=(0,e.join)(c,a);try{let a=function(a){for(let b of[(0,e.join)(a,v),a])try{return Date.now()-(0,d.statSync)(b).mtimeMs}catch{}return null}(b);null!==a&&a>3e5&&(0,d.rmSync)(b,{recursive:!0,force:!0})}catch{}}}function x(a,b){let{stage:c,copy:f}=function(a){let b=`${a}${t}`;return(0,d.rmSync)(b,{recursive:!0,force:!0}),i(b),h(b,448),{stage:b,copy:(0,e.join)(b,v)}}(b);try{a.prepare("VACUUM INTO ?").run(f),h(f,384),(0,d.renameSync)(f,b)}catch(a){try{(0,d.rmSync)(c,{recursive:!0,force:!0})}catch{}throw a}try{(0,d.rmSync)(c,{recursive:!0,force:!0})}catch{}}function y(a){return a.replace(/\\/g,"\\\\").replace(/%/g,"\\%").replace(/_/g,"\\_")}function z(a){return Array.from({length:a},()=>"?").join(", ")}function A(a){return`%${y(a)}%`}function B(a){return`(${a.map(a=>`${a} LIKE ? ESCAPE '\\'`).join(" OR ")})`}let C=0;function D(a,b,c="DEFERRED"){if(a.isTransaction){let c=`aka_sp_${String(C+=1)}`;a.exec(`SAVEPOINT ${c}`);try{b(),a.exec(`RELEASE ${c}`)}catch(b){try{a.exec(`ROLLBACK TO ${c}`),a.exec(`RELEASE ${c}`)}catch{}throw b}return}a.exec("IMMEDIATE"===c?"BEGIN IMMEDIATE":"BEGIN");try{b(),a.exec("COMMIT")}catch(b){try{a.exec("ROLLBACK")}catch{}throw b}}function E(a,b,c="DEFERRED"){let d=a.isTransaction;try{return D(a,b,c),!0}catch(b){if(!a.isTransaction&&d)throw b;return!1}}function F(a){process.stderr.write(`[aka] ${a}
|
|
2
|
-
`)}function G(a,b,c){return void 0!==a.prepare("SELECT 1 FROM sqlite_master WHERE type = ? AND name = ? LIMIT 1").get(b,c)}function H(a,b,c){let d=c?.includeGenerated?"table_xinfo":"table_info";return a.prepare(`PRAGMA ${d}(${b})`).all().map(a=>a.name)}function I(a,b){return void 0===b?a.all():Array.isArray(b)?a.all(...b):a.all(b)}function*J(a,b){for(let c of void 0===b?a.iterate():Array.isArray(b)?a.iterate(...b):a.iterate(b))yield c}function K(a,b){return void 0===b?a.get():Array.isArray(b)?a.get(...b):a.get(b)}function L(a){return 1===a||!0===a}function M(a){let b={};for(let[c,d]of Object.entries(a))b[c]=void 0===d?null:d;return b}function N(a,b,c){return K(a.prepare(b),c)?.n??0}function O(a,b,c){let d=new Map;for(let e of I(a.prepare(b),c))d.set(e.k,e.n);return d}function P(a,b){let c=[];for(let d of a)try{c.push(b(d))}catch{}return c}function Q(a){return"column"===a.kind?`column ${a.table}.${a.name}`:`table ${a.name}`}function R(a){return a.split(/-->\s*statement-breakpoint/).map(a=>a.trim()).filter(a=>a.length>0)}let S="0014_drop_legacy_events_findings";function T(a){let b=!1,c=[];for(let d of["events","findings"])try{let e=a.prepare(`SELECT count(*) AS n, ifnull(max(rowid), -1) AS hi FROM ${d}`).get();if(void 0===e){b=!0,c.push(`${d}:unreadable`);continue}e.n>0&&(b=!0),c.push(`${d}:${String(e.n)}:${String(e.hi)}`)}catch{b=!0,c.push(`${d}:unreadable`)}return{holdsRows:b,mark:c.join("|")}}let U=[{name:"input_tokens",ddl:"ALTER TABLE audit_events ADD COLUMN input_tokens integer GENERATED ALWAYS AS (json_extract(attributes, '$.input_tokens')) VIRTUAL"},{name:"output_tokens",ddl:"ALTER TABLE audit_events ADD COLUMN output_tokens integer GENERATED ALWAYS AS (json_extract(attributes, '$.output_tokens')) VIRTUAL"},{name:"cache_creation_input_tokens",ddl:"ALTER TABLE audit_events ADD COLUMN cache_creation_input_tokens integer GENERATED ALWAYS AS (json_extract(attributes, '$.cache_creation_input_tokens')) VIRTUAL"},{name:"cache_read_input_tokens",ddl:"ALTER TABLE audit_events ADD COLUMN cache_read_input_tokens integer GENERATED ALWAYS AS (json_extract(attributes, '$.cache_read_input_tokens')) VIRTUAL"},{name:"model",ddl:"ALTER TABLE audit_events ADD COLUMN model text GENERATED ALWAYS AS (json_extract(attributes, '$.model')) VIRTUAL"},{name:"provider",ddl:"ALTER TABLE audit_events ADD COLUMN provider text GENERATED ALWAYS AS (json_extract(attributes, '$.provider')) VIRTUAL"}];function V(a,b,c,d){let e=function(a,b){let c=a.prepare("SELECT last_rowid AS lastRowid FROM legacy_copy_watermark WHERE source = ?").get(b);return c?.lastRowid??0}(a,b),f=0;for(;f<1e3;){let g=c.all(e,200);if(0===g.length||(D(a,()=>{var c;d(g),e=g[g.length-1]?.rowid??e,c=e,a.prepare(`INSERT INTO legacy_copy_watermark (source, last_rowid) VALUES (?, ?)
|
|
3
|
-
ON CONFLICT(source) DO UPDATE SET last_rowid = excluded.last_rowid`).run(b,c)},"IMMEDIATE"),f+=g.length,g.length<200))return!0}return!1}function W(a,b){if(null==a)return b;try{return JSON.parse(a)}catch{return b}}function X(a){if(null!=a)try{let b=JSON.parse(a);if("object"==typeof b&&null!==b)return b}catch{}}function Y(a){return Buffer.from(JSON.stringify(a)).toString("base64url")}function Z(a){let b=X(Buffer.from(a,"base64url").toString("utf8"));return void 0!==b&&"startedAtMs"in b&&"id"in b&&Number.isInteger(b.startedAtMs)&&"string"==typeof b.id?b:null}function $(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return"UTC"}}let _={session:"session",prompt:"prompt",response:"response",tool_call:"tool",hook:"hook",detection:"detection",share:"share",permission:"permission",commit:"commit",error:"error",active:"active"},aa=Object.keys(_).map(a=>`'${a}'`).join(", ");function ab(a){if(!a)return[];let b=W(a,null);return Array.isArray(b)?b:[]}let ac=f.tLs.ClaudeCode;function ad(a){let b=f.TUN.safeParse(a);return b.success?b.data:ac}function ae(a,b,c){let d=Math.max(a.started_at,b.lastActivityMs),{status:e,endedAtMs:g}=function(a,b,c){if(a.status){let b=f.PhW.safeParse(a.status);if(b.success)return{status:b.data,endedAtMs:a.ended_at}}return null!==a.ended_at?{status:"completed",endedAtMs:a.ended_at}:b>=c-18e5?{status:"active",endedAtMs:null}:{status:"completed",endedAtMs:b}}(a,d,c);return{id:a.id,harness:ad(a.harness),title:a.title||a.project||a.repo||`Session ${a.id.slice(0,8)}`,project:a.project??"",repo:a.repo??"",branches:ab(a.branches),startedAt:(0,f.q11)(a.started_at),endedAt:null===g?null:(0,f.q11)(g),status:e,turns:b.turns,findings:b.findings,shares:b.shares}}function af(a){let b=_[a.event_type];if(!b)return null;let c=a.severity?f.U7X.safeParse(a.severity):null,d=a.link?f.Itg.safeParse(a.link):null;return{id:a.id,occurredAt:(0,f.q11)(a.started_at),kind:b,title:a.title??"",detail:a.detail??"",tool:a.tool,severity:c?.success?c.data:null,link:d?.success?d.data:null,targetId:a.target_id,internal:L(a.internal),flagged:L(a.flagged)}}let ag=`
|
|
4
|
-
id,
|
|
5
|
-
event_type,
|
|
6
|
-
started_at,
|
|
7
|
-
coalesce(content, json_extract(attributes, '$.tool_name')) AS title,
|
|
8
|
-
coalesce(json_extract(attributes, '$.detail'), json_extract(attributes, '$.target')) AS detail,
|
|
9
|
-
coalesce(json_extract(attributes, '$.tool_name'), json_extract(attributes, '$.tool')) AS tool,
|
|
10
|
-
json_extract(attributes, '$.severity') AS severity,
|
|
11
|
-
json_extract(attributes, '$.link') AS link,
|
|
12
|
-
json_extract(attributes, '$.targetId') AS target_id,
|
|
13
|
-
json_extract(attributes, '$.internal') AS internal,
|
|
14
|
-
json_extract(attributes, '$.flagged') AS flagged`,ah=`
|
|
15
|
-
SELECT root_session_id AS sessionId,
|
|
16
|
-
provider,
|
|
17
|
-
model,
|
|
18
|
-
service_tier AS serviceTier,
|
|
19
|
-
coalesce(sum(input_tokens), 0) AS inputTokens,
|
|
20
|
-
coalesce(sum(output_tokens), 0) AS outputTokens,
|
|
21
|
-
coalesce(sum(cache_creation_input_tokens), 0) AS cacheCreationTokens,
|
|
22
|
-
coalesce(sum(cache_read_input_tokens), 0) AS cacheReadTokens,
|
|
23
|
-
coalesce(sum(ephemeral_1h_input_tokens), 0) AS ephemeral1hTokens,
|
|
24
|
-
coalesce(sum(ephemeral_5m_input_tokens), 0) AS ephemeral5mTokens,
|
|
25
|
-
coalesce(sum(web_search_requests), 0) AS webSearchRequests`,ai="event_type = 'llm_call' AND attributes IS NOT NULL AND root_session_id IS NOT NULL",aj="GROUP BY root_session_id, provider, model, service_tier";function ak(a){return a.map(a=>{let b={input_tokens:a.inputTokens,output_tokens:a.outputTokens,cache_creation_input_tokens:a.cacheCreationTokens,cache_read_input_tokens:a.cacheReadTokens,ephemeral_1h_input_tokens:a.ephemeral1hTokens,ephemeral_5m_input_tokens:a.ephemeral5mTokens,web_search_requests:a.webSearchRequests};return null!==a.provider&&(b.provider=a.provider),null!==a.model&&(b.model=a.model),null!==a.serviceTier&&(b.service_tier=a.serviceTier),{sessionId:a.sessionId,attributes:b}})}let al="event_type = 'session'",am=`EXISTS (
|
|
26
|
-
SELECT 1 FROM audit_events c
|
|
27
|
-
WHERE c.root_session_id = audit_events.id
|
|
28
|
-
AND c.event_type NOT IN ('hook', 'config_scan'))`;class an{constructor(a,b=()=>Date.now()){this.db=a,this.now=b}stats(a){let{startMs:b,endMs:c}=function a(b,c){let d;try{d=new Intl.DateTimeFormat("en-US",{timeZone:b,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(new Date(c))}catch{let d=$();return b===d?function(a){let b=864e5*Math.floor(a/864e5);return{startMs:b,endMs:b+864e5}}(c):a(d,c)}let e=Object.fromEntries(d.map(a=>[a.type,a.value])),f=Number(e.year),g=Number(e.month),h=Number(e.day),i=Number(e.hour),j=Date.UTC(f,g-1,h,i,Number(e.minute),Number(e.second))-c,k=Date.UTC(f,g-1,h,0,0,0)-j;return{startMs:k,endMs:k+864e5}}(a??$(),this.now()),d=N(this.db,`SELECT count(*) AS n FROM audit_events
|
|
29
|
-
WHERE ${al} AND started_at >= ? AND started_at < ?
|
|
30
|
-
AND ${am}`,[b,c]),e=this.now()-18e5,f=N(this.db,`SELECT count(*) AS n FROM audit_events s INDEXED BY sqlite_autoindex_audit_events_1
|
|
31
|
-
WHERE s.event_type = 'session' AND s.ended_at IS NULL
|
|
32
|
-
AND s.id IN (
|
|
33
|
-
SELECT id FROM audit_events WHERE event_type = 'session' AND started_at >= ?
|
|
34
|
-
UNION
|
|
35
|
-
SELECT root_session_id FROM audit_events INDEXED BY idx_audit_started_at
|
|
36
|
-
WHERE started_at >= ?
|
|
37
|
-
UNION
|
|
38
|
-
SELECT root_session_id FROM audit_events INDEXED BY idx_audit_ended_at
|
|
39
|
-
WHERE ended_at >= ?)`,[e,e,e]),g=N(this.db,`SELECT count(*) AS n FROM audit_events
|
|
40
|
-
WHERE event_type = 'tool_call' AND started_at >= ? AND started_at < ?`,[b,c]);return Promise.resolve({sessionsToday:d,liveNow:f,toolCallsToday:g,findingsToday:N(this.db,`SELECT count(*) AS n FROM inspection_findings f
|
|
41
|
-
JOIN audit_events e ON e.id = f.audit_event_id
|
|
42
|
-
WHERE e.started_at >= ? AND e.started_at < ?`,[b,c]),egressToday:N(this.db,`SELECT count(DISTINCT json_extract(attributes, '$.destination')) AS n
|
|
43
|
-
FROM audit_events
|
|
44
|
-
WHERE event_type = 'share' AND started_at >= ? AND started_at < ?`,[b,c])})}listSessions(a){let b=a.cursor?Z(a.cursor):null,c=a.to?(0,f.I8t)(a.to):this.now(),d=a.from?(0,f.I8t)(a.from):void 0,e=[al],g=[];if(a.harness&&a.harness.length>0&&(e.push(`coalesce(json_extract(attributes, '$.harness'), '${ac}') IN (${z(a.harness.length)})`),g.push(...a.harness)),void 0!==d&&(e.push("started_at >= ?"),g.push(d)),e.push("started_at <= ?"),g.push(c),a.q){let b=A(a.q);e.push(`(content LIKE ? ESCAPE '\\'
|
|
45
|
-
OR json_extract(attributes, '$.project') LIKE ? ESCAPE '\\'
|
|
46
|
-
OR json_extract(attributes, '$.repo') LIKE ? ESCAPE '\\'
|
|
47
|
-
OR json_extract(attributes, '$.branches') LIKE ? ESCAPE '\\'
|
|
48
|
-
OR EXISTS (
|
|
49
|
-
SELECT 1 FROM audit_events d
|
|
50
|
-
WHERE d.root_session_id = audit_events.id
|
|
51
|
-
AND (d.content LIKE ? ESCAPE '\\'
|
|
52
|
-
OR json_extract(d.attributes, '$.detail') LIKE ? ESCAPE '\\')))`),g.push(b,b,b,b,b,b)}let h=N(this.db,`SELECT count(*) AS n FROM audit_events
|
|
53
|
-
WHERE ${[...e,`NOT ${am}`].join(" AND ")}`,g);a.excludeEmpty&&e.push(am),b&&(e.push("(started_at < ? OR (started_at = ? AND id < ?))"),g.push(b.startedAtMs,b.startedAtMs,b.id));let i=a.limit,j=I(this.db.prepare(`SELECT id,
|
|
54
|
-
json_extract(attributes, '$.harness') AS harness,
|
|
55
|
-
content AS title,
|
|
56
|
-
json_extract(attributes, '$.project') AS project,
|
|
57
|
-
json_extract(attributes, '$.repo') AS repo,
|
|
58
|
-
json_extract(attributes, '$.branches') AS branches,
|
|
59
|
-
json_extract(attributes, '$.status') AS status,
|
|
60
|
-
started_at,
|
|
61
|
-
ended_at
|
|
62
|
-
FROM audit_events
|
|
63
|
-
WHERE ${e.join(" AND ")}
|
|
64
|
-
ORDER BY started_at DESC, id DESC
|
|
65
|
-
LIMIT ?`),[...g,i+1]),k=j.length>i,l=k?j.slice(0,i):j,m=this.rollupsFor(l.map(a=>a.id)),n=this.now(),o=l.map(a=>ae(a,m.get(a.id)??{turns:0,findings:0,shares:0,lastActivityMs:0},n)),p=l[l.length-1];return Promise.resolve({items:o,nextCursor:k&&p?Y({startedAtMs:p.started_at,id:p.id}):null,emptyCount:h})}getSession(a){let b=K(this.db.prepare(`SELECT id,
|
|
66
|
-
json_extract(attributes, '$.harness') AS harness,
|
|
67
|
-
content AS title,
|
|
68
|
-
json_extract(attributes, '$.project') AS project,
|
|
69
|
-
json_extract(attributes, '$.repo') AS repo,
|
|
70
|
-
json_extract(attributes, '$.branches') AS branches,
|
|
71
|
-
json_extract(attributes, '$.status') AS status,
|
|
72
|
-
json_extract(attributes, '$.host') AS host,
|
|
73
|
-
json_extract(attributes, '$.cwd') AS cwd,
|
|
74
|
-
json_extract(attributes, '$.models') AS models,
|
|
75
|
-
json_extract(attributes, '$.version') AS version,
|
|
76
|
-
json_extract(attributes, '$.files') AS files,
|
|
77
|
-
started_at,
|
|
78
|
-
ended_at
|
|
79
|
-
FROM audit_events
|
|
80
|
-
WHERE id = ? AND event_type = 'session'
|
|
81
|
-
LIMIT 1`),[a]);if(!b)return Promise.resolve(null);let c=I(this.db.prepare(`SELECT ${ag}
|
|
82
|
-
FROM audit_events
|
|
83
|
-
WHERE (id = ? OR root_session_id = ?) AND event_type IN (${aa})
|
|
84
|
-
ORDER BY started_at ASC, id ASC`),[a,a]).map(af).filter(a=>null!==a),d=K(this.db.prepare(`SELECT
|
|
85
|
-
coalesce(sum(input_tokens), 0) AS input,
|
|
86
|
-
coalesce(sum(output_tokens), 0) AS output,
|
|
87
|
-
coalesce(sum(cache_creation_input_tokens), 0) AS cache_creation,
|
|
88
|
-
coalesce(sum(cache_read_input_tokens), 0) AS cache_read
|
|
89
|
-
FROM audit_events INDEXED BY idx_audit_session_type
|
|
90
|
-
WHERE root_session_id = ? AND event_type = 'llm_call'`),[a])??{input:0,output:0,cache_creation:0,cache_read:0},e=K(this.db.prepare(`SELECT model, provider FROM audit_events INDEXED BY idx_audit_session_type
|
|
91
|
-
WHERE root_session_id = ? AND event_type = 'llm_call'
|
|
92
|
-
ORDER BY started_at ASC, id ASC
|
|
93
|
-
LIMIT 1`),[a]),f=I(this.db.prepare(`SELECT coalesce(json_extract(attributes, '$.tool_name'), json_extract(attributes, '$.tool')) AS tool,
|
|
94
|
-
count(*) AS n
|
|
95
|
-
FROM audit_events INDEXED BY idx_audit_session
|
|
96
|
-
WHERE root_session_id = ? AND event_type = 'tool_call'
|
|
97
|
-
GROUP BY coalesce(json_extract(attributes, '$.tool_name'), json_extract(attributes, '$.tool'))`),[a]),g=I(this.db.prepare(`SELECT DISTINCT model FROM audit_events INDEXED BY idx_audit_session_type
|
|
98
|
-
WHERE root_session_id = ? AND event_type = 'llm_call' AND model IS NOT NULL AND model <> ''
|
|
99
|
-
ORDER BY model`),[a]).map(a=>a.model),h=N(this.db,`SELECT count(*) AS n FROM audit_events INDEXED BY idx_audit_session
|
|
100
|
-
WHERE root_session_id = ? AND event_type = 'commit'`,[a]),i=this.rollupsFor([a]).get(a)??{turns:0,findings:0,shares:0,lastActivityMs:0},j={sessionId:a,model:e?.model??"",provider:e?.provider??"",inputTokens:d.input,outputTokens:d.output,cacheCreation:d.cache_creation,cacheRead:d.cache_read,totalTokens:d.input+d.output+d.cache_creation+d.cache_read,estimatedCostUsd:null};return Promise.resolve({...ae(b,i,this.now()),host:b.host??"",cwd:b.cwd??"",models:g.length>0?g:ab(b.models),version:b.version??"",tokens:j,tools:Object.fromEntries(f.flatMap(a=>a.tool?[[a.tool,a.n]]:[])),files:ab(b.files),commits:h,events:c})}tokenReports(a){let b=I(this.db.prepare(`${ah}
|
|
101
|
-
FROM audit_events INDEXED BY idx_audit_llm_usage
|
|
102
|
-
WHERE ${ai}${void 0===a?"":" AND started_at >= ?"}
|
|
103
|
-
${aj}`),void 0===a?void 0:[a]);return Promise.resolve((0,f.ryv)(ak(b),f.q_t))}tokenReportForSession(a){let b=I(this.db.prepare(`${ah}
|
|
104
|
-
FROM audit_events
|
|
105
|
-
WHERE ${ai} AND root_session_id = ?
|
|
106
|
-
${aj}`),[a]);return Promise.resolve((0,f.ryv)(ak(b),f.q_t)[0]??null)}harnessFacets(a){let b=I(this.db.prepare(`SELECT DISTINCT coalesce(json_extract(attributes, '$.harness'), '${ac}') AS harness
|
|
107
|
-
FROM audit_events WHERE ${al}${void 0===a?"":" AND started_at >= ?"}`),void 0===a?void 0:[a]),c=new Set;for(let a of b)c.add(ad(a.harness));return Promise.resolve([...c])}rollupsFor(a){let b=new Map(a.map(a=>[a,{turns:0,findings:0,shares:0,lastActivityMs:0}]));if(0===a.length)return b;let c=z(a.length);for(let c of I(this.db.prepare(`SELECT ids.value AS id,
|
|
108
|
-
(SELECT max(started_at) FROM audit_events e WHERE e.root_session_id = ids.value) AS ms,
|
|
109
|
-
(SELECT max(ended_at) FROM audit_events e
|
|
110
|
-
WHERE e.root_session_id = ids.value AND e.ended_at IS NOT NULL) AS me
|
|
111
|
-
FROM json_each(?) AS ids`),[JSON.stringify(a)])){let a=b.get(c.id),d=Math.max(c.ms??0,c.me??0);a&&d>0&&(a.lastActivityMs=d)}for(let d of I(this.db.prepare(`SELECT root_session_id AS id, count(*) AS n
|
|
112
|
-
FROM audit_events INDEXED BY idx_audit_session_prompt
|
|
113
|
-
WHERE root_session_id IN (${c}) AND event_type = 'prompt'
|
|
114
|
-
GROUP BY root_session_id`),a)){if(null===d.id)continue;let a=b.get(d.id);a&&(a.turns=d.n)}for(let d of I(this.db.prepare(`SELECT root_session_id AS id,
|
|
115
|
-
count(DISTINCT json_extract(attributes, '$.run_key')) AS n
|
|
116
|
-
FROM audit_events INDEXED BY idx_audit_session_run_key
|
|
117
|
-
WHERE root_session_id IN (${c}) AND event_type = 'llm_call'
|
|
118
|
-
AND json_extract(attributes, '$.run_key') IS NOT NULL
|
|
119
|
-
GROUP BY root_session_id`),a)){if(null===d.id)continue;let a=b.get(d.id);a&&(a.turns=Math.max(a.turns,d.n))}for(let d of I(this.db.prepare(`SELECT e.root_session_id AS id, count(*) AS n FROM inspection_findings f
|
|
120
|
-
JOIN audit_events e ON e.id = f.audit_event_id
|
|
121
|
-
WHERE e.root_session_id IN (${c})
|
|
122
|
-
GROUP BY e.root_session_id`),a)){if(null===d.id)continue;let a=b.get(d.id);a&&(a.findings=d.n)}for(let d of I(this.db.prepare(`SELECT root_session_id AS id,
|
|
123
|
-
count(DISTINCT json_extract(attributes, '$.destination')) AS n
|
|
124
|
-
FROM audit_events INDEXED BY idx_audit_session_share
|
|
125
|
-
WHERE root_session_id IN (${c}) AND event_type = 'share'
|
|
126
|
-
GROUP BY root_session_id`),a)){if(null===d.id)continue;let a=b.get(d.id);a&&(a.shares=d.n)}return b}}class ao{constructor(a){this.db=a,this.insertStmt=a.prepare(`INSERT OR IGNORE INTO audit_events
|
|
127
|
-
(id, parent_id, root_session_id, event_type,
|
|
128
|
-
host_id, harness_id, source_project_id, started_at, ended_at,
|
|
129
|
-
severity, priority, content, content_hash, attributes)
|
|
130
|
-
VALUES
|
|
131
|
-
(:id, :parentId, :rootSessionId, :eventType,
|
|
132
|
-
:hostId, :harnessId, :sourceProjectId, :startedAt, :endedAt,
|
|
133
|
-
:severity, :priority, :content, :contentHash, :attributes)`),this.upsertLlmCallStmt=a.prepare(`INSERT INTO audit_events
|
|
134
|
-
(id, parent_id, root_session_id, event_type,
|
|
135
|
-
host_id, harness_id, source_project_id, started_at, ended_at,
|
|
136
|
-
severity, priority, content, content_hash, attributes)
|
|
137
|
-
VALUES
|
|
138
|
-
(:id, :parentId, :rootSessionId, :eventType,
|
|
139
|
-
:hostId, :harnessId, :sourceProjectId, :startedAt, :endedAt,
|
|
140
|
-
:severity, :priority, :content, :contentHash, :attributes)
|
|
141
|
-
ON CONFLICT(id) DO UPDATE SET
|
|
142
|
-
attributes = excluded.attributes,
|
|
143
|
-
ended_at = excluded.ended_at
|
|
144
|
-
WHERE COALESCE(json_extract(excluded.attributes, '$.output_tokens'), 0)
|
|
145
|
-
> COALESCE(json_extract(audit_events.attributes, '$.output_tokens'), 0)`),this.upsertSessionRootStmt=a.prepare(`INSERT OR IGNORE INTO audit_events
|
|
146
|
-
(id, parent_id, root_session_id, event_type,
|
|
147
|
-
host_id, harness_id, source_project_id, started_at, ended_at,
|
|
148
|
-
severity, priority, content, content_hash, attributes)
|
|
149
|
-
VALUES
|
|
150
|
-
(:id, :parentId, :rootSessionId, :eventType,
|
|
151
|
-
:hostId, :harnessId, :sourceProjectId, :startedAt, :endedAt,
|
|
152
|
-
:severity, :priority, :content, :contentHash, :attributes)
|
|
153
|
-
ON CONFLICT(id) DO UPDATE SET
|
|
154
|
-
parent_id = excluded.parent_id,
|
|
155
|
-
root_session_id = excluded.root_session_id,
|
|
156
|
-
host_id = excluded.host_id,
|
|
157
|
-
harness_id = excluded.harness_id,
|
|
158
|
-
source_project_id = excluded.source_project_id,
|
|
159
|
-
started_at = min(audit_events.started_at, excluded.started_at),
|
|
160
|
-
ended_at = excluded.ended_at,
|
|
161
|
-
severity = excluded.severity,
|
|
162
|
-
priority = excluded.priority,
|
|
163
|
-
content = excluded.content,
|
|
164
|
-
content_hash = excluded.content_hash,
|
|
165
|
-
attributes = excluded.attributes
|
|
166
|
-
WHERE audit_events.attributes IS NULL AND excluded.attributes IS NOT NULL`)}runInTransaction(a){D(this.db,a)}insertAuditEvent(a){let b=(0,f.V9M)(a);Number.isFinite(b.startedAt)&&("session"===b.eventType?this.upsertSessionRootStmt:this.insertStmt).run(M({id:b.id,parentId:b.parentId,rootSessionId:b.rootSessionId,eventType:b.eventType,hostId:b.hostId,harnessId:b.harnessId,sourceProjectId:b.sourceProjectId,startedAt:b.startedAt,endedAt:b.endedAt,severity:b.severity,priority:b.priority,content:b.content,contentHash:b.contentHash,attributes:b.attributes}))}ensureSessionRoot(a,b){this.insertAuditEvent({id:a,eventType:"session",startedAt:b})}insertLlmCall(a){var b,c;let d=(0,f.I8t)(a.startedAt);if(!Number.isFinite(d))return;let e=(b=a.sessionId,c=a.messageId,p((0,f.tTV)(["audit_event_llm_call",b,c])));this.upsertLlmCallStmt.run(M({id:e,parentId:a.parentId,rootSessionId:a.rootSessionId,eventType:"llm_call",hostId:null,harnessId:null,sourceProjectId:null,startedAt:d,endedAt:null,severity:null,priority:null,content:null,contentHash:null,attributes:JSON.stringify(a.attributes)}))}insertToolCall(a){var b,c;let d=(0,f.I8t)(a.startedAt);if(!Number.isFinite(d))return;let e=(b=a.sessionId,c=a.toolUseId,p((0,f.tTV)(["audit_event_tool_call",b,c])));this.insertStmt.run(M({id:e,parentId:a.parentId,rootSessionId:a.rootSessionId,eventType:"tool_call",hostId:null,harnessId:null,sourceProjectId:null,startedAt:d,endedAt:null,severity:null,priority:null,content:null,contentHash:null,attributes:JSON.stringify(a.attributes)}))}findById(a){return K(this.db.prepare("SELECT * FROM audit_events WHERE id = :id"),{id:a})}sessionProvider(a){let b=this.findById(a);if(!b?.attributes)return;let c=X(b.attributes)?.provider;if("string"==typeof c)return c}llmCallLeaves(){return I(this.db.prepare(`SELECT root_session_id AS sessionId, attributes
|
|
167
|
-
FROM audit_events
|
|
168
|
-
WHERE event_type = 'llm_call' AND attributes IS NOT NULL`))}}class ap{constructor(a){this.db=a,this.insertStmt=a.prepare(`INSERT OR IGNORE INTO classified_data (id, class, label, attributes)
|
|
169
|
-
VALUES (:id, :class, :label, :attributes)`)}upsert(a){var b;let c=(b=a.class,p((0,f.tTV)(["classified_data",b]))),d=(0,f.$BP)(a,c);return this.insertStmt.run(M({id:d.id,class:d.class,label:d.label,attributes:d.attributes})),c}}function aq(a){return K(a.prepare(`SELECT id, started_at, attributes FROM audit_events
|
|
170
|
-
WHERE event_type = 'config_scan'
|
|
171
|
-
ORDER BY started_at DESC, id DESC LIMIT 1`))}class ar{constructor(a){this.db=a}report(){let a=aq(this.db);if(!a)return{scannedAt:null,skills:[],hooks:[],mcpServers:[],configFiles:[],topics:[]};let b=I(this.db.prepare(`SELECT id, object_type AS objectType, title, location, attributes FROM inventory
|
|
172
|
-
WHERE object_type IN ('skill', 'hook', 'mcp_server', 'config_file') AND last_seen >= :startedAt
|
|
173
|
-
ORDER BY object_type, title`),{startedAt:a.started_at}),c=I(this.db.prepare(`SELECT f.masked_match AS maskedMatch, d.rule_id AS ruleId, d.name AS name
|
|
174
|
-
FROM inspection_findings f
|
|
175
|
-
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
176
|
-
WHERE f.audit_event_id = :scanId`),{scanId:a.id}),d=[],e=[],f=[],g=[],h=this.trustOverrides();for(let a of b){let b=X(a.attributes);b&&("skill"===a.objectType?d.push(function(a,b){let c={id:a.id,name:a.title??"(unnamed)",source:as(b.source)??"unknown",scope:as(b.scope)??"unknown",status:"unknown"},d=as(b.description);void 0!==d&&(c.description=d);let e=as(b.version);void 0!==e&&(c.installedVersion=e);let f=as(b.updated_at);return void 0!==f&&(c.updatedAt=f),c}(a,b)):"hook"===a.objectType?e.push(function(a,b,c){let d=as(b.command)??"",e=c.filter(a=>a.maskedMatch===d),f={id:a.id,event:as(b.event)??"unknown",command:d,scope:as(b.scope)??"unknown",status:e.some(a=>"hook-external-egress"===a.ruleId)?"egress":e.some(a=>"hook-conflict"===a.ruleId)?"conflict":e.some(a=>"hook-unknown"===a.ruleId)?"unknown":"active",warnings:e.map(a=>a.name)},g=as(b.matcher);void 0!==g&&(f.matcher=g);let h=as(b.plugin_name);return void 0!==h&&(f.pluginName=h),f}(a,b,c)):"mcp_server"===a.objectType?f.push(function(a,b,c){let d={id:a.id,name:a.title??"(unnamed)",scope:as(b.scope)??"unknown",transport:as(b.transport)??"unknown",trust:c.get(a.id)??"unapproved"},e=as(b.command);void 0!==e&&(d.command=e);let f=as(b.url);if(void 0!==f&&(d.url=f),Array.isArray(b.env_keys)){let a=b.env_keys.filter(a=>"string"==typeof a);a.length>0&&(d.envKeys=a)}let g=as(b.plugin_name);void 0!==g&&(d.pluginName=g);let h=as(b.marketplace);void 0!==h&&(d.marketplace=h);let i=as(b.project);return void 0!==i&&(d.project=i),d}(a,b,h)):g.push(function(a,b){let c=as(b.scope)??"unknown",d={id:a.id,name:a.title??"(unnamed)",path:a.location??"",scope:c,kind:as(b.kind)??"Configuration file",untracked:"local"===c},e=as(b.detail);void 0!==e&&(d.detail=e),"number"==typeof b.entry_count&&(d.entryCount=b.entry_count);let f=as(b.updated_at);return void 0!==f&&(d.updatedAt=f),d}(a,b)))}return{scannedAt:new Date(a.started_at).toISOString(),skills:d,hooks:e,mcpServers:f,configFiles:g,topics:function(a,b,c,d,e){let f=[],g=a.filter(a=>"update_available"===a.status).length,h={topic:"skills",count:a.length};g>0&&(h.attention=`${String(g)} updates`),f.push(h);let i=b.filter(a=>"egress"===a.status).length,j=b.filter(a=>"conflict"===a.status).length,k=b.filter(a=>"unknown"===a.status).length,l=[];i>0&&l.push(`${String(i)} egress`),k>0&&l.push(`${String(k)} unknown`),j>0&&l.push(`${String(j)} conflict${j>1?"s":""}`);let m={topic:"hooks",count:b.length};l.length>0&&(m.attention=l.join(" \xb7 ")),f.push(m);let n=c.filter(a=>"unapproved"===a.trust).length,o={topic:"mcp",count:c.length};n>0&&(o.attention=`${String(n)} unapproved`),f.push(o);let p=d.filter(a=>a.untracked).length,q={topic:"config_files",count:d.length};p>0&&(q.attention=`${String(p)} untracked`),f.push(q);let r=function(a){let b=X(a)?.errors;return"number"==typeof b?b:0}(e),s={topic:"configuration",count:r};return r>0&&(s.attention=`${String(r)} sources failed to parse`),f.push(s),f}(d,e,f,g,a.attributes)}}trustOverrides(){let a=I(this.db.prepare("SELECT asset_id AS assetId, trust FROM mcp_trust_override")),b=new Map;for(let c of a)("known-good"===c.trust||"risky"===c.trust||"unapproved"===c.trust)&&b.set(c.assetId,c.trust);return b}}function as(a){return"string"==typeof a?a:void 0}function at(a){let b=W(a,[]);if(!Array.isArray(b))return[];let c=[];for(let a of b)a&&"object"==typeof a&&c.push(a);return c}function au(a,b){return a.version!==b.version||a.rulesJson!==b.rulesJson}class av{constructor(a,b=()=>Date.now()){this.db=a,this.now=b}listDetections(a){let b=I(this.db.prepare(`SELECT namespace, pack_id AS packId, version, name, enabled, policy_id AS policyId,
|
|
177
|
-
rules_json AS rulesJson
|
|
178
|
-
FROM installed_packs`)),c=this.availableByPack(),d=b.map(a=>{let b=c.get(`${a.namespace}/${a.packId}`);return{namespace:a.namespace,packId:a.packId,version:a.version,name:a.name,enabled:L(a.enabled),ruleCount:at(a.rulesJson).length,policyId:a.policyId,...b&&au(a,b)?{latestVersion:b.version}:{}}});return Promise.resolve((0,f.plk)(d,a))}availableByPack(){return new Map(I(this.db.prepare(`SELECT namespace, pack_id AS packId, version, rules_json AS rulesJson
|
|
179
|
-
FROM available_packs`)).map(a=>[`${a.namespace}/${a.packId}`,a]))}getDetectionStats(){let a=I(this.db.prepare("SELECT enabled, rules_json AS rulesJson FROM installed_packs")),b=0,c=0,d=new Set;for(let e of a){L(e.enabled)&&(c+=1);let a=at(e.rulesJson);for(let c of(b+=a.length,a))"string"==typeof c.id&&d.add(c.id)}return Promise.resolve({detections:a.length,rules:b,active:c,findingsLast30d:this.countFindingsLast30d([...d])})}getDetectionDetail(a){let b=(0,f.pnU)(a);if(!b)return Promise.resolve(null);let{namespace:c,packId:d}=b,e=K(this.db.prepare(`SELECT namespace, pack_id AS packId, version, name, enabled, policy_id AS policyId,
|
|
180
|
-
rules_json AS rulesJson, updated_at AS updatedAt
|
|
181
|
-
FROM installed_packs
|
|
182
|
-
WHERE namespace = ? AND pack_id = ?`),[c,d]);if(!e)return Promise.resolve(null);let g=at(e.rulesJson),h=g.map(a=>a.id).filter(a=>"string"==typeof a),i=this.countFindingsLast30d(h),j=this.availableByPack().get(`${e.namespace}/${e.packId}`),k=j?au(e,j)?{available:!0,latestVersion:j.version,latestRuleCount:at(j.rulesJson).length}:{available:!1,latestVersion:j.version}:null;return Promise.resolve((0,f.a45)({namespace:e.namespace,packId:e.packId,version:e.version,name:e.name,enabled:L(e.enabled),rules:g,updatedAt:new Date(e.updatedAt),policyId:e.policyId},i,k))}countFindingsLast30d(a){if(0===a.length)return 0;let b=this.now()-2592e6,c=z(a.length);return N(this.db,`SELECT count(*) AS n
|
|
183
|
-
FROM inspection_findings f
|
|
184
|
-
JOIN audit_events e ON e.id = f.audit_event_id
|
|
185
|
-
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
186
|
-
WHERE e.started_at >= ?
|
|
187
|
-
AND e.event_type IN (${f.hfB})
|
|
188
|
-
AND d.rule_id IN (${c})`,[b,...a])}}class aw{constructor(a){this.db=a}contentHashes(){return Promise.resolve(new Set(I(this.db.prepare(`SELECT content_hash FROM audit_events
|
|
189
|
-
WHERE event_type IN (${f.hfB})`)).map(a=>a.content_hash)))}}let ax=864e5;class ay extends Error{constructor(a){super(`duplicate-active-exception: an active exception already exists for rule "${a}" and this value — revoke it before granting a new one`),this.code="duplicate-active-exception",this.name="DuplicateActiveExceptionError"}}class az extends Error{constructor(a){super(`ambiguous-exception-id: "${a}" matches more than one exception — add more characters`),this.code="ambiguous-exception-id",this.name="AmbiguousExceptionIdError"}}let aA=`revoked_at IS NULL
|
|
190
|
-
AND (expires_at IS NULL OR expires_at > :now)
|
|
191
|
-
AND (max_uses IS NULL OR use_count < max_uses)`,aB=`capability = 'reveal_to_model'
|
|
192
|
-
AND conditions IS NULL
|
|
193
|
-
AND ${aA}`;class aC{constructor(a,b=()=>Date.now()){this.db=a,this.now=b,this.consumeStmt=a.prepare(`UPDATE exceptions
|
|
194
|
-
SET use_count = use_count + 1, last_used_at = :now, updated_at = :now
|
|
195
|
-
WHERE id = :id AND ${aA}`),this.insertBlockedStmt=a.prepare(`INSERT OR REPLACE INTO blocked_detections (reference, rule_id, category, value_fingerprint, key_version, masked_value, session_id, repo, blocked_at)
|
|
196
|
-
VALUES (:reference, :ruleId, :category, :valueFingerprint, :keyVersion, :maskedValue, :sessionId, :repo, :blockedAt)`),this.sweepBlockedStmt=a.prepare("DELETE FROM blocked_detections WHERE blocked_at <= :cutoff")}create(a){try{return Promise.resolve(this.createSync(a))}catch(a){return Promise.reject(a instanceof Error?a:Error(String(a)))}}createSync(a){if(a.conditions?.provider!==void 0)throw Error("provider conditions are not supported yet — a grant with one would never apply");let b=(0,n.randomUUID)(),c=this.now();try{this.insertExceptionRow(b,a,c)}catch(d){if(!(d instanceof Error&&(2067===d.errcode||d.message.includes("UNIQUE constraint failed"))))throw d;D(this.db,()=>{if(1!==Number(this.db.prepare(`UPDATE exceptions
|
|
197
|
-
SET revoked_at = :now, revoked_by = :revokedBy,
|
|
198
|
-
revoke_reason = 'superseded by a new grant for the same value',
|
|
199
|
-
updated_at = :now
|
|
200
|
-
WHERE rule_id = :ruleId AND value_fingerprint = :valueFingerprint
|
|
201
|
-
AND key_version = :keyVersion AND revoked_at IS NULL
|
|
202
|
-
AND ((expires_at IS NOT NULL AND expires_at <= :now)
|
|
203
|
-
OR (max_uses IS NOT NULL AND use_count >= max_uses))`).run({now:c,revokedBy:a.createdBy,ruleId:a.ruleId,valueFingerprint:a.valueFingerprint,keyVersion:a.keyVersion}).changes))throw new ay(a.ruleId);this.insertExceptionRow(b,a,c)},"IMMEDIATE")}let d=K(this.db.prepare("SELECT * FROM exceptions WHERE id = :id"),{id:b});if(void 0===d)throw Error("exception row not found immediately after insert");return aD(d)}insertExceptionRow(a,b,c){this.db.prepare(`INSERT INTO exceptions (
|
|
204
|
-
id, rule_id, category, value_fingerprint, key_version, masked_value,
|
|
205
|
-
capability, scope, expires_at, max_uses, use_count, last_used_at,
|
|
206
|
-
justification, conditions, created_by, created_via, created_at, updated_at
|
|
207
|
-
) VALUES (
|
|
208
|
-
:id, :ruleId, :category, :valueFingerprint, :keyVersion, :maskedValue,
|
|
209
|
-
:capability, :scope, :expiresAt, :maxUses, 0, NULL, :justification,
|
|
210
|
-
:conditions, :createdBy, :createdVia, :now, :now
|
|
211
|
-
)`).run({id:a,ruleId:b.ruleId,category:b.category,valueFingerprint:b.valueFingerprint,keyVersion:b.keyVersion,maskedValue:b.maskedValue,capability:b.capability??"suppress",scope:b.scope,expiresAt:null===b.expiresAt?null:(0,f.I8t)(b.expiresAt),maxUses:b.maxUses,justification:b.justification,conditions:null===b.conditions?null:JSON.stringify(b.conditions),createdBy:b.createdBy,createdVia:b.createdVia,now:c})}list(a){let b=a?.includeTerminal?"":`WHERE ${aA}`;return Promise.resolve(P(I(this.db.prepare(`SELECT * FROM exceptions ${b} ORDER BY created_at DESC, rowid DESC`),a?.includeTerminal?{}:{now:this.now()}),aD))}getByIdPrefix(a){if(0===a.length)return Promise.resolve(void 0);let b=I(this.db.prepare(String.raw`SELECT * FROM exceptions WHERE id LIKE :pattern ESCAPE '\' LIMIT 2`),{pattern:`${y(a)}%`});if(b.length>1)return Promise.reject(new az(a));let c=b[0];if(!c)return Promise.resolve(void 0);try{return Promise.resolve(aD(c))}catch{return Promise.resolve(void 0)}}revoke(a,b,c){let d=this.now();return Promise.resolve(1===Number(this.db.prepare(`UPDATE exceptions
|
|
212
|
-
SET revoked_at = :now, revoked_by = :revokedBy, revoke_reason = :reason, updated_at = :now
|
|
213
|
-
WHERE id = :id AND revoked_at IS NULL`).run({id:a,revokedBy:b,reason:c??null,now:d}).changes))}consume(a,b=this.now()){return Promise.resolve(1===Number(this.consumeStmt.run({id:a,now:b}).changes))}activeBundleEntries(a,b=this.now()){return Promise.resolve(P(I(this.db.prepare(`SELECT * FROM exceptions
|
|
214
|
-
WHERE key_version = :keyVersion AND ${aA}
|
|
215
|
-
ORDER BY created_at DESC, rowid DESC`),{keyVersion:a,now:b}),a=>{let b=null===a.conditions?null:JSON.parse(a.conditions);return f.iRC.parse({id:a.id,ruleId:a.rule_id,valueFingerprint:a.value_fingerprint,keyVersion:a.key_version,capability:a.capability,expiresAt:null===a.expires_at?null:(0,f.q11)(a.expires_at),maxUses:a.max_uses,useCount:a.use_count,conditions:b})}))}recordBlocked(a){let b=this.now();return this.sweepBlockedStmt.run({cutoff:b-ax}),this.insertBlockedStmt.run({reference:a.reference,ruleId:a.ruleId,category:a.category,valueFingerprint:a.valueFingerprint,keyVersion:a.keyVersion,maskedValue:a.maskedValue,sessionId:a.sessionId,repo:a.repo,blockedAt:b}),Promise.resolve()}recentBlocked(a=18e5){return Promise.resolve(I(this.db.prepare(`SELECT * FROM blocked_detections
|
|
216
|
-
WHERE blocked_at > :cutoff
|
|
217
|
-
ORDER BY blocked_at DESC, rowid DESC`),{cutoff:this.now()-a}).map(a=>({reference:a.reference,ruleId:a.rule_id,category:a.category,valueFingerprint:a.value_fingerprint,keyVersion:a.key_version,maskedValue:a.masked_value,sessionId:a.session_id,repo:a.repo,blockedAt:(0,f.q11)(a.blocked_at)})))}activeRevealGrant(a,b,c,d){try{let e=d??this.now(),f=K(this.db.prepare(`SELECT id FROM exceptions
|
|
218
|
-
WHERE rule_id = :ruleId AND value_fingerprint = :valueFingerprint
|
|
219
|
-
AND key_version = :keyVersion
|
|
220
|
-
AND ${aB}
|
|
221
|
-
LIMIT 1`),{ruleId:a,valueFingerprint:b,keyVersion:c,now:e});return Promise.resolve(f??null)}catch(a){return Promise.reject(a instanceof Error?a:Error(String(a)))}}sweepTerminal(a,b=this.now()){return Promise.resolve(Number(this.db.prepare(`DELETE FROM exceptions
|
|
222
|
-
WHERE updated_at < :cutoff
|
|
223
|
-
AND (revoked_at IS NOT NULL
|
|
224
|
-
OR (expires_at IS NOT NULL AND expires_at <= :now)
|
|
225
|
-
OR (max_uses IS NOT NULL AND use_count >= max_uses))`).run({cutoff:b-a,now:b}).changes))}}function aD(a){let b=null===a.conditions?null:JSON.parse(a.conditions);return f.V8B.parse({id:a.id,ruleId:a.rule_id,category:a.category,valueFingerprint:a.value_fingerprint,keyVersion:a.key_version,maskedValue:a.masked_value,capability:a.capability,scope:a.scope,expiresAt:null===a.expires_at?null:(0,f.q11)(a.expires_at),maxUses:a.max_uses,useCount:a.use_count,lastUsedAt:null===a.last_used_at?null:(0,f.q11)(a.last_used_at),justification:a.justification,conditions:b,createdBy:a.created_by,createdVia:a.created_via,createdAt:(0,f.q11)(a.created_at),updatedAt:(0,f.q11)(a.updated_at),revokedAt:null===a.revoked_at?null:(0,f.q11)(a.revoked_at),revokedBy:a.revoked_by,revokeReason:a.revoke_reason})}function aE(a){return`(
|
|
226
|
-
SELECT fr.status FROM finding_resolution fr
|
|
227
|
-
WHERE fr.finding_key = ${a}.finding_key
|
|
228
|
-
ORDER BY fr.created_at DESC, fr.rowid DESC
|
|
229
|
-
LIMIT 1
|
|
230
|
-
)`}let aF=`(
|
|
231
|
-
SELECT finding_key, status, method, resolved_at FROM (
|
|
232
|
-
SELECT fr.finding_key, fr.status, fr.method, fr.resolved_at,
|
|
233
|
-
ROW_NUMBER() OVER (
|
|
234
|
-
PARTITION BY fr.finding_key
|
|
235
|
-
ORDER BY fr.created_at DESC, fr.rowid DESC
|
|
236
|
-
) AS rn
|
|
237
|
-
FROM finding_resolution fr
|
|
238
|
-
) WHERE rn = 1
|
|
239
|
-
)`;function aG(a,b){return(0,f._6W)({severity:a.maxSeverity,latestDetectedAt:a.latestDetectedAt,id:""},{severity:b.maxSeverity,latestDetectedAt:b.latestDetectedAt,id:""})}function aH(a){return null===a||""===a?[]:a.split(",")}function aI(a){return{id:a.id,ruleId:a.rule_id,category:a.category,severity:a.severity,maskedMatch:a.masked_match,actionTaken:a.action_taken,confidence:a.confidence,occurredAt:(0,f.q11)(a.occurred_at),sourceTool:a.source_tool,repo:a.repo??"",file:a.file??"",...null===a.tool_name?{}:{toolName:a.tool_name},eventId:a.event_id,...null===a.session_id?{}:{sessionId:a.session_id},status:(0,f.xog)({kind:a.kind,findingKey:a.finding_key,latestResolutionStatus:a.latest_status})}}class aJ{constructor(a){this.db=a}recentFindings(a){let b=a?.limit??50;return Promise.resolve(I(this.db.prepare(`SELECT f.id, f.audit_event_id AS event_id, d.rule_id, d.category, d.severity,
|
|
240
|
-
f.masked_match, f.action_taken, f.confidence, e.started_at AS occurred_at,
|
|
241
|
-
e.source_tool AS source_tool,
|
|
242
|
-
e.event_type AS kind
|
|
243
|
-
FROM audit_events e
|
|
244
|
-
CROSS JOIN inspection_findings f ON f.audit_event_id = e.id
|
|
245
|
-
CROSS JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
246
|
-
WHERE +e.event_type IN (${f.hfB})
|
|
247
|
-
ORDER BY e.started_at DESC, f.rowid DESC
|
|
248
|
-
LIMIT :limit`),{limit:b}).map(a=>({id:a.id,eventId:a.event_id,ruleId:a.rule_id,category:a.category,severity:a.severity,maskedMatch:a.masked_match,actionTaken:a.action_taken,confidence:a.confidence,occurredAt:(0,f.q11)(a.occurred_at),sourceTool:a.source_tool,kind:a.kind})))}sessionFindingsCount(a){return a?Promise.resolve(N(this.db,`SELECT count(*) AS n FROM inspection_findings f
|
|
249
|
-
JOIN audit_events e ON e.id = f.audit_event_id
|
|
250
|
-
WHERE e.root_session_id = :sessionId
|
|
251
|
-
AND e.event_type IN (${f.hfB})`,{sessionId:a})):Promise.resolve(0)}sessionFirings(a){return Object.fromEntries(O(this.db,`SELECT d.rule_id AS k, count(*) AS n
|
|
252
|
-
FROM inspection_findings f
|
|
253
|
-
JOIN audit_events e ON e.id = f.audit_event_id
|
|
254
|
-
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
255
|
-
WHERE e.root_session_id = :sessionId
|
|
256
|
-
AND e.event_type NOT IN (${f.hfB})
|
|
257
|
-
GROUP BY d.rule_id`,{sessionId:a}))}listGroupedFindings(a){let b=a.sessionId?" AND e.root_session_id = :sessionId":"",c=void 0===a.from?void 0:(0,f.I8t)(a.from),d=`WHERE e.event_type IN (${f.hfB})${b}${void 0===c?"":" AND e.started_at >= :fromMs"}`,e={...a.sessionId?{sessionId:a.sessionId}:{},...void 0===c?{}:{fromMs:c}},g=this.groupAggregates(void 0!==a.q&&""!==a.q,{predicate:d,params:e}),h=this.previewRows(g,{sessionId:a.sessionId,from:a.from}).map(aI),i=(0,f.mAj)(h,{aggregates:g}),j={severity:a.severity,providers:a.provider,actions:a.action,statuses:a.status,subtype:a.subtype,q:a.q},k=(0,f.rG)(i,j),l=(0,f.A6E)((0,f.tXp)(i,j)),m=a.status??[],n={findings:l.reduce((a,b)=>{if(0===m.length)return a+b.instanceCount;let c=g.get(b.id);return a+(c?(0,f.Bfj)(c.statusInputs,m)??b.instanceCount:b.instanceCount)},0),groups:l.length},o=a.limit??f.goN,p=void 0===a.cursor?null:function(a){let b=X(Buffer.from(a,"base64url").toString("utf8"));return void 0!==b&&"string"==typeof b.sev&&"string"==typeof b.t&&"string"==typeof b.id?{severity:b.sev,latestDetectedAt:b.t,id:b.id}:null}(a.cursor),q=null===p?0:function(a,b){let c=a.findIndex(a=>(0,f._6W)(a,b)>0);return -1===c?a.length:c}(l,p),r=l.slice(q,q+o),s=r.at(-1),t=q+o<l.length&&s?function(a){let b={sev:a.severity,t:a.latestDetectedAt,id:a.id};return Buffer.from(JSON.stringify(b)).toString("base64url")}(s):null,u=void 0===a.includeId||""===a.includeId?void 0:function(a,b,c){if(!b.some(a=>a.id===c||a.instances.some(a=>a.id===c)))return a.find(a=>a.id===c||a.instances.some(a=>a.id===c))}(l,r,a.includeId),v=m.length>0?new Set(m):null;return Promise.resolve({totals:n,facets:k,items:[...r,...u?[u]:[]].map(a=>v?{...a,instances:a.instances.filter(a=>void 0!==a.status&&v.has(a.status))}:a),nextCursor:t,...a.sessionId?{sessionFirings:this.sessionFirings(a.sessionId)}:{}})}listFindingInstances(a){let b,c={severity:a.severity,subtype:a.subtype,providers:a.provider,actions:a.action,statuses:a.status,tools:a.tool,repo:a.repo,file:a.file,q:a.q},d=a.limit??f.b2L,e=void 0===a.cursor?null:Z(a.cursor),g=null===e?()=>!0:a=>{let b=(0,f.I8t)(a.occurredAt);return b<=e.startedAtMs&&(b<e.startedAtMs||a.id<e.id)},h=(0,f.fj8)(c),i=[],j=0,k=!1;for(let e of this.scanFindingRows({sessionId:a.sessionId,from:a.from}))h.add(e),(0,f.am1)(e,c)&&(j+=1,g(e)&&(i.length<d?(i.push((0,f.MgS)(e)),b=e):k=!0));let l=k&&b?Y({startedAtMs:(0,f.I8t)(b.occurredAt),id:b.id}):null;return Promise.resolve({totals:{findings:j},facets:h.facets(),items:i,nextCursor:l})}listFindingLocations(a){let b={severity:a.severity,subtype:a.subtype,providers:a.provider,actions:a.action,statuses:a.status,tools:a.tool,q:a.q},c=a.limit??100,d=new Map,e=0;for(let c of this.scanFindingRows({sessionId:a.sessionId,from:a.from})){if(!(0,f.am1)(c,b))continue;e+=1;let a=d.get(c.repo);void 0===a&&(a=new Map,d.set(c.repo,a));let g=a.get(c.file);void 0===g&&(g=(0,f.SSj)(),a.set(c.file,g)),(0,f._5V)(g,c)}let g=0,h=[...d.entries()].map(([a,b])=>{g+=b.size;let c=[...b.entries()].map(([a,b])=>({file:a,instanceCount:b.instanceCount,maxSeverity:b.maxSeverity,latestDetectedAt:b.latestDetectedAt,...void 0===(0,f.JB8)(b.statuses)?{}:{status:(0,f.JB8)(b.statuses)},ruleIds:[...b.ruleIds].slice(0,20)})).sort(aG),d=c.reduce((a,b)=>({instanceCount:a.instanceCount+b.instanceCount,maxSeverity:0>aG(b,a)?b.maxSeverity:a.maxSeverity,latestDetectedAt:b.latestDetectedAt>a.latestDetectedAt?b.latestDetectedAt:a.latestDetectedAt}),{instanceCount:0,maxSeverity:c[0]?.maxSeverity??"low",latestDetectedAt:""}),e=c.map(a=>a.status),h=(0,f.JB8)(e);return{repo:a,instanceCount:d.instanceCount,maxSeverity:d.maxSeverity,latestDetectedAt:d.latestDetectedAt,...void 0===h?{}:{status:h},files:c}});return h.sort(aG),Promise.resolve({totals:{findings:e,repos:h.length,files:g},items:h.slice(0,c),hasMore:h.length>c})}previewRows(a,b){let c=new Map,d=0;for(let[b,e]of a){let a=Math.min(e.instanceCount,200);c.set(b,a),d+=a}let e=[];if(0===d)return e;let{sql:f,params:g}=this.findingScanSql(b),h=new Map;for(let a of J(this.db.prepare(f),g)){let b=c.get(a.rule_id);if(void 0===b)continue;let f=h.get(a.rule_id)??0;if(!(f>=b)&&(h.set(a.rule_id,f+1),e.push(a),0==(d-=1)))break}return e}*scanFindingRows(a){let{sql:b,params:c}=this.findingScanSql(a);for(let a of J(this.db.prepare(b),c))yield aI(a)}findingScanSql(a){let b=[`+e.event_type IN (${f.hfB})`],c=[];return void 0!==a.sessionId&&""!==a.sessionId&&(b.push("e.root_session_id = ?"),c.push(a.sessionId)),void 0!==a.from&&(b.push("e.started_at >= ?"),c.push((0,f.I8t)(a.from))),{sql:`SELECT f.id AS id, d.rule_id AS rule_id, d.category AS category,
|
|
258
|
-
d.severity AS severity, f.masked_match AS masked_match,
|
|
259
|
-
f.action_taken AS action_taken, f.confidence AS confidence,
|
|
260
|
-
e.started_at AS occurred_at,
|
|
261
|
-
e.source_tool AS source_tool,
|
|
262
|
-
e.repo AS repo,
|
|
263
|
-
e.file_path AS file,
|
|
264
|
-
e.tool_name AS tool_name,
|
|
265
|
-
f.audit_event_id AS event_id, e.root_session_id AS session_id,
|
|
266
|
-
e.event_type AS kind, f.finding_key AS finding_key,
|
|
267
|
-
${aE("f")} AS latest_status
|
|
268
|
-
FROM audit_events e
|
|
269
|
-
CROSS JOIN inspection_findings f ON f.audit_event_id = e.id
|
|
270
|
-
CROSS JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
271
|
-
WHERE ${b.join(" AND ")}
|
|
272
|
-
ORDER BY e.started_at DESC, f.id DESC`,params:c}}groupAggregates(a,b){let c=a?`, group_concat(DISTINCT e.repo) AS repos,
|
|
273
|
-
group_concat(DISTINCT e.file_path) AS files,
|
|
274
|
-
group_concat(DISTINCT 'via ' || e.tool_name) AS tool_names`:", NULL AS repos, NULL AS files, NULL AS tool_names";return new Map(this.db.prepare(`SELECT rule_id,
|
|
275
|
-
sum(tuple_count) AS instance_count,
|
|
276
|
-
max(latest_at) AS latest_at,
|
|
277
|
-
group_concat(source_tools) AS source_tools,
|
|
278
|
-
group_concat(actions_taken) AS actions_taken,
|
|
279
|
-
group_concat(status_tuple || '|' || tuple_count) AS status_inputs,
|
|
280
|
-
group_concat(repos) AS repos,
|
|
281
|
-
group_concat(files) AS files,
|
|
282
|
-
group_concat(tool_names) AS tool_names
|
|
283
|
-
FROM (
|
|
284
|
-
SELECT d.rule_id AS rule_id,
|
|
285
|
-
e.event_type || '|' ||
|
|
286
|
-
(CASE WHEN f.finding_key IS NULL THEN '' ELSE 'k' END) || '|' ||
|
|
287
|
-
coalesce(latest.status, '') AS status_tuple,
|
|
288
|
-
count(*) AS tuple_count,
|
|
289
|
-
max(e.started_at) AS latest_at,
|
|
290
|
-
group_concat(DISTINCT e.source_tool) AS source_tools,
|
|
291
|
-
group_concat(DISTINCT f.action_taken) AS actions_taken
|
|
292
|
-
${c}
|
|
293
|
-
FROM inspection_findings f
|
|
294
|
-
JOIN audit_events e ON e.id = f.audit_event_id
|
|
295
|
-
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
296
|
-
LEFT JOIN ${aF} latest
|
|
297
|
-
ON latest.finding_key = f.finding_key
|
|
298
|
-
${b.predicate}
|
|
299
|
-
GROUP BY d.rule_id, status_tuple
|
|
300
|
-
)
|
|
301
|
-
GROUP BY rule_id`).all(b.params).map(b=>[b.rule_id,{instanceCount:b.instance_count,sourceTools:aH(b.source_tools),actionsTaken:aH(b.actions_taken),statusInputs:aH(b.status_inputs).map(a=>{let[b="",c="",d="",e=""]=a.split("|");return{kind:b,findingKey:""===c?null:c,latestResolutionStatus:""===d?null:d,count:Number(e)}}),latestDetectedAt:(0,f.q11)(b.latest_at),...a?{searchText:[b.repos??"",b.files??"",b.tool_names??""].filter(a=>""!==a).join(" ")}:{}}]))}healthSummary(){let a=N(this.db,`SELECT count(*) AS n FROM inspection_findings f
|
|
302
|
-
JOIN audit_events e ON e.id = f.audit_event_id
|
|
303
|
-
WHERE e.event_type IN (${f.hfB})`),b=Object.fromEntries(f.S8C.map(a=>[a,0]));for(let a of I(this.db.prepare(`SELECT f.action_taken AS action_taken, count(*) AS c
|
|
304
|
-
FROM inspection_findings f
|
|
305
|
-
JOIN audit_events e ON e.id = f.audit_event_id
|
|
306
|
-
WHERE e.event_type IN (${f.hfB})
|
|
307
|
-
GROUP BY f.action_taken`)))a.action_taken in b&&(b[a.action_taken]=a.c);let c={critical:0,high:0,medium:0,low:0};for(let a of I(this.db.prepare(`SELECT d.severity AS severity, count(*) AS c
|
|
308
|
-
FROM inspection_findings f
|
|
309
|
-
JOIN audit_events e ON e.id = f.audit_event_id
|
|
310
|
-
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
311
|
-
LEFT JOIN ${aF} latest
|
|
312
|
-
ON latest.finding_key = f.finding_key
|
|
313
|
-
WHERE e.event_type IN (${f.hfB})
|
|
314
|
-
AND (latest.status IS NULL OR latest.status != 'resolved')
|
|
315
|
-
GROUP BY d.severity`)))a.severity in c&&(c[a.severity]=a.c);let d=f.IgC,e=new Set(I(this.db.prepare(`SELECT DISTINCT json_extract(target, '$.category') AS category
|
|
316
|
-
FROM policies WHERE enabled = 1 AND json_extract(target, '$.category') IS NOT NULL`)).map(a=>a.category));return Promise.resolve({findings:a,byAction:b,bySeverity:c,coverage:0===d.length?0:d.filter(a=>e.has(a)).length/d.length})}activityByDay(a=7){let b=864e5*Math.floor(Date.now()/864e5)-(a-1)*864e5,c=I(this.db.prepare(`SELECT date(e.started_at / 1000, 'unixepoch') AS day, f.action_taken AS action, count(*) AS c
|
|
317
|
-
FROM inspection_findings f
|
|
318
|
-
JOIN audit_events e ON e.id = f.audit_event_id
|
|
319
|
-
WHERE e.started_at >= :since
|
|
320
|
-
AND e.event_type IN (${f.hfB})
|
|
321
|
-
GROUP BY day, f.action_taken`),{since:b}),d=new Map;for(let c=0;c<a;c++){let a=new Date(b+864e5*c).toISOString().slice(0,10);d.set(a,{day:a,total:0,redacted:0,warned:0,blocked:0})}for(let a of c){let b=d.get(a.day);b&&(b.total+=a.c,"redact"===a.action?b.redacted+=a.c:"warn"===a.action?b.warned+=a.c:"block"===a.action&&(b.blocked+=a.c))}return Promise.resolve([...d.values()].sort((a,b)=>a.day.localeCompare(b.day)))}}let aK=["session","llm_call","tool_call"].map(a=>`'${a}'`).join(", "),aL=["prompt","response","tool_use"].map(a=>`'${a}'`).join(", "),aM=`id,
|
|
322
|
-
parent_id AS parentId,
|
|
323
|
-
root_session_id AS rootSessionId,
|
|
324
|
-
event_type AS eventType,
|
|
325
|
-
host_id AS hostId,
|
|
326
|
-
harness_id AS harnessId,
|
|
327
|
-
source_project_id AS sourceProjectId,
|
|
328
|
-
started_at AS startedAt,
|
|
329
|
-
ended_at AS endedAt,
|
|
330
|
-
severity,
|
|
331
|
-
priority,
|
|
332
|
-
content,
|
|
333
|
-
content_hash AS contentHash,
|
|
334
|
-
attributes`;class aN{constructor(a){this.db=a,this.ensureRowStmt=a.prepare("INSERT OR IGNORE INTO history_sync (id) VALUES (1)"),this.sessionsStmt=a.prepare(`SELECT COALESCE(root_session_id, id) AS sessionId, MIN(started_at) AS earliest
|
|
335
|
-
FROM audit_events
|
|
336
|
-
WHERE synced_at IS NULL
|
|
337
|
-
AND event_type IN (${aK})
|
|
338
|
-
AND started_at < :before
|
|
339
|
-
GROUP BY sessionId
|
|
340
|
-
ORDER BY earliest
|
|
341
|
-
LIMIT :limit`),this.rowsStmt=a.prepare(`SELECT ${aM}
|
|
342
|
-
FROM audit_events
|
|
343
|
-
WHERE synced_at IS NULL
|
|
344
|
-
AND event_type IN (${aK})
|
|
345
|
-
AND started_at < :before
|
|
346
|
-
AND COALESCE(root_session_id, id) = :sessionId
|
|
347
|
-
ORDER BY (event_type = 'session') DESC, started_at
|
|
348
|
-
LIMIT :limit`),this.captureRowsStmt=a.prepare(`SELECT ${aM}
|
|
349
|
-
FROM audit_events
|
|
350
|
-
WHERE synced_at IS NULL
|
|
351
|
-
AND sync_claimed_at IS NULL
|
|
352
|
-
AND outbox_owed = 1
|
|
353
|
-
AND event_type IN (${aL})
|
|
354
|
-
AND started_at < :before
|
|
355
|
-
ORDER BY started_at
|
|
356
|
-
LIMIT :limit`),this.markOwedStmt=a.prepare("UPDATE audit_events SET outbox_owed = 1 WHERE id = :id AND synced_at IS NULL"),this.stampStmt=a.prepare("UPDATE audit_events SET synced_at = :at, sync_claimed_at = NULL WHERE id = :id"),this.claimRowStmt=a.prepare("UPDATE audit_events SET sync_claimed_at = :at WHERE id = :id AND synced_at IS NULL"),this.releaseRowStmt=a.prepare("UPDATE audit_events SET sync_claimed_at = NULL WHERE id = :id"),this.releaseStaleClaimsStmt=a.prepare(`UPDATE audit_events SET sync_claimed_at = NULL
|
|
357
|
-
WHERE sync_claimed_at IS NOT NULL AND sync_claimed_at < :staleBefore`),this.partitionStmt=a.prepare(`SELECT
|
|
358
|
-
SUM(CASE WHEN synced_at IS NULL AND sync_claimed_at IS NULL THEN 1 ELSE 0 END) AS queued,
|
|
359
|
-
SUM(CASE WHEN synced_at IS NULL AND sync_claimed_at IS NOT NULL THEN 1 ELSE 0 END) AS inProgress,
|
|
360
|
-
SUM(CASE WHEN synced_at > 0 THEN 1 ELSE 0 END) AS synced,
|
|
361
|
-
SUM(CASE WHEN synced_at IS NOT NULL AND synced_at <= 0 THEN 1 ELSE 0 END) AS failed,
|
|
362
|
-
COUNT(*) AS total
|
|
363
|
-
FROM audit_events
|
|
364
|
-
WHERE event_type IN (${aK})`),this.countsStmt=a.prepare(`SELECT
|
|
365
|
-
SUM(CASE WHEN synced_at IS NULL AND started_at < :before THEN 1 ELSE 0 END) AS pending,
|
|
366
|
-
SUM(CASE WHEN synced_at > 0 THEN 1 ELSE 0 END) AS sent,
|
|
367
|
-
SUM(CASE WHEN synced_at = ${String(-1)} THEN 1 ELSE 0 END) AS skipped
|
|
368
|
-
FROM audit_events
|
|
369
|
-
WHERE event_type IN (${aK})`),this.captureSkipCountStmt=a.prepare(`SELECT COUNT(*) AS skipped
|
|
370
|
-
FROM audit_events
|
|
371
|
-
WHERE synced_at = ${String(-1)}
|
|
372
|
-
AND event_type IN (${aL})`),this.fingerprintStmt=a.prepare(`SELECT endpoint_fingerprint AS fingerprint, backlog_before AS backlogBefore
|
|
373
|
-
FROM history_sync WHERE id = 1`),this.setFingerprintStmt=a.prepare(`UPDATE history_sync
|
|
374
|
-
SET endpoint_fingerprint = :fingerprint, backlog_before = :backlogBefore
|
|
375
|
-
WHERE id = 1`),this.disownCapturesStmt=a.prepare(`UPDATE audit_events SET outbox_owed = NULL
|
|
376
|
-
WHERE outbox_owed IS NOT NULL AND event_type IN (${aL})`),this.rearmStmt=a.prepare(`UPDATE audit_events SET synced_at = NULL
|
|
377
|
-
WHERE synced_at > 0 AND event_type IN (${aK})`),this.claimStmt=a.prepare(`UPDATE history_sync
|
|
378
|
-
SET owner_pid = :pid, owner_host = :host, acquired_at = :now, heartbeat_at = :now
|
|
379
|
-
WHERE id = 1
|
|
380
|
-
AND (owner_pid IS NULL
|
|
381
|
-
OR heartbeat_at IS NULL
|
|
382
|
-
OR heartbeat_at < :staleBefore
|
|
383
|
-
OR heartbeat_at > :now)`),this.heartbeatStmt=a.prepare("UPDATE history_sync SET heartbeat_at = :now WHERE id = 1 AND owner_pid = :pid"),this.releaseStmt=a.prepare(`UPDATE history_sync
|
|
384
|
-
SET owner_pid = NULL, owner_host = NULL, acquired_at = NULL, heartbeat_at = NULL
|
|
385
|
-
WHERE id = 1 AND owner_pid = :pid`),this.closeWindowStmt=a.prepare(`UPDATE audit_events SET synced_at = :at
|
|
386
|
-
WHERE synced_at IS NULL
|
|
387
|
-
AND event_type IN (${aK})
|
|
388
|
-
AND started_at >= :attachedAt`),this.releaseBoundaryStmt=a.prepare("UPDATE history_sync SET backlog_before = NULL WHERE id = 1"),this.freezeBoundaryStmt=a.prepare("UPDATE history_sync SET backlog_before = :backlogBefore WHERE id = 1"),this.leaseStmt=a.prepare(`SELECT owner_pid AS ownerPid, owner_host AS ownerHost,
|
|
389
|
-
acquired_at AS acquiredAt, heartbeat_at AS heartbeatAt
|
|
390
|
-
FROM history_sync WHERE id = 1`),this.inspectionsStmt=a.prepare(`SELECT d.rule_id AS ruleId,
|
|
391
|
-
d.name AS ruleName,
|
|
392
|
-
d.version AS ruleVersion,
|
|
393
|
-
d.category AS category,
|
|
394
|
-
d.severity AS severity,
|
|
395
|
-
f.span_start AS spanStart,
|
|
396
|
-
f.span_end AS spanEnd,
|
|
397
|
-
f.masked_match AS maskedMatch,
|
|
398
|
-
f.action_taken AS actionTaken,
|
|
399
|
-
f.confidence AS confidence
|
|
400
|
-
FROM inspection_findings f
|
|
401
|
-
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
402
|
-
WHERE f.audit_event_id = :auditEventId
|
|
403
|
-
ORDER BY f.span_start, f.id`)}inspectionsFor(a){return I(this.inspectionsStmt,{auditEventId:a})}pendingSessions(a,b){return I(this.sessionsStmt,{limit:a,before:b}).map(a=>a.sessionId)}pendingRows(a,b,c){return I(this.rowsStmt,{sessionId:a,limit:b,before:c})}pendingCaptureRows(a,b){return I(this.captureRowsStmt,{limit:a,before:b})}markCaptureOwed(a){this.markOwedStmt.run({id:a})}markSynced(a,b){this.stampAll(a,b)}markSkipped(a){this.stampAll(a,-1)}eachInTransaction(a,b){0!==a.length&&D(this.db,()=>{for(let c of a)b(c)},"IMMEDIATE")}stampAll(a,b){0!==a.length&&D(this.db,()=>{for(let c of a)this.stampStmt.run({at:b,id:c})},"IMMEDIATE")}claimRows(a,b){this.eachInTransaction(a,a=>this.claimRowStmt.run({at:b,id:a}))}releaseRows(a){this.eachInTransaction(a,a=>this.releaseRowStmt.run({id:a}))}releaseStaleClaims(a){return Number(this.releaseStaleClaimsStmt.run({staleBefore:a}).changes)}partition(){let a=K(this.partitionStmt,{});return{queued:a?.queued??0,inProgress:a?.inProgress??0,synced:a?.synced??0,failed:a?.failed??0,total:a?.total??0}}counts(a){let b=K(this.countsStmt,{before:a}),c=K(this.captureSkipCountStmt);return{pending:b?.pending??0,sent:b?.sent??0,skipped:b?.skipped??0,capturesSkipped:c?.skipped??0}}deployment(){let a=K(this.fingerprintStmt);return{fingerprint:a?.fingerprint??void 0,backlogBefore:a?.backlogBefore??void 0}}rearmFor(a,b){this.ensureRowStmt.run(),D(this.db,()=>{let c=K(this.fingerprintStmt)?.fingerprint;this.rearmStmt.run(),null!=c&&c!==a&&this.disownCapturesStmt.run(),this.setFingerprintStmt.run({fingerprint:a,backlogBefore:b})},"IMMEDIATE")}closeAttachedWindow(a,b){this.ensureRowStmt.run(),D(this.db,()=>{let c=K(this.fingerprintStmt),d=c?.backlogBefore??a;this.closeWindowStmt.run({at:b,attachedAt:d}),this.releaseBoundaryStmt.run()},"IMMEDIATE")}freezeBoundary(a){this.ensureRowStmt.run(),this.freezeBoundaryStmt.run({backlogBefore:a})}claim(a,b,c,d){this.ensureRowStmt.run();let e=!1;return D(this.db,()=>{e=1===this.claimStmt.run({pid:a,host:b,now:c,staleBefore:c-d}).changes},"IMMEDIATE"),e}heartbeat(a,b){this.heartbeatStmt.run({now:b,pid:a})}release(a){this.releaseStmt.run({pid:a})}lease(){return K(this.leaseStmt)}}class aO{constructor(a){this.db=a,this.insertStmt=a.prepare(`INSERT OR IGNORE INTO inspection_definitions
|
|
404
|
-
(id, rule_id, name, category, severity, definition, version)
|
|
405
|
-
VALUES
|
|
406
|
-
(:id, :ruleId, :name, :category, :severity, :definition, :version)`)}upsert(a){let b=r(a.ruleId,a.version),c=(0,f.JAl)(a,b);return this.insertStmt.run({id:c.id,ruleId:c.ruleId,name:c.name,category:c.category,severity:c.severity,definition:c.definition,version:c.version}),b}}class aP{constructor(a){this.db=a,this.insertStmt=a.prepare(`INSERT INTO inspection_findings
|
|
407
|
-
(id, audit_event_id, inspection_definition_id, classified_data_id,
|
|
408
|
-
span_start, span_end, masked_match, action_taken, confidence,
|
|
409
|
-
finding_key, first_detected_at)
|
|
410
|
-
VALUES
|
|
411
|
-
(:id, :auditEventId, :inspectionDefinitionId, :classifiedDataId,
|
|
412
|
-
:spanStart, :spanEnd, :maskedMatch, :actionTaken, :confidence,
|
|
413
|
-
:findingKey,
|
|
414
|
-
COALESCE(:firstDetectedAt, (SELECT started_at FROM audit_events WHERE id = :auditEventId)))
|
|
415
|
-
ON CONFLICT(id) DO UPDATE SET
|
|
416
|
-
inspection_definition_id = excluded.inspection_definition_id
|
|
417
|
-
ON CONFLICT (finding_key) DO UPDATE SET
|
|
418
|
-
audit_event_id = excluded.audit_event_id,
|
|
419
|
-
inspection_definition_id = excluded.inspection_definition_id,
|
|
420
|
-
classified_data_id = excluded.classified_data_id,
|
|
421
|
-
span_start = excluded.span_start,
|
|
422
|
-
span_end = excluded.span_end,
|
|
423
|
-
masked_match = excluded.masked_match,
|
|
424
|
-
action_taken = excluded.action_taken,
|
|
425
|
-
confidence = excluded.confidence`),this.sessionDupStmt=a.prepare(`SELECT 1 FROM inspection_findings f
|
|
426
|
-
JOIN audit_events e ON e.id = f.audit_event_id
|
|
427
|
-
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
428
|
-
WHERE d.rule_id = :ruleId AND f.masked_match = :maskedMatch
|
|
429
|
-
AND e.root_session_id = :sessionId
|
|
430
|
-
AND e.event_type IN (${f.hfB})
|
|
431
|
-
LIMIT 1`),this.eventDupStmt=a.prepare(`SELECT 1 FROM inspection_findings f
|
|
432
|
-
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
433
|
-
WHERE f.audit_event_id = :auditEventId AND d.rule_id = :ruleId
|
|
434
|
-
AND f.masked_match = :maskedMatch
|
|
435
|
-
AND f.span_start = :spanStart AND f.span_end = :spanEnd
|
|
436
|
-
LIMIT 1`)}isSessionDuplicate(a,b,c){return void 0!==this.sessionDupStmt.get({ruleId:a,maskedMatch:b,sessionId:c})}isEventDuplicate(a,b,c,d,e){return void 0!==this.eventDupStmt.get({auditEventId:a,ruleId:b,maskedMatch:c,spanStart:d,spanEnd:e})}insertFinding(a){let b=(0,f.$3l)(a);this.insertStmt.run(M({id:b.id,auditEventId:b.auditEventId,inspectionDefinitionId:b.inspectionDefinitionId,classifiedDataId:b.classifiedDataId,spanStart:b.spanStart,spanEnd:b.spanEnd,maskedMatch:b.maskedMatch,actionTaken:b.actionTaken,confidence:b.confidence,findingKey:b.findingKey,firstDetectedAt:b.firstDetectedAt}))}}c(51455);var aQ=c(48161);function aR(){return(0,e.join)((0,aQ.homedir)(),".aka")}function aS(a=aR()){return(0,e.join)(a,"settings")}function aT(a=aR()){return(0,e.join)(a,"data")}function aU(a=function(a=process.platform){return"darwin"===a?[e.posix.join("/Library","Application Support","AKASecurity",f.WRR),e.posix.join("/Library","Managed Preferences",f.WRR)]:"win32"===a?[e.win32.join("C:\\","ProgramData","AKASecurity",f.WRR)]:[e.posix.join("/etc","aka",f.WRR)]}()){for(let b of a){let a;try{a=(0,d.readFileSync)(b,"utf8")}catch{continue}let c=X(a);if(!c)continue;let e=f.ZXz.safeParse(c);if(e.success)return e.data}return null}function aV(a,b,c=()=>new Date){if(!b)return a;let{values:d}=b,e={...a};return void 0!==d.runMode&&(e.runMode=d.runMode),void 0!==d.controlPlane&&(e.controlPlane={...d.controlPlane,attachedAt:a.controlPlane?.endpoint===d.controlPlane.endpoint?a.controlPlane.attachedAt:c().toISOString()}),void 0!==d.historicalAccess&&(e.historicalAccess=d.historicalAccess),void 0!==d.vaultKeyCustody&&(e.vaultKeyCustody=d.vaultKeyCustody),void 0!==d.vaultInlineReveal&&(e.vaultInlineReveal=d.vaultInlineReveal),void 0!==d.dataSharesInPlace&&(e.dataSharesInPlace=d.dataSharesInPlace),void 0!==d.redactFallback&&(e.redactFallback=d.redactFallback),void 0!==d.vaultConsent&&(e.vaultConsent=d.vaultConsent?a.vaultConsent?.version===f.DzG?a.vaultConsent:{acknowledgedAt:c().toISOString(),version:f.DzG}:void 0),void 0!==d.modelJudgeConsent&&(e.modelJudgeConsent=d.modelJudgeConsent?a.modelJudgeConsent?.payloadVersion===f.kxf?a.modelJudgeConsent:{acknowledgedAt:c().toISOString(),payloadVersion:f.kxf}:void 0),e}function aW(a=aR()){return aV(aX(a),aU())}function aX(a){let b=function(a){let b;try{b=(0,d.readFileSync)(a,"utf8")}catch{return null}return X(b)??null}((0,e.join)(aS(a),"settings.json"));if(!b)return(0,f.i1j)();try{return f.hd_.parse(b)}catch{return(0,f.i1j)()}}function aY(a=aR(),b){let c=void 0===b?aU():b;return{settings:aV(aX(a),c),managed:c?{present:!0,...void 0===c.organization?{}:{organization:c.organization},lockedFields:c.lockedFields}:f.MhX}}new Int32Array(new SharedArrayBuffer(4));class aZ extends Error{constructor(a,b,c,d){super(function(a,b,c,d){switch(d){case"lock":return`refusing to re-assign '${a}': its policy is set by the connected control plane`;case"disable":return`refusing to disable '${a}': it is governed by the connected control plane`;case"floor":return`refusing to set '${a}' to '${b??"unassigned"}': the connected control plane requires at least '${c}'`}}(a,b,c,d)),this.name="PolicyFloorError",this.pack=a,this.attempted=b,this.floor=c,this.refusal=d}}function a$(a=aR()){if(!(0,f.lgf)(aW(a)))return null;let b=function(a=aR()){try{let b=(0,d.readFileSync)((0,e.join)(aT(a),"policy-cache.json"),"utf8"),c=JSON.parse(b);if("object"!=typeof c||null===c)return null;return f.vap.parse(c.bundle)}catch{return null}}(a);if(null===b)return null;let c=function(a){let b=new Map,c=new Map;for(let d of a)d.enabled&&("ruleId"in d.target?b.has(d.target.ruleId)||b.set(d.target.ruleId,d.action):c.has(d.target.category)||c.set(d.target.category,d.action));return{byRuleId:b,byCategory:c}}(b.policies);return{floorFor:a=>(function(a,b,{byRuleId:c,byCategory:d}){let e=null;for(let b of a){let a=c.get(b.id)??d.get(b.category);void 0!==a&&(e=null===e?a:(0,f.Lq6)(e,a))}return null===e?null:{floor:(0,f.GWi)(e),locked:function(a,b,c){let d=new Set(b.map(a=>a.id)),e=new Set(b.map(a=>a.category)),f=b.some(a=>c.has(a.id));return a.some(a=>!!a.enabled&&"authored"===a.provenance&&("ruleId"in a.target?d.has(a.target.ruleId):f&&e.has(a.target.category)))}(b,a,c)}})(a,b.policies,c)}}function a_(a){let b=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-.]+))?$/.exec(a.trim());return b?{core:[Number(b[1]),Number(b[2]),Number(b[3])],pre:b[4]?b[4].split("."):[]}:null}let a0=f.Jr;function a1(a){return a.map(a=>{var b;return`${a.namespace}/${a.packId}@${a.version}#${b=a.rulesJson,(0,n.createHash)("sha256").update(b).digest("hex")}`}).sort().join(",")}function a2(a){let b=/^(\d+)\.(\d+)\.(\d+)/.exec(a);return b?[Number(b[1]),Number(b[2]),Number(b[3])]:null}class a3{constructor(a,b){this.db=a,this.baseDir=b,this.insertMissingStmt=a.prepare(`INSERT INTO installed_packs (id, namespace, pack_id, version, name, rules_json, enabled, created_at, updated_at)
|
|
437
|
-
VALUES (:id, :namespace, :packId, :version, :name, :rulesJson, 1, :now, :now)
|
|
438
|
-
ON CONFLICT (namespace, pack_id) DO NOTHING`),this.upsertAvailableStmt=a.prepare(`INSERT INTO available_packs (id, namespace, pack_id, version, name, rules_json, recorded_by, updated_at)
|
|
439
|
-
VALUES (:id, :namespace, :packId, :version, :name, :rulesJson, :recordedBy, :now)
|
|
440
|
-
ON CONFLICT (namespace, pack_id) DO UPDATE SET
|
|
441
|
-
version = excluded.version,
|
|
442
|
-
name = excluded.name,
|
|
443
|
-
rules_json = excluded.rules_json,
|
|
444
|
-
recorded_by = excluded.recorded_by,
|
|
445
|
-
updated_at = excluded.updated_at
|
|
446
|
-
WHERE available_packs.version <> excluded.version
|
|
447
|
-
OR available_packs.name <> excluded.name
|
|
448
|
-
OR available_packs.rules_json <> excluded.rules_json`),this.signatureStmt=a.prepare("SELECT namespace, pack_id AS packId, version, rules_json AS rulesJson FROM available_packs"),this.packRulesStmt=a.prepare(`SELECT rules_json AS rulesJson FROM installed_packs
|
|
449
|
-
WHERE namespace = ? AND pack_id = ?`)}recordInventory(a,b){if(0!==a.length)try{let c=a.map(a=>({namespace:a.namespace,packId:a.packId,version:a.version,name:a.name,rulesJson:JSON.stringify(a.rules),ruleIds:new Set(a.rules.map(a=>a.id))}));if(this.storedSignature()===a1(c))return;let d=Date.now();D(this.db,()=>{let a=this.mirrorState(),e=!1;for(let f of c){let c={id:(0,n.randomUUID)(),namespace:f.namespace,packId:f.packId,version:f.version,name:f.name,rulesJson:f.rulesJson,now:d},g=a.get(`${f.namespace}/${f.packId}`);void 0===g||!function(a,b){let c=a2(a.version);if(null===c)return!0;let d=a2(b.version);if(null===d)return!1;for(let a=0;a<3;a++){let b=c[a]??0,e=d[a]??0;if(b!==e)return b<e}for(let c of b.ruleIds)if(!a.ruleIds.has(c))return!0;return!1}(f,g)?this.upsertAvailableStmt.run({...c,id:(0,n.randomUUID)(),recordedBy:b?.recordedBy??null}):e=!0,this.insertMissingStmt.run(c)}e||this.pruneAvailable(c.map(a=>`${a.namespace}/${a.packId}`))},"IMMEDIATE")}catch{}}mirrorState(){return new Map(I(this.db.prepare("SELECT namespace, pack_id AS packId, version, rules_json AS rulesJson FROM available_packs")).map(a=>[`${a.namespace}/${a.packId}`,{version:a.version,ruleIds:function(a){let b=new Set,c=W(a,[]);if(!Array.isArray(c))return b;for(let a of c)if(a&&"object"==typeof a){let c=a.id;"string"==typeof c&&b.add(c)}return b}(a.rulesJson)}]))}pruneAvailable(a){let b=I(this.db.prepare("SELECT namespace, pack_id AS packId FROM available_packs")),c=new Set(a),d=this.db.prepare("DELETE FROM available_packs WHERE namespace = ? AND pack_id = ?");for(let a of b)c.has(`${a.namespace}/${a.packId}`)||d.run(a.namespace,a.packId)}applyUpdate(a,b){if(this.db.isTransaction)throw Error("applyUpdate must not be called inside an open transaction");let c=!1;return D(this.db,()=>{this.db.exec("UPDATE _pack_write_gate SET open = 1 WHERE id = 1");let d=this.db.prepare(`UPDATE installed_packs SET
|
|
450
|
-
version = (SELECT a.version FROM available_packs a
|
|
451
|
-
WHERE a.namespace = :namespace AND a.pack_id = :packId),
|
|
452
|
-
name = (SELECT a.name FROM available_packs a
|
|
453
|
-
WHERE a.namespace = :namespace AND a.pack_id = :packId),
|
|
454
|
-
rules_json = (SELECT a.rules_json FROM available_packs a
|
|
455
|
-
WHERE a.namespace = :namespace AND a.pack_id = :packId),
|
|
456
|
-
updated_at = :now
|
|
457
|
-
WHERE namespace = :namespace AND pack_id = :packId
|
|
458
|
-
AND EXISTS (SELECT 1 FROM available_packs a
|
|
459
|
-
WHERE a.namespace = :namespace AND a.pack_id = :packId)`).run({namespace:a,packId:b,now:Date.now()});this.db.exec("UPDATE _pack_write_gate SET open = 0 WHERE id = 1"),c=Number(d.changes)>0},"IMMEDIATE"),c}installedRuleset(){let a=I(this.db.prepare(`SELECT enabled, policy_id AS policyId, rules_json AS rulesJson, version,
|
|
460
|
-
namespace, pack_id AS packId
|
|
461
|
-
FROM installed_packs
|
|
462
|
-
ORDER BY namespace, pack_id`)),b={installedPacks:a.length,enabledPacks:0,rules:[],invalidRules:0,rejectedRules:[],ruleActions:new Map,ruleVersions:new Map,reversibleRules:new Set},c=(a,c,d)=>{b.rejectedRules.length>=10||b.rejectedRules.push({pack:a,ruleId:c,reason:d})};for(let d of a){let a;if(!L(d.enabled))continue;b.enabledPacks+=1;let e=(0,f.DhA)(d.policyId),g=(0,f.TdZ)(d.policyId),h=`${d.namespace}/${d.packId}`;try{a=JSON.parse(d.rulesJson)}catch{b.invalidRules+=1,c(h,null,"rules_json: malformed JSON");continue}if(!Array.isArray(a)){b.invalidRules+=1,c(h,null,"rules_json: not an array");continue}for(let i of a){let a=f.jON.safeParse(i);a.success?(b.rules.push(a.data),b.ruleActions.set(a.data.id,e),b.ruleVersions.set(a.data.id,d.version),g?b.reversibleRules.add(a.data.id):b.reversibleRules.delete(a.data.id)):(b.invalidRules+=1,c(h,function(a){if("object"!=typeof a||null===a)return null;let b=a.id;return f.jON.shape.id.safeParse(b).success?b:null}(i),function(a){let b=a.issues[0];if(!b)return"unknown";let c=b.path.map(a=>String(a)).join(".");return c?`${c}: ${b.code}`:b.code}(a.error)))}}return b}newestRecordedBinary(){let a=I(this.db.prepare("SELECT DISTINCT recorded_by AS recordedBy FROM available_packs WHERE recorded_by IS NOT NULL")),b=null;for(let c of a){let a=c.recordedBy.lastIndexOf("@");if(a<=0||a===c.recordedBy.length-1)continue;let d=c.recordedBy.slice(0,a),e=c.recordedBy.slice(a+1);null!==a_(e)&&(null===b||function(a,b){let c=a_(a),d=a_(b);if(!c||!d)return 0;for(let a=0;a<3;a++){let b=c.core[a]??0,e=d.core[a]??0;if(b!==e)return b<e?-1:1}return function(a,b){if(0===a.length&&0===b.length)return 0;if(0===a.length)return 1;if(0===b.length)return -1;let c=Math.min(a.length,b.length);for(let d=0;d<c;d++){let c=a[d]??"",e=b[d]??"";if(c===e)continue;let f=/^\d+$/.test(c),g=/^\d+$/.test(e);if(f&&!g)return -1;if(!f&&g)return 1;if(f&&g)return Number(c)<Number(e)?-1:1;return c<e?-1:1}return a.length===b.length?0:a.length<b.length?-1:1}(c.pre,d.pre)}(e,b.version)>0)&&(b={binary:d,version:e})}return b}counts(){return Promise.resolve(K(this.db.prepare(`SELECT count(*) AS packs,
|
|
463
|
-
coalesce(sum(json_array_length(rules_json)), 0) AS rules,
|
|
464
|
-
coalesce(sum(enabled), 0) AS enabled
|
|
465
|
-
FROM installed_packs`))??{packs:0,rules:0,enabled:0})}countsByPolicyId(){return O(this.db,`SELECT coalesce(policy_id, '${a0}') AS k, count(*) AS n
|
|
466
|
-
FROM installed_packs
|
|
467
|
-
GROUP BY k`)}listByPolicyId(a){return I(this.db.prepare(`SELECT namespace, pack_id AS packId, name, enabled, rules_json AS rulesJson
|
|
468
|
-
FROM installed_packs
|
|
469
|
-
WHERE coalesce(policy_id, '${a0}') = ?
|
|
470
|
-
ORDER BY name ASC`),[a]).map(a=>({id:`${a.namespace}/${a.packId}`,name:a.name,ruleCount:at(a.rulesJson).length,enabled:L(a.enabled)}))}packFloorRules(a,b){let c=K(this.packRulesStmt,[a,b]);return c?at(c.rulesJson).map(a=>({id:a.id,category:a.category})):[]}policyFloor(a,b){return void 0===this.baseDir?null:function(a,b=aR()){let c=a$(b);return null===c?null:c.floorFor(a)}(this.packFloorRules(a,b),this.baseDir)}policyFloors(a){let b=new Map;if(void 0===this.baseDir)return b;let c=a$(this.baseDir);if(null===c)return b;for(let d of a){let a=c.floorFor(this.packFloorRules(d.namespace,d.packId));null!==a&&b.set(`${d.namespace}/${d.packId}`,a)}return b}setPolicy(a,b,c){if(null!==c&&!f.HUb.safeParse(c).success)throw Error(`Unknown policy '${c}'. Must be one of: ${f.V0H.join(", ")}.`);let d=this.policyFloor(a,b);if(null!==d){let e=function(a,b){if(b.locked)return"lock";let c=a??f.Jr;return(0,f.T2I)((0,f.fhc)(c),(0,f.fhc)(b.floor))?null:"floor"}(c,d);if(null!==e)throw new aZ(`${a}/${b}`,c,d.floor,e)}return Number(this.db.prepare(`UPDATE installed_packs SET policy_id = :policyId, updated_at = :now
|
|
471
|
-
WHERE namespace = :namespace AND pack_id = :packId`).run({policyId:c,now:Date.now(),namespace:a,packId:b}).changes)>0}setEnabled(a,b,c){let d=this.policyFloor(a,b);if(null!==d){let e=null===d||c?null:"disable";if(null!==e)throw new aZ(`${a}/${b}`,null,d.floor,e)}return Number(this.db.prepare(`UPDATE installed_packs SET enabled = :enabled, updated_at = :now
|
|
472
|
-
WHERE namespace = :namespace AND pack_id = :packId`).run({enabled:+!!c,now:Date.now(),namespace:a,packId:b}).changes)>0}storedSignature(){return a1(I(this.signatureStmt))}}class a4{constructor(a){this.db=a,this.upsertStmt=a.prepare(`INSERT INTO inventory
|
|
473
|
-
(id, object_type, location, title, host_id, attributes, first_seen, last_seen)
|
|
474
|
-
VALUES
|
|
475
|
-
(:id, :objectType, :location, :title, :hostId, :attributes, :firstSeen, :lastSeen)
|
|
476
|
-
ON CONFLICT(id) DO UPDATE SET
|
|
477
|
-
location = excluded.location,
|
|
478
|
-
title = excluded.title,
|
|
479
|
-
host_id = excluded.host_id,
|
|
480
|
-
attributes = excluded.attributes,
|
|
481
|
-
last_seen = excluded.last_seen`)}upsert(a,b=Date.now()){var c,d;let e=(c=a.objectType,d=a.identityKey,p((0,f.tTV)(["inventory",c,d]))),g=(0,f.gzP)(a,e,b);return this.upsertStmt.run(M({id:g.id,objectType:g.objectType,location:g.location,title:g.title,hostId:g.hostId,attributes:g.attributes,firstSeen:g.firstSeen,lastSeen:g.lastSeen})),e}findById(a){return K(this.db.prepare("SELECT * FROM inventory WHERE id = :id"),{id:a})}distinctTitles(a){return I(this.db.prepare(`SELECT DISTINCT title FROM inventory
|
|
482
|
-
WHERE object_type = :objectType AND title IS NOT NULL
|
|
483
|
-
ORDER BY title`),{objectType:a}).map(a=>a.title)}osVersions(){return I(this.db.prepare(`SELECT DISTINCT os_version AS value FROM inventory
|
|
484
|
-
WHERE object_type = 'host' AND os_version IS NOT NULL
|
|
485
|
-
ORDER BY value`)).map(a=>a.value)}}let a5=["config","skill","mcp","hook"],a6=new Set(f.SHn.options),a7="(url IS NULL OR (url NOT LIKE '%/.claude/worktrees/%' AND url NOT LIKE '%\\.claude\\worktrees\\%'))",a8={[f.tLs.ClaudeCode]:"Claude Code",[f.tLs.Cursor]:"Cursor",[f.tLs.Codex]:"Codex",[f.tLs.Antigravity]:"Antigravity"},a9={accessCounts:{open:0,approved:0,blocked:0,total:0},findingsCount:0},ba=a=>a.toLowerCase().replace(/[\s-]/g,""),bb={ClaudeCode:ba(f.Zdp.ClaudeCode),Cursor:ba(f.Zdp.Cursor),Codex:ba(f.Zdp.Codex),Antigravity:ba(f.Zdp.Antigravity)};function bc(a,b){if(a.provider&&a6.has(a.provider))return a.provider;let c=ba(b.title??"");return c.includes(bb.ClaudeCode)||"claude"===c?f.tLs.ClaudeCode:c.includes(bb.Cursor)?f.tLs.Cursor:c.includes(bb.Codex)?f.tLs.Codex:c.includes(bb.Antigravity)?f.tLs.Antigravity:null}function bd(a){return a.some(a=>{let b=W(a.attributes,{});return"sample"!==b.provenance&&bc(b,a)===f.tLs.ClaudeCode})}function be(a){let b={id:a.id,type:a.assetType,name:a.name,sub:a.sub??"",flags:W(a.flagsJson,[])};return"mcp"===a.assetType&&a.effectiveTrust&&(b.trust=a.effectiveTrust),b}function bf(a){let b="update_available"===a.status?["update"]:[],c={source:a.source,scope:a.scope};return void 0!==a.installedVersion&&(c.installedVersion=a.installedVersion),void 0!==a.latestVersion&&(c.latestVersion=a.latestVersion),void 0!==a.updatedAt&&(c.updatedAt=a.updatedAt),{id:a.id,assetType:"skill",name:a.name,sub:`Skill \xb7 ${a.source}`,description:a.description??null,flagsJson:JSON.stringify(b),metaJson:JSON.stringify(c),trust:null,toolsJson:null,effectiveTrust:null}}function bg(a){let b="egress"===a.status?["risk"]:"conflict"===a.status?["conflict"]:"unknown"===a.status?["unknown"]:[],c={event:a.event,command:a.command,scope:a.scope,status:a.status};return void 0!==a.matcher&&(c.matcher=a.matcher),void 0!==a.pluginName&&(c.pluginName=a.pluginName),a.warnings.length>0&&(c.warnings=a.warnings),{id:a.id,assetType:"hook",name:bj(a.command.trim(),64),sub:a.matcher?`Hook \xb7 ${a.event} \xb7 ${a.matcher}`:`Hook \xb7 ${a.event}`,description:a.warnings.length>0?a.warnings.join(" \xb7 "):null,flagsJson:JSON.stringify(b),metaJson:JSON.stringify(c),trust:null,toolsJson:null,effectiveTrust:null}}function bh(a){let b={scope:a.scope,transport:a.transport};return void 0!==a.command&&(b.command=a.command),void 0!==a.url&&(b.url=a.url),void 0!==a.envKeys&&(b.envKeys=a.envKeys),void 0!==a.pluginName&&(b.pluginName=a.pluginName),void 0!==a.marketplace&&(b.marketplace=a.marketplace),void 0!==a.project&&(b.project=a.project),{id:a.id,assetType:"mcp",name:a.name,sub:`MCP server \xb7 ${a.transport} \xb7 ${bj(function(a){if(void 0!==a.url)try{return new URL(a.url).host}catch{return a.url}return a.command??a.name}(a),48)}`,description:null,flagsJson:"[]",metaJson:JSON.stringify(b),trust:"unapproved",toolsJson:null,effectiveTrust:a.trust}}function bi(a){let b=a.untracked?["untracked"]:[],c={kind:a.kind,scope:a.scope,path:a.path};return void 0!==a.detail&&(c.detail=a.detail),void 0!==a.entryCount&&(c.entryCount=a.entryCount),void 0!==a.updatedAt&&(c.updatedAt=a.updatedAt),{id:a.id,assetType:"config",name:a.name,sub:a.kind,description:a.detail??null,flagsJson:JSON.stringify(b),metaJson:JSON.stringify(c),trust:null,toolsJson:null,effectiveTrust:null}}function bj(a,b){return a.length>b?`${a.slice(0,b-1)}…`:a}function bk(a,b,c){let d=W(a.attributes,{});return{id:a.id,name:a.name??"",repo:a.url??"",visibility:d.visibility??"private",language:d.language??"",policyDefault:d.policyDefault??"approved",updatedAt:new Date(a.lastSeen).toISOString(),accessCounts:b,findingsCount:c}}function bl(a){return{path:a.path,name:a.name,origin:a.origin,access:a.effectiveAccess,isCustom:null!==a.overrideAccess&&a.overrideAccess!==a.defaultAccess,findings:a.findingsCount,blockedAt:null!==a.blockedAtMs?new Date(a.blockedAtMs).toISOString():null,note:a.note}}class bm{constructor(a){this.db=a}getInventoryStats(){let a=O(this.db,"SELECT asset_type AS k, count(*) AS n FROM inventory_asset GROUP BY asset_type"),b={project:0,skill:a.get("skill")??0,mcp:a.get("mcp")??0,hook:a.get("hook")??0,config:a.get("config")??0};b.project=N(this.db,`SELECT count(*) AS n FROM source_project WHERE ${a7}`);let c=O(this.db,`SELECT coalesce(o.trust, a.trust) AS k, count(*) AS n
|
|
486
|
-
FROM inventory_asset a
|
|
487
|
-
LEFT JOIN mcp_trust_override o ON o.asset_id = a.id
|
|
488
|
-
WHERE a.asset_type = 'mcp' AND coalesce(o.trust, a.trust) IS NOT NULL
|
|
489
|
-
GROUP BY coalesce(o.trust, a.trust)`),d={"known-good":c.get("known-good")??0,risky:c.get("risky")??0,unapproved:c.get("unapproved")??0},e=N(this.db,`SELECT count(*) AS n FROM inventory
|
|
490
|
-
WHERE object_type = 'harness'
|
|
491
|
-
AND (last_seen >= :liveSince OR json_extract(attributes, '$.provenance') = 'sample')`,{liveSince:Date.now()-2592e6}),f=N(this.db,"SELECT count(*) AS n FROM inventory_asset WHERE flags_json <> '[]'"),g=N(this.db,"SELECT count(DISTINCT project_id) AS n FROM project_file WHERE findings_count > 0"),h=this.configAssetRows();for(let a of h)b[a.assetType]+=1,"mcp"===a.assetType&&a.effectiveTrust&&(d[a.effectiveTrust]+=1);return Promise.resolve({attention:f+g+h.filter(a=>"[]"!==a.flagsJson).length,byType:b,harnesses:e,mcpTrust:d})}listHarnesses(a){let b=this.fetchHarnessRows();if(0===b.length)return Promise.resolve({items:[]});let c=new Map;for(let a of b){let b=bc(W(a.attributes,{}),a);if(!b)continue;let d=c.get(b);d?d.push(a):c.set(b,[a])}let d=this.assetsByHarness(b.map(a=>a.id),a),e=[...new Set(b.flatMap(a=>W(a.attributes,{}).projectIds??[]))],g=this.fetchProjectsByIds(e),h=this.projectAggregates(e),i=this.configAssetRows(a,bd(b)),j=[];for(let[b,e]of c){let c=e.flatMap(a=>d.get(a.id)??[]),k=e.some(a=>"sample"!==W(a.attributes,{}).provenance)&&b===f.tLs.ClaudeCode&&i.length>0?[...c,...i].sort((a,b)=>a.name.localeCompare(b.name)):c;if(a&&0===k.length)continue;let l=e[0];if(!l)continue;let m=W(l.attributes,{}),n=[...new Set(e.flatMap(a=>W(a.attributes,{}).projectIds??[]))].map(a=>g.get(a)).filter(a=>void 0!==a).map(a=>{let b=h.get(a.id)??a9;return bk(a,b.accessCounts,b.findingsCount)}),o=e.reduce((a,b)=>a+(W(b.attributes,{}).sessions??0),0),p=k.reduce((a,b)=>a+W(b.flagsJson,[]).length,0),q=new Map;for(let a of k){let b=q.get(a.assetType);b?b.push(be(a)):q.set(a.assetType,[be(a)])}let r=a5.filter(a=>q.has(a)).map(a=>({type:a,assets:q.get(a)??[]}));j.push({id:b,label:m.label??a8[b],kind:m.kind??m.provider??b,version:m.harness_version??l.harnessVersion??"",sessions:o,assetCount:k.length,flagCount:p,projects:n,categories:r})}return Promise.resolve({items:j})}listAssets(a){let b=this.fetchAssets(a.type,a.q);if(0===b.length)return Promise.resolve({groups:[]});let c=new Map;for(let a of b){let b=c.get(a.assetType);b?b.push(a):c.set(a.assetType,[a])}let d=[...c.entries()].map(([a,b])=>{let c=new Map;for(let a of b)for(let b of W(a.flagsJson,[]))c.set(b,(c.get(b)??0)+1);let d={type:a,total:b.length,flagRollup:Object.fromEntries(c),items:b.map(be)};if("mcp"===a){let a=new Map;for(let c of b)c.effectiveTrust&&a.set(c.effectiveTrust,(a.get(c.effectiveTrust)??0)+1);d.trustRollup=Object.fromEntries(a)}return d});return d.sort((a,b)=>a5.indexOf(a.type)-a5.indexOf(b.type)),Promise.resolve({groups:d})}getAsset(a){let b=this.fetchAssetById(a);return Promise.resolve(b?function(a){let b={id:a.id,type:a.assetType,name:a.name,sub:a.sub??"",flags:W(a.flagsJson,[]),description:a.description??null,trust:"mcp"===a.assetType?a.effectiveTrust??null:null,meta:W(a.metaJson,{}),finding:null};if("mcp"===a.assetType&&null!==a.toolsJson){let c=W(a.toolsJson,[]);b.tools="unapproved"===a.effectiveTrust?c.map(a=>({...a,risk:a.risk??"Tool access blocked: MCP server trust is unapproved."})):c}return b}(b):null)}listProjects(a){let b=this.fetchProjects(a),c=this.projectAggregates(b.map(a=>a.id));return Promise.resolve({items:b.map(a=>{let b=c.get(a.id)??a9;return bk(a,b.accessCounts,b.findingsCount)})})}getProjectTree(a,b){let c=this.fetchProjectById(a);if(!c)return Promise.resolve(null);let d=W(c.attributes,{}),e={id:c.id,repo:c.url??"",visibility:d.visibility??"private"},f=b.path??"";if("blocked"===b.filter){let b=this.fetchProjectFilesBlocked(a);return b.sort((a,b)=>(b.blockedAtMs??0)-(a.blockedAtMs??0)),Promise.resolve({project:e,path:f,files:b.map(bl)})}if(void 0!==b.q&&""!==b.q)return Promise.resolve({project:e,path:f,files:this.fetchProjectFilesSearch(a,b.q).map(bl)});let g=this.fetchProjectFilesUnder(a,f),h=""===f?"":`${f}/`,i=[],j=new Map;for(let a of g){let b=h.length>0?a.path.slice(h.length):a.path,c=b.indexOf("/");if(-1===c)i.push(a);else{let d=b.slice(0,c),e=j.get(d)??[];e.push(a),j.set(d,e)}}let k=[...j.entries()].sort(([a],[b])=>a.localeCompare(b)).map(([a,b])=>({name:a,path:h.length>0?`${f}/${a}`:a,accessCounts:function(a){let b={open:0,approved:0,blocked:0,total:0};for(let c of a)b.total++,b[c.effectiveAccess]++;return b}(b)}));return Promise.resolve({project:e,path:f,folders:k,files:i.map(bl)})}getProjectFile(a,b){let c=this.fetchProjectById(a);if(!c)return Promise.resolve(null);let d=this.fetchProjectFile(a,b);if(!d)return Promise.resolve(null);let e=W(c.attributes,{});return Promise.resolve({...bl(d),project:{repo:c.url??"",visibility:e.visibility??"private",language:e.language??"",policyDefault:e.policyDefault??"approved",updatedAt:new Date(c.lastSeen).toISOString()},findingsRefs:[]})}setFileAccess(a,b,c){let d=this.fetchProjectFile(a,b);return!!d&&(c===d.defaultAccess?this.db.prepare("DELETE FROM file_access_override WHERE project_id = ? AND path = ?").run(a,b):this.db.prepare(`INSERT INTO file_access_override (id, project_id, path, access, created_at, updated_at)
|
|
492
|
-
VALUES (:id, :projectId, :path, :access, :now, :now)
|
|
493
|
-
ON CONFLICT (project_id, path) DO UPDATE SET access = excluded.access, updated_at = excluded.updated_at`).run({id:(0,n.randomUUID)(),projectId:a,path:b,access:c,now:Date.now()}),!0)}setMcpTrust(a,b){let c=this.fetchAssetById(a);return c?"mcp"!==c.assetType?"not_mcp":(b===c.trust?this.db.prepare("DELETE FROM mcp_trust_override WHERE asset_id = ?").run(a):this.db.prepare(`INSERT INTO mcp_trust_override (id, asset_id, trust, created_at, updated_at)
|
|
494
|
-
VALUES (:id, :assetId, :trust, :now, :now)
|
|
495
|
-
ON CONFLICT (asset_id) DO UPDATE SET trust = excluded.trust, updated_at = excluded.updated_at`).run({id:(0,n.randomUUID)(),assetId:a,trust:b,now:Date.now()}),this.configRowsCache=void 0,"ok"):"not_found"}fetchHarnessRows(){return I(this.db.prepare(`SELECT id, title, attributes, harness_version AS harnessVersion
|
|
496
|
-
FROM inventory
|
|
497
|
-
WHERE object_type = 'harness'
|
|
498
|
-
AND (last_seen >= :liveSince OR json_extract(attributes, '$.provenance') = 'sample')`),{liveSince:Date.now()-2592e6})}assetsByHarness(a,b){let c=new Map;if(0===a.length)return c;let d=[...a],e=`ha.harness_id IN (${z(a.length)})`;if(b){let a=A(b);e+=` AND ${B(["a.name","a.sub"])}`,d.push(a,a)}for(let a of I(this.db.prepare(`SELECT ha.harness_id AS harnessInvId, a.id, a.asset_type AS assetType, a.name, a.sub,
|
|
499
|
-
a.description, a.flags_json AS flagsJson, a.meta_json AS metaJson, a.trust,
|
|
500
|
-
a.tools_json AS toolsJson, coalesce(o.trust, a.trust) AS effectiveTrust
|
|
501
|
-
FROM harness_asset ha
|
|
502
|
-
JOIN inventory_asset a ON a.id = ha.asset_id
|
|
503
|
-
LEFT JOIN mcp_trust_override o ON o.asset_id = a.id
|
|
504
|
-
WHERE ${e}
|
|
505
|
-
ORDER BY a.name ASC`),d)){let b=a.harnessInvId,[d]=this.mapAssetRows([a]);if(!d)continue;let e=c.get(b);e?e.push(d):c.set(b,[d])}return c}fetchAssets(a,b){let c=[],d=[];if(a&&a.length>0&&(c.push(`a.asset_type IN (${z(a.length)})`),d.push(...a)),b){let a=A(b);c.push(B(["a.name","a.sub"])),d.push(a,a)}let e=c.length?`WHERE ${c.join(" AND ")}`:"",f=this.mapAssetRows(I(this.db.prepare(`SELECT a.id, a.asset_type AS assetType, a.name, a.sub, a.description,
|
|
506
|
-
a.flags_json AS flagsJson, a.meta_json AS metaJson, a.trust,
|
|
507
|
-
a.tools_json AS toolsJson, coalesce(o.trust, a.trust) AS effectiveTrust
|
|
508
|
-
FROM inventory_asset a
|
|
509
|
-
LEFT JOIN mcp_trust_override o ON o.asset_id = a.id
|
|
510
|
-
${e}
|
|
511
|
-
ORDER BY a.name ASC`),d)),g=this.configAssetRows(b).filter(b=>!a||0===a.length||a.includes(b.assetType));return g.length>0?[...f,...g].sort((a,b)=>a.name.localeCompare(b.name)):f}fetchAssetById(a){return this.mapAssetRows(I(this.db.prepare(`SELECT a.id, a.asset_type AS assetType, a.name, a.sub, a.description,
|
|
512
|
-
a.flags_json AS flagsJson, a.meta_json AS metaJson, a.trust,
|
|
513
|
-
a.tools_json AS toolsJson, coalesce(o.trust, a.trust) AS effectiveTrust
|
|
514
|
-
FROM inventory_asset a
|
|
515
|
-
LEFT JOIN mcp_trust_override o ON o.asset_id = a.id
|
|
516
|
-
WHERE a.id = ?`),[a]))[0]??this.configAssetRows().find(b=>b.id===a)??null}mapAssetRows(a){return a.map(a=>({id:a.id,assetType:a.assetType,name:a.name,sub:a.sub??null,description:a.description??null,flagsJson:a.flagsJson??"[]",metaJson:a.metaJson??"{}",trust:a.trust??null,toolsJson:a.toolsJson??null,effectiveTrust:a.effectiveTrust??null}))}configAssetRows(a,b){let c=this.liveConfigAssetRows(b);if(!a)return c;let d=a.toLowerCase();return c.filter(a=>a.name.toLowerCase().includes(d)||(a.sub??"").toLowerCase().includes(d))}liveConfigAssetRows(a){if(!(a??bd(this.fetchHarnessRows())))return[];let b=this.latestConfigScanId();if(null===b)return[];if(this.configRowsCache?.scanId===b)return this.configRowsCache.rows;let c=new ar(this.db).report(),d=[...c.skills.map(bf),...c.hooks.map(bg),...c.mcpServers.map(bh),...c.configFiles.map(bi)].sort((a,b)=>a.name.localeCompare(b.name));return this.configRowsCache={scanId:b,rows:d},d}latestConfigScanId(){return aq(this.db)?.id??null}fetchProjects(a){let b=`SELECT id, url, name, attributes, last_seen AS lastSeen FROM source_project
|
|
517
|
-
WHERE ${a7}`,c=[];if(a){let d=A(a);b+=` AND ${B(["name","url"])}`,c.push(d,d)}return b+=" ORDER BY name ASC",I(this.db.prepare(b),c)}fetchProjectById(a){return K(this.db.prepare("SELECT id, url, name, attributes, last_seen AS lastSeen FROM source_project WHERE id = ?"),[a])??null}fetchProjectsByIds(a){let b=new Map;if(0===a.length)return b;for(let c of I(this.db.prepare(`SELECT id, url, name, attributes, last_seen AS lastSeen
|
|
518
|
-
FROM source_project WHERE id IN (${z(a.length)})`),a))b.set(c.id,c);return b}projectAggregates(a){let b=new Map;if(0===a.length)return b;for(let c of I(this.db.prepare(`SELECT f.project_id AS projectId,
|
|
519
|
-
coalesce(o.access, f.default_access) AS eff,
|
|
520
|
-
count(*) AS n,
|
|
521
|
-
coalesce(sum(f.findings_count), 0) AS findings
|
|
522
|
-
FROM project_file f
|
|
523
|
-
LEFT JOIN file_access_override o ON o.project_id = f.project_id AND o.path = f.path
|
|
524
|
-
WHERE f.project_id IN (${z(a.length)})
|
|
525
|
-
GROUP BY f.project_id, eff`),a)){let a=b.get(c.projectId);a||(a={accessCounts:{open:0,approved:0,blocked:0,total:0},findingsCount:0},b.set(c.projectId,a)),a.accessCounts.total+=c.n,a.accessCounts[c.eff]+=c.n,a.findingsCount+=c.findings}return b}fileSelect(a){return`SELECT f.path, f.name, f.origin, f.default_access AS defaultAccess,
|
|
526
|
-
f.findings_count AS findingsCount, f.blocked_at AS blockedAtMs, f.note,
|
|
527
|
-
coalesce(o.access, f.default_access) AS effectiveAccess,
|
|
528
|
-
o.access AS overrideAccess
|
|
529
|
-
FROM project_file f
|
|
530
|
-
LEFT JOIN file_access_override o ON o.project_id = f.project_id AND o.path = f.path
|
|
531
|
-
WHERE ${a}`}mapFileRows(a){return a.map(a=>({path:a.path,name:a.name,origin:a.origin,defaultAccess:a.defaultAccess,findingsCount:a.findingsCount??0,blockedAtMs:a.blockedAtMs??null,note:a.note??null,effectiveAccess:a.effectiveAccess,overrideAccess:a.overrideAccess??null}))}fetchProjectFilesUnder(a,b){return""===b?this.mapFileRows(I(this.db.prepare(this.fileSelect("f.project_id = ? ORDER BY f.path ASC")),[a])):this.mapFileRows(I(this.db.prepare(this.fileSelect("f.project_id = ? AND f.path LIKE ? ESCAPE '\\' ORDER BY f.path ASC")),[a,`${y(b)}/%`]))}fetchProjectFilesSearch(a,b){let c=A(b);return this.mapFileRows(I(this.db.prepare(this.fileSelect("f.project_id = ? AND (f.path LIKE ? ESCAPE '\\' OR f.name LIKE ? ESCAPE '\\') ORDER BY f.path ASC")),[a,c,c]))}fetchProjectFilesBlocked(a){return this.mapFileRows(I(this.db.prepare(this.fileSelect("f.project_id = ? AND coalesce(o.access, f.default_access) = 'blocked' AND f.blocked_at IS NOT NULL")),[a]))}fetchProjectFile(a,b){return this.mapFileRows(I(this.db.prepare(this.fileSelect("f.project_id = ? AND f.path = ?")),[a,b]))[0]??null}}class bn{constructor(a){this.db=a}readPolicies(){return Promise.resolve(P(I(this.db.prepare("SELECT * FROM policies")),a=>{let b=JSON.parse(a.target),c=a.custom_keywords?JSON.parse(a.custom_keywords):void 0;return f.PEm.parse({id:a.id,scope:a.scope,target:b,action:a.action,enabled:L(a.enabled),customKeywords:c})}))}seedDefaults(){if(N(this.db,"SELECT count(*) AS n FROM policies")>0)return;let a=this.db.prepare(`INSERT INTO policies (id, scope, target, action, enabled, created_at, updated_at)
|
|
532
|
-
VALUES (:id, 'global', :target, :action, 1, :now, :now)`);E(this.db,()=>{for(let[b,c]of Object.entries(f.unw))a.run({id:(0,n.randomUUID)(),target:JSON.stringify({category:b}),action:c,now:Date.now()})})}upsertCategoryAction(a,b){let c=Date.now();this.db.prepare(`INSERT INTO policies (id, scope, target, action, enabled, created_at, updated_at)
|
|
533
|
-
VALUES (:id, 'global', :target, :action, 1, :now, :now)
|
|
534
|
-
ON CONFLICT(scope, target) DO UPDATE SET action = excluded.action, enabled = 1, updated_at = excluded.updated_at`).run({id:(0,n.randomUUID)(),target:JSON.stringify({category:a}),action:b,now:c})}capCategoryActions(){return Number(this.db.prepare(`UPDATE policies SET action='warn', updated_at=:now
|
|
535
|
-
WHERE scope='global' AND action IN ('block','redact')
|
|
536
|
-
AND json_extract(target,'$.category') IS NOT NULL`).run({now:Date.now()}).changes)}getCategoryAction(a){let b=this.db.prepare("SELECT action FROM policies WHERE scope='global' AND json_extract(target,'$.category') = :category").get({category:a});return b?.action}}class bo{constructor(a){this.packs=a}getPolicyList(a){if("custom"===a)return Promise.resolve({items:[]});let b=this.packs.countsByPolicyId();return Promise.resolve({items:f.RRF.map(a=>({id:a,kind:"builtin",name:f.ZpU[a].name,enabled:!0,usedByCount:b.get(a)??0}))})}getPolicyStats(){let a=this.packs.countsByPolicyId(),b=f.V0H.reduce((b,c)=>b+(a.get(c)??0),0),c=f.V0H.length;return Promise.resolve({policies:c,builtin:c,custom:0,detectionsGoverned:b})}getPolicyDetail(a){let b=f.V0H.find(b=>b===a);if(void 0===b)return Promise.resolve(null);let c=f.ZpU[b];return Promise.resolve({specVersion:1,id:a,kind:"builtin",name:c.name,enabled:!0,description:c.description,usedBy:this.packs.listByPolicyId(a)})}}class bp{constructor(a){this.db=a,this.maxStampStmt=a.prepare("SELECT coalesce(max(updated_at), 0) AS maxStamp FROM project_file WHERE project_id = :projectId"),this.upsertStmt=a.prepare(`INSERT INTO project_file
|
|
537
|
-
(id, project_id, path, name, origin, default_access, findings_count, blocked_at, note, created_at, updated_at)
|
|
538
|
-
VALUES
|
|
539
|
-
(:id, :projectId, :path, :name, :origin, :defaultAccess, 0, NULL, NULL, :now, :now)
|
|
540
|
-
ON CONFLICT (project_id, path) DO UPDATE SET
|
|
541
|
-
name = excluded.name,
|
|
542
|
-
origin = excluded.origin,
|
|
543
|
-
default_access = excluded.default_access,
|
|
544
|
-
updated_at = excluded.updated_at`),this.pruneStmt=a.prepare("DELETE FROM project_file WHERE project_id = :projectId AND updated_at < :now")}replaceForProject(a,b,c){let d=Math.max(c,(K(this.maxStampStmt,{projectId:a})?.maxStamp??0)+1);for(let c of b.files)this.upsertStmt.run({id:(0,n.randomUUID)(),projectId:a,path:c.path,name:c.name,origin:c.origin,defaultAccess:c.defaultAccess,now:d});b.truncated||this.pruneStmt.run({projectId:a,now:d})}}class bq{constructor(a,b=()=>Date.now(),c=()=>(0,n.randomUUID)()){this.db=a,this.now=b,this.newId=c,this.insertStmt=a.prepare(`INSERT INTO finding_resolution (id, finding_key, status, method, resolved_at, evidence, created_at)
|
|
545
|
-
VALUES (:id, :findingKey, :status, :method, :resolvedAt, :evidence, :createdAt)`),this.latestStmt=a.prepare(`SELECT status, method, resolved_at, evidence
|
|
546
|
-
FROM finding_resolution
|
|
547
|
-
WHERE finding_key = :findingKey
|
|
548
|
-
ORDER BY created_at DESC, rowid DESC
|
|
549
|
-
LIMIT 1`),this.openAtRestStmt=a.prepare(`SELECT DISTINCT f.finding_key AS finding_key
|
|
550
|
-
FROM inspection_findings f
|
|
551
|
-
JOIN audit_events e ON e.id = f.audit_event_id
|
|
552
|
-
WHERE e.event_type = 'code_change'
|
|
553
|
-
AND json_extract(e.attributes, '$.file_path') = :path
|
|
554
|
-
AND f.finding_key IS NOT NULL
|
|
555
|
-
AND ${aE("f")} IS NOT 'resolved'`),this.resolvedAtRestStmt=a.prepare(`SELECT DISTINCT f.finding_key AS finding_key
|
|
556
|
-
FROM inspection_findings f
|
|
557
|
-
JOIN audit_events e ON e.id = f.audit_event_id
|
|
558
|
-
WHERE e.event_type = 'code_change'
|
|
559
|
-
AND json_extract(e.attributes, '$.file_path') = :path
|
|
560
|
-
AND f.finding_key IS NOT NULL
|
|
561
|
-
AND ${aE("f")} = 'resolved'`)}insertResolution(a){this.insertStmt.run({id:this.newId(),findingKey:a.findingKey,status:f.GCf.parse(a.status),method:f.cqq.parse(a.method),resolvedAt:a.resolvedAt,evidence:a.evidence,createdAt:this.now()})}latestByKey(a){let b=K(this.latestStmt,{findingKey:a});if(b)return{status:b.status,method:b.method,resolvedAt:b.resolved_at,evidence:b.evidence??""}}openAtRestKeysForPath(a){return I(this.openAtRestStmt,{path:a}).map(a=>a.finding_key)}resolvedAtRestKeysForPath(a){return I(this.resolvedAtRestStmt,{path:a}).map(a=>a.finding_key)}}class br{constructor(a){this.db=a,this.upsertStmt=a.prepare(`INSERT INTO rule_probe_cache (rule_key, verdict, worst_probe_ms, checked_at)
|
|
562
|
-
VALUES (:ruleKey, :verdict, :worstProbeMs, :checkedAt)
|
|
563
|
-
ON CONFLICT (rule_key) DO UPDATE SET
|
|
564
|
-
verdict = excluded.verdict,
|
|
565
|
-
worst_probe_ms = excluded.worst_probe_ms,
|
|
566
|
-
checked_at = excluded.checked_at`),this.readStmt=a.prepare("SELECT verdict, worst_probe_ms AS worstProbeMs FROM rule_probe_cache WHERE rule_key = :ruleKey"),this.countQuarantinedStmt=a.prepare("SELECT COUNT(*) AS n FROM rule_probe_cache WHERE verdict = 'quarantined'"),this.clearQuarantinedStmt=a.prepare("DELETE FROM rule_probe_cache WHERE verdict = 'quarantined'")}getVerdict(a){return K(this.readStmt,{ruleKey:a})}countQuarantined(){return K(this.countQuarantinedStmt,{})?.n??0}clearQuarantined(){let a=this.countQuarantined();return{refused:!E(this.db,()=>{this.clearQuarantinedStmt.run()}),cleared:a-this.countQuarantined()}}setVerdict(a,b,c){E(this.db,()=>{this.upsertStmt.run({ruleKey:a,verdict:b,worstProbeMs:c,checkedAt:Date.now()})})}}class bs{constructor(a){this.db=a,this.upsertStmt=a.prepare(`INSERT INTO scan_ledger (path, mtime, content_hash, ruleset_hash, scanned_at)
|
|
567
|
-
VALUES (:path, :mtime, :contentHash, :rulesetHash, :scannedAt)
|
|
568
|
-
ON CONFLICT (path) DO UPDATE SET
|
|
569
|
-
mtime = excluded.mtime,
|
|
570
|
-
content_hash = excluded.content_hash,
|
|
571
|
-
ruleset_hash = excluded.ruleset_hash,
|
|
572
|
-
scanned_at = excluded.scanned_at`),this.readStmt=a.prepare(`SELECT path, mtime, content_hash AS contentHash
|
|
573
|
-
FROM scan_ledger WHERE ruleset_hash = :rulesetHash`)}entriesForRuleset(a){return new Map(I(this.readStmt,{rulesetHash:a}).map(a=>[a.path,{mtime:a.mtime,contentHash:a.contentHash}]))}upsertEntries(a){if(0===a.length)return;let b=Date.now();E(this.db,()=>{for(let c of a)this.upsertStmt.run({path:c.path,mtime:c.mtime,contentHash:c.contentHash,rulesetHash:c.rulesetHash,scannedAt:b})})}}function bt(a,b){return void 0===a?b:Math.min(Math.max(1,Math.trunc(a)),f.u8Q)}let bu=`(v.occurrence_count > 1
|
|
574
|
-
OR (SELECT count(*) FROM secret_vault_sighting s WHERE s.pointer_id = v.pointer_id) > 1)`,bv=`v.pointer_id, v.category, v.rule_id, v.masked_match, v.provider,
|
|
575
|
-
v.occurrence_count, v.first_seen, v.last_seen`,bw=`
|
|
576
|
-
pointer_id AS pointerId,
|
|
577
|
-
value_fingerprint AS valueFingerprint,
|
|
578
|
-
fingerprint_key_version AS fingerprintKeyVersion,
|
|
579
|
-
key_version AS keyVersion,
|
|
580
|
-
format_version AS formatVersion,
|
|
581
|
-
category,
|
|
582
|
-
rule_id AS ruleId,
|
|
583
|
-
masked_match AS maskedMatch,
|
|
584
|
-
provider,
|
|
585
|
-
ciphertext,
|
|
586
|
-
nonce,
|
|
587
|
-
auth_tag AS authTag,
|
|
588
|
-
user_authorized AS userAuthorized,
|
|
589
|
-
occurrence_count AS occurrenceCount,
|
|
590
|
-
first_seen AS firstSeen,
|
|
591
|
-
last_seen AS lastSeen`;function bx(a){let{provider:b,userAuthorized:c,...d}=a,e={...d,userAuthorized:0!==c};return null===b?e:{...e,provider:b}}class by{constructor(a){this.db=a,this.insertStmt=a.prepare(`INSERT INTO secret_vault (
|
|
592
|
-
pointer_id, value_fingerprint, fingerprint_key_version, key_version,
|
|
593
|
-
format_version, category, rule_id, masked_match, provider,
|
|
594
|
-
ciphertext, nonce, auth_tag,
|
|
595
|
-
user_authorized, occurrence_count, first_seen, last_seen
|
|
596
|
-
) VALUES (
|
|
597
|
-
:pointerId, :valueFingerprint, :fingerprintKeyVersion, :keyVersion,
|
|
598
|
-
:formatVersion, :category, :ruleId, :maskedMatch, :provider,
|
|
599
|
-
:ciphertext, :nonce, :authTag,
|
|
600
|
-
:userAuthorized, 1, :now, :now
|
|
601
|
-
)`),this.bumpStmt=a.prepare(`UPDATE secret_vault
|
|
602
|
-
SET occurrence_count = occurrence_count + 1, last_seen = :now,
|
|
603
|
-
user_authorized = max(user_authorized, :userAuthorized)
|
|
604
|
-
WHERE value_fingerprint = :valueFingerprint`),this.byPointerStmt=a.prepare(`SELECT ${bw} FROM secret_vault WHERE pointer_id = :pointerId`),this.byFingerprintStmt=a.prepare(`SELECT ${bw} FROM secret_vault WHERE value_fingerprint = :valueFingerprint`),this.listStmt=a.prepare(`SELECT ${bw} FROM secret_vault ORDER BY first_seen`),this.replaceCiphertextStmt=a.prepare(`UPDATE secret_vault
|
|
605
|
-
SET key_version = :keyVersion, ciphertext = :ciphertext, nonce = :nonce, auth_tag = :authTag
|
|
606
|
-
WHERE pointer_id = :pointerId`),this.refreshFingerprintStmt=a.prepare(`UPDATE secret_vault
|
|
607
|
-
SET value_fingerprint = :valueFingerprint, fingerprint_key_version = :fingerprintKeyVersion
|
|
608
|
-
WHERE pointer_id = :pointerId`),this.deleteByPointerStmt=a.prepare("DELETE FROM secret_vault WHERE pointer_id = :pointerId"),this.derefStmt=a.prepare(`INSERT INTO secret_vault_deref (id, pointer_id, at, target, reason, outcome, grant_id, pointer_count)
|
|
609
|
-
VALUES (:id, :pointerId, :at, :target, :reason, :outcome, :grantId, :pointerCount)`)}upsert(a,b){let c=!1;D(this.db,()=>{if(void 0===K(this.byFingerprintStmt,{valueFingerprint:a.valueFingerprint})){this.insertStmt.run(M({pointerId:a.pointerId,valueFingerprint:a.valueFingerprint,fingerprintKeyVersion:a.fingerprintKeyVersion,keyVersion:a.keyVersion,formatVersion:a.formatVersion??f.viY,category:a.category,ruleId:a.ruleId,maskedMatch:a.maskedMatch,provider:a.provider,ciphertext:a.ciphertext,nonce:a.nonce,authTag:a.authTag,userAuthorized:+(!0===a.userAuthorized),now:b})),c=!0;return}this.bumpStmt.run({valueFingerprint:a.valueFingerprint,userAuthorized:+(!0===a.userAuthorized),now:b})},"IMMEDIATE");let d=K(this.byFingerprintStmt,{valueFingerprint:a.valueFingerprint});if(void 0===d)throw Error("vault: row vanished immediately after write");return{row:bx(d),minted:c}}byPointerId(a){let b=K(this.byPointerStmt,{pointerId:a});return void 0===b?null:bx(b)}byValueFingerprint(a){let b=K(this.byFingerprintStmt,{valueFingerprint:a});return void 0===b?null:bx(b)}recordDeref(a){this.derefStmt.run(M({id:a.id,pointerId:a.pointerId,at:a.at,target:a.target,reason:a.reason,outcome:a.outcome,grantId:a.grantId,pointerCount:a.pointerCount??1}))}listAll(){return I(this.listStmt).map(bx)}replaceCiphertext(a,b){this.replaceCiphertextStmt.run({pointerId:a,...b})}refreshFingerprint(a,b){this.refreshFingerprintStmt.run({pointerId:a,...b})}purgeAll(){let a=0;return D(this.db,()=>{a=this.countEntries(),this.db.exec("DELETE FROM secret_vault")},"IMMEDIATE"),a}deleteByPointerIds(a){if(0===a.length)return[];let b=[];return D(this.db,()=>{for(let c of a)Number(this.deleteByPointerStmt.run({pointerId:c}).changes)>0&&b.push(c)},"IMMEDIATE"),b}recordSighting(a,b){this.db.prepare(`INSERT INTO secret_vault_sighting (id, pointer_id, location, kind, first_seen, last_seen)
|
|
610
|
-
VALUES (:id, :pointerId, :location, :kind, :now, :now)
|
|
611
|
-
ON CONFLICT (pointer_id, location) DO UPDATE SET last_seen = :now`).run({id:(0,n.randomUUID)(),pointerId:a.pointerId,location:a.location,kind:a.kind,now:b})}sightingsFor(a){let b=new Map(a.map(a=>[a,[]]));if(0===a.length)return b;for(let c of I(this.db.prepare(`SELECT pointer_id, location, kind, first_seen, last_seen
|
|
612
|
-
FROM secret_vault_sighting
|
|
613
|
-
WHERE pointer_id IN (${z(a.length)})
|
|
614
|
-
ORDER BY last_seen DESC`),a))b.get(c.pointer_id)?.push({location:c.location,kind:c.kind,firstSeen:new Date(c.first_seen).toISOString(),lastSeen:new Date(c.last_seen).toISOString()});return b}toInventoryEntries(a){let b=this.sightingsFor(a.map(a=>a.pointer_id));return a.map(a=>({pointerId:a.pointer_id,category:a.category,...null===a.provider?{}:{provider:a.provider},maskedMatch:a.masked_match,occurrences:a.occurrence_count,firstSeen:new Date(a.first_seen).toISOString(),lastSeen:new Date(a.last_seen).toISOString(),revealGrantId:a.grant_id,sightings:b.get(a.pointer_id)??[]}))}listInventory(a={},b=Date.now()){let c=bt(a.limit,f.mBk),d=void 0===a.cursor?null:Z(a.cursor),e=null===d?"":"WHERE (v.last_seen < :cursorLastSeen OR (v.last_seen = :cursorLastSeen AND v.pointer_id < :cursorPointerId))",g=I(this.db.prepare(`SELECT ${bv},
|
|
615
|
-
(SELECT e.id FROM exceptions e
|
|
616
|
-
WHERE e.rule_id = v.rule_id
|
|
617
|
-
AND e.value_fingerprint = v.value_fingerprint
|
|
618
|
-
AND e.key_version = v.fingerprint_key_version
|
|
619
|
-
AND ${aB}
|
|
620
|
-
LIMIT 1) AS grant_id
|
|
621
|
-
FROM secret_vault v
|
|
622
|
-
${e}
|
|
623
|
-
ORDER BY v.last_seen DESC, v.pointer_id DESC
|
|
624
|
-
LIMIT :limit`),M({now:b,limit:c+1,...null===d?{}:{cursorLastSeen:d.startedAtMs,cursorPointerId:d.id}})),h=g.length>c,i=h?g.slice(0,c):g,j=i[i.length-1];return{totals:{values:this.countEntries()},items:this.toInventoryEntries(i),nextCursor:h&&j?Y({startedAtMs:j.last_seen,id:j.pointer_id}):null}}listReuse(a={},b=Date.now()){var c;let d=bt(a.limit,f.mBk),e=void 0===a.cursor?null:function(a){let b=X(Buffer.from(a,"base64url").toString("utf8"));return void 0!==b&&Number.isInteger(b.occurrences)&&"string"==typeof b.pointerId?{occurrences:b.occurrences,pointerId:b.pointerId}:null}(a.cursor),g=null===e?"":`AND (v.occurrence_count < :cursorOccurrences
|
|
625
|
-
OR (v.occurrence_count = :cursorOccurrences AND v.pointer_id < :cursorPointerId))`,h=I(this.db.prepare(`SELECT ${bv},
|
|
626
|
-
(SELECT e.id FROM exceptions e
|
|
627
|
-
WHERE e.rule_id = v.rule_id
|
|
628
|
-
AND e.value_fingerprint = v.value_fingerprint
|
|
629
|
-
AND e.key_version = v.fingerprint_key_version
|
|
630
|
-
AND ${aB}
|
|
631
|
-
LIMIT 1) AS grant_id
|
|
632
|
-
FROM secret_vault v
|
|
633
|
-
WHERE ${bu} ${g}
|
|
634
|
-
ORDER BY v.occurrence_count DESC, v.pointer_id DESC
|
|
635
|
-
LIMIT :limit`),M({now:b,limit:d+1,...null===e?{}:{cursorOccurrences:e.occurrences,cursorPointerId:e.pointerId}})),i=h.length>d,j=i?h.slice(0,d):h,k=j[j.length-1];return{totals:{reused:this.countReused()},items:this.toInventoryEntries(j),nextCursor:i&&k?(c={occurrences:k.occurrence_count,pointerId:k.pointer_id},Buffer.from(JSON.stringify(c)).toString("base64url")):null}}listDerefs(a={}){let b=bt(a.limit,f.hdu),c=void 0===a.cursor?null:Z(a.cursor),d=[];!0!==a.includeBatched&&d.push("reason NOT IN ('display', 'view-render')"),null!==c&&d.push("(at < :cursorAt OR (at = :cursorAt AND id < :cursorId))");let e=0===d.length?"":`WHERE ${d.join(" AND ")}`,g=I(this.db.prepare(`SELECT id, pointer_id, at, target, reason, outcome, grant_id, pointer_count
|
|
636
|
-
FROM secret_vault_deref ${e}
|
|
637
|
-
ORDER BY at DESC, id DESC LIMIT :limit`),M({limit:b+1,...null===c?{}:{cursorAt:c.startedAtMs,cursorId:c.id}})),h=g.length>b,i=h?g.slice(0,b):g,j=i[i.length-1],k=!0===a.includeBatched?0:N(this.db,"SELECT count(*) AS n FROM secret_vault_deref WHERE reason IN ('display', 'view-render')");return{items:i.map(a=>({id:a.id,pointerId:a.pointer_id,at:new Date(a.at).toISOString(),target:a.target,reason:a.reason,outcome:a.outcome,...null===a.grant_id?{}:{grantId:a.grant_id},pointerCount:a.pointer_count})),nextCursor:h&&j?Y({startedAtMs:j.at,id:j.id}):null,hiddenBatched:k}}countEntries(){return N(this.db,"SELECT COUNT(*) AS n FROM secret_vault")}countReused(){return N(this.db,`SELECT COUNT(*) AS n FROM secret_vault v WHERE ${bu}`)}}let bz=["critical","high","medium","low"],bA={block:"blocked",redact:"redacted",warn:"warned"},bB=["blocked","redacted","warned"],bC={[f.tLs.Antigravity]:{coverage:60,supported:!0},[f.tLs.Api]:{coverage:0,supported:!1},[f.tLs.ChatGpt]:{coverage:40,supported:!0},[f.tLs.ClaudeAi]:{coverage:40,supported:!0},[f.tLs.ClaudeCode]:{coverage:100,supported:!0},[f.tLs.Codex]:{coverage:80,supported:!0},[f.tLs.Copilot]:{coverage:0,supported:!1},[f.tLs.Cursor]:{coverage:0,supported:!1}},bD={"7d":"day","30d":"day","3m":"week","6m":"week"};function bE(a){return 864e5*Math.floor(a/864e5)}function bF(a){return new Date(a).toISOString().slice(0,10)}class bG{constructor(a,b=()=>Date.now()){this.db=a,this.now=b}severitySummary(){let a=new Map(I(this.db.prepare(`SELECT d.severity AS severity,
|
|
638
|
-
COUNT(*) AS count,
|
|
639
|
-
SUM(CASE
|
|
640
|
-
WHEN e.event_type != 'code_change' THEN 1
|
|
641
|
-
WHEN f.finding_key IS NULL THEN 0
|
|
642
|
-
WHEN latest.status = 'resolved' THEN 1
|
|
643
|
-
ELSE 0
|
|
644
|
-
END) AS caught,
|
|
645
|
-
SUM(CASE
|
|
646
|
-
WHEN e.event_type = 'code_change'
|
|
647
|
-
AND f.finding_key IS NOT NULL
|
|
648
|
-
AND (latest.status IS NULL OR latest.status != 'resolved') THEN 1
|
|
649
|
-
ELSE 0
|
|
650
|
-
END) AS open_at_rest
|
|
651
|
-
FROM inspection_findings f
|
|
652
|
-
JOIN audit_events e ON e.id = f.audit_event_id
|
|
653
|
-
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
654
|
-
LEFT JOIN ${aF} latest
|
|
655
|
-
ON latest.finding_key = f.finding_key
|
|
656
|
-
WHERE e.event_type IN (${f.hfB})
|
|
657
|
-
GROUP BY d.severity`)).map(a=>[a.severity,a])),b=bz.map(b=>({severity:b,count:a.get(b)?.count??0,caught:a.get(b)?.caught??0,openAtRest:a.get(b)?.open_at_rest??0}));return Promise.resolve({total:b.reduce((a,b)=>a+b.count,0),needsRemediation:b.reduce((a,b)=>a+b.openAtRest,0),bySeverity:b})}scanCoverage(a){return Promise.resolve({range:a,providers:f.KqW.options.map(a=>({provider:a,...bC[a]}))})}enforcementActions(a){let b=864e5*f.eI7[a],c=this.now(),d=c-b,e=this.findingsInRange(c-2*b,c),g={blocked:0,redacted:0,warned:0},h={blocked:0,redacted:0,warned:0};for(let a of e){let b=bA[a.actionTaken];b&&(a.occurredAt>=d?g[b]++:h[b]++)}let i=bB.map(a=>({kind:a,count:g[a],delta:g[a]-h[a]}));return Promise.resolve({range:a,total:i.reduce((a,b)=>a+b.count,0),actions:i})}findingsTimeseries(a){let b=bD[a],c=("day"===b?1:7)*864e5,d=f.eI7[a],e="day"===b?d:Math.ceil(d/7),g=this.now(),h=bE(g)-(d-1)*864e5,i=this.findingsInRange(h,g),j=Array.from({length:e},(a,b)=>({timestamp:bF(h+b*c),critical:0,high:0,medium:0}));for(let a of i){let b=j[Math.floor((a.occurredAt-h)/c)];if(b){var k;("critical"===(k=a.severity)||"high"===k||"medium"===k)&&b[a.severity]++}}return Promise.resolve({range:a,granularity:b,points:j})}mttrTrend(a){let b=bD[a],c=("day"===b?1:7)*864e5,d=f.eI7[a],e="day"===b?d:Math.ceil(d/7),g=this.now(),h=bE(g)-(d-1)*864e5,i=I(this.db.prepare(`SELECT DISTINCT f.finding_key AS finding_key,
|
|
658
|
-
COALESCE(f.first_detected_at, e.started_at) AS first_detected_at, d.severity AS severity,
|
|
659
|
-
latest.status AS latest_status,
|
|
660
|
-
latest.method AS latest_method,
|
|
661
|
-
latest.resolved_at AS latest_resolved_at
|
|
662
|
-
FROM finding_resolution fr
|
|
663
|
-
CROSS JOIN inspection_findings f ON f.finding_key = fr.finding_key
|
|
664
|
-
CROSS JOIN audit_events e ON e.id = f.audit_event_id
|
|
665
|
-
CROSS JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
666
|
-
LEFT JOIN ${aF} latest
|
|
667
|
-
ON latest.finding_key = f.finding_key
|
|
668
|
-
WHERE fr.resolved_at >= :windowStart
|
|
669
|
-
AND e.event_type IN (${f.hfB})`),{windowStart:h}),j=new Map,k=new Map;for(let a of i){if("resolved"!==a.latest_status||"fixed-at-source"!==a.latest_method||null==a.latest_resolved_at||a.latest_resolved_at<h||a.latest_resolved_at>=g)continue;let b=Math.floor((a.latest_resolved_at-h)/c);if(b<0||b>=e)continue;let d=`${String(b)}:${a.severity}`,f=Math.max(0,a.latest_resolved_at-a.first_detected_at);j.set(d,(j.get(d)??0)+f),k.set(d,(k.get(d)??0)+1)}return Promise.resolve({range:a,granularity:b,points:Array.from({length:e},(a,b)=>{let d={};for(let a of bz){let c=`${String(b)}:${a}`,e=k.get(c)??0;d[a]=e>0?(j.get(c)??0)/e:null}return{timestamp:bF(h+b*c),bySeverity:d}})})}topSources(a,b={}){let c=b.limit??5;if("user"===b.kind)return Promise.resolve({range:a,items:[]});let d=this.now(),e=d-864e5*f.eI7[a];return Promise.resolve({range:a,items:I(this.db.prepare(`SELECT e.repo AS repo, count(*) AS c
|
|
670
|
-
FROM inspection_findings f
|
|
671
|
-
JOIN audit_events e ON e.id = f.audit_event_id
|
|
672
|
-
WHERE e.started_at >= :from AND e.started_at < :to
|
|
673
|
-
AND e.event_type IN (${f.hfB})
|
|
674
|
-
AND e.repo IS NOT NULL
|
|
675
|
-
AND e.repo != ''
|
|
676
|
-
GROUP BY e.repo
|
|
677
|
-
ORDER BY c DESC, e.repo
|
|
678
|
-
LIMIT :limit`),{from:e,to:d,limit:c}).map(a=>({id:`repo_${a.repo}`,name:a.repo,kind:"repo",findingsCount:a.c}))})}recentlyResolved(a=20){return Promise.resolve({items:I(this.db.prepare(`SELECT f.finding_key AS finding_key,
|
|
679
|
-
d.rule_id AS rule_id,
|
|
680
|
-
d.severity AS severity,
|
|
681
|
-
e.file_path AS path,
|
|
682
|
-
COALESCE(f.first_detected_at, e.started_at) AS first_detected_at,
|
|
683
|
-
latest.resolved_at AS latest_resolved_at
|
|
684
|
-
FROM ${aF} latest
|
|
685
|
-
CROSS JOIN inspection_findings f ON f.finding_key = latest.finding_key
|
|
686
|
-
CROSS JOIN audit_events e ON e.id = f.audit_event_id
|
|
687
|
-
CROSS JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
688
|
-
WHERE latest.status = 'resolved'
|
|
689
|
-
AND latest.method = 'fixed-at-source'
|
|
690
|
-
AND latest.resolved_at IS NOT NULL
|
|
691
|
-
AND e.event_type = 'code_change'
|
|
692
|
-
ORDER BY latest.resolved_at DESC
|
|
693
|
-
LIMIT :limit`),{limit:a}).map(a=>({findingKey:a.finding_key,ruleId:a.rule_id,severity:a.severity,path:a.path??"",resolvedAt:new Date(a.latest_resolved_at).toISOString(),detectedAt:new Date(a.first_detected_at).toISOString()}))})}findingsInRange(a,b){return I(this.db.prepare(`SELECT e.started_at AS occurred_at, d.severity AS severity, f.action_taken AS action_taken
|
|
694
|
-
FROM inspection_findings f
|
|
695
|
-
JOIN audit_events e ON e.id = f.audit_event_id
|
|
696
|
-
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
697
|
-
WHERE e.started_at >= :from AND e.started_at < :to
|
|
698
|
-
AND e.event_type IN (${f.hfB})
|
|
699
|
-
ORDER BY e.started_at`),{from:a,to:b}).map(a=>({occurredAt:a.occurred_at,severity:a.severity,actionTaken:a.action_taken}))}}let bH=["provider","internal","external","ip"],bI="('http', 'ws')",bJ=`LEFT JOIN egress_decision_override oh ON oh.host = d.host
|
|
700
|
-
LEFT JOIN egress_decision_override ol ON ol.destination_id = d.id AND ol.host IS NULL`;function bK(a){return{id:a.id,method:a.method,transport:a.transport,url:a.url,template:a.template,dataClass:a.dataClass,lastSeen:new Date(a.lastSeenMs).toISOString(),callSiteCount:a.callSiteCount}}function bL(a,b){let c=b.map(a=>a.transport),d=b.map(a=>a.dataClass),e=b.reduce((a,b)=>a+b.callSiteCount,0),g=b.length>0?Math.max(...b.map(a=>a.lastSeenMs)):a.lastSeenMs;return{id:a.id,kind:a.kind,name:a.name,host:a.host,category:a.category,trust:a.trust,status:(0,f.Gw9)(a.trust,a.overrideDecision),isCustom:(0,f.y_0)(a.trust,a.overrideDecision),lastSeen:new Date(g).toISOString(),endpointCount:b.length,callSiteCount:e,transports:(0,f.by7)(c),dataClasses:(0,f.hzO)(d),review:(0,f.Fnc)(a.trust,c,null!==a.overrideDecision),network:"provider"===a.kind?null:W(a.networkJson,null),endpoints:b.map(bK)}}class bM{constructor(a){this.db=a}stats(){let a=N(this.db,"SELECT count(*) AS n FROM share_destination"),b=N(this.db,"SELECT count(*) AS n FROM share_endpoint"),c=N(this.db,"SELECT count(*) AS n FROM share_call_site"),d=N(this.db,`SELECT count(DISTINCT destination_id) AS n FROM share_endpoint
|
|
701
|
-
WHERE transport IN ${bI}`),e=N(this.db,`SELECT count(DISTINCT d.id) AS n
|
|
702
|
-
FROM share_destination d
|
|
703
|
-
LEFT JOIN share_endpoint e ON e.destination_id = d.id
|
|
704
|
-
AND e.transport IN ${bI}
|
|
705
|
-
WHERE (d.trust IN ('unverified', 'ip') OR e.id IS NOT NULL)
|
|
706
|
-
AND NOT EXISTS (
|
|
707
|
-
SELECT 1 FROM egress_decision_override o
|
|
708
|
-
WHERE o.host = d.host OR (o.destination_id = d.id AND o.host IS NULL)
|
|
709
|
-
)`),f=O(this.db,"SELECT kind AS k, count(*) AS n FROM share_destination GROUP BY kind"),g={provider:f.get("provider")??0,internal:f.get("internal")??0,external:f.get("external")??0,ip:f.get("ip")??0},h=O(this.db,"SELECT trust AS k, count(*) AS n FROM share_destination GROUP BY trust");return Promise.resolve({destinations:a,endpoints:b,callSites:c,needsReview:e,insecure:d,byKind:g,byTrust:{recognized:h.get("recognized")??0,internal:h.get("internal")??0,unverified:h.get("unverified")??0,ip:h.get("ip")??0}})}listDestinations(a){let b=void 0===a.q||""===a.q?void 0:a.q,c=this.fetchDestinations(b,a.kind),d=this.groupEndpoints(c.map(a=>a.id)),e=c.map(a=>bL(a,d.get(a.id)??[])),f=new Map;for(let a of e){let b=f.get(a.kind);b?b.push(a):f.set(a.kind,[a])}return Promise.resolve({groups:bH.filter(a=>f.has(a)).map(a=>{let b=f.get(a)??[];return{kind:a,total:b.length,items:b}})})}needsReview(){let a=this.fetchDestinations(void 0,void 0,!0),b=this.groupEndpoints(a.map(a=>a.id));return Promise.resolve({items:a.map(a=>({dest:a,endpoints:b.get(a.id)??[]})).map(({dest:a,endpoints:b})=>({summary:bL(a,b),endpoints:b})).filter(({summary:a})=>a.review.needsReview).map(({summary:a,endpoints:b})=>({id:a.id,kind:a.kind,name:a.name,host:a.host,trust:a.trust,status:a.status,review:a.review,topDataClass:(0,f.C05)(b.map(a=>a.dataClass)),callSiteCount:a.callSiteCount,lastSeen:a.lastSeen})).sort((a,b)=>{let c=(0,f.WSs)(a.review.reasons)-(0,f.WSs)(b.review.reasons);return 0!==c?c:b.lastSeen.localeCompare(a.lastSeen)})})}getDestination(a){let b=this.fetchDestinationById(a);if(!b)return Promise.resolve(null);let c=this.fetchEndpoints([b.id]),d=this.fetchCallSites(c.map(a=>a.id));return Promise.resolve(function(a,b,c){let d=b.map(a=>a.transport),e=b.length>0?Math.max(...b.map(a=>a.lastSeenMs)):a.lastSeenMs,g=new Map;for(let a of c.slice(0,200)){let b={id:a.id,project:a.project,file:a.file,line:a.line,snippet:a.snippet,dynamic:a.dynamic,vendored:a.vendored,projectId:a.projectId},c=g.get(a.endpointId);c?c.push(b):g.set(a.endpointId,[b])}return{id:a.id,kind:a.kind,name:a.name,host:a.host,category:a.category,trust:a.trust,status:(0,f.Gw9)(a.trust,a.overrideDecision),isCustom:(0,f.y_0)(a.trust,a.overrideDecision),lastSeen:new Date(e).toISOString(),transports:(0,f.by7)(d),dataClasses:(0,f.hzO)(b.map(a=>a.dataClass)),review:(0,f.Fnc)(a.trust,d,null!==a.overrideDecision),network:"provider"===a.kind?null:W(a.networkJson,null),note:a.note,endpoints:b.map(a=>({...bK(a),sites:g.get(a.id)??[]}))}}(b,c,d))}setEgressDecision(a,b){let c=!1;return D(this.db,()=>{let d=this.db.prepare("SELECT host FROM share_destination WHERE id = ?").get(a);void 0!==d&&(c=!0,this.db.prepare(`DELETE FROM egress_decision_override
|
|
710
|
-
WHERE host = :host OR (destination_id = :destinationId AND host IS NULL)`).run({host:d.host,destinationId:a}),null!==b&&this.db.prepare(`INSERT INTO egress_decision_override
|
|
711
|
-
(id, destination_id, host, decision, created_at, updated_at)
|
|
712
|
-
VALUES (:id, :destinationId, :host, :decision, :now, :now)`).run({id:(0,n.randomUUID)(),destinationId:a,host:d.host,decision:b,now:Date.now()}))},"IMMEDIATE"),c}recordProjectEgress(a){let{hits:b,droppedFiles:c,truncated:d}=function(a,b){if(a.length<=5e3)return{hits:[...a],droppedFiles:[],truncated:!1};if("walk"===b)return{hits:a.slice(0,5e3),droppedFiles:[],truncated:!0};let c=new Map;for(let b of a){let a=c.get(b.site.file);void 0===a?c.set(b.site.file,[b]):a.push(b)}let d=[],e=[];for(let[a,b]of c)d.length+b.length>5e3?e.push(a):d.push(...b);return{hits:d,droppedFiles:e,truncated:!0}}(a.hits,a.reconcile.mode),e=function(a,b){if("walk"===a.mode||0===b.length)return a;let c=new Set(b);return{mode:"ledger",scannedFiles:a.scannedFiles.filter(a=>!c.has(a)),deletedFiles:a.deletedFiles.filter(a=>!c.has(a))}}(a.reconcile,c),f=Date.now(),g={destinations:0,endpoints:0,callSites:0,truncated:d,droppedFiles:c};return D(this.db,()=>{let h=a.projectId??this.knownProjectId(a.projectKey);this.reconcileCallSites(a.projectKey,e),this.upsertHits(a,b,h,f),this.confirmLastSeen(a.projectKey,f),this.pruneOrphans(),g={...this.projectTotals(a.projectKey),truncated:d,droppedFiles:c}},"IMMEDIATE"),g}reconcileCallSites(a,b){if("walk"===b.mode){let c=b.walkedPrefix.replace(/\/+$/,"");this.db.prepare(`DELETE FROM share_call_site
|
|
713
|
-
WHERE project_key = :key
|
|
714
|
-
AND (:prefix = '' OR file = :prefix OR file LIKE :subtree ESCAPE '\\')
|
|
715
|
-
AND file NOT LIKE '.%'
|
|
716
|
-
AND file NOT LIKE '%/.%'`).run({key:a,prefix:c,subtree:`${y(c)}/%`});return}let c=[...new Set([...b.scannedFiles,...b.deletedFiles])];for(let b=0;b<c.length;b+=500){let d=c.slice(b,b+500);this.db.prepare(`DELETE FROM share_call_site
|
|
717
|
-
WHERE project_key = ? AND file IN (${z(d.length)})`).run(a,...d)}}upsertHits(a,b,c,d){if(0===b.length)return;let e=this.db.prepare(`INSERT INTO share_destination
|
|
718
|
-
(id, kind, name, host, category, trust, network_json, last_seen, provenance,
|
|
719
|
-
created_at, updated_at)
|
|
720
|
-
VALUES (:id, :kind, :name, :host, :category, :trust, :networkJson, :now, 'scan', :now, :now)
|
|
721
|
-
ON CONFLICT (host) DO UPDATE SET
|
|
722
|
-
kind = excluded.kind,
|
|
723
|
-
name = excluded.name,
|
|
724
|
-
category = excluded.category,
|
|
725
|
-
trust = excluded.trust,
|
|
726
|
-
network_json = excluded.network_json,
|
|
727
|
-
last_seen = excluded.last_seen,
|
|
728
|
-
updated_at = excluded.updated_at`),f=this.db.prepare("SELECT id FROM share_destination WHERE host = ?"),g=this.db.prepare(`INSERT INTO share_endpoint
|
|
729
|
-
(id, destination_id, method, transport, url, template, data_class, last_seen,
|
|
730
|
-
created_at, updated_at)
|
|
731
|
-
VALUES (:id, :destinationId, :method, :transport, :url, :template, :dataClass, :now,
|
|
732
|
-
:now, :now)
|
|
733
|
-
ON CONFLICT (destination_id, method, url) DO UPDATE SET
|
|
734
|
-
transport = excluded.transport,
|
|
735
|
-
template = excluded.template,
|
|
736
|
-
data_class = excluded.data_class,
|
|
737
|
-
last_seen = excluded.last_seen,
|
|
738
|
-
updated_at = excluded.updated_at`),h=this.db.prepare("SELECT id FROM share_endpoint WHERE destination_id = ? AND method = ? AND url = ?"),i=this.db.prepare(`INSERT INTO share_call_site
|
|
739
|
-
(id, endpoint_id, project, project_key, file, line, snippet, dynamic, vendored,
|
|
740
|
-
project_id, created_at, updated_at)
|
|
741
|
-
VALUES (:id, :endpointId, :project, :projectKey, :file, :line, :snippet, :dynamic,
|
|
742
|
-
:vendored, :projectId, :now, :now)
|
|
743
|
-
ON CONFLICT (endpoint_id, project_key, file, line) DO UPDATE SET
|
|
744
|
-
snippet = excluded.snippet,
|
|
745
|
-
dynamic = excluded.dynamic,
|
|
746
|
-
vendored = excluded.vendored,
|
|
747
|
-
project = excluded.project,
|
|
748
|
-
project_id = COALESCE(excluded.project_id, share_call_site.project_id),
|
|
749
|
-
updated_at = excluded.updated_at`),j=new Map,k=new Map;for(let l of b){let b=j.get(l.host);void 0===b&&(e.run({id:(0,n.randomUUID)(),kind:l.kind,name:l.name,host:l.host,category:l.category,trust:l.trust,networkJson:null===l.network?null:JSON.stringify(l.network),now:d}),b=K(f,[l.host])?.id??"",j.set(l.host,b));let m=`${b}\0${l.method}\0${l.url}`,o=k.get(m);void 0===o&&(g.run({id:(0,n.randomUUID)(),destinationId:b,method:l.method,transport:l.transport,url:l.url,template:+!!l.template,dataClass:l.dataClass,now:d}),o=K(h,[b,l.method,l.url])?.id??"",k.set(m,o)),i.run({id:(0,n.randomUUID)(),endpointId:o,project:a.project,projectKey:a.projectKey,file:l.site.file,line:l.site.line,snippet:l.site.snippet,dynamic:+!!l.site.dynamic,vendored:+!!l.site.vendored,projectId:c,now:d})}}knownProjectId(a){return K(this.db.prepare(`SELECT project_id AS projectId FROM share_call_site
|
|
750
|
-
WHERE project_key = ? AND project_id IS NOT NULL LIMIT 1`),[a])?.projectId??null}confirmLastSeen(a,b){this.db.prepare(`UPDATE share_endpoint SET last_seen = :now, updated_at = :now
|
|
751
|
-
WHERE id IN (SELECT DISTINCT endpoint_id FROM share_call_site WHERE project_key = :key)`).run({now:b,key:a}),this.db.prepare(`UPDATE share_destination SET last_seen = :now, updated_at = :now
|
|
752
|
-
WHERE id IN (SELECT DISTINCT e.destination_id
|
|
753
|
-
FROM share_endpoint e
|
|
754
|
-
JOIN share_call_site c ON c.endpoint_id = e.id
|
|
755
|
-
WHERE c.project_key = :key)`).run({now:b,key:a})}pruneOrphans(){this.db.exec(`DELETE FROM share_endpoint
|
|
756
|
-
WHERE NOT EXISTS (SELECT 1 FROM share_call_site c WHERE c.endpoint_id = share_endpoint.id)`),this.db.exec(`DELETE FROM egress_decision_override
|
|
757
|
-
WHERE host IS NULL
|
|
758
|
-
AND destination_id IN (
|
|
759
|
-
SELECT d.id FROM share_destination d
|
|
760
|
-
WHERE NOT EXISTS (SELECT 1 FROM share_endpoint e WHERE e.destination_id = d.id))`),this.db.exec(`DELETE FROM share_destination
|
|
761
|
-
WHERE NOT EXISTS (
|
|
762
|
-
SELECT 1 FROM share_endpoint e WHERE e.destination_id = share_destination.id)`)}projectTotals(a){return{destinations:N(this.db,`SELECT count(DISTINCT e.destination_id) AS n
|
|
763
|
-
FROM share_endpoint e
|
|
764
|
-
JOIN share_call_site c ON c.endpoint_id = e.id
|
|
765
|
-
WHERE c.project_key = ?`,[a]),endpoints:N(this.db,"SELECT count(DISTINCT endpoint_id) AS n FROM share_call_site WHERE project_key = ?",[a]),callSites:N(this.db,"SELECT count(*) AS n FROM share_call_site WHERE project_key = ?",[a])}}mapDestRow(a){return{id:a.id,kind:a.kind,name:a.name,host:a.host,category:a.category,trust:a.trust,note:a.note,networkJson:a.networkJson,lastSeenMs:a.lastSeenMs,overrideDecision:a.overrideDecision??null}}fetchDestinations(a,b,c=!1){let d,e=`d.id, d.kind, d.name, d.host, d.category, d.trust, d.note,
|
|
766
|
-
d.network_json AS networkJson, d.last_seen AS lastSeenMs,
|
|
767
|
-
d.created_at AS createdAt,
|
|
768
|
-
COALESCE(oh.decision, ol.decision) AS overrideDecision`,f=[],g=[];if(b&&b.length>0&&(f.push(`d.kind IN (${z(b.length)})`),g.push(...b)),c&&f.push(`(d.trust IN ('unverified', 'ip')
|
|
769
|
-
OR EXISTS (SELECT 1 FROM share_endpoint re
|
|
770
|
-
WHERE re.destination_id = d.id
|
|
771
|
-
AND re.transport IN ${bI}))`),a){let b=A(a);f.push(`(d.name LIKE ? ESCAPE '\\' OR d.category LIKE ? ESCAPE '\\' OR e.url LIKE ? ESCAPE '\\'
|
|
772
|
-
OR c.project LIKE ? ESCAPE '\\' OR c.file LIKE ? ESCAPE '\\')`),g.push(b,b,b,b,b),d=`SELECT DISTINCT ${e}
|
|
773
|
-
FROM share_destination d
|
|
774
|
-
${bJ}
|
|
775
|
-
LEFT JOIN share_endpoint e ON e.destination_id = d.id
|
|
776
|
-
LEFT JOIN share_call_site c ON c.endpoint_id = e.id
|
|
777
|
-
${f.length?`WHERE ${f.join(" AND ")}`:""}
|
|
778
|
-
ORDER BY d.created_at ASC, d.id ASC`}else d=`SELECT ${e}
|
|
779
|
-
FROM share_destination d
|
|
780
|
-
${bJ}
|
|
781
|
-
${f.length?`WHERE ${f.join(" AND ")}`:""}
|
|
782
|
-
ORDER BY d.created_at ASC, d.id ASC`;return I(this.db.prepare(d),g).map(a=>this.mapDestRow(a))}fetchDestinationById(a){let b=K(this.db.prepare(`SELECT d.id, d.kind, d.name, d.host, d.category, d.trust, d.note,
|
|
783
|
-
d.network_json AS networkJson, d.last_seen AS lastSeenMs,
|
|
784
|
-
COALESCE(oh.decision, ol.decision) AS overrideDecision
|
|
785
|
-
FROM share_destination d
|
|
786
|
-
${bJ}
|
|
787
|
-
WHERE d.id = ?`),[a]);return b?this.mapDestRow(b):null}fetchEndpoints(a){return 0===a.length?[]:I(this.db.prepare(`SELECT e.id, e.destination_id AS destinationId, e.method, e.transport, e.url,
|
|
788
|
-
e.template, e.data_class AS dataClass, e.last_seen AS lastSeenMs,
|
|
789
|
-
count(c.id) AS callSiteCount
|
|
790
|
-
FROM share_endpoint e
|
|
791
|
-
LEFT JOIN share_call_site c ON c.endpoint_id = e.id
|
|
792
|
-
WHERE e.destination_id IN (${z(a.length)})
|
|
793
|
-
GROUP BY e.id
|
|
794
|
-
ORDER BY e.created_at ASC, e.id ASC`),a).map(a=>({id:a.id,destinationId:a.destinationId,method:a.method,transport:a.transport,url:a.url,template:1===a.template,dataClass:a.dataClass,lastSeenMs:a.lastSeenMs,callSiteCount:a.callSiteCount}))}groupEndpoints(a){let b=new Map;for(let c of this.fetchEndpoints(a)){let a=b.get(c.destinationId);a?a.push(c):b.set(c.destinationId,[c])}return b}fetchCallSites(a){return 0===a.length?[]:I(this.db.prepare(`SELECT id, endpoint_id AS endpointId, project, file, line, snippet, dynamic, vendored,
|
|
795
|
-
project_id AS projectId
|
|
796
|
-
FROM share_call_site
|
|
797
|
-
WHERE endpoint_id IN (${z(a.length)})
|
|
798
|
-
ORDER BY created_at ASC, id ASC`),a).map(a=>({id:a.id,endpointId:a.endpointId,project:a.project,file:a.file,line:a.line,snippet:a.snippet,dynamic:1===a.dynamic,vendored:1===a.vendored,projectId:a.projectId}))}}class bN{constructor(a){this.db=a,this.upsertStmt=a.prepare(`INSERT INTO source_project
|
|
799
|
-
(id, url, name, attributes, first_seen, last_seen)
|
|
800
|
-
VALUES
|
|
801
|
-
(:id, :url, :name, :attributes, :firstSeen, :lastSeen)
|
|
802
|
-
ON CONFLICT(id) DO UPDATE SET
|
|
803
|
-
url = excluded.url,
|
|
804
|
-
name = excluded.name,
|
|
805
|
-
attributes = excluded.attributes,
|
|
806
|
-
last_seen = excluded.last_seen`)}upsert(a,b=Date.now()){let c=q(a.url),d=(0,f.QCA)(a,c,b);return this.upsertStmt.run(M({id:d.id,url:d.url,name:d.name,attributes:d.attributes,firstSeen:d.firstSeen,lastSeen:d.lastSeen})),c}findById(a){return K(this.db.prepare("SELECT * FROM source_project WHERE id = :id"),{id:a})}distinctNames(){return I(this.db.prepare(`SELECT DISTINCT name FROM source_project
|
|
807
|
-
WHERE name IS NOT NULL
|
|
808
|
-
ORDER BY name`)).map(a=>a.name)}}let bO=new Set(f.ZYZ.options),bP=Symbol("aka.persistence.unsafeTestOnlyRawHandle");function bQ(a,b){return b?{...a,hostId:b}:a}function bR(a){try{a.close()}catch{}}function bS(a){let b=new o.DatabaseSync(a);try{b.exec("PRAGMA journal_mode = WAL"),b.exec("PRAGMA busy_timeout = 2000"),b.exec("PRAGMA foreign_keys = ON")}catch(a){throw bR(b),a}return b}function bT(a){i(a,!0),h(a,448);let b=(0,e.join)(a,g);w(b);let{db:c,events:l,findings:m,policies:o,installedPacks:t,scanLedger:u,historySync:v,secretVault:z,exceptions:A,resolutions:B,ruleProbeCache:C,security:I,detections:J,shares:K,policyCatalog:L,inventory:N,inventoryAssets:O,projectFiles:P,activity:W,sourceProject:X,auditEvents:Y,classifiedData:Z,inspectionDefinitions:$,inspectionFindings:_,configInventory:aa}=function(a,b){let c=bS(a);try{var e;if(e=c,G(e,"table","tenants")||H(e,"events").includes("tenant_id")){let b=function(a,b){let c;w(b);let e=s(b,"legacy"),f=!1;try{x(a,e),f=!0}catch(a){c=a}finally{a.close()}if(!f){F(`Could not snapshot the incompatible ${g} (${String(c)}); moving the store aside with its sidecars instead.`);let a=[];(0,d.renameSync)(b,e),a.push([e,b]);try{for(let c of j(b)){let f=`${e}${c.slice(b.length)}`;try{(0,d.renameSync)(c,f),a.push([f,c])}catch{(0,d.rmSync)(c,{force:!0})}}}catch(b){for(let[b,c]of a.reverse())try{(0,d.renameSync)(b,c)}catch{}throw b}return k(e),e}try{for(let a of((0,d.rmSync)(b,{force:!0}),j(b)))(0,d.rmSync)(a,{force:!0})}catch(a){if((0,d.existsSync)(b))try{(0,d.rmSync)(e,{force:!0})}catch{}throw a}return e}(c,a);c=bS(a),F(`Detected an older, incompatible (tenant-bearing) ${g}; backed it up to ${b} and created a fresh store.`)}!function(a,b){var c,d;let e=a.prepare("PRAGMA user_version").get().user_version;a.exec("CREATE TABLE IF NOT EXISTS migration_ledger (tag TEXT PRIMARY KEY, applied_at INTEGER NOT NULL)");let g=new Set(a.prepare("SELECT tag FROM migration_ledger").all().map(a=>a.tag)),h=0===g.size&&e>0,i=a.prepare("INSERT OR IGNORE INTO migration_ledger (tag, applied_at) VALUES (?, ?)");for(let[b,c]of f.lFU.entries()){if(g.has(c.tag)||c.tag===S)continue;let d=function(a){let b=[];for(let c of a.matchAll(/CREATE TABLE (?:IF NOT EXISTS )?`([^`]+)`/g))void 0===c[1]||c[1].startsWith("__new_")||b.push({kind:"table",name:c[1]});for(let c of a.matchAll(/ALTER TABLE `([^`]+)` ADD (?:COLUMN )?`([^`]+)`/g))void 0!==c[1]&&void 0!==c[2]&&b.push({kind:"column",table:c[1],name:c[2]});return b}(c.sql),f=d.filter(b=>"column"===b.kind?H(a,b.table,{includeGenerated:!0}).includes(b.name):G(a,"table",b.name));if(f.length>0&&f.length<d.length){let a=d.filter(a=>!f.includes(a)),b=`sqlite migration ${c.tag} has no ledger row, but the store already has ${f.map(Q).join(", ")} while missing ${a.map(Q).join(", ")} — the schema diverged from the migration history; refusing to replay or skip.`;throw F(b),Error(`[aka] ${b}`)}let j=d.length>0?f.length===d.length:h&&b<e,k=/PRAGMA foreign_keys\s*=\s*OFF/i.test(c.sql),l=R(c.sql);k&&a.exec("PRAGMA foreign_keys = OFF");try{D(a,()=>{for(let b of l){let c=function(a){let b=a.replace(/^(?:\s*--[^\n]*\n?)+/,"").trimStart();return/^CREATE (?:UNIQUE )?INDEX (?:IF NOT EXISTS )?`([^`]+)`/.exec(b)?.[1]}(b);if(void 0===c){if(j)continue}else if(G(a,"index",c))continue;a.exec(b)}if(k&&!j){let b=a.prepare("PRAGMA foreign_key_check").all();if(b.length>0)throw Error(`[aka] sqlite migration ${c.tag} left ${String(b.length)} foreign-key violation(s); rolling back.`)}i.run(c.tag,Date.now())},"IMMEDIATE")}finally{k&&a.exec("PRAGMA foreign_keys = ON")}}e<f.lFU.length&&a.exec(`PRAGMA user_version = ${String(f.lFU.length)}`),function(a,b){if(!G(a,"table",b))return;let c=H(a,b);c.includes("synced_at")||a.exec(`ALTER TABLE ${b} ADD COLUMN synced_at integer`),c.includes("sync_claimed_at")||a.exec(`ALTER TABLE ${b} ADD COLUMN sync_claimed_at integer`),c.includes("outbox_owed")||a.exec(`ALTER TABLE ${b} ADD COLUMN outbox_owed integer`),a.exec(`CREATE INDEX IF NOT EXISTS idx_audit_events_sync
|
|
809
|
-
ON audit_events (event_type, synced_at, sync_claimed_at, started_at)`),a.exec(`CREATE INDEX IF NOT EXISTS idx_audit_outbox_owed
|
|
810
|
-
ON audit_events (event_type, synced_at, sync_claimed_at, started_at) WHERE outbox_owed = 1`),a.exec(`CREATE INDEX IF NOT EXISTS idx_audit_claimed
|
|
811
|
-
ON audit_events (sync_claimed_at) WHERE sync_claimed_at IS NOT NULL`)}(a,"audit_events"),a.exec(`CREATE TABLE IF NOT EXISTS scan_ledger (
|
|
812
|
-
path TEXT PRIMARY KEY,
|
|
813
|
-
mtime TEXT NOT NULL,
|
|
814
|
-
content_hash TEXT NOT NULL,
|
|
815
|
-
ruleset_hash TEXT NOT NULL,
|
|
816
|
-
scanned_at INTEGER NOT NULL
|
|
817
|
-
)`),(c=a).exec(`CREATE TABLE IF NOT EXISTS history_sync (
|
|
818
|
-
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
819
|
-
endpoint_fingerprint TEXT,
|
|
820
|
-
backlog_before INTEGER,
|
|
821
|
-
owner_pid INTEGER,
|
|
822
|
-
owner_host TEXT,
|
|
823
|
-
acquired_at INTEGER,
|
|
824
|
-
heartbeat_at INTEGER
|
|
825
|
-
)`),H(c,"history_sync").includes("backlog_before")||c.exec("ALTER TABLE history_sync ADD COLUMN backlog_before integer"),a.exec(`CREATE TABLE IF NOT EXISTS blocked_detections (
|
|
826
|
-
reference TEXT PRIMARY KEY,
|
|
827
|
-
rule_id TEXT NOT NULL,
|
|
828
|
-
category TEXT NOT NULL,
|
|
829
|
-
value_fingerprint TEXT NOT NULL,
|
|
830
|
-
key_version INTEGER NOT NULL,
|
|
831
|
-
masked_value TEXT NOT NULL,
|
|
832
|
-
session_id TEXT,
|
|
833
|
-
repo TEXT,
|
|
834
|
-
blocked_at INTEGER NOT NULL
|
|
835
|
-
)`),a.exec(`CREATE TABLE IF NOT EXISTS rule_probe_cache (
|
|
836
|
-
rule_key TEXT PRIMARY KEY,
|
|
837
|
-
verdict TEXT NOT NULL,
|
|
838
|
-
worst_probe_ms REAL NOT NULL,
|
|
839
|
-
checked_at INTEGER NOT NULL
|
|
840
|
-
)`),(d=a).exec(`CREATE TABLE IF NOT EXISTS \`_pack_write_gate\` (
|
|
841
|
-
\`id\` integer PRIMARY KEY NOT NULL,
|
|
842
|
-
\`open\` integer DEFAULT 0 NOT NULL,
|
|
843
|
-
CONSTRAINT "ck_pack_write_gate_single_row" CHECK("_pack_write_gate"."id" = 1)
|
|
844
|
-
)`),d.exec("INSERT OR IGNORE INTO _pack_write_gate (id, open) VALUES (1, 0)"),G(d,"table","installed_packs")&&d.exec(`CREATE TRIGGER IF NOT EXISTS trg_installed_packs_write_gate
|
|
845
|
-
BEFORE UPDATE OF version, name, rules_json ON installed_packs
|
|
846
|
-
WHEN (SELECT open FROM _pack_write_gate WHERE id = 1) IS NOT 1
|
|
847
|
-
BEGIN SELECT RAISE(IGNORE); END`),function(a){if(!G(a,"table","audit_events"))return;let b=new Set(H(a,"audit_events",{includeGenerated:!0}));for(let c of U)b.has(c.name)||a.exec(c.ddl)}(a),function(a){try{let b=a.prepare(`SELECT id, url, name, attributes, first_seen AS firstSeen, last_seen AS lastSeen
|
|
848
|
-
FROM source_project
|
|
849
|
-
WHERE url IS NOT NULL AND id NOT LIKE 'sample:%'
|
|
850
|
-
ORDER BY last_seen DESC, id`).all().map(a=>({row:a,canonicalId:q(a.url)})).filter(({row:a,canonicalId:b})=>a.id!==b);if(0===b.length)return;let c=a.prepare(`INSERT INTO source_project (id, url, name, attributes, first_seen, last_seen)
|
|
851
|
-
VALUES (?, ?, ?, ?, ?, ?)
|
|
852
|
-
ON CONFLICT(id) DO UPDATE SET
|
|
853
|
-
first_seen = min(first_seen, excluded.first_seen),
|
|
854
|
-
last_seen = max(last_seen, excluded.last_seen)`),d=a.prepare("UPDATE audit_events SET source_project_id = ? WHERE source_project_id = ?"),e=a.prepare("UPDATE share_call_site SET project_id = ? WHERE project_id = ?"),f=["project_file","file_access_override"].map(b=>({dropCollisions:a.prepare(`DELETE FROM ${b} WHERE project_id = ?
|
|
855
|
-
AND path IN (SELECT path FROM ${b} WHERE project_id = ?)`),repoint:a.prepare(`UPDATE ${b} SET project_id = ? WHERE project_id = ?`)})),g=a.prepare("DELETE FROM source_project WHERE id = ?");D(a,()=>{for(let{row:a,canonicalId:h}of b){for(let{dropCollisions:b,repoint:e}of(c.run(h,a.url,a.name,a.attributes,a.firstSeen,a.lastSeen),d.run(h,a.id),f))b.run(a.id,h),e.run(h,a.id);e.run(h,a.id),g.run(a.id)}},"IMMEDIATE")}catch(a){F(`source_project id reconcile failed: ${String(a)}`)}}(a),!g.has(S)&&function(a){try{if(!function(a){let b=a.prepare(`SELECT rowid AS rowid, id, source_tool AS sourceTool, kind, occurred_at AS occurredAt,
|
|
856
|
-
content_hash AS contentHash, content, metadata
|
|
857
|
-
FROM events WHERE rowid > ? ORDER BY rowid LIMIT ?`),c=a.prepare(`INSERT OR IGNORE INTO audit_events
|
|
858
|
-
(id, parent_id, root_session_id, event_type, started_at, content, content_hash, attributes)
|
|
859
|
-
VALUES (:id, :parentId, :rootSessionId, :eventType, :startedAt, :content, :contentHash, :attributes)`),d=a.prepare("INSERT OR IGNORE INTO audit_events (id, event_type, started_at) VALUES (?, 'session', ?)");return V(a,"events",b,a=>{for(let e of a){var b;let a=function(a){if(null!==a)try{return JSON.parse(a)}catch{return}}(e.metadata),g=a?.sessionId??null;null!==g&&d.run(g,e.occurredAt),c.run(M({id:e.id,parentId:g,rootSessionId:g,eventType:e.kind,startedAt:e.occurredAt,content:e.content,contentHash:e.contentHash,attributes:(b={...e,metadata:a},JSON.stringify((0,f.$w9)({id:b.id,sourceTool:b.sourceTool,kind:b.kind,occurredAt:new Date(b.occurredAt).toISOString(),contentHash:b.contentHash,content:b.content,metadata:b.metadata})))}))}})}(a))return!1;let b=a.prepare(`SELECT rowid AS rowid, id, event_id AS eventId, rule_id AS ruleId, category, severity,
|
|
860
|
-
span_start AS spanStart, span_end AS spanEnd, masked_match AS maskedMatch,
|
|
861
|
-
action_taken AS actionTaken, confidence, finding_key AS findingKey,
|
|
862
|
-
first_detected_at AS firstDetectedAt
|
|
863
|
-
FROM findings WHERE rowid > ? ORDER BY rowid LIMIT ?`),c=a.prepare(`INSERT OR IGNORE INTO inspection_definitions
|
|
864
|
-
(id, rule_id, name, category, severity, definition, version)
|
|
865
|
-
VALUES (:id, :ruleId, :name, :category, :severity, :definition, :version)`),d=a.prepare(`INSERT INTO inspection_findings
|
|
866
|
-
(id, audit_event_id, inspection_definition_id, classified_data_id,
|
|
867
|
-
span_start, span_end, masked_match, action_taken, confidence,
|
|
868
|
-
finding_key, first_detected_at)
|
|
869
|
-
VALUES
|
|
870
|
-
(:id, :auditEventId, :inspectionDefinitionId, NULL,
|
|
871
|
-
:spanStart, :spanEnd, :maskedMatch, :actionTaken, :confidence,
|
|
872
|
-
:findingKey, :firstDetectedAt)
|
|
873
|
-
ON CONFLICT(id) DO NOTHING
|
|
874
|
-
ON CONFLICT (finding_key) DO UPDATE SET
|
|
875
|
-
first_detected_at = CASE
|
|
876
|
-
WHEN first_detected_at IS NULL THEN excluded.first_detected_at
|
|
877
|
-
WHEN excluded.first_detected_at IS NULL THEN first_detected_at
|
|
878
|
-
ELSE min(first_detected_at, excluded.first_detected_at)
|
|
879
|
-
END`);return V(a,"findings",b,a=>{let b=new Map;for(let e of a){let a=JSON.stringify([e.ruleId,e.category,e.severity]),f=b.get(a);if(void 0===f){let d=`unmigrated/${e.category}/${e.severity}`;f=r(e.ruleId,d),c.run(M({id:f,ruleId:e.ruleId,name:e.ruleId,category:e.category,severity:e.severity,definition:"",version:d})),b.set(a,f)}d.run(M({id:e.id,auditEventId:e.eventId,inspectionDefinitionId:f,spanStart:e.spanStart,spanEnd:e.spanEnd,maskedMatch:e.maskedMatch,actionTaken:e.actionTaken,confidence:e.confidence,findingKey:e.findingKey,firstDetectedAt:e.firstDetectedAt}))}})}catch(a){return F(`legacy history backfill failed: ${String(a)}`),!1}}(a)&&function(a,b){let c=f.lFU.find(a=>a.tag===S);if(!c)return;let d=void 0===b?void 0:T(a);if(void 0!==b&&d?.holdsRows===!0)try{var e=a,g=b;w(g);let c=s(g,"pre-drop");x(e,c)}catch(a){F(`legacy events/findings backup failed; deferring the drop: ${String(a)}`);return}try{D(a,()=>{if(!a.prepare("SELECT 1 FROM migration_ledger WHERE tag = ?").get(c.tag)){if(void 0!==d&&T(a).mark!==d.mark)return void F("legacy events/findings rows changed after the pre-drop snapshot decision; deferring the drop so the next open can copy them first.");for(let b of R(c.sql))a.exec(b);a.prepare("INSERT OR IGNORE INTO migration_ledger (tag, applied_at) VALUES (?, ?)").run(c.tag,Date.now())}},"IMMEDIATE")}catch(a){F(`legacy events/findings drop failed; deferring: ${String(a)}`)}}(a,b)}(c,a),k(a);let h=new bn(c),i=new a3(c,b),l={events:new aw(c),findings:new aJ(c),policies:h,installedPacks:i,scanLedger:new bs(c),historySync:new aN(c),secretVault:new by(c),exceptions:new aC(c),resolutions:new bq(c),ruleProbeCache:new br(c),security:new bG(c),detections:new av(c),shares:new bM(c),policyCatalog:new bo(i),inventory:new a4(c),inventoryAssets:new bm(c),projectFiles:new bp(c),activity:new an(c),sourceProject:new bN(c),auditEvents:new ao(c),classifiedData:new ap(c),inspectionDefinitions:new aO(c),inspectionFindings:new aP(c),configInventory:new ar(c)};return h.seedDefaults(),{db:c,...l}}catch(a){throw bR(c),a}}(b,(0,e.dirname)(a));function ab(a){return function(a,b,c=null){return p((0,f.tTV)(["capture",a??"no_session",b,c??"no_path"]))}(a.metadata?.sessionId??null,a.contentHash,a.metadata?.filePath??null)}return{events:l,findings:m,policies:o,installedPacks:t,scanLedger:u,historySync:v,secretVault:z,exceptions:A,resolutions:B,ruleProbeCache:C,security:I,detections:J,shares:K,policyCatalog:L,inventory:N,inventoryAssets:O,activity:W,sourceProject:X,auditEvents:Y,classifiedData:Z,inspectionDefinitions:$,inspectionFindings:_,recordCapture:function(a,b){E(c,()=>{let c=a.metadata?.sessionId;c&&Y.ensureSessionRoot(c,a.occurredAt);let d=ab(a);Y.insertAuditEvent({id:d,eventType:a.kind,startedAt:a.occurredAt,parentId:c,rootSessionId:c,content:a.content,contentHash:a.contentHash,attributes:(0,f.$w9)(a)});let e=new Map;for(let a of b){if(c&&_.isSessionDuplicate(a.ruleId,a.maskedMatch,c)||_.isEventDuplicate(d,a.ruleId,a.maskedMatch,a.span.start,a.span.end))continue;let b=`${a.ruleId}@${(0,f.qmP)(a)}`,g=e.get(b);g||(g=$.upsert((0,f.jTf)(a)),e.set(b,g)),_.insertFinding({id:a.id,auditEventId:d,inspectionDefinitionId:g,span:a.span,maskedMatch:a.maskedMatch,actionTaken:a.actionTaken,confidence:a.confidence,findingKey:a.findingKey??void 0})}})},markCaptureDelivered:function(a,b){E(c,()=>{v.markSynced([ab(a)],b)})},markCaptureOwed:function(a){E(c,()=>{v.markCaptureOwed(ab(a))})},markAuditEventsDelivered:function(a,b){let d=a.filter(a=>!bO.has(a.eventType));0!==d.length&&E(c,()=>{v.markSynced(d.map(a=>a.id),b)})},ensureInventory:function(a){let b={};return E(c,()=>{let c=Date.now();a.host&&(b.hostId=N.upsert(a.host,c)),a.harness&&(b.harnessId=N.upsert(bQ(a.harness,b.hostId),c)),b.accountId=N.upsert(bQ({objectType:"user",identityKey:"local",attributes:{source:"local"}},b.hostId),c),a.project&&(b.sourceProjectId=X.upsert(a.project,c))})?b:{}},recordConfigScan:function(a){E(c,()=>{let b=(0,f.I8t)(a.scanEvent.startedAt);for(let c of a.items)N.upsert(c,b);Y.insertAuditEvent(a.scanEvent);let c=new Map;for(let b of a.definitions??[])c.set(`${b.ruleId}@${b.version}`,$.upsert(b));for(let b of a.findings??[]){let d=c.get(`${b.ruleId}@${b.version}`);d&&_.insertFinding({id:(0,n.randomUUID)(),auditEventId:a.scanEvent.id,inspectionDefinitionId:d,span:b.span,maskedMatch:b.maskedMatch,actionTaken:b.actionTaken,confidence:b.confidence})}})},recordProjectFiles:function(a,b){0!==b.files.length&&E(c,()=>{P.replaceForProject(a,b,Date.now())})},reconcileWorktreeProjects:function(a,b,d){try{let f=b.split(e.sep).join("/"),g=d.split(e.sep).join("/"),h=d===b?"":"url IN (:worktreePosix, :worktreeWin) OR ",i=c.prepare(`SELECT id FROM source_project
|
|
880
|
-
WHERE id <> :canonicalId
|
|
881
|
-
AND (${h}url LIKE :pattern ESCAPE '\\' OR url LIKE :patternWin ESCAPE '\\')`).all({canonicalId:a,...d===b?{}:{worktreePosix:g,worktreeWin:g.split("/").join("\\")},pattern:`${y(f)}/.claude/worktrees/%`,patternWin:`${y(f.split("/").join("\\"))}\\\\.claude\\\\worktrees\\\\%`});if(0===i.length)return;D(c,()=>{for(let{id:b}of i)c.prepare("UPDATE audit_events SET source_project_id = :canonicalId WHERE source_project_id = :id").run({canonicalId:a,id:b}),c.prepare("UPDATE OR IGNORE file_access_override SET project_id = :canonicalId WHERE project_id = :id").run({canonicalId:a,id:b}),c.prepare("DELETE FROM file_access_override WHERE project_id = :id").run({id:b}),c.prepare("DELETE FROM project_file WHERE project_id = :id").run({id:b}),c.prepare("DELETE FROM source_project WHERE id = :id").run({id:b})})}catch{}},configInventoryReport:()=>aa.report(),facets:function(){return{hosts:N.distinctTitles("host"),harnesses:N.distinctTitles("harness"),osVersions:N.osVersions(),projects:X.distinctNames()}},purgeSampleData:()=>{!function(a){try{if(!a.prepare(`SELECT (
|
|
882
|
-
EXISTS(SELECT 1 FROM share_destination WHERE provenance = 'sample')
|
|
883
|
-
OR EXISTS(SELECT 1 FROM audit_events WHERE id LIKE 'sample:activity:%')
|
|
884
|
-
OR EXISTS(SELECT 1 FROM inventory_asset WHERE provenance = 'sample')
|
|
885
|
-
) AS n`).get().n)return;D(a,()=>{a.exec(`DELETE FROM share_call_site WHERE endpoint_id IN (
|
|
886
|
-
SELECT e.id FROM share_endpoint e
|
|
887
|
-
JOIN share_destination d ON d.id = e.destination_id
|
|
888
|
-
WHERE d.provenance = 'sample')`),a.exec(`DELETE FROM egress_decision_override WHERE destination_id IN (
|
|
889
|
-
SELECT id FROM share_destination WHERE provenance = 'sample')`),a.exec(`DELETE FROM share_endpoint WHERE destination_id IN (
|
|
890
|
-
SELECT id FROM share_destination WHERE provenance = 'sample')`),a.exec("DELETE FROM share_destination WHERE provenance = 'sample'"),a.exec(`DELETE FROM harness_asset WHERE asset_id IN (SELECT id FROM inventory_asset WHERE provenance = 'sample')
|
|
891
|
-
OR harness_id IN (SELECT id FROM inventory WHERE object_type = 'harness' AND json_extract(attributes, '$.provenance') = 'sample')`),a.exec("DELETE FROM mcp_trust_override WHERE asset_id IN (SELECT id FROM inventory_asset WHERE provenance = 'sample')"),a.exec("DELETE FROM file_access_override WHERE project_id IN (SELECT id FROM source_project WHERE json_extract(attributes, '$.provenance') = 'sample')"),a.exec("DELETE FROM project_file WHERE project_id IN (SELECT id FROM source_project WHERE json_extract(attributes, '$.provenance') = 'sample')"),a.exec("DELETE FROM inventory_asset WHERE provenance = 'sample'"),a.exec("DELETE FROM source_project WHERE json_extract(attributes, '$.provenance') = 'sample'"),a.exec("DELETE FROM inventory WHERE object_type = 'harness' AND json_extract(attributes, '$.provenance') = 'sample'"),a.exec("DELETE FROM inspection_findings WHERE id LIKE 'sample:activity:%'"),a.exec("DELETE FROM inspection_definitions WHERE id LIKE 'sample:activity:%'"),a.exec("DELETE FROM audit_events WHERE root_session_id LIKE 'sample:activity:%'"),a.exec("DELETE FROM audit_events WHERE id LIKE 'sample:activity:%'"),a.exec(`CREATE TABLE IF NOT EXISTS app_meta (
|
|
892
|
-
key TEXT PRIMARY KEY,
|
|
893
|
-
value TEXT NOT NULL
|
|
894
|
-
)`),a.exec("DELETE FROM app_meta WHERE key LIKE 'sample_seeded:%'")})}catch{}}(c)},transaction:async function a(a){c.exec("BEGIN");try{let b=await a();return c.exec("COMMIT"),b}catch(a){try{c.exec("ROLLBACK")}catch{}throw a}},close:()=>{c.close()},[bP]:c}}function bU(a){let b;try{b=(0,d.readFileSync)((0,e.join)(a,"exception.key"),"utf8")}catch(a){if("ENOENT"===a.code)return null;throw a instanceof Error?a:Error(String(a))}let c=JSON.parse(b);if("object"!=typeof c||null===c)throw Error("exception key file is corrupt: not a JSON object");let{version:f,material:g}=c;if("number"!=typeof f||!Number.isInteger(f)||f<1)throw Error("exception key file is corrupt: bad version");if("string"!=typeof g)throw Error("exception key file is corrupt: bad material");let h=Buffer.from(g,"base64");if(32!==h.length)throw Error("exception key file is corrupt: bad material length");return{version:f,material:h}}function bV(a){return null===a?{status:"absent"}:{status:"present",version:a.version}}c(31421),Symbol("aka.vault.consentAbsent"),Symbol("aka.vault.unavailable")},42353:(a,b,c)=>{"use strict";c.d(b,{i:()=>j});var d=c(15008),e=c(71378),f=c(16820),g=c(21459),h=c(24061);function i({event:a,first:b,last:c,linkHref:i}){let j=h.$x[a.kind],k="tool"===a.kind&&a.tool?h.pS[a.tool]??j.icon:j.icon,l="active"===a.kind,m="tool"===a.kind||"commit"===a.kind,n=a.link?h.Oy[a.link]:null,o=a.link&&i?i(a.link,a.targetId):null;return(0,d.jsxs)("div",{className:"grid grid-cols-[60px_24px_1fr] gap-x-3",children:[(0,d.jsx)("div",{className:"whitespace-nowrap pt-1.5 text-right font-mono text-label text-text-3",children:(0,g.gE)(a.occurredAt)}),(0,d.jsxs)("div",{className:"relative flex justify-center",children:[!(b&&c)&&(0,d.jsx)("span",{className:(0,e.cn)("absolute left-1/2 w-px -translate-x-1/2 bg-border",b?"bottom-0 top-3":c?"top-0 h-3":"inset-y-0")}),(0,d.jsxs)("span",{className:(0,e.cn)("relative z-10 grid size-6 place-items-center rounded-md ring-2 ring-surface",j.fill,j.text),children:[l&&(0,d.jsx)("span",{className:"absolute inset-0 animate-ping rounded-md bg-current opacity-30"}),(0,d.jsx)(k,{"aria-hidden":!0,focusable:!1,className:"relative size-3.5"})]})]}),(0,d.jsxs)("div",{className:(0,e.cn)("pt-0.5",c?"pb-0":"pb-4.5"),children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:"text-ui font-semibold text-text",children:a.title}),a.severity&&(0,d.jsx)(e.Pt,{severity:a.severity}),a.flagged&&(0,d.jsxs)(e.Ex,{variant:"critical",className:"h-6 gap-1.5",children:[(0,d.jsx)(f._0,{"aria-hidden":!0,focusable:!1,className:"size-3"}),"Flagged"]}),a.internal&&(0,d.jsxs)(e.Ex,{variant:"primary",className:"h-6 gap-1.5",children:[(0,d.jsx)(f.Zu,{"aria-hidden":!0,focusable:!1,className:"size-3"}),"Internal"]})]}),(0,d.jsxs)("div",{className:(0,e.cn)("mt-0.5 text-xs text-text-2",m&&"font-mono"),children:[a.detail,n&&o&&(0,d.jsx)(e.$n,{asChild:!0,variant:"link",tone:"primary",className:"ml-2 text-xs font-normal",children:(0,d.jsxs)("a",{href:o,children:["Open in ",n,(0,d.jsx)(f.Qq,{"aria-hidden":!0,focusable:!1})]})})]})]})]})}function j({events:a,linkHref:b}){return(0,d.jsx)("div",{children:a.map((c,e)=>(0,d.jsx)(i,{event:c,first:0===e,last:e===a.length-1,...b?{linkHref:b}:{}},c.id))})}},42749:(a,b,c)=>{"use strict";c.d(b,{UpdateStatusCardView:()=>g});var d=c(15008),e=c(71378),f=c(16820);function g({statuses:a,checkedAt:b,onCheckNow:c,onApply:g,applyingId:h,outcomes:i,restartRequired:j,busy:k}){return(0,d.jsxs)(e.Zp,{className:"shadow-sm",children:[(0,d.jsxs)(e.aR,{children:[(0,d.jsx)(e.AG,{tone:"primary",children:(0,d.jsx)(f.fN,{"aria-hidden":!0,focusable:!1,className:"size-4"})}),(0,d.jsxs)(e.Lc,{children:[(0,d.jsx)(e.ZB,{children:"Installed components"}),(0,d.jsx)(e.BT,{children:b?`Last checked ${b}`:"Not checked yet"})]}),(0,d.jsx)(e.$n,{variant:"outline",tone:"neutral",size:"sm",disabled:k,onClick:c,children:k?"Checking…":"Check now"})]}),(0,d.jsxs)(e.Wu,{children:[j&&(0,d.jsxs)("div",{className:"mb-3 rounded-lg border border-ok-fill bg-ok-fill px-3 py-2 text-xs font-medium text-text",children:["Update installed — restart ",(0,d.jsx)("code",{className:"font-mono",children:"aka dashboard"})," to load the new version."]}),(0,d.jsxs)("div",{className:"flex flex-col",children:[a.map((a,b)=>{let c=i[a.id];return(0,d.jsxs)("div",{className:(0,e.cn)("py-3",b>0&&"border-t border-hairline"),children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"text-sm font-semibold text-text",children:a.name}),(0,d.jsxs)("div",{className:"mt-0.5 font-mono text-xs text-text-3",children:[a.installed??"—",a.latest&&a.updateAvailable&&` → ${a.latest}`]})]}),null===a.installed||null===a.latest?(0,d.jsx)(e.Ex,{variant:"default",children:"unknown"}):a.updateAvailable?(0,d.jsx)(e.Ex,{variant:"high",children:"update available"}):(0,d.jsx)(e.Ex,{variant:"success",children:"up to date"}),a.updateAvailable&&(0,d.jsx)(e.$n,{variant:"solid",tone:"primary",size:"sm",disabled:null!==h,onClick:()=>{g(a.id)},children:h===a.id?"Updating…":"Update"})]}),c&&(0,d.jsxs)("div",{className:(0,e.cn)("mt-2 rounded-lg border p-2",c.ok?"border-ok-fill bg-ok-fill":"border-sev-critical-fill bg-sev-critical-fill"),children:[(0,d.jsx)("div",{className:"text-xs font-semibold text-text",children:c.ok?"Updated.":"Update failed"}),c.output&&(0,d.jsx)("pre",{className:"mt-1 max-h-40 overflow-auto whitespace-pre-wrap font-mono text-label text-text-2",children:c.output})]})]},a.id)}),0===a.length&&(0,d.jsx)("div",{className:"py-6 text-center text-xs text-text-3",children:"Nothing installed to report on yet."})]})]})]})}},46205:(a,b,c)=>{"use strict";c.d(b,{AppShell:()=>d});let d=(0,c(28326).registerClientReference)(function(){throw Error("Attempted to call AppShell() from the server but AppShell is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/ai-tc/ai-tc/web-ui/app/components/AppShell.tsx","AppShell")},46867:(a,b,c)=>{"use strict";c.d(b,{DataShareDetailView:()=>n});var d=c(15008),e=c(71378),f=c(5265),g=c(76836),h=c(16820),i=c(47472),j=c(52833);function k({st:a}){return(0,d.jsxs)("div",{className:"rounded-lg border border-border bg-surface p-3",children:[(0,d.jsxs)("div",{className:"mb-1.5 flex items-center gap-2",children:[(0,d.jsx)(h.SY,{"aria-hidden":!0,focusable:!1,className:"size-3.5 shrink-0 text-primary"}),(0,d.jsx)("span",{className:"text-xs font-semibold text-text",children:a.project}),a.vendored?(0,d.jsx)("span",{className:"ml-auto",children:(0,d.jsx)(e.Ex,{variant:"high",children:"Vendored"})}):a.dynamic&&(0,d.jsx)("span",{className:"ml-auto",children:(0,d.jsxs)(e.Ex,{variant:"default",children:[(0,d.jsx)(h.cZ,{"aria-hidden":!0,focusable:!1,className:"size-2.5"}),"Dynamic"]})})]}),(0,d.jsxs)("span",{className:"font-mono text-xs text-text-3",children:[a.file,":",(0,d.jsx)("b",{className:"text-text-2",children:a.line})]}),""!==a.snippet&&(0,d.jsxs)("div",{className:"overflow-x-auto whitespace-pre rounded-md bg-ink px-2.5 py-2 font-mono text-xs leading-relaxed text-white mt-0.5",children:[(0,d.jsxs)("span",{className:"text-code-muted",children:[a.file.split("/").pop(),":",a.line," "]}),a.snippet]})]})}function l({d:a,onPick:b}){let c=j.pN[a.trust].icon,f=a.endpoints.reduce((a,b)=>a+b.callSiteCount,0);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(i.Wi,{kind:a.kind,trust:a.trust,name:a.name,host:a.host,size:44}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("div",{className:(0,e.cn)("text-lg font-semibold text-text","ip"===a.kind?"font-mono":"font-display"),children:a.name}),(0,d.jsxs)("div",{className:"mt-0.5 text-xs text-text-3",children:[a.category," \xb7 ",a.endpoints.length," endpoints \xb7 ",f," call sites"]})]})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(i.xB,{trust:a.trust}),a.transports.map(a=>(0,d.jsx)(i.eV,{transport:a},a))]}),(null!==a.note||a.network?.geo!=null)&&(0,d.jsxs)("div",{className:"flex gap-2.5 rounded-lg border border-border bg-surface-2 px-3 py-2.5",children:[(0,d.jsx)(c,{"aria-hidden":!0,focusable:!1,className:"mt-0.5 size-4 shrink-0 text-text-2"}),(0,d.jsxs)("div",{className:"text-xs leading-normal text-text-2",children:[a.network?.geo!=null&&(0,d.jsxs)("div",{children:[(0,d.jsx)("b",{className:"text-text",children:"Resolves to "}),a.network.geo,null!=a.network.ptr?" \xb7 "+a.network.ptr:""]}),null!=a.note&&(0,d.jsx)("div",{className:a.network?.geo!=null?"mt-1":"",children:a.note})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(g.e,{children:"Endpoints"}),(0,d.jsx)("div",{className:"flex flex-col gap-2",children:a.endpoints.map(a=>(0,d.jsxs)("button",{type:"button",onClick:()=>{b(a.id)},className:"flex w-full cursor-pointer items-center gap-2.5 rounded-lg border border-border bg-surface px-3 py-2.5 text-left hover:bg-surface-2",children:[(0,d.jsx)(i.kX,{method:a.method}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)(i.UH,{url:a.url}),(0,d.jsxs)("div",{className:"mt-1 flex items-center gap-2",children:[(0,d.jsx)(i.eV,{transport:a.transport,plain:!0}),(0,d.jsxs)("span",{className:"text-xs text-text-3",children:["\xb7 ",a.callSiteCount," call",1===a.callSiteCount?"":"s"]})]})]}),(0,d.jsx)(h.vK,{"aria-hidden":!0,focusable:!1,className:"size-4 shrink-0 text-text-3"})]},a.id))})]})]})}function m({d:a,ep:b,onBack:c,renderedAt:j}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{children:(0,d.jsxs)(e.$n,{onClick:c,size:"sm",variant:"link",tone:"primary",children:[(0,d.jsx)(h.YJ,{"aria-hidden":!0,focusable:!1,className:"size-3.5"}),"Back to destination"]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"mb-2 flex items-center gap-2.5",children:[(0,d.jsx)(i.kX,{method:b.method}),(0,d.jsx)(i.Wi,{kind:a.kind,trust:a.trust,name:a.name,host:a.host,size:22}),(0,d.jsx)("span",{className:"text-xs font-semibold text-text-3",children:a.name})]}),(0,d.jsx)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2.5",children:(0,d.jsx)(i.UH,{url:b.url,big:!0})})]}),b.template&&(0,d.jsxs)("div",{className:"flex gap-2.5 rounded-lg border border-border bg-primary-tint px-3 py-2.5",children:[(0,d.jsx)(h.cZ,{"aria-hidden":!0,focusable:!1,className:"mt-0.5 size-4 shrink-0 text-primary"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"mb-0.5 text-xs font-semibold text-text",children:"Templated URL"}),(0,d.jsxs)("div",{className:"text-xs leading-normal text-text-2",children:["Built at runtime — the"," ",(0,d.jsxs)("span",{className:"rounded bg-primary-tint px-1 font-mono font-semibold text-primary",children:["$","{…}"]})," ","segments vary per request, so individual generated URLs aren’t itemized."]})]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-x-3 gap-y-3.5",children:[(0,d.jsx)(g.p,{label:"Method",children:b.method}),(0,d.jsx)(g.p,{label:"Transport",children:(0,d.jsx)(i.eV,{transport:b.transport,plain:!0})}),(0,d.jsx)(g.p,{label:"Data classification",children:(0,d.jsx)("span",{className:"inline-flex",children:(0,d.jsx)(i.HD,{cls:b.dataClass})})}),(0,d.jsx)(g.p,{label:"Last seen",children:(0,f.K)(b.lastSeen,j)})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(g.e,{children:"Call sites"}),(0,d.jsx)("div",{className:"flex flex-col gap-2",children:b.sites.map(a=>(0,d.jsx)(k,{st:a},a.id))})]})]})}function n({destination:a,endpoint:b,onPick:c,onBack:f,onSetDecision:g,isSettingDecision:i,renderedAt:k}){let n="blocked"===a.status;return(0,d.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,d.jsx)("header",{className:"flex items-center gap-2.5 border-b border-border px-4.5 py-4 pr-12",children:(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs font-semibold text-text-3",children:[(0,d.jsx)(h._G,{"aria-hidden":!0,focusable:!1,className:"size-4"}),b?"Endpoint":"Destination"]})}),(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4.5",children:b?(0,d.jsx)(m,{d:a,ep:b,onBack:f,renderedAt:k}):(0,d.jsx)(l,{d:a,onPick:c})}),(0,d.jsxs)("footer",{className:"flex flex-col gap-2 border-t border-border p-3.5",children:[(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsxs)(e.$n,{variant:"outline",className:"flex-1",children:[(0,d.jsx)(h.iB,{"aria-hidden":!0,focusable:!1}),"Add policy"]}),n?(0,d.jsxs)(e.$n,{variant:"outline",className:"flex-1 border-ok-fill text-ok-ink hover:bg-ok-fill",disabled:i,onClick:()=>{g("allow")},children:[(0,d.jsx)(h.Sr,{"aria-hidden":!0,focusable:!1}),"Allow egress"]}):(0,d.jsxs)(e.$n,{variant:"solid",tone:"danger",className:"flex-1",disabled:i,onClick:()=>{g("block")},children:[(0,d.jsx)(h.pD,{"aria-hidden":!0,focusable:!1}),"Block egress"]})]}),a.isCustom&&(0,d.jsxs)(e.$n,{variant:"ghost",size:"sm",tone:"neutral",className:"self-center text-xs text-text-3",disabled:i,onClick:()=>{g(null)},children:["Reset to default (",j.pN[a.trust].label,")"]})]})]})}},47472:(a,b,c)=>{"use strict";c.d(b,{HD:()=>k,SU:()=>p,UH:()=>o,Wi:()=>n,eV:()=>j,hC:()=>m,kX:()=>i,xB:()=>l});var d=c(15008),e=c(71378),f=c(16820),g=c(52833);let h={GET:"low",POST:"ok",PUT:"high",DELETE:"critical",SDK:"ok",REF:"medium"};function i({method:a}){return(0,d.jsx)("span",{className:(0,e.cn)("inline-flex h-5 items-center rounded px-1.5 font-mono text-label leading-none font-bold py-0.5",e.id[h[a]]),children:a})}function j({transport:a,plain:b}){let c=g.aD[a],f=c.icon;return b?(0,d.jsxs)("span",{className:(0,e.cn)("inline-flex items-center gap-1.5 text-xs font-semibold",c.secure?"text-text-2":"text-sev-critical-ink"),children:[(0,d.jsx)(f,{"aria-hidden":!0,focusable:!1,className:"size-3"}),c.label,!c.secure&&" \xb7 plaintext"]}):(0,d.jsxs)(e.Ex,{variant:c.secure?"default":"critical",children:[(0,d.jsx)(f,{"aria-hidden":!0,focusable:!1,className:"size-3"}),c.label]})}function k({cls:a}){let b=g.Hf[a],c=b.icon;return(0,d.jsxs)(e.Ex,{variant:b.tone,children:[(0,d.jsx)(c,{"aria-hidden":!0,focusable:!1,className:"size-3"}),b.label]})}function l({trust:a}){let b=g.pN[a],c=b.icon;return(0,d.jsxs)(e.Ex,{variant:b.tone,children:[(0,d.jsx)(c,{"aria-hidden":!0,focusable:!1,className:"size-3"}),b.label]})}function m({status:a,isCustom:b}){let c=g.P4[a],f=c.icon;return(0,d.jsxs)(e.Ex,{variant:b?c.tone:"default",children:[(0,d.jsx)(f,{"aria-hidden":!0,focusable:!1,className:"size-3"}),c.label,(0,d.jsx)("span",{className:"sr-only",children:b?" — set by an operator":" — trust default"})]})}function n({kind:a,trust:b,name:c,host:h,size:i=34}){if("provider"===a){let{short:a,color:b}=(0,g.Lh)(c,h);return(0,d.jsx)("span",{className:"inline-flex shrink-0 items-center justify-center rounded-lg font-display font-semibold text-white ring-1 ring-inset ring-mark-edge",style:{width:i,height:i,background:b,fontSize:.34*i},children:a})}let j={width:.5*i,height:.5*i},k="ip"===a?(0,d.jsx)(f.ts,{"aria-hidden":!0,focusable:!1,style:j}):"external"===a||"unverified"===b?(0,d.jsx)(f.ai,{"aria-hidden":!0,focusable:!1,style:j}):(0,d.jsx)(f.RR,{"aria-hidden":!0,focusable:!1,style:j});return(0,d.jsx)("span",{className:(0,e.cn)("grid shrink-0 place-items-center rounded-lg",(0,g.rL)({kind:a,trust:b})),style:{width:i,height:i},children:k})}function o({url:a,big:b}){let c=a.split(/(\$\{[^}]+\})/g);return(0,d.jsx)("span",{className:(0,e.cn)("break-all font-mono",b?"text-ui":"text-xs"),children:c.map((a,b)=>a.startsWith("${")?(0,d.jsx)("span",{className:"rounded bg-primary-tint px-1 font-semibold text-primary",children:a},b):(0,d.jsx)("span",{children:a},b))})}function p(){return(0,d.jsxs)(e.Ex,{variant:"default",children:[(0,d.jsx)(f.cZ,{"aria-hidden":!0,focusable:!1,className:"size-2.5"}),"Template"]})}},47644:(a,b,c)=>{"use strict";c.d(b,{S8C:()=>aj,leE:()=>bF,Itg:()=>aS,PWo:()=>a1,yi_:()=>bG,RRF:()=>dd,ZpU:()=>dr,HUb:()=>db,hfB:()=>cq,unw:()=>dq,b2L:()=>aA,goN:()=>ay,Jr:()=>ds,hdu:()=>dI,mBk:()=>dH,V8B:()=>cw,IgC:()=>c8,ZYZ:()=>cp,iRC:()=>cx,yA3:()=>al,Bfx:()=>am,GCf:()=>ao,tLs:()=>ab,TUN:()=>ac,SHn:()=>a8,V0H:()=>da,WRR:()=>d6,u8Q:()=>dJ,kxf:()=>dP,ZXz:()=>d9,MhX:()=>ea,viY:()=>dw,PEm:()=>c5,vap:()=>c6,KqW:()=>ez,eI7:()=>ee,cqq:()=>ap,jON:()=>b8,Zdp:()=>ad,lFU:()=>d,PhW:()=>aQ,AI$:()=>ah,zJK:()=>ed,DzG:()=>dM,hd_:()=>dW,_5V:()=>c_,W4_:()=>$,tXp:()=>cO,plk:()=>co,mAj:()=>cI,Fnc:()=>eY,ryv:()=>Z,fhc:()=>df,tTV:()=>aP,qmP:()=>d4,_6W:()=>cQ,rG:()=>cS,Bfj:()=>cN,fj8:()=>cX,q_t:()=>X,i1j:()=>dX,xog:()=>cH,hzO:()=>e$,by7:()=>eZ,Gw9:()=>eW,q11:()=>T,U7X:()=>ah,JB8:()=>cG,T2I:()=>dj,lgf:()=>dY,y_0:()=>eX,qEQ:()=>cA,hds:()=>dO,I8t:()=>S,am1:()=>cU,SSj:()=>c$,OHL:()=>eg,TdZ:()=>dp,DhA:()=>dt,WSs:()=>e1,a45:()=>cm,A6E:()=>cR,pnU:()=>cn,Lq6:()=>dk,V9M:()=>d_,ImG:()=>cz,$w9:()=>d3,jTf:()=>d5,$BP:()=>d0,GyT:()=>cy,JAl:()=>d1,$3l:()=>d2,MgS:()=>cY,gzP:()=>dZ,QCA:()=>d$,C05:()=>e_,GWi:()=>dl});let d=[{tag:"0000_acoustic_felicia_hardy",sql:"CREATE TABLE `audit_events` (\n `id` text PRIMARY KEY NOT NULL,\n `parent_id` text,\n `root_session_id` text,\n `event_type` text NOT NULL,\n `host_id` text,\n `harness_id` text,\n `source_project_id` text,\n `started_at` integer NOT NULL,\n `ended_at` integer,\n `severity` text,\n `priority` text,\n `content` text,\n `content_hash` text,\n `attributes` text,\n FOREIGN KEY (`parent_id`) REFERENCES `audit_events`(`id`) ON UPDATE no action ON DELETE no action,\n FOREIGN KEY (`root_session_id`) REFERENCES `audit_events`(`id`) ON UPDATE no action ON DELETE no action,\n FOREIGN KEY (`host_id`) REFERENCES `inventory`(`id`) ON UPDATE no action ON DELETE no action,\n FOREIGN KEY (`harness_id`) REFERENCES `inventory`(`id`) ON UPDATE no action ON DELETE no action,\n FOREIGN KEY (`source_project_id`) REFERENCES `source_project`(`id`) ON UPDATE no action ON DELETE no action\n);\n--\x3e statement-breakpoint\nCREATE INDEX `idx_audit_parent` ON `audit_events` (`parent_id`);--\x3e statement-breakpoint\nCREATE INDEX `idx_audit_session` ON `audit_events` (`root_session_id`,`started_at`);--\x3e statement-breakpoint\nCREATE INDEX `idx_audit_harness_t` ON `audit_events` (`harness_id`,`started_at`);--\x3e statement-breakpoint\nCREATE INDEX `idx_audit_project_t` ON `audit_events` (`source_project_id`,`started_at`);--\x3e statement-breakpoint\nCREATE TABLE `classified_data` (\n `id` text PRIMARY KEY NOT NULL,\n `class` text NOT NULL,\n `label` text,\n `attributes` text\n);\n--\x3e statement-breakpoint\nCREATE TABLE `events` (\n `id` text PRIMARY KEY NOT NULL,\n `source_tool` text NOT NULL,\n `kind` text NOT NULL,\n `occurred_at` integer NOT NULL,\n `content_hash` text NOT NULL,\n `content` text NOT NULL,\n `metadata` text\n);\n--\x3e statement-breakpoint\nCREATE INDEX `idx_events_occurred` ON `events` (`occurred_at`);--\x3e statement-breakpoint\nCREATE TABLE `findings` (\n `id` text PRIMARY KEY NOT NULL,\n `event_id` text NOT NULL,\n `rule_id` text NOT NULL,\n `category` text NOT NULL,\n `severity` text NOT NULL,\n `span_start` integer NOT NULL,\n `span_end` integer NOT NULL,\n `masked_match` text NOT NULL,\n `action_taken` text NOT NULL,\n `confidence` real NOT NULL,\n FOREIGN KEY (`event_id`) REFERENCES `events`(`id`) ON UPDATE no action ON DELETE no action\n);\n--\x3e statement-breakpoint\nCREATE INDEX `idx_findings_event` ON `findings` (`event_id`);--\x3e statement-breakpoint\nCREATE TABLE `inspection_definitions` (\n `id` text PRIMARY KEY NOT NULL,\n `rule_id` text NOT NULL,\n `name` text NOT NULL,\n `category` text NOT NULL,\n `severity` text NOT NULL,\n `definition` text NOT NULL,\n `version` text NOT NULL\n);\n--\x3e statement-breakpoint\nCREATE TABLE `inspection_findings` (\n `id` text PRIMARY KEY NOT NULL,\n `audit_event_id` text NOT NULL,\n `inspection_definition_id` text NOT NULL,\n `classified_data_id` text,\n `span_start` integer NOT NULL,\n `span_end` integer NOT NULL,\n `masked_match` text NOT NULL,\n `action_taken` text NOT NULL,\n `confidence` real NOT NULL,\n FOREIGN KEY (`audit_event_id`) REFERENCES `audit_events`(`id`) ON UPDATE no action ON DELETE no action,\n FOREIGN KEY (`inspection_definition_id`) REFERENCES `inspection_definitions`(`id`) ON UPDATE no action ON DELETE no action,\n FOREIGN KEY (`classified_data_id`) REFERENCES `classified_data`(`id`) ON UPDATE no action ON DELETE no action\n);\n--\x3e statement-breakpoint\nCREATE INDEX `idx_inspection_findings_event` ON `inspection_findings` (`audit_event_id`);--\x3e statement-breakpoint\nCREATE TABLE `installed_packs` (\n `id` text PRIMARY KEY NOT NULL,\n `namespace` text NOT NULL,\n `pack_id` text NOT NULL,\n `version` text NOT NULL,\n `name` text NOT NULL,\n `rules_json` text NOT NULL,\n `enabled` integer DEFAULT true NOT NULL,\n `policy_id` text,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL\n);\n--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_installed_packs_pack` ON `installed_packs` (`namespace`,`pack_id`);--\x3e statement-breakpoint\nCREATE TABLE `inventory` (\n `id` text PRIMARY KEY NOT NULL,\n `object_type` text NOT NULL,\n `location` text,\n `title` text,\n `host_id` text,\n `attributes` text NOT NULL,\n `os_version` text GENERATED ALWAYS AS (json_extract(attributes, '$.os_version')) VIRTUAL,\n `harness_version` text GENERATED ALWAYS AS (json_extract(attributes, '$.harness_version')) VIRTUAL,\n `first_seen` integer NOT NULL,\n `last_seen` integer NOT NULL,\n FOREIGN KEY (`host_id`) REFERENCES `inventory`(`id`) ON UPDATE no action ON DELETE no action\n);\n--\x3e statement-breakpoint\nCREATE INDEX `idx_inventory_type` ON `inventory` (`object_type`);--\x3e statement-breakpoint\nCREATE INDEX `idx_inventory_type_osver` ON `inventory` (`object_type`,`os_version`);--\x3e statement-breakpoint\nCREATE INDEX `idx_inventory_type_harnessver` ON `inventory` (`object_type`,`harness_version`);--\x3e statement-breakpoint\nCREATE TABLE `policies` (\n `id` text PRIMARY KEY NOT NULL,\n `scope` text DEFAULT 'global' NOT NULL,\n `target` text NOT NULL,\n `action` text NOT NULL,\n `enabled` integer DEFAULT true NOT NULL,\n `custom_keywords` text,\n `name` text,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL\n);\n--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_policies_scope_target` ON `policies` (`scope`,`target`);--\x3e statement-breakpoint\nCREATE TABLE `source_project` (\n `id` text PRIMARY KEY NOT NULL,\n `url` text,\n `name` text,\n `attributes` text NOT NULL,\n `first_seen` integer NOT NULL,\n `last_seen` integer NOT NULL\n);\n"},{tag:"0001_adorable_marten_broadcloak",sql:"ALTER TABLE `audit_events` ADD `input_tokens` integer GENERATED ALWAYS AS (json_extract(attributes, '$.input_tokens')) VIRTUAL;--\x3e statement-breakpoint\nALTER TABLE `audit_events` ADD `output_tokens` integer GENERATED ALWAYS AS (json_extract(attributes, '$.output_tokens')) VIRTUAL;--\x3e statement-breakpoint\nALTER TABLE `audit_events` ADD `cache_creation_input_tokens` integer GENERATED ALWAYS AS (json_extract(attributes, '$.cache_creation_input_tokens')) VIRTUAL;--\x3e statement-breakpoint\nALTER TABLE `audit_events` ADD `cache_read_input_tokens` integer GENERATED ALWAYS AS (json_extract(attributes, '$.cache_read_input_tokens')) VIRTUAL;--\x3e statement-breakpoint\nALTER TABLE `audit_events` ADD `model` text GENERATED ALWAYS AS (json_extract(attributes, '$.model')) VIRTUAL;--\x3e statement-breakpoint\nALTER TABLE `audit_events` ADD `provider` text GENERATED ALWAYS AS (json_extract(attributes, '$.provider')) VIRTUAL;--\x3e statement-breakpoint\nCREATE INDEX `idx_audit_session_type` ON `audit_events` (`root_session_id`,`started_at`) WHERE event_type = 'llm_call';"},{tag:"0002_groovy_big_bertha",sql:"CREATE TABLE `exceptions` (\n `id` text PRIMARY KEY NOT NULL,\n `rule_id` text NOT NULL,\n `category` text NOT NULL,\n `value_fingerprint` text NOT NULL,\n `key_version` integer NOT NULL,\n `masked_value` text NOT NULL,\n `scope` text NOT NULL,\n `expires_at` integer,\n `max_uses` integer,\n `use_count` integer DEFAULT 0 NOT NULL,\n `last_used_at` integer,\n `justification` text NOT NULL,\n `conditions` text,\n `created_by` text NOT NULL,\n `created_via` text NOT NULL,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n `revoked_at` integer,\n `revoked_by` text,\n `revoke_reason` text\n);\n--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_exceptions_active` ON `exceptions` (`rule_id`,`value_fingerprint`,`key_version`) WHERE revoked_at IS NULL;"},{tag:"0003_rich_sage",sql:"CREATE TABLE `egress_decision_override` (\n `id` text PRIMARY KEY NOT NULL,\n `destination_id` text NOT NULL,\n `decision` text NOT NULL,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n FOREIGN KEY (`destination_id`) REFERENCES `share_destination`(`id`) ON UPDATE no action ON DELETE no action\n);\n--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_egress_decision_override` ON `egress_decision_override` (`destination_id`);--\x3e statement-breakpoint\nCREATE TABLE `file_access_override` (\n `id` text PRIMARY KEY NOT NULL,\n `project_id` text NOT NULL,\n `path` text NOT NULL,\n `access` text NOT NULL,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n FOREIGN KEY (`project_id`) REFERENCES `source_project`(`id`) ON UPDATE no action ON DELETE no action\n);\n--\x3e statement-breakpoint\nCREATE INDEX `idx_file_access_override_project` ON `file_access_override` (`project_id`);--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_file_access_override` ON `file_access_override` (`project_id`,`path`);--\x3e statement-breakpoint\nCREATE TABLE `harness_asset` (\n `id` text PRIMARY KEY NOT NULL,\n `harness_id` text NOT NULL,\n `asset_id` text NOT NULL,\n `created_at` integer NOT NULL,\n FOREIGN KEY (`harness_id`) REFERENCES `inventory`(`id`) ON UPDATE no action ON DELETE no action,\n FOREIGN KEY (`asset_id`) REFERENCES `inventory_asset`(`id`) ON UPDATE no action ON DELETE no action\n);\n--\x3e statement-breakpoint\nCREATE INDEX `idx_harness_asset_harness` ON `harness_asset` (`harness_id`);--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_harness_asset` ON `harness_asset` (`harness_id`,`asset_id`);--\x3e statement-breakpoint\nCREATE TABLE `inventory_asset` (\n `id` text PRIMARY KEY NOT NULL,\n `asset_type` text NOT NULL,\n `name` text NOT NULL,\n `sub` text,\n `description` text,\n `flags_json` text DEFAULT '[]' NOT NULL,\n `meta_json` text DEFAULT '{}' NOT NULL,\n `trust` text,\n `tools_json` text,\n `provenance` text DEFAULT 'scan' NOT NULL,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL\n);\n--\x3e statement-breakpoint\nCREATE INDEX `idx_inventory_asset_type` ON `inventory_asset` (`asset_type`);--\x3e statement-breakpoint\nCREATE TABLE `mcp_trust_override` (\n `id` text PRIMARY KEY NOT NULL,\n `asset_id` text NOT NULL,\n `trust` text NOT NULL,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n FOREIGN KEY (`asset_id`) REFERENCES `inventory_asset`(`id`) ON UPDATE no action ON DELETE no action\n);\n--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_mcp_trust_override` ON `mcp_trust_override` (`asset_id`);--\x3e statement-breakpoint\nCREATE TABLE `project_file` (\n `id` text PRIMARY KEY NOT NULL,\n `project_id` text NOT NULL,\n `path` text NOT NULL,\n `name` text NOT NULL,\n `origin` text NOT NULL,\n `default_access` text NOT NULL,\n `findings_count` integer DEFAULT 0 NOT NULL,\n `blocked_at` integer,\n `note` text,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n FOREIGN KEY (`project_id`) REFERENCES `source_project`(`id`) ON UPDATE no action ON DELETE no action\n);\n--\x3e statement-breakpoint\nCREATE INDEX `idx_project_file_project` ON `project_file` (`project_id`);--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_project_file` ON `project_file` (`project_id`,`path`);--\x3e statement-breakpoint\nCREATE TABLE `share_call_site` (\n `id` text PRIMARY KEY NOT NULL,\n `endpoint_id` text NOT NULL,\n `project` text NOT NULL,\n `file` text NOT NULL,\n `line` integer NOT NULL,\n `snippet` text NOT NULL,\n `dynamic` integer DEFAULT false NOT NULL,\n `vendored` integer DEFAULT false NOT NULL,\n `project_id` text,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n FOREIGN KEY (`endpoint_id`) REFERENCES `share_endpoint`(`id`) ON UPDATE no action ON DELETE no action\n);\n--\x3e statement-breakpoint\nCREATE INDEX `idx_share_call_site_endpoint` ON `share_call_site` (`endpoint_id`);--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_share_call_site` ON `share_call_site` (`endpoint_id`,`project`,`file`,`line`);--\x3e statement-breakpoint\nCREATE TABLE `share_destination` (\n `id` text PRIMARY KEY NOT NULL,\n `kind` text NOT NULL,\n `name` text NOT NULL,\n `host` text NOT NULL,\n `category` text NOT NULL,\n `trust` text NOT NULL,\n `note` text,\n `network_json` text,\n `last_seen` integer NOT NULL,\n `provenance` text DEFAULT 'scan' NOT NULL,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL\n);\n--\x3e statement-breakpoint\nCREATE INDEX `idx_share_destination_kind` ON `share_destination` (`kind`);--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_share_destination_host` ON `share_destination` (`host`);--\x3e statement-breakpoint\nCREATE TABLE `share_endpoint` (\n `id` text PRIMARY KEY NOT NULL,\n `destination_id` text NOT NULL,\n `method` text NOT NULL,\n `transport` text NOT NULL,\n `url` text NOT NULL,\n `template` integer DEFAULT false NOT NULL,\n `data_class` text NOT NULL,\n `last_seen` integer NOT NULL,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n FOREIGN KEY (`destination_id`) REFERENCES `share_destination`(`id`) ON UPDATE no action ON DELETE no action\n);\n--\x3e statement-breakpoint\nCREATE INDEX `idx_share_endpoint_dest` ON `share_endpoint` (`destination_id`);--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_share_endpoint` ON `share_endpoint` (`destination_id`,`method`,`url`);"},{tag:"0004_glorious_mindworm",sql:"CREATE TABLE `available_packs` (\n `id` text PRIMARY KEY NOT NULL,\n `namespace` text NOT NULL,\n `pack_id` text NOT NULL,\n `version` text NOT NULL,\n `name` text NOT NULL,\n `rules_json` text NOT NULL,\n `updated_at` integer NOT NULL\n);\n--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_available_packs_pack` ON `available_packs` (`namespace`,`pack_id`);"},{tag:"0005_fast_vindicator",sql:'PRAGMA foreign_keys=OFF;--\x3e statement-breakpoint\nCREATE TABLE `__new_mcp_trust_override` (\n `id` text PRIMARY KEY NOT NULL,\n `asset_id` text NOT NULL,\n `trust` text NOT NULL,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL\n);\n--\x3e statement-breakpoint\nINSERT INTO `__new_mcp_trust_override`("id", "asset_id", "trust", "created_at", "updated_at") SELECT "id", "asset_id", "trust", "created_at", "updated_at" FROM `mcp_trust_override`;--\x3e statement-breakpoint\nDROP TABLE `mcp_trust_override`;--\x3e statement-breakpoint\nALTER TABLE `__new_mcp_trust_override` RENAME TO `mcp_trust_override`;--\x3e statement-breakpoint\nPRAGMA foreign_keys=ON;--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_mcp_trust_override` ON `mcp_trust_override` (`asset_id`);'},{tag:"0006_magenta_flatman",sql:'CREATE TABLE `_pack_write_gate` (\n `id` integer PRIMARY KEY NOT NULL,\n `open` integer DEFAULT 0 NOT NULL,\n CONSTRAINT "ck_pack_write_gate_single_row" CHECK("_pack_write_gate"."id" = 1)\n);\n--\x3e statement-breakpoint\nALTER TABLE `available_packs` ADD `recorded_by` text;--\x3e statement-breakpoint\nINSERT OR IGNORE INTO _pack_write_gate (id, open) VALUES (1, 0);\n--\x3e statement-breakpoint\nCREATE TRIGGER trg_installed_packs_write_gate\nBEFORE UPDATE OF version, name, rules_json ON installed_packs\nWHEN (SELECT open FROM _pack_write_gate WHERE id = 1) IS NOT 1\nBEGIN SELECT RAISE(IGNORE); END;'},{tag:"0007_thick_stick",sql:"CREATE TABLE `finding_resolution` (\n `id` text PRIMARY KEY NOT NULL,\n `finding_key` text NOT NULL,\n `status` text NOT NULL,\n `method` text NOT NULL,\n `resolved_at` integer NOT NULL,\n `evidence` text,\n `created_at` integer NOT NULL\n);\n--\x3e statement-breakpoint\nCREATE INDEX `idx_finding_resolution_key` ON `finding_resolution` (`finding_key`);--\x3e statement-breakpoint\nALTER TABLE `findings` ADD `finding_key` text;--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_findings_key` ON `findings` (`finding_key`);"},{tag:"0008_freezing_selene",sql:"ALTER TABLE `findings` ADD `first_detected_at` integer;--\x3e statement-breakpoint\nUPDATE `findings` SET `first_detected_at` = (SELECT `occurred_at` FROM `events` WHERE `events`.`id` = `findings`.`event_id`) WHERE `first_detected_at` IS NULL;"},{tag:"0009_findings_path_expression_index",sql:"-- Custom migration: partial expression index for the resolver's per-path reads.\n--\n-- openAtRestKeysForPath / resolvedAtRestKeysForPath (and the scanner's tier-3\n-- open-key probe) filter at-rest events by\n-- e.kind = 'code_change' AND json_extract(e.metadata, '$.filePath') = :path\n-- once per changed/deleted file on every scan — previously a full events scan\n-- per file. json_extract is deterministic, so SQLite allows it in an index;\n-- the WHERE kind = 'code_change' keeps the index to exactly the rows those\n-- queries can match (in-flight events are never path-addressed).\nCREATE INDEX `idx_events_code_change_path` ON `events` (json_extract(`metadata`, '$.filePath')) WHERE `kind` = 'code_change';\n"},{tag:"0010_events_session_expression_index",sql:"-- Custom migration: partial expression index for session-scoped finding reads.\n--\n-- sessionFindingsCount, the session-scoped listGroupedFindings paths, and the\n-- insert-time session dedup all filter live-capture events by\n-- json_extract(e.metadata, '$.sessionId') = :sessionId\n-- — previously a full findings-join scan with a JSON parse per row. The\n-- IS NOT NULL predicate keeps the index to session-stamped events only (an\n-- equality probe implies non-null, so SQLite still uses it).\nCREATE INDEX `idx_events_session_id` ON `events` (json_extract(`metadata`, '$.sessionId')) WHERE json_extract(`metadata`, '$.sessionId') IS NOT NULL;\n"},{tag:"0011_egress_writer",sql:'-- Stable per-project reconcile key for egress call sites, plus a host-keyed\n-- egress decision override that survives destination pruning.\n--\n-- DROP INDEX IF EXISTS, not a bare DROP: the applier replays a pending\n-- migration\'s non-index statements verbatim, so a store that lost\n-- uq_share_call_site out of band would throw here — and on the plugin hook path\n-- that throw is swallowed fail-open, silently stopping capture.\n--\n-- Existing rows carry the old key\'s discriminator into project_key\n-- (\'legacy:\' || project), so the new unique index is a re-encoding of the old\n-- one and cannot collide on rows the old one allowed. Leaving them on the\n-- column default would collapse two projects\' identical file/line hits onto\n-- one key and abort the whole migration. Writer keys are \'git:\'/\'path:\'-\n-- prefixed, so a backfilled row never collides with a captured one either.\n--\n-- egress_decision_override.destination_id becomes nullable with ON DELETE SET\n-- NULL, which SQLite can only do by rebuilding the table. `host` is ADDed\n-- before the rebuild so the copy has a column to read and so the migration\n-- still presents two probeable columns to the applier\'s evidence check.\nALTER TABLE `share_call_site` ADD `project_key` text DEFAULT \'\' NOT NULL;--\x3e statement-breakpoint\nUPDATE `share_call_site` SET `project_key` = \'legacy:\' || `project`;--\x3e statement-breakpoint\nDROP INDEX IF EXISTS `uq_share_call_site`;--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_share_call_site` ON `share_call_site` (`endpoint_id`,`project_key`,`file`,`line`);--\x3e statement-breakpoint\nCREATE INDEX `idx_share_call_site_project` ON `share_call_site` (`project_key`,`endpoint_id`);--\x3e statement-breakpoint\nALTER TABLE `egress_decision_override` ADD `host` text;--\x3e statement-breakpoint\nPRAGMA foreign_keys=OFF;--\x3e statement-breakpoint\nCREATE TABLE `__new_egress_decision_override` (\n `id` text PRIMARY KEY NOT NULL,\n `destination_id` text,\n `host` text,\n `decision` text NOT NULL,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n FOREIGN KEY (`destination_id`) REFERENCES `share_destination`(`id`) ON UPDATE no action ON DELETE set null\n);\n--\x3e statement-breakpoint\nINSERT INTO `__new_egress_decision_override`("id", "destination_id", "host", "decision", "created_at", "updated_at") SELECT "id", "destination_id", "host", "decision", "created_at", "updated_at" FROM `egress_decision_override`;--\x3e statement-breakpoint\nDROP TABLE `egress_decision_override`;--\x3e statement-breakpoint\nALTER TABLE `__new_egress_decision_override` RENAME TO `egress_decision_override`;--\x3e statement-breakpoint\nPRAGMA foreign_keys=ON;--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_egress_decision_override` ON `egress_decision_override` (`destination_id`);--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_egress_decision_override_host` ON `egress_decision_override` (`host`) WHERE `host` IS NOT NULL;\n'},{tag:"0012_handy_the_captain",sql:"ALTER TABLE `inspection_findings` ADD `finding_key` text;--\x3e statement-breakpoint\nALTER TABLE `inspection_findings` ADD `first_detected_at` integer;--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_inspection_findings_key` ON `inspection_findings` (`finding_key`);"},{tag:"0013_legacy_history_backfill_support",sql:"-- Legacy-to-generalized backfill support: the schema the resumable\n-- events/findings -> audit_events/inspection_findings copy needs (the row\n-- copy itself runs as a batched post-migration installer, not here — see\n-- @akasecurity/persistence's migrations.ts), plus the audit_events read-path\n-- indexes replacing the ones the legacy events table carried (0009/0010).\n\n-- Tracks how far the batched, resumable copy has advanced through each legacy\n-- table, by rowid, so a copy interrupted mid-run resumes instead of\n-- restarting, and a completed copy is a cheap no-op on every later open.\nCREATE TABLE `legacy_copy_watermark` (\n `source` text PRIMARY KEY NOT NULL,\n `last_rowid` integer DEFAULT 0 NOT NULL\n);\n--\x3e statement-breakpoint\n-- Serves the time-range read family that scans a single event_type across a\n-- start/end window (e.g. the Activity timeline) without a full-table scan.\nCREATE INDEX `idx_audit_type_t` ON `audit_events` (`event_type`,`started_at`);\n--\x3e statement-breakpoint\n-- Partial expression index mirroring `idx_events_code_change_path` (0009) for\n-- the generalized audit_events/attributes pair: file-path reads filter\n-- `event_type = 'code_change' AND json_extract(attributes, '$.file_path') = :path`.\nCREATE INDEX `idx_audit_code_change_path` ON `audit_events` (json_extract(`attributes`, '$.file_path')) WHERE `event_type` = 'code_change';\n--\x3e statement-breakpoint\n-- Synthesizes a stub session root (event_type = 'session', no attributes) for\n-- every legacy `events.metadata.sessionId` that has no audit_events row yet.\n-- audit_events.root_session_id is a self-FK, enforced with foreign-key\n-- checking on, and INSERT OR IGNORE does not suppress a foreign-key violation\n-- (only UNIQUE/PK/NOT NULL/CHECK) — so this must run before the events copy\n-- resolves root_session_id, or every session-scoped row's insert fails.\n-- started_at takes the earliest legacy occurred_at recorded under that\n-- session, so the stub root's own timeline position is never later than\n-- anything it will end up parenting.\nINSERT INTO audit_events (id, event_type, root_session_id, started_at)\nSELECT\n json_extract(metadata, '$.sessionId'),\n 'session',\n NULL,\n min(occurred_at)\nFROM events\nWHERE json_valid(metadata)\n AND json_extract(metadata, '$.sessionId') IS NOT NULL\n AND json_extract(metadata, '$.sessionId') NOT IN (SELECT id FROM audit_events)\nGROUP BY json_extract(metadata, '$.sessionId');\n"},{tag:"0014_drop_legacy_events_findings",sql:"-- Custom migration: drops the frozen legacy `events`/`findings` tables\n-- (superseded by audit_events/inspection_definitions/inspection_findings) and\n-- replaces them with read-only views of the same name.\n--\n-- persistence's migrations.ts applies this migration ONLY once the batched\n-- history backfill (see runLegacyHistoryBackfill) has fully drained both\n-- tables, and only after copying the live file aside — see\n-- backupBeforeLegacyDrop in packages/persistence/src/migrations.ts. A store\n-- still mid-copy keeps its real tables and this migration stays pending.\n--\n-- The views exist for skew: the `aka` CLI and the Claude Code plugin update\n-- independently against one shared store, so an older, already-installed\n-- binary can open a store a newer binary already dropped these tables on.\n-- Every already-shipped repository constructor prepares its SQL eagerly at\n-- open time, so a bare \"table not found\" would fail the WHOLE open, not just\n-- a findings-specific read — these views keep `prepare()` succeeding so an\n-- old binary's unrelated features keep working; its own reads stay truthful,\n-- and its rare (already fail-open) writes fail at run time instead.\n--\n-- The 0009/0010 expression indexes existed only over the legacy `events`\n-- table; DROP TABLE below would remove them implicitly, but they are\n-- dropped explicitly first so the intent reads clearly. IF EXISTS so a store\n-- that reached here with an index missing out of band (an adopted-tag store\n-- whose physical index was never built) does not throw a deterministic \"no\n-- such index\" out of the fail-open drop path.\nDROP INDEX IF EXISTS `idx_events_code_change_path`;\n--\x3e statement-breakpoint\nDROP INDEX IF EXISTS `idx_events_session_id`;\n--\x3e statement-breakpoint\n-- `findings.event_id` references `events.id` — drop the child first.\nDROP TABLE `findings`;\n--\x3e statement-breakpoint\nDROP TABLE `events`;\n--\x3e statement-breakpoint\n-- Legacy `events` shape, projected from audit_events: `kind`/`occurred_at`/\n-- `source_tool` become real columns again (source_tool round-trips through\n-- the attributes bag, the only place a capture-typed audit row keeps it);\n-- `metadata` is reconstructed as the old camelCase JSON object from the new\n-- snake_case attributes bag, with `root_session_id` folded back in as\n-- `sessionId` (the one legacy metadata key that became a column, never an\n-- attribute, on the new table). Constrained to the four capture kinds so\n-- structural rows (session/run/tool_call/llm_call/source_lookup/config_scan)\n-- never leak into a legacy reader's result set — the old `events` table\n-- never held them either.\nCREATE VIEW `events` AS\nSELECT\n id,\n json_extract(attributes, '$.source_tool') AS source_tool,\n event_type AS kind,\n started_at AS occurred_at,\n content_hash,\n content,\n -- Plugin-local bookkeeping column that `ensureSyncedAtColumn` adds to the\n -- real `events` table at open time. A pre-cutover binary runs that probe on\n -- EVERY open; without this projection its `columnNames('events')` check\n -- misses `synced_at` and issues `ALTER TABLE events ADD COLUMN` against this\n -- view, which SQLite rejects (\"Cannot add a column to a view\") — a hard,\n -- non-fail-open crash of the whole open, the exact skew failure these views\n -- exist to prevent. Projecting it (always NULL; no reader consumes it)\n -- short-circuits that ALTER.\n NULL AS synced_at,\n json_object(\n 'sessionId', root_session_id,\n 'repo', json_extract(attributes, '$.repo'),\n 'filePath', json_extract(attributes, '$.file_path'),\n 'toolName', json_extract(attributes, '$.tool_name'),\n 'gitignored', json_extract(attributes, '$.gitignored'),\n 'wholeFile', json_extract(attributes, '$.whole_file'),\n 'model', json_extract(attributes, '$.model'),\n 'turnIndex', json_extract(attributes, '$.turn_index'),\n 'correlationId', json_extract(attributes, '$.correlation_id'),\n 'traceId', json_extract(attributes, '$.trace_id'),\n 'exceptionIds', json_extract(attributes, '$.exception_ids')\n ) AS metadata\nFROM audit_events\nWHERE event_type IN ('prompt', 'response', 'code_change', 'tool_use');\n--\x3e statement-breakpoint\n-- A plain single-row INSERT (the old writer's shape — no ON CONFLICT) is\n-- accepted by prepare() against a view once an INSTEAD OF INSERT trigger\n-- exists, so it fails at run time instead of at open — landing in the same\n-- fail-open path the caller already wraps its write in.\nCREATE TRIGGER `trg_events_ro`\nINSTEAD OF INSERT ON `events`\nBEGIN SELECT RAISE(ABORT, 'events is read-only; write to audit_events instead'); END;\n--\x3e statement-breakpoint\n-- Legacy `findings` shape: rule_id/category/severity come from the joined\n-- inspection_definitions row (the legacy table inlined them per-row; the\n-- generalized schema normalizes them out into the shared definition). A view\n-- has no rowid of its own, so the underlying table's rowid is re-exposed\n-- explicitly under that name — a legacy reader ordering by `f.rowid` would\n-- otherwise fail to resolve the column at all. Joined to audit_events for the\n-- same four-capture-kind constraint as the events view above (a finding\n-- attached to a tool_call/config_scan row never existed in the legacy table\n-- either — see the persistence findings repository's identical predicate).\nCREATE VIEW `findings` AS\nSELECT\n f.id AS id,\n f.rowid AS rowid,\n f.audit_event_id AS event_id,\n d.rule_id AS rule_id,\n d.category AS category,\n d.severity AS severity,\n f.span_start AS span_start,\n f.span_end AS span_end,\n f.masked_match AS masked_match,\n f.action_taken AS action_taken,\n f.confidence AS confidence,\n f.finding_key AS finding_key,\n f.first_detected_at AS first_detected_at\nFROM inspection_findings f\nJOIN audit_events e ON e.id = f.audit_event_id\nJOIN inspection_definitions d ON d.id = f.inspection_definition_id\nWHERE e.event_type IN ('prompt', 'response', 'code_change', 'tool_use');\n--\x3e statement-breakpoint\n-- Defense in depth only: SQLite refuses to plan ANY upsert against a view\n-- (\"cannot UPSERT a view\") no matter what trigger exists, so this can never\n-- rescue the real legacy writer, which always used\n-- `ON CONFLICT (finding_key) DO UPDATE` — that statement still fails at\n-- prepare() on an old binary, same as it would with no trigger at all. This\n-- only covers a plain-INSERT shape, should one ever exist.\nCREATE TRIGGER `trg_findings_ro`\nINSTEAD OF INSERT ON `findings`\nBEGIN SELECT RAISE(ABORT, 'findings is read-only; write to inspection_findings instead'); END;\n"},{tag:"0015_busy_vengeance",sql:"CREATE TABLE `secret_vault` (\n `pointer_id` text PRIMARY KEY NOT NULL,\n `value_fingerprint` text NOT NULL,\n `fingerprint_key_version` integer NOT NULL,\n `key_version` integer NOT NULL,\n `category` text NOT NULL,\n `rule_id` text NOT NULL,\n `masked_match` text NOT NULL,\n `provider` text,\n `ciphertext` text NOT NULL,\n `nonce` text NOT NULL,\n `auth_tag` text NOT NULL,\n `occurrence_count` integer DEFAULT 1 NOT NULL,\n `first_seen` integer NOT NULL,\n `last_seen` integer NOT NULL\n);\n--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_secret_vault_value` ON `secret_vault` (`value_fingerprint`);--\x3e statement-breakpoint\nCREATE TABLE `secret_vault_deref` (\n `id` text PRIMARY KEY NOT NULL,\n `pointer_id` text NOT NULL,\n `at` integer NOT NULL,\n `target` text NOT NULL,\n `reason` text NOT NULL,\n `outcome` text NOT NULL,\n `grant_id` text,\n `pointer_count` integer DEFAULT 1 NOT NULL\n);\n--\x3e statement-breakpoint\nCREATE INDEX `idx_secret_vault_deref_pointer` ON `secret_vault_deref` (`pointer_id`);--\x3e statement-breakpoint\nCREATE INDEX `idx_secret_vault_deref_reason_at` ON `secret_vault_deref` (`reason`,`at`);"},{tag:"0016_breezy_zodiak",sql:"ALTER TABLE `exceptions` ADD `capability` text DEFAULT 'suppress' NOT NULL;"},{tag:"0017_rainy_kat_farrell",sql:"CREATE TABLE `secret_vault_sighting` (\n `id` text PRIMARY KEY NOT NULL,\n `pointer_id` text NOT NULL,\n `location` text NOT NULL,\n `kind` text NOT NULL,\n `first_seen` integer NOT NULL,\n `last_seen` integer NOT NULL\n);\n--\x3e statement-breakpoint\nCREATE UNIQUE INDEX `uq_secret_vault_sighting` ON `secret_vault_sighting` (`pointer_id`,`location`);"},{tag:"0018_serious_tana_nile",sql:"ALTER TABLE `secret_vault` ADD `format_version` integer DEFAULT 2 NOT NULL;"},{tag:"0019_audit_started_at_index",sql:"CREATE INDEX `idx_audit_started_at` ON `audit_events` (`started_at`);"},{tag:"0020_secret_vault_pagination_indexes",sql:"CREATE INDEX `idx_secret_vault_last_seen` ON `secret_vault` (`last_seen`,`pointer_id`);--\x3e statement-breakpoint\nCREATE INDEX `idx_secret_vault_reuse` ON `secret_vault` (`occurrence_count`,`pointer_id`);--\x3e statement-breakpoint\nCREATE INDEX `idx_secret_vault_deref_at` ON `secret_vault_deref` (`at`,`id`);--\x3e statement-breakpoint\nCREATE INDEX `idx_secret_vault_deref_signal` ON `secret_vault_deref` (`at`,`id`) WHERE `reason` NOT IN ('display', 'view-render');"},{tag:"0021_finding_resolution_resolved_at_index",sql:"CREATE INDEX `idx_finding_resolution_resolved_at` ON `finding_resolution` (`resolved_at`);\n"},{tag:"0022_audit_inspection_ms",sql:"ALTER TABLE `audit_events` ADD `inspection_ms` integer GENERATED ALWAYS AS (json_extract(attributes, '$.inspection_ms')) VIRTUAL;"},{tag:"0023_secret_vault_user_authorized",sql:"ALTER TABLE `secret_vault` ADD `user_authorized` integer DEFAULT 0 NOT NULL;"},{tag:"0024_finding_resolution_key_created_index",sql:"DROP INDEX IF EXISTS `idx_finding_resolution_key`;--\x3e statement-breakpoint\nCREATE INDEX `idx_finding_resolution_key_created` ON `finding_resolution` (`finding_key`,`created_at`);"},{tag:"0025_audit_capture_attribute_columns",sql:"ALTER TABLE `audit_events` ADD `source_tool` text GENERATED ALWAYS AS (json_extract(attributes, '$.source_tool')) VIRTUAL;--\x3e statement-breakpoint\nALTER TABLE `audit_events` ADD `repo` text GENERATED ALWAYS AS (json_extract(attributes, '$.repo')) VIRTUAL;--\x3e statement-breakpoint\nALTER TABLE `audit_events` ADD `file_path` text GENERATED ALWAYS AS (json_extract(attributes, '$.file_path')) VIRTUAL;--\x3e statement-breakpoint\nALTER TABLE `audit_events` ADD `tool_name` text GENERATED ALWAYS AS (json_extract(attributes, '$.tool_name')) VIRTUAL;"},{tag:"0026_audit_llm_call_usage_columns",sql:"ALTER TABLE `audit_events` ADD `service_tier` text GENERATED ALWAYS AS (json_extract(attributes, '$.service_tier')) VIRTUAL;--\x3e statement-breakpoint\nALTER TABLE `audit_events` ADD `ephemeral_1h_input_tokens` integer GENERATED ALWAYS AS (json_extract(attributes, '$.ephemeral_1h_input_tokens')) VIRTUAL;--\x3e statement-breakpoint\nALTER TABLE `audit_events` ADD `ephemeral_5m_input_tokens` integer GENERATED ALWAYS AS (json_extract(attributes, '$.ephemeral_5m_input_tokens')) VIRTUAL;--\x3e statement-breakpoint\nALTER TABLE `audit_events` ADD `web_search_requests` integer GENERATED ALWAYS AS (json_extract(attributes, '$.web_search_requests')) VIRTUAL;"},{tag:"0027_audit_llm_usage_index",sql:"CREATE INDEX `idx_audit_llm_usage` ON `audit_events` (`started_at`,`root_session_id`,`provider`,`model`,`service_tier`,`input_tokens`,`output_tokens`,`cache_creation_input_tokens`,`cache_read_input_tokens`,`ephemeral_1h_input_tokens`,`ephemeral_5m_input_tokens`,`web_search_requests`) WHERE event_type = 'llm_call' AND attributes IS NOT NULL;"},{tag:"0028_activity_session_probe_indexes",sql:"CREATE INDEX `idx_audit_session_prompt` ON `audit_events` (`root_session_id`) WHERE event_type = 'prompt';--\x3e statement-breakpoint\nCREATE INDEX `idx_audit_session_share` ON `audit_events` (`root_session_id`) WHERE event_type = 'share';--\x3e statement-breakpoint\nCREATE INDEX `idx_audit_ended_at` ON `audit_events` (`ended_at`,`root_session_id`) WHERE ended_at IS NOT NULL;--\x3e statement-breakpoint\nCREATE INDEX `idx_audit_session_ended` ON `audit_events` (`root_session_id`,`ended_at`) WHERE ended_at IS NOT NULL;--\x3e statement-breakpoint\n-- Expression index for the activity list's turns rollup: a live-captured\n-- session's turns are the DISTINCT `run_key` across its `llm_call` leaves, and\n-- carrying the extracted key in the index answers that count from the index\n-- alone instead of parsing every leaf's attribute bag. Written by hand, as\n-- 0013's `idx_audit_code_change_path` was: drizzle-kit cannot emit an\n-- expression containing a comma, so this index is not declared in sqlite.ts.\nCREATE INDEX `idx_audit_session_run_key` ON `audit_events` (`root_session_id`, json_extract(`attributes`, '$.run_key')) WHERE `event_type` = 'llm_call';\n"}];var e=c(8690);let f=e.Ik({thresholdInputTokens:e.ai().int().positive(),input:e.ai().nonnegative().nullable(),output:e.ai().nonnegative().nullable()});function g(a,b,c){return Object.freeze({input:a,output:b,longContext:null,cacheWrite5m:1.25*a,cacheWrite1h:2*a,cacheRead:c,webSearch:.01})}function h(a,b,c={}){return Object.freeze({input:a,output:b,longContext:void 0===c.longContext?null:Object.freeze(c.longContext),cacheWrite5m:null,cacheWrite1h:null,cacheRead:c.cacheRead??null,webSearch:null})}e.Ik({input:e.ai().nonnegative(),output:e.ai().nonnegative(),longContext:f.nullable(),cacheWrite5m:e.ai().nonnegative().nullable(),cacheWrite1h:e.ai().nonnegative().nullable(),cacheRead:e.ai().nonnegative().nullable(),webSearch:e.ai().nonnegative().nullable()});let i=Object.freeze({input:0,output:0,longContext:null,cacheWrite5m:0,cacheWrite1h:0,cacheRead:0,webSearch:0}),j=new Map([["standard",1],["batch",.5],["priority",1.5]]);e.k5(["anthropic","openai","google","meta","mistral","deepseek","alibaba","xai","amazon","cohere","unknown"]),e.k5(["anthropic","openai","google-ai","mistral","deepseek","xai","cohere","bedrock","vertex","azure","foundry","together","fireworks","groq","openrouter","ollama","local"]),e.k5(["api","gateway","local"]);let k=new Map([["anthropic","api"],["openai","api"],["google-ai","api"],["mistral","api"],["deepseek","api"],["xai","api"],["cohere","api"],["bedrock","api"],["vertex","api"],["azure","api"],["foundry","api"],["together","gateway"],["fireworks","gateway"],["groq","gateway"],["openrouter","gateway"],["ollama","local"],["local","local"]]);function l(a){return k.get(a)??"api"}let m=new Map([["anthropic","anthropic"],["openai","openai"],["google","google-ai"],["mistral","mistral"],["deepseek","deepseek"],["xai","xai"],["cohere","cohere"]]),n=Object.freeze(["anthropic","amazon","meta","mistral","deepseek","qwen","cohere","ai21","writer","luma","stability"]),o=Object.freeze(["us","eu","apac","au","jp","global"]);class p{constructor(a,b={}){this.entries=[],this.vendor=a,this.defaults=b}model(a,b){var c,d;let e=b.family??this.defaults.family??{id:a,name:b.name},f=!1===b.firstParty?null:(c=this.vendor,m.get(c)??null),g=b.openWeights??this.defaults.openWeights??!1,h=b.region??this.defaults.region??null,j=b.retention??this.defaults.retention??"unknown",k=new Map;for(let a of(null!==f&&k.set(f,Object.freeze({platform:f,hosting:l(f),firstParty:!0,price:b.price??null,retention:j,region:h})),b.on??[])){let{platform:c,price:e,retention:f,region:g}="string"==typeof a?{platform:a}:a,n=(d=this.vendor,m.get(d)===c),o=l(c),p="local"===o;k.set(c,Object.freeze({platform:c,hosting:o,firstParty:n,price:e??(p?i:n?b.price??null:null),retention:f??(p?"on_infrastructure":n?j:"unknown"),region:void 0===g?n?h:null:g}))}let n=b.defaultHosting??this.defaults.defaultHosting??(null===f?"gateway":l(f));if(void 0!==b.price&&![...k.values()].some(a=>a.price===b.price))throw Error(`${a}: a first-party price was declared but no platform can carry it — vendor '${this.vendor}' has no first-party endpoint. Price the serving platform explicitly via the object form of \`on\`.`);let o={id:a,vendor:this.vendor,displayName:b.name,familyId:e.id,familyName:e.name,capability:b.capability??null,contextWindow:b.ctx??null,maxOutputTokens:b.maxOut??null,openWeights:g,aliases:Object.freeze([...b.aliases??[]]),training:this.defaults.training??null,platforms:k,defaultHosting:n,seen:b.seen??"managed"};return Object.freeze(o),Object.freeze(o.aliases),this.entries.push(o),o}models(){return this.entries}}function q(a,b={}){return new p(a,b)}let r=RegExp(`^(?:${o.join("|")})\\.`,"u"),s=RegExp(`^(?:${n.join("|")})\\.`,"u"),t=RegExp(`^(?:${n.join("|")})/`,"iu"),u=/^[a-z0-9][\w.-]*\//iu,v=/-v\d+:\d+$/u,w=/:\d+$/u,x=/@[\w-]+$/u,y=/-\d{8}$/u;function z(a,b){let c,d,e=b.byId.get(a);if(void 0!==e)return{entry:e,canonicalId:a,platform:null,raw:a};let{id:f,platform:g}=(c=a.trim(),d=null,r.test(c)&&(c=c.replace(r,""),d="bedrock"),s.test(c)&&(c=c.replace(s,""),d??="bedrock"),v.test(c)?(c=c.replace(v,""),d??="bedrock"):w.test(c)&&(c=c.replace(w,""),d??="bedrock"),x.test(c)&&(c=c.replace(x,""),d??="vertex"),t.test(c)?c=c.replace(t,""):u.test(c)&&(c=c.replace(u,"")),{id:c,platform:d}),h=b.byId.get(f);if(void 0!==h)return{entry:h,canonicalId:f,platform:g,raw:a};if(y.test(f)){let c=f.replace(y,""),d=b.byId.get(c);if(void 0!==d)return{entry:d,canonicalId:c,platform:g,raw:a}}return{entry:null,canonicalId:a,platform:g,raw:a}}let A=q("anthropic",{family:{id:"claude",name:"Claude"},region:"us",retention:"zero_retention",training:{apiDefault:"no",consumerDefault:"no",consumerControl:"opt-in",source:"https://privacy.claude.com/en/articles/7996868-is-my-data-used-for-model-training"}}),B=["bedrock","vertex","foundry"];A.model("claude-fable-5-1",{name:"Claude Fable 5.1",ctx:1e6,maxOut:128e3,capability:"reasoning",price:g(10,50,.25),on:[...B]}),A.model("claude-fable-5",{name:"Claude Fable 5",capability:"reasoning",price:g(10,50,1),on:[...B]}),A.model("claude-opus-5",{name:"Claude Opus 5",ctx:1e6,maxOut:128e3,capability:"reasoning",price:g(5,25,.5),on:[...B]}),A.model("claude-opus-4-8",{name:"Claude Opus 4.8",capability:"reasoning",price:g(5,25,.5),on:[...B]}),A.model("claude-opus-4-7",{name:"Claude Opus 4.7",capability:"reasoning",price:g(5,25,.5),on:[...B]}),A.model("claude-opus-4-6",{name:"Claude Opus 4.6",capability:"reasoning",price:g(5,25,.5),on:[...B]}),A.model("claude-opus-4-5",{name:"Claude Opus 4.5",capability:"reasoning",price:g(5,25,.5),on:[...B]}),A.model("claude-opus-4-1",{name:"Claude Opus 4.1",capability:"reasoning",price:g(15,75,1.5),on:[...B]}),A.model("claude-sonnet-5",{name:"Claude Sonnet 5",ctx:1e6,maxOut:128e3,capability:"reasoning",price:g(2,10,.2),on:[...B]}),A.model("claude-sonnet-4-6",{name:"Claude Sonnet 4.6",capability:"reasoning",price:g(3,15,.3),on:[...B]}),A.model("claude-sonnet-4-5",{name:"Claude Sonnet 4.5",capability:"reasoning",price:g(3,15,.3),on:[...B]}),A.model("claude-haiku-4-5",{name:"Claude Haiku 4.5",ctx:2e5,maxOut:64e3,capability:null,price:g(1,5,.1),aliases:["claude-haiku-4-5-20251001"],on:[...B]}),A.model("claude-sonnet-3-7",{name:"Claude Sonnet 3.7",on:[...B]});let C={thresholdInputTokens:272e3,input:null,output:null},D=q("openai",{family:{id:"gpt",name:"GPT"},region:"us",retention:"configurable",training:{apiDefault:"no",consumerDefault:"yes",consumerControl:"opt-out",source:"https://developers.openai.com/api/docs/guides/your-data"}}),E=["azure","foundry"];D.model("gpt-5.6-sol",{name:"GPT-5.6 Sol",ctx:105e4,maxOut:128e3,capability:"reasoning",price:h(4,20,{cacheRead:.4,longContext:C}),on:[...E]}),D.model("gpt-5.6-terra",{name:"GPT-5.6 Terra",ctx:105e4,maxOut:128e3,capability:"reasoning",price:h(2,12,{cacheRead:.2,longContext:C}),on:[...E]}),D.model("gpt-5.6-luna",{name:"GPT-5.6 Luna",ctx:105e4,maxOut:128e3,capability:null,price:h(.2,1.2,{cacheRead:.02,longContext:C}),on:[...E]}),D.model("gpt-5.5",{name:"GPT-5.5",ctx:105e4,maxOut:128e3,capability:"reasoning",price:h(5,30,{cacheRead:.5,longContext:C}),on:[...E]}),D.model("gpt-5.4",{name:"GPT-5.4",ctx:105e4,maxOut:128e3,capability:"reasoning",price:h(2.5,15,{cacheRead:.25,longContext:C}),on:[...E]}),D.model("gpt-5.4-mini",{name:"GPT-5.4 mini",ctx:4e5,maxOut:128e3,capability:null,price:h(.75,4.5,{cacheRead:.075}),on:[...E]}),D.model("gpt-5.4-nano",{name:"GPT-5.4 nano",ctx:4e5,maxOut:128e3,capability:null,price:h(.2,1.25,{cacheRead:.02}),on:[...E]}),D.model("gpt-5.3-codex",{name:"GPT-5.3 Codex",ctx:4e5,maxOut:128e3,capability:"code",price:h(1.75,14,{cacheRead:.175}),on:[...E]}),D.model("gpt-5.1",{name:"GPT-5.1",ctx:4e5,maxOut:128e3,capability:"reasoning",price:h(1.25,10,{cacheRead:.125}),on:[...E]}),D.model("gpt-5",{name:"GPT-5",ctx:4e5,maxOut:128e3,capability:"reasoning",price:h(1.25,10,{cacheRead:.125}),on:[...E]}),D.model("gpt-5-mini",{name:"GPT-5 mini",ctx:4e5,capability:null,price:h(.25,2,{cacheRead:.025}),on:[...E]}),D.model("gpt-5-nano",{name:"GPT-5 nano",ctx:4e5,maxOut:128e3,capability:null,price:h(.05,.4,{cacheRead:.005}),on:[...E]}),D.model("gpt-4.1",{name:"GPT-4.1",price:h(2,8,{cacheRead:.5}),on:[...E]}),D.model("gpt-4o",{name:"GPT-4o",price:h(2.5,10,{cacheRead:1.25}),on:[...E]}),D.model("gpt-4o-mini",{name:"GPT-4o mini",price:h(.15,.6,{cacheRead:.075}),on:[...E]}),D.model("gpt-4-turbo",{name:"GPT-4 Turbo",seen:"discovered",price:h(10,30),aliases:["gpt-4-turbo-2024-04-09"],on:[...E]}),D.model("o3",{name:"o3",capability:"reasoning",price:h(2,8,{cacheRead:.5}),on:[...E]}),D.model("gpt-oss-120b",{name:"GPT-OSS 120B",openWeights:!0,firstParty:!1,retention:"unknown",defaultHosting:"local",on:["together","fireworks","groq","openrouter","bedrock","ollama","local"]}),D.model("gpt-oss-20b",{name:"GPT-OSS 20B",openWeights:!0,firstParty:!1,retention:"unknown",defaultHosting:"local",on:["together","fireworks","groq","openrouter","ollama","local"]});let F=q("google",{family:{id:"gemini",name:"Gemini"},region:"us",retention:"configurable",training:{apiDefault:"no",consumerDefault:"yes",consumerControl:"none",source:"https://ai.google.dev/gemini-api/terms"}});F.model("gemini-3.7-flash",{name:"Gemini 3.7 Flash",capability:null,price:h(.75,3.75),on:["vertex"]}),F.model("gemini-3.6-flash",{name:"Gemini 3.6 Flash",capability:null,price:h(.75,3.75),on:["vertex"]}),F.model("gemini-3.5-flash",{name:"Gemini 3.5 Flash",capability:null,price:h(1.5,9),on:["vertex"]}),F.model("gemini-3.5-flash-lite",{name:"Gemini 3.5 Flash Lite",capability:null,price:h(.3,2.5),on:["vertex"]}),F.model("gemini-3.1-pro-preview",{name:"Gemini 3.1 Pro Preview",capability:"reasoning",price:h(2,12,{longContext:{thresholdInputTokens:2e5,input:4,output:18}}),on:["vertex"]}),F.model("gemini-2.5-pro",{name:"Gemini 2.5 Pro",capability:"reasoning",price:h(1.25,10,{longContext:{thresholdInputTokens:2e5,input:2.5,output:15}}),on:["vertex"]}),F.model("gemini-2.5-flash",{name:"Gemini 2.5 Flash",capability:null,price:h(.3,2.5),on:["vertex"]}),F.model("gemini-2.5-flash-lite",{name:"Gemini 2.5 Flash Lite",capability:null,price:h(.1,.4),on:["vertex"]}),F.model("gemini-1-5-pro",{name:"Gemini 1.5 Pro",on:["vertex"]}),F.model("gemini-1-5-flash",{name:"Gemini 1.5 Flash",on:["vertex"]});let G=q("xai",{family:{id:"grok",name:"Grok"},region:"us",retention:"configurable",training:{apiDefault:"no",consumerDefault:"unknown",consumerControl:"unknown",source:"https://docs.x.ai/developers/faq/security"}});G.model("grok-4.6",{name:"Grok 4.6",ctx:5e5,capability:"reasoning",price:h(2,6,{cacheRead:.5,longContext:{thresholdInputTokens:2e5,input:4,output:12}}),on:["bedrock"]}),G.model("grok-4.5",{name:"Grok 4.5",ctx:5e5,capability:"reasoning",price:h(2,6,{cacheRead:.3,longContext:{thresholdInputTokens:2e5,input:4,output:12}})}),G.model("grok-4.3",{name:"Grok 4.3",ctx:1e6,capability:"reasoning",price:h(1.25,2.5,{cacheRead:.2,longContext:{thresholdInputTokens:2e5,input:2.5,output:5}}),on:["bedrock"]}),G.model("grok-build-0.1",{name:"Grok Build 0.1",ctx:256e3,capability:"code",price:h(1,2,{cacheRead:.2,longContext:{thresholdInputTokens:2e5,input:2,output:4}})});let H=q("deepseek",{family:{id:"deepseek",name:"DeepSeek"},region:"cn",retention:"configurable",training:{apiDefault:"yes",consumerDefault:"yes",consumerControl:"opt-out",source:"https://cdn.deepseek.com/policies/en-US/deepseek-privacy-policy.html"}});H.model("deepseek-v4-flash",{name:"DeepSeek V4 Flash",ctx:1e6,capability:null,price:h(.44,1.32,{cacheRead:.014}),on:["bedrock","together","fireworks","openrouter","ollama","local"]}),H.model("deepseek-v4-pro",{name:"DeepSeek V4 Pro",ctx:1e6,capability:"reasoning",price:h(1.32,3.96,{cacheRead:.044}),on:["bedrock","together","fireworks","openrouter"]}),H.model("deepseek-r1",{name:"DeepSeek R1",seen:"discovered",capability:"reasoning",openWeights:!0,defaultHosting:"local",on:["bedrock","together","fireworks","openrouter","ollama","local"]});let I=q("cohere",{family:{id:"command",name:"Command"},region:"us",retention:"configurable",training:{apiDefault:"unknown",consumerDefault:"unknown",consumerControl:"opt-out",source:"https://cohere.com/security"}});I.model("command-a-plus-05-2026",{name:"Command A+",ctx:128e3,maxOut:64e3,on:["bedrock"]}),I.model("command-a-03-2025",{name:"Command A",ctx:256e3,maxOut:8e3,on:["bedrock"]}),I.model("command-a-reasoning-08-2025",{name:"Command A Reasoning",ctx:256e3,maxOut:32e3,capability:"reasoning"}),I.model("command-r-plus-08-2024",{name:"Command R+",ctx:128e3,maxOut:4e3,price:h(2.5,10),aliases:["command-r-plus"],on:["bedrock"]});let J=q("meta",{family:{id:"llama",name:"Llama"},openWeights:!0,retention:"unknown",defaultHosting:"local"}),K=["bedrock","together","fireworks","groq","openrouter","ollama","local"];J.model("llama-3-3-70b",{name:"Llama 3.3 70B",ctx:128e3,on:[...K]}),J.model("llama-3-1-70b",{name:"Llama 3.1 70B",ctx:128e3,on:[...K]}),J.model("llama-3-1-8b",{name:"Llama 3.1 8B",ctx:128e3,on:[...K]});let L=q("alibaba",{family:{id:"qwen",name:"Qwen"},openWeights:!0,retention:"unknown",defaultHosting:"local"});L.model("qwen-3-235b",{name:"Qwen 3 235B",on:[...K]}),L.model("qwen-3-coder-480b",{name:"Qwen 3 Coder 480B",capability:"code",on:[...K]});let M=q("amazon",{family:{id:"nova",name:"Nova"},retention:"configurable"});M.model("nova-2-lite",{name:"Nova 2 Lite",ctx:1e6,maxOut:64e3,aliases:["nova-2-lite-v1:0"],on:["bedrock"]});let N=q("mistral",{family:{id:"mistral",name:"Mistral"},openWeights:!0,retention:"unknown",defaultHosting:"local"});N.model("mixtral-8x7b",{name:"Mixtral 8x7B",seen:"discovered",on:[...K]});let O=function(a){let b=new Map;for(let c of a)b.set(c.id,c);for(let c of a)for(let a of c.aliases)b.has(a)||b.set(a,c);return{byId:b,entries:Object.freeze([...a])}}(Object.freeze([...A.models(),...D.models(),...F.models(),...G.models(),...H.models(),...I.models(),...N.models(),...J.models(),...L.models(),...M.models()]));e.k5(["reasoning","code"]),e.k5(["zero_retention","no_storage","configurable","on_device","on_infrastructure","unknown"]),e.k5(["managed","discovered"]);let P=e.k5(["yes","no","unknown"]),Q=e.k5(["opt-in","opt-out","none","unknown"]);e.Ik({apiDefault:P,consumerDefault:P,consumerControl:Q,source:e.Yj().nullable()});let R=e.k5(["api","consumer","enterprise","unknown"]);function S(a){return new Date(a).getTime()}function T(a){return new Date(a).toISOString()}e.Ik({tier:R,controlExercised:e.zM().nullable()}),Object.freeze({tier:"unknown",controlExercised:null});let U=new Map([["anthropic","anthropic"],["openai","openai"],["google","google-ai"],["google-ai","google-ai"],["bedrock","bedrock"],["vertex","vertex"],["azure","azure"],["foundry","foundry"],["mistral","mistral"],["deepseek","deepseek"],["xai","xai"],["cohere","cohere"],["together","together"],["fireworks","fireworks"],["groq","groq"],["openrouter","openrouter"],["ollama","ollama"],["local","local"]]);function V(a){return U.get(a.trim().toLowerCase())??null}function W(a){let b=V(a);return null!==b&&"local"===l(b)}Object.freeze(["gateway","unknown","cli","api"]);let X={normalizeModelId(a,b){let c=a.trim().toLowerCase();if(W(c))return{provider:c,model:"*"};let d=z(b,O);return{provider:c,model:d.entry?.id??b}},costFor({provider:a,model:b,usage:c}){let d=function(a,b){if(W(a))return i;let c=z(b,O);if(null===c.entry)return null;let d=c.platform??V(a);return null===d?null:c.entry.platforms.get(d)?.price??null}(a,b);return null===d?null:function(a,b){var c;let d=[[b.cacheWrite1hTokens??0,a.cacheWrite1h],[b.cacheWrite5mTokens??0,a.cacheWrite5m],[b.cacheReadTokens??0,a.cacheRead]],e=null!==a.longContext&&(b.inputTokens??0)>a.longContext.thresholdInputTokens?a.longContext:null;if(null!==e&&(null===e.input||null===e.output))return null;let f=e?.input??a.input,g=e?.output??a.output,h=(b.inputTokens??0)*f+(b.outputTokens??0)*g;for(let[a,b]of d)if(0!==a){if(null===b)return null;h+=a*b}let i=h/1e6*(void 0===(c=b.serviceTier)?1:j.get(c)??1),k=b.webSearchRequests??0;return k>0&&null===a.webSearch?null:i+k*(a.webSearch??0)}(d,c)}};new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1});let Y=a=>a??0;function Z(a,b){let c=new Map;for(let{sessionId:d,attributes:e}of a){let a=e.provider??"unknown",f=e.model??"unknown",g=`${a} ${f}`,h=c.get(d);void 0===h&&(h=new Map,c.set(d,h));let i=h.get(g);void 0===i&&(i={provider:a,model:f,input:0,output:0,cacheCreation:0,cacheRead:0,costUsd:0,priced:!1},h.set(g,i)),i.input+=Y(e.input_tokens),i.output+=Y(e.output_tokens),i.cacheCreation+=Y(e.cache_creation_input_tokens),i.cacheRead+=Y(e.cache_read_input_tokens);let j=b.costFor({provider:a,model:f,usage:function(a){let b={inputTokens:Y(a.input_tokens),outputTokens:Y(a.output_tokens),cacheWrite1hTokens:Y(a.ephemeral_1h_input_tokens),cacheWrite5mTokens:Y(a.ephemeral_5m_input_tokens),cacheReadTokens:Y(a.cache_read_input_tokens),webSearchRequests:Y(a.web_search_requests)};return void 0!==a.service_tier&&(b.serviceTier=a.service_tier),b}(e)});null!==j&&(i.costUsd+=j,i.priced=!0)}let d=[];for(let[a,b]of c){let c=[],e=0,f=0,g=!1,h=!1;for(let d of b.values()){let b=d.input+d.output+d.cacheCreation+d.cacheRead;e+=b;let i=d.priced?d.costUsd:null;null===i?h=!0:(g=!0,f+=i),c.push({sessionId:a,model:d.model,provider:d.provider,inputTokens:d.input,outputTokens:d.output,cacheCreation:d.cacheCreation,cacheRead:d.cacheRead,totalTokens:b,estimatedCostUsd:i})}c.sort((a,b)=>b.totalTokens-a.totalTokens),d.push({sessionId:a,rollups:c,totalTokens:e,estimatedCostUsd:g?f:null,costIsPartial:h})}return d.sort((a,b)=>b.totalTokens-a.totalTokens),d}function $(a){let b=new Map,c=0,d=0,e=!1;for(let f of a){for(let a of f.rollups){let c=`${a.provider} ${a.model}`,d=b.get(c);void 0===d&&(d={provider:a.provider,model:a.model,inputTokens:0,outputTokens:0,cacheTokens:0,totalTokens:0,costUsd:0,priced:!1},b.set(c,d)),d.inputTokens+=a.inputTokens,d.outputTokens+=a.outputTokens,d.cacheTokens+=a.cacheCreation+a.cacheRead,d.totalTokens+=a.totalTokens,null===a.estimatedCostUsd?e=!0:(d.costUsd+=a.estimatedCostUsd,d.priced=!0)}c+=f.totalTokens,null!==f.estimatedCostUsd&&(d+=f.estimatedCostUsd),f.costIsPartial&&(e=!0)}return{models:[...b.values()].sort((a,b)=>b.totalTokens-a.totalTokens).map(a=>({provider:a.provider,model:a.model,inputTokens:a.inputTokens,outputTokens:a.outputTokens,cacheTokens:a.cacheTokens,totalTokens:a.totalTokens,estimatedCostUsd:a.priced?a.costUsd:null})),sessionCount:a.length,totalTokens:c,estimatedCostUsd:d,costIsPartial:e}}var _=c(2739),aa=c(84441);let ab={ClaudeCode:"claudecode",Cursor:"cursor",Copilot:"copilot",Codex:"codex",Antigravity:"antigravity",Windsurf:"windsurf",ClaudeDesktop:"claudedesktop",ChatGpt:"chatgpt",ClaudeAi:"claudeai",Api:"api"},ac=e.k5(ab).meta({id:"Harness"}),ad={ClaudeCode:"claude-code",ClaudeDesktop:"claude-desktop",Cursor:"cursor",ChatGpt:"chatgpt",ClaudeAi:"claude-ai",Copilot:"github-copilot",Codex:"codex",Antigravity:"antigravity",Cli:"cli",Unknown:"unknown"},ae=e.k5(ad).meta({id:"SourceTool"}),af={[ad.ClaudeCode]:ab.ClaudeCode,[ad.ClaudeDesktop]:ab.ClaudeDesktop,[ad.Copilot]:ab.Copilot,[ad.Cursor]:ab.Cursor,[ad.ChatGpt]:ab.ChatGpt,[ad.Codex]:ab.Codex,[ad.Antigravity]:ab.Antigravity,[ad.ClaudeAi]:ab.ClaudeAi},ag=e.k5(["pii","financial","secret","phi","code_context","code_flaw","custom","config"]).meta({id:"DetectionCategory"}),ah=e.k5(["critical","high","medium","low"]).meta({id:"Severity"}),ai=e.k5(["warn","redact","block","allow","log"]).meta({id:"ActionTaken"}),aj=ai.options,ak=e.Ik({start:e.ai().int().nonnegative(),end:e.ai().int().nonnegative()}).meta({id:"Span"});e.Ik({id:e.Os(),eventId:e.Os(),ruleId:e.Yj(),category:ag,severity:ah,span:ak,maskedMatch:e.Yj(),actionTaken:ai,confidence:e.ai().min(0).max(1)}).meta({id:"Finding"}).meta({id:"DetectedFinding"});let al=e.k5(["blocked","redacted","warned","allowed","quarantined","monitored"]).meta({id:"FindingAction"}),am=ac.extract(["ClaudeCode","ClaudeDesktop","Cursor","Copilot","ChatGpt","ClaudeAi","Codex","Antigravity","Api"]).meta({id:"FindingProvider"}),an=e.k5(["secret","pii","source_code","code_flaw","external_share","mcp_server","customer_data","financial","phi","custom"]).meta({id:"FindingCategory"});e.k5(["in-flight","at-rest"]).meta({id:"FindingOrigin"});let ao=e.k5(["open","handled","resolved","dismissed"]).meta({id:"FindingStatus"}),ap=e.k5(["enforced-in-flight","fixed-at-source","exception","acknowledged","false-positive","redetected"]).meta({id:"ResolutionMethod"}),aq=e.Ik({maskedValue:e.Yj(),contextPrefix:e.Yj()}).meta({id:"FindingMatch"}),ar=e.Ik({id:e.Yj(),name:e.Yj().nullable()}).meta({id:"FindingDetectionRef"}),as=e.Ik({id:e.Yj(),name:e.Yj()}).meta({id:"FindingPolicyRef"}),at=e.Ik({id:e.Yj(),name:e.Yj()}).meta({id:"FindingUser"}),au=e.Ik({id:e.Yj(),provider:am,repo:e.Yj(),file:e.Yj(),user:at.optional(),toolName:e.Yj().optional(),action:al,detectedAt:_.w$(),confidence:e.ai().min(0).max(1),status:ao.optional(),eventId:e.Yj().optional(),sessionId:e.Yj().optional()}).meta({id:"FindingInstance"}),av=e.Ik({id:e.Yj(),category:an,subtype:e.Yj(),severity:ah,match:aq,detection:ar,policy:as,instanceCount:e.ai().int().nonnegative(),providers:e.YO(am),aggregateAction:al.nullable(),latestDetectedAt:_.w$(),instances:e.YO(au),status:ao.optional(),users:e.YO(at).optional()}).meta({id:"FindingGroup"});e.Ik({findings:e.ai().int().nonnegative(),groups:e.ai().int().nonnegative(),bySeverity:e.Ik({critical:e.ai().int().nonnegative(),high:e.ai().int().nonnegative(),medium:e.ai().int().nonnegative(),low:e.ai().int().nonnegative()})}).meta({id:"FindingStats"});let aw=e.Ik({value:e.Yj(),count:e.ai().int().nonnegative()}).meta({id:"FindingFacetItem"}),ax=e.Ik({severity:e.YO(aw),subtype:e.YO(aw),provider:e.YO(aw),action:e.YO(aw),status:e.YO(aw),tool:e.YO(aw).optional()}).meta({id:"FindingFacets"}),ay=50;e.Ik({severity:e.YO(ah).optional(),subtype:e.YO(e.Yj()).optional(),provider:e.YO(am).optional(),action:e.YO(al).optional(),status:e.YO(ao).optional(),q:e.Yj().optional(),sessionId:e.Yj().optional(),from:_.w$().optional(),includeId:e.Yj().optional(),groupBy:e.eu("type").optional(),limit:aa.ai().int().min(1).max(100).optional(),cursor:e.Yj().optional()}),e.Ik({totals:e.Ik({findings:e.ai().int().nonnegative(),groups:e.ai().int().nonnegative()}),facets:ax,items:e.YO(av),nextCursor:e.Yj().nullable(),sessionFirings:e.g1(e.Yj(),e.ai().int().nonnegative()).optional()}).meta({id:"ListGroupedFindingsResponse"}),e.Ik({action:al.exclude(["quarantined"]),instanceId:e.Yj().optional()}).meta({id:"ApplyFindingActionRequest"}),av.meta({id:"ApplyFindingActionResponse"}),e.Ik({severity:e.YO(ah).optional(),subtype:e.YO(e.Yj()).optional(),provider:e.YO(am).optional(),action:e.YO(al).optional(),q:e.Yj().optional(),format:e.k5(["csv","json"]).optional()});let az=au.extend({groupId:e.Yj(),category:an,subtype:e.Yj(),severity:ah,match:aq,detection:ar,policy:as}).meta({id:"FindingInstanceDetail"}),aA=50;e.Ik({severity:e.YO(ah).optional(),subtype:e.YO(e.Yj()).optional(),provider:e.YO(am).optional(),action:e.YO(al).optional(),status:e.YO(ao).optional(),tool:e.YO(e.Yj()).optional(),repo:e.Yj().optional(),file:e.Yj().optional(),q:e.Yj().optional(),sessionId:e.Yj().optional(),from:_.w$().optional(),limit:aa.ai().int().min(1).max(200).optional(),cursor:e.Yj().optional()}),e.Ik({totals:e.Ik({findings:e.ai().int().nonnegative()}),facets:ax,items:e.YO(az),nextCursor:e.Yj().nullable()}).meta({id:"ListFindingInstancesResponse"});let aB=e.Ik({file:e.Yj(),instanceCount:e.ai().int().nonnegative(),maxSeverity:ah,latestDetectedAt:_.w$(),status:ao.optional(),ruleIds:e.YO(e.Yj())}).meta({id:"FindingLocationFile"}),aC=e.Ik({repo:e.Yj(),instanceCount:e.ai().int().nonnegative(),maxSeverity:ah,latestDetectedAt:_.w$(),status:ao.optional(),files:e.YO(aB)}).meta({id:"FindingLocationRepo"});e.Ik({severity:e.YO(ah).optional(),subtype:e.YO(e.Yj()).optional(),provider:e.YO(am).optional(),action:e.YO(al).optional(),status:e.YO(ao).optional(),tool:e.YO(e.Yj()).optional(),q:e.Yj().optional(),sessionId:e.Yj().optional(),from:_.w$().optional(),limit:aa.ai().int().min(1).max(500).optional()}),e.Ik({totals:e.Ik({findings:e.ai().int().nonnegative(),repos:e.ai().int().nonnegative(),files:e.ai().int().nonnegative()}),items:e.YO(aC),hasMore:e.zM()}).meta({id:"ListFindingLocationsResponse"});let aD=e.k5(["host","harness","user","skill","hook","mcp_server","config_file"]).meta({id:"InventoryObjectType"}),aE=e.k5(["session","run","tool_call","llm_call","source_lookup","prompt","response","code_change","tool_use","model_refusal","config_scan"]).meta({id:"AuditEventType"}),aF=e.g1(e.Yj(),e.L5());e.Ik({host_name:e.Yj().optional(),os:e.Yj().optional(),os_version:e.Yj().optional(),arch:e.Yj().optional()}).catchall(e.L5()),e.Ik({harness_version:e.Yj().optional(),interface:e.Yj().optional()}).catchall(e.L5()),e.Ik({display_name:e.Yj().optional(),email:e.Yj().optional()}).catchall(e.L5()),e.Ik({source:e.Yj().optional(),version:e.Yj().optional(),description:e.Yj().optional(),updated_at:e.Yj().optional(),scope:e.Yj().optional(),plugin_name:e.Yj().optional()}).catchall(e.L5()),e.Ik({event:e.Yj().optional(),matcher:e.Yj().optional(),command:e.Yj().optional(),scope:e.Yj().optional(),plugin_name:e.Yj().optional(),timeout:e.ai().optional()}).catchall(e.L5()),e.Ik({scope:e.Yj().optional(),transport:e.Yj().optional(),command:e.Yj().optional(),url:e.Yj().optional(),env_keys:e.YO(e.Yj()).optional(),plugin_name:e.Yj().optional(),marketplace:e.Yj().optional(),project:e.Yj().optional()}).catchall(e.L5()),e.Ik({kind:e.Yj().optional(),detail:e.Yj().optional(),scope:e.Yj().optional(),updated_at:e.Yj().optional(),entry_count:e.ai().optional()}).catchall(e.L5());let aG=e.Ik({model:e.Yj().optional(),provider:e.Yj().optional(),input_tokens:e.ai().int().nonnegative().optional(),output_tokens:e.ai().int().nonnegative().optional(),cache_creation_input_tokens:e.ai().int().nonnegative().optional(),cache_read_input_tokens:e.ai().int().nonnegative().optional(),ephemeral_1h_input_tokens:e.ai().int().nonnegative().optional(),ephemeral_5m_input_tokens:e.ai().int().nonnegative().optional(),web_search_requests:e.ai().int().nonnegative().optional(),web_fetch_requests:e.ai().int().nonnegative().optional(),service_tier:e.Yj().optional(),stop_reason:e.Yj().optional(),message_id:e.Yj().optional(),uuid:e.Yj().optional(),parent_uuid:e.Yj().optional(),run_key:e.Yj().optional()}).catchall(e.L5());e.Ik({sessionId:e.Yj().min(1),messageId:e.Yj().min(1),parentId:e.Yj().min(1),rootSessionId:e.Yj().min(1),startedAt:_.w$(),attributes:aG});let aH=e.Ik({tool_name:e.Yj().optional(),tool_use_id:e.Yj().optional(),target:e.Yj().optional(),is_error:e.zM().optional(),input_size:e.ai().int().nonnegative().optional(),output_size:e.ai().int().nonnegative().optional(),uuid:e.Yj().optional(),parent_uuid:e.Yj().optional(),run_key:e.Yj().optional()}).catchall(e.L5());e.Ik({source_tool:e.Yj().optional(),file_path:e.Yj().optional(),repo:e.Yj().optional(),tool_name:e.Yj().optional(),gitignored:e.zM().optional(),whole_file:e.zM().optional(),correlation_id:e.uR().optional(),trace_id:e.Yj().regex(/^[0-9a-f]{32}$/).optional(),exception_ids:e.YO(e.Os()).optional(),inspection_ms:e.ai().int().nonnegative().optional()}).catchall(e.L5());let aI=e.Ik({ruleId:e.Yj().min(1),ruleName:e.Yj(),ruleVersion:e.Yj().min(1),category:ag,severity:ah,span:ak,maskedMatch:e.Yj(),actionTaken:ai,confidence:e.ai().min(0).max(1)});e.Ik({sessionId:e.Yj().min(1),toolUseId:e.Yj().min(1),parentId:e.Yj().min(1),rootSessionId:e.Yj().min(1),startedAt:_.w$(),attributes:aH,inspections:e.YO(aI).default([])});let aJ=e.Ik({objectType:aD,identityKey:e.Yj().min(1),location:e.Yj().optional(),title:e.Yj().optional(),hostId:e.Yj().optional(),attributes:aF.default({})}).meta({id:"InventoryInput"}),aK=e.Ik({url:e.Yj().min(1),name:e.Yj().optional(),attributes:aF.default({})}).meta({id:"SourceProjectInput"}),aL=e.Ik({id:e.Yj().min(1),eventType:aE,startedAt:_.w$(),endedAt:_.w$().optional(),parentId:e.Yj().optional(),rootSessionId:e.Yj().optional(),hostId:e.Yj().optional(),harnessId:e.Yj().optional(),sourceProjectId:e.Yj().optional(),severity:ah.optional(),priority:e.Yj().optional(),content:e.Yj().optional(),contentHash:e.Yj().optional(),attributes:aF.optional()}).meta({id:"AuditEventInput"});e.Ik({class:e.Yj().min(1),label:e.Yj().optional(),attributes:aF.optional()});let aM=e.Ik({ruleId:e.Yj().min(1),version:e.Yj().min(1),name:e.Yj(),category:ag,severity:ah,definition:e.Yj()});e.Ik({id:e.Yj().min(1),auditEventId:e.Yj().min(1),inspectionDefinitionId:e.Yj().min(1),classifiedDataId:e.Yj().optional(),span:ak,maskedMatch:e.Yj(),actionTaken:ai,confidence:e.ai().min(0).max(1),findingKey:e.Yj().optional(),firstDetectedAt:_.w$().optional()}),e.Ik({host:aJ.optional(),harness:aJ.optional(),project:aK.optional()}).meta({id:"InventoryContext"}),e.Ik({hostId:e.Yj().optional(),harnessId:e.Yj().optional(),accountId:e.Yj().optional(),sourceProjectId:e.Yj().optional()}).meta({id:"ResolvedInventory"}),e.Ik({hosts:e.YO(e.Yj()),harnesses:e.YO(e.Yj()),osVersions:e.YO(e.Yj()),projects:e.YO(e.Yj())}).meta({id:"InventoryFacets"});let aN=e.Ik({sessionId:e.Yj(),model:e.Yj(),provider:e.Yj(),inputTokens:e.ai().int().nonnegative(),outputTokens:e.ai().int().nonnegative(),cacheCreation:e.ai().int().nonnegative(),cacheRead:e.ai().int().nonnegative(),totalTokens:e.ai().int().nonnegative(),estimatedCostUsd:e.ai().nullable()}).meta({id:"TokenRollup"});e.Ik({sessionId:e.Yj(),rollups:e.YO(aN),totalTokens:e.ai().int().nonnegative(),estimatedCostUsd:e.ai().nullable(),costIsPartial:e.zM()});let aO=e.Ik({provider:e.Yj(),model:e.Yj(),inputTokens:e.ai().int().nonnegative(),outputTokens:e.ai().int().nonnegative(),cacheTokens:e.ai().int().nonnegative(),totalTokens:e.ai().int().nonnegative(),estimatedCostUsd:e.ai().nullable()});function aP(a){return JSON.stringify(a)}e.Ik({models:e.YO(aO),sessionCount:e.ai().int().nonnegative(),totalTokens:e.ai().int().nonnegative(),estimatedCostUsd:e.ai(),costIsPartial:e.zM()});let aQ=e.k5(["active","completed","interrupted","error"]),aR=e.k5(["session","prompt","response","tool","hook","detection","share","permission","commit","error","active"]),aS=e.k5(["detections","shares","inventory"]),aT=e.Ik({id:e.Yj(),occurredAt:_.w$(),kind:aR,title:e.Yj(),detail:e.Yj(),tool:e.Yj().nullable(),severity:ah.nullable(),link:aS.nullable(),targetId:e.Yj().nullable(),internal:e.zM(),flagged:e.zM()}).meta({id:"ActivityAuditEvent"}),aU=e.Ik({id:e.Yj(),harness:ac,title:e.Yj(),project:e.Yj(),repo:e.Yj(),branches:e.YO(e.Yj()),startedAt:_.w$(),endedAt:_.w$().nullable(),status:aQ,turns:e.ai().int().nonnegative(),findings:e.ai().int().nonnegative(),shares:e.ai().int().nonnegative()}).meta({id:"ActivitySessionSummary"});aU.extend({host:e.Yj(),cwd:e.Yj(),models:e.YO(e.Yj()),version:e.Yj(),tokens:aN,tools:e.g1(e.Yj(),e.ai().int().nonnegative()),files:e.YO(e.Yj()),commits:e.ai().int().nonnegative(),events:e.YO(aT)}).meta({id:"ActivitySession"}),e.Ik({tz:e.Yj().optional()});let aV=e.Ik({sessionsToday:e.ai().int().nonnegative(),liveNow:e.ai().int().nonnegative(),toolCallsToday:e.ai().int().nonnegative(),findingsToday:e.ai().int().nonnegative(),egressToday:e.ai().int().nonnegative()}).meta({id:"GetActivityStatsResponse"});e.Ik({q:e.Yj().optional(),harness:e.YO(ac).optional(),from:e.KC([_.p6(),_.w$()]).optional(),to:e.KC([_.p6(),_.w$()]).optional(),excludeEmpty:e.uE().optional(),limit:aa.ai().int().min(1).max(100).default(50),cursor:e.Yj().optional()});let aW=e.Ik({items:e.YO(aU),nextCursor:e.Yj().nullable(),emptyCount:e.ai().int().nonnegative()}).meta({id:"ListActivitySessionsResponse"});e.Ik({limit:aa.ai().int().min(1).max(500).default(100),cursor:e.Yj().optional(),order:e.k5(["asc","desc"]).default("asc")}),e.Ik({items:e.YO(aT),nextCursor:e.Yj().nullable()}).meta({id:"ListSessionEventsResponse"}),e.Ik({format:e.k5(["ndjson","json"]).default("ndjson")}),e.Ik({format:e.k5(["csv","json"]).default("csv"),q:e.Yj().optional(),harness:e.YO(ac).optional(),from:e.KC([_.p6(),_.w$()]).optional(),to:e.KC([_.p6(),_.w$()]).optional()}),e.Ik({stats:aV,sessions:aW}).meta({id:"ActivityOverviewResponse"});let aX=e.k5(["user","project","local","plugin"]),aY=e.Ik({name:e.Yj().min(1),source:e.Yj().min(1),scope:aX,pluginName:e.Yj().optional(),version:e.Yj().optional(),description:e.Yj().optional(),updatedAt:_.w$().optional(),location:e.Yj().optional()}),aZ=e.Ik({event:e.Yj().min(1),matcher:e.Yj().optional(),command:e.Yj().min(1),timeout:e.ai().optional(),scope:aX,pluginName:e.Yj().optional(),location:e.Yj().optional()}),a$=e.Ik({name:e.Yj().min(1),scope:aX,pluginName:e.Yj().optional(),marketplace:e.Yj().optional(),project:e.Yj().optional(),transport:e.Yj().min(1),command:e.Yj().optional(),url:e.Yj().optional(),envKeys:e.YO(e.Yj()).optional(),location:e.Yj().optional()}),a_=e.Ik({name:e.Yj().min(1),path:e.Yj().min(1),scope:aX,kind:e.Yj().min(1),detail:e.Yj().optional(),entryCount:e.ai().optional(),updatedAt:_.w$().optional()});e.Ik({scannedAt:_.w$(),skills:e.YO(aY),hooks:e.YO(aZ),mcpServers:e.YO(a$),configFiles:e.YO(a_),errors:e.YO(e.Ik({source:e.Yj(),reason:e.Yj()}))});let a0=e.Ik({ruleId:e.Yj().min(1),version:e.Yj().min(1),span:ak,maskedMatch:e.Yj(),actionTaken:ai,confidence:e.ai().min(0).max(1)});e.Ik({items:e.YO(aJ),scanEvent:aL,definitions:e.YO(aM).optional(),findings:e.YO(a0).optional()});let a1=e.k5(["project","skill","mcp","hook","config"]).meta({id:"AssetType"}),a2=e.k5(["open","approved","blocked"]).meta({id:"AccessLevel"}),a3=e.k5(["source","public-dep","vendored","config","data","docs","generated"]).meta({id:"Origin"}),a4=e.k5(["known-good","risky","unapproved"]).meta({id:"TrustLevel"}),a5=e.k5(["update","stale","conflict","unknown","change","untracked","risk","findings"]).meta({id:"Flag"}),a6=e.k5(["public","private"]).meta({id:"Visibility"}),a7=e.k5(["block","redact","warn"]).meta({id:"HarnessEventKind"}),a8=ac.extract(["ClaudeCode","Cursor","Codex","Antigravity"]).meta({id:"HarnessId"}),a9=e.Ik({open:e.ai().int().nonnegative(),approved:e.ai().int().nonnegative(),blocked:e.ai().int().nonnegative(),total:e.ai().int().nonnegative()}).meta({id:"AccessCounts"}),ba=e.Ik({id:e.Yj(),type:a1,name:e.Yj(),sub:e.Yj(),flags:e.YO(a5),trust:a4.optional()}).meta({id:"AssetSummary"}),bb=e.Ik({id:e.Yj(),name:e.Yj(),repo:e.Yj(),visibility:a6,language:e.Yj(),policyDefault:a2,updatedAt:_.w$(),accessCounts:a9,findingsCount:e.ai().int().nonnegative()}).meta({id:"ProjectSummary"}),bc=e.Ik({type:a1,assets:e.YO(ba)}),bd=e.Ik({id:a8,label:e.Yj(),kind:e.Yj(),version:e.Yj(),sessions:e.ai().int().nonnegative(),assetCount:e.ai().int().nonnegative(),flagCount:e.ai().int().nonnegative(),projects:e.YO(bb),categories:e.YO(bc)}).meta({id:"HarnessSummary"});e.Ik({items:e.YO(bd)}).meta({id:"ListHarnessesResponse"});let be=e.Ik({type:a1,total:e.ai().int().nonnegative(),trustRollup:e.Ik({"known-good":e.ai().int().nonnegative(),risky:e.ai().int().nonnegative(),unapproved:e.ai().int().nonnegative()}).partial().strict().optional(),flagRollup:e.Ik({update:e.ai().int().nonnegative(),stale:e.ai().int().nonnegative(),conflict:e.ai().int().nonnegative(),unknown:e.ai().int().nonnegative(),change:e.ai().int().nonnegative(),untracked:e.ai().int().nonnegative(),risk:e.ai().int().nonnegative(),findings:e.ai().int().nonnegative()}).partial().strict(),items:e.YO(ba)}).meta({id:"AssetGroup"});e.Ik({groups:e.YO(be)}).meta({id:"ListAssetsResponse"});let bf=e.Ik({name:e.Yj(),signature:e.Yj(),description:e.Yj(),write:e.zM(),risk:e.Yj().nullable()}).meta({id:"McpTool"}),bg=e.Ik({id:e.Yj(),title:e.Yj(),note:e.Yj()});ba.extend({description:e.Yj().nullable(),trust:a4.nullable(),meta:e.g1(e.Yj(),e.L5()),finding:bg.nullable(),tools:e.YO(bf).optional()}).meta({id:"AssetDetail"}),e.Ik({items:e.YO(bb)}).meta({id:"ListProjectsResponse"}),e.Ik({attention:e.ai().int().nonnegative(),byType:e.Ik({project:e.ai().int().nonnegative(),skill:e.ai().int().nonnegative(),mcp:e.ai().int().nonnegative(),hook:e.ai().int().nonnegative(),config:e.ai().int().nonnegative()}),harnesses:e.ai().int().nonnegative(),mcpTrust:e.Ik({"known-good":e.ai().int().nonnegative(),risky:e.ai().int().nonnegative(),unapproved:e.ai().int().nonnegative()})}).meta({id:"InventoryStats"});let bh=e.Ik({path:e.Yj(),name:e.Yj(),origin:a3,access:a2,isCustom:e.zM(),findings:e.ai().int().nonnegative(),blockedAt:_.w$().nullable().optional(),note:e.Yj().nullable().optional()}).meta({id:"FileSummary"}),bi=e.Ik({name:e.Yj(),path:e.Yj(),accessCounts:a9}).meta({id:"FolderSummary"});e.Ik({project:e.Ik({id:e.Yj(),repo:e.Yj(),visibility:a6}),path:e.Yj(),folders:e.YO(bi).optional(),files:e.YO(bh)}).meta({id:"ProjectTreeResponse"}),bh.extend({project:e.Ik({repo:e.Yj(),visibility:a6,language:e.Yj(),policyDefault:a2,updatedAt:_.w$()}),findingsRefs:e.YO(e.Ik({id:e.Yj(),title:e.Yj()}))}).meta({id:"FileDetail"}),e.Ik({path:e.Yj(),access:a2}).meta({id:"SetFileAccessBody"}),e.Ik({file:bh,accessCounts:a9}).meta({id:"SetFileAccessResponse"}),e.Ik({trust:a4}).meta({id:"SetMcpTrustBody"});let bj=e.Ik({kind:a7,title:e.Yj(),detail:e.Yj(),occurredAt:_.w$(),findingId:e.Yj().nullable().optional()}).meta({id:"HarnessEventItem"});e.Ik({counts:e.Ik({block:e.ai().int().nonnegative(),redact:e.ai().int().nonnegative(),warn:e.ai().int().nonnegative()}),items:e.YO(bj)}).meta({id:"HarnessEventsResponse"}),e.Ik({jobId:e.Yj(),startedAt:_.w$()}).meta({id:"RescanResponse"}),e.Ik({repo:e.Yj()}).meta({id:"ConnectProjectBody"}),e.Ik({type:e.YO(a1).optional(),q:e.Yj().optional()}),e.Ik({path:e.Yj().optional(),q:e.Yj().optional(),filter:e.k5(["blocked"]).optional()}),e.Ik({path:e.Yj()}),e.Ik({limit:aa.ai().int().min(1).max(50).default(7)});let bk=e.k5(["provider","internal","external","ip"]).meta({id:"DestinationKind"}),bl=e.k5(["https","http","sftp","grpc","smtp","ws","wss"]).meta({id:"Transport"}),bm=e.k5(["secrets","pii","customer","source","telemetry","logs","metrics","none"]).meta({id:"DataClass"}),bn=bm.options,bo=e.k5(["recognized","internal","unverified","ip"]).meta({id:"ShareTrustLevel"}),bp=e.k5(["allow","block"]).meta({id:"EgressDecision"}),bq=e.k5(["allowed","blocked","review"]).meta({id:"EgressStatus"}),br=e.k5(["raw_ip","unverified_domain","plaintext_transport"]).meta({id:"ReviewReason"}),bs=e.k5(["GET","POST","PUT","DELETE","SDK","REF"]).meta({id:"HttpMethod"}),bt=e.Ik({needsReview:e.zM(),reasons:e.YO(br)}).meta({id:"ReviewInfo"}),bu=e.Ik({port:e.ai().int().nullable(),geo:e.Yj().nullable(),ptr:e.Yj().nullable()}).meta({id:"DestinationNetwork"}),bv=e.Ik({id:e.Yj(),method:bs,transport:bl,url:e.Yj(),template:e.zM(),dataClass:bm,lastSeen:_.w$(),callSiteCount:e.ai().int().nonnegative()}).meta({id:"EndpointSummary"}),bw=e.Ik({id:e.Yj(),project:e.Yj(),file:e.Yj(),line:e.ai().int().nonnegative(),snippet:e.Yj(),dynamic:e.zM(),vendored:e.zM(),projectId:e.Yj().nullable()}).meta({id:"CallSite"}),bx=bv.extend({sites:e.YO(bw)}).meta({id:"EndpointWithSites"}),by=e.Ik({id:e.Yj(),kind:bk,name:e.Yj(),host:e.Yj(),category:e.Yj(),trust:bo,status:bq,isCustom:e.zM(),lastSeen:_.w$(),endpointCount:e.ai().int().nonnegative(),callSiteCount:e.ai().int().nonnegative(),transports:e.YO(bl),dataClasses:e.YO(bm),review:bt,network:bu.nullable(),endpoints:e.YO(bv)}).meta({id:"ShareDestinationSummary"});by.omit({endpointCount:!0,callSiteCount:!0,endpoints:!0}).extend({note:e.Yj().nullable(),endpoints:e.YO(bx)}).meta({id:"ShareDestinationDetail"});let bz=e.Ik({id:e.Yj(),kind:bk,name:e.Yj(),host:e.Yj(),trust:bo,status:bq,review:bt,topDataClass:bm,callSiteCount:e.ai().int().nonnegative(),lastSeen:_.w$()}).meta({id:"ReviewDestination"}),bA=e.Ik({kind:bk,total:e.ai().int().nonnegative(),items:e.YO(by)}).meta({id:"ShareDestinationGroup"});e.Ik({groups:e.YO(bA)}).meta({id:"ListShareDestinationsResponse"}),e.Ik({items:e.YO(bz)}).meta({id:"NeedsReviewResponse"}),e.Ik({destinations:e.ai().int().nonnegative(),endpoints:e.ai().int().nonnegative(),callSites:e.ai().int().nonnegative(),needsReview:e.ai().int().nonnegative(),insecure:e.ai().int().nonnegative(),byKind:e.Ik({provider:e.ai().int().nonnegative(),internal:e.ai().int().nonnegative(),external:e.ai().int().nonnegative(),ip:e.ai().int().nonnegative()}),byTrust:e.Ik({recognized:e.ai().int().nonnegative(),internal:e.ai().int().nonnegative(),unverified:e.ai().int().nonnegative(),ip:e.ai().int().nonnegative()})}).meta({id:"SharesStats"}),e.Ik({decision:bp.nullable()}).meta({id:"SetEgressDecisionBody"}),e.Ik({destination:by}).meta({id:"SetEgressDecisionResponse"}),e.Ik({q:e.Yj().optional(),kind:e.YO(bk).optional(),groupBy:e.k5(["destination"]).default("destination"),review:e.uE().default(!1)}),e.Ik({format:e.k5(["csv","json"]).default("csv"),q:e.Yj().optional(),kind:e.YO(bk).optional()});let bB=e.k5(["npm","pypi","go","maven","rubygems","cargo","composer","nuget"]).meta({id:"EgressEcosystem"});e.Ik({id:e.Yj(),name:e.Yj(),category:e.Yj(),hostSuffixes:e.YO(e.Yj()).min(1),apiBase:e.Yj(),defaultDataClasses:e.YO(bm).min(1),sdks:e.jg(bB,e.YO(e.Yj()))}).meta({id:"ProviderRegistryEntry"});let bC=e.Ik({file:e.Yj(),line:e.ai().int().positive(),snippet:e.Yj(),dynamic:e.zM(),vendored:e.zM()}).meta({id:"EgressCallSiteHit"}),bD=e.Ik({host:e.Yj(),kind:bk,name:e.Yj(),category:e.Yj(),trust:bo,network:bu.nullable(),method:bs,transport:bl,url:e.Yj(),template:e.zM(),dataClass:bm,site:bC}).meta({id:"ResolvedEgressHit"}),bE=e.gM("mode",[e.Ik({mode:e.eu("walk"),walkedPrefix:e.Yj()}),e.Ik({mode:e.eu("ledger"),scannedFiles:e.YO(e.Yj()),deletedFiles:e.YO(e.Yj())})]).meta({id:"EgressReconcile"});e.Ik({projectKey:e.Yj().min(1),project:e.Yj(),projectId:e.Yj().nullable(),reconcile:bE,hits:e.YO(bD)}).meta({id:"RecordProjectEgressInput"}),e.Ik({destinations:e.ai().int().nonnegative(),endpoints:e.ai().int().nonnegative(),callSites:e.ai().int().nonnegative(),truncated:e.zM(),droppedFiles:e.YO(e.Yj()).default([])}).meta({id:"EgressWriteSummary"});let bF="control-plane-credential.json",bG=e.Ik({specVersion:e.eu(1),endpoint:e.Yj().min(1),apiKey:e.Yj().min(1),keyPrefix:e.Yj().min(1).max(16).optional(),mintedAt:_.w$().optional()}),bH=e.Ik({packId:e.Yj().min(1),version:e.Yj().min(1),enabled:e.zM(),updatedAt:e.Yj().nullable()}).meta({id:"StorePosturePack"}),bI=e.Ik({total:e.ai().int().min(0),disabled:e.ai().int().min(0),byAction:e.Ik({warn:e.ai().int().min(0),redact:e.ai().int().min(0),block:e.ai().int().min(0),allow:e.ai().int().min(0),log:e.ai().int().min(0)}).strict()}).meta({id:"StorePosturePolicyCounts"}),bJ=e.Ik({package:e.Yj().min(1).max(200),version:e.Yj().min(1).max(64),ossVersion:e.Yj().max(64).nullable(),policyBundleVersion:e.Yj().max(200).nullable(),policyFetchedAt:e.ai().int().min(0).max(0xe677d21fdbff).nullable()}).meta({id:"StorePosturePlugin"});e.Ik({deviceId:e.Os(),hostname:e.Yj().min(1).max(253),capturedAt:e.ai().int().min(0).max(0xe677d21fdbff),storePresent:e.zM(),schemaVersion:e.ai().int().min(0).max(0x7fffffff).nullable(),findingsTotal:e.ai().int().min(0).max(0x7fffffff),findingsFirstAt:e.ai().int().min(0).max(0xe677d21fdbff).nullable(),findingsLastAt:e.ai().int().min(0).max(0xe677d21fdbff).nullable(),packs:e.YO(bH).max(500),policyCounts:bI,plugin:bJ.optional()}).meta({id:"StorePostureSnapshot"});let bK="capture/",bL=aL.extend({inspections:e.YO(aI).default([])}).refine(a=>a.inspections.every(a=>!a.ruleVersion.startsWith(bK)),{message:`inspections[].ruleVersion must not start with \`${bK}\` — that namespace is reserved for capture definitions the control plane mints itself`,path:["inspections"]}).meta({id:"RecordAuditEventRequest"});e.Ik({events:e.YO(bL).min(1).max(50)}).meta({id:"RecordAuditEventBatch"});let bM=e.Ik({host:e.Yj(),kind:bk,name:e.Yj(),category:e.Yj(),trust:bo,network:bu.nullable(),method:bs,transport:bl,url:e.Yj(),template:e.zM(),dataClass:bm,site:e.Ik({file:e.Yj(),line:e.ai().int().positive(),dynamic:e.zM(),vendored:e.zM()})}).meta({id:"EgressIngestHit"});e.Ik({projectKey:e.Yj().regex(/^[0-9a-f]{64}$/,"projectKey must be a 64-character lowercase hex digest"),project:e.Yj(),reconcile:bE,hits:e.YO(bM)}).meta({id:"EgressIngestRequest"}),e.Ik({accepted:e.ai().int().nonnegative(),duplicates:e.ai().int().nonnegative()}),e.Ik({accepted:e.ai().int().nonnegative()});let bN=/^[^\p{Cc}\p{Cf}]*$/u,bO=a=>e.Yj().max(a).regex(bN,"must not contain control characters");e.Ik({tenantName:bO(200),userEmail:bO(320),role:bO(64),keyKind:bO(64),serverTime:bO(64)}),e.Ik({error:e.Ik({code:e.Yj().optional(),message:e.Yj().optional()}).optional()}),e.Ik({deviceId:bO(128).min(1),hostname:bO(255).min(1),os:bO(64).min(1),cliVersion:bO(64).min(1),label:bO(200).optional()}).meta({id:"AttachDeviceRequest"}),e.Ik({deviceCode:bO(128).min(1)}).meta({id:"AttachTokenRequest"}),e.Ik({deviceCode:bO(128),userCode:bO(32),verificationUri:bO(512),verificationUriComplete:bO(512).optional(),expiresIn:e.ai().int().positive(),interval:e.ai().int().positive()});let bP=e.Ik({status:e.eu("pending")}),bQ=e.Ik({status:e.eu("slow_down"),interval:e.ai().int().positive()}),bR=e.Ik({status:e.eu("denied"),message:bO(500).optional()}),bS=e.Ik({status:e.eu("expired")}),bT=e.Ik({status:e.eu("issued"),apiKey:e.Yj().min(1).max(512),endpoint:bO(512),tenantName:bO(200).optional(),userEmail:bO(320).optional()});e.KC([bT,bP,bQ,bR,bS,e.Ik({status:bO(64)})]);let bU=e.k5(["shares_rescan"]),bV=e.Ik({id:bO(128).min(1),kind:bU,issuedAt:bO(64).min(1),expiresAt:bO(64).min(1)}).strict();e.Ik({command:bV.nullable()});let bW=e.k5(["scan_failed","no_projects","expired"]);e.gM("outcome",[e.Ik({outcome:e.eu("reported"),projectsScanned:e.ai().int().nonnegative()}).strict(),e.Ik({outcome:e.eu("failed"),reason:bW,projectsScanned:e.ai().int().nonnegative()}).strict()]);let bX=e.Yj().regex(/^[a-z][a-z0-9-]*$/),bY=e.Yj().regex(/^[a-z][a-z0-9-]*$/),bZ=e.Yj().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?$/),b$=e.k5(["labs","user","org"]),b_=e.k5(["keyword","regex"]).meta({id:"MatcherType"});e.k5(["safe","quarantined"]).meta({id:"RuleProbeVerdict"});let b0=e.re({type:e.eu("keyword"),keywords:e.YO(e.Yj().min(1)).min(1),caseSensitive:e.zM().default(!1)});function b1(a){return a.replace(/[gy]/g,"")}let b2=e.re({type:e.eu("regex"),pattern:e.Yj().min(1).max(2e3),flags:e.Yj().default("gi"),captureGroup:e.ai().int().nonnegative().optional()}).refine(a=>(function(a,b){try{return new RegExp(a,b),!0}catch{return!1}})(a.pattern,a.flags),{message:"pattern/flags do not form a valid JavaScript regular expression",path:["pattern"]}).refine(a=>!function(a){return void 0===a||0===a}(a.captureGroup)||!function(a,b){try{let c=new RegExp(a,b1(b));return c.exec("")?.[0].length===0}catch{return!1}}(a.pattern,a.flags),{message:'a whole-match regex that can match the empty string (e.g. "\\d*", "a?", "(?:)") can hang the matcher — scope the quantifier to a captureGroup, or require at least one character',path:["pattern"]}).superRefine((a,b)=>{if(void 0===a.captureGroup)return;let c=function(a,b){try{let c=RegExp(`${a}|`,b1(b)).exec("");return c?c.length-1:void 0}catch{return}}(a.pattern,a.flags);void 0===c||a.captureGroup<=c||b.addIssue({code:"custom",path:["captureGroup"],message:`captureGroup ${String(a.captureGroup)} is out of range — the pattern declares ${String(c)} capture group(s), so valid values are 0-${String(c)}. An out-of-range group never matches, which would make the rule silently never fire.`})}),b3=e.gM("type",[b0,b2]).meta({id:"Matcher"});b_.options;let b4=e.re({extensions:e.YO(e.Yj().regex(/^\.[A-Za-z0-9]+$/)).min(1)}).meta({id:"AppliesTo"}),b5=e.k5(["entropy","luhn"]).meta({id:"PostValidatorName"}),b6=e.KC([b5,e.re({name:b5,config:e.g1(e.Yj(),e.L5()).optional()})],{error:()=>`not a valid post-validator: use a bare name (${b5.options.map(a=>JSON.stringify(a)).join(" or ")}) or { "name": ..., "config": { ... } }. An unrecognized name would be a false-positive guard that never runs.`}).meta({id:"PostValidatorRef"}),b7=e.re({categories:e.YO(ag).min(1).optional(),ruleIds:e.YO(e.Yj().min(1)).min(1).optional(),labels:e.YO(e.Yj().min(1)).min(1).optional(),windowChars:e.ai().int().positive().default(160),confidenceBoost:e.ai().min(0).max(.3).optional()}).refine(a=>(a.categories?.length??0)+(a.ruleIds?.length??0)+(a.labels?.length??0)>0,{message:"requiresNearby needs at least one of categories, ruleIds, or labels"}).meta({id:"RequiresNearby"});e.re({label:e.Yj(),text:e.Yj().max(5e4),shouldMatch:e.zM(),filePath:e.Yj().optional(),expectedSpans:e.YO(e.re({start:e.ai(),end:e.ai()})).optional()}).meta({id:"RuleFixture"});let b8=e.re({specVersion:e.eu(1),id:e.Yj().regex(/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/),name:e.Yj(),category:ag,severity:ah,matcher:b3,appliesTo:b4.optional(),postValidators:e.YO(b6).optional(),requiresNearby:b7.optional(),examples:e.YO(e.Yj()).optional()}).meta({id:"Rule"}),b9=e.Ik({name:e.Yj(),email:e.Rp().optional(),url:e.OZ().optional()}).meta({id:"Author"});e.Ik({specVersion:e.eu(1),id:e.Yj(),name:e.Yj(),version:e.Yj(),rules:e.YO(e.Yj()),description:e.Yj().optional(),author:b9.optional(),license:e.Yj().optional(),sourceUrl:e.OZ().optional()}).meta({id:"PackManifest"});let ca=e.k5(["library","custom"]).meta({id:"OriginEnum"}),cb=e.k5(["all","library","custom","customized","updates"]),cc=e.k5(["new","imported","update"]).meta({id:"LibraryStateEnum"}),cd=e.Ik({all:e.ai().int().nonnegative(),library:e.ai().int().nonnegative(),custom:e.ai().int().nonnegative(),customized:e.ai().int().nonnegative(),updates:e.ai().int().nonnegative()}).meta({id:"DetectionCounts"}),ce=e.Ik({id:e.Yj(),name:e.Yj(),version:bZ,enabled:e.zM(),origin:ca,publisher:bX.optional(),publisherKind:b$.optional(),ruleCount:e.ai().int().nonnegative(),namespace:bX,packId:bY,policyId:e.Yj().optional(),latestVersion:bZ.optional()}).meta({id:"DetectionListItem"});e.Ik({counts:cd,items:e.YO(ce)}).meta({id:"ListDetectionsResponse"}),e.Ik({filter:cb.optional().default("all"),q:e.Yj().optional()}),e.Ik({detections:e.ai().int().nonnegative(),rules:e.ai().int().nonnegative(),active:e.ai().int().nonnegative(),findingsLast30d:e.ai().int().nonnegative()}).meta({id:"DetectionStats"});let cf=e.Ik({id:e.Yj(),name:e.Yj(),category:ag,severity:ah,matcher:b3,appliesTo:b4.optional(),postValidators:e.YO(b6).optional(),requiresNearby:b7.optional(),examples:e.YO(e.Yj()).optional()}).meta({id:"DetectionRule"}),cg=e.Ik({available:e.zM(),latestVersion:bZ,latestRuleCount:e.ai().int().nonnegative().optional()}).nullable().meta({id:"DetectionUpdate"});e.Ik({id:e.Yj(),name:e.Yj(),version:bZ,enabled:e.zM(),origin:ca,publisher:bX.optional(),publisherKind:b$.optional(),ruleCount:e.ai().int().nonnegative(),namespace:bX,packId:bY,description:e.Yj().optional(),editedAt:_.w$(),findingsLast30d:e.ai().int().nonnegative(),latestVersion:bZ.nullable().optional(),update:cg,rules:e.YO(cf),modified:e.zM(),policyId:e.Yj().optional()}).meta({id:"DetectionDetail"});let ch=e.Ik({id:e.Yj(),name:e.Yj(),publisher:bX,publisherKind:b$.optional(),category:ag.optional(),version:bZ,ruleCount:e.ai().int().nonnegative(),description:e.Yj().optional(),updatedAt:_.w$(),state:cc,importedAs:e.Yj().nullable()}).meta({id:"LibraryItem"});function ci(a,b,c){return void 0!==c&&b.success&&void 0!==b.data?{[a]:b.data}:{}}e.Ik({categories:e.YO(ag),items:e.YO(ch)}).meta({id:"ListLibraryResponse"}),e.Ik({libraryId:e.Yj().refine(a=>/^[^/]+\/[^/]+$/.test(a),{message:"libraryId must be in namespace/packId format"})}).meta({id:"ImportDetectionRequest"});let cj={library:!0,custom:!0};function ck(a){return null!=a&&Object.hasOwn(cj,a)?a:"library"}function cl(a){return{id:`${a.namespace}/${a.packId}`,name:a.name,version:a.version,enabled:a.enabled,origin:ck(a.origin),namespace:a.namespace,packId:a.packId,ruleCount:a.ruleCount,...null!=a.policyId?{policyId:a.policyId}:{},...null!=a.latestVersion?{latestVersion:a.latestVersion}:{}}}function cm(a,b,c){let d=a.rules.flatMap(a=>{var b;let c=b3.safeParse(a.matcher);return c.success?[{id:a.id,name:a.name,category:a.category,severity:a.severity,matcher:c.data,...ci("appliesTo",b4.safeParse(a.appliesTo),a.appliesTo),...ci("postValidators",b6.array().safeParse(a.postValidators),a.postValidators),...ci("requiresNearby",b7.safeParse(a.requiresNearby),a.requiresNearby),...ci("examples",{success:Array.isArray(b=a.examples)&&b.every(a=>"string"==typeof a),data:a.examples},a.examples)}]:[]});return{id:`${a.namespace}/${a.packId}`,name:a.name,version:a.version,enabled:a.enabled,origin:ck(a.origin),namespace:a.namespace,packId:a.packId,ruleCount:a.rules.length,editedAt:a.updatedAt.toISOString(),findingsLast30d:b,latestVersion:c?c.latestVersion:null,update:c,rules:d,modified:!1,...null!=a.policyId?{policyId:a.policyId}:{}}}function cn(a){let b=a.indexOf("/");return b<1||b===a.length-1?null:{namespace:a.slice(0,b),packId:a.slice(b+1)}}function co(a,b){let c=a.filter(a=>null!=a.latestVersion),d=a=>ck(a.origin),e={all:a.length,library:a.filter(a=>"library"===d(a)).length,custom:a.filter(a=>"custom"===d(a)).length,customized:0,updates:c.length},f=b.filter,g="customized"===f?[]:"custom"===f?a.filter(a=>"custom"===d(a)):"library"===f?a.filter(a=>"library"===d(a)):"updates"===f?[...c]:[...a];if(b.q){let a=b.q.toLowerCase();g=g.filter(b=>b.name.toLowerCase().includes(a)||b.packId.toLowerCase().includes(a)||b.namespace.toLowerCase().includes(a))}return g.sort((a,b)=>a.enabled!==b.enabled?a.enabled?-1:1:a.name.localeCompare(b.name)),{counts:e,items:g.map(cl)}}let cp=e.k5(["prompt","response","code_change","tool_use"]).meta({id:"EventKind"}),cq=cp.options.map(a=>`'${a}'`).join(","),cr=e.Ik({sessionId:e.Yj().optional(),repo:e.Yj().optional(),filePath:e.Yj().optional(),toolName:e.Yj().optional(),gitignored:e.zM().optional(),wholeFile:e.zM().optional(),model:e.Yj().optional(),turnIndex:e.ai().int().nonnegative().optional(),correlationId:e.uR().optional(),traceId:e.Yj().regex(/^[0-9a-f]{32}$/).optional(),exceptionIds:e.YO(e.Os()).optional(),inspectionMs:e.ai().int().nonnegative().optional()}).meta({id:"EventMetadata"}),cs=e.Ik({id:e.Os(),sourceTool:ae,kind:cp,occurredAt:_.w$(),contentHash:e.Yj(),content:e.Yj(),metadata:cr.optional()}).meta({id:"Event"}).meta({id:"IngestEvent"});e.Ik({events:e.YO(cs).min(1).max(100),dedupe:e.eu("content-hash").optional()}).meta({id:"IngestBatch"});let ct=e.k5(["once","temporary","permanent"]),cu=e.Ik({repo:e.Yj().optional(),sourceTool:e.Yj().optional(),provider:e.Yj().optional()}).strict(),cv=e.k5(["suppress","reveal_to_model"]),cw=e.Ik({id:e.Os(),ruleId:e.Yj(),category:ag,valueFingerprint:e.Yj().regex(/^[0-9a-f]{64}$/),keyVersion:e.ai().int().positive(),maskedValue:e.Yj(),capability:cv.default("suppress"),scope:ct,expiresAt:_.w$().nullable(),maxUses:e.ai().int().positive().nullable(),useCount:e.ai().int().nonnegative(),lastUsedAt:_.w$().nullable(),justification:e.Yj().min(1),conditions:cu.nullable(),createdBy:e.Yj(),createdVia:e.k5(["cli-approve","cli-add","web-approve","web-add","api","setup-triage"]),createdAt:_.w$(),updatedAt:_.w$(),revokedAt:_.w$().nullable(),revokedBy:e.Yj().nullable(),revokeReason:e.Yj().nullable()}),cx=cw.pick({id:!0,ruleId:!0,valueFingerprint:!0,keyVersion:!0,capability:!0,expiresAt:!0,maxUses:!0,useCount:!0,conditions:!0});function cy(a){let{valueFingerprint:b,...c}=a;return c}function cz(a){let{valueFingerprint:b,...c}=a;return c}function cA(a,b){return"present"===b.status&&b.version===a}cw.omit({valueFingerprint:!0});let cB=e.Yj().optional();function cC(a){return({log:"monitored",block:"blocked",redact:"redacted",warn:"warned",allow:"allowed"})[a]??"allowed"}function cD(a){if("code_context"===a)return"source_code";let b=an.safeParse(a);return b.success?b.data:"custom"}function cE(a){return af[a]??ab.Api}e.Ik({reference:e.Yj(),scope:e.Yj(),reason:e.Yj(),confirmation:cB}),e.Ik({ruleId:e.Yj(),value:e.Yj(),scope:e.Yj(),reason:e.Yj(),confirmation:cB}),e.Ik({pointer:e.Yj(),scope:e.Yj(),justification:e.Yj(),confirmation:cB}),e.Ik({id:e.Yj(),reason:e.Yj()}),e.Ik({confirmation:e.Yj()});let cF=["open","handled","dismissed","resolved"];function cG(a){let b=new Set(a.filter(a=>void 0!==a));if(0!==b.size){for(let a of cF)if(b.has(a))return a}}function cH(a){return"code_change"!==a.kind?"handled":null===a.findingKey?"open":"resolved"===a.latestResolutionStatus?"resolved":"dismissed"===a.latestResolutionStatus?"dismissed":"open"}function cI(a,b={}){let c=b.overrides,d=b.packNames,e=b.aggregates,f=new Map;for(let b of a){let a=f.get(b.ruleId);a?a.push(b):f.set(b.ruleId,[b])}let g=[];for(let[a,b]of f){let f=b.map(a=>{let b=c?.get(a.id)??a.actionTaken;return{id:a.id,provider:cE(a.sourceTool),repo:a.repo,file:a.file,...void 0===a.toolName?{}:{toolName:a.toolName},...void 0===a.eventId?{}:{eventId:a.eventId},...void 0===a.sessionId?{}:{sessionId:a.sessionId},...void 0===a.user?{}:{user:a.user},action:cC(b),detectedAt:a.occurredAt,confidence:a.confidence,status:a.status}}),h=e?.get(a),i=h?[...h.users??[]].sort((a,b)=>a.name.localeCompare(b.name)||a.id.localeCompare(b.id)):function(a){let b=new Set,c=[];for(let d of a)void 0===d.user||b.has(d.user.id)||(b.add(d.user.id),c.push(d.user));return c}(f),j=h?.latestDetectedAt??b.reduce((a,b)=>b.occurredAt>a?b.occurredAt:a,b[0]?.occurredAt??new Date(0).toISOString()),k=new Set,l=(h?[...new Set(h.sourceTools.map(cE))].sort():f.map(a=>a.provider)).filter(a=>!k.has(a)&&(k.add(a),!0)),m=new Set(h?h.actionsTaken.map(cC):f.map(a=>a.action)),n=1===m.size?[...m][0]??null:null,o=b[0]?.severity??"low",p={id:a,name:d?.get(a)??null},q=cD(b[0]?.category??"custom"),r={id:`category:${q}`,name:q},s={maskedValue:b[0]?.maskedMatch??"",contextPrefix:""},t=cG(h?h.statusInputs.map(cH):f.map(a=>a.status)),u={id:a,category:q,subtype:a,severity:o,match:s,detection:p,policy:r,instanceCount:h?.instanceCount??f.length,providers:l,aggregateAction:n,latestDetectedAt:j,instances:f,status:t,...i.length>0?{users:i}:{}};h&&(cL.set(u,[...m]),void 0!==h.searchText&&cJ.set(u,cK(u,h.searchText))),g.push(u)}return g}let cJ=new WeakMap;function cK(a,b){return[a.subtype,a.category,a.match.maskedValue,a.policy.name,a.id,...a.instances.map(a=>a.repo),...a.instances.map(a=>a.file),...a.instances.map(a=>a.toolName?`via ${a.toolName}`:""),...a.instances.map(a=>a.id),...(a.users??[]).map(a=>a.name),...a.instances.map(a=>a.user?.name??""),...void 0===b?[]:[b]].join(" ").toLowerCase()}let cL=new WeakMap;function cM(a){let b=cL.get(a);if(void 0!==b)return b;let c=[...new Set(a.instances.map(a=>a.action))];return cL.set(a,c),c}function cN(a,b){let c=new Set(b),d=0;for(let b of a){if(void 0===b.count)return null;c.has(cH(b))&&(d+=b.count)}return d}function cO(a,b){let c=a;if(b.severity&&b.severity.length>0){let a=new Set(b.severity);c=c.filter(b=>a.has(b.severity))}if(b.providers&&b.providers.length>0){let a=new Set(b.providers);c=c.filter(b=>b.providers.some(b=>a.has(b)))}if(b.actions&&b.actions.length>0){let a=new Set(b.actions);c=c.filter(b=>cM(b).some(b=>a.has(b)))}if(b.subtype&&b.subtype.length>0){let a=new Set(b.subtype);c=c.filter(b=>a.has(b.subtype))}if(b.statuses&&b.statuses.length>0){let a=new Set(b.statuses);c=c.filter(b=>void 0!==b.status&&a.has(b.status))}if(b.q){let a=b.q.toLowerCase();c=c.filter(b=>(function(a){let b=cJ.get(a);if(void 0!==b)return b;let c=cK(a);return cJ.set(a,c),c})(b).includes(a))}return c}let cP={critical:0,high:1,medium:2,low:3};function cQ(a,b){let c=(cP[a.severity]??-1)-(cP[b.severity]??-1);if(0!==c)return c;let d=b.latestDetectedAt.localeCompare(a.latestDetectedAt);return 0!==d?d:a.id.localeCompare(b.id)}function cR(a){return[...a].sort(cQ)}function cS(a,b){let c=cO(a,{providers:b.providers,actions:b.actions,statuses:b.statuses,q:b.q,subtype:b.subtype}),d=new Map;for(let a of c)d.set(a.severity,(d.get(a.severity)??0)+1);let e=cO(a,{actions:b.actions,statuses:b.statuses,q:b.q,subtype:b.subtype,severity:b.severity}),f=new Map;for(let a of e)for(let b of a.providers)f.set(b,(f.get(b)??0)+1);let g=cO(a,{providers:b.providers,statuses:b.statuses,q:b.q,subtype:b.subtype,severity:b.severity}),h=new Map;for(let a of g)for(let b of cM(a))h.set(b,(h.get(b)??0)+1);let i=cO(a,{providers:b.providers,actions:b.actions,statuses:b.statuses,q:b.q,severity:b.severity}),j=new Map;for(let a of i)j.set(a.subtype,(j.get(a.subtype)??0)+1);let k=cO(a,{providers:b.providers,actions:b.actions,q:b.q,subtype:b.subtype,severity:b.severity}),l=new Map;for(let a of k)void 0!==a.status&&l.set(a.status,(l.get(a.status)??0)+1);let m=a=>[...a.entries()].map(([a,b])=>({value:a,count:b}));return{severity:m(d),provider:m(f),action:m(h),subtype:m(j),status:m(l)}}let cT=["severity","subtype","providers","actions","statuses","tools","repo","file","q"];function cU(a,b,c){for(let d of cT)if(d!==c&&!function(a,b,c){switch(c){case"severity":return!b.severity?.length||b.severity.includes(a.severity);case"subtype":return!b.subtype?.length||b.subtype.includes(a.ruleId);case"providers":return!b.providers?.length||b.providers.includes(cE(a.sourceTool));case"actions":return!b.actions?.length||b.actions.includes(cC(a.actionTaken));case"statuses":return!b.statuses?.length||void 0!==a.status&&b.statuses.includes(a.status);case"tools":return!b.tools?.length||void 0!==a.toolName&&b.tools.includes(a.toolName);case"repo":return void 0===b.repo||""===b.repo||a.repo===b.repo;case"file":return void 0===b.file||""===b.file||a.file===b.file;case"q":return!b.q||[a.ruleId,a.category,a.maskedMatch,a.repo,a.file,a.toolName?`via ${a.toolName}`:"",a.id,a.user?.name??""].join(" ").toLowerCase().includes(b.q.toLowerCase())}}(a,b,d))return!1;return!0}function cV(a){return[...a.entries()].map(([a,b])=>({value:a,count:b})).sort((a,b)=>b.count-a.count||a.value.localeCompare(b.value))}function cW(a,b){a.set(b,(a.get(b)??0)+1)}function cX(a){let b=new Map,c=new Map,d=new Map,e=new Map,f=new Map,g=new Map;return{add(h){cU(h,a,"severity")&&cW(b,h.severity),cU(h,a,"subtype")&&cW(c,h.ruleId),cU(h,a,"providers")&&cW(d,cE(h.sourceTool)),cU(h,a,"actions")&&cW(e,cC(h.actionTaken)),void 0!==h.status&&cU(h,a,"statuses")&&cW(f,h.status),void 0!==h.toolName&&cU(h,a,"tools")&&cW(g,h.toolName)},facets:()=>({severity:cV(b),subtype:cV(c),provider:cV(d),action:cV(e),status:cV(f),tool:cV(g)})}}function cY(a){let b=cD(a.category);return{id:a.id,provider:cE(a.sourceTool),repo:a.repo,file:a.file,...void 0===a.toolName?{}:{toolName:a.toolName},eventId:a.eventId,...void 0===a.sessionId?{}:{sessionId:a.sessionId},...void 0===a.user?{}:{user:a.user},action:cC(a.actionTaken),detectedAt:a.occurredAt,confidence:a.confidence,...void 0===a.status?{}:{status:a.status},groupId:a.ruleId,category:b,subtype:a.ruleId,severity:a.severity,match:{maskedValue:a.maskedMatch,contextPrefix:""},detection:{id:a.ruleId,name:null},policy:{id:`category:${b}`,name:b}}}let cZ={critical:0,high:1,medium:2,low:3};function c$(){return{instanceCount:0,maxSeverityRank:Number.MAX_SAFE_INTEGER,maxSeverity:"low",latestDetectedAt:"",statuses:[],ruleIds:new Set}}function c_(a,b){a.instanceCount+=1;let c=cZ[b.severity]??Number.MAX_SAFE_INTEGER-1;c<a.maxSeverityRank&&(a.maxSeverityRank=c,a.maxSeverity=b.severity),b.occurredAt>a.latestDetectedAt&&(a.latestDetectedAt=b.occurredAt),a.statuses.push(b.status),a.ruleIds.add(b.ruleId)}let c0=e.Ik({id:e.Os(),namespace:bX,packId:bY,version:bZ,name:e.Yj(),enabled:e.zM().default(!0),policyId:e.Yj().optional()}).meta({id:"InstalledPack"});e.Ik({namespace:bX,packId:bY,version:bZ}).meta({id:"InstallPackRequest"}),e.Ik({items:e.YO(c0)}).meta({id:"ListInstalledPacksResponse"}),e.Ik({enabled:e.zM().optional(),policyId:e.Yj().nullable().optional()}).refine(a=>Object.keys(a).some(b=>void 0!==a[b]),{message:"At least one field must be provided"}).meta({id:"PatchInstalledPackRequest"});let c1=e.k5(["global","repo","user"]).meta({id:"PolicyScope"}),c2=e.KC([e.Ik({ruleId:e.Yj()}),e.Ik({category:ag})]).meta({id:"PolicyTarget"}),c3=e.k5(["builtin","custom"]).meta({id:"PolicyKind"}),c4=e.k5(["builtin","authored"]).meta({id:"PolicyProvenance"}),c5=e.Ik({id:e.Os(),scope:c1,target:c2,action:ai,enabled:e.zM().default(!0),customKeywords:e.YO(e.Yj()).optional(),name:e.Yj().optional(),provenance:c4.optional()}).meta({id:"Policy"}),c6=e.Ik({version:e.Yj(),policies:e.YO(c5),rules:e.YO(b8).optional(),rulesComplete:e.zM().optional(),exceptions:e.YO(cx).optional(),reversibleRuleIds:e.YO(e.Yj()).optional(),ruleVersions:e.g1(e.Yj(),e.Yj()).optional(),prohibitedModels:e.YO(e.Yj()).optional(),customKeywords:e.YO(e.Yj()),fetchedAt:_.w$()}).meta({id:"PolicyBundle"});[...Object.keys(c6.shape),...Object.keys(c5.shape).map(a=>`policies.${a}`),...c2.options.flatMap(a=>"shape"in a?Object.keys(a.shape):[]).map(a=>`policies.target.${a}`),...Object.keys(cx.shape).map(a=>`exceptions.${a}`)].sort().join(",");let c7=["config"],c8=ag.options.filter(a=>!c7.includes(a)),c9={secret:"critical",financial:"critical",code_flaw:"critical",pii:"high",phi:"high",custom:"high",code_context:"low",config:"low"},da=["monitor","warn","redact","vault","block"],db=e.k5(da).meta({id:"BuiltinPolicyId"}),dc=db.extract(["monitor","warn","block"]).meta({id:"RedactFallback"}),dd=da,de={monitor:{name:"Monitor",action:"log",reversible:!1,description:"Log every match for audit. The request is allowed through untouched."},warn:{name:"Warn",action:"warn",reversible:!1,description:"Allow the request, but warn the user inline before it is sent."},redact:{name:"Redact",action:"redact",reversible:!1,description:"Strip the matched value from the request and destroy it, then continue. What was removed cannot be recovered."},vault:{name:"Redact & Vault",action:"redact",reversible:!0,description:"Strip the matched value from the request and keep an encrypted, recoverable copy in the local vault, leaving a pointer in its place. Needs the vault consent granted under Settings; without it this behaves as Redact."},block:{name:"Block",action:"block",reversible:!1,description:"Refuse the request entirely whenever any rule in this detection matches."}};function df(a){return de[a].action}let dg=[...new Set(da.map(df))],dh=[...aj.filter(a=>!dg.includes(a)),...dg];function di(a){return dh.indexOf(a)}function dj(a,b){return di(a)>=di(b)}function dk(a,b){return di(a)>=di(b)?a:b}function dl(a){return da.find(b=>dj(df(b),a))??"block"}e.Ik({floor:db,locked:e.zM()}).describe("PackPolicyFloor");let dm=da.filter(a=>!de[a].reversible);da.filter(a=>de[a].reversible);let dn=e.k5(dm).meta({id:"CategoryPolicyId"});function dp(a){let b=db.safeParse(a??ds);return de[b.success?b.data:ds].reversible}let dq=Object.fromEntries(ag.options.map(a=>[a,df(function(a){if(c7.includes(a))return"monitor";let b=c9[a];return"critical"===b||"high"===b?"warn":"monitor"}(a))])),dr=Object.fromEntries(da.map(a=>[a,{id:a,...de[a]}])),ds="monitor";function dt(a){let b=db.safeParse(a??ds);return dr[b.success?b.data:ds].action}let du=e.Ik({id:e.Yj(),name:e.Yj(),ruleCount:e.ai().int().nonnegative(),enabled:e.zM()}).meta({id:"UsedByItem"}),dv=e.Ik({id:e.Yj(),kind:c3,name:e.Yj(),enabled:e.zM(),usedByCount:e.ai().int().nonnegative()}).meta({id:"PolicyListItem"});e.Ik({items:e.YO(dv)}).meta({id:"ListPoliciesResponse"}),e.Ik({specVersion:e.eu(1),id:e.Yj(),kind:c3,name:e.Yj(),enabled:e.zM(),description:e.Yj(),usedBy:e.YO(du)}).meta({id:"PolicyDetail"}),e.Ik({policies:e.ai().int().nonnegative(),builtin:e.ai().int().nonnegative(),custom:e.ai().int().nonnegative(),detectionsGoverned:e.ai().int().nonnegative()}).meta({id:"PolicyStatsResponse"});let dw=2,dx=ag.options.join("|"),dy=RegExp(`\\[\\[aka:(?:${dx}):[A-Z2-7]{2,7}\\.[A-Z2-7]{26}\\.[A-Z2-7]{16}\\]\\]`),dz=RegExp(`^${dy.source}$`);e.Yj().regex(dz),e.Ik({category:ag,keyVersion:e.ai().int().positive(),pointerId:e.Yj(),tag:e.Yj()}),e.Ik({pointerId:e.Yj(),valueFingerprint:e.Yj().regex(/^[0-9a-f]{64}$/),fingerprintKeyVersion:e.ai().int().positive(),keyVersion:e.ai().int().positive(),category:ag,ruleId:e.Yj(),maskedMatch:e.Yj(),provider:e.Yj().optional(),ciphertext:e.Yj(),nonce:e.Yj(),authTag:e.Yj(),occurrenceCount:e.ai().int().nonnegative(),userAuthorized:e.zM(),firstSeen:e.Yj(),lastSeen:e.Yj()}),e.Ik({category:ag,provider:e.Yj().optional(),maskedMatch:e.Yj(),occurrences:e.ai().int().nonnegative(),firstSeen:e.Yj(),lastSeen:e.Yj()}),e.Ik({ruleId:e.Yj(),valueFingerprint:e.Yj().regex(/^[0-9a-f]{64}$/),fingerprintKeyVersion:e.ai().int().positive()});let dA=e.k5(["human","model"]),dB=e.k5(["display","explicit-reveal","view-render","model-input","remediation","purge"]),dC=e.k5(["revealed","refused","unavailable"]),dD=e.Ik({id:e.Os(),pointerId:e.Yj(),at:e.Yj(),target:dA,reason:dB,outcome:dC,grantId:e.Yj().optional(),pointerCount:e.ai().int().positive().default(1)}),dE=e.k5(["prompt","tool-input","tool-output","file","transcript"]),dF=e.Ik({location:e.Yj(),kind:dE,firstSeen:e.Yj(),lastSeen:e.Yj()}),dG=e.Ik({pointerId:e.Yj(),category:ag,provider:e.Yj().optional(),maskedMatch:e.Yj(),occurrences:e.ai().int().nonnegative(),firstSeen:e.Yj(),lastSeen:e.Yj(),revealGrantId:e.Yj().nullable(),sightings:e.YO(dF)}),dH=50,dI=50,dJ=200;e.Ik({limit:aa.ai().int().min(1).max(dJ).optional(),cursor:e.Yj().optional()}),e.Ik({totals:e.Ik({values:e.ai().int().nonnegative()}),items:e.YO(dG),nextCursor:e.Yj().nullable()}),e.Ik({limit:aa.ai().int().min(1).max(dJ).optional(),cursor:e.Yj().optional()}),e.Ik({totals:e.Ik({reused:e.ai().int().nonnegative()}),items:e.YO(dG),nextCursor:e.Yj().nullable()}),e.Ik({includeBatched:e.zM().optional(),limit:aa.ai().int().min(1).max(dJ).optional(),cursor:e.Yj().optional()}),e.Ik({items:e.YO(dD),nextCursor:e.Yj().nullable(),hiddenBatched:e.ai().int().nonnegative()});let dK=e.Yj(),dL=e.k5(["masked","full","off"]),dM=1,dN=e.Ik({acknowledgedAt:_.w$(),version:e.ai().int().positive()});function dO(a){return a?.version===dM}let dP=1,dQ=e.k5(["standalone","attached"]),dR=e.Ik({endpoint:e.Yj().min(1),label:e.Yj().min(1).optional(),attachedAt:_.w$()}).meta({id:"ControlPlaneConnection"}),dS=e.k5(["redact","warn"]),dT=e.k5(["full","session-only"]),dU=e.Ik({acknowledgedAt:_.w$(),payloadVersion:e.ai().int().positive()}),dV=e.Ik({acknowledgedAt:_.w$(),payloadVersion:e.ai().int().positive(),endpoint:e.Yj()}),dW=e.Ik({specVersion:e.ai().int().positive().default(7),runMode:dQ.default("standalone"),controlPlane:dR.optional(),policy:dS.default("redact"),historicalAccess:dT.default("session-only"),dataSharesInPlace:e.zM().default(!0),vaultConsent:dN.optional(),vaultKeyCustody:dK.default("file"),vaultInlineReveal:dL.default("masked"),redactFallback:dc.default("warn"),onboardedAt:_.w$().optional(),modelJudgeConsent:dU.optional(),historySyncConsent:dV.optional()});function dX(){return dW.parse({})}function dY(a){return"attached"===a.runMode&&void 0!==a.controlPlane}function dZ(a,b,c){return{id:b,objectType:a.objectType,location:a.location??null,title:a.title??null,hostId:a.hostId??null,attributes:JSON.stringify(a.attributes),firstSeen:c,lastSeen:c}}function d$(a,b,c){return{id:b,url:a.url,name:a.name??null,attributes:JSON.stringify(a.attributes),firstSeen:c,lastSeen:c}}function d_(a){return{id:a.id,parentId:a.parentId??null,rootSessionId:a.rootSessionId??null,eventType:a.eventType,hostId:a.hostId??null,harnessId:a.harnessId??null,sourceProjectId:a.sourceProjectId??null,startedAt:S(a.startedAt),endedAt:a.endedAt?S(a.endedAt):null,severity:a.severity??null,priority:a.priority??null,content:a.content??null,contentHash:a.contentHash??null,attributes:a.attributes?JSON.stringify(a.attributes):null}}function d0(a,b){return{id:b,class:a.class,label:a.label??null,attributes:a.attributes?JSON.stringify(a.attributes):null}}function d1(a,b){return{id:b,ruleId:a.ruleId,name:a.name,category:a.category,severity:a.severity,definition:a.definition,version:a.version}}function d2(a){return{id:a.id,auditEventId:a.auditEventId,inspectionDefinitionId:a.inspectionDefinitionId,classifiedDataId:a.classifiedDataId??null,spanStart:a.span.start,spanEnd:a.span.end,maskedMatch:a.maskedMatch,actionTaken:a.actionTaken,confidence:a.confidence,findingKey:a.findingKey??null,firstDetectedAt:a.firstDetectedAt?S(a.firstDetectedAt):null}}function d3(a){let b=a.metadata;return{source_tool:a.sourceTool,...b?.repo!==void 0?{repo:b.repo}:{},...b?.filePath!==void 0?{file_path:b.filePath}:{},...b?.toolName!==void 0?{tool_name:b.toolName}:{},...b?.gitignored!==void 0?{gitignored:b.gitignored}:{},...b?.wholeFile!==void 0?{whole_file:b.wholeFile}:{},...b?.correlationId!==void 0?{correlation_id:b.correlationId}:{},...b?.traceId!==void 0?{trace_id:b.traceId}:{},...b?.exceptionIds!==void 0?{exception_ids:b.exceptionIds}:{},...b?.inspectionMs!==void 0?{inspection_ms:b.inspectionMs}:{},...b?.model!==void 0?{model:b.model}:{},...b?.turnIndex!==void 0?{turn_index:b.turnIndex}:{}}}function d4(a){return`capture/${a.category}/${a.severity}`}function d5(a){return{ruleId:a.ruleId,version:d4(a),name:a.ruleId,category:a.category,severity:a.severity,definition:JSON.stringify({ruleId:a.ruleId})}}let d6="managed-settings.json",d7=e.k5(["runMode","historicalAccess","vaultConsent","vaultKeyCustody","vaultInlineReveal","modelJudgeConsent","dataSharesInPlace","redactFallback"]).meta({id:"ManagedSettingKey"}),d8=e.Ik({runMode:e.k5(["standalone","attached"]).optional(),controlPlane:e.Ik({endpoint:e.Yj().min(1),label:e.Yj().min(1).optional()}).optional(),historicalAccess:e.k5(["full","session-only"]).optional(),vaultConsent:e.zM().optional(),vaultKeyCustody:e.k5(["file","keychain"]).optional(),vaultInlineReveal:e.k5(["masked","full","off"]).optional(),modelJudgeConsent:e.zM().optional(),dataSharesInPlace:e.zM().optional(),redactFallback:dc.optional()}).meta({id:"ManagedSettingsValues"}),d9=e.Ik({specVersion:e.ai().int().positive().default(1),organization:e.Yj().min(1).optional(),values:d8.default({}),lockedFields:e.YO(d7).default([])}).meta({id:"ManagedSettings"}),ea={present:!1,lockedFields:[]},eb=e.Ik({path:e.Yj().min(1),name:e.Yj().min(1),origin:a3,defaultAccess:a2});e.Ik({files:e.YO(eb),truncated:e.zM(),scannedAt:e.Yj()});let ec=["7d","30d","3m","6m"],ed=e.k5(ec).meta({id:"TimeRange"}),ee={"7d":7,"30d":30,"3m":90,"6m":180},ef=ed.catch("7d");function eg(a){return ef.parse(a)}let eh=e.k5(["still-valid","unknown","invalid"]),ei=e.Ik({filePath:e.Yj(),span:ak.optional()}).strict(),ej=e.Ik({provider:e.Yj(),maskedToken:e.Yj(),where:ei,state:eh,observedAt:_.w$().optional()}).strict();e.Ik({provider:e.Yj(),maskedToken:e.Yj(),consolePath:e.Yj(),occurrenceSpread:e.ai().int().positive()}).strict();let ek=e.k5(["redact-rotation-checklist","redact-only","set-secret-redact","leave"]),el=e.k5(["first-run","pre-push","secret-scan"]);e.Ik({entrySource:el}).strict();let em=e.Ik({id:ek,label:e.Yj()}),en=e.Ik({kind:e.eu("decision"),entrySource:el,secretCount:e.ai().int().positive(),prompt:e.Yj(),options:e.PV([em.extend({id:e.eu("redact-rotation-checklist")}),em.extend({id:e.eu("redact-only")}),em.extend({id:e.eu("set-secret-redact")}),em.extend({id:e.eu("leave")})])}),eo=e.Ik({kind:e.eu("no-decision")});e.gM("kind",[en,eo]);let ep=e.Ik({severity:ah,count:e.ai().int().nonnegative(),caught:e.ai().int().nonnegative().optional(),openAtRest:e.ai().int().nonnegative().optional()}).meta({id:"SeveritySummaryItem"});e.Ik({total:e.ai().int().nonnegative(),needsRemediation:e.ai().int().nonnegative().optional(),bySeverity:e.YO(ep)}).meta({id:"SeveritySummaryResponse"}),e.Ik({range:e.k5(ec).default("7d")});let eq=e.k5(["blocked","redacted","warned"]).meta({id:"EnforcementActionKind"}),er=e.Ik({kind:eq,count:e.ai().int().nonnegative(),delta:e.ai().int()}).meta({id:"EnforcementAction"});e.Ik({range:ed,total:e.ai().int().nonnegative(),actions:e.YO(er)}).meta({id:"EnforcementActionsResponse"});let es=e.k5(["day","week"]).meta({id:"TimeseriesGranularity"}),et=e.Ik({timestamp:_.p6(),critical:e.ai().int().nonnegative(),high:e.ai().int().nonnegative(),medium:e.ai().int().nonnegative()}).meta({id:"FindingsTimeseriesPoint"});e.Ik({range:ed,granularity:es,points:e.YO(et)}).meta({id:"FindingsTimeseriesResponse"});let eu=e.Ik({timestamp:_.p6(),bySeverity:e.Ik({critical:e.ai().nonnegative().nullable(),high:e.ai().nonnegative().nullable(),medium:e.ai().nonnegative().nullable(),low:e.ai().nonnegative().nullable()})}).meta({id:"MttrTrendPoint"});e.Ik({range:ed,granularity:es,points:e.YO(eu)}).meta({id:"MttrTrendResponse"});let ev=e.Ik({findingKey:e.Yj(),ruleId:e.Yj(),severity:ah,path:e.Yj(),resolvedAt:_.w$(),detectedAt:_.w$()}).meta({id:"ResolvedFeedItem"});e.Ik({items:e.YO(ev)}).meta({id:"RecentlyResolvedResponse"});let ew=["repo","user"],ex=e.k5(ew).meta({id:"SourceKind"}),ey=e.Ik({id:e.Yj(),name:e.Yj(),kind:ex,findingsCount:e.ai().int().nonnegative()}).meta({id:"TopSource"});e.Ik({range:ed,items:e.YO(ey)}).meta({id:"TopSourcesResponse"}),e.Ik({range:e.k5(ec).default("7d"),limit:aa.ai().int().min(1).max(50).default(5),kind:e.k5(ew).optional()});let ez=ac.extract(["ClaudeCode","Cursor","Codex","Antigravity","ClaudeAi","ChatGpt","Copilot","Api"]).meta({id:"Provider"}),eA=e.Ik({provider:ez,coverage:e.ai().int().min(0).max(100),supported:e.zM()}).meta({id:"ScanCoverageProvider"});e.Ik({range:ed,providers:e.YO(eA)}).meta({id:"ScanCoverageResponse"});let eB=e.k5(["repo","user","team","policy","share","rule"]).meta({id:"SubjectType"}),eC=e.Ik({type:eB,id:e.Yj(),label:e.Yj()}).meta({id:"RecommendationSubject"}),eD=e.k5(["apply","navigate"]).meta({id:"RecommendationActionMode"}),eE=e.Ik({mode:eD,type:e.Yj(),label:e.Yj(),href:e.Yj().optional(),policyId:e.Yj().optional(),teamId:e.Yj().optional()}).meta({id:"RecommendationAction"}),eF=e.Ik({id:e.Yj(),category:e.Yj(),severity:ah,title:e.Yj(),description:e.Yj(),subjects:e.YO(eC),action:eE}).meta({id:"RecommendedAction"});e.Ik({items:e.YO(eF)}).meta({id:"RecommendedActionsResponse"}),e.Ik({limit:aa.ai().int().min(1).max(20).default(3)});let eG=e.Ik({type:e.Yj(),policyId:e.Yj().optional(),teamId:e.Yj().optional()}).meta({id:"AppliedAction"});e.Ik({id:e.Yj(),status:e.eu("applied"),appliedAction:eG}).meta({id:"ApplyRecommendedActionResponse"}),e.Ik({id:e.Yj(),status:e.eu("dismissed")}).meta({id:"DismissRecommendedActionResponse"}),e.Ik({id:e.Yj()});let eH=e.k5(["granted","revoked","unchanged"]).meta({id:"HistorySyncConsentChoice"}),eI=e.k5(["granted","revoked","unchanged"]).meta({id:"ModelJudgeConsentChoice"});e.Ik({historicalAccess:e.Yj(),modelJudgeConsent:eI,historySyncConsent:eH,vaultConsent:e.Yj(),vaultInlineReveal:e.Yj()}),e.Ik({endpoint:e.Yj(),label:bO(200).optional(),accessKey:e.Yj()}),e.Ik({ruleId:e.Yj(),category:ag,severity:ah,maskedMatch:e.Yj(),rawMatch:e.Yj(),context:e.Yj(),filePath:e.Yj().optional(),confidence:e.ai().min(0).max(1),id:e.Yj().optional(),valueFingerprint:e.Yj().optional(),keyVersion:e.ai().int().nonnegative().optional()});let eJ=e.Ik({category:ag,action:dn,reasoning:e.Yj(),genuineCount:e.ai().int().nonnegative(),fpCount:e.ai().int().nonnegative(),fpIds:e.YO(e.Yj())});e.Ik({perCategory:e.YO(eJ),notes:e.Yj()});let eK=e.Ik({total:e.ai().int().nonnegative(),important:e.ai().int().nonnegative(),routine:e.ai().int().nonnegative()}).refine(a=>a.total===a.important+a.routine,{message:"total must equal important + routine",path:["total"]}),eL=e.Ik({ruleId:e.Yj(),category:ag,valueFingerprint:e.Yj(),keyVersion:e.ai().int().nonnegative()}),eM=e.Ik({pattern:e.Yj(),count:e.ai().int().nonnegative(),values:e.YO(eL).min(1)}),eN=e.Ik({category:ag,count:e.ai().int().nonnegative(),egress:e.zM()}),eO=e.Ik({counts:eK,routineCategories:e.YO(ag),surfacedCategories:e.YO(ag),findingKinds:e.YO(eN),posture:e.g1(ag,db),maskedFindings:e.YO(ej).optional(),falsePositivePatterns:e.YO(eM).optional()}),eP=eJ.pick({category:!0,genuineCount:!0,fpCount:!0}).extend({egress:e.zM()});e.Ik({categories:e.YO(eP),posture:e.g1(ag,db)}),e.Ik({frame:eO,copy:e.Yj()}),e.k5(["scan","floor"]);let eQ=e.Ik({id:e.k5(["enter-remediation","open-dashboard","not-now"]),label:e.Yj()}),eR=e.PV([eQ.extend({id:e.eu("open-dashboard")}),eQ.extend({id:e.eu("not-now")})]),eS=e.PV([eQ.extend({id:e.eu("enter-remediation")}),eQ.extend({id:e.eu("open-dashboard")}),eQ.extend({id:e.eu("not-now")})]);e.Ik({worthALook:e.ai().int().nonnegative(),liveKeys:e.ai().int().nonnegative().optional(),options:e.KC([eR,eS])}).refine(a=>a.options.some(a=>"enter-remediation"===a.id)===(a.liveKeys??0)>0,{message:"the chain-entry option is present exactly when liveKeys > 0",path:["options"]}).refine(a=>(a.liveKeys??0)<=a.worthALook,{message:"liveKeys is a subset of worthALook and cannot exceed it",path:["liveKeys"]});let eT=new Set(["recognized","internal"]);function eU(a){return eT.has(a)?"allowed":"review"}function eV(a){return"block"===a?"blocked":"allowed"}function eW(a,b){return null===b?eU(a):eV(b)}function eX(a,b){return null!==b&&eV(b)!==eU(a)}function eY(a,b,c){let d=function(a,b){let c=[];return"ip"===a&&c.push("raw_ip"),"unverified"===a&&c.push("unverified_domain"),(b.includes("http")||b.includes("ws"))&&c.push("plaintext_transport"),c}(a,b);return{needsReview:d.length>0&&!c,reasons:d}}function eZ(a){return Array.from(new Set(a))}function e$(a){let b=new Set(a);return bn.filter(a=>b.has(a))}function e_(a){return e$(a)[0]??"none"}let e0={raw_ip:0,unverified_domain:1,plaintext_transport:2};function e1(a){return 0===a.length?1/0:Math.min(...a.map(a=>e0[a]))}},49195:(a,b,c)=>{"use strict";c.d(b,{ThemeToggle:()=>k});var d=c(15008),e=c(71378),f=c(1505),g=c(54201);let h={light:"Light",dark:"Dark",system:"System"};function i({className:a}){return(0,d.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,focusable:!1,className:a,children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,d.jsx)("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"})]})}function j({className:a}){return(0,d.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,focusable:!1,className:a,children:(0,d.jsx)("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79Z"})})}function k(){let a=(0,f.useSyncExternalStore)(g.Mk,g.t$,g.Py),b=(0,f.useSyncExternalStore)(g.lr,g.Ud,g.LZ),c="system"===a?b?"dark":"light":a;return(0,d.jsxs)(e.rI,{children:[(0,d.jsx)(e.ty,{asChild:!0,children:(0,d.jsx)(e.$n,{variant:"ghost",tone:"neutral",size:"icon","aria-label":`Theme: ${h[a]}`,children:(0,d.jsx)("dark"===c?j:i,{className:"size-4"})})}),(0,d.jsx)(e.SQ,{align:"end",children:(0,d.jsx)(e.Hr,{value:a,onValueChange:a=>{(0,g.nk)(a)&&(0,g.pT)(a)},children:g.j0.map(a=>(0,d.jsx)(e.Ht,{value:a,children:h[a]},a))})})]})}},50467:(a,b,c)=>{"use strict";c.d(b,{ColumnsMenu:()=>o,FindingsToolbarView:()=>m});var d=c(15008),e=c(71378),f=c(51076),g=c(16820),h=c(63407),i=c(14129);let j=a=>a.charAt(0).toUpperCase()+a.slice(1),k=a=>a in h.x?h.x[a].label:a;function l(a,b,c){let d=new Set(a.map(a=>a.value));return[...a,...b.filter(a=>!d.has(a)).map(a=>({value:a,label:c(a),count:0}))]}function m({facets:a,filters:b,onFiltersChange:c,query:e,onQueryChange:h,findingCount:m,typeCount:o}){let p=new Map(a.severity.map(a=>[a.value,a.count])),q=i.oC.map(a=>({value:a,label:j(a),count:p.get(a)??0})),r=new Map(a.status.map(a=>[a.value,a.count])),s=i.pM.map(a=>({value:a,label:i.B5[a].label,count:r.get(a)??0})),t=l(a.subtype.map(a=>({value:a.value,label:a.value,count:a.count})),b.type,a=>a),u=l(a.provider.map(a=>({value:a.value,label:k(a.value),count:a.count})),b.provider,k),v=l(a.action.map(a=>({value:a.value,label:j(a.value),count:a.count})),b.action,j),w=(a,d)=>{c({...b,[a]:d})};return(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)("div",{className:"relative w-64",children:[(0,d.jsx)(g.WI,{className:"absolute left-3 top-1/2 size-4 -translate-y-1/2 text-text-3"}),(0,d.jsx)("input",{type:"text","aria-label":"Search findings",placeholder:"Search findings…",value:e,onChange:a=>{h(a.target.value)},className:"h-9 w-full rounded-lg border border-border-field bg-surface pl-9 pr-3 text-sm text-text placeholder:text-text-3 focus:border-primary focus:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40"})]}),(0,d.jsx)(n,{label:"Severity",options:q,selected:b.severity,onChange:a=>{w("severity",a)}}),(0,d.jsx)(n,{label:"Type",options:t,selected:b.type,onChange:a=>{w("type",a)}}),(0,d.jsx)(n,{label:"Provider",options:u,selected:b.provider,onChange:a=>{w("provider",a)}}),(0,d.jsx)(n,{label:"Action",options:v,selected:b.action,onChange:a=>{w("action",a)}}),(0,d.jsx)(n,{label:"Status",options:s,selected:b.status,onChange:a=>{w("status",a)}}),(0,d.jsx)("span",{className:"h-6 bg-border w-px"}),(0,d.jsxs)("span",{className:"text-sm text-text-3",children:[(0,d.jsx)("span",{className:"font-semibold text-text",children:f.jq.format(m)})," finding",1===m?"":"s"," \xb7"," ",(0,d.jsx)("span",{className:"font-semibold text-text",children:f.jq.format(o)})," type",1===o?"":"s"]})]})}function n({label:a,options:b,selected:c,onChange:f}){let h=c.length>0;return(0,d.jsxs)(e.AM,{children:[(0,d.jsxs)(e.Wv,{className:(0,e.cn)("inline-flex h-8 items-center gap-1.5 rounded-lg border px-3 text-sm font-medium transition-colors cursor-pointer",h?"border-primary bg-primary-tint text-primary":"border-border text-text-2 bg-surface hover:bg-surface-2"),children:[a,h&&(0,d.jsx)("span",{className:"flex size-4 items-center justify-center rounded-full bg-primary-solid text-[10px] font-semibold text-text-inv",children:c.length}),(0,d.jsx)(g.D3,{className:"size-3.5"})]}),(0,d.jsxs)(e.hl,{className:"min-w-52 max-h-80",children:[b.map(a=>{let b=c.includes(a.value);return(0,d.jsxs)("button",{type:"button",onClick:()=>{var b;b=a.value,f(c.includes(b)?c.filter(a=>a!==b):[...c,b])},className:"flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-text hover:bg-surface-2",children:[(0,d.jsx)("span",{className:(0,e.cn)("flex size-4 shrink-0 items-center justify-center rounded border",b?"border-primary-solid bg-primary-solid text-text-inv":"border-border"),children:b&&(0,d.jsx)(g.Sr,{className:"size-3"})}),(0,d.jsx)("span",{className:"flex-1",children:a.label}),void 0!==a.count&&(0,d.jsx)("span",{className:"text-xs tabular-nums text-text-3",children:a.count})]},a.value)}),h&&(0,d.jsx)("button",{type:"button",onClick:()=>{f([])},className:"mt-1 flex w-full cursor-pointer items-center rounded-md border-t border-border px-2 py-1.5 text-left text-sm text-text-2 hover:bg-surface-2",children:"Clear"})]})]})}function o({columns:a,visibility:b,onChange:c}){let f=a=>!1!==b[a],h=a.filter(a=>f(a.id)).length;return(0,d.jsxs)(e.AM,{children:[(0,d.jsx)(e.Wv,{asChild:!0,children:(0,d.jsxs)(e.$n,{variant:"outline",children:[(0,d.jsx)(g.Qf,{})," Columns"]})}),(0,d.jsx)(e.hl,{align:"end",className:"min-w-44 p-1",children:a.map(a=>{let i=f(a.id);return(0,d.jsxs)("button",{type:"button",onClick:()=>{i&&1===h?c({}):c({...b,[a.id]:!i})},className:"flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-text hover:bg-surface-2",children:[(0,d.jsx)("span",{className:(0,e.cn)("flex size-4 shrink-0 items-center justify-center rounded border",i?"border-primary-solid bg-primary-solid text-text-inv":"border-border"),children:i&&(0,d.jsx)(g.Sr,{className:"size-3"})}),a.header]},a.id)})})]})}},50754:(a,b,c)=>{"use strict";c.d(b,{SessionDetailView:()=>q});var d=c(15008),e=c(71378),f=c(1505),g=c(76836),h=c(16820),i=c(63407),j=c(88488),k=c(70124),l=c(42353),m=c(21459),n=c(24061);function o({text:a,mono:b=!1}){return(0,d.jsx)("span",{className:(0,e.cn)("block truncate",b&&"font-mono"),title:a,children:a})}function p({session:a,tokenReport:b,liveFindings:c,linkHref:p,toolHref:q,onExpand:r,overlayClose:s=!1,renderedAt:t}){let u=i.x[a.harness],v=(0,n.Tp)(a.tools),[w,x]=(0,f.useState)(!1);return(0,d.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,d.jsxs)("div",{className:(0,e.cn)("shrink-0 border-b border-border px-5 py-4",s&&"pr-14"),children:[(0,d.jsxs)("div",{className:"flex items-start gap-3.5",children:[(0,d.jsx)(i.K,{id:a.harness,size:40}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)("span",{className:"min-w-0 truncate font-display text-lg font-semibold text-text",title:a.title,children:a.title}),(0,d.jsx)(k.UD,{status:a.status})]}),(0,d.jsxs)("div",{className:"mt-1 flex items-center gap-2 text-ui text-text-3",children:[(0,d.jsxs)("span",{className:"shrink-0 whitespace-nowrap",children:[u.label," \xb7 ",n.Ay[a.harness]]}),(0,d.jsx)("span",{className:"shrink-0 text-text-3",children:"\xb7"}),(0,d.jsx)("span",{className:"min-w-0 truncate font-mono",title:a.id,children:a.id})]})]}),(0,d.jsxs)("div",{className:"flex shrink-0 gap-1",children:[r&&(0,d.jsx)(e.$n,{variant:"ghost",size:"sm",title:"Open this session in the full-width inspector","aria-label":"Open this session in the full-width inspector",onClick:r,children:(0,d.jsx)(h.mS,{"aria-hidden":!0,focusable:!1,className:"size-4"})}),(0,d.jsx)(e.$n,{variant:"ghost",size:"sm",title:"Export session data as JSON","aria-label":"Export session data as JSON",onClick:()=>{!function(a){if("undefined"==typeof document||"function"!=typeof URL.createObjectURL)return;let b=new Blob([JSON.stringify(a,null,2)],{type:"application/json"}),c=URL.createObjectURL(b),d=document.createElement("a");d.href=c,d.download=`session-${a.id.slice(0,12)}.json`,document.body.appendChild(d),d.click(),d.remove(),URL.revokeObjectURL(c)}(a)},children:(0,d.jsx)(h.s3,{"aria-hidden":!0,focusable:!1,className:"size-4"})})]})]}),(0,d.jsxs)("div",{className:"mt-3.5 grid 2xl:grid-cols-4 grid-cols-3 gap-x-4 gap-y-3 [&>*]:min-w-0",children:[(0,d.jsx)(g.p,{label:"Working dir",children:(0,d.jsx)(o,{text:a.cwd,mono:!0})}),(0,d.jsx)(g.p,{label:"Branch",children:(0,d.jsx)(k.Lw,{items:a.branches,mono:!0,nowrap:!0})}),(0,d.jsx)(g.p,{label:"Model",children:(0,d.jsx)(k.Lw,{items:a.models,mono:!0,nowrap:!0})}),(0,d.jsx)(g.p,{label:"Started",children:(0,d.jsx)(o,{text:`${(0,m.rw)(a.startedAt)} \xb7 ${(0,m.nt)(a.startedAt,new Date(t))}`})}),(0,d.jsx)(g.p,{label:"Duration",children:(0,d.jsx)(o,{text:(0,m.vV)(a.startedAt,a.endedAt,a.status,t)})}),(0,d.jsx)(g.p,{label:"Turns",children:a.turns}),(0,d.jsx)(g.p,{label:"Findings",children:a.findings>0||c?(0,d.jsxs)("span",{className:"flex items-center gap-x-1.5 overflow-hidden whitespace-nowrap",children:[a.findings>0&&(0,d.jsxs)("span",{className:"min-w-0 shrink truncate font-semibold text-sev-critical-ink",title:`${String(a.findings)} triggered — detection firings across this session's transcript; the same value fires once per event it appears in`,children:[a.findings," triggered"]}),a.findings>0&&c&&(0,d.jsx)("span",{className:"shrink-0 text-text-3",children:"\xb7"}),c&&(0,d.jsxs)("a",{href:c.href,className:"inline-flex shrink-0 items-center gap-0.5 font-semibold text-sev-critical-ink underline-offset-2 hover:underline",title:"Unique findings recorded by live enforcement — open in Findings",children:[c.count," enforced live",(0,d.jsx)(h.Qq,{"aria-hidden":!0,focusable:!1,className:"size-3.5"})]})]}):(0,d.jsx)("span",{className:"text-ok-ink",children:"None"})}),(0,d.jsx)(g.p,{label:"Egress",children:a.shares>0?`${String(a.shares)} destinations`:"None"})]})]}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-5 border-b border-border bg-surface-2 px-5 py-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3.5",children:[(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-ui",children:[(0,d.jsx)(h.Kp,{"aria-hidden":!0,focusable:!1,className:"size-3.5 text-text-3"}),(0,d.jsx)("b",{className:"font-semibold tabular-nums",children:(0,m.Sk)(a.tokens.inputTokens)}),(0,d.jsx)("span",{className:"text-text-3",children:"in"})]}),(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-ui",children:[(0,d.jsx)(h.ZL,{"aria-hidden":!0,focusable:!1,className:"size-3.5 text-text-3"}),(0,d.jsx)("b",{className:"font-semibold tabular-nums",children:(0,m.Sk)(a.tokens.outputTokens)}),(0,d.jsx)("span",{className:"text-text-3",children:"out"})]}),(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-ui",children:[(0,d.jsx)(h.DQ,{"aria-hidden":!0,focusable:!1,className:"size-3.5 text-primary"}),(0,d.jsxs)("b",{className:"font-semibold tabular-nums text-primary",children:[(0,m.fz)(a.tokens),"%"]}),(0,d.jsx)("span",{className:"text-text-3",children:"cache"})]}),b&&(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-ui",children:[(0,d.jsx)("b",{className:"font-semibold tabular-nums text-text",children:(0,m.xd)(b.estimatedCostUsd??0,b.costIsPartial)}),(0,d.jsx)("span",{className:"text-text-3",children:"est. cost"})]})]}),(0,d.jsx)("span",{className:"h-5 w-px bg-border"}),(0,d.jsxs)("div",{className:"flex flex-1 flex-wrap items-center gap-2 max-h-22 overflow-y-auto",children:[(0,d.jsxs)("span",{className:"text-xs font-semibold text-text-3",children:[(0,n.ni)(a.tools)," tool calls"]}),v.map(a=>(0,d.jsx)(k.zn,{name:a.name,n:a.n,...q?{href:q(a.name)}:{}},a.name))]})]}),b&&b.rollups.length>1&&(0,d.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-border bg-surface-2 px-5 py-2.5",children:[(0,d.jsx)("span",{className:"text-label font-semibold uppercase tracking-wider text-text-3",children:"Cost by model"}),b.rollups.map(a=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-surface py-0.5 px-2 text-xs text-text-2",children:[(0,d.jsx)("span",{className:"font-mono text-text",children:a.model}),(0,d.jsx)("span",{className:"tabular-nums text-text-3",children:(0,m.Sk)(a.totalTokens)}),(0,d.jsx)("span",{className:"tabular-nums text-text",children:null!==a.estimatedCostUsd?(0,m.UK)(a.estimatedCostUsd):"—"})]},`${a.provider} ${a.model}`))]}),(0,d.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-4.5",children:[(0,d.jsxs)("div",{className:"mb-4 flex items-center gap-2 text-label font-semibold uppercase tracking-wider text-text-3",children:[w?"Raw events":"Audit log",(0,d.jsx)("span",{className:"text-text-3",children:"\xb7"}),(0,d.jsxs)("span",{className:"font-mono text-label font-medium normal-case tracking-normal text-text-3",children:[a.events.length," events"]})]}),w?a.events.length>0?(0,d.jsx)("pre",{className:"overflow-x-auto rounded-lg border border-border bg-surface-2 p-3 text-label leading-relaxed text-text-2",children:JSON.stringify(a.events,null,2)}):(0,d.jsx)(j.A,{message:"No events recorded for this session yet"}):(0,d.jsx)(l.i,{events:a.events,...p?{linkHref:p}:{}})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-t border-border px-5 py-2.5 text-xs text-text-3",children:[(0,d.jsx)(h.k3,{"aria-hidden":!0,focusable:!1,className:"size-3.5"}),(0,d.jsx)("span",{className:"font-mono",children:"Source: ~/.claude/audit.log"}),(0,d.jsxs)(e.$n,{variant:"link",tone:"primary",className:"ml-auto text-ui",onClick:()=>{x(a=>!a)},children:[(0,d.jsx)(h.kp,{"aria-hidden":!0,focusable:!1,className:"size-3.5"}),w?"View timeline":"View raw events"]})]})]})}function q({session:a,isLoading:b,error:c,tokenReport:f,liveFindings:g,linkHref:h,toolHref:i,onExpand:k,overlayClose:l,renderedAt:m}){return c?(0,d.jsx)("div",{className:"grid h-full place-items-center p-6",children:(0,d.jsx)(j.r,{message:c})}):b&&!a?(0,d.jsxs)("div",{className:"flex h-full flex-col gap-4 p-5","aria-busy":!0,children:[(0,d.jsx)(e.EA,{className:"h-10 w-2/3"}),(0,d.jsx)(e.EA,{className:"h-24 w-full"}),(0,d.jsx)(e.EA,{className:"h-12 w-full"}),(0,d.jsx)(e.EA,{className:"h-40 w-full"})]}):a?(0,d.jsx)(p,{session:a,tokenReport:f??null,liveFindings:g??null,...h?{linkHref:h}:{},...i?{toolHref:i}:{},...k?{onExpand:k}:{},...l?{overlayClose:l}:{},renderedAt:m}):(0,d.jsx)("div",{className:"grid h-full place-items-center p-6",children:(0,d.jsx)(j.A,{message:"Select a session to view its audit timeline"})})}},51076:(a,b,c)=>{"use strict";c.d(b,{AW:()=>e.A,rJ:()=>e.r,jq:()=>d});let d=new Intl.NumberFormat("en-US");var e=c(88488)},51260:(a,b,c)=>{"use strict";c.d(b,{TimeRangeSelect:()=>i});var d=c(15008),e=c(71378),f=c(22567);function g(a){return(0,d.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",...a,children:[(0,d.jsx)("rect",{x:"4",y:"5",width:"16",height:"16",rx:"2"}),(0,d.jsx)("path",{d:"M4 9h16M8 3v4M16 3v4"})]})}function h(a){return(0,d.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",...a,children:(0,d.jsx)("path",{d:"m6 9 6 6 6-6"})})}function i({value:a,onChange:b}){let c=(0,f.QT)(a);return(0,d.jsxs)(e.rI,{children:[(0,d.jsx)(e.ty,{asChild:!0,children:(0,d.jsxs)(e.$n,{variant:"outline",size:"md",children:[(0,d.jsx)(g,{"aria-hidden":!0,focusable:!1,className:"size-4 text-text-3"}),c,(0,d.jsx)(h,{"aria-hidden":!0,focusable:!1,className:"size-3.5 text-text-3"})]})}),(0,d.jsx)(e.SQ,{align:"end",className:"w-44",children:(0,d.jsx)(e.Hr,{value:a,onValueChange:a=>{b(a)},children:f.hn.map(a=>(0,d.jsx)(e.Ht,{value:a.value,children:a.label},a.value))})})]})}},51775:(a,b,c)=>{"use strict";c.d(b,{DerefAuditTableView:()=>k});var d=c(15008),e=c(64145),f=c(71378),g=c(5265),h=c(40229);let i={revealed:"border-l-2 border-l-sev-critical bg-sev-critical-fill font-medium",refused:"border-l-2 border-l-sev-high bg-sev-high-fill font-medium"};function j({row:a}){return"model"===a.target&&"revealed"===a.outcome?(0,d.jsx)(f.Ex,{variant:"critical",children:"revealed"}):"refused"===a.outcome?(0,d.jsx)(f.Ex,{variant:"high",children:"refused"}):"unavailable"===a.outcome?(0,d.jsx)(f.Ex,{variant:"outline",children:"unavailable"}):(0,d.jsx)(f.Ex,{variant:"default",children:"revealed"})}function k({rows:a,hiddenBatched:b,showBatched:c,onToggleBatched:k,hasNextPage:l=!1,hasPreviousPage:m=!1,onNextPage:n,onPreviousPage:o,loadingNextPage:p=!1,pageStart:q,renderedAt:r}){let s=void 0===k?null:(0,d.jsx)(f.$n,{variant:"link",tone:"neutral",onClick:()=>{k(!c)},children:c?"Hide display/render resolutions":"Show them"}),t=!c&&b>0?(0,d.jsxs)("p",{className:"mt-3 flex items-center gap-2 text-xs text-text-3",children:[(0,d.jsxs)("span",{children:[String(b)," display/render"," ",1===b?"resolution":"resolutions"," hidden"]}),s]}):c&&void 0!==k?(0,d.jsx)("p",{className:"mt-3 text-xs text-text-3",children:s}):null,u=0===a.length;return!u||m||l?(0,d.jsxs)("div",{className:"overflow-x-auto rounded-xl border border-border bg-surface p-4",children:[u?(0,d.jsx)("div",{className:"py-10 text-center text-sm text-text-3",children:"These rows moved while you were reading. Step back to see the rest."}):(0,d.jsxs)(f.XI,{children:[(0,d.jsx)(f.A0,{children:(0,d.jsxs)(f.Hj,{children:[(0,d.jsx)(f.nd,{children:"When"}),(0,d.jsx)(f.nd,{children:"Reason"}),(0,d.jsx)(f.nd,{children:"Target"}),(0,d.jsx)(f.nd,{children:"Outcome"}),(0,d.jsx)(f.nd,{children:"Grant"}),(0,d.jsx)(f.nd,{children:"Pointers"})]})}),(0,d.jsx)(f.BF,{children:a.map(a=>"purge"===a.reason?(0,d.jsxs)(f.Hj,{"data-purge":"",className:"bg-surface-2",children:[(0,d.jsx)(f.nA,{className:"text-xs text-text-2",children:(0,g.K)(a.at,r)}),(0,d.jsxs)(f.nA,{colSpan:5,className:"text-xs font-medium text-text-2",children:["Vault purge —"," ",1===a.pointerCount?"a pointer":`${String(a.pointerCount)} pointers`," ","made permanently unresolvable"]})]},a.id):(0,d.jsxs)(f.Hj,{"data-model-crossing":"model"===a.target?a.outcome:void 0,className:(0,f.cn)("model"===a.target&&i[a.outcome],(0,e.kqf)(a.reason)&&"text-text-3"),children:[(0,d.jsx)(f.nA,{className:"text-xs text-text-2",children:(0,g.K)(a.at,r)}),(0,d.jsx)(f.nA,{className:"text-xs",children:h.V[a.reason]}),(0,d.jsx)(f.nA,{className:"text-xs",children:"model"===a.target?(0,d.jsx)("span",{className:"font-semibold text-sev-critical-ink",children:"model"}):(0,d.jsx)("span",{className:"text-text-2",children:"human"})}),(0,d.jsx)(f.nA,{children:(0,d.jsx)(j,{row:a})}),(0,d.jsx)(f.nA,{className:"font-mono text-xs text-text-3",children:void 0===a.grantId?"—":a.grantId.slice(0,8)}),(0,d.jsx)(f.nA,{className:"text-xs text-text-2",children:a.pointerCount>1?`\xd7${String(a.pointerCount)}`:"—"})]},a.id))})]}),n?(0,d.jsxs)(f.dK,{children:[(0,d.jsx)(f.Eb,{disabled:!m||p,onClick:o}),(0,d.jsx)(f.D2,{children:void 0===q?`${String(a.length)} shown`:u?"0 resolutions":`${String(q)}–${String(q+a.length-1)} resolutions`}),(0,d.jsx)(f.WA,{disabled:!l||p,loading:p,onClick:n})]}):l&&(0,d.jsxs)("p",{className:"mt-4 text-center text-xs text-text-3",children:["Showing the most recent ",a.length," resolutions."]}),t]}):(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-4",children:[(0,d.jsx)("div",{className:"py-10 text-center text-sm text-text-3",children:"No de-references recorded — every resolution of a vaulted value lands here."}),t]})}},52233:(a,b,c)=>{"use strict";c.d(b,{s:()=>h});var d=c(15008),e=c(71378),f=c(1505);function g({icon:a,value:b,label:c,tone:f,isLoading:g}){let{text:h,fill:i}=e.cH[f];return(0,d.jsxs)("div",{"data-slot":"summary-stat",className:"flex min-w-0 flex-1 items-center gap-2 px-4",children:[(0,d.jsx)("span",{"data-slot":"summary-stat-icon",className:(0,e.cn)("grid size-7 shrink-0 place-items-center rounded-lg",i,h),children:(0,d.jsx)(a,{"aria-hidden":!0,focusable:!1,className:"size-3.5"})}),(0,d.jsxs)("div",{className:"flex min-w-0 items-baseline gap-1.5 overflow-hidden",title:g?c:`${String(b)} ${c}`,children:[g?(0,d.jsx)(e.EA,{className:"h-4 w-10 shrink-0"}):(0,d.jsx)("span",{className:"min-w-0 truncate font-display text-lg font-semibold leading-none tabular-nums text-text",children:b}),(0,d.jsx)("span",{className:"shrink-[9999] truncate text-xs text-text-3",children:c})]})]})}function h({items:a,isLoading:b,className:c}){return(0,d.jsx)(e.Zp,{className:(0,e.cn)("mb-3 flex shrink-0 items-stretch overflow-hidden py-2.5 shadow-sm",c),"aria-busy":b,children:a.map((a,c)=>(0,d.jsxs)(f.Fragment,{children:[c>0&&(0,d.jsx)("span",{className:"w-px shrink-0 self-stretch bg-hairline"}),(0,d.jsx)(g,{...a,isLoading:b})]},a.label))})}},52833:(a,b,c)=>{"use strict";c.d(b,{CF:()=>k,EI:()=>g,Hf:()=>h,Lh:()=>q,P4:()=>j,ZX:()=>n,aD:()=>f,pN:()=>i,rL:()=>o});var d=c(71378),e=c(16820);let f={https:{label:"HTTPS",icon:e.XA,secure:!0},http:{label:"HTTP",icon:e.fC,secure:!1},sftp:{label:"SFTP",icon:e.JM,secure:!0},grpc:{label:"gRPC",icon:e.hF,secure:!0},smtp:{label:"SMTP",icon:e.K$,secure:!0},ws:{label:"WS",icon:e.fC,secure:!1},wss:{label:"WSS",icon:e.XA,secure:!0}};function g(a){return a.some(a=>!f[a].secure)}let h={secrets:{label:"Secrets",tone:"critical",icon:e.RY},pii:{label:"PII",tone:"high",icon:e.Ey},customer:{label:"Customer data",tone:"high",icon:e.ny},source:{label:"Source code",tone:"low",icon:e.lo},telemetry:{label:"Telemetry",tone:"teal",icon:e.BH},logs:{label:"Logs",tone:"default",icon:e.kp},metrics:{label:"Metrics",tone:"teal",icon:e.np},none:{label:"No payload",tone:"default",icon:e.mo}},i={recognized:{label:"Known provider",tone:"success",icon:e.C1},internal:{label:"Your organization",tone:"primary",icon:e.Zu},unverified:{label:"Unverified domain",tone:"high",icon:e._0},ip:{label:"Raw IP address",tone:"critical",icon:e.rX}},j={allowed:{label:"Allowed",tone:"success",icon:e.C1},blocked:{label:"Blocked",tone:"critical",icon:e.pD},review:{label:"Needs review",tone:"high",icon:e._0}},k={provider:"Providers",internal:"Internal & corporate domains",external:"External domains",ip:"Raw IP addresses"},l={raw_ip:"Connects to a raw IP with no reverse DNS",unverified_domain:"Corporate-looking domain not owned by your org",plaintext_transport:"Sends data over a plaintext transport"},m=["raw_ip","unverified_domain","plaintext_transport"];function n(a){let b=m.find(b=>a.includes(b));return b?l[b]:"Needs review"}function o(a){return"ip"===a.kind?d.id.critical:"external"===a.kind||"unverified"===a.trust?d.id.high:d.id.primary}let p=["#2563EB","#7C3AED","#DB2777","#0891B2","#CA8A04","#059669"];function q(a,b){let c=b??a,d=0;for(let a=0;a<c.length;a++)d=31*d+c.charCodeAt(a)>>>0;return{short:function(a){let b=a.trim().split(/[\s.\-_/]+/u).filter(Boolean),c=b[0]??"";if(b.length<=1)return(c.slice(0,2)||"?").toUpperCase();let d=b[1]??"";return((c[0]??"")+(d[0]??"")).toUpperCase()||"?"}(a),color:p[d%p.length]??"#2563EB"}}},53896:(a,b,c)=>{"use strict";c.d(b,{ActivityTokenUsageView:()=>k});var d=c(15008),e=c(71378),f=c(1505),g=c(16820),h=c(88488),i=c(21459);function j({summary:a}){return(0,d.jsxs)(e.XI,{children:[(0,d.jsx)(e.A0,{children:(0,d.jsxs)(e.Hj,{children:[(0,d.jsx)(e.nd,{children:"Provider"}),(0,d.jsx)(e.nd,{children:"Model"}),(0,d.jsx)(e.nd,{className:"text-right",children:"Input"}),(0,d.jsx)(e.nd,{className:"text-right",children:"Output"}),(0,d.jsx)(e.nd,{className:"text-right",children:"Cache"}),(0,d.jsx)(e.nd,{className:"text-right",children:"Total"}),(0,d.jsx)(e.nd,{className:"text-right",children:"Cost"})]})}),(0,d.jsx)(e.BF,{children:a.models.map(a=>(0,d.jsxs)(e.Hj,{children:[(0,d.jsx)(e.nA,{className:"text-text-2",children:a.provider}),(0,d.jsx)(e.nA,{className:"max-w-40 truncate font-mono text-text",title:a.model,children:a.model}),(0,d.jsx)(e.nA,{className:"text-right tabular-nums text-text-2",children:(0,i.Sk)(a.inputTokens)}),(0,d.jsx)(e.nA,{className:"text-right tabular-nums text-text-2",children:(0,i.Sk)(a.outputTokens)}),(0,d.jsx)(e.nA,{className:"text-right tabular-nums text-text-2",children:(0,i.Sk)(a.cacheTokens)}),(0,d.jsx)(e.nA,{className:"text-right font-semibold tabular-nums text-text",children:(0,i.Sk)(a.totalTokens)}),(0,d.jsx)(e.nA,{className:"text-right tabular-nums text-text",children:null!==a.estimatedCostUsd?(0,i.UK)(a.estimatedCostUsd):"—"})]},`${a.provider} ${a.model}`))})]})}function k({summary:a,isLoading:b,error:c,rangeLabel:k}){let[l,m]=(0,f.useState)(!1);if(b&&!a)return(0,d.jsx)(e.EA,{className:"h-9 w-44 rounded-lg","aria-busy":!0});let n=null!==a&&a.models.length>0,o=c?"Token usage":n?`${(0,i.Sk)(a.totalTokens)} tokens \xb7 ${(0,i.xd)(a.estimatedCostUsd,a.costIsPartial)}`:"No token usage",p=c?`Token usage could not be read — ${c}`:n?`Token usage${k?` \xb7 ${k}`:""} — ${String(a.sessionCount)} session${1===a.sessionCount?"":"s"}. Open the per-model breakdown.`:"No token usage recorded yet — open for details";return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(e.$n,{variant:"outline",size:"md",title:p,"aria-label":"Token usage — open the per-model breakdown",onClick:()=>{m(!0)},children:[(0,d.jsx)(g.Uy,{"aria-hidden":!0,focusable:!1,className:c?"size-4 text-sev-critical-ink":"size-4 text-primary"}),(0,d.jsx)("span",{className:"max-w-56 truncate tabular-nums",children:o})]}),(0,d.jsx)(e.cj,{open:l,onOpenChange:m,children:(0,d.jsxs)(e.h,{className:"w-200 max-w-[94%] gap-0 overflow-hidden p-0","aria-describedby":void 0,children:[(0,d.jsxs)(e.Fm,{className:"shrink-0 border-b border-border px-5 py-4",children:[(0,d.jsxs)(e.qp,{className:"flex items-center gap-2",children:[(0,d.jsx)(g.Uy,{"aria-hidden":!0,focusable:!1,className:"size-4 text-primary"}),"Token usage",k&&(0,d.jsxs)("span",{className:"text-ui font-normal text-text-3",children:["\xb7 ",k]})]}),n&&(0,d.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-x-2.5 gap-y-0.5 text-xs text-text-3",children:[(0,d.jsxs)("span",{children:[a.sessionCount," session",1===a.sessionCount?"":"s"]}),(0,d.jsx)("span",{children:"\xb7"}),(0,d.jsxs)("span",{className:"font-semibold tabular-nums text-text-2",children:[(0,i.Sk)(a.totalTokens)," tokens"]}),(0,d.jsx)("span",{children:"\xb7"}),(0,d.jsx)("span",{className:"font-semibold tabular-nums text-text-2",children:(0,i.xd)(a.estimatedCostUsd,a.costIsPartial)})]})]}),(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-auto px-2 py-2",children:c?(0,d.jsx)("div",{className:"p-3",children:(0,d.jsx)(h.r,{message:c})}):n?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j,{summary:a}),a.costIsPartial&&(0,d.jsx)("p",{className:"px-3 pb-1 pt-2 text-xs text-text-3",children:"— = unknown pricing (a local or non-Anthropic model); the cost total is a lower bound."})]}):(0,d.jsx)("div",{className:"p-3",children:(0,d.jsx)(h.A,{message:"No token usage recorded yet — sessions are reconciled as you work."})})})]})})]})}},54201:(a,b,c)=>{"use strict";c.d(b,{AZ:()=>o,LZ:()=>r,Mk:()=>l,Py:()=>q,Ud:()=>n,j0:()=>d,lr:()=>p,nk:()=>h,pT:()=>m,t$:()=>j});let d=["light","dark","system"],e="system",f="aka-theme",g="(prefers-color-scheme: dark)";function h(a){return"string"==typeof a&&d.includes(a)}let i=null;function j(){if(null!==i)return i;try{let a=window.localStorage.getItem(f);return h(a)?a:e}catch{return e}}let k=new Set;function l(a){k.add(a);let b=b=>{(null===b.key||b.key===f)&&(i=null,a())};return window.addEventListener("storage",b),()=>{k.delete(a),window.removeEventListener("storage",b)}}function m(a){try{window.localStorage.setItem(f,a),i=null}catch{i=a}for(let a of k)a()}function n(){return window.matchMedia(g).matches}function o(a){document.documentElement.classList.toggle("dark","dark"===a)}function p(a){let b=window.matchMedia(g);return b.addEventListener("change",a),()=>{b.removeEventListener("change",a)}}function q(){return e}function r(){return!1}},54760:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(34703);let e=async a=>[{type:"image/svg+xml",sizes:"any",url:(0,d.fillMetadataSegment)(".",await a.params,"icon.svg")+"?f88cc4549cfe61ae"}]},55343:(a,b,c)=>{"use strict";c.d(b,{Y:()=>f});var d=c(15008),e=c(71378);function f({value:a,descriptor:b,className:c}){if(null===a&&null===b)return(0,d.jsx)("span",{"data-slot":"scrubbed-value",className:(0,e.cn)("text-ui text-text-3",c),children:"[unavailable]"});let f=null===b?null:(0,d.jsxs)(e.Ex,{variant:"primary",children:["scrubbed:"," ",void 0===b.provider?b.category:`${b.category}/${b.provider}`]});return(0,d.jsxs)("span",{"data-slot":"scrubbed-value",className:(0,e.cn)("inline-flex flex-wrap items-center gap-2",c),children:[null!==a?(0,d.jsx)("code",{className:"break-all font-mono text-ui text-text",children:a}):(0,d.jsx)("code",{className:"break-all font-mono text-ui text-text-2",children:b?.maskedMatch}),f]})}},58268:()=>{},58435:(a,b,c)=>{"use strict";c.d(b,{NavigationTransitionProvider:()=>e});var d=c(28326);let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call NavigationTransitionProvider() from the server but NavigationTransitionProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/ai-tc/ai-tc/web-ui/app/components/NavigationTransition.tsx","NavigationTransitionProvider");(0,d.registerClientReference)(function(){throw Error("Attempted to call useNavigationTransition() from the server but useNavigationTransition is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/ai-tc/ai-tc/web-ui/app/components/NavigationTransition.tsx","useNavigationTransition"),(0,d.registerClientReference)(function(){throw Error("Attempted to call NavigationProgressBar() from the server but NavigationProgressBar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/ai-tc/ai-tc/web-ui/app/components/NavigationTransition.tsx","NavigationProgressBar")},58610:(a,b,c)=>{"use strict";c.d(b,{ExceptionsTableView:()=>i});var d=c(15008),e=c(71378),f=c(5265),g=c(18389),h=c(77292);function i({items:a,includeTerminal:b,onSelect:c,renderedAt:i}){return 0===a.length?(0,d.jsx)("div",{className:"rounded-xl border border-border bg-surface py-10 text-center text-sm text-text-3",children:b?"No exceptions have ever been granted.":"No active exceptions — enforcement applies everywhere."}):(0,d.jsx)("div",{className:"overflow-x-auto rounded-xl border border-border bg-surface p-4",children:(0,d.jsxs)(e.XI,{children:[(0,d.jsx)(e.A0,{children:(0,d.jsxs)(e.Hj,{children:[(0,d.jsx)(e.nd,{children:"ID"}),(0,d.jsx)(e.nd,{children:"Rule"}),(0,d.jsx)(e.nd,{children:"Value"}),(0,d.jsx)(e.nd,{children:"Scope"}),(0,d.jsx)(e.nd,{children:"Expires"}),(0,d.jsx)(e.nd,{children:"Uses"}),(0,d.jsx)(e.nd,{children:"Created"}),(0,d.jsx)(e.nd,{children:"State"})]})}),(0,d.jsx)(e.BF,{children:a.map(a=>(0,d.jsxs)(e.Hj,{className:"cursor-pointer","aria-label":`View details for exception ${a.id.slice(0,8)}`,onClick:()=>{c(a.id)},children:[(0,d.jsx)(e.nA,{className:"font-mono text-xs text-text-3",children:a.id.slice(0,8)}),(0,d.jsx)(e.nA,{className:"font-mono text-xs",children:a.ruleId}),(0,d.jsx)(e.nA,{className:"font-mono text-xs",children:(0,d.jsxs)("span",{className:"inline-flex items-center gap-2",children:[a.maskedValue,(0,d.jsx)(g._,{exception:a})]})}),(0,d.jsx)(e.nA,{className:"text-xs",children:h.yr[a.scope]}),(0,d.jsx)(e.nA,{className:"text-xs text-text-2",children:null===a.expiresAt?"—":(0,f.K)(a.expiresAt,i)}),(0,d.jsx)(e.nA,{className:"text-xs text-text-2",children:null===a.maxUses?String(a.useCount):`${String(a.useCount)}/${String(a.maxUses)}`}),(0,d.jsxs)(e.nA,{className:"text-xs text-text-2",children:[(0,f.K)(a.createdAt,i)," \xb7 ",h.gi[a.createdVia]]}),(0,d.jsx)(e.nA,{children:(0,d.jsx)(g.StateTagFor,{exception:a,now:i})})]},a.id))})]})})}},59609:(a,b,c)=>{"use strict";c.d(b,{ApproveExceptionDialog:()=>h});var d=c(15008),e=c(71378),f=c(1505),g=c(18389);function h({entry:a,open:b,onOpenChange:c,onSubmit:h,busy:i,error:j}){let[k,l]=(0,f.useState)(null),[m,n]=(0,f.useState)(""),[o,p]=(0,f.useState)(""),q="permanent"===k,r=null!==a&&null!==k&&""!==m.trim()&&(!q||o===a.maskedValue);return(0,d.jsx)(e.lG,{open:b,onOpenChange:a=>{a||(l(null),n(""),p("")),c(a)},children:(0,d.jsxs)(e.Cf,{children:[(0,d.jsxs)(e.c7,{children:[(0,d.jsx)(e.L3,{children:"Approve blocked detection"}),(0,d.jsx)(e.rr,{children:"Grant an explicit, audited bypass for this exact value. Enforcement continues for every other value."})]}),(0,d.jsx)(e.R4,{children:a&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 p-3 text-xs",children:[(0,d.jsx)("div",{className:"font-mono font-semibold text-text",children:a.ruleId}),(0,d.jsx)("div",{className:"mt-1 font-mono text-text-2",children:a.maskedValue})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"mb-1.5 text-label font-semibold uppercase tracking-wider text-text-3",children:"Scope — pick one"}),(0,d.jsx)(g.ScopePicker,{value:k,onChange:l})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"mb-1.5 text-label font-semibold uppercase tracking-wider text-text-3",children:"Reason (required — the audit trail)"}),(0,d.jsx)(e.pd,{value:m,onChange:a=>{n(a.target.value)},placeholder:"Why this value may pass"})]}),q&&(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"mb-1.5 text-label font-semibold uppercase tracking-wider text-text-3",children:"Type the masked value to confirm a permanent grant"}),(0,d.jsx)(e.pd,{value:o,onChange:a=>{p(a.target.value)},placeholder:a.maskedValue,autoComplete:"off",className:"font-mono"})]}),j&&(0,d.jsx)("p",{className:"text-xs text-sev-critical-ink",children:j})]})}),(0,d.jsxs)(e.Es,{children:[(0,d.jsx)(e.$n,{variant:"ghost",tone:"neutral",size:"sm",onClick:()=>{c(!1)},children:"Cancel"}),(0,d.jsx)(e.$n,{variant:"solid",tone:"primary",size:"sm",disabled:!r||i,onClick:()=>{a&&k&&h({reference:a.reference,scope:k,reason:m.trim(),...q?{confirmation:o}:{}})},children:i?"Granting…":"Grant exception"})]})]})})}},59999:(a,b,c)=>{"use strict";c.d(b,{AppShell:()=>m});var d=c(15008),e=c(49195),f=c(71378),g=c(96075),h=c.n(g),i=c(50734),j=c(76210),k=c(17737);let l=[{label:"Security",icon:j.Zu,href:"/security"},{label:"Findings",icon:j.rX,href:"/findings"},{label:"Inventory",icon:j.mL,href:"/inventory"},{label:"Data Shares",icon:j._G,href:"/data-shares"},{label:"Activity",icon:j.np,href:"/activity"},{label:"Detections",icon:j.kp,href:"/detections"},{label:"Policies",icon:j.iB,href:"/policies"},{label:"Exceptions",icon:j.RY,href:"/exceptions"},{label:"Vault",icon:j.XA,href:"/vault"},{label:"Scan",icon:j.WI,href:"/scan"},{label:"Updates",icon:j.fN,href:"/updates"},{label:"Settings",icon:j.Ze,href:"/settings"}];function m({children:a}){let b=(0,i.usePathname)();return(0,d.jsxs)("div",{className:"flex h-screen overflow-hidden bg-canvas",children:[(0,d.jsx)(n,{pathname:b}),(0,d.jsxs)("div",{className:"relative flex min-w-0 flex-1 flex-col",children:[(0,d.jsx)(k.p,{}),(0,d.jsx)(p,{}),(0,d.jsx)("main",{className:"flex-1 overflow-y-auto",children:a})]})]})}function n({pathname:a}){return(0,d.jsxs)("aside",{className:"flex w-62 flex-col border-r border-border bg-surface shrink-0",children:[(0,d.jsx)("div",{className:"flex h-16 items-center border-b border-hairline px-5",children:(0,d.jsx)(j.j4,{"aria-label":"AKA",className:"h-8 w-auto text-mark-fg"})}),(0,d.jsx)("nav",{className:"flex flex-1 flex-col gap-0.5 overflow-y-auto px-3 py-3.5",children:l.map(b=>(0,d.jsx)(o,{item:b,active:void 0!==b.href&&(a===b.href||a.startsWith(`${b.href}/`))},b.label))})]})}function o({item:a,active:b}){let c=a.icon,e=(0,f.cn)("flex w-full items-center gap-3 rounded-lg px-3 h-10 text-left text-sm group font-medium transition-colors cursor-pointer",b?(0,f.cn)(f.id.primary,"font-semibold"):"text-text-2 hover:bg-surface-2 hover:text-text"),g=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c,{"aria-hidden":!0,focusable:!1,className:(0,f.cn)("size-4 shrink-0",b?"text-primary":"text-text-3 group-hover:text-text-2")}),(0,d.jsx)("span",{className:"flex-1",children:a.label})]});return a.href?(0,d.jsx)(h(),{href:a.href,"aria-current":b?"page":void 0,className:e,children:g}):(0,d.jsx)("button",{type:"button","aria-current":b?"page":void 0,className:e,children:g})}function p(){return(0,d.jsx)("header",{className:"flex items-center gap-4 border-b border-border bg-surface px-6 h-16",children:(0,d.jsx)("div",{className:"ml-auto flex items-center gap-2",children:(0,d.jsx)(e.ThemeToggle,{})})})}},60004:(a,b,c)=>{"use strict";c.d(b,{l:()=>d});let d={primary:"var(--color-primary)",ok:"var(--color-ok)",violet:"var(--color-violet)",teal:"var(--color-teal)",sevCritical:"var(--color-sev-critical)",sevHigh:"var(--color-sev-high)",sevMedium:"var(--color-sev-medium)",sevLow:"var(--color-sev-low)",surface:"var(--color-surface)",surface3:"var(--color-surface-3)",border:"var(--color-border)",text2:"var(--color-text-2)",text3:"var(--color-text-3)"}},60692:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>i});var d=c(15008),e=c(71378),f=c(96075),g=c.n(f),h=c(76210);function i({error:a,reset:b}){return(0,d.jsx)("div",{className:"px-8 pb-10 pt-7",children:(0,d.jsx)(e.Zp,{className:"mx-auto max-w-lg",children:(0,d.jsxs)(e.Wu,{className:"flex flex-col items-center gap-4 py-10 text-center",children:[(0,d.jsx)("span",{className:"flex size-11 items-center justify-center rounded-full bg-sev-critical-fill",children:(0,d.jsx)(h.rX,{"aria-hidden":!0,focusable:!1,className:"size-5 text-sev-critical-ink"})}),(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,d.jsx)("h1",{className:"text-lg font-semibold text-text",children:"Something went wrong"}),(0,d.jsx)("p",{className:"text-sm text-text-2",children:"This page could not be rendered from the local store."}),a.digest&&(0,d.jsxs)("p",{className:"pt-1 font-mono text-xs text-text-3",children:["Error digest: ",a.digest]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(e.$n,{variant:"solid",tone:"primary",onClick:b,children:"Try again"}),(0,d.jsx)(e.$n,{variant:"outline",tone:"neutral",asChild:!0,children:(0,d.jsx)(g(),{href:"/security",children:"Go to Security"})})]})]})})})}},61125:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,55934,23)),Promise.resolve().then(c.t.bind(c,27161,23)),Promise.resolve().then(c.t.bind(c,18433,23)),Promise.resolve().then(c.t.bind(c,21368,23)),Promise.resolve().then(c.t.bind(c,8008,23)),Promise.resolve().then(c.t.bind(c,88012,23)),Promise.resolve().then(c.t.bind(c,9916,23)),Promise.resolve().then(c.t.bind(c,69869,23)),Promise.resolve().then(c.t.bind(c,47916,23))},62512:(a,b,c)=>{"use strict";c.d(b,{MatcherModal:()=>q,RuleInspectorBody:()=>p});var d=c(15008),e=c(71378),f=c(16820),g=c(65366);function h(a,b){return a.length>b?`${a.slice(0,b)}…`:a}function i({hidden:a}){return a<=0?null:(0,d.jsxs)("div",{className:"text-xs text-text-2",children:["+",String(a)," more not shown"]})}function j({children:a}){return(0,d.jsx)("span",{className:"inline-flex h-6 items-center rounded-md border border-border bg-surface-2 px-2 font-mono text-xs text-text-2",children:a})}function k({children:a,emphasis:b=!1}){return(0,d.jsx)("code",{className:"block break-all rounded-md border border-border bg-surface-2 px-2.5 font-mono text-xs "+(b?"py-2 text-text":"py-1.5 text-text-2"),children:a})}function l({matcher:a}){return"regex"===a.type?(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)(m,{label:"Pattern",children:(0,d.jsx)(k,{emphasis:!0,children:a.pattern})}),(0,d.jsx)(m,{label:"Flags",children:(0,d.jsx)("code",{className:"font-mono text-xs text-text-2",children:a.flags||"—"})}),"number"==typeof a.captureGroup&&(0,d.jsx)(m,{label:"Capture group",children:(0,d.jsx)("span",{className:"font-mono text-xs text-text-2",children:a.captureGroup})})]}):(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)(m,{label:"Keywords",children:(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.keywords.map((a,b)=>(0,d.jsx)(j,{children:a},`${a}-${String(b)}`))})}),(0,d.jsx)(m,{label:"Case sensitive",children:(0,d.jsx)("span",{className:"text-xs text-text-2",children:a.caseSensitive?"Yes":"No"})})]})}function m({label:a,children:b}){return(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,d.jsx)("div",{className:"text-label font-semibold uppercase tracking-wider text-text-3",children:a}),b]})}function n({rule:a}){let b=a.requiresNearby,c=b?[...(b.categories??[]).map(a=>`category ${g.gh[a]||a}`),...(b.ruleIds??[]).map(a=>`rule ${a}`),...(b.labels??[]).map(a=>`"${a}"`)]:[];return a.appliesTo||a.postValidators?.length||b?(0,d.jsxs)("div",{className:"mt-4 flex flex-col gap-3",children:[a.appliesTo&&(0,d.jsx)(m,{label:"Only in files",children:(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.appliesTo.extensions.map((a,b)=>(0,d.jsx)(j,{children:a},`${a}-${String(b)}`))})}),a.postValidators&&a.postValidators.length>0&&(0,d.jsx)(m,{label:"Must also pass",children:(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.postValidators.map((a,b)=>{var c;let e="string"==typeof a?a:a.name,f="string"!=typeof a&&(c=a.config)?Object.entries(c).flatMap(([a,b])=>"string"==typeof b||"number"==typeof b||"boolean"==typeof b?[`${h(a,120)} ${h(String(b),120)}`]:[]).slice(0,6).join(" \xb7 "):"";return(0,d.jsx)(j,{children:f?`${e} \xb7 ${f}`:e},`${e}-${String(b)}`)})})}),b&&(0,d.jsxs)(m,{label:`Needs corroboration within ${String(b.windowChars)} chars`,children:[(0,d.jsx)("div",{className:"text-xs leading-snug text-text-2",children:c.length>1?`Any of: ${c.join(" \xb7 ")}`:c.join(" \xb7 ")}),void 0!==b.confidenceBoost&&(0,d.jsxs)("div",{className:"text-xs leading-snug text-text-3",children:["Corroborated matches gain ",String(b.confidenceBoost)," confidence"]})]})]}):null}function o({fixtures:a}){let b=a.slice(0,20);return(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[b.map((a,b)=>(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:"inline-flex h-5 items-center rounded-full px-2 text-label font-semibold "+(a.shouldMatch?"bg-ok-fill text-ok-ink":"bg-surface-3 text-text-2"),children:a.shouldMatch?"matches":"does not match"}),(0,d.jsx)("span",{className:"text-xs text-text-2",children:h(a.label,120)}),void 0!==a.filePath&&(0,d.jsx)("span",{className:"font-mono text-label text-text-3",children:h(a.filePath,120)})]}),(0,d.jsx)(k,{children:h(a.text,1e3)})]},`${h(a.label,120)}-${String(b)}`)),(0,d.jsx)(i,{hidden:a.length-b.length})]})}function p({rule:a,fixtures:b}){let c=g.rE[a.matcher.type];if(!c)return null;let e=c.icon,j=a.examples??[],p=b?.ruleId===a.id?b.cases:[];return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"mb-4 flex flex-wrap gap-2",children:[(0,d.jsx)(r,{icon:(0,d.jsx)(f.kp,{"aria-hidden":!0,focusable:!1,className:"size-3.5"}),children:g.gh[a.category]||a.category}),(0,d.jsx)(r,{icon:(0,d.jsx)(e,{"aria-hidden":!0,focusable:!1,className:"size-3.5"}),children:c.blurb})]}),(0,d.jsx)(l,{matcher:a.matcher}),(0,d.jsx)(n,{rule:a}),j.length>0&&(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(m,{label:"Catches values like",children:(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[j.slice(0,20).map((a,b)=>{let c=h(a,1e3);return(0,d.jsx)(k,{children:c},`${c}-${String(b)}`)}),(0,d.jsx)(i,{hidden:j.length-20})]})})}),p.length>0&&(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(m,{label:`Test cases (${String(p.length)})`,children:(0,d.jsx)(o,{fixtures:p})})})]})}function q({rule:a,fixtures:b,onClose:c}){let h=!!a,i=a?g.rE[a.matcher.type]:null,j=i?.icon;return(0,d.jsx)(e.lG,{open:h,onOpenChange:a=>{a||c()},children:(0,d.jsx)(e.Cf,{className:"max-w-3xl","aria-describedby":void 0,children:a&&i&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(e.L3,{className:"sr-only",children:["Rule \xb7 ",a.name]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-5 py-4",children:[(0,d.jsx)("span",{className:"grid size-9 shrink-0 place-items-center rounded-lg",style:{background:i.fill,color:i.color},children:j&&(0,d.jsx)(j,{"aria-hidden":!0,focusable:!1,className:"size-4.5"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)("span",{className:"font-display text-base font-semibold text-text",children:a.name}),(0,d.jsx)(e.Pt,{severity:a.severity})]}),(0,d.jsx)("div",{className:"mt-px font-mono text-xs text-text-3",children:a.id})]}),(0,d.jsx)("span",{className:"rounded-full px-2.5 py-1 text-xs font-semibold",style:{background:i.fill,color:i.color},children:i.label}),(0,d.jsx)(e.$n,{variant:"ghost",tone:"neutral",size:"icon",onClick:c,"aria-label":"Close",className:"size-8 text-text-3",children:(0,d.jsx)(f.uv,{"aria-hidden":!0,focusable:!1})})]}),(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-5",children:(0,d.jsx)(p,{rule:a,fixtures:b})})]})})})}function r({icon:a,children:b}){return(0,d.jsxs)("span",{className:"inline-flex h-6 items-center gap-1.5 rounded-md border border-border bg-surface px-2 text-label font-medium text-text-2",children:[a,b]})}},62606:(a,b,c)=>{"use strict";c.d(b,{FindingsLocationsView:()=>j});var d=c(15008),e=c(71378),f=c(1505),g=c(5265),h=c(16820),i=c(14129);function j({items:a,expandedRepos:b,onToggleRepo:c,onSelectFile:i,hasMore:j=!1,isLoading:m=!1,emptyState:n,renderedAt:o}){return(0,d.jsx)(e.Zp,{className:"flex h-full min-h-0 flex-col overflow-hidden shadow-sm",children:(0,d.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:[m?(0,d.jsx)("div",{className:"flex flex-col gap-2 py-2",children:Array.from({length:6},(a,b)=>(0,d.jsx)("div",{className:"h-12 animate-pulse rounded-md bg-surface-3"},b))}):0===a.length?n??(0,d.jsx)("p",{className:"py-8 text-center text-sm text-text-3",children:"No findings match these filters."}):(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:a.map(a=>{let j=b.has(a.repo);return(0,d.jsxs)(f.Fragment,{children:[(0,d.jsxs)("button",{type:"button","aria-expanded":j,onClick:()=>{c(a.repo)},className:"flex w-full items-center gap-3 rounded-lg border border-border px-3 py-2.5 text-left hover:bg-surface-2",children:[(0,d.jsx)(h.vK,{"aria-hidden":!0,focusable:!1,className:(0,e.cn)("size-4 shrink-0 text-text-3 transition-transform",j&&"rotate-90")}),(0,d.jsx)(e.Pt,{severity:a.maxSeverity}),(0,d.jsx)("span",{className:(0,e.cn)("min-w-0 flex-1 truncate text-ui font-semibold",a.repo?"font-mono text-text":"italic text-text-3"),children:a.repo||"No repository recorded"}),(0,d.jsx)(k,{status:a.status}),(0,d.jsxs)("span",{className:"shrink-0 text-xs text-text-3",children:[a.instanceCount," ",1===a.instanceCount?"finding":"findings"," \xb7"," ",a.files.length," ",1===a.files.length?"file":"files"]}),(0,d.jsx)("span",{className:"shrink-0 text-xs text-text-3",children:(0,g.K)(a.latestDetectedAt,o)})]}),j&&a.files.map(b=>(0,d.jsx)(l,{file:b,renderedAt:o,onSelect:b.file?()=>{i(a.repo,b.file)}:void 0},`${a.repo}\0${b.file}`))]},a.repo||"\0unnamed")})}),j&&(0,d.jsxs)("p",{className:"mt-4 text-center text-xs text-text-3",children:["Showing the first ",a.length," repositories — refine the filters to narrow results."]})]})})}function k({status:a}){if(void 0===a)return null;let b=(0,i.Dx)(a);return(0,d.jsx)(e.Ex,{variant:b.badge,className:"h-6 shrink-0",children:b.label})}function l({file:a,onSelect:b,renderedAt:c}){let f=(0,d.jsxs)("div",{className:"grid grid-cols-[100px_1fr_1fr_100px_100px] w-full gap-2",children:[(0,d.jsx)("div",{children:(0,d.jsx)(e.Pt,{severity:a.maxSeverity})}),(0,d.jsx)("span",{className:(0,e.cn)("font-mono text-xs break-words [word-break:break-word]",a.file?"text-text-2":"italic text-text-3"),children:a.file||"No file recorded"}),(0,d.jsx)("span",{className:"text-xs text-text-3 break-words [word-break:break-word]",children:a.ruleIds.join(", ")}),(0,d.jsx)("span",{className:"shrink-0 text-xs text-text-3",children:a.instanceCount}),(0,d.jsx)("span",{className:"shrink-0 text-xs text-text-3",children:(0,g.K)(a.latestDetectedAt,c)})]}),h="flex w-full items-center gap-3 rounded-md py-1.5 pl-10 pr-3 text-left";return b?(0,d.jsx)("button",{type:"button",onClick:b,className:(0,e.cn)(h,"cursor-pointer hover:bg-surface-2"),children:f}):(0,d.jsx)("div",{className:h,children:f})}},63407:(a,b,c)=>{"use strict";c.d(b,{K:()=>g,x:()=>f});var d=c(15008),e=c(64145);let f={[e.tLs.ClaudeCode]:{label:"Claude Code",short:"CC",color:"#C96442"},[e.tLs.ClaudeDesktop]:{label:"Claude Desktop",short:"CD",color:"#A8553A"},[e.tLs.Cursor]:{label:"Cursor",short:"Cu",color:"#252F3D"},[e.tLs.Windsurf]:{label:"Windsurf",short:"Wf",color:"#0B8F7B"},[e.tLs.Codex]:{label:"Codex CLI",short:"Cx",color:"#10A37F"},[e.tLs.Antigravity]:{label:"Antigravity",short:"Ag",color:"#4285F4"},[e.tLs.Copilot]:{label:"GitHub Copilot",short:"Co",color:"#0581D4"},[e.tLs.ChatGpt]:{label:"ChatGPT",short:"GP",color:"#0d8f6f"},[e.tLs.ClaudeAi]:{label:"Claude.ai",short:"Ca",color:"#D97757"},[e.tLs.Api]:{label:"Anthropic API",short:"AP",color:"#6058E9"}};function g({id:a,size:b=24}){let c=f[a];return(0,d.jsx)("span",{className:"flex shrink-0 items-center justify-center rounded-lg font-display font-bold text-white ring-1 ring-inset ring-mark-edge",style:{width:b,height:b,background:c.color,fontSize:.36*b},children:c.short})}},64145:(a,b,c)=>{"use strict";c.d(b,{PWo:()=>aH,HUb:()=>cd,spO:()=>cY,tLs:()=>M,V0H:()=>cc,MhX:()=>cS,fhc:()=>cg,F$B:()=>cP,xdw:()=>J,ap_:()=>H,UKt:()=>I,T2I:()=>ck,lgf:()=>cO,kqf:()=>cw,O2m:()=>cT,bkE:()=>cN,EL9:()=>cM,qEQ:()=>b1,DLF:()=>cK,hds:()=>cE,Ly$:()=>cU,y6l:()=>b2});var d=c(48460);let e=d.Ik({thresholdInputTokens:d.ai().int().positive(),input:d.ai().nonnegative().nullable(),output:d.ai().nonnegative().nullable()});function f(a,b,c){return Object.freeze({input:a,output:b,longContext:null,cacheWrite5m:1.25*a,cacheWrite1h:2*a,cacheRead:c,webSearch:.01})}function g(a,b,c={}){return Object.freeze({input:a,output:b,longContext:void 0===c.longContext?null:Object.freeze(c.longContext),cacheWrite5m:null,cacheWrite1h:null,cacheRead:c.cacheRead??null,webSearch:null})}d.Ik({input:d.ai().nonnegative(),output:d.ai().nonnegative(),longContext:e.nullable(),cacheWrite5m:d.ai().nonnegative().nullable(),cacheWrite1h:d.ai().nonnegative().nullable(),cacheRead:d.ai().nonnegative().nullable(),webSearch:d.ai().nonnegative().nullable()});let h=Object.freeze({input:0,output:0,longContext:null,cacheWrite5m:0,cacheWrite1h:0,cacheRead:0,webSearch:0});d.k5(["anthropic","openai","google","meta","mistral","deepseek","alibaba","xai","amazon","cohere","unknown"]),d.k5(["anthropic","openai","google-ai","mistral","deepseek","xai","cohere","bedrock","vertex","azure","foundry","together","fireworks","groq","openrouter","ollama","local"]),d.k5(["api","gateway","local"]);let i=new Map([["anthropic","api"],["openai","api"],["google-ai","api"],["mistral","api"],["deepseek","api"],["xai","api"],["cohere","api"],["bedrock","api"],["vertex","api"],["azure","api"],["foundry","api"],["together","gateway"],["fireworks","gateway"],["groq","gateway"],["openrouter","gateway"],["ollama","local"],["local","local"]]);function j(a){return i.get(a)??"api"}let k=new Map([["anthropic","anthropic"],["openai","openai"],["google","google-ai"],["mistral","mistral"],["deepseek","deepseek"],["xai","xai"],["cohere","cohere"]]),l=Object.freeze(["anthropic","amazon","meta","mistral","deepseek","qwen","cohere","ai21","writer","luma","stability"]),m=Object.freeze(["us","eu","apac","au","jp","global"]);class n{constructor(a,b={}){this.entries=[],this.vendor=a,this.defaults=b}model(a,b){var c,d;let e=b.family??this.defaults.family??{id:a,name:b.name},f=!1===b.firstParty?null:(c=this.vendor,k.get(c)??null),g=b.openWeights??this.defaults.openWeights??!1,i=b.region??this.defaults.region??null,l=b.retention??this.defaults.retention??"unknown",m=new Map;for(let a of(null!==f&&m.set(f,Object.freeze({platform:f,hosting:j(f),firstParty:!0,price:b.price??null,retention:l,region:i})),b.on??[])){let{platform:c,price:e,retention:f,region:g}="string"==typeof a?{platform:a}:a,n=(d=this.vendor,k.get(d)===c),o=j(c),p="local"===o;m.set(c,Object.freeze({platform:c,hosting:o,firstParty:n,price:e??(p?h:n?b.price??null:null),retention:f??(p?"on_infrastructure":n?l:"unknown"),region:void 0===g?n?i:null:g}))}let n=b.defaultHosting??this.defaults.defaultHosting??(null===f?"gateway":j(f));if(void 0!==b.price&&![...m.values()].some(a=>a.price===b.price))throw Error(`${a}: a first-party price was declared but no platform can carry it — vendor '${this.vendor}' has no first-party endpoint. Price the serving platform explicitly via the object form of \`on\`.`);let o={id:a,vendor:this.vendor,displayName:b.name,familyId:e.id,familyName:e.name,capability:b.capability??null,contextWindow:b.ctx??null,maxOutputTokens:b.maxOut??null,openWeights:g,aliases:Object.freeze([...b.aliases??[]]),training:this.defaults.training??null,platforms:m,defaultHosting:n,seen:b.seen??"managed"};return Object.freeze(o),Object.freeze(o.aliases),this.entries.push(o),o}models(){return this.entries}}function o(a,b={}){return new n(a,b)}RegExp(`^(?:${m.join("|")})\\.`,"u"),RegExp(`^(?:${l.join("|")})\\.`,"u"),RegExp(`^(?:${l.join("|")})/`,"iu");let p=o("anthropic",{family:{id:"claude",name:"Claude"},region:"us",retention:"zero_retention",training:{apiDefault:"no",consumerDefault:"no",consumerControl:"opt-in",source:"https://privacy.claude.com/en/articles/7996868-is-my-data-used-for-model-training"}}),q=["bedrock","vertex","foundry"];p.model("claude-fable-5-1",{name:"Claude Fable 5.1",ctx:1e6,maxOut:128e3,capability:"reasoning",price:f(10,50,.25),on:[...q]}),p.model("claude-fable-5",{name:"Claude Fable 5",capability:"reasoning",price:f(10,50,1),on:[...q]}),p.model("claude-opus-5",{name:"Claude Opus 5",ctx:1e6,maxOut:128e3,capability:"reasoning",price:f(5,25,.5),on:[...q]}),p.model("claude-opus-4-8",{name:"Claude Opus 4.8",capability:"reasoning",price:f(5,25,.5),on:[...q]}),p.model("claude-opus-4-7",{name:"Claude Opus 4.7",capability:"reasoning",price:f(5,25,.5),on:[...q]}),p.model("claude-opus-4-6",{name:"Claude Opus 4.6",capability:"reasoning",price:f(5,25,.5),on:[...q]}),p.model("claude-opus-4-5",{name:"Claude Opus 4.5",capability:"reasoning",price:f(5,25,.5),on:[...q]}),p.model("claude-opus-4-1",{name:"Claude Opus 4.1",capability:"reasoning",price:f(15,75,1.5),on:[...q]}),p.model("claude-sonnet-5",{name:"Claude Sonnet 5",ctx:1e6,maxOut:128e3,capability:"reasoning",price:f(2,10,.2),on:[...q]}),p.model("claude-sonnet-4-6",{name:"Claude Sonnet 4.6",capability:"reasoning",price:f(3,15,.3),on:[...q]}),p.model("claude-sonnet-4-5",{name:"Claude Sonnet 4.5",capability:"reasoning",price:f(3,15,.3),on:[...q]}),p.model("claude-haiku-4-5",{name:"Claude Haiku 4.5",ctx:2e5,maxOut:64e3,capability:null,price:f(1,5,.1),aliases:["claude-haiku-4-5-20251001"],on:[...q]}),p.model("claude-sonnet-3-7",{name:"Claude Sonnet 3.7",on:[...q]});let r={thresholdInputTokens:272e3,input:null,output:null},s=o("openai",{family:{id:"gpt",name:"GPT"},region:"us",retention:"configurable",training:{apiDefault:"no",consumerDefault:"yes",consumerControl:"opt-out",source:"https://developers.openai.com/api/docs/guides/your-data"}}),t=["azure","foundry"];s.model("gpt-5.6-sol",{name:"GPT-5.6 Sol",ctx:105e4,maxOut:128e3,capability:"reasoning",price:g(4,20,{cacheRead:.4,longContext:r}),on:[...t]}),s.model("gpt-5.6-terra",{name:"GPT-5.6 Terra",ctx:105e4,maxOut:128e3,capability:"reasoning",price:g(2,12,{cacheRead:.2,longContext:r}),on:[...t]}),s.model("gpt-5.6-luna",{name:"GPT-5.6 Luna",ctx:105e4,maxOut:128e3,capability:null,price:g(.2,1.2,{cacheRead:.02,longContext:r}),on:[...t]}),s.model("gpt-5.5",{name:"GPT-5.5",ctx:105e4,maxOut:128e3,capability:"reasoning",price:g(5,30,{cacheRead:.5,longContext:r}),on:[...t]}),s.model("gpt-5.4",{name:"GPT-5.4",ctx:105e4,maxOut:128e3,capability:"reasoning",price:g(2.5,15,{cacheRead:.25,longContext:r}),on:[...t]}),s.model("gpt-5.4-mini",{name:"GPT-5.4 mini",ctx:4e5,maxOut:128e3,capability:null,price:g(.75,4.5,{cacheRead:.075}),on:[...t]}),s.model("gpt-5.4-nano",{name:"GPT-5.4 nano",ctx:4e5,maxOut:128e3,capability:null,price:g(.2,1.25,{cacheRead:.02}),on:[...t]}),s.model("gpt-5.3-codex",{name:"GPT-5.3 Codex",ctx:4e5,maxOut:128e3,capability:"code",price:g(1.75,14,{cacheRead:.175}),on:[...t]}),s.model("gpt-5.1",{name:"GPT-5.1",ctx:4e5,maxOut:128e3,capability:"reasoning",price:g(1.25,10,{cacheRead:.125}),on:[...t]}),s.model("gpt-5",{name:"GPT-5",ctx:4e5,maxOut:128e3,capability:"reasoning",price:g(1.25,10,{cacheRead:.125}),on:[...t]}),s.model("gpt-5-mini",{name:"GPT-5 mini",ctx:4e5,capability:null,price:g(.25,2,{cacheRead:.025}),on:[...t]}),s.model("gpt-5-nano",{name:"GPT-5 nano",ctx:4e5,maxOut:128e3,capability:null,price:g(.05,.4,{cacheRead:.005}),on:[...t]}),s.model("gpt-4.1",{name:"GPT-4.1",price:g(2,8,{cacheRead:.5}),on:[...t]}),s.model("gpt-4o",{name:"GPT-4o",price:g(2.5,10,{cacheRead:1.25}),on:[...t]}),s.model("gpt-4o-mini",{name:"GPT-4o mini",price:g(.15,.6,{cacheRead:.075}),on:[...t]}),s.model("gpt-4-turbo",{name:"GPT-4 Turbo",seen:"discovered",price:g(10,30),aliases:["gpt-4-turbo-2024-04-09"],on:[...t]}),s.model("o3",{name:"o3",capability:"reasoning",price:g(2,8,{cacheRead:.5}),on:[...t]}),s.model("gpt-oss-120b",{name:"GPT-OSS 120B",openWeights:!0,firstParty:!1,retention:"unknown",defaultHosting:"local",on:["together","fireworks","groq","openrouter","bedrock","ollama","local"]}),s.model("gpt-oss-20b",{name:"GPT-OSS 20B",openWeights:!0,firstParty:!1,retention:"unknown",defaultHosting:"local",on:["together","fireworks","groq","openrouter","ollama","local"]});let u=o("google",{family:{id:"gemini",name:"Gemini"},region:"us",retention:"configurable",training:{apiDefault:"no",consumerDefault:"yes",consumerControl:"none",source:"https://ai.google.dev/gemini-api/terms"}});u.model("gemini-3.7-flash",{name:"Gemini 3.7 Flash",capability:null,price:g(.75,3.75),on:["vertex"]}),u.model("gemini-3.6-flash",{name:"Gemini 3.6 Flash",capability:null,price:g(.75,3.75),on:["vertex"]}),u.model("gemini-3.5-flash",{name:"Gemini 3.5 Flash",capability:null,price:g(1.5,9),on:["vertex"]}),u.model("gemini-3.5-flash-lite",{name:"Gemini 3.5 Flash Lite",capability:null,price:g(.3,2.5),on:["vertex"]}),u.model("gemini-3.1-pro-preview",{name:"Gemini 3.1 Pro Preview",capability:"reasoning",price:g(2,12,{longContext:{thresholdInputTokens:2e5,input:4,output:18}}),on:["vertex"]}),u.model("gemini-2.5-pro",{name:"Gemini 2.5 Pro",capability:"reasoning",price:g(1.25,10,{longContext:{thresholdInputTokens:2e5,input:2.5,output:15}}),on:["vertex"]}),u.model("gemini-2.5-flash",{name:"Gemini 2.5 Flash",capability:null,price:g(.3,2.5),on:["vertex"]}),u.model("gemini-2.5-flash-lite",{name:"Gemini 2.5 Flash Lite",capability:null,price:g(.1,.4),on:["vertex"]}),u.model("gemini-1-5-pro",{name:"Gemini 1.5 Pro",on:["vertex"]}),u.model("gemini-1-5-flash",{name:"Gemini 1.5 Flash",on:["vertex"]});let v=o("xai",{family:{id:"grok",name:"Grok"},region:"us",retention:"configurable",training:{apiDefault:"no",consumerDefault:"unknown",consumerControl:"unknown",source:"https://docs.x.ai/developers/faq/security"}});v.model("grok-4.6",{name:"Grok 4.6",ctx:5e5,capability:"reasoning",price:g(2,6,{cacheRead:.5,longContext:{thresholdInputTokens:2e5,input:4,output:12}}),on:["bedrock"]}),v.model("grok-4.5",{name:"Grok 4.5",ctx:5e5,capability:"reasoning",price:g(2,6,{cacheRead:.3,longContext:{thresholdInputTokens:2e5,input:4,output:12}})}),v.model("grok-4.3",{name:"Grok 4.3",ctx:1e6,capability:"reasoning",price:g(1.25,2.5,{cacheRead:.2,longContext:{thresholdInputTokens:2e5,input:2.5,output:5}}),on:["bedrock"]}),v.model("grok-build-0.1",{name:"Grok Build 0.1",ctx:256e3,capability:"code",price:g(1,2,{cacheRead:.2,longContext:{thresholdInputTokens:2e5,input:2,output:4}})});let w=o("deepseek",{family:{id:"deepseek",name:"DeepSeek"},region:"cn",retention:"configurable",training:{apiDefault:"yes",consumerDefault:"yes",consumerControl:"opt-out",source:"https://cdn.deepseek.com/policies/en-US/deepseek-privacy-policy.html"}});w.model("deepseek-v4-flash",{name:"DeepSeek V4 Flash",ctx:1e6,capability:null,price:g(.44,1.32,{cacheRead:.014}),on:["bedrock","together","fireworks","openrouter","ollama","local"]}),w.model("deepseek-v4-pro",{name:"DeepSeek V4 Pro",ctx:1e6,capability:"reasoning",price:g(1.32,3.96,{cacheRead:.044}),on:["bedrock","together","fireworks","openrouter"]}),w.model("deepseek-r1",{name:"DeepSeek R1",seen:"discovered",capability:"reasoning",openWeights:!0,defaultHosting:"local",on:["bedrock","together","fireworks","openrouter","ollama","local"]});let x=o("cohere",{family:{id:"command",name:"Command"},region:"us",retention:"configurable",training:{apiDefault:"unknown",consumerDefault:"unknown",consumerControl:"opt-out",source:"https://cohere.com/security"}});x.model("command-a-plus-05-2026",{name:"Command A+",ctx:128e3,maxOut:64e3,on:["bedrock"]}),x.model("command-a-03-2025",{name:"Command A",ctx:256e3,maxOut:8e3,on:["bedrock"]}),x.model("command-a-reasoning-08-2025",{name:"Command A Reasoning",ctx:256e3,maxOut:32e3,capability:"reasoning"}),x.model("command-r-plus-08-2024",{name:"Command R+",ctx:128e3,maxOut:4e3,price:g(2.5,10),aliases:["command-r-plus"],on:["bedrock"]});let y=o("meta",{family:{id:"llama",name:"Llama"},openWeights:!0,retention:"unknown",defaultHosting:"local"}),z=["bedrock","together","fireworks","groq","openrouter","ollama","local"];y.model("llama-3-3-70b",{name:"Llama 3.3 70B",ctx:128e3,on:[...z]}),y.model("llama-3-1-70b",{name:"Llama 3.1 70B",ctx:128e3,on:[...z]}),y.model("llama-3-1-8b",{name:"Llama 3.1 8B",ctx:128e3,on:[...z]});let A=o("alibaba",{family:{id:"qwen",name:"Qwen"},openWeights:!0,retention:"unknown",defaultHosting:"local"});A.model("qwen-3-235b",{name:"Qwen 3 235B",on:[...z]}),A.model("qwen-3-coder-480b",{name:"Qwen 3 Coder 480B",capability:"code",on:[...z]});let B=o("amazon",{family:{id:"nova",name:"Nova"},retention:"configurable"});B.model("nova-2-lite",{name:"Nova 2 Lite",ctx:1e6,maxOut:64e3,aliases:["nova-2-lite-v1:0"],on:["bedrock"]});let C=o("mistral",{family:{id:"mistral",name:"Mistral"},openWeights:!0,retention:"unknown",defaultHosting:"local"});C.model("mixtral-8x7b",{name:"Mixtral 8x7B",seen:"discovered",on:[...z]}),function(a){let b=new Map;for(let c of a)b.set(c.id,c);for(let c of a)for(let a of c.aliases)b.has(a)||b.set(a,c);Object.freeze([...a])}(Object.freeze([...p.models(),...s.models(),...u.models(),...v.models(),...w.models(),...x.models(),...C.models(),...y.models(),...A.models(),...B.models()])),d.k5(["reasoning","code"]),d.k5(["zero_retention","no_storage","configurable","on_device","on_infrastructure","unknown"]),d.k5(["managed","discovered"]);let D=d.k5(["yes","no","unknown"]),E=d.k5(["opt-in","opt-out","none","unknown"]);d.Ik({apiDefault:D,consumerDefault:D,consumerControl:E,source:d.Yj().nullable()});let F=d.k5(["api","consumer","enterprise","unknown"]);d.Ik({tier:F,controlExercised:d.zM().nullable()}),Object.freeze({tier:"unknown",controlExercised:null}),Object.freeze(["gateway","unknown","cli","api"]);let G=new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1});function H(a){return G.format(a)}function I(a){return a>0&&a<.1?`$${a.toFixed(4)}`:`$${a.toFixed(2)}`}function J(a,b){return b?`≥ ${I(a)}`:I(a)}var K=c(28181),L=c(63367);let M={ClaudeCode:"claudecode",Cursor:"cursor",Copilot:"copilot",Codex:"codex",Antigravity:"antigravity",Windsurf:"windsurf",ClaudeDesktop:"claudedesktop",ChatGpt:"chatgpt",ClaudeAi:"claudeai",Api:"api"},N=d.k5(M).meta({id:"Harness"}),O={ClaudeCode:"claude-code",ClaudeDesktop:"claude-desktop",Cursor:"cursor",ChatGpt:"chatgpt",ClaudeAi:"claude-ai",Copilot:"github-copilot",Codex:"codex",Antigravity:"antigravity",Cli:"cli",Unknown:"unknown"},P=d.k5(O).meta({id:"SourceTool"});O.ClaudeCode,M.ClaudeCode,O.ClaudeDesktop,M.ClaudeDesktop,O.Copilot,M.Copilot,O.Cursor,M.Cursor,O.ChatGpt,M.ChatGpt,O.Codex,M.Codex,O.Antigravity,M.Antigravity,O.ClaudeAi,M.ClaudeAi;let Q=d.k5(["pii","financial","secret","phi","code_context","code_flaw","custom","config"]).meta({id:"DetectionCategory"}),R=d.k5(["critical","high","medium","low"]).meta({id:"Severity"}),S=d.k5(["warn","redact","block","allow","log"]).meta({id:"ActionTaken"}),T=S.options,U=d.Ik({start:d.ai().int().nonnegative(),end:d.ai().int().nonnegative()}).meta({id:"Span"});d.Ik({id:d.Os(),eventId:d.Os(),ruleId:d.Yj(),category:Q,severity:R,span:U,maskedMatch:d.Yj(),actionTaken:S,confidence:d.ai().min(0).max(1)}).meta({id:"Finding"}).meta({id:"DetectedFinding"});let V=d.k5(["blocked","redacted","warned","allowed","quarantined","monitored"]).meta({id:"FindingAction"}),W=N.extract(["ClaudeCode","ClaudeDesktop","Cursor","Copilot","ChatGpt","ClaudeAi","Codex","Antigravity","Api"]).meta({id:"FindingProvider"}),X=d.k5(["secret","pii","source_code","code_flaw","external_share","mcp_server","customer_data","financial","phi","custom"]).meta({id:"FindingCategory"});d.k5(["in-flight","at-rest"]).meta({id:"FindingOrigin"});let Y=d.k5(["open","handled","resolved","dismissed"]).meta({id:"FindingStatus"});d.k5(["enforced-in-flight","fixed-at-source","exception","acknowledged","false-positive","redetected"]).meta({id:"ResolutionMethod"});let Z=d.Ik({maskedValue:d.Yj(),contextPrefix:d.Yj()}).meta({id:"FindingMatch"}),$=d.Ik({id:d.Yj(),name:d.Yj().nullable()}).meta({id:"FindingDetectionRef"}),_=d.Ik({id:d.Yj(),name:d.Yj()}).meta({id:"FindingPolicyRef"}),aa=d.Ik({id:d.Yj(),name:d.Yj()}).meta({id:"FindingUser"}),ab=d.Ik({id:d.Yj(),provider:W,repo:d.Yj(),file:d.Yj(),user:aa.optional(),toolName:d.Yj().optional(),action:V,detectedAt:K.w$(),confidence:d.ai().min(0).max(1),status:Y.optional(),eventId:d.Yj().optional(),sessionId:d.Yj().optional()}).meta({id:"FindingInstance"}),ac=d.Ik({id:d.Yj(),category:X,subtype:d.Yj(),severity:R,match:Z,detection:$,policy:_,instanceCount:d.ai().int().nonnegative(),providers:d.YO(W),aggregateAction:V.nullable(),latestDetectedAt:K.w$(),instances:d.YO(ab),status:Y.optional(),users:d.YO(aa).optional()}).meta({id:"FindingGroup"});d.Ik({findings:d.ai().int().nonnegative(),groups:d.ai().int().nonnegative(),bySeverity:d.Ik({critical:d.ai().int().nonnegative(),high:d.ai().int().nonnegative(),medium:d.ai().int().nonnegative(),low:d.ai().int().nonnegative()})}).meta({id:"FindingStats"});let ad=d.Ik({value:d.Yj(),count:d.ai().int().nonnegative()}).meta({id:"FindingFacetItem"}),ae=d.Ik({severity:d.YO(ad),subtype:d.YO(ad),provider:d.YO(ad),action:d.YO(ad),status:d.YO(ad),tool:d.YO(ad).optional()}).meta({id:"FindingFacets"});d.Ik({severity:d.YO(R).optional(),subtype:d.YO(d.Yj()).optional(),provider:d.YO(W).optional(),action:d.YO(V).optional(),status:d.YO(Y).optional(),q:d.Yj().optional(),sessionId:d.Yj().optional(),from:K.w$().optional(),includeId:d.Yj().optional(),groupBy:d.eu("type").optional(),limit:L.ai().int().min(1).max(100).optional(),cursor:d.Yj().optional()}),d.Ik({totals:d.Ik({findings:d.ai().int().nonnegative(),groups:d.ai().int().nonnegative()}),facets:ae,items:d.YO(ac),nextCursor:d.Yj().nullable(),sessionFirings:d.g1(d.Yj(),d.ai().int().nonnegative()).optional()}).meta({id:"ListGroupedFindingsResponse"}),d.Ik({action:V.exclude(["quarantined"]),instanceId:d.Yj().optional()}).meta({id:"ApplyFindingActionRequest"}),ac.meta({id:"ApplyFindingActionResponse"}),d.Ik({severity:d.YO(R).optional(),subtype:d.YO(d.Yj()).optional(),provider:d.YO(W).optional(),action:d.YO(V).optional(),q:d.Yj().optional(),format:d.k5(["csv","json"]).optional()});let af=ab.extend({groupId:d.Yj(),category:X,subtype:d.Yj(),severity:R,match:Z,detection:$,policy:_}).meta({id:"FindingInstanceDetail"});d.Ik({severity:d.YO(R).optional(),subtype:d.YO(d.Yj()).optional(),provider:d.YO(W).optional(),action:d.YO(V).optional(),status:d.YO(Y).optional(),tool:d.YO(d.Yj()).optional(),repo:d.Yj().optional(),file:d.Yj().optional(),q:d.Yj().optional(),sessionId:d.Yj().optional(),from:K.w$().optional(),limit:L.ai().int().min(1).max(200).optional(),cursor:d.Yj().optional()}),d.Ik({totals:d.Ik({findings:d.ai().int().nonnegative()}),facets:ae,items:d.YO(af),nextCursor:d.Yj().nullable()}).meta({id:"ListFindingInstancesResponse"});let ag=d.Ik({file:d.Yj(),instanceCount:d.ai().int().nonnegative(),maxSeverity:R,latestDetectedAt:K.w$(),status:Y.optional(),ruleIds:d.YO(d.Yj())}).meta({id:"FindingLocationFile"}),ah=d.Ik({repo:d.Yj(),instanceCount:d.ai().int().nonnegative(),maxSeverity:R,latestDetectedAt:K.w$(),status:Y.optional(),files:d.YO(ag)}).meta({id:"FindingLocationRepo"});d.Ik({severity:d.YO(R).optional(),subtype:d.YO(d.Yj()).optional(),provider:d.YO(W).optional(),action:d.YO(V).optional(),status:d.YO(Y).optional(),tool:d.YO(d.Yj()).optional(),q:d.Yj().optional(),sessionId:d.Yj().optional(),from:K.w$().optional(),limit:L.ai().int().min(1).max(500).optional()}),d.Ik({totals:d.Ik({findings:d.ai().int().nonnegative(),repos:d.ai().int().nonnegative(),files:d.ai().int().nonnegative()}),items:d.YO(ah),hasMore:d.zM()}).meta({id:"ListFindingLocationsResponse"});let ai=d.k5(["host","harness","user","skill","hook","mcp_server","config_file"]).meta({id:"InventoryObjectType"}),aj=d.k5(["session","run","tool_call","llm_call","source_lookup","prompt","response","code_change","tool_use","model_refusal","config_scan"]).meta({id:"AuditEventType"}),ak=d.g1(d.Yj(),d.L5());d.Ik({host_name:d.Yj().optional(),os:d.Yj().optional(),os_version:d.Yj().optional(),arch:d.Yj().optional()}).catchall(d.L5()),d.Ik({harness_version:d.Yj().optional(),interface:d.Yj().optional()}).catchall(d.L5()),d.Ik({display_name:d.Yj().optional(),email:d.Yj().optional()}).catchall(d.L5()),d.Ik({source:d.Yj().optional(),version:d.Yj().optional(),description:d.Yj().optional(),updated_at:d.Yj().optional(),scope:d.Yj().optional(),plugin_name:d.Yj().optional()}).catchall(d.L5()),d.Ik({event:d.Yj().optional(),matcher:d.Yj().optional(),command:d.Yj().optional(),scope:d.Yj().optional(),plugin_name:d.Yj().optional(),timeout:d.ai().optional()}).catchall(d.L5()),d.Ik({scope:d.Yj().optional(),transport:d.Yj().optional(),command:d.Yj().optional(),url:d.Yj().optional(),env_keys:d.YO(d.Yj()).optional(),plugin_name:d.Yj().optional(),marketplace:d.Yj().optional(),project:d.Yj().optional()}).catchall(d.L5()),d.Ik({kind:d.Yj().optional(),detail:d.Yj().optional(),scope:d.Yj().optional(),updated_at:d.Yj().optional(),entry_count:d.ai().optional()}).catchall(d.L5());let al=d.Ik({model:d.Yj().optional(),provider:d.Yj().optional(),input_tokens:d.ai().int().nonnegative().optional(),output_tokens:d.ai().int().nonnegative().optional(),cache_creation_input_tokens:d.ai().int().nonnegative().optional(),cache_read_input_tokens:d.ai().int().nonnegative().optional(),ephemeral_1h_input_tokens:d.ai().int().nonnegative().optional(),ephemeral_5m_input_tokens:d.ai().int().nonnegative().optional(),web_search_requests:d.ai().int().nonnegative().optional(),web_fetch_requests:d.ai().int().nonnegative().optional(),service_tier:d.Yj().optional(),stop_reason:d.Yj().optional(),message_id:d.Yj().optional(),uuid:d.Yj().optional(),parent_uuid:d.Yj().optional(),run_key:d.Yj().optional()}).catchall(d.L5());d.Ik({sessionId:d.Yj().min(1),messageId:d.Yj().min(1),parentId:d.Yj().min(1),rootSessionId:d.Yj().min(1),startedAt:K.w$(),attributes:al});let am=d.Ik({tool_name:d.Yj().optional(),tool_use_id:d.Yj().optional(),target:d.Yj().optional(),is_error:d.zM().optional(),input_size:d.ai().int().nonnegative().optional(),output_size:d.ai().int().nonnegative().optional(),uuid:d.Yj().optional(),parent_uuid:d.Yj().optional(),run_key:d.Yj().optional()}).catchall(d.L5());d.Ik({source_tool:d.Yj().optional(),file_path:d.Yj().optional(),repo:d.Yj().optional(),tool_name:d.Yj().optional(),gitignored:d.zM().optional(),whole_file:d.zM().optional(),correlation_id:d.uR().optional(),trace_id:d.Yj().regex(/^[0-9a-f]{32}$/).optional(),exception_ids:d.YO(d.Os()).optional(),inspection_ms:d.ai().int().nonnegative().optional()}).catchall(d.L5());let an=d.Ik({ruleId:d.Yj().min(1),ruleName:d.Yj(),ruleVersion:d.Yj().min(1),category:Q,severity:R,span:U,maskedMatch:d.Yj(),actionTaken:S,confidence:d.ai().min(0).max(1)});d.Ik({sessionId:d.Yj().min(1),toolUseId:d.Yj().min(1),parentId:d.Yj().min(1),rootSessionId:d.Yj().min(1),startedAt:K.w$(),attributes:am,inspections:d.YO(an).default([])});let ao=d.Ik({objectType:ai,identityKey:d.Yj().min(1),location:d.Yj().optional(),title:d.Yj().optional(),hostId:d.Yj().optional(),attributes:ak.default({})}).meta({id:"InventoryInput"}),ap=d.Ik({url:d.Yj().min(1),name:d.Yj().optional(),attributes:ak.default({})}).meta({id:"SourceProjectInput"}),aq=d.Ik({id:d.Yj().min(1),eventType:aj,startedAt:K.w$(),endedAt:K.w$().optional(),parentId:d.Yj().optional(),rootSessionId:d.Yj().optional(),hostId:d.Yj().optional(),harnessId:d.Yj().optional(),sourceProjectId:d.Yj().optional(),severity:R.optional(),priority:d.Yj().optional(),content:d.Yj().optional(),contentHash:d.Yj().optional(),attributes:ak.optional()}).meta({id:"AuditEventInput"});d.Ik({class:d.Yj().min(1),label:d.Yj().optional(),attributes:ak.optional()});let ar=d.Ik({ruleId:d.Yj().min(1),version:d.Yj().min(1),name:d.Yj(),category:Q,severity:R,definition:d.Yj()});d.Ik({id:d.Yj().min(1),auditEventId:d.Yj().min(1),inspectionDefinitionId:d.Yj().min(1),classifiedDataId:d.Yj().optional(),span:U,maskedMatch:d.Yj(),actionTaken:S,confidence:d.ai().min(0).max(1),findingKey:d.Yj().optional(),firstDetectedAt:K.w$().optional()}),d.Ik({host:ao.optional(),harness:ao.optional(),project:ap.optional()}).meta({id:"InventoryContext"}),d.Ik({hostId:d.Yj().optional(),harnessId:d.Yj().optional(),accountId:d.Yj().optional(),sourceProjectId:d.Yj().optional()}).meta({id:"ResolvedInventory"}),d.Ik({hosts:d.YO(d.Yj()),harnesses:d.YO(d.Yj()),osVersions:d.YO(d.Yj()),projects:d.YO(d.Yj())}).meta({id:"InventoryFacets"});let as=d.Ik({sessionId:d.Yj(),model:d.Yj(),provider:d.Yj(),inputTokens:d.ai().int().nonnegative(),outputTokens:d.ai().int().nonnegative(),cacheCreation:d.ai().int().nonnegative(),cacheRead:d.ai().int().nonnegative(),totalTokens:d.ai().int().nonnegative(),estimatedCostUsd:d.ai().nullable()}).meta({id:"TokenRollup"});d.Ik({sessionId:d.Yj(),rollups:d.YO(as),totalTokens:d.ai().int().nonnegative(),estimatedCostUsd:d.ai().nullable(),costIsPartial:d.zM()});let at=d.Ik({provider:d.Yj(),model:d.Yj(),inputTokens:d.ai().int().nonnegative(),outputTokens:d.ai().int().nonnegative(),cacheTokens:d.ai().int().nonnegative(),totalTokens:d.ai().int().nonnegative(),estimatedCostUsd:d.ai().nullable()});d.Ik({models:d.YO(at),sessionCount:d.ai().int().nonnegative(),totalTokens:d.ai().int().nonnegative(),estimatedCostUsd:d.ai(),costIsPartial:d.zM()});let au=d.k5(["active","completed","interrupted","error"]),av=d.k5(["session","prompt","response","tool","hook","detection","share","permission","commit","error","active"]),aw=d.k5(["detections","shares","inventory"]),ax=d.Ik({id:d.Yj(),occurredAt:K.w$(),kind:av,title:d.Yj(),detail:d.Yj(),tool:d.Yj().nullable(),severity:R.nullable(),link:aw.nullable(),targetId:d.Yj().nullable(),internal:d.zM(),flagged:d.zM()}).meta({id:"ActivityAuditEvent"}),ay=d.Ik({id:d.Yj(),harness:N,title:d.Yj(),project:d.Yj(),repo:d.Yj(),branches:d.YO(d.Yj()),startedAt:K.w$(),endedAt:K.w$().nullable(),status:au,turns:d.ai().int().nonnegative(),findings:d.ai().int().nonnegative(),shares:d.ai().int().nonnegative()}).meta({id:"ActivitySessionSummary"});ay.extend({host:d.Yj(),cwd:d.Yj(),models:d.YO(d.Yj()),version:d.Yj(),tokens:as,tools:d.g1(d.Yj(),d.ai().int().nonnegative()),files:d.YO(d.Yj()),commits:d.ai().int().nonnegative(),events:d.YO(ax)}).meta({id:"ActivitySession"}),d.Ik({tz:d.Yj().optional()});let az=d.Ik({sessionsToday:d.ai().int().nonnegative(),liveNow:d.ai().int().nonnegative(),toolCallsToday:d.ai().int().nonnegative(),findingsToday:d.ai().int().nonnegative(),egressToday:d.ai().int().nonnegative()}).meta({id:"GetActivityStatsResponse"});d.Ik({q:d.Yj().optional(),harness:d.YO(N).optional(),from:d.KC([K.p6(),K.w$()]).optional(),to:d.KC([K.p6(),K.w$()]).optional(),excludeEmpty:d.uE().optional(),limit:L.ai().int().min(1).max(100).default(50),cursor:d.Yj().optional()});let aA=d.Ik({items:d.YO(ay),nextCursor:d.Yj().nullable(),emptyCount:d.ai().int().nonnegative()}).meta({id:"ListActivitySessionsResponse"});d.Ik({limit:L.ai().int().min(1).max(500).default(100),cursor:d.Yj().optional(),order:d.k5(["asc","desc"]).default("asc")}),d.Ik({items:d.YO(ax),nextCursor:d.Yj().nullable()}).meta({id:"ListSessionEventsResponse"}),d.Ik({format:d.k5(["ndjson","json"]).default("ndjson")}),d.Ik({format:d.k5(["csv","json"]).default("csv"),q:d.Yj().optional(),harness:d.YO(N).optional(),from:d.KC([K.p6(),K.w$()]).optional(),to:d.KC([K.p6(),K.w$()]).optional()}),d.Ik({stats:az,sessions:aA}).meta({id:"ActivityOverviewResponse"});let aB=d.k5(["user","project","local","plugin"]),aC=d.Ik({name:d.Yj().min(1),source:d.Yj().min(1),scope:aB,pluginName:d.Yj().optional(),version:d.Yj().optional(),description:d.Yj().optional(),updatedAt:K.w$().optional(),location:d.Yj().optional()}),aD=d.Ik({event:d.Yj().min(1),matcher:d.Yj().optional(),command:d.Yj().min(1),timeout:d.ai().optional(),scope:aB,pluginName:d.Yj().optional(),location:d.Yj().optional()}),aE=d.Ik({name:d.Yj().min(1),scope:aB,pluginName:d.Yj().optional(),marketplace:d.Yj().optional(),project:d.Yj().optional(),transport:d.Yj().min(1),command:d.Yj().optional(),url:d.Yj().optional(),envKeys:d.YO(d.Yj()).optional(),location:d.Yj().optional()}),aF=d.Ik({name:d.Yj().min(1),path:d.Yj().min(1),scope:aB,kind:d.Yj().min(1),detail:d.Yj().optional(),entryCount:d.ai().optional(),updatedAt:K.w$().optional()});d.Ik({scannedAt:K.w$(),skills:d.YO(aC),hooks:d.YO(aD),mcpServers:d.YO(aE),configFiles:d.YO(aF),errors:d.YO(d.Ik({source:d.Yj(),reason:d.Yj()}))});let aG=d.Ik({ruleId:d.Yj().min(1),version:d.Yj().min(1),span:U,maskedMatch:d.Yj(),actionTaken:S,confidence:d.ai().min(0).max(1)});d.Ik({items:d.YO(ao),scanEvent:aq,definitions:d.YO(ar).optional(),findings:d.YO(aG).optional()});let aH=d.k5(["project","skill","mcp","hook","config"]).meta({id:"AssetType"}),aI=d.k5(["open","approved","blocked"]).meta({id:"AccessLevel"}),aJ=d.k5(["source","public-dep","vendored","config","data","docs","generated"]).meta({id:"Origin"}),aK=d.k5(["known-good","risky","unapproved"]).meta({id:"TrustLevel"}),aL=d.k5(["update","stale","conflict","unknown","change","untracked","risk","findings"]).meta({id:"Flag"}),aM=d.k5(["public","private"]).meta({id:"Visibility"}),aN=d.k5(["block","redact","warn"]).meta({id:"HarnessEventKind"}),aO=N.extract(["ClaudeCode","Cursor","Codex","Antigravity"]).meta({id:"HarnessId"}),aP=d.Ik({open:d.ai().int().nonnegative(),approved:d.ai().int().nonnegative(),blocked:d.ai().int().nonnegative(),total:d.ai().int().nonnegative()}).meta({id:"AccessCounts"}),aQ=d.Ik({id:d.Yj(),type:aH,name:d.Yj(),sub:d.Yj(),flags:d.YO(aL),trust:aK.optional()}).meta({id:"AssetSummary"}),aR=d.Ik({id:d.Yj(),name:d.Yj(),repo:d.Yj(),visibility:aM,language:d.Yj(),policyDefault:aI,updatedAt:K.w$(),accessCounts:aP,findingsCount:d.ai().int().nonnegative()}).meta({id:"ProjectSummary"}),aS=d.Ik({type:aH,assets:d.YO(aQ)}),aT=d.Ik({id:aO,label:d.Yj(),kind:d.Yj(),version:d.Yj(),sessions:d.ai().int().nonnegative(),assetCount:d.ai().int().nonnegative(),flagCount:d.ai().int().nonnegative(),projects:d.YO(aR),categories:d.YO(aS)}).meta({id:"HarnessSummary"});d.Ik({items:d.YO(aT)}).meta({id:"ListHarnessesResponse"});let aU=d.Ik({type:aH,total:d.ai().int().nonnegative(),trustRollup:d.Ik({"known-good":d.ai().int().nonnegative(),risky:d.ai().int().nonnegative(),unapproved:d.ai().int().nonnegative()}).partial().strict().optional(),flagRollup:d.Ik({update:d.ai().int().nonnegative(),stale:d.ai().int().nonnegative(),conflict:d.ai().int().nonnegative(),unknown:d.ai().int().nonnegative(),change:d.ai().int().nonnegative(),untracked:d.ai().int().nonnegative(),risk:d.ai().int().nonnegative(),findings:d.ai().int().nonnegative()}).partial().strict(),items:d.YO(aQ)}).meta({id:"AssetGroup"});d.Ik({groups:d.YO(aU)}).meta({id:"ListAssetsResponse"});let aV=d.Ik({name:d.Yj(),signature:d.Yj(),description:d.Yj(),write:d.zM(),risk:d.Yj().nullable()}).meta({id:"McpTool"}),aW=d.Ik({id:d.Yj(),title:d.Yj(),note:d.Yj()});aQ.extend({description:d.Yj().nullable(),trust:aK.nullable(),meta:d.g1(d.Yj(),d.L5()),finding:aW.nullable(),tools:d.YO(aV).optional()}).meta({id:"AssetDetail"}),d.Ik({items:d.YO(aR)}).meta({id:"ListProjectsResponse"}),d.Ik({attention:d.ai().int().nonnegative(),byType:d.Ik({project:d.ai().int().nonnegative(),skill:d.ai().int().nonnegative(),mcp:d.ai().int().nonnegative(),hook:d.ai().int().nonnegative(),config:d.ai().int().nonnegative()}),harnesses:d.ai().int().nonnegative(),mcpTrust:d.Ik({"known-good":d.ai().int().nonnegative(),risky:d.ai().int().nonnegative(),unapproved:d.ai().int().nonnegative()})}).meta({id:"InventoryStats"});let aX=d.Ik({path:d.Yj(),name:d.Yj(),origin:aJ,access:aI,isCustom:d.zM(),findings:d.ai().int().nonnegative(),blockedAt:K.w$().nullable().optional(),note:d.Yj().nullable().optional()}).meta({id:"FileSummary"}),aY=d.Ik({name:d.Yj(),path:d.Yj(),accessCounts:aP}).meta({id:"FolderSummary"});d.Ik({project:d.Ik({id:d.Yj(),repo:d.Yj(),visibility:aM}),path:d.Yj(),folders:d.YO(aY).optional(),files:d.YO(aX)}).meta({id:"ProjectTreeResponse"}),aX.extend({project:d.Ik({repo:d.Yj(),visibility:aM,language:d.Yj(),policyDefault:aI,updatedAt:K.w$()}),findingsRefs:d.YO(d.Ik({id:d.Yj(),title:d.Yj()}))}).meta({id:"FileDetail"}),d.Ik({path:d.Yj(),access:aI}).meta({id:"SetFileAccessBody"}),d.Ik({file:aX,accessCounts:aP}).meta({id:"SetFileAccessResponse"}),d.Ik({trust:aK}).meta({id:"SetMcpTrustBody"});let aZ=d.Ik({kind:aN,title:d.Yj(),detail:d.Yj(),occurredAt:K.w$(),findingId:d.Yj().nullable().optional()}).meta({id:"HarnessEventItem"});d.Ik({counts:d.Ik({block:d.ai().int().nonnegative(),redact:d.ai().int().nonnegative(),warn:d.ai().int().nonnegative()}),items:d.YO(aZ)}).meta({id:"HarnessEventsResponse"}),d.Ik({jobId:d.Yj(),startedAt:K.w$()}).meta({id:"RescanResponse"}),d.Ik({repo:d.Yj()}).meta({id:"ConnectProjectBody"}),d.Ik({type:d.YO(aH).optional(),q:d.Yj().optional()}),d.Ik({path:d.Yj().optional(),q:d.Yj().optional(),filter:d.k5(["blocked"]).optional()}),d.Ik({path:d.Yj()}),d.Ik({limit:L.ai().int().min(1).max(50).default(7)});let a$=d.k5(["provider","internal","external","ip"]).meta({id:"DestinationKind"}),a_=d.k5(["https","http","sftp","grpc","smtp","ws","wss"]).meta({id:"Transport"}),a0=d.k5(["secrets","pii","customer","source","telemetry","logs","metrics","none"]).meta({id:"DataClass"});a0.options;let a1=d.k5(["recognized","internal","unverified","ip"]).meta({id:"ShareTrustLevel"}),a2=d.k5(["allow","block"]).meta({id:"EgressDecision"}),a3=d.k5(["allowed","blocked","review"]).meta({id:"EgressStatus"}),a4=d.k5(["raw_ip","unverified_domain","plaintext_transport"]).meta({id:"ReviewReason"}),a5=d.k5(["GET","POST","PUT","DELETE","SDK","REF"]).meta({id:"HttpMethod"}),a6=d.Ik({needsReview:d.zM(),reasons:d.YO(a4)}).meta({id:"ReviewInfo"}),a7=d.Ik({port:d.ai().int().nullable(),geo:d.Yj().nullable(),ptr:d.Yj().nullable()}).meta({id:"DestinationNetwork"}),a8=d.Ik({id:d.Yj(),method:a5,transport:a_,url:d.Yj(),template:d.zM(),dataClass:a0,lastSeen:K.w$(),callSiteCount:d.ai().int().nonnegative()}).meta({id:"EndpointSummary"}),a9=d.Ik({id:d.Yj(),project:d.Yj(),file:d.Yj(),line:d.ai().int().nonnegative(),snippet:d.Yj(),dynamic:d.zM(),vendored:d.zM(),projectId:d.Yj().nullable()}).meta({id:"CallSite"}),ba=a8.extend({sites:d.YO(a9)}).meta({id:"EndpointWithSites"}),bb=d.Ik({id:d.Yj(),kind:a$,name:d.Yj(),host:d.Yj(),category:d.Yj(),trust:a1,status:a3,isCustom:d.zM(),lastSeen:K.w$(),endpointCount:d.ai().int().nonnegative(),callSiteCount:d.ai().int().nonnegative(),transports:d.YO(a_),dataClasses:d.YO(a0),review:a6,network:a7.nullable(),endpoints:d.YO(a8)}).meta({id:"ShareDestinationSummary"});bb.omit({endpointCount:!0,callSiteCount:!0,endpoints:!0}).extend({note:d.Yj().nullable(),endpoints:d.YO(ba)}).meta({id:"ShareDestinationDetail"});let bc=d.Ik({id:d.Yj(),kind:a$,name:d.Yj(),host:d.Yj(),trust:a1,status:a3,review:a6,topDataClass:a0,callSiteCount:d.ai().int().nonnegative(),lastSeen:K.w$()}).meta({id:"ReviewDestination"}),bd=d.Ik({kind:a$,total:d.ai().int().nonnegative(),items:d.YO(bb)}).meta({id:"ShareDestinationGroup"});d.Ik({groups:d.YO(bd)}).meta({id:"ListShareDestinationsResponse"}),d.Ik({items:d.YO(bc)}).meta({id:"NeedsReviewResponse"}),d.Ik({destinations:d.ai().int().nonnegative(),endpoints:d.ai().int().nonnegative(),callSites:d.ai().int().nonnegative(),needsReview:d.ai().int().nonnegative(),insecure:d.ai().int().nonnegative(),byKind:d.Ik({provider:d.ai().int().nonnegative(),internal:d.ai().int().nonnegative(),external:d.ai().int().nonnegative(),ip:d.ai().int().nonnegative()}),byTrust:d.Ik({recognized:d.ai().int().nonnegative(),internal:d.ai().int().nonnegative(),unverified:d.ai().int().nonnegative(),ip:d.ai().int().nonnegative()})}).meta({id:"SharesStats"}),d.Ik({decision:a2.nullable()}).meta({id:"SetEgressDecisionBody"}),d.Ik({destination:bb}).meta({id:"SetEgressDecisionResponse"}),d.Ik({q:d.Yj().optional(),kind:d.YO(a$).optional(),groupBy:d.k5(["destination"]).default("destination"),review:d.uE().default(!1)}),d.Ik({format:d.k5(["csv","json"]).default("csv"),q:d.Yj().optional(),kind:d.YO(a$).optional()});let be=d.k5(["npm","pypi","go","maven","rubygems","cargo","composer","nuget"]).meta({id:"EgressEcosystem"});d.Ik({id:d.Yj(),name:d.Yj(),category:d.Yj(),hostSuffixes:d.YO(d.Yj()).min(1),apiBase:d.Yj(),defaultDataClasses:d.YO(a0).min(1),sdks:d.jg(be,d.YO(d.Yj()))}).meta({id:"ProviderRegistryEntry"});let bf=d.Ik({file:d.Yj(),line:d.ai().int().positive(),snippet:d.Yj(),dynamic:d.zM(),vendored:d.zM()}).meta({id:"EgressCallSiteHit"}),bg=d.Ik({host:d.Yj(),kind:a$,name:d.Yj(),category:d.Yj(),trust:a1,network:a7.nullable(),method:a5,transport:a_,url:d.Yj(),template:d.zM(),dataClass:a0,site:bf}).meta({id:"ResolvedEgressHit"}),bh=d.gM("mode",[d.Ik({mode:d.eu("walk"),walkedPrefix:d.Yj()}),d.Ik({mode:d.eu("ledger"),scannedFiles:d.YO(d.Yj()),deletedFiles:d.YO(d.Yj())})]).meta({id:"EgressReconcile"});d.Ik({projectKey:d.Yj().min(1),project:d.Yj(),projectId:d.Yj().nullable(),reconcile:bh,hits:d.YO(bg)}).meta({id:"RecordProjectEgressInput"}),d.Ik({destinations:d.ai().int().nonnegative(),endpoints:d.ai().int().nonnegative(),callSites:d.ai().int().nonnegative(),truncated:d.zM(),droppedFiles:d.YO(d.Yj()).default([])}).meta({id:"EgressWriteSummary"}),d.Ik({specVersion:d.eu(1),endpoint:d.Yj().min(1),apiKey:d.Yj().min(1),keyPrefix:d.Yj().min(1).max(16).optional(),mintedAt:K.w$().optional()});let bi=d.Ik({packId:d.Yj().min(1),version:d.Yj().min(1),enabled:d.zM(),updatedAt:d.Yj().nullable()}).meta({id:"StorePosturePack"}),bj=d.Ik({total:d.ai().int().min(0),disabled:d.ai().int().min(0),byAction:d.Ik({warn:d.ai().int().min(0),redact:d.ai().int().min(0),block:d.ai().int().min(0),allow:d.ai().int().min(0),log:d.ai().int().min(0)}).strict()}).meta({id:"StorePosturePolicyCounts"}),bk=d.Ik({package:d.Yj().min(1).max(200),version:d.Yj().min(1).max(64),ossVersion:d.Yj().max(64).nullable(),policyBundleVersion:d.Yj().max(200).nullable(),policyFetchedAt:d.ai().int().min(0).max(0xe677d21fdbff).nullable()}).meta({id:"StorePosturePlugin"});d.Ik({deviceId:d.Os(),hostname:d.Yj().min(1).max(253),capturedAt:d.ai().int().min(0).max(0xe677d21fdbff),storePresent:d.zM(),schemaVersion:d.ai().int().min(0).max(0x7fffffff).nullable(),findingsTotal:d.ai().int().min(0).max(0x7fffffff),findingsFirstAt:d.ai().int().min(0).max(0xe677d21fdbff).nullable(),findingsLastAt:d.ai().int().min(0).max(0xe677d21fdbff).nullable(),packs:d.YO(bi).max(500),policyCounts:bj,plugin:bk.optional()}).meta({id:"StorePostureSnapshot"});let bl="capture/",bm=aq.extend({inspections:d.YO(an).default([])}).refine(a=>a.inspections.every(a=>!a.ruleVersion.startsWith(bl)),{message:`inspections[].ruleVersion must not start with \`${bl}\` — that namespace is reserved for capture definitions the control plane mints itself`,path:["inspections"]}).meta({id:"RecordAuditEventRequest"});d.Ik({events:d.YO(bm).min(1).max(50)}).meta({id:"RecordAuditEventBatch"});let bn=d.Ik({host:d.Yj(),kind:a$,name:d.Yj(),category:d.Yj(),trust:a1,network:a7.nullable(),method:a5,transport:a_,url:d.Yj(),template:d.zM(),dataClass:a0,site:d.Ik({file:d.Yj(),line:d.ai().int().positive(),dynamic:d.zM(),vendored:d.zM()})}).meta({id:"EgressIngestHit"});d.Ik({projectKey:d.Yj().regex(/^[0-9a-f]{64}$/,"projectKey must be a 64-character lowercase hex digest"),project:d.Yj(),reconcile:bh,hits:d.YO(bn)}).meta({id:"EgressIngestRequest"}),d.Ik({accepted:d.ai().int().nonnegative(),duplicates:d.ai().int().nonnegative()}),d.Ik({accepted:d.ai().int().nonnegative()});let bo=/^[^\p{Cc}\p{Cf}]*$/u,bp=a=>d.Yj().max(a).regex(bo,"must not contain control characters");d.Ik({tenantName:bp(200),userEmail:bp(320),role:bp(64),keyKind:bp(64),serverTime:bp(64)}),d.Ik({error:d.Ik({code:d.Yj().optional(),message:d.Yj().optional()}).optional()}),d.Ik({deviceId:bp(128).min(1),hostname:bp(255).min(1),os:bp(64).min(1),cliVersion:bp(64).min(1),label:bp(200).optional()}).meta({id:"AttachDeviceRequest"}),d.Ik({deviceCode:bp(128).min(1)}).meta({id:"AttachTokenRequest"}),d.Ik({deviceCode:bp(128),userCode:bp(32),verificationUri:bp(512),verificationUriComplete:bp(512).optional(),expiresIn:d.ai().int().positive(),interval:d.ai().int().positive()});let bq=d.Ik({status:d.eu("pending")}),br=d.Ik({status:d.eu("slow_down"),interval:d.ai().int().positive()}),bs=d.Ik({status:d.eu("denied"),message:bp(500).optional()}),bt=d.Ik({status:d.eu("expired")}),bu=d.Ik({status:d.eu("issued"),apiKey:d.Yj().min(1).max(512),endpoint:bp(512),tenantName:bp(200).optional(),userEmail:bp(320).optional()});d.KC([bu,bq,br,bs,bt,d.Ik({status:bp(64)})]);let bv=d.k5(["shares_rescan"]),bw=d.Ik({id:bp(128).min(1),kind:bv,issuedAt:bp(64).min(1),expiresAt:bp(64).min(1)}).strict();d.Ik({command:bw.nullable()});let bx=d.k5(["scan_failed","no_projects","expired"]);d.gM("outcome",[d.Ik({outcome:d.eu("reported"),projectsScanned:d.ai().int().nonnegative()}).strict(),d.Ik({outcome:d.eu("failed"),reason:bx,projectsScanned:d.ai().int().nonnegative()}).strict()]);let by=d.Yj().regex(/^[a-z][a-z0-9-]*$/),bz=d.Yj().regex(/^[a-z][a-z0-9-]*$/),bA=d.Yj().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?$/),bB=d.k5(["labs","user","org"]),bC=d.k5(["keyword","regex"]).meta({id:"MatcherType"});d.k5(["safe","quarantined"]).meta({id:"RuleProbeVerdict"});let bD=d.re({type:d.eu("keyword"),keywords:d.YO(d.Yj().min(1)).min(1),caseSensitive:d.zM().default(!1)});function bE(a){return a.replace(/[gy]/g,"")}let bF=d.re({type:d.eu("regex"),pattern:d.Yj().min(1).max(2e3),flags:d.Yj().default("gi"),captureGroup:d.ai().int().nonnegative().optional()}).refine(a=>(function(a,b){try{return new RegExp(a,b),!0}catch{return!1}})(a.pattern,a.flags),{message:"pattern/flags do not form a valid JavaScript regular expression",path:["pattern"]}).refine(a=>!function(a){return void 0===a||0===a}(a.captureGroup)||!function(a,b){try{let c=new RegExp(a,bE(b));return c.exec("")?.[0].length===0}catch{return!1}}(a.pattern,a.flags),{message:'a whole-match regex that can match the empty string (e.g. "\\d*", "a?", "(?:)") can hang the matcher — scope the quantifier to a captureGroup, or require at least one character',path:["pattern"]}).superRefine((a,b)=>{if(void 0===a.captureGroup)return;let c=function(a,b){try{let c=RegExp(`${a}|`,bE(b)).exec("");return c?c.length-1:void 0}catch{return}}(a.pattern,a.flags);void 0===c||a.captureGroup<=c||b.addIssue({code:"custom",path:["captureGroup"],message:`captureGroup ${String(a.captureGroup)} is out of range — the pattern declares ${String(c)} capture group(s), so valid values are 0-${String(c)}. An out-of-range group never matches, which would make the rule silently never fire.`})}),bG=d.gM("type",[bD,bF]).meta({id:"Matcher"});bC.options;let bH=d.re({extensions:d.YO(d.Yj().regex(/^\.[A-Za-z0-9]+$/)).min(1)}).meta({id:"AppliesTo"}),bI=d.k5(["entropy","luhn"]).meta({id:"PostValidatorName"}),bJ=d.KC([bI,d.re({name:bI,config:d.g1(d.Yj(),d.L5()).optional()})],{error:()=>`not a valid post-validator: use a bare name (${bI.options.map(a=>JSON.stringify(a)).join(" or ")}) or { "name": ..., "config": { ... } }. An unrecognized name would be a false-positive guard that never runs.`}).meta({id:"PostValidatorRef"}),bK=d.re({categories:d.YO(Q).min(1).optional(),ruleIds:d.YO(d.Yj().min(1)).min(1).optional(),labels:d.YO(d.Yj().min(1)).min(1).optional(),windowChars:d.ai().int().positive().default(160),confidenceBoost:d.ai().min(0).max(.3).optional()}).refine(a=>(a.categories?.length??0)+(a.ruleIds?.length??0)+(a.labels?.length??0)>0,{message:"requiresNearby needs at least one of categories, ruleIds, or labels"}).meta({id:"RequiresNearby"});d.re({label:d.Yj(),text:d.Yj().max(5e4),shouldMatch:d.zM(),filePath:d.Yj().optional(),expectedSpans:d.YO(d.re({start:d.ai(),end:d.ai()})).optional()}).meta({id:"RuleFixture"});let bL=d.re({specVersion:d.eu(1),id:d.Yj().regex(/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/),name:d.Yj(),category:Q,severity:R,matcher:bG,appliesTo:bH.optional(),postValidators:d.YO(bJ).optional(),requiresNearby:bK.optional(),examples:d.YO(d.Yj()).optional()}).meta({id:"Rule"}),bM=d.Ik({name:d.Yj(),email:d.Rp().optional(),url:d.OZ().optional()}).meta({id:"Author"});d.Ik({specVersion:d.eu(1),id:d.Yj(),name:d.Yj(),version:d.Yj(),rules:d.YO(d.Yj()),description:d.Yj().optional(),author:bM.optional(),license:d.Yj().optional(),sourceUrl:d.OZ().optional()}).meta({id:"PackManifest"});let bN=d.k5(["library","custom"]).meta({id:"OriginEnum"}),bO=d.k5(["all","library","custom","customized","updates"]),bP=d.k5(["new","imported","update"]).meta({id:"LibraryStateEnum"}),bQ=d.Ik({all:d.ai().int().nonnegative(),library:d.ai().int().nonnegative(),custom:d.ai().int().nonnegative(),customized:d.ai().int().nonnegative(),updates:d.ai().int().nonnegative()}).meta({id:"DetectionCounts"}),bR=d.Ik({id:d.Yj(),name:d.Yj(),version:bA,enabled:d.zM(),origin:bN,publisher:by.optional(),publisherKind:bB.optional(),ruleCount:d.ai().int().nonnegative(),namespace:by,packId:bz,policyId:d.Yj().optional(),latestVersion:bA.optional()}).meta({id:"DetectionListItem"});d.Ik({counts:bQ,items:d.YO(bR)}).meta({id:"ListDetectionsResponse"}),d.Ik({filter:bO.optional().default("all"),q:d.Yj().optional()}),d.Ik({detections:d.ai().int().nonnegative(),rules:d.ai().int().nonnegative(),active:d.ai().int().nonnegative(),findingsLast30d:d.ai().int().nonnegative()}).meta({id:"DetectionStats"});let bS=d.Ik({id:d.Yj(),name:d.Yj(),category:Q,severity:R,matcher:bG,appliesTo:bH.optional(),postValidators:d.YO(bJ).optional(),requiresNearby:bK.optional(),examples:d.YO(d.Yj()).optional()}).meta({id:"DetectionRule"}),bT=d.Ik({available:d.zM(),latestVersion:bA,latestRuleCount:d.ai().int().nonnegative().optional()}).nullable().meta({id:"DetectionUpdate"});d.Ik({id:d.Yj(),name:d.Yj(),version:bA,enabled:d.zM(),origin:bN,publisher:by.optional(),publisherKind:bB.optional(),ruleCount:d.ai().int().nonnegative(),namespace:by,packId:bz,description:d.Yj().optional(),editedAt:K.w$(),findingsLast30d:d.ai().int().nonnegative(),latestVersion:bA.nullable().optional(),update:bT,rules:d.YO(bS),modified:d.zM(),policyId:d.Yj().optional()}).meta({id:"DetectionDetail"});let bU=d.Ik({id:d.Yj(),name:d.Yj(),publisher:by,publisherKind:bB.optional(),category:Q.optional(),version:bA,ruleCount:d.ai().int().nonnegative(),description:d.Yj().optional(),updatedAt:K.w$(),state:bP,importedAs:d.Yj().nullable()}).meta({id:"LibraryItem"});d.Ik({categories:d.YO(Q),items:d.YO(bU)}).meta({id:"ListLibraryResponse"}),d.Ik({libraryId:d.Yj().refine(a=>/^[^/]+\/[^/]+$/.test(a),{message:"libraryId must be in namespace/packId format"})}).meta({id:"ImportDetectionRequest"});let bV=d.k5(["prompt","response","code_change","tool_use"]).meta({id:"EventKind"});bV.options.map(a=>`'${a}'`).join(",");let bW=d.Ik({sessionId:d.Yj().optional(),repo:d.Yj().optional(),filePath:d.Yj().optional(),toolName:d.Yj().optional(),gitignored:d.zM().optional(),wholeFile:d.zM().optional(),model:d.Yj().optional(),turnIndex:d.ai().int().nonnegative().optional(),correlationId:d.uR().optional(),traceId:d.Yj().regex(/^[0-9a-f]{32}$/).optional(),exceptionIds:d.YO(d.Os()).optional(),inspectionMs:d.ai().int().nonnegative().optional()}).meta({id:"EventMetadata"}),bX=d.Ik({id:d.Os(),sourceTool:P,kind:bV,occurredAt:K.w$(),contentHash:d.Yj(),content:d.Yj(),metadata:bW.optional()}).meta({id:"Event"}).meta({id:"IngestEvent"});d.Ik({events:d.YO(bX).min(1).max(100),dedupe:d.eu("content-hash").optional()}).meta({id:"IngestBatch"});let bY=d.k5(["once","temporary","permanent"]),bZ=d.Ik({repo:d.Yj().optional(),sourceTool:d.Yj().optional(),provider:d.Yj().optional()}).strict(),b$=d.k5(["suppress","reveal_to_model"]),b_=d.Ik({id:d.Os(),ruleId:d.Yj(),category:Q,valueFingerprint:d.Yj().regex(/^[0-9a-f]{64}$/),keyVersion:d.ai().int().positive(),maskedValue:d.Yj(),capability:b$.default("suppress"),scope:bY,expiresAt:K.w$().nullable(),maxUses:d.ai().int().positive().nullable(),useCount:d.ai().int().nonnegative(),lastUsedAt:K.w$().nullable(),justification:d.Yj().min(1),conditions:bZ.nullable(),createdBy:d.Yj(),createdVia:d.k5(["cli-approve","cli-add","web-approve","web-add","api","setup-triage"]),createdAt:K.w$(),updatedAt:K.w$(),revokedAt:K.w$().nullable(),revokedBy:d.Yj().nullable(),revokeReason:d.Yj().nullable()}),b0=b_.pick({id:!0,ruleId:!0,valueFingerprint:!0,keyVersion:!0,capability:!0,expiresAt:!0,maxUses:!0,useCount:!0,conditions:!0});function b1(a,b){return"present"===b.status&&b.version===a}function b2(a){if(a<=0)return"Recently blocked detections are invalidated too: the ledger outlives a rotation, so its rows stay listed as a record of what was blocked but stop being approvable. Trigger the detection again to approve it under the new key.";let b=`from the last ${String(24)} hours`,c=1===a?`1 recently blocked detection ${b} is still approvable; after rotating, none are`:`${String(a)} recently blocked detections ${b} are still approvable; after rotating, none are`;return`${c}. They stay listed as a record of what was blocked — trigger the detection again to approve under the new key.`}b_.omit({valueFingerprint:!0});let b3=d.Yj().optional();d.Ik({reference:d.Yj(),scope:d.Yj(),reason:d.Yj(),confirmation:b3}),d.Ik({ruleId:d.Yj(),value:d.Yj(),scope:d.Yj(),reason:d.Yj(),confirmation:b3}),d.Ik({pointer:d.Yj(),scope:d.Yj(),justification:d.Yj(),confirmation:b3}),d.Ik({id:d.Yj(),reason:d.Yj()}),d.Ik({confirmation:d.Yj()}),new WeakMap,new WeakMap;let b4=d.Ik({id:d.Os(),namespace:by,packId:bz,version:bA,name:d.Yj(),enabled:d.zM().default(!0),policyId:d.Yj().optional()}).meta({id:"InstalledPack"});d.Ik({namespace:by,packId:bz,version:bA}).meta({id:"InstallPackRequest"}),d.Ik({items:d.YO(b4)}).meta({id:"ListInstalledPacksResponse"}),d.Ik({enabled:d.zM().optional(),policyId:d.Yj().nullable().optional()}).refine(a=>Object.keys(a).some(b=>void 0!==a[b]),{message:"At least one field must be provided"}).meta({id:"PatchInstalledPackRequest"});let b5=d.k5(["global","repo","user"]).meta({id:"PolicyScope"}),b6=d.KC([d.Ik({ruleId:d.Yj()}),d.Ik({category:Q})]).meta({id:"PolicyTarget"}),b7=d.k5(["builtin","custom"]).meta({id:"PolicyKind"}),b8=d.k5(["builtin","authored"]).meta({id:"PolicyProvenance"}),b9=d.Ik({id:d.Os(),scope:b5,target:b6,action:S,enabled:d.zM().default(!0),customKeywords:d.YO(d.Yj()).optional(),name:d.Yj().optional(),provenance:b8.optional()}).meta({id:"Policy"});[...Object.keys(d.Ik({version:d.Yj(),policies:d.YO(b9),rules:d.YO(bL).optional(),rulesComplete:d.zM().optional(),exceptions:d.YO(b0).optional(),reversibleRuleIds:d.YO(d.Yj()).optional(),ruleVersions:d.g1(d.Yj(),d.Yj()).optional(),prohibitedModels:d.YO(d.Yj()).optional(),customKeywords:d.YO(d.Yj()),fetchedAt:K.w$()}).meta({id:"PolicyBundle"}).shape),...Object.keys(b9.shape).map(a=>`policies.${a}`),...b6.options.flatMap(a=>"shape"in a?Object.keys(a.shape):[]).map(a=>`policies.target.${a}`),...Object.keys(b0.shape).map(a=>`exceptions.${a}`)].sort().join(",");let ca=["config"];Q.options.filter(a=>!ca.includes(a));let cb={secret:"critical",financial:"critical",code_flaw:"critical",pii:"high",phi:"high",custom:"high",code_context:"low",config:"low"},cc=["monitor","warn","redact","vault","block"],cd=d.k5(cc).meta({id:"BuiltinPolicyId"}),ce=cd.extract(["monitor","warn","block"]).meta({id:"RedactFallback"}),cf={monitor:{name:"Monitor",action:"log",reversible:!1,description:"Log every match for audit. The request is allowed through untouched."},warn:{name:"Warn",action:"warn",reversible:!1,description:"Allow the request, but warn the user inline before it is sent."},redact:{name:"Redact",action:"redact",reversible:!1,description:"Strip the matched value from the request and destroy it, then continue. What was removed cannot be recovered."},vault:{name:"Redact & Vault",action:"redact",reversible:!0,description:"Strip the matched value from the request and keep an encrypted, recoverable copy in the local vault, leaving a pointer in its place. Needs the vault consent granted under Settings; without it this behaves as Redact."},block:{name:"Block",action:"block",reversible:!1,description:"Refuse the request entirely whenever any rule in this detection matches."}};function cg(a){return cf[a].action}let ch=[...new Set(cc.map(cg))],ci=[...T.filter(a=>!ch.includes(a)),...ch];function cj(a){return ci.indexOf(a)}function ck(a,b){return cj(a)>=cj(b)}d.Ik({floor:cd,locked:d.zM()}).describe("PackPolicyFloor");let cl=cc.filter(a=>!cf[a].reversible);cc.filter(a=>cf[a].reversible);let cm=d.k5(cl).meta({id:"CategoryPolicyId"});Object.fromEntries(Q.options.map(a=>[a,cg(function(a){if(ca.includes(a))return"monitor";let b=cb[a];return"critical"===b||"high"===b?"warn":"monitor"}(a))])),Object.fromEntries(cc.map(a=>[a,{id:a,...cf[a]}]));let cn=d.Ik({id:d.Yj(),name:d.Yj(),ruleCount:d.ai().int().nonnegative(),enabled:d.zM()}).meta({id:"UsedByItem"}),co=d.Ik({id:d.Yj(),kind:b7,name:d.Yj(),enabled:d.zM(),usedByCount:d.ai().int().nonnegative()}).meta({id:"PolicyListItem"});d.Ik({items:d.YO(co)}).meta({id:"ListPoliciesResponse"}),d.Ik({specVersion:d.eu(1),id:d.Yj(),kind:b7,name:d.Yj(),enabled:d.zM(),description:d.Yj(),usedBy:d.YO(cn)}).meta({id:"PolicyDetail"}),d.Ik({policies:d.ai().int().nonnegative(),builtin:d.ai().int().nonnegative(),custom:d.ai().int().nonnegative(),detectionsGoverned:d.ai().int().nonnegative()}).meta({id:"PolicyStatsResponse"});let cp=Q.options.join("|"),cq=RegExp(`\\[\\[aka:(?:${cp}):[A-Z2-7]{2,7}\\.[A-Z2-7]{26}\\.[A-Z2-7]{16}\\]\\]`),cr=RegExp(`^${cq.source}$`);d.Yj().regex(cr),d.Ik({category:Q,keyVersion:d.ai().int().positive(),pointerId:d.Yj(),tag:d.Yj()}),d.Ik({pointerId:d.Yj(),valueFingerprint:d.Yj().regex(/^[0-9a-f]{64}$/),fingerprintKeyVersion:d.ai().int().positive(),keyVersion:d.ai().int().positive(),category:Q,ruleId:d.Yj(),maskedMatch:d.Yj(),provider:d.Yj().optional(),ciphertext:d.Yj(),nonce:d.Yj(),authTag:d.Yj(),occurrenceCount:d.ai().int().nonnegative(),userAuthorized:d.zM(),firstSeen:d.Yj(),lastSeen:d.Yj()}),d.Ik({category:Q,provider:d.Yj().optional(),maskedMatch:d.Yj(),occurrences:d.ai().int().nonnegative(),firstSeen:d.Yj(),lastSeen:d.Yj()}),d.Ik({ruleId:d.Yj(),valueFingerprint:d.Yj().regex(/^[0-9a-f]{64}$/),fingerprintKeyVersion:d.ai().int().positive()});let cs=d.k5(["human","model"]),ct=d.k5(["display","explicit-reveal","view-render","model-input","remediation","purge"]),cu=d.k5(["revealed","refused","unavailable"]),cv=["display","view-render"];function cw(a){return cv.includes(a)}let cx=d.Ik({id:d.Os(),pointerId:d.Yj(),at:d.Yj(),target:cs,reason:ct,outcome:cu,grantId:d.Yj().optional(),pointerCount:d.ai().int().positive().default(1)}),cy=d.k5(["prompt","tool-input","tool-output","file","transcript"]),cz=d.Ik({location:d.Yj(),kind:cy,firstSeen:d.Yj(),lastSeen:d.Yj()}),cA=d.Ik({pointerId:d.Yj(),category:Q,provider:d.Yj().optional(),maskedMatch:d.Yj(),occurrences:d.ai().int().nonnegative(),firstSeen:d.Yj(),lastSeen:d.Yj(),revealGrantId:d.Yj().nullable(),sightings:d.YO(cz)});d.Ik({limit:L.ai().int().min(1).max(200).optional(),cursor:d.Yj().optional()}),d.Ik({totals:d.Ik({values:d.ai().int().nonnegative()}),items:d.YO(cA),nextCursor:d.Yj().nullable()}),d.Ik({limit:L.ai().int().min(1).max(200).optional(),cursor:d.Yj().optional()}),d.Ik({totals:d.Ik({reused:d.ai().int().nonnegative()}),items:d.YO(cA),nextCursor:d.Yj().nullable()}),d.Ik({includeBatched:d.zM().optional(),limit:L.ai().int().min(1).max(200).optional(),cursor:d.Yj().optional()}),d.Ik({items:d.YO(cx),nextCursor:d.Yj().nullable(),hiddenBatched:d.ai().int().nonnegative()});let cB=d.Yj(),cC=d.k5(["masked","full","off"]),cD=d.Ik({acknowledgedAt:K.w$(),version:d.ai().int().positive()});function cE(a){return a?.version===1}let cF=d.k5(["standalone","attached"]),cG=d.Ik({endpoint:d.Yj().min(1),label:d.Yj().min(1).optional(),attachedAt:K.w$()}).meta({id:"ControlPlaneConnection"}),cH=d.k5(["redact","warn"]),cI=d.k5(["full","session-only"]),cJ=d.Ik({acknowledgedAt:K.w$(),payloadVersion:d.ai().int().positive()});function cK(a){return a?.payloadVersion===1}let cL=d.Ik({acknowledgedAt:K.w$(),payloadVersion:d.ai().int().positive(),endpoint:d.Yj()});function cM(a,b){return void 0!==a&&void 0!==b&&2===a.payloadVersion&&a.endpoint===b}function cN(a,b){return void 0!==a&&void 0!==b&&a.endpoint===b&&2!==a.payloadVersion}function cO(a){return"attached"===a.runMode&&void 0!==a.controlPlane}function cP(a){return a.label??a.endpoint}d.Ik({specVersion:d.ai().int().positive().default(7),runMode:cF.default("standalone"),controlPlane:cG.optional(),policy:cH.default("redact"),historicalAccess:cI.default("session-only"),dataSharesInPlace:d.zM().default(!0),vaultConsent:cD.optional(),vaultKeyCustody:cB.default("file"),vaultInlineReveal:cC.default("masked"),redactFallback:ce.default("warn"),onboardedAt:K.w$().optional(),modelJudgeConsent:cJ.optional(),historySyncConsent:cL.optional()});let cQ=d.k5(["runMode","historicalAccess","vaultConsent","vaultKeyCustody","vaultInlineReveal","modelJudgeConsent","dataSharesInPlace","redactFallback"]).meta({id:"ManagedSettingKey"}),cR=d.Ik({runMode:d.k5(["standalone","attached"]).optional(),controlPlane:d.Ik({endpoint:d.Yj().min(1),label:d.Yj().min(1).optional()}).optional(),historicalAccess:d.k5(["full","session-only"]).optional(),vaultConsent:d.zM().optional(),vaultKeyCustody:d.k5(["file","keychain"]).optional(),vaultInlineReveal:d.k5(["masked","full","off"]).optional(),modelJudgeConsent:d.zM().optional(),dataSharesInPlace:d.zM().optional(),redactFallback:ce.optional()}).meta({id:"ManagedSettingsValues"});d.Ik({specVersion:d.ai().int().positive().default(1),organization:d.Yj().min(1).optional(),values:cR.default({}),lockedFields:d.YO(cQ).default([])}).meta({id:"ManagedSettings"});let cS={present:!1,lockedFields:[]};function cT(a,b){return a.present&&a.lockedFields.includes(b)}function cU(a){return`Managed by ${a.organization??"your organization"}`}let cV=d.Ik({path:d.Yj().min(1),name:d.Yj().min(1),origin:aJ,defaultAccess:aI});d.Ik({files:d.YO(cV),truncated:d.zM(),scannedAt:d.Yj()});let cW=["7d","30d","3m","6m"],cX=d.k5(cW).meta({id:"TimeRange"}),cY="7d";cX.catch(cY);let cZ=d.k5(["still-valid","unknown","invalid"]),c$=d.Ik({filePath:d.Yj(),span:U.optional()}).strict(),c_=d.Ik({provider:d.Yj(),maskedToken:d.Yj(),where:c$,state:cZ,observedAt:K.w$().optional()}).strict();d.Ik({provider:d.Yj(),maskedToken:d.Yj(),consolePath:d.Yj(),occurrenceSpread:d.ai().int().positive()}).strict();let c0=d.k5(["redact-rotation-checklist","redact-only","set-secret-redact","leave"]),c1=d.k5(["first-run","pre-push","secret-scan"]);d.Ik({entrySource:c1}).strict();let c2=d.Ik({id:c0,label:d.Yj()}),c3=d.Ik({kind:d.eu("decision"),entrySource:c1,secretCount:d.ai().int().positive(),prompt:d.Yj(),options:d.PV([c2.extend({id:d.eu("redact-rotation-checklist")}),c2.extend({id:d.eu("redact-only")}),c2.extend({id:d.eu("set-secret-redact")}),c2.extend({id:d.eu("leave")})])}),c4=d.Ik({kind:d.eu("no-decision")});d.gM("kind",[c3,c4]);let c5=d.Ik({severity:R,count:d.ai().int().nonnegative(),caught:d.ai().int().nonnegative().optional(),openAtRest:d.ai().int().nonnegative().optional()}).meta({id:"SeveritySummaryItem"});d.Ik({total:d.ai().int().nonnegative(),needsRemediation:d.ai().int().nonnegative().optional(),bySeverity:d.YO(c5)}).meta({id:"SeveritySummaryResponse"}),d.Ik({range:d.k5(cW).default(cY)});let c6=d.k5(["blocked","redacted","warned"]).meta({id:"EnforcementActionKind"}),c7=d.Ik({kind:c6,count:d.ai().int().nonnegative(),delta:d.ai().int()}).meta({id:"EnforcementAction"});d.Ik({range:cX,total:d.ai().int().nonnegative(),actions:d.YO(c7)}).meta({id:"EnforcementActionsResponse"});let c8=d.k5(["day","week"]).meta({id:"TimeseriesGranularity"}),c9=d.Ik({timestamp:K.p6(),critical:d.ai().int().nonnegative(),high:d.ai().int().nonnegative(),medium:d.ai().int().nonnegative()}).meta({id:"FindingsTimeseriesPoint"});d.Ik({range:cX,granularity:c8,points:d.YO(c9)}).meta({id:"FindingsTimeseriesResponse"});let da=d.Ik({timestamp:K.p6(),bySeverity:d.Ik({critical:d.ai().nonnegative().nullable(),high:d.ai().nonnegative().nullable(),medium:d.ai().nonnegative().nullable(),low:d.ai().nonnegative().nullable()})}).meta({id:"MttrTrendPoint"});d.Ik({range:cX,granularity:c8,points:d.YO(da)}).meta({id:"MttrTrendResponse"});let db=d.Ik({findingKey:d.Yj(),ruleId:d.Yj(),severity:R,path:d.Yj(),resolvedAt:K.w$(),detectedAt:K.w$()}).meta({id:"ResolvedFeedItem"});d.Ik({items:d.YO(db)}).meta({id:"RecentlyResolvedResponse"});let dc=["repo","user"],dd=d.k5(dc).meta({id:"SourceKind"}),de=d.Ik({id:d.Yj(),name:d.Yj(),kind:dd,findingsCount:d.ai().int().nonnegative()}).meta({id:"TopSource"});d.Ik({range:cX,items:d.YO(de)}).meta({id:"TopSourcesResponse"}),d.Ik({range:d.k5(cW).default(cY),limit:L.ai().int().min(1).max(50).default(5),kind:d.k5(dc).optional()});let df=N.extract(["ClaudeCode","Cursor","Codex","Antigravity","ClaudeAi","ChatGpt","Copilot","Api"]).meta({id:"Provider"}),dg=d.Ik({provider:df,coverage:d.ai().int().min(0).max(100),supported:d.zM()}).meta({id:"ScanCoverageProvider"});d.Ik({range:cX,providers:d.YO(dg)}).meta({id:"ScanCoverageResponse"});let dh=d.k5(["repo","user","team","policy","share","rule"]).meta({id:"SubjectType"}),di=d.Ik({type:dh,id:d.Yj(),label:d.Yj()}).meta({id:"RecommendationSubject"}),dj=d.k5(["apply","navigate"]).meta({id:"RecommendationActionMode"}),dk=d.Ik({mode:dj,type:d.Yj(),label:d.Yj(),href:d.Yj().optional(),policyId:d.Yj().optional(),teamId:d.Yj().optional()}).meta({id:"RecommendationAction"}),dl=d.Ik({id:d.Yj(),category:d.Yj(),severity:R,title:d.Yj(),description:d.Yj(),subjects:d.YO(di),action:dk}).meta({id:"RecommendedAction"});d.Ik({items:d.YO(dl)}).meta({id:"RecommendedActionsResponse"}),d.Ik({limit:L.ai().int().min(1).max(20).default(3)});let dm=d.Ik({type:d.Yj(),policyId:d.Yj().optional(),teamId:d.Yj().optional()}).meta({id:"AppliedAction"});d.Ik({id:d.Yj(),status:d.eu("applied"),appliedAction:dm}).meta({id:"ApplyRecommendedActionResponse"}),d.Ik({id:d.Yj(),status:d.eu("dismissed")}).meta({id:"DismissRecommendedActionResponse"}),d.Ik({id:d.Yj()});let dn=d.k5(["granted","revoked","unchanged"]).meta({id:"HistorySyncConsentChoice"}),dp=d.k5(["granted","revoked","unchanged"]).meta({id:"ModelJudgeConsentChoice"});d.Ik({historicalAccess:d.Yj(),modelJudgeConsent:dp,historySyncConsent:dn,vaultConsent:d.Yj(),vaultInlineReveal:d.Yj()}),d.Ik({endpoint:d.Yj(),label:bp(200).optional(),accessKey:d.Yj()}),d.Ik({ruleId:d.Yj(),category:Q,severity:R,maskedMatch:d.Yj(),rawMatch:d.Yj(),context:d.Yj(),filePath:d.Yj().optional(),confidence:d.ai().min(0).max(1),id:d.Yj().optional(),valueFingerprint:d.Yj().optional(),keyVersion:d.ai().int().nonnegative().optional()});let dq=d.Ik({category:Q,action:cm,reasoning:d.Yj(),genuineCount:d.ai().int().nonnegative(),fpCount:d.ai().int().nonnegative(),fpIds:d.YO(d.Yj())});d.Ik({perCategory:d.YO(dq),notes:d.Yj()});let dr=d.Ik({total:d.ai().int().nonnegative(),important:d.ai().int().nonnegative(),routine:d.ai().int().nonnegative()}).refine(a=>a.total===a.important+a.routine,{message:"total must equal important + routine",path:["total"]}),ds=d.Ik({ruleId:d.Yj(),category:Q,valueFingerprint:d.Yj(),keyVersion:d.ai().int().nonnegative()}),dt=d.Ik({pattern:d.Yj(),count:d.ai().int().nonnegative(),values:d.YO(ds).min(1)}),du=d.Ik({category:Q,count:d.ai().int().nonnegative(),egress:d.zM()}),dv=d.Ik({counts:dr,routineCategories:d.YO(Q),surfacedCategories:d.YO(Q),findingKinds:d.YO(du),posture:d.g1(Q,cd),maskedFindings:d.YO(c_).optional(),falsePositivePatterns:d.YO(dt).optional()}),dw=dq.pick({category:!0,genuineCount:!0,fpCount:!0}).extend({egress:d.zM()});d.Ik({categories:d.YO(dw),posture:d.g1(Q,cd)}),d.Ik({frame:dv,copy:d.Yj()}),d.k5(["scan","floor"]);let dx=d.Ik({id:d.k5(["enter-remediation","open-dashboard","not-now"]),label:d.Yj()}),dy=d.PV([dx.extend({id:d.eu("open-dashboard")}),dx.extend({id:d.eu("not-now")})]),dz=d.PV([dx.extend({id:d.eu("enter-remediation")}),dx.extend({id:d.eu("open-dashboard")}),dx.extend({id:d.eu("not-now")})]);d.Ik({worthALook:d.ai().int().nonnegative(),liveKeys:d.ai().int().nonnegative().optional(),options:d.KC([dy,dz])}).refine(a=>a.options.some(a=>"enter-remediation"===a.id)===(a.liveKeys??0)>0,{message:"the chain-entry option is present exactly when liveKeys > 0",path:["options"]}).refine(a=>(a.liveKeys??0)<=a.worthALook,{message:"liveKeys is a subset of worthALook and cannot exceed it",path:["liveKeys"]})},65366:(a,b,c)=>{"use strict";c.d(b,{ES:()=>k,H9:()=>m,Xg:()=>o,gh:()=>l,jP:()=>n,rE:()=>h,tG:()=>f,uR:()=>j,vm:()=>g});var d=c(64145),e=c(16820);let f="monitor";function g(a){return"regex"===a.type?"/"+a.pattern+"/"+a.flags:a.keywords.join(" \xb7 ")}let h={regex:{label:"Regex",icon:e.cZ,color:"var(--color-violet-ink)",fill:"var(--color-violet-fill)",blurb:"Pattern match"},keyword:{label:"Keyword",icon:e.Ey,color:"var(--color-teal-ink)",fill:"var(--color-teal-fill)",blurb:"Literal lookup"}},i={monitor:{id:"monitor",label:"Monitor",icon:e.bM,tone:"neutral",desc:"Log every match for audit. The request is allowed through untouched."},warn:{id:"warn",label:"Warn",icon:e._0,tone:"high",desc:"Allow the request, but warn the user inline before it is sent."},redact:{id:"redact",label:"Redact",icon:e.jZ,tone:"primary",desc:"Strip the matched value from the request and destroy it, then continue. What was removed cannot be recovered."},vault:{id:"vault",label:"Redact & Vault",icon:e.XA,tone:"teal",desc:"Strip the matched value from the request and keep an encrypted, recoverable copy in the local vault, leaving a pointer in its place. Needs the vault consent granted under Settings; without it this behaves as Redact."},block:{id:"block",label:"Block",icon:e.pD,tone:"critical",desc:"Refuse the request entirely whenever any rule in this detection matches."}},j=d.V0H;function k(a){return(Object.hasOwn(i,a)?i[a]:void 0)??{id:a,label:a,icon:e.iB,tone:"neutral",desc:""}}let l={pii:"PII",financial:"Financial",secret:"Secret",phi:"PHI",code_context:"Code context",code_flaw:"Code flaw",custom:"Custom",config:"Configuration"},m={library:{label:"Library",icon:e.fC,tone:"teal",blurb:"Imported from the public library"},custom:{label:"Custom",icon:e.qU,tone:"violet",blurb:"Authored here — no upstream to track"}},n={labs:{label:"AKA Labs",icon:e.Zu,tone:"teal",verified:!0},org:{label:"Your org",icon:e.ai,tone:"violet",verified:!1},user:{label:"Community",icon:e.ny,tone:"neutral",verified:!1}};function o(a){return null==a.update?"unknown":a.update.available?"update-available":"up-to-date"}},66755:(a,b,c)=>{"use strict";c.d(b,{B:()=>f,i:()=>g});var d=c(15008),e=c(63407);function f({ids:a}){return(0,d.jsx)("div",{className:"flex items-center -space-x-1.5",children:a.map(a=>(0,d.jsx)("span",{title:e.x[a].label,className:"inline-flex rounded-lg ring-2 ring-surface",children:(0,d.jsx)(e.K,{id:a})},a))})}function g({provider:a}){return(0,d.jsxs)("span",{className:"inline-flex items-center gap-2 font-display text-xs text-text",children:[(0,d.jsx)(e.K,{id:a}),e.x[a].label]})}},68788:(a,b,c)=>{"use strict";c.d(b,{MttrTrendCardView:()=>l});var d=c(15008),e=c(71378),f=c(60004),g=c(5475),h=c(16820);function i(a){if(null===a||Number.isNaN(a))return"—";let b=Math.round(Math.max(0,a)/6e4),c=Math.floor(b/1440),d=Math.floor((b-=24*c*60)/60);return(b-=60*d,c>0)?d>0?`${String(c)}d ${String(d)}h`:`${String(c)}d`:d>0?b>0?`${String(d)}h ${String(b)}m`:`${String(d)}h`:`${String(Math.max(1,b))}m`}var j=c(51076);let k=[{key:"critical",label:"Critical",color:f.l.sevCritical},{key:"high",label:"High",color:f.l.sevHigh},{key:"medium",label:"Medium",color:f.l.sevMedium},{key:"low",label:"Low",color:f.l.sevLow}];function l({points:a,isLoading:b,error:c}){let f=a.every(a=>null===a.critical&&null===a.high&&null===a.medium&&null===a.low),l=a.map(a=>({label:a.label,critical:a.critical,high:a.high,medium:a.medium,low:a.low})),m=a.at(-1)??null;return(0,d.jsxs)(e.Zp,{className:"mt-4 shadow-sm xl:mt-5",children:[(0,d.jsxs)(e.aR,{children:[(0,d.jsx)(e.AG,{children:(0,d.jsx)(h.O4,{"aria-hidden":!0,focusable:!1,className:"size-4"})}),(0,d.jsxs)(e.Lc,{children:[(0,d.jsx)(e.ZB,{children:"Time to remediate"}),(0,d.jsx)(e.BT,{children:"Mean time from detection to resolution, by severity"})]}),(0,d.jsx)(e.X9,{className:"gap-3 text-xs text-text-2",children:k.map(a=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"size-2 rounded-xs",style:{background:a.color}}),a.label,m&&(0,d.jsx)("span",{className:"text-text-3",children:i(m[a.key])})]},a.key))})]}),(0,d.jsx)(e.Wu,{"aria-busy":b,className:"pb-2",children:c?(0,d.jsx)(j.rJ,{message:c}):b?(0,d.jsx)(e.EA,{className:"h-40 w-full"}):f?(0,d.jsx)(j.AW,{message:"No resolved findings in this range."}):(0,d.jsx)(g.AreaChart,{data:l,series:k,height:160,valueFormat:i})})]})}},68951:(a,b,c)=>{Promise.resolve().then(c.bind(c,17289)),Promise.resolve().then(c.bind(c,6363)),Promise.resolve().then(c.bind(c,85641)),Promise.resolve().then(c.bind(c,58973)),Promise.resolve().then(c.bind(c,81610)),Promise.resolve().then(c.bind(c,93636)),Promise.resolve().then(c.bind(c,89904))},70124:(a,b,c)=>{"use strict";c.d(b,{JW:()=>i,Lw:()=>k,UD:()=>h,md:()=>g,zn:()=>j});var d=c(15008),e=c(71378),f=c(24061);function g({status:a}){return"active"===a?(0,d.jsxs)("span",{className:"relative flex size-2 shrink-0",title:"Live",children:[(0,d.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-ok opacity-75"}),(0,d.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-ok"})]}):(0,d.jsx)("span",{className:(0,e.cn)("size-1.5 shrink-0 rounded-full",f.nR[a].dot)})}function h({status:a}){let b=f.nR[a];return(0,d.jsxs)(e.Ex,{variant:b.badge,className:"h-6 gap-1.5",children:[(0,d.jsx)(g,{status:a}),b.label]})}function i({icon:a,children:b}){return(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 whitespace-nowrap text-xs text-text-3",children:[(0,d.jsx)(a,{"aria-hidden":!0,focusable:!1,className:"size-3"}),b]})}function j({name:a,n:b,href:c}){let g=f.pS[a]??f.ek,h=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g,{"aria-hidden":!0,focusable:!1,className:"size-3 text-text-3"}),a,(0,d.jsx)("span",{className:"tabular-nums text-text",children:b})]}),i="inline-flex items-center gap-1.5 rounded-full border border-border bg-surface-2 py-0.5 px-2 text-xs font-semibold text-text-2";return c?(0,d.jsx)("a",{href:c,title:`Findings captured via ${a}`,className:(0,e.cn)(i,"transition-colors hover:bg-surface-3 hover:text-text"),children:h}):(0,d.jsx)("span",{className:i,children:h})}function k({items:a,mono:b=!1,nowrap:c=!1}){return(0,d.jsx)("div",{className:(0,e.cn)("flex gap-1.5",c?"min-w-0 overflow-hidden":"flex-wrap"),children:a.map(a=>(0,d.jsx)("span",{title:a,className:(0,e.cn)("rounded-md border border-border bg-surface-2 px-1.5 py-0.5 text-xs text-text",b&&"font-mono",c&&"min-w-0 truncate"),children:a},a))})}},71052:(a,b,c)=>{"use strict";c.d(b,{FindingDetailView:()=>p,formatConfidence:()=>n});var d=c(15008),e=c(71378),f=c(5265),g=c(76836),h=c(16820),i=c(63407),j=c(98937),k=c(14129),l=c(66755),m=c(13182);function n(a){let b=a.toFixed(2);return a>=.9?{label:`High \xb7 ${b}`,tone:"text-ok-ink"}:a>=.7?{label:`Medium \xb7 ${b}`,tone:"text-sev-high-ink"}:{label:`Low \xb7 ${b}`,tone:"text-text-2"}}function o({confidence:a}){let{label:b,tone:c}=n(a);return(0,d.jsx)("span",{className:c,children:b})}function p({selection:a,onSelectInstance:b,onBack:c,footer:i,renderedAt:n}){let{finding:p,instance:s}=a,t=k.y7[p.category]??h.RY,u=!s,v=p.providers.length,w=(0,k.Jm)(p.category);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(e.Fm,{className:"flex-row items-center gap-2.5 border-b border-border p-4 pr-12",children:[(0,d.jsx)(e.Pt,{severity:p.severity}),(0,d.jsx)(e.qp,{className:"font-mono text-xs font-semibold text-text-3",children:u?w:s.id})]}),(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-4 pb-4",children:[!u&&(0,d.jsxs)(e.$n,{variant:"link",tone:"primary",size:"sm",onClick:c,className:"self-start",children:[(0,d.jsx)(h.YJ,{"aria-hidden":!0,focusable:!1,className:"size-4"}),"Back to finding"]}),(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:(0,e.cn)("flex size-10 shrink-0 items-center justify-center rounded-lg",(0,k.i9)(p.category)),children:(0,d.jsx)(t,{className:"size-5"})}),(0,d.jsxs)("div",{className:"flex flex-col",children:[(0,d.jsx)("span",{className:"font-display text-base font-semibold",children:p.subtype}),(0,d.jsx)("span",{className:"text-xs text-text-3",children:u?`${String(p.instanceCount)} locations \xb7 ${String(v)} tool${v>1?"s":""}`:`${w} \xb7 ${s.repo} \xb7 detected ${(0,f.K)(s.detectedAt,n)}`})]})]}),(0,d.jsx)(q,{code:p.match.contextPrefix,snippet:p.match.maskedValue,file:u?`${String(p.instanceCount)} locations`:(0,k.xE)(s)}),u?(0,d.jsxs)("div",{children:[(0,d.jsx)(g.e,{children:"Locations"}),(0,d.jsx)("div",{className:"flex flex-col gap-2",children:p.instances.map(a=>(0,d.jsx)(r,{instance:a,onClick:()=>{b(a)}},a.id))}),p.instances.length<p.instanceCount&&(0,d.jsx)("p",{className:"pt-2 text-xs text-text-3",children:0===p.instances.length?`No locations here match the current filters — the group has ${String(p.instanceCount)} locations in total.`:`Showing the ${String(p.instances.length)} most recent of ${String(p.instanceCount)} locations.`})]}):(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-x-3 gap-y-3.5",children:[(0,d.jsx)(g.p,{label:"Source tool",children:(0,d.jsx)(l.i,{provider:s.provider})}),(0,d.jsx)(g.p,{label:"Repository",children:(0,d.jsx)("span",{className:"font-mono text-xs wrap-break-word",children:s.repo})}),(0,d.jsx)(g.p,{label:"Location",children:(0,d.jsx)("span",{className:"font-mono text-xs wrap-break-word",children:(0,k.xE)(s)})}),(0,d.jsx)(g.p,{label:"Action taken",children:(0,d.jsx)(j.T,{action:s.action})}),(0,d.jsx)(g.p,{label:"Detected",children:(0,f.K)(s.detectedAt,n)}),(0,d.jsx)(g.p,{label:"Confidence",children:(0,d.jsx)(o,{confidence:s.confidence})}),void 0!==s.user&&(0,d.jsx)(g.p,{label:"User",children:(0,d.jsx)("span",{title:k.O,children:(0,d.jsx)(m.c,{user:s.user})})})]}),i]})]})}function q({code:a,snippet:b,file:c}){return(0,d.jsxs)("div",{children:[(0,d.jsxs)(g.e,{className:"flex items-center gap-2",children:["Matched content",(0,d.jsx)(h.aR,{"aria-hidden":!0,focusable:!1,className:"size-3.5"})]}),(0,d.jsxs)("div",{className:"rounded-lg border border-border bg-ink p-3.5 font-mono text-xs leading-relaxed text-code-fg",children:[(0,d.jsx)("div",{className:"text-code-muted wrap-break-word",children:`// ${c}`}),(0,d.jsxs)("div",{children:[a,(0,d.jsx)("span",{className:"rounded bg-sev-critical/20 px-1 py-0.5 text-code-err wrap-break-word",children:`"${b}"`}),";"]})]})]})}function r({instance:a,onClick:b}){return(0,d.jsxs)("button",{type:"button",onClick:b,className:"flex items-center cursor-pointer gap-3 rounded-lg border border-border bg-surface px-3 py-2.5 text-left transition-colors hover:bg-surface-2",children:[(0,d.jsx)(i.K,{id:a.provider}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-text",children:a.repo}),(0,d.jsx)("span",{className:"font-mono text-label text-text-3 wrap-break-word",children:(0,k.xE)(a)}),void 0!==a.user&&(0,d.jsx)("span",{className:"text-label text-text-3 wrap-break-word",children:a.user.name})]}),(0,d.jsx)(j.T,{action:a.action}),(0,d.jsx)(h.vK,{className:"size-4 shrink-0 text-text-3"})]})}},71378:(a,b,c)=>{"use strict";c.d(b,{Ex:()=>n,$n:()=>s,Zp:()=>t,X9:()=>z,Wu:()=>A,BT:()=>y,aR:()=>u,Lc:()=>w,AG:()=>v,ZB:()=>x,lG:()=>C,R4:()=>F,Cf:()=>D,rr:()=>H,Es:()=>I,c7:()=>E,L3:()=>G,rI:()=>L,hO:()=>R,SQ:()=>P,Hr:()=>N,Ht:()=>Q,mB:()=>S,ty:()=>M,pd:()=>T,dK:()=>U,WA:()=>W,Eb:()=>V,D2:()=>X,AM:()=>_,hl:()=>ab,Wv:()=>aa,Iz:()=>ad,tR:()=>ae,l6:()=>ag,gC:()=>al,eb:()=>am,bq:()=>ak,yv:()=>ah,Pt:()=>p,cj:()=>ap,h:()=>aq,Qs:()=>at,Fm:()=>ar,qp:()=>as,EA:()=>au,dO:()=>aw,cH:()=>i,id:()=>j,XI:()=>ax,BF:()=>az,nA:()=>aC,nd:()=>aB,A0:()=>ay,Hj:()=>aA,tU:()=>aE,av:()=>aH,j7:()=>aF,Xi:()=>aG,vw:()=>aI,cn:()=>h,vV:()=>l});var d=c(15008),e=c(44637),f=c(40943);let g=(0,c(48331).zu)({extend:{classGroups:{"font-size":[{text:["ui","label"]}]}}});function h(...a){return g((0,f.$)(a))}let i={neutral:{fill:"bg-surface-3",text:"text-text-2"},critical:{fill:"bg-sev-critical-fill",text:"text-sev-critical-ink"},high:{fill:"bg-sev-high-fill",text:"text-sev-high-ink"},medium:{fill:"bg-sev-medium-fill",text:"text-sev-medium-ink"},low:{fill:"bg-sev-low-fill",text:"text-sev-low-ink"},ok:{fill:"bg-ok-fill",text:"text-ok-ink"},teal:{fill:"bg-teal-fill",text:"text-teal-ink"},violet:{fill:"bg-violet-fill",text:"text-violet-ink"},primary:{fill:"bg-primary-tint",text:"text-primary"}},j=Object.fromEntries(Object.entries(i).map(([a,{fill:b,text:c}])=>[a,`${b} ${c}`]));function k(a){return`var(--color-${a.replace(/^(?:text|bg)-/,"")})`}function l(a){let{fill:b,text:c}=i[a];return[k(c),k(b)]}let m=(0,e.F)("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5 text-xs font-semibold",{variants:{variant:{default:j.neutral,outline:"border border-border text-text-2",critical:j.critical,high:j.high,medium:j.medium,low:j.low,success:j.ok,teal:j.teal,primary:j.primary}},defaultVariants:{variant:"default"}});function n({variant:a,className:b,children:c}){return(0,d.jsx)("span",{className:h(m({variant:a}),b),children:c})}let o={critical:"bg-sev-critical",high:"bg-sev-high",medium:"bg-sev-medium",low:"bg-sev-low"};function p({severity:a}){return(0,d.jsxs)(n,{variant:a,className:"h-6",children:[(0,d.jsx)("span",{className:h("size-1.5 rounded-full",o[a])}),(0,d.jsx)("span",{className:"capitalize",children:a})]})}var q=c(76331);let r=(0,e.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg font-medium transition-colors cursor-pointer disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{solid:"",outline:"border",ghost:"",link:""},tone:{primary:"",neutral:"",danger:""},size:{sm:"h-8 px-3 text-xs",md:"h-9 px-4 text-sm",icon:"size-9"}},compoundVariants:[{variant:"solid",tone:"primary",class:"bg-primary-solid text-text-inv hover:bg-primary-hover"},{variant:"solid",tone:"neutral",class:"bg-surface-3 text-text hover:bg-border-strong"},{variant:"solid",tone:"danger",class:"bg-sev-critical-ink text-on-accent hover:bg-sev-critical-hover"},{variant:"outline",tone:"primary",class:"border-primary text-primary hover:bg-primary-tint"},{variant:"outline",tone:"neutral",class:"border-border bg-surface text-text hover:bg-surface-2"},{variant:"outline",tone:"danger",class:"border-sev-critical text-sev-critical-ink hover:bg-sev-critical-fill"},{variant:"ghost",tone:"primary",class:"text-primary hover:bg-primary-tint"},{variant:"ghost",tone:"neutral",class:"text-text-2 hover:bg-surface-2 hover:text-text"},{variant:"ghost",tone:"danger",class:"text-sev-critical-ink hover:bg-sev-critical-fill"},{variant:"link",class:"h-auto gap-1 rounded-sm p-0 align-baseline font-semibold underline-offset-4 [&_svg]:size-3.5"},{variant:"link",tone:"primary",class:"text-primary hover:underline"},{variant:"link",tone:"neutral",class:"text-text-2 hover:text-text hover:underline"},{variant:"link",tone:"danger",class:"text-sev-critical-ink hover:underline"}],defaultVariants:{variant:"solid",tone:"neutral",size:"md"}});function s({className:a,variant:b,tone:c,size:e,asChild:f=!1,type:g,...i}){let j=f?q.DX:"button";return(0,d.jsx)(j,{className:h(r({variant:b,tone:c,size:e}),a),...f?{}:{type:g??"button"},...i})}function t({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card",className:h("rounded-xl border border-border bg-surface",a),...b})}function u({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-header",className:h("flex items-center gap-3 px-5 pt-5",a),...b})}function v({className:a,tone:b="neutral",...c}){return(0,d.jsx)("span",{"data-slot":"card-icon",className:h("flex size-7.5 shrink-0 items-center justify-center rounded-lg",(Object.hasOwn(j,b)?j[b]:void 0)??j.neutral,a),...c})}function w({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-heading",className:h("min-w-0",a),...b})}function x({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-title",className:h("text-sm font-semibold text-text",a),...b})}function y({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-description",className:h("text-xs text-text-3",a),...b})}function z({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-action",className:h("ml-auto flex items-center",a),...b})}function A({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-content",className:h("p-5",a),...b})}var B=c(17289);let C=B.Root;function D({className:a,children:b,...c}){return(0,d.jsxs)(B.Portal,{children:[(0,d.jsx)(B.Overlay,{"data-slot":"dialog-overlay",className:"fixed inset-0 z-50 bg-ink/40"}),(0,d.jsx)(B.Content,{"data-slot":"dialog-content",className:h("fixed left-1/2 top-1/2 z-50 flex max-h-[92vh] w-full max-w-lg -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-border bg-surface shadow-lg outline-none",a),...c,children:b})]})}function E({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"dialog-header",className:h("flex shrink-0 flex-col gap-1 border-b border-border px-5 py-4",a),...b})}function F({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"dialog-body",className:h("flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto px-5 py-4",a),...b})}function G({className:a,...b}){return(0,d.jsx)(B.Title,{"data-slot":"dialog-title",className:h("font-display text-base font-semibold text-text",a),...b})}function H({className:a,...b}){return(0,d.jsx)(B.Description,{"data-slot":"dialog-description",className:h("text-xs text-text-3",a),...b})}function I({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"dialog-footer",className:h("flex shrink-0 items-center gap-2.5 border-t border-border px-5 py-3.5",a),...b})}B.Trigger,B.Close;var J=c(6363);function K({className:a}){return(0,d.jsx)("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:!1,className:a,children:(0,d.jsx)("path",{d:"M13 4.5 6.5 11 3 7.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}let L=J.Root,M=J.Trigger;J.Group;let N=J.RadioGroup,O="flex cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-1.5 text-sm text-text-2 outline-none focus:bg-surface-2 focus:text-text data-[disabled]:pointer-events-none data-[disabled]:opacity-50";function P({className:a,sideOffset:b=6,...c}){return(0,d.jsx)(J.Portal,{children:(0,d.jsx)(J.Content,{sideOffset:b,className:h("z-50 min-w-32 overflow-hidden rounded-lg border border-border bg-surface p-1 shadow-lg",a),...c})})}function Q({className:a,children:b,...c}){return(0,d.jsxs)(J.RadioItem,{className:h(O,"data-[state=checked]:font-semibold data-[state=checked]:text-text",a),...c,children:[(0,d.jsx)("span",{className:"flex-1",children:b}),(0,d.jsx)(J.ItemIndicator,{children:(0,d.jsx)(K,{className:"size-4 text-primary"})})]})}function R({className:a,children:b,...c}){return(0,d.jsxs)(J.CheckboxItem,{className:h(O,"group data-[state=checked]:font-semibold data-[state=checked]:text-text",a),...c,children:[(0,d.jsx)("span",{className:"grid size-4 shrink-0 place-items-center rounded-[5px] border border-border-strong text-text-inv transition-colors group-data-[state=checked]:border-primary-solid group-data-[state=checked]:bg-primary-solid",children:(0,d.jsx)(J.ItemIndicator,{children:(0,d.jsx)(K,{className:"size-3"})})}),(0,d.jsx)("span",{className:"flex-1",children:b})]})}function S({className:a,...b}){return(0,d.jsx)(J.Separator,{className:h("-mx-1 my-1 h-px bg-border",a),...b})}function T({className:a,type:b="text",...c}){return(0,d.jsx)("input",{type:b,"data-slot":"input",className:h("h-9 w-full rounded-lg border border-border-field bg-surface-2 px-3 text-sm text-text","truncate placeholder:text-text-3 transition-colors","focus:border-primary focus:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40","disabled:cursor-not-allowed disabled:opacity-50",a),...c})}function U({className:a,...b}){return(0,d.jsx)("nav",{"data-slot":"pagination",role:"navigation","aria-label":"Pagination",className:h("flex items-center justify-center gap-3 py-4",a),...b})}function V({children:a,...b}){return(0,d.jsxs)(s,{"data-slot":"pagination-previous",variant:"outline",tone:"neutral",size:"sm",...b,children:[(0,d.jsx)(Y,{"aria-hidden":!0,focusable:!1}),a??"Previous"]})}function W({loading:a=!1,children:b,disabled:c=!1,...e}){return(0,d.jsxs)(s,{"data-slot":"pagination-next",variant:"outline",tone:"neutral",size:"sm",disabled:c||a,...e,children:[b??(a?"Loading…":"Next"),a?(0,d.jsxs)("svg",{"aria-hidden":!0,focusable:!1,viewBox:"0 0 16 16",className:"size-3.5 animate-spin",fill:"none",children:[(0,d.jsx)("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"2"}),(0,d.jsx)("path",{d:"M14 8a6 6 0 0 0-6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}):(0,d.jsx)(Z,{"aria-hidden":!0,focusable:!1})]})}function X({className:a,...b}){return(0,d.jsx)("p",{"data-slot":"pagination-status","aria-live":"polite",className:h("text-xs text-text-3",a),...b})}function Y(a){return(0,d.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round",...a,children:(0,d.jsx)("path",{d:"m15 6-6 6 6 6"})})}function Z(a){return(0,d.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round",...a,children:(0,d.jsx)("path",{d:"m9 6 6 6-6 6"})})}var $=c(85641);let _=$.Root,aa=$.Trigger;function ab({className:a,align:b="start",sideOffset:c=6,collisionPadding:e=8,...f}){return(0,d.jsx)($.Portal,{children:(0,d.jsx)($.Content,{align:b,sideOffset:c,collisionPadding:e,className:h("z-50 max-h-(--radix-popover-content-available-height) min-w-32 overflow-y-auto rounded-lg border border-border bg-surface p-1 shadow-lg outline-none",a),...f})})}$.Close,$.Anchor;var ac=c(89904);function ad({className:a,...b}){return(0,d.jsx)(ac.Root,{type:"single","data-slot":"segmented-control",className:h("inline-flex items-center gap-0.5 rounded-lg border border-border bg-surface-2 p-0.5",a),...b})}function ae({className:a,...b}){return(0,d.jsx)(ac.Item,{"data-slot":"segmented-control-item",className:h("inline-flex flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md px-3 py-1.5 text-xs font-semibold text-text-3 transition-colors cursor-pointer","hover:text-text-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40","data-[state=on]:bg-surface data-[state=on]:text-text data-[state=on]:shadow-sm","[&_svg]:size-4 [&_svg]:shrink-0",a),...b})}var af=c(58973);let ag=af.Root;af.Group;let ah=af.Value;function ai({className:a}){return(0,d.jsx)("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:!1,className:a,children:(0,d.jsx)("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function aj({className:a}){return(0,d.jsx)("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:!1,className:a,children:(0,d.jsx)("path",{d:"M13 4.5 6.5 11 3 7.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function ak({className:a,children:b,...c}){return(0,d.jsxs)(af.Trigger,{"data-slot":"select-trigger",className:h("flex h-9 w-full cursor-pointer items-center justify-between gap-2 rounded-lg border border-border-field bg-surface-2 px-3 text-sm text-text","transition-colors focus:border-primary focus:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40","data-[placeholder]:text-text-3 disabled:cursor-not-allowed disabled:opacity-50","[&>span]:truncate",a),...c,children:[b,(0,d.jsx)(af.Icon,{asChild:!0,children:(0,d.jsx)(ai,{className:"size-4 shrink-0 text-text-3"})})]})}function al({className:a,children:b,position:c="popper",sideOffset:e=6,...f}){return(0,d.jsx)(af.Portal,{children:(0,d.jsxs)(af.Content,{"data-slot":"select-content",position:c,sideOffset:e,className:h("relative z-50 max-h-(--radix-select-content-available-height) min-w-32 overflow-hidden rounded-lg border border-border bg-surface shadow-lg","popper"===c&&"w-(--radix-select-trigger-width)",a),...f,children:[(0,d.jsx)(an,{}),(0,d.jsx)(af.Viewport,{className:"p-1",children:b}),(0,d.jsx)(ao,{})]})})}function am({className:a,children:b,...c}){return(0,d.jsxs)(af.Item,{"data-slot":"select-item",className:h("relative flex w-full cursor-pointer select-none items-center rounded-md py-1.5 pl-2.5 pr-8 text-sm text-text-2 outline-none","hover:bg-surface-2 hover:text-text data-[highlighted]:bg-surface-2 data-[highlighted]:text-text","data-[state=checked]:font-semibold data-[state=checked]:text-text","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...c,children:[(0,d.jsx)(af.ItemText,{children:b}),(0,d.jsx)("span",{className:"absolute right-2.5 flex items-center",children:(0,d.jsx)(af.ItemIndicator,{children:(0,d.jsx)(aj,{className:"size-4 text-primary"})})})]})}function an({className:a,...b}){return(0,d.jsx)(af.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:h("flex cursor-default items-center justify-center py-1 text-text-3",a),...b,children:(0,d.jsx)(ai,{className:"size-4 rotate-180"})})}function ao({className:a,...b}){return(0,d.jsx)(af.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:h("flex cursor-default items-center justify-center py-1 text-text-3",a),...b,children:(0,d.jsx)(ai,{className:"size-4"})})}let ap=B.Root;function aq({className:a,children:b,side:c="right",...e}){return(0,d.jsxs)(B.Portal,{children:[(0,d.jsx)(B.Overlay,{"data-slot":"sheet-overlay",className:"fixed inset-0 z-40 bg-ink/40 backdrop-blur-[1px]"}),(0,d.jsxs)(B.Content,{"data-slot":"sheet-content",className:h("fixed inset-y-0 z-50 flex h-full w-full max-w-md flex-col gap-4 overflow-y-auto border-border bg-surface p-6 shadow-lg outline-none","left"===c?"left-0 border-r":"right-0 border-l",a),...e,children:[b,(0,d.jsxs)(B.Close,{className:"absolute right-4 top-4 cursor-pointer rounded-md text-text-3 transition-colors hover:bg-surface-2 hover:text-text size-8 grid place-content-center",children:[(0,d.jsx)("svg",{"aria-hidden":!0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round",className:"size-4",children:(0,d.jsx)("path",{d:"M6 6 18 18M18 6 6 18"})}),(0,d.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function ar({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"sheet-header",className:h("flex flex-col gap-1 pr-8",a),...b})}function as({className:a,...b}){return(0,d.jsx)(B.Title,{"data-slot":"sheet-title",className:h("font-display text-lg font-semibold text-text",a),...b})}function at({className:a,...b}){return(0,d.jsx)(B.Description,{"data-slot":"sheet-description",className:h("text-sm text-text-2",a),...b})}function au({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"skeleton","aria-hidden":!0,className:h("animate-pulse rounded-md bg-surface-3",a),...b})}B.Trigger,B.Close;var av=c(81610);function aw({className:a,...b}){return(0,d.jsx)(av.Root,{"data-slot":"switch",className:h("peer inline-flex h-5.5 w-9.5 shrink-0 cursor-pointer items-center rounded-full p-0.5 transition-colors outline-none focus-visible:ring-2 focus-visible:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-ok data-[state=unchecked]:bg-border-strong",a),...b,children:(0,d.jsx)(av.Thumb,{"data-slot":"switch-thumb",className:"pointer-events-none block size-4.5 rounded-full bg-switch-thumb shadow-sm transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"})})}function ax({className:a,...b}){return(0,d.jsx)("div",{className:"w-full overflow-x-auto",children:(0,d.jsx)("table",{"data-slot":"table",className:h("w-full caption-bottom border-collapse text-sm",a),...b})})}function ay({className:a,...b}){return(0,d.jsx)("thead",{"data-slot":"table-header",className:h("[&_tr]:border-b [&_tr]:border-border",a),...b})}function az({className:a,...b}){return(0,d.jsx)("tbody",{"data-slot":"table-body",className:h("[&_tr:last-child]:border-0",a),...b})}function aA({className:a,onClick:b,onKeyDown:c,tabIndex:e,role:f,...g}){let i="function"==typeof b;return(0,d.jsx)("tr",{"data-slot":"table-row",role:i?f??"button":f,tabIndex:i?e??0:e,onClick:b,onKeyDown:i?function(a){c?.(a),i&&!a.defaultPrevented&&a.target===a.currentTarget&&("Enter"===a.key||" "===a.key)&&(a.preventDefault(),b(a))}:c,className:h("border-b border-hairline transition-colors",i&&"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40",a),...g})}function aB({scope:a="col",className:b,...c}){return(0,d.jsx)("th",{"data-slot":"table-head",scope:a,className:h("px-3 pb-3 text-left align-middle text-label font-semibold uppercase tracking-wider text-text-3",b),...c})}function aC({className:a,...b}){return(0,d.jsx)("td",{"data-slot":"table-cell",className:h("px-3 py-2 align-middle",a),...b})}var aD=c(93636);let aE=aD.Root;function aF({className:a,...b}){return(0,d.jsx)(aD.List,{"data-slot":"tabs-list",className:h("inline-flex items-center gap-0.5 rounded-lg border border-border bg-surface-2 p-0.5",a),...b})}function aG({className:a,...b}){return(0,d.jsx)(aD.Trigger,{"data-slot":"tabs-trigger",className:h("inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md px-3 py-1.5 text-xs font-semibold text-text-3 transition-colors cursor-pointer","hover:text-text-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40","data-[state=active]:bg-surface data-[state=active]:text-text data-[state=active]:shadow-sm","[&_svg]:size-4 [&_svg]:shrink-0",a),...b})}function aH({className:a,...b}){return(0,d.jsx)(aD.Content,{"data-slot":"tabs-content",className:h("focus-visible:outline-none",a),...b})}function aI({children:a,icon:b,dot:c,className:e}){return(0,d.jsxs)("span",{className:h("inline-flex h-6 items-center gap-1.5 whitespace-nowrap rounded-md border border-border bg-surface px-2 text-label font-medium text-text-2",e),children:[c&&(0,d.jsx)("span",{className:"size-1.5 shrink-0 rounded-full",style:{background:c}}),b,a]})}},74277:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,80772,23)),Promise.resolve().then(c.t.bind(c,8055,23)),Promise.resolve().then(c.t.bind(c,50315,23)),Promise.resolve().then(c.t.bind(c,31646,23)),Promise.resolve().then(c.t.bind(c,22506,23)),Promise.resolve().then(c.t.bind(c,89374,23)),Promise.resolve().then(c.t.bind(c,62046,23)),Promise.resolve().then(c.t.bind(c,93323,23)),Promise.resolve().then(c.bind(c,54126))},74835:(a,b,c)=>{"use strict";c.d(b,{CLOCK_TICK_MS:()=>e,useRenderClock:()=>f});var d=c(1505);let e=3e4;function f(a,b=e){let c=(0,d.useMemo)(()=>(function(a,b){let c,d=b,e=new Set,f=()=>{for(let a of(d=Date.now(),e))a()},g=()=>{"visible"===document.visibilityState&&f()};return{subscribe:b=>(e.add(b),void 0===c&&(d=Date.now(),c=setInterval(f,a),document.addEventListener("visibilitychange",g)),()=>{e.delete(b),0===e.size&&void 0!==c&&(clearInterval(c),c=void 0,document.removeEventListener("visibilitychange",g))}),getSnapshot:()=>d}})(b,a),[b,a]);return(0,d.useSyncExternalStore)(c.subscribe,c.getSnapshot,()=>a)}},75784:(a,b,c)=>{"use strict";c.d(b,{RecommendedActionsCardView:()=>j});var d=c(15008),e=c(71378),f=c(16820),g=c(51076);let h={block_credentials:f.pD,redact_pii:f.jZ,review_external_share:f._G},i={critical:"critical",high:"primary",medium:"teal",low:"teal"};function j({items:a,isLoading:b,error:c,applyAction:j,dismissAction:k,isMutating:l,mutationError:m}){return(0,d.jsxs)(e.Zp,{className:"flex flex-col shadow-sm",children:[(0,d.jsxs)(e.aR,{children:[(0,d.jsx)(e.AG,{tone:"primary",children:(0,d.jsx)(f.BZ,{"aria-hidden":!0,focusable:!1,className:"size-4"})}),(0,d.jsxs)(e.Lc,{children:[(0,d.jsx)(e.ZB,{children:"Recommended actions"}),(0,d.jsx)(e.BT,{children:b?"Loading…":`${String(a.length)} prioritized for your environment`})]}),(0,d.jsx)(e.X9,{children:(0,d.jsx)(e.$n,{variant:"ghost",tone:"primary",size:"sm",children:"View all"})})]}),(0,d.jsx)(e.Wu,{"aria-busy":b,children:c?(0,d.jsx)(g.rJ,{message:c}):b?(0,d.jsx)("div",{className:"flex flex-col gap-3 py-2",children:[0,1,2].map(a=>(0,d.jsx)(e.EA,{className:"h-20 w-full"},a))}):0===a.length?(0,d.jsx)("div",{className:"py-6 text-center text-xs text-text-3",children:"No recommendations right now."}):(0,d.jsxs)(d.Fragment,{children:[m&&(0,d.jsx)(g.rJ,{message:m}),a.map((b,c)=>{let g=h[b.category]??f.rX;return(0,d.jsxs)("div",{className:(0,e.cn)("flex gap-3 py-3",c<a.length-1&&"border-b border-hairline"),children:[(0,d.jsx)("span",{className:(0,e.cn)("flex size-8 shrink-0 items-center justify-center rounded-lg",e.id[i[b.severity]]),children:(0,d.jsx)(g,{"aria-hidden":!0,focusable:!1,className:"size-4"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"text-sm font-semibold text-text",children:b.title}),(0,d.jsx)("div",{className:"mt-0.5 text-xs leading-relaxed text-text-2",children:b.description}),(0,d.jsx)("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:b.subjects.map(a=>(0,d.jsx)(e.vw,{children:a.label},`${a.type}_${a.id}`))})]}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-col items-end gap-1.5",children:["apply"===b.action.mode?(0,d.jsx)(e.$n,{variant:"solid",tone:"primary",size:"sm",disabled:l,onClick:()=>{j(b.id)},children:b.action.label}):b.action.href?(0,d.jsx)(e.$n,{asChild:!0,variant:"solid",tone:"primary",size:"sm",children:(0,d.jsx)("a",{href:b.action.href,children:b.action.label})}):(0,d.jsx)(e.$n,{variant:"solid",tone:"primary",size:"sm",disabled:!0,children:b.action.label}),(0,d.jsx)(e.$n,{variant:"ghost",size:"sm",disabled:l,onClick:()=>{k(b.id)},children:"Dismiss"})]})]},b.id)})]})})]})}},76122:(a,b,c)=>{"use strict";c.d(b,{PolicyDetailView:()=>m,PolicyListView:()=>l,PolicyStatsView:()=>j});var d=c(15008),e=c(71378),f=c(65366),g=c(16820),h=c(52233);function i(a){return void 0===a?"—":a.toLocaleString()}function j({stats:a,loading:b=!1,className:c}){let e=[{icon:g.iB,value:i(a?.policies),label:"Policies",tone:"primary"},{icon:g.Zu,value:i(a?.builtin),label:"Built-in",tone:"neutral"},{icon:g.k3,value:i(a?.custom),label:"Custom scripts",tone:"violet"},{icon:g.kp,value:i(a?.detectionsGoverned),label:"Detections governed",tone:"ok"}];return(0,d.jsx)(h.s,{items:e,isLoading:b,className:c})}function k({policy:a,selected:b,onSelect:c}){let{icon:h,tone:i}=(0,f.ES)(a.id),[j,k]=(0,e.vV)(i),l=a.usedByCount;return(0,d.jsxs)("button",{type:"button",onClick:c,"aria-pressed":b,className:(0,e.cn)("flex w-full cursor-pointer items-center gap-3 rounded-lg p-3 text-left transition-colors",b?"bg-primary-tint":"hover:bg-surface-2"),children:[(0,d.jsx)("span",{className:"flex size-7.5 shrink-0 items-center justify-center rounded-lg [&_svg]:size-4",style:{background:k,color:j},children:(0,d.jsx)(h,{"aria-hidden":!0,focusable:!1})}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:"block truncate text-sm font-semibold text-text",title:a.name,children:a.name}),(0,d.jsxs)("span",{className:"mt-px block text-xs text-text-3",children:[l," detection",1===l?"":"s"]})]}),"builtin"===a.kind&&(0,d.jsx)(g.XA,{"aria-hidden":!0,focusable:!1,className:"size-3.5 shrink-0 text-text-3"})]})}function l({items:a,activeId:b,onSelect:c,loading:f=!1,error:g=null}){return(0,d.jsxs)(e.Zp,{className:"flex flex-col overflow-hidden p-2 shadow-sm",children:[(0,d.jsx)("div",{className:"mb-1 px-2.5 pb-1 pt-2 text-label font-semibold uppercase tracking-wider text-text-3",children:"Policies"}),(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto",children:g?(0,d.jsxs)("p",{className:"px-2.5 py-2 text-sm text-sev-critical-ink",children:["Error loading policies: ",g]}):f?(0,d.jsx)("p",{className:"px-2.5 py-2 text-sm text-text-3",children:"Loading policies…"}):0===a.length?(0,d.jsx)("p",{className:"px-2.5 py-2 text-sm text-text-3",children:"No policies yet."}):a.map(a=>(0,d.jsx)(k,{policy:a,selected:a.id===b,onSelect:()=>{c(a.id)}},a.id))})]})}function m({policy:a}){let{icon:b,tone:c}=(0,f.ES)(a.id),[h,i]=(0,e.vV)(c),j="builtin"===a.kind,k=a.usedBy;return(0,d.jsxs)("div",{className:"flex flex-col",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 border-b border-border px-5 py-4",children:[(0,d.jsx)("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-xl [&_svg]:size-5.5",style:{background:i,color:h},children:(0,d.jsx)(b,{"aria-hidden":!0,focusable:!1})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)("h2",{className:"font-display text-xl font-semibold text-text",children:a.name}),j&&(0,d.jsx)(e.vw,{icon:(0,d.jsx)(g.XA,{"aria-hidden":!0,focusable:!1,className:"size-3"}),children:"Built-in"}),(0,d.jsx)("span",{className:"rounded-full border border-border bg-surface-2 px-2 py-0.5 font-mono text-xs font-semibold text-text-2",children:a.id})]}),(0,d.jsx)("p",{className:"mt-0.5 text-xs text-text-3",children:j?"AKA \xb7 built-in \xb7 no configuration":"Custom policy"})]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-6 p-5",children:[(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-surface-2 px-4 py-3",children:[(0,d.jsx)("p",{className:"text-sm leading-relaxed text-text",children:a.description}),j&&(0,d.jsxs)("p",{className:"mt-2 inline-flex items-center gap-1.5 text-xs text-text-3",children:[(0,d.jsx)(g.XA,{"aria-hidden":!0,focusable:!1,className:"size-3.5"}),"Built-in policy — behavior is fixed and can't be edited."]})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"mb-2.5 flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-label font-semibold uppercase tracking-wider text-text-3",children:"Applied by"}),(0,d.jsx)("span",{className:"rounded-full bg-surface-3 px-2 py-0.5 text-xs font-semibold text-text-2",children:k.length})]}),0===k.length?(0,d.jsx)("p",{className:"py-2 text-sm text-text-3",children:"No detections use this policy yet."}):(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:k.map(a=>(0,d.jsxs)(e.vw,{className:"h-7",dot:a.enabled?"var(--color-ok)":"var(--color-border-strong)",children:[a.name,(0,d.jsxs)("span",{className:"font-mono text-text-3",children:[a.ruleCount," rules"]})]},a.id))})]})]})]})}},76210:(a,b,c)=>{"use strict";c.d(b,{RY:()=>i,WI:()=>e.WIv,XA:()=>e.XAi,Ze:()=>k,Zu:()=>e.Zus,_G:()=>e._GS,fN:()=>j,iB:()=>l,j4:()=>m,k3:()=>e.k3y,kp:()=>g,mL:()=>e.mLz,np:()=>h,rX:()=>e.rX,uv:()=>e.uv5});var d=c(15008),e=c(93435);let f={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"},g=a=>(0,d.jsxs)("svg",{...f,...a,children:[(0,d.jsx)("path",{d:"M8 6h12M8 12h12M8 18h12"}),(0,d.jsx)("circle",{cx:"3.6",cy:"6",r:"1.1",fill:"currentColor",stroke:"none"}),(0,d.jsx)("circle",{cx:"3.6",cy:"12",r:"1.1",fill:"currentColor",stroke:"none"}),(0,d.jsx)("circle",{cx:"3.6",cy:"18",r:"1.1",fill:"currentColor",stroke:"none"})]}),h=a=>(0,d.jsx)("svg",{...f,...a,children:(0,d.jsx)("path",{d:"M3 12h4l3 8 4-16 3 8h4"})}),i=a=>(0,d.jsxs)("svg",{...f,...a,children:[(0,d.jsx)("circle",{cx:"7.5",cy:"15.5",r:"4.5"}),(0,d.jsx)("path",{d:"M10.7 12.3 21 2M15 8l3 3M18 5l3 3"})]}),j=a=>(0,d.jsxs)("svg",{...f,...a,children:[(0,d.jsx)("path",{d:"M21 12a9 9 0 1 1-2.64-6.36"}),(0,d.jsx)("path",{d:"M21 3v6h-6"})]}),k=a=>(0,d.jsxs)("svg",{...f,...a,children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"}),(0,d.jsx)("path",{d:"M19.4 15a1.7 1.7 0 0 0 .34 1.87l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.7 1.7 0 0 0-1.87-.34 1.7 1.7 0 0 0-1.03 1.56V21a2 2 0 1 1-4 0v-.09a1.7 1.7 0 0 0-1.11-1.56 1.7 1.7 0 0 0-1.87.34l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.7 1.7 0 0 0 .34-1.87 1.7 1.7 0 0 0-1.56-1.03H3a2 2 0 1 1 0-4h.09a1.7 1.7 0 0 0 1.56-1.11 1.7 1.7 0 0 0-.34-1.87l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.7 1.7 0 0 0 1.87.34h.08A1.7 1.7 0 0 0 10.12 3V3a2 2 0 1 1 4 0v.09a1.7 1.7 0 0 0 1.03 1.56 1.7 1.7 0 0 0 1.87-.34l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.7 1.7 0 0 0-.34 1.87v.08a1.7 1.7 0 0 0 1.56 1.03H21a2 2 0 1 1 0 4h-.09a1.7 1.7 0 0 0-1.56 1.03Z"})]}),l=a=>(0,d.jsxs)("svg",{...f,...a,children:[(0,d.jsx)("path",{d:"M6 3h9l3 3v15H6z"}),(0,d.jsx)("path",{d:"M15 3v3h3"}),(0,d.jsx)("path",{d:"M9 12h6M9 16h4"})]}),m=a=>(0,d.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:510,height:236,viewBox:"0 0 510 236",fill:"none",...a,children:[(0,d.jsx)("path",{d:"M329.798 26H302.492V169.68H329.798V126.99H344.796L374.425 169.57H405.11L364.293 113.206L403.6 65.6621H371.909L343.689 101.616H329.798V26.0042V26Z",fill:"currentColor"}),(0,d.jsx)("path",{d:"M224.398 172C234.998 172 247.996 167.417 254.994 155.653H255.595V169.607H282.394V66.5446H255.595V80.2995H254.994C247.996 68.5362 234.994 63.7539 224.398 63.7539C194.799 63.7539 178 88.6717 178 117.776C178 146.879 194.799 172 224.398 172ZM205.802 117.776C205.802 101.031 213.201 85.2805 230.998 85.2805C248.796 85.2805 256.195 101.031 256.195 117.776C256.195 134.52 248.796 150.469 230.998 150.469C213.201 150.469 205.802 134.52 205.802 117.776Z",fill:"currentColor"}),(0,d.jsx)("path",{d:"M452.006 172C462.606 172 475.604 167.417 482.602 155.653H483.203V169.607H510.002V66.5446H483.203V80.2995H482.602C475.604 68.5362 462.602 63.7539 452.006 63.7539C422.407 63.7539 405.608 88.6717 405.608 117.776C405.608 146.879 422.407 172 452.006 172ZM433.409 117.776C433.409 101.031 440.809 85.2805 458.606 85.2805C476.403 85.2805 483.803 101.031 483.803 117.776C483.803 134.52 476.403 150.469 458.606 150.469C440.809 150.469 433.409 134.52 433.409 117.776Z",fill:"currentColor"}),(0,d.jsx)("path",{d:"M54 118H0C0 88.3759 24.3759 64 54 64C83.6241 64 108 88.3759 108 118H54Z",fill:"currentColor"}),(0,d.jsx)("path",{d:"M54 118H108C108 147.624 83.6241 172 54 172C24.3759 172 0 147.624 0 118H54Z",fill:"#00E0B8"}),(0,d.jsx)("path",{d:"M81 54C95.9117 54 108 41.9117 108 27C108 12.0883 95.9117 0 81 0C66.0883 0 54 12.0883 54 27C54 41.9117 66.0883 54 81 54Z",fill:"currentColor"}),(0,d.jsx)("path",{d:"M27 236C41.9117 236 54 223.912 54 209C54 194.088 41.9117 182 27 182C12.0883 182 0 194.088 0 209C0 223.912 12.0883 236 27 236Z",fill:"#00E0B8"})]})},76836:(a,b,c)=>{"use strict";c.d(b,{e:()=>f,p:()=>g});var d=c(15008),e=c(71378);function f({children:a,className:b}){return(0,d.jsx)("span",{className:(0,e.cn)("mb-2 block text-label font-semibold uppercase tracking-wider text-text-3",b),children:a})}function g({label:a,children:b}){return(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"mb-1 text-label font-semibold uppercase tracking-wider text-text-3",children:a}),(0,d.jsx)("div",{className:"text-ui font-medium text-text",children:b})]})}},77292:(a,b,c)=>{"use strict";c.d(b,{DU:()=>l,eF:()=>f,gi:()=>j,hv:()=>g,rO:()=>e,rU:()=>k,y3:()=>i,y6:()=>d.y6l,yr:()=>h});var d=c(64145);function e(a,b){return null!==a.revokedAt?"revoked":null!==a.maxUses&&a.useCount>=a.maxUses?"consumed":null!==a.expiresAt&&Date.parse(a.expiresAt)<=b?"expired":"active"}function f(a,b){if((0,d.qEQ)(a.keyVersion,b))return null;switch(b.status){case"unreadable":return"The fingerprint key file cannot be read, so no recorded detection can be matched right now. Check the permissions on ~/.aka/data — do not delete the key.";case"absent":return"The fingerprint key file is missing, so the fingerprint recorded for this detection can no longer be matched. Trigger the detection again.";default:return`Recorded under fingerprint key v${String(a.keyVersion)}; the key is now v${String(b.version)}, so a grant from it could never match. Trigger the detection again.`}}let g={active:"success",consumed:"default",expired:"default",revoked:"critical"},h={once:"Once",temporary:"Temporary",permanent:"Permanent"},i={suppress:"Suppress",reveal_to_model:"Reveal to model"},j={"cli-approve":"CLI approve","cli-add":"CLI add","web-approve":"Web approve","web-add":"Web add",api:"API","setup-triage":"Setup triage"},k=["once","30m","1h","24h","permanent"],l={once:"Once","30m":"30 min","1h":"1 hour","24h":"24 hours",permanent:"Permanent"}},80954:(a,b,c)=>{"use strict";c.d(b,{ProjectPane:()=>k});var d=c(15008),e=c(71378),f=c(1505),g=c(93946),h=c(97769),i=c(14728);function j(a){let b=a.lastIndexOf("/");return -1===b?"":a.slice(0,b)}function k(a){let{proj:b,path:c,onPathChange:f,query:j,tree:k,isLoading:o,error:s,onClose:t}=a,u=j.trim().length>0,v=k?.folders??[],w=k?.files??[],x=b.accessCounts;return(0,d.jsxs)(e.Zp,{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:[(0,d.jsxs)("div",{className:"border-b border-border px-5 py-3.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3.5",children:[(0,d.jsx)("div",{className:"min-w-0 flex-1",children:(0,d.jsx)(m,{proj:b,path:c,onPathChange:f})}),(0,d.jsx)(l,{...a}),t&&(0,d.jsx)(e.$n,{variant:"ghost",size:"icon","aria-label":"Back to harness",title:"Back to harness",onClick:t,children:(0,d.jsx)(i.m,{name:"x"})})]}),(0,d.jsxs)("div",{className:"mt-3 flex items-start gap-2.5",children:[(0,d.jsx)(g.yk,{v:b.visibility}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 gap-2.5 flex-wrap justify-between",children:[(0,d.jsx)("span",{className:"text-xs text-text-3",children:(0,h._t)(b,"source")}),(0,d.jsx)("span",{className:"flex items-center gap-3 text-xs text-text-3",children:h.IF.map(a=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:(0,e.cn)("size-2 rounded-sm",h.Pe[a].bar)}),x[a]," ",h.Pe[a].label]},a))})]})]})]}),!u&&a.blocked.length>0&&(0,d.jsx)(r,{...a}),(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 pb-4 pt-2",children:o&&!k?(0,d.jsx)("div",{className:"py-12 text-center text-sm text-text-3",children:"Loading files…"}):s?(0,d.jsx)("div",{className:"py-12 text-center text-sm text-sev-critical-ink",children:s}):u?w.length>0?(0,d.jsx)(q,{caption:`${String(w.length)} result${1===w.length?"":"s"}`,rows:w,showPath:!0,...a}):(0,d.jsxs)("div",{className:"py-12 text-center text-text-3",children:[(0,d.jsx)(i.m,{name:"search",className:"mx-auto mb-2 size-6"}),(0,d.jsxs)("div",{className:"text-sm",children:["No files match “",j,"”"]})]}):0===v.length&&0===w.length?(0,d.jsx)("div",{className:"py-12 text-center text-sm text-text-3",children:"This folder is empty"}):(0,d.jsxs)(e.XI,{children:[(0,d.jsx)(e.A0,{children:(0,d.jsxs)(e.Hj,{children:[(0,d.jsx)(e.nd,{children:"Name"}),(0,d.jsx)(e.nd,{children:"Origin"}),(0,d.jsx)(e.nd,{children:"LLM access"}),(0,d.jsx)(e.nd,{className:"w-10"})]})}),(0,d.jsxs)(e.BF,{children:[v.map(a=>(0,d.jsx)(n,{folder:a,onOpen:()=>{f([...c,a.name])}},"d"+a.name)),w.map(b=>(0,d.jsx)(p,{file:b,...a},"f"+b.path))]})]})})]})}function l({proj:a,query:b,onQueryChange:c}){return(0,d.jsxs)("div",{className:"relative w-70 shrink-0",children:[(0,d.jsx)(i.m,{name:"search",className:"absolute left-3 top-1/2 size-4 -translate-y-1/2 text-text-3"}),(0,d.jsx)("input",{value:b,onChange:a=>{c(a.target.value)},placeholder:`Search files in ${a.name}…`,className:"h-9 w-full rounded-lg border border-border-field bg-surface-2 pl-9 pr-8 text-sm text-text placeholder:text-text-3 focus:border-primary focus:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40"}),b&&(0,d.jsx)("button",{type:"button","aria-label":"Clear search",onClick:()=>{c("")},className:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-1 text-text-3 hover:text-text",children:(0,d.jsx)(i.m,{name:"x",className:"size-3.5"})})]})}function m({proj:a,path:b,onPathChange:c}){let g=[a.name,...b];return(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[b.length>0&&(0,d.jsx)(e.$n,{variant:"ghost",size:"icon",className:"size-7",title:"Up one level",onClick:()=>{c(b.slice(0,-1))},children:(0,d.jsx)(i.m,{name:"arrow-up"})}),g.map((a,h)=>{let j=h===g.length-1;return(0,d.jsxs)(f.Fragment,{children:[h>0&&(0,d.jsx)(i.m,{name:"chevron-right",className:"size-3 text-text-3"}),(0,d.jsx)("button",{type:"button",onClick:()=>{c(b.slice(0,h))},className:(0,e.cn)("rounded px-1 py-0.5 text-sm",0===h&&"font-mono",j?"cursor-default font-bold text-text":"font-semibold text-text-2 hover:text-text"),children:a})]},h)})]})}function n({folder:a,onOpen:b}){let c=a.accessCounts;return(0,d.jsxs)(e.Hj,{className:"cursor-pointer hover:bg-surface-2",onClick:b,children:[(0,d.jsx)(e.nA,{children:(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)(i.m,{name:"folder",className:"size-4.5 shrink-0 text-primary"}),(0,d.jsx)("span",{className:"text-ui font-semibold text-text",children:a.name}),(0,d.jsxs)("span",{className:"text-xs text-text-3",children:[c.total," file",1===c.total?"":"s"]})]})}),(0,d.jsx)(e.nA,{className:"text-xs text-text-3",children:"Folder"}),(0,d.jsx)(e.nA,{children:(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(g.AJ,{counts:c}),c.blocked>0?(0,d.jsxs)("span",{className:"text-xs font-semibold text-sev-critical-ink",children:[c.blocked," blocked"]}):(0,d.jsxs)("span",{className:"text-xs text-text-3",children:[c.total," allowed"]})]})}),(0,d.jsx)(e.nA,{children:(0,d.jsx)("div",{className:"grid size-7 place-items-center","aria-hidden":"true",children:(0,d.jsx)(i.m,{name:"chevron-right",className:"size-4 text-text-3"})})})]})}function o({file:a,showPath:b}){let c=j(a.path),e="blocked"===a.access;return(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2.5",children:[(0,d.jsx)(i.m,{name:"file",className:"size-4.5 shrink-0 text-text-3"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-1.5 whitespace-nowrap",children:[b&&c.length>0&&(0,d.jsxs)("span",{className:"font-mono text-xs text-text-3",children:[c,"/"]}),(0,d.jsx)("span",{className:"font-mono text-xs font-semibold text-text",children:a.name})]}),a.blockedAt&&e&&(0,d.jsxs)("div",{className:"mt-px flex items-center gap-1.5 text-xs text-sev-critical-ink",children:[(0,d.jsx)(i.m,{name:"slash-circle",className:"size-3"}),a.note]})]})]})}function p({file:a,onSetAccess:b,onOpenFile:c,drawerPath:f,showPath:h}){return(0,d.jsxs)(e.Hj,{className:(0,e.cn)("cursor-pointer hover:bg-surface-2",f===a.path&&"bg-surface-2"),onClick:()=>{c(a.path)},children:[(0,d.jsx)(e.nA,{children:(0,d.jsx)(o,{file:a,showPath:h})}),(0,d.jsx)(e.nA,{children:(0,d.jsx)(g.TJ,{origin:a.origin})}),(0,d.jsx)(e.nA,{children:(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(g.kx,{value:a.access,onChange:c=>{b(a.path,c)}}),(0,d.jsx)(g.Vx,{value:a.access})]})}),(0,d.jsx)(e.nA,{children:(0,d.jsx)("div",{className:"grid size-7 place-items-center","aria-hidden":"true",children:(0,d.jsx)(i.m,{name:"chevron-right",className:"size-4 text-text-3"})})})]})}function q({caption:a,rows:b,showPath:c,...f}){return(0,d.jsxs)(e.XI,{children:[(0,d.jsx)(e.A0,{children:(0,d.jsxs)(e.Hj,{children:[(0,d.jsx)(e.nd,{children:a}),(0,d.jsx)(e.nd,{children:"Origin"}),(0,d.jsx)(e.nd,{children:"LLM access"}),(0,d.jsx)(e.nd,{className:"w-10"})]})}),(0,d.jsx)(e.BF,{children:b.map(a=>(0,d.jsx)(p,{file:a,showPath:c,...f},a.path))})]})}function r({blocked:a,showBlocked:b,onToggleBlocked:c,onSetAccess:f,onOpenFile:k}){return(0,d.jsxs)("div",{className:"border-b border-border bg-surface-2",children:[(0,d.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-4.5 py-3 text-left cursor-pointer",onClick:c,children:[(0,d.jsx)("span",{className:"grid size-6 shrink-0 place-items-center rounded-md bg-sev-critical-fill text-sev-critical-ink",children:(0,d.jsx)(i.m,{name:"slash-circle",className:"size-3.5"})}),(0,d.jsx)("span",{className:"text-ui font-semibold",children:"Recently blocked"}),(0,d.jsx)("span",{className:"rounded-full bg-sev-critical-ink px-2 py-px text-xs font-bold text-on-accent",children:a.length}),(0,d.jsx)("span",{className:"text-xs text-text-3",children:"Auto-blocked on detection — review to adjust"}),(0,d.jsx)(i.m,{name:"chevron-down",className:(0,e.cn)("ml-auto size-4.5 text-text-3 transition-transform",!b&&"-rotate-90")})]}),b&&(0,d.jsx)("div",{className:"flex flex-col gap-2 px-3.5 pb-3",children:a.map(a=>{let b=j(a.path);return(0,d.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-surface px-3 py-2.5",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-1.5 overflow-hidden whitespace-nowrap",children:[b.length>0&&(0,d.jsxs)("span",{className:"font-mono text-xs text-text-3",children:[b,"/"]}),(0,d.jsx)("span",{className:"font-mono text-xs font-semibold text-text",children:a.name})]}),(0,d.jsxs)("div",{className:"mt-0.5 text-xs text-text-3",children:[a.note,a.blockedAt?` \xb7 blocked ${(0,h.v7)(a.blockedAt)}`:""]})]}),(0,d.jsx)(g.kx,{value:a.access,onChange:b=>{f(a.path,b)}}),(0,d.jsx)(g.Vx,{value:a.access}),(0,d.jsx)(e.$n,{variant:"ghost",tone:"primary",size:"sm",onClick:()=>{k(a.path)},children:"Review"})]},a.path)})})]})}},81009:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>g,metadata:()=>f});var d=c(13726);c(45288),c(3204),c(73032),c(99588);var e=c(33443);let f={title:{template:"%s \xb7 AI Traffic Control",default:"AI Traffic Control"},description:"AI Traffic Control (ai-tc) by AKA Security — local-first security dashboard (open source)."};function g({children:a}){return(0,d.jsxs)("html",{lang:"en",suppressHydrationWarning:!0,children:[(0,d.jsx)("head",{children:(0,d.jsx)("script",{dangerouslySetInnerHTML:{__html:e.HB}})}),(0,d.jsx)("body",{children:a})]})}},82731:(a,b,c)=>{"use strict";c.d(b,{BlockedLedgerView:()=>k});var d=c(15008),e=c(71378),f=c(5265),g=c(22567),h=c(16820),i=c(17139);let j="This row cannot be approved. No reason was given.";function k({items:a,onApprove:b,blockedWindow:c,onBlockedWindowChange:k,blockReason:l,renderedAt:m}){return(0,d.jsxs)("div",{className:"mb-3.5 overflow-hidden rounded-xl border border-sev-high-fill bg-sev-high-fill",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5 px-3.5 py-3",children:[(0,d.jsx)("span",{className:"grid size-6.5 shrink-0 place-items-center rounded-md bg-sev-high-ink text-on-accent",children:(0,d.jsx)(h.pD,{"aria-hidden":!0,focusable:!1,className:"size-4"})}),(0,d.jsx)("span",{className:"text-sm font-semibold text-text",children:"Recently blocked"}),(0,d.jsx)("span",{className:"rounded-full bg-sev-high-ink px-2 py-0.5 text-xs font-bold text-on-accent",children:a.length}),(0,d.jsxs)("span",{className:"text-xs text-text-2",children:["Detections blocked in ",g.sr[c]," — approve one to grant an exception"]}),(0,d.jsx)("span",{className:"ml-auto shrink-0",children:(0,d.jsx)(i.BlockedWindowSelect,{value:c,onChange:k})})]}),0===a.length?(0,d.jsx)("div",{className:"px-3.5 pb-3.5 text-xs text-text-2",children:"Nothing blocked in this window."}):(0,d.jsx)("div",{className:"flex flex-col gap-1.5 px-3 pb-3",children:a.map(a=>{let c=function(a,b){let c;try{c=b(a)}catch{return j}return null===c?null:""===c.trim()?j:c}(a,l),g=`blocked-reason-${a.reference}`;return(0,d.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-surface px-3 py-2.5",children:[(0,d.jsx)("span",{className:"font-mono text-xs font-semibold text-text-3",children:a.reference}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"font-mono text-xs font-semibold text-text",children:a.ruleId}),(0,d.jsx)("span",{className:"font-mono text-xs text-text-2",children:a.maskedValue})]}),(0,d.jsxs)("div",{className:(0,e.cn)("mt-1 text-label text-text-3"),children:[(0,f.K)(a.blockedAt,m),a.repo?` \xb7 ${a.repo}`:"",null===c?"":" \xb7 not approvable"]}),null===c?null:(0,d.jsx)("div",{id:g,className:"mt-1 text-label text-text-3",children:c})]}),(0,d.jsx)(e.$n,{onClick:()=>{b(a.reference)},disabled:null!==c,"aria-describedby":null===c?void 0:g,variant:"ghost",tone:"primary",size:"sm",children:"Approve"})]},a.reference)})})]})}},87038:(a,b,c)=>{"use strict";c.d(b,{H1:()=>i,N2:()=>h,Pt:()=>g,VA:()=>k,q2:()=>j,xf:()=>f});var d=c(64145),e=c(65366);function f(a){return a.locked?"Your organization sets the enforcement policy for this detection, so it cannot be changed on this machine.":`Your organization requires at least ${(0,e.ES)(a.floor).label} for this detection. You can choose a stronger action here, but not a weaker one.`}function g(a){if(!a)return;let b=a.locked?d.V0H:d.V0H.filter(b=>!(0,d.T2I)((0,d.fhc)(b),(0,d.fhc)(a.floor)));if(0===b.length)return;let c=f(a);return Object.fromEntries(b.map(a=>[a,c]))}function h(a,b){let c=a??e.tG;if(!b)return c;let f=d.HUb.safeParse(c);return f.success&&(0,d.T2I)((0,d.fhc)(f.data),(0,d.fhc)(b.floor))?c:b.floor}function i(a,b){return!!b&&(b.locked||h(a,b)!==(a??e.tG))}let j="Your organization requires this detection to stay on, so it cannot be turned off on this machine. You can still give it a stronger enforcement policy here.";function k(a,b){return a&&!!b}},88461:(a,b,c)=>{"use strict";c.d(b,{SessionListView:()=>o});var d=c(15008),e=c(71378),f=c(5265),g=c(16820),h=c(63407),i=c(88488),j=c(70124),k=c(21459),l=c(21462);function m({session:a,selected:b,onSelect:c,renderedAt:i}){let l=a.findings>0;return(0,d.jsxs)("button",{type:"button",onClick:c,"aria-current":b?"true":void 0,className:(0,e.cn)("relative cursor-pointer block w-full rounded-lg px-3 py-2.5 text-left transition-colors",b?"bg-primary-tint":"hover:bg-surface-2"),children:[(0,d.jsxs)("div",{className:"mb-2 flex items-center gap-2.5",children:[(0,d.jsx)(h.K,{id:a.harness,size:26}),(0,d.jsx)("div",{className:"min-w-0 flex-1",children:(0,d.jsx)("div",{className:"truncate text-ui font-semibold text-text",title:a.title,children:a.title})}),(0,d.jsx)(j.md,{status:a.status})]}),(0,d.jsxs)("div",{className:"mb-2 flex items-center gap-1.5 font-mono text-label text-text-3",children:[(0,d.jsx)(g.SY,{"aria-hidden":!0,focusable:!1,className:"size-3 shrink-0"}),(0,d.jsx)("span",{className:"min-w-0 max-w-[50%] truncate",title:a.project,children:a.project}),(0,d.jsx)("span",{className:"shrink-0 text-text-3",children:"\xb7"}),(0,d.jsx)(g.OK,{"aria-hidden":!0,focusable:!1,className:"size-3 shrink-0"}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate",title:a.branches[0],children:a.branches[0]})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-2",title:new Date(a.startedAt).toLocaleString(),suppressHydrationWarning:!0,children:(0,f.K)(a.startedAt,i)}),(0,d.jsx)(j.JW,{icon:g.O4,children:(0,k.vV)(a.startedAt,a.endedAt,a.status,i)}),(0,d.jsxs)(j.JW,{icon:g.kp,children:[a.turns," turns"]}),l&&(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 whitespace-nowrap text-xs font-semibold text-sev-critical-ink",children:[(0,d.jsx)(g.Zu,{"aria-hidden":!0,focusable:!1,className:"size-3"}),a.findings]})]})]})}function n(){return(0,d.jsxs)("div",{className:"rounded-lg px-3 py-2.5",children:[(0,d.jsxs)("div",{className:"mb-2 flex items-center gap-2.5",children:[(0,d.jsx)(e.EA,{className:"size-6.5 shrink-0 rounded-lg"}),(0,d.jsx)(e.EA,{className:"h-4 flex-1"})]}),(0,d.jsx)(e.EA,{className:"mb-2 h-3 w-2/3"}),(0,d.jsx)(e.EA,{className:"h-3 w-1/2"})]})}function o({sessions:a,selectedId:b,onSelect:c,query:f,onQuery:h,harness:j,harnessOptions:o,onHarness:p,isLoading:q,error:r,hasMore:s=!1,emptyCount:t=0,showEmpty:u=!1,onToggleEmpty:v,renderedAt:w}){let x=(0,k.u3)(a,new Date(w)),y=""!==f.trim()||j.length>0,z=1===t?"background session":"background sessions",A=t>0&&v?(0,d.jsx)("div",{className:"px-2 py-2 text-center",children:(0,d.jsx)(e.$n,{variant:"link",tone:"primary",className:"text-label font-normal",onClick:v,children:u?`Hide ${String(t)} ${z}`:`${String(t)} ${z} hidden — show`})}):null;return(0,d.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,d.jsxs)("div",{className:"shrink-0 border-b border-border p-3",children:[(0,d.jsxs)("div",{className:"mb-2 flex h-8.5 items-center gap-2 rounded-lg border border-border-field bg-surface-2 px-2.5 focus-within:border-primary focus-within:ring-2 focus-within:ring-primary/40",children:[(0,d.jsx)(g.WI,{"aria-hidden":!0,focusable:!1,className:"size-3.5 shrink-0 text-text-3"}),(0,d.jsx)("input",{value:f,onChange:a=>{h(a.target.value)},placeholder:"Search sessions & events…","aria-label":"Search sessions and events",className:"min-w-0 flex-1 bg-transparent text-sm text-text placeholder:text-text-3 focus:outline-hidden"})]}),(0,d.jsx)(l.HarnessSelect,{value:j,onChange:p,...o?{options:o}:{}})]}),(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-2","aria-busy":q,children:r?(0,d.jsx)("div",{className:"p-2",children:(0,d.jsx)(i.r,{message:r})}):q&&0===a.length?(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)(n,{}),(0,d.jsx)(n,{}),(0,d.jsx)(n,{})]}):0===x.length?(0,d.jsxs)("div",{className:"py-10 text-center text-sm text-text-3",children:[y?"No sessions match":t>0?"No active sessions in this range":"No sessions recorded yet",A]}):(0,d.jsxs)(d.Fragment,{children:[x.map(a=>(0,d.jsxs)("div",{className:"mb-1.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 pb-1.5 pt-2",children:[(0,d.jsx)("span",{className:"text-label font-semibold uppercase tracking-wider text-text-3",children:a.day}),(0,d.jsx)("span",{className:"h-px flex-1 bg-hairline"}),(0,d.jsx)("span",{className:"text-label text-text-3",children:a.items.length})]}),(0,d.jsx)("div",{className:"flex flex-col gap-1",children:a.items.map(a=>(0,d.jsx)(m,{session:a,renderedAt:w,selected:a.id===b,onSelect:()=>{c(a.id)}},a.id))})]},a.day)),A,s&&(0,d.jsxs)("div",{className:"px-2 py-3 text-center text-label text-text-3",children:["Showing the most recent ",a.length," sessions — narrow the range to see more."]})]})})]})}},88488:(a,b,c)=>{"use strict";c.d(b,{A:()=>g,r:()=>f});var d=c(15008),e=c(71378);function f({message:a}){return(0,d.jsxs)("div",{role:"alert",className:"text-xs text-text-3",children:["Couldn’t load data — ",a]})}function g({message:a,className:b}){return(0,d.jsx)("div",{className:(0,e.cn)("w-full py-6 text-center text-xs text-text-3",b),children:a})}},89388:(a,b,c)=>{Promise.resolve().then(c.bind(c,59999)),Promise.resolve().then(c.bind(c,17737))},90241:(a,b,c)=>{"use strict";c.d(b,{PolicyPicker:()=>h});var d=c(15008),e=c(71378),f=c(1505),g=c(65366);function h({value:a,onChange:b,unavailable:c}){let h=!b,i=a=>c?.[a],j=[...new Set(g.uR.map(i).filter(a=>void 0!==a))],k=(0,f.useId)(),l=a=>`${k}-unavailable-${String(j.indexOf(a))}`;return(0,d.jsxs)("div",{className:"flex flex-col items-start gap-1.5",children:[(0,d.jsx)("div",{className:"inline-flex gap-1 self-start rounded-lg border border-border bg-surface-2 p-0.5"+(h?" opacity-70":""),"aria-disabled":h||void 0,children:g.uR.map(c=>{let f=(0,g.ES)(c),j=a===c,[k,m]=(0,e.vV)(f.tone),n="neutral"===f.tone?"var(--color-surface)":m,o=f.icon,p=i(c);return(0,d.jsxs)("button",{type:"button",disabled:h,"aria-disabled":h||void 0!==p||void 0,"aria-describedby":void 0===p?void 0:l(p),title:p,onClick:b&&void 0===p?()=>{b(c)}:void 0,"aria-pressed":j,"data-unavailable":void 0===p?void 0:"",className:"inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-semibold "+(h||void 0!==p?"cursor-not-allowed ":"cursor-pointer ")+(void 0===p?"":"opacity-50 ")+(j?"shadow-sm":"text-text-3"),style:j?{color:k,background:n}:void 0,children:[(0,d.jsx)(o,{"aria-hidden":!0,focusable:!1,className:"size-4"}),f.label]},c)})}),j.map(a=>(0,d.jsx)("p",{id:l(a),className:"text-xs text-text-3","data-slot":"policy-unavailable-reason",children:a},a))]})}},90330:(a,b,c)=>{"use strict";c.d(b,{DETECTION_FILTER_TABS:()=>i,DetectionsListView:()=>k});var d=c(15008),e=c(71378),f=c(16820),g=c(4543),h=c(65366);let i=[["all","All"],["library","Library"],["updates","Updates"]];function j({d:a,sel:b,updateVersion:c,floor:e,onClick:f}){return(0,d.jsx)("button",{type:"button",onClick:f,className:"w-full cursor-pointer rounded-lg px-3 py-2.5 text-left transition-colors "+(b?"bg-primary-tint":"hover:bg-surface-2"),children:(0,d.jsxs)("div",{className:"min-w-0 flex-1 flex flex-col gap-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,d.jsx)("span",{title:a.enabled?"Enabled":"Disabled",className:"size-2 shrink-0 rounded-full "+(a.enabled?"bg-ok ring-3 ring-ok-fill":"bg-border-strong")}),(0,d.jsx)("span",{className:"truncate text-sm font-semibold text-text",title:a.name,children:a.name})]}),(0,d.jsxs)("div",{className:"font-mono text-xs text-text-3",children:["v",a.version]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5 justify-between",children:[(0,d.jsx)("span",{className:"font-mono text-xs text-text-3",children:a.id}),(0,d.jsxs)("span",{className:"text-xs text-text-3 shrink-0",children:[a.ruleCount," rule",1===a.ruleCount?"":"s"]})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-1.5 mt-1",children:[(0,d.jsx)(g.Ai,{origin:a.origin}),(0,d.jsx)(g.$F,{policy:a.policyId??h.tG,floor:e}),c?(0,d.jsx)(g.Zp,{version:c}):null]})]})})}function k({items:a,counts:b,activeId:c,query:g,filter:h,onQueryChange:k,onFilterChange:l,onSelect:m,isLoading:n=!1,error:o=null,updatesById:p,floorsById:q,filterTabs:r=i}){return(0,d.jsxs)(e.Zp,{className:"flex flex-col overflow-hidden shadow-sm",children:[(0,d.jsxs)("div",{className:"border-b border-border p-3",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(f.WI,{"aria-hidden":!0,focusable:!1,className:"absolute left-3 top-1/2 size-4 -translate-y-1/2 text-text-3"}),(0,d.jsx)("input",{value:g,onChange:a=>{k(a.target.value)},spellCheck:!1,placeholder:"Search detections…",className:"h-9 w-full rounded-lg border border-border-field bg-surface-2 pl-9 pr-3 text-sm text-text placeholder:text-text-3 focus:border-primary focus:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40"})]}),(0,d.jsx)("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:r.map(([a,c])=>{let e=h===a,g=b[a]??0,i="updates"===a&&g>0;return(0,d.jsxs)("button",{type:"button",onClick:()=>{l(a)},className:"inline-flex h-7 items-center gap-1.5 cursor-pointer rounded-full border px-2.5 text-xs font-semibold "+(e?i?"border-sev-high bg-sev-high-fill text-sev-high-ink":"border-primary bg-primary-tint text-primary":i?"border-border text-sev-high-ink":"border-border bg-surface text-text-2"),children:[i&&(0,d.jsx)(f.Kp,{"aria-hidden":!0,focusable:!1,className:"size-3"}),c,(0,d.jsx)("span",{className:"text-label font-bold opacity-70",children:g})]},a)})})]}),(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto p-3",children:n?(0,d.jsx)("div",{className:"grid flex-1 place-items-center p-6 text-center text-xs text-text-3",children:"Loading detections…"}):o?(0,d.jsx)("div",{className:"grid flex-1 place-items-center p-6 text-center text-xs text-sev-critical-ink",children:o}):0===a.length?(0,d.jsx)("div",{className:"grid flex-1 place-items-center p-6 text-center text-xs text-text-3",children:g.trim()?`No detections match “${g.trim()}”`:"No detections in this view"}):a.map(a=>(0,d.jsx)(j,{d:a,sel:a.id===c,updateVersion:p?.get(a.id),floor:q?.get(a.id),onClick:()=>{m(a.id)}},a.id))})]})}},90821:(a,b,c)=>{"use strict";c.d(b,{t:()=>i});var d=c(15008),e=c(71378),f=c(16820),g=c(4543),h=c(65366);function i({d:a,onOpenUpdate:b,onRecheck:c,unknownHint:i}){let j=(0,h.Xg)(a),k=a.update?.latestVersion??a.latestVersion??"";return(0,d.jsxs)("div",{className:"overflow-hidden rounded-xl border border-border shrink-0",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2.5 bg-surface-2 px-4 py-3 border-b border-border",children:[(0,d.jsx)(g.Ai,{origin:a.origin}),(0,d.jsx)(g.Jk,{publisher:a.publisher??a.namespace,kind:a.publisherKind??"user"}),(0,d.jsx)("span",{className:"flex-1"}),(0,d.jsxs)("span",{className:"font-mono text-label text-text-2",children:["tracking v",a.version]})]}),"update-available"===j?(0,d.jsxs)("div",{className:"flex items-center gap-3 bg-sev-high-fill px-4 py-3",children:[(0,d.jsx)(f.Kp,{"aria-hidden":!0,focusable:!1,className:"size-4.5 shrink-0 text-sev-high-ink"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"text-sm font-semibold text-sev-high-ink",children:["Update available \xb7 v",k]}),(0,d.jsx)("div",{className:"mt-px text-xs leading-snug text-text-2",children:"A newer version is published upstream."})]}),b&&(0,d.jsx)(e.$n,{size:"sm",onClick:b,className:"shrink-0 bg-sev-high-ink text-on-accent hover:bg-sev-high-ink",children:"Update"})]}):"up-to-date"===j?(0,d.jsxs)("div",{className:"flex items-center gap-2.5 px-4 py-2.5 text-xs text-text-3",children:[(0,d.jsx)(f.C1,{"aria-hidden":!0,focusable:!1,className:"size-4 text-ok-ink"}),"Up to date with upstream"]}):(0,d.jsxs)("div",{className:"flex items-center gap-2.5 px-4 py-2.5 text-xs text-text-3",children:[(0,d.jsx)(f.mo,{"aria-hidden":!0,focusable:!1,className:"size-4 shrink-0"}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:["Update status unknown",i?(0,d.jsxs)(d.Fragment,{children:[" — ",i]}):"."]}),c&&(0,d.jsx)(e.$n,{variant:"ghost",tone:"neutral",size:"sm",onClick:c,children:"Check again"})]})]})}},93224:(a,b,c)=>{"use strict";c.d(b,{DetectionDetailView:()=>n});var d=c(15008),e=c(71378),f=c(1505),g=c(76836),h=c(16820),i=c(65366),j=c(87038),k=c(90241),l=c(90821);function m({rule:a,onOpen:b}){let c=i.rE[a.matcher.type],f=c.icon;return(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3.5",children:[(0,d.jsxs)("div",{className:"mb-2.5 flex items-center gap-2.5",children:[(0,d.jsx)("span",{className:"grid size-7.5 shrink-0 place-items-center rounded-lg",style:{background:c.fill,color:c.color},children:(0,d.jsx)(f,{"aria-hidden":!0,focusable:!1,className:"size-4"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"truncate text-sm font-semibold text-text",title:a.name,children:a.name}),(0,d.jsx)("span",{className:"text-xs text-text-3",children:i.gh[a.category]||a.category})]}),(0,d.jsx)("div",{className:"mt-px font-mono text-label text-text-3",children:a.id})]}),(0,d.jsx)(e.Pt,{severity:a.severity}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-2.5 py-0.5 text-xs font-semibold",style:{background:c.fill,color:c.color},children:c.label})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"min-w-0 flex-1 truncate rounded-md border border-border bg-surface-2 px-2.5 py-1.5 font-mono text-xs text-text-2",children:(0,i.vm)(a.matcher)}),(0,d.jsxs)(e.$n,{variant:"ghost",tone:"primary",size:"sm",onClick:b,className:"shrink-0",children:["View",(0,d.jsx)(h.vK,{"aria-hidden":!0,focusable:!1,className:"size-3.5"})]})]})]})}function n({d:a,onOpenRule:b,onToggleEnabled:c,onChangePolicy:n,unavailablePolicies:o,policyFloor:p,policyError:q,enabledError:r,onOpenUpdate:s,onRecheck:t,unknownHint:u}){let v=(0,j.N2)(a.policyId,p),w=(0,i.ES)(v),x=w.icon,y=(0,j.Pt)(p),z=void 0===o&&void 0===y?void 0:{...o,...y},A=void 0!==c&&(0,j.VA)(a.enabled,p),B=(0,f.useId)();return(0,d.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,d.jsxs)("div",{className:"border-b border-border px-5 pb-4 pt-5",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2.5",children:[(0,d.jsx)("h2",{className:"font-display text-xl font-semibold text-text",children:a.name}),(0,d.jsxs)("span",{className:"rounded-full border border-border bg-surface-2 px-2 py-0.5 font-mono text-xs font-semibold text-text-2",children:["v",a.version]})]}),a.description&&(0,d.jsx)("div",{className:"mt-1.5 text-ui leading-snug text-text-2",children:a.description}),(0,d.jsx)("div",{className:"mt-2 font-mono text-xs text-text-3",children:a.id})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-ui font-semibold "+(a.enabled?"text-ok-ink":"text-text-3"),children:a.enabled?"Enabled":"Disabled"}),c&&(0,d.jsx)(e.dO,{checked:a.enabled,...A?{}:{onCheckedChange:c},"aria-disabled":A||void 0,"aria-describedby":A?B:void 0,title:A?j.q2:void 0,className:A?"cursor-not-allowed opacity-50":void 0,"aria-label":a.enabled?"Disable detection":"Enable detection"})]}),(0,d.jsx)(e.$n,{variant:"ghost",tone:"neutral",size:"icon","aria-label":"More",className:"size-8.5 text-text-3",children:(0,d.jsx)(h.wy,{"aria-hidden":!0,focusable:!1})})]})]}),A&&(0,d.jsx)("p",{id:B,className:"mt-2 text-xs text-text-3","data-slot":"enabled-locked-reason",children:j.q2}),r&&(0,d.jsx)("p",{className:"mt-2 text-xs text-sev-critical-ink","data-slot":"enabled-write-error",children:r})]}),(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto p-5",children:[(0,d.jsx)(l.t,{d:a,onOpenUpdate:s,onRecheck:t,unknownHint:u}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"mb-2.5 flex items-baseline gap-2",children:[(0,d.jsx)(g.e,{children:"Enforcement policy"}),(0,d.jsx)("span",{className:"text-xs text-text-3",children:"applied to every matching request"})]}),(0,d.jsx)(k.PolicyPicker,{value:v,onChange:n,unavailable:z}),q&&(0,d.jsx)("p",{className:"mt-2 text-xs text-sev-critical-ink","data-slot":"policy-write-error",children:q}),(0,d.jsxs)("div",{className:"mt-3 flex items-start gap-2.5 rounded-lg border border-border bg-surface-2 px-3 py-2.5",children:[(0,d.jsx)(x,{"aria-hidden":!0,focusable:!1,className:"mt-px size-4 shrink-0",style:{color:(0,e.vV)(w.tone)[0]}}),(0,d.jsx)("div",{className:"text-xs leading-snug text-text-2",children:w.desc})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"mb-3 flex items-center gap-2.5",children:[(0,d.jsx)(g.e,{children:"Rules"}),(0,d.jsx)("span",{className:"rounded-full bg-surface-3 px-2 py-px text-xs font-semibold text-text-2",children:a.rules.length}),(0,d.jsx)("span",{className:"flex-1"}),(0,d.jsxs)(e.$n,{variant:"outline",tone:"neutral",size:"sm",disabled:!0,title:"Rule authoring coming soon",children:[(0,d.jsx)(h.c1,{"aria-hidden":!0,focusable:!1}),"Add rule"]})]}),(0,d.jsx)("div",{className:"flex flex-col gap-2.5",children:a.rules.map(a=>(0,d.jsx)(m,{rule:a,onOpen:()=>{b(a.id)}},a.id))})]})]})]})}},93435:(a,b,c)=>{"use strict";c.d(b,{dtc:()=>H.AddExceptionForm,rX:()=>s.rX,fu:()=>I.ApproveExceptionDialog,i5F:()=>z.AssetDetail,JRA:()=>S.AvailablePluginsCardView,VBV:()=>K.BlockedLedgerView,Tct:()=>q.ColumnsMenu,VNw:()=>r.VN,spO:()=>e.sp,MXo:()=>V.DataShareDetailView,e3r:()=>W.DataSharesKindTabsView,Imc:()=>X.DataSharesTableView,tlv:()=>P.DerefAuditTableView,MFC:()=>t.DetectionDetailView,A7Z:()=>u.DetectionsListView,ppr:()=>A.EmptyState,Gj:()=>L.ExceptionDetailView,Ebj:()=>M.ExceptionsTableView,_GS:()=>s._G,nUY:()=>r.nU,gsr:()=>r.gs,qWw:()=>r.qW,ToP:()=>B.FileDetailDrawer,Wjr:()=>m.FindingDetailView,FGz:()=>n.FindingsFlatTableView,ikE:()=>o.FindingsLocationsView,oHV:()=>p.FindingsTableView,Dmd:()=>q.FindingsToolbarView,y2Z:()=>C.HarnessOverview,mD3:()=>D.m,_c:()=>E.InventoryNav,mLz:()=>s.mL,XAi:()=>s.XA,wO1:()=>w.MatcherModal,b6_:()=>Y.NeedsReviewListView,t6e:()=>Z.NeedsReviewStripView,ece:()=>h,LKE:()=>y.PolicyDetailView,m$d:()=>y.PolicyListView,kLH:()=>F.ProjectPane,sJz:()=>G.RecommendedActionsCardView,nZB:()=>O.RotateKeyDialog,Tvj:()=>J.ScopePicker,YJs:()=>i.Y,WIv:()=>s.WI,LOI:()=>k.SessionDetailView,md2:()=>l.SessionListView,Zus:()=>s.Zu,hny:()=>e.hn,k3y:()=>s.k3,$nP:()=>j.TimeRangeSelect,b1W:()=>x.UpdateModal,bnY:()=>T.UpdateStatusCardView,y6v:()=>Q.VaultInventoryView,gvr:()=>R.VaultReuseView,A30:()=>U.WorkspaceSettingsFormView,uv5:()=>s.uv,eFG:()=>N.eF,XgB:()=>v.Xg,QTF:()=>e.QT,a5B:()=>f.useRenderClock});var d=c(60004);c(5265);var e=c(22567),f=c(74835);c(5475);var g=c(15008);function h({title:a,sub:b,actions:c}){return(0,g.jsxs)("div",{className:"flex items-start justify-between gap-4 pb-6",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("h1",{className:"font-display text-2xl font-semibold text-text",children:a}),b&&(0,g.jsx)("p",{className:"mt-1 text-sm text-text-3",children:b})]}),c&&(0,g.jsx)("div",{className:"flex shrink-0 items-center gap-2",children:c})]})}c(63407);var i=c(55343);c(52233);var j=c(51260);c(88488),c(76836),c(53896),c(70124),c(42353),c(21459),c(21462),c(24061);var k=c(50754),l=c(88461);c(98937);var m=c(71052),n=c(10985),o=c(62606),p=c(94350),q=c(50467),r=c(14129);c(66755),c(13182);var s=c(16820);c(4543);var t=c(93224),u=c(90330),v=c(65366);c(87038),c(90241),c(90821);var w=c(62512),x=c(37231),y=c(76122),z=c(12696),A=c(93946);c(97769);var B=c(19037),C=c(16254),D=c(14728),E=c(95896),F=c(80954);c(71378),d.l.sevCritical,d.l.sevHigh,d.l.sevMedium,d.l.sevLow,s.pD,d.l.sevCritical,s.jZ,d.l.primary,s.rX,d.l.sevHigh,c(51076),d.l.sevCritical,d.l.sevHigh,d.l.sevMedium,c(68788);var G=c(75784),H=c(15009),I=c(59609),J=c(18389),K=c(82731);c(17139);var L=c(6824),M=c(58610),N=c(77292),O=c(23757);c(40229);var P=c(51775),Q=c(16696),R=c(38564),S=c(31527),T=c(42749),U=c(37827);c(47472);var V=c(46867),W=c(37769),X=c(95197);c(52833);var Y=c(99798),Z=c(16980);c(54201),c(49195)},93946:(a,b,c)=>{"use strict";c.d(b,{AC:()=>k,AJ:()=>n,As:()=>o,EmptyState:()=>i,Kh:()=>q,TJ:()=>s,Vx:()=>m,kx:()=>l,wn:()=>j,yk:()=>r});var d=c(15008),e=c(71378),f=c(97769),g=c(14728);function h({order:a,meta:b,value:c,onChange:f}){return(0,d.jsx)("span",{className:"inline-flex",onClick:a=>{a.stopPropagation()},children:(0,d.jsx)(e.Iz,{value:c,onValueChange:a=>{a&&f(a)},children:a.map(a=>{let f=b[a],h=a===c;return(0,d.jsx)(e.tR,{value:a,title:f.label,className:(0,e.cn)("size-7 flex-none gap-0 px-0 py-0","data-[state=on]:bg-transparent data-[state=on]:text-current data-[state=on]:shadow-none",h?(0,e.cn)(f.fg,f.bg):"text-text-3 hover:text-text-2"),children:(0,d.jsx)(g.m,{name:f.icon})},a)})})})}function i({message:a,icon:b="list",className:c}){return(0,d.jsxs)("div",{className:(0,e.cn)("flex items-center gap-2.5 rounded-lg border border-dashed border-border-strong px-3 py-3.5 text-text-3",c),children:[(0,d.jsx)(g.m,{name:b,className:"size-4 shrink-0"}),(0,d.jsx)("span",{className:"text-xs",children:a})]})}function j({label:a,children:b}){return(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"mb-2 text-label font-semibold uppercase tracking-wider text-text-3",children:a}),b]})}function k({order:a,meta:b,value:c,onChange:f,accentOf:h}){return(0,d.jsx)("div",{className:"flex flex-col gap-2",children:a.map(a=>{let i=b[a],j=a===c;return(0,d.jsxs)("button",{type:"button",onClick:()=>{f(a)},className:(0,e.cn)("flex items-center gap-3 rounded-lg border px-3 py-2.5 text-left cursor-pointer",j?(0,e.cn)(i.bg,"border-current",i.fg):"border-border bg-surface"),children:[(0,d.jsx)("span",{className:(0,e.cn)("grid size-8 shrink-0 place-items-center rounded-lg",j?"bg-surface":"bg-surface-2",i.fg),children:(0,d.jsx)(g.m,{name:i.icon,className:"size-4.5"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:(0,e.cn)("text-sm font-semibold",j?i.fg:"text-text"),children:i.label}),(0,d.jsx)("div",{className:"mt-0.5 text-xs text-text-2",children:i.desc})]}),(0,d.jsx)("span",{className:(0,e.cn)("grid size-4.5 shrink-0 place-items-center rounded-full border-[1.5px]",j?(0,e.cn)("border-current text-on-accent",h(i)):"border-border-strong"),children:j&&(0,d.jsx)(g.m,{name:"check",className:"size-3"})})]},a)})})}function l({value:a,onChange:b}){return(0,d.jsx)(h,{order:f.IF,meta:f.Pe,value:a,onChange:b})}function m({value:a}){return(0,d.jsx)("span",{className:(0,e.cn)("min-w-23 whitespace-nowrap text-xs font-semibold",f.Pe[a].fg),children:f.Pe[a].label})}function n({counts:a,className:b}){let c=a.total||1;return(0,d.jsx)("span",{className:(0,e.cn)("flex h-1.5 w-30 overflow-hidden rounded-full bg-surface-3",b),children:f.IF.map(b=>{let e=a[b]/c*100;return e>0?(0,d.jsx)("span",{className:f.Pe[b].bar,style:{width:`${String(e)}%`}},b):null})})}function o({value:a}){let b=f.ZY[a];return(0,d.jsxs)(e.Ex,{variant:b.tone,children:[(0,d.jsx)(g.m,{name:b.icon,className:"size-3"}),b.label]})}function p({flag:a,mini:b}){let c=f.lx[a];return(0,d.jsxs)(e.Ex,{variant:c.tone,children:[(0,d.jsx)(g.m,{name:c.icon,className:b?"size-2.5":"size-3"}),b?c.short:c.label]})}function q({flags:a,mini:b}){return 0===a.length?b?null:(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs font-semibold text-ok-ink",children:[(0,d.jsx)(g.m,{name:"check-circle",className:"size-3.5"})," OK"]}):(0,d.jsx)("span",{className:"inline-flex flex-wrap items-center gap-1.5",children:a.map(a=>(0,d.jsx)(p,{flag:a,mini:b},a))})}function r({v:a}){return"public"===a?(0,d.jsxs)(e.Ex,{variant:"success",children:[(0,d.jsx)(g.m,{name:"globe",className:"size-3"})," Public"]}):(0,d.jsxs)(e.Ex,{variant:"default",children:[(0,d.jsx)(g.m,{name:"lock",className:"size-3"})," Private"]})}function s({origin:a}){let b=f.Gb[a];return(0,d.jsxs)(e.Ex,{variant:"default",children:[(0,d.jsx)(g.m,{name:b.icon,className:"size-3"})," ",b.short]})}},94350:(a,b,c)=>{"use strict";c.d(b,{FindingsTableView:()=>n});var d=c(15008),e=c(71378),f=c(1505),g=c(5265),h=c(16820),i=c(98937),j=c(14129),k=c(66755),l=c(13182);let m={severity:"min-w-[110px] whitespace-nowrap",subtype:"",sources:"min-w-[140px] whitespace-nowrap",user:"min-w-[140px]",locations:"",action:"min-w-[130px] whitespace-nowrap",status:"min-w-[110px] whitespace-nowrap",latest:"min-w-[100px] whitespace-nowrap"};function n({groups:a,columns:b,selection:c,expandedIds:g,onToggleExpand:i,onSelectGroup:k,onSelectInstance:l,hasNextPage:n=!1,hasPreviousPage:o=!1,onNextPage:p,onPreviousPage:s,loadingNextPage:t=!1,pageStart:u,total:v,isLoading:w=!1,error:x=null,emptyState:y,sessionFirings:z,statusFilter:A,renderedAt:B}){return(0,d.jsxs)(e.Zp,{className:"flex flex-col overflow-hidden shadow-sm h-full",children:[(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:x?(0,d.jsxs)("p",{className:"py-8 text-center text-sm text-sev-critical-ink",children:["Error loading findings: ",x]}):w?(0,d.jsx)("p",{className:"py-8 text-center text-sm text-text-3",children:"Loading findings…"}):0===a.length?y??(0,d.jsx)("p",{className:"py-8 text-center text-sm text-text-3",children:"No findings match these filters."}):(0,d.jsxs)(e.XI,{children:[(0,d.jsx)(e.A0,{children:(0,d.jsxs)(e.Hj,{children:[(0,d.jsx)(e.nd,{className:"w-10"}),b.map(a=>(0,d.jsx)(e.nd,{className:m[a.id],...void 0===a.title?{}:{title:a.title},children:a.header},a.id))]})}),(0,d.jsx)(e.BF,{children:a.map(a=>{let n=g.has(a.id),o=c?.finding.id===a.id&&!c.instance,p=(0,j.EQ)(a.instances,A);return(0,d.jsxs)(f.Fragment,{children:[(0,d.jsxs)(e.Hj,{onClick:()=>{k(a)},"aria-label":`View details for ${a.subtype} finding`,className:(0,e.cn)("cursor-pointer hover:bg-surface-2",o&&"bg-surface-2"),children:[(0,d.jsx)(e.nA,{className:"text-text-3",children:(0,d.jsx)(e.$n,{"aria-label":n?"Collapse":"Expand",onClick:b=>{b.stopPropagation(),i(a.id)},size:"icon",variant:"ghost",children:(0,d.jsx)(h.vK,{className:(0,e.cn)("size-4 transition-transform",n&&"rotate-90")})})}),b.map(b=>(0,d.jsx)(e.nA,{className:m[b.id],children:q[b.id](a,B)},b.id))]}),n&&p.map(f=>(0,d.jsxs)(e.Hj,{onClick:()=>{l(a,f)},"aria-label":`View details for ${a.subtype} finding in ${f.repo}`,className:(0,e.cn)("cursor-pointer hover:bg-surface-2",c?.instance?.id===f.id?"bg-surface-2":"bg-surface-2/50"),children:[(0,d.jsx)(e.nA,{}),b.map(b=>(0,d.jsx)(e.nA,{className:m[b.id],children:r[b.id](a,f,B)},b.id))]},f.id)),n&&z&&(0,d.jsxs)(e.Hj,{className:"bg-surface-2/50 hover:bg-surface-2/50",children:[(0,d.jsx)(e.nA,{}),(0,d.jsx)(e.nA,{colSpan:b.length,className:"text-xs text-text-3",children:(z[a.id]??0)>0?`Fired ${String(z[a.id])} times in this session's transcript — the session's "triggered" tally counts every firing, this row counts unique values.`:`Caught by live enforcement only — not re-detected in this session's transcript.`})]}),n&&0===p.length&&(0,d.jsxs)(e.Hj,{className:"bg-surface-2/50 hover:bg-surface-2/50",children:[(0,d.jsx)(e.nA,{}),(0,d.jsxs)(e.nA,{colSpan:b.length,className:"text-xs text-text-3",children:["No locations with the selected status among the most recently detected — the status column reflects all ",a.instanceCount," locations."]})]}),n&&p.length>0&&p.length<a.instanceCount&&(0,d.jsxs)(e.Hj,{className:"bg-surface-2/50 hover:bg-surface-2/50",children:[(0,d.jsx)(e.nA,{}),(0,d.jsxs)(e.nA,{colSpan:b.length,className:"text-xs text-text-3",children:["Showing the ",p.length," most recent of"," ",a.instanceCount," locations."]})]})]},a.id)})})]})}),p?a.length>0&&(0,d.jsxs)(e.dK,{children:[(0,d.jsx)(e.Eb,{disabled:!o||t,onClick:s}),(0,d.jsx)(e.D2,{children:void 0===v||void 0===u?`${String(a.length)} shown`:`${String(u)}–${String(u+a.length-1)} of ${String(v)} types`}),(0,d.jsx)(e.WA,{disabled:!n||t,loading:t,onClick:p})]}):n&&(0,d.jsxs)("p",{className:"mt-4 text-center text-xs text-text-3",children:["Showing the first ",a.length," types — refine the filters to narrow results."]})]})}function o({finding:a}){let b=j.y7[a.category]??h.RY;return(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)("span",{className:(0,e.cn)("flex size-7 shrink-0 items-center justify-center rounded-lg",(0,j.i9)(a.category)),children:(0,d.jsx)(b,{className:"size-4"})}),(0,d.jsxs)("div",{className:"flex flex-col",children:[(0,d.jsx)("span",{className:"font-semibold text-text wrap-anywhere",children:a.subtype}),(0,d.jsx)("span",{className:"font-mono text-xs text-text-3 wrap-anywhere",title:a.match.maskedValue,children:a.match.maskedValue})]})]})}function p({status:a}){if(!a)return(0,d.jsx)("span",{className:"text-text-3",children:"—"});let b=(0,j.Dx)(a);return(0,d.jsx)(e.Ex,{variant:b.badge,className:"h-6",children:b.label})}let q={severity:a=>(0,d.jsx)(e.Pt,{severity:a.severity}),subtype:a=>(0,d.jsx)(o,{finding:a}),sources:a=>(0,d.jsx)(k.B,{ids:a.providers}),user:a=>(0,d.jsx)(l.l,{users:a.users}),locations:a=>(0,d.jsxs)("span",{className:"text-text-3",children:[a.instanceCount," locations"]}),action:a=>(0,d.jsx)(i._,{aggregateAction:a.aggregateAction}),status:a=>(0,d.jsx)(p,{status:a.status}),latest:(a,b)=>(0,d.jsx)("span",{className:"text-text-3 text-xs",children:(0,g.K)(a.latestDetectedAt,b)})},r={severity:a=>(0,d.jsx)(e.Pt,{severity:a.severity}),subtype:(a,b)=>(0,d.jsxs)("div",{className:"flex items-center gap-2.5 pl-1",children:[(0,d.jsx)("span",{className:"-mt-1.5 size-3.5 shrink-0 rounded-bl border-b-[1.5px] border-l-[1.5px] border-border-strong"}),(0,d.jsxs)("div",{className:"flex flex-col gap-px",children:[(0,d.jsx)("span",{className:"font-semibold text-text text-ui wrap-anywhere",children:b.repo}),(0,d.jsx)("span",{className:"font-mono text-label text-text-3 wrap-anywhere",children:b.id})]})]}),sources:(a,b)=>(0,d.jsx)(k.i,{provider:b.provider}),user:(a,b)=>(0,d.jsx)(l.c,{user:b.user}),locations:(a,b)=>(0,d.jsx)("span",{className:"font-mono text-xs text-text-3 wrap-anywhere",children:(0,j.xE)(b)}),action:(a,b)=>(0,d.jsx)(i.T,{action:b.action}),status:(a,b)=>(0,d.jsx)(p,{status:b.status}),latest:(a,b,c)=>(0,d.jsx)("span",{className:"text-text-3 text-xs",children:(0,g.K)(b.detectedAt,c)})}},95043:(a,b,c)=>{"use strict";c.d(b,{Zp:()=>k,X9:()=>q,Wu:()=>r,BT:()=>p,aR:()=>l,Lc:()=>n,AG:()=>m,ZB:()=>o,kI:()=>u,EA:()=>x,cH:()=>i,id:()=>j,cn:()=>h});var d=c(13726),e=c(13403),f=c(73557);let g=(0,c(9213).zu)({extend:{classGroups:{"font-size":[{text:["ui","label"]}]}}});function h(...a){return g((0,f.$)(a))}let i={neutral:{fill:"bg-surface-3",text:"text-text-2"},critical:{fill:"bg-sev-critical-fill",text:"text-sev-critical-ink"},high:{fill:"bg-sev-high-fill",text:"text-sev-high-ink"},medium:{fill:"bg-sev-medium-fill",text:"text-sev-medium-ink"},low:{fill:"bg-sev-low-fill",text:"text-sev-low-ink"},ok:{fill:"bg-ok-fill",text:"text-ok-ink"},teal:{fill:"bg-teal-fill",text:"text-teal-ink"},violet:{fill:"bg-violet-fill",text:"text-violet-ink"},primary:{fill:"bg-primary-tint",text:"text-primary"}},j=Object.fromEntries(Object.entries(i).map(([a,{fill:b,text:c}])=>[a,`${b} ${c}`]));function k({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card",className:h("rounded-xl border border-border bg-surface",a),...b})}function l({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-header",className:h("flex items-center gap-3 px-5 pt-5",a),...b})}function m({className:a,tone:b="neutral",...c}){return(0,d.jsx)("span",{"data-slot":"card-icon",className:h("flex size-7.5 shrink-0 items-center justify-center rounded-lg",(Object.hasOwn(j,b)?j[b]:void 0)??j.neutral,a),...c})}function n({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-heading",className:h("min-w-0",a),...b})}function o({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-title",className:h("text-sm font-semibold text-text",a),...b})}function p({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-description",className:h("text-xs text-text-3",a),...b})}function q({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-action",className:h("ml-auto flex items-center",a),...b})}function r({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-content",className:h("p-5",a),...b})}(0,e.F)("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5 text-xs font-semibold",{variants:{variant:{default:j.neutral,outline:"border border-border text-text-2",critical:j.critical,high:j.high,medium:j.medium,low:j.low,success:j.ok,teal:j.teal,primary:j.primary}},defaultVariants:{variant:"default"}}),(0,e.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg font-medium transition-colors cursor-pointer disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{solid:"",outline:"border",ghost:"",link:""},tone:{primary:"",neutral:"",danger:""},size:{sm:"h-8 px-3 text-xs",md:"h-9 px-4 text-sm",icon:"size-9"}},compoundVariants:[{variant:"solid",tone:"primary",class:"bg-primary-solid text-text-inv hover:bg-primary-hover"},{variant:"solid",tone:"neutral",class:"bg-surface-3 text-text hover:bg-border-strong"},{variant:"solid",tone:"danger",class:"bg-sev-critical-ink text-on-accent hover:bg-sev-critical-hover"},{variant:"outline",tone:"primary",class:"border-primary text-primary hover:bg-primary-tint"},{variant:"outline",tone:"neutral",class:"border-border bg-surface text-text hover:bg-surface-2"},{variant:"outline",tone:"danger",class:"border-sev-critical text-sev-critical-ink hover:bg-sev-critical-fill"},{variant:"ghost",tone:"primary",class:"text-primary hover:bg-primary-tint"},{variant:"ghost",tone:"neutral",class:"text-text-2 hover:bg-surface-2 hover:text-text"},{variant:"ghost",tone:"danger",class:"text-sev-critical-ink hover:bg-sev-critical-fill"},{variant:"link",class:"h-auto gap-1 rounded-sm p-0 align-baseline font-semibold underline-offset-4 [&_svg]:size-3.5"},{variant:"link",tone:"primary",class:"text-primary hover:underline"},{variant:"link",tone:"neutral",class:"text-text-2 hover:text-text hover:underline"},{variant:"link",tone:"danger",class:"text-sev-critical-ink hover:underline"}],defaultVariants:{variant:"solid",tone:"neutral",size:"md"}});var s=c(32071);s.Root,s.Trigger,s.Close;var t=c(39904);function u({value:a,max:b,color:c,height:e=8,className:f,style:g,...i}){let j=Math.min(b,Math.max(0,a)),k=b>0?j/b*100:0;return(0,d.jsx)("span",{"data-slot":"meter",role:"meter","aria-valuenow":j,"aria-valuemin":0,"aria-valuemax":b,className:h("block flex-1 overflow-hidden rounded-full bg-surface-3",f),style:{height:e,...g},...i,children:(0,d.jsx)("span",{className:"block h-full rounded-full",style:{width:`${String(k)}%`,background:c}})})}t.Root,t.Trigger,t.Group,t.RadioGroup;var v=c(3867);v.Root,v.Trigger,v.Close,v.Anchor;var w=c(12278);function x({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"skeleton","aria-hidden":!0,className:h("animate-pulse rounded-md bg-surface-3",a),...b})}w.Root,w.Group,w.Value,s.Root,s.Trigger,s.Close,c(46450).Root},95197:(a,b,c)=>{"use strict";c.d(b,{DataSharesTableView:()=>o});var d=c(15008),e=c(71378),f=c(1505),g=c(5265),h=c(16820),i=c(47472),j=c(14998),k=c(52833);function l({classes:a}){return(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.slice(0,3).map(a=>(0,d.jsx)(i.HD,{cls:a},a)),a.length>3&&(0,d.jsxs)("span",{className:"text-xs text-text-3",children:["+",a.length-3]})]})}function m({d:a,renderedAt:b,expanded:c,selected:f,onToggle:j,onOpen:m}){let n=(0,k.EI)(a.transports);return(0,d.jsxs)(e.Hj,{onClick:m,"aria-label":`View details for destination ${a.name}`,className:(0,e.cn)("cursor-pointer",f?"bg-primary-tint":"hover:bg-surface-2"),children:[(0,d.jsx)(e.nA,{className:"w-9",children:(0,d.jsx)(e.$n,{"aria-label":c?"Collapse":"Expand",onClick:a=>{a.stopPropagation(),j()},variant:"ghost",size:"sm",children:(0,d.jsx)(h.vK,{"aria-hidden":!0,focusable:!1,className:(0,e.cn)("size-4 transition-transform",c&&"rotate-90")})})}),(0,d.jsx)(e.nA,{children:(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(i.Wi,{kind:a.kind,trust:a.trust,name:a.name,host:a.host}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:(0,e.cn)("whitespace-nowrap font-semibold text-text","ip"===a.kind&&"font-mono"),children:a.name}),n&&(0,d.jsx)("span",{title:"Sends over plaintext",className:"inline-flex text-sev-critical-ink",children:(0,d.jsx)(h._0,{"aria-hidden":!0,focusable:!1,className:"size-3.5"})})]}),(0,d.jsxs)("div",{className:"whitespace-nowrap text-xs text-text-3",children:[a.category,a.network?.geo?" \xb7 "+a.network.geo:""]})]})]})}),(0,d.jsx)(e.nA,{children:(0,d.jsx)(i.xB,{trust:a.trust})}),(0,d.jsx)(e.nA,{children:(0,d.jsx)(i.hC,{status:a.status,isCustom:a.isCustom})}),(0,d.jsx)(e.nA,{children:(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.transports.map(a=>(0,d.jsx)(i.eV,{transport:a},a))})}),(0,d.jsx)(e.nA,{children:(0,d.jsx)(l,{classes:a.dataClasses})}),(0,d.jsxs)(e.nA,{className:"whitespace-nowrap text-xs text-text-3",children:[(0,d.jsx)("b",{className:"text-text",children:a.endpointCount})," endpoint",1===a.endpointCount?"":"s"," \xb7 ",(0,d.jsx)("b",{className:"text-text",children:a.callSiteCount})," call",1===a.callSiteCount?"":"s"]}),(0,d.jsx)(e.nA,{className:"whitespace-nowrap text-xs text-text-3",children:(0,g.K)(a.lastSeen,b)})]})}function n({ep:a,renderedAt:b,selected:c,onClick:f}){return(0,d.jsxs)(e.Hj,{onClick:f,"aria-label":`View details for endpoint ${a.method} ${a.url}`,className:(0,e.cn)("cursor-pointer",c?"bg-primary-tint":"bg-surface-2 hover:bg-surface-3"),children:[(0,d.jsx)(e.nA,{className:"w-9"}),(0,d.jsx)(e.nA,{colSpan:3,children:(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2.5 pl-1.5 py-1",children:[(0,d.jsx)("span",{className:"h-3.5 w-3.5 shrink-0 rounded-bl border-b-[1.5px] border-l-[1.5px] border-border-strong"}),(0,d.jsx)(i.kX,{method:a.method}),(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,d.jsx)(i.UH,{url:a.url}),a.template&&(0,d.jsx)(i.SU,{})]})]})}),(0,d.jsx)(e.nA,{children:(0,d.jsx)(i.eV,{transport:a.transport})}),(0,d.jsx)(e.nA,{children:(0,d.jsx)(i.HD,{cls:a.dataClass})}),(0,d.jsxs)(e.nA,{className:"whitespace-nowrap text-xs text-text-3",children:[(0,d.jsx)("b",{className:"text-text",children:a.callSiteCount})," call",1===a.callSiteCount?"":"s"]}),(0,d.jsx)(e.nA,{className:"whitespace-nowrap text-xs text-text-3",children:(0,g.K)(a.lastSeen,b)})]})}function o({group:a,expanded:b,forceExpand:c,selection:g,drawerOpen:h,onToggle:i,onOpenDest:k,onOpenEndpoint:l,renderedAt:o}){return(0,d.jsxs)(e.XI,{children:[(0,d.jsx)(e.A0,{children:(0,d.jsxs)(e.Hj,{children:[(0,d.jsx)(e.nd,{className:"w-9"}),(0,d.jsx)(e.nd,{children:"Destination"}),(0,d.jsx)(e.nd,{children:"Trust"}),(0,d.jsx)(e.nd,{children:"Status"}),(0,d.jsx)(e.nd,{children:"Transport"}),(0,d.jsx)(e.nd,{children:"Data sent"}),(0,d.jsx)(e.nd,{children:"Footprint"}),(0,d.jsx)(e.nd,{children:"Last seen"})]})}),(0,d.jsx)(e.BF,{children:a.items.map(a=>{let e=(c??!1)||!!b[a.id],p=h&&g?.id===a.id&&null==g.endpointId;return(0,d.jsxs)(f.Fragment,{children:[(0,d.jsx)(m,{d:a,renderedAt:o,expanded:e,selected:p,onToggle:(0,j.T)(i,a.id),onOpen:(0,j.T)(k,a.id)}),e&&a.endpoints.map(b=>(0,d.jsx)(n,{ep:b,renderedAt:o,selected:h&&g?.id===a.id&&g.endpointId===b.id,onClick:(0,j.i)(l,a.id,b.id)},b.id))]},a.id)})})]})}},95896:(a,b,c)=>{"use strict";c.d(b,{InventoryNav:()=>l});var d=c(15008),e=c(71378),f=c(1505),g=c(63407),h=c(93946),i=c(97769),j=c(14728);let k=[{type:"all",label:"All"},...i.fd.map(a=>({type:a.type,label:"Configuration"===a.label?"Config":a.label.replace(" servers","")}))];function l(a){let{projects:b,assetGroups:c,harnesses:g,viewMode:h,onViewMode:i,typeFilter:l,onTypeFilter:n,query:p,onQuery:q,attention:r,isLoading:s}=a,t=(0,f.useMemo)(()=>{let a={skill:[],mcp:[],hook:[],config:[]};for(let b of c)"project"!==b.type&&(a[b.type]=b.items);return a},[c]),u=(0,f.useMemo)(()=>{let a=p.toLowerCase(),c=b=>!a||b.toLowerCase().includes(a);return b.filter(a=>c(a.name)||c(a.repo))},[b,p]);return(0,d.jsxs)(e.Zp,{className:"flex w-85 shrink-0 flex-col overflow-hidden shadow-sm",children:[(0,d.jsxs)("div",{className:"border-b border-border px-4 pb-3 pt-4",children:[(0,d.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,d.jsx)("span",{className:"font-display text-base font-semibold",children:"All assets"}),void 0===r?(0,d.jsx)("span",{className:"ml-auto text-xs text-text-3",children:"…"}):(0,d.jsxs)("span",{className:(0,e.cn)("ml-auto inline-flex items-center gap-1.5 text-xs font-semibold",r?"text-sev-high-ink":"text-ok-ink"),children:[(0,d.jsx)(j.m,{name:r?"flag":"check-circle",className:"size-3.5"}),r?`${String(r)} to review`:"All clear"]})]}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(j.m,{name:"search",className:"absolute left-3 top-1/2 size-4 -translate-y-1/2 text-text-3"}),(0,d.jsx)("input",{value:p,onChange:a=>{q(a.target.value)},placeholder:"Search assets…",className:"h-8.5 w-full rounded-lg border border-border-field bg-surface-2 pl-9 pr-3 text-sm text-text placeholder:text-text-3 focus:border-primary focus:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40"})]}),(0,d.jsxs)(e.Iz,{className:"mt-3 flex w-full",value:h,onValueChange:a=>{a&&i(a)},children:[(0,d.jsxs)(e.tR,{value:"tree",children:[(0,d.jsx)(j.m,{name:"layers"})," By harness"]}),(0,d.jsxs)(e.tR,{value:"type",children:[(0,d.jsx)(j.m,{name:"list"})," By type"]})]}),"type"===h&&(0,d.jsx)(e.Iz,{className:"mt-2.5 flex w-full flex-wrap border-0 bg-transparent p-0 gap-1.5",value:l,onValueChange:a=>{a&&n(a)},children:k.map(a=>(0,d.jsx)(e.tR,{value:a.type,className:(0,e.cn)("flex-none rounded-full border border-border bg-surface px-2.5 py-1 text-text-2","data-[state=on]:border-transparent data-[state=on]:bg-text data-[state=on]:text-surface data-[state=on]:shadow-none"),children:a.label},a.type))})]}),(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 pb-2.5 pt-1",children:s&&0===g.length&&0===b.length&&0===c.length?(0,d.jsx)("div",{className:"px-3 py-6 text-center text-xs text-text-3",children:"Loading inventory…"}):"tree"===h?(0,d.jsx)(m,{...a}):(0,d.jsx)(o,{...a,projList:u,assetsByType:t})})]})}function m(a){let{harnesses:b,query:c}=a,e=c.toLowerCase(),f=a=>!e||a.toLowerCase().includes(e),g=e?b.map(a=>({...a,projects:a.projects.filter(a=>f(a.name)||f(a.repo)),categories:a.categories.map(a=>({...a,assets:a.assets.filter(a=>f(a.name)||f(a.sub))})).filter(a=>a.assets.length>0)})).filter(a=>a.projects.length>0||a.categories.length>0||f(a.label)||f(a.kind)):b;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(s,{iconName:"terminal",label:"Harnesses",count:g.length}),(0,d.jsx)("div",{className:"flex flex-col gap-0.5",children:g.length>0?g.map(b=>(0,d.jsx)(n,{h:b,...a},b.id)):(0,d.jsx)(h.EmptyState,{message:c?"No matches":"No harnesses detected"})})]})}function n(a){let{h:b,sel:c,expanded:f,onToggleExpand:h,onSelectHarness:k,onSelectAsset:l,query:m}=a,n=b.projects,o=b.categories,r=f[b.id]??(!!m&&(n.length>0||o.length>0)),s=c?.type==="harness"&&c.id===b.id,t=(o.find(a=>"mcp"===a.type)?.assets??[]).filter(a=>"unapproved"===a.trust).length;return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:(0,e.cn)("flex items-center rounded-lg",s?"bg-primary-tint":"hover:bg-surface-2"),children:[(0,d.jsx)("button",{type:"button","aria-label":r?"Collapse":"Expand","aria-expanded":r,onClick:()=>{h(b.id,!r)},className:"my-2.5 ml-2.5 grid size-4.5 shrink-0 cursor-pointer place-items-center rounded text-text-3",children:(0,d.jsx)(j.m,{name:"chevron-right",className:(0,e.cn)("size-3.5 transition-transform",r&&"rotate-90")})}),(0,d.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-2.5 p-2.5 text-left cursor-pointer",onClick:()=>{k(b.id),r||h(b.id,!0)},children:[(0,d.jsx)(g.K,{id:b.id,size:28}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"truncate text-sm font-semibold text-text",title:b.label,children:b.label}),(0,d.jsxs)("div",{className:"mt-px text-xs text-text-3",children:[b.kind," \xb7 ",b.assetCount," assets"]})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[t>0&&(0,d.jsx)("span",{className:"size-2 rounded-full bg-sev-critical"}),0===b.flagCount?(0,d.jsx)(j.m,{name:"check-circle",className:"size-3.5 text-ok-ink"}):(0,d.jsx)("span",{className:"rounded-full bg-sev-high-ink px-1.5 py-px text-xs font-bold text-on-accent",children:b.flagCount})]})]})]}),r&&(0,d.jsxs)("div",{className:"my-0.5 ml-4 border-l border-border pl-2.5",children:[n.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 px-2 pb-1 pt-2",children:[(0,d.jsx)(j.m,{name:i.WD.icon,className:"size-3 text-text-3"}),(0,d.jsx)("span",{className:"text-label font-bold uppercase tracking-wider text-text-3",children:i.WD.label}),(0,d.jsx)("span",{className:"text-label font-semibold text-text-3",children:n.length})]}),n.map(c=>(0,d.jsx)(p,{p:c,fromHarness:b.id,...a},c.id))]}),o.map(a=>{let e=i.pA[a.type];return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 px-2 pb-1 pt-2",children:[(0,d.jsx)(j.m,{name:e.icon,className:"size-3 text-text-3"}),(0,d.jsx)("span",{className:"text-label font-bold uppercase tracking-wider text-text-3",children:e.label}),(0,d.jsx)("span",{className:"text-label font-semibold text-text-3",children:a.assets.length})]}),a.assets.map(a=>(0,d.jsx)(q,{it:a,indent:!0,fromHarness:b.id,sel:c,onSelectAsset:l},a.id))]},a.type)})]})]})}function o(a){let{typeFilter:b,query:c,projList:e,assetsByType:f}=a,g=c.toLowerCase(),j=a=>!g||a.toLowerCase().includes(g),k=0,l=i.fd.map(c=>{let g;if(g=c.type,"all"!==b&&b!==g)return null;if("project"===c.type){let f=e.length;return 0===f&&"all"===b?null:(f>0&&k++,(0,d.jsxs)("div",{children:[(0,d.jsx)(r,{group:c,items:e.map(a=>({flags:a.findingsCount>0?["findings"]:[]}))}),(0,d.jsx)("div",{className:"flex flex-col gap-0.5",children:0===f?(0,d.jsx)(h.EmptyState,{message:`No ${c.label.toLowerCase()}`}):e.map(b=>(0,d.jsx)(p,{p:b,...a},b.id))})]},c.type))}let i=f[c.type].filter(a=>j(a.name)||j(a.sub));return 0===i.length&&"all"===b?null:(i.length>0&&k++,(0,d.jsxs)("div",{children:[(0,d.jsx)(r,{group:c,items:i,mcpItems:"mcp"===c.type?i:void 0}),(0,d.jsx)("div",{className:"flex flex-col gap-0.5",children:0===i.length?(0,d.jsx)(h.EmptyState,{message:`No ${c.label.toLowerCase()}`}):i.map(b=>(0,d.jsx)(q,{it:b,sel:a.sel,onSelectAsset:a.onSelectAsset},b.id))})]},c.type))});return"all"===b&&0===k?(0,d.jsx)(h.EmptyState,{icon:"search",message:c?`No assets match “${c}”`:"No assets"}):(0,d.jsx)(d.Fragment,{children:l})}function p({p:a,fromHarness:b,selFromHarness:c,sel:f,onSelectProject:g}){let k=a.accessCounts,l=a.findingsCount,m=f?.type==="project"&&f.id===a.id&&(null==b||null==c||b===c);return(0,d.jsxs)("button",{type:"button",onClick:()=>{g(a.id,b)},className:(0,e.cn)("flex w-full flex-col rounded-lg p-2.5 text-left cursor-pointer",m?"bg-primary-tint":"hover:bg-surface-2"),children:[(0,d.jsxs)("div",{className:"mb-1.5 flex items-center gap-2.5",children:[(0,d.jsx)("span",{className:"size-2 shrink-0 rounded-full",style:{background:(0,i.Cs)(a.language)}}),(0,d.jsx)("span",{className:"truncate text-sm font-semibold text-text",title:a.name,children:a.name}),(0,d.jsx)("span",{className:"ml-auto shrink-0",children:(0,d.jsx)(h.yk,{v:a.visibility})})]}),(0,d.jsxs)("div",{className:"mb-2 flex items-center gap-1.5 font-mono text-xs text-text-3",children:[(0,d.jsx)(j.m,{name:"repo",className:"size-3 shrink-0"}),(0,d.jsx)("span",{className:"truncate",title:a.repo,children:a.repo})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)(h.AJ,{counts:k}),k.blocked>0?(0,d.jsxs)("span",{className:"text-xs font-semibold text-sev-critical-ink",children:[k.blocked," blocked"]}):(0,d.jsxs)("span",{className:"text-xs text-text-3",children:[k.total," files"]}),l>0&&(0,d.jsx)("span",{className:"ml-auto shrink-0",children:(0,d.jsx)(h.Kh,{flags:["findings"],mini:!0})})]})]})}function q({it:a,indent:b,fromHarness:c,sel:f,onSelectAsset:g}){let k=f?.type===a.type&&f.id===a.id,l=(0,i.TW)(a.type),m="mcp"===a.type?a.trust:void 0;return(0,d.jsxs)("button",{type:"button",onClick:()=>{g(a,c)},className:(0,e.cn)("flex w-full items-center gap-2.5 rounded-lg py-3 text-left cursor-pointer",b?"px-3":"px-2.5",k?"bg-primary-tint":"hover:bg-surface-2"),children:[(0,d.jsx)("span",{className:(0,e.cn)("grid size-7.5 shrink-0 place-items-center rounded-md",l.bg,l.fg),children:(0,d.jsx)(j.m,{name:l.icon,className:"size-3.5"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"truncate font-mono text-xs font-semibold text-text",title:a.name,children:a.name}),(0,d.jsx)("div",{className:"mt-0.5 truncate font-mono text-label text-text-3",title:a.sub,children:a.sub})]}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[m&&(0,d.jsx)(h.As,{value:m}),a.flags.length>0&&(0,d.jsx)(h.Kh,{flags:a.flags,mini:!0})]})]})}function r({group:a,items:b,mcpItems:c}){let f=(0,i.z)(b),g=c?["unapproved","risky"].map(a=>({k:a,n:c.filter(b=>b.trust===a).length})).filter(a=>a.n):[];return(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2.5 pb-1.5 pt-3",children:[(0,d.jsx)("span",{className:(0,e.cn)("grid size-5 shrink-0 place-items-center rounded",a.bg,a.fg),children:(0,d.jsx)(j.m,{name:a.icon,className:"size-3"})}),(0,d.jsx)("span",{className:"text-xs font-bold uppercase tracking-wider text-text-2",children:a.label}),(0,d.jsx)("span",{className:"text-xs font-semibold text-text-3",children:b.length}),(0,d.jsxs)("span",{className:"ml-auto inline-flex flex-wrap items-center justify-end gap-1.5",children:[g.map(a=>(0,d.jsxs)(e.Ex,{variant:i.ZY[a.k].tone,children:[a.n," ",i.ZY[a.k].label.toLowerCase()]},a.k)),f.map(a=>(0,d.jsxs)(e.Ex,{variant:i.lx[a.key].tone,children:[a.count," ",i.lx[a.key].short.toLowerCase()]},a.key))]})]})}function s({iconName:a,label:b,count:c}){return(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2.5 pb-1.5 pt-3",children:[(0,d.jsx)("span",{className:"grid size-5 shrink-0 place-items-center rounded bg-surface-2 text-text-2",children:(0,d.jsx)(j.m,{name:a,className:"size-3"})}),(0,d.jsx)("span",{className:"text-xs font-bold uppercase tracking-wider text-text-2",children:b}),(0,d.jsx)("span",{className:"text-xs font-semibold text-text-3",children:c})]})}},96940:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>g});var d=c(13726),e=c(46205),f=c(58435);function g({children:a}){return(0,d.jsx)(f.NavigationTransitionProvider,{children:(0,d.jsx)(e.AppShell,{children:a})})}},97769:(a,b,c)=>{"use strict";c.d(b,{Cs:()=>r,Gb:()=>j,IF:()=>e,Pe:()=>d,TW:()=>n,WD:()=>k,ZY:()=>f,_t:()=>t,fd:()=>m,iL:()=>p,lx:()=>h,pA:()=>l,v7:()=>o,yx:()=>g,z:()=>s});let d={open:{label:"Any LLM",icon:"cloud",fg:"text-ok-ink",bg:"bg-ok-fill",bar:"bg-ok",accent:"bg-ok-ink",desc:"Allowed to any model — including public, consumer LLMs."},approved:{label:"Approved only",icon:"shield-check",fg:"text-primary",bg:"bg-primary-tint",bar:"bg-primary",accent:"bg-primary",desc:"Allowed only to approved, governed models."},blocked:{label:"No LLM",icon:"slash-circle",fg:"text-sev-critical-ink",bg:"bg-sev-critical-fill",bar:"bg-sev-critical",accent:"bg-sev-critical-ink",desc:"Never sent to any model. Blocked at the proxy."}},e=["open","approved","blocked"],f={"known-good":{label:"Known good",icon:"shield-check",tone:"success",fg:"text-ok-ink",bg:"bg-ok-fill",iconBg:"bg-ok-ink",desc:"Reviewed & allow-listed. Agents may call it freely."},risky:{label:"Risky",icon:"alert",tone:"high",fg:"text-sev-high-ink",bg:"bg-sev-high-fill",iconBg:"bg-sev-high-ink",desc:"Allowed, but reaches sensitive systems or external hosts. Use with care."},unapproved:{label:"Unapproved",icon:"x-circle",tone:"critical",fg:"text-sev-critical-ink",bg:"bg-sev-critical-fill",iconBg:"bg-sev-critical-ink",desc:"Not reviewed or explicitly denied — calls are blocked at the proxy."}},g=["known-good","risky","unapproved"],h={update:{label:"Update available",short:"Update",icon:"arrow-up",tone:"high"},stale:{label:"Stale",short:"Stale",icon:"clock",tone:"default"},conflict:{label:"Conflict",short:"Conflict",icon:"branch",tone:"critical"},unknown:{label:"Unverified",short:"Unverified",icon:"help",tone:"critical"},change:{label:"Changed",short:"Changed",icon:"edit",tone:"low"},untracked:{label:"Untracked",short:"Untracked",icon:"eye-off",tone:"high"},risk:{label:"Security risk",short:"Risk",icon:"alert",tone:"critical"},findings:{label:"Sensitive data",short:"Findings",icon:"alert",tone:"critical"}},i=["risk","conflict","unknown","change","untracked","update","stale"],j={source:{short:"Source",label:"First-party source code",icon:"code"},"public-dep":{short:"Public dep",label:"Public dependency \xb7 open source",icon:"cloud"},vendored:{short:"Vendored",label:"Vendored third-party",icon:"layers"},config:{short:"Config",label:"Configuration",icon:"settings"},data:{short:"Data",label:"Data \xb7 fixtures",icon:"database"},docs:{short:"Docs",label:"Documentation",icon:"book"},generated:{short:"Generated",label:"Generated artifact",icon:"bolt"}},k={type:"project",label:"Projects",icon:"repo",fg:"text-primary",bg:"bg-primary-tint"},l={skill:{type:"skill",label:"Skills",icon:"sparkles",fg:"text-violet-ink",bg:"bg-violet-fill"},mcp:{type:"mcp",label:"MCP servers",icon:"server",fg:"text-teal-ink",bg:"bg-teal-fill"},hook:{type:"hook",label:"Hooks",icon:"route",fg:"text-sev-low-ink",bg:"bg-sev-low-fill"},config:{type:"config",label:"Configuration",icon:"sliders",fg:"text-teal-ink",bg:"bg-surface-2"}},m=[k,l.skill,l.mcp,l.hook,l.config],n=a=>{let{icon:b,fg:c,bg:d}="project"===a?k:l[a];return{icon:b,fg:c,bg:d}};function o(a){return new Date(a).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}let p={block:{label:"Blocked",icon:"slash-circle",tone:"critical",fg:"text-sev-critical-ink",bg:"bg-sev-critical-fill"},redact:{label:"Redacted",icon:"redact",tone:"teal",fg:"text-teal-ink",bg:"bg-teal-fill"},warn:{label:"Warned",icon:"alert",tone:"high",fg:"text-sev-high-ink",bg:"bg-sev-high-fill"}},q={typescript:"#3178C6",javascript:"#F1E05A",rust:"#DEA584",python:"#3572A5",go:"#00ADD8",ruby:"#701516",java:"#B07219",hcl:"#844FBA",jupyter:"#DA5B0B","jupyter notebook":"#DA5B0B",mdx:"#1B1F24",markdown:"#083FA1",shell:"#89E051",c:"#555555","c++":"#F34B7D","c#":"#178600",php:"#4F5D95",swift:"#F05138",kotlin:"#A97BFF"};function r(a){return q[a.toLowerCase()]??"var(--color-border-strong)"}function s(a){let b={};return a.forEach(a=>{a.flags.forEach(a=>{b[a]=(b[a]??0)+1})}),i.filter(a=>b[a]).map(a=>({key:a,count:b[a]??0}))}function t(a,b){if("public"===a.visibility)return"Public repository — every file is allowed to any LLM by default.";if("public-dep"===b)return"Public, open-source dependency — allowed to any LLM by default, even inside a private repo.";let c="blocked"===a.policyDefault?"No LLM":"Approved only";return`Private repository. First-party files default to “${c}”. Adjust per file as needed.`}},98937:(a,b,c)=>{"use strict";c.d(b,{T:()=>i,_:()=>j});var d=c(15008),e=c(71378),f=c(16820),g=c(14129);let h="rounded-full border-transparent px-2.5 text-xs [&_svg]:size-3.5";function i({action:a}){let b=(0,g.C$)(a),c=b.icon;return(0,d.jsx)(e.vw,{icon:(0,d.jsx)(c,{}),className:(0,e.cn)(h,b.className),children:b.label})}function j({aggregateAction:a}){return a?(0,d.jsx)(i,{action:a}):(0,d.jsx)(e.vw,{icon:(0,d.jsx)(f.mL,{}),className:(0,e.cn)(h,"bg-surface-3 text-text-2"),children:"Mixed"})}},99588:()=>{},99798:(a,b,c)=>{"use strict";c.d(b,{NeedsReviewListView:()=>j});var d=c(15008),e=c(71378),f=c(16820),g=c(47472),h=c(14998),i=c(52833);function j({items:a,onReview:b}){return 0===a.length?(0,d.jsxs)("div",{className:"flex flex-col items-center gap-2 py-12 text-center text-text-3",children:[(0,d.jsx)(f.C1,{"aria-hidden":!0,focusable:!1,className:"size-6 text-ok-ink"}),(0,d.jsx)("div",{className:"text-sm",children:"Nothing needs review"})]}):(0,d.jsx)("div",{className:"flex flex-col gap-2",children:a.map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-surface-2 px-3 py-2.5",children:[(0,d.jsx)(g.Wi,{kind:a.kind,trust:a.trust,name:a.name,host:a.host,size:30}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:(0,e.cn)("text-xs font-semibold text-text","ip"===a.kind&&"font-mono"),children:a.name}),(0,d.jsx)(g.HD,{cls:a.topDataClass})]}),(0,d.jsxs)("div",{className:"mt-1.5 flex items-center gap-1.5 text-label text-sev-critical-ink",children:[(0,d.jsx)(f._0,{"aria-hidden":!0,focusable:!1,className:"size-3"}),(0,i.ZX)(a.review.reasons)]})]}),(0,d.jsxs)("span",{className:"text-xs text-text-3",children:[a.callSiteCount," call",1===a.callSiteCount?"":"s"]}),(0,d.jsx)(e.$n,{onClick:(0,h.T)(b,a.id),variant:"ghost",tone:"primary",size:"sm",children:"Review"})]},a.id))})}}};
|