loki-mode 6.50.0 → 6.51.0

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.
Files changed (24) hide show
  1. package/SKILL.md +2 -2
  2. package/VERSION +1 -1
  3. package/autonomy/run.sh +3 -1
  4. package/dashboard/__init__.py +1 -1
  5. package/docs/INSTALLATION.md +1 -1
  6. package/mcp/__init__.py +1 -1
  7. package/package.json +1 -1
  8. package/web-app/dist/assets/{Badge--0P706gJ.js → Badge-btjJpcIR.js} +1 -1
  9. package/web-app/dist/assets/{Button-CiWrzR-b.js → Button-al3e4s_k.js} +1 -1
  10. package/web-app/dist/assets/{Card-kK4qakmW.js → Card-Dy53Fy1C.js} +1 -1
  11. package/web-app/dist/assets/{HomePage-8Iht82oS.js → HomePage-CpxX59f6.js} +1 -1
  12. package/web-app/dist/assets/{LoginPage-QKE0uBAy.js → LoginPage-C4U4jQQ1.js} +1 -1
  13. package/web-app/dist/assets/{NotFoundPage-CyiH17vK.js → NotFoundPage-C-jR50AT.js} +1 -1
  14. package/web-app/dist/assets/{ProjectPage-Bv_bjjwT.js → ProjectPage-nrlfDm3r.js} +1 -1
  15. package/web-app/dist/assets/{ProjectsPage-DaB2tqOQ.js → ProjectsPage-CswR-Imw.js} +1 -1
  16. package/web-app/dist/assets/{SettingsPage-gZBenmpt.js → SettingsPage-DyeqtdDr.js} +1 -1
  17. package/web-app/dist/assets/{TemplatesPage-BGHgxn_a.js → TemplatesPage-CzVB6kTH.js} +1 -1
  18. package/web-app/dist/assets/{TerminalOutput-C7sYzcHM.js → TerminalOutput-DCP_fS6c.js} +1 -1
  19. package/web-app/dist/assets/{arrow-left-C56w2CVD.js → arrow-left-5SrcW4Rm.js} +1 -1
  20. package/web-app/dist/assets/{clock-CybOBArs.js → clock-DLN9xqq3.js} +1 -1
  21. package/web-app/dist/assets/{external-link-DN8r7gOC.js → external-link-C04MOXed.js} +1 -1
  22. package/web-app/dist/assets/{index-g4lAt51o.js → index-BlkhGr5c.js} +2 -2
  23. package/web-app/dist/index.html +1 -1
  24. package/web-app/server.py +36 -8
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.50.0
6
+ # Loki Mode v6.51.0
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.50.0 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
270
+ **v6.51.0 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
package/VERSION CHANGED
@@ -1 +1 @@
1
- 6.50.0
1
+ 6.51.0
package/autonomy/run.sh CHANGED
@@ -177,7 +177,9 @@ PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
177
177
  # Solution: Copy ourselves to /tmp and run from there. The original can be safely edited.
178
178
  #===============================================================================
