loki-mode 6.64.3 → 6.64.4

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 (22) hide show
  1. package/SKILL.md +2 -2
  2. package/VERSION +1 -1
  3. package/dashboard/__init__.py +1 -1
  4. package/docs/INSTALLATION.md +1 -1
  5. package/mcp/__init__.py +1 -1
  6. package/package.json +1 -1
  7. package/web-app/dist/assets/{Badge-CecAeNGh.js → Badge-B5HgOamf.js} +1 -1
  8. package/web-app/dist/assets/{Button-BAwZY3QB.js → Button-Dr_x-zc5.js} +1 -1
  9. package/web-app/dist/assets/{Card-3YIYrz1X.js → Card-Kc9YONqh.js} +1 -1
  10. package/web-app/dist/assets/{HomePage-DYS0zqqT.js → HomePage-BtsaYGRR.js} +1 -1
  11. package/web-app/dist/assets/{LoginPage-D5Jj_Q44.js → LoginPage-D7RmxUWG.js} +1 -1
  12. package/web-app/dist/assets/{NotFoundPage-DLG6ORdp.js → NotFoundPage-D5Gd5Q79.js} +1 -1
  13. package/web-app/dist/assets/{ProjectPage-D-ZyzZUT.js → ProjectPage-DQHsCc2_.js} +21 -21
  14. package/web-app/dist/assets/{ProjectsPage-CMacaz1V.js → ProjectsPage-CUdwe4_n.js} +1 -1
  15. package/web-app/dist/assets/{SettingsPage-B9XKC6ge.js → SettingsPage-4zGDgdk5.js} +1 -1
  16. package/web-app/dist/assets/{TemplatesPage-Bq8ASiy4.js → TemplatesPage-BR2QjKqV.js} +1 -1
  17. package/web-app/dist/assets/{TerminalOutput-rQ65EXIP.js → TerminalOutput-Bk9csYRz.js} +1 -1
  18. package/web-app/dist/assets/{arrow-left-BcsRbWot.js → arrow-left-BuMZs13c.js} +1 -1
  19. package/web-app/dist/assets/{clock-DUeIWW98.js → clock-JjJ4Yqbk.js} +1 -1
  20. package/web-app/dist/assets/{external-link-lxSyZieU.js → external-link-jWUgVKgO.js} +1 -1
  21. package/web-app/dist/assets/{index-Cyfnu-vw.js → index-pa3JgPvH.js} +2 -2
  22. package/web-app/dist/index.html +1 -1
