@akasecurity/cli 0.9.11 → 0.9.12
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/dist/cli.js +4764 -3653
- package/extension/content.js +1 -1
- package/extension/manifest.json +1 -1
- package/native-host/host.js +1576 -870
- package/native-host/scan-worker.js +237 -18
- package/native-host/sync.js +333 -65
- package/package.json +5 -5
- package/web-ui/web-ui/.next/BUILD_ID +1 -1
- package/web-ui/web-ui/.next/app-build-manifest.json +87 -87
- 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 +3 -3
- 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/{739.js → 121.js} +1 -1
- package/web-ui/web-ui/.next/server/chunks/290.js +6 -0
- package/web-ui/web-ui/.next/server/chunks/475.js +1 -1
- package/web-ui/web-ui/.next/server/chunks/589.js +1 -1
- package/web-ui/web-ui/.next/server/chunks/611.js +1015 -0
- package/web-ui/web-ui/.next/server/chunks/7.js +1 -1
- package/web-ui/web-ui/.next/server/chunks/816.js +1 -0
- package/web-ui/web-ui/.next/server/chunks/935.js +1 -1
- package/web-ui/web-ui/.next/server/chunks/968.js +1006 -0
- package/web-ui/web-ui/.next/server/functions-config-manifest.json +6 -6
- 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/{526-026c69b926a17dbb.js → 526-f0156de7831566b3.js} +1 -1
- package/web-ui/web-ui/.next/static/chunks/674-d8237c5d0faa4a53.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/activity/page-a27c8937989448e4.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/data-shares/page-2b805f9e1f995092.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/detections/page-a87cfee370c4e0f4.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/{error-dead9507fc349f26.js → error-190085728a856072.js} +1 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/[id]/page-4e214491c7be8d43.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/new/page-c1bb992ee1f12566.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/page-f16ba40d88e414b1.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/findings/page-59c76da638f22b0e.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/inventory/page-c37447caf89a86e1.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/{layout-dc7ae7664dcdc3c5.js → layout-cb3c8c7b6b33414c.js} +1 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/policies/page-ab639e48f60ad7ee.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/scan/page-494614fccc8c62cc.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/security/page-a3095119b3e87341.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/settings/page-469613d499e41093.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/updates/page-5b32bd569c9569d9.js +1 -0
- package/web-ui/web-ui/.next/static/chunks/app/(app)/vault/page-3152ceb31f024b8d.js +1 -0
- package/web-ui/web-ui/.next/static/css/6e72259eccdf4435.css +2 -0
- package/web-ui/web-ui/dist/scan-worker.js +237 -18
- package/web-ui/web-ui/.next/server/chunks/471.js +0 -950
- package/web-ui/web-ui/.next/server/chunks/766.js +0 -6
- package/web-ui/web-ui/.next/server/chunks/851.js +0 -1
- package/web-ui/web-ui/.next/server/chunks/905.js +0 -959
- package/web-ui/web-ui/.next/static/chunks/907-2ba9428e7818b656.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/activity/page-c5a55618d187c906.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/data-shares/page-b1c76b8c00e1ae2a.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/detections/page-159167b47a005b33.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/[id]/page-5e872a82af85ef64.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/new/page-0695d0006518b2cb.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/exceptions/page-adec99f2f4bbc180.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/findings/page-d013384d2ddb3036.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/inventory/page-42c1b48a01fdecb0.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/policies/page-9b6d7cc4ce9fb33e.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/scan/page-f3ee9ecde06df153.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/security/page-24a003c709776317.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/settings/page-4ea49ce2e765fffb.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/updates/page-6c7b94b070de8986.js +0 -1
- package/web-ui/web-ui/.next/static/chunks/app/(app)/vault/page-f37ab8e1edc67663.js +0 -1
- package/web-ui/web-ui/.next/static/css/c6954dd65f2115e6.css +0 -2
- /package/web-ui/web-ui/.next/static/{osEmGZG6yEV-XkQlklt-B → PMeePXfXsQ2xxrXppySG_}/_buildManifest.js +0 -0
- /package/web-ui/web-ui/.next/static/{osEmGZG6yEV-XkQlklt-B → PMeePXfXsQ2xxrXppySG_}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,1006 @@
|
|
|
1
|
+
exports.id=968,exports.ids=[968],exports.modules={60:()=>{},3121:(a,b,c)=>{"use strict";c.d(b,{FindingLocationsListView:()=>j});var d=c(15008),e=c(71378),f=c(53002),g=c(5265),h=c(14129);function i({location:a,sel:b,onClick:c,renderedAt:i}){let j=a.ruleIds.slice(0,3),k=a.ruleIds.length-j.length,l=void 0===a.status?null:(0,h.Dx)(a.status);return(0,d.jsxs)("button",{type:"button",onClick:c,"aria-current":b?"true":void 0,className:(0,e.cn)("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:"flex min-w-0 items-center gap-2",children:[(0,d.jsx)(e.Pt,{severity:a.maxSeverity}),(0,d.jsx)("span",{className:(0,e.cn)("min-w-0 flex-1 text-xs break-words [word-break:break-word]",a.repo?"text-text-3":"italic text-text-3"),children:a.repo||"No repository recorded"}),l&&(0,d.jsx)(e.Ex,{variant:l.badge,className:"h-5 shrink-0",children:l.label})]}),(0,d.jsx)("div",{className:(0,e.cn)("mt-1 text-sm font-semibold break-words [word-break:break-word]",a.file?"text-text":"italic text-text-3"),children:a.file||"No file recorded"}),(0,d.jsxs)("div",{className:"mt-1 flex min-w-0 items-center gap-1.5",children:[(0,d.jsxs)("span",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",title:a.ruleIds.join("\n"),children:[j.map(a=>(0,d.jsx)("span",{className:"max-w-full truncate rounded border border-border px-1.5 py-px text-label text-text-3",children:a},a)),k>0&&(0,d.jsxs)("span",{className:"shrink-0 text-label text-text-3",children:["+",k," more"]})]}),(0,d.jsx)("span",{className:"shrink-0 text-xs font-semibold tabular-nums text-text-2",title:`${f.j.format(a.instanceCount)} ${1===a.instanceCount?"finding":"findings"}`,children:(0,f.R)(a.instanceCount)}),(0,d.jsx)("span",{className:"shrink-0 text-xs text-text-3",children:(0,g.g)(a.latestDetectedAt,i)})]})]})}function j({locations:a,activeId:b,onSelect:c,renderedAt:f,hasNextPage:g=!1,hasPreviousPage:h=!1,onNextPage:j,onPreviousPage:k,loadingNextPage:l=!1,pageStart:m,total:n,emptyState:o}){return(0,d.jsxs)(e.Zp,{className:"flex h-full flex-col overflow-hidden shadow-sm",children:[(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto p-3",children:0===a.length?(0,d.jsx)("div",{className:"grid flex-1 place-items-center p-6 text-center text-xs text-text-3",children:o??"No locations match these filters."}):a.map(a=>(0,d.jsx)(i,{location:a,sel:a.id===b,renderedAt:f,onClick:()=>{c(a)}},a.id))}),j&&(h||g||a.length>0)&&(0,d.jsxs)(e.dK,{children:[(0,d.jsx)(e.Eb,{disabled:!h||l,onClick:k}),(0,d.jsx)(e.D2,{children:0===a.length||void 0===n||void 0===m?`${String(a.length)} shown`:`${String(m)}–${String(m+a.length-1)} of ${String(n)} locations`}),(0,d.jsx)(e.WA,{disabled:!g||l,loading:l,onClick:j})]})]})}},3792:(a,b,c)=>{"use strict";c.d(b,{SyncPanelView:()=>k});var d=c(15008),e=c(71378),f=c(60004),g=c(5265);let h={ok:"Last pass sent what was waiting.",interrupted:"Last pass sent some of what was waiting.",unreachable:"Last pass could not reach your deployment. Nothing was lost; it stays queued.",refused:"Your deployment refused this machine’s key. Re-attach to resume."};function i(a){return a.toLocaleString("en-US")}function j({row:a}){let b=0===a.queued&&0===a.notSent?f.l.ok:f.l.primary;return(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)("span",{className:"w-24 shrink-0 truncate text-ui text-text",children:a.label}),(0,d.jsx)(e.kI,{value:a.synced,max:a.total,color:b,height:6,"aria-label":`${a.label}: ${i(a.synced)} of ${i(a.total)} sent`}),(0,d.jsxs)("span",{className:"w-32 shrink-0 text-right text-label tabular-nums text-text-2",children:[i(a.synced)," of ",i(a.total)]}),a.notSent>0&&(0,d.jsxs)("span",{className:"w-24 shrink-0 text-right text-label text-text-3",children:[i(a.notSent)," not sent"]})]})}function k({state:a,deployment:b,lastOutcome:c,lastPassAt:k,renderedAt:l,running:m,paused:n,onSyncNow:o,busy:p,startError:q,localOnly:r}){let s="ready"===a.status||"nothing-recorded"===a.status,t=s&&!0===n;return(0,d.jsxs)(e.Zp,{children:[(0,d.jsxs)(e.aR,{children:[(0,d.jsxs)(e.Lc,{children:[(0,d.jsx)(e.ZB,{children:"Sync"}),(0,d.jsxs)(e.BT,{children:["What this machine has sent to ",b,", and what it still owes."]})]}),m&&(0,d.jsx)(e.vw,{dot:f.l.primary,children:"Sending…"}),!m&&t&&(0,d.jsx)(e.vw,{dot:f.l.sevMedium,children:"Paused"}),"consent-stale"===a.status&&(0,d.jsx)(e.vw,{children:"Paused"})]}),(0,d.jsxs)(e.Wu,{className:"flex flex-col gap-3",children:["not-shared"===a.status&&(0,d.jsx)("p",{className:"text-ui text-text-2",children:"Existing activity is not shared. Only what this machine records from now on is sent."}),"consent-stale"===a.status&&(0,d.jsx)("p",{className:"text-ui text-text-2",children:"Paused: your grant predates a change to what is sent. Review it above to resume."}),"credential-unusable"===a.status&&(0,d.jsx)("p",{className:"text-ui text-text-2",children:a.detail}),"nothing-recorded"===a.status&&(0,d.jsx)("p",{className:"text-ui text-text-2",children:"Nothing recorded yet."}),"ready"===a.status&&a.kinds.map(a=>(0,d.jsx)(j,{row:a},a.kind)),void 0!==c&&(0,d.jsxs)("p",{className:(0,e.cn)("text-label","ok"===c?"text-text-3":"text-text-2"),children:[void 0!==k&&(0,d.jsxs)("span",{className:"text-text-3",children:[(0,g.K)(k,l)," \xb7 "]}),h[c]]}),t&&(0,d.jsx)("p",{className:"text-ui text-text-2",children:"Sending is paused after repeated failures. It resumes on its own — nothing was lost, and what is queued above stays queued."}),void 0!==q&&(0,d.jsx)("p",{className:"text-ui text-text-2",children:q}),s&&void 0!==o&&(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)(e.$n,{onClick:o,disabled:!0===p||m||t,children:m?"Sending…":"Sync now"}),(0,d.jsx)("span",{className:"text-label text-text-3",children:"Sends what is queued above."})]}),void 0!==r&&r.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-1.5 border-t border-border pt-3",children:r.map(a=>(0,d.jsxs)("p",{className:"text-label text-text-3",children:[(0,d.jsx)("span",{className:"text-text-2",children:a.label}),void 0!==a.count&&(0,d.jsxs)(d.Fragment,{children:[" \xb7 ",i(a.count)," here"]})," — ",a.detail]},a.id))})]})]})}},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,g:()=>h});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"}let g={year:"y",month:"mo",week:"w",day:"d",hour:"h",minute:"m"};function h(a,b){if(!a)return"";let c=Date.parse(a);if(Number.isNaN(c))return"";let d=Math.abs((c-b)/1e3);if(d<45)return"now";for(let[a,b]of e)if(d>=b)return`${String(Math.floor(d/b))}${g[a]??""}`;return"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})]})]})}},9777:(a,b,c)=>{"use strict";c.d(b,{dtc:()=>I.AddExceptionForm,rX:()=>t.rX,fu:()=>J.ApproveExceptionDialog,i5F:()=>A.AssetDetail,JRA:()=>T.AvailablePluginsCardView,VBV:()=>L.BlockedLedgerView,VNw:()=>s.VN,spO:()=>e.sp,MXo:()=>X.DataShareDetailView,e3r:()=>Y.DataSharesKindTabsView,Imc:()=>Z.DataSharesTableView,tlv:()=>Q.DerefAuditTableView,MFC:()=>u.DetectionDetailView,A7Z:()=>v.DetectionsListView,ppr:()=>B.EmptyState,Gj:()=>M.ExceptionDetailView,Ebj:()=>N.ExceptionsTableView,_GS:()=>t._G,gsr:()=>s.gs,qWw:()=>s.qW,ToP:()=>C.FileDetailDrawer,Wjr:()=>n.FindingDetailView,tFx:()=>q.FindingLevelFilters,$Gd:()=>o.FindingLocationsListView,S$9:()=>r.FindingTypesListView,FGz:()=>p.FindingsFlatTableView,Dmd:()=>q.FindingsToolbarView,y2Z:()=>D.HarnessOverview,mD3:()=>E.m,_c:()=>F.InventoryNav,mLz:()=>t.mL,XAi:()=>t.XA,wO1:()=>x.MatcherModal,b6_:()=>$.NeedsReviewListView,t6e:()=>_.NeedsReviewStripView,ece:()=>h,LKE:()=>z.PolicyDetailView,m$d:()=>z.PolicyListView,kLH:()=>G.ProjectPane,sJz:()=>H.RecommendedActionsCardView,nZB:()=>P.RotateKeyDialog,Tvj:()=>K.ScopePicker,YJs:()=>i.Y,Lwf:()=>j.SearchField,WIv:()=>t.WI,LOI:()=>l.SessionDetailView,md2:()=>m.SessionListView,Zus:()=>t.Zu,Zmc:()=>V.SyncPanelView,hny:()=>e.hn,k3y:()=>t.k3,$nP:()=>k.TimeRangeSelect,b1W:()=>y.UpdateModal,bnY:()=>U.UpdateStatusCardView,y6v:()=>R.VaultInventoryView,gvr:()=>S.VaultReuseView,A30:()=>W.WorkspaceSettingsFormView,uv5:()=>t.uv,eFG:()=>O.eF,XgB:()=>w.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}),void 0!==b&&""!==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),j=c(59294);c(52233);var k=c(51260);c(88488),c(76836),c(53896),c(70124),c(42353),c(21459),c(21462),c(24061);var l=c(50754),m=c(88461);c(98937);var n=c(36198),o=c(3121),p=c(10985),q=c(50467),r=c(16142),s=c(14129);c(66755),c(13182);var t=c(16820);c(4543);var u=c(93224),v=c(90330),w=c(65366);c(87038),c(90241),c(90821);var x=c(62512),y=c(37231),z=c(76122),A=c(12696),B=c(93946);c(97769);var C=c(19037),D=c(16254),E=c(14728),F=c(95896),G=c(80954);c(71378),d.l.sevCritical,d.l.sevHigh,d.l.sevMedium,d.l.sevLow,t.pD,d.l.sevCritical,t.jZ,d.l.primary,t.rX,d.l.sevHigh,c(99685),c(87921),c(68788),c(33414);var H=c(75784),I=c(15009),J=c(59609),K=c(18389),L=c(82731);c(17139);var M=c(6824),N=c(58610),O=c(77292),P=c(23757);c(40229);var Q=c(51775),R=c(16696),S=c(38564),T=c(31527),U=c(42749),V=c(3792),W=c(37827);c(47472);var X=c(46867),Y=c(37769),Z=c(95197);c(52833);var $=c(99798),_=c(16980);c(54201),c(49195)},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",deployment:"min-w-[130px] 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,showDeploymentColumn:w=!1,pinnedType:x=!1,header:y,renderedAt:z}){return(0,d.jsxs)(e.Zp,{className:"flex h-full min-h-0 flex-col overflow-hidden shadow-sm",children:[y,(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:[!x&&(0,d.jsx)(e.nd,{className:l.severity,children:"Severity"}),(0,d.jsx)(e.nd,{className:l.type,children:x?"Value":"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"}),w&&(0,d.jsx)(e.nd,{className:l.deployment,children:"Deployment"}),(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:[!x&&(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:x?(0,d.jsx)("span",{className:"font-mono text-ui text-text wrap-anywhere",children:a.match.maskedValue}):(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})}),w&&(0,d.jsx)(e.nA,{className:l.deployment,children:void 0===a.delivery?(0,d.jsx)("span",{className:"text-text-3",children:"—"}):(0,d.jsx)(e.Ex,{variant:(0,i.dL)(a.delivery.state).badge,className:"h-6",children:(0,i.dL)(a.delivery.state).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,z)})})]},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});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:"—"})}},13364:(a,b,c)=>{"use strict";c.d(b,{N:()=>k,T:()=>g});var d=c(15008),e=c(71378),f=c(1505);function g(a){let[b,c]=(0,f.useState)(()=>new Set);return{visible:a.filter(a=>!b.has(a.key)),hidden:b,toggle:function(b){c(c=>{if(c.has(b)){let a=new Set(c);return a.delete(b),a}if(!a.some(a=>a.key!==b&&!c.has(a.key)))return c;let d=new Set(c);return d.add(b),d})}}}function h(a){return void 0===a||""===a?null:a}function i({color:a,hollow:b}){return(0,d.jsx)("span",{className:"size-2 rounded-xs",style:b?{background:"transparent",boxShadow:`inset 0 0 0 1.5px ${a}`}:{background:a}})}function j({text:a}){return null===a?null:(0,d.jsx)("span",{className:"text-text-3",children:a})}function k({series:a,visibility:b,metaLabel:c,interactive:f}){let{hidden:g,visible:k,toggle:l}=b;return f?(0,d.jsx)(d.Fragment,{children:a.map(a=>{let b=g.has(a.key),f=!b&&1===k.length,m=h(c?.(a.key)),n=null===m?a.label:`${a.label}, ${m}`;return(0,d.jsxs)("button",{type:"button","aria-label":f?`${n}, only series left`:n,"aria-pressed":!b,"aria-disabled":f||void 0,title:f?`${a.label} is the only series left — show another before hiding it`:b?`Show ${a.label}`:`Hide ${a.label}`,onClick:()=>{l(a.key)},className:(0,e.cn)("-mx-1 inline-flex cursor-pointer items-center gap-1.5 rounded-sm px-1 transition-colors","hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40",b&&"text-text-3",f&&"cursor-default hover:bg-transparent"),children:[(0,d.jsx)(i,{color:a.color,hollow:b}),a.label,(0,d.jsx)(j,{text:m})]},a.key)})}):(0,d.jsx)(d.Fragment,{children:a.map(a=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,d.jsx)(i,{color:a.color,hollow:!1}),a.label,(0,d.jsx)(j,{text:h(c?.(a.key))})]},a.key))})}},14129:(a,b,c)=>{"use strict";c.d(b,{y7:()=>m,VN:()=>h,gs:()=>g,qW:()=>B,V_:()=>w,Ec:()=>y,pM:()=>v,B5:()=>t,oC:()=>i,O:()=>s,C$:()=>q,Jm:()=>o,i9:()=>n,Ad:()=>A,dL:()=>x,Dx:()=>u,xE:()=>r});var d=c(71378),e=c(5265),f=c(16820);let g=["grouped","flat","files"],h="grouped",i=["critical","high","medium","low"],j={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"},k={secret:f.RY,pii:f.ny,source_code:f.lo,code_flaw:f._0,external_share:f._G,mcp_server:f.RR,customer_data:f.bN,financial:f.bN,phi:f.ny,custom:f.RY},l={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"},m=Object.assign(Object.create(null),k),n=a=>{let b=Object.hasOwn(l,a)?l[a]:void 0;return d.id[b??"neutral"]},o=a=>(Object.hasOwn(j,a)?j[a]:void 0)??a,p={blocked:{label:"Blocked",icon:f.pD,className:d.id.critical},redacted:{label:"Redacted",icon:f.jZ,className:d.id.primary},warned:{label:"Warned",icon:f._0,className:d.id.high},allowed:{label:"Allowed",icon:f.Sr,className:d.id.ok},monitored:{label:"Monitored",icon:f.bM,className:d.id.neutral},quarantined:{label:"Quarantined",icon:f.lm,className:d.id.critical}},q=a=>(Object.hasOwn(p,a)?p[a]:void 0)??{label:a,icon:f.RY,className:d.id.neutral};function r(a){return a.file?a.file:a.toolName?`via ${a.toolName}`:"—"}let s="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.",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),w={sent:{label:"Sent",badge:"success"},queued:{label:"Queued",badge:"primary"},not_sent:{label:"Not sent",badge:"high"},never_offered:{label:"Never offered",badge:"default"},local_scan:{label:"Local scan",badge:"default"}},x=a=>(Object.hasOwn(w,a)?w[a]:void 0)??{label:a,badge:"default"},y=Object.keys(w),z={deployment_refused:"Your deployment refused it.",payload_invalid:"This machine couldn’t package it for sending.",detached_undelivered:"Still unsent when this machine detached."};function A(a,b,c){switch(a.state){case"sent":return void 0===a.at?"Sent.":`Sent ${(0,e.K)(a.at,c)}.`;case"queued":return b.canRetry?"Waiting to be retried.":"Waiting to be retried. It won’t be retried until history sharing and this machine’s key are working — Settings → Sync.";case"not_sent":{let b=void 0!==a.reason&&Object.hasOwn(z,a.reason)?z[a.reason]:void 0;return void 0===b?"Not sent.":`Not sent. ${b}`}case"never_offered":return"Never queued: recorded while detached, before switching to this deployment, or its send wasn’t recorded.";case"local_scan":return"Found by a local scan (aka scan or the folder scan). Scanned files are never sent."}}let B={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"})})]})}},16142:(a,b,c)=>{"use strict";c.d(b,{FindingTypesListView:()=>k});var d=c(15008),e=c(71378),f=c(16820),g=c(59294),h=c(14129);function i({counts:a,selected:b,onChange:c}){return(0,d.jsx)("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:h.oC.map(f=>{let g=b.includes(f);return(0,d.jsxs)("button",{type:"button","aria-pressed":g,onClick:()=>{c(g?b.filter(a=>a!==f):[...b,f])},className:(0,e.cn)("inline-flex h-7 cursor-pointer items-center gap-1.5 rounded-full border px-2.5 text-xs font-semibold capitalize",g?"border-primary bg-primary-tint text-primary":"border-border bg-surface text-text-2"),children:[(0,d.jsx)("span",{className:(0,e.cn)("size-1.5 rounded-full",e.t0[f])}),f,(0,d.jsx)("span",{className:"text-label font-bold opacity-70",children:a.get(f)??0})]},f)})})}function j({type:a,sel:b,onClick:c}){let g=h.y7[a.category]??f.RY;return(0,d.jsx)("button",{type:"button",onClick:c,"aria-current":b?"true":void 0,className:(0,e.cn)("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:"flex min-w-0 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,h.i9)(a.category)),children:(0,d.jsx)(g,{"aria-hidden":!0,focusable:!1,className:"size-4"})}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,d.jsx)("span",{className:"truncate text-sm font-semibold text-text",title:a.subtype,children:a.subtype}),(0,d.jsx)("span",{className:"truncate text-xs text-text-3",children:(0,h.Jm)(a.category)})]}),(0,d.jsx)("span",{className:"shrink-0 text-xs font-semibold tabular-nums text-text-2",children:a.instanceCount})]})})}function k({types:a,activeId:b,onSelect:c,query:f,onQueryChange:h,severityCounts:k,selectedSeverities:l,onSeverityChange:m,hasNextPage:n=!1,hasPreviousPage:o=!1,onNextPage:p,onPreviousPage:q,loadingNextPage:r=!1,pageStart:s,total:t,emptyState:u}){return(0,d.jsxs)(e.Zp,{className:"flex h-full flex-col overflow-hidden shadow-sm",children:[(0,d.jsxs)("div",{className:"border-b border-border p-3",children:[(0,d.jsx)(g.SearchField,{value:f,onValueChange:h,label:"Search finding types",placeholder:"Search types…",clearLabel:"Clear type search",surface:"card",className:"h-9"}),(0,d.jsx)(i,{counts:k,selected:l,onChange:m})]}),(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto p-3",children:0===a.length?(0,d.jsx)("div",{className:"grid flex-1 place-items-center p-6 text-center text-xs text-text-3",children:u??"No types match these filters."}):a.map(a=>(0,d.jsx)(j,{type:a,sel:a.id===b,onClick:()=>{c(a)}},a.id))}),p&&(o||n||a.length>0)&&(0,d.jsxs)(e.dK,{children:[(0,d.jsx)(e.Eb,{disabled:!o||r,onClick:q}),(0,d.jsx)(e.D2,{children:0===a.length||void 0===t||void 0===s?`${String(a.length)} shown`:`${String(s)}–${String(s+a.length-1)} of ${String(t)} types`}),(0,d.jsx)(e.WA,{disabled:!n||r,loading:r,onClick:p})]})]})}},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,scope:b,onOpen:c}){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:c,"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}),b&&(0,d.jsx)("span",{className:"shrink-0 whitespace-nowrap text-xs font-semibold text-text-2",children:b}),(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(33414);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(33414);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(33414),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"})]})]})}},33414:(a,b,c)=>{"use strict";c.d(b,{PWo:()=>aK,HUb:()=>ce,spO:()=>c1,tLs:()=>M,V0H:()=>cd,MhX:()=>cX,fhc:()=>cj,F$B:()=>cT,xdw:()=>J,ap_:()=>H,UKt:()=>I,T2I:()=>cn,lgf:()=>cS,kqf:()=>cz,O2m:()=>cY,bkE:()=>cQ,EL9:()=>cP,qEQ:()=>b4,DLF:()=>cN,hds:()=>cH,Ly$:()=>cZ,y6l:()=>b5});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"}),Z=d.k5(["deployment_refused","payload_invalid","detached_undelivered"]).meta({id:"SyncFailureReason"}),$=d.k5(["sent","queued","not_sent","never_offered","local_scan"]).meta({id:"FindingDeliveryState"}),_=d.Ik({state:$,at:K.w$().optional(),reason:Z.optional()}).meta({id:"FindingDelivery"});d.k5(["enforced-in-flight","fixed-at-source","exception","acknowledged","false-positive","redetected"]).meta({id:"ResolutionMethod"});let aa=d.Ik({maskedValue:d.Yj(),contextPrefix:d.Yj()}).meta({id:"FindingMatch"}),ab=d.Ik({id:d.Yj(),name:d.Yj().nullable()}).meta({id:"FindingDetectionRef"}),ac=d.Ik({id:d.Yj(),name:d.Yj()}).meta({id:"FindingPolicyRef"}),ad=d.Ik({id:d.Yj(),name:d.Yj()}).meta({id:"FindingUser"}),ae=d.Ik({id:d.Yj(),provider:W,repo:d.Yj(),file:d.Yj(),user:ad.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(),delivery:_.optional()}).meta({id:"FindingInstance"}),af=d.Ik({id:d.Yj(),category:X,subtype:d.Yj(),severity:R,match:aa,detection:ab,policy:ac,instanceCount:d.ai().int().nonnegative(),providers:d.YO(W),aggregateAction:V.nullable(),latestDetectedAt:K.w$(),instances:d.YO(ae),status:Y.optional(),users:d.YO(ad).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 ag=d.Ik({value:d.Yj(),count:d.ai().int().nonnegative()}).meta({id:"FindingFacetItem"}),ah=d.Ik({severity:d.YO(ag),subtype:d.YO(ag),provider:d.YO(ag),action:d.YO(ag),status:d.YO(ag),tool:d.YO(ag).optional(),deployment:d.YO(ag).optional()}).meta({id:"FindingFacets"}),ai=af.omit({instances:!0,match:!0}).meta({id:"FindingTypeSummary"});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(),limit:L.ai().int().min(1).max(100).optional(),cursor:d.Yj().optional()}),d.Ik({totals:d.Ik({findings:d.ai().int().nonnegative(),types:d.ai().int().nonnegative()}),facets:ah,items:d.YO(ai),nextCursor:d.Yj().nullable(),sessionFirings:d.g1(d.Yj(),d.ai().int().nonnegative()).optional()}).meta({id:"ListFindingTypesResponse"}),d.Ik({action:V.exclude(["quarantined"]),instanceId:d.Yj().optional()}).meta({id:"ApplyFindingActionRequest"}),af.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 aj=ae.extend({groupId:d.Yj(),category:X,subtype:d.Yj(),severity:R,match:aa,detection:ab,policy:ac}).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(),deployment:d.YO($).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:ah,items:d.YO(aj),nextCursor:d.Yj().nullable()}).meta({id:"ListFindingInstancesResponse"}),d.Ik({items:d.YO(aj),nextCursor:d.Yj().nullable()}).meta({id:"ListFindingInstancesPage"});let ak=d.Ik({id:d.Yj(),repo:d.Yj(),file:d.Yj(),instanceCount:d.ai().int().nonnegative(),maxSeverity:R,latestDetectedAt:K.w$(),status:Y.optional(),ruleIds:d.YO(d.Yj())}).meta({id:"FindingLocationSummary"});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(),deployment:d.YO($).optional(),q:d.Yj().optional(),sessionId:d.Yj().optional(),from:K.w$().optional(),includeId:d.Yj().optional(),limit:L.ai().int().min(1).max(100).optional(),cursor:d.Yj().optional()}),d.Ik({totals:d.Ik({findings:d.ai().int().nonnegative(),locations:d.ai().int().nonnegative()}),facets:ah,items:d.YO(ak),nextCursor:d.Yj().nullable()}).meta({id:"ListFindingLocationsResponse"});let al=d.k5(["host","harness","user","skill","hook","mcp_server","config_file"]).meta({id:"InventoryObjectType"}),am=d.k5(["session","run","tool_call","llm_call","source_lookup","prompt","response","code_change","tool_use","model_refusal","config_scan"]).meta({id:"AuditEventType"}),an=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 ao=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:ao});let ap=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(),message_id:d.Yj().optional(),conversation_id:d.Yj().optional(),inspection_ms:d.ai().int().nonnegative().optional(),redact_degraded_to:S.optional()}).catchall(d.L5());let aq=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:ap,inspections:d.YO(aq).default([])});let ar=d.Ik({objectType:al,identityKey:d.Yj().min(1),location:d.Yj().optional(),title:d.Yj().optional(),hostId:d.Yj().optional(),attributes:an.default({})}).meta({id:"InventoryInput"}),as=d.Ik({url:d.Yj().min(1),name:d.Yj().optional(),attributes:an.default({})}).meta({id:"SourceProjectInput"}),at=d.Ik({id:d.Yj().min(1),eventType:am,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:an.optional()}).meta({id:"AuditEventInput"});d.Ik({class:d.Yj().min(1),label:d.Yj().optional(),attributes:an.optional()});let au=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:ar.optional(),harness:ar.optional(),project:as.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 av=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(av),totalTokens:d.ai().int().nonnegative(),estimatedCostUsd:d.ai().nullable(),costIsPartial:d.zM()});let aw=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(aw),sessionCount:d.ai().int().nonnegative(),totalTokens:d.ai().int().nonnegative(),estimatedCostUsd:d.ai(),costIsPartial:d.zM()});let ax=d.k5(["active","completed","interrupted","error"]),ay=d.k5(["session","prompt","response","tool","hook","detection","share","permission","commit","error","active"]),az=d.k5(["detections","shares","inventory"]),aA=d.Ik({id:d.Yj(),occurredAt:K.w$(),kind:ay,title:d.Yj(),detail:d.Yj(),tool:d.Yj().nullable(),severity:R.nullable(),link:az.nullable(),targetId:d.Yj().nullable(),internal:d.zM(),flagged:d.zM(),bodyExpired:d.zM().default(!1)}).meta({id:"ActivityAuditEvent"}),aB=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:ax,turns:d.ai().int().nonnegative(),findings:d.ai().int().nonnegative(),shares:d.ai().int().nonnegative()}).meta({id:"ActivitySessionSummary"});aB.extend({host:d.Yj(),cwd:d.Yj(),models:d.YO(d.Yj()),version:d.Yj(),tokens:av,tools:d.g1(d.Yj(),d.ai().int().nonnegative()),files:d.YO(d.Yj()),commits:d.ai().int().nonnegative(),events:d.YO(aA)}).meta({id:"ActivitySession"}),d.Ik({tz:d.Yj().optional()});let aC=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 aD=d.Ik({items:d.YO(aB),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(aA),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:aC,sessions:aD}).meta({id:"ActivityOverviewResponse"});let aE=d.k5(["user","project","local","plugin"]),aF=d.Ik({name:d.Yj().min(1),source:d.Yj().min(1),scope:aE,pluginName:d.Yj().optional(),version:d.Yj().optional(),description:d.Yj().optional(),updatedAt:K.w$().optional(),location:d.Yj().optional()}),aG=d.Ik({event:d.Yj().min(1),matcher:d.Yj().optional(),command:d.Yj().min(1),timeout:d.ai().optional(),scope:aE,pluginName:d.Yj().optional(),location:d.Yj().optional()}),aH=d.Ik({name:d.Yj().min(1),scope:aE,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()}),aI=d.Ik({name:d.Yj().min(1),path:d.Yj().min(1),scope:aE,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(aF),hooks:d.YO(aG),mcpServers:d.YO(aH),configFiles:d.YO(aI),errors:d.YO(d.Ik({source:d.Yj(),reason:d.Yj()}))});let aJ=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(ar),scanEvent:at,definitions:d.YO(au).optional(),findings:d.YO(aJ).optional()});let aK=d.k5(["project","skill","mcp","hook","config"]).meta({id:"AssetType"}),aL=d.k5(["open","approved","blocked"]).meta({id:"AccessLevel"}),aM=d.k5(["source","public-dep","vendored","config","data","docs","generated"]).meta({id:"Origin"}),aN=d.k5(["known-good","risky","unapproved"]).meta({id:"TrustLevel"}),aO=d.k5(["update","stale","conflict","unknown","change","untracked","risk","findings"]).meta({id:"Flag"}),aP=d.k5(["public","private"]).meta({id:"Visibility"}),aQ=d.k5(["block","redact","warn"]).meta({id:"HarnessEventKind"}),aR=N.extract(["ClaudeCode","Cursor","Codex","Antigravity"]).meta({id:"HarnessId"}),aS=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"}),aT=d.Ik({id:d.Yj(),type:aK,name:d.Yj(),sub:d.Yj(),flags:d.YO(aO),trust:aN.optional()}).meta({id:"AssetSummary"}),aU=d.Ik({id:d.Yj(),name:d.Yj(),repo:d.Yj(),visibility:aP,language:d.Yj(),policyDefault:aL,updatedAt:K.w$(),accessCounts:aS,findingsCount:d.ai().int().nonnegative()}).meta({id:"ProjectSummary"}),aV=d.Ik({type:aK,assets:d.YO(aT)}),aW=d.Ik({id:aR,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(aU),categories:d.YO(aV)}).meta({id:"HarnessSummary"});d.Ik({items:d.YO(aW)}).meta({id:"ListHarnessesResponse"});let aX=d.Ik({type:aK,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(aT)}).meta({id:"AssetGroup"});d.Ik({groups:d.YO(aX)}).meta({id:"ListAssetsResponse"});let aY=d.Ik({name:d.Yj(),signature:d.Yj(),description:d.Yj(),write:d.zM(),risk:d.Yj().nullable()}).meta({id:"McpTool"}),aZ=d.Ik({id:d.Yj(),title:d.Yj(),note:d.Yj()});aT.extend({description:d.Yj().nullable(),trust:aN.nullable(),meta:d.g1(d.Yj(),d.L5()),finding:aZ.nullable(),tools:d.YO(aY).optional()}).meta({id:"AssetDetail"}),d.Ik({items:d.YO(aU)}).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 a$=d.Ik({path:d.Yj(),name:d.Yj(),origin:aM,access:aL,isCustom:d.zM(),findings:d.ai().int().nonnegative(),blockedAt:K.w$().nullable().optional(),note:d.Yj().nullable().optional()}).meta({id:"FileSummary"}),a_=d.Ik({name:d.Yj(),path:d.Yj(),accessCounts:aS}).meta({id:"FolderSummary"});d.Ik({project:d.Ik({id:d.Yj(),repo:d.Yj(),visibility:aP}),path:d.Yj(),folders:d.YO(a_).optional(),files:d.YO(a$)}).meta({id:"ProjectTreeResponse"}),a$.extend({project:d.Ik({repo:d.Yj(),visibility:aP,language:d.Yj(),policyDefault:aL,updatedAt:K.w$()}),findingsRefs:d.YO(d.Ik({id:d.Yj(),title:d.Yj()}))}).meta({id:"FileDetail"}),d.Ik({path:d.Yj(),access:aL}).meta({id:"SetFileAccessBody"}),d.Ik({file:a$,accessCounts:aS}).meta({id:"SetFileAccessResponse"}),d.Ik({trust:aN}).meta({id:"SetMcpTrustBody"});let a0=d.Ik({kind:aQ,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(a0)}).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(aK).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 a1=d.k5(["provider","internal","external","ip"]).meta({id:"DestinationKind"}),a2=d.k5(["https","http","sftp","grpc","smtp","ws","wss"]).meta({id:"Transport"}),a3=d.k5(["secrets","pii","customer","source","telemetry","logs","metrics","none"]).meta({id:"DataClass"});a3.options;let a4=d.k5(["recognized","internal","unverified","ip"]).meta({id:"ShareTrustLevel"}),a5=d.k5(["allow","block"]).meta({id:"EgressDecision"}),a6=d.k5(["allowed","blocked","review"]).meta({id:"EgressStatus"}),a7=d.k5(["raw_ip","unverified_domain","plaintext_transport"]).meta({id:"ReviewReason"}),a8=d.k5(["GET","POST","PUT","DELETE","SDK","REF"]).meta({id:"HttpMethod"}),a9=d.Ik({needsReview:d.zM(),reasons:d.YO(a7)}).meta({id:"ReviewInfo"}),ba=d.Ik({port:d.ai().int().nullable(),geo:d.Yj().nullable(),ptr:d.Yj().nullable()}).meta({id:"DestinationNetwork"}),bb=d.Ik({id:d.Yj(),method:a8,transport:a2,url:d.Yj(),template:d.zM(),dataClass:a3,lastSeen:K.w$(),callSiteCount:d.ai().int().nonnegative()}).meta({id:"EndpointSummary"}),bc=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"}),bd=bb.extend({sites:d.YO(bc)}).meta({id:"EndpointWithSites"}),be=d.Ik({id:d.Yj(),kind:a1,name:d.Yj(),host:d.Yj(),category:d.Yj(),trust:a4,status:a6,isCustom:d.zM(),lastSeen:K.w$(),endpointCount:d.ai().int().nonnegative(),callSiteCount:d.ai().int().nonnegative(),transports:d.YO(a2),dataClasses:d.YO(a3),review:a9,network:ba.nullable(),endpoints:d.YO(bb)}).meta({id:"ShareDestinationSummary"});be.omit({endpointCount:!0,callSiteCount:!0,endpoints:!0}).extend({note:d.Yj().nullable(),endpoints:d.YO(bd)}).meta({id:"ShareDestinationDetail"});let bf=d.Ik({id:d.Yj(),kind:a1,name:d.Yj(),host:d.Yj(),trust:a4,status:a6,review:a9,topDataClass:a3,callSiteCount:d.ai().int().nonnegative(),lastSeen:K.w$()}).meta({id:"ReviewDestination"}),bg=d.Ik({kind:a1,total:d.ai().int().nonnegative(),items:d.YO(be)}).meta({id:"ShareDestinationGroup"});d.Ik({groups:d.YO(bg)}).meta({id:"ListShareDestinationsResponse"}),d.Ik({items:d.YO(bf)}).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:a5.nullable()}).meta({id:"SetEgressDecisionBody"}),d.Ik({destination:be}).meta({id:"SetEgressDecisionResponse"}),d.Ik({q:d.Yj().optional(),kind:d.YO(a1).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(a1).optional()});let bh=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(a3).min(1),sdks:d.jg(bh,d.YO(d.Yj()))}).meta({id:"ProviderRegistryEntry"});let bi=d.Ik({file:d.Yj(),line:d.ai().int().positive(),snippet:d.Yj(),dynamic:d.zM(),vendored:d.zM()}).meta({id:"EgressCallSiteHit"}),bj=d.Ik({host:d.Yj(),kind:a1,name:d.Yj(),category:d.Yj(),trust:a4,network:ba.nullable(),method:a8,transport:a2,url:d.Yj(),template:d.zM(),dataClass:a3,site:bi}).meta({id:"ResolvedEgressHit"}),bk=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:bk,hits:d.YO(bj)}).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 bl=d.Ik({packId:d.Yj().min(1),version:d.Yj().min(1),enabled:d.zM(),updatedAt:d.Yj().nullable()}).meta({id:"StorePosturePack"}),bm=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"}),bn=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(bl).max(500),policyCounts:bm,plugin:bn.optional()}).meta({id:"StorePostureSnapshot"});let bo="capture/",bp=at.extend({inspections:d.YO(aq).default([])}).refine(a=>a.inspections.every(a=>!a.ruleVersion.startsWith(bo)),{message:`inspections[].ruleVersion must not start with \`${bo}\` — that namespace is reserved for capture definitions the control plane mints itself`,path:["inspections"]}).meta({id:"RecordAuditEventRequest"});d.Ik({events:d.YO(bp).min(1).max(50)}).meta({id:"RecordAuditEventBatch"});let bq=d.Ik({host:d.Yj(),kind:a1,name:d.Yj(),category:d.Yj(),trust:a4,network:ba.nullable(),method:a8,transport:a2,url:d.Yj(),template:d.zM(),dataClass:a3,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:bk,hits:d.YO(bq)}).meta({id:"EgressIngestRequest"}),d.Ik({accepted:d.ai().int().nonnegative(),duplicates:d.ai().int().nonnegative()}),d.Ik({accepted:d.ai().int().nonnegative()});let br=/^[^\p{Cc}\p{Cf}]*$/u,bs=a=>d.Yj().max(a).regex(br,"must not contain control characters");d.Ik({tenantName:bs(200),userEmail:bs(320),role:bs(64),keyKind:bs(64),serverTime:bs(64)}),d.Ik({error:d.Ik({code:d.Yj().optional(),message:d.Yj().optional()}).optional()}),d.k5(["unauthorized","forbidden","route-absent","invalid-request","rejected","unreachable"]),d.Ik({deviceId:bs(128).min(1),hostname:bs(255).min(1),os:bs(64).min(1),cliVersion:bs(64).min(1),label:bs(200).optional()}).meta({id:"AttachDeviceRequest"}),d.Ik({deviceCode:bs(128).min(1)}).meta({id:"AttachTokenRequest"}),d.Ik({deviceCode:bs(128),userCode:bs(32),verificationUri:bs(512),verificationUriComplete:bs(512).optional(),expiresIn:d.ai().int().positive(),interval:d.ai().int().positive()});let bt=d.Ik({status:d.eu("pending")}),bu=d.Ik({status:d.eu("slow_down"),interval:d.ai().int().positive()}),bv=d.Ik({status:d.eu("denied"),message:bs(500).optional()}),bw=d.Ik({status:d.eu("expired")}),bx=d.Ik({status:d.eu("issued"),apiKey:d.Yj().min(1).max(512),endpoint:bs(512),tenantName:bs(200).optional(),userEmail:bs(320).optional()});d.KC([bx,bt,bu,bv,bw,d.Ik({status:bs(64)})]);let by=d.k5(["shares_rescan"]),bz=d.Ik({id:bs(128).min(1),kind:by,issuedAt:bs(64).min(1),expiresAt:bs(64).min(1)}).strict();d.Ik({command:bz.nullable()});let bA=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:bA,projectsScanned:d.ai().int().nonnegative()}).strict()]);let bB=d.Yj().regex(/^[a-z][a-z0-9-]*$/),bC=d.Yj().regex(/^[a-z][a-z0-9-]*$/),bD=d.Yj().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?$/),bE=d.k5(["labs","user","org"]),bF=d.k5(["keyword","regex"]).meta({id:"MatcherType"});d.k5(["safe","quarantined"]).meta({id:"RuleProbeVerdict"});let bG=d.re({type:d.eu("keyword"),keywords:d.YO(d.Yj().min(1)).min(1),caseSensitive:d.zM().default(!1)});function bH(a){return a.replace(/[gy]/g,"")}let bI=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,bH(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}|`,bH(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.`})}),bJ=d.gM("type",[bG,bI]).meta({id:"Matcher"});bF.options;let bK=d.re({extensions:d.YO(d.Yj().regex(/^\.[A-Za-z0-9]+$/)).min(1)}).meta({id:"AppliesTo"}),bL=d.k5(["entropy","luhn"]).meta({id:"PostValidatorName"}),bM=d.KC([bL,d.re({name:bL,config:d.g1(d.Yj(),d.L5()).optional()})],{error:()=>`not a valid post-validator: use a bare name (${bL.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"}),bN=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 bO=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:bJ,appliesTo:bK.optional(),postValidators:d.YO(bM).optional(),requiresNearby:bN.optional(),examples:d.YO(d.Yj()).optional()}).meta({id:"Rule"}),bP=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:bP.optional(),license:d.Yj().optional(),sourceUrl:d.OZ().optional()}).meta({id:"PackManifest"});let bQ=d.k5(["library","custom"]).meta({id:"OriginEnum"}),bR=d.k5(["all","library","custom","customized","updates"]),bS=d.k5(["new","imported","update"]).meta({id:"LibraryStateEnum"}),bT=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"}),bU=d.Ik({id:d.Yj(),name:d.Yj(),version:bD,enabled:d.zM(),origin:bQ,publisher:bB.optional(),publisherKind:bE.optional(),ruleCount:d.ai().int().nonnegative(),namespace:bB,packId:bC,policyId:d.Yj().optional(),latestVersion:bD.optional()}).meta({id:"DetectionListItem"});d.Ik({counts:bT,items:d.YO(bU)}).meta({id:"ListDetectionsResponse"}),d.Ik({filter:bR.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 bV=d.Ik({id:d.Yj(),name:d.Yj(),category:Q,severity:R,matcher:bJ,appliesTo:bK.optional(),postValidators:d.YO(bM).optional(),requiresNearby:bN.optional(),examples:d.YO(d.Yj()).optional()}).meta({id:"DetectionRule"}),bW=d.Ik({available:d.zM(),latestVersion:bD,latestRuleCount:d.ai().int().nonnegative().optional()}).nullable().meta({id:"DetectionUpdate"});d.Ik({id:d.Yj(),name:d.Yj(),version:bD,enabled:d.zM(),origin:bQ,publisher:bB.optional(),publisherKind:bE.optional(),ruleCount:d.ai().int().nonnegative(),namespace:bB,packId:bC,description:d.Yj().optional(),editedAt:K.w$(),findingsLast30d:d.ai().int().nonnegative(),latestVersion:bD.nullable().optional(),update:bW,rules:d.YO(bV),modified:d.zM(),policyId:d.Yj().optional()}).meta({id:"DetectionDetail"});let bX=d.Ik({id:d.Yj(),name:d.Yj(),publisher:bB,publisherKind:bE.optional(),category:Q.optional(),version:bD,ruleCount:d.ai().int().nonnegative(),description:d.Yj().optional(),updatedAt:K.w$(),state:bS,importedAs:d.Yj().nullable()}).meta({id:"LibraryItem"});d.Ik({categories:d.YO(Q),items:d.YO(bX)}).meta({id:"ListLibraryResponse"}),d.Ik({libraryId:d.Yj().refine(a=>/^[^/]+\/[^/]+$/.test(a),{message:"libraryId must be in namespace/packId format"})}).meta({id:"ImportDetectionRequest"});let bY=d.k5(["prompt","response","code_change","tool_use"]).meta({id:"EventKind"});bY.options.map(a=>`'${a}'`).join(",");let bZ=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(),messageId:d.Yj().optional(),conversationId:d.Yj().optional(),inspectionMs:d.ai().int().nonnegative().optional(),redactDegradedTo:S.optional()}).meta({id:"EventMetadata"}),b$=d.Ik({id:d.Os(),sourceTool:P,kind:bY,occurredAt:K.w$(),contentHash:d.Yj(),content:d.Yj(),metadata:bZ.optional()}).meta({id:"Event"}).meta({id:"IngestEvent"});d.Ik({events:d.YO(b$).min(1).max(100),dedupe:d.eu("content-hash").optional()}).meta({id:"IngestBatch"});let b_=d.k5(["once","temporary","permanent"]),b0=d.Ik({repo:d.Yj().optional(),sourceTool:d.Yj().optional(),provider:d.Yj().optional()}).strict(),b1=d.k5(["suppress","reveal_to_model"]),b2=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:b1.default("suppress"),scope:b_,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:b0.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()}),b3=b2.pick({id:!0,ruleId:!0,valueFingerprint:!0,keyVersion:!0,capability:!0,expiresAt:!0,maxUses:!0,useCount:!0,conditions:!0});function b4(a,b){return"present"===b.status&&b.version===a}function b5(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.`}b2.omit({valueFingerprint:!0});let b6=d.Yj().optional();d.Ik({reference:d.Yj(),scope:d.Yj(),reason:d.Yj(),confirmation:b6}),d.Ik({ruleId:d.Yj(),value:d.Yj(),scope:d.Yj(),reason:d.Yj(),confirmation:b6}),d.Ik({pointer:d.Yj(),scope:d.Yj(),justification:d.Yj(),confirmation:b6}),d.Ik({id:d.Yj(),reason:d.Yj()}),d.Ik({confirmation:d.Yj()}),Z.options,new WeakMap,new WeakMap,Object.fromEntries(R.options.map((a,b)=>[a,b]));let b7=d.Ik({id:d.Os(),namespace:bB,packId:bC,version:bD,name:d.Yj(),enabled:d.zM().default(!0),policyId:d.Yj().optional()}).meta({id:"InstalledPack"});d.Ik({namespace:bB,packId:bC,version:bD}).meta({id:"InstallPackRequest"}),d.Ik({items:d.YO(b7)}).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 b8=d.k5(["global","repo","user"]).meta({id:"PolicyScope"}),b9=d.KC([d.Ik({ruleId:d.Yj()}),d.Ik({category:Q})]).meta({id:"PolicyTarget"}),ca=d.k5(["builtin","custom"]).meta({id:"PolicyKind"}),cb=d.k5(["builtin","authored"]).meta({id:"PolicyProvenance"}),cc=d.Ik({id:d.Os(),scope:b8,target:b9,action:S,enabled:d.zM().default(!0),customKeywords:d.YO(d.Yj()).optional(),name:d.Yj().optional(),provenance:cb.optional()}).meta({id:"Policy"}),cd=["monitor","warn","redact","vault","block"],ce=d.k5(cd).meta({id:"BuiltinPolicyId"}),cf=ce.extract(["monitor","warn","block"]).meta({id:"RedactFallback"});[...Object.keys(d.Ik({version:d.Yj(),policies:d.YO(cc),rules:d.YO(bO).optional(),rulesComplete:d.zM().optional(),exceptions:d.YO(b3).optional(),reversibleRuleIds:d.YO(d.Yj()).optional(),ruleVersions:d.g1(d.Yj(),d.Yj()).optional(),prohibitedModels:d.YO(d.Yj()).optional(),redactFallback:cf.optional(),customKeywords:d.YO(d.Yj()),fetchedAt:K.w$()}).meta({id:"PolicyBundle"}).shape),...Object.keys(cc.shape).map(a=>`policies.${a}`),...b9.options.flatMap(a=>"shape"in a?Object.keys(a.shape):[]).map(a=>`policies.target.${a}`),...Object.keys(b3.shape).map(a=>`exceptions.${a}`)].sort().join(",");let cg=["config"];Q.options.filter(a=>!cg.includes(a));let ch={secret:"critical",financial:"critical",code_flaw:"critical",pii:"high",phi:"high",custom:"high",code_context:"low",config:"low"},ci={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 cj(a){return ci[a].action}let ck=[...new Set(cd.map(cj))],cl=[...T.filter(a=>!ck.includes(a)),...ck];function cm(a){return cl.indexOf(a)}function cn(a,b){return cm(a)>=cm(b)}d.Ik({floor:ce,locked:d.zM()}).describe("PackPolicyFloor");let co=cd.filter(a=>!ci[a].reversible);cd.filter(a=>ci[a].reversible);let cp=d.k5(co).meta({id:"CategoryPolicyId"});Object.fromEntries(Q.options.map(a=>[a,cj(function(a){if(cg.includes(a))return"monitor";let b=ch[a];return"critical"===b||"high"===b?"warn":"monitor"}(a))])),Object.fromEntries(cd.map(a=>[a,{id:a,...ci[a]}]));let cq=d.Ik({id:d.Yj(),name:d.Yj(),ruleCount:d.ai().int().nonnegative(),enabled:d.zM()}).meta({id:"UsedByItem"}),cr=d.Ik({id:d.Yj(),kind:ca,name:d.Yj(),enabled:d.zM(),usedByCount:d.ai().int().nonnegative()}).meta({id:"PolicyListItem"});d.Ik({items:d.YO(cr)}).meta({id:"ListPoliciesResponse"}),d.Ik({specVersion:d.eu(1),id:d.Yj(),kind:ca,name:d.Yj(),enabled:d.zM(),description:d.Yj(),usedBy:d.YO(cq)}).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 cs=Q.options.join("|"),ct=RegExp(`\\[\\[aka:(?:${cs}):[A-Z2-7]{2,7}\\.[A-Z2-7]{26}\\.[A-Z2-7]{16}\\]\\]`),cu=RegExp(`^${ct.source}$`);d.Yj().regex(cu),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 cv=d.k5(["human","model"]),cw=d.k5(["display","explicit-reveal","view-render","model-input","remediation","purge"]),cx=d.k5(["revealed","refused","unavailable"]),cy=["display","view-render"];function cz(a){return cy.includes(a)}let cA=d.Ik({id:d.Os(),pointerId:d.Yj(),at:d.Yj(),target:cv,reason:cw,outcome:cx,grantId:d.Yj().optional(),pointerCount:d.ai().int().positive().default(1)}),cB=d.k5(["prompt","tool-input","tool-output","file","transcript"]),cC=d.Ik({location:d.Yj(),kind:cB,firstSeen:d.Yj(),lastSeen:d.Yj()}),cD=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(cC)});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(cD),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(cD),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(cA),nextCursor:d.Yj().nullable(),hiddenBatched:d.ai().int().nonnegative()});let cE=d.Yj(),cF=d.k5(["masked","full","off"]),cG=d.Ik({acknowledgedAt:K.w$(),version:d.ai().int().positive()});function cH(a){return a?.version===1}let cI=d.k5(["standalone","attached"]),cJ=d.Ik({endpoint:d.Yj().min(1),label:d.Yj().min(1).optional(),attachedAt:K.w$()}).meta({id:"ControlPlaneConnection"}),cK=d.k5(["redact","warn"]),cL=d.k5(["full","session-only"]),cM=d.Ik({acknowledgedAt:K.w$(),payloadVersion:d.ai().int().positive()});function cN(a){return a?.payloadVersion===1}let cO=d.Ik({acknowledgedAt:K.w$(),payloadVersion:d.ai().int().positive(),endpoint:d.Yj()});function cP(a,b){return void 0!==a&&void 0!==b&&3===a.payloadVersion&&a.endpoint===b}function cQ(a,b){return void 0!==a&&void 0!==b&&a.endpoint===b&&3!==a.payloadVersion}let cR=d.Ik({enabled:d.zM().default(!1),retainDays:d.ai().int().min(1).max(3650).default(30)}).meta({id:"BodyRetention"});function cS(a){return"attached"===a.runMode&&void 0!==a.controlPlane}function cT(a){return a.label??a.endpoint}d.Ik({specVersion:d.ai().int().positive().default(8),runMode:cI.default("standalone"),controlPlane:cJ.optional(),policy:cK.default("redact"),historicalAccess:cL.default("session-only"),dataSharesInPlace:d.zM().default(!0),vaultConsent:cG.optional(),vaultKeyCustody:cE.default("file"),vaultInlineReveal:cF.default("masked"),redactFallback:cf.default("warn"),onboardedAt:K.w$().optional(),modelJudgeConsent:cM.optional(),historySyncConsent:cO.optional(),bodyRetention:cR.default({enabled:!1,retainDays:30})});var cU=c(72320);let cV=d.k5(["runMode","historicalAccess","vaultConsent","vaultKeyCustody","vaultInlineReveal","modelJudgeConsent","dataSharesInPlace","redactFallback","bodyRetention"]).meta({id:"ManagedSettingKey"}),cW=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:cf.optional(),bodyRetention:cR.optional()}).meta({id:"ManagedSettingsValues"});d.Ik({specVersion:d.ai().int().positive().default(1),organization:d.Yj().min(1).optional(),values:d.g1(d.Yj(),d.L5()).default({}),lockedFields:d.YO(d.Yj()).default([])}).transform(({lockedFields:a,values:b,...c},d)=>{let e=[],f=[];for(let b of a)cV.safeParse(b).success?e.push(b):f.push(b);let g=Object.create(null),h=[];for(let[a,c]of Object.entries(b))Object.hasOwn(cW.shape,a)?g[a]=c:h.push(a);let i=cW.safeParse(g);if(!i.success){for(let a of i.error.issues)d.addIssue({...a,path:["values",...a.path]});return cU.tm}return{...c,values:i.data,lockedFields:e,...f.length>0?{unknownLockedFields:f}:{},...h.length>0?{unknownValueFields:h}:{}}}).meta({id:"ManagedSettings"});let cX={present:!1,lockedFields:[]};function cY(a,b){return a.present&&a.lockedFields.includes(b)}function cZ(a){return`Managed by ${a.organization??"your organization"}`}let c$=d.Ik({path:d.Yj().min(1),name:d.Yj().min(1),origin:aM,defaultAccess:aL});d.Ik({files:d.YO(c$),truncated:d.zM(),scannedAt:d.Yj()});let c_=["7d","30d","3m","6m"],c0=d.k5(c_).meta({id:"TimeRange"}),c1="7d";c0.catch(c1);let c2=d.k5(["still-valid","unknown","invalid"]),c3=d.Ik({filePath:d.Yj(),span:U.optional()}).strict(),c4=d.Ik({provider:d.Yj(),maskedToken:d.Yj(),where:c3,state:c2,observedAt:K.w$().optional()}).strict();d.Ik({provider:d.Yj(),maskedToken:d.Yj(),consolePath:d.Yj(),occurrenceSpread:d.ai().int().positive()}).strict();let c5=d.k5(["redact-rotation-checklist","redact-only","set-secret-redact","leave"]),c6=d.k5(["first-run","pre-push","secret-scan"]);d.Ik({entrySource:c6}).strict();let c7=d.Ik({id:c5,label:d.Yj()}),c8=d.Ik({kind:d.eu("decision"),entrySource:c6,secretCount:d.ai().int().positive(),prompt:d.Yj(),options:d.PV([c7.extend({id:d.eu("redact-rotation-checklist")}),c7.extend({id:d.eu("redact-only")}),c7.extend({id:d.eu("set-secret-redact")}),c7.extend({id:d.eu("leave")})])}),c9=d.Ik({kind:d.eu("no-decision")});d.gM("kind",[c8,c9]);let da=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(da)}).meta({id:"SeveritySummaryResponse"}),d.Ik({range:d.k5(c_).default(c1)});let db=d.k5(["blocked","redacted","warned"]).meta({id:"EnforcementActionKind"}),dc=d.Ik({kind:db,count:d.ai().int().nonnegative(),delta:d.ai().int()}).meta({id:"EnforcementAction"});d.Ik({range:c0,total:d.ai().int().nonnegative(),actions:d.YO(dc)}).meta({id:"EnforcementActionsResponse"});let dd=d.k5(["day","week"]).meta({id:"TimeseriesGranularity"}),de=d.Ik({timestamp:K.p6(),critical:d.ai().int().nonnegative(),high:d.ai().int().nonnegative(),medium:d.ai().int().nonnegative(),low:d.ai().int().nonnegative().optional()}).meta({id:"FindingsTimeseriesPoint"});d.Ik({range:c0,granularity:dd,points:d.YO(de)}).meta({id:"FindingsTimeseriesResponse"});let df=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:c0,granularity:dd,points:d.YO(df)}).meta({id:"MttrTrendResponse"});let dg=d.Ik({findingKey:d.Yj(),ruleId:d.Yj(),severity:R,repo:d.Yj().optional(),path:d.Yj(),resolvedAt:K.w$(),detectedAt:K.w$()}).meta({id:"ResolvedFeedItem"});d.Ik({items:d.YO(dg)}).meta({id:"RecentlyResolvedResponse"});let dh=["repo","user"],di=d.k5(dh).meta({id:"SourceKind"}),dj=d.Ik({id:d.Yj(),name:d.Yj(),kind:di,findingsCount:d.ai().int().nonnegative()}).meta({id:"TopSource"});d.Ik({range:c0,items:d.YO(dj)}).meta({id:"TopSourcesResponse"}),d.Ik({range:d.k5(c_).default(c1),limit:L.ai().int().min(1).max(50).default(5),kind:d.k5(dh).optional()});let dk=N.extract(["ClaudeCode","Cursor","Codex","Antigravity","ClaudeAi","ChatGpt","Copilot","Api"]).meta({id:"Provider"}),dl=d.Ik({provider:dk,coverage:d.ai().int().min(0).max(100),supported:d.zM()}).meta({id:"ScanCoverageProvider"});d.Ik({range:c0,providers:d.YO(dl)}).meta({id:"ScanCoverageResponse"});let dm=d.k5(["repo","user","team","policy","share","rule"]).meta({id:"SubjectType"}),dn=d.Ik({type:dm,id:d.Yj(),label:d.Yj()}).meta({id:"RecommendationSubject"}),dp=d.k5(["apply","navigate"]).meta({id:"RecommendationActionMode"}),dq=d.Ik({mode:dp,type:d.Yj(),label:d.Yj(),href:d.Yj().optional(),policyId:d.Yj().optional(),teamId:d.Yj().optional()}).meta({id:"RecommendationAction"}),dr=d.Ik({id:d.Yj(),category:d.Yj(),severity:R,title:d.Yj(),description:d.Yj(),subjects:d.YO(dn),action:dq}).meta({id:"RecommendedAction"});d.Ik({items:d.YO(dr)}).meta({id:"RecommendedActionsResponse"}),d.Ik({limit:L.ai().int().min(1).max(20).default(3)});let ds=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:ds}).meta({id:"ApplyRecommendedActionResponse"}),d.Ik({id:d.Yj(),status:d.eu("dismissed")}).meta({id:"DismissRecommendedActionResponse"}),d.Ik({id:d.Yj()});let dt=d.k5(["granted","revoked","unchanged"]).meta({id:"HistorySyncConsentChoice"}),du=d.k5(["granted","revoked","unchanged"]).meta({id:"ModelJudgeConsentChoice"});d.Ik({historicalAccess:d.Yj(),modelJudgeConsent:du,historySyncConsent:dt,vaultConsent:d.Yj(),vaultInlineReveal:d.Yj(),redactFallback:d.Yj(),bodyRetention:d.Ik({enabled:d.zM(),retainDays:d.ai()})}),d.Ik({endpoint:d.Yj(),label:bs(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 dv=d.Ik({category:Q,action:cp,reasoning:d.Yj(),genuineCount:d.ai().int().nonnegative(),fpCount:d.ai().int().nonnegative(),fpIds:d.YO(d.Yj())});d.Ik({perCategory:d.YO(dv),notes:d.Yj()});let dw=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"]}),dx=d.Ik({ruleId:d.Yj(),category:Q,valueFingerprint:d.Yj(),keyVersion:d.ai().int().nonnegative()}),dy=d.Ik({pattern:d.Yj(),count:d.ai().int().nonnegative(),values:d.YO(dx).min(1)}),dz=d.Ik({category:Q,count:d.ai().int().nonnegative(),egress:d.zM()}),dA=d.Ik({counts:dw,routineCategories:d.YO(Q),surfacedCategories:d.YO(Q),findingKinds:d.YO(dz),posture:d.g1(Q,ce),maskedFindings:d.YO(c4).optional(),falsePositivePatterns:d.YO(dy).optional()}),dB=dv.pick({category:!0,genuineCount:!0,fpCount:!0}).extend({egress:d.zM()});d.Ik({categories:d.YO(dB),posture:d.g1(Q,ce)}),d.Ik({frame:dA,copy:d.Yj()}),d.k5(["scan","floor"]);let dC=d.Ik({id:d.k5(["enter-remediation","open-dashboard","not-now"]),label:d.Yj()}),dD=d.PV([dC.extend({id:d.eu("open-dashboard")}),dC.extend({id:d.eu("not-now")})]),dE=d.PV([dC.extend({id:d.eu("enter-remediation")}),dC.extend({id:d.eu("open-dashboard")}),dC.extend({id:d.eu("not-now")})]);d.Ik({worthALook:d.ai().int().nonnegative(),liveKeys:d.ai().int().nonnegative().optional(),options:d.KC([dD,dE])}).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 dF=d.k5(["site","estimated","none"]),dG=d.Ik({inputTokens:d.ai().int().nonnegative().optional(),outputTokens:d.ai().int().nonnegative().optional(),cacheReadInputTokens:d.ai().int().nonnegative().optional(),cacheCreationInputTokens:d.ai().int().nonnegative().optional()}),dH=d.Ik({toolUseId:d.Yj().min(1),toolName:d.Yj().min(1),target:d.Yj().optional(),isError:d.zM().optional(),inputSize:d.ai().int().nonnegative().optional(),outputSize:d.ai().int().nonnegative().optional()});d.Ik({messageId:d.Yj().min(1),startedAt:K.w$(),model:d.Yj().optional(),usage:dG.optional(),usageSource:dF,stopReason:d.Yj().optional(),conversationId:d.Yj().optional(),turnIndex:d.ai().int().nonnegative().optional(),toolCalls:d.YO(dH).default([]),responseText:d.Yj().optional(),truncated:d.zM().default(!1)}),d.Ik({patched:d.zM(),live:d.zM(),blind:d.zM(),sendsSeenDom:d.ai().int().nonnegative(),exchangesSeenNet:d.ai().int().nonnegative(),parseFailures:d.ai().int().nonnegative(),unparsedBodies:d.ai().int().nonnegative(),shapeMisses:d.YO(d.Yj()).default([])})},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){}})();'},36198:(a,b,c)=>{"use strict";c.d(b,{FindingDetailView:()=>q,formatConfidence:()=>o});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);function l({delivery:a,deployment:b,renderedAt:c}){let f=(0,k.dL)(a.state);return(0,d.jsx)("div",{className:"col-span-2",children:(0,d.jsx)(g.p,{label:"Deployment",children:(0,d.jsxs)("div",{className:"flex flex-col items-start gap-1",children:[(0,d.jsx)(e.Ex,{variant:f.badge,className:"h-6",children:f.label}),(0,d.jsx)("span",{className:"text-xs font-normal text-text-2",children:(0,k.Ad)(a,b,c)}),(0,d.jsx)("span",{className:"text-xs font-normal text-text-3",children:"Based on its latest detection."})]})})})}var m=c(66755),n=c(13182);function o(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 p({confidence:a}){let{label:b,tone:c}=o(a);return(0,d.jsx)("span",{className:c,children:b})}function q({selection:a,onSelectInstance:b,onBack:c,footer:i,deployment:o,renderedAt:q}){let{finding:t,instance:u}=a,v=k.y7[t.category]??h.RY,w=!u,x=t.providers.length,y=(0,k.Jm)(t.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:t.severity}),(0,d.jsx)(e.qp,{className:"font-mono text-xs font-semibold text-text-3",children:w?y:u.id})]}),(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-4 pb-4",children:[!w&&(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)(t.category)),children:(0,d.jsx)(v,{className:"size-5"})}),(0,d.jsxs)("div",{className:"flex flex-col",children:[(0,d.jsx)("span",{className:"font-display text-base font-semibold",children:t.subtype}),(0,d.jsx)("span",{className:"text-xs text-text-3",children:w?`${String(t.instanceCount)} locations \xb7 ${String(x)} tool${x>1?"s":""}`:`${y} \xb7 ${u.repo} \xb7 detected ${(0,f.K)(u.detectedAt,q)}`})]})]}),(0,d.jsx)(r,{code:t.match.contextPrefix,snippet:t.match.maskedValue,file:w?`${String(t.instanceCount)} locations`:(0,k.xE)(u)}),w?(0,d.jsxs)("div",{children:[(0,d.jsx)(g.e,{children:"Locations"}),(0,d.jsx)("div",{className:"flex flex-col gap-2",children:t.instances.map(a=>(0,d.jsx)(s,{instance:a,onClick:()=>{b(a)}},a.id))}),t.instances.length<t.instanceCount&&(0,d.jsx)("p",{className:"pt-2 text-xs text-text-3",children:0===t.instances.length?`No locations here match the current filters — the group has ${String(t.instanceCount)} locations in total.`:`Showing the ${String(t.instances.length)} most recent of ${String(t.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)(m.i,{provider:u.provider})}),(0,d.jsx)(g.p,{label:"Repository",children:(0,d.jsx)("span",{className:"font-mono text-xs wrap-break-word",children:u.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)(u)})}),(0,d.jsx)(g.p,{label:"Action taken",children:(0,d.jsx)(j.T,{action:u.action})}),(0,d.jsx)(g.p,{label:"Detected",children:(0,f.K)(u.detectedAt,q)}),(0,d.jsx)(g.p,{label:"Confidence",children:(0,d.jsx)(p,{confidence:u.confidence})}),void 0!==u.user&&(0,d.jsx)(g.p,{label:"User",children:(0,d.jsx)("span",{title:k.O,children:(0,d.jsx)(n.c,{user:u.user})})}),null!=o&&void 0!==u.delivery&&(0,d.jsx)(l,{delivery:u.delivery,deployment:o,renderedAt:q})]}),i]})]})}function r({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 s({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"})]})}},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:()=>w});var d=c(15008),e=c(33414),f=c(71378),g=c(1505);let h=[{value:"monitor",label:"Let it through",description:"The call runs with the value unmasked and the finding is recorded."},{value:"warn",label:"Let it through, with a warning",description:"The call runs with the value unmasked, and the session is told what was found (default). A host with no channel to print on records the finding and shows nothing."},{value:"block",label:"Block the call",description:"The call is refused and the message says what to remove. The stricter answer, and the one to pick if a request that has already left cannot be recalled."}],i=[{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."}],j=[{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."}],k=[{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:"Activity from before this machine attached, and anything undelivered since, may be sent later — including the text of prompts, replies and tool results, in which a value is masked only where the detection that flagged it is set to redact or block."}],l=[{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."}],m=`Enter a whole number of days, ${String(1)}\u2013${String(3650)}.`,n=[{value:"off",label:"Keep everything",description:"Bodies are kept for as long as the store lives."},{value:"on",label:"Expire after a horizon",description:"Clear bodies past the horizon below. The events, their severities and every finding stay."}],o=[{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 p(a){return a?"on":"off"}function q(a){return void 0!==a&&!(0,e.hds)(a)}function r({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)(s,{}),(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)(t,{name:c,labelledBy:n,choices:e,value:f,onChange:g,disabled:void 0!==h})}),l]})]})}function s(){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 t({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 u({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})]})}let v=a=>1===a?"1 setting":`${String(a)} settings`;function w({settings:a,managed:b=e.MhX,onSave:c,onAttach:s,onDetach:t,credentialState:w,detectionsHref:y="/detections",busy:z,error:A,saved:B}){let[C,D]=(0,g.useState)(a.historicalAccess),E=(0,e.DLF)(a.modelJudgeConsent)?"granted":"revoked",[F,G]=(0,g.useState)(E),[H,I]=(0,g.useState)(!1),J=(0,e.EL9)(a.historySyncConsent,a.controlPlane?.endpoint)?"granted":"revoked",[K,L]=(0,g.useState)(J),[M,N]=(0,g.useState)(!1),O=(0,e.bkE)(a.historySyncConsent,a.controlPlane?.endpoint),[P,Q]=(0,g.useState)(p(a.vaultConsent)),[R,S]=(0,g.useState)(a.vaultInlineReveal),[T,U]=(0,g.useState)(a.redactFallback),[V,W]=(0,g.useState)(a.bodyRetention.enabled?"on":"off"),[X,Y]=(0,g.useState)(String(a.bodyRetention.retainDays)),Z=Number(X),$=""!==X.trim()&&Number.isInteger(Z)&&Z>=1&&Z<=3650,_=a=>(0,e.O2m)(b,a)?(0,e.Ly$)(b):void 0,aa=function(a){let b=a.unknownLockedCount??0,c=a.unknownValueCount??0;if(!a.present||b+c===0)return;let d=a.organization??"Your organization",e=[...c>0?[`pins ${v(c)}`]:[],...b>0?[`locks ${v(b)}`]:[]],f=b+c===1?"it":"them";return`${d} ${e.join(" and ")} this version of AKA does not recognize. Update AKA to apply ${f}.`}(b),ab=C!==a.historicalAccess||V!==(a.bodyRetention.enabled?"on":"off")||$&&Z!==a.bodyRetention.retainDays||F!==E||K!==J||P!==p(a.vaultConsent)||R!==a.vaultInlineReveal||T!==a.redactFallback||"on"===P&&q(a.vaultConsent)||M||H;return(0,d.jsxs)("div",{className:"flex max-w-4xl flex-col gap-7",children:[void 0!==aa&&(0,d.jsx)("p",{className:"text-xs text-text-3","data-slot":"managed-unrecognized",children:aa}),(0,d.jsx)(u,{title:"Connection",children:(0,d.jsx)(x,{settings:a,credentialState:w,managedLabel:_("runMode"),onAttach:s,onDetach:t,busy:z})}),(0,d.jsxs)(u,{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:y,className:"shrink-0 text-xs font-medium text-primary hover:underline",children:"Configure detections"})]}),(0,d.jsx)(r,{label:"When masking is not possible",description:"Some fields cannot be masked in place: rewriting a shell command would change what runs, and rewriting a URL would fetch something else. A detection set to Redact cannot be carried out there, and this chooses what happens instead. It does not change what any detection is set to — only what happens where that answer cannot be applied. A plugin applies this once it reports which of its fields cannot be rewritten; until then it refuses those calls outright, and its Known limitations says where it stands.",name:"redactFallback",choices:h,value:T,onChange:U,managed:_("redactFallback")})]}),(0,d.jsxs)(u,{title:"Data access",children:[(0,d.jsx)(r,{label:"Historical access",description:"Consent to inspect surfaces that existed before AKA was installed.",name:"historicalAccess",choices:i,value:C,onChange:D,managed:_("historicalAccess")}),(0,d.jsx)(r,{label:"Model-judge consent",description:"Whether the setup scan may send findings to the model API.",name:"modelJudgeConsent",choices:j,value:F,onChange:a=>{I(!0),G(a)},managed:_("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)(r,{label:"Unsent activity",description:"Whether activity this machine has not delivered may be sent later.",name:"historySyncConsent",choices:k,value:K,onChange:a=>{N(!0),L(a)},alert:O?"Paused":void 0,defaultOpen:O,notice:(0,d.jsxs)(d.Fragment,{children:[O&&(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 the activity recorded before this machine attached — only what a live send failed to deliver afterward — 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. Both are sent the same way: 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, what was detected in those inputs, and the prompts, assistant replies and tool results themselves — for which a captured one 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)(r,{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:l,value:P,onChange:Q,managed:_("vaultConsent"),alert:q(a.vaultConsent)?"Paused":void 0,defaultOpen:q(a.vaultConsent),notice:q(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)(u,{title:"Display",children:(0,d.jsx)(r,{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:o,value:R,onChange:S,managed:_("vaultInlineReveal")})}),(0,d.jsx)(u,{title:"Storage",children:(0,d.jsx)(r,{label:"Expire captured bodies",description:"Clear the stored text of old captures, keeping the events and their findings.",name:"bodyRetention",choices:n,value:V,onChange:W,managed:_("bodyRetention"),children:"on"===V&&(0,d.jsxs)("div",{className:"mt-3 flex items-center gap-2","data-slot":"retain-days",children:[(0,d.jsx)("label",{htmlFor:"retainDays",className:"text-xs text-text-2",children:"Keep bodies for"}),(0,d.jsx)("input",{id:"retainDays",name:"retainDays",type:"number",inputMode:"numeric",min:1,max:3650,value:X,disabled:void 0!==_("bodyRetention"),onChange:a=>{Y(a.target.value)},className:"w-20 rounded-md border border-border bg-surface px-2 py-1 text-sm text-text disabled:opacity-50","aria-invalid":!$,"aria-describedby":$?void 0:"retainDays-error"}),(0,d.jsx)("span",{className:"text-xs text-text-2",children:"days"}),!$&&(0,d.jsx)("span",{id:"retainDays-error",className:"text-xs text-sev-critical-ink",children:m})]})})}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(f.$n,{variant:"solid",tone:"primary",size:"sm",disabled:!ab||!0===z||"on"===V&&!$,onClick:()=>{c({historicalAccess:C,redactFallback:T,modelJudgeConsent:H?"granted"===F?"granted":"revoked":"unchanged",historySyncConsent:M?"granted"===K?"granted":"revoked":"unchanged",vaultConsent:P,vaultInlineReveal:R,bodyRetention:{enabled:"on"===V,retainDays:$?Z:a.bodyRetention.retainDays}})},children:z?"Saving…":"Save changes"}),B&&!ab&&(0,d.jsx)("span",{className:"text-xs text-ok-ink",children:"Saved."}),A&&(0,d.jsx)("span",{className:"text-xs text-sev-critical-ink",children:A})]})]})}function x({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. A scan you run from the Scan page also sends the Data Shares register it records — destinations and call sites, never source text. 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))},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:[a.bodyExpired?(0,d.jsx)("span",{className:"text-ui font-semibold text-text-2 italic",children:"Body expired"}):(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],f=function(a){let b=a.marketplacePin;if(b&&b.npmAhead&&null!==a.latest&&null!==b.npmLatest)return`${b.marketplace} pins v${a.latest} — npm has v${b.npmLatest}, which this machine cannot install until that marketplace moves.`}(a);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}`]}),void 0!==f&&(0,d.jsx)("div",{className:"mt-1 text-xs text-text-3","data-slot":"marketplace-pin-note",children:f})]}),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"]})}},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,{FindingLevelFilters:()=>m,FindingsToolbarView:()=>n});var d=c(15008),e=c(71378),f=c(16820),g=c(63407),h=c(59294),i=c(14129);let j=a=>a.charAt(0).toUpperCase()+a.slice(1),k=a=>a in g.x?g.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,showDeployment:e=!1}){let f=l(a.provider.map(a=>({value:a.value,label:k(a.value),count:a.count})),b.provider,k),g=l(a.action.map(a=>({value:a.value,label:j(a.value),count:a.count})),b.action,j),h=new Map(a.status.map(a=>[a.value,a.count])),m=i.pM.map(a=>({value:a,label:i.B5[a].label,count:h.get(a)??0})),n=new Map((a.deployment??[]).map(a=>[a.value,a.count])),p=i.Ec.map(a=>({value:a,label:i.V_[a].label,count:n.get(a)??0})),q=(a,d)=>{c({...b,[a]:d})};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(o,{label:"Provider",options:f,selected:b.provider,onChange:a=>{q("provider",a)}}),(0,d.jsx)(o,{label:"Action",options:g,selected:b.action,onChange:a=>{q("action",a)}}),(0,d.jsx)(o,{label:"Status",options:m,selected:b.status,onChange:a=>{q("status",a)}}),e&&(0,d.jsx)(o,{label:"Deployment",options:p,selected:b.deployment,onChange:a=>{q("deployment",a)}})]})}function n({facets:a,filters:b,onFiltersChange:c,query:e,onQueryChange:f,showDeployment:g=!1}){let k=new Map(a.severity.map(a=>[a.value,a.count])),n=i.oC.map(a=>({value:a,label:j(a),count:k.get(a)??0})),p=l(a.subtype.map(a=>({value:a.value,label:a.value,count:a.count})),b.type,a=>a),q=(a,d)=>{c({...b,[a]:d})};return(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)(h.SearchField,{value:e,onValueChange:f,label:"Search findings",placeholder:"Search findings…",clearLabel:"Clear findings search",surface:"canvas",className:"h-9 w-64"}),(0,d.jsx)(o,{label:"Severity",options:n,selected:b.severity,onChange:a=>{q("severity",a)}}),(0,d.jsx)(o,{label:"Type",options:p,selected:b.type,onChange:a=>{q("type",a)}}),(0,d.jsx)(m,{facets:a,filters:b,onFiltersChange:c,showDeployment:g})]})}function o({label:a,options:b,selected:c,onChange:g}){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)(f.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,g(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)(f.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:()=>{g([])},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"})]})]})}},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"})})}},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(33414),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"}}},53002:(a,b,c)=>{"use strict";c.d(b,{R:()=>f,j:()=>d});let d=new Intl.NumberFormat("en-US"),e=new Intl.NumberFormat("en-US",{notation:"compact"});function f(a){return e.format(a).toLowerCase()}},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")},58438:(a,b,c)=>{"use strict";c.d(b,{S8C:()=>ap,leE:()=>bP,Itg:()=>a0,PWo:()=>bb,yi_:()=>bQ,RRF:()=>du,ZpU:()=>dH,HUb:()=>dn,hfB:()=>cA,unw:()=>dG,p$t:()=>aM,IYX:()=>aI,b2L:()=>aK,Jr:()=>dI,hdu:()=>dY,mBk:()=>dX,vog:()=>d,V8B:()=>cG,IgC:()=>ds,ZYZ:()=>cz,iRC:()=>cH,yA3:()=>ar,ZDs:()=>aw,Bfx:()=>as,GCf:()=>au,tLs:()=>ah,TUN:()=>ai,SHn:()=>bi,V0H:()=>dm,WRR:()=>er,u8Q:()=>dZ,kxf:()=>d3,ZXz:()=>eu,MhX:()=>ev,viY:()=>dM,PEm:()=>dl,vap:()=>dq,KqW:()=>eU,eI7:()=>ez,cqq:()=>ay,jON:()=>ci,Zdp:()=>aj,lFU:()=>e,PhW:()=>a$,AI$:()=>an,AJV:()=>av,zJK:()=>ey,DzG:()=>d0,hd_:()=>ed,_5V:()=>dc,W4_:()=>ae,tXp:()=>c_,Plu:()=>W,plk:()=>cy,Ple:()=>cV,Fnc:()=>fh,ryv:()=>ad,fhc:()=>dw,tTV:()=>aZ,qmP:()=>eo,_6W:()=>c1,hml:()=>dd,rG:()=>c3,F$B:()=>eg,Bfj:()=>c$,fj8:()=>c9,q_t:()=>ab,i1j:()=>ee,xHz:()=>cN,xog:()=>cU,hzO:()=>fj,by7:()=>fi,Gw9:()=>ff,ZoN:()=>de,q11:()=>U,U7X:()=>an,JB8:()=>cT,T2I:()=>dA,lgf:()=>ef,y_0:()=>fg,bkE:()=>eb,EL9:()=>ea,qEQ:()=>cK,hds:()=>d2,I8t:()=>T,am1:()=>c6,SSj:()=>db,OHL:()=>eB,TdZ:()=>dF,DhA:()=>dJ,bCv:()=>X,WSs:()=>fm,a45:()=>cw,X0p:()=>c2,pnU:()=>cx,Lq6:()=>dB,V9M:()=>ej,ImG:()=>cJ,$w9:()=>en,jTf:()=>ep,$BP:()=>ek,GyT:()=>cI,JAl:()=>el,$3l:()=>em,MgS:()=>da,gzP:()=>eh,QCA:()=>ei,C05:()=>fk,GWi:()=>dC});let d=["0031_audit_capture_by_time_index","0032_audit_capture_by_id_index","0033_audit_capture_location_index","0034_findings_read_indexes"],e=[{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"},{tag:"0029_audit_capture_rollup_index",sql:"CREATE INDEX `idx_audit_capture_rollup` ON `audit_events` (`event_type`,`started_at`,`repo`,`id`) WHERE event_type IN ('prompt','response','code_change','tool_use');"},{tag:"0030_audit_content_expiry",sql:"ALTER TABLE `audit_events` ADD `content_expired_at` integer;--\x3e statement-breakpoint\nCREATE INDEX `idx_audit_expirable_body` ON `audit_events` (`started_at`) WHERE content IS NOT NULL;"},{tag:"0031_audit_capture_by_time_index",sql:"CREATE INDEX `idx_audit_capture_by_time` ON `audit_events` (`started_at`,`id`,`event_type`,`root_session_id`,`source_tool`,`repo`,`file_path`,`tool_name`) WHERE event_type IN ('prompt','response','code_change','tool_use');"},{tag:"0032_audit_capture_by_id_index",sql:"CREATE INDEX `idx_audit_capture_by_id` ON `audit_events` (`id`,`started_at`,`event_type`,`root_session_id`,`source_tool`,`repo`,`file_path`,`tool_name`) WHERE event_type IN ('prompt','response','code_change','tool_use');"},{tag:"0033_audit_capture_location_index",sql:"CREATE INDEX `idx_audit_capture_location` ON `audit_events` (`repo`,`file_path`,`started_at`,`id`,`event_type`) WHERE event_type IN ('prompt','response','code_change','tool_use');"},{tag:"0034_findings_read_indexes",sql:"CREATE INDEX `idx_inspection_definitions_rule` ON `inspection_definitions` (`rule_id`,`severity`,`category`);--\x3e statement-breakpoint\nCREATE INDEX `idx_inspection_findings_def` ON `inspection_findings` (`inspection_definition_id`,`audit_event_id`);--\x3e statement-breakpoint\nCREATE INDEX `idx_inspection_findings_event_cover` ON `inspection_findings` (`audit_event_id`,`inspection_definition_id`,`action_taken`,`finding_key`,`id`);"}];var f=c(8690);let g=f.Ik({thresholdInputTokens:f.ai().int().positive(),input:f.ai().nonnegative().nullable(),output:f.ai().nonnegative().nullable()});function h(a,b,c){return Object.freeze({input:a,output:b,longContext:null,cacheWrite5m:1.25*a,cacheWrite1h:2*a,cacheRead:c,webSearch:.01})}function i(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})}f.Ik({input:f.ai().nonnegative(),output:f.ai().nonnegative(),longContext:g.nullable(),cacheWrite5m:f.ai().nonnegative().nullable(),cacheWrite1h:f.ai().nonnegative().nullable(),cacheRead:f.ai().nonnegative().nullable(),webSearch:f.ai().nonnegative().nullable()});let j=Object.freeze({input:0,output:0,longContext:null,cacheWrite5m:0,cacheWrite1h:0,cacheRead:0,webSearch:0}),k=new Map([["standard",1],["batch",.5],["priority",1.5]]);f.k5(["anthropic","openai","google","meta","mistral","deepseek","alibaba","xai","amazon","cohere","unknown"]),f.k5(["anthropic","openai","google-ai","mistral","deepseek","xai","cohere","bedrock","vertex","azure","foundry","together","fireworks","groq","openrouter","ollama","local"]),f.k5(["api","gateway","local"]);let l=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 m(a){return l.get(a)??"api"}let n=new Map([["anthropic","anthropic"],["openai","openai"],["google","google-ai"],["mistral","mistral"],["deepseek","deepseek"],["xai","xai"],["cohere","cohere"]]),o=Object.freeze(["anthropic","amazon","meta","mistral","deepseek","qwen","cohere","ai21","writer","luma","stability"]),p=Object.freeze(["us","eu","apac","au","jp","global"]);class q{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,n.get(c)??null),g=b.openWeights??this.defaults.openWeights??!1,h=b.region??this.defaults.region??null,i=b.retention??this.defaults.retention??"unknown",k=new Map;for(let a of(null!==f&&k.set(f,Object.freeze({platform:f,hosting:m(f),firstParty:!0,price:b.price??null,retention:i,region:h})),b.on??[])){let{platform:c,price:e,retention:f,region:g}="string"==typeof a?{platform:a}:a,l=(d=this.vendor,n.get(d)===c),o=m(c),p="local"===o;k.set(c,Object.freeze({platform:c,hosting:o,firstParty:l,price:e??(p?j:l?b.price??null:null),retention:f??(p?"on_infrastructure":l?i:"unknown"),region:void 0===g?l?h:null:g}))}let l=b.defaultHosting??this.defaults.defaultHosting??(null===f?"gateway":m(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:l,seen:b.seen??"managed"};return Object.freeze(o),Object.freeze(o.aliases),this.entries.push(o),o}models(){return this.entries}}function r(a,b={}){return new q(a,b)}let s=RegExp(`^(?:${p.join("|")})\\.`,"u"),t=RegExp(`^(?:${o.join("|")})\\.`,"u"),u=RegExp(`^(?:${o.join("|")})/`,"iu"),v=/^[a-z0-9][\w.-]*\//iu,w=/-v\d+:\d+$/u,x=/:\d+$/u,y=/@[\w-]+$/u,z=/-\d{8}$/u;function A(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,s.test(c)&&(c=c.replace(s,""),d="bedrock"),t.test(c)&&(c=c.replace(t,""),d??="bedrock"),w.test(c)?(c=c.replace(w,""),d??="bedrock"):x.test(c)&&(c=c.replace(x,""),d??="bedrock"),y.test(c)&&(c=c.replace(y,""),d??="vertex"),u.test(c)?c=c.replace(u,""):v.test(c)&&(c=c.replace(v,"")),{id:c,platform:d}),h=b.byId.get(f);if(void 0!==h)return{entry:h,canonicalId:f,platform:g,raw:a};if(z.test(f)){let c=f.replace(z,""),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 B=r("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"}}),C=["bedrock","vertex","foundry"];B.model("claude-fable-5-1",{name:"Claude Fable 5.1",ctx:1e6,maxOut:128e3,capability:"reasoning",price:h(10,50,.25),on:[...C]}),B.model("claude-fable-5",{name:"Claude Fable 5",capability:"reasoning",price:h(10,50,1),on:[...C]}),B.model("claude-opus-5",{name:"Claude Opus 5",ctx:1e6,maxOut:128e3,capability:"reasoning",price:h(5,25,.5),on:[...C]}),B.model("claude-opus-4-8",{name:"Claude Opus 4.8",capability:"reasoning",price:h(5,25,.5),on:[...C]}),B.model("claude-opus-4-7",{name:"Claude Opus 4.7",capability:"reasoning",price:h(5,25,.5),on:[...C]}),B.model("claude-opus-4-6",{name:"Claude Opus 4.6",capability:"reasoning",price:h(5,25,.5),on:[...C]}),B.model("claude-opus-4-5",{name:"Claude Opus 4.5",capability:"reasoning",price:h(5,25,.5),on:[...C]}),B.model("claude-opus-4-1",{name:"Claude Opus 4.1",capability:"reasoning",price:h(15,75,1.5),on:[...C]}),B.model("claude-sonnet-5",{name:"Claude Sonnet 5",ctx:1e6,maxOut:128e3,capability:"reasoning",price:h(2,10,.2),on:[...C]}),B.model("claude-sonnet-4-6",{name:"Claude Sonnet 4.6",capability:"reasoning",price:h(3,15,.3),on:[...C]}),B.model("claude-sonnet-4-5",{name:"Claude Sonnet 4.5",capability:"reasoning",price:h(3,15,.3),on:[...C]}),B.model("claude-haiku-4-5",{name:"Claude Haiku 4.5",ctx:2e5,maxOut:64e3,capability:null,price:h(1,5,.1),aliases:["claude-haiku-4-5-20251001"],on:[...C]}),B.model("claude-sonnet-3-7",{name:"Claude Sonnet 3.7",on:[...C]});let D={thresholdInputTokens:272e3,input:null,output:null},E=r("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"}}),F=["azure","foundry"];E.model("gpt-5.6-sol",{name:"GPT-5.6 Sol",ctx:105e4,maxOut:128e3,capability:"reasoning",price:i(4,20,{cacheRead:.4,longContext:D}),on:[...F]}),E.model("gpt-5.6-terra",{name:"GPT-5.6 Terra",ctx:105e4,maxOut:128e3,capability:"reasoning",price:i(2,12,{cacheRead:.2,longContext:D}),on:[...F]}),E.model("gpt-5.6-luna",{name:"GPT-5.6 Luna",ctx:105e4,maxOut:128e3,capability:null,price:i(.2,1.2,{cacheRead:.02,longContext:D}),on:[...F]}),E.model("gpt-5.5",{name:"GPT-5.5",ctx:105e4,maxOut:128e3,capability:"reasoning",price:i(5,30,{cacheRead:.5,longContext:D}),on:[...F]}),E.model("gpt-5.4",{name:"GPT-5.4",ctx:105e4,maxOut:128e3,capability:"reasoning",price:i(2.5,15,{cacheRead:.25,longContext:D}),on:[...F]}),E.model("gpt-5.4-mini",{name:"GPT-5.4 mini",ctx:4e5,maxOut:128e3,capability:null,price:i(.75,4.5,{cacheRead:.075}),on:[...F]}),E.model("gpt-5.4-nano",{name:"GPT-5.4 nano",ctx:4e5,maxOut:128e3,capability:null,price:i(.2,1.25,{cacheRead:.02}),on:[...F]}),E.model("gpt-5.3-codex",{name:"GPT-5.3 Codex",ctx:4e5,maxOut:128e3,capability:"code",price:i(1.75,14,{cacheRead:.175}),on:[...F]}),E.model("gpt-5.1",{name:"GPT-5.1",ctx:4e5,maxOut:128e3,capability:"reasoning",price:i(1.25,10,{cacheRead:.125}),on:[...F]}),E.model("gpt-5",{name:"GPT-5",ctx:4e5,maxOut:128e3,capability:"reasoning",price:i(1.25,10,{cacheRead:.125}),on:[...F]}),E.model("gpt-5-mini",{name:"GPT-5 mini",ctx:4e5,capability:null,price:i(.25,2,{cacheRead:.025}),on:[...F]}),E.model("gpt-5-nano",{name:"GPT-5 nano",ctx:4e5,maxOut:128e3,capability:null,price:i(.05,.4,{cacheRead:.005}),on:[...F]}),E.model("gpt-4.1",{name:"GPT-4.1",price:i(2,8,{cacheRead:.5}),on:[...F]}),E.model("gpt-4o",{name:"GPT-4o",price:i(2.5,10,{cacheRead:1.25}),on:[...F]}),E.model("gpt-4o-mini",{name:"GPT-4o mini",price:i(.15,.6,{cacheRead:.075}),on:[...F]}),E.model("gpt-4-turbo",{name:"GPT-4 Turbo",seen:"discovered",price:i(10,30),aliases:["gpt-4-turbo-2024-04-09"],on:[...F]}),E.model("o3",{name:"o3",capability:"reasoning",price:i(2,8,{cacheRead:.5}),on:[...F]}),E.model("gpt-oss-120b",{name:"GPT-OSS 120B",openWeights:!0,firstParty:!1,retention:"unknown",defaultHosting:"local",on:["together","fireworks","groq","openrouter","bedrock","ollama","local"]}),E.model("gpt-oss-20b",{name:"GPT-OSS 20B",openWeights:!0,firstParty:!1,retention:"unknown",defaultHosting:"local",on:["together","fireworks","groq","openrouter","ollama","local"]});let G=r("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"}});G.model("gemini-3.7-flash",{name:"Gemini 3.7 Flash",capability:null,price:i(.75,3.75),on:["vertex"]}),G.model("gemini-3.6-flash",{name:"Gemini 3.6 Flash",capability:null,price:i(.75,3.75),on:["vertex"]}),G.model("gemini-3.5-flash",{name:"Gemini 3.5 Flash",capability:null,price:i(1.5,9),on:["vertex"]}),G.model("gemini-3.5-flash-lite",{name:"Gemini 3.5 Flash Lite",capability:null,price:i(.3,2.5),on:["vertex"]}),G.model("gemini-3.1-pro-preview",{name:"Gemini 3.1 Pro Preview",capability:"reasoning",price:i(2,12,{longContext:{thresholdInputTokens:2e5,input:4,output:18}}),on:["vertex"]}),G.model("gemini-2.5-pro",{name:"Gemini 2.5 Pro",capability:"reasoning",price:i(1.25,10,{longContext:{thresholdInputTokens:2e5,input:2.5,output:15}}),on:["vertex"]}),G.model("gemini-2.5-flash",{name:"Gemini 2.5 Flash",capability:null,price:i(.3,2.5),on:["vertex"]}),G.model("gemini-2.5-flash-lite",{name:"Gemini 2.5 Flash Lite",capability:null,price:i(.1,.4),on:["vertex"]}),G.model("gemini-1-5-pro",{name:"Gemini 1.5 Pro",on:["vertex"]}),G.model("gemini-1-5-flash",{name:"Gemini 1.5 Flash",on:["vertex"]});let H=r("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"}});H.model("grok-4.6",{name:"Grok 4.6",ctx:5e5,capability:"reasoning",price:i(2,6,{cacheRead:.5,longContext:{thresholdInputTokens:2e5,input:4,output:12}}),on:["bedrock"]}),H.model("grok-4.5",{name:"Grok 4.5",ctx:5e5,capability:"reasoning",price:i(2,6,{cacheRead:.3,longContext:{thresholdInputTokens:2e5,input:4,output:12}})}),H.model("grok-4.3",{name:"Grok 4.3",ctx:1e6,capability:"reasoning",price:i(1.25,2.5,{cacheRead:.2,longContext:{thresholdInputTokens:2e5,input:2.5,output:5}}),on:["bedrock"]}),H.model("grok-build-0.1",{name:"Grok Build 0.1",ctx:256e3,capability:"code",price:i(1,2,{cacheRead:.2,longContext:{thresholdInputTokens:2e5,input:2,output:4}})});let I=r("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"}});I.model("deepseek-v4-flash",{name:"DeepSeek V4 Flash",ctx:1e6,capability:null,price:i(.44,1.32,{cacheRead:.014}),on:["bedrock","together","fireworks","openrouter","ollama","local"]}),I.model("deepseek-v4-pro",{name:"DeepSeek V4 Pro",ctx:1e6,capability:"reasoning",price:i(1.32,3.96,{cacheRead:.044}),on:["bedrock","together","fireworks","openrouter"]}),I.model("deepseek-r1",{name:"DeepSeek R1",seen:"discovered",capability:"reasoning",openWeights:!0,defaultHosting:"local",on:["bedrock","together","fireworks","openrouter","ollama","local"]});let J=r("cohere",{family:{id:"command",name:"Command"},region:"us",retention:"configurable",training:{apiDefault:"unknown",consumerDefault:"unknown",consumerControl:"opt-out",source:"https://cohere.com/security"}});J.model("command-a-plus-05-2026",{name:"Command A+",ctx:128e3,maxOut:64e3,on:["bedrock"]}),J.model("command-a-03-2025",{name:"Command A",ctx:256e3,maxOut:8e3,on:["bedrock"]}),J.model("command-a-reasoning-08-2025",{name:"Command A Reasoning",ctx:256e3,maxOut:32e3,capability:"reasoning"}),J.model("command-r-plus-08-2024",{name:"Command R+",ctx:128e3,maxOut:4e3,price:i(2.5,10),aliases:["command-r-plus"],on:["bedrock"]});let K=r("meta",{family:{id:"llama",name:"Llama"},openWeights:!0,retention:"unknown",defaultHosting:"local"}),L=["bedrock","together","fireworks","groq","openrouter","ollama","local"];K.model("llama-3-3-70b",{name:"Llama 3.3 70B",ctx:128e3,on:[...L]}),K.model("llama-3-1-70b",{name:"Llama 3.1 70B",ctx:128e3,on:[...L]}),K.model("llama-3-1-8b",{name:"Llama 3.1 8B",ctx:128e3,on:[...L]});let M=r("alibaba",{family:{id:"qwen",name:"Qwen"},openWeights:!0,retention:"unknown",defaultHosting:"local"});M.model("qwen-3-235b",{name:"Qwen 3 235B",on:[...L]}),M.model("qwen-3-coder-480b",{name:"Qwen 3 Coder 480B",capability:"code",on:[...L]});let N=r("amazon",{family:{id:"nova",name:"Nova"},retention:"configurable"});N.model("nova-2-lite",{name:"Nova 2 Lite",ctx:1e6,maxOut:64e3,aliases:["nova-2-lite-v1:0"],on:["bedrock"]});let O=r("mistral",{family:{id:"mistral",name:"Mistral"},openWeights:!0,retention:"unknown",defaultHosting:"local"});O.model("mixtral-8x7b",{name:"Mixtral 8x7B",seen:"discovered",on:[...L]});let P=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([...B.models(),...E.models(),...G.models(),...H.models(),...I.models(),...J.models(),...O.models(),...K.models(),...M.models(),...N.models()]));f.k5(["reasoning","code"]),f.k5(["zero_retention","no_storage","configurable","on_device","on_infrastructure","unknown"]),f.k5(["managed","discovered"]);let Q=f.k5(["yes","no","unknown"]),R=f.k5(["opt-in","opt-out","none","unknown"]);f.Ik({apiDefault:Q,consumerDefault:Q,consumerControl:R,source:f.Yj().nullable()});let S=f.k5(["api","consumer","enterprise","unknown"]);function T(a){return new Date(a).getTime()}function U(a){return new Date(a).toISOString()}f.Ik({tier:S,controlExercised:f.zM().nullable()}),Object.freeze({tier:"unknown",controlExercised:null});let V={critical:4,high:3,medium:2,low:1};function W(a){let b=new Map,c=new Map;for(let e of a){var d;let a=e.count??1;b.set(e.ruleId,(b.get(e.ruleId)??0)+a);let f=c.get(e.category)??{category:e.category,count:0,categoryCount:0,severity:e.severity,weight:0,ruleId:e.ruleId};f.categoryCount+=a;let g=Object.hasOwn(V,d=e.severity)?V[d]:0;g>f.weight&&(f.weight=g,f.severity=e.severity,f.ruleId=e.ruleId),c.set(e.category,f)}for(let a of c.values())a.count=b.get(a.ruleId)??0;return[...c.values()].sort((a,b)=>b.weight-a.weight||b.categoryCount-a.categoryCount).slice(0,10)}function X(a){return{...Z[a]??{title:`${a} finding`,action:"Review"},advice:Y[a]??"Review this finding against your policy."}}let Y={secret:"Rotate the exposed credentials and move them out of prompts (secrets manager / env vars).",pii:"Remove or mask personal data before it reaches the model.",financial:"Strip card and account numbers; share only non-sensitive references.",phi:"Remove protected health information — it should never reach an external model.",code_context:"Confirm this proprietary code context is safe to share.",code_flaw:"Review the flagged pattern and apply the secure alternative (parameterized queries, safe deserializers, etc.).",config:"Review the setting — a hook conflict or an egress change applies to every session that follows.",custom:"Review against your organization’s custom policy."},Z={secret:{title:"Exposed secret detected",action:"Rotate"},pii:{title:"Personal data in a prompt",action:"Remove"},financial:{title:"Financial data detected",action:"Strip"},phi:{title:"Health information detected",action:"Remove"},code_context:{title:"Proprietary code shared",action:"Review"},code_flaw:{title:"Insecure code pattern",action:"Fix"},config:{title:"Weakened configuration",action:"Review"},custom:{title:"Custom policy match",action:"Review"}},$=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 _(a){return $.get(a.trim().toLowerCase())??null}function aa(a){let b=_(a);return null!==b&&"local"===m(b)}Object.freeze(["gateway","unknown","cli","api"]);let ab={normalizeModelId(a,b){let c=a.trim().toLowerCase();if(aa(c))return{provider:c,model:"*"};let d=A(b,P);return{provider:c,model:d.entry?.id??b}},costFor({provider:a,model:b,usage:c}){let d=function(a,b){if(aa(a))return j;let c=A(b,P);if(null===c.entry)return null;let d=c.platform??_(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:k.get(c)??1),j=b.webSearchRequests??0;return j>0&&null===a.webSearch?null:i+j*(a.webSearch??0)}(d,c)}};new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1});let ac=a=>a??0;function ad(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+=ac(e.input_tokens),i.output+=ac(e.output_tokens),i.cacheCreation+=ac(e.cache_creation_input_tokens),i.cacheRead+=ac(e.cache_read_input_tokens);let j=b.costFor({provider:a,model:f,usage:function(a){let b={inputTokens:ac(a.input_tokens),outputTokens:ac(a.output_tokens),cacheWrite1hTokens:ac(a.ephemeral_1h_input_tokens),cacheWrite5mTokens:ac(a.ephemeral_5m_input_tokens),cacheReadTokens:ac(a.cache_read_input_tokens),webSearchRequests:ac(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 ae(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 af=c(2739),ag=c(84441);let ah={ClaudeCode:"claudecode",Cursor:"cursor",Copilot:"copilot",Codex:"codex",Antigravity:"antigravity",Windsurf:"windsurf",ClaudeDesktop:"claudedesktop",ChatGpt:"chatgpt",ClaudeAi:"claudeai",Api:"api"},ai=f.k5(ah).meta({id:"Harness"}),aj={ClaudeCode:"claude-code",ClaudeDesktop:"claude-desktop",Cursor:"cursor",ChatGpt:"chatgpt",ClaudeAi:"claude-ai",Copilot:"github-copilot",Codex:"codex",Antigravity:"antigravity",Cli:"cli",Unknown:"unknown"},ak=f.k5(aj).meta({id:"SourceTool"}),al={[aj.ClaudeCode]:ah.ClaudeCode,[aj.ClaudeDesktop]:ah.ClaudeDesktop,[aj.Copilot]:ah.Copilot,[aj.Cursor]:ah.Cursor,[aj.ChatGpt]:ah.ChatGpt,[aj.Codex]:ah.Codex,[aj.Antigravity]:ah.Antigravity,[aj.ClaudeAi]:ah.ClaudeAi},am=f.k5(["pii","financial","secret","phi","code_context","code_flaw","custom","config"]).meta({id:"DetectionCategory"}),an=f.k5(["critical","high","medium","low"]).meta({id:"Severity"}),ao=f.k5(["warn","redact","block","allow","log"]).meta({id:"ActionTaken"}),ap=ao.options,aq=f.Ik({start:f.ai().int().nonnegative(),end:f.ai().int().nonnegative()}).meta({id:"Span"});f.Ik({id:f.Os(),eventId:f.Os(),ruleId:f.Yj(),category:am,severity:an,span:aq,maskedMatch:f.Yj(),actionTaken:ao,confidence:f.ai().min(0).max(1)}).meta({id:"Finding"}).meta({id:"DetectedFinding"});let ar=f.k5(["blocked","redacted","warned","allowed","quarantined","monitored"]).meta({id:"FindingAction"}),as=ai.extract(["ClaudeCode","ClaudeDesktop","Cursor","Copilot","ChatGpt","ClaudeAi","Codex","Antigravity","Api"]).meta({id:"FindingProvider"}),at=f.k5(["secret","pii","source_code","code_flaw","external_share","mcp_server","customer_data","financial","phi","custom"]).meta({id:"FindingCategory"});f.k5(["in-flight","at-rest"]).meta({id:"FindingOrigin"});let au=f.k5(["open","handled","resolved","dismissed"]).meta({id:"FindingStatus"}),av=f.k5(["deployment_refused","payload_invalid","detached_undelivered"]).meta({id:"SyncFailureReason"}),aw=f.k5(["sent","queued","not_sent","never_offered","local_scan"]).meta({id:"FindingDeliveryState"}),ax=f.Ik({state:aw,at:af.w$().optional(),reason:av.optional()}).meta({id:"FindingDelivery"}),ay=f.k5(["enforced-in-flight","fixed-at-source","exception","acknowledged","false-positive","redetected"]).meta({id:"ResolutionMethod"}),az=f.Ik({maskedValue:f.Yj(),contextPrefix:f.Yj()}).meta({id:"FindingMatch"}),aA=f.Ik({id:f.Yj(),name:f.Yj().nullable()}).meta({id:"FindingDetectionRef"}),aB=f.Ik({id:f.Yj(),name:f.Yj()}).meta({id:"FindingPolicyRef"}),aC=f.Ik({id:f.Yj(),name:f.Yj()}).meta({id:"FindingUser"}),aD=f.Ik({id:f.Yj(),provider:as,repo:f.Yj(),file:f.Yj(),user:aC.optional(),toolName:f.Yj().optional(),action:ar,detectedAt:af.w$(),confidence:f.ai().min(0).max(1),status:au.optional(),eventId:f.Yj().optional(),sessionId:f.Yj().optional(),delivery:ax.optional()}).meta({id:"FindingInstance"}),aE=f.Ik({id:f.Yj(),category:at,subtype:f.Yj(),severity:an,match:az,detection:aA,policy:aB,instanceCount:f.ai().int().nonnegative(),providers:f.YO(as),aggregateAction:ar.nullable(),latestDetectedAt:af.w$(),instances:f.YO(aD),status:au.optional(),users:f.YO(aC).optional()}).meta({id:"FindingGroup"});f.Ik({findings:f.ai().int().nonnegative(),groups:f.ai().int().nonnegative(),bySeverity:f.Ik({critical:f.ai().int().nonnegative(),high:f.ai().int().nonnegative(),medium:f.ai().int().nonnegative(),low:f.ai().int().nonnegative()})}).meta({id:"FindingStats"});let aF=f.Ik({value:f.Yj(),count:f.ai().int().nonnegative()}).meta({id:"FindingFacetItem"}),aG=f.Ik({severity:f.YO(aF),subtype:f.YO(aF),provider:f.YO(aF),action:f.YO(aF),status:f.YO(aF),tool:f.YO(aF).optional(),deployment:f.YO(aF).optional()}).meta({id:"FindingFacets"}),aH=aE.omit({instances:!0,match:!0}).meta({id:"FindingTypeSummary"}),aI=50;f.Ik({severity:f.YO(an).optional(),subtype:f.YO(f.Yj()).optional(),provider:f.YO(as).optional(),action:f.YO(ar).optional(),status:f.YO(au).optional(),q:f.Yj().optional(),sessionId:f.Yj().optional(),from:af.w$().optional(),includeId:f.Yj().optional(),limit:ag.ai().int().min(1).max(100).optional(),cursor:f.Yj().optional()}),f.Ik({totals:f.Ik({findings:f.ai().int().nonnegative(),types:f.ai().int().nonnegative()}),facets:aG,items:f.YO(aH),nextCursor:f.Yj().nullable(),sessionFirings:f.g1(f.Yj(),f.ai().int().nonnegative()).optional()}).meta({id:"ListFindingTypesResponse"}),f.Ik({action:ar.exclude(["quarantined"]),instanceId:f.Yj().optional()}).meta({id:"ApplyFindingActionRequest"}),aE.meta({id:"ApplyFindingActionResponse"}),f.Ik({severity:f.YO(an).optional(),subtype:f.YO(f.Yj()).optional(),provider:f.YO(as).optional(),action:f.YO(ar).optional(),q:f.Yj().optional(),format:f.k5(["csv","json"]).optional()});let aJ=aD.extend({groupId:f.Yj(),category:at,subtype:f.Yj(),severity:an,match:az,detection:aA,policy:aB}).meta({id:"FindingInstanceDetail"}),aK=50;f.Ik({severity:f.YO(an).optional(),subtype:f.YO(f.Yj()).optional(),provider:f.YO(as).optional(),action:f.YO(ar).optional(),status:f.YO(au).optional(),tool:f.YO(f.Yj()).optional(),deployment:f.YO(aw).optional(),repo:f.Yj().optional(),file:f.Yj().optional(),q:f.Yj().optional(),sessionId:f.Yj().optional(),from:af.w$().optional(),limit:ag.ai().int().min(1).max(200).optional(),cursor:f.Yj().optional()}),f.Ik({totals:f.Ik({findings:f.ai().int().nonnegative()}),facets:aG,items:f.YO(aJ),nextCursor:f.Yj().nullable()}).meta({id:"ListFindingInstancesResponse"}),f.Ik({items:f.YO(aJ),nextCursor:f.Yj().nullable()}).meta({id:"ListFindingInstancesPage"});let aL=f.Ik({id:f.Yj(),repo:f.Yj(),file:f.Yj(),instanceCount:f.ai().int().nonnegative(),maxSeverity:an,latestDetectedAt:af.w$(),status:au.optional(),ruleIds:f.YO(f.Yj())}).meta({id:"FindingLocationSummary"}),aM=50;f.Ik({severity:f.YO(an).optional(),subtype:f.YO(f.Yj()).optional(),provider:f.YO(as).optional(),action:f.YO(ar).optional(),status:f.YO(au).optional(),tool:f.YO(f.Yj()).optional(),deployment:f.YO(aw).optional(),q:f.Yj().optional(),sessionId:f.Yj().optional(),from:af.w$().optional(),includeId:f.Yj().optional(),limit:ag.ai().int().min(1).max(100).optional(),cursor:f.Yj().optional()}),f.Ik({totals:f.Ik({findings:f.ai().int().nonnegative(),locations:f.ai().int().nonnegative()}),facets:aG,items:f.YO(aL),nextCursor:f.Yj().nullable()}).meta({id:"ListFindingLocationsResponse"});let aN=f.k5(["host","harness","user","skill","hook","mcp_server","config_file"]).meta({id:"InventoryObjectType"}),aO=f.k5(["session","run","tool_call","llm_call","source_lookup","prompt","response","code_change","tool_use","model_refusal","config_scan"]).meta({id:"AuditEventType"}),aP=f.g1(f.Yj(),f.L5());f.Ik({host_name:f.Yj().optional(),os:f.Yj().optional(),os_version:f.Yj().optional(),arch:f.Yj().optional()}).catchall(f.L5()),f.Ik({harness_version:f.Yj().optional(),interface:f.Yj().optional()}).catchall(f.L5()),f.Ik({display_name:f.Yj().optional(),email:f.Yj().optional()}).catchall(f.L5()),f.Ik({source:f.Yj().optional(),version:f.Yj().optional(),description:f.Yj().optional(),updated_at:f.Yj().optional(),scope:f.Yj().optional(),plugin_name:f.Yj().optional()}).catchall(f.L5()),f.Ik({event:f.Yj().optional(),matcher:f.Yj().optional(),command:f.Yj().optional(),scope:f.Yj().optional(),plugin_name:f.Yj().optional(),timeout:f.ai().optional()}).catchall(f.L5()),f.Ik({scope:f.Yj().optional(),transport:f.Yj().optional(),command:f.Yj().optional(),url:f.Yj().optional(),env_keys:f.YO(f.Yj()).optional(),plugin_name:f.Yj().optional(),marketplace:f.Yj().optional(),project:f.Yj().optional()}).catchall(f.L5()),f.Ik({kind:f.Yj().optional(),detail:f.Yj().optional(),scope:f.Yj().optional(),updated_at:f.Yj().optional(),entry_count:f.ai().optional()}).catchall(f.L5());let aQ=f.Ik({model:f.Yj().optional(),provider:f.Yj().optional(),input_tokens:f.ai().int().nonnegative().optional(),output_tokens:f.ai().int().nonnegative().optional(),cache_creation_input_tokens:f.ai().int().nonnegative().optional(),cache_read_input_tokens:f.ai().int().nonnegative().optional(),ephemeral_1h_input_tokens:f.ai().int().nonnegative().optional(),ephemeral_5m_input_tokens:f.ai().int().nonnegative().optional(),web_search_requests:f.ai().int().nonnegative().optional(),web_fetch_requests:f.ai().int().nonnegative().optional(),service_tier:f.Yj().optional(),stop_reason:f.Yj().optional(),message_id:f.Yj().optional(),uuid:f.Yj().optional(),parent_uuid:f.Yj().optional(),run_key:f.Yj().optional()}).catchall(f.L5());f.Ik({sessionId:f.Yj().min(1),messageId:f.Yj().min(1),parentId:f.Yj().min(1),rootSessionId:f.Yj().min(1),startedAt:af.w$(),attributes:aQ});let aR=f.Ik({tool_name:f.Yj().optional(),tool_use_id:f.Yj().optional(),target:f.Yj().optional(),is_error:f.zM().optional(),input_size:f.ai().int().nonnegative().optional(),output_size:f.ai().int().nonnegative().optional(),uuid:f.Yj().optional(),parent_uuid:f.Yj().optional(),run_key:f.Yj().optional()}).catchall(f.L5());f.Ik({source_tool:f.Yj().optional(),file_path:f.Yj().optional(),repo:f.Yj().optional(),tool_name:f.Yj().optional(),gitignored:f.zM().optional(),whole_file:f.zM().optional(),correlation_id:f.uR().optional(),trace_id:f.Yj().regex(/^[0-9a-f]{32}$/).optional(),exception_ids:f.YO(f.Os()).optional(),message_id:f.Yj().optional(),conversation_id:f.Yj().optional(),inspection_ms:f.ai().int().nonnegative().optional(),redact_degraded_to:ao.optional()}).catchall(f.L5());let aS=f.Ik({ruleId:f.Yj().min(1),ruleName:f.Yj(),ruleVersion:f.Yj().min(1),category:am,severity:an,span:aq,maskedMatch:f.Yj(),actionTaken:ao,confidence:f.ai().min(0).max(1)});f.Ik({sessionId:f.Yj().min(1),toolUseId:f.Yj().min(1),parentId:f.Yj().min(1),rootSessionId:f.Yj().min(1),startedAt:af.w$(),attributes:aR,inspections:f.YO(aS).default([])});let aT=f.Ik({objectType:aN,identityKey:f.Yj().min(1),location:f.Yj().optional(),title:f.Yj().optional(),hostId:f.Yj().optional(),attributes:aP.default({})}).meta({id:"InventoryInput"}),aU=f.Ik({url:f.Yj().min(1),name:f.Yj().optional(),attributes:aP.default({})}).meta({id:"SourceProjectInput"}),aV=f.Ik({id:f.Yj().min(1),eventType:aO,startedAt:af.w$(),endedAt:af.w$().optional(),parentId:f.Yj().optional(),rootSessionId:f.Yj().optional(),hostId:f.Yj().optional(),harnessId:f.Yj().optional(),sourceProjectId:f.Yj().optional(),severity:an.optional(),priority:f.Yj().optional(),content:f.Yj().optional(),contentHash:f.Yj().optional(),attributes:aP.optional()}).meta({id:"AuditEventInput"});f.Ik({class:f.Yj().min(1),label:f.Yj().optional(),attributes:aP.optional()});let aW=f.Ik({ruleId:f.Yj().min(1),version:f.Yj().min(1),name:f.Yj(),category:am,severity:an,definition:f.Yj()});f.Ik({id:f.Yj().min(1),auditEventId:f.Yj().min(1),inspectionDefinitionId:f.Yj().min(1),classifiedDataId:f.Yj().optional(),span:aq,maskedMatch:f.Yj(),actionTaken:ao,confidence:f.ai().min(0).max(1),findingKey:f.Yj().optional(),firstDetectedAt:af.w$().optional()}),f.Ik({host:aT.optional(),harness:aT.optional(),project:aU.optional()}).meta({id:"InventoryContext"}),f.Ik({hostId:f.Yj().optional(),harnessId:f.Yj().optional(),accountId:f.Yj().optional(),sourceProjectId:f.Yj().optional()}).meta({id:"ResolvedInventory"}),f.Ik({hosts:f.YO(f.Yj()),harnesses:f.YO(f.Yj()),osVersions:f.YO(f.Yj()),projects:f.YO(f.Yj())}).meta({id:"InventoryFacets"});let aX=f.Ik({sessionId:f.Yj(),model:f.Yj(),provider:f.Yj(),inputTokens:f.ai().int().nonnegative(),outputTokens:f.ai().int().nonnegative(),cacheCreation:f.ai().int().nonnegative(),cacheRead:f.ai().int().nonnegative(),totalTokens:f.ai().int().nonnegative(),estimatedCostUsd:f.ai().nullable()}).meta({id:"TokenRollup"});f.Ik({sessionId:f.Yj(),rollups:f.YO(aX),totalTokens:f.ai().int().nonnegative(),estimatedCostUsd:f.ai().nullable(),costIsPartial:f.zM()});let aY=f.Ik({provider:f.Yj(),model:f.Yj(),inputTokens:f.ai().int().nonnegative(),outputTokens:f.ai().int().nonnegative(),cacheTokens:f.ai().int().nonnegative(),totalTokens:f.ai().int().nonnegative(),estimatedCostUsd:f.ai().nullable()});function aZ(a){return JSON.stringify(a)}f.Ik({models:f.YO(aY),sessionCount:f.ai().int().nonnegative(),totalTokens:f.ai().int().nonnegative(),estimatedCostUsd:f.ai(),costIsPartial:f.zM()});let a$=f.k5(["active","completed","interrupted","error"]),a_=f.k5(["session","prompt","response","tool","hook","detection","share","permission","commit","error","active"]),a0=f.k5(["detections","shares","inventory"]),a1=f.Ik({id:f.Yj(),occurredAt:af.w$(),kind:a_,title:f.Yj(),detail:f.Yj(),tool:f.Yj().nullable(),severity:an.nullable(),link:a0.nullable(),targetId:f.Yj().nullable(),internal:f.zM(),flagged:f.zM(),bodyExpired:f.zM().default(!1)}).meta({id:"ActivityAuditEvent"}),a2=f.Ik({id:f.Yj(),harness:ai,title:f.Yj(),project:f.Yj(),repo:f.Yj(),branches:f.YO(f.Yj()),startedAt:af.w$(),endedAt:af.w$().nullable(),status:a$,turns:f.ai().int().nonnegative(),findings:f.ai().int().nonnegative(),shares:f.ai().int().nonnegative()}).meta({id:"ActivitySessionSummary"});a2.extend({host:f.Yj(),cwd:f.Yj(),models:f.YO(f.Yj()),version:f.Yj(),tokens:aX,tools:f.g1(f.Yj(),f.ai().int().nonnegative()),files:f.YO(f.Yj()),commits:f.ai().int().nonnegative(),events:f.YO(a1)}).meta({id:"ActivitySession"}),f.Ik({tz:f.Yj().optional()});let a3=f.Ik({sessionsToday:f.ai().int().nonnegative(),liveNow:f.ai().int().nonnegative(),toolCallsToday:f.ai().int().nonnegative(),findingsToday:f.ai().int().nonnegative(),egressToday:f.ai().int().nonnegative()}).meta({id:"GetActivityStatsResponse"});f.Ik({q:f.Yj().optional(),harness:f.YO(ai).optional(),from:f.KC([af.p6(),af.w$()]).optional(),to:f.KC([af.p6(),af.w$()]).optional(),excludeEmpty:f.uE().optional(),limit:ag.ai().int().min(1).max(100).default(50),cursor:f.Yj().optional()});let a4=f.Ik({items:f.YO(a2),nextCursor:f.Yj().nullable(),emptyCount:f.ai().int().nonnegative()}).meta({id:"ListActivitySessionsResponse"});f.Ik({limit:ag.ai().int().min(1).max(500).default(100),cursor:f.Yj().optional(),order:f.k5(["asc","desc"]).default("asc")}),f.Ik({items:f.YO(a1),nextCursor:f.Yj().nullable()}).meta({id:"ListSessionEventsResponse"}),f.Ik({format:f.k5(["ndjson","json"]).default("ndjson")}),f.Ik({format:f.k5(["csv","json"]).default("csv"),q:f.Yj().optional(),harness:f.YO(ai).optional(),from:f.KC([af.p6(),af.w$()]).optional(),to:f.KC([af.p6(),af.w$()]).optional()}),f.Ik({stats:a3,sessions:a4}).meta({id:"ActivityOverviewResponse"});let a5=f.k5(["user","project","local","plugin"]),a6=f.Ik({name:f.Yj().min(1),source:f.Yj().min(1),scope:a5,pluginName:f.Yj().optional(),version:f.Yj().optional(),description:f.Yj().optional(),updatedAt:af.w$().optional(),location:f.Yj().optional()}),a7=f.Ik({event:f.Yj().min(1),matcher:f.Yj().optional(),command:f.Yj().min(1),timeout:f.ai().optional(),scope:a5,pluginName:f.Yj().optional(),location:f.Yj().optional()}),a8=f.Ik({name:f.Yj().min(1),scope:a5,pluginName:f.Yj().optional(),marketplace:f.Yj().optional(),project:f.Yj().optional(),transport:f.Yj().min(1),command:f.Yj().optional(),url:f.Yj().optional(),envKeys:f.YO(f.Yj()).optional(),location:f.Yj().optional()}),a9=f.Ik({name:f.Yj().min(1),path:f.Yj().min(1),scope:a5,kind:f.Yj().min(1),detail:f.Yj().optional(),entryCount:f.ai().optional(),updatedAt:af.w$().optional()});f.Ik({scannedAt:af.w$(),skills:f.YO(a6),hooks:f.YO(a7),mcpServers:f.YO(a8),configFiles:f.YO(a9),errors:f.YO(f.Ik({source:f.Yj(),reason:f.Yj()}))});let ba=f.Ik({ruleId:f.Yj().min(1),version:f.Yj().min(1),span:aq,maskedMatch:f.Yj(),actionTaken:ao,confidence:f.ai().min(0).max(1)});f.Ik({items:f.YO(aT),scanEvent:aV,definitions:f.YO(aW).optional(),findings:f.YO(ba).optional()});let bb=f.k5(["project","skill","mcp","hook","config"]).meta({id:"AssetType"}),bc=f.k5(["open","approved","blocked"]).meta({id:"AccessLevel"}),bd=f.k5(["source","public-dep","vendored","config","data","docs","generated"]).meta({id:"Origin"}),be=f.k5(["known-good","risky","unapproved"]).meta({id:"TrustLevel"}),bf=f.k5(["update","stale","conflict","unknown","change","untracked","risk","findings"]).meta({id:"Flag"}),bg=f.k5(["public","private"]).meta({id:"Visibility"}),bh=f.k5(["block","redact","warn"]).meta({id:"HarnessEventKind"}),bi=ai.extract(["ClaudeCode","Cursor","Codex","Antigravity"]).meta({id:"HarnessId"}),bj=f.Ik({open:f.ai().int().nonnegative(),approved:f.ai().int().nonnegative(),blocked:f.ai().int().nonnegative(),total:f.ai().int().nonnegative()}).meta({id:"AccessCounts"}),bk=f.Ik({id:f.Yj(),type:bb,name:f.Yj(),sub:f.Yj(),flags:f.YO(bf),trust:be.optional()}).meta({id:"AssetSummary"}),bl=f.Ik({id:f.Yj(),name:f.Yj(),repo:f.Yj(),visibility:bg,language:f.Yj(),policyDefault:bc,updatedAt:af.w$(),accessCounts:bj,findingsCount:f.ai().int().nonnegative()}).meta({id:"ProjectSummary"}),bm=f.Ik({type:bb,assets:f.YO(bk)}),bn=f.Ik({id:bi,label:f.Yj(),kind:f.Yj(),version:f.Yj(),sessions:f.ai().int().nonnegative(),assetCount:f.ai().int().nonnegative(),flagCount:f.ai().int().nonnegative(),projects:f.YO(bl),categories:f.YO(bm)}).meta({id:"HarnessSummary"});f.Ik({items:f.YO(bn)}).meta({id:"ListHarnessesResponse"});let bo=f.Ik({type:bb,total:f.ai().int().nonnegative(),trustRollup:f.Ik({"known-good":f.ai().int().nonnegative(),risky:f.ai().int().nonnegative(),unapproved:f.ai().int().nonnegative()}).partial().strict().optional(),flagRollup:f.Ik({update:f.ai().int().nonnegative(),stale:f.ai().int().nonnegative(),conflict:f.ai().int().nonnegative(),unknown:f.ai().int().nonnegative(),change:f.ai().int().nonnegative(),untracked:f.ai().int().nonnegative(),risk:f.ai().int().nonnegative(),findings:f.ai().int().nonnegative()}).partial().strict(),items:f.YO(bk)}).meta({id:"AssetGroup"});f.Ik({groups:f.YO(bo)}).meta({id:"ListAssetsResponse"});let bp=f.Ik({name:f.Yj(),signature:f.Yj(),description:f.Yj(),write:f.zM(),risk:f.Yj().nullable()}).meta({id:"McpTool"}),bq=f.Ik({id:f.Yj(),title:f.Yj(),note:f.Yj()});bk.extend({description:f.Yj().nullable(),trust:be.nullable(),meta:f.g1(f.Yj(),f.L5()),finding:bq.nullable(),tools:f.YO(bp).optional()}).meta({id:"AssetDetail"}),f.Ik({items:f.YO(bl)}).meta({id:"ListProjectsResponse"}),f.Ik({attention:f.ai().int().nonnegative(),byType:f.Ik({project:f.ai().int().nonnegative(),skill:f.ai().int().nonnegative(),mcp:f.ai().int().nonnegative(),hook:f.ai().int().nonnegative(),config:f.ai().int().nonnegative()}),harnesses:f.ai().int().nonnegative(),mcpTrust:f.Ik({"known-good":f.ai().int().nonnegative(),risky:f.ai().int().nonnegative(),unapproved:f.ai().int().nonnegative()})}).meta({id:"InventoryStats"});let br=f.Ik({path:f.Yj(),name:f.Yj(),origin:bd,access:bc,isCustom:f.zM(),findings:f.ai().int().nonnegative(),blockedAt:af.w$().nullable().optional(),note:f.Yj().nullable().optional()}).meta({id:"FileSummary"}),bs=f.Ik({name:f.Yj(),path:f.Yj(),accessCounts:bj}).meta({id:"FolderSummary"});f.Ik({project:f.Ik({id:f.Yj(),repo:f.Yj(),visibility:bg}),path:f.Yj(),folders:f.YO(bs).optional(),files:f.YO(br)}).meta({id:"ProjectTreeResponse"}),br.extend({project:f.Ik({repo:f.Yj(),visibility:bg,language:f.Yj(),policyDefault:bc,updatedAt:af.w$()}),findingsRefs:f.YO(f.Ik({id:f.Yj(),title:f.Yj()}))}).meta({id:"FileDetail"}),f.Ik({path:f.Yj(),access:bc}).meta({id:"SetFileAccessBody"}),f.Ik({file:br,accessCounts:bj}).meta({id:"SetFileAccessResponse"}),f.Ik({trust:be}).meta({id:"SetMcpTrustBody"});let bt=f.Ik({kind:bh,title:f.Yj(),detail:f.Yj(),occurredAt:af.w$(),findingId:f.Yj().nullable().optional()}).meta({id:"HarnessEventItem"});f.Ik({counts:f.Ik({block:f.ai().int().nonnegative(),redact:f.ai().int().nonnegative(),warn:f.ai().int().nonnegative()}),items:f.YO(bt)}).meta({id:"HarnessEventsResponse"}),f.Ik({jobId:f.Yj(),startedAt:af.w$()}).meta({id:"RescanResponse"}),f.Ik({repo:f.Yj()}).meta({id:"ConnectProjectBody"}),f.Ik({type:f.YO(bb).optional(),q:f.Yj().optional()}),f.Ik({path:f.Yj().optional(),q:f.Yj().optional(),filter:f.k5(["blocked"]).optional()}),f.Ik({path:f.Yj()}),f.Ik({limit:ag.ai().int().min(1).max(50).default(7)});let bu=f.k5(["provider","internal","external","ip"]).meta({id:"DestinationKind"}),bv=f.k5(["https","http","sftp","grpc","smtp","ws","wss"]).meta({id:"Transport"}),bw=f.k5(["secrets","pii","customer","source","telemetry","logs","metrics","none"]).meta({id:"DataClass"}),bx=bw.options,by=f.k5(["recognized","internal","unverified","ip"]).meta({id:"ShareTrustLevel"}),bz=f.k5(["allow","block"]).meta({id:"EgressDecision"}),bA=f.k5(["allowed","blocked","review"]).meta({id:"EgressStatus"}),bB=f.k5(["raw_ip","unverified_domain","plaintext_transport"]).meta({id:"ReviewReason"}),bC=f.k5(["GET","POST","PUT","DELETE","SDK","REF"]).meta({id:"HttpMethod"}),bD=f.Ik({needsReview:f.zM(),reasons:f.YO(bB)}).meta({id:"ReviewInfo"}),bE=f.Ik({port:f.ai().int().nullable(),geo:f.Yj().nullable(),ptr:f.Yj().nullable()}).meta({id:"DestinationNetwork"}),bF=f.Ik({id:f.Yj(),method:bC,transport:bv,url:f.Yj(),template:f.zM(),dataClass:bw,lastSeen:af.w$(),callSiteCount:f.ai().int().nonnegative()}).meta({id:"EndpointSummary"}),bG=f.Ik({id:f.Yj(),project:f.Yj(),file:f.Yj(),line:f.ai().int().nonnegative(),snippet:f.Yj(),dynamic:f.zM(),vendored:f.zM(),projectId:f.Yj().nullable()}).meta({id:"CallSite"}),bH=bF.extend({sites:f.YO(bG)}).meta({id:"EndpointWithSites"}),bI=f.Ik({id:f.Yj(),kind:bu,name:f.Yj(),host:f.Yj(),category:f.Yj(),trust:by,status:bA,isCustom:f.zM(),lastSeen:af.w$(),endpointCount:f.ai().int().nonnegative(),callSiteCount:f.ai().int().nonnegative(),transports:f.YO(bv),dataClasses:f.YO(bw),review:bD,network:bE.nullable(),endpoints:f.YO(bF)}).meta({id:"ShareDestinationSummary"});bI.omit({endpointCount:!0,callSiteCount:!0,endpoints:!0}).extend({note:f.Yj().nullable(),endpoints:f.YO(bH)}).meta({id:"ShareDestinationDetail"});let bJ=f.Ik({id:f.Yj(),kind:bu,name:f.Yj(),host:f.Yj(),trust:by,status:bA,review:bD,topDataClass:bw,callSiteCount:f.ai().int().nonnegative(),lastSeen:af.w$()}).meta({id:"ReviewDestination"}),bK=f.Ik({kind:bu,total:f.ai().int().nonnegative(),items:f.YO(bI)}).meta({id:"ShareDestinationGroup"});f.Ik({groups:f.YO(bK)}).meta({id:"ListShareDestinationsResponse"}),f.Ik({items:f.YO(bJ)}).meta({id:"NeedsReviewResponse"}),f.Ik({destinations:f.ai().int().nonnegative(),endpoints:f.ai().int().nonnegative(),callSites:f.ai().int().nonnegative(),needsReview:f.ai().int().nonnegative(),insecure:f.ai().int().nonnegative(),byKind:f.Ik({provider:f.ai().int().nonnegative(),internal:f.ai().int().nonnegative(),external:f.ai().int().nonnegative(),ip:f.ai().int().nonnegative()}),byTrust:f.Ik({recognized:f.ai().int().nonnegative(),internal:f.ai().int().nonnegative(),unverified:f.ai().int().nonnegative(),ip:f.ai().int().nonnegative()})}).meta({id:"SharesStats"}),f.Ik({decision:bz.nullable()}).meta({id:"SetEgressDecisionBody"}),f.Ik({destination:bI}).meta({id:"SetEgressDecisionResponse"}),f.Ik({q:f.Yj().optional(),kind:f.YO(bu).optional(),groupBy:f.k5(["destination"]).default("destination"),review:f.uE().default(!1)}),f.Ik({format:f.k5(["csv","json"]).default("csv"),q:f.Yj().optional(),kind:f.YO(bu).optional()});let bL=f.k5(["npm","pypi","go","maven","rubygems","cargo","composer","nuget"]).meta({id:"EgressEcosystem"});f.Ik({id:f.Yj(),name:f.Yj(),category:f.Yj(),hostSuffixes:f.YO(f.Yj()).min(1),apiBase:f.Yj(),defaultDataClasses:f.YO(bw).min(1),sdks:f.jg(bL,f.YO(f.Yj()))}).meta({id:"ProviderRegistryEntry"});let bM=f.Ik({file:f.Yj(),line:f.ai().int().positive(),snippet:f.Yj(),dynamic:f.zM(),vendored:f.zM()}).meta({id:"EgressCallSiteHit"}),bN=f.Ik({host:f.Yj(),kind:bu,name:f.Yj(),category:f.Yj(),trust:by,network:bE.nullable(),method:bC,transport:bv,url:f.Yj(),template:f.zM(),dataClass:bw,site:bM}).meta({id:"ResolvedEgressHit"}),bO=f.gM("mode",[f.Ik({mode:f.eu("walk"),walkedPrefix:f.Yj()}),f.Ik({mode:f.eu("ledger"),scannedFiles:f.YO(f.Yj()),deletedFiles:f.YO(f.Yj())})]).meta({id:"EgressReconcile"});f.Ik({projectKey:f.Yj().min(1),project:f.Yj(),projectId:f.Yj().nullable(),reconcile:bO,hits:f.YO(bN)}).meta({id:"RecordProjectEgressInput"}),f.Ik({destinations:f.ai().int().nonnegative(),endpoints:f.ai().int().nonnegative(),callSites:f.ai().int().nonnegative(),truncated:f.zM(),droppedFiles:f.YO(f.Yj()).default([])}).meta({id:"EgressWriteSummary"});let bP="control-plane-credential.json",bQ=f.Ik({specVersion:f.eu(1),endpoint:f.Yj().min(1),apiKey:f.Yj().min(1),keyPrefix:f.Yj().min(1).max(16).optional(),mintedAt:af.w$().optional()}),bR=f.Ik({packId:f.Yj().min(1),version:f.Yj().min(1),enabled:f.zM(),updatedAt:f.Yj().nullable()}).meta({id:"StorePosturePack"}),bS=f.Ik({total:f.ai().int().min(0),disabled:f.ai().int().min(0),byAction:f.Ik({warn:f.ai().int().min(0),redact:f.ai().int().min(0),block:f.ai().int().min(0),allow:f.ai().int().min(0),log:f.ai().int().min(0)}).strict()}).meta({id:"StorePosturePolicyCounts"}),bT=f.Ik({package:f.Yj().min(1).max(200),version:f.Yj().min(1).max(64),ossVersion:f.Yj().max(64).nullable(),policyBundleVersion:f.Yj().max(200).nullable(),policyFetchedAt:f.ai().int().min(0).max(0xe677d21fdbff).nullable()}).meta({id:"StorePosturePlugin"});f.Ik({deviceId:f.Os(),hostname:f.Yj().min(1).max(253),capturedAt:f.ai().int().min(0).max(0xe677d21fdbff),storePresent:f.zM(),schemaVersion:f.ai().int().min(0).max(0x7fffffff).nullable(),findingsTotal:f.ai().int().min(0).max(0x7fffffff),findingsFirstAt:f.ai().int().min(0).max(0xe677d21fdbff).nullable(),findingsLastAt:f.ai().int().min(0).max(0xe677d21fdbff).nullable(),packs:f.YO(bR).max(500),policyCounts:bS,plugin:bT.optional()}).meta({id:"StorePostureSnapshot"});let bU="capture/",bV=aV.extend({inspections:f.YO(aS).default([])}).refine(a=>a.inspections.every(a=>!a.ruleVersion.startsWith(bU)),{message:`inspections[].ruleVersion must not start with \`${bU}\` — that namespace is reserved for capture definitions the control plane mints itself`,path:["inspections"]}).meta({id:"RecordAuditEventRequest"});f.Ik({events:f.YO(bV).min(1).max(50)}).meta({id:"RecordAuditEventBatch"});let bW=f.Ik({host:f.Yj(),kind:bu,name:f.Yj(),category:f.Yj(),trust:by,network:bE.nullable(),method:bC,transport:bv,url:f.Yj(),template:f.zM(),dataClass:bw,site:f.Ik({file:f.Yj(),line:f.ai().int().positive(),dynamic:f.zM(),vendored:f.zM()})}).meta({id:"EgressIngestHit"});f.Ik({projectKey:f.Yj().regex(/^[0-9a-f]{64}$/,"projectKey must be a 64-character lowercase hex digest"),project:f.Yj(),reconcile:bO,hits:f.YO(bW)}).meta({id:"EgressIngestRequest"}),f.Ik({accepted:f.ai().int().nonnegative(),duplicates:f.ai().int().nonnegative()}),f.Ik({accepted:f.ai().int().nonnegative()});let bX=/^[^\p{Cc}\p{Cf}]*$/u,bY=a=>f.Yj().max(a).regex(bX,"must not contain control characters");f.Ik({tenantName:bY(200),userEmail:bY(320),role:bY(64),keyKind:bY(64),serverTime:bY(64)}),f.Ik({error:f.Ik({code:f.Yj().optional(),message:f.Yj().optional()}).optional()}),f.k5(["unauthorized","forbidden","route-absent","invalid-request","rejected","unreachable"]),f.Ik({deviceId:bY(128).min(1),hostname:bY(255).min(1),os:bY(64).min(1),cliVersion:bY(64).min(1),label:bY(200).optional()}).meta({id:"AttachDeviceRequest"}),f.Ik({deviceCode:bY(128).min(1)}).meta({id:"AttachTokenRequest"}),f.Ik({deviceCode:bY(128),userCode:bY(32),verificationUri:bY(512),verificationUriComplete:bY(512).optional(),expiresIn:f.ai().int().positive(),interval:f.ai().int().positive()});let bZ=f.Ik({status:f.eu("pending")}),b$=f.Ik({status:f.eu("slow_down"),interval:f.ai().int().positive()}),b_=f.Ik({status:f.eu("denied"),message:bY(500).optional()}),b0=f.Ik({status:f.eu("expired")}),b1=f.Ik({status:f.eu("issued"),apiKey:f.Yj().min(1).max(512),endpoint:bY(512),tenantName:bY(200).optional(),userEmail:bY(320).optional()});f.KC([b1,bZ,b$,b_,b0,f.Ik({status:bY(64)})]);let b2=f.k5(["shares_rescan"]),b3=f.Ik({id:bY(128).min(1),kind:b2,issuedAt:bY(64).min(1),expiresAt:bY(64).min(1)}).strict();f.Ik({command:b3.nullable()});let b4=f.k5(["scan_failed","no_projects","expired"]);f.gM("outcome",[f.Ik({outcome:f.eu("reported"),projectsScanned:f.ai().int().nonnegative()}).strict(),f.Ik({outcome:f.eu("failed"),reason:b4,projectsScanned:f.ai().int().nonnegative()}).strict()]);let b5=f.Yj().regex(/^[a-z][a-z0-9-]*$/),b6=f.Yj().regex(/^[a-z][a-z0-9-]*$/),b7=f.Yj().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?$/),b8=f.k5(["labs","user","org"]),b9=f.k5(["keyword","regex"]).meta({id:"MatcherType"});f.k5(["safe","quarantined"]).meta({id:"RuleProbeVerdict"});let ca=f.re({type:f.eu("keyword"),keywords:f.YO(f.Yj().min(1)).min(1),caseSensitive:f.zM().default(!1)});function cb(a){return a.replace(/[gy]/g,"")}let cc=f.re({type:f.eu("regex"),pattern:f.Yj().min(1).max(2e3),flags:f.Yj().default("gi"),captureGroup:f.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,cb(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}|`,cb(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.`})}),cd=f.gM("type",[ca,cc]).meta({id:"Matcher"});b9.options;let ce=f.re({extensions:f.YO(f.Yj().regex(/^\.[A-Za-z0-9]+$/)).min(1)}).meta({id:"AppliesTo"}),cf=f.k5(["entropy","luhn"]).meta({id:"PostValidatorName"}),cg=f.KC([cf,f.re({name:cf,config:f.g1(f.Yj(),f.L5()).optional()})],{error:()=>`not a valid post-validator: use a bare name (${cf.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"}),ch=f.re({categories:f.YO(am).min(1).optional(),ruleIds:f.YO(f.Yj().min(1)).min(1).optional(),labels:f.YO(f.Yj().min(1)).min(1).optional(),windowChars:f.ai().int().positive().default(160),confidenceBoost:f.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"});f.re({label:f.Yj(),text:f.Yj().max(5e4),shouldMatch:f.zM(),filePath:f.Yj().optional(),expectedSpans:f.YO(f.re({start:f.ai(),end:f.ai()})).optional()}).meta({id:"RuleFixture"});let ci=f.re({specVersion:f.eu(1),id:f.Yj().regex(/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/),name:f.Yj(),category:am,severity:an,matcher:cd,appliesTo:ce.optional(),postValidators:f.YO(cg).optional(),requiresNearby:ch.optional(),examples:f.YO(f.Yj()).optional()}).meta({id:"Rule"}),cj=f.Ik({name:f.Yj(),email:f.Rp().optional(),url:f.OZ().optional()}).meta({id:"Author"});f.Ik({specVersion:f.eu(1),id:f.Yj(),name:f.Yj(),version:f.Yj(),rules:f.YO(f.Yj()),description:f.Yj().optional(),author:cj.optional(),license:f.Yj().optional(),sourceUrl:f.OZ().optional()}).meta({id:"PackManifest"});let ck=f.k5(["library","custom"]).meta({id:"OriginEnum"}),cl=f.k5(["all","library","custom","customized","updates"]),cm=f.k5(["new","imported","update"]).meta({id:"LibraryStateEnum"}),cn=f.Ik({all:f.ai().int().nonnegative(),library:f.ai().int().nonnegative(),custom:f.ai().int().nonnegative(),customized:f.ai().int().nonnegative(),updates:f.ai().int().nonnegative()}).meta({id:"DetectionCounts"}),co=f.Ik({id:f.Yj(),name:f.Yj(),version:b7,enabled:f.zM(),origin:ck,publisher:b5.optional(),publisherKind:b8.optional(),ruleCount:f.ai().int().nonnegative(),namespace:b5,packId:b6,policyId:f.Yj().optional(),latestVersion:b7.optional()}).meta({id:"DetectionListItem"});f.Ik({counts:cn,items:f.YO(co)}).meta({id:"ListDetectionsResponse"}),f.Ik({filter:cl.optional().default("all"),q:f.Yj().optional()}),f.Ik({detections:f.ai().int().nonnegative(),rules:f.ai().int().nonnegative(),active:f.ai().int().nonnegative(),findingsLast30d:f.ai().int().nonnegative()}).meta({id:"DetectionStats"});let cp=f.Ik({id:f.Yj(),name:f.Yj(),category:am,severity:an,matcher:cd,appliesTo:ce.optional(),postValidators:f.YO(cg).optional(),requiresNearby:ch.optional(),examples:f.YO(f.Yj()).optional()}).meta({id:"DetectionRule"}),cq=f.Ik({available:f.zM(),latestVersion:b7,latestRuleCount:f.ai().int().nonnegative().optional()}).nullable().meta({id:"DetectionUpdate"});f.Ik({id:f.Yj(),name:f.Yj(),version:b7,enabled:f.zM(),origin:ck,publisher:b5.optional(),publisherKind:b8.optional(),ruleCount:f.ai().int().nonnegative(),namespace:b5,packId:b6,description:f.Yj().optional(),editedAt:af.w$(),findingsLast30d:f.ai().int().nonnegative(),latestVersion:b7.nullable().optional(),update:cq,rules:f.YO(cp),modified:f.zM(),policyId:f.Yj().optional()}).meta({id:"DetectionDetail"});let cr=f.Ik({id:f.Yj(),name:f.Yj(),publisher:b5,publisherKind:b8.optional(),category:am.optional(),version:b7,ruleCount:f.ai().int().nonnegative(),description:f.Yj().optional(),updatedAt:af.w$(),state:cm,importedAs:f.Yj().nullable()}).meta({id:"LibraryItem"});function cs(a,b,c){return void 0!==c&&b.success&&void 0!==b.data?{[a]:b.data}:{}}f.Ik({categories:f.YO(am),items:f.YO(cr)}).meta({id:"ListLibraryResponse"}),f.Ik({libraryId:f.Yj().refine(a=>/^[^/]+\/[^/]+$/.test(a),{message:"libraryId must be in namespace/packId format"})}).meta({id:"ImportDetectionRequest"});let ct={library:!0,custom:!0};function cu(a){return null!=a&&Object.hasOwn(ct,a)?a:"library"}function cv(a){return{id:`${a.namespace}/${a.packId}`,name:a.name,version:a.version,enabled:a.enabled,origin:cu(a.origin),namespace:a.namespace,packId:a.packId,ruleCount:a.ruleCount,...null!=a.policyId?{policyId:a.policyId}:{},...null!=a.latestVersion?{latestVersion:a.latestVersion}:{}}}function cw(a,b,c){let d=a.rules.flatMap(a=>{var b;let c=cd.safeParse(a.matcher);return c.success?[{id:a.id,name:a.name,category:a.category,severity:a.severity,matcher:c.data,...cs("appliesTo",ce.safeParse(a.appliesTo),a.appliesTo),...cs("postValidators",cg.array().safeParse(a.postValidators),a.postValidators),...cs("requiresNearby",ch.safeParse(a.requiresNearby),a.requiresNearby),...cs("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:cu(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 cx(a){let b=a.indexOf("/");return b<1||b===a.length-1?null:{namespace:a.slice(0,b),packId:a.slice(b+1)}}function cy(a,b){let c=a.filter(a=>null!=a.latestVersion),d=a=>cu(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(cv)}}let cz=f.k5(["prompt","response","code_change","tool_use"]).meta({id:"EventKind"}),cA=cz.options.map(a=>`'${a}'`).join(","),cB=f.Ik({sessionId:f.Yj().optional(),repo:f.Yj().optional(),filePath:f.Yj().optional(),toolName:f.Yj().optional(),gitignored:f.zM().optional(),wholeFile:f.zM().optional(),model:f.Yj().optional(),turnIndex:f.ai().int().nonnegative().optional(),correlationId:f.uR().optional(),traceId:f.Yj().regex(/^[0-9a-f]{32}$/).optional(),exceptionIds:f.YO(f.Os()).optional(),messageId:f.Yj().optional(),conversationId:f.Yj().optional(),inspectionMs:f.ai().int().nonnegative().optional(),redactDegradedTo:ao.optional()}).meta({id:"EventMetadata"}),cC=f.Ik({id:f.Os(),sourceTool:ak,kind:cz,occurredAt:af.w$(),contentHash:f.Yj(),content:f.Yj(),metadata:cB.optional()}).meta({id:"Event"}).meta({id:"IngestEvent"});f.Ik({events:f.YO(cC).min(1).max(100),dedupe:f.eu("content-hash").optional()}).meta({id:"IngestBatch"});let cD=f.k5(["once","temporary","permanent"]),cE=f.Ik({repo:f.Yj().optional(),sourceTool:f.Yj().optional(),provider:f.Yj().optional()}).strict(),cF=f.k5(["suppress","reveal_to_model"]),cG=f.Ik({id:f.Os(),ruleId:f.Yj(),category:am,valueFingerprint:f.Yj().regex(/^[0-9a-f]{64}$/),keyVersion:f.ai().int().positive(),maskedValue:f.Yj(),capability:cF.default("suppress"),scope:cD,expiresAt:af.w$().nullable(),maxUses:f.ai().int().positive().nullable(),useCount:f.ai().int().nonnegative(),lastUsedAt:af.w$().nullable(),justification:f.Yj().min(1),conditions:cE.nullable(),createdBy:f.Yj(),createdVia:f.k5(["cli-approve","cli-add","web-approve","web-add","api","setup-triage"]),createdAt:af.w$(),updatedAt:af.w$(),revokedAt:af.w$().nullable(),revokedBy:f.Yj().nullable(),revokeReason:f.Yj().nullable()}),cH=cG.pick({id:!0,ruleId:!0,valueFingerprint:!0,keyVersion:!0,capability:!0,expiresAt:!0,maxUses:!0,useCount:!0,conditions:!0});function cI(a){let{valueFingerprint:b,...c}=a;return c}function cJ(a){let{valueFingerprint:b,...c}=a;return c}function cK(a,b){return"present"===b.status&&b.version===a}cG.omit({valueFingerprint:!0});let cL=f.Yj().optional();f.Ik({reference:f.Yj(),scope:f.Yj(),reason:f.Yj(),confirmation:cL}),f.Ik({ruleId:f.Yj(),value:f.Yj(),scope:f.Yj(),reason:f.Yj(),confirmation:cL}),f.Ik({pointer:f.Yj(),scope:f.Yj(),justification:f.Yj(),confirmation:cL}),f.Ik({id:f.Yj(),reason:f.Yj()}),f.Ik({confirmation:f.Yj()});let cM=av.options;function cN(a){if("code_change"===a.kind)return{state:"local_scan"};if(null!==a.syncedAt&&a.syncedAt>0)return{state:"sent",at:U(a.syncedAt)};if(null!==a.syncedAt){var b;let c=null!==(b=a.syncFailure)&&cM.includes(b)?b:void 0;return{state:"not_sent",...null===a.syncFailedAt?{}:{at:U(a.syncFailedAt)},...void 0===c?{}:{reason:c}}}return 1===a.outboxOwed||null!==a.syncClaimedAt?{state:"queued"}:{state:"never_offered"}}function cO(a,b){return Object.hasOwn(a,b)?a[b]:void 0}function cP(a){return cO({log:"monitored",block:"blocked",redact:"redacted",warn:"warned",allow:"allowed"},a)??"allowed"}function cQ(a){if("code_context"===a)return"source_code";let b=at.safeParse(a);return b.success?b.data:"custom"}function cR(a){return cO(al,a)??ah.Api}let cS=["open","handled","dismissed","resolved"];function cT(a){let b=new Set(a.filter(a=>void 0!==a));if(0!==b.size){for(let a of cS)if(b.has(a))return a}}function cU(a){return"code_change"!==a.kind?"handled":null===a.findingKey?"open":"resolved"===a.latestResolutionStatus?"resolved":"dismissed"===a.latestResolutionStatus?"dismissed":"open"}function cV(a,b={}){let c=b.packNames,d=[];for(let[b,e]of a){let a=[...e.users??[]].sort((a,b)=>a.name.localeCompare(b.name)||a.id.localeCompare(b.id)),f=[...new Set(e.sourceTools.map(cR))].sort(),g=new Set(e.actionsTaken.map(cP)),h=1===g.size?[...g][0]??null:null,i=cQ(e.category??"custom"),j={id:b,category:i,subtype:b,severity:e.severity??"low",detection:{id:b,name:c?.get(b)??null},policy:{id:`category:${i}`,name:i},instanceCount:e.instanceCount,providers:f,aggregateAction:h,latestDetectedAt:e.latestDetectedAt,status:cT(e.statusInputs.map(cU)),...a.length>0?{users:a}:{}};cY.set(j,[...g]),void 0!==e.searchText&&cW.set(j,cX(j,e.searchText)),d.push(j)}return d}let cW=new WeakMap;function cX(a,b){return[a.subtype,a.category,a.policy.name,a.id,...(a.users??[]).map(a=>a.name),...void 0===b?[]:[b]].join(" ").toLowerCase()}let cY=new WeakMap;function cZ(a){return cY.get(a)??[]}function c$(a,b){let c=new Set(b),d=0;for(let b of a){if(void 0===b.count)return null;c.has(cU(b))&&(d+=b.count)}return d}function c_(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=>cZ(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=cW.get(a);if(void 0!==b)return b;let c=cX(a);return cW.set(a,c),c})(b).includes(a))}return c}let c0=Object.fromEntries(an.options.map((a,b)=>[a,b]));function c1(a,b){let c=(cO(c0,a.severity)??-1)-(cO(c0,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 c2(a){return[...a].sort(c1)}function c3(a,b){let c=c_(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=c_(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=c_(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 cZ(a))h.set(b,(h.get(b)??0)+1);let i=c_(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=c_(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)}}function c4(a,b){let c=a[Symbol.iterator](),d=b[Symbol.iterator]();for(;;){let a=c.next(),b=d.next();if(a.done&&b.done)return 0;if(a.done)return -1;if(b.done)return 1;let e=a.value.codePointAt(0)??0,f=b.value.codePointAt(0)??0;if(e!==f)return e-f}}let c5=["severity","subtype","providers","actions","statuses","deliveries","tools","repo","file","q"];function c6(a,b,c){for(let d of c5)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(cR(a.sourceTool));case"actions":return!b.actions?.length||b.actions.includes(cP(a.actionTaken));case"statuses":return!b.statuses?.length||void 0!==a.status&&b.statuses.includes(a.status);case"deliveries":return!b.deliveries?.length||void 0!==a.delivery&&b.deliveries.includes(a.delivery.state);case"tools":return!b.tools?.length||void 0!==a.toolName&&b.tools.includes(a.toolName);case"repo":return void 0===b.repo||a.repo===b.repo;case"file":return void 0===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 c7(a){return[...a.entries()].map(([a,b])=>({value:a,count:b})).sort((a,b)=>b.count-a.count||a.value.localeCompare(b.value)||c4(a.value,b.value))}function c8(a,b,c=1){a.set(b,(a.get(b)??0)+c)}function c9(a){let b=new Map,c=new Map,d=new Map,e=new Map,f=new Map,g=new Map,h=new Map;return{add(i){c6(i,a,"severity")&&c8(b,i.severity),c6(i,a,"subtype")&&c8(c,i.ruleId),c6(i,a,"providers")&&c8(d,cR(i.sourceTool)),c6(i,a,"actions")&&c8(e,cP(i.actionTaken)),void 0!==i.status&&c6(i,a,"statuses")&&c8(f,i.status),void 0!==i.toolName&&c6(i,a,"tools")&&c8(g,i.toolName),void 0!==i.delivery&&c6(i,a,"deliveries")&&c8(h,i.delivery.state)},facets:()=>({severity:c7(b),subtype:c7(c),provider:c7(d),action:c7(e),status:c7(f),tool:c7(g),deployment:c7(h)})}}function da(a){let b=cQ(a.category);return{id:a.id,provider:cR(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.delivery?{}:{delivery:a.delivery},...void 0===a.user?{}:{user:a.user},action:cP(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}}}function db(){return{instanceCount:0,maxSeverityRank:Number.MAX_SAFE_INTEGER,maxSeverity:"low",latestDetectedAt:"",statuses:[],ruleIds:new Set}}function dc(a,b){a.instanceCount+=1;let c=cO(c0,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)}function dd(a,b){let c=cO(c0,a.maxSeverity)??-1,d=cO(c0,b.maxSeverity)??-1;if(c!==d)return c-d;if(a.latestDetectedAt!==b.latestDetectedAt)return a.latestDetectedAt<b.latestDetectedAt?1:-1;let e=c4(a.repo,b.repo);return 0!==e?e:c4(a.file,b.file)}function de(a,b){return`${df(a)}/${df(b)}`}function df(a){return encodeURIComponent(a.replace(/[\uD800-\uDFFF]/gu,"�"))}let dg=f.Ik({id:f.Os(),namespace:b5,packId:b6,version:b7,name:f.Yj(),enabled:f.zM().default(!0),policyId:f.Yj().optional()}).meta({id:"InstalledPack"});f.Ik({namespace:b5,packId:b6,version:b7}).meta({id:"InstallPackRequest"}),f.Ik({items:f.YO(dg)}).meta({id:"ListInstalledPacksResponse"}),f.Ik({enabled:f.zM().optional(),policyId:f.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 dh=f.k5(["global","repo","user"]).meta({id:"PolicyScope"}),di=f.KC([f.Ik({ruleId:f.Yj()}),f.Ik({category:am})]).meta({id:"PolicyTarget"}),dj=f.k5(["builtin","custom"]).meta({id:"PolicyKind"}),dk=f.k5(["builtin","authored"]).meta({id:"PolicyProvenance"}),dl=f.Ik({id:f.Os(),scope:dh,target:di,action:ao,enabled:f.zM().default(!0),customKeywords:f.YO(f.Yj()).optional(),name:f.Yj().optional(),provenance:dk.optional()}).meta({id:"Policy"}),dm=["monitor","warn","redact","vault","block"],dn=f.k5(dm).meta({id:"BuiltinPolicyId"}),dp=dn.extract(["monitor","warn","block"]).meta({id:"RedactFallback"}),dq=f.Ik({version:f.Yj(),policies:f.YO(dl),rules:f.YO(ci).optional(),rulesComplete:f.zM().optional(),exceptions:f.YO(cH).optional(),reversibleRuleIds:f.YO(f.Yj()).optional(),ruleVersions:f.g1(f.Yj(),f.Yj()).optional(),prohibitedModels:f.YO(f.Yj()).optional(),redactFallback:dp.optional(),customKeywords:f.YO(f.Yj()),fetchedAt:af.w$()}).meta({id:"PolicyBundle"});[...Object.keys(dq.shape),...Object.keys(dl.shape).map(a=>`policies.${a}`),...di.options.flatMap(a=>"shape"in a?Object.keys(a.shape):[]).map(a=>`policies.target.${a}`),...Object.keys(cH.shape).map(a=>`exceptions.${a}`)].sort().join(",");let dr=["config"],ds=am.options.filter(a=>!dr.includes(a)),dt={secret:"critical",financial:"critical",code_flaw:"critical",pii:"high",phi:"high",custom:"high",code_context:"low",config:"low"},du=dm,dv={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 dw(a){return dv[a].action}let dx=[...new Set(dm.map(dw))],dy=[...ap.filter(a=>!dx.includes(a)),...dx];function dz(a){return dy.indexOf(a)}function dA(a,b){return dz(a)>=dz(b)}function dB(a,b){return dz(a)>=dz(b)?a:b}function dC(a){return dm.find(b=>dA(dw(b),a))??"block"}f.Ik({floor:dn,locked:f.zM()}).describe("PackPolicyFloor");let dD=dm.filter(a=>!dv[a].reversible);dm.filter(a=>dv[a].reversible);let dE=f.k5(dD).meta({id:"CategoryPolicyId"});function dF(a){let b=dn.safeParse(a??dI);return dv[b.success?b.data:dI].reversible}let dG=Object.fromEntries(am.options.map(a=>[a,dw(function(a){if(dr.includes(a))return"monitor";let b=dt[a];return"critical"===b||"high"===b?"warn":"monitor"}(a))])),dH=Object.fromEntries(dm.map(a=>[a,{id:a,...dv[a]}])),dI="monitor";function dJ(a){let b=dn.safeParse(a??dI);return dH[b.success?b.data:dI].action}let dK=f.Ik({id:f.Yj(),name:f.Yj(),ruleCount:f.ai().int().nonnegative(),enabled:f.zM()}).meta({id:"UsedByItem"}),dL=f.Ik({id:f.Yj(),kind:dj,name:f.Yj(),enabled:f.zM(),usedByCount:f.ai().int().nonnegative()}).meta({id:"PolicyListItem"});f.Ik({items:f.YO(dL)}).meta({id:"ListPoliciesResponse"}),f.Ik({specVersion:f.eu(1),id:f.Yj(),kind:dj,name:f.Yj(),enabled:f.zM(),description:f.Yj(),usedBy:f.YO(dK)}).meta({id:"PolicyDetail"}),f.Ik({policies:f.ai().int().nonnegative(),builtin:f.ai().int().nonnegative(),custom:f.ai().int().nonnegative(),detectionsGoverned:f.ai().int().nonnegative()}).meta({id:"PolicyStatsResponse"});let dM=2,dN=am.options.join("|"),dO=RegExp(`\\[\\[aka:(?:${dN}):[A-Z2-7]{2,7}\\.[A-Z2-7]{26}\\.[A-Z2-7]{16}\\]\\]`),dP=RegExp(`^${dO.source}$`);f.Yj().regex(dP),f.Ik({category:am,keyVersion:f.ai().int().positive(),pointerId:f.Yj(),tag:f.Yj()}),f.Ik({pointerId:f.Yj(),valueFingerprint:f.Yj().regex(/^[0-9a-f]{64}$/),fingerprintKeyVersion:f.ai().int().positive(),keyVersion:f.ai().int().positive(),category:am,ruleId:f.Yj(),maskedMatch:f.Yj(),provider:f.Yj().optional(),ciphertext:f.Yj(),nonce:f.Yj(),authTag:f.Yj(),occurrenceCount:f.ai().int().nonnegative(),userAuthorized:f.zM(),firstSeen:f.Yj(),lastSeen:f.Yj()}),f.Ik({category:am,provider:f.Yj().optional(),maskedMatch:f.Yj(),occurrences:f.ai().int().nonnegative(),firstSeen:f.Yj(),lastSeen:f.Yj()}),f.Ik({ruleId:f.Yj(),valueFingerprint:f.Yj().regex(/^[0-9a-f]{64}$/),fingerprintKeyVersion:f.ai().int().positive()});let dQ=f.k5(["human","model"]),dR=f.k5(["display","explicit-reveal","view-render","model-input","remediation","purge"]),dS=f.k5(["revealed","refused","unavailable"]),dT=f.Ik({id:f.Os(),pointerId:f.Yj(),at:f.Yj(),target:dQ,reason:dR,outcome:dS,grantId:f.Yj().optional(),pointerCount:f.ai().int().positive().default(1)}),dU=f.k5(["prompt","tool-input","tool-output","file","transcript"]),dV=f.Ik({location:f.Yj(),kind:dU,firstSeen:f.Yj(),lastSeen:f.Yj()}),dW=f.Ik({pointerId:f.Yj(),category:am,provider:f.Yj().optional(),maskedMatch:f.Yj(),occurrences:f.ai().int().nonnegative(),firstSeen:f.Yj(),lastSeen:f.Yj(),revealGrantId:f.Yj().nullable(),sightings:f.YO(dV)}),dX=50,dY=50,dZ=200;f.Ik({limit:ag.ai().int().min(1).max(dZ).optional(),cursor:f.Yj().optional()}),f.Ik({totals:f.Ik({values:f.ai().int().nonnegative()}),items:f.YO(dW),nextCursor:f.Yj().nullable()}),f.Ik({limit:ag.ai().int().min(1).max(dZ).optional(),cursor:f.Yj().optional()}),f.Ik({totals:f.Ik({reused:f.ai().int().nonnegative()}),items:f.YO(dW),nextCursor:f.Yj().nullable()}),f.Ik({includeBatched:f.zM().optional(),limit:ag.ai().int().min(1).max(dZ).optional(),cursor:f.Yj().optional()}),f.Ik({items:f.YO(dT),nextCursor:f.Yj().nullable(),hiddenBatched:f.ai().int().nonnegative()});let d$=f.Yj(),d_=f.k5(["masked","full","off"]),d0=1,d1=f.Ik({acknowledgedAt:af.w$(),version:f.ai().int().positive()});function d2(a){return a?.version===d0}let d3=1,d4=f.k5(["standalone","attached"]),d5=f.Ik({endpoint:f.Yj().min(1),label:f.Yj().min(1).optional(),attachedAt:af.w$()}).meta({id:"ControlPlaneConnection"}),d6=f.k5(["redact","warn"]),d7=f.k5(["full","session-only"]),d8=f.Ik({acknowledgedAt:af.w$(),payloadVersion:f.ai().int().positive()}),d9=f.Ik({acknowledgedAt:af.w$(),payloadVersion:f.ai().int().positive(),endpoint:f.Yj()});function ea(a,b){return void 0!==a&&void 0!==b&&3===a.payloadVersion&&a.endpoint===b}function eb(a,b){return void 0!==a&&void 0!==b&&a.endpoint===b&&3!==a.payloadVersion}let ec=f.Ik({enabled:f.zM().default(!1),retainDays:f.ai().int().min(1).max(3650).default(30)}).meta({id:"BodyRetention"}),ed=f.Ik({specVersion:f.ai().int().positive().default(8),runMode:d4.default("standalone"),controlPlane:d5.optional(),policy:d6.default("redact"),historicalAccess:d7.default("session-only"),dataSharesInPlace:f.zM().default(!0),vaultConsent:d1.optional(),vaultKeyCustody:d$.default("file"),vaultInlineReveal:d_.default("masked"),redactFallback:dp.default("warn"),onboardedAt:af.w$().optional(),modelJudgeConsent:d8.optional(),historySyncConsent:d9.optional(),bodyRetention:ec.default({enabled:!1,retainDays:30})});function ee(){return ed.parse({})}function ef(a){return"attached"===a.runMode&&void 0!==a.controlPlane}function eg(a){return a.label??a.endpoint}function eh(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 ei(a,b,c){return{id:b,url:a.url,name:a.name??null,attributes:JSON.stringify(a.attributes),firstSeen:c,lastSeen:c}}function ej(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:T(a.startedAt),endedAt:a.endedAt?T(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 ek(a,b){return{id:b,class:a.class,label:a.label??null,attributes:a.attributes?JSON.stringify(a.attributes):null}}function el(a,b){return{id:b,ruleId:a.ruleId,name:a.name,category:a.category,severity:a.severity,definition:a.definition,version:a.version}}function em(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?T(a.firstDetectedAt):null}}function en(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?.redactDegradedTo!==void 0?{redact_degraded_to:b.redactDegradedTo}:{},...b?.model!==void 0?{model:b.model}:{},...b?.turnIndex!==void 0?{turn_index:b.turnIndex}:{},...b?.messageId!==void 0?{message_id:b.messageId}:{},...b?.conversationId!==void 0?{conversation_id:b.conversationId}:{}}}function eo(a){return`capture/${a.category}/${a.severity}`}function ep(a){return{ruleId:a.ruleId,version:eo(a),name:a.ruleId,category:a.category,severity:a.severity,definition:JSON.stringify({ruleId:a.ruleId})}}var eq=c(49374);let er="managed-settings.json",es=f.k5(["runMode","historicalAccess","vaultConsent","vaultKeyCustody","vaultInlineReveal","modelJudgeConsent","dataSharesInPlace","redactFallback","bodyRetention"]).meta({id:"ManagedSettingKey"}),et=f.Ik({runMode:f.k5(["standalone","attached"]).optional(),controlPlane:f.Ik({endpoint:f.Yj().min(1),label:f.Yj().min(1).optional()}).optional(),historicalAccess:f.k5(["full","session-only"]).optional(),vaultConsent:f.zM().optional(),vaultKeyCustody:f.k5(["file","keychain"]).optional(),vaultInlineReveal:f.k5(["masked","full","off"]).optional(),modelJudgeConsent:f.zM().optional(),dataSharesInPlace:f.zM().optional(),redactFallback:dp.optional(),bodyRetention:ec.optional()}).meta({id:"ManagedSettingsValues"}),eu=f.Ik({specVersion:f.ai().int().positive().default(1),organization:f.Yj().min(1).optional(),values:f.g1(f.Yj(),f.L5()).default({}),lockedFields:f.YO(f.Yj()).default([])}).transform(({lockedFields:a,values:b,...c},d)=>{let e=[],f=[];for(let b of a)es.safeParse(b).success?e.push(b):f.push(b);let g=Object.create(null),h=[];for(let[a,c]of Object.entries(b))Object.hasOwn(et.shape,a)?g[a]=c:h.push(a);let i=et.safeParse(g);if(!i.success){for(let a of i.error.issues)d.addIssue({...a,path:["values",...a.path]});return eq.tm}return{...c,values:i.data,lockedFields:e,...f.length>0?{unknownLockedFields:f}:{},...h.length>0?{unknownValueFields:h}:{}}}).meta({id:"ManagedSettings"}),ev={present:!1,lockedFields:[]},ew=f.Ik({path:f.Yj().min(1),name:f.Yj().min(1),origin:bd,defaultAccess:bc});f.Ik({files:f.YO(ew),truncated:f.zM(),scannedAt:f.Yj()});let ex=["7d","30d","3m","6m"],ey=f.k5(ex).meta({id:"TimeRange"}),ez={"7d":7,"30d":30,"3m":90,"6m":180},eA=ey.catch("7d");function eB(a){return eA.parse(a)}let eC=f.k5(["still-valid","unknown","invalid"]),eD=f.Ik({filePath:f.Yj(),span:aq.optional()}).strict(),eE=f.Ik({provider:f.Yj(),maskedToken:f.Yj(),where:eD,state:eC,observedAt:af.w$().optional()}).strict();f.Ik({provider:f.Yj(),maskedToken:f.Yj(),consolePath:f.Yj(),occurrenceSpread:f.ai().int().positive()}).strict();let eF=f.k5(["redact-rotation-checklist","redact-only","set-secret-redact","leave"]),eG=f.k5(["first-run","pre-push","secret-scan"]);f.Ik({entrySource:eG}).strict();let eH=f.Ik({id:eF,label:f.Yj()}),eI=f.Ik({kind:f.eu("decision"),entrySource:eG,secretCount:f.ai().int().positive(),prompt:f.Yj(),options:f.PV([eH.extend({id:f.eu("redact-rotation-checklist")}),eH.extend({id:f.eu("redact-only")}),eH.extend({id:f.eu("set-secret-redact")}),eH.extend({id:f.eu("leave")})])}),eJ=f.Ik({kind:f.eu("no-decision")});f.gM("kind",[eI,eJ]);let eK=f.Ik({severity:an,count:f.ai().int().nonnegative(),caught:f.ai().int().nonnegative().optional(),openAtRest:f.ai().int().nonnegative().optional()}).meta({id:"SeveritySummaryItem"});f.Ik({total:f.ai().int().nonnegative(),needsRemediation:f.ai().int().nonnegative().optional(),bySeverity:f.YO(eK)}).meta({id:"SeveritySummaryResponse"}),f.Ik({range:f.k5(ex).default("7d")});let eL=f.k5(["blocked","redacted","warned"]).meta({id:"EnforcementActionKind"}),eM=f.Ik({kind:eL,count:f.ai().int().nonnegative(),delta:f.ai().int()}).meta({id:"EnforcementAction"});f.Ik({range:ey,total:f.ai().int().nonnegative(),actions:f.YO(eM)}).meta({id:"EnforcementActionsResponse"});let eN=f.k5(["day","week"]).meta({id:"TimeseriesGranularity"}),eO=f.Ik({timestamp:af.p6(),critical:f.ai().int().nonnegative(),high:f.ai().int().nonnegative(),medium:f.ai().int().nonnegative(),low:f.ai().int().nonnegative().optional()}).meta({id:"FindingsTimeseriesPoint"});f.Ik({range:ey,granularity:eN,points:f.YO(eO)}).meta({id:"FindingsTimeseriesResponse"});let eP=f.Ik({timestamp:af.p6(),bySeverity:f.Ik({critical:f.ai().nonnegative().nullable(),high:f.ai().nonnegative().nullable(),medium:f.ai().nonnegative().nullable(),low:f.ai().nonnegative().nullable()})}).meta({id:"MttrTrendPoint"});f.Ik({range:ey,granularity:eN,points:f.YO(eP)}).meta({id:"MttrTrendResponse"});let eQ=f.Ik({findingKey:f.Yj(),ruleId:f.Yj(),severity:an,repo:f.Yj().optional(),path:f.Yj(),resolvedAt:af.w$(),detectedAt:af.w$()}).meta({id:"ResolvedFeedItem"});f.Ik({items:f.YO(eQ)}).meta({id:"RecentlyResolvedResponse"});let eR=["repo","user"],eS=f.k5(eR).meta({id:"SourceKind"}),eT=f.Ik({id:f.Yj(),name:f.Yj(),kind:eS,findingsCount:f.ai().int().nonnegative()}).meta({id:"TopSource"});f.Ik({range:ey,items:f.YO(eT)}).meta({id:"TopSourcesResponse"}),f.Ik({range:f.k5(ex).default("7d"),limit:ag.ai().int().min(1).max(50).default(5),kind:f.k5(eR).optional()});let eU=ai.extract(["ClaudeCode","Cursor","Codex","Antigravity","ClaudeAi","ChatGpt","Copilot","Api"]).meta({id:"Provider"}),eV=f.Ik({provider:eU,coverage:f.ai().int().min(0).max(100),supported:f.zM()}).meta({id:"ScanCoverageProvider"});f.Ik({range:ey,providers:f.YO(eV)}).meta({id:"ScanCoverageResponse"});let eW=f.k5(["repo","user","team","policy","share","rule"]).meta({id:"SubjectType"}),eX=f.Ik({type:eW,id:f.Yj(),label:f.Yj()}).meta({id:"RecommendationSubject"}),eY=f.k5(["apply","navigate"]).meta({id:"RecommendationActionMode"}),eZ=f.Ik({mode:eY,type:f.Yj(),label:f.Yj(),href:f.Yj().optional(),policyId:f.Yj().optional(),teamId:f.Yj().optional()}).meta({id:"RecommendationAction"}),e$=f.Ik({id:f.Yj(),category:f.Yj(),severity:an,title:f.Yj(),description:f.Yj(),subjects:f.YO(eX),action:eZ}).meta({id:"RecommendedAction"});f.Ik({items:f.YO(e$)}).meta({id:"RecommendedActionsResponse"}),f.Ik({limit:ag.ai().int().min(1).max(20).default(3)});let e_=f.Ik({type:f.Yj(),policyId:f.Yj().optional(),teamId:f.Yj().optional()}).meta({id:"AppliedAction"});f.Ik({id:f.Yj(),status:f.eu("applied"),appliedAction:e_}).meta({id:"ApplyRecommendedActionResponse"}),f.Ik({id:f.Yj(),status:f.eu("dismissed")}).meta({id:"DismissRecommendedActionResponse"}),f.Ik({id:f.Yj()});let e0=f.k5(["granted","revoked","unchanged"]).meta({id:"HistorySyncConsentChoice"}),e1=f.k5(["granted","revoked","unchanged"]).meta({id:"ModelJudgeConsentChoice"});f.Ik({historicalAccess:f.Yj(),modelJudgeConsent:e1,historySyncConsent:e0,vaultConsent:f.Yj(),vaultInlineReveal:f.Yj(),redactFallback:f.Yj(),bodyRetention:f.Ik({enabled:f.zM(),retainDays:f.ai()})}),f.Ik({endpoint:f.Yj(),label:bY(200).optional(),accessKey:f.Yj()}),f.Ik({ruleId:f.Yj(),category:am,severity:an,maskedMatch:f.Yj(),rawMatch:f.Yj(),context:f.Yj(),filePath:f.Yj().optional(),confidence:f.ai().min(0).max(1),id:f.Yj().optional(),valueFingerprint:f.Yj().optional(),keyVersion:f.ai().int().nonnegative().optional()});let e2=f.Ik({category:am,action:dE,reasoning:f.Yj(),genuineCount:f.ai().int().nonnegative(),fpCount:f.ai().int().nonnegative(),fpIds:f.YO(f.Yj())});f.Ik({perCategory:f.YO(e2),notes:f.Yj()});let e3=f.Ik({total:f.ai().int().nonnegative(),important:f.ai().int().nonnegative(),routine:f.ai().int().nonnegative()}).refine(a=>a.total===a.important+a.routine,{message:"total must equal important + routine",path:["total"]}),e4=f.Ik({ruleId:f.Yj(),category:am,valueFingerprint:f.Yj(),keyVersion:f.ai().int().nonnegative()}),e5=f.Ik({pattern:f.Yj(),count:f.ai().int().nonnegative(),values:f.YO(e4).min(1)}),e6=f.Ik({category:am,count:f.ai().int().nonnegative(),egress:f.zM()}),e7=f.Ik({counts:e3,routineCategories:f.YO(am),surfacedCategories:f.YO(am),findingKinds:f.YO(e6),posture:f.g1(am,dn),maskedFindings:f.YO(eE).optional(),falsePositivePatterns:f.YO(e5).optional()}),e8=e2.pick({category:!0,genuineCount:!0,fpCount:!0}).extend({egress:f.zM()});f.Ik({categories:f.YO(e8),posture:f.g1(am,dn)}),f.Ik({frame:e7,copy:f.Yj()}),f.k5(["scan","floor"]);let e9=f.Ik({id:f.k5(["enter-remediation","open-dashboard","not-now"]),label:f.Yj()}),fa=f.PV([e9.extend({id:f.eu("open-dashboard")}),e9.extend({id:f.eu("not-now")})]),fb=f.PV([e9.extend({id:f.eu("enter-remediation")}),e9.extend({id:f.eu("open-dashboard")}),e9.extend({id:f.eu("not-now")})]);f.Ik({worthALook:f.ai().int().nonnegative(),liveKeys:f.ai().int().nonnegative().optional(),options:f.KC([fa,fb])}).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 fc=new Set(["recognized","internal"]);function fd(a){return fc.has(a)?"allowed":"review"}function fe(a){return"block"===a?"blocked":"allowed"}function ff(a,b){return null===b?fd(a):fe(b)}function fg(a,b){return null!==b&&fe(b)!==fd(a)}function fh(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 fi(a){return Array.from(new Set(a))}function fj(a){let b=new Set(a);return bx.filter(a=>b.has(a))}function fk(a){return fj(a)[0]??"none"}let fl={raw_ip:0,unverified_domain:1,plaintext_transport:2};function fm(a){return 0===a.length?1/0:Math.min(...a.map(a=>fl[a]))}let fn=f.k5(["site","estimated","none"]),fo=f.Ik({inputTokens:f.ai().int().nonnegative().optional(),outputTokens:f.ai().int().nonnegative().optional(),cacheReadInputTokens:f.ai().int().nonnegative().optional(),cacheCreationInputTokens:f.ai().int().nonnegative().optional()}),fp=f.Ik({toolUseId:f.Yj().min(1),toolName:f.Yj().min(1),target:f.Yj().optional(),isError:f.zM().optional(),inputSize:f.ai().int().nonnegative().optional(),outputSize:f.ai().int().nonnegative().optional()});f.Ik({messageId:f.Yj().min(1),startedAt:af.w$(),model:f.Yj().optional(),usage:fo.optional(),usageSource:fn,stopReason:f.Yj().optional(),conversationId:f.Yj().optional(),turnIndex:f.ai().int().nonnegative().optional(),toolCalls:f.YO(fp).default([]),responseText:f.Yj().optional(),truncated:f.zM().default(!1)}),f.Ik({patched:f.zM(),live:f.zM(),blind:f.zM(),sendsSeenDom:f.ai().int().nonnegative(),exchangesSeenNet:f.ai().int().nonnegative(),parseFailures:f.ai().int().nonnegative(),unparsedBodies:f.ai().int().nonnegative(),shapeMisses:f.YO(f.Yj()).default([])})},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))})]})})}},59294:(a,b,c)=>{"use strict";c.d(b,{SearchField:()=>i});var d=c(15008),e=c(71378),f=c(1505),g=c(16820);let h={card:"rounded-lg border border-border-field bg-surface-2",canvas:"rounded-lg border border-border-field bg-surface"};function i({value:a,onValueChange:b,label:c,placeholder:i,surface:j,className:k,iconClassName:l,clearLabel:m="Clear search"}){let n=(0,f.useRef)(null),o=()=>{b(""),n.current?.focus()};return(0,d.jsxs)("div",{className:(0,e.cn)("flex items-center gap-2 px-3 focus-within:border-primary focus-within:ring-2 focus-within:ring-primary/40",k,h[j]),children:[(0,d.jsx)(g.WI,{"aria-hidden":!0,focusable:!1,className:(0,e.cn)("size-4 shrink-0 text-text-3",l)}),(0,d.jsx)("input",{ref:n,type:"text",value:a,onChange:a=>{b(a.target.value)},onKeyDown:b=>{"Escape"===b.key&&""!==a&&(b.preventDefault(),b.stopPropagation(),o())},spellCheck:!1,placeholder:i,"aria-label":c,className:"min-w-0 flex-1 bg-transparent text-sm text-text placeholder:text-text-3 focus:outline-hidden"}),""!==a&&(0,d.jsx)("button",{type:"button","aria-label":m,onClick:o,className:"grid size-6 shrink-0 cursor-pointer place-items-center rounded text-text-3 hover:text-text focus:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40",children:(0,d.jsx)(g.uv,{"aria-hidden":!0,focusable:!1,className:"size-3.5"})})]})}},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)(h(),{href:"/security","aria-label":"AKA — go to Security",className:"rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/70",children:(0,d.jsx)(j.j4,{"aria-hidden":!0,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:"p-6",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]})}},63407:(a,b,c)=>{"use strict";c.d(b,{K:()=>g,x:()=>f});var d=c(15008),e=c(33414);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})}},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(33414),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,{i:()=>f});var d=c(15008),e=c(63407);function f({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:()=>m});var d=c(15008),e=c(71378),f=c(60004),g=c(5475),h=c(16820),i=c(13364);function j(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 k=c(99685);let l=[{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 m({points:a,isLoading:b,error:c}){let f=a.every(a=>l.every(b=>null===a[b.key])),m=a.at(-1)??null,n=(0,i.T)(l);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:(0,d.jsx)(i.N,{series:l,visibility:n,interactive:!c&&!b&&!f,metaLabel:a=>null===m?null:j(m[a])})})]}),(0,d.jsx)(e.Wu,{"aria-busy":b,className:"pb-2",children:c?(0,d.jsx)(k.rJ,{message:c}):b?(0,d.jsx)(e.EA,{className:"h-40 w-full"}):f?(0,d.jsx)(k.AW,{message:"No resolved findings in this range."}):(0,d.jsx)(g.AreaChart,{data:a,series:n.visible,height:160,valueFormat:j})})]})}},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))})}},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,kI:()=>U,dK:()=>V,WA:()=>X,Eb:()=>W,D2:()=>Y,AM:()=>aa,hl:()=>ac,Wv:()=>ab,t0:()=>o,Iz:()=>ae,tR:()=>af,l6:()=>ah,gC:()=>am,eb:()=>an,bq:()=>al,yv:()=>ai,Pt:()=>p,cj:()=>aq,h:()=>ar,Qs:()=>au,Fm:()=>as,qp:()=>at,EA:()=>av,dO:()=>ax,cH:()=>i,id:()=>j,XI:()=>ay,BF:()=>aA,nA:()=>aD,nd:()=>aC,A0:()=>az,Hj:()=>aB,tU:()=>aF,av:()=>aI,j7:()=>aG,Xi:()=>aH,vw:()=>aJ,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({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}})})}function V({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 W({children:a,...b}){return(0,d.jsxs)(s,{"data-slot":"pagination-previous",variant:"outline",tone:"neutral",size:"sm",...b,children:[(0,d.jsx)(Z,{"aria-hidden":!0,focusable:!1}),a??"Previous"]})}function X({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)($,{"aria-hidden":!0,focusable:!1})]})}function Y({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 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:"m15 6-6 6 6 6"})})}function $(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 aa=_.Root,ab=_.Trigger;function ac({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 ad=c(89904);function ae({className:a,...b}){return(0,d.jsx)(ad.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 af({className:a,...b}){return(0,d.jsx)(ad.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 ag=c(58973);let ah=ag.Root;ag.Group;let ai=ag.Value;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:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function ak({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 al({className:a,children:b,...c}){return(0,d.jsxs)(ag.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)(ag.Icon,{asChild:!0,children:(0,d.jsx)(aj,{className:"size-4 shrink-0 text-text-3"})})]})}function am({className:a,children:b,position:c="popper",sideOffset:e=6,...f}){return(0,d.jsx)(ag.Portal,{children:(0,d.jsxs)(ag.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)(ao,{}),(0,d.jsx)(ag.Viewport,{className:"p-1",children:b}),(0,d.jsx)(ap,{})]})})}function an({className:a,children:b,...c}){return(0,d.jsxs)(ag.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)(ag.ItemText,{children:b}),(0,d.jsx)("span",{className:"absolute right-2.5 flex items-center",children:(0,d.jsx)(ag.ItemIndicator,{children:(0,d.jsx)(ak,{className:"size-4 text-primary"})})})]})}function ao({className:a,...b}){return(0,d.jsx)(ag.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)(aj,{className:"size-4 rotate-180"})})}function ap({className:a,...b}){return(0,d.jsx)(ag.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)(aj,{className:"size-4"})})}let aq=B.Root;function ar({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 as({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"sheet-header",className:h("flex flex-col gap-1 pr-8",a),...b})}function at({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 au({className:a,...b}){return(0,d.jsx)(B.Description,{"data-slot":"sheet-description",className:h("text-sm text-text-2",a),...b})}function av({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 aw=c(81610);function ax({className:a,...b}){return(0,d.jsx)(aw.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)(aw.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 ay({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 az({className:a,...b}){return(0,d.jsx)("thead",{"data-slot":"table-header",className:h("[&_tr]:border-b [&_tr]:border-border",a),...b})}function aA({className:a,...b}){return(0,d.jsx)("tbody",{"data-slot":"table-body",className:h("[&_tr:last-child]:border-0",a),...b})}function aB({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 aC({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 aD({className:a,...b}){return(0,d.jsx)("td",{"data-slot":"table-cell",className:h("px-3 py-2 align-middle",a),...b})}var aE=c(93636);let aF=aE.Root;function aG({className:a,...b}){return(0,d.jsx)(aE.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 aH({className:a,...b}){return(0,d.jsx)(aE.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 aI({className:a,...b}){return(0,d.jsx)(aE.Content,{"data-slot":"tabs-content",className:h("focus-visible:outline-none",a),...b})}function aJ({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(99685);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,viewAllHref:n}){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)} open, prioritized for you`})]}),n?(0,d.jsx)(e.X9,{children:(0,d.jsx)(e.$n,{asChild:!0,variant:"ghost",tone:"primary",size:"sm",children:(0,d.jsx)("a",{href:n,children:"View all"})})}):null]}),(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 open findings."}):(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(9777);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(33414);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"}},80943:(a,b,c)=>{"use strict";c.d(b,{FI:()=>aO,WR:()=>aM,KS:()=>a2,tI:()=>a0,gt:()=>b8,Yp:()=>$,eS:()=>b5,Ji:()=>b3,XK:()=>m,$i:()=>a7,y9:()=>b4,cn:()=>b7,ls:()=>cb,xR:()=>a5,VL:()=>a1});var d=c(73024),e=c(76760),f=c(58438);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{}}let y=new TextDecoder;function z(a){return null===a?null:"string"==typeof a?a.toLowerCase():"number"==typeof a||"bigint"==typeof a?String(a).toLowerCase():y.decode(a).toLowerCase()}function A(a){return a.replace(/\\/g,"\\\\").replace(/%/g,"\\%").replace(/_/g,"\\_")}function B(a){return Array.from({length:a},()=>"?").join(", ")}function C(a){return`%${A(a)}%`}function D(a){return`(${a.map(a=>`${a} LIKE ? ESCAPE '\\'`).join(" OR ")})`}let E=0;function F(a,b,c="DEFERRED"){if(a.isTransaction){let c=`aka_sp_${String(E+=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 G(a,b,c="DEFERRED"){let d=a.isTransaction;try{return F(a,b,c),!0}catch(b){if(!a.isTransaction&&d)throw b;return!1}}function H(a){process.stderr.write(`[aka] ${a}
|
|
2
|
+
`)}function I(a,b,c){return void 0!==a.prepare("SELECT 1 FROM sqlite_master WHERE type = ? AND name = ? LIMIT 1").get(b,c)}function J(a,b){return I(a,"index",b)}function K(a,b,c){let d=c?.includeGenerated?"table_xinfo":"table_info";return a.prepare(`PRAGMA ${d}(${b})`).all().map(a=>a.name)}function L(a,b){return void 0===b?a.all():Array.isArray(b)?a.all(...b):a.all(b)}function M(a,b){return void 0===b?a.get():Array.isArray(b)?a.get(...b):a.get(b)}function N(a){return 1===a||!0===a}function O(a){let b={};for(let[c,d]of Object.entries(a))b[c]=void 0===d?null:d;return b}function P(a,b,c){return M(a.prepare(b),c)?.n??0}function Q(a,b,c){let d=new Map;for(let e of L(a.prepare(b),c))d.set(e.k,e.n);return d}function R(a,b){let c=[];for(let d of a)try{c.push(b(d))}catch{}return c}let S=["prompt","response","tool_use"],T=S.map(a=>`'${a}'`).join(", "),U=["session","llm_call","tool_call"],V=U.map(a=>`'${a}'`).join(", "),W=[...U,...S],X=W.map(a=>`'${a}'`).join(", "),Y=`
|
|
3
|
+
SUM(CASE WHEN synced_at IS NULL AND sync_claimed_at IS NULL THEN 1 ELSE 0 END) AS queued,
|
|
4
|
+
SUM(CASE WHEN synced_at IS NULL AND sync_claimed_at IS NOT NULL THEN 1 ELSE 0 END) AS inProgress,
|
|
5
|
+
SUM(CASE WHEN synced_at > 0 THEN 1 ELSE 0 END) AS synced,
|
|
6
|
+
SUM(CASE WHEN synced_at IS NOT NULL AND synced_at <= 0
|
|
7
|
+
AND sync_failure = 'deployment_refused' THEN 1 ELSE 0 END) AS refused,
|
|
8
|
+
SUM(CASE WHEN synced_at IS NOT NULL AND synced_at <= 0
|
|
9
|
+
AND sync_failure = 'detached_undelivered' THEN 1 ELSE 0 END) AS detached,
|
|
10
|
+
-- Spelled as what it INCLUDES rather than what it excludes, so a reason
|
|
11
|
+
-- added later lands in no bucket and fails the sum assertion, instead
|
|
12
|
+
-- of silently joining this one.
|
|
13
|
+
SUM(CASE WHEN synced_at IS NOT NULL AND synced_at <= 0
|
|
14
|
+
AND (sync_failure IS NULL OR sync_failure = 'payload_invalid')
|
|
15
|
+
THEN 1 ELSE 0 END) AS failed,
|
|
16
|
+
COUNT(*) AS total`,Z=`
|
|
17
|
+
WHERE event_type IN (${X})
|
|
18
|
+
AND (
|
|
19
|
+
event_type IN (${V})
|
|
20
|
+
OR synced_at IS NOT NULL
|
|
21
|
+
OR outbox_owed = 1
|
|
22
|
+
)`;function $(a,b){if(void 0===a)return!1;let{ownerPid:c,heartbeatAt:d}=a;return null!==c&&null!==d&&d>=b-6e4&&d<=b}let _=`id,
|
|
23
|
+
parent_id AS parentId,
|
|
24
|
+
root_session_id AS rootSessionId,
|
|
25
|
+
event_type AS eventType,
|
|
26
|
+
host_id AS hostId,
|
|
27
|
+
harness_id AS harnessId,
|
|
28
|
+
source_project_id AS sourceProjectId,
|
|
29
|
+
started_at AS startedAt,
|
|
30
|
+
ended_at AS endedAt,
|
|
31
|
+
severity,
|
|
32
|
+
priority,
|
|
33
|
+
content,
|
|
34
|
+
content_hash AS contentHash,
|
|
35
|
+
attributes`;class aa{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
|
|
36
|
+
FROM audit_events
|
|
37
|
+
WHERE synced_at IS NULL
|
|
38
|
+
AND event_type IN (${V})
|
|
39
|
+
AND started_at < :before
|
|
40
|
+
GROUP BY sessionId
|
|
41
|
+
ORDER BY earliest
|
|
42
|
+
LIMIT :limit`),this.rowsStmt=a.prepare(`SELECT ${_}
|
|
43
|
+
FROM audit_events
|
|
44
|
+
WHERE synced_at IS NULL
|
|
45
|
+
AND event_type IN (${V})
|
|
46
|
+
AND started_at < :before
|
|
47
|
+
AND COALESCE(root_session_id, id) = :sessionId
|
|
48
|
+
ORDER BY (event_type = 'session') DESC, started_at
|
|
49
|
+
LIMIT :limit`),this.captureRowsStmt=a.prepare(`SELECT ${_}
|
|
50
|
+
FROM audit_events
|
|
51
|
+
WHERE synced_at IS NULL
|
|
52
|
+
AND sync_claimed_at IS NULL
|
|
53
|
+
AND outbox_owed = 1
|
|
54
|
+
AND event_type IN (${T})
|
|
55
|
+
AND started_at < :before
|
|
56
|
+
ORDER BY started_at
|
|
57
|
+
LIMIT :limit`),this.markOwedStmt=a.prepare("UPDATE audit_events SET outbox_owed = 1 WHERE id = :id AND synced_at IS NULL"),this.markCaptureBacklogOwedStmt=a.prepare(`UPDATE audit_events SET outbox_owed = 1
|
|
58
|
+
WHERE synced_at IS NULL
|
|
59
|
+
AND event_type IN (${T})
|
|
60
|
+
AND started_at < :before`),this.stampStmt=a.prepare(`UPDATE audit_events
|
|
61
|
+
SET synced_at = :at,
|
|
62
|
+
sync_claimed_at = NULL,
|
|
63
|
+
sync_failed_at = :failedAt,
|
|
64
|
+
sync_failure = :failure
|
|
65
|
+
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
|
|
66
|
+
WHERE sync_claimed_at IS NOT NULL AND sync_claimed_at < :staleBefore`),this.partitionStmt=a.prepare(`SELECT${Y}
|
|
67
|
+
FROM audit_events${Z}`),this.partitionByKindStmt=a.prepare(`SELECT event_type AS kind,${Y}
|
|
68
|
+
FROM audit_events INDEXED BY idx_audit_events_sync${Z}
|
|
69
|
+
GROUP BY event_type`),this.countsStmt=a.prepare(`SELECT
|
|
70
|
+
SUM(CASE WHEN synced_at IS NULL AND started_at < :before THEN 1 ELSE 0 END) AS pending,
|
|
71
|
+
SUM(CASE WHEN synced_at > 0 THEN 1 ELSE 0 END) AS sent,
|
|
72
|
+
SUM(CASE WHEN synced_at = ${String(-1)}
|
|
73
|
+
AND (sync_failure IS NULL OR sync_failure = 'payload_invalid')
|
|
74
|
+
THEN 1 ELSE 0 END) AS skipped,
|
|
75
|
+
SUM(CASE WHEN synced_at = ${String(-1)}
|
|
76
|
+
AND sync_failure = 'deployment_refused' THEN 1 ELSE 0 END) AS refused,
|
|
77
|
+
SUM(CASE WHEN synced_at = ${String(-1)}
|
|
78
|
+
AND sync_failure = 'detached_undelivered' THEN 1 ELSE 0 END) AS detached
|
|
79
|
+
FROM audit_events
|
|
80
|
+
WHERE event_type IN (${V})`),this.captureSkipCountStmt=a.prepare(`SELECT COUNT(*) AS skipped
|
|
81
|
+
FROM audit_events
|
|
82
|
+
WHERE synced_at = ${String(-1)}
|
|
83
|
+
AND event_type IN (${T})`),this.fingerprintStmt=a.prepare(`SELECT endpoint_fingerprint AS fingerprint, backlog_before AS backlogBefore
|
|
84
|
+
FROM history_sync WHERE id = 1`),this.setFingerprintStmt=a.prepare(`UPDATE history_sync
|
|
85
|
+
SET endpoint_fingerprint = :fingerprint, backlog_before = :backlogBefore
|
|
86
|
+
WHERE id = 1`),this.disownCapturesStmt=a.prepare(`UPDATE audit_events SET outbox_owed = NULL
|
|
87
|
+
WHERE outbox_owed IS NOT NULL
|
|
88
|
+
AND event_type IN (${T})
|
|
89
|
+
AND started_at < :attachedAt`),this.rearmStmt=a.prepare(`UPDATE audit_events
|
|
90
|
+
SET synced_at = NULL, sync_failed_at = NULL, sync_failure = NULL
|
|
91
|
+
WHERE (synced_at > 0
|
|
92
|
+
OR sync_failure IN ('deployment_refused', 'detached_undelivered'))
|
|
93
|
+
AND event_type IN (${V})`),this.claimStmt=a.prepare(`UPDATE history_sync
|
|
94
|
+
SET owner_pid = :pid, owner_host = :host, acquired_at = :now, heartbeat_at = :now
|
|
95
|
+
WHERE id = 1
|
|
96
|
+
AND (owner_pid IS NULL
|
|
97
|
+
OR heartbeat_at IS NULL
|
|
98
|
+
OR heartbeat_at < :staleBefore
|
|
99
|
+
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
|
|
100
|
+
SET owner_pid = NULL, owner_host = NULL, acquired_at = NULL, heartbeat_at = NULL
|
|
101
|
+
WHERE id = 1 AND owner_pid = :pid`),this.closeWindowStmt=a.prepare(`UPDATE audit_events
|
|
102
|
+
SET synced_at = ${String(-1)},
|
|
103
|
+
sync_failed_at = :at,
|
|
104
|
+
sync_failure = 'detached_undelivered'
|
|
105
|
+
WHERE synced_at IS NULL
|
|
106
|
+
AND event_type IN (${V})
|
|
107
|
+
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,
|
|
108
|
+
acquired_at AS acquiredAt, heartbeat_at AS heartbeatAt
|
|
109
|
+
FROM history_sync WHERE id = 1`),this.inspectionsStmt=a.prepare(`SELECT d.rule_id AS ruleId,
|
|
110
|
+
d.name AS ruleName,
|
|
111
|
+
d.version AS ruleVersion,
|
|
112
|
+
d.category AS category,
|
|
113
|
+
d.severity AS severity,
|
|
114
|
+
f.span_start AS spanStart,
|
|
115
|
+
f.span_end AS spanEnd,
|
|
116
|
+
f.masked_match AS maskedMatch,
|
|
117
|
+
f.action_taken AS actionTaken,
|
|
118
|
+
f.confidence AS confidence
|
|
119
|
+
FROM inspection_findings f
|
|
120
|
+
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
121
|
+
WHERE f.audit_event_id = :auditEventId
|
|
122
|
+
ORDER BY f.span_start, f.id`)}inspectionsFor(a){return L(this.inspectionsStmt,{auditEventId:a})}pendingSessions(a,b){return L(this.sessionsStmt,{limit:a,before:b}).map(a=>a.sessionId)}pendingRows(a,b,c){return L(this.rowsStmt,{sessionId:a,limit:b,before:c})}pendingCaptureRows(a,b){return L(this.captureRowsStmt,{limit:a,before:b})}markCaptureOwed(a){this.markOwedStmt.run({id:a})}markCaptureBacklogOwed(a){return Number(this.markCaptureBacklogOwedStmt.run({before:a}).changes)}markSynced(a,b){this.stampAll(a,b,null)}markSkipped(a,b){this.stampAll(a,-1,"payload_invalid",b)}markRefused(a,b){this.stampAll(a,-1,"deployment_refused",b)}eachInTransaction(a,b){0!==a.length&&F(this.db,()=>{for(let c of a)b(c)},"IMMEDIATE")}stampAll(a,b,c,d){if(0===a.length)return;let e=null===c?null:d??null;F(this.db,()=>{for(let d of a)this.stampStmt.run({at:b,failedAt:e,failure:c,id:d})},"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)}partitionByKind(){return L(this.partitionByKindStmt,{}).map(a=>({kind:a.kind,queued:a.queued??0,inProgress:a.inProgress??0,synced:a.synced??0,failed:a.failed??0,refused:a.refused??0,detached:a.detached??0,total:a.total??0}))}partition(){let a=M(this.partitionStmt,{});return{queued:a?.queued??0,inProgress:a?.inProgress??0,synced:a?.synced??0,failed:a?.failed??0,refused:a?.refused??0,detached:a?.detached??0,total:a?.total??0}}counts(a){let b=M(this.countsStmt,{before:a}),c=M(this.captureSkipCountStmt);return{pending:b?.pending??0,sent:b?.sent??0,skipped:b?.skipped??0,refused:b?.refused??0,detached:b?.detached??0,capturesSkipped:c?.skipped??0}}deployment(){let a=M(this.fingerprintStmt);return{fingerprint:a?.fingerprint??void 0,backlogBefore:a?.backlogBefore??void 0}}rearmFor(a,b,c){this.ensureRowStmt.run(),F(this.db,()=>{let d=M(this.fingerprintStmt)?.fingerprint;this.rearmStmt.run(),null!=d&&d!==a&&this.disownCapturesStmt.run({attachedAt:b}),void 0!==c&&this.markCaptureBacklogOwedStmt.run({before:c}),this.setFingerprintStmt.run({fingerprint:a,backlogBefore:b})},"IMMEDIATE")}closeAttachedWindow(a,b){this.ensureRowStmt.run(),F(this.db,()=>{let c=M(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 F(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 M(this.leaseStmt)}}let ab=f.AJV.options;function ac(a){return"column"===a.kind?`column ${a.table}.${a.name}`:`table ${a.name}`}function ad(a){return a.split(/-->\s*statement-breakpoint/).map(a=>a.trim()).filter(a=>a.length>0)}let ae="0014_drop_legacy_events_findings";function af(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 ag=[{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 ah(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||(F(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 (?, ?)
|
|
123
|
+
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 ai(a,b){if(null==a)return b;try{return JSON.parse(a)}catch{return b}}function aj(a){if(null!=a)try{let b=JSON.parse(a);if("object"==typeof b&&null!==b)return b}catch{}}function ak(a){return Buffer.from(JSON.stringify(a)).toString("base64url")}function al(a){let b=aj(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 am(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return"UTC"}}let an={session:"session",prompt:"prompt",response:"response",tool_call:"tool",hook:"hook",detection:"detection",share:"share",permission:"permission",commit:"commit",error:"error",active:"active"},ao=Object.keys(an).map(a=>`'${a}'`).join(", ");function ap(a){if(!a)return[];let b=ai(a,null);return Array.isArray(b)?b:[]}let aq=f.tLs.ClaudeCode;function ar(a){let b=f.TUN.safeParse(a);return b.success?b.data:aq}function as(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:ar(a.harness),title:a.title||a.project||a.repo||`Session ${a.id.slice(0,8)}`,project:a.project??"",repo:a.repo??"",branches:ap(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 at(a){let b=an[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:N(a.internal),flagged:N(a.flagged),bodyExpired:null!==a.content_expired_at&&(a.title??"")===""}}let au=`
|
|
124
|
+
id,
|
|
125
|
+
event_type,
|
|
126
|
+
started_at,
|
|
127
|
+
coalesce(content, json_extract(attributes, '$.tool_name')) AS title,
|
|
128
|
+
content_expired_at,
|
|
129
|
+
coalesce(json_extract(attributes, '$.detail'), json_extract(attributes, '$.target')) AS detail,
|
|
130
|
+
coalesce(json_extract(attributes, '$.tool_name'), json_extract(attributes, '$.tool')) AS tool,
|
|
131
|
+
json_extract(attributes, '$.severity') AS severity,
|
|
132
|
+
json_extract(attributes, '$.link') AS link,
|
|
133
|
+
json_extract(attributes, '$.targetId') AS target_id,
|
|
134
|
+
json_extract(attributes, '$.internal') AS internal,
|
|
135
|
+
json_extract(attributes, '$.flagged') AS flagged`,av=`
|
|
136
|
+
SELECT root_session_id AS sessionId,
|
|
137
|
+
provider,
|
|
138
|
+
model,
|
|
139
|
+
service_tier AS serviceTier,
|
|
140
|
+
coalesce(sum(input_tokens), 0) AS inputTokens,
|
|
141
|
+
coalesce(sum(output_tokens), 0) AS outputTokens,
|
|
142
|
+
coalesce(sum(cache_creation_input_tokens), 0) AS cacheCreationTokens,
|
|
143
|
+
coalesce(sum(cache_read_input_tokens), 0) AS cacheReadTokens,
|
|
144
|
+
coalesce(sum(ephemeral_1h_input_tokens), 0) AS ephemeral1hTokens,
|
|
145
|
+
coalesce(sum(ephemeral_5m_input_tokens), 0) AS ephemeral5mTokens,
|
|
146
|
+
coalesce(sum(web_search_requests), 0) AS webSearchRequests`,aw="event_type = 'llm_call' AND attributes IS NOT NULL AND root_session_id IS NOT NULL",ax="GROUP BY root_session_id, provider, model, service_tier";function ay(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 az="event_type = 'session'",aA=`EXISTS (
|
|
147
|
+
SELECT 1 FROM audit_events c
|
|
148
|
+
WHERE c.root_session_id = audit_events.id
|
|
149
|
+
AND c.event_type NOT IN ('hook', 'config_scan'))`;class aB{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=am();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??am(),this.now()),d=P(this.db,`SELECT count(*) AS n FROM audit_events
|
|
150
|
+
WHERE ${az} AND started_at >= ? AND started_at < ?
|
|
151
|
+
AND ${aA}`,[b,c]),e=this.now()-18e5,f=P(this.db,`SELECT count(*) AS n FROM audit_events s INDEXED BY sqlite_autoindex_audit_events_1
|
|
152
|
+
WHERE s.event_type = 'session' AND s.ended_at IS NULL
|
|
153
|
+
AND s.id IN (
|
|
154
|
+
SELECT id FROM audit_events WHERE event_type = 'session' AND started_at >= ?
|
|
155
|
+
UNION
|
|
156
|
+
SELECT root_session_id FROM audit_events INDEXED BY idx_audit_started_at
|
|
157
|
+
WHERE started_at >= ?
|
|
158
|
+
UNION
|
|
159
|
+
SELECT root_session_id FROM audit_events INDEXED BY idx_audit_ended_at
|
|
160
|
+
WHERE ended_at >= ?)`,[e,e,e]),g=P(this.db,`SELECT count(*) AS n FROM audit_events
|
|
161
|
+
WHERE event_type = 'tool_call' AND started_at >= ? AND started_at < ?`,[b,c]);return Promise.resolve({sessionsToday:d,liveNow:f,toolCallsToday:g,findingsToday:P(this.db,`SELECT count(*) AS n FROM inspection_findings f
|
|
162
|
+
JOIN audit_events e ON e.id = f.audit_event_id
|
|
163
|
+
WHERE e.started_at >= ? AND e.started_at < ?`,[b,c]),egressToday:P(this.db,`SELECT count(DISTINCT json_extract(attributes, '$.destination')) AS n
|
|
164
|
+
FROM audit_events
|
|
165
|
+
WHERE event_type = 'share' AND started_at >= ? AND started_at < ?`,[b,c])})}listSessions(a){let b=a.cursor?al(a.cursor):null,c=a.to?(0,f.I8t)(a.to):this.now(),d=a.from?(0,f.I8t)(a.from):void 0,e=[az],g=[];if(a.harness&&a.harness.length>0&&(e.push(`coalesce(json_extract(attributes, '$.harness'), '${aq}') IN (${B(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=C(a.q);e.push(`(content LIKE ? ESCAPE '\\'
|
|
166
|
+
OR json_extract(attributes, '$.project') LIKE ? ESCAPE '\\'
|
|
167
|
+
OR json_extract(attributes, '$.repo') LIKE ? ESCAPE '\\'
|
|
168
|
+
OR json_extract(attributes, '$.branches') LIKE ? ESCAPE '\\'
|
|
169
|
+
OR EXISTS (
|
|
170
|
+
SELECT 1 FROM audit_events d
|
|
171
|
+
WHERE d.root_session_id = audit_events.id
|
|
172
|
+
AND (d.content LIKE ? ESCAPE '\\'
|
|
173
|
+
OR coalesce(json_extract(d.attributes, '$.detail'),
|
|
174
|
+
json_extract(d.attributes, '$.target')) LIKE ? ESCAPE '\\')))`),g.push(b,b,b,b,b,b)}let h=P(this.db,`SELECT count(*) AS n FROM audit_events
|
|
175
|
+
WHERE ${[...e,`NOT ${aA}`].join(" AND ")}`,g);a.excludeEmpty&&e.push(aA),b&&(e.push("(started_at < ? OR (started_at = ? AND id < ?))"),g.push(b.startedAtMs,b.startedAtMs,b.id));let i=a.limit,j=L(this.db.prepare(`SELECT id,
|
|
176
|
+
json_extract(attributes, '$.harness') AS harness,
|
|
177
|
+
content AS title,
|
|
178
|
+
json_extract(attributes, '$.project') AS project,
|
|
179
|
+
json_extract(attributes, '$.repo') AS repo,
|
|
180
|
+
json_extract(attributes, '$.branches') AS branches,
|
|
181
|
+
json_extract(attributes, '$.status') AS status,
|
|
182
|
+
started_at,
|
|
183
|
+
ended_at
|
|
184
|
+
FROM audit_events
|
|
185
|
+
WHERE ${e.join(" AND ")}
|
|
186
|
+
ORDER BY started_at DESC, id DESC
|
|
187
|
+
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=>as(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?ak({startedAtMs:p.started_at,id:p.id}):null,emptyCount:h})}getSession(a){let b=M(this.db.prepare(`SELECT id,
|
|
188
|
+
json_extract(attributes, '$.harness') AS harness,
|
|
189
|
+
content AS title,
|
|
190
|
+
json_extract(attributes, '$.project') AS project,
|
|
191
|
+
json_extract(attributes, '$.repo') AS repo,
|
|
192
|
+
json_extract(attributes, '$.branches') AS branches,
|
|
193
|
+
json_extract(attributes, '$.status') AS status,
|
|
194
|
+
json_extract(attributes, '$.host') AS host,
|
|
195
|
+
json_extract(attributes, '$.cwd') AS cwd,
|
|
196
|
+
json_extract(attributes, '$.models') AS models,
|
|
197
|
+
json_extract(attributes, '$.version') AS version,
|
|
198
|
+
json_extract(attributes, '$.files') AS files,
|
|
199
|
+
started_at,
|
|
200
|
+
ended_at
|
|
201
|
+
FROM audit_events
|
|
202
|
+
WHERE id = ? AND event_type = 'session'
|
|
203
|
+
LIMIT 1`),[a]);if(!b)return Promise.resolve(null);let c=L(this.db.prepare(`SELECT ${au}
|
|
204
|
+
FROM audit_events
|
|
205
|
+
WHERE (id = ? OR root_session_id = ?) AND event_type IN (${ao})
|
|
206
|
+
ORDER BY started_at ASC, id ASC`),[a,a]).map(at).filter(a=>null!==a),d=M(this.db.prepare(`SELECT
|
|
207
|
+
coalesce(sum(input_tokens), 0) AS input,
|
|
208
|
+
coalesce(sum(output_tokens), 0) AS output,
|
|
209
|
+
coalesce(sum(cache_creation_input_tokens), 0) AS cache_creation,
|
|
210
|
+
coalesce(sum(cache_read_input_tokens), 0) AS cache_read
|
|
211
|
+
FROM audit_events INDEXED BY idx_audit_session_type
|
|
212
|
+
WHERE root_session_id = ? AND event_type = 'llm_call'`),[a])??{input:0,output:0,cache_creation:0,cache_read:0},e=M(this.db.prepare(`SELECT model, provider FROM audit_events INDEXED BY idx_audit_session_type
|
|
213
|
+
WHERE root_session_id = ? AND event_type = 'llm_call'
|
|
214
|
+
ORDER BY started_at ASC, id ASC
|
|
215
|
+
LIMIT 1`),[a]),f=L(this.db.prepare(`SELECT coalesce(json_extract(attributes, '$.tool_name'), json_extract(attributes, '$.tool')) AS tool,
|
|
216
|
+
count(*) AS n
|
|
217
|
+
FROM audit_events INDEXED BY idx_audit_session
|
|
218
|
+
WHERE root_session_id = ? AND event_type = 'tool_call'
|
|
219
|
+
GROUP BY coalesce(json_extract(attributes, '$.tool_name'), json_extract(attributes, '$.tool'))`),[a]),g=L(this.db.prepare(`SELECT DISTINCT model FROM audit_events INDEXED BY idx_audit_session_type
|
|
220
|
+
WHERE root_session_id = ? AND event_type = 'llm_call' AND model IS NOT NULL AND model <> ''
|
|
221
|
+
ORDER BY model`),[a]).map(a=>a.model),h=P(this.db,`SELECT count(*) AS n FROM audit_events INDEXED BY idx_audit_session
|
|
222
|
+
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({...as(b,i,this.now()),host:b.host??"",cwd:b.cwd??"",models:g.length>0?g:ap(b.models),version:b.version??"",tokens:j,tools:Object.fromEntries(f.flatMap(a=>a.tool?[[a.tool,a.n]]:[])),files:ap(b.files),commits:h,events:c})}tokenReports(a){let b=L(this.db.prepare(`${av}
|
|
223
|
+
FROM audit_events INDEXED BY idx_audit_llm_usage
|
|
224
|
+
WHERE ${aw}${void 0===a?"":" AND started_at >= ?"}
|
|
225
|
+
${ax}`),void 0===a?void 0:[a]);return Promise.resolve((0,f.ryv)(ay(b),f.q_t))}tokenReportForSession(a){let b=L(this.db.prepare(`${av}
|
|
226
|
+
FROM audit_events
|
|
227
|
+
WHERE ${aw} AND root_session_id = ?
|
|
228
|
+
${ax}`),[a]);return Promise.resolve((0,f.ryv)(ay(b),f.q_t)[0]??null)}harnessFacets(a){let b=L(this.db.prepare(`SELECT DISTINCT coalesce(json_extract(attributes, '$.harness'), '${aq}') AS harness
|
|
229
|
+
FROM audit_events WHERE ${az}${void 0===a?"":" AND started_at >= ?"}`),void 0===a?void 0:[a]),c=new Set;for(let a of b)c.add(ar(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=B(a.length);for(let c of L(this.db.prepare(`SELECT ids.value AS id,
|
|
230
|
+
(SELECT max(started_at) FROM audit_events e WHERE e.root_session_id = ids.value) AS ms,
|
|
231
|
+
(SELECT max(ended_at) FROM audit_events e
|
|
232
|
+
WHERE e.root_session_id = ids.value AND e.ended_at IS NOT NULL) AS me
|
|
233
|
+
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 L(this.db.prepare(`SELECT root_session_id AS id, count(*) AS n
|
|
234
|
+
FROM audit_events INDEXED BY idx_audit_session_prompt
|
|
235
|
+
WHERE root_session_id IN (${c}) AND event_type = 'prompt'
|
|
236
|
+
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 L(this.db.prepare(`SELECT root_session_id AS id,
|
|
237
|
+
count(DISTINCT json_extract(attributes, '$.run_key')) AS n
|
|
238
|
+
FROM audit_events INDEXED BY idx_audit_session_run_key
|
|
239
|
+
WHERE root_session_id IN (${c}) AND event_type = 'llm_call'
|
|
240
|
+
AND json_extract(attributes, '$.run_key') IS NOT NULL
|
|
241
|
+
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 L(this.db.prepare(`SELECT e.root_session_id AS id, count(*) AS n FROM inspection_findings f
|
|
242
|
+
JOIN audit_events e ON e.id = f.audit_event_id
|
|
243
|
+
WHERE e.root_session_id IN (${c})
|
|
244
|
+
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 L(this.db.prepare(`SELECT root_session_id AS id,
|
|
245
|
+
count(DISTINCT json_extract(attributes, '$.destination')) AS n
|
|
246
|
+
FROM audit_events INDEXED BY idx_audit_session_share
|
|
247
|
+
WHERE root_session_id IN (${c}) AND event_type = 'share'
|
|
248
|
+
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 aC{constructor(a){this.db=a,this.insertStmt=a.prepare(`INSERT OR IGNORE INTO audit_events
|
|
249
|
+
(id, parent_id, root_session_id, event_type,
|
|
250
|
+
host_id, harness_id, source_project_id, started_at, ended_at,
|
|
251
|
+
severity, priority, content, content_hash, attributes)
|
|
252
|
+
VALUES
|
|
253
|
+
(:id, :parentId, :rootSessionId, :eventType,
|
|
254
|
+
:hostId, :harnessId, :sourceProjectId, :startedAt, :endedAt,
|
|
255
|
+
:severity, :priority, :content, :contentHash, :attributes)`),this.upsertLlmCallStmt=a.prepare(`INSERT INTO audit_events
|
|
256
|
+
(id, parent_id, root_session_id, event_type,
|
|
257
|
+
host_id, harness_id, source_project_id, started_at, ended_at,
|
|
258
|
+
severity, priority, content, content_hash, attributes)
|
|
259
|
+
VALUES
|
|
260
|
+
(:id, :parentId, :rootSessionId, :eventType,
|
|
261
|
+
:hostId, :harnessId, :sourceProjectId, :startedAt, :endedAt,
|
|
262
|
+
:severity, :priority, :content, :contentHash, :attributes)
|
|
263
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
264
|
+
attributes = excluded.attributes,
|
|
265
|
+
ended_at = excluded.ended_at
|
|
266
|
+
WHERE COALESCE(json_extract(excluded.attributes, '$.output_tokens'), 0)
|
|
267
|
+
> COALESCE(json_extract(audit_events.attributes, '$.output_tokens'), 0)`),this.upsertSessionRootStmt=a.prepare(`INSERT OR IGNORE INTO audit_events
|
|
268
|
+
(id, parent_id, root_session_id, event_type,
|
|
269
|
+
host_id, harness_id, source_project_id, started_at, ended_at,
|
|
270
|
+
severity, priority, content, content_hash, attributes)
|
|
271
|
+
VALUES
|
|
272
|
+
(:id, :parentId, :rootSessionId, :eventType,
|
|
273
|
+
:hostId, :harnessId, :sourceProjectId, :startedAt, :endedAt,
|
|
274
|
+
:severity, :priority, :content, :contentHash, :attributes)
|
|
275
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
276
|
+
parent_id = excluded.parent_id,
|
|
277
|
+
root_session_id = excluded.root_session_id,
|
|
278
|
+
host_id = excluded.host_id,
|
|
279
|
+
harness_id = excluded.harness_id,
|
|
280
|
+
source_project_id = excluded.source_project_id,
|
|
281
|
+
started_at = min(audit_events.started_at, excluded.started_at),
|
|
282
|
+
ended_at = excluded.ended_at,
|
|
283
|
+
severity = excluded.severity,
|
|
284
|
+
priority = excluded.priority,
|
|
285
|
+
content = excluded.content,
|
|
286
|
+
content_hash = excluded.content_hash,
|
|
287
|
+
attributes = excluded.attributes
|
|
288
|
+
WHERE audit_events.attributes IS NULL AND excluded.attributes IS NOT NULL`)}runInTransaction(a){F(this.db,a)}insertAuditEvent(a){let b=(0,f.V9M)(a);Number.isFinite(b.startedAt)&&("session"===b.eventType?this.upsertSessionRootStmt:this.insertStmt).run(O({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(O({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(O({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 M(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=aj(b.attributes)?.provider;if("string"==typeof c)return c}llmCallLeaves(){return L(this.db.prepare(`SELECT root_session_id AS sessionId, attributes
|
|
289
|
+
FROM audit_events
|
|
290
|
+
WHERE event_type = 'llm_call' AND attributes IS NOT NULL`))}}class aD{constructor(a){this.db=a;let b=a=>`
|
|
291
|
+
SELECT id, LENGTH(CAST(content AS BLOB)) AS bytes
|
|
292
|
+
FROM audit_events
|
|
293
|
+
WHERE content IS NOT NULL
|
|
294
|
+
AND started_at < :cutoff
|
|
295
|
+
AND event_type IN (${f.hfB})
|
|
296
|
+
${a}
|
|
297
|
+
ORDER BY started_at
|
|
298
|
+
LIMIT :limit`;this.candidatesStmt=this.db.prepare(b("")),this.candidatesSyncSafeStmt=this.db.prepare(b(`AND (event_type NOT IN (${T}) OR synced_at IS NOT NULL)`)),this.heldBySyncStmt=this.db.prepare(`
|
|
299
|
+
SELECT COUNT(*) AS n
|
|
300
|
+
FROM audit_events
|
|
301
|
+
WHERE content IS NOT NULL
|
|
302
|
+
AND started_at < :cutoff
|
|
303
|
+
AND event_type IN (${T})
|
|
304
|
+
AND synced_at IS NULL`),this.expireStmt=this.db.prepare("UPDATE audit_events SET content = NULL, content_expired_at = :now WHERE id = :id")}preview(a){let b=a.maxRows??5e4,c=(a.sweepSyncLane?this.candidatesStmt:this.candidatesSyncSafeStmt).all({cutoff:a.cutoff,limit:b});return{rowsExpired:c.length,bytesFreed:c.reduce((a,b)=>a+b.bytes,0),rowsHeldBySync:this.countHeldBySync(a)}}expire(a){let b=a.batchSize??500,c=a.maxRows??5e4,d=a.sweepSyncLane?this.candidatesStmt:this.candidatesSyncSafeStmt,e=0,f=0,g=!0;for(;e<c;){let h=Math.min(b,c-e),i=d.all({cutoff:a.cutoff,limit:h});if(0===i.length||(F(this.db,()=>{for(let b of i)this.expireStmt.run({id:b.id,now:a.now})},"IMMEDIATE"),e+=i.length,f+=i.reduce((a,b)=>a+b.bytes,0),i.length<h))break;e>=c&&(g=0===d.all({cutoff:a.cutoff,limit:1}).length)}return{rowsExpired:e,bytesFreed:f,rowsHeldBySync:this.countHeldBySync(a),done:g}}countHeldBySync(a){return a.sweepSyncLane?0:this.heldBySyncStmt.get({cutoff:a.cutoff}).n}}class aE{constructor(a){this.db=a,this.insertStmt=a.prepare(`INSERT OR IGNORE INTO classified_data (id, class, label, attributes)
|
|
305
|
+
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(O({id:d.id,class:d.class,label:d.label,attributes:d.attributes})),c}}function aF(a){return M(a.prepare(`SELECT id, started_at, attributes FROM audit_events
|
|
306
|
+
WHERE event_type = 'config_scan'
|
|
307
|
+
ORDER BY started_at DESC, id DESC LIMIT 1`))}class aG{constructor(a){this.db=a}report(){let a=aF(this.db);if(!a)return{scannedAt:null,skills:[],hooks:[],mcpServers:[],configFiles:[],topics:[]};let b=L(this.db.prepare(`SELECT id, object_type AS objectType, title, location, attributes FROM inventory
|
|
308
|
+
WHERE object_type IN ('skill', 'hook', 'mcp_server', 'config_file') AND last_seen >= :startedAt
|
|
309
|
+
ORDER BY object_type, title`),{startedAt:a.started_at}),c=L(this.db.prepare(`SELECT f.masked_match AS maskedMatch, d.rule_id AS ruleId, d.name AS name
|
|
310
|
+
FROM inspection_findings f
|
|
311
|
+
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
312
|
+
WHERE f.audit_event_id = :scanId`),{scanId:a.id}),d=[],e=[],f=[],g=[],h=this.trustOverrides();for(let a of b){let b=aj(a.attributes);b&&("skill"===a.objectType?d.push(function(a,b){let c={id:a.id,name:a.title??"(unnamed)",source:aH(b.source)??"unknown",scope:aH(b.scope)??"unknown",status:"unknown"},d=aH(b.description);void 0!==d&&(c.description=d);let e=aH(b.version);void 0!==e&&(c.installedVersion=e);let f=aH(b.updated_at);return void 0!==f&&(c.updatedAt=f),c}(a,b)):"hook"===a.objectType?e.push(function(a,b,c){let d=aH(b.command)??"",e=c.filter(a=>a.maskedMatch===d),f={id:a.id,event:aH(b.event)??"unknown",command:d,scope:aH(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=aH(b.matcher);void 0!==g&&(f.matcher=g);let h=aH(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:aH(b.scope)??"unknown",transport:aH(b.transport)??"unknown",trust:c.get(a.id)??"unapproved"},e=aH(b.command);void 0!==e&&(d.command=e);let f=aH(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=aH(b.plugin_name);void 0!==g&&(d.pluginName=g);let h=aH(b.marketplace);void 0!==h&&(d.marketplace=h);let i=aH(b.project);return void 0!==i&&(d.project=i),d}(a,b,h)):g.push(function(a,b){let c=aH(b.scope)??"unknown",d={id:a.id,name:a.title??"(unnamed)",path:a.location??"",scope:c,kind:aH(b.kind)??"Configuration file",untracked:"local"===c},e=aH(b.detail);void 0!==e&&(d.detail=e),"number"==typeof b.entry_count&&(d.entryCount=b.entry_count);let f=aH(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=aj(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=L(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 aH(a){return"string"==typeof a?a:void 0}function aI(a){let b=ai(a,[]);if(!Array.isArray(b))return[];let c=[];for(let a of b)a&&"object"==typeof a&&c.push(a);return c}function aJ(a,b){return a.version!==b.version||a.rulesJson!==b.rulesJson}class aK{constructor(a,b=()=>Date.now()){this.db=a,this.now=b}listDetections(a){let b=L(this.db.prepare(`SELECT namespace, pack_id AS packId, version, name, enabled, policy_id AS policyId,
|
|
313
|
+
rules_json AS rulesJson
|
|
314
|
+
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:N(a.enabled),ruleCount:aI(a.rulesJson).length,policyId:a.policyId,...b&&aJ(a,b)?{latestVersion:b.version}:{}}});return Promise.resolve((0,f.plk)(d,a))}availableByPack(){return new Map(L(this.db.prepare(`SELECT namespace, pack_id AS packId, version, rules_json AS rulesJson
|
|
315
|
+
FROM available_packs`)).map(a=>[`${a.namespace}/${a.packId}`,a]))}getDetectionStats(){let a=L(this.db.prepare("SELECT enabled, rules_json AS rulesJson FROM installed_packs")),b=0,c=0,d=new Set;for(let e of a){N(e.enabled)&&(c+=1);let a=aI(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=M(this.db.prepare(`SELECT namespace, pack_id AS packId, version, name, enabled, policy_id AS policyId,
|
|
316
|
+
rules_json AS rulesJson, updated_at AS updatedAt
|
|
317
|
+
FROM installed_packs
|
|
318
|
+
WHERE namespace = ? AND pack_id = ?`),[c,d]);if(!e)return Promise.resolve(null);let g=aI(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?aJ(e,j)?{available:!0,latestVersion:j.version,latestRuleCount:aI(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:N(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=B(a.length);return P(this.db,`SELECT count(*) AS n
|
|
319
|
+
FROM inspection_findings f
|
|
320
|
+
JOIN audit_events e ON e.id = f.audit_event_id
|
|
321
|
+
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
322
|
+
WHERE e.started_at >= ?
|
|
323
|
+
AND e.event_type IN (${f.hfB})
|
|
324
|
+
AND d.rule_id IN (${c})`,[b,...a])}}class aL{constructor(a){this.db=a}contentHashes(){return Promise.resolve(new Set(L(this.db.prepare(`SELECT content_hash FROM audit_events
|
|
325
|
+
WHERE event_type IN (${f.hfB})`)).map(a=>a.content_hash)))}}let aM=864e5;class aN 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 aO 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 aP=`revoked_at IS NULL
|
|
326
|
+
AND (expires_at IS NULL OR expires_at > :now)
|
|
327
|
+
AND (max_uses IS NULL OR use_count < max_uses)`,aQ=`capability = 'reveal_to_model'
|
|
328
|
+
AND conditions IS NULL
|
|
329
|
+
AND ${aP}`;class aR{constructor(a,b=()=>Date.now()){this.db=a,this.now=b,this.consumeStmt=a.prepare(`UPDATE exceptions
|
|
330
|
+
SET use_count = use_count + 1, last_used_at = :now, updated_at = :now
|
|
331
|
+
WHERE id = :id AND ${aP}`),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)
|
|
332
|
+
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;F(this.db,()=>{if(1!==Number(this.db.prepare(`UPDATE exceptions
|
|
333
|
+
SET revoked_at = :now, revoked_by = :revokedBy,
|
|
334
|
+
revoke_reason = 'superseded by a new grant for the same value',
|
|
335
|
+
updated_at = :now
|
|
336
|
+
WHERE rule_id = :ruleId AND value_fingerprint = :valueFingerprint
|
|
337
|
+
AND key_version = :keyVersion AND revoked_at IS NULL
|
|
338
|
+
AND ((expires_at IS NOT NULL AND expires_at <= :now)
|
|
339
|
+
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 aN(a.ruleId);this.insertExceptionRow(b,a,c)},"IMMEDIATE")}let d=M(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 aS(d)}insertExceptionRow(a,b,c){this.db.prepare(`INSERT INTO exceptions (
|
|
340
|
+
id, rule_id, category, value_fingerprint, key_version, masked_value,
|
|
341
|
+
capability, scope, expires_at, max_uses, use_count, last_used_at,
|
|
342
|
+
justification, conditions, created_by, created_via, created_at, updated_at
|
|
343
|
+
) VALUES (
|
|
344
|
+
:id, :ruleId, :category, :valueFingerprint, :keyVersion, :maskedValue,
|
|
345
|
+
:capability, :scope, :expiresAt, :maxUses, 0, NULL, :justification,
|
|
346
|
+
:conditions, :createdBy, :createdVia, :now, :now
|
|
347
|
+
)`).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 ${aP}`;return Promise.resolve(R(L(this.db.prepare(`SELECT * FROM exceptions ${b} ORDER BY created_at DESC, rowid DESC`),a?.includeTerminal?{}:{now:this.now()}),aS))}getByIdPrefix(a){if(0===a.length)return Promise.resolve(void 0);let b=L(this.db.prepare(String.raw`SELECT * FROM exceptions WHERE id LIKE :pattern ESCAPE '\' LIMIT 2`),{pattern:`${A(a)}%`});if(b.length>1)return Promise.reject(new aO(a));let c=b[0];if(!c)return Promise.resolve(void 0);try{return Promise.resolve(aS(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
|
|
348
|
+
SET revoked_at = :now, revoked_by = :revokedBy, revoke_reason = :reason, updated_at = :now
|
|
349
|
+
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(R(L(this.db.prepare(`SELECT * FROM exceptions
|
|
350
|
+
WHERE key_version = :keyVersion AND ${aP}
|
|
351
|
+
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-aM}),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(L(this.db.prepare(`SELECT * FROM blocked_detections
|
|
352
|
+
WHERE blocked_at > :cutoff
|
|
353
|
+
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=M(this.db.prepare(`SELECT id FROM exceptions
|
|
354
|
+
WHERE rule_id = :ruleId AND value_fingerprint = :valueFingerprint
|
|
355
|
+
AND key_version = :keyVersion
|
|
356
|
+
AND ${aQ}
|
|
357
|
+
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
|
|
358
|
+
WHERE updated_at < :cutoff
|
|
359
|
+
AND (revoked_at IS NOT NULL
|
|
360
|
+
OR (expires_at IS NOT NULL AND expires_at <= :now)
|
|
361
|
+
OR (max_uses IS NOT NULL AND use_count >= max_uses))`).run({cutoff:b-a,now:b}).changes))}}function aS(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 aT(a){return`(
|
|
362
|
+
SELECT fr.status FROM finding_resolution fr
|
|
363
|
+
WHERE fr.finding_key = ${a}.finding_key
|
|
364
|
+
ORDER BY fr.created_at DESC, fr.rowid DESC
|
|
365
|
+
LIMIT 1
|
|
366
|
+
)`}let aU=`(
|
|
367
|
+
SELECT finding_key, status, method, resolved_at FROM (
|
|
368
|
+
SELECT fr.finding_key, fr.status, fr.method, fr.resolved_at,
|
|
369
|
+
ROW_NUMBER() OVER (
|
|
370
|
+
PARTITION BY fr.finding_key
|
|
371
|
+
ORDER BY fr.created_at DESC, fr.rowid DESC
|
|
372
|
+
) AS rn
|
|
373
|
+
FROM finding_resolution fr
|
|
374
|
+
) WHERE rn = 1
|
|
375
|
+
)`;function aV(a){return null===a||""===a?[]:a.split(",")}function aW(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}),delivery:(0,f.xHz)({kind:a.kind,syncedAt:a.synced_at,syncClaimedAt:a.sync_claimed_at,syncFailedAt:a.sync_failed_at,syncFailure:a.sync_failure,outboxOwed:a.outbox_owed})}}let aX=`f.id AS id, d.rule_id AS rule_id, d.category AS category,
|
|
376
|
+
d.severity AS severity, f.masked_match AS masked_match,
|
|
377
|
+
f.action_taken AS action_taken, f.confidence AS confidence,
|
|
378
|
+
e.started_at AS occurred_at,
|
|
379
|
+
e.source_tool AS source_tool,
|
|
380
|
+
e.repo AS repo,
|
|
381
|
+
e.file_path AS file,
|
|
382
|
+
e.tool_name AS tool_name,
|
|
383
|
+
f.audit_event_id AS event_id, e.root_session_id AS session_id,
|
|
384
|
+
e.event_type AS kind, f.finding_key AS finding_key,
|
|
385
|
+
${aT("f")} AS latest_status,
|
|
386
|
+
e.synced_at AS synced_at, e.sync_claimed_at AS sync_claimed_at,
|
|
387
|
+
e.sync_failed_at AS sync_failed_at, e.sync_failure AS sync_failure,
|
|
388
|
+
e.outbox_owed AS outbox_owed`;class aY{constructor(a){this.db=a}recentFindings(a){let b=a?.limit??50;return Promise.resolve(L(this.db.prepare(`SELECT f.id, f.audit_event_id AS event_id, d.rule_id, d.category, d.severity,
|
|
389
|
+
f.masked_match, f.action_taken, f.confidence, e.started_at AS occurred_at,
|
|
390
|
+
e.source_tool AS source_tool,
|
|
391
|
+
e.event_type AS kind
|
|
392
|
+
FROM audit_events e
|
|
393
|
+
CROSS JOIN inspection_findings f ON f.audit_event_id = e.id
|
|
394
|
+
CROSS JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
395
|
+
WHERE +e.event_type IN (${f.hfB})
|
|
396
|
+
ORDER BY e.started_at DESC, f.rowid DESC
|
|
397
|
+
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(P(this.db,`SELECT count(*) AS n FROM inspection_findings f
|
|
398
|
+
JOIN audit_events e ON e.id = f.audit_event_id
|
|
399
|
+
WHERE e.root_session_id = :sessionId
|
|
400
|
+
AND e.event_type IN (${f.hfB})`,{sessionId:a})):Promise.resolve(0)}sessionFirings(a){return Object.fromEntries(Q(this.db,`SELECT d.rule_id AS k, count(*) AS n
|
|
401
|
+
FROM inspection_findings f
|
|
402
|
+
JOIN audit_events e ON e.id = f.audit_event_id
|
|
403
|
+
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
404
|
+
WHERE e.root_session_id = :sessionId
|
|
405
|
+
AND e.event_type NOT IN (${f.hfB})
|
|
406
|
+
GROUP BY d.rule_id`,{sessionId:a}))}listFindingTypes(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=(0,f.Ple)(g),i={severity:a.severity,providers:a.provider,actions:a.action,statuses:a.status,subtype:a.subtype,q:a.q},j=(0,f.rG)(h,i),k=(0,f.X0p)((0,f.tXp)(h,i)),l=a.status??[],m={findings:k.reduce((a,b)=>{if(0===l.length)return a+b.instanceCount;let c=g.get(b.id);return a+(c?(0,f.Bfj)(c.statusInputs,l)??b.instanceCount:b.instanceCount)},0),types:k.length},n=a.limit??f.IYX,o=void 0===a.cursor?null:function(a){let b=aj(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),p=null===o?0:function(a,b){let c=a.findIndex(a=>(0,f._6W)(a,b)>0);return -1===c?a.length:c}(k,o),q=k.slice(p,p+n),r=q.at(-1),s=p+n<k.length&&r?function(a){let b={sev:a.severity,t:a.latestDetectedAt,id:a.id};return Buffer.from(JSON.stringify(b)).toString("base64url")}(r):null,t=void 0===a.includeId||""===a.includeId?void 0:function(a,b,c){if(!b.some(a=>a.id===c))return a.find(a=>a.id===c)}(k,q,a.includeId);return Promise.resolve({totals:m,facets:j,items:[...q,...t?[t]:[]],nextCursor:s,...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,deliveries:a.deployment,tools:a.tool,repo:a.repo,file:a.file,q:a.q},d=a.limit??f.b2L,e=void 0===a.cursor?null:al(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?ak({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,deliveries:a.deployment,tools:a.tool,q:a.q},c=a.limit??f.p$t,d=void 0===a.cursor?null:function(a){let b=aj(Buffer.from(a,"base64url").toString("utf8"));return void 0!==b&&"string"==typeof b.sev&&"string"==typeof b.t&&"string"==typeof b.r&&"string"==typeof b.f?{maxSeverity:b.sev,latestDetectedAt:b.t,repo:b.r,file:b.f}:null}(a.cursor),e=new Map,g=(0,f.fj8)(b),h=0;for(let c of this.scanFindingRows({sessionId:a.sessionId,from:a.from})){if(g.add(c),!(0,f.am1)(c,b))continue;h+=1;let a=e.get(c.repo);void 0===a&&(a=new Map,e.set(c.repo,a));let d=a.get(c.file);void 0===d&&(d=(0,f.SSj)(),a.set(c.file,d)),(0,f._5V)(d,c)}let i=[];for(let[a,b]of e)for(let[c,d]of b){let b=(0,f.JB8)(d.statuses);i.push({id:(0,f.ZoN)(a,c),repo:a,file:c,instanceCount:d.instanceCount,maxSeverity:d.maxSeverity,latestDetectedAt:d.latestDetectedAt,...void 0===b?{}:{status:b},ruleIds:[...d.ruleIds]})}i.sort(f.hml);let j=null===d?0:function(a,b){let c=a.findIndex(a=>(0,f.hml)(a,b)>0);return -1===c?a.length:c}(i,d),k=i.slice(j,j+c),l=k.at(-1),m=j+c<i.length&&l?function(a){let b={sev:a.maxSeverity,t:a.latestDetectedAt,r:a.repo,f:a.file};return Buffer.from(JSON.stringify(b)).toString("base64url")}(l):null,n=void 0===a.includeId||""===a.includeId?void 0:function(a,b,c){if(!b.some(a=>a.id===c))return a.find(a=>a.id===c)}(i,k,a.includeId);return Promise.resolve({totals:{findings:h,locations:i.length},facets:g.facets(),items:[...k,...n?[n]:[]],nextCursor:m})}*scanFindingRows(a){let{sql:b,params:c}=this.findingScanSql(a);for(let a of function*(a,b){for(let c of void 0===b?a.iterate():Array.isArray(b)?a.iterate(...b):a.iterate(b))yield c}(this.db.prepare(b),c))yield aW(a)}findingInstance(a){let b=this.db.prepare(`SELECT ${aX}
|
|
407
|
+
FROM inspection_findings f
|
|
408
|
+
JOIN audit_events e ON e.id = f.audit_event_id
|
|
409
|
+
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
410
|
+
WHERE f.id = ?`).get(a);return Promise.resolve(void 0===b?null:(0,f.MgS)(aW(b)))}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 ${aX}
|
|
411
|
+
FROM audit_events e
|
|
412
|
+
CROSS JOIN inspection_findings f ON f.audit_event_id = e.id
|
|
413
|
+
CROSS JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
414
|
+
WHERE ${b.join(" AND ")}
|
|
415
|
+
ORDER BY e.started_at DESC, f.id DESC`,params:c}}groupAggregates(a,b){let c=a?`, group_concat(DISTINCT e.repo) AS repos,
|
|
416
|
+
group_concat(DISTINCT e.file_path) AS files,
|
|
417
|
+
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,
|
|
418
|
+
-- BARE columns beside max(latest_at), which is deliberate and
|
|
419
|
+
-- is SQLite's documented behaviour: with a single min()/max()
|
|
420
|
+
-- in an aggregate query, every bare column takes its value from
|
|
421
|
+
-- the row that produced the extremum. So these are the severity
|
|
422
|
+
-- and category of the definition whose finding is NEWEST, which
|
|
423
|
+
-- is what the row-based build they replaced read off its first
|
|
424
|
+
-- (newest-first) row.
|
|
425
|
+
--
|
|
426
|
+
-- min() is WRONG here and was the defect: inspection_definitions
|
|
427
|
+
-- holds one row per rule VERSION (see its writer — a version bump
|
|
428
|
+
-- mints a new row), so a rule whose severity moved between
|
|
429
|
+
-- versions has several, and min() picks the ALPHABETICALLY
|
|
430
|
+
-- smallest — 'low' over 'medium', but 'critical' over 'high'.
|
|
431
|
+
-- That is arbitrary in direction, and it feeds the badge, the
|
|
432
|
+
-- filter, the facet counts and the primary sort key.
|
|
433
|
+
--
|
|
434
|
+
-- Adding a second min()/max() aggregate here would make these
|
|
435
|
+
-- bare columns ambiguous again; keep max(latest_at) the only one.
|
|
436
|
+
severity,
|
|
437
|
+
category,
|
|
438
|
+
sum(tuple_count) AS instance_count,
|
|
439
|
+
max(latest_at) AS latest_at,
|
|
440
|
+
group_concat(source_tools) AS source_tools,
|
|
441
|
+
group_concat(actions_taken) AS actions_taken,
|
|
442
|
+
group_concat(status_tuple || '|' || tuple_count) AS status_inputs,
|
|
443
|
+
group_concat(repos) AS repos,
|
|
444
|
+
group_concat(files) AS files,
|
|
445
|
+
group_concat(tool_names) AS tool_names
|
|
446
|
+
FROM (
|
|
447
|
+
SELECT d.rule_id AS rule_id,
|
|
448
|
+
-- Severity and category are columns of the DEFINITION, and
|
|
449
|
+
-- a rule can have SEVERAL definitions (one per version), so
|
|
450
|
+
-- these are grouped on below and resolved to the newest
|
|
451
|
+
-- firing version by the outer query's bare-column select.
|
|
452
|
+
-- They ride the aggregate because the type build has no rows
|
|
453
|
+
-- to read them off — see buildFindingTypes.
|
|
454
|
+
d.severity AS severity,
|
|
455
|
+
d.category AS category,
|
|
456
|
+
e.event_type || '|' ||
|
|
457
|
+
(CASE WHEN f.finding_key IS NULL THEN '' ELSE 'k' END) || '|' ||
|
|
458
|
+
coalesce(latest.status, '') AS status_tuple,
|
|
459
|
+
count(*) AS tuple_count,
|
|
460
|
+
max(e.started_at) AS latest_at,
|
|
461
|
+
group_concat(DISTINCT e.source_tool) AS source_tools,
|
|
462
|
+
group_concat(DISTINCT f.action_taken) AS actions_taken
|
|
463
|
+
${c}
|
|
464
|
+
FROM inspection_findings f
|
|
465
|
+
JOIN audit_events e ON e.id = f.audit_event_id
|
|
466
|
+
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
467
|
+
LEFT JOIN ${aU} latest
|
|
468
|
+
ON latest.finding_key = f.finding_key
|
|
469
|
+
${b.predicate}
|
|
470
|
+
GROUP BY d.rule_id, d.severity, d.category, status_tuple
|
|
471
|
+
)
|
|
472
|
+
GROUP BY rule_id`).all(b.params).map(b=>[b.rule_id,{instanceCount:b.instance_count,severity:b.severity,category:b.category,sourceTools:aV(b.source_tools),actionsTaken:aV(b.actions_taken),statusInputs:aV(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=P(this.db,`SELECT count(*) AS n FROM inspection_findings f
|
|
473
|
+
JOIN audit_events e ON e.id = f.audit_event_id
|
|
474
|
+
WHERE e.event_type IN (${f.hfB})`),b=Object.fromEntries(f.S8C.map(a=>[a,0]));for(let a of L(this.db.prepare(`SELECT f.action_taken AS action_taken, count(*) AS c
|
|
475
|
+
FROM inspection_findings f
|
|
476
|
+
JOIN audit_events e ON e.id = f.audit_event_id
|
|
477
|
+
WHERE e.event_type IN (${f.hfB})
|
|
478
|
+
GROUP BY f.action_taken`)))Object.hasOwn(b,a.action_taken)&&(b[a.action_taken]=a.c);let c={critical:0,high:0,medium:0,low:0};for(let a of L(this.db.prepare(`SELECT d.severity AS severity, count(*) AS c
|
|
479
|
+
FROM inspection_findings f
|
|
480
|
+
JOIN audit_events e ON e.id = f.audit_event_id
|
|
481
|
+
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
482
|
+
LEFT JOIN ${aU} latest
|
|
483
|
+
ON latest.finding_key = f.finding_key
|
|
484
|
+
WHERE e.event_type IN (${f.hfB})
|
|
485
|
+
AND (latest.status IS NULL OR latest.status != 'resolved')
|
|
486
|
+
GROUP BY d.severity`)))Object.hasOwn(c,a.severity)&&(c[a.severity]=a.c);let d=f.IgC,e=new Set(L(this.db.prepare(`SELECT DISTINCT json_extract(target, '$.category') AS category
|
|
487
|
+
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=L(this.db.prepare(`SELECT date(e.started_at / 1000, 'unixepoch') AS day, f.action_taken AS action, count(*) AS c
|
|
488
|
+
FROM inspection_findings f
|
|
489
|
+
JOIN audit_events e ON e.id = f.audit_event_id
|
|
490
|
+
WHERE e.started_at >= :since
|
|
491
|
+
AND e.event_type IN (${f.hfB})
|
|
492
|
+
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)))}}class aZ{constructor(a){this.db=a,this.insertStmt=a.prepare(`INSERT OR IGNORE INTO inspection_definitions
|
|
493
|
+
(id, rule_id, name, category, severity, definition, version)
|
|
494
|
+
VALUES
|
|
495
|
+
(: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 a${constructor(a){this.db=a,this.insertStmt=a.prepare(`INSERT INTO inspection_findings
|
|
496
|
+
(id, audit_event_id, inspection_definition_id, classified_data_id,
|
|
497
|
+
span_start, span_end, masked_match, action_taken, confidence,
|
|
498
|
+
finding_key, first_detected_at)
|
|
499
|
+
VALUES
|
|
500
|
+
(:id, :auditEventId, :inspectionDefinitionId, :classifiedDataId,
|
|
501
|
+
:spanStart, :spanEnd, :maskedMatch, :actionTaken, :confidence,
|
|
502
|
+
:findingKey,
|
|
503
|
+
COALESCE(:firstDetectedAt, (SELECT started_at FROM audit_events WHERE id = :auditEventId)))
|
|
504
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
505
|
+
inspection_definition_id = excluded.inspection_definition_id
|
|
506
|
+
ON CONFLICT (finding_key) DO UPDATE SET
|
|
507
|
+
audit_event_id = excluded.audit_event_id,
|
|
508
|
+
inspection_definition_id = excluded.inspection_definition_id,
|
|
509
|
+
classified_data_id = excluded.classified_data_id,
|
|
510
|
+
span_start = excluded.span_start,
|
|
511
|
+
span_end = excluded.span_end,
|
|
512
|
+
masked_match = excluded.masked_match,
|
|
513
|
+
action_taken = excluded.action_taken,
|
|
514
|
+
confidence = excluded.confidence`),this.sessionDupStmt=a.prepare(`SELECT 1 FROM inspection_findings f
|
|
515
|
+
JOIN audit_events e ON e.id = f.audit_event_id
|
|
516
|
+
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
517
|
+
WHERE d.rule_id = :ruleId AND f.masked_match = :maskedMatch
|
|
518
|
+
AND e.root_session_id = :sessionId
|
|
519
|
+
AND e.event_type IN (${f.hfB})
|
|
520
|
+
LIMIT 1`),this.eventDupStmt=a.prepare(`SELECT 1 FROM inspection_findings f
|
|
521
|
+
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
522
|
+
WHERE f.audit_event_id = :auditEventId AND d.rule_id = :ruleId
|
|
523
|
+
AND f.masked_match = :maskedMatch
|
|
524
|
+
AND f.span_start = :spanStart AND f.span_end = :spanEnd
|
|
525
|
+
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(O({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 a_=c(48161);function a0(){return(0,e.join)((0,a_.homedir)(),".aka")}function a1(a=a0()){return(0,e.join)(a,"settings")}function a2(a=a0()){return(0,e.join)(a,"data")}function a3(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=aj(a);if(!c)continue;let e=f.ZXz.safeParse(c);if(e.success)return e.data}return null}function a4(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.bodyRetention&&(e.bodyRetention=d.bodyRetention),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 a5(a=a0()){return a4(a6(a),a3())}function a6(a){let b=function(a){let b;try{b=(0,d.readFileSync)(a,"utf8")}catch{return null}return aj(b)??null}((0,e.join)(a1(a),"settings.json"));if(!b)return(0,f.i1j)();try{return f.hd_.parse(b)}catch{return(0,f.i1j)()}}function a7(a=a0(),b){let c=void 0===b?a3():b;return{settings:a4(a6(a),c),managed:c?{present:!0,...void 0===c.organization?{}:{organization:c.organization},lockedFields:c.lockedFields,...void 0===c.unknownLockedFields?{}:{unknownLockedCount:c.unknownLockedFields.length},...void 0===c.unknownValueFields?{}:{unknownValueCount:c.unknownValueFields.length}}:f.MhX}}new Int32Array(new SharedArrayBuffer(4));class a8 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 a9(a=a0()){if(!(0,f.lgf)(a5(a)))return null;let b=function(a=a0()){try{let b=(0,d.readFileSync)((0,e.join)(a2(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 ba(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 bb=f.Jr;function bc(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 bd(a){let b=/^(\d+)\.(\d+)\.(\d+)/.exec(a);return b?[Number(b[1]),Number(b[2]),Number(b[3])]:null}class be{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)
|
|
526
|
+
VALUES (:id, :namespace, :packId, :version, :name, :rulesJson, 1, :now, :now)
|
|
527
|
+
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)
|
|
528
|
+
VALUES (:id, :namespace, :packId, :version, :name, :rulesJson, :recordedBy, :now)
|
|
529
|
+
ON CONFLICT (namespace, pack_id) DO UPDATE SET
|
|
530
|
+
version = excluded.version,
|
|
531
|
+
name = excluded.name,
|
|
532
|
+
rules_json = excluded.rules_json,
|
|
533
|
+
recorded_by = excluded.recorded_by,
|
|
534
|
+
updated_at = excluded.updated_at
|
|
535
|
+
WHERE available_packs.version <> excluded.version
|
|
536
|
+
OR available_packs.name <> excluded.name
|
|
537
|
+
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
|
|
538
|
+
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()===bc(c))return;let d=Date.now();F(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=bd(a.version);if(null===c)return!0;let d=bd(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(L(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=ai(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=L(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 F(this.db,()=>{this.db.exec("UPDATE _pack_write_gate SET open = 1 WHERE id = 1");let d=this.db.prepare(`UPDATE installed_packs SET
|
|
539
|
+
version = (SELECT a.version FROM available_packs a
|
|
540
|
+
WHERE a.namespace = :namespace AND a.pack_id = :packId),
|
|
541
|
+
name = (SELECT a.name FROM available_packs a
|
|
542
|
+
WHERE a.namespace = :namespace AND a.pack_id = :packId),
|
|
543
|
+
rules_json = (SELECT a.rules_json FROM available_packs a
|
|
544
|
+
WHERE a.namespace = :namespace AND a.pack_id = :packId),
|
|
545
|
+
updated_at = :now
|
|
546
|
+
WHERE namespace = :namespace AND pack_id = :packId
|
|
547
|
+
AND EXISTS (SELECT 1 FROM available_packs a
|
|
548
|
+
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=L(this.db.prepare(`SELECT enabled, policy_id AS policyId, rules_json AS rulesJson, version,
|
|
549
|
+
namespace, pack_id AS packId
|
|
550
|
+
FROM installed_packs
|
|
551
|
+
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(!N(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=L(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!==ba(e)&&(null===b||function(a,b){let c=ba(a),d=ba(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(M(this.db.prepare(`SELECT count(*) AS packs,
|
|
552
|
+
coalesce(sum(json_array_length(rules_json)), 0) AS rules,
|
|
553
|
+
coalesce(sum(enabled), 0) AS enabled
|
|
554
|
+
FROM installed_packs`))??{packs:0,rules:0,enabled:0})}countsByPolicyId(){return Q(this.db,`SELECT coalesce(policy_id, '${bb}') AS k, count(*) AS n
|
|
555
|
+
FROM installed_packs
|
|
556
|
+
GROUP BY k`)}listByPolicyId(a){return L(this.db.prepare(`SELECT namespace, pack_id AS packId, name, enabled, rules_json AS rulesJson
|
|
557
|
+
FROM installed_packs
|
|
558
|
+
WHERE coalesce(policy_id, '${bb}') = ?
|
|
559
|
+
ORDER BY name ASC`),[a]).map(a=>({id:`${a.namespace}/${a.packId}`,name:a.name,ruleCount:aI(a.rulesJson).length,enabled:N(a.enabled)}))}packFloorRules(a,b){let c=M(this.packRulesStmt,[a,b]);return c?aI(c.rulesJson).map(a=>({id:a.id,category:a.category})):[]}policyFloor(a,b){return void 0===this.baseDir?null:function(a,b=a0()){let c=a9(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=a9(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 a8(`${a}/${b}`,c,d.floor,e)}return Number(this.db.prepare(`UPDATE installed_packs SET policy_id = :policyId, updated_at = :now
|
|
560
|
+
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 a8(`${a}/${b}`,null,d.floor,e)}return Number(this.db.prepare(`UPDATE installed_packs SET enabled = :enabled, updated_at = :now
|
|
561
|
+
WHERE namespace = :namespace AND pack_id = :packId`).run({enabled:+!!c,now:Date.now(),namespace:a,packId:b}).changes)>0}storedSignature(){return bc(L(this.signatureStmt))}}class bf{constructor(a){this.db=a,this.upsertStmt=a.prepare(`INSERT INTO inventory
|
|
562
|
+
(id, object_type, location, title, host_id, attributes, first_seen, last_seen)
|
|
563
|
+
VALUES
|
|
564
|
+
(:id, :objectType, :location, :title, :hostId, :attributes, :firstSeen, :lastSeen)
|
|
565
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
566
|
+
location = excluded.location,
|
|
567
|
+
title = excluded.title,
|
|
568
|
+
host_id = excluded.host_id,
|
|
569
|
+
attributes = excluded.attributes,
|
|
570
|
+
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(O({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 M(this.db.prepare("SELECT * FROM inventory WHERE id = :id"),{id:a})}distinctTitles(a){return L(this.db.prepare(`SELECT DISTINCT title FROM inventory
|
|
571
|
+
WHERE object_type = :objectType AND title IS NOT NULL
|
|
572
|
+
ORDER BY title`),{objectType:a}).map(a=>a.title)}osVersions(){return L(this.db.prepare(`SELECT DISTINCT os_version AS value FROM inventory
|
|
573
|
+
WHERE object_type = 'host' AND os_version IS NOT NULL
|
|
574
|
+
ORDER BY value`)).map(a=>a.value)}}let bg=["config","skill","mcp","hook"],bh=new Set(f.SHn.options),bi="(url IS NULL OR (url NOT LIKE '%/.claude/worktrees/%' AND url NOT LIKE '%\\.claude\\worktrees\\%'))",bj={[f.tLs.ClaudeCode]:"Claude Code",[f.tLs.Cursor]:"Cursor",[f.tLs.Codex]:"Codex",[f.tLs.Antigravity]:"Antigravity"},bk={accessCounts:{open:0,approved:0,blocked:0,total:0},findingsCount:0},bl=a=>a.toLowerCase().replace(/[\s-]/g,""),bm={ClaudeCode:bl(f.Zdp.ClaudeCode),Cursor:bl(f.Zdp.Cursor),Codex:bl(f.Zdp.Codex),Antigravity:bl(f.Zdp.Antigravity)};function bn(a,b){if(a.provider&&bh.has(a.provider))return a.provider;let c=bl(b.title??"");return c.includes(bm.ClaudeCode)||"claude"===c?f.tLs.ClaudeCode:c.includes(bm.Cursor)?f.tLs.Cursor:c.includes(bm.Codex)?f.tLs.Codex:c.includes(bm.Antigravity)?f.tLs.Antigravity:null}function bo(a){return a.some(a=>{let b=ai(a.attributes,{});return"sample"!==b.provenance&&bn(b,a)===f.tLs.ClaudeCode})}function bp(a){let b={id:a.id,type:a.assetType,name:a.name,sub:a.sub??"",flags:ai(a.flagsJson,[])};return"mcp"===a.assetType&&a.effectiveTrust&&(b.trust=a.effectiveTrust),b}function bq(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 br(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:bu(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 bs(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 ${bu(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 bt(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 bu(a,b){return a.length>b?`${a.slice(0,b-1)}…`:a}function bv(a,b,c){let d=ai(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 bw(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 bx{constructor(a){this.db=a}getInventoryStats(){let a=Q(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=P(this.db,`SELECT count(*) AS n FROM source_project WHERE ${bi}`);let c=Q(this.db,`SELECT coalesce(o.trust, a.trust) AS k, count(*) AS n
|
|
575
|
+
FROM inventory_asset a
|
|
576
|
+
LEFT JOIN mcp_trust_override o ON o.asset_id = a.id
|
|
577
|
+
WHERE a.asset_type = 'mcp' AND coalesce(o.trust, a.trust) IS NOT NULL
|
|
578
|
+
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=P(this.db,`SELECT count(*) AS n FROM inventory
|
|
579
|
+
WHERE object_type = 'harness'
|
|
580
|
+
AND (last_seen >= :liveSince OR json_extract(attributes, '$.provenance') = 'sample')`,{liveSince:Date.now()-2592e6}),f=P(this.db,"SELECT count(*) AS n FROM inventory_asset WHERE flags_json <> '[]'"),g=P(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=bn(ai(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=>ai(a.attributes,{}).projectIds??[]))],g=this.fetchProjectsByIds(e),h=this.projectAggregates(e),i=this.configAssetRows(a,bo(b)),j=[];for(let[b,e]of c){let c=e.flatMap(a=>d.get(a.id)??[]),k=e.some(a=>"sample"!==ai(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=ai(l.attributes,{}),n=[...new Set(e.flatMap(a=>ai(a.attributes,{}).projectIds??[]))].map(a=>g.get(a)).filter(a=>void 0!==a).map(a=>{let b=h.get(a.id)??bk;return bv(a,b.accessCounts,b.findingsCount)}),o=e.reduce((a,b)=>a+(ai(b.attributes,{}).sessions??0),0),p=k.reduce((a,b)=>a+ai(b.flagsJson,[]).length,0),q=new Map;for(let a of k){let b=q.get(a.assetType);b?b.push(bp(a)):q.set(a.assetType,[bp(a)])}let r=bg.filter(a=>q.has(a)).map(a=>({type:a,assets:q.get(a)??[]}));j.push({id:b,label:m.label??bj[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 ai(a.flagsJson,[]))c.set(b,(c.get(b)??0)+1);let d={type:a,total:b.length,flagRollup:Object.fromEntries(c),items:b.map(bp)};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)=>bg.indexOf(a.type)-bg.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:ai(a.flagsJson,[]),description:a.description??null,trust:"mcp"===a.assetType?a.effectiveTrust??null:null,meta:ai(a.metaJson,{}),finding:null};if("mcp"===a.assetType&&null!==a.toolsJson){let c=ai(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)??bk;return bv(a,b.accessCounts,b.findingsCount)})})}getProjectTree(a,b){let c=this.fetchProjectById(a);if(!c)return Promise.resolve(null);let d=ai(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(bw)})}if(void 0!==b.q&&""!==b.q)return Promise.resolve({project:e,path:f,files:this.fetchProjectFilesSearch(a,b.q).map(bw)});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(bw)})}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=ai(c.attributes,{});return Promise.resolve({...bw(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)
|
|
581
|
+
VALUES (:id, :projectId, :path, :access, :now, :now)
|
|
582
|
+
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)
|
|
583
|
+
VALUES (:id, :assetId, :trust, :now, :now)
|
|
584
|
+
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 L(this.db.prepare(`SELECT id, title, attributes, harness_version AS harnessVersion
|
|
585
|
+
FROM inventory
|
|
586
|
+
WHERE object_type = 'harness'
|
|
587
|
+
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 (${B(a.length)})`;if(b){let a=C(b);e+=` AND ${D(["a.name","a.sub"])}`,d.push(a,a)}for(let a of L(this.db.prepare(`SELECT ha.harness_id AS harnessInvId, a.id, a.asset_type AS assetType, a.name, a.sub,
|
|
588
|
+
a.description, a.flags_json AS flagsJson, a.meta_json AS metaJson, a.trust,
|
|
589
|
+
a.tools_json AS toolsJson, coalesce(o.trust, a.trust) AS effectiveTrust
|
|
590
|
+
FROM harness_asset ha
|
|
591
|
+
JOIN inventory_asset a ON a.id = ha.asset_id
|
|
592
|
+
LEFT JOIN mcp_trust_override o ON o.asset_id = a.id
|
|
593
|
+
WHERE ${e}
|
|
594
|
+
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 (${B(a.length)})`),d.push(...a)),b){let a=C(b);c.push(D(["a.name","a.sub"])),d.push(a,a)}let e=c.length?`WHERE ${c.join(" AND ")}`:"",f=this.mapAssetRows(L(this.db.prepare(`SELECT a.id, a.asset_type AS assetType, a.name, a.sub, a.description,
|
|
595
|
+
a.flags_json AS flagsJson, a.meta_json AS metaJson, a.trust,
|
|
596
|
+
a.tools_json AS toolsJson, coalesce(o.trust, a.trust) AS effectiveTrust
|
|
597
|
+
FROM inventory_asset a
|
|
598
|
+
LEFT JOIN mcp_trust_override o ON o.asset_id = a.id
|
|
599
|
+
${e}
|
|
600
|
+
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(L(this.db.prepare(`SELECT a.id, a.asset_type AS assetType, a.name, a.sub, a.description,
|
|
601
|
+
a.flags_json AS flagsJson, a.meta_json AS metaJson, a.trust,
|
|
602
|
+
a.tools_json AS toolsJson, coalesce(o.trust, a.trust) AS effectiveTrust
|
|
603
|
+
FROM inventory_asset a
|
|
604
|
+
LEFT JOIN mcp_trust_override o ON o.asset_id = a.id
|
|
605
|
+
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??bo(this.fetchHarnessRows())))return[];let b=this.latestConfigScanId();if(null===b)return[];if(this.configRowsCache?.scanId===b)return this.configRowsCache.rows;let c=new aG(this.db).report(),d=[...c.skills.map(bq),...c.hooks.map(br),...c.mcpServers.map(bs),...c.configFiles.map(bt)].sort((a,b)=>a.name.localeCompare(b.name));return this.configRowsCache={scanId:b,rows:d},d}latestConfigScanId(){return aF(this.db)?.id??null}fetchProjects(a){let b=`SELECT id, url, name, attributes, last_seen AS lastSeen FROM source_project
|
|
606
|
+
WHERE ${bi}`,c=[];if(a){let d=C(a);b+=` AND ${D(["name","url"])}`,c.push(d,d)}return b+=" ORDER BY name ASC",L(this.db.prepare(b),c)}fetchProjectById(a){return M(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 L(this.db.prepare(`SELECT id, url, name, attributes, last_seen AS lastSeen
|
|
607
|
+
FROM source_project WHERE id IN (${B(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 L(this.db.prepare(`SELECT f.project_id AS projectId,
|
|
608
|
+
coalesce(o.access, f.default_access) AS eff,
|
|
609
|
+
count(*) AS n,
|
|
610
|
+
coalesce(sum(f.findings_count), 0) AS findings
|
|
611
|
+
FROM project_file f
|
|
612
|
+
LEFT JOIN file_access_override o ON o.project_id = f.project_id AND o.path = f.path
|
|
613
|
+
WHERE f.project_id IN (${B(a.length)})
|
|
614
|
+
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,
|
|
615
|
+
f.findings_count AS findingsCount, f.blocked_at AS blockedAtMs, f.note,
|
|
616
|
+
coalesce(o.access, f.default_access) AS effectiveAccess,
|
|
617
|
+
o.access AS overrideAccess
|
|
618
|
+
FROM project_file f
|
|
619
|
+
LEFT JOIN file_access_override o ON o.project_id = f.project_id AND o.path = f.path
|
|
620
|
+
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(L(this.db.prepare(this.fileSelect("f.project_id = ? ORDER BY f.path ASC")),[a])):this.mapFileRows(L(this.db.prepare(this.fileSelect("f.project_id = ? AND f.path LIKE ? ESCAPE '\\' ORDER BY f.path ASC")),[a,`${A(b)}/%`]))}fetchProjectFilesSearch(a,b){let c=C(b);return this.mapFileRows(L(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(L(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(L(this.db.prepare(this.fileSelect("f.project_id = ? AND f.path = ?")),[a,b]))[0]??null}}class by{constructor(a){this.db=a}readPolicies(){return Promise.resolve(R(L(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:N(a.enabled),customKeywords:c})}))}seedDefaults(){if(P(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)
|
|
621
|
+
VALUES (:id, 'global', :target, :action, 1, :now, :now)`);G(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)
|
|
622
|
+
VALUES (:id, 'global', :target, :action, 1, :now, :now)
|
|
623
|
+
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
|
|
624
|
+
WHERE scope='global' AND action IN ('block','redact')
|
|
625
|
+
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 bz{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 bA{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
|
|
626
|
+
(id, project_id, path, name, origin, default_access, findings_count, blocked_at, note, created_at, updated_at)
|
|
627
|
+
VALUES
|
|
628
|
+
(:id, :projectId, :path, :name, :origin, :defaultAccess, 0, NULL, NULL, :now, :now)
|
|
629
|
+
ON CONFLICT (project_id, path) DO UPDATE SET
|
|
630
|
+
name = excluded.name,
|
|
631
|
+
origin = excluded.origin,
|
|
632
|
+
default_access = excluded.default_access,
|
|
633
|
+
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,(M(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 bB{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)
|
|
634
|
+
VALUES (:id, :findingKey, :status, :method, :resolvedAt, :evidence, :createdAt)`),this.latestStmt=a.prepare(`SELECT status, method, resolved_at, evidence
|
|
635
|
+
FROM finding_resolution
|
|
636
|
+
WHERE finding_key = :findingKey
|
|
637
|
+
ORDER BY created_at DESC, rowid DESC
|
|
638
|
+
LIMIT 1`),this.openAtRestStmt=a.prepare(`SELECT DISTINCT f.finding_key AS finding_key
|
|
639
|
+
FROM inspection_findings f
|
|
640
|
+
JOIN audit_events e ON e.id = f.audit_event_id
|
|
641
|
+
WHERE e.event_type = 'code_change'
|
|
642
|
+
AND json_extract(e.attributes, '$.file_path') = :path
|
|
643
|
+
AND f.finding_key IS NOT NULL
|
|
644
|
+
AND ${aT("f")} IS NOT 'resolved'`),this.resolvedAtRestStmt=a.prepare(`SELECT DISTINCT f.finding_key AS finding_key
|
|
645
|
+
FROM inspection_findings f
|
|
646
|
+
JOIN audit_events e ON e.id = f.audit_event_id
|
|
647
|
+
WHERE e.event_type = 'code_change'
|
|
648
|
+
AND json_extract(e.attributes, '$.file_path') = :path
|
|
649
|
+
AND f.finding_key IS NOT NULL
|
|
650
|
+
AND ${aT("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=M(this.latestStmt,{findingKey:a});if(b)return{status:b.status,method:b.method,resolvedAt:b.resolved_at,evidence:b.evidence??""}}openAtRestKeysForPath(a){return L(this.openAtRestStmt,{path:a}).map(a=>a.finding_key)}resolvedAtRestKeysForPath(a){return L(this.resolvedAtRestStmt,{path:a}).map(a=>a.finding_key)}}class bC{constructor(a){this.db=a,this.upsertStmt=a.prepare(`INSERT INTO rule_probe_cache (rule_key, verdict, worst_probe_ms, checked_at)
|
|
651
|
+
VALUES (:ruleKey, :verdict, :worstProbeMs, :checkedAt)
|
|
652
|
+
ON CONFLICT (rule_key) DO UPDATE SET
|
|
653
|
+
verdict = excluded.verdict,
|
|
654
|
+
worst_probe_ms = excluded.worst_probe_ms,
|
|
655
|
+
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 M(this.readStmt,{ruleKey:a})}countQuarantined(){return M(this.countQuarantinedStmt,{})?.n??0}clearQuarantined(){let a=this.countQuarantined();return{refused:!G(this.db,()=>{this.clearQuarantinedStmt.run()}),cleared:a-this.countQuarantined()}}setVerdict(a,b,c){G(this.db,()=>{this.upsertStmt.run({ruleKey:a,verdict:b,worstProbeMs:c,checkedAt:Date.now()})})}}class bD{constructor(a){this.db=a,this.upsertStmt=a.prepare(`INSERT INTO scan_ledger (path, mtime, content_hash, ruleset_hash, scanned_at)
|
|
656
|
+
VALUES (:path, :mtime, :contentHash, :rulesetHash, :scannedAt)
|
|
657
|
+
ON CONFLICT (path) DO UPDATE SET
|
|
658
|
+
mtime = excluded.mtime,
|
|
659
|
+
content_hash = excluded.content_hash,
|
|
660
|
+
ruleset_hash = excluded.ruleset_hash,
|
|
661
|
+
scanned_at = excluded.scanned_at`),this.readStmt=a.prepare(`SELECT path, mtime, content_hash AS contentHash
|
|
662
|
+
FROM scan_ledger WHERE ruleset_hash = :rulesetHash`)}entriesForRuleset(a){return new Map(L(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();G(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 bE(a,b){return void 0===a?b:Math.min(Math.max(1,Math.trunc(a)),f.u8Q)}let bF=`(v.occurrence_count > 1
|
|
663
|
+
OR (SELECT count(*) FROM secret_vault_sighting s WHERE s.pointer_id = v.pointer_id) > 1)`,bG=`v.pointer_id, v.category, v.rule_id, v.masked_match, v.provider,
|
|
664
|
+
v.occurrence_count, v.first_seen, v.last_seen`,bH=`
|
|
665
|
+
pointer_id AS pointerId,
|
|
666
|
+
value_fingerprint AS valueFingerprint,
|
|
667
|
+
fingerprint_key_version AS fingerprintKeyVersion,
|
|
668
|
+
key_version AS keyVersion,
|
|
669
|
+
format_version AS formatVersion,
|
|
670
|
+
category,
|
|
671
|
+
rule_id AS ruleId,
|
|
672
|
+
masked_match AS maskedMatch,
|
|
673
|
+
provider,
|
|
674
|
+
ciphertext,
|
|
675
|
+
nonce,
|
|
676
|
+
auth_tag AS authTag,
|
|
677
|
+
user_authorized AS userAuthorized,
|
|
678
|
+
occurrence_count AS occurrenceCount,
|
|
679
|
+
first_seen AS firstSeen,
|
|
680
|
+
last_seen AS lastSeen`;function bI(a){let{provider:b,userAuthorized:c,...d}=a,e={...d,userAuthorized:0!==c};return null===b?e:{...e,provider:b}}class bJ{constructor(a){this.db=a,this.insertStmt=a.prepare(`INSERT INTO secret_vault (
|
|
681
|
+
pointer_id, value_fingerprint, fingerprint_key_version, key_version,
|
|
682
|
+
format_version, category, rule_id, masked_match, provider,
|
|
683
|
+
ciphertext, nonce, auth_tag,
|
|
684
|
+
user_authorized, occurrence_count, first_seen, last_seen
|
|
685
|
+
) VALUES (
|
|
686
|
+
:pointerId, :valueFingerprint, :fingerprintKeyVersion, :keyVersion,
|
|
687
|
+
:formatVersion, :category, :ruleId, :maskedMatch, :provider,
|
|
688
|
+
:ciphertext, :nonce, :authTag,
|
|
689
|
+
:userAuthorized, 1, :now, :now
|
|
690
|
+
)`),this.bumpStmt=a.prepare(`UPDATE secret_vault
|
|
691
|
+
SET occurrence_count = occurrence_count + 1, last_seen = :now,
|
|
692
|
+
user_authorized = max(user_authorized, :userAuthorized)
|
|
693
|
+
WHERE value_fingerprint = :valueFingerprint`),this.byPointerStmt=a.prepare(`SELECT ${bH} FROM secret_vault WHERE pointer_id = :pointerId`),this.byFingerprintStmt=a.prepare(`SELECT ${bH} FROM secret_vault WHERE value_fingerprint = :valueFingerprint`),this.listStmt=a.prepare(`SELECT ${bH} FROM secret_vault ORDER BY first_seen`),this.replaceCiphertextStmt=a.prepare(`UPDATE secret_vault
|
|
694
|
+
SET key_version = :keyVersion, ciphertext = :ciphertext, nonce = :nonce, auth_tag = :authTag
|
|
695
|
+
WHERE pointer_id = :pointerId`),this.refreshFingerprintStmt=a.prepare(`UPDATE secret_vault
|
|
696
|
+
SET value_fingerprint = :valueFingerprint, fingerprint_key_version = :fingerprintKeyVersion
|
|
697
|
+
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)
|
|
698
|
+
VALUES (:id, :pointerId, :at, :target, :reason, :outcome, :grantId, :pointerCount)`)}upsert(a,b){let c=!1;F(this.db,()=>{if(void 0===M(this.byFingerprintStmt,{valueFingerprint:a.valueFingerprint})){this.insertStmt.run(O({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=M(this.byFingerprintStmt,{valueFingerprint:a.valueFingerprint});if(void 0===d)throw Error("vault: row vanished immediately after write");return{row:bI(d),minted:c}}byPointerId(a){let b=M(this.byPointerStmt,{pointerId:a});return void 0===b?null:bI(b)}byValueFingerprint(a){let b=M(this.byFingerprintStmt,{valueFingerprint:a});return void 0===b?null:bI(b)}recordDeref(a){this.derefStmt.run(O({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 L(this.listStmt).map(bI)}replaceCiphertext(a,b){this.replaceCiphertextStmt.run({pointerId:a,...b})}refreshFingerprint(a,b){this.refreshFingerprintStmt.run({pointerId:a,...b})}purgeAll(){let a=0;return F(this.db,()=>{a=this.countEntries(),this.db.exec("DELETE FROM secret_vault")},"IMMEDIATE"),a}deleteByPointerIds(a){if(0===a.length)return[];let b=[];return F(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)
|
|
699
|
+
VALUES (:id, :pointerId, :location, :kind, :now, :now)
|
|
700
|
+
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 L(this.db.prepare(`SELECT pointer_id, location, kind, first_seen, last_seen
|
|
701
|
+
FROM secret_vault_sighting
|
|
702
|
+
WHERE pointer_id IN (${B(a.length)})
|
|
703
|
+
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=bE(a.limit,f.mBk),d=void 0===a.cursor?null:al(a.cursor),e=null===d?"":"WHERE (v.last_seen < :cursorLastSeen OR (v.last_seen = :cursorLastSeen AND v.pointer_id < :cursorPointerId))",g=L(this.db.prepare(`SELECT ${bG},
|
|
704
|
+
(SELECT e.id FROM exceptions e
|
|
705
|
+
WHERE e.rule_id = v.rule_id
|
|
706
|
+
AND e.value_fingerprint = v.value_fingerprint
|
|
707
|
+
AND e.key_version = v.fingerprint_key_version
|
|
708
|
+
AND ${aQ}
|
|
709
|
+
LIMIT 1) AS grant_id
|
|
710
|
+
FROM secret_vault v
|
|
711
|
+
${e}
|
|
712
|
+
ORDER BY v.last_seen DESC, v.pointer_id DESC
|
|
713
|
+
LIMIT :limit`),O({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?ak({startedAtMs:j.last_seen,id:j.pointer_id}):null}}listReuse(a={},b=Date.now()){var c;let d=bE(a.limit,f.mBk),e=void 0===a.cursor?null:function(a){let b=aj(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
|
|
714
|
+
OR (v.occurrence_count = :cursorOccurrences AND v.pointer_id < :cursorPointerId))`,h=L(this.db.prepare(`SELECT ${bG},
|
|
715
|
+
(SELECT e.id FROM exceptions e
|
|
716
|
+
WHERE e.rule_id = v.rule_id
|
|
717
|
+
AND e.value_fingerprint = v.value_fingerprint
|
|
718
|
+
AND e.key_version = v.fingerprint_key_version
|
|
719
|
+
AND ${aQ}
|
|
720
|
+
LIMIT 1) AS grant_id
|
|
721
|
+
FROM secret_vault v
|
|
722
|
+
WHERE ${bF} ${g}
|
|
723
|
+
ORDER BY v.occurrence_count DESC, v.pointer_id DESC
|
|
724
|
+
LIMIT :limit`),O({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=bE(a.limit,f.hdu),c=void 0===a.cursor?null:al(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=L(this.db.prepare(`SELECT id, pointer_id, at, target, reason, outcome, grant_id, pointer_count
|
|
725
|
+
FROM secret_vault_deref ${e}
|
|
726
|
+
ORDER BY at DESC, id DESC LIMIT :limit`),O({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:P(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?ak({startedAtMs:j.at,id:j.id}):null,hiddenBatched:k}}countEntries(){return P(this.db,"SELECT COUNT(*) AS n FROM secret_vault")}countReused(){return P(this.db,`SELECT COUNT(*) AS n FROM secret_vault v WHERE ${bF}`)}}let bK=["critical","high","medium","low"],bL={block:"blocked",redact:"redacted",warn:"warned"},bM=["blocked","redacted","warned"],bN={[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}},bO={"7d":"day","30d":"day","3m":"week","6m":"week"};function bP(a){return 864e5*Math.floor(a/864e5)}function bQ(a){return new Date(a).toISOString().slice(0,10)}class bR{constructor(a,b=()=>Date.now()){this.db=a,this.now=b}severitySummary(){let a=new Map(L(this.db.prepare(`SELECT d.severity AS severity,
|
|
727
|
+
COUNT(*) AS count,
|
|
728
|
+
SUM(CASE
|
|
729
|
+
WHEN e.event_type != 'code_change' THEN 1
|
|
730
|
+
WHEN f.finding_key IS NULL THEN 0
|
|
731
|
+
WHEN latest.status = 'resolved' THEN 1
|
|
732
|
+
ELSE 0
|
|
733
|
+
END) AS caught,
|
|
734
|
+
SUM(CASE
|
|
735
|
+
WHEN e.event_type = 'code_change'
|
|
736
|
+
AND f.finding_key IS NOT NULL
|
|
737
|
+
AND (latest.status IS NULL OR latest.status != 'resolved') THEN 1
|
|
738
|
+
ELSE 0
|
|
739
|
+
END) AS open_at_rest
|
|
740
|
+
FROM inspection_findings f
|
|
741
|
+
JOIN audit_events e INDEXED BY idx_audit_capture_rollup ON e.id = f.audit_event_id
|
|
742
|
+
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
743
|
+
LEFT JOIN ${aU} latest
|
|
744
|
+
ON latest.finding_key = f.finding_key
|
|
745
|
+
WHERE e.event_type IN (${f.hfB})
|
|
746
|
+
GROUP BY d.severity`)).map(a=>[a.severity,a])),b=bK.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,...bN[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=bL[a.actionTaken];b&&(a.occurredAt>=d?g[b]++:h[b]++)}let i=bM.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=bO[a],c=("day"===b?1:7)*864e5,d=f.eI7[a],e="day"===b?d:Math.ceil(d/7),g=this.now(),h=bP(g)-(d-1)*864e5,i=this.findingsInRange(h,g),j=Array.from({length:e},(a,b)=>({timestamp:bQ(h+b*c),critical:0,high:0,medium:0,low: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||"low"===k)&&b[a.severity]++}}return Promise.resolve({range:a,granularity:b,points:j})}mttrTrend(a){let b=bO[a],c=("day"===b?1:7)*864e5,d=f.eI7[a],e="day"===b?d:Math.ceil(d/7),g=this.now(),h=bP(g)-(d-1)*864e5,i=L(this.db.prepare(`SELECT DISTINCT f.finding_key AS finding_key,
|
|
747
|
+
COALESCE(f.first_detected_at, e.started_at) AS first_detected_at, d.severity AS severity,
|
|
748
|
+
latest.status AS latest_status,
|
|
749
|
+
latest.method AS latest_method,
|
|
750
|
+
latest.resolved_at AS latest_resolved_at
|
|
751
|
+
FROM finding_resolution fr
|
|
752
|
+
CROSS JOIN inspection_findings f ON f.finding_key = fr.finding_key
|
|
753
|
+
CROSS JOIN audit_events e ON e.id = f.audit_event_id
|
|
754
|
+
CROSS JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
755
|
+
LEFT JOIN ${aU} latest
|
|
756
|
+
ON latest.finding_key = f.finding_key
|
|
757
|
+
WHERE fr.resolved_at >= :windowStart
|
|
758
|
+
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 bK){let c=`${String(b)}:${a}`,e=k.get(c)??0;d[a]=e>0?(j.get(c)??0)/e:null}return{timestamp:bQ(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:L(this.db.prepare(`SELECT e.repo AS repo, count(*) AS c
|
|
759
|
+
FROM inspection_findings f
|
|
760
|
+
JOIN audit_events e INDEXED BY idx_audit_capture_rollup ON e.id = f.audit_event_id
|
|
761
|
+
WHERE e.started_at >= :from AND e.started_at < :to
|
|
762
|
+
AND e.event_type IN (${f.hfB})
|
|
763
|
+
AND e.repo IS NOT NULL
|
|
764
|
+
AND e.repo != ''
|
|
765
|
+
GROUP BY e.repo
|
|
766
|
+
ORDER BY c DESC, e.repo
|
|
767
|
+
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:L(this.db.prepare(`SELECT f.finding_key AS finding_key,
|
|
768
|
+
d.rule_id AS rule_id,
|
|
769
|
+
d.severity AS severity,
|
|
770
|
+
e.repo AS repo,
|
|
771
|
+
e.file_path AS path,
|
|
772
|
+
COALESCE(f.first_detected_at, e.started_at) AS first_detected_at,
|
|
773
|
+
latest.resolved_at AS latest_resolved_at
|
|
774
|
+
FROM ${aU} latest
|
|
775
|
+
CROSS JOIN inspection_findings f ON f.finding_key = latest.finding_key
|
|
776
|
+
CROSS JOIN audit_events e ON e.id = f.audit_event_id
|
|
777
|
+
CROSS JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
778
|
+
WHERE latest.status = 'resolved'
|
|
779
|
+
AND latest.method = 'fixed-at-source'
|
|
780
|
+
AND latest.resolved_at IS NOT NULL
|
|
781
|
+
AND e.event_type = 'code_change'
|
|
782
|
+
ORDER BY latest.resolved_at DESC
|
|
783
|
+
LIMIT :limit`),{limit:a}).map(a=>({findingKey:a.finding_key,ruleId:a.rule_id,repo:a.repo??"",severity:a.severity,path:a.path??"",resolvedAt:new Date(a.latest_resolved_at).toISOString(),detectedAt:new Date(a.first_detected_at).toISOString()}))})}recommendationInputs(){return Promise.resolve(L(this.db.prepare(`SELECT d.rule_id AS rule_id,
|
|
784
|
+
d.category AS category,
|
|
785
|
+
d.severity AS severity,
|
|
786
|
+
COUNT(*) AS count
|
|
787
|
+
FROM inspection_findings f
|
|
788
|
+
JOIN audit_events e INDEXED BY idx_audit_capture_rollup ON e.id = f.audit_event_id
|
|
789
|
+
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
790
|
+
LEFT JOIN ${aU} latest
|
|
791
|
+
ON latest.finding_key = f.finding_key
|
|
792
|
+
WHERE e.event_type IN (${f.hfB})
|
|
793
|
+
AND e.event_type = 'code_change'
|
|
794
|
+
AND (
|
|
795
|
+
f.finding_key IS NULL
|
|
796
|
+
OR latest.status IS NULL
|
|
797
|
+
OR latest.status NOT IN ('resolved', 'dismissed')
|
|
798
|
+
)
|
|
799
|
+
GROUP BY d.rule_id, d.category, d.severity`)).map(a=>({ruleId:a.rule_id,category:a.category,severity:a.severity,count:a.count})))}findingsInRange(a,b){return L(this.db.prepare(`SELECT e.started_at AS occurred_at, d.severity AS severity, f.action_taken AS action_taken,
|
|
800
|
+
d.rule_id AS rule_id, d.category AS category
|
|
801
|
+
FROM inspection_findings f
|
|
802
|
+
JOIN audit_events e INDEXED BY idx_audit_capture_rollup ON e.id = f.audit_event_id
|
|
803
|
+
JOIN inspection_definitions d ON d.id = f.inspection_definition_id
|
|
804
|
+
WHERE e.started_at >= :from AND e.started_at < :to
|
|
805
|
+
AND e.event_type IN (${f.hfB})
|
|
806
|
+
ORDER BY e.started_at`),{from:a,to:b}).map(a=>({occurredAt:a.occurred_at,severity:a.severity,actionTaken:a.action_taken,ruleId:a.rule_id,category:a.category}))}}let bS=["provider","internal","external","ip"],bT="('http', 'ws')",bU=`LEFT JOIN egress_decision_override oh ON oh.host = d.host
|
|
807
|
+
LEFT JOIN egress_decision_override ol ON ol.destination_id = d.id AND ol.host IS NULL`;function bV(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 bW(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:ai(a.networkJson,null),endpoints:b.map(bV)}}class bX{constructor(a){this.db=a}stats(){let a=P(this.db,"SELECT count(*) AS n FROM share_destination"),b=P(this.db,"SELECT count(*) AS n FROM share_endpoint"),c=P(this.db,"SELECT count(*) AS n FROM share_call_site"),d=P(this.db,`SELECT count(DISTINCT destination_id) AS n FROM share_endpoint
|
|
808
|
+
WHERE transport IN ${bT}`),e=P(this.db,`SELECT count(DISTINCT d.id) AS n
|
|
809
|
+
FROM share_destination d
|
|
810
|
+
LEFT JOIN share_endpoint e ON e.destination_id = d.id
|
|
811
|
+
AND e.transport IN ${bT}
|
|
812
|
+
WHERE (d.trust IN ('unverified', 'ip') OR e.id IS NOT NULL)
|
|
813
|
+
AND NOT EXISTS (
|
|
814
|
+
SELECT 1 FROM egress_decision_override o
|
|
815
|
+
WHERE o.host = d.host OR (o.destination_id = d.id AND o.host IS NULL)
|
|
816
|
+
)`),f=Q(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=Q(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=>bW(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:bS.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:bW(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:ai(a.networkJson,null),note:a.note,endpoints:b.map(a=>({...bV(a),sites:g.get(a.id)??[]}))}}(b,c,d))}setEgressDecision(a,b){let c=!1;return F(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
|
|
817
|
+
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
|
|
818
|
+
(id, destination_id, host, decision, created_at, updated_at)
|
|
819
|
+
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 F(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
|
|
820
|
+
WHERE project_key = :key
|
|
821
|
+
AND (:prefix = '' OR file = :prefix OR file LIKE :subtree ESCAPE '\\')
|
|
822
|
+
AND file NOT LIKE '.%'
|
|
823
|
+
AND file NOT LIKE '%/.%'`).run({key:a,prefix:c,subtree:`${A(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
|
|
824
|
+
WHERE project_key = ? AND file IN (${B(d.length)})`).run(a,...d)}}upsertHits(a,b,c,d){if(0===b.length)return;let e=this.db.prepare(`INSERT INTO share_destination
|
|
825
|
+
(id, kind, name, host, category, trust, network_json, last_seen, provenance,
|
|
826
|
+
created_at, updated_at)
|
|
827
|
+
VALUES (:id, :kind, :name, :host, :category, :trust, :networkJson, :now, 'scan', :now, :now)
|
|
828
|
+
ON CONFLICT (host) DO UPDATE SET
|
|
829
|
+
kind = excluded.kind,
|
|
830
|
+
name = excluded.name,
|
|
831
|
+
category = excluded.category,
|
|
832
|
+
trust = excluded.trust,
|
|
833
|
+
network_json = excluded.network_json,
|
|
834
|
+
last_seen = excluded.last_seen,
|
|
835
|
+
updated_at = excluded.updated_at`),f=this.db.prepare("SELECT id FROM share_destination WHERE host = ?"),g=this.db.prepare(`INSERT INTO share_endpoint
|
|
836
|
+
(id, destination_id, method, transport, url, template, data_class, last_seen,
|
|
837
|
+
created_at, updated_at)
|
|
838
|
+
VALUES (:id, :destinationId, :method, :transport, :url, :template, :dataClass, :now,
|
|
839
|
+
:now, :now)
|
|
840
|
+
ON CONFLICT (destination_id, method, url) DO UPDATE SET
|
|
841
|
+
transport = excluded.transport,
|
|
842
|
+
template = excluded.template,
|
|
843
|
+
data_class = excluded.data_class,
|
|
844
|
+
last_seen = excluded.last_seen,
|
|
845
|
+
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
|
|
846
|
+
(id, endpoint_id, project, project_key, file, line, snippet, dynamic, vendored,
|
|
847
|
+
project_id, created_at, updated_at)
|
|
848
|
+
VALUES (:id, :endpointId, :project, :projectKey, :file, :line, :snippet, :dynamic,
|
|
849
|
+
:vendored, :projectId, :now, :now)
|
|
850
|
+
ON CONFLICT (endpoint_id, project_key, file, line) DO UPDATE SET
|
|
851
|
+
snippet = excluded.snippet,
|
|
852
|
+
dynamic = excluded.dynamic,
|
|
853
|
+
vendored = excluded.vendored,
|
|
854
|
+
project = excluded.project,
|
|
855
|
+
project_id = COALESCE(excluded.project_id, share_call_site.project_id),
|
|
856
|
+
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=M(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=M(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 M(this.db.prepare(`SELECT project_id AS projectId FROM share_call_site
|
|
857
|
+
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
|
|
858
|
+
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
|
|
859
|
+
WHERE id IN (SELECT DISTINCT e.destination_id
|
|
860
|
+
FROM share_endpoint e
|
|
861
|
+
JOIN share_call_site c ON c.endpoint_id = e.id
|
|
862
|
+
WHERE c.project_key = :key)`).run({now:b,key:a})}pruneOrphans(){this.db.exec(`DELETE FROM share_endpoint
|
|
863
|
+
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
|
|
864
|
+
WHERE host IS NULL
|
|
865
|
+
AND destination_id IN (
|
|
866
|
+
SELECT d.id FROM share_destination d
|
|
867
|
+
WHERE NOT EXISTS (SELECT 1 FROM share_endpoint e WHERE e.destination_id = d.id))`),this.db.exec(`DELETE FROM share_destination
|
|
868
|
+
WHERE NOT EXISTS (
|
|
869
|
+
SELECT 1 FROM share_endpoint e WHERE e.destination_id = share_destination.id)`)}projectTotals(a){return{destinations:P(this.db,`SELECT count(DISTINCT e.destination_id) AS n
|
|
870
|
+
FROM share_endpoint e
|
|
871
|
+
JOIN share_call_site c ON c.endpoint_id = e.id
|
|
872
|
+
WHERE c.project_key = ?`,[a]),endpoints:P(this.db,"SELECT count(DISTINCT endpoint_id) AS n FROM share_call_site WHERE project_key = ?",[a]),callSites:P(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,
|
|
873
|
+
d.network_json AS networkJson, d.last_seen AS lastSeenMs,
|
|
874
|
+
d.created_at AS createdAt,
|
|
875
|
+
COALESCE(oh.decision, ol.decision) AS overrideDecision`,f=[],g=[];if(b&&b.length>0&&(f.push(`d.kind IN (${B(b.length)})`),g.push(...b)),c&&f.push(`(d.trust IN ('unverified', 'ip')
|
|
876
|
+
OR EXISTS (SELECT 1 FROM share_endpoint re
|
|
877
|
+
WHERE re.destination_id = d.id
|
|
878
|
+
AND re.transport IN ${bT}))`),a){let b=C(a);f.push(`(d.name LIKE ? ESCAPE '\\' OR d.category LIKE ? ESCAPE '\\' OR e.url LIKE ? ESCAPE '\\'
|
|
879
|
+
OR c.project LIKE ? ESCAPE '\\' OR c.file LIKE ? ESCAPE '\\')`),g.push(b,b,b,b,b),d=`SELECT DISTINCT ${e}
|
|
880
|
+
FROM share_destination d
|
|
881
|
+
${bU}
|
|
882
|
+
LEFT JOIN share_endpoint e ON e.destination_id = d.id
|
|
883
|
+
LEFT JOIN share_call_site c ON c.endpoint_id = e.id
|
|
884
|
+
${f.length?`WHERE ${f.join(" AND ")}`:""}
|
|
885
|
+
ORDER BY d.created_at ASC, d.id ASC`}else d=`SELECT ${e}
|
|
886
|
+
FROM share_destination d
|
|
887
|
+
${bU}
|
|
888
|
+
${f.length?`WHERE ${f.join(" AND ")}`:""}
|
|
889
|
+
ORDER BY d.created_at ASC, d.id ASC`;return L(this.db.prepare(d),g).map(a=>this.mapDestRow(a))}fetchDestinationById(a){let b=M(this.db.prepare(`SELECT d.id, d.kind, d.name, d.host, d.category, d.trust, d.note,
|
|
890
|
+
d.network_json AS networkJson, d.last_seen AS lastSeenMs,
|
|
891
|
+
COALESCE(oh.decision, ol.decision) AS overrideDecision
|
|
892
|
+
FROM share_destination d
|
|
893
|
+
${bU}
|
|
894
|
+
WHERE d.id = ?`),[a]);return b?this.mapDestRow(b):null}fetchEndpoints(a){return 0===a.length?[]:L(this.db.prepare(`SELECT e.id, e.destination_id AS destinationId, e.method, e.transport, e.url,
|
|
895
|
+
e.template, e.data_class AS dataClass, e.last_seen AS lastSeenMs,
|
|
896
|
+
count(c.id) AS callSiteCount
|
|
897
|
+
FROM share_endpoint e
|
|
898
|
+
LEFT JOIN share_call_site c ON c.endpoint_id = e.id
|
|
899
|
+
WHERE e.destination_id IN (${B(a.length)})
|
|
900
|
+
GROUP BY e.id
|
|
901
|
+
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?[]:L(this.db.prepare(`SELECT id, endpoint_id AS endpointId, project, file, line, snippet, dynamic, vendored,
|
|
902
|
+
project_id AS projectId
|
|
903
|
+
FROM share_call_site
|
|
904
|
+
WHERE endpoint_id IN (${B(a.length)})
|
|
905
|
+
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 bY{constructor(a){this.db=a,this.upsertStmt=a.prepare(`INSERT INTO source_project
|
|
906
|
+
(id, url, name, attributes, first_seen, last_seen)
|
|
907
|
+
VALUES
|
|
908
|
+
(:id, :url, :name, :attributes, :firstSeen, :lastSeen)
|
|
909
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
910
|
+
url = excluded.url,
|
|
911
|
+
name = excluded.name,
|
|
912
|
+
attributes = excluded.attributes,
|
|
913
|
+
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(O({id:d.id,url:d.url,name:d.name,attributes:d.attributes,firstSeen:d.firstSeen,lastSeen:d.lastSeen})),c}findById(a){return M(this.db.prepare("SELECT * FROM source_project WHERE id = :id"),{id:a})}distinctNames(){return L(this.db.prepare(`SELECT DISTINCT name FROM source_project
|
|
914
|
+
WHERE name IS NOT NULL
|
|
915
|
+
ORDER BY name`)).map(a=>a.name)}}let bZ=new Set(f.ZYZ.options),b$=Symbol("aka.persistence.unsafeTestOnlyRawHandle");function b_(a,b){return b?{...a,hostId:b}:a}function b0(a){try{a.close()}catch{}}function b1(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"),b.function("aka_lower",{deterministic:!0,directOnly:!0,useBigIntArguments:!0},z)}catch(a){throw b0(b),a}return b}let b2=new Set(f.vog);function b3(a,b={}){i(a,!0),h(a,448);let c=(0,e.join)(a,g);w(c);let{db:l,events:m,findings:o,policies:t,installedPacks:u,scanLedger:v,historySync:y,bodyRetention:z,secretVault:B,exceptions:C,resolutions:D,ruleProbeCache:E,security:L,detections:M,shares:N,policyCatalog:P,inventory:Q,inventoryAssets:R,projectFiles:S,activity:T,sourceProject:U,auditEvents:V,classifiedData:X,inspectionDefinitions:Y,inspectionFindings:Z,configInventory:$}=function(a,b,c){let e=b1(a);try{var h;if(h=e,I(h,"table","tenants")||K(h,"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){H(`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}(e,a);e=b1(a),H(`Detected an older, incompatible (tenant-bearing) ${g}; backed it up to ${b} and created a fresh store.`)}!function(a,b,c={}){var d,e;let g=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 h=new Set(a.prepare("SELECT tag FROM migration_ledger").all().map(a=>a.tag)),i=0===h.size&&g>0,j=a.prepare("INSERT OR IGNORE INTO migration_ledger (tag, applied_at) VALUES (?, ?)");for(let[b,d]of f.lFU.entries()){if(h.has(d.tag)||c.skipTags?.has(d.tag)===!0||d.tag===ae)continue;let e=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}(d.sql),f=e.filter(b=>"column"===b.kind?K(a,b.table,{includeGenerated:!0}).includes(b.name):I(a,"table",b.name));if(f.length>0&&f.length<e.length){let a=e.filter(a=>!f.includes(a)),b=`sqlite migration ${d.tag} has no ledger row, but the store already has ${f.map(ac).join(", ")} while missing ${a.map(ac).join(", ")} — the schema diverged from the migration history; refusing to replay or skip.`;throw H(b),Error(`[aka] ${b}`)}let k=e.length>0?f.length===e.length:i&&b<g,l=/PRAGMA foreign_keys\s*=\s*OFF/i.test(d.sql),m=ad(d.sql);l&&a.exec("PRAGMA foreign_keys = OFF");try{F(a,()=>{for(let b of m){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(k)continue}else if(J(a,c))continue;a.exec(b)}if(l&&!k){let b=a.prepare("PRAGMA foreign_key_check").all();if(b.length>0)throw Error(`[aka] sqlite migration ${d.tag} left ${String(b.length)} foreign-key violation(s); rolling back.`)}j.run(d.tag,Date.now())},"IMMEDIATE")}finally{l&&a.exec("PRAGMA foreign_keys = ON")}}g<f.lFU.length&&a.exec(`PRAGMA user_version = ${String(f.lFU.length)}`),function(a,b){var c;if(!I(a,"table",b))return;let d=K(a,b);d.includes("synced_at")||a.exec(`ALTER TABLE ${b} ADD COLUMN synced_at integer`),d.includes("sync_claimed_at")||a.exec(`ALTER TABLE ${b} ADD COLUMN sync_claimed_at integer`),d.includes("outbox_owed")||a.exec(`ALTER TABLE ${b} ADD COLUMN outbox_owed integer`),d.includes("sync_failed_at")||a.exec(`ALTER TABLE ${b} ADD COLUMN sync_failed_at integer`),d.includes("sync_failure")||F(a,()=>{a.exec(`ALTER TABLE ${b} ADD COLUMN sync_failure text`),a.exec(`UPDATE ${b} SET synced_at = NULL
|
|
916
|
+
WHERE synced_at = -1
|
|
917
|
+
AND event_type IN (${W.map(a=>`'${a}'`).join(", ")})`)},"IMMEDIATE"),a.exec(`CREATE TRIGGER IF NOT EXISTS aka_sync_failure_guard
|
|
918
|
+
BEFORE UPDATE OF sync_failure ON ${b}
|
|
919
|
+
WHEN ${function(a="sync_failure"){let b=ab.map(a=>`'${a}'`).join(", ");return`NEW.${a} IS NOT NULL AND NEW.${a} NOT IN (${b})`}()}
|
|
920
|
+
BEGIN SELECT RAISE(ABORT, 'sync_failure is not one of the recorded reasons'); END`);let e=["event_type","synced_at","sync_claimed_at","started_at","sync_failure"],f=(c="idx_audit_events_sync",J(a,c)?a.prepare(`PRAGMA index_info(${c})`).all().map(a=>a.name).filter(a=>null!==a):[]);f.length===e.length&&f.every((a,b)=>a===e[b])||(a.exec("DROP INDEX IF EXISTS idx_audit_events_sync"),a.exec(`CREATE INDEX idx_audit_events_sync
|
|
921
|
+
ON audit_events (${e.join(", ")})`)),a.exec(`CREATE INDEX IF NOT EXISTS idx_audit_outbox_owed
|
|
922
|
+
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
|
|
923
|
+
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 (
|
|
924
|
+
path TEXT PRIMARY KEY,
|
|
925
|
+
mtime TEXT NOT NULL,
|
|
926
|
+
content_hash TEXT NOT NULL,
|
|
927
|
+
ruleset_hash TEXT NOT NULL,
|
|
928
|
+
scanned_at INTEGER NOT NULL
|
|
929
|
+
)`),(d=a).exec(`CREATE TABLE IF NOT EXISTS history_sync (
|
|
930
|
+
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
931
|
+
endpoint_fingerprint TEXT,
|
|
932
|
+
backlog_before INTEGER,
|
|
933
|
+
owner_pid INTEGER,
|
|
934
|
+
owner_host TEXT,
|
|
935
|
+
acquired_at INTEGER,
|
|
936
|
+
heartbeat_at INTEGER
|
|
937
|
+
)`),K(d,"history_sync").includes("backlog_before")||d.exec("ALTER TABLE history_sync ADD COLUMN backlog_before integer"),a.exec(`CREATE TABLE IF NOT EXISTS blocked_detections (
|
|
938
|
+
reference TEXT PRIMARY KEY,
|
|
939
|
+
rule_id TEXT NOT NULL,
|
|
940
|
+
category TEXT NOT NULL,
|
|
941
|
+
value_fingerprint TEXT NOT NULL,
|
|
942
|
+
key_version INTEGER NOT NULL,
|
|
943
|
+
masked_value TEXT NOT NULL,
|
|
944
|
+
session_id TEXT,
|
|
945
|
+
repo TEXT,
|
|
946
|
+
blocked_at INTEGER NOT NULL
|
|
947
|
+
)`),a.exec(`CREATE TABLE IF NOT EXISTS rule_probe_cache (
|
|
948
|
+
rule_key TEXT PRIMARY KEY,
|
|
949
|
+
verdict TEXT NOT NULL,
|
|
950
|
+
worst_probe_ms REAL NOT NULL,
|
|
951
|
+
checked_at INTEGER NOT NULL
|
|
952
|
+
)`),(e=a).exec(`CREATE TABLE IF NOT EXISTS \`_pack_write_gate\` (
|
|
953
|
+
\`id\` integer PRIMARY KEY NOT NULL,
|
|
954
|
+
\`open\` integer DEFAULT 0 NOT NULL,
|
|
955
|
+
CONSTRAINT "ck_pack_write_gate_single_row" CHECK("_pack_write_gate"."id" = 1)
|
|
956
|
+
)`),e.exec("INSERT OR IGNORE INTO _pack_write_gate (id, open) VALUES (1, 0)"),I(e,"table","installed_packs")&&e.exec(`CREATE TRIGGER IF NOT EXISTS trg_installed_packs_write_gate
|
|
957
|
+
BEFORE UPDATE OF version, name, rules_json ON installed_packs
|
|
958
|
+
WHEN (SELECT open FROM _pack_write_gate WHERE id = 1) IS NOT 1
|
|
959
|
+
BEGIN SELECT RAISE(IGNORE); END`),function(a){if(!I(a,"table","audit_events"))return;let b=new Set(K(a,"audit_events",{includeGenerated:!0}));for(let c of ag)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
|
|
960
|
+
FROM source_project
|
|
961
|
+
WHERE url IS NOT NULL AND id NOT LIKE 'sample:%'
|
|
962
|
+
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)
|
|
963
|
+
VALUES (?, ?, ?, ?, ?, ?)
|
|
964
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
965
|
+
first_seen = min(first_seen, excluded.first_seen),
|
|
966
|
+
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 = ?
|
|
967
|
+
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 = ?");F(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){H(`source_project id reconcile failed: ${String(a)}`)}}(a),!h.has(ae)&&function(a){try{if(!function(a){let b=a.prepare(`SELECT rowid AS rowid, id, source_tool AS sourceTool, kind, occurred_at AS occurredAt,
|
|
968
|
+
content_hash AS contentHash, content, metadata
|
|
969
|
+
FROM events WHERE rowid > ? ORDER BY rowid LIMIT ?`),c=a.prepare(`INSERT OR IGNORE INTO audit_events
|
|
970
|
+
(id, parent_id, root_session_id, event_type, started_at, content, content_hash, attributes)
|
|
971
|
+
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 ah(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(O({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,
|
|
972
|
+
span_start AS spanStart, span_end AS spanEnd, masked_match AS maskedMatch,
|
|
973
|
+
action_taken AS actionTaken, confidence, finding_key AS findingKey,
|
|
974
|
+
first_detected_at AS firstDetectedAt
|
|
975
|
+
FROM findings WHERE rowid > ? ORDER BY rowid LIMIT ?`),c=a.prepare(`INSERT OR IGNORE INTO inspection_definitions
|
|
976
|
+
(id, rule_id, name, category, severity, definition, version)
|
|
977
|
+
VALUES (:id, :ruleId, :name, :category, :severity, :definition, :version)`),d=a.prepare(`INSERT INTO inspection_findings
|
|
978
|
+
(id, audit_event_id, inspection_definition_id, classified_data_id,
|
|
979
|
+
span_start, span_end, masked_match, action_taken, confidence,
|
|
980
|
+
finding_key, first_detected_at)
|
|
981
|
+
VALUES
|
|
982
|
+
(:id, :auditEventId, :inspectionDefinitionId, NULL,
|
|
983
|
+
:spanStart, :spanEnd, :maskedMatch, :actionTaken, :confidence,
|
|
984
|
+
:findingKey, :firstDetectedAt)
|
|
985
|
+
ON CONFLICT(id) DO NOTHING
|
|
986
|
+
ON CONFLICT (finding_key) DO UPDATE SET
|
|
987
|
+
first_detected_at = CASE
|
|
988
|
+
WHEN first_detected_at IS NULL THEN excluded.first_detected_at
|
|
989
|
+
WHEN excluded.first_detected_at IS NULL THEN first_detected_at
|
|
990
|
+
ELSE min(first_detected_at, excluded.first_detected_at)
|
|
991
|
+
END`);return ah(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(O({id:f,ruleId:e.ruleId,name:e.ruleId,category:e.category,severity:e.severity,definition:"",version:d})),b.set(a,f)}d.run(O({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 H(`legacy history backfill failed: ${String(a)}`),!1}}(a)&&function(a,b){let c=f.lFU.find(a=>a.tag===ae);if(!c)return;let d=void 0===b?void 0:af(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){H(`legacy events/findings backup failed; deferring the drop: ${String(a)}`);return}try{F(a,()=>{if(!a.prepare("SELECT 1 FROM migration_ledger WHERE tag = ?").get(c.tag)){if(void 0!==d&&af(a).mark!==d.mark)return void H("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 ad(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){H(`legacy events/findings drop failed; deferring: ${String(a)}`)}}(a,b)}(e,a,{skipTags:c}),k(a);let i=new by(e),l=new be(e,b),m={events:new aL(e),findings:new aY(e),policies:i,installedPacks:l,scanLedger:new bD(e),historySync:new aa(e),secretVault:new bJ(e),exceptions:new aR(e),resolutions:new bB(e),ruleProbeCache:new bC(e),bodyRetention:new aD(e),security:new bR(e),detections:new aK(e),shares:new bX(e),policyCatalog:new bz(l),inventory:new bf(e),inventoryAssets:new bx(e),projectFiles:new bA(e),activity:new aB(e),sourceProject:new bY(e),auditEvents:new aC(e),classifiedData:new aE(e),inspectionDefinitions:new aZ(e),inspectionFindings:new a$(e),configInventory:new aG(e)};return i.seedDefaults(),{db:e,...m}}catch(a){throw b0(e),a}}(c,(0,e.dirname)(a),!0===b.applyDeferredMigrations?void 0:b2);function _(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:m,findings:o,policies:t,installedPacks:u,scanLedger:v,historySync:y,bodyRetention:z,secretVault:B,exceptions:C,resolutions:D,ruleProbeCache:E,security:L,detections:M,shares:N,policyCatalog:P,inventory:Q,inventoryAssets:R,activity:T,sourceProject:U,auditEvents:V,classifiedData:X,inspectionDefinitions:Y,inspectionFindings:Z,recordCapture:function(a,b){G(l,()=>{let c=a.metadata?.sessionId;c&&V.ensureSessionRoot(c,a.occurredAt);let d=_(a);V.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&&Z.isSessionDuplicate(a.ruleId,a.maskedMatch,c)||Z.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=Y.upsert((0,f.jTf)(a)),e.set(b,g)),Z.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){G(l,()=>{y.markSynced([_(a)],b)})},markCaptureOwed:function(a){G(l,()=>{y.markCaptureOwed(_(a))})},markAuditEventsDelivered:function(a,b){let c=a.filter(a=>!bZ.has(a.eventType));0!==c.length&&G(l,()=>{y.markSynced(c.map(a=>a.id),b)})},ensureInventory:function(a){let b={};return G(l,()=>{let c=Date.now();a.host&&(b.hostId=Q.upsert(a.host,c)),a.harness&&(b.harnessId=Q.upsert(b_(a.harness,b.hostId),c)),b.accountId=Q.upsert(b_({objectType:"user",identityKey:"local",attributes:{source:"local"}},b.hostId),c),a.project&&(b.sourceProjectId=U.upsert(a.project,c))})?b:{}},recordConfigScan:function(a){G(l,()=>{let b=(0,f.I8t)(a.scanEvent.startedAt);for(let c of a.items)Q.upsert(c,b);V.insertAuditEvent(a.scanEvent);let c=new Map;for(let b of a.definitions??[])c.set(`${b.ruleId}@${b.version}`,Y.upsert(b));for(let b of a.findings??[]){let d=c.get(`${b.ruleId}@${b.version}`);d&&Z.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&&G(l,()=>{S.replaceForProject(a,b,Date.now())})},reconcileWorktreeProjects:function(a,b,c){try{let d=b.split(e.sep).join("/"),f=c.split(e.sep).join("/"),g=c===b?"":"url IN (:worktreePosix, :worktreeWin) OR ",h=l.prepare(`SELECT id FROM source_project
|
|
992
|
+
WHERE id <> :canonicalId
|
|
993
|
+
AND (${g}url LIKE :pattern ESCAPE '\\' OR url LIKE :patternWin ESCAPE '\\')`).all({canonicalId:a,...c===b?{}:{worktreePosix:f,worktreeWin:f.split("/").join("\\")},pattern:`${A(d)}/.claude/worktrees/%`,patternWin:`${A(d.split("/").join("\\"))}\\\\.claude\\\\worktrees\\\\%`});if(0===h.length)return;F(l,()=>{for(let{id:b}of h)l.prepare("UPDATE audit_events SET source_project_id = :canonicalId WHERE source_project_id = :id").run({canonicalId:a,id:b}),l.prepare("UPDATE OR IGNORE file_access_override SET project_id = :canonicalId WHERE project_id = :id").run({canonicalId:a,id:b}),l.prepare("DELETE FROM file_access_override WHERE project_id = :id").run({id:b}),l.prepare("DELETE FROM project_file WHERE project_id = :id").run({id:b}),l.prepare("DELETE FROM source_project WHERE id = :id").run({id:b})})}catch{}},configInventoryReport:()=>$.report(),facets:function(){return{hosts:Q.distinctTitles("host"),harnesses:Q.distinctTitles("harness"),osVersions:Q.osVersions(),projects:U.distinctNames()}},purgeSampleData:()=>{!function(a){try{if(!a.prepare(`SELECT (
|
|
994
|
+
EXISTS(SELECT 1 FROM share_destination WHERE provenance = 'sample')
|
|
995
|
+
OR EXISTS(SELECT 1 FROM audit_events WHERE id LIKE 'sample:activity:%')
|
|
996
|
+
OR EXISTS(SELECT 1 FROM inventory_asset WHERE provenance = 'sample')
|
|
997
|
+
) AS n`).get().n)return;F(a,()=>{a.exec(`DELETE FROM share_call_site WHERE endpoint_id IN (
|
|
998
|
+
SELECT e.id FROM share_endpoint e
|
|
999
|
+
JOIN share_destination d ON d.id = e.destination_id
|
|
1000
|
+
WHERE d.provenance = 'sample')`),a.exec(`DELETE FROM egress_decision_override WHERE destination_id IN (
|
|
1001
|
+
SELECT id FROM share_destination WHERE provenance = 'sample')`),a.exec(`DELETE FROM share_endpoint WHERE destination_id IN (
|
|
1002
|
+
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')
|
|
1003
|
+
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 (
|
|
1004
|
+
key TEXT PRIMARY KEY,
|
|
1005
|
+
value TEXT NOT NULL
|
|
1006
|
+
)`),a.exec("DELETE FROM app_meta WHERE key LIKE 'sample_seeded:%'")})}catch{}}(l)},transaction:async function a(a){l.exec("BEGIN");try{let b=await a();return l.exec("COMMIT"),b}catch(a){try{l.exec("ROLLBACK")}catch{}throw a}},close:()=>{l.close()},[b$]:l}}function b4(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 b5(a){return null===a?{status:"absent"}:{status:"present",version:a.version}}let b6=new Set(["unauthorized","forbidden","unreachable"]);function b7(a,b=Date.now()){try{return function(a,b){try{let c=JSON.parse(a);if("object"!=typeof c||null===c)return null;let d="number"==typeof c.consecutiveFailures&&c.consecutiveFailures>=0?c.consecutiveFailures:0,e="number"==typeof c.openedAtMs&&Number.isFinite(c.openedAtMs)&&c.openedAtMs<=b?c.openedAtMs:null,f="string"==typeof c.lastFailure&&b6.has(c.lastFailure)?c.lastFailure:null;return{consecutiveFailures:d,openedAtMs:e,lastFailure:f}}catch{return null}}((0,d.readFileSync)((0,e.join)(a,"attached-state.json"),"utf8"),b)}catch{return null}}function b8(a,b){let c=a?.openedAtMs??null;return null!==c&&b-c<3e4}let b9=new Set(["filling","complete"]),ca=new Set(["ok","unreachable","refused","interrupted"]);function cb(a){try{let b=JSON.parse((0,d.readFileSync)((0,e.join)(a,"attached-history-sync.json"),"utf8"));if("object"!=typeof b||null===b||1!==b.specVersion||"string"!=typeof b.phase||!b9.has(b.phase)||"string"!=typeof b.lastOutcome||!ca.has(b.lastOutcome)||!cc(b.lastPassAtMs)||!cc(b.sentTotal)||!cc(b.pendingTotal)||!cc(b.skippedTotal)||!cd(b.startedAtMs)||!cd(b.completedAtMs))return null;return{specVersion:1,phase:b.phase,lastOutcome:b.lastOutcome,lastPassAtMs:b.lastPassAtMs,sentTotal:b.sentTotal,pendingTotal:b.pendingTotal,skippedTotal:b.skippedTotal,startedAtMs:b.startedAtMs,completedAtMs:b.completedAtMs}}catch{return null}}function cc(a){return"number"==typeof a&&Number.isFinite(a)&&a>=0}function cd(a){return null===a||cc(a)}c(31421),Symbol("aka.vault.consentAbsent"),Symbol("aka.vault.unavailable")},80954:(a,b,c)=>{"use strict";c.d(b,{ProjectPane:()=>l});var d=c(15008),e=c(71378),f=c(1505),g=c(59294),h=c(93946),i=c(97769),j=c(14728);function k(a){let b=a.lastIndexOf("/");return -1===b?"":a.slice(0,b)}function l(a){let{proj:b,path:c,onPathChange:f,query:g,tree:k,isLoading:l,error:p,onClose:t}=a,u=g.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)(n,{proj:b,path:c,onPathChange:f})}),(0,d.jsx)(m,{...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)(j.m,{name:"x"})})]}),(0,d.jsxs)("div",{className:"mt-3 flex items-start gap-2.5",children:[(0,d.jsx)(h.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,i._t)(b,"source")}),(0,d.jsx)("span",{className:"flex items-center gap-3 text-xs text-text-3",children:i.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",i.Pe[a].bar)}),x[a]," ",i.Pe[a].label]},a))})]})]})]}),!u&&a.blocked.length>0&&(0,d.jsx)(s,{...a}),(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 pb-4 pt-2",children:l&&!k?(0,d.jsx)("div",{className:"py-12 text-center text-sm text-text-3",children:"Loading files…"}):p?(0,d.jsx)("div",{className:"py-12 text-center text-sm text-sev-critical-ink",children:p}):u?w.length>0?(0,d.jsx)(r,{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)(j.m,{name:"search",className:"mx-auto mb-2 size-6"}),(0,d.jsxs)("div",{className:"text-sm",children:["No files match “",g,"”"]})]}):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)(o,{folder:a,onOpen:()=>{f([...c,a.name])}},"d"+a.name)),w.map(b=>(0,d.jsx)(q,{file:b,...a},"f"+b.path))]})]})})]})}function m({proj:a,query:b,onQueryChange:c}){return(0,d.jsx)(g.SearchField,{value:b,onValueChange:c,label:`Search files in ${a.name}`,placeholder:`Search files in ${a.name}…`,clearLabel:`Clear file search in ${a.name}`,surface:"card",className:"h-9 w-70 shrink-0"})}function n({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)(j.m,{name:"arrow-up"})}),g.map((a,h)=>{let i=h===g.length-1;return(0,d.jsxs)(f.Fragment,{children:[h>0&&(0,d.jsx)(j.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",i?"cursor-default font-bold text-text":"font-semibold text-text-2 hover:text-text"),children:a})]},h)})]})}function o({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)(j.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)(h.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)(j.m,{name:"chevron-right",className:"size-4 text-text-3"})})})]})}function p({file:a,showPath:b}){let c=k(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)(j.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)(j.m,{name:"slash-circle",className:"size-3"}),a.note]})]})]})}function q({file:a,onSetAccess:b,onOpenFile:c,drawerPath:f,showPath:g}){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)(p,{file:a,showPath:g})}),(0,d.jsx)(e.nA,{children:(0,d.jsx)(h.TJ,{origin:a.origin})}),(0,d.jsx)(e.nA,{children:(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(h.kx,{value:a.access,onChange:c=>{b(a.path,c)}}),(0,d.jsx)(h.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)(j.m,{name:"chevron-right",className:"size-4 text-text-3"})})})]})}function r({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)(q,{file:a,showPath:c,...f},a.path))})]})}function s({blocked:a,showBlocked:b,onToggleBlocked:c,onSetAccess:f,onOpenFile:g}){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)(j.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)(j.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=k(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,i.v7)(a.blockedAt)}`:""]})]}),(0,d.jsx)(h.kx,{value:a.access,onChange:b=>{f(a.path,b)}}),(0,d.jsx)(h.Vx,{value:a.access}),(0,d.jsx)(e.$n,{variant:"ghost",tone:"primary",size:"sm",onClick:()=>{g(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(33414),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}},87921:(a,b,c)=>{"use strict";c.d(b,{FindingsOverTimeCardView:()=>l});var d=c(15008),e=c(71378),f=c(60004),g=c(5475),h=c(16820),i=c(13364),j=c(99685);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,granularity:b,isLoading:c,error:f}){let l=a.every(a=>k.every(b=>!a[b.key])),m=(0,i.T)(k);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.Uy,{"aria-hidden":!0,focusable:!1,className:"size-4"})}),(0,d.jsxs)(e.Lc,{children:[(0,d.jsx)(e.ZB,{children:"Findings over time"}),(0,d.jsx)(e.BT,{children:`New sensitive-data detections${null===b?"":` per ${b}`}`})]}),(0,d.jsx)(e.X9,{className:"gap-3 text-xs text-text-2",children:(0,d.jsx)(i.N,{series:k,visibility:m,interactive:!f&&!c&&!l})})]}),(0,d.jsx)(e.Wu,{"aria-busy":c,className:"pb-2",children:f?(0,d.jsx)(j.rJ,{message:f}):c?(0,d.jsx)(e.EA,{className:"h-40 w-full"}):l?(0,d.jsx)(j.AW,{message:"No findings in this range."}):(0,d.jsx)(g.AreaChart,{data:a,series:m.visible,height:160})})]})}},88461:(a,b,c)=>{"use strict";c.d(b,{SessionListView:()=>p});var d=c(15008),e=c(71378),f=c(5265),g=c(16820),h=c(63407),i=c(59294),j=c(88488),k=c(70124),l=c(21459),m=c(21462);function n({session:a,selected:b,onSelect:c,renderedAt:i}){let j=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)(k.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)(k.JW,{icon:g.O4,children:(0,l.vV)(a.startedAt,a.endedAt,a.status,i)}),(0,d.jsxs)(k.JW,{icon:g.kp,children:[a.turns," turns"]}),j&&(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 o(){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 p({sessions:a,selectedId:b,onSelect:c,query:f,onQuery:g,harness:h,harnessOptions:k,onHarness:p,isLoading:q,error:r,hasMore:s=!1,emptyCount:t=0,showEmpty:u=!1,onToggleEmpty:v,renderedAt:w}){let x=(0,l.u3)(a,new Date(w)),y=""!==f.trim()||h.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.jsx)(i.SearchField,{value:f,onValueChange:g,label:"Search sessions and events",placeholder:"Search sessions & events…",surface:"card",className:"mb-2 h-8.5 px-2.5",iconClassName:"size-3.5"}),(0,d.jsx)(m.HarnessSelect,{value:h,onChange:p,...k?{options:k}:{}})]}),(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)(j.r,{message:r})}):q&&0===a.length?(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)(o,{}),(0,d.jsx)(o,{}),(0,d.jsx)(o,{})]}):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)(n,{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:()=>j,DetectionsListView:()=>l});var d=c(15008),e=c(71378),f=c(16820),g=c(59294),h=c(4543),i=c(65366);let j=[["all","All"],["library","Library"],["updates","Updates"]];function k({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)(h.Ai,{origin:a.origin}),(0,d.jsx)(h.$F,{policy:a.policyId??i.tG,floor:e}),c?(0,d.jsx)(h.Zp,{version:c}):null]})]})})}function l({items:a,counts:b,activeId:c,query:h,filter:i,onQueryChange:l,onFilterChange:m,onSelect:n,isLoading:o=!1,error:p=null,updatesById:q,floorsById:r,filterTabs:s=j}){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.jsx)(g.SearchField,{value:h,onValueChange:l,label:"Search detections",placeholder:"Search detections…",surface:"card",className:"h-9"}),(0,d.jsx)("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:s.map(([a,c])=>{let e=i===a,g=b[a]??0,h="updates"===a&&g>0;return(0,d.jsxs)("button",{type:"button",onClick:()=>{m(a)},className:"inline-flex h-7 items-center gap-1.5 cursor-pointer rounded-full border px-2.5 text-xs font-semibold "+(e?h?"border-sev-high bg-sev-high-fill text-sev-high-ink":"border-primary bg-primary-tint text-primary":h?"border-border text-sev-high-ink":"border-border bg-surface text-text-2"),children:[h&&(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:o?(0,d.jsx)("div",{className:"grid flex-1 place-items-center p-6 text-center text-xs text-text-3",children:"Loading detections…"}):p?(0,d.jsx)("div",{className:"grid flex-1 place-items-center p-6 text-center text-xs text-sev-critical-ink",children:p}):0===a.length?(0,d.jsx)("div",{className:"grid flex-1 place-items-center p-6 text-center text-xs text-text-3",children:h.trim()?`No detections match “${h.trim()}”`:"No detections in this view"}):a.map(a=>(0,d.jsx)(k,{d:a,sel:a.id===c,updateVersion:q?.get(a.id),floor:r?.get(a.id),onClick:()=>{n(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))})]})]})]})}},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]})}},95043:(a,b,c)=>{"use strict";c.d(b,{Zp:()=>k,Wu:()=>q,BT:()=>p,aR:()=>l,Lc:()=>n,AG:()=>m,ZB:()=>o,kI:()=>t,EA:()=>w,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-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 r=c(32071);r.Root,r.Trigger,r.Close;var s=c(39904);function t({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}})})}s.Root,s.Trigger,s.Group,s.RadioGroup;var u=c(3867);u.Root,u.Trigger,u.Close,u.Anchor;var v=c(12278);function w({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})}v.Root,v.Group,v.Value,r.Root,r.Trigger,r.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:()=>m});var d=c(15008),e=c(71378),f=c(1505),g=c(63407),h=c(59294),i=c(93946),j=c(97769),k=c(14728);let l=[{type:"all",label:"All"},...j.fd.map(a=>({type:a.type,label:"Configuration"===a.label?"Config":a.label.replace(" servers","")}))];function m(a){let{projects:b,assetGroups:c,harnesses:g,viewMode:i,onViewMode:j,typeFilter:m,onTypeFilter:o,query:q,onQuery:r,attention:s,isLoading:t}=a,u=(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]),v=(0,f.useMemo)(()=>{let a=q.toLowerCase(),c=b=>!a||b.toLowerCase().includes(a);return b.filter(a=>c(a.name)||c(a.repo))},[b,q]);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===s?(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",s?"text-sev-high-ink":"text-ok-ink"),children:[(0,d.jsx)(k.m,{name:s?"flag":"check-circle",className:"size-3.5"}),s?`${String(s)} to review`:"All clear"]})]}),(0,d.jsx)(h.SearchField,{value:q,onValueChange:r,label:"Search assets",placeholder:"Search assets…",clearLabel:"Clear asset search",surface:"card",className:"h-8.5"}),(0,d.jsxs)(e.Iz,{className:"mt-3 flex w-full",value:i,onValueChange:a=>{a&&j(a)},children:[(0,d.jsxs)(e.tR,{value:"tree",children:[(0,d.jsx)(k.m,{name:"layers"})," By harness"]}),(0,d.jsxs)(e.tR,{value:"type",children:[(0,d.jsx)(k.m,{name:"list"})," By type"]})]}),"type"===i&&(0,d.jsx)(e.Iz,{className:"mt-2.5 flex w-full flex-wrap border-0 bg-transparent p-0 gap-1.5",value:m,onValueChange:a=>{a&&o(a)},children:l.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:t&&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"===i?(0,d.jsx)(n,{...a}):(0,d.jsx)(p,{...a,projList:v,assetsByType:u})})]})}function n(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)(t,{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)(o,{h:b,...a},b.id)):(0,d.jsx)(i.EmptyState,{message:c?"No matches":"No harnesses detected"})})]})}function o(a){let{h:b,sel:c,expanded:f,onToggleExpand:h,onSelectHarness:i,onSelectAsset:l,query:m}=a,n=b.projects,o=b.categories,p=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":p?"Collapse":"Expand","aria-expanded":p,onClick:()=>{h(b.id,!p)},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)(k.m,{name:"chevron-right",className:(0,e.cn)("size-3.5 transition-transform",p&&"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:()=>{i(b.id),p||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)(k.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})]})]})]}),p&&(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)(k.m,{name:j.WD.icon,className:"size-3 text-text-3"}),(0,d.jsx)("span",{className:"text-label font-bold uppercase tracking-wider text-text-3",children:j.WD.label}),(0,d.jsx)("span",{className:"text-label font-semibold text-text-3",children:n.length})]}),n.map(c=>(0,d.jsx)(q,{p:c,fromHarness:b.id,...a},c.id))]}),o.map(a=>{let e=j.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)(k.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)(r,{it:a,indent:!0,fromHarness:b.id,sel:c,onSelectAsset:l},a.id))]},a.type)})]})]})}function p(a){let{typeFilter:b,query:c,projList:e,assetsByType:f}=a,g=c.toLowerCase(),h=a=>!g||a.toLowerCase().includes(g),k=0,l=j.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)(s,{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)(i.EmptyState,{message:`No ${c.label.toLowerCase()}`}):e.map(b=>(0,d.jsx)(q,{p:b,...a},b.id))})]},c.type))}let j=f[c.type].filter(a=>h(a.name)||h(a.sub));return 0===j.length&&"all"===b?null:(j.length>0&&k++,(0,d.jsxs)("div",{children:[(0,d.jsx)(s,{group:c,items:j,mcpItems:"mcp"===c.type?j:void 0}),(0,d.jsx)("div",{className:"flex flex-col gap-0.5",children:0===j.length?(0,d.jsx)(i.EmptyState,{message:`No ${c.label.toLowerCase()}`}):j.map(b=>(0,d.jsx)(r,{it:b,sel:a.sel,onSelectAsset:a.onSelectAsset},b.id))})]},c.type))});return"all"===b&&0===k?(0,d.jsx)(i.EmptyState,{icon:"search",message:c?`No assets match “${c}”`:"No assets"}):(0,d.jsx)(d.Fragment,{children:l})}function q({p:a,fromHarness:b,selFromHarness:c,sel:f,onSelectProject:g}){let h=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,j.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)(i.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)(k.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)(i.AJ,{counts:h}),h.blocked>0?(0,d.jsxs)("span",{className:"text-xs font-semibold text-sev-critical-ink",children:[h.blocked," blocked"]}):(0,d.jsxs)("span",{className:"text-xs text-text-3",children:[h.total," files"]}),l>0&&(0,d.jsx)("span",{className:"ml-auto shrink-0",children:(0,d.jsx)(i.Kh,{flags:["findings"],mini:!0})})]})]})}function r({it:a,indent:b,fromHarness:c,sel:f,onSelectAsset:g}){let h=f?.type===a.type&&f.id===a.id,l=(0,j.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",h?"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)(k.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)(i.As,{value:m}),a.flags.length>0&&(0,d.jsx)(i.Kh,{flags:a.flags,mini:!0})]})]})}function s({group:a,items:b,mcpItems:c}){let f=(0,j.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)(k.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:j.ZY[a.k].tone,children:[a.n," ",j.ZY[a.k].label.toLowerCase()]},a.k)),f.map(a=>(0,d.jsxs)(e.Ex,{variant:j.lx[a.key].tone,children:[a.count," ",j.lx[a.key].short.toLowerCase()]},a.key))]})]})}function t({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)(k.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:()=>g});var d=c(15008),e=c(71378);c(16820);var f=c(14129);function g({action:a}){let b=(0,f.C$)(a),c=b.icon;return(0,d.jsx)(e.vw,{icon:(0,d.jsx)(c,{}),className:(0,e.cn)("rounded-full border-transparent px-2.5 text-xs [&_svg]:size-3.5",b.className),children:b.label})}},99588:()=>{},99685:(a,b,c)=>{"use strict";c.d(b,{AW:()=>d.A,rJ:()=>d.r}),c(53002);var d=c(88488)},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))})}}};
|