179
179
  if [[ -z "${LOKI_RUNNING_FROM_TEMP:-}" ]] && [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
180
- TEMP_SCRIPT=$(mktemp /tmp/loki-run-XXXXXX.sh)
180
+ TEMP_SCRIPT=$(mktemp /tmp/loki-run-XXXXXX)
181
+ mv "$TEMP_SCRIPT" "${TEMP_SCRIPT}.sh"
182
+ TEMP_SCRIPT="${TEMP_SCRIPT}.sh"
181
183
  cp "${BASH_SOURCE[0]}" "$TEMP_SCRIPT"
182
184
  chmod 700 "$TEMP_SCRIPT"
183
185
  export LOKI_RUNNING_FROM_TEMP=1
@@ -7,7 +7,7 @@ Modules:
7
7
  control: Session control API (start/stop/pause/resume)
8
8
  """
9
9
 
10
- __version__ = "6.50.0"
10
+ __version__ = "6.51.0"
11
11
 
12
12
  # Expose the control app for easy import
13
13
  try:
@@ -2,7 +2,7 @@
2
2
 
3
3
  The flagship product of [Autonomi](https://www.autonomi.dev/). Complete installation instructions for all platforms and use cases.
4
4
 
5
- **Version:** v6.50.0
5
+ **Version:** v6.51.0
6
6
 
7
7
  ---
8
8
 
package/mcp/__init__.py CHANGED
@@ -57,4 +57,4 @@ try:
57
57
  except ImportError:
58
58
  __all__ = ['mcp']
59
59
 
60
- __version__ = '6.50.0'
60
+ __version__ = '6.51.0'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loki-mode",
3
- "version": "6.50.0",
3
+ "version": "6.51.0",
4
4
  "description": "Loki Mode by Autonomi - Multi-agent autonomous startup system for Claude Code, Codex CLI, and Gemini CLI",
5
5
  "keywords": [
6
6
  "agent",
@@ -1,4 +1,4 @@
1
- import{c as m,r,j as e}from"./index-g4lAt51o.js";import{C as g,a as p}from"./clock-CybOBArs.js";/**
1
+ import{c as m,r,j as e}from"./index-BlkhGr5c.js";import{C as g,a as p}from"./clock-DLN9xqq3.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 p,r as u,j as e}from"./index-g4lAt51o.js";/**
1
+ import{c as p,r as u,j as e}from"./index-BlkhGr5c.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-g4lAt51o.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
+ import{j as s}from"./index-BlkhGr5c.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 n,a as h,u as be,b as ge}from"./index-g4lAt51o.js";import{u as I,B as je}from"./Badge--0P706gJ.js";import{P as ve,a as Ne,S as ye,E,T as we}from"./TerminalOutput-C7sYzcHM.js";import"./clock-CybOBArs.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),l=Math.floor(t%3600/60);return`${s}h ${l}m`}function Se(t,s){if(!t||t<=0)return"--";const l={simple:{opus:1,haiku:1,total:3},standard:{opus:2,haiku:2,total:5},complex:{opus:3,haiku:3,total:8}},r=l[s]||l.standard;return t<=r.opus?"Opus":t>r.total-r.haiku?"Haiku":"Sonnet"}function Ce({status:t,prdSummary:s,onStop:l,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"]}),l&&e.jsxs("button",{onClick:l,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(l=>e.jsxs("div",{className:"card p-4 text-center",children:[e.jsx("div",{className:`text-2xl font-bold font-mono ${l.color}`,children:l.value}),e.jsx("div",{className:"text-xs text-muted font-medium mt-1 uppercase tracking-wider",children:l.label})]},l.label))})}function Pe({plan:t,loading:s,onConfirm:l,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:l,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:l,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:l,provider:r,onProviderChange:a,initialPrd:c}){const[i,o]=n.useState(""),[m,b]=n.useState(""),[f,y]=n.useState("claude"),[d,g]=n.useState(""),j=r??f,[v,w]=n.useState(!1),[k,T]=n.useState([]),[x,P]=n.useState(!1),[N,M]=n.useState(!1),[_,A]=n.useState(!1),[z,F]=n.useState(null),[L,$]=n.useState(!1),[O,D]=n.useState(!1);n.useEffect(()=>{h.getTemplates().then(u=>{T(u),P(!1)}).catch(()=>{T([]),P(!0)})},[]),n.useEffect(()=>{c&&o(c)},[c]),n.useEffect(()=>{if(c)return;const u=localStorage.getItem("loki-prd-draft");u&&o(u),h.getPrdPrefill().then(({content:S})=>{S&&o(S)}).catch(()=>{})},[c]),n.useEffect(()=>{i.trim()?localStorage.setItem("loki-prd-draft",i):localStorage.removeItem("loki-prd-draft")},[i]),n.useEffect(()=>{const u=S=>{i.trim()&&S.preventDefault()};return window.addEventListener("beforeunload",u),()=>window.removeEventListener("beforeunload",u)},[i]);const R=n.useCallback(async(u,S)=>{b(S),w(!1);try{const G=await h.getTemplateContent(u);o(G.content)}catch{o(`# ${S}
1
+ import{j as e,r as n,a as h,u as be,b as ge}from"./index-BlkhGr5c.js";import{u as I,B as je}from"./Badge-btjJpcIR.js";import{P as ve,a as Ne,S as ye,E,T as we}from"./TerminalOutput-DCP_fS6c.js";import"./clock-DLN9xqq3.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),l=Math.floor(t%3600/60);return`${s}h ${l}m`}function Se(t,s){if(!t||t<=0)return"--";const l={simple:{opus:1,haiku:1,total:3},standard:{opus:2,haiku:2,total:5},complex:{opus:3,haiku:3,total:8}},r=l[s]||l.standard;return t<=r.opus?"Opus":t>r.total-r.haiku?"Haiku":"Sonnet"}function Ce({status:t,prdSummary:s,onStop:l,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"]}),l&&e.jsxs("button",{onClick:l,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(l=>e.jsxs("div",{className:"card p-4 text-center",children:[e.jsx("div",{className:`text-2xl font-bold font-mono ${l.color}`,children:l.value}),e.jsx("div",{className:"text-xs text-muted font-medium mt-1 uppercase tracking-wider",children:l.label})]},l.label))})}function Pe({plan:t,loading:s,onConfirm:l,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:l,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:l,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:l,provider:r,onProviderChange:a,initialPrd:c}){const[i,o]=n.useState(""),[m,b]=n.useState(""),[f,y]=n.useState("claude"),[d,g]=n.useState(""),j=r??f,[v,w]=n.useState(!1),[k,T]=n.useState([]),[x,P]=n.useState(!1),[N,M]=n.useState(!1),[_,A]=n.useState(!1),[z,F]=n.useState(null),[L,$]=n.useState(!1),[O,D]=n.useState(!1);n.useEffect(()=>{h.getTemplates().then(u=>{T(u),P(!1)}).catch(()=>{T([]),P(!0)})},[]),n.useEffect(()=>{c&&o(c)},[c]),n.useEffect(()=>{if(c)return;const u=localStorage.getItem("loki-prd-draft");u&&o(u),h.getPrdPrefill().then(({content:S})=>{S&&o(S)}).catch(()=>{})},[c]),n.useEffect(()=>{i.trim()?localStorage.setItem("loki-prd-draft",i):localStorage.removeItem("loki-prd-draft")},[i]),n.useEffect(()=>{const u=S=>{i.trim()&&S.preventDefault()};return window.addEventListener("beforeunload",u),()=>window.removeEventListener("beforeunload",u)},[i]);const R=n.useCallback(async(u,S)=>{b(S),w(!1);try{const G=await h.getTemplateContent(u);o(G.content)}catch{o(`# ${S}
2
2
 
3
3
  ## Overview
4
4
 
@@ -1 +1 @@
1
- import{g as r,u as o,r as c,j as e}from"./index-g4lAt51o.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
+ import{g as r,u as o,r as c,j as e}from"./index-BlkhGr5c.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-g4lAt51o.js";import{A as o}from"./arrow-left-C56w2CVD.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
+ import{j as e,L as t,H as s}from"./index-BlkhGr5c.js";import{A as o}from"./arrow-left-5SrcW4Rm.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-g4lAt51o.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-C7sYzcHM.js";import{B as Ft,P as Tl}from"./Button-CiWrzR-b.js";import{C as Al,a as zl}from"./clock-CybOBArs.js";import{A as Ol}from"./arrow-left-C56w2CVD.js";import{E as Il}from"./external-link-DN8r7gOC.js";/**
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-BlkhGr5c.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-DCP_fS6c.js";import{B as Ft,P as Tl}from"./Button-al3e4s_k.js";import{C as Al,a as zl}from"./clock-DLN9xqq3.js";import{A as Ol}from"./arrow-left-5SrcW4Rm.js";import{E as Il}from"./external-link-C04MOXed.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-g4lAt51o.js";import{B as d,P as m}from"./Button-CiWrzR-b.js";import{C as j}from"./Card-kK4qakmW.js";import{u as y,B as b}from"./Badge--0P706gJ.js";import"./clock-CybOBArs.js";/**
1
+ import{c as f,u as h,r as n,a as g,j as e}from"./index-BlkhGr5c.js";import{B as d,P as m}from"./Button-al3e4s_k.js";import{C as j}from"./Card-Dy53Fy1C.js";import{u as y,B as b}from"./Badge-btjJpcIR.js";import"./clock-DLN9xqq3.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-g4lAt51o.js";import{C as l}from"./Card-kK4qakmW.js";import{E as c}from"./external-link-DN8r7gOC.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
+ import{r as t,a,j as e}from"./index-BlkhGr5c.js";import{C as l}from"./Card-Dy53Fy1C.js";import{E as c}from"./external-link-C04MOXed.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-g4lAt51o.js";import{C as p}from"./Card-kK4qakmW.js";import{u as d,B as h}from"./Badge--0P706gJ.js";import"./clock-CybOBArs.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
+ import{u as c,r,a as x,j as t}from"./index-BlkhGr5c.js";import{C as p}from"./Card-Dy53Fy1C.js";import{u as d,B as h}from"./Badge-btjJpcIR.js";import"./clock-DLN9xqq3.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
- import{c as o,r as m,j as e}from"./index-g4lAt51o.js";/**
1
+ import{c as o,r as m,j as e}from"./index-BlkhGr5c.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 o}from"./index-g4lAt51o.js";/**
1
+ import{c as o}from"./index-BlkhGr5c.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}from"./index-g4lAt51o.js";/**
1
+ import{c}from"./index-BlkhGr5c.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 a}from"./index-g4lAt51o.js";/**
1
+ import{c as a}from"./index-BlkhGr5c.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
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomePage-8Iht82oS.js","assets/Badge--0P706gJ.js","assets/clock-CybOBArs.js","assets/TerminalOutput-C7sYzcHM.js","assets/ProjectPage-Bv_bjjwT.js","assets/Button-CiWrzR-b.js","assets/arrow-left-C56w2CVD.js","assets/external-link-DN8r7gOC.js","assets/ProjectPage-9CEnUXvW.css","assets/ProjectsPage-DaB2tqOQ.js","assets/Card-kK4qakmW.js","assets/TemplatesPage-BGHgxn_a.js","assets/SettingsPage-gZBenmpt.js","assets/NotFoundPage-CyiH17vK.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomePage-CpxX59f6.js","assets/Badge-btjJpcIR.js","assets/clock-DLN9xqq3.js","assets/TerminalOutput-DCP_fS6c.js","assets/ProjectPage-nrlfDm3r.js","assets/Button-al3e4s_k.js","assets/arrow-left-5SrcW4Rm.js","assets/external-link-C04MOXed.js","assets/ProjectPage-9CEnUXvW.css","assets/ProjectsPage-CswR-Imw.js","assets/Card-Dy53Fy1C.js","assets/TemplatesPage-CzVB6kTH.js","assets/SettingsPage-DyeqtdDr.js","assets/NotFoundPage-C-jR50AT.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,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-8Iht82oS.js"),__vite__mapDeps([0,1,2,3]))),sg=E.lazy(()=>Pl(()=>import("./ProjectPage-Bv_bjjwT.js"),__vite__mapDeps([4,3,5,2,6,7,8]))),rg=E.lazy(()=>Pl(()=>import("./ProjectsPage-DaB2tqOQ.js"),__vite__mapDeps([9,5,10,1,2]))),dg=E.lazy(()=>Pl(()=>import("./TemplatesPage-BGHgxn_a.js"),__vite__mapDeps([11,10,1,2]))),hg=E.lazy(()=>Pl(()=>import("./SettingsPage-gZBenmpt.js"),__vite__mapDeps([12,10,7]))),mg=E.lazy(()=>Pl(()=>import("./LoginPage-QKE0uBAy.js"),[])),yg=E.lazy(()=>Pl(()=>import("./NotFoundPage-CyiH17vK.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-CpxX59f6.js"),__vite__mapDeps([0,1,2,3]))),sg=E.lazy(()=>Pl(()=>import("./ProjectPage-nrlfDm3r.js"),__vite__mapDeps([4,3,5,2,6,7,8]))),rg=E.lazy(()=>Pl(()=>import("./ProjectsPage-CswR-Imw.js"),__vite__mapDeps([9,5,10,1,2]))),dg=E.lazy(()=>Pl(()=>import("./TemplatesPage-CzVB6kTH.js"),__vite__mapDeps([11,10,1,2]))),hg=E.lazy(()=>Pl(()=>import("./SettingsPage-DyeqtdDr.js"),__vite__mapDeps([12,10,7]))),mg=E.lazy(()=>Pl(()=>import("./LoginPage-C4U4jQQ1.js"),[])),yg=E.lazy(()=>Pl(()=>import("./NotFoundPage-C-jR50AT.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};
@@ -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-g4lAt51o.js"></script>
11
+ <script type="module" crossorigin src="/assets/index-BlkhGr5c.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">
package/web-app/server.py CHANGED
@@ -2261,10 +2261,19 @@ async def chat_session(session_id: str, req: ChatRequest) -> JSONResponse:
2261
2261
  task.returncode = 1
2262
2262
  task.complete = True
2263
2263
  return
2264
- if req.mode == "quick":
2265
- cmd_args = [loki, "quick", req.message]
2264
+ # All chat modes use 'loki quick' with the user's message as the task.
2265
+ # This runs claude (or configured provider) in the project directory
2266
+ # to make changes based on the user's prompt -- works both during
2267
+ # active sessions and post-completion for iterative development.
2268
+ if req.mode == "max":
2269
+ # Max mode: full loki start with the message as a PRD
2270
+ prd_path = target / ".loki" / "chat-prd.md"
2271
+ prd_path.parent.mkdir(parents=True, exist_ok=True)
2272
+ prd_path.write_text(req.message)
2273
+ cmd_args = [loki, "start", "--provider", "claude", str(prd_path)]
2266
2274
  else:
2267
- cmd_args = [loki, "start", "--provider", "claude", str(target / "PRD.md")]
2275
+ # Quick and Standard both use 'loki quick' -- fast, focused changes
2276
+ cmd_args = [loki, "quick", req.message]
2268
2277
  try:
2269
2278
  proc = subprocess.Popen(
2270
2279
  cmd_args,
@@ -2285,7 +2294,9 @@ async def chat_session(session_id: str, req: ChatRequest) -> JSONResponse:
2285
2294
  for raw_line in proc.stdout:
2286
2295
  if task.cancelled:
2287
2296
  break
2288
- task.output_lines.append(raw_line.rstrip("\n"))
2297
+ # Strip ANSI escape codes for clean display
2298
+ clean = re.sub(r'\x1b\[[0-9;]*[a-zA-Z]', '', raw_line.rstrip("\n"))
2299
+ task.output_lines.append(clean)
2289
2300
  proc.stdout.close()
2290
2301
 
2291
2302
  await asyncio.wait_for(
@@ -2314,14 +2325,31 @@ async def chat_session(session_id: str, req: ChatRequest) -> JSONResponse:
2314
2325
  except (ProcessLookupError, OSError):
2315
2326
  proc.kill()
2316
2327
  proc.wait()
2317
- # Detect changed files
2328
+ # Detect changed files (both committed and uncommitted)
2318
2329
  try:
2319
- result = subprocess.run(
2330
+ changed = set()
2331
+ # Check uncommitted changes (working tree + staged)
2332
+ r1 = subprocess.run(
2333
+ ["git", "diff", "--name-only"],
2334
+ cwd=str(target), capture_output=True, text=True, timeout=10,
2335
+ )
2336
+ if r1.returncode == 0:
2337
+ changed.update(f for f in r1.stdout.strip().splitlines() if f)
2338
+ # Check staged changes
2339
+ r2 = subprocess.run(
2340
+ ["git", "diff", "--name-only", "--cached"],
2341
+ cwd=str(target), capture_output=True, text=True, timeout=10,
2342
+ )
2343
+ if r2.returncode == 0:
2344
+ changed.update(f for f in r2.stdout.strip().splitlines() if f)
2345
+ # Check recent commit if any
2346
+ r3 = subprocess.run(
2320
2347
  ["git", "diff", "--name-only", "HEAD~1"],
2321
2348
  cwd=str(target), capture_output=True, text=True, timeout=10,
2322
2349
  )
2323
- if result.returncode == 0:
2324
- task.files_changed = [f for f in result.stdout.strip().splitlines() if f]
2350
+ if r3.returncode == 0:
2351
+ changed.update(f for f in r3.stdout.strip().splitlines() if f)
2352
+ task.files_changed = sorted(changed)
2325
2353
  except Exception:
2326
2354
  pass
2327
2355
  task.complete = True