loki-mode 9.48.1 → 9.49.2
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/.github/workflows/loki-issue-to-pr.yml +1 -1
- package/SKILL.md +2 -2
- package/VERSION +1 -1
- package/autonomy/loki +166 -13
- package/autonomy/provider-offer.sh +47 -0
- package/autonomy/quickstart.sh +306 -9
- package/dashboard/__init__.py +1 -1
- package/dashboard/static/index.html +7 -1
- package/docs/INSTALLATION.md +1 -1
- package/docs/KNOWN-ISSUES.md +42 -0
- package/loki-ts/dist/loki.js +317 -317
- package/mcp/__init__.py +1 -1
- package/package.json +1 -1
- package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
- package/web-app/dist/assets/{AdminPage-PyyVXg4b.js → AdminPage-DpV2vW3y.js} +1 -1
- package/web-app/dist/assets/{Avatar-CTUlr_Xf.js → Avatar-BXeMYK1_.js} +1 -1
- package/web-app/dist/assets/{Badge-BQeXvmg8.js → Badge-D8WddQk1.js} +1 -1
- package/web-app/dist/assets/{Button-Dc6-P6pz.js → Button-CFzTTVeJ.js} +1 -1
- package/web-app/dist/assets/{CockpitPage-BspOJ3Fv.js → CockpitPage-D1eQe9QF.js} +4 -4
- package/web-app/dist/assets/{ComparePage-CFXIM--Z.js → ComparePage-uX3OPphr.js} +1 -1
- package/web-app/dist/assets/{ErrorBoundary-C7vQYDW9.js → ErrorBoundary-wE3oxaG6.js} +1 -1
- package/web-app/dist/assets/{EvidenceReceiptPanel-CqjsjTOs.js → EvidenceReceiptPanel-B_Wouz6N.js} +1 -1
- package/web-app/dist/assets/{GitHubIssuesPanel-DyuNDMgD.js → GitHubIssuesPanel-DRlEeFuw.js} +1 -1
- package/web-app/dist/assets/{GitHubPRsPanel-BtAq20xF.js → GitHubPRsPanel-CCv6_I74.js} +2 -2
- package/web-app/dist/assets/{HomePage-BuVFOrO8.js → HomePage-EG-jq8nR.js} +1 -1
- package/web-app/dist/assets/{LoginPage-CuhhrxGb.js → LoginPage-CEOnBICH.js} +1 -1
- package/web-app/dist/assets/{MagicPage-D2KZPX3F.js → MagicPage-DeWaFdsG.js} +1 -1
- package/web-app/dist/assets/MetricsPage-CG8CuSSJ.js +6 -0
- package/web-app/dist/assets/{NotFoundPage-CTnnaWlL.js → NotFoundPage-Mz5rOat6.js} +1 -1
- package/web-app/dist/assets/{ProjectPage-uJFaoM8-.js → ProjectPage-D2Fh6tVw.js} +8 -8
- package/web-app/dist/assets/{ProjectsPage-8lKAOBIW.js → ProjectsPage-B8cRWkWa.js} +2 -2
- package/web-app/dist/assets/{SettingsPage-D1BBd5qy.js → SettingsPage-DKpsst6x.js} +1 -1
- package/web-app/dist/assets/{ShowcasePage-CmQ0n8iO.js → ShowcasePage-qab065PM.js} +1 -1
- package/web-app/dist/assets/SystemSettingsPage-9qmEH2Y6.js +1 -0
- package/web-app/dist/assets/{TeamsPage-BS0TtVUa.js → TeamsPage-CW6lvW-0.js} +1 -1
- package/web-app/dist/assets/{TemplatesPage-C2zPnnf2.js → TemplatesPage-B-a61T6a.js} +1 -1
- package/web-app/dist/assets/{TerminalOutput-Dle1klqq.js → TerminalOutput-CJy13rAn.js} +1 -1
- package/web-app/dist/assets/{activity-DQp5U9f9.js → activity-CA4moIvC.js} +1 -1
- package/web-app/dist/assets/{bell-BqkTmgL7.js → bell-JyOeobLN.js} +1 -1
- package/web-app/dist/assets/{bot-DILhaIGH.js → bot-Cu4UwP5w.js} +1 -1
- package/web-app/dist/assets/{check-BC9x7oPm.js → check-Drzd8-9c.js} +1 -1
- package/web-app/dist/assets/{chevron-left--yqvAfjx.js → chevron-left-ClvdXm3Y.js} +1 -1
- package/web-app/dist/assets/{circle-alert-DOH6PcgZ.js → circle-alert-CstyZfKG.js} +1 -1
- package/web-app/dist/assets/{clock-DKSDFsE6.js → clock-Bnz6tlQN.js} +1 -1
- package/web-app/dist/assets/{cloud-DRBU3JYs.js → cloud-IPIgE4P3.js} +1 -1
- package/web-app/dist/assets/{code-xml-D2LqszR9.js → code-xml-BOZbQiOt.js} +1 -1
- package/web-app/dist/assets/{database-D7ceedlh.js → database-CHclPjog.js} +1 -1
- package/web-app/dist/assets/{dollar-sign-D0A47egY.js → dollar-sign-D6RFNgdZ.js} +1 -1
- package/web-app/dist/assets/{file-code-corner-CH_Qbtjo.js → file-code-corner-CNayCvOY.js} +1 -1
- package/web-app/dist/assets/{file-plus-CUNMjHk9.js → file-plus-BmVfFwsX.js} +1 -1
- package/web-app/dist/assets/folder-open-ChzGfLRr.js +11 -0
- package/web-app/dist/assets/{globe-gZnaGg8N.js → globe-DtXgCG3Z.js} +1 -1
- package/web-app/dist/assets/{hammer-BhJC5DMK.js → hammer-DCa0I_7V.js} +1 -1
- package/web-app/dist/assets/{index-BMmYYws0.js → index-Cu-njJ8o.js} +3 -3
- package/web-app/dist/assets/index-D98GzaW8.css +1 -0
- package/web-app/dist/assets/{layers-glXeoUbJ.js → layers-DxIhn7NZ.js} +1 -1
- package/web-app/dist/assets/{lightbulb-gXn8H0Lf.js → lightbulb-D7Pzhd06.js} +1 -1
- package/web-app/dist/assets/{loader-circle-Do2ke8xm.js → loader-circle-DXgc_u5I.js} +1 -1
- package/web-app/dist/assets/{lock-Bgplb1_n.js → lock-qRAVU53b.js} +1 -1
- package/web-app/dist/assets/{mail-j4Lo8hfB.js → mail-CHe3KyCw.js} +1 -1
- package/web-app/dist/assets/{minus-dhrzKSK5.js → minus-B8p0FoYZ.js} +1 -1
- package/web-app/dist/assets/{package-CInWQQ97.js → package-C5LDn8SI.js} +1 -1
- package/web-app/dist/assets/{plus-BpYvoLlZ.js → plus-CRd_FHOA.js} +1 -1
- package/web-app/dist/assets/{refresh-cw-F6koqEgF.js → refresh-cw-DKoSN8s3.js} +1 -1
- package/web-app/dist/assets/{rotate-ccw-CQ2W5S8f.js → rotate-ccw-Nf8zB8G0.js} +1 -1
- package/web-app/dist/assets/{save-DMCYGm06.js → save-B8ytQLgW.js} +1 -1
- package/web-app/dist/assets/{server-Bj8EX4Z1.js → server-D_VRDkaD.js} +1 -1
- package/web-app/dist/assets/{shield-alert-CiYuulCU.js → shield-alert-PsDkSyFD.js} +1 -1
- package/web-app/dist/assets/{thumbs-up-BqEh1puP.js → thumbs-up-Da1QQhqo.js} +11 -6
- package/web-app/dist/assets/{trash-2-CCwouZJJ.js → trash-2-ChoylpGQ.js} +1 -1
- package/web-app/dist/assets/{trending-down-Cx1vhE4o.js → trending-down-CX2fUeho.js} +1 -1
- package/web-app/dist/assets/{trending-up-BUhVYJ2T.js → trending-up-CGyYgZH7.js} +1 -1
- package/web-app/dist/assets/{upload-D5IsZeFM.js → upload-KkeVyg67.js} +1 -1
- package/web-app/dist/assets/{usePolling-CJbfhFcH.js → usePolling-C5f4xrXD.js} +1 -1
- package/web-app/dist/assets/{user-BRLhezsD.js → user-WCGccIST.js} +1 -1
- package/web-app/dist/index.html +2 -2
- package/web-app/server.py +121 -1
- package/web-app/dist/assets/MetricsPage-DFEYJl9z.js +0 -6
- package/web-app/dist/assets/SystemSettingsPage-CSHaVyuD.js +0 -6
- package/web-app/dist/assets/copy-BKW4U4Qr.js +0 -6
- package/web-app/dist/assets/folder-open-CQ_SVq94.js +0 -6
- package/web-app/dist/assets/git-commit-horizontal-DQUBe0oD.js +0 -6
- package/web-app/dist/assets/index-84JUN_aA.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as I,r as o,a as b,j as e,G as xe,A as me,S as Z,l as ee,n as
|
|
1
|
+
import{c as I,r as o,a as b,j as e,G as xe,A as me,S as Z,l as ee,n as ue,i as pe,b as he,X as te,M as fe}from"./index-Cu-njJ8o.js";import{B as y}from"./Button-CFzTTVeJ.js";import{C as be}from"./chevron-left-ClvdXm3Y.js";import{G as P}from"./thumbs-up-Da1QQhqo.js";import{R as L}from"./refresh-cw-DKoSN8s3.js";import{C as ge}from"./circle-alert-CstyZfKG.js";import{L as V,S as Ne}from"./ProjectPage-D2Fh6tVw.js";import{S as se}from"./shield-alert-PsDkSyFD.js";import{F as je}from"./file-code-corner-CNayCvOY.js";import{C as H}from"./clock-Bnz6tlQN.js";import{C as re}from"./check-Drzd8-9c.js";import"./ErrorBoundary-wE3oxaG6.js";import"./TerminalOutput-CJy13rAn.js";import"./lock-qRAVU53b.js";import"./package-C5LDn8SI.js";import"./file-plus-BmVfFwsX.js";import"./activity-CA4moIvC.js";import"./bot-Cu4UwP5w.js";import"./loader-circle-DXgc_u5I.js";import"./hammer-DCa0I_7V.js";import"./dollar-sign-D6RFNgdZ.js";import"./globe-DtXgCG3Z.js";import"./folder-open-ChzGfLRr.js";import"./upload-KkeVyg67.js";import"./plus-CRd_FHOA.js";import"./trash-2-ChoylpGQ.js";import"./rotate-ccw-Nf8zB8G0.js";import"./minus-B8p0FoYZ.js";import"./save-B8ytQLgW.js";import"./code-xml-BOZbQiOt.js";import"./trending-up-CGyYgZH7.js";import"./layers-DxIhn7NZ.js";import"./trending-down-CX2fUeho.js";import"./server-D_VRDkaD.js";/**
|
|
2
2
|
* @license lucide-react v0.577.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -14,4 +14,4 @@ import{c as I,r as o,a as b,j as e,G as xe,A as me,S as Z,l as ee,n as pe,i as u
|
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
16
|
*/const we=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ce=I("shield-question-mark",we);function Re(t){const n=Date.now(),i=new Date(t).getTime(),a=Math.floor((n-i)/1e3);if(a<60)return"just now";const c=Math.floor(a/60);if(c<60)return`${c}m ago`;const l=Math.floor(c/60);if(l<24)return`${l}h ago`;const x=Math.floor(l/24);return x<30?`${x}d ago`:`${Math.floor(x/30)}mo ago`}function Se(t){switch(t==null?void 0:t.toUpperCase()){case"APPROVED":return{className:"bg-green-500/10 text-green-500 border-green-500/20",label:"Approved"};case"CHANGES_REQUESTED":return{className:"bg-red-400/10 text-red-400 border-red-400/20",label:"Changes Requested"};case"REVIEW_REQUIRED":return{className:"bg-yellow-500/10 text-yellow-500 border-yellow-500/20",label:"Review Required"};default:return{className:"bg-muted/10 text-muted border-muted/20",label:t}}}function ze(t){switch(t==null?void 0:t.toUpperCase()){case"APPROVED":return{className:"text-green-500",label:"Approved",Icon:Z};case"CHANGES_REQUESTED":return{className:"text-red-400",label:"Changes Requested",Icon:se};case"COMMENTED":return{className:"text-muted",label:"Commented",Icon:fe};case"DISMISSED":return{className:"text-muted/60",label:"Dismissed",Icon:ee};default:return{className:"text-muted",label:t||"Pending",Icon:Ce}}}function Pe(t){switch(t==null?void 0:t.toLowerCase()){case"success":return e.jsx(re,{size:12,className:"text-green-500"});case"failure":case"error":return e.jsx(te,{size:12,className:"text-red-400"});case"pending":case"in_progress":case"queued":return e.jsx(V,{size:12,className:"text-yellow-500 animate-spin"});case"neutral":case"skipped":return e.jsx(H,{size:12,className:"text-muted"});default:return e.jsx(H,{size:12,className:"text-muted"})}}function Me(t){if(!t||t.length===0)return{label:"No checks",className:"text-muted"};const n=t.every(a=>a.conclusion==="success"),i=t.some(a=>a.conclusion==="failure"||a.conclusion==="error");return n?{label:"All passing",className:"text-green-500"}:i?{label:"Some failing",className:"text-red-400"}:{label:"In progress",className:"text-yellow-500"}}function Ee(t){var a;const n=[];if(!t)return n;const i=t.split(/^diff --git /m).filter(Boolean);for(const c of i){const l=c.split(`
|
|
17
|
-
`),x=(a=l[0])==null?void 0:a.match(/a\/(.+?) b\/(.+)/),g=x?x[2]:"unknown";let w=0,v=0;const C=[];let s=null,p=0,h=0;for(let k=1;k<l.length;k++){const m=l[k],N=m.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@(.*)/);if(N){s={header:m,lines:[]},C.push(s),p=parseInt(N[1],10),h=parseInt(N[2],10),s.lines.push({type:"header",content:m});continue}s&&(m.startsWith("+")?(w++,s.lines.push({type:"add",content:m.slice(1),newLine:h}),h++):m.startsWith("-")?(v++,s.lines.push({type:"delete",content:m.slice(1),oldLine:p}),p++):m.startsWith(" ")&&(s.lines.push({type:"context",content:m.slice(1),oldLine:p,newLine:h}),p++,h++))}n.push({path:g,additions:w,deletions:v,hunks:C})}return n}function De({pr:t}){var c;const n=((c=t.statusCheckRollup)==null?void 0:c.contexts)||[];if(!n||n.length===0)return e.jsx("span",{title:"No status checks",children:e.jsx(H,{size:13,className:"text-muted"})});const i=n.every(l=>l.conclusion==="success"),a=n.some(l=>l.conclusion==="failure"||l.conclusion==="error");return i?e.jsx("span",{title:"All checks passing",children:e.jsx(re,{size:13,className:"text-green-500"})}):a?e.jsx("span",{title:"Some checks failing",children:e.jsx(te,{size:13,className:"text-red-400"})}):e.jsx("span",{title:"Checks in progress",children:e.jsx(V,{size:13,className:"text-yellow-500 animate-spin"})})}function Le({pr:t,onClick:n}){var a;const i=Se(t.reviewDecision||"PENDING");return e.jsx("button",{onClick:n,className:"w-full text-left px-3 py-2.5 border-b border-border hover:bg-hover transition-colors",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(P,{size:14,className:`mt-0.5 flex-shrink-0 ${t.state==="open"?"text-green-500":t.state==="merged"?"text-purple-500":"text-red-400"}`}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-ink truncate",children:t.title}),e.jsxs("span",{className:"text-[10px] font-mono text-muted flex-shrink-0",children:["#",t.number]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[e.jsx("span",{className:"text-[10px] text-muted",children:(a=t.author)==null?void 0:a.login}),e.jsx("span",{className:"text-[10px] font-mono text-primary/60 truncate max-w-[120px]",title:t.headRefName,children:t.headRefName}),e.jsx("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:e.jsx(De,{pr:t})}),e.jsx("span",{className:`inline-flex items-center px-1.5 py-0 text-[9px] font-medium rounded border ${i.className}`,children:i.label}),e.jsxs("span",{className:"text-[10px] text-muted ml-auto flex-shrink-0 flex items-center gap-1",children:[e.jsxs("span",{className:"text-green-500",children:["+",t.additions]}),e.jsxs("span",{className:"text-red-400",children:["-",t.deletions]})]}),e.jsx("span",{className:"text-[10px] text-muted flex-shrink-0",children:Re(t.createdAt)})]})]})]})})}function $e({checks:t}){const[n,i]=o.useState(!1),a=Me(t);return!t||t.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-muted",children:"No status checks configured."}):e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("button",{onClick:()=>i(!n),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-hover transition-colors",children:[n?e.jsx(ue,{size:12}):e.jsx(he,{size:12}),e.jsx("span",{className:"text-xs font-semibold text-ink",children:"Status Checks"}),e.jsx("span",{className:`text-[10px] font-medium ${a.className}`,children:a.label}),e.jsxs("span",{className:"text-[10px] text-muted ml-auto",children:[t.length," checks"]})]}),n&&e.jsx("div",{className:"px-3 pb-2 space-y-1",children:t.map((c,l)=>e.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs",children:[Pe(c.conclusion),e.jsx("span",{className:"text-ink flex-1 truncate",children:c.name}),e.jsx("span",{className:"text-[10px] text-muted capitalize",children:c.conclusion||"pending"})]},l))})]})}function qe({reviews:t}){return!t||t.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-muted border-b border-border",children:"No reviews yet."}):e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider border-b border-border",children:["Reviews (",t.length,")"]}),t.map((n,i)=>{var c;const a=ze(n.state);return e.jsxs("div",{className:"px-3 py-2 border-b border-border last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(a.Icon,{size:13,className:a.className}),e.jsx("span",{className:"text-xs font-medium text-ink",children:(c=n.author)==null?void 0:c.login}),e.jsx("span",{className:`text-[10px] ${a.className}`,children:a.label})]}),n.body&&e.jsx("p",{className:"mt-1 text-xs text-muted leading-relaxed pl-5",children:n.body})]},i)})]})}function Ae({file:t,isSelected:n,onClick:i}){return e.jsxs("button",{onClick:i,className:`w-full text-left flex items-center gap-2 px-3 py-1.5 text-xs transition-colors ${n?"bg-primary/10 text-primary":"hover:bg-hover text-ink"}`,children:[e.jsx(je,{size:12,className:n?"text-primary":"text-muted"}),e.jsx("span",{className:"font-mono truncate flex-1",children:t.path}),e.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsxs("span",{className:"text-green-500 text-[10px]",children:["+",t.additions]}),e.jsxs("span",{className:"text-red-400 text-[10px]",children:["-",t.deletions]})]})]})}function Fe({diffFiles:t,selectedFile:n}){const i=t.find(a=>a.path===n);return i?e.jsx("div",{className:"overflow-x-auto terminal-scroll",children:i.hunks.map((a,c)=>e.jsx("div",{className:"mb-2",children:a.lines.map((l,x)=>{if(l.type==="header")return e.jsx("div",{className:"px-3 py-1 bg-primary/5 text-primary text-[11px] font-mono border-y border-border",children:l.content},x);const g=l.type==="add"?"bg-green-500/8 text-ink":l.type==="delete"?"bg-red-400/8 text-ink":"text-ink";return e.jsxs("div",{className:`flex text-[11px] font-mono leading-5 ${g}`,children:[e.jsx("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-muted/50 select-none border-r border-border",children:l.oldLine??""}),e.jsx("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-muted/50 select-none border-r border-border",children:l.newLine??""}),e.jsx("span",{className:`w-4 flex-shrink-0 text-center select-none ${l.type==="add"?"text-green-500":l.type==="delete"?"text-red-400":"text-transparent"}`,children:l.type==="add"?"+":l.type==="delete"?"-":" "}),e.jsx("span",{className:"flex-1 px-2 whitespace-pre",children:l.content})]},x)})},c))}):e.jsx("div",{className:"flex items-center justify-center py-8 text-xs text-muted",children:"Select a file to view its diff."})}function Ge({onSubmit:t,loading:n,action:i}){const[a,c]=o.useState(""),l=()=>{t(a),c("")};return e.jsxs("div",{className:"p-3 space-y-2 border-t border-border bg-hover",children:[e.jsxs("p",{className:"text-[11px] font-semibold text-ink capitalize",children:[i.replace("_"," ")," Review"]}),e.jsx("textarea",{value:a,onChange:x=>c(x.target.value),placeholder:"Review comment (optional for approve, required for request changes)...",rows:3,className:"w-full px-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary transition-colors resize-none font-mono"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-[10px] text-muted",children:[a.length," characters"]}),e.jsx(y,{size:"sm",icon:Ne,onClick:l,disabled:n||i==="request_changes"&&!a.trim(),loading:n,children:"Submit"})]})]})}function vt({sessionId:t}){var X,J,K;const[n,i]=o.useState([]),[a,c]=o.useState("open"),[l,x]=o.useState(""),[g,w]=o.useState(!0),[v,C]=o.useState(null),[s,p]=o.useState(null),[h,k]=o.useState(!1),[m,N]=o.useState(null),[R,$]=o.useState([]),[ae,_e]=o.useState(!1),[q,M]=o.useState(null),[f,S]=o.useState(null),[ne,Q]=o.useState(!1),[E,le]=o.useState("squash"),[A,D]=o.useState(!1),[B,U]=o.useState(!1),[O,T]=o.useState(!1),[F,u]=o.useState(null),z=o.useCallback(async()=>{w(!0),C(null);try{const r=await b.getGitHubPRs(t,a==="all"?void 0:a);i(r)}catch(r){C(r instanceof Error?r.message:"Failed to load pull requests")}w(!1)},[t,a]);o.useEffect(()=>{z()},[z]);const W=o.useCallback(async r=>{k(!0),N(null),$([]),M(null),u(null),S(null),D(!1);try{const[d,j]=await Promise.all([b.getGitHubPR(t,r),b.getGitHubPRDiff(t,r)]);p(d);const _=Ee(j);$(_),_.length>0&&M(_[0].path)}catch(d){N(d instanceof Error?d.message:"Failed to load PR details")}k(!1)},[t]),ie=()=>{p(null),N(null),$([]),M(null),u(null),S(null),D(!1)},oe=async r=>{if(!(!s||!f)){Q(!0),u(null);try{await b.reviewGitHubPR(t,s.number,f,r),u({type:"success",text:`Review submitted: ${f.replace("_"," ")}`}),S(null);const d=await b.getGitHubPR(t,s.number);p(d)}catch(d){u({type:"error",text:d instanceof Error?d.message:"Review failed"})}Q(!1)}},ce=async()=>{if(s){U(!0),u(null);try{await b.mergeGitHubPR(t,s.number,E),u({type:"success",text:`PR #${s.number} merged via ${E}`}),D(!1),z();const r=await b.getGitHubPR(t,s.number);p(r)}catch(r){u({type:"error",text:r instanceof Error?r.message:"Merge failed"})}U(!1)}},de=async()=>{if(s){T(!0),u(null);try{await b.reviewGitHubPR(t,s.number,"comment","Closed via Purple Lab"),u({type:"success",text:`PR #${s.number} closed`}),z();const r=await b.getGitHubPR(t,s.number);p(r)}catch(r){u({type:"error",text:r instanceof Error?r.message:"Close failed"})}T(!1)}},G=o.useMemo(()=>{if(!l.trim())return n;const r=l.toLowerCase();return n.filter(d=>{var j;return d.title.toLowerCase().includes(r)||((j=d.author)==null?void 0:j.login.toLowerCase().includes(r))||d.headRefName.toLowerCase().includes(r)||`#${d.number}`.includes(r)})},[n,l]);return s||h||m?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-hover flex-shrink-0",children:[e.jsx("button",{onClick:ie,className:"p-1 text-muted hover:text-ink rounded transition-colors",title:"Back to list",children:e.jsx(be,{size:14})}),e.jsx(P,{size:14,className:"text-primary"}),e.jsx("span",{className:"text-xs font-semibold text-ink truncate",children:s?`#${s.number} ${s.title}`:"Loading..."})]}),h&&e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(L,{size:20,className:"text-muted animate-spin"}),e.jsx("span",{className:"text-xs text-muted",children:"Loading PR details..."})]})}),m&&!h&&e.jsx("div",{className:"flex-1 flex items-center justify-center p-6",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[e.jsx(ge,{size:32,className:"text-muted/40"}),e.jsx("p",{className:"text-sm text-muted",children:m}),e.jsx(y,{size:"sm",variant:"secondary",icon:L,onClick:()=>s&&W(s.number),children:"Retry"})]})}),s&&!h&&e.jsxs("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:[e.jsxs("div",{className:"px-3 py-2 border-b border-border space-y-1.5",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] font-medium rounded capitalize ${s.state==="open"?"bg-green-500/10 text-green-500":s.state==="merged"?"bg-purple-500/10 text-purple-500":"bg-red-400/10 text-red-400"}`,children:[e.jsx(P,{size:10}),s.state]}),e.jsx("span",{className:"text-[10px] text-muted",children:(X=s.author)==null?void 0:X.login}),e.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-mono text-primary/60",children:[e.jsx(xe,{size:10}),s.headRefName,e.jsx(me,{size:10,className:"text-muted"}),s.baseRefName]}),e.jsxs("span",{className:"text-[10px] text-muted ml-auto",children:[s.changedFiles," files, +",s.additions," -",s.deletions]})]}),s.body&&e.jsx("div",{className:"mt-2 text-xs text-ink/80 leading-relaxed whitespace-pre-wrap bg-hover p-2 rounded-btn border border-border",children:s.body})]}),F&&e.jsx("div",{className:`px-3 py-2 text-xs border-b ${F.type==="success"?"bg-green-500/5 border-green-500/20 text-green-500":"bg-red-400/5 border-red-400/20 text-red-400"}`,children:F.text}),e.jsx($e,{checks:((J=s.statusCheckRollup)==null?void 0:J.contexts)||[]}),e.jsx(qe,{reviews:s.reviews||[]}),e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider border-b border-border flex items-center gap-1",children:[e.jsx(ve,{size:11}),"Changed Files (",R.length||((K=s.files)==null?void 0:K.length)||0,")"]}),(R.length>0?R:s.files||[]).map((r,d)=>e.jsx(Ae,{file:r,isSelected:q===r.path,onClick:()=>M(r.path)},d)),ae&&e.jsxs("div",{className:"px-3 py-4 text-center",children:[e.jsx(V,{size:14,className:"text-muted animate-spin mx-auto"}),e.jsx("span",{className:"text-xs text-muted",children:"Loading diff..."})]}),R.length>0&&q&&e.jsx("div",{className:"border-t border-border",children:e.jsx(Fe,{diffFiles:R,selectedFile:q})})]}),s.state==="open"&&e.jsxs("div",{className:"p-3 space-y-2 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(y,{size:"sm",variant:"secondary",icon:Z,onClick:()=>S(f==="approve"?null:"approve"),className:f==="approve"?"ring-1 ring-green-500":"",children:"Approve"}),e.jsx(y,{size:"sm",variant:"danger",icon:se,onClick:()=>S(f==="request_changes"?null:"request_changes"),className:f==="request_changes"?"ring-1 ring-red-400":"",children:"Request Changes"}),e.jsx(y,{size:"sm",icon:Y,onClick:()=>D(!A),className:A?"ring-1 ring-primary":"",children:"Merge"}),e.jsx(y,{size:"sm",variant:"ghost",icon:ee,onClick:de,loading:O,disabled:O,children:"Close"})]}),f&&e.jsx(Ge,{onSubmit:oe,loading:ne,action:f}),A&&e.jsxs("div",{className:"p-3 border border-border rounded-btn bg-hover space-y-2",children:[e.jsx("p",{className:"text-[11px] font-semibold text-ink",children:"Merge Method"}),e.jsx("div",{className:"flex items-center gap-2",children:["merge","squash","rebase"].map(r=>e.jsx("button",{onClick:()=>le(r),className:`px-2.5 py-1 text-[11px] font-medium rounded-btn border transition-colors capitalize ${E===r?"border-primary bg-primary/10 text-primary":"border-border text-muted hover:text-ink"}`,children:r},r))}),e.jsxs(y,{size:"sm",icon:Y,onClick:ce,loading:B,disabled:B,children:["Confirm Merge (",E,")"]})]})]}),s.commits&&s.commits.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider border-b border-border",children:["Commits (",s.commits.length,")"]}),s.commits.map((r,d)=>{var j;return e.jsx("div",{className:"px-3 py-2 border-b border-border hover:bg-hover transition-colors",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-primary/40 mt-1.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-xs text-ink truncate",children:r.message}),e.jsx("span",{className:"text-[10px] font-mono text-muted",children:(j=r.sha)==null?void 0:j.slice(0,7)})]})]})},d)})]})]})]}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-hover flex-shrink-0",children:[e.jsx(P,{size:14,className:"text-primary"}),e.jsx("span",{className:"text-xs font-semibold text-ink",children:"Pull Requests"}),e.jsx("span",{className:"text-[10px] text-muted font-mono",children:G.length}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:z,className:"p-1 text-muted hover:text-ink rounded transition-colors",title:"Refresh",children:e.jsx(L,{size:13,className:g?"animate-spin":""})})]}),e.jsx("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border flex-shrink-0",children:[{id:"open",label:"Open"},{id:"closed",label:"Closed"},{id:"merged",label:"Merged"},{id:"all",label:"All"}].map(r=>e.jsx("button",{onClick:()=>c(r.id),className:`px-2.5 py-1 text-[11px] font-medium rounded-btn transition-colors ${a===r.id?"bg-primary/10 text-primary":"text-muted hover:text-ink"}`,children:r.label},r.id))}),e.jsx("div",{className:"px-2 py-1.5 border-b border-border flex-shrink-0",children:e.jsxs("div",{className:"relative",children:[e.jsx(pe,{size:12,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted"}),e.jsx("input",{value:l,onChange:r=>x(r.target.value),placeholder:"Search PRs...",className:"w-full pl-7 pr-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary transition-colors"})]})}),v&&e.jsx("div",{className:"px-3 py-2 bg-red-500/5 border-b border-red-500/20 text-xs text-red-400",children:v}),e.jsxs("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:[g&&n.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(L,{size:20,className:"text-muted animate-spin"}),e.jsx("span",{className:"text-xs text-muted mt-2",children:"Loading pull requests..."})]}),!g&&G.length===0&&!v&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(P,{size:28,className:"text-muted/30 mb-2"}),e.jsx("p",{className:"text-xs text-muted",children:l?"No PRs match your search.":`No ${a==="all"?"":a+" "}pull requests.`}),!l&&a!=="all"&&e.jsx("button",{onClick:()=>c("all"),className:"text-[11px] text-primary hover:text-primary/80 mt-1",children:"Show all PRs"})]}),G.map(r=>e.jsx(Le,{pr:r,onClick:()=>W(r.number)},r.number))]})]})}export{vt as GitHubPRsPanel};
|
|
17
|
+
`),x=(a=l[0])==null?void 0:a.match(/a\/(.+?) b\/(.+)/),g=x?x[2]:"unknown";let w=0,v=0;const C=[];let s=null,u=0,h=0;for(let k=1;k<l.length;k++){const m=l[k],N=m.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@(.*)/);if(N){s={header:m,lines:[]},C.push(s),u=parseInt(N[1],10),h=parseInt(N[2],10),s.lines.push({type:"header",content:m});continue}s&&(m.startsWith("+")?(w++,s.lines.push({type:"add",content:m.slice(1),newLine:h}),h++):m.startsWith("-")?(v++,s.lines.push({type:"delete",content:m.slice(1),oldLine:u}),u++):m.startsWith(" ")&&(s.lines.push({type:"context",content:m.slice(1),oldLine:u,newLine:h}),u++,h++))}n.push({path:g,additions:w,deletions:v,hunks:C})}return n}function De({pr:t}){var c;const n=((c=t.statusCheckRollup)==null?void 0:c.contexts)||[];if(!n||n.length===0)return e.jsx("span",{title:"No status checks",children:e.jsx(H,{size:13,className:"text-muted"})});const i=n.every(l=>l.conclusion==="success"),a=n.some(l=>l.conclusion==="failure"||l.conclusion==="error");return i?e.jsx("span",{title:"All checks passing",children:e.jsx(re,{size:13,className:"text-green-500"})}):a?e.jsx("span",{title:"Some checks failing",children:e.jsx(te,{size:13,className:"text-red-400"})}):e.jsx("span",{title:"Checks in progress",children:e.jsx(V,{size:13,className:"text-yellow-500 animate-spin"})})}function Le({pr:t,onClick:n}){var a;const i=Se(t.reviewDecision||"PENDING");return e.jsx("button",{onClick:n,className:"w-full text-left px-3 py-2.5 border-b border-border hover:bg-hover transition-colors",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(P,{size:14,className:`mt-0.5 flex-shrink-0 ${t.state==="open"?"text-green-500":t.state==="merged"?"text-purple-500":"text-red-400"}`}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-ink truncate",children:t.title}),e.jsxs("span",{className:"text-[10px] font-mono text-muted flex-shrink-0",children:["#",t.number]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[e.jsx("span",{className:"text-[10px] text-muted",children:(a=t.author)==null?void 0:a.login}),e.jsx("span",{className:"text-[10px] font-mono text-primary/60 truncate max-w-[120px]",title:t.headRefName,children:t.headRefName}),e.jsx("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:e.jsx(De,{pr:t})}),e.jsx("span",{className:`inline-flex items-center px-1.5 py-0 text-[9px] font-medium rounded border ${i.className}`,children:i.label}),e.jsxs("span",{className:"text-[10px] text-muted ml-auto flex-shrink-0 flex items-center gap-1",children:[e.jsxs("span",{className:"text-green-500",children:["+",t.additions]}),e.jsxs("span",{className:"text-red-400",children:["-",t.deletions]})]}),e.jsx("span",{className:"text-[10px] text-muted flex-shrink-0",children:Re(t.createdAt)})]})]})]})})}function $e({checks:t}){const[n,i]=o.useState(!1),a=Me(t);return!t||t.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-muted",children:"No status checks configured."}):e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("button",{onClick:()=>i(!n),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-hover transition-colors",children:[n?e.jsx(pe,{size:12}):e.jsx(he,{size:12}),e.jsx("span",{className:"text-xs font-semibold text-ink",children:"Status Checks"}),e.jsx("span",{className:`text-[10px] font-medium ${a.className}`,children:a.label}),e.jsxs("span",{className:"text-[10px] text-muted ml-auto",children:[t.length," checks"]})]}),n&&e.jsx("div",{className:"px-3 pb-2 space-y-1",children:t.map((c,l)=>e.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs",children:[Pe(c.conclusion),e.jsx("span",{className:"text-ink flex-1 truncate",children:c.name}),e.jsx("span",{className:"text-[10px] text-muted capitalize",children:c.conclusion||"pending"})]},l))})]})}function qe({reviews:t}){return!t||t.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-muted border-b border-border",children:"No reviews yet."}):e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider border-b border-border",children:["Reviews (",t.length,")"]}),t.map((n,i)=>{var c;const a=ze(n.state);return e.jsxs("div",{className:"px-3 py-2 border-b border-border last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(a.Icon,{size:13,className:a.className}),e.jsx("span",{className:"text-xs font-medium text-ink",children:(c=n.author)==null?void 0:c.login}),e.jsx("span",{className:`text-[10px] ${a.className}`,children:a.label})]}),n.body&&e.jsx("p",{className:"mt-1 text-xs text-muted leading-relaxed pl-5",children:n.body})]},i)})]})}function Ae({file:t,isSelected:n,onClick:i}){return e.jsxs("button",{onClick:i,className:`w-full text-left flex items-center gap-2 px-3 py-1.5 text-xs transition-colors ${n?"bg-primary/10 text-primary":"hover:bg-hover text-ink"}`,children:[e.jsx(je,{size:12,className:n?"text-primary":"text-muted"}),e.jsx("span",{className:"font-mono truncate flex-1",children:t.path}),e.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsxs("span",{className:"text-green-500 text-[10px]",children:["+",t.additions]}),e.jsxs("span",{className:"text-red-400 text-[10px]",children:["-",t.deletions]})]})]})}function Fe({diffFiles:t,selectedFile:n}){const i=t.find(a=>a.path===n);return i?e.jsx("div",{className:"overflow-x-auto terminal-scroll",children:i.hunks.map((a,c)=>e.jsx("div",{className:"mb-2",children:a.lines.map((l,x)=>{if(l.type==="header")return e.jsx("div",{className:"px-3 py-1 bg-primary/5 text-primary text-[11px] font-mono border-y border-border",children:l.content},x);const g=l.type==="add"?"bg-green-500/8 text-ink":l.type==="delete"?"bg-red-400/8 text-ink":"text-ink";return e.jsxs("div",{className:`flex text-[11px] font-mono leading-5 ${g}`,children:[e.jsx("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-muted/50 select-none border-r border-border",children:l.oldLine??""}),e.jsx("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-muted/50 select-none border-r border-border",children:l.newLine??""}),e.jsx("span",{className:`w-4 flex-shrink-0 text-center select-none ${l.type==="add"?"text-green-500":l.type==="delete"?"text-red-400":"text-transparent"}`,children:l.type==="add"?"+":l.type==="delete"?"-":" "}),e.jsx("span",{className:"flex-1 px-2 whitespace-pre",children:l.content})]},x)})},c))}):e.jsx("div",{className:"flex items-center justify-center py-8 text-xs text-muted",children:"Select a file to view its diff."})}function Ge({onSubmit:t,loading:n,action:i}){const[a,c]=o.useState(""),l=()=>{t(a),c("")};return e.jsxs("div",{className:"p-3 space-y-2 border-t border-border bg-hover",children:[e.jsxs("p",{className:"text-[11px] font-semibold text-ink capitalize",children:[i.replace("_"," ")," Review"]}),e.jsx("textarea",{value:a,onChange:x=>c(x.target.value),placeholder:"Review comment (optional for approve, required for request changes)...",rows:3,className:"w-full px-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary transition-colors resize-none font-mono"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-[10px] text-muted",children:[a.length," characters"]}),e.jsx(y,{size:"sm",icon:Ne,onClick:l,disabled:n||i==="request_changes"&&!a.trim(),loading:n,children:"Submit"})]})]})}function jt({sessionId:t}){var X,J,K;const[n,i]=o.useState([]),[a,c]=o.useState("open"),[l,x]=o.useState(""),[g,w]=o.useState(!0),[v,C]=o.useState(null),[s,u]=o.useState(null),[h,k]=o.useState(!1),[m,N]=o.useState(null),[R,$]=o.useState([]),[ae,_e]=o.useState(!1),[q,M]=o.useState(null),[f,S]=o.useState(null),[ne,Q]=o.useState(!1),[E,le]=o.useState("squash"),[A,D]=o.useState(!1),[B,U]=o.useState(!1),[O,T]=o.useState(!1),[F,p]=o.useState(null),z=o.useCallback(async()=>{w(!0),C(null);try{const r=await b.getGitHubPRs(t,a==="all"?void 0:a);i(r)}catch(r){C(r instanceof Error?r.message:"Failed to load pull requests")}w(!1)},[t,a]);o.useEffect(()=>{z()},[z]);const W=o.useCallback(async r=>{k(!0),N(null),$([]),M(null),p(null),S(null),D(!1);try{const[d,j]=await Promise.all([b.getGitHubPR(t,r),b.getGitHubPRDiff(t,r)]);u(d);const _=Ee(j);$(_),_.length>0&&M(_[0].path)}catch(d){N(d instanceof Error?d.message:"Failed to load PR details")}k(!1)},[t]),ie=()=>{u(null),N(null),$([]),M(null),p(null),S(null),D(!1)},oe=async r=>{if(!(!s||!f)){Q(!0),p(null);try{await b.reviewGitHubPR(t,s.number,f,r),p({type:"success",text:`Review submitted: ${f.replace("_"," ")}`}),S(null);const d=await b.getGitHubPR(t,s.number);u(d)}catch(d){p({type:"error",text:d instanceof Error?d.message:"Review failed"})}Q(!1)}},ce=async()=>{if(s){U(!0),p(null);try{await b.mergeGitHubPR(t,s.number,E),p({type:"success",text:`PR #${s.number} merged via ${E}`}),D(!1),z();const r=await b.getGitHubPR(t,s.number);u(r)}catch(r){p({type:"error",text:r instanceof Error?r.message:"Merge failed"})}U(!1)}},de=async()=>{if(s){T(!0),p(null);try{await b.reviewGitHubPR(t,s.number,"comment","Closed via Purple Lab"),p({type:"success",text:`PR #${s.number} closed`}),z();const r=await b.getGitHubPR(t,s.number);u(r)}catch(r){p({type:"error",text:r instanceof Error?r.message:"Close failed"})}T(!1)}},G=o.useMemo(()=>{if(!l.trim())return n;const r=l.toLowerCase();return n.filter(d=>{var j;return d.title.toLowerCase().includes(r)||((j=d.author)==null?void 0:j.login.toLowerCase().includes(r))||d.headRefName.toLowerCase().includes(r)||`#${d.number}`.includes(r)})},[n,l]);return s||h||m?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-hover flex-shrink-0",children:[e.jsx("button",{onClick:ie,className:"p-1 text-muted hover:text-ink rounded transition-colors",title:"Back to list",children:e.jsx(be,{size:14})}),e.jsx(P,{size:14,className:"text-primary"}),e.jsx("span",{className:"text-xs font-semibold text-ink truncate",children:s?`#${s.number} ${s.title}`:"Loading..."})]}),h&&e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(L,{size:20,className:"text-muted animate-spin"}),e.jsx("span",{className:"text-xs text-muted",children:"Loading PR details..."})]})}),m&&!h&&e.jsx("div",{className:"flex-1 flex items-center justify-center p-6",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[e.jsx(ge,{size:32,className:"text-muted/40"}),e.jsx("p",{className:"text-sm text-muted",children:m}),e.jsx(y,{size:"sm",variant:"secondary",icon:L,onClick:()=>s&&W(s.number),children:"Retry"})]})}),s&&!h&&e.jsxs("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:[e.jsxs("div",{className:"px-3 py-2 border-b border-border space-y-1.5",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] font-medium rounded capitalize ${s.state==="open"?"bg-green-500/10 text-green-500":s.state==="merged"?"bg-purple-500/10 text-purple-500":"bg-red-400/10 text-red-400"}`,children:[e.jsx(P,{size:10}),s.state]}),e.jsx("span",{className:"text-[10px] text-muted",children:(X=s.author)==null?void 0:X.login}),e.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-mono text-primary/60",children:[e.jsx(xe,{size:10}),s.headRefName,e.jsx(me,{size:10,className:"text-muted"}),s.baseRefName]}),e.jsxs("span",{className:"text-[10px] text-muted ml-auto",children:[s.changedFiles," files, +",s.additions," -",s.deletions]})]}),s.body&&e.jsx("div",{className:"mt-2 text-xs text-ink/80 leading-relaxed whitespace-pre-wrap bg-hover p-2 rounded-btn border border-border",children:s.body})]}),F&&e.jsx("div",{className:`px-3 py-2 text-xs border-b ${F.type==="success"?"bg-green-500/5 border-green-500/20 text-green-500":"bg-red-400/5 border-red-400/20 text-red-400"}`,children:F.text}),e.jsx($e,{checks:((J=s.statusCheckRollup)==null?void 0:J.contexts)||[]}),e.jsx(qe,{reviews:s.reviews||[]}),e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider border-b border-border flex items-center gap-1",children:[e.jsx(ve,{size:11}),"Changed Files (",R.length||((K=s.files)==null?void 0:K.length)||0,")"]}),(R.length>0?R:s.files||[]).map((r,d)=>e.jsx(Ae,{file:r,isSelected:q===r.path,onClick:()=>M(r.path)},d)),ae&&e.jsxs("div",{className:"px-3 py-4 text-center",children:[e.jsx(V,{size:14,className:"text-muted animate-spin mx-auto"}),e.jsx("span",{className:"text-xs text-muted",children:"Loading diff..."})]}),R.length>0&&q&&e.jsx("div",{className:"border-t border-border",children:e.jsx(Fe,{diffFiles:R,selectedFile:q})})]}),s.state==="open"&&e.jsxs("div",{className:"p-3 space-y-2 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(y,{size:"sm",variant:"secondary",icon:Z,onClick:()=>S(f==="approve"?null:"approve"),className:f==="approve"?"ring-1 ring-green-500":"",children:"Approve"}),e.jsx(y,{size:"sm",variant:"danger",icon:se,onClick:()=>S(f==="request_changes"?null:"request_changes"),className:f==="request_changes"?"ring-1 ring-red-400":"",children:"Request Changes"}),e.jsx(y,{size:"sm",icon:Y,onClick:()=>D(!A),className:A?"ring-1 ring-primary":"",children:"Merge"}),e.jsx(y,{size:"sm",variant:"ghost",icon:ee,onClick:de,loading:O,disabled:O,children:"Close"})]}),f&&e.jsx(Ge,{onSubmit:oe,loading:ne,action:f}),A&&e.jsxs("div",{className:"p-3 border border-border rounded-btn bg-hover space-y-2",children:[e.jsx("p",{className:"text-[11px] font-semibold text-ink",children:"Merge Method"}),e.jsx("div",{className:"flex items-center gap-2",children:["merge","squash","rebase"].map(r=>e.jsx("button",{onClick:()=>le(r),className:`px-2.5 py-1 text-[11px] font-medium rounded-btn border transition-colors capitalize ${E===r?"border-primary bg-primary/10 text-primary":"border-border text-muted hover:text-ink"}`,children:r},r))}),e.jsxs(y,{size:"sm",icon:Y,onClick:ce,loading:B,disabled:B,children:["Confirm Merge (",E,")"]})]})]}),s.commits&&s.commits.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-muted uppercase tracking-wider border-b border-border",children:["Commits (",s.commits.length,")"]}),s.commits.map((r,d)=>{var j;return e.jsx("div",{className:"px-3 py-2 border-b border-border hover:bg-hover transition-colors",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-primary/40 mt-1.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-xs text-ink truncate",children:r.message}),e.jsx("span",{className:"text-[10px] font-mono text-muted",children:(j=r.sha)==null?void 0:j.slice(0,7)})]})]})},d)})]})]})]}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-hover flex-shrink-0",children:[e.jsx(P,{size:14,className:"text-primary"}),e.jsx("span",{className:"text-xs font-semibold text-ink",children:"Pull Requests"}),e.jsx("span",{className:"text-[10px] text-muted font-mono",children:G.length}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:z,className:"p-1 text-muted hover:text-ink rounded transition-colors",title:"Refresh",children:e.jsx(L,{size:13,className:g?"animate-spin":""})})]}),e.jsx("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border flex-shrink-0",children:[{id:"open",label:"Open"},{id:"closed",label:"Closed"},{id:"merged",label:"Merged"},{id:"all",label:"All"}].map(r=>e.jsx("button",{onClick:()=>c(r.id),className:`px-2.5 py-1 text-[11px] font-medium rounded-btn transition-colors ${a===r.id?"bg-primary/10 text-primary":"text-muted hover:text-ink"}`,children:r.label},r.id))}),e.jsx("div",{className:"px-2 py-1.5 border-b border-border flex-shrink-0",children:e.jsxs("div",{className:"relative",children:[e.jsx(ue,{size:12,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted"}),e.jsx("input",{value:l,onChange:r=>x(r.target.value),placeholder:"Search PRs...",className:"w-full pl-7 pr-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary transition-colors"})]})}),v&&e.jsx("div",{className:"px-3 py-2 bg-red-500/5 border-b border-red-500/20 text-xs text-red-400",children:v}),e.jsxs("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:[g&&n.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(L,{size:20,className:"text-muted animate-spin"}),e.jsx("span",{className:"text-xs text-muted mt-2",children:"Loading pull requests..."})]}),!g&&G.length===0&&!v&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(P,{size:28,className:"text-muted/30 mb-2"}),e.jsx("p",{className:"text-xs text-muted",children:l?"No PRs match your search.":`No ${a==="all"?"":a+" "}pull requests.`}),!l&&a!=="all"&&e.jsx("button",{onClick:()=>c("all"),className:"text-[11px] text-primary hover:text-primary/80 mt-1",children:"Show all PRs"})]}),G.map(r=>e.jsx(Le,{pr:r,onClick:()=>W(r.number)},r.number))]})]})}export{jt as GitHubPRsPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as he,j as e,P as We,r as n,a as j,C as Ue,M as fe,R as re,u as ae,b as Ve,A as Qe,S as Ye,d as Ke,U as Ze,e as Je}from"./index-
|
|
1
|
+
import{c as he,j as e,P as We,r as n,a as j,C as Ue,M as fe,R as re,u as ae,b as Ve,A as Qe,S as Ye,d as Ke,U as Ze,e as Je}from"./index-Cu-njJ8o.js";import{u as R}from"./usePolling-C5f4xrXD.js";import{P as Xe,S as et,E as C}from"./ErrorBoundary-wE3oxaG6.js";import{F as tt,T as st}from"./TerminalOutput-CJy13rAn.js";import{E as rt}from"./EvidenceReceiptPanel-B_Wouz6N.js";import{B as at}from"./Badge-D8WddQk1.js";import{P as nt}from"./package-C5LDn8SI.js";import{C as it}from"./cloud-IPIgE4P3.js";import{C as be}from"./code-xml-BOZbQiOt.js";import{H as lt}from"./hammer-DCa0I_7V.js";import{C as ot}from"./chevron-left-ClvdXm3Y.js";import{L as ct}from"./layers-DxIhn7NZ.js";import{C as dt}from"./check-Drzd8-9c.js";import{M as mt}from"./mail-CHe3KyCw.js";import{B as xt}from"./bell-JyOeobLN.js";import{F as ut}from"./file-code-corner-CNayCvOY.js";import"./lock-qRAVU53b.js";import"./clock-Bnz6tlQN.js";import"./circle-alert-CstyZfKG.js";/**
|
|
2
2
|
* @license lucide-react v0.577.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a0 as r,u as o,r as c,j as e}from"./index-
|
|
1
|
+
import{a0 as r,u as o,r as c,j as e}from"./index-Cu-njJ8o.js";function x(){const{user:l,loading:t,login:i,isLocalMode:n}=r(),s=o();return c.useEffect(()=>{!t&&(l||n)&&s("/",{replace:!0})},[l,t,n,s]),t?e.jsx("div",{className:"h-screen bg-[#FAF9F6] flex items-center justify-center text-[#6B6960] text-sm",children:"Loading..."}):e.jsx("div",{className:"h-screen bg-[#FAF9F6] flex items-center justify-center",children:e.jsxs("div",{className:"w-full max-w-sm mx-auto px-6",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"font-heading text-3xl font-bold text-[#36342E] mb-1",children:"Purple Lab"}),e.jsx("p",{className:"text-sm text-[#6B6960]",children:"Autonomous agent workspace powered by Loki"})]}),e.jsxs("div",{className:"bg-white rounded-lg border border-[#ECEAE3] shadow-sm p-6 space-y-4",children:[e.jsx("h2",{className:"text-base font-medium text-[#36342E] text-center",children:"Sign in to continue"}),e.jsxs("button",{type:"button",onClick:()=>i("github"),className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 rounded-[5px] border border-[#ECEAE3] bg-[#24292f] text-white text-sm font-medium hover:bg-[#1b1f23] transition-colors",children:[e.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})}),"Sign in with GitHub"]}),e.jsxs("button",{type:"button",onClick:()=>i("google"),className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 rounded-[5px] border border-[#ECEAE3] bg-white text-[#36342E] text-sm font-medium hover:bg-[#F8F4F0] transition-colors",children:[e.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",children:[e.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"}),e.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),e.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),e.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),"Sign in with Google"]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-[#ECEAE3]"})}),e.jsx("div",{className:"relative flex justify-center text-xs",children:e.jsx("span",{className:"bg-white px-2 text-[#939084]",children:"or"})})]}),e.jsx("button",{type:"button",onClick:()=>s("/"),className:"w-full text-center text-sm text-[#6B6960] hover:text-[#553DE9] transition-colors py-1",children:"Continue without account (local mode)"})]}),e.jsx("p",{className:"text-xs text-[#939084] text-center mt-4",children:"Local mode stores everything on your machine. Sign in for cloud sync and collaboration."})]})})}export{x as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as C,r as s,j as e,v as _,X as H,m as Q,f as I,T as K,F as Y,n as ee}from"./index-
|
|
1
|
+
import{c as C,r as s,j as e,v as _,X as H,m as Q,f as I,T as K,F as Y,n as ee}from"./index-Cu-njJ8o.js";import{U as te}from"./upload-KkeVyg67.js";import{C as se}from"./circle-alert-CstyZfKG.js";import{L as R}from"./loader-circle-DXgc_u5I.js";import{C as ae}from"./code-xml-BOZbQiOt.js";/**
|
|
2
2
|
* @license lucide-react v0.577.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as U,r as u,j as t,a as P}from"./index-Cu-njJ8o.js";import{E as K}from"./EvidenceReceiptPanel-B_Wouz6N.js";import{D as q}from"./dollar-sign-D6RFNgdZ.js";import{L as Z}from"./layers-DxIhn7NZ.js";import{T as O}from"./trending-up-CGyYgZH7.js";import{T as J}from"./trending-down-CX2fUeho.js";/**
|
|
2
|
+
* @license lucide-react v0.577.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const Q=[["path",{d:"M13.744 17.736a6 6 0 1 1-7.48-7.48",key:"bq4yh3"}],["path",{d:"M15 6h1v4",key:"11y1tn"}],["path",{d:"m6.134 14.768.866-.5 2 3.464",key:"17snzx"}],["circle",{cx:"16",cy:"8",r:"6",key:"14bfc9"}]],X=U("coins",Q),n={top:20,right:20,bottom:40,left:50};function T(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(e%1===0?0:2)}function Y({data:e,width:x=400,height:o=240,color:p="#553DE9",live:y}){const[i,N]=u.useState(null),[C,g]=u.useState(!1),d=u.useRef(null);u.useEffect(()=>{const a=setTimeout(()=>g(!0),50);return()=>clearTimeout(a)},[]),u.useEffect(()=>{const a=d.current;if(!a)return;const c=a.getTotalLength();a.style.strokeDasharray=`${c}`,a.style.strokeDashoffset=C?"0":`${c}`},[C,e]);const l=x-n.left-n.right,h=o-n.top-n.bottom,{pathD:$,gradientPath:f,points:r,minVal:s,maxVal:m}=u.useMemo(()=>{if(e.length<2)return{pathD:"",gradientPath:"",points:[],minVal:0,maxVal:0};const a=e.map(A=>A.value),c=Math.min(...a),E=Math.max(...a),b=E-c||1,B=l/(e.length-1),k=e.map((A,v)=>({x:n.left+v*B,y:n.top+h-(A.value-c)/b*h}));let w=`M ${k[0].x},${k[0].y}`;for(let A=1;A<k.length;A++){const v=k[A-1],M=k[A],G=v.x+(M.x-v.x)*.4,H=M.x-(M.x-v.x)*.4;w+=` C ${G},${v.y} ${H},${M.y} ${M.x},${M.y}`}const L=w+` L ${k[k.length-1].x},${n.top+h} L ${k[0].x},${n.top+h} Z`;return{pathD:w,gradientPath:L,points:k,minVal:c,maxVal:E}},[e,l,h]);if(e.length<2)return t.jsx("svg",{width:x,height:o,children:t.jsx("text",{x:x/2,y:o/2,textAnchor:"middle",className:"fill-[#939084] text-sm",children:"Not enough data"})});const j=`line-grad-${p.replace("#","")}`;return t.jsxs("svg",{width:x,height:o,viewBox:`0 0 ${x} ${o}`,className:"select-none",children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:j,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:p,stopOpacity:.25}),t.jsx("stop",{offset:"100%",stopColor:p,stopOpacity:.02})]})}),t.jsx("text",{x:n.left-8,y:n.top+4,textAnchor:"end",className:"fill-[#939084]",style:{fontSize:10},children:T(m)}),t.jsx("text",{x:n.left-8,y:n.top+h+4,textAnchor:"end",className:"fill-[#939084]",style:{fontSize:10},children:T(s)}),t.jsx("line",{x1:n.left,y1:n.top,x2:n.left+l,y2:n.top,stroke:"#ECEAE3",strokeWidth:.5,className:"dark:stroke-[#2A2A30]"}),t.jsx("line",{x1:n.left,y1:n.top+h,x2:n.left+l,y2:n.top+h,stroke:"#ECEAE3",strokeWidth:.5,className:"dark:stroke-[#2A2A30]"}),t.jsx("line",{x1:n.left,y1:n.top+h/2,x2:n.left+l,y2:n.top+h/2,stroke:"#ECEAE3",strokeWidth:.5,strokeDasharray:"4 4",className:"dark:stroke-[#2A2A30]"}),t.jsx("path",{d:f,fill:`url(#${j})`,style:{transition:"d 0.4s ease"}}),t.jsx("path",{ref:d,d:$,fill:"none",stroke:p,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:{transition:"stroke-dashoffset 1.2s ease-out, d 0.4s ease"}}),e.map((a,c)=>{const E=l/(e.length-1),b=n.left+c*E;return e.length<=6||c%Math.ceil(e.length/6)===0||c===e.length-1?t.jsx("text",{x:b,y:o-8,textAnchor:"middle",className:"fill-[#939084]",style:{fontSize:10},children:a.label},c):null}),r.map((a,c)=>t.jsxs("g",{children:[t.jsx("rect",{x:a.x-l/e.length/2,y:n.top,width:l/e.length,height:h,fill:"transparent",onMouseEnter:()=>N(c),onMouseLeave:()=>N(null),style:{cursor:"pointer"}}),t.jsx("circle",{cx:a.x,cy:a.y,r:i===c?5:3,fill:"white",stroke:p,strokeWidth:2,style:{opacity:i===c?1:0,transition:"opacity 0.15s, r 0.15s"}})]},c)),i!==null&&t.jsxs("g",{children:[t.jsx("line",{x1:r[i].x,y1:n.top,x2:r[i].x,y2:n.top+h,stroke:p,strokeWidth:.5,strokeDasharray:"3 3",opacity:.4}),t.jsx("rect",{x:r[i].x-30,y:r[i].y-28,width:60,height:20,rx:4,fill:"#36342E",className:"dark:fill-[#E8E6E3]"}),t.jsx("text",{x:r[i].x,y:r[i].y-14,textAnchor:"middle",fill:"white",className:"dark:fill-[#1A1A1E]",style:{fontSize:11,fontWeight:600},children:T(e[i].value)})]})]})}function R(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function ee({segments:e,size:x=200,thickness:o=32,live:p}){var f;const[y,i]=u.useState(null),[N,C]=u.useState(0);u.useEffect(()=>{const r=setTimeout(()=>C(1),50);return()=>clearTimeout(r)},[]);const g=u.useMemo(()=>e.reduce((r,s)=>r+s.value,0),[e]),d=x/2,l=(x-o)/2-4,h=u.useMemo(()=>{if(g===0)return[];let r=-90;return e.map(s=>{const m=s.value/g*360,j=r;r+=m;const a=r,c=j*Math.PI/180,E=a*Math.PI/180,b=d+l*Math.cos(c),B=d+l*Math.sin(c),k=d+l*Math.cos(E),w=d+l*Math.sin(E),L=m>180?1:0,A=`M ${b} ${B} A ${l} ${l} 0 ${L} 1 ${k} ${w}`,v=(s.value/g*100).toFixed(1);return{d:A,percentage:v,startAngle:j,endAngle:a}})},[e,g,d,l]),$=2*Math.PI*l;return t.jsxs("div",{className:"flex flex-col items-center gap-3",children:[t.jsxs("svg",{width:x,height:x,viewBox:`0 0 ${x} ${x}`,className:"select-none",children:[t.jsx("circle",{cx:d,cy:d,r:l,fill:"none",stroke:"#ECEAE3",strokeWidth:o,className:"dark:stroke-[#2A2A30]"}),h.map((r,s)=>{const m=e[s],a=m.value/g*360/360*$,c=$-a*N;let E=-90;for(let b=0;b<s;b++)E+=e[b].value/g*360;return t.jsx("circle",{cx:d,cy:d,r:l,fill:"none",stroke:m.color,strokeWidth:y===s?o+6:o,strokeDasharray:`${a} ${$-a}`,strokeDashoffset:c,strokeLinecap:"butt",transform:`rotate(${E} ${d} ${d})`,style:{transition:"stroke-dashoffset 0.8s ease-out, stroke-width 0.15s ease",cursor:"pointer",opacity:y!==null&&y!==s?.5:1},onMouseEnter:()=>i(s),onMouseLeave:()=>i(null)},s)}),t.jsx("text",{x:d,y:d-6,textAnchor:"middle",className:"fill-[#36342E] dark:fill-[#E8E6E3]",style:{fontSize:22,fontWeight:700},children:R(g)}),t.jsx("text",{x:d,y:d+14,textAnchor:"middle",className:"fill-[#939084]",style:{fontSize:11},children:y!==null?`${e[y].label} (${(f=h[y])==null?void 0:f.percentage}%)`:"Total"})]}),t.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1 justify-center",children:e.map((r,s)=>t.jsxs("div",{className:"flex items-center gap-1.5 text-xs cursor-pointer",onMouseEnter:()=>i(s),onMouseLeave:()=>i(null),style:{opacity:y!==null&&y!==s?.5:1},children:[t.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:r.color}}),t.jsx("span",{className:"text-[#6B6960] dark:text-[#8A8880]",children:r.label}),t.jsx("span",{className:"text-[#36342E] dark:text-[#C5C0B8] font-medium",children:R(r.value)})]},s))})]})}const D="#553DE9",F="#1FC5A8",W="#6B8AFD",I="#D4A843";function S(e){return e==null?"Not recorded":`$${e.toFixed(2)}`}function te(e){return e==null?"Not recorded":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}const se={[D]:"text-[#553DE9]",[F]:"text-[#1FC5A8]",[W]:"text-[#6B8AFD]",[I]:"text-[#D4A843]"};function _({label:e,value:x,detail:o,trend:p,icon:y,color:i}){const N=p!=null&&p<0?J:O;return t.jsxs("div",{className:"rounded-card border border-[#ECEAE3] dark:border-[#2A2A2E] bg-white dark:bg-[#18181B] p-4",children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("span",{className:"text-xs font-medium text-[#6B6960] dark:text-[#A8A69E]",children:e}),t.jsx(y,{className:se[i]??"",size:16})]}),t.jsx("div",{className:"text-xl font-semibold text-[#36342E] dark:text-[#E8E6E3] tabular-nums",children:x}),o&&t.jsx("div",{className:"mt-1 text-xs text-[#6B6960] dark:text-[#A8A69E]",children:o}),p!=null&&t.jsxs("div",{className:"mt-1 flex items-center gap-1 text-xs text-[#6B6960] dark:text-[#A8A69E]",children:[t.jsx(N,{size:12}),t.jsxs("span",{className:"tabular-nums",children:[Math.abs(p).toFixed(1),"%"]})]})]})}function V({title:e,subtitle:x,children:o}){return t.jsxs("div",{className:"rounded-card border border-[#ECEAE3] dark:border-[#2A2A2E] bg-white dark:bg-[#18181B] p-4",children:[t.jsx("h3",{className:"text-sm font-semibold text-[#36342E] dark:text-[#E8E6E3] mb-1",children:e}),x&&t.jsx("p",{className:"text-xs text-[#6B6960] dark:text-[#A8A69E] mb-3",children:x}),o]})}function z({what:e}){return t.jsx("div",{className:"flex h-[200px] items-center justify-center text-center",children:t.jsxs("p",{className:"max-w-[26ch] text-xs text-[#6B6960] dark:text-[#A8A69E]",children:["No ",e," recorded yet. This fills in once a build writes cost data."]})})}function ie(){const[e,x]=u.useState(null),[o,p]=u.useState(null),[y,i]=u.useState(null),[N,C]=u.useState(!0),[g,d]=u.useState(560);u.useEffect(()=>{let r=!1;return(async()=>{try{const[s,m]=await Promise.all([P.getCost(),P.getCostTimeline()]);if(r)return;x(s),p(m),i(null)}catch(s){if(r)return;i(s instanceof Error?s.message:"Could not load cost data")}finally{r||C(!1)}})(),()=>{r=!0}},[]);const l=Math.max(280,g-48),h=u.useMemo(()=>((o==null?void 0:o.runs)??[]).filter(s=>typeof s.cost_usd=="number").map((s,m)=>({label:s.run_id?s.run_id.slice(-6):`run ${m+1}`,value:s.cost_usd})),[o]),$=u.useMemo(()=>e?[["Input",e.total_input_tokens,D],["Output",e.total_output_tokens,F],["Cache read",e.total_cache_read_tokens,W],["Cache write",e.total_cache_creation_tokens,I]].filter(([,s])=>typeof s=="number"&&s>0).map(([s,m,j])=>({label:s,value:m,color:j})):[],[e]),f=o==null?void 0:o.budget;return N?t.jsx("div",{className:"p-6",children:t.jsx("p",{className:"text-sm text-[#6B6960] dark:text-[#A8A69E]",children:"Loading cost data..."})}):t.jsxs("div",{className:"p-6",children:[t.jsx("h1",{className:"text-lg font-semibold text-[#36342E] dark:text-[#E8E6E3] mb-1",children:"Metrics"}),t.jsx("p",{className:"text-xs text-[#6B6960] dark:text-[#A8A69E] mb-6",children:'Measured cost and token usage. Values read "Not recorded" when no build has written them.'}),y&&t.jsx("div",{className:"mb-6 rounded-card border border-[#C45B5B]/30 bg-[#C45B5B]/5 p-4",children:t.jsx("p",{className:"text-xs text-[#C45B5B]",children:y})}),t.jsx("div",{className:"mb-6 rounded-card border border-[#ECEAE3] dark:border-[#2A2A2E] bg-white dark:bg-[#18181B] p-4",children:t.jsx(K,{})}),t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[t.jsx(_,{label:"Total cost",value:S(e==null?void 0:e.estimated_cost_usd),detail:(e==null?void 0:e.cost_recorded)===!1?"No cost recorded yet":void 0,icon:q,color:I}),t.jsx(_,{label:"Total tokens",value:te(e==null?void 0:e.total_tokens),icon:X,color:D}),t.jsx(_,{label:"Runs with cost",value:String((o==null?void 0:o.runs_count)??0),detail:"Runs that wrote a receipt",icon:Z,color:W}),t.jsx(_,{label:"Budget used",value:(f==null?void 0:f.percent_used)==null?"No budget set":`${f.percent_used.toFixed(0)}%`,detail:(f==null?void 0:f.limit)==null?void 0:`${S(f.used)} of ${S(f.limit)}`,icon:O,color:f!=null&&f.exceeded?"#C45B5B":F})]}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 mb-6",ref:r=>{r&&new ResizeObserver(m=>{const j=m[0];if(j){const a=window.innerWidth>=1024?2:1;d(Math.floor(j.contentRect.width/a))}}).observe(r)},children:[t.jsx(V,{title:"Cost per run",subtitle:"From each run's Evidence Receipt",children:h.length>0?t.jsx(Y,{data:h,width:l,height:220,color:D}):t.jsx(z,{what:"per-run cost"})}),t.jsx(V,{title:"Token usage",subtitle:"Input, output and cache totals",children:$.length>0?t.jsx(ee,{segments:$,size:190,thickness:28}):t.jsx(z,{what:"token usage"})})]})]})}export{ie as MetricsPage,ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,J as t,a3 as s,a4 as o}from"./index-
|
|
1
|
+
import{j as e,J as t,a3 as s,a4 as o}from"./index-Cu-njJ8o.js";function r(){return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[60vh] p-8 text-center",children:[e.jsx("div",{className:"text-6xl font-heading font-bold text-primary/20 mb-4",children:"404"}),e.jsx("h1",{className:"text-h3 font-heading font-bold text-ink mb-2",children:"Page not found"}),e.jsx("p",{className:"text-sm text-muted-accessible mb-6 max-w-xs",children:"The page you are looking for does not exist or has been moved."}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:()=>window.history.back(),className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-btn border border-border text-secondary hover:bg-hover transition-colors",children:[e.jsx(t,{size:14}),"Go Back"]}),e.jsxs(s,{to:"/",className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-btn bg-primary text-white hover:bg-[#4432c4] transition-colors shadow-button",children:[e.jsx(o,{size:14}),"Home"]})]})]})}export{r as default};
|