loki-mode 6.57.0 → 6.57.1
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/SKILL.md +2 -2
- package/VERSION +1 -1
- package/dashboard/__init__.py +1 -1
- package/docs/INSTALLATION.md +1 -1
- package/mcp/__init__.py +1 -1
- package/package.json +1 -1
- package/web-app/dist/assets/{Badge-B67j7joS.js → Badge-wQU9blAB.js} +1 -1
- package/web-app/dist/assets/{Button-DMrzb-kA.js → Button-DV8ro4oS.js} +1 -1
- package/web-app/dist/assets/{Card-Ciw4QWLx.js → Card-B4GJw1Yl.js} +1 -1
- package/web-app/dist/assets/{HomePage-YNmSv1D1.js → HomePage-BrwjWs5_.js} +3 -3
- package/web-app/dist/assets/{LoginPage-DxTWjVbY.js → LoginPage-KBUVD4pE.js} +1 -1
- package/web-app/dist/assets/{NotFoundPage-BCVkrGqA.js → NotFoundPage-CDzHJO08.js} +1 -1
- package/web-app/dist/assets/{ProjectPage-BnDAAUIO.js → ProjectPage-CNuYm1A5.js} +1 -1
- package/web-app/dist/assets/{ProjectsPage-CU3RDQw8.js → ProjectsPage-uJimVYlj.js} +1 -1
- package/web-app/dist/assets/{SettingsPage-BlEJ08Gv.js → SettingsPage-BiSUXmC2.js} +1 -1
- package/web-app/dist/assets/{TemplatesPage-u9bIAvZ4.js → TemplatesPage-_MJc-qGU.js} +1 -1
- package/web-app/dist/assets/{TerminalOutput-B455njN4.js → TerminalOutput-B5rIKYNW.js} +1 -1
- package/web-app/dist/assets/{arrow-left-CrvV7OEl.js → arrow-left-BaOs4kgD.js} +1 -1
- package/web-app/dist/assets/{clock-arMDDQOh.js → clock-Csnz1n2_.js} +1 -1
- package/web-app/dist/assets/{external-link-BBVnfWUJ.js → external-link-i7ZDkWbe.js} +1 -1
- package/web-app/dist/assets/{index-iESYbzQ8.js → index-1UyN_URb.js} +2 -2
- package/web-app/dist/index.html +1 -1
package/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: loki-mode
|
|
|
3
3
|
description: Multi-agent autonomous startup system. Triggers on "Loki Mode". Takes PRD to deployed product with minimal human intervention. Requires --dangerously-skip-permissions flag.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Loki Mode v6.57.
|
|
6
|
+
# Loki Mode v6.57.1
|
|
7
7
|
|
|
8
8
|
**You are an autonomous agent. You make decisions. You do not ask questions. You do not stop.**
|
|
9
9
|
|
|
@@ -267,4 +267,4 @@ The following features are documented in skill modules but not yet fully automat
|
|
|
267
267
|
| Quality gates 3-reviewer system | Implemented (v5.35.0) | 5 specialist reviewers in `skills/quality-gates.md`; execution in run.sh |
|
|
268
268
|
| Benchmarks (HumanEval, SWE-bench) | Infrastructure only | Runner scripts and datasets exist in `benchmarks/`; no published results |
|
|
269
269
|
|
|
270
|
-
**v6.57.
|
|
270
|
+
**v6.57.1 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.57.
|
|
1
|
+
6.57.1
|
package/dashboard/__init__.py
CHANGED
package/docs/INSTALLATION.md
CHANGED
package/mcp/__init__.py
CHANGED
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as m,r,j as e}from"./index-
|
|
1
|
+
import{c as m,r,j as e}from"./index-1UyN_URb.js";import{C as g,a as p}from"./clock-Csnz1n2_.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{j as s}from"./index-
|
|
1
|
+
import{j as s}from"./index-1UyN_URb.js";const n={none:"p-0",sm:"p-3",md:"p-4",lg:"p-6"};function p({hover:e=!1,padding:d="md",className:t="",children:a,onClick:r}){return s.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:r,onKeyDown:r?o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),r())}:void 0,className:["bg-white border border-[#ECEAE3] rounded-[5px] shadow-card",e&&"hover:shadow-card-hover transition-shadow duration-200",r&&"cursor-pointer",n[d],t].filter(Boolean).join(" "),children:a})}export{p as C};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,r as
|
|
1
|
+
import{j as e,r as l,a as h,u as be,b as ge}from"./index-1UyN_URb.js";import{u as I,B as je}from"./Badge-wQU9blAB.js";import{P as ve,a as Ne,S as ye,E as C,T as we}from"./TerminalOutput-B5rIKYNW.js";import"./clock-Csnz1n2_.js";function ke(t){if(t<60)return`${Math.round(t)}s`;if(t<3600)return`${Math.floor(t/60)}m ${Math.round(t%60)}s`;const s=Math.floor(t/3600),n=Math.floor(t%3600/60);return`${s}h ${n}m`}function Se(t,s){if(!t||t<=0)return"--";const n={simple:{opus:1,haiku:1,total:3},standard:{opus:2,haiku:2,total:5},complex:{opus:3,haiku:3,total:8}},r=n[s]||n.standard;return t<=r.opus?"Opus":t>r.total-r.haiku?"Haiku":"Sonnet"}function Ce({status:t,prdSummary:s,onStop:n,onPause:r,onResume:a,isPaused:c}){const i=t?Se(t.iteration??0,t.complexity||"standard"):"--",o=c??(t==null?void 0:t.paused)??!1;return e.jsxs("div",{className:"card px-5 py-3 flex items-center gap-6 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Phase"}),e.jsx("span",{className:"font-mono font-semibold text-ink",children:(t==null?void 0:t.phase)||"idle"})]}),e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Complexity"}),e.jsx("span",{className:`font-mono font-semibold ${(t==null?void 0:t.complexity)==="complex"?"text-warning":(t==null?void 0:t.complexity)==="simple"?"text-success":"text-ink"}`,children:(t==null?void 0:t.complexity)||"standard"})]}),e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Model"}),e.jsx("span",{className:`font-mono font-semibold px-2 py-0.5 rounded-md text-xs ${i==="Opus"?"bg-primary/10 text-primary":i==="Haiku"?"bg-success/10 text-success":"bg-primary/10 text-primary"}`,children:i})]}),e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Tasks"}),e.jsx("span",{className:"font-mono text-ink",children:t!=null&&t.current_task?e.jsx("span",{className:"text-xs",children:t.current_task}):e.jsx("span",{className:"text-muted",children:"--"})}),((t==null?void 0:t.pending_tasks)??0)>0&&e.jsxs("span",{className:"text-xs text-primary font-mono",children:["+",t==null?void 0:t.pending_tasks," pending"]})]}),s&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium flex-shrink-0",children:"Building"}),e.jsx("span",{className:"text-xs font-mono text-ink truncate max-w-[220px]",title:s,children:s.length>60?s.slice(0,60)+"...":s})]})]}),e.jsx("div",{className:"flex-1"}),((t==null?void 0:t.uptime)??0)>0&&e.jsx("span",{className:"font-mono text-xs text-muted",children:ke((t==null?void 0:t.uptime)??0)}),(r||a)&&e.jsxs("button",{onClick:o?a:r,className:"flex items-center gap-1.5 px-4 py-1.5 rounded-btn text-xs font-semibold border border-warning/30 text-warning hover:bg-warning/10 transition-colors",children:[o?e.jsx(ve,{size:14}):e.jsx(Ne,{size:14}),o?"Resume":"Pause"]}),n&&e.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-4 py-1.5 rounded-btn text-xs font-semibold bg-danger/10 text-danger border border-danger/20 hover:bg-danger/20 transition-colors",children:[e.jsx(ye,{size:14}),"Stop"]})]})}function Ee({status:t}){const s=[{label:"Iteration",value:t?t.iteration.toString():"--",color:"text-primary"},{label:"Agents",value:t?t.running_agents.toString():"--",color:t&&t.running_agents>0?"text-success":"text-muted"},{label:"Pending",value:t?t.pending_tasks.toString():"--",color:t&&t.pending_tasks>0?"text-warning":"text-muted"},{label:"Provider",value:(t==null?void 0:t.provider)||"--",color:"text-primary"}];return e.jsx("div",{className:"grid grid-cols-4 gap-3",children:s.map(n=>e.jsxs("div",{className:"card p-4 text-center",children:[e.jsx("div",{className:`text-2xl font-bold font-mono ${n.color}`,children:n.value}),e.jsx("div",{className:"text-xs text-muted font-medium mt-1 uppercase tracking-wider",children:n.label})]},n.label))})}function Pe({plan:t,loading:s,onConfirm:n,onCancel:r}){return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",children:e.jsxs("div",{className:"card w-full max-w-lg mx-4 p-6 rounded-card shadow-card-hover",children:[e.jsx("h2",{className:"text-lg font-bold text-ink mb-4",children:"Build Estimate"}),s?e.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[e.jsx("div",{className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin"}),e.jsx("p",{className:"text-sm text-muted",children:"Analyzing PRD..."}),e.jsxs("div",{className:"flex gap-3 mt-4",children:[e.jsx("button",{onClick:r,className:"px-4 py-2 text-sm font-medium text-muted hover:text-ink transition-colors",children:"Cancel"}),e.jsx("button",{onClick:n,className:"px-4 py-2 text-sm font-medium text-primary hover:text-primary/80 transition-colors underline",children:"Skip analysis, build now"})]})]}):t?e.jsxs(e.Fragment,{children:[t.returncode!==0&&e.jsxs("div",{className:"mb-4 px-3 py-2 rounded-btn bg-warning/10 border border-warning/20 text-warning text-xs",children:["loki plan exited with code ",t.returncode," - showing partial results"]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Complexity"}),e.jsx("div",{className:"text-base font-bold text-ink capitalize",children:t.complexity})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Est. Cost"}),e.jsx("div",{className:"text-base font-bold text-ink",children:t.cost_estimate})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Iterations"}),e.jsx("div",{className:"text-base font-bold text-ink",children:t.iterations})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Phases"}),e.jsx("div",{className:"text-xs text-ink capitalize",children:t.phases.join(", ")})]})]}),t.output_text&&e.jsxs("details",{className:"mb-4",children:[e.jsx("summary",{className:"text-xs text-muted cursor-pointer hover:text-ink transition-colors",children:"Raw output"}),e.jsx("pre",{className:"mt-2 text-xs font-mono text-muted-accessible bg-black/5 rounded-card p-3 overflow-auto max-h-40 whitespace-pre-wrap",children:t.output_text})]}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx("button",{onClick:r,className:"px-4 py-2 text-sm font-medium text-muted hover:text-ink transition-colors",children:"Cancel"}),e.jsx("button",{onClick:n,className:"px-5 py-2 rounded-card text-sm font-semibold bg-primary text-white hover:bg-primary/90 transition-all shadow-button",children:"Start Build"})]})]}):e.jsx("div",{className:"text-sm text-muted py-4",children:"No plan data available."})]})})}function _e({onSubmit:t,running:s,error:n,provider:r,onProviderChange:a,initialPrd:c}){const[i,o]=l.useState(""),[m,b]=l.useState(""),[f,y]=l.useState("claude"),[d,g]=l.useState(""),j=r??f,[v,w]=l.useState(!1),[k,T]=l.useState([]),[x,E]=l.useState(!1),[N,M]=l.useState(!1),[P,A]=l.useState(!1),[z,_]=l.useState(null),[F,$]=l.useState(!1),[O,B]=l.useState(!1);l.useEffect(()=>{h.getTemplates().then(p=>{T(p),E(!1)}).catch(()=>{T([]),E(!0)})},[]),l.useEffect(()=>{c&&o(c)},[c]),l.useEffect(()=>{if(c)return;const p=localStorage.getItem("loki-prd-draft");p&&o(p),h.getPrdPrefill().then(({content:L})=>{L&&o(L)}).catch(()=>{})},[c]),l.useEffect(()=>{i.trim()?localStorage.setItem("loki-prd-draft",i):localStorage.removeItem("loki-prd-draft")},[i]);const R=l.useCallback(async(p,L)=>{b(L),w(!1);try{const G=await h.getTemplateContent(p);o(G.content)}catch{o(`# ${L}
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
@@ -14,5 +14,5 @@ Describe your project here...
|
|
|
14
14
|
|
|
15
15
|
- Requirement 1
|
|
16
16
|
- Requirement 2
|
|
17
|
-
`)}},[]),q=async()=>{if(!(!i.trim()||L)){$(!0),F(null),D(!0);try{const u=await h.planSession(i,j);F(u)}catch{F({complexity:"unknown",cost_estimate:"N/A",iterations:0,phases:[],output_text:"Failed to run loki plan. The CLI may not be available.",returncode:1})}finally{$(!1)}}},H=async()=>{if(!(!i.trim()||s||N)){D(!1),M(!0);try{await t(i,j,d.trim()||void 0,_?"quick":void 0)}finally{M(!1)}}};return e.jsxs(e.Fragment,{children:[O&&e.jsx(Pe,{plan:z,loading:L,onConfirm:H,onCancel:()=>D(!1)}),e.jsxs("div",{className:"card p-6 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Product Requirements"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>w(!v),className:"text-xs font-medium px-3 py-1.5 rounded-card border border-primary/20 text-primary hover:bg-primary/5 transition-colors",children:m||"Templates"}),v&&e.jsx("div",{className:"absolute right-0 top-full mt-1 w-56 card rounded-card overflow-hidden z-20 shadow-card-hover",children:e.jsxs("div",{className:"py-1 max-h-64 overflow-y-auto terminal-scroll",children:[x&&e.jsx("div",{className:"px-3 py-2 text-xs text-warning border-b border-warning/10",children:"Could not load templates from server. Check that the backend is running."}),!x&&k.length===0&&e.jsx("div",{className:"px-3 py-2 text-xs text-muted",children:"Loading..."}),k.map(u=>e.jsx("button",{onClick:()=>R(u.filename,u.name),className:"w-full text-left px-3 py-2 text-sm text-ink hover:bg-primary/5 transition-colors",children:u.name},u.filename))]})})]})})]}),e.jsx("textarea",{value:i,onChange:u=>o(u.target.value),placeholder:"Paste your PRD here, or select a template above to get started...",className:"flex-1 min-h-[280px] w-full bg-card rounded-card border border-border-light px-4 py-3 text-sm font-mono text-ink placeholder:text-primary/60 resize-none focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/30 transition-all",spellCheck:!1}),e.jsxs("div",{className:"mt-3",children:[e.jsx("label",{className:"block text-xs text-muted font-medium mb-1 uppercase tracking-wider",children:"Project Directory"}),e.jsx("input",{type:"text",value:d,onChange:u=>g(u.target.value),placeholder:"Leave blank to auto-create, or type a path (e.g. /Users/you/my-project)",className:"w-full bg-card rounded-card border border-border-light px-4 py-2 text-sm font-mono text-ink placeholder:text-primary/60/70 focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/30 transition-all",spellCheck:!1}),e.jsx("p",{className:"text-xs text-muted-accessible mt-1",children:"Type a path or leave blank to auto-create under ~/purple-lab-projects/"})]}),l&&e.jsx("div",{className:"mt-3 px-3 py-2 rounded-btn bg-danger/10 border border-danger/20 text-danger text-xs font-medium",children:l}),e.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[e.jsxs("button",{onClick:()=>A(!_),title:"Quick Mode: 3 iterations max, faster builds",className:`flex items-center gap-1.5 px-3 py-1.5 rounded-card text-xs font-semibold border transition-all ${_?"bg-primary/10 border-primary/30 text-primary":"border-border-light text-muted hover:text-ink hover:bg-card"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${_?"bg-primary":"bg-muted/40"}`}),"Quick"]}),e.jsx("div",{className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted font-mono",children:[i.length.toLocaleString()," chars"]}),e.jsx("button",{onClick:q,disabled:!i.trim()||s||N||L,className:`px-6 py-2.5 rounded-card text-sm font-semibold transition-all ${!i.trim()||s||N||L?"bg-primary/10 text-muted cursor-not-allowed":"bg-primary text-white hover:bg-primary/90 shadow-button"}`,children:L?"Analyzing...":N?"Starting...":s?"Building...":"Start Build"})]})]})]})}const B=[{key:"reason",label:"Reason",description:"Analyzing task, planning approach"},{key:"act",label:"Act",description:"Implementing changes, writing code"},{key:"reflect",label:"Reflect",description:"Reviewing output, self-critique"},{key:"verify",label:"Verify",description:"Testing, validation, quality gates"}];function Fe(t){if(!t)return"reason";const s=t.toLowerCase();return s.includes("reason")||s.includes("plan")?"reason":s.includes("act")||s.includes("implement")||s.includes("code")?"act":s.includes("reflect")||s.includes("review")?"reflect":s.includes("verify")||s.includes("test")||s.includes("check")?"verify":"idle"}function Le({currentPhase:t,iteration:s}){const l=Fe(t);return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"RARV Cycle"}),e.jsxs("span",{className:"font-mono text-xs text-muted",children:["Iteration ",s]})]}),e.jsx("div",{className:"flex items-center justify-center mb-5",children:e.jsxs("svg",{viewBox:"0 0 120 120",className:"w-28 h-28",children:[B.map((r,a)=>{const c=r.key===l,i=l!=="idle"&&B.findIndex(f=>f.key===l)>a,o=(a*90-90)*(Math.PI/180),m=60+40*Math.cos(o),b=60+40*Math.sin(o);return e.jsxs("g",{children:[a<B.length-1&&e.jsx("line",{x1:m,y1:b,x2:60+40*Math.cos(((a+1)*90-90)*(Math.PI/180)),y2:60+40*Math.sin(((a+1)*90-90)*(Math.PI/180)),stroke:i?"#553DE9":"#ECEAE3",strokeWidth:i?2:1,strokeDasharray:i?"none":"4 3"}),a===B.length-1&&e.jsx("line",{x1:m,y1:b,x2:60+40*Math.cos(-90*(Math.PI/180)),y2:60+40*Math.sin(-90*(Math.PI/180)),stroke:"#ECEAE3",strokeWidth:1,strokeDasharray:"4 3"}),e.jsx("circle",{cx:m,cy:b,r:c?14:10,fill:c||i?"#553DE9":"#E8E4FD",stroke:c?"#4432c4":i?"#553DE9":"#ECEAE3",strokeWidth:c?3:1.5,className:c?"phase-active":""}),e.jsx("text",{x:m,y:b+(a===0?-20:a===2?24:0),textAnchor:"middle",className:"text-[9px] font-semibold fill-ink",dx:a===1?22:a===3?-22:0,children:r.label[0]})]},r.key)}),e.jsx("text",{x:"60",y:"64",textAnchor:"middle",className:"text-lg font-bold font-mono fill-primary",children:s})]})}),e.jsx("div",{className:"space-y-2",children:B.map(r=>{const a=r.key===l;return e.jsxs("div",{className:`flex items-center gap-3 px-3 py-2 rounded-card transition-all duration-200 ${a?"bg-primary/8 border border-primary/20":"opacity-50"}`,children:[e.jsx("div",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${a?"bg-primary phase-active":"bg-border"}`}),e.jsxs("div",{children:[e.jsx("span",{className:`text-sm font-semibold ${a?"text-primary":"text-muted"}`,children:r.label}),a&&e.jsx("p",{className:"text-xs text-muted mt-0.5",children:r.description})]})]},r.key)})})]})}const W={architect:"bg-primary/10 text-primary border-primary/20",developer:"bg-primary/10 text-primary border-primary/20",tester:"bg-success/10 text-success border-success/20",reviewer:"bg-warning/10 text-warning border-warning/20",planner:"bg-primary/60/20 text-ink border-primary/60/30",default:"bg-border/30 text-muted border-border/50"};function Re(t){if(!t)return W.default;const s=t.toLowerCase();for(const[l,r]of Object.entries(W))if(s.includes(l))return r;return W.default}function Te({agents:t,loading:s}){const l=(t==null?void 0:t.filter(a=>a.alive))||[],r=(t==null?void 0:t.filter(a=>!a.alive))||[];return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Agents"}),e.jsxs("span",{className:"font-mono text-xs text-muted",children:[l.length," active"]})]}),s&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading agents..."}),!s&&(t==null?void 0:t.length)===0&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No agents running"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Start a build to spawn agents"})]}),l.length>0&&e.jsx("div",{className:"space-y-2 mb-4",children:l.map(a=>e.jsx(K,{agent:a},a.id))}),r.length>0&&e.jsxs("details",{className:"mt-3",children:[e.jsxs("summary",{className:"text-xs text-muted cursor-pointer hover:text-ink transition-colors",children:[r.length," completed"]}),e.jsx("div",{className:"space-y-1.5 mt-2",children:r.slice(0,10).map(a=>e.jsx(K,{agent:a,compact:!0},a.id))})]})]})}function K({agent:t,compact:s}){const l=Re(t.type||t.name||"");return s?e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded-btn bg-hover text-xs",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-muted/30"}),e.jsx("span",{className:"font-medium text-muted truncate",children:t.name||t.id}),e.jsx("span",{className:"text-primary/60 ml-auto",children:t.type})]}):e.jsxs("div",{className:`flex items-start gap-3 px-3 py-2.5 rounded-card border ${l}`,children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${t.alive?"bg-success phase-active":"bg-muted/30"}`})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold truncate",children:t.name||t.id}),t.type&&e.jsx("span",{className:"text-xs font-mono font-medium opacity-70",children:t.type})]}),t.task&&e.jsx("p",{className:"text-xs opacity-70 mt-0.5 truncate",children:t.task}),t.status&&t.status!=="unknown"&&e.jsx("span",{className:"inline-block text-xs font-mono mt-1 opacity-60",children:t.status})]}),t.pid&&e.jsxs("span",{className:"text-xs font-mono text-muted-accessible flex-shrink-0",children:["PID ",t.pid]})]})}const Me={pass:{badge:"bg-success/10 text-success border-success/20",dot:"bg-success",label:"Pass"},fail:{badge:"bg-danger/10 text-danger border-danger/20",dot:"bg-danger",label:"Fail"},skip:{badge:"bg-muted/10 text-muted border-muted/20",dot:"bg-muted/40",label:"Skip"},pending:{badge:"bg-warning/10 text-warning border-warning/20",dot:"bg-warning",label:"Pending"}};function $e({item:t}){const[s,l]=n.useState(!1),r=Me[t.status];return e.jsxs("div",{className:`border rounded-card overflow-hidden ${r.badge}`,children:[e.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 px-3 py-2.5 text-left",onClick:()=>t.details&&l(!s),children:[e.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${r.dot}`}),e.jsx("span",{className:"text-sm font-medium flex-1 truncate",children:t.label}),e.jsx("span",{className:"text-xs font-mono font-semibold uppercase tracking-wider flex-shrink-0",children:r.label}),t.details&&e.jsx("span",{className:"text-xs text-muted/60 flex-shrink-0",children:s?"v":">"})]}),s&&t.details&&e.jsx("div",{className:"px-3 pb-2.5 pt-0",children:e.jsx("p",{className:"text-xs font-mono opacity-70 leading-relaxed",children:t.details})})]})}function Ie({checklist:t,loading:s}){const l=t&&t.total>0?t.passed/t.total*100:0;return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Quality Gates"}),t&&e.jsxs("span",{className:"font-mono text-xs text-muted",children:[t.passed,"/",t.total," passed"]})]}),s&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading gates..."}),!s&&!t&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No quality gate data"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Gates run during verification phase"})]}),t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-4 mb-3 text-xs",children:[e.jsxs("span",{className:"text-success font-medium",children:[t.passed," passed"]}),t.failed>0&&e.jsxs("span",{className:"text-danger font-medium",children:[t.failed," failed"]}),t.skipped>0&&e.jsxs("span",{className:"text-muted",children:[t.skipped," skipped"]}),t.pending>0&&e.jsxs("span",{className:"text-warning",children:[t.pending," pending"]})]}),e.jsx("div",{className:"w-full h-2 bg-charcoal/10 rounded-full overflow-hidden mb-4",children:e.jsx("div",{className:"h-full bg-success rounded-full transition-all duration-500",style:{width:`${l}%`}})}),e.jsx("div",{className:"space-y-2 max-h-[400px] overflow-y-auto terminal-scroll",children:t.items.map(r=>e.jsx($e,{item:r},r.id))})]})]})}const Ae={".py":"bg-success",".ts":"bg-primary",".tsx":"bg-primary",".md":"bg-warning",".sh":"bg-primary"};function De(t){const s=t.substring(t.lastIndexOf("."));return Ae[s]||"bg-muted"}function Be(t){return t==null?"":t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}const V=100;function X({node:t,depth:s,onSelectFile:l,selectedPath:r}){const[a,c]=n.useState(!1),[i,o]=n.useState(V),m=t.type==="directory",b=t.path===r,f=m&&a?t.children??[]:[],y=f.length>i;return e.jsxs("div",{children:[e.jsxs("button",{type:"button",className:`w-full flex items-center gap-2 px-2 py-1 rounded-btn text-left text-sm transition-colors hover:bg-hover ${b?"bg-primary/10 text-primary":"text-ink"}`,style:{paddingLeft:`${s*16+8}px`},onClick:()=>{m?(c(!a),a&&o(V)):l(t.path)},children:[m?e.jsx("span",{className:"font-mono text-xs text-muted w-3 flex-shrink-0",children:a?"v":">"}):e.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${De(t.name)}`}),e.jsx("span",{className:`truncate ${m?"font-medium":"font-mono text-xs"}`,children:t.name}),!m&&t.size!==void 0&&e.jsx("span",{className:"ml-auto text-xs font-mono text-muted-accessible flex-shrink-0",children:Be(t.size)})]}),f.length>0&&e.jsxs("div",{children:[f.slice(0,i).map(d=>e.jsx(X,{node:d,depth:s+1,onSelectFile:l,selectedPath:r},d.path)),y&&e.jsxs("button",{type:"button",className:"w-full text-left text-xs text-primary hover:text-primary/80 py-1 transition-colors",style:{paddingLeft:`${(s+1)*16+8}px`},onClick:()=>o(d=>d+V),children:["Show more (",f.length-i," remaining)"]})]})]})}function ze({files:t,loading:s}){const[l,r]=n.useState(null),[a,c]=n.useState(null),[i,o]=n.useState(!1),[m,b]=n.useState(null),f=n.useCallback(async d=>{c(null),r(d),o(!0),b(null);try{const g=await h.getFileContent(d);c(g.content)}catch(g){const j=g instanceof Error?g.message:"Unknown error",v=g instanceof TypeError||j==="Request timeout",w=j.includes("404")||j.includes("not found")||j.includes("Not found");b(v?"Network error - server may be unreachable":w?"File not found - it may have been deleted or renamed":j),c(null)}finally{o(!1)}},[]),y=n.useCallback(d=>{f(d)},[f]);return e.jsxs("div",{className:"card p-6 flex flex-col",style:{minHeight:"300px"},children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"File Browser"}),e.jsx("span",{className:"font-mono text-xs text-muted",children:".loki/"})]}),s&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading files..."}),!s&&(!t||t.length===0)&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No project files found"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Start a session to generate .loki/ state"})]}),t&&t.length>0&&e.jsxs("div",{className:"flex gap-4 flex-1 min-h-0",children:[e.jsx("div",{className:"w-1/2 overflow-y-auto terminal-scroll pr-2",children:t.map(d=>e.jsx(X,{node:d,depth:0,onSelectFile:y,selectedPath:l},d.path))}),e.jsxs("div",{className:"w-1/2 bg-charcoal/5 rounded-card p-3 overflow-hidden flex flex-col",children:[!l&&e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted text-xs",children:"Select a file to preview"}),l&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-xs font-mono text-primary mb-2 truncate",children:l}),e.jsx("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:i?e.jsx("div",{className:"text-muted text-xs",children:"Loading..."}):m?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-6",children:[e.jsx("p",{className:"text-danger text-xs font-medium",children:"Failed to load file"}),e.jsx("p",{className:"text-muted-accessible text-xs text-center max-w-[200px] break-words",children:m}),e.jsx("button",{type:"button",onClick:()=>l&&f(l),className:"mt-1 px-3 py-1 text-xs font-semibold rounded-btn border border-primary/20 text-primary hover:bg-primary/5 transition-colors",children:"Retry"})]}):e.jsx("pre",{className:"text-xs font-mono text-ink whitespace-pre-wrap break-words leading-relaxed",children:a})})]})]})]})]})}const Y=5e5;function Z(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}function Ue(t){if(!t)return"Never";try{const s=new Date(t),r=new Date().getTime()-s.getTime(),a=Math.floor(r/(1e3*60*60));return a<1?"Just now":a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}catch{return t}}function Oe({memory:t,loading:s}){const l=t?[{label:"Episodic",count:t.episodic_count,color:"text-primary",bg:"bg-primary/10",border:"border-primary/20"},{label:"Semantic",count:t.semantic_count,color:"text-success",bg:"bg-success/10",border:"border-success/20"},{label:"Skills",count:t.skill_count,color:"text-warning",bg:"bg-warning/10",border:"border-warning/20"}]:[],r=t?Math.min(t.total_tokens/Y*100,100):0;return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Memory System"}),t&&e.jsx("span",{className:"font-mono text-xs text-muted",children:Ue(t.last_consolidation)})]}),s&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading memory..."}),!s&&!t&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No memory data available"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Memory populates during autonomous runs"})]}),t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:l.map(a=>e.jsxs("div",{className:`${a.bg} border ${a.border} rounded-card p-3 text-center`,children:[e.jsx("div",{className:`text-2xl font-bold font-mono ${a.color}`,children:a.count}),e.jsx("div",{className:"text-xs text-muted-accessible font-medium mt-1 uppercase tracking-wider",children:a.label})]},a.label))}),e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-xs text-muted font-medium",children:"Token Usage"}),e.jsxs("span",{className:"text-xs font-mono text-ink",children:[Z(t.total_tokens)," / ",Z(Y)]})]}),e.jsx("div",{className:"w-full h-2 bg-charcoal/10 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${r>80?"bg-danger":r>50?"bg-warning":"bg-info"}`,style:{width:`${r}%`}})})]}),e.jsxs("div",{className:"mt-3 flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted",children:"Last Consolidation"}),e.jsx("span",{className:"font-mono text-ink",children:t.last_consolidation?new Date(t.last_consolidation).toLocaleString():"Never"})]})]})]})}function qe({visible:t}){const[s,l]=n.useState("markdown"),[r,a]=n.useState(null),[c,i]=n.useState(null),[o,m]=n.useState(!1),[b,f]=n.useState(!1),[y,d]=n.useState(null),[g,j]=n.useState(!1);if(!t)return null;const v=async()=>{m(!0),d(null),a(null),i(null);try{const x=await h.generateReport(s);a(x)}catch(x){d(x instanceof Error?x.message:"Failed to generate report")}finally{m(!1)}},w=async()=>{f(!0),d(null);try{const x=await h.shareSession();i(x)}catch(x){d(x instanceof Error?x.message:"Failed to share session")}finally{f(!1)}},k=async x=>{try{await navigator.clipboard.writeText(x),j(!0),setTimeout(()=>j(!1),2e3)}catch{}},T=()=>{if(!r)return;const x=new Blob([r.content],{type:s==="html"?"text/html":"text/markdown"}),P=URL.createObjectURL(x),N=document.createElement("a");N.href=P,N.download=`loki-report.${s==="html"?"html":"md"}`,N.click(),URL.revokeObjectURL(P)};return e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Session Report"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-1 card rounded-card p-1",children:["markdown","html"].map(x=>e.jsx("button",{onClick:()=>l(x),className:`px-3 py-1 text-xs font-semibold rounded-btn transition-all ${s===x?"bg-primary text-white shadow-sm":"text-muted hover:text-ink hover:bg-hover"}`,children:x.toUpperCase()},x))}),e.jsx("button",{onClick:v,disabled:o,className:"px-4 py-1.5 rounded-card text-xs font-semibold bg-primary text-white hover:bg-primary/90 disabled:opacity-50 transition-all",children:o?"Generating...":"Generate Report"})]})]}),y&&e.jsx("div",{className:"mb-3 px-3 py-2 rounded-btn bg-danger/10 border border-danger/20 text-danger text-xs",children:y}),r&&e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("span",{className:"text-xs text-muted",children:["Report generated (",r.format,")"]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>k(r.content),className:"px-3 py-1 text-xs font-medium text-muted hover:text-ink border border-border-light rounded-btn hover:bg-hover transition-all",children:g?"Copied":"Copy"}),e.jsx("button",{onClick:T,className:"px-3 py-1 text-xs font-medium text-muted hover:text-ink border border-border-light rounded-btn hover:bg-hover transition-all",children:"Download"}),e.jsx("button",{onClick:w,disabled:b,className:"px-3 py-1 text-xs font-medium bg-primary/10 text-primary border border-primary/20 rounded-btn hover:bg-primary/20 disabled:opacity-50 transition-all",children:b?"Sharing...":"Share as Gist"})]}),c&&e.jsxs("div",{className:"mb-2 flex items-center gap-2 px-3 py-2 rounded-btn bg-success/10 border border-success/20",children:[e.jsx("span",{className:"text-xs text-success font-medium",children:"Shared:"}),c.url?e.jsx("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary underline flex-1 truncate",children:c.url}):e.jsx("span",{className:"text-xs text-muted flex-1",children:"No URL returned"}),c.url&&e.jsx("button",{onClick:()=>k(c.url),className:"text-xs text-muted hover:text-ink",children:"Copy URL"})]}),e.jsx("pre",{className:"text-[11px] font-mono text-ink bg-black/5 rounded-card p-3 overflow-auto max-h-64 whitespace-pre-wrap terminal-scroll",children:r.content||"(empty report)"})]})]})}function J({visible:t}){const s=n.useCallback(()=>h.getMetrics(),[]),{data:l,loading:r}=I(s,15e3,t);return t?e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Session Metrics"}),r&&e.jsx("div",{className:"w-4 h-4 border-2 border-primary border-t-transparent rounded-full animate-spin"})]}),l?e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Iterations"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:l.iterations??0})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Gate Pass Rate"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:typeof l.quality_gate_pass_rate=="number"?`${l.quality_gate_pass_rate.toFixed(0)}%`:"N/A"})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Tokens Used"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:(l.tokens_used??0).toLocaleString()})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Time Elapsed"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:l.time_elapsed||"N/A"})]})]}):e.jsx("div",{className:"text-sm text-muted py-4 text-center",children:r?"Loading metrics...":"No metrics available"})]}):null}function He(t){switch(t){case"completed":case"complete":case"done":return"completed";case"in_progress":return"running";case"started":return"started";case"error":case"failed":return"failed";default:return"empty"}}const Ge={completed:"Completed",complete:"Completed",done:"Completed",in_progress:"In Progress",started:"Started",error:"Failed",failed:"Failed",empty:"Empty"};function We({onLoadSession:t}){const s=n.useCallback(()=>h.getSessionsHistory(),[]),{data:l,loading:r}=I(s,6e4,!0);return r&&!l?e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider mb-3",children:"Past Builds"}),e.jsx("div",{className:"text-sm text-muted",children:"Loading..."})]}):!l||l.length===0?null:e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider mb-3",children:"Past Builds"}),e.jsx("div",{className:"flex flex-col gap-2 max-h-64 overflow-y-auto terminal-scroll",children:l.map(a=>{const c=a.file_count;return e.jsxs("button",{onClick:()=>t==null?void 0:t(a),className:"text-left px-4 py-3 rounded-card card hover:bg-hover transition-all group cursor-pointer",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs font-mono text-muted-accessible",children:a.date}),e.jsxs("div",{className:"flex items-center gap-2",children:[c!==void 0&&c>0&&e.jsxs("span",{className:"text-xs font-mono text-muted-accessible",children:[c," files"]}),e.jsx(je,{status:He(a.status),children:Ge[a.status]||a.status})]})]}),e.jsx("div",{className:"text-xs text-ink truncate group-hover:text-primary transition-colors",children:a.prd_snippet||a.id}),e.jsx("div",{className:"text-xs font-mono text-muted-accessible mt-0.5 truncate",children:a.path})]},a.id)})})]})}function Ze(){const t=be(),[s,l]=n.useState(null),[r,a]=n.useState(()=>sessionStorage.getItem("pl_running")==="1"),[c,i]=n.useState(!1),[o,m]=n.useState(()=>sessionStorage.getItem("pl_prd")),[b,f]=n.useState(!1),[y,d]=n.useState(!1),[g,j]=n.useState(!1),[v,w]=n.useState(()=>sessionStorage.getItem("pl_tab")||"terminal"),[k,T]=n.useState(()=>sessionStorage.getItem("pl_provider")||"claude"),[x,P]=n.useState(void 0);n.useEffect(()=>{const p=sessionStorage.getItem("pl_template");p&&(sessionStorage.removeItem("pl_template"),h.getTemplateContent(p).then(({content:U})=>{U&&P(U)}).catch(()=>{}))},[]);const[N,M]=n.useState(null),[_,A]=n.useState(null),[z,F]=n.useState(null),L=n.useCallback(p=>{if(!p){M(null),A(null),F(null);return}M(p.status),A(p.agents),F(p.logs),a(p.status.running??!1),i(p.status.paused??!1)},[]),{connected:$,subscribe:O}=ge(L),D=n.useCallback(()=>h.getStatus(),[]),{data:R}=I(D,3e4,!$);n.useEffect(()=>{N===null&&R!==null&&(a(R.running??!1),i(R.paused??!1))},[R,N]),n.useEffect(()=>{sessionStorage.setItem("pl_running",r?"1":"0"),r&&f(!0)},[r]),n.useEffect(()=>{o?sessionStorage.setItem("pl_prd",o):sessionStorage.removeItem("pl_prd")},[o]),n.useEffect(()=>{sessionStorage.setItem("pl_provider",k)},[k]),n.useEffect(()=>{sessionStorage.setItem("pl_tab",v)},[v]);const q=n.useCallback(()=>h.getMemorySummary(),[]),H=n.useCallback(()=>h.getChecklist(),[]),u=n.useCallback(()=>h.getFiles(),[]),{data:S,loading:G}=I(q,3e4,r),{data:ee,loading:te}=I(H,3e4,r),{data:se,loading:ae}=I(u,3e4,r),C=N??R,re=_,ne=z,le=_===null,ie=z===null,ce=n.useCallback(async(p,U,he,fe)=>{l(null),f(!1),d(!1),w("terminal");try{await h.startSession({prd:p,provider:U,projectDir:he,mode:fe}),m(p),a(!0)}catch(Q){l(Q instanceof Error?Q.message:"Failed to start session")}},[]),oe=n.useCallback(async()=>{try{(await h.stopSession()).stopped&&(a(!1),i(!1),m(null),M(null),A(null),F(null))}catch{a(!1),i(!1),m(null)}sessionStorage.removeItem("pl_running"),sessionStorage.removeItem("pl_prd"),sessionStorage.removeItem("pl_tab")},[]),de=n.useCallback(p=>{t(`/project/${p.id}`)},[t]),xe=n.useCallback(p=>{T(p)},[]),me=n.useCallback(async()=>{try{await h.pauseSession(),i(!0)}catch{}},[]),ue=n.useCallback(async()=>{try{await h.resumeSession(),i(!1)}catch{}},[]),pe=o&&o.replace(/^#+\s*/gm,"").split(`
|
|
18
|
-
`).find(
|
|
17
|
+
`)}},[]),q=async()=>{if(!(!i.trim()||F)){$(!0),_(null),B(!0);try{const p=await h.planSession(i,j);_(p)}catch{_({complexity:"unknown",cost_estimate:"N/A",iterations:0,phases:[],output_text:"Failed to run loki plan. The CLI may not be available.",returncode:1})}finally{$(!1)}}},H=async()=>{if(!(!i.trim()||s||N)){B(!1),M(!0);try{await t(i,j,d.trim()||void 0,P?"quick":void 0)}finally{M(!1)}}};return e.jsxs(e.Fragment,{children:[O&&e.jsx(Pe,{plan:z,loading:F,onConfirm:H,onCancel:()=>B(!1)}),e.jsxs("div",{className:"card p-6 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Product Requirements"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>w(!v),className:"text-xs font-medium px-3 py-1.5 rounded-card border border-primary/20 text-primary hover:bg-primary/5 transition-colors",children:m||"Templates"}),v&&e.jsx("div",{className:"absolute right-0 top-full mt-1 w-56 card rounded-card overflow-hidden z-20 shadow-card-hover",children:e.jsxs("div",{className:"py-1 max-h-64 overflow-y-auto terminal-scroll",children:[x&&e.jsx("div",{className:"px-3 py-2 text-xs text-warning border-b border-warning/10",children:"Could not load templates from server. Check that the backend is running."}),!x&&k.length===0&&e.jsx("div",{className:"px-3 py-2 text-xs text-muted",children:"Loading..."}),k.map(p=>e.jsx("button",{onClick:()=>R(p.filename,p.name),className:"w-full text-left px-3 py-2 text-sm text-ink hover:bg-primary/5 transition-colors",children:p.name},p.filename))]})})]})})]}),e.jsx("textarea",{value:i,onChange:p=>o(p.target.value),placeholder:"Paste your PRD here, or select a template above to get started...",className:"flex-1 min-h-[280px] w-full bg-card rounded-card border border-border-light px-4 py-3 text-sm font-mono text-ink placeholder:text-primary/60 resize-none focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/30 transition-all",spellCheck:!1}),e.jsxs("div",{className:"mt-3",children:[e.jsx("label",{className:"block text-xs text-muted font-medium mb-1 uppercase tracking-wider",children:"Project Directory"}),e.jsx("input",{type:"text",value:d,onChange:p=>g(p.target.value),placeholder:"Leave blank to auto-create, or type a path (e.g. /Users/you/my-project)",className:"w-full bg-card rounded-card border border-border-light px-4 py-2 text-sm font-mono text-ink placeholder:text-primary/60/70 focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/30 transition-all",spellCheck:!1}),e.jsx("p",{className:"text-xs text-muted-accessible mt-1",children:"Type a path or leave blank to auto-create under ~/purple-lab-projects/"})]}),n&&e.jsx("div",{className:"mt-3 px-3 py-2 rounded-btn bg-danger/10 border border-danger/20 text-danger text-xs font-medium",children:n}),e.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[e.jsxs("button",{onClick:()=>A(!P),title:"Quick Mode: 3 iterations max, faster builds",className:`flex items-center gap-1.5 px-3 py-1.5 rounded-card text-xs font-semibold border transition-all ${P?"bg-primary/10 border-primary/30 text-primary":"border-border-light text-muted hover:text-ink hover:bg-card"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${P?"bg-primary":"bg-muted/40"}`}),"Quick"]}),e.jsx("div",{className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted font-mono",children:[i.length.toLocaleString()," chars"]}),e.jsx("button",{onClick:q,disabled:!i.trim()||s||N||F,className:`px-6 py-2.5 rounded-card text-sm font-semibold transition-all ${!i.trim()||s||N||F?"bg-primary/10 text-muted cursor-not-allowed":"bg-primary text-white hover:bg-primary/90 shadow-button"}`,children:F?"Analyzing...":N?"Starting...":s?"Building...":"Start Build"})]})]})]})}const D=[{key:"reason",label:"Reason",description:"Analyzing task, planning approach"},{key:"act",label:"Act",description:"Implementing changes, writing code"},{key:"reflect",label:"Reflect",description:"Reviewing output, self-critique"},{key:"verify",label:"Verify",description:"Testing, validation, quality gates"}];function Fe(t){if(!t)return"reason";const s=t.toLowerCase();return s.includes("reason")||s.includes("plan")?"reason":s.includes("act")||s.includes("implement")||s.includes("code")?"act":s.includes("reflect")||s.includes("review")?"reflect":s.includes("verify")||s.includes("test")||s.includes("check")?"verify":"idle"}function Re({currentPhase:t,iteration:s}){const n=Fe(t);return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"RARV Cycle"}),e.jsxs("span",{className:"font-mono text-xs text-muted",children:["Iteration ",s]})]}),e.jsx("div",{className:"flex items-center justify-center mb-5",children:e.jsxs("svg",{viewBox:"0 0 120 120",className:"w-28 h-28",children:[D.map((r,a)=>{const c=r.key===n,i=n!=="idle"&&D.findIndex(f=>f.key===n)>a,o=(a*90-90)*(Math.PI/180),m=60+40*Math.cos(o),b=60+40*Math.sin(o);return e.jsxs("g",{children:[a<D.length-1&&e.jsx("line",{x1:m,y1:b,x2:60+40*Math.cos(((a+1)*90-90)*(Math.PI/180)),y2:60+40*Math.sin(((a+1)*90-90)*(Math.PI/180)),stroke:i?"#553DE9":"#ECEAE3",strokeWidth:i?2:1,strokeDasharray:i?"none":"4 3"}),a===D.length-1&&e.jsx("line",{x1:m,y1:b,x2:60+40*Math.cos(-90*(Math.PI/180)),y2:60+40*Math.sin(-90*(Math.PI/180)),stroke:"#ECEAE3",strokeWidth:1,strokeDasharray:"4 3"}),e.jsx("circle",{cx:m,cy:b,r:c?14:10,fill:c||i?"#553DE9":"#E8E4FD",stroke:c?"#4432c4":i?"#553DE9":"#ECEAE3",strokeWidth:c?3:1.5,className:c?"phase-active":""}),e.jsx("text",{x:m,y:b+(a===0?-20:a===2?24:0),textAnchor:"middle",className:"text-[9px] font-semibold fill-ink",dx:a===1?22:a===3?-22:0,children:r.label[0]})]},r.key)}),e.jsx("text",{x:"60",y:"64",textAnchor:"middle",className:"text-lg font-bold font-mono fill-primary",children:s})]})}),e.jsx("div",{className:"space-y-2",children:D.map(r=>{const a=r.key===n;return e.jsxs("div",{className:`flex items-center gap-3 px-3 py-2 rounded-card transition-all duration-200 ${a?"bg-primary/8 border border-primary/20":"opacity-50"}`,children:[e.jsx("div",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${a?"bg-primary phase-active":"bg-border"}`}),e.jsxs("div",{children:[e.jsx("span",{className:`text-sm font-semibold ${a?"text-primary":"text-muted"}`,children:r.label}),a&&e.jsx("p",{className:"text-xs text-muted mt-0.5",children:r.description})]})]},r.key)})})]})}const W={architect:"bg-primary/10 text-primary border-primary/20",developer:"bg-primary/10 text-primary border-primary/20",tester:"bg-success/10 text-success border-success/20",reviewer:"bg-warning/10 text-warning border-warning/20",planner:"bg-primary/60/20 text-ink border-primary/60/30",default:"bg-border/30 text-muted border-border/50"};function Le(t){if(!t)return W.default;const s=t.toLowerCase();for(const[n,r]of Object.entries(W))if(s.includes(n))return r;return W.default}function Te({agents:t,loading:s}){const n=(t==null?void 0:t.filter(a=>a.alive))||[],r=(t==null?void 0:t.filter(a=>!a.alive))||[];return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Agents"}),e.jsxs("span",{className:"font-mono text-xs text-muted",children:[n.length," active"]})]}),s&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading agents..."}),!s&&(t==null?void 0:t.length)===0&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No agents running"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Start a build to spawn agents"})]}),n.length>0&&e.jsx("div",{className:"space-y-2 mb-4",children:n.map(a=>e.jsx(K,{agent:a},a.id))}),r.length>0&&e.jsxs("details",{className:"mt-3",children:[e.jsxs("summary",{className:"text-xs text-muted cursor-pointer hover:text-ink transition-colors",children:[r.length," completed"]}),e.jsx("div",{className:"space-y-1.5 mt-2",children:r.slice(0,10).map(a=>e.jsx(K,{agent:a,compact:!0},a.id))})]})]})}function K({agent:t,compact:s}){const n=Le(t.type||t.name||"");return s?e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded-btn bg-hover text-xs",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-muted/30"}),e.jsx("span",{className:"font-medium text-muted truncate",children:t.name||t.id}),e.jsx("span",{className:"text-primary/60 ml-auto",children:t.type})]}):e.jsxs("div",{className:`flex items-start gap-3 px-3 py-2.5 rounded-card border ${n}`,children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${t.alive?"bg-success phase-active":"bg-muted/30"}`})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold truncate",children:t.name||t.id}),t.type&&e.jsx("span",{className:"text-xs font-mono font-medium opacity-70",children:t.type})]}),t.task&&e.jsx("p",{className:"text-xs opacity-70 mt-0.5 truncate",children:t.task}),t.status&&t.status!=="unknown"&&e.jsx("span",{className:"inline-block text-xs font-mono mt-1 opacity-60",children:t.status})]}),t.pid&&e.jsxs("span",{className:"text-xs font-mono text-muted-accessible flex-shrink-0",children:["PID ",t.pid]})]})}const Me={pass:{badge:"bg-success/10 text-success border-success/20",dot:"bg-success",label:"Pass"},fail:{badge:"bg-danger/10 text-danger border-danger/20",dot:"bg-danger",label:"Fail"},skip:{badge:"bg-muted/10 text-muted border-muted/20",dot:"bg-muted/40",label:"Skip"},pending:{badge:"bg-warning/10 text-warning border-warning/20",dot:"bg-warning",label:"Pending"}};function $e({item:t}){const[s,n]=l.useState(!1),r=Me[t.status];return e.jsxs("div",{className:`border rounded-card overflow-hidden ${r.badge}`,children:[e.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 px-3 py-2.5 text-left",onClick:()=>t.details&&n(!s),children:[e.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${r.dot}`}),e.jsx("span",{className:"text-sm font-medium flex-1 truncate",children:t.label}),e.jsx("span",{className:"text-xs font-mono font-semibold uppercase tracking-wider flex-shrink-0",children:r.label}),t.details&&e.jsx("span",{className:"text-xs text-muted/60 flex-shrink-0",children:s?"v":">"})]}),s&&t.details&&e.jsx("div",{className:"px-3 pb-2.5 pt-0",children:e.jsx("p",{className:"text-xs font-mono opacity-70 leading-relaxed",children:t.details})})]})}function Ie({checklist:t,loading:s}){const n=t&&t.total>0?t.passed/t.total*100:0;return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Quality Gates"}),t&&e.jsxs("span",{className:"font-mono text-xs text-muted",children:[t.passed,"/",t.total," passed"]})]}),s&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading gates..."}),!s&&!t&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No quality gate data"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Gates run during verification phase"})]}),t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-4 mb-3 text-xs",children:[e.jsxs("span",{className:"text-success font-medium",children:[t.passed," passed"]}),t.failed>0&&e.jsxs("span",{className:"text-danger font-medium",children:[t.failed," failed"]}),t.skipped>0&&e.jsxs("span",{className:"text-muted",children:[t.skipped," skipped"]}),t.pending>0&&e.jsxs("span",{className:"text-warning",children:[t.pending," pending"]})]}),e.jsx("div",{className:"w-full h-2 bg-charcoal/10 rounded-full overflow-hidden mb-4",children:e.jsx("div",{className:"h-full bg-success rounded-full transition-all duration-500",style:{width:`${n}%`}})}),e.jsx("div",{className:"space-y-2 max-h-[400px] overflow-y-auto terminal-scroll",children:t.items.map(r=>e.jsx($e,{item:r},r.id))})]})]})}const Ae={".py":"bg-success",".ts":"bg-primary",".tsx":"bg-primary",".md":"bg-warning",".sh":"bg-primary"};function Be(t){const s=t.substring(t.lastIndexOf("."));return Ae[s]||"bg-muted"}function De(t){return t==null?"":t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}const V=100;function X({node:t,depth:s,onSelectFile:n,selectedPath:r}){const[a,c]=l.useState(!1),[i,o]=l.useState(V),m=t.type==="directory",b=t.path===r,f=m&&a?t.children??[]:[],y=f.length>i;return e.jsxs("div",{children:[e.jsxs("button",{type:"button",className:`w-full flex items-center gap-2 px-2 py-1 rounded-btn text-left text-sm transition-colors hover:bg-hover ${b?"bg-primary/10 text-primary":"text-ink"}`,style:{paddingLeft:`${s*16+8}px`},onClick:()=>{m?(c(!a),a&&o(V)):n(t.path)},children:[m?e.jsx("span",{className:"font-mono text-xs text-muted w-3 flex-shrink-0",children:a?"v":">"}):e.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${Be(t.name)}`}),e.jsx("span",{className:`truncate ${m?"font-medium":"font-mono text-xs"}`,children:t.name}),!m&&t.size!==void 0&&e.jsx("span",{className:"ml-auto text-xs font-mono text-muted-accessible flex-shrink-0",children:De(t.size)})]}),f.length>0&&e.jsxs("div",{children:[f.slice(0,i).map(d=>e.jsx(X,{node:d,depth:s+1,onSelectFile:n,selectedPath:r},d.path)),y&&e.jsxs("button",{type:"button",className:"w-full text-left text-xs text-primary hover:text-primary/80 py-1 transition-colors",style:{paddingLeft:`${(s+1)*16+8}px`},onClick:()=>o(d=>d+V),children:["Show more (",f.length-i," remaining)"]})]})]})}function ze({files:t,loading:s}){const[n,r]=l.useState(null),[a,c]=l.useState(null),[i,o]=l.useState(!1),[m,b]=l.useState(null),f=l.useCallback(async d=>{c(null),r(d),o(!0),b(null);try{const g=await h.getFileContent(d);c(g.content)}catch(g){const j=g instanceof Error?g.message:"Unknown error",v=g instanceof TypeError||j==="Request timeout",w=j.includes("404")||j.includes("not found")||j.includes("Not found");b(v?"Network error - server may be unreachable":w?"File not found - it may have been deleted or renamed":j),c(null)}finally{o(!1)}},[]),y=l.useCallback(d=>{f(d)},[f]);return e.jsxs("div",{className:"card p-6 flex flex-col",style:{minHeight:"300px"},children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"File Browser"}),e.jsx("span",{className:"font-mono text-xs text-muted",children:".loki/"})]}),s&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading files..."}),!s&&(!t||t.length===0)&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No project files found"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Start a session to generate .loki/ state"})]}),t&&t.length>0&&e.jsxs("div",{className:"flex gap-4 flex-1 min-h-0",children:[e.jsx("div",{className:"w-1/2 overflow-y-auto terminal-scroll pr-2",children:t.map(d=>e.jsx(X,{node:d,depth:0,onSelectFile:y,selectedPath:n},d.path))}),e.jsxs("div",{className:"w-1/2 bg-charcoal/5 rounded-card p-3 overflow-hidden flex flex-col",children:[!n&&e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted text-xs",children:"Select a file to preview"}),n&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-xs font-mono text-primary mb-2 truncate",children:n}),e.jsx("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:i?e.jsx("div",{className:"text-muted text-xs",children:"Loading..."}):m?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-6",children:[e.jsx("p",{className:"text-danger text-xs font-medium",children:"Failed to load file"}),e.jsx("p",{className:"text-muted-accessible text-xs text-center max-w-[200px] break-words",children:m}),e.jsx("button",{type:"button",onClick:()=>n&&f(n),className:"mt-1 px-3 py-1 text-xs font-semibold rounded-btn border border-primary/20 text-primary hover:bg-primary/5 transition-colors",children:"Retry"})]}):e.jsx("pre",{className:"text-xs font-mono text-ink whitespace-pre-wrap break-words leading-relaxed",children:a})})]})]})]})]})}const Y=5e5;function Z(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}function Ue(t){if(!t)return"Never";try{const s=new Date(t),r=new Date().getTime()-s.getTime(),a=Math.floor(r/(1e3*60*60));return a<1?"Just now":a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}catch{return t}}function Oe({memory:t,loading:s}){const n=t?[{label:"Episodic",count:t.episodic_count,color:"text-primary",bg:"bg-primary/10",border:"border-primary/20"},{label:"Semantic",count:t.semantic_count,color:"text-success",bg:"bg-success/10",border:"border-success/20"},{label:"Skills",count:t.skill_count,color:"text-warning",bg:"bg-warning/10",border:"border-warning/20"}]:[],r=t?Math.min(t.total_tokens/Y*100,100):0;return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Memory System"}),t&&e.jsx("span",{className:"font-mono text-xs text-muted",children:Ue(t.last_consolidation)})]}),s&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading memory..."}),!s&&!t&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No memory data available"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Memory populates during autonomous runs"})]}),t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:n.map(a=>e.jsxs("div",{className:`${a.bg} border ${a.border} rounded-card p-3 text-center`,children:[e.jsx("div",{className:`text-2xl font-bold font-mono ${a.color}`,children:a.count}),e.jsx("div",{className:"text-xs text-muted-accessible font-medium mt-1 uppercase tracking-wider",children:a.label})]},a.label))}),e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-xs text-muted font-medium",children:"Token Usage"}),e.jsxs("span",{className:"text-xs font-mono text-ink",children:[Z(t.total_tokens)," / ",Z(Y)]})]}),e.jsx("div",{className:"w-full h-2 bg-charcoal/10 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${r>80?"bg-danger":r>50?"bg-warning":"bg-info"}`,style:{width:`${r}%`}})})]}),e.jsxs("div",{className:"mt-3 flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted",children:"Last Consolidation"}),e.jsx("span",{className:"font-mono text-ink",children:t.last_consolidation?new Date(t.last_consolidation).toLocaleString():"Never"})]})]})]})}function qe({visible:t}){const[s,n]=l.useState("markdown"),[r,a]=l.useState(null),[c,i]=l.useState(null),[o,m]=l.useState(!1),[b,f]=l.useState(!1),[y,d]=l.useState(null),[g,j]=l.useState(!1);if(!t)return null;const v=async()=>{m(!0),d(null),a(null),i(null);try{const x=await h.generateReport(s);a(x)}catch(x){d(x instanceof Error?x.message:"Failed to generate report")}finally{m(!1)}},w=async()=>{f(!0),d(null);try{const x=await h.shareSession();i(x)}catch(x){d(x instanceof Error?x.message:"Failed to share session")}finally{f(!1)}},k=async x=>{try{await navigator.clipboard.writeText(x),j(!0),setTimeout(()=>j(!1),2e3)}catch{}},T=()=>{if(!r)return;const x=new Blob([r.content],{type:s==="html"?"text/html":"text/markdown"}),E=URL.createObjectURL(x),N=document.createElement("a");N.href=E,N.download=`loki-report.${s==="html"?"html":"md"}`,N.click(),URL.revokeObjectURL(E)};return e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Session Report"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-1 card rounded-card p-1",children:["markdown","html"].map(x=>e.jsx("button",{onClick:()=>n(x),className:`px-3 py-1 text-xs font-semibold rounded-btn transition-all ${s===x?"bg-primary text-white shadow-sm":"text-muted hover:text-ink hover:bg-hover"}`,children:x.toUpperCase()},x))}),e.jsx("button",{onClick:v,disabled:o,className:"px-4 py-1.5 rounded-card text-xs font-semibold bg-primary text-white hover:bg-primary/90 disabled:opacity-50 transition-all",children:o?"Generating...":"Generate Report"})]})]}),y&&e.jsx("div",{className:"mb-3 px-3 py-2 rounded-btn bg-danger/10 border border-danger/20 text-danger text-xs",children:y}),r&&e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("span",{className:"text-xs text-muted",children:["Report generated (",r.format,")"]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>k(r.content),className:"px-3 py-1 text-xs font-medium text-muted hover:text-ink border border-border-light rounded-btn hover:bg-hover transition-all",children:g?"Copied":"Copy"}),e.jsx("button",{onClick:T,className:"px-3 py-1 text-xs font-medium text-muted hover:text-ink border border-border-light rounded-btn hover:bg-hover transition-all",children:"Download"}),e.jsx("button",{onClick:w,disabled:b,className:"px-3 py-1 text-xs font-medium bg-primary/10 text-primary border border-primary/20 rounded-btn hover:bg-primary/20 disabled:opacity-50 transition-all",children:b?"Sharing...":"Share as Gist"})]}),c&&e.jsxs("div",{className:"mb-2 flex items-center gap-2 px-3 py-2 rounded-btn bg-success/10 border border-success/20",children:[e.jsx("span",{className:"text-xs text-success font-medium",children:"Shared:"}),c.url?e.jsx("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary underline flex-1 truncate",children:c.url}):e.jsx("span",{className:"text-xs text-muted flex-1",children:"No URL returned"}),c.url&&e.jsx("button",{onClick:()=>k(c.url),className:"text-xs text-muted hover:text-ink",children:"Copy URL"})]}),e.jsx("pre",{className:"text-[11px] font-mono text-ink bg-black/5 rounded-card p-3 overflow-auto max-h-64 whitespace-pre-wrap terminal-scroll",children:r.content||"(empty report)"})]})]})}function J({visible:t}){const s=l.useCallback(()=>h.getMetrics(),[]),{data:n,loading:r}=I(s,15e3,t);return t?e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Session Metrics"}),r&&e.jsx("div",{className:"w-4 h-4 border-2 border-primary border-t-transparent rounded-full animate-spin"})]}),n?e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Iterations"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:n.iterations??0})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Gate Pass Rate"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:typeof n.quality_gate_pass_rate=="number"?`${n.quality_gate_pass_rate.toFixed(0)}%`:"N/A"})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Tokens Used"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:(n.tokens_used??0).toLocaleString()})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Time Elapsed"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:n.time_elapsed||"N/A"})]})]}):e.jsx("div",{className:"text-sm text-muted py-4 text-center",children:r?"Loading metrics...":"No metrics available"})]}):null}function He(t){switch(t){case"completed":case"complete":case"done":return"completed";case"in_progress":return"running";case"started":return"started";case"error":case"failed":return"failed";default:return"empty"}}const Ge={completed:"Completed",complete:"Completed",done:"Completed",in_progress:"In Progress",started:"Started",error:"Failed",failed:"Failed",empty:"Empty"};function We({onLoadSession:t}){const s=l.useCallback(()=>h.getSessionsHistory(),[]),{data:n,loading:r}=I(s,6e4,!0);return r&&!n?e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider mb-3",children:"Past Builds"}),e.jsx("div",{className:"text-sm text-muted",children:"Loading..."})]}):!n||n.length===0?null:e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider mb-3",children:"Past Builds"}),e.jsx("div",{className:"flex flex-col gap-2 max-h-64 overflow-y-auto terminal-scroll",children:n.map(a=>{const c=a.file_count;return e.jsxs("button",{onClick:()=>t==null?void 0:t(a),className:"text-left px-4 py-3 rounded-card card hover:bg-hover transition-all group cursor-pointer",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs font-mono text-muted-accessible",children:a.date}),e.jsxs("div",{className:"flex items-center gap-2",children:[c!==void 0&&c>0&&e.jsxs("span",{className:"text-xs font-mono text-muted-accessible",children:[c," files"]}),e.jsx(je,{status:He(a.status),children:Ge[a.status]||a.status})]})]}),e.jsx("div",{className:"text-xs text-ink truncate group-hover:text-primary transition-colors",children:a.prd_snippet||a.id}),e.jsx("div",{className:"text-xs font-mono text-muted-accessible mt-0.5 truncate",children:a.path})]},a.id)})})]})}function Ze(){const t=be(),[s,n]=l.useState(null),[r,a]=l.useState(()=>sessionStorage.getItem("pl_running")==="1"),[c,i]=l.useState(!1),[o,m]=l.useState(()=>sessionStorage.getItem("pl_prd")),[b,f]=l.useState(!1),[y,d]=l.useState(!1),[g,j]=l.useState(!1),[v,w]=l.useState(()=>sessionStorage.getItem("pl_tab")||"terminal"),[k,T]=l.useState(()=>sessionStorage.getItem("pl_provider")||"claude"),[x,E]=l.useState(void 0);l.useEffect(()=>{const u=sessionStorage.getItem("pl_template");u&&(sessionStorage.removeItem("pl_template"),h.getTemplateContent(u).then(({content:U})=>{U&&E(U)}).catch(()=>{}))},[]);const[N,M]=l.useState(null),[P,A]=l.useState(null),[z,_]=l.useState(null),F=l.useCallback(u=>{if(!u){M(null),A(null),_(null);return}M(u.status),A(u.agents),_(u.logs),a(u.status.running??!1),i(u.status.paused??!1)},[]),{connected:$,subscribe:O}=ge(F),B=l.useCallback(()=>h.getStatus(),[]),{data:R}=I(B,3e4,!$);l.useEffect(()=>{N===null&&R!==null&&(a(R.running??!1),i(R.paused??!1))},[R,N]),l.useEffect(()=>{sessionStorage.setItem("pl_running",r?"1":"0"),r&&f(!0)},[r]),l.useEffect(()=>{o?sessionStorage.setItem("pl_prd",o):sessionStorage.removeItem("pl_prd")},[o]),l.useEffect(()=>{sessionStorage.setItem("pl_provider",k)},[k]),l.useEffect(()=>{sessionStorage.setItem("pl_tab",v)},[v]);const q=l.useCallback(()=>h.getMemorySummary(),[]),H=l.useCallback(()=>h.getChecklist(),[]),p=l.useCallback(()=>h.getFiles(),[]),{data:L,loading:G}=I(q,3e4,r),{data:ee,loading:te}=I(H,3e4,r),{data:se,loading:ae}=I(p,3e4,r),S=N??R,re=P,ne=z,le=P===null,ie=z===null,ce=l.useCallback(async(u,U,he,fe)=>{n(null),f(!1),d(!1),w("terminal");try{await h.startSession({prd:u,provider:U,projectDir:he,mode:fe}),m(u),a(!0)}catch(Q){n(Q instanceof Error?Q.message:"Failed to start session")}},[]),oe=l.useCallback(async()=>{try{(await h.stopSession()).stopped&&(a(!1),i(!1),m(null),M(null),A(null),_(null))}catch{a(!1),i(!1),m(null)}sessionStorage.removeItem("pl_running"),sessionStorage.removeItem("pl_prd"),sessionStorage.removeItem("pl_tab")},[]),de=l.useCallback(u=>{t(`/project/${u.id}`)},[t]),xe=l.useCallback(u=>{T(u)},[]),me=l.useCallback(async()=>{try{await h.pauseSession(),i(!0)}catch{}},[]),ue=l.useCallback(async()=>{try{await h.resumeSession(),i(!1)}catch{}},[]),pe=o&&o.replace(/^#+\s*/gm,"").split(`
|
|
18
|
+
`).find(u=>u.trim().length>0)||null;return e.jsxs("div",{className:"min-h-screen bg-[#FAF9F6] relative",children:[e.jsx("div",{className:"pattern-nodes"}),e.jsx("div",{className:"max-w-[1920px] mx-auto px-6 py-6 relative z-10",children:r?e.jsxs(e.Fragment,{children:[e.jsx(C,{name:"ControlBar",children:e.jsx(Ce,{status:S,prdSummary:pe,onStop:oe,onPause:me,onResume:ue,isPaused:c})}),e.jsx("div",{className:"mt-4",children:e.jsx(C,{name:"StatusOverview",children:e.jsx(Ee,{status:S})})}),e.jsxs("div",{className:"mt-4 grid grid-cols-12 gap-6",style:{height:"calc(100vh - 340px)",minHeight:"400px"},children:[e.jsx("div",{className:"col-span-3 flex flex-col gap-6",children:e.jsx(C,{name:"PhaseVisualizer",children:e.jsx(Re,{currentPhase:(S==null?void 0:S.phase)||"idle",iteration:(S==null?void 0:S.iteration)||0})})}),e.jsxs("div",{className:"col-span-5 flex flex-col gap-0 min-h-0",children:[e.jsxs("div",{className:"flex items-center gap-1 mb-2 flex-shrink-0",children:[e.jsx("button",{onClick:()=>w("terminal"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all ${v==="terminal"?"bg-[#553DE9] text-white":"text-[#6B6960] hover:text-[#36342E] hover:bg-[#F8F4F0]"}`,children:"Terminal"}),e.jsx("button",{onClick:()=>w("metrics"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all ${v==="metrics"?"bg-[#553DE9] text-white":"text-[#6B6960] hover:text-[#36342E] hover:bg-[#F8F4F0]"}`,children:"Metrics"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(C,{name:"Terminal",children:v==="terminal"?e.jsx(we,{logs:ne,loading:ie,subscribe:O}):e.jsx(J,{visible:!0})})})]}),e.jsxs("div",{className:"col-span-4 flex flex-col gap-6 overflow-y-auto",children:[e.jsx(C,{name:"AgentDashboard",children:e.jsx(Te,{agents:re,loading:le})}),e.jsx(C,{name:"QualityGates",children:e.jsx(Ie,{checklist:ee,loading:te})})]})]}),e.jsxs("div",{className:"mt-6 grid grid-cols-12 gap-6",children:[e.jsx("div",{className:"col-span-6",children:e.jsx(C,{name:"FileBrowser",children:e.jsx(ze,{files:se,loading:ae})})}),e.jsx("div",{className:"col-span-6",children:e.jsx(C,{name:"MemoryViewer",children:e.jsx(Oe,{memory:L,loading:G})})})]})]}):e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("div",{className:"text-center mt-8 mb-8",children:[e.jsx("h2",{className:"font-heading text-h1 text-[#36342E]",children:"Describe it. Build it. Ship it."}),e.jsx("p",{className:"text-[#6B6960] mt-2 text-base max-w-lg mx-auto",children:"Paste a PRD or pick a template. Purple Lab spins up autonomous agents to build your project from scratch."})]}),e.jsx("div",{className:"w-full max-w-3xl",children:e.jsx(_e,{onSubmit:ce,running:r,error:s,provider:k,onProviderChange:xe,initialPrd:x})}),b&&!r&&e.jsxs("div",{className:"w-full max-w-3xl mt-4 flex flex-col gap-4",children:[e.jsx("button",{onClick:async()=>{try{const u=await h.getSessionsHistory();u.length>0&&t(`/project/${u[0].id}`)}catch{}},className:"w-full px-6 py-4 rounded-card text-base font-bold bg-[#553DE9] text-white hover:bg-[#553DE9]/90 transition-all shadow-lg shadow-[#553DE9]/20",children:"View Project -- Browse Files and Preview"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>d(!y),className:"px-4 py-2 rounded-card text-sm font-semibold border border-[#553DE9]/30 text-[#553DE9] hover:bg-[#553DE9]/5 transition-all",children:y?"Hide Report":"Report"}),e.jsx("button",{onClick:()=>j(!g),className:"px-4 py-2 rounded-card text-sm font-semibold border border-[#ECEAE3] text-[#6B6960] hover:text-[#36342E] hover:bg-[#F8F4F0] transition-all",children:g?"Hide Metrics":"Metrics"})]}),e.jsx(qe,{visible:y}),e.jsx(J,{visible:g})]}),e.jsx("div",{className:"w-full max-w-3xl mt-4",children:e.jsx(We,{onLoadSession:de})}),e.jsxs("div",{className:"mt-6 text-xs text-[#6B6960] flex items-center gap-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${$?"bg-[#1FC5A8]":"bg-[#C45B5B]"}`}),$?"Connected to Purple Lab backend":"Waiting for backend connection..."]})]})})]})}export{Ze as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as r,u as o,r as c,j as e}from"./index-
|
|
1
|
+
import{g as r,u as o,r as c,j as e}from"./index-1UyN_URb.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 +1 @@
|
|
|
1
|
-
import{j as e,L as t,H as s}from"./index-
|
|
1
|
+
import{j as e,L as t,H as s}from"./index-1UyN_URb.js";import{A as o}from"./arrow-left-BaOs4kgD.js";function i(){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(o,{size:14}),"Go Back"]}),e.jsxs(t,{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(s,{size:14}),"Home"]})]})]})}export{i as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var an=e=>{throw TypeError(e)};var ln=(e,t,i)=>t.has(e)||an("Cannot "+i);var ti=(e,t,i)=>(ln(e,t,"read from private field"),i?i.call(e):t.get(e)),hn=(e,t,i)=>t.has(e)?an("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),cn=(e,t,i,s)=>(ln(e,t,"write to private field"),s?s.call(e,i):t.set(e,i),i);import{c as de,r as g,W as qt,j as c,a as te,M as Ao,T as zo,X as yi,b as wl,E as hi,B as dn,S as xl,F as Oo,d as Cl,A as kl,e as ws,f as El,u as Ml}from"./index-
|
|
1
|
+
var an=e=>{throw TypeError(e)};var ln=(e,t,i)=>t.has(e)||an("Cannot "+i);var ti=(e,t,i)=>(ln(e,t,"read from private field"),i?i.call(e):t.get(e)),hn=(e,t,i)=>t.has(e)?an("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),cn=(e,t,i,s)=>(ln(e,t,"write to private field"),s?s.call(e,i):t.set(e,i),i);import{c as de,r as g,W as qt,j as c,a as te,M as Ao,T as zo,X as yi,b as wl,E as hi,B as dn,S as xl,F as Oo,d as Cl,A as kl,e as ws,f as El,u as Ml}from"./index-1UyN_URb.js";import{S as is,T as Dl,P as xs,a as Rl,E as Vi,R as Pl,C as Bl,b as Ll,c as Nl}from"./TerminalOutput-B5rIKYNW.js";import{B as Ft,P as Tl}from"./Button-DV8ro4oS.js";import{C as Al,a as zl}from"./clock-Csnz1n2_.js";import{A as Ol}from"./arrow-left-BaOs4kgD.js";import{E as Il}from"./external-link-i7ZDkWbe.js";/**
|
|
2
2
|
* @license lucide-react v0.577.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as f,u as h,r as n,a as g,j as e}from"./index-
|
|
1
|
+
import{c as f,u as h,r as n,a as g,j as e}from"./index-1UyN_URb.js";import{B as d,P as m}from"./Button-DV8ro4oS.js";import{C as j}from"./Card-B4GJw1Yl.js";import{u as y,B as b}from"./Badge-wQU9blAB.js";import"./clock-Csnz1n2_.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{r as t,a,j as e}from"./index-
|
|
1
|
+
import{r as t,a,j as e}from"./index-1UyN_URb.js";import{C as l}from"./Card-B4GJw1Yl.js";import{E as c}from"./external-link-i7ZDkWbe.js";const h=[{id:"claude",name:"Claude",description:"Anthropic Claude Code -- full features"},{id:"codex",name:"Codex",description:"OpenAI Codex CLI -- degraded mode"},{id:"gemini",name:"Gemini",description:"Google Gemini CLI -- degraded mode"}];function p(){const[i,n]=t.useState("claude"),[o,r]=t.useState(!1),[d,x]=t.useState("");t.useEffect(()=>{a.getCurrentProvider().then(s=>n(s.provider)).catch(()=>{}),a.getStatus().then(s=>x(s.version||"")).catch(()=>{})},[]);const m=async s=>{n(s),r(!0);try{await a.setProvider(s)}catch{}finally{r(!1)}};return e.jsxs("div",{className:"max-w-[800px] mx-auto px-6 py-8",children:[e.jsx("h1",{className:"font-heading text-h1 text-[#36342E] mb-8",children:"Settings"}),e.jsxs("section",{className:"mb-10",children:[e.jsx("h2",{className:"text-sm font-semibold text-[#36342E] uppercase tracking-wide mb-4",children:"Provider"}),e.jsx("div",{className:"flex flex-col gap-3",children:h.map(s=>e.jsx(l,{hover:!0,onClick:()=>m(s.id),className:i===s.id?"ring-2 ring-[#553DE9] border-[#553DE9]":"",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center flex-shrink-0 ${i===s.id?"border-[#553DE9]":"border-[#ECEAE3]"}`,children:i===s.id&&e.jsx("div",{className:"w-2 h-2 rounded-full bg-[#553DE9]"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-[#36342E]",children:s.name}),e.jsx("p",{className:"text-xs text-[#6B6960]",children:s.description})]})]})},s.id))}),o&&e.jsx("p",{className:"text-xs text-[#6B6960] mt-2",children:"Saving..."})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-sm font-semibold text-[#36342E] uppercase tracking-wide mb-4",children:"About"}),e.jsx(l,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[d&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-[#6B6960]",children:"Version"}),e.jsxs("span",{className:"text-sm font-medium text-[#36342E]",children:["v",d]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-[#6B6960]",children:"Documentation"}),e.jsxs("a",{href:"https://www.autonomi.dev/docs",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-sm text-[#553DE9] hover:underline",children:["autonomi.dev/docs ",e.jsx(c,{size:12})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-[#6B6960]",children:"GitHub"}),e.jsxs("a",{href:"https://github.com/asklokesh/loki-mode",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-sm text-[#553DE9] hover:underline",children:["asklokesh/loki-mode ",e.jsx(c,{size:12})]})]})]})})]})]})}export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as c,r,a as x,j as t}from"./index-
|
|
1
|
+
import{u as c,r,a as x,j as t}from"./index-1UyN_URb.js";import{C as p}from"./Card-B4GJw1Yl.js";import{u as d,B as h}from"./Badge-wQU9blAB.js";import"./clock-Csnz1n2_.js";const g=[{key:"all",label:"All"},{key:"website",label:"Website"},{key:"api",label:"API"},{key:"cli",label:"CLI"},{key:"bot",label:"Bot"},{key:"data",label:"Data"},{key:"other",label:"Other"}];function u(l){return l.replace(/\.md$/i,"").replace(/[-_]/g," ").replace(/\b\w/g,a=>a.toUpperCase())}function k(){const l=c(),[a,o]=r.useState("all"),n=r.useCallback(()=>x.getTemplates(),[]),{data:s}=d(n,6e4,!0),i=r.useMemo(()=>s?a==="all"?s:s.filter(e=>(e.category||"other")===a):[],[s,a]),m=e=>{sessionStorage.setItem("pl_template",e),l("/")};return t.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 py-8",children:[t.jsx("h1",{className:"font-heading text-h1 text-[#36342E] mb-6",children:"Templates"}),t.jsx("div",{className:"flex items-center gap-1 mb-6",role:"tablist",children:g.map(e=>t.jsx("button",{role:"tab","aria-selected":a===e.key,onClick:()=>o(e.key),className:`px-3 py-1.5 text-xs font-semibold rounded-[3px] transition-colors ${a===e.key?"bg-[#553DE9] text-white":"text-[#6B6960] hover:text-[#36342E] hover:bg-[#F8F4F0]"}`,children:e.label},e.key))}),s?i.length===0?t.jsx("p",{className:"text-sm text-[#6B6960] py-12 text-center",children:"No templates in this category."}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:i.map(e=>t.jsxs(p,{hover:!0,onClick:()=>m(e.filename),children:[t.jsx("div",{className:"mb-2",children:t.jsx(h,{status:"version",children:e.category||"other"})}),t.jsx("h3",{className:"text-sm font-medium text-[#36342E] mb-1",children:u(e.name)}),t.jsx("p",{className:"text-xs text-[#6B6960]",children:e.filename})]},e.filename))}):t.jsx("p",{className:"text-sm text-[#6B6960]",children:"Loading templates..."})]})}export{k as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomePage-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomePage-BrwjWs5_.js","assets/Badge-wQU9blAB.js","assets/clock-Csnz1n2_.js","assets/TerminalOutput-B5rIKYNW.js","assets/ProjectPage-CNuYm1A5.js","assets/Button-DV8ro4oS.js","assets/arrow-left-BaOs4kgD.js","assets/external-link-i7ZDkWbe.js","assets/ProjectPage-9CEnUXvW.css","assets/ProjectsPage-uJimVYlj.js","assets/Card-B4GJw1Yl.js","assets/TemplatesPage-_MJc-qGU.js","assets/SettingsPage-BiSUXmC2.js","assets/NotFoundPage-CDzHJO08.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var S0=Object.defineProperty;var b0=(i,o,r)=>o in i?S0(i,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[o]=r;var Bn=(i,o,r)=>b0(i,typeof o!="symbol"?o+"":o,r);(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))f(d);new MutationObserver(d=>{for(const h of d)if(h.type==="childList")for(const g of h.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&f(g)}).observe(document,{childList:!0,subtree:!0});function r(d){const h={};return d.integrity&&(h.integrity=d.integrity),d.referrerPolicy&&(h.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?h.credentials="include":d.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function f(d){if(d.ep)return;d.ep=!0;const h=r(d);fetch(d.href,h)}})();function E0(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Bf={exports:{}},Ln={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -183,4 +183,4 @@ Please change the parent <Route path="${B}"> to <Route path="${B==="/"?"*":`${B}
|
|
|
183
183
|
*
|
|
184
184
|
* This source code is licensed under the ISC license.
|
|
185
185
|
* See the LICENSE file in the root directory of this source tree.
|
|
186
|
-
*/const $1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Kh=Jt("x",$1),Jh=`${window.location.origin}/api`,W1=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;function F1(){const i={"Content-Type":"application/json"};try{const o=localStorage.getItem("pl_auth_token");o&&(i.Authorization=`Bearer ${o}`)}catch{}return i}async function W(i,o){const r=await fetch(`${Jh}${i}`,{...o,headers:{...F1(),...o==null?void 0:o.headers}});if(!r.ok){const f=await r.text().catch(()=>"");throw new Error(`API error ${r.status}: ${r.statusText}${f?` - ${f}`:""}`)}return r.json()}const qa={startSession:i=>W("/session/start",{method:"POST",body:JSON.stringify(i)}),stopSession:()=>W("/session/stop",{method:"POST"}),pauseSession:()=>W("/session/pause",{method:"POST"}),resumeSession:()=>W("/session/resume",{method:"POST"}),getPrdPrefill:()=>W("/session/prd-prefill"),getStatus:()=>W("/session/status"),getAgents:()=>W("/session/agents"),getLogs:(i=200)=>W(`/session/logs?lines=${i}`),getMemorySummary:()=>W("/session/memory"),getChecklist:()=>W("/session/checklist"),getFiles:()=>W("/session/files"),getFileContent:i=>W(`/session/files/content?path=${encodeURIComponent(i)}`),getSessionFileContent:(i,o)=>W(`/sessions/${encodeURIComponent(i)}/file?path=${encodeURIComponent(o)}`),getTemplates:()=>W("/templates"),getTemplateContent:i=>W(`/templates/${encodeURIComponent(i)}`),planSession:(i,o)=>W("/session/plan",{method:"POST",body:JSON.stringify({prd:i,provider:o})}),generateReport:(i="markdown")=>W("/session/report",{method:"POST",body:JSON.stringify({format:i})}),shareSession:()=>W("/session/share",{method:"POST"}),getCurrentProvider:()=>W("/provider/current"),setProvider:i=>W("/provider/set",{method:"POST",body:JSON.stringify({provider:i})}),getMetrics:()=>W("/session/metrics"),getSessionsHistory:()=>W("/sessions/history"),getSessionDetail:i=>W(`/sessions/${encodeURIComponent(i)}`),onboardRepo:i=>W("/session/onboard",{method:"POST",body:JSON.stringify({path:i})}),saveSessionFile:(i,o,r)=>W(`/sessions/${encodeURIComponent(i)}/file`,{method:"PUT",body:JSON.stringify({path:o,content:r})}),createSessionFile:(i,o,r="")=>W(`/sessions/${encodeURIComponent(i)}/file`,{method:"POST",body:JSON.stringify({path:o,content:r})}),deleteSessionFile:(i,o)=>W(`/sessions/${encodeURIComponent(i)}/file`,{method:"DELETE",body:JSON.stringify({path:o})}),createSessionDirectory:(i,o)=>W(`/sessions/${encodeURIComponent(i)}/directory`,{method:"POST",body:JSON.stringify({path:o})}),reviewProject:i=>W(`/sessions/${encodeURIComponent(i)}/review`,{method:"POST"}),testProject:i=>W(`/sessions/${encodeURIComponent(i)}/test`,{method:"POST"}),explainProject:i=>W(`/sessions/${encodeURIComponent(i)}/explain`,{method:"POST"}),exportProject:i=>W(`/sessions/${encodeURIComponent(i)}/export`,{method:"POST"}),chatMessage:(i,o,r="quick")=>W(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:o,mode:r})}),chatStart:(i,o,r="quick")=>W(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:o,mode:r})}),chatPoll:(i,o)=>W(`/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(o)}`),chatStreamUrl:(i,o)=>`${Jh}/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(o)}/stream`,chatCancel:(i,o)=>W(`/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(o)}/cancel`,{method:"POST"}),getPreviewInfo:i=>W(`/sessions/${encodeURIComponent(i)}/preview-info`),devserver:{start:(i,o)=>W(`/sessions/${encodeURIComponent(i)}/devserver/start`,{method:"POST",body:JSON.stringify({command:o||null})}),stop:i=>W(`/sessions/${encodeURIComponent(i)}/devserver/stop`,{method:"POST"}),status:i=>W(`/sessions/${encodeURIComponent(i)}/devserver/status`)},getSecrets:()=>W("/secrets"),setSecret:(i,o)=>W("/secrets",{method:"POST",body:JSON.stringify({key:i,value:o})}),deleteSecret:i=>W(`/secrets/${encodeURIComponent(i)}`,{method:"DELETE"}),getMe:()=>W("/auth/me"),getGitHubAuthUrl:()=>W("/auth/github/url"),getGoogleAuthUrl:()=>W("/auth/google/url"),githubCallback:(i,o)=>W("/auth/github/callback",{method:"POST",body:JSON.stringify({code:i,state:o})}),googleCallback:(i,o,r)=>W("/auth/google/callback",{method:"POST",body:JSON.stringify({code:i,state:o,redirect_uri:r||`${window.location.origin}${window.location.pathname}`})})};class I1{constructor(o){Bn(this,"ws",null);Bn(this,"listeners",new Map);Bn(this,"reconnectTimer",null);Bn(this,"url");this.url=o||W1}connect(){var o;((o=this.ws)==null?void 0:o.readyState)!==WebSocket.OPEN&&(this.ws=new WebSocket(this.url),this.ws.onopen=()=>{this.emit("connected",{message:"WebSocket connected"})},this.ws.onmessage=r=>{try{const f=JSON.parse(r.data);this.emit(f.type,f.data||f)}catch{}},this.ws.onclose=()=>{this.emit("disconnected",{}),this.scheduleReconnect()},this.ws.onerror=()=>{var r;(r=this.ws)==null||r.close()})}scheduleReconnect(){this.reconnectTimer||(this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},3e3))}on(o,r){return this.listeners.has(o)||this.listeners.set(o,new Set),this.listeners.get(o).add(r),()=>{var f;return(f=this.listeners.get(o))==null?void 0:f.delete(r)}}emit(o,r){var f,d;(f=this.listeners.get(o))==null||f.forEach(h=>h(r)),(d=this.listeners.get("*"))==null||d.forEach(h=>h({type:o,data:r}))}send(o){var r;((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify(o))}disconnect(){var o;this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(o=this.ws)==null||o.close(),this.ws=null}}const Vf="pl_auth_token",kh=E.createContext({user:null,loading:!0,login:()=>{},logout:()=>{},isLocalMode:!0});function P1(i,o,r){o(!1),r({email:i.sub||i.email||"",name:i.name||"",avatar_url:i.avatar||"",authenticated:!0})}function tg({children:i}){const[o,r]=E.useState(null),[f,d]=E.useState(!0),[h,g]=E.useState(!0),_=Ff(),S=je();E.useEffect(()=>{let j=!1;async function w(){const Z=new URLSearchParams(window.location.search),Y=Z.get("token"),G=Z.get("code");if(Y)localStorage.setItem(Vf,Y),window.history.replaceState({},"",window.location.pathname);else if(G)try{const B=sessionStorage.getItem("pl_oauth_provider")||"github",F=sessionStorage.getItem("pl_oauth_state")||"";sessionStorage.removeItem("pl_oauth_state"),sessionStorage.removeItem("pl_oauth_provider");let K;if(B==="google"?K=await qa.googleCallback(G,F):K=await qa.githubCallback(G,F),!j){localStorage.setItem(Vf,K.token),window.history.replaceState({},"",window.location.pathname),g(!1),r({email:K.user.email,name:K.user.name,avatar_url:K.user.avatar_url,authenticated:!0}),d(!1);return}}catch{window.history.replaceState({},"",window.location.pathname)}try{const B=await qa.getMe();if(j)return;B.local_mode?(g(!0),r(null)):B.authenticated?P1(B,g,r):(g(!1),r(null))}catch{if(j)return;g(!0),r(null)}finally{j||d(!1)}}return w(),()=>{j=!0}},[]);const y=E.useCallback(j=>{j==="github"?qa.getGitHubAuthUrl().then(w=>{try{const Y=new URL(w.url).searchParams.get("state");Y&&(sessionStorage.setItem("pl_oauth_state",Y),sessionStorage.setItem("pl_oauth_provider","github"))}catch{}window.location.href=w.url}).catch(()=>{}):j==="google"&&qa.getGoogleAuthUrl().then(w=>{try{const Y=new URL(w.url).searchParams.get("state");Y&&(sessionStorage.setItem("pl_oauth_state",Y),sessionStorage.setItem("pl_oauth_provider","google"))}catch{}window.location.href=w.url}).catch(()=>{})},[]),M=E.useCallback(()=>{localStorage.removeItem(Vf),r(null),S.pathname!=="/login"&&_("/login",{replace:!0})},[_,S.pathname]),z=E.useMemo(()=>({user:o,loading:f,login:y,logout:M,isLocalMode:h}),[o,f,y,M,h]);return O.jsx(kh.Provider,{value:z,children:i})}function $h(){return E.useContext(kh)}const Th="pl_sidebar_collapsed",eg=[{to:"/",label:"Home",icon:N1},{to:"/projects",label:"Projects",icon:M1},{to:"/templates",label:"Templates",icon:U1}],lg=[{to:"/settings",label:"Settings",icon:Vh}];function ag(){const[i,o]=E.useState(typeof window<"u"?window.innerWidth<768:!1);return E.useEffect(()=>{const r=()=>o(window.innerWidth<768);return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),i}function ng({wsConnected:i,version:o}){const r=ag(),f=je(),[d,h]=E.useState(!1),[g,_]=E.useState(()=>{try{return localStorage.getItem(Th)==="1"}catch{return!1}});E.useEffect(()=>{try{localStorage.setItem(Th,g?"1":"0")}catch{}},[g]),E.useEffect(()=>{r&&h(!1)},[f.pathname,r]);const S=r?d:!g,y=S?240:64,M=j=>["flex items-center gap-3 px-3 py-2 text-sm transition-colors rounded-[5px]",!S&&"justify-center",j?"bg-[#553DE9]/8 text-[#553DE9] font-medium border-l-2 border-[#553DE9]":"text-[#36342E] hover:bg-[#F8F4F0]"].filter(Boolean).join(" "),z=O.jsxs("aside",{className:"flex flex-col h-full border-r border-[#ECEAE3] bg-white transition-[width] duration-200",style:{width:y,minWidth:y},children:[O.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-b border-[#ECEAE3]",children:[S&&O.jsxs("div",{className:"flex flex-col",children:[O.jsx("span",{className:"font-heading text-lg font-bold leading-tight text-[#36342E]",children:"Purple Lab"}),O.jsx("span",{className:"text-xs text-[#6B6960]",children:"Powered by Loki"})]}),r?O.jsx("button",{type:"button","aria-label":d?"Close menu":"Open menu",title:d?"Close menu":"Open menu",onClick:()=>h(!d),className:"inline-flex items-center justify-center w-7 h-7 rounded-[3px] text-[#939084] hover:bg-[#F8F4F0] transition-colors",children:d?O.jsx(Kh,{size:16}):O.jsx(L1,{size:16})}):O.jsx("button",{type:"button","aria-label":g?"Expand sidebar":"Collapse sidebar",title:g?"Expand sidebar":"Collapse sidebar",onClick:()=>_(!g),className:"inline-flex items-center justify-center w-7 h-7 rounded-[3px] text-[#939084] hover:bg-[#F8F4F0] transition-colors",children:g?O.jsx(V1,{size:16}):O.jsx(Q1,{size:16})})]}),O.jsxs("nav",{className:"flex-1 px-2 py-3 flex flex-col gap-1","aria-label":"Main navigation",children:[eg.map(j=>O.jsxs(di,{to:j.to,end:j.to==="/",className:({isActive:w})=>M(w),title:S?void 0:j.label,children:[O.jsx(j.icon,{size:18}),S&&O.jsx("span",{children:j.label})]},j.to)),O.jsx("div",{className:"my-2 border-t border-[#ECEAE3]"}),lg.map(j=>O.jsxs(di,{to:j.to,className:({isActive:w})=>M(w),title:S?void 0:j.label,children:[O.jsx(j.icon,{size:18}),S&&O.jsx("span",{children:j.label})]},j.to))]}),O.jsxs("div",{className:"px-3 py-3 border-t border-[#ECEAE3] flex flex-col gap-2",children:[O.jsx(ug,{collapsed:!S}),O.jsxs("div",{className:["flex items-center gap-2 text-xs",!S&&"justify-center"].filter(Boolean).join(" "),children:[O.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${i?"bg-[#1FC5A8]":"bg-[#C45B5B]"}`}),S&&O.jsx("span",{className:"text-[#6B6960]",children:i?"Connected":"Disconnected"})]}),S&&o&&O.jsxs("span",{className:"text-xs text-[#6B6960]",children:["v",o]}),O.jsxs("a",{href:"https://www.autonomi.dev/docs",target:"_blank",rel:"noopener noreferrer",className:["flex items-center gap-2 text-xs text-[#6B6960] hover:text-[#36342E] transition-colors",!S&&"justify-center"].filter(Boolean).join(" "),title:S?void 0:"Documentation",children:[O.jsx(E1,{size:14}),S&&O.jsx("span",{children:"Docs"})]})]})]});return r&&d?O.jsxs(O.Fragment,{children:[O.jsx("div",{className:"fixed inset-0 z-40 bg-ink/20",onClick:()=>h(!1)}),O.jsx("div",{className:"fixed inset-y-0 left-0 z-50",children:z})]}):z}function ug({collapsed:i}){const{user:o,logout:r,isLocalMode:f}=$h(),[d,h]=E.useState(!1),g=E.useRef(null);return E.useEffect(()=>{function _(S){g.current&&!g.current.contains(S.target)&&h(!1)}if(d)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[d]),f||!o?O.jsxs("div",{className:["flex items-center gap-2 text-xs",i&&"justify-center"].filter(Boolean).join(" "),title:i?"Local Mode":void 0,children:[O.jsx(G1,{size:14,className:"text-[#939084] flex-shrink-0"}),!i&&O.jsx("span",{className:"text-[#939084]",children:"Local Mode"})]}):O.jsxs("div",{className:"relative",ref:g,"data-testid":"user-section",children:[O.jsxs("button",{type:"button",onClick:()=>h(!d),className:["flex items-center gap-2 w-full text-left text-xs rounded-[3px] py-1 px-1 hover:bg-[#F8F4F0] transition-colors",i&&"justify-center"].filter(Boolean).join(" "),title:i?o.name||o.email:void 0,children:[o.avatar_url?O.jsx("img",{src:o.avatar_url,alt:"",className:"w-5 h-5 rounded-full flex-shrink-0"}):O.jsx("div",{className:"w-5 h-5 rounded-full bg-[#553DE9] flex items-center justify-center text-white text-[10px] font-bold flex-shrink-0",children:(o.name||o.email||"?")[0].toUpperCase()}),!i&&O.jsxs(O.Fragment,{children:[O.jsx("span",{className:"text-[#36342E] truncate flex-1",children:o.name||o.email}),O.jsx(T1,{size:12,className:`text-[#939084] transition-transform ${d?"":"rotate-180"}`})]})]}),d&&O.jsxs("div",{className:"absolute bottom-full left-0 mb-1 w-48 bg-white border border-[#ECEAE3] rounded-lg shadow-lg py-1 z-50",children:[O.jsxs("div",{className:"px-3 py-2 border-b border-[#ECEAE3]",children:[O.jsx("p",{className:"text-xs font-medium text-[#36342E] truncate",children:o.name}),O.jsx("p",{className:"text-xs text-[#939084] truncate",children:o.email})]}),O.jsxs(di,{to:"/settings",onClick:()=>h(!1),className:"flex items-center gap-2 px-3 py-2 text-xs text-[#36342E] hover:bg-[#F8F4F0] transition-colors",children:[O.jsx(Vh,{size:14}),"Settings"]}),O.jsxs("button",{type:"button",onClick:()=>{h(!1),r()},className:"flex items-center gap-2 px-3 py-2 text-xs text-[#C45B5B] hover:bg-[#F8F4F0] transition-colors w-full text-left",children:[O.jsx(H1,{size:14}),"Sign out"]})]})]})}const zh="pl_onboarding_complete",wn=[{icon:R1,title:"Write your PRD",description:"Describe what you want to build, or choose a template to get started quickly."},{icon:k1,title:"Use the terminal",description:"Run commands directly in the integrated terminal to install dependencies or debug."},{icon:_1,title:"Preview in real-time",description:"Switch to the Preview tab to see your app running with live reload."},{icon:Y1,title:"Iterate with AI Chat",description:"Ask the AI to modify, fix, or explain your code in the chat panel."}];function ig(){const[i,o]=E.useState(!1),[r,f]=E.useState(0);E.useEffect(()=>{try{localStorage.getItem(zh)!=="1"&&o(!0)}catch{}},[]);const d=()=>{o(!1);try{localStorage.setItem(zh,"1")}catch{}},h=()=>{r<wn.length-1?f(r+1):d()};if(!i)return null;const g=wn[r],_=g.icon;return O.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/30",children:O.jsxs("div",{className:"bg-card rounded-card shadow-card-hover border border-border w-full max-w-sm mx-4",children:[O.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-2",children:[O.jsxs("span",{className:"text-[11px] font-mono text-muted-accessible",children:[r+1," / ",wn.length]}),O.jsx("button",{onClick:d,className:"text-muted hover:text-ink transition-colors p-1 rounded-btn hover:bg-hover",title:"Skip onboarding",children:O.jsx(Kh,{size:14})})]}),O.jsxs("div",{className:"px-5 pb-4 text-center",children:[O.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-4",children:O.jsx(_,{size:24,className:"text-primary"})}),O.jsx("h3",{className:"text-sm font-heading font-bold text-ink mb-1",children:g.title}),O.jsx("p",{className:"text-xs text-muted-accessible leading-relaxed",children:g.description})]}),O.jsx("div",{className:"flex items-center justify-center gap-1.5 pb-4",children:wn.map((S,y)=>O.jsx("div",{className:`w-1.5 h-1.5 rounded-full transition-colors ${y===r?"bg-primary":"bg-border"}`},y))}),O.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-t border-border",children:[O.jsx("button",{onClick:d,className:"text-xs text-muted hover:text-ink transition-colors",children:"Skip"}),O.jsx("button",{onClick:h,className:"inline-flex items-center gap-1.5 px-4 py-1.5 text-xs font-medium rounded-btn bg-primary text-white hover:bg-primary-hover transition-colors",children:r<wn.length-1?O.jsxs(O.Fragment,{children:["Next",O.jsx(S1,{size:12})]}):"Get Started"})]})]})})}function cg(i){const[o,r]=E.useState(!1),f=E.useRef(null),d=E.useRef(i);E.useEffect(()=>{d.current=i},[i]),E.useEffect(()=>{const g=new I1;return f.current=g,g.on("connected",()=>r(!0)),g.on("disconnected",()=>{r(!1),d.current&&d.current(null)}),g.on("state_update",_=>{d.current&&_&&typeof _=="object"&&d.current(_)}),g.connect(),()=>{g.disconnect(),f.current=null}},[]);const h=E.useCallback((g,_)=>{var S;return((S=f.current)==null?void 0:S.on(g,_))||(()=>{})},[]);return{connected:o,subscribe:h}}function fg(){const[i,o]=E.useState(""),{connected:r}=cg(()=>{});return E.useEffect(()=>{qa.getStatus().then(f=>{o(f.version||"")}).catch(()=>{})},[]),O.jsxs("div",{className:"flex h-screen bg-[#FAF9F6]",children:[O.jsx(ig,{}),O.jsx("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:absolute focus:z-50 focus:top-2 focus:left-2 focus:px-4 focus:py-2 focus:bg-white focus:text-[#553DE9] focus:rounded-[3px] focus:shadow-card",children:"Skip to main content"}),O.jsx(ng,{wsConnected:r,version:i}),O.jsx("main",{id:"main-content",className:"flex-1 overflow-auto",children:O.jsx(Cv,{})})]})}function _h({children:i}){const{user:o,loading:r,isLocalMode:f}=$h();return r?O.jsx("div",{className:"h-screen bg-[#FAF9F6] flex items-center justify-center text-[#6B6960] text-sm",children:"Loading..."}):f?O.jsx(O.Fragment,{children:i}):o?O.jsx(O.Fragment,{children:i}):O.jsx(Mv,{to:"/login",replace:!0})}function hi({variant:i="text",width:o,height:r,className:f=""}){const d="animate-pulse bg-[#ECEAE3]/60 rounded";if(i==="circle"){const h=o||"2rem";return O.jsx("div",{className:`${d} rounded-full flex-shrink-0 ${f}`,style:{width:h,height:h}})}return i==="block"?O.jsx("div",{className:`${d} rounded-btn ${f}`,style:{width:o||"100%",height:r||"4rem"}}):O.jsx("div",{className:`${d} rounded-btn ${f}`,style:{width:o||"100%",height:r||"0.75rem"}})}function bg(){return O.jsx("div",{className:"p-4 space-y-3",children:[...Array(12)].map((i,o)=>O.jsxs("div",{className:"flex items-center gap-3",children:[O.jsx(hi,{variant:"text",width:"1.5rem",height:"10px",className:"flex-shrink-0 opacity-40"}),O.jsx(hi,{variant:"text",width:`${20+Math.random()*60}%`,height:"10px"})]},o))})}const og=E.lazy(()=>Pl(()=>import("./HomePage-YNmSv1D1.js"),__vite__mapDeps([0,1,2,3]))),sg=E.lazy(()=>Pl(()=>import("./ProjectPage-BnDAAUIO.js"),__vite__mapDeps([4,3,5,2,6,7,8]))),rg=E.lazy(()=>Pl(()=>import("./ProjectsPage-CU3RDQw8.js"),__vite__mapDeps([9,5,10,1,2]))),dg=E.lazy(()=>Pl(()=>import("./TemplatesPage-u9bIAvZ4.js"),__vite__mapDeps([11,10,1,2]))),hg=E.lazy(()=>Pl(()=>import("./SettingsPage-BlEJ08Gv.js"),__vite__mapDeps([12,10,7]))),mg=E.lazy(()=>Pl(()=>import("./LoginPage-DxTWjVbY.js"),[])),yg=E.lazy(()=>Pl(()=>import("./NotFoundPage-BCVkrGqA.js"),__vite__mapDeps([13,6])));function Il(){return O.jsxs("div",{className:"h-screen bg-[#FAF9F6] flex flex-col items-center justify-center gap-3",children:[O.jsx(hi,{variant:"block",width:"200px",height:"24px"}),O.jsx(hi,{variant:"text",width:"140px",height:"12px",className:"opacity-50"})]})}function vg(){return O.jsx(tg,{children:O.jsxs(Dv,{children:[O.jsx(il,{path:"/login",element:O.jsx(E.Suspense,{fallback:O.jsx(Il,{}),children:O.jsx(mg,{})})}),O.jsx(il,{path:"/project/:sessionId",element:O.jsx(_h,{children:O.jsx(E.Suspense,{fallback:O.jsx(Il,{}),children:O.jsx(sg,{})})})}),O.jsxs(il,{element:O.jsx(_h,{children:O.jsx(fg,{})}),children:[O.jsx(il,{path:"/",element:O.jsx(E.Suspense,{fallback:O.jsx(Il,{}),children:O.jsx(og,{})})}),O.jsx(il,{path:"/projects",element:O.jsx(E.Suspense,{fallback:O.jsx(Il,{}),children:O.jsx(rg,{})})}),O.jsx(il,{path:"/templates",element:O.jsx(E.Suspense,{fallback:O.jsx(Il,{}),children:O.jsx(dg,{})})}),O.jsx(il,{path:"/settings",element:O.jsx(E.Suspense,{fallback:O.jsx(Il,{}),children:O.jsx(hg,{})})}),O.jsx(il,{path:"*",element:O.jsx(E.Suspense,{fallback:O.jsx(Il,{}),children:O.jsx(yg,{})})})]})]})})}N0.createRoot(document.getElementById("root")).render(O.jsx(E.StrictMode,{children:O.jsx(l1,{children:O.jsx(vg,{})})}));export{S1 as A,E1 as B,_1 as E,R1 as F,N1 as H,Xh as L,Y1 as M,Vh as S,k1 as T,pg as W,Kh as X,qa as a,cg as b,Jt as c,bg as d,hi as e,Sg as f,$h as g,O as j,E as r,Ff as u};
|
|
186
|
+
*/const $1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Kh=Jt("x",$1),Jh=`${window.location.origin}/api`,W1=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;function F1(){const i={"Content-Type":"application/json"};try{const o=localStorage.getItem("pl_auth_token");o&&(i.Authorization=`Bearer ${o}`)}catch{}return i}async function W(i,o){const r=await fetch(`${Jh}${i}`,{...o,headers:{...F1(),...o==null?void 0:o.headers}});if(!r.ok){const f=await r.text().catch(()=>"");throw new Error(`API error ${r.status}: ${r.statusText}${f?` - ${f}`:""}`)}return r.json()}const qa={startSession:i=>W("/session/start",{method:"POST",body:JSON.stringify(i)}),stopSession:()=>W("/session/stop",{method:"POST"}),pauseSession:()=>W("/session/pause",{method:"POST"}),resumeSession:()=>W("/session/resume",{method:"POST"}),getPrdPrefill:()=>W("/session/prd-prefill"),getStatus:()=>W("/session/status"),getAgents:()=>W("/session/agents"),getLogs:(i=200)=>W(`/session/logs?lines=${i}`),getMemorySummary:()=>W("/session/memory"),getChecklist:()=>W("/session/checklist"),getFiles:()=>W("/session/files"),getFileContent:i=>W(`/session/files/content?path=${encodeURIComponent(i)}`),getSessionFileContent:(i,o)=>W(`/sessions/${encodeURIComponent(i)}/file?path=${encodeURIComponent(o)}`),getTemplates:()=>W("/templates"),getTemplateContent:i=>W(`/templates/${encodeURIComponent(i)}`),planSession:(i,o)=>W("/session/plan",{method:"POST",body:JSON.stringify({prd:i,provider:o})}),generateReport:(i="markdown")=>W("/session/report",{method:"POST",body:JSON.stringify({format:i})}),shareSession:()=>W("/session/share",{method:"POST"}),getCurrentProvider:()=>W("/provider/current"),setProvider:i=>W("/provider/set",{method:"POST",body:JSON.stringify({provider:i})}),getMetrics:()=>W("/session/metrics"),getSessionsHistory:()=>W("/sessions/history"),getSessionDetail:i=>W(`/sessions/${encodeURIComponent(i)}`),onboardRepo:i=>W("/session/onboard",{method:"POST",body:JSON.stringify({path:i})}),saveSessionFile:(i,o,r)=>W(`/sessions/${encodeURIComponent(i)}/file`,{method:"PUT",body:JSON.stringify({path:o,content:r})}),createSessionFile:(i,o,r="")=>W(`/sessions/${encodeURIComponent(i)}/file`,{method:"POST",body:JSON.stringify({path:o,content:r})}),deleteSessionFile:(i,o)=>W(`/sessions/${encodeURIComponent(i)}/file`,{method:"DELETE",body:JSON.stringify({path:o})}),createSessionDirectory:(i,o)=>W(`/sessions/${encodeURIComponent(i)}/directory`,{method:"POST",body:JSON.stringify({path:o})}),reviewProject:i=>W(`/sessions/${encodeURIComponent(i)}/review`,{method:"POST"}),testProject:i=>W(`/sessions/${encodeURIComponent(i)}/test`,{method:"POST"}),explainProject:i=>W(`/sessions/${encodeURIComponent(i)}/explain`,{method:"POST"}),exportProject:i=>W(`/sessions/${encodeURIComponent(i)}/export`,{method:"POST"}),chatMessage:(i,o,r="quick")=>W(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:o,mode:r})}),chatStart:(i,o,r="quick")=>W(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:o,mode:r})}),chatPoll:(i,o)=>W(`/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(o)}`),chatStreamUrl:(i,o)=>`${Jh}/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(o)}/stream`,chatCancel:(i,o)=>W(`/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(o)}/cancel`,{method:"POST"}),getPreviewInfo:i=>W(`/sessions/${encodeURIComponent(i)}/preview-info`),devserver:{start:(i,o)=>W(`/sessions/${encodeURIComponent(i)}/devserver/start`,{method:"POST",body:JSON.stringify({command:o||null})}),stop:i=>W(`/sessions/${encodeURIComponent(i)}/devserver/stop`,{method:"POST"}),status:i=>W(`/sessions/${encodeURIComponent(i)}/devserver/status`)},getSecrets:()=>W("/secrets"),setSecret:(i,o)=>W("/secrets",{method:"POST",body:JSON.stringify({key:i,value:o})}),deleteSecret:i=>W(`/secrets/${encodeURIComponent(i)}`,{method:"DELETE"}),getMe:()=>W("/auth/me"),getGitHubAuthUrl:()=>W("/auth/github/url"),getGoogleAuthUrl:()=>W("/auth/google/url"),githubCallback:(i,o)=>W("/auth/github/callback",{method:"POST",body:JSON.stringify({code:i,state:o})}),googleCallback:(i,o,r)=>W("/auth/google/callback",{method:"POST",body:JSON.stringify({code:i,state:o,redirect_uri:r||`${window.location.origin}${window.location.pathname}`})})};class I1{constructor(o){Bn(this,"ws",null);Bn(this,"listeners",new Map);Bn(this,"reconnectTimer",null);Bn(this,"url");this.url=o||W1}connect(){var o;((o=this.ws)==null?void 0:o.readyState)!==WebSocket.OPEN&&(this.ws=new WebSocket(this.url),this.ws.onopen=()=>{this.emit("connected",{message:"WebSocket connected"})},this.ws.onmessage=r=>{try{const f=JSON.parse(r.data);this.emit(f.type,f.data||f)}catch{}},this.ws.onclose=()=>{this.emit("disconnected",{}),this.scheduleReconnect()},this.ws.onerror=()=>{var r;(r=this.ws)==null||r.close()})}scheduleReconnect(){this.reconnectTimer||(this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},3e3))}on(o,r){return this.listeners.has(o)||this.listeners.set(o,new Set),this.listeners.get(o).add(r),()=>{var f;return(f=this.listeners.get(o))==null?void 0:f.delete(r)}}emit(o,r){var f,d;(f=this.listeners.get(o))==null||f.forEach(h=>h(r)),(d=this.listeners.get("*"))==null||d.forEach(h=>h({type:o,data:r}))}send(o){var r;((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify(o))}disconnect(){var o;this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(o=this.ws)==null||o.close(),this.ws=null}}const Vf="pl_auth_token",kh=E.createContext({user:null,loading:!0,login:()=>{},logout:()=>{},isLocalMode:!0});function P1(i,o,r){o(!1),r({email:i.sub||i.email||"",name:i.name||"",avatar_url:i.avatar||"",authenticated:!0})}function tg({children:i}){const[o,r]=E.useState(null),[f,d]=E.useState(!0),[h,g]=E.useState(!0),_=Ff(),S=je();E.useEffect(()=>{let j=!1;async function w(){const Z=new URLSearchParams(window.location.search),Y=Z.get("token"),G=Z.get("code");if(Y)localStorage.setItem(Vf,Y),window.history.replaceState({},"",window.location.pathname);else if(G)try{const B=sessionStorage.getItem("pl_oauth_provider")||"github",F=sessionStorage.getItem("pl_oauth_state")||"";sessionStorage.removeItem("pl_oauth_state"),sessionStorage.removeItem("pl_oauth_provider");let K;if(B==="google"?K=await qa.googleCallback(G,F):K=await qa.githubCallback(G,F),!j){localStorage.setItem(Vf,K.token),window.history.replaceState({},"",window.location.pathname),g(!1),r({email:K.user.email,name:K.user.name,avatar_url:K.user.avatar_url,authenticated:!0}),d(!1);return}}catch{window.history.replaceState({},"",window.location.pathname)}try{const B=await qa.getMe();if(j)return;B.local_mode?(g(!0),r(null)):B.authenticated?P1(B,g,r):(g(!1),r(null))}catch{if(j)return;g(!0),r(null)}finally{j||d(!1)}}return w(),()=>{j=!0}},[]);const y=E.useCallback(j=>{j==="github"?qa.getGitHubAuthUrl().then(w=>{try{const Y=new URL(w.url).searchParams.get("state");Y&&(sessionStorage.setItem("pl_oauth_state",Y),sessionStorage.setItem("pl_oauth_provider","github"))}catch{}window.location.href=w.url}).catch(()=>{}):j==="google"&&qa.getGoogleAuthUrl().then(w=>{try{const Y=new URL(w.url).searchParams.get("state");Y&&(sessionStorage.setItem("pl_oauth_state",Y),sessionStorage.setItem("pl_oauth_provider","google"))}catch{}window.location.href=w.url}).catch(()=>{})},[]),M=E.useCallback(()=>{localStorage.removeItem(Vf),r(null),S.pathname!=="/login"&&_("/login",{replace:!0})},[_,S.pathname]),z=E.useMemo(()=>({user:o,loading:f,login:y,logout:M,isLocalMode:h}),[o,f,y,M,h]);return O.jsx(kh.Provider,{value:z,children:i})}function $h(){return E.useContext(kh)}const Th="pl_sidebar_collapsed",eg=[{to:"/",label:"Home",icon:N1},{to:"/projects",label:"Projects",icon:M1},{to:"/templates",label:"Templates",icon:U1}],lg=[{to:"/settings",label:"Settings",icon:Vh}];function ag(){const[i,o]=E.useState(typeof window<"u"?window.innerWidth<768:!1);return E.useEffect(()=>{const r=()=>o(window.innerWidth<768);return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),i}function ng({wsConnected:i,version:o}){const r=ag(),f=je(),[d,h]=E.useState(!1),[g,_]=E.useState(()=>{try{return localStorage.getItem(Th)==="1"}catch{return!1}});E.useEffect(()=>{try{localStorage.setItem(Th,g?"1":"0")}catch{}},[g]),E.useEffect(()=>{r&&h(!1)},[f.pathname,r]);const S=r?d:!g,y=S?240:64,M=j=>["flex items-center gap-3 px-3 py-2 text-sm transition-colors rounded-[5px]",!S&&"justify-center",j?"bg-[#553DE9]/8 text-[#553DE9] font-medium border-l-2 border-[#553DE9]":"text-[#36342E] hover:bg-[#F8F4F0]"].filter(Boolean).join(" "),z=O.jsxs("aside",{className:"flex flex-col h-full border-r border-[#ECEAE3] bg-white transition-[width] duration-200",style:{width:y,minWidth:y},children:[O.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-b border-[#ECEAE3]",children:[S&&O.jsxs("div",{className:"flex flex-col",children:[O.jsx("span",{className:"font-heading text-lg font-bold leading-tight text-[#36342E]",children:"Purple Lab"}),O.jsx("span",{className:"text-xs text-[#6B6960]",children:"Powered by Loki"})]}),r?O.jsx("button",{type:"button","aria-label":d?"Close menu":"Open menu",title:d?"Close menu":"Open menu",onClick:()=>h(!d),className:"inline-flex items-center justify-center w-7 h-7 rounded-[3px] text-[#939084] hover:bg-[#F8F4F0] transition-colors",children:d?O.jsx(Kh,{size:16}):O.jsx(L1,{size:16})}):O.jsx("button",{type:"button","aria-label":g?"Expand sidebar":"Collapse sidebar",title:g?"Expand sidebar":"Collapse sidebar",onClick:()=>_(!g),className:"inline-flex items-center justify-center w-7 h-7 rounded-[3px] text-[#939084] hover:bg-[#F8F4F0] transition-colors",children:g?O.jsx(V1,{size:16}):O.jsx(Q1,{size:16})})]}),O.jsxs("nav",{className:"flex-1 px-2 py-3 flex flex-col gap-1","aria-label":"Main navigation",children:[eg.map(j=>O.jsxs(di,{to:j.to,end:j.to==="/",className:({isActive:w})=>M(w),title:S?void 0:j.label,children:[O.jsx(j.icon,{size:18}),S&&O.jsx("span",{children:j.label})]},j.to)),O.jsx("div",{className:"my-2 border-t border-[#ECEAE3]"}),lg.map(j=>O.jsxs(di,{to:j.to,className:({isActive:w})=>M(w),title:S?void 0:j.label,children:[O.jsx(j.icon,{size:18}),S&&O.jsx("span",{children:j.label})]},j.to))]}),O.jsxs("div",{className:"px-3 py-3 border-t border-[#ECEAE3] flex flex-col gap-2",children:[O.jsx(ug,{collapsed:!S}),O.jsxs("div",{className:["flex items-center gap-2 text-xs",!S&&"justify-center"].filter(Boolean).join(" "),children:[O.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${i?"bg-[#1FC5A8]":"bg-[#C45B5B]"}`}),S&&O.jsx("span",{className:"text-[#6B6960]",children:i?"Connected":"Disconnected"})]}),S&&o&&O.jsxs("span",{className:"text-xs text-[#6B6960]",children:["v",o]}),O.jsxs("a",{href:"https://www.autonomi.dev/docs",target:"_blank",rel:"noopener noreferrer",className:["flex items-center gap-2 text-xs text-[#6B6960] hover:text-[#36342E] transition-colors",!S&&"justify-center"].filter(Boolean).join(" "),title:S?void 0:"Documentation",children:[O.jsx(E1,{size:14}),S&&O.jsx("span",{children:"Docs"})]})]})]});return r&&d?O.jsxs(O.Fragment,{children:[O.jsx("div",{className:"fixed inset-0 z-40 bg-ink/20",onClick:()=>h(!1)}),O.jsx("div",{className:"fixed inset-y-0 left-0 z-50",children:z})]}):z}function ug({collapsed:i}){const{user:o,logout:r,isLocalMode:f}=$h(),[d,h]=E.useState(!1),g=E.useRef(null);return E.useEffect(()=>{function _(S){g.current&&!g.current.contains(S.target)&&h(!1)}if(d)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[d]),f||!o?O.jsxs("div",{className:["flex items-center gap-2 text-xs",i&&"justify-center"].filter(Boolean).join(" "),title:i?"Local Mode":void 0,children:[O.jsx(G1,{size:14,className:"text-[#939084] flex-shrink-0"}),!i&&O.jsx("span",{className:"text-[#939084]",children:"Local Mode"})]}):O.jsxs("div",{className:"relative",ref:g,"data-testid":"user-section",children:[O.jsxs("button",{type:"button",onClick:()=>h(!d),className:["flex items-center gap-2 w-full text-left text-xs rounded-[3px] py-1 px-1 hover:bg-[#F8F4F0] transition-colors",i&&"justify-center"].filter(Boolean).join(" "),title:i?o.name||o.email:void 0,children:[o.avatar_url?O.jsx("img",{src:o.avatar_url,alt:"",className:"w-5 h-5 rounded-full flex-shrink-0"}):O.jsx("div",{className:"w-5 h-5 rounded-full bg-[#553DE9] flex items-center justify-center text-white text-[10px] font-bold flex-shrink-0",children:(o.name||o.email||"?")[0].toUpperCase()}),!i&&O.jsxs(O.Fragment,{children:[O.jsx("span",{className:"text-[#36342E] truncate flex-1",children:o.name||o.email}),O.jsx(T1,{size:12,className:`text-[#939084] transition-transform ${d?"":"rotate-180"}`})]})]}),d&&O.jsxs("div",{className:"absolute bottom-full left-0 mb-1 w-48 bg-white border border-[#ECEAE3] rounded-lg shadow-lg py-1 z-50",children:[O.jsxs("div",{className:"px-3 py-2 border-b border-[#ECEAE3]",children:[O.jsx("p",{className:"text-xs font-medium text-[#36342E] truncate",children:o.name}),O.jsx("p",{className:"text-xs text-[#939084] truncate",children:o.email})]}),O.jsxs(di,{to:"/settings",onClick:()=>h(!1),className:"flex items-center gap-2 px-3 py-2 text-xs text-[#36342E] hover:bg-[#F8F4F0] transition-colors",children:[O.jsx(Vh,{size:14}),"Settings"]}),O.jsxs("button",{type:"button",onClick:()=>{h(!1),r()},className:"flex items-center gap-2 px-3 py-2 text-xs text-[#C45B5B] hover:bg-[#F8F4F0] transition-colors w-full text-left",children:[O.jsx(H1,{size:14}),"Sign out"]})]})]})}const zh="pl_onboarding_complete",wn=[{icon:R1,title:"Write your PRD",description:"Describe what you want to build, or choose a template to get started quickly."},{icon:k1,title:"Use the terminal",description:"Run commands directly in the integrated terminal to install dependencies or debug."},{icon:_1,title:"Preview in real-time",description:"Switch to the Preview tab to see your app running with live reload."},{icon:Y1,title:"Iterate with AI Chat",description:"Ask the AI to modify, fix, or explain your code in the chat panel."}];function ig(){const[i,o]=E.useState(!1),[r,f]=E.useState(0);E.useEffect(()=>{try{localStorage.getItem(zh)!=="1"&&o(!0)}catch{}},[]);const d=()=>{o(!1);try{localStorage.setItem(zh,"1")}catch{}},h=()=>{r<wn.length-1?f(r+1):d()};if(!i)return null;const g=wn[r],_=g.icon;return O.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/30",children:O.jsxs("div",{className:"bg-card rounded-card shadow-card-hover border border-border w-full max-w-sm mx-4",children:[O.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-2",children:[O.jsxs("span",{className:"text-[11px] font-mono text-muted-accessible",children:[r+1," / ",wn.length]}),O.jsx("button",{onClick:d,className:"text-muted hover:text-ink transition-colors p-1 rounded-btn hover:bg-hover",title:"Skip onboarding",children:O.jsx(Kh,{size:14})})]}),O.jsxs("div",{className:"px-5 pb-4 text-center",children:[O.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-4",children:O.jsx(_,{size:24,className:"text-primary"})}),O.jsx("h3",{className:"text-sm font-heading font-bold text-ink mb-1",children:g.title}),O.jsx("p",{className:"text-xs text-muted-accessible leading-relaxed",children:g.description})]}),O.jsx("div",{className:"flex items-center justify-center gap-1.5 pb-4",children:wn.map((S,y)=>O.jsx("div",{className:`w-1.5 h-1.5 rounded-full transition-colors ${y===r?"bg-primary":"bg-border"}`},y))}),O.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-t border-border",children:[O.jsx("button",{onClick:d,className:"text-xs text-muted hover:text-ink transition-colors",children:"Skip"}),O.jsx("button",{onClick:h,className:"inline-flex items-center gap-1.5 px-4 py-1.5 text-xs font-medium rounded-btn bg-primary text-white hover:bg-primary-hover transition-colors",children:r<wn.length-1?O.jsxs(O.Fragment,{children:["Next",O.jsx(S1,{size:12})]}):"Get Started"})]})]})})}function cg(i){const[o,r]=E.useState(!1),f=E.useRef(null),d=E.useRef(i);E.useEffect(()=>{d.current=i},[i]),E.useEffect(()=>{const g=new I1;return f.current=g,g.on("connected",()=>r(!0)),g.on("disconnected",()=>{r(!1),d.current&&d.current(null)}),g.on("state_update",_=>{d.current&&_&&typeof _=="object"&&d.current(_)}),g.connect(),()=>{g.disconnect(),f.current=null}},[]);const h=E.useCallback((g,_)=>{var S;return((S=f.current)==null?void 0:S.on(g,_))||(()=>{})},[]);return{connected:o,subscribe:h}}function fg(){const[i,o]=E.useState(""),{connected:r}=cg(()=>{});return E.useEffect(()=>{qa.getStatus().then(f=>{o(f.version||"")}).catch(()=>{})},[]),O.jsxs("div",{className:"flex h-screen bg-[#FAF9F6]",children:[O.jsx(ig,{}),O.jsx("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:absolute focus:z-50 focus:top-2 focus:left-2 focus:px-4 focus:py-2 focus:bg-white focus:text-[#553DE9] focus:rounded-[3px] focus:shadow-card",children:"Skip to main content"}),O.jsx(ng,{wsConnected:r,version:i}),O.jsx("main",{id:"main-content",className:"flex-1 overflow-auto",children:O.jsx(Cv,{})})]})}function _h({children:i}){const{user:o,loading:r,isLocalMode:f}=$h();return r?O.jsx("div",{className:"h-screen bg-[#FAF9F6] flex items-center justify-center text-[#6B6960] text-sm",children:"Loading..."}):f?O.jsx(O.Fragment,{children:i}):o?O.jsx(O.Fragment,{children:i}):O.jsx(Mv,{to:"/login",replace:!0})}function hi({variant:i="text",width:o,height:r,className:f=""}){const d="animate-pulse bg-[#ECEAE3]/60 rounded";if(i==="circle"){const h=o||"2rem";return O.jsx("div",{className:`${d} rounded-full flex-shrink-0 ${f}`,style:{width:h,height:h}})}return i==="block"?O.jsx("div",{className:`${d} rounded-btn ${f}`,style:{width:o||"100%",height:r||"4rem"}}):O.jsx("div",{className:`${d} rounded-btn ${f}`,style:{width:o||"100%",height:r||"0.75rem"}})}function bg(){return O.jsx("div",{className:"p-4 space-y-3",children:[...Array(12)].map((i,o)=>O.jsxs("div",{className:"flex items-center gap-3",children:[O.jsx(hi,{variant:"text",width:"1.5rem",height:"10px",className:"flex-shrink-0 opacity-40"}),O.jsx(hi,{variant:"text",width:`${20+Math.random()*60}%`,height:"10px"})]},o))})}const og=E.lazy(()=>Pl(()=>import("./HomePage-BrwjWs5_.js"),__vite__mapDeps([0,1,2,3]))),sg=E.lazy(()=>Pl(()=>import("./ProjectPage-CNuYm1A5.js"),__vite__mapDeps([4,3,5,2,6,7,8]))),rg=E.lazy(()=>Pl(()=>import("./ProjectsPage-uJimVYlj.js"),__vite__mapDeps([9,5,10,1,2]))),dg=E.lazy(()=>Pl(()=>import("./TemplatesPage-_MJc-qGU.js"),__vite__mapDeps([11,10,1,2]))),hg=E.lazy(()=>Pl(()=>import("./SettingsPage-BiSUXmC2.js"),__vite__mapDeps([12,10,7]))),mg=E.lazy(()=>Pl(()=>import("./LoginPage-KBUVD4pE.js"),[])),yg=E.lazy(()=>Pl(()=>import("./NotFoundPage-CDzHJO08.js"),__vite__mapDeps([13,6])));function Il(){return O.jsxs("div",{className:"h-screen bg-[#FAF9F6] flex flex-col items-center justify-center gap-3",children:[O.jsx(hi,{variant:"block",width:"200px",height:"24px"}),O.jsx(hi,{variant:"text",width:"140px",height:"12px",className:"opacity-50"})]})}function vg(){return O.jsx(tg,{children:O.jsxs(Dv,{children:[O.jsx(il,{path:"/login",element:O.jsx(E.Suspense,{fallback:O.jsx(Il,{}),children:O.jsx(mg,{})})}),O.jsx(il,{path:"/project/:sessionId",element:O.jsx(_h,{children:O.jsx(E.Suspense,{fallback:O.jsx(Il,{}),children:O.jsx(sg,{})})})}),O.jsxs(il,{element:O.jsx(_h,{children:O.jsx(fg,{})}),children:[O.jsx(il,{path:"/",element:O.jsx(E.Suspense,{fallback:O.jsx(Il,{}),children:O.jsx(og,{})})}),O.jsx(il,{path:"/projects",element:O.jsx(E.Suspense,{fallback:O.jsx(Il,{}),children:O.jsx(rg,{})})}),O.jsx(il,{path:"/templates",element:O.jsx(E.Suspense,{fallback:O.jsx(Il,{}),children:O.jsx(dg,{})})}),O.jsx(il,{path:"/settings",element:O.jsx(E.Suspense,{fallback:O.jsx(Il,{}),children:O.jsx(hg,{})})}),O.jsx(il,{path:"*",element:O.jsx(E.Suspense,{fallback:O.jsx(Il,{}),children:O.jsx(yg,{})})})]})]})})}N0.createRoot(document.getElementById("root")).render(O.jsx(E.StrictMode,{children:O.jsx(l1,{children:O.jsx(vg,{})})}));export{S1 as A,E1 as B,_1 as E,R1 as F,N1 as H,Xh as L,Y1 as M,Vh as S,k1 as T,pg as W,Kh as X,qa as a,cg as b,Jt as c,bg as d,hi as e,Sg as f,$h as g,O as j,E as r,Ff as u};
|
package/web-app/dist/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
9
9
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
10
10
|
<link href="https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-1UyN_URb.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-UNfgZjJl.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body class="bg-background text-ink font-sans antialiased">
|