@@ -1,4 +1,4 @@
1
- import{c as p,u as C,r as a,a as j,j as e}from"./index-Cyfnu-vw.js";import{B as b,P as y,F,T as S}from"./Button-BAwZY3QB.js";import{C as P}from"./Card-3YIYrz1X.js";import{u as _,B}from"./Badge-CecAeNGh.js";import{E as z}from"./external-link-lxSyZieU.js";import"./clock-DUeIWW98.js";/**
1
+ import{c as p,u as C,r as a,a as j,j as e}from"./index-pa3JgPvH.js";import{B as b,P as y,F,T as S}from"./Button-Dr_x-zc5.js";import{C as P}from"./Card-Kc9YONqh.js";import{u as _,B}from"./Badge-B5HgOamf.js";import{E as z}from"./external-link-jWUgVKgO.js";import"./clock-JjJ4Yqbk.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-Cyfnu-vw.js";import{C as l}from"./Card-3YIYrz1X.js";import{E as c}from"./external-link-lxSyZieU.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-pa3JgPvH.js";import{C as l}from"./Card-Kc9YONqh.js";import{E as c}from"./external-link-jWUgVKgO.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-Cyfnu-vw.js";import{C as p}from"./Card-3YIYrz1X.js";import{u as d,B as h}from"./Badge-CecAeNGh.js";import"./clock-DUeIWW98.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-pa3JgPvH.js";import{C as p}from"./Card-Kc9YONqh.js";import{u as d,B as h}from"./Badge-B5HgOamf.js";import"./clock-JjJ4Yqbk.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-Cyfnu-vw.js";/**
1
+ import{c as o,r as m,j as e}from"./index-pa3JgPvH.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-Cyfnu-vw.js";/**
1
+ import{c as o}from"./index-pa3JgPvH.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-Cyfnu-vw.js";/**
1
+ import{c}from"./index-pa3JgPvH.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-Cyfnu-vw.js";/**
1
+ import{c as a}from"./index-pa3JgPvH.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-DYS0zqqT.js","assets/Badge-CecAeNGh.js","assets/clock-DUeIWW98.js","assets/TerminalOutput-rQ65EXIP.js","assets/ProjectPage-D-ZyzZUT.js","assets/Button-BAwZY3QB.js","assets/arrow-left-BcsRbWot.js","assets/external-link-lxSyZieU.js","assets/ProjectPage-9CEnUXvW.css","assets/ProjectsPage-CMacaz1V.js","assets/Card-3YIYrz1X.js","assets/TemplatesPage-Bq8ASiy4.js","assets/SettingsPage-B9XKC6ge.js","assets/NotFoundPage-DLG6ORdp.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomePage-BtsaYGRR.js","assets/Badge-B5HgOamf.js","assets/clock-JjJ4Yqbk.js","assets/TerminalOutput-Bk9csYRz.js","assets/ProjectPage-DQHsCc2_.js","assets/Button-Dr_x-zc5.js","assets/arrow-left-BuMZs13c.js","assets/external-link-jWUgVKgO.js","assets/ProjectPage-9CEnUXvW.css","assets/ProjectsPage-CUdwe4_n.js","assets/Card-Kc9YONqh.js","assets/TemplatesPage-BR2QjKqV.js","assets/SettingsPage-4zGDgdk5.js","assets/NotFoundPage-D5Gd5Q79.js"])))=>i.map(i=>d[i]);
2
2
  var S0=Object.defineProperty;var b0=(i,f,r)=>f in i?S0(i,f,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[f]=r;var Bn=(i,f,r)=>b0(i,typeof f!="symbol"?f+"":f,r);(function(){const f=document.createElement("link").relList;if(f&&f.supports&&f.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))o(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"&&o(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 o(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 k1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Kh=Jt("x",k1),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 f=localStorage.getItem("pl_auth_token");f&&(i.Authorization=`Bearer ${f}`)}catch{}return i}async function $(i,f){const r=await fetch(`${Jh}${i}`,{...f,headers:{...F1(),...f==null?void 0:f.headers}});if(!r.ok){const o=await r.text().catch(()=>"");throw new Error(`API error ${r.status}: ${r.statusText}${o?` - ${o}`:""}`)}return r.json()}const qa={startSession:i=>$("/session/start",{method:"POST",body:JSON.stringify(i)}),stopSession:()=>$("/session/stop",{method:"POST"}),pauseSession:()=>$("/session/pause",{method:"POST"}),resumeSession:()=>$("/session/resume",{method:"POST"}),getPrdPrefill:()=>$("/session/prd-prefill"),getStatus:()=>$("/session/status"),getAgents:()=>$("/session/agents"),getLogs:(i=200)=>$(`/session/logs?lines=${i}`),getMemorySummary:()=>$("/session/memory"),getChecklist:()=>$("/session/checklist"),getFiles:()=>$("/session/files"),getFileContent:i=>$(`/session/files/content?path=${encodeURIComponent(i)}`),getSessionFileContent:(i,f)=>$(`/sessions/${encodeURIComponent(i)}/file?path=${encodeURIComponent(f)}`),getTemplates:()=>$("/templates"),getTemplateContent:i=>$(`/templates/${encodeURIComponent(i)}`),planSession:(i,f)=>$("/session/plan",{method:"POST",body:JSON.stringify({prd:i,provider:f})}),generateReport:(i="markdown")=>$("/session/report",{method:"POST",body:JSON.stringify({format:i})}),shareSession:()=>$("/session/share",{method:"POST"}),getCurrentProvider:()=>$("/provider/current"),setProvider:i=>$("/provider/set",{method:"POST",body:JSON.stringify({provider:i})}),getMetrics:()=>$("/session/metrics"),getSessionsHistory:()=>$("/sessions/history"),getSessionDetail:i=>$(`/sessions/${encodeURIComponent(i)}`),deleteSession:i=>$(`/sessions/${encodeURIComponent(i)}`,{method:"DELETE"}),onboardRepo:i=>$("/session/onboard",{method:"POST",body:JSON.stringify({path:i})}),saveSessionFile:(i,f,r)=>$(`/sessions/${encodeURIComponent(i)}/file`,{method:"PUT",body:JSON.stringify({path:f,content:r})}),createSessionFile:(i,f,r="")=>$(`/sessions/${encodeURIComponent(i)}/file`,{method:"POST",body:JSON.stringify({path:f,content:r})}),deleteSessionFile:(i,f)=>$(`/sessions/${encodeURIComponent(i)}/file`,{method:"DELETE",body:JSON.stringify({path:f})}),createSessionDirectory:(i,f)=>$(`/sessions/${encodeURIComponent(i)}/directory`,{method:"POST",body:JSON.stringify({path:f})}),reviewProject:i=>$(`/sessions/${encodeURIComponent(i)}/review`,{method:"POST"}),testProject:i=>$(`/sessions/${encodeURIComponent(i)}/test`,{method:"POST"}),explainProject:i=>$(`/sessions/${encodeURIComponent(i)}/explain`,{method:"POST"}),exportProject:i=>$(`/sessions/${encodeURIComponent(i)}/export`,{method:"POST"}),fixProject:i=>$(`/sessions/${encodeURIComponent(i)}/fix`,{method:"POST"}),chatMessage:(i,f,r="quick")=>$(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:f,mode:r})}),chatStart:(i,f,r="quick")=>$(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:f,mode:r})}),chatPoll:(i,f)=>$(`/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(f)}`),chatStreamUrl:(i,f)=>`${Jh}/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(f)}/stream`,chatCancel:(i,f)=>$(`/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(f)}/cancel`,{method:"POST"}),getPreviewInfo:i=>$(`/sessions/${encodeURIComponent(i)}/preview-info`),devserver:{start:(i,f)=>$(`/sessions/${encodeURIComponent(i)}/devserver/start`,{method:"POST",body:JSON.stringify({command:f||null})}),stop:i=>$(`/sessions/${encodeURIComponent(i)}/devserver/stop`,{method:"POST"}),status:i=>$(`/sessions/${encodeURIComponent(i)}/devserver/status`)},getSecrets:()=>$("/secrets"),setSecret:(i,f)=>$("/secrets",{method:"POST",body:JSON.stringify({key:i,value:f})}),deleteSecret:i=>$(`/secrets/${encodeURIComponent(i)}`,{method:"DELETE"}),getServices:i=>$(`/sessions/${encodeURIComponent(i)}/services`),getServiceLogs:(i,f,r=50)=>$(`/sessions/${encodeURIComponent(i)}/devserver/logs${f?`?service=${encodeURIComponent(f)}&tail=${r}`:`?tail=${r}`}`),restartService:(i,f)=>$(`/sessions/${encodeURIComponent(i)}/devserver/restart-service`,{method:"POST",body:JSON.stringify({service:f})}),getMe:()=>$("/auth/me"),getGitHubAuthUrl:()=>$("/auth/github/url"),getGoogleAuthUrl:()=>$("/auth/google/url"),githubCallback:(i,f)=>$("/auth/github/callback",{method:"POST",body:JSON.stringify({code:i,state:f})}),googleCallback:(i,f,r)=>$("/auth/google/callback",{method:"POST",body:JSON.stringify({code:i,state:f,redirect_uri:r||`${window.location.origin}${window.location.pathname}`})})};class I1{constructor(f){Bn(this,"ws",null);Bn(this,"listeners",new Map);Bn(this,"reconnectTimer",null);Bn(this,"url");this.url=f||W1}connect(){var f;((f=this.ws)==null?void 0:f.readyState)!==WebSocket.OPEN&&(this.ws=new WebSocket(this.url),this.ws.onopen=()=>{this.emit("connected",{message:"WebSocket connected"})},this.ws.onmessage=r=>{try{const o=JSON.parse(r.data);this.emit(o.type,o.data||o)}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(f,r){return this.listeners.has(f)||this.listeners.set(f,new Set),this.listeners.get(f).add(r),()=>{var o;return(o=this.listeners.get(f))==null?void 0:o.delete(r)}}emit(f,r){var o,d;(o=this.listeners.get(f))==null||o.forEach(h=>h(r)),(d=this.listeners.get("*"))==null||d.forEach(h=>h({type:f,data:r}))}send(f){var r;((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify(f))}disconnect(){var f;this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(f=this.ws)==null||f.close(),this.ws=null}}const Vf="pl_auth_token",$h=E.createContext({user:null,loading:!0,login:()=>{},logout:()=>{},isLocalMode:!0});function P1(i,f,r){f(!1),r({email:i.sub||i.email||"",name:i.name||"",avatar_url:i.avatar||"",authenticated:!0})}function tg({children:i}){const[f,r]=E.useState(null),[o,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(()=>{})},[]),C=E.useCallback(()=>{localStorage.removeItem(Vf),r(null),S.pathname!=="/login"&&_("/login",{replace:!0})},[_,S.pathname]),z=E.useMemo(()=>({user:f,loading:o,login:y,logout:C,isLocalMode:h}),[f,o,y,C,h]);return O.jsx($h.Provider,{value:z,children:i})}function kh(){return E.useContext($h)}const Th="pl_sidebar_collapsed",eg=[{to:"/",label:"Home",icon:N1},{to:"/projects",label:"Projects",icon:C1},{to:"/templates",label:"Templates",icon:D1}],lg=[{to:"/settings",label:"Settings",icon:Vh}];function ag(){const[i,f]=E.useState(typeof window<"u"?window.innerWidth<768:!1);return E.useEffect(()=>{const r=()=>f(window.innerWidth<768);return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),i}function ng({wsConnected:i,version:f}){const r=ag(),o=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)},[o.pathname,r]);const S=r?d:!g,y=S?240:64,C=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})=>C(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})=>C(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&&f&&O.jsxs("span",{className:"text-xs text-[#6B6960]",children:["v",f]}),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:f,logout:r,isLocalMode:o}=kh(),[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]),o||!f?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?f.name||f.email:void 0,children:[f.avatar_url?O.jsx("img",{src:f.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:(f.name||f.email||"?")[0].toUpperCase()}),!i&&O.jsxs(O.Fragment,{children:[O.jsx("span",{className:"text-[#36342E] truncate flex-1",children:f.name||f.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:f.name}),O.jsx("p",{className:"text-xs text-[#939084] truncate",children:f.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:$1,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,f]=E.useState(!1),[r,o]=E.useState(0);E.useEffect(()=>{try{localStorage.getItem(zh)!=="1"&&f(!0)}catch{}},[]);const d=()=>{f(!1);try{localStorage.setItem(zh,"1")}catch{}},h=()=>{r<wn.length-1?o(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[f,r]=E.useState(!1),o=E.useRef(null),d=E.useRef(i);E.useEffect(()=>{d.current=i},[i]),E.useEffect(()=>{const g=new I1;return o.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(),o.current=null}},[]);const h=E.useCallback((g,_)=>{var S;return((S=o.current)==null?void 0:S.on(g,_))||(()=>{})},[]);return{connected:f,subscribe:h}}function fg(){const[i,f]=E.useState(""),{connected:r}=cg(()=>{});return E.useEffect(()=>{qa.getStatus().then(o=>{f(o.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(Mv,{})})]})}function _h({children:i}){const{user:f,loading:r,isLocalMode:o}=kh();return r?O.jsx("div",{className:"h-screen bg-[#FAF9F6] flex items-center justify-center text-[#6B6960] text-sm",children:"Loading..."}):o?O.jsx(O.Fragment,{children:i}):f?O.jsx(O.Fragment,{children:i}):O.jsx(Cv,{to:"/login",replace:!0})}function hi({variant:i="text",width:f,height:r,className:o=""}){const d="animate-pulse bg-[#ECEAE3]/60 rounded";if(i==="circle"){const h=f||"2rem";return O.jsx("div",{className:`${d} rounded-full flex-shrink-0 ${o}`,style:{width:h,height:h}})}return i==="block"?O.jsx("div",{className:`${d} rounded-btn ${o}`,style:{width:f||"100%",height:r||"4rem"}}):O.jsx("div",{className:`${d} rounded-btn ${o}`,style:{width:f||"100%",height:r||"0.75rem"}})}function bg(){return O.jsx("div",{className:"p-4 space-y-3",children:[...Array(12)].map((i,f)=>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"})]},f))})}typeof window<"u"&&window.addEventListener("beforeunload",i=>{delete i.returnValue});const og=E.lazy(()=>Pl(()=>import("./HomePage-DYS0zqqT.js"),__vite__mapDeps([0,1,2,3]))),sg=E.lazy(()=>Pl(()=>import("./ProjectPage-D-ZyzZUT.js"),__vite__mapDeps([4,3,5,2,6,7,8]))),rg=E.lazy(()=>Pl(()=>import("./ProjectsPage-CMacaz1V.js"),__vite__mapDeps([9,5,10,1,2,7]))),dg=E.lazy(()=>Pl(()=>import("./TemplatesPage-Bq8ASiy4.js"),__vite__mapDeps([11,10,1,2]))),hg=E.lazy(()=>Pl(()=>import("./SettingsPage-B9XKC6ge.js"),__vite__mapDeps([12,10,7]))),mg=E.lazy(()=>Pl(()=>import("./LoginPage-D5Jj_Q44.js"),[])),yg=E.lazy(()=>Pl(()=>import("./NotFoundPage-DLG6ORdp.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(Uv,{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,$1 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,kh as g,O as j,E as r,Ff as u};
186
+ */const k1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Kh=Jt("x",k1),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 f=localStorage.getItem("pl_auth_token");f&&(i.Authorization=`Bearer ${f}`)}catch{}return i}async function $(i,f){const r=await fetch(`${Jh}${i}`,{...f,headers:{...F1(),...f==null?void 0:f.headers}});if(!r.ok){const o=await r.text().catch(()=>"");throw new Error(`API error ${r.status}: ${r.statusText}${o?` - ${o}`:""}`)}return r.json()}const qa={startSession:i=>$("/session/start",{method:"POST",body:JSON.stringify(i)}),stopSession:()=>$("/session/stop",{method:"POST"}),pauseSession:()=>$("/session/pause",{method:"POST"}),resumeSession:()=>$("/session/resume",{method:"POST"}),getPrdPrefill:()=>$("/session/prd-prefill"),getStatus:()=>$("/session/status"),getAgents:()=>$("/session/agents"),getLogs:(i=200)=>$(`/session/logs?lines=${i}`),getMemorySummary:()=>$("/session/memory"),getChecklist:()=>$("/session/checklist"),getFiles:()=>$("/session/files"),getFileContent:i=>$(`/session/files/content?path=${encodeURIComponent(i)}`),getSessionFileContent:(i,f)=>$(`/sessions/${encodeURIComponent(i)}/file?path=${encodeURIComponent(f)}`),getTemplates:()=>$("/templates"),getTemplateContent:i=>$(`/templates/${encodeURIComponent(i)}`),planSession:(i,f)=>$("/session/plan",{method:"POST",body:JSON.stringify({prd:i,provider:f})}),generateReport:(i="markdown")=>$("/session/report",{method:"POST",body:JSON.stringify({format:i})}),shareSession:()=>$("/session/share",{method:"POST"}),getCurrentProvider:()=>$("/provider/current"),setProvider:i=>$("/provider/set",{method:"POST",body:JSON.stringify({provider:i})}),getMetrics:()=>$("/session/metrics"),getSessionsHistory:()=>$("/sessions/history"),getSessionDetail:i=>$(`/sessions/${encodeURIComponent(i)}`),deleteSession:i=>$(`/sessions/${encodeURIComponent(i)}`,{method:"DELETE"}),onboardRepo:i=>$("/session/onboard",{method:"POST",body:JSON.stringify({path:i})}),saveSessionFile:(i,f,r)=>$(`/sessions/${encodeURIComponent(i)}/file`,{method:"PUT",body:JSON.stringify({path:f,content:r})}),createSessionFile:(i,f,r="")=>$(`/sessions/${encodeURIComponent(i)}/file`,{method:"POST",body:JSON.stringify({path:f,content:r})}),deleteSessionFile:(i,f)=>$(`/sessions/${encodeURIComponent(i)}/file`,{method:"DELETE",body:JSON.stringify({path:f})}),createSessionDirectory:(i,f)=>$(`/sessions/${encodeURIComponent(i)}/directory`,{method:"POST",body:JSON.stringify({path:f})}),reviewProject:i=>$(`/sessions/${encodeURIComponent(i)}/review`,{method:"POST"}),testProject:i=>$(`/sessions/${encodeURIComponent(i)}/test`,{method:"POST"}),explainProject:i=>$(`/sessions/${encodeURIComponent(i)}/explain`,{method:"POST"}),exportProject:i=>$(`/sessions/${encodeURIComponent(i)}/export`,{method:"POST"}),fixProject:i=>$(`/sessions/${encodeURIComponent(i)}/fix`,{method:"POST"}),chatMessage:(i,f,r="quick")=>$(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:f,mode:r})}),chatStart:(i,f,r="quick")=>$(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:f,mode:r})}),chatPoll:(i,f)=>$(`/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(f)}`),chatStreamUrl:(i,f)=>`${Jh}/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(f)}/stream`,chatCancel:(i,f)=>$(`/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(f)}/cancel`,{method:"POST"}),getPreviewInfo:i=>$(`/sessions/${encodeURIComponent(i)}/preview-info`),devserver:{start:(i,f)=>$(`/sessions/${encodeURIComponent(i)}/devserver/start`,{method:"POST",body:JSON.stringify({command:f||null})}),stop:i=>$(`/sessions/${encodeURIComponent(i)}/devserver/stop`,{method:"POST"}),status:i=>$(`/sessions/${encodeURIComponent(i)}/devserver/status`)},getSecrets:()=>$("/secrets"),setSecret:(i,f)=>$("/secrets",{method:"POST",body:JSON.stringify({key:i,value:f})}),deleteSecret:i=>$(`/secrets/${encodeURIComponent(i)}`,{method:"DELETE"}),getServices:i=>$(`/sessions/${encodeURIComponent(i)}/services`),getServiceLogs:(i,f,r=50)=>$(`/sessions/${encodeURIComponent(i)}/devserver/logs${f?`?service=${encodeURIComponent(f)}&tail=${r}`:`?tail=${r}`}`),restartService:(i,f)=>$(`/sessions/${encodeURIComponent(i)}/devserver/restart-service`,{method:"POST",body:JSON.stringify({service:f})}),getMe:()=>$("/auth/me"),getGitHubAuthUrl:()=>$("/auth/github/url"),getGoogleAuthUrl:()=>$("/auth/google/url"),githubCallback:(i,f)=>$("/auth/github/callback",{method:"POST",body:JSON.stringify({code:i,state:f})}),googleCallback:(i,f,r)=>$("/auth/google/callback",{method:"POST",body:JSON.stringify({code:i,state:f,redirect_uri:r||`${window.location.origin}${window.location.pathname}`})})};class I1{constructor(f){Bn(this,"ws",null);Bn(this,"listeners",new Map);Bn(this,"reconnectTimer",null);Bn(this,"url");this.url=f||W1}connect(){var f;((f=this.ws)==null?void 0:f.readyState)!==WebSocket.OPEN&&(this.ws=new WebSocket(this.url),this.ws.onopen=()=>{this.emit("connected",{message:"WebSocket connected"})},this.ws.onmessage=r=>{try{const o=JSON.parse(r.data);this.emit(o.type,o.data||o)}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(f,r){return this.listeners.has(f)||this.listeners.set(f,new Set),this.listeners.get(f).add(r),()=>{var o;return(o=this.listeners.get(f))==null?void 0:o.delete(r)}}emit(f,r){var o,d;(o=this.listeners.get(f))==null||o.forEach(h=>h(r)),(d=this.listeners.get("*"))==null||d.forEach(h=>h({type:f,data:r}))}send(f){var r;((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify(f))}disconnect(){var f;this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(f=this.ws)==null||f.close(),this.ws=null}}const Vf="pl_auth_token",$h=E.createContext({user:null,loading:!0,login:()=>{},logout:()=>{},isLocalMode:!0});function P1(i,f,r){f(!1),r({email:i.sub||i.email||"",name:i.name||"",avatar_url:i.avatar||"",authenticated:!0})}function tg({children:i}){const[f,r]=E.useState(null),[o,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(()=>{})},[]),C=E.useCallback(()=>{localStorage.removeItem(Vf),r(null),S.pathname!=="/login"&&_("/login",{replace:!0})},[_,S.pathname]),z=E.useMemo(()=>({user:f,loading:o,login:y,logout:C,isLocalMode:h}),[f,o,y,C,h]);return O.jsx($h.Provider,{value:z,children:i})}function kh(){return E.useContext($h)}const Th="pl_sidebar_collapsed",eg=[{to:"/",label:"Home",icon:N1},{to:"/projects",label:"Projects",icon:C1},{to:"/templates",label:"Templates",icon:D1}],lg=[{to:"/settings",label:"Settings",icon:Vh}];function ag(){const[i,f]=E.useState(typeof window<"u"?window.innerWidth<768:!1);return E.useEffect(()=>{const r=()=>f(window.innerWidth<768);return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),i}function ng({wsConnected:i,version:f}){const r=ag(),o=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)},[o.pathname,r]);const S=r?d:!g,y=S?240:64,C=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})=>C(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})=>C(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&&f&&O.jsxs("span",{className:"text-xs text-[#6B6960]",children:["v",f]}),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:f,logout:r,isLocalMode:o}=kh(),[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]),o||!f?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?f.name||f.email:void 0,children:[f.avatar_url?O.jsx("img",{src:f.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:(f.name||f.email||"?")[0].toUpperCase()}),!i&&O.jsxs(O.Fragment,{children:[O.jsx("span",{className:"text-[#36342E] truncate flex-1",children:f.name||f.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:f.name}),O.jsx("p",{className:"text-xs text-[#939084] truncate",children:f.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:$1,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,f]=E.useState(!1),[r,o]=E.useState(0);E.useEffect(()=>{try{localStorage.getItem(zh)!=="1"&&f(!0)}catch{}},[]);const d=()=>{f(!1);try{localStorage.setItem(zh,"1")}catch{}},h=()=>{r<wn.length-1?o(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[f,r]=E.useState(!1),o=E.useRef(null),d=E.useRef(i);E.useEffect(()=>{d.current=i},[i]),E.useEffect(()=>{const g=new I1;return o.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(),o.current=null}},[]);const h=E.useCallback((g,_)=>{var S;return((S=o.current)==null?void 0:S.on(g,_))||(()=>{})},[]);return{connected:f,subscribe:h}}function fg(){const[i,f]=E.useState(""),{connected:r}=cg(()=>{});return E.useEffect(()=>{qa.getStatus().then(o=>{f(o.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(Mv,{})})]})}function _h({children:i}){const{user:f,loading:r,isLocalMode:o}=kh();return r?O.jsx("div",{className:"h-screen bg-[#FAF9F6] flex items-center justify-center text-[#6B6960] text-sm",children:"Loading..."}):o?O.jsx(O.Fragment,{children:i}):f?O.jsx(O.Fragment,{children:i}):O.jsx(Cv,{to:"/login",replace:!0})}function hi({variant:i="text",width:f,height:r,className:o=""}){const d="animate-pulse bg-[#ECEAE3]/60 rounded";if(i==="circle"){const h=f||"2rem";return O.jsx("div",{className:`${d} rounded-full flex-shrink-0 ${o}`,style:{width:h,height:h}})}return i==="block"?O.jsx("div",{className:`${d} rounded-btn ${o}`,style:{width:f||"100%",height:r||"4rem"}}):O.jsx("div",{className:`${d} rounded-btn ${o}`,style:{width:f||"100%",height:r||"0.75rem"}})}function bg(){return O.jsx("div",{className:"p-4 space-y-3",children:[...Array(12)].map((i,f)=>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"})]},f))})}typeof window<"u"&&window.addEventListener("beforeunload",i=>{delete i.returnValue});const og=E.lazy(()=>Pl(()=>import("./HomePage-BtsaYGRR.js"),__vite__mapDeps([0,1,2,3]))),sg=E.lazy(()=>Pl(()=>import("./ProjectPage-DQHsCc2_.js"),__vite__mapDeps([4,3,5,2,6,7,8]))),rg=E.lazy(()=>Pl(()=>import("./ProjectsPage-CUdwe4_n.js"),__vite__mapDeps([9,5,10,1,2,7]))),dg=E.lazy(()=>Pl(()=>import("./TemplatesPage-BR2QjKqV.js"),__vite__mapDeps([11,10,1,2]))),hg=E.lazy(()=>Pl(()=>import("./SettingsPage-4zGDgdk5.js"),__vite__mapDeps([12,10,7]))),mg=E.lazy(()=>Pl(()=>import("./LoginPage-D7RmxUWG.js"),[])),yg=E.lazy(()=>Pl(()=>import("./NotFoundPage-D5Gd5Q79.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(Uv,{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,$1 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,kh 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-Cyfnu-vw.js"></script>
11
+ <script type="module" crossorigin src="/assets/index-pa3JgPvH.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="/assets/index-CQcaFLVo.css">
13
13
  </head>
14
14
  <body class="bg-background text-ink font-sans antialiased">