loki-mode 6.58.0 → 6.59.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 (25) 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-D7TIdZar.js → Badge-Daan3gu4.js} +1 -1
  8. package/web-app/dist/assets/{Button-DKcG2o4d.js → Button-BfeQWtXn.js} +1 -1
  9. package/web-app/dist/assets/{Card-BYPZ_x4V.js → Card-JqwSaE0I.js} +1 -1
  10. package/web-app/dist/assets/{HomePage-HRveXAfF.js → HomePage-ZrDPLDGe.js} +1 -1
  11. package/web-app/dist/assets/{LoginPage-BYCoju0M.js → LoginPage-lJUDQIlI.js} +1 -1
  12. package/web-app/dist/assets/{NotFoundPage-CRt8mn8H.js → NotFoundPage-kZTYx4v_.js} +1 -1
  13. package/web-app/dist/assets/{ProjectPage-Bmpam9ar.js → ProjectPage-DayJk_FX.js} +52 -45
  14. package/web-app/dist/assets/{ProjectsPage-C0VOGkff.js → ProjectsPage-4_PqKgaD.js} +1 -1
  15. package/web-app/dist/assets/{SettingsPage-Ckx_yXi7.js → SettingsPage-DmjFCI0F.js} +1 -1
  16. package/web-app/dist/assets/{TemplatesPage-BwJosahG.js → TemplatesPage-BOX60wWf.js} +1 -1
  17. package/web-app/dist/assets/{TerminalOutput-BWnU0CwK.js → TerminalOutput-B9rfXUCC.js} +1 -1
  18. package/web-app/dist/assets/{arrow-left-BFRA7Jct.js → arrow-left-Rh7PJrlD.js} +1 -1
  19. package/web-app/dist/assets/{clock-DDnIYvRf.js → clock-CDe-IBc9.js} +1 -1
  20. package/web-app/dist/assets/{external-link-ysIuny2I.js → external-link-BviPLjiY.js} +1 -1
  21. package/web-app/dist/assets/{index-DhigFKk5.js → index--VmvfdEx.js} +2 -2
  22. package/web-app/dist/assets/index-DzYIpBt0.css +1 -0
  23. package/web-app/dist/index.html +2 -2
  24. package/web-app/server.py +215 -5
  25. package/web-app/dist/assets/index-CcHKSz7z.css +0 -1
@@ -1,4 +1,4 @@
1
- import{c as p,u as C,r as a,a as j,j as e}from"./index-DhigFKk5.js";import{B as b,P as y,F,T as S}from"./Button-DKcG2o4d.js";import{C as P}from"./Card-BYPZ_x4V.js";import{u as _,B}from"./Badge-D7TIdZar.js";import{E as z}from"./external-link-ysIuny2I.js";import"./clock-DDnIYvRf.js";/**
1
+ import{c as p,u as C,r as a,a as j,j as e}from"./index--VmvfdEx.js";import{B as b,P as y,F,T as S}from"./Button-BfeQWtXn.js";import{C as P}from"./Card-JqwSaE0I.js";import{u as _,B}from"./Badge-Daan3gu4.js";import{E as z}from"./external-link-BviPLjiY.js";import"./clock-CDe-IBc9.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-DhigFKk5.js";import{C as l}from"./Card-BYPZ_x4V.js";import{E as c}from"./external-link-ysIuny2I.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--VmvfdEx.js";import{C as l}from"./Card-JqwSaE0I.js";import{E as c}from"./external-link-BviPLjiY.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-DhigFKk5.js";import{C as p}from"./Card-BYPZ_x4V.js";import{u as d,B as h}from"./Badge-D7TIdZar.js";import"./clock-DDnIYvRf.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--VmvfdEx.js";import{C as p}from"./Card-JqwSaE0I.js";import{u as d,B as h}from"./Badge-Daan3gu4.js";import"./clock-CDe-IBc9.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-DhigFKk5.js";/**
1
+ import{c as o,r as m,j as e}from"./index--VmvfdEx.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-DhigFKk5.js";/**
1
+ import{c as o}from"./index--VmvfdEx.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-DhigFKk5.js";/**
1
+ import{c}from"./index--VmvfdEx.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-DhigFKk5.js";/**
1
+ import{c as a}from"./index--VmvfdEx.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-HRveXAfF.js","assets/Badge-D7TIdZar.js","assets/clock-DDnIYvRf.js","assets/TerminalOutput-BWnU0CwK.js","assets/ProjectPage-Bmpam9ar.js","assets/Button-DKcG2o4d.js","assets/arrow-left-BFRA7Jct.js","assets/external-link-ysIuny2I.js","assets/ProjectPage-9CEnUXvW.css","assets/ProjectsPage-C0VOGkff.js","assets/Card-BYPZ_x4V.js","assets/TemplatesPage-BwJosahG.js","assets/SettingsPage-Ckx_yXi7.js","assets/NotFoundPage-CRt8mn8H.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomePage-ZrDPLDGe.js","assets/Badge-Daan3gu4.js","assets/clock-CDe-IBc9.js","assets/TerminalOutput-B9rfXUCC.js","assets/ProjectPage-DayJk_FX.js","assets/Button-BfeQWtXn.js","assets/arrow-left-Rh7PJrlD.js","assets/external-link-BviPLjiY.js","assets/ProjectPage-9CEnUXvW.css","assets/ProjectsPage-4_PqKgaD.js","assets/Card-JqwSaE0I.js","assets/TemplatesPage-BOX60wWf.js","assets/SettingsPage-DmjFCI0F.js","assets/NotFoundPage-kZTYx4v_.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 $(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=>$("/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,o)=>$(`/sessions/${encodeURIComponent(i)}/file?path=${encodeURIComponent(o)}`),getTemplates:()=>$("/templates"),getTemplateContent:i=>$(`/templates/${encodeURIComponent(i)}`),planSession:(i,o)=>$("/session/plan",{method:"POST",body:JSON.stringify({prd:i,provider:o})}),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,o,r)=>$(`/sessions/${encodeURIComponent(i)}/file`,{method:"PUT",body:JSON.stringify({path:o,content:r})}),createSessionFile:(i,o,r="")=>$(`/sessions/${encodeURIComponent(i)}/file`,{method:"POST",body:JSON.stringify({path:o,content:r})}),deleteSessionFile:(i,o)=>$(`/sessions/${encodeURIComponent(i)}/file`,{method:"DELETE",body:JSON.stringify({path:o})}),createSessionDirectory:(i,o)=>$(`/sessions/${encodeURIComponent(i)}/directory`,{method:"POST",body:JSON.stringify({path:o})}),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"}),chatMessage:(i,o,r="quick")=>$(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:o,mode:r})}),chatStart:(i,o,r="quick")=>$(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:o,mode:r})}),chatPoll:(i,o)=>$(`/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(o)}`),chatStreamUrl:(i,o)=>`${Jh}/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(o)}/stream`,chatCancel:(i,o)=>$(`/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(o)}/cancel`,{method:"POST"}),getPreviewInfo:i=>$(`/sessions/${encodeURIComponent(i)}/preview-info`),devserver:{start:(i,o)=>$(`/sessions/${encodeURIComponent(i)}/devserver/start`,{method:"POST",body:JSON.stringify({command:o||null})}),stop:i=>$(`/sessions/${encodeURIComponent(i)}/devserver/stop`,{method:"POST"}),status:i=>$(`/sessions/${encodeURIComponent(i)}/devserver/status`)},getSecrets:()=>$("/secrets"),setSecret:(i,o)=>$("/secrets",{method:"POST",body:JSON.stringify({key:i,value:o})}),deleteSecret:i=>$(`/secrets/${encodeURIComponent(i)}`,{method:"DELETE"}),getMe:()=>$("/auth/me"),getGitHubAuthUrl:()=>$("/auth/github/url"),getGoogleAuthUrl:()=>$("/auth/google/url"),githubCallback:(i,o)=>$("/auth/github/callback",{method:"POST",body:JSON.stringify({code:i,state:o})}),googleCallback:(i,o,r)=>$("/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(()=>{})},[]),C=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:C,isLocalMode:h}),[o,f,y,C,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:C1},{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,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&&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(Mv,{})})]})}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(Cv,{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))})}typeof window<"u"&&window.addEventListener("beforeunload",i=>{delete i.returnValue});const og=E.lazy(()=>Pl(()=>import("./HomePage-HRveXAfF.js"),__vite__mapDeps([0,1,2,3]))),sg=E.lazy(()=>Pl(()=>import("./ProjectPage-Bmpam9ar.js"),__vite__mapDeps([4,3,5,2,6,7,8]))),rg=E.lazy(()=>Pl(()=>import("./ProjectsPage-C0VOGkff.js"),__vite__mapDeps([9,5,10,1,2,7]))),dg=E.lazy(()=>Pl(()=>import("./TemplatesPage-BwJosahG.js"),__vite__mapDeps([11,10,1,2]))),hg=E.lazy(()=>Pl(()=>import("./SettingsPage-Ckx_yXi7.js"),__vite__mapDeps([12,10,7]))),mg=E.lazy(()=>Pl(()=>import("./LoginPage-BYCoju0M.js"),[])),yg=E.lazy(()=>Pl(()=>import("./NotFoundPage-CRt8mn8H.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 $(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=>$("/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,o)=>$(`/sessions/${encodeURIComponent(i)}/file?path=${encodeURIComponent(o)}`),getTemplates:()=>$("/templates"),getTemplateContent:i=>$(`/templates/${encodeURIComponent(i)}`),planSession:(i,o)=>$("/session/plan",{method:"POST",body:JSON.stringify({prd:i,provider:o})}),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,o,r)=>$(`/sessions/${encodeURIComponent(i)}/file`,{method:"PUT",body:JSON.stringify({path:o,content:r})}),createSessionFile:(i,o,r="")=>$(`/sessions/${encodeURIComponent(i)}/file`,{method:"POST",body:JSON.stringify({path:o,content:r})}),deleteSessionFile:(i,o)=>$(`/sessions/${encodeURIComponent(i)}/file`,{method:"DELETE",body:JSON.stringify({path:o})}),createSessionDirectory:(i,o)=>$(`/sessions/${encodeURIComponent(i)}/directory`,{method:"POST",body:JSON.stringify({path:o})}),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,o,r="quick")=>$(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:o,mode:r})}),chatStart:(i,o,r="quick")=>$(`/sessions/${encodeURIComponent(i)}/chat`,{method:"POST",body:JSON.stringify({message:o,mode:r})}),chatPoll:(i,o)=>$(`/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(o)}`),chatStreamUrl:(i,o)=>`${Jh}/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(o)}/stream`,chatCancel:(i,o)=>$(`/sessions/${encodeURIComponent(i)}/chat/${encodeURIComponent(o)}/cancel`,{method:"POST"}),getPreviewInfo:i=>$(`/sessions/${encodeURIComponent(i)}/preview-info`),devserver:{start:(i,o)=>$(`/sessions/${encodeURIComponent(i)}/devserver/start`,{method:"POST",body:JSON.stringify({command:o||null})}),stop:i=>$(`/sessions/${encodeURIComponent(i)}/devserver/stop`,{method:"POST"}),status:i=>$(`/sessions/${encodeURIComponent(i)}/devserver/status`)},getSecrets:()=>$("/secrets"),setSecret:(i,o)=>$("/secrets",{method:"POST",body:JSON.stringify({key:i,value:o})}),deleteSecret:i=>$(`/secrets/${encodeURIComponent(i)}`,{method:"DELETE"}),getMe:()=>$("/auth/me"),getGitHubAuthUrl:()=>$("/auth/github/url"),getGoogleAuthUrl:()=>$("/auth/google/url"),githubCallback:(i,o)=>$("/auth/github/callback",{method:"POST",body:JSON.stringify({code:i,state:o})}),googleCallback:(i,o,r)=>$("/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(()=>{})},[]),C=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:C,isLocalMode:h}),[o,f,y,C,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:C1},{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,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&&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(Mv,{})})]})}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(Cv,{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))})}typeof window<"u"&&window.addEventListener("beforeunload",i=>{delete i.returnValue});const og=E.lazy(()=>Pl(()=>import("./HomePage-ZrDPLDGe.js"),__vite__mapDeps([0,1,2,3]))),sg=E.lazy(()=>Pl(()=>import("./ProjectPage-DayJk_FX.js"),__vite__mapDeps([4,3,5,2,6,7,8]))),rg=E.lazy(()=>Pl(()=>import("./ProjectsPage-4_PqKgaD.js"),__vite__mapDeps([9,5,10,1,2,7]))),dg=E.lazy(()=>Pl(()=>import("./TemplatesPage-BOX60wWf.js"),__vite__mapDeps([11,10,1,2]))),hg=E.lazy(()=>Pl(()=>import("./SettingsPage-DmjFCI0F.js"),__vite__mapDeps([12,10,7]))),mg=E.lazy(()=>Pl(()=>import("./LoginPage-lJUDQIlI.js"),[])),yg=E.lazy(()=>Pl(()=>import("./NotFoundPage-kZTYx4v_.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};
@@ -0,0 +1 @@
1
+ *,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter,system-ui,-apple-system,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,Fira Code,Cascadia Code,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}html{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.terminal-scroll::-webkit-scrollbar{width:6px}.terminal-scroll::-webkit-scrollbar-track{background:transparent}.terminal-scroll::-webkit-scrollbar-thumb{background:#553de933;border-radius:3px}.terminal-scroll::-webkit-scrollbar-thumb:hover{background:#553de959}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.card{background:#fff;border:1px solid #ECEAE3;border-radius:5px;box-shadow:0 1px 3px #0000000f}.card:hover,.card-hover:hover{box-shadow:0 5px 10px #00000014}.pattern-nodes{position:absolute;top:0;right:0;bottom:0;left:0;opacity:.04;pointer-events:none;background-image:radial-gradient(circle at 10% 20%,#553DE9 1px,transparent 1px),radial-gradient(circle at 30% 60%,#553DE9 1px,transparent 1px),radial-gradient(circle at 50% 40%,#553DE9 1px,transparent 1px),radial-gradient(circle at 70% 80%,#553DE9 1px,transparent 1px),radial-gradient(circle at 90% 30%,#553DE9 1px,transparent 1px);background-size:200px 200px}*:focus-visible{outline:2px solid #553DE9;outline-offset:2px}::-moz-selection{background:#e8e4fd;color:#201515}::selection{background:#e8e4fd;color:#201515}@media(prefers-reduced-motion:reduce){.phase-active{animation:none}}@keyframes phase-pulse{0%,to{opacity:1}50%{opacity:.5}}.phase-active{animation:phase-pulse 2s ease-in-out infinite}@keyframes cursor-blink{0%,to{opacity:1}50%{opacity:0}}.terminal-cursor:after{content:"";display:inline-block;width:8px;height:16px;background:#553de9;animation:cursor-blink 1s step-end infinite;margin-left:2px;vertical-align:text-bottom}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.\!visible{visibility:visible!important}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.bottom-6{bottom:1.5rem}.bottom-full{bottom:100%}.left-0{left:0}.left-3{left:.75rem}.right-0{right:0}.right-2\.5{right:.625rem}.right-6{right:1.5rem}.top-1\/2{top:50%}.top-2\.5{top:.625rem}.top-8{top:2rem}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.col-span-3{grid-column:span 3 / span 3}.col-span-4{grid-column:span 4 / span 4}.col-span-5{grid-column:span 5 / span 5}.col-span-6{grid-column:span 6 / span 6}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-10{margin-bottom:2.5rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.contents{display:contents}.hidden{display:none}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-28{height:7rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-40{max-height:10rem}.max-h-64{max-height:16rem}.max-h-\[400px\]{max-height:400px}.min-h-0{min-height:0px}.min-h-\[120px\]{min-height:120px}.min-h-\[280px\]{min-height:280px}.min-h-\[60vh\]{min-height:60vh}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-28{width:7rem}.w-3{width:.75rem}.w-4{width:1rem}.w-44{width:11rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[160px\]{min-width:160px}.max-w-3xl{max-width:48rem}.max-w-\[1400px\]{max-width:1400px}.max-w-\[1920px\]{max-width:1920px}.max-w-\[200px\]{max-width:200px}.max-w-\[220px\]{max-width:220px}.max-w-\[80\%\]{max-width:80%}.max-w-\[800px\]{max-width:800px}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-col-resize{cursor:col-resize}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-row-resize{cursor:row-resize}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-\[3px\]{border-radius:3px}.rounded-\[5px\]{border-radius:5px}.rounded-btn{border-radius:4px}.rounded-card{border-radius:5px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-t-card{border-top-left-radius:5px;border-top-right-radius:5px}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-\[\#553DE9\]{--tw-border-opacity: 1;border-color:rgb(85 61 233 / var(--tw-border-opacity, 1))}.border-\[\#553DE9\]\/30{border-color:#553de94d}.border-\[\#C45B5B\]\/20{border-color:#c45b5b33}.border-\[\#ECEAE3\],.border-border{--tw-border-opacity: 1;border-color:rgb(236 234 227 / var(--tw-border-opacity, 1))}.border-border-light{--tw-border-opacity: 1;border-color:rgb(197 192 177 / var(--tw-border-opacity, 1))}.border-border\/50{border-color:#eceae380}.border-danger\/10{border-color:#c45b5b1a}.border-danger\/20{border-color:#c45b5b33}.border-danger\/30{border-color:#c45b5b4d}.border-danger\/40{border-color:#c45b5b66}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-muted\/20{border-color:#93908433}.border-primary{--tw-border-opacity: 1;border-color:rgb(85 61 233 / var(--tw-border-opacity, 1))}.border-primary\/20{border-color:#553de933}.border-primary\/30{border-color:#553de94d}.border-primary\/40{border-color:#553de966}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-success\/20{border-color:#1fc5a833}.border-transparent{border-color:transparent}.border-warning\/10{border-color:#d4a03c1a}.border-warning\/20{border-color:#d4a03c33}.border-warning\/30{border-color:#d4a03c4d}.border-warning\/40{border-color:#d4a03c66}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-t-transparent{border-top-color:transparent}.bg-\[\#1FC5A8\]{--tw-bg-opacity: 1;background-color:rgb(31 197 168 / var(--tw-bg-opacity, 1))}.bg-\[\#1FC5A8\]\/10{background-color:#1fc5a81a}.bg-\[\#24292f\]{--tw-bg-opacity: 1;background-color:rgb(36 41 47 / var(--tw-bg-opacity, 1))}.bg-\[\#36342E\]{--tw-bg-opacity: 1;background-color:rgb(54 52 46 / var(--tw-bg-opacity, 1))}.bg-\[\#553DE9\]{--tw-bg-opacity: 1;background-color:rgb(85 61 233 / var(--tw-bg-opacity, 1))}.bg-\[\#553DE9\]\/10{background-color:#553de91a}.bg-\[\#C45B5B\]{--tw-bg-opacity: 1;background-color:rgb(196 91 91 / var(--tw-bg-opacity, 1))}.bg-\[\#C45B5B\]\/10{background-color:#c45b5b1a}.bg-\[\#D4A03C\]\/10{background-color:#d4a03c1a}.bg-\[\#ECEAE3\]\/60{background-color:#eceae399}.bg-\[\#F8F4F0\]{--tw-bg-opacity: 1;background-color:rgb(248 244 240 / var(--tw-bg-opacity, 1))}.bg-\[\#FAF9F6\]{--tw-bg-opacity: 1;background-color:rgb(250 249 246 / var(--tw-bg-opacity, 1))}.bg-background{--tw-bg-opacity: 1;background-color:rgb(255 254 251 / var(--tw-bg-opacity, 1))}.bg-black\/30{background-color:#0000004d}.bg-black\/40{background-color:#0006}.bg-black\/5{background-color:#0000000d}.bg-border{--tw-bg-opacity: 1;background-color:rgb(236 234 227 / var(--tw-bg-opacity, 1))}.bg-border\/30{background-color:#eceae34d}.bg-card{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-card\/50{background-color:#ffffff80}.bg-current{background-color:currentColor}.bg-danger{--tw-bg-opacity: 1;background-color:rgb(196 91 91 / var(--tw-bg-opacity, 1))}.bg-danger\/10{background-color:#c45b5b1a}.bg-danger\/5{background-color:#c45b5b0d}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-hover{--tw-bg-opacity: 1;background-color:rgb(248 244 240 / var(--tw-bg-opacity, 1))}.bg-info{--tw-bg-opacity: 1;background-color:rgb(47 113 227 / var(--tw-bg-opacity, 1))}.bg-ink\/20{background-color:#20151533}.bg-ink\/30{background-color:#2015154d}.bg-ink\/\[0\.03\]{background-color:#20151508}.bg-muted{--tw-bg-opacity: 1;background-color:rgb(147 144 132 / var(--tw-bg-opacity, 1))}.bg-muted\/10{background-color:#9390841a}.bg-muted\/30{background-color:#9390844d}.bg-muted\/40{background-color:#93908466}.bg-primary{--tw-bg-opacity: 1;background-color:rgb(85 61 233 / var(--tw-bg-opacity, 1))}.bg-primary\/10{background-color:#553de91a}.bg-primary\/5{background-color:#553de90d}.bg-primary\/60{background-color:#553de999}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-success{--tw-bg-opacity: 1;background-color:rgb(31 197 168 / var(--tw-bg-opacity, 1))}.bg-success\/10{background-color:#1fc5a81a}.bg-transparent{background-color:transparent}.bg-warning{--tw-bg-opacity: 1;background-color:rgb(212 160 60 / var(--tw-bg-opacity, 1))}.bg-warning\/10{background-color:#d4a03c1a}.bg-warning\/5{background-color:#d4a03c0d}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.fill-ink{fill:#201515}.fill-primary{fill:#553de9}.p-0{padding:0}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-2\.5{padding-bottom:.625rem}.pb-4{padding-bottom:1rem}.pl-3{padding-left:.75rem}.pl-9{padding-left:2.25rem}.pr-2{padding-right:.5rem}.pr-3{padding-right:.75rem}.pr-6{padding-right:1.5rem}.pt-0{padding-top:0}.pt-2{padding-top:.5rem}.pt-5{padding-top:1.25rem}.pt-\[20vh\]{padding-top:20vh}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-text-bottom{vertical-align:text-bottom}.font-heading{font-family:DM Serif Display,Georgia,Times New Roman,serif}.font-mono{font-family:JetBrains Mono,Fira Code,Cascadia Code,monospace}.font-sans{font-family:Inter,system-ui,-apple-system,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-6xl{font-size:3.75rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-h1{font-size:2.5rem;line-height:1;letter-spacing:-.01em}.text-h3{font-size:1.25rem;line-height:1.4}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.text-\[\#1FC5A8\]{--tw-text-opacity: 1;color:rgb(31 197 168 / var(--tw-text-opacity, 1))}.text-\[\#36342E\]{--tw-text-opacity: 1;color:rgb(54 52 46 / var(--tw-text-opacity, 1))}.text-\[\#553DE9\]{--tw-text-opacity: 1;color:rgb(85 61 233 / var(--tw-text-opacity, 1))}.text-\[\#6B6960\]{--tw-text-opacity: 1;color:rgb(107 105 96 / var(--tw-text-opacity, 1))}.text-\[\#939084\]{--tw-text-opacity: 1;color:rgb(147 144 132 / var(--tw-text-opacity, 1))}.text-\[\#B8B5AD\]{--tw-text-opacity: 1;color:rgb(184 181 173 / var(--tw-text-opacity, 1))}.text-\[\#C45B5B\]{--tw-text-opacity: 1;color:rgb(196 91 91 / var(--tw-text-opacity, 1))}.text-\[\#D4A03C\]{--tw-text-opacity: 1;color:rgb(212 160 60 / var(--tw-text-opacity, 1))}.text-cyan-600{--tw-text-opacity: 1;color:rgb(8 145 178 / var(--tw-text-opacity, 1))}.text-danger{--tw-text-opacity: 1;color:rgb(196 91 91 / var(--tw-text-opacity, 1))}.text-danger\/70{color:#c45b5bb3}.text-danger\/80{color:#c45b5bcc}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-info{--tw-text-opacity: 1;color:rgb(47 113 227 / var(--tw-text-opacity, 1))}.text-ink{--tw-text-opacity: 1;color:rgb(32 21 21 / var(--tw-text-opacity, 1))}.text-ink\/70{color:#201515b3}.text-muted{--tw-text-opacity: 1;color:rgb(147 144 132 / var(--tw-text-opacity, 1))}.text-muted-accessible{--tw-text-opacity: 1;color:rgb(107 105 96 / var(--tw-text-opacity, 1))}.text-muted\/30{color:#9390844d}.text-muted\/40{color:#93908466}.text-muted\/50{color:#93908480}.text-muted\/60{color:#93908499}.text-muted\/70{color:#939084b3}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-primary{--tw-text-opacity: 1;color:rgb(85 61 233 / var(--tw-text-opacity, 1))}.text-primary\/20{color:#553de933}.text-primary\/60{color:#553de999}.text-primary\/80{color:#553de9cc}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary{--tw-text-opacity: 1;color:rgb(54 52 46 / var(--tw-text-opacity, 1))}.text-success{--tw-text-opacity: 1;color:rgb(31 197 168 / var(--tw-text-opacity, 1))}.text-warning{--tw-text-opacity: 1;color:rgb(212 160 60 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-white\/60{color:#fff9}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.opacity-0{opacity:0}.opacity-25{opacity:.25}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-button{--tw-shadow: 0 1px 3px rgba(0,0,0,.08);--tw-shadow-colored: 0 1px 3px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-card{--tw-shadow: 0 1px 3px rgba(0,0,0,.06);--tw-shadow-colored: 0 1px 3px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-card-hover{--tw-shadow: 0 5px 10px rgba(0,0,0,.08);--tw-shadow-colored: 0 5px 10px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[\#553DE9\]\/20{--tw-shadow-color: rgb(85 61 233 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-card{--tw-shadow-color: #FFFFFF;--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-\[\#553DE9\]{--tw-ring-opacity: 1;--tw-ring-color: rgb(85 61 233 / var(--tw-ring-opacity, 1))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-500{transition-duration:.5s}.placeholder\:text-\[\#939084\]::-moz-placeholder{--tw-text-opacity: 1;color:rgb(147 144 132 / var(--tw-text-opacity, 1))}.placeholder\:text-\[\#939084\]::placeholder{--tw-text-opacity: 1;color:rgb(147 144 132 / var(--tw-text-opacity, 1))}.placeholder\:text-muted::-moz-placeholder{--tw-text-opacity: 1;color:rgb(147 144 132 / var(--tw-text-opacity, 1))}.placeholder\:text-muted::placeholder{--tw-text-opacity: 1;color:rgb(147 144 132 / var(--tw-text-opacity, 1))}.placeholder\:text-primary\/60::-moz-placeholder{color:#553de999}.placeholder\:text-primary\/60::placeholder{color:#553de999}.last\:border-b-0:last-child{border-bottom-width:0px}.hover\:border-border:hover{--tw-border-opacity: 1;border-color:rgb(236 234 227 / var(--tw-border-opacity, 1))}.hover\:border-primary\/30:hover{border-color:#553de94d}.hover\:bg-\[\#1b1f23\]:hover{--tw-bg-opacity: 1;background-color:rgb(27 31 35 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#4432c4\]:hover{--tw-bg-opacity: 1;background-color:rgb(68 50 196 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#553DE9\]\/5:hover{background-color:#553de90d}.hover\:bg-\[\#553DE9\]\/90:hover{background-color:#553de9e6}.hover\:bg-\[\#C45B5B\]\/20:hover{background-color:#c45b5b33}.hover\:bg-\[\#E8E4FD\]:hover{--tw-bg-opacity: 1;background-color:rgb(232 228 253 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#ECEAE3\]:hover{--tw-bg-opacity: 1;background-color:rgb(236 234 227 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#F8F4F0\]:hover{--tw-bg-opacity: 1;background-color:rgb(248 244 240 / var(--tw-bg-opacity, 1))}.hover\:bg-card:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.hover\:bg-danger\/10:hover{background-color:#c45b5b1a}.hover\:bg-danger\/20:hover{background-color:#c45b5b33}.hover\:bg-hover:hover{--tw-bg-opacity: 1;background-color:rgb(248 244 240 / var(--tw-bg-opacity, 1))}.hover\:bg-primary-hover:hover{--tw-bg-opacity: 1;background-color:rgb(68 50 196 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/20:hover{background-color:#553de933}.hover\:bg-primary\/30:hover{background-color:#553de94d}.hover\:bg-primary\/5:hover{background-color:#553de90d}.hover\:bg-primary\/90:hover{background-color:#553de9e6}.hover\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/20:hover{background-color:#ef444433}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-warning\/10:hover{background-color:#d4a03c1a}.hover\:bg-warning\/20:hover{background-color:#d4a03c33}.hover\:text-\[\#36342E\]:hover{--tw-text-opacity: 1;color:rgb(54 52 46 / var(--tw-text-opacity, 1))}.hover\:text-\[\#553DE9\]:hover{--tw-text-opacity: 1;color:rgb(85 61 233 / var(--tw-text-opacity, 1))}.hover\:text-danger:hover{--tw-text-opacity: 1;color:rgb(196 91 91 / var(--tw-text-opacity, 1))}.hover\:text-ink:hover{--tw-text-opacity: 1;color:rgb(32 21 21 / var(--tw-text-opacity, 1))}.hover\:text-primary:hover{--tw-text-opacity: 1;color:rgb(85 61 233 / var(--tw-text-opacity, 1))}.hover\:text-primary\/80:hover{color:#553de9cc}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:shadow-card-hover:hover{--tw-shadow: 0 5px 10px rgba(0,0,0,.08);--tw-shadow-colored: 0 5px 10px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:not-sr-only:focus{position:static;width:auto;height:auto;padding:0;margin:0;overflow:visible;clip:auto;white-space:normal}.focus\:absolute:focus{position:absolute}.focus\:left-2:focus{left:.5rem}.focus\:top-2:focus{top:.5rem}.focus\:z-50:focus{z-index:50}.focus\:rounded-\[3px\]:focus{border-radius:3px}.focus\:border-\[\#553DE9\]:focus{--tw-border-opacity: 1;border-color:rgb(85 61 233 / var(--tw-border-opacity, 1))}.focus\:border-primary:focus{--tw-border-opacity: 1;border-color:rgb(85 61 233 / var(--tw-border-opacity, 1))}.focus\:border-primary\/30:focus{border-color:#553de94d}.focus\:bg-white:focus{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.focus\:px-4:focus{padding-left:1rem;padding-right:1rem}.focus\:py-2:focus{padding-top:.5rem;padding-bottom:.5rem}.focus\:text-\[\#553DE9\]:focus{--tw-text-opacity: 1;color:rgb(85 61 233 / var(--tw-text-opacity, 1))}.focus\:shadow-card:focus{--tw-shadow: 0 1px 3px rgba(0,0,0,.06);--tw-shadow-colored: 0 1px 3px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);--tw-shadow-color: #FFFFFF;--tw-shadow: var(--tw-shadow-colored)}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-\[\#553DE9\]\/20:focus{--tw-ring-color: rgb(85 61 233 / .2)}.focus\:ring-primary\/20:focus{--tw-ring-color: rgb(85 61 233 / .2)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:text-primary{--tw-text-opacity: 1;color:rgb(85 61 233 / var(--tw-text-opacity, 1))}.group\/file:hover .group-hover\/file\:opacity-100{opacity:1}@media(prefers-reduced-motion:reduce){.motion-reduce\:animate-none{animation:none}}@media(min-width:768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(min-width:1024px){.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}
@@ -8,8 +8,8 @@
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-DhigFKk5.js"></script>
12
- <link rel="stylesheet" crossorigin href="/assets/index-CcHKSz7z.css">
11
+ <script type="module" crossorigin src="/assets/index--VmvfdEx.js"></script>
12
+ <link rel="stylesheet" crossorigin href="/assets/index-DzYIpBt0.css">
13
13
  </head>
14
14
  <body class="bg-background text-ink font-sans antialiased">
15
15
  <div id="root"></div>
package/web-app/server.py CHANGED
@@ -866,6 +866,80 @@ class DevServerManager:
866
866
  # Process exited -- mark as error if it was still starting or running
867
867
  if info.get("status") in ("starting", "running"):
868
868
  info["status"] = "error"
869
+ # Auto-fix: trigger error repair if under circuit breaker limit
870
+ attempts = info.get("auto_fix_attempts", 0)
871
+ if attempts < 3:
872
+ info["auto_fix_attempts"] = attempts + 1
873
+ error_context = "\n".join(info.get("output_lines", [])[-30:])
874
+ try:
875
+ asyncio.ensure_future(
876
+ self._auto_fix(session_id, error_context)
877
+ )
878
+ except Exception:
879
+ pass
880
+
881
+ async def _auto_fix(self, session_id: str, error_context: str) -> None:
882
+ """Auto-fix a crashed dev server by invoking loki quick with the error."""
883
+ info = self.servers.get(session_id)
884
+ if not info:
885
+ return
886
+
887
+ attempt = info.get("auto_fix_attempts", 1)
888
+ # Preserve auto_fix_attempts across stop/start to maintain circuit breaker
889
+ saved_attempts = info.get("auto_fix_attempts", 0)
890
+ info["auto_fix_status"] = f"fixing (attempt {attempt}/3)"
891
+ logger.info("Auto-fix attempt %d/3 for session %s", attempt, session_id)
892
+
893
+ # Find the project directory for this session
894
+ target = _find_session_dir(session_id)
895
+ if target is None:
896
+ info["auto_fix_status"] = "failed (session not found)"
897
+ return
898
+
899
+ loki = _find_loki_cli()
900
+ if loki is None:
901
+ info["auto_fix_status"] = "failed (loki CLI not found)"
902
+ return
903
+
904
+ fix_message = (
905
+ f"The dev server crashed. Fix the error and ensure the app starts correctly.\n\n"
906
+ f"DEV SERVER ERROR OUTPUT:\n{error_context}"
907
+ )
908
+
909
+ # Save original command before stop() removes the info dict
910
+ cmd = info.get("command")
911
+
912
+ try:
913
+ result = await asyncio.get_running_loop().run_in_executor(
914
+ None,
915
+ lambda: subprocess.run(
916
+ [loki, "quick", fix_message],
917
+ cwd=str(target),
918
+ capture_output=True,
919
+ text=True,
920
+ timeout=300,
921
+ env={**os.environ},
922
+ start_new_session=True,
923
+ ),
924
+ )
925
+ if result.returncode == 0:
926
+ logger.info("Auto-fix succeeded for session %s, restarting dev server", session_id)
927
+ # Restart the dev server
928
+ await self.stop(session_id)
929
+ await asyncio.sleep(1)
930
+ await self.start(session_id, str(target), command=cmd)
931
+ # Transfer circuit breaker state to the new info dict
932
+ new_info = self.servers.get(session_id)
933
+ if new_info:
934
+ new_info["auto_fix_attempts"] = saved_attempts
935
+ new_info["auto_fix_status"] = "fixed, restarting..."
936
+ else:
937
+ # info may be stale after stop, but we only read from it here
938
+ info["auto_fix_status"] = f"fix attempt {attempt} failed"
939
+ logger.warning("Auto-fix attempt %d failed for session %s", attempt, session_id)
940
+ except Exception as e:
941
+ info["auto_fix_status"] = f"fix error: {str(e)[:100]}"
942
+ logger.error("Auto-fix error for session %s: %s", session_id, e)
869
943
 
870
944
  async def _health_check(self, port: int, retries: int = 3) -> bool:
871
945
  """Check if a port is responding to TCP connections."""
@@ -980,6 +1054,8 @@ class DevServerManager:
980
1054
  "url": f"/proxy/{session_id}/" if info.get("port") and alive else None,
981
1055
  "framework": info.get("framework"),
982
1056
  "output": info.get("output_lines", [])[-20:],
1057
+ "auto_fix_status": info.get("auto_fix_status"),
1058
+ "auto_fix_attempts": info.get("auto_fix_attempts", 0),
983
1059
  }
984
1060
  if info.get("use_portless") and info.get("portless_app_name"):
985
1061
  app_name = info["portless_app_name"]
@@ -2518,8 +2594,6 @@ async def chat_session(session_id: str, req: ChatRequest) -> JSONResponse:
2518
2594
  return JSONResponse(status_code=404, content={"error": "Session not found"})
2519
2595
 
2520
2596
  # Clean up old completed tasks to prevent unbounded memory growth
2521
- _cleanup_chat_tasks()
2522
-
2523
2597
  _cleanup_chat_tasks()
2524
2598
  task = ChatTask()
2525
2599
  _chat_tasks[task.id] = task
@@ -2536,6 +2610,33 @@ async def chat_session(session_id: str, req: ChatRequest) -> JSONResponse:
2536
2610
  # This runs claude (or configured provider) in the project directory
2537
2611
  # to make changes based on the user's prompt -- works both during
2538
2612
  # active sessions and post-completion for iterative development.
2613
+
2614
+ # -- Phase 1: Inject project context (dev server errors, gate failures) --
2615
+ context_parts = [req.message]
2616
+
2617
+ # Inject dev server errors if the server has crashed
2618
+ ds_info = dev_server_manager.servers.get(session_id)
2619
+ if ds_info and ds_info.get("status") == "error":
2620
+ error_lines = ds_info.get("output_lines", [])[-30:]
2621
+ if error_lines:
2622
+ context_parts.append(
2623
+ "\n\nDEV SERVER ERROR (fix this):\n" + "\n".join(error_lines)
2624
+ )
2625
+
2626
+ # Inject quality gate failures if any
2627
+ gate_file = target / ".loki" / "quality" / "gate-failures.txt"
2628
+ if gate_file.exists():
2629
+ try:
2630
+ gate_text = gate_file.read_text()[:2000]
2631
+ if gate_text.strip():
2632
+ context_parts.append(
2633
+ "\n\nQUALITY GATE FAILURES:\n" + gate_text
2634
+ )
2635
+ except OSError:
2636
+ pass
2637
+
2638
+ full_message = "\n".join(context_parts)
2639
+
2539
2640
  # Inject Docker Compose requirement into prompts so generated projects
2540
2641
  # always include a docker-compose.yml for containerized execution.
2541
2642
  docker_note = " (IMPORTANT: include a Dockerfile and docker-compose.yml so the app runs in a container via 'docker compose up')"
@@ -2550,12 +2651,12 @@ async def chat_session(session_id: str, req: ChatRequest) -> JSONResponse:
2550
2651
  # Max mode: full loki start with the message as a PRD
2551
2652
  prd_path = target / ".loki" / "chat-prd.md"
2552
2653
  prd_path.parent.mkdir(parents=True, exist_ok=True)
2553
- prd_content = req.message + "\n\n## Deployment\nMUST include Dockerfile and docker-compose.yml for containerized execution." + docker_extra
2654
+ prd_content = full_message + "\n\n## Deployment\nMUST include Dockerfile and docker-compose.yml for containerized execution." + docker_extra
2554
2655
  prd_path.write_text(prd_content)
2555
2656
  cmd_args = [loki, "start", "--provider", "claude", str(prd_path)]
2556
2657
  else:
2557
2658
  # Quick and Standard both use 'loki quick' -- fast, focused changes
2558
- cmd_args = [loki, "quick", req.message + docker_note]
2659
+ cmd_args = [loki, "quick", full_message + docker_note]
2559
2660
  try:
2560
2661
  proc = subprocess.Popen(
2561
2662
  cmd_args,
@@ -2586,7 +2687,17 @@ async def chat_session(session_id: str, req: ChatRequest) -> JSONResponse:
2586
2687
  continue
2587
2688
  if not stripped:
2588
2689
  continue
2589
- task.output_lines.append(clean)
2690
+ # Skip npm noise lines
2691
+ if any(noise in stripped for noise in ("npm warn", "npm notice", "npm WARN")):
2692
+ continue
2693
+ # Categorize file change lines for structured frontend display
2694
+ if (stripped.startswith("Created ") or stripped.startswith("Modified ") or
2695
+ stripped.startswith("Deleted ") or stripped.startswith("Wrote ")):
2696
+ task.output_lines.append(f"__FILE_CHANGE__{clean}")
2697
+ elif (stripped.startswith("$ ") or stripped.startswith("Running: ")):
2698
+ task.output_lines.append(f"__COMMAND__{clean}")
2699
+ else:
2700
+ task.output_lines.append(clean)
2590
2701
  proc.stdout.close()
2591
2702
 
2592
2703
  await asyncio.wait_for(
@@ -2747,6 +2858,105 @@ async def cancel_chat(session_id: str, task_id: str) -> JSONResponse:
2747
2858
  return JSONResponse(content={"cancelled": True})
2748
2859
 
2749
2860
 
2861
+ @app.post("/api/sessions/{session_id}/fix")
2862
+ async def fix_session(session_id: str) -> JSONResponse:
2863
+ """Run loki quick with dev server error context to auto-fix crashes."""
2864
+ if not re.match(r"^[a-zA-Z0-9._-]+$", session_id):
2865
+ return JSONResponse(status_code=400, content={"error": "Invalid session ID"})
2866
+ target = _find_session_dir(session_id)
2867
+ if target is None:
2868
+ return JSONResponse(status_code=404, content={"error": "Session not found"})
2869
+
2870
+ # Gather error context from dev server output
2871
+ ds_info = dev_server_manager.servers.get(session_id)
2872
+ error_lines: list[str] = []
2873
+ if ds_info:
2874
+ error_lines = ds_info.get("output_lines", [])[-30:]
2875
+
2876
+ if not error_lines:
2877
+ return JSONResponse(status_code=400, content={"error": "No dev server error output to fix"})
2878
+
2879
+ error_context = "\n".join(error_lines)
2880
+ fix_message = (
2881
+ f"The dev server crashed. Fix the error and ensure the app starts correctly.\n\n"
2882
+ f"DEV SERVER ERROR OUTPUT:\n{error_context}"
2883
+ )
2884
+
2885
+ # Use the chat endpoint flow -- create a task and return task_id
2886
+ _cleanup_chat_tasks()
2887
+ task = ChatTask()
2888
+ _chat_tasks[task.id] = task
2889
+
2890
+ async def run_fix() -> None:
2891
+ loki = _find_loki_cli()
2892
+ if loki is None:
2893
+ task.output_lines = ["loki CLI not found"]
2894
+ task.returncode = 1
2895
+ task.complete = True
2896
+ return
2897
+ proc: Optional[subprocess.Popen] = None
2898
+ try:
2899
+ proc = subprocess.Popen(
2900
+ [loki, "quick", fix_message],
2901
+ stdout=subprocess.PIPE,
2902
+ stderr=subprocess.STDOUT,
2903
+ stdin=subprocess.DEVNULL,
2904
+ text=True,
2905
+ cwd=str(target),
2906
+ env={**os.environ},
2907
+ start_new_session=True,
2908
+ )
2909
+ task.process = proc
2910
+ loop = asyncio.get_running_loop()
2911
+
2912
+ def _read() -> None:
2913
+ assert proc.stdout is not None
2914
+ for raw_line in proc.stdout:
2915
+ if task.cancelled:
2916
+ break
2917
+ clean = re.sub(r'\x1b\[[0-9;]*[a-zA-Z]', '', raw_line.rstrip("\n"))
2918
+ stripped = clean.strip()
2919
+ if stripped in ("[Tool: Read]", "[Tool: Bash]", "[Tool: Write]",
2920
+ "[Tool: Edit]", "[Tool: Grep]", "[Tool: Glob]",
2921
+ "[Result]", "[Thinking]"):
2922
+ continue
2923
+ if not stripped:
2924
+ continue
2925
+ task.output_lines.append(clean)
2926
+ proc.stdout.close()
2927
+
2928
+ await asyncio.wait_for(loop.run_in_executor(None, _read), timeout=300)
2929
+ proc.wait(timeout=10)
2930
+ task.returncode = proc.returncode
2931
+ except asyncio.TimeoutError:
2932
+ if proc is not None:
2933
+ try:
2934
+ os.killpg(os.getpgid(proc.pid), signal.SIGKILL)
2935
+ except (ProcessLookupError, OSError):
2936
+ proc.kill()
2937
+ proc.wait()
2938
+ task.output_lines.append("Fix timed out after 5 minutes")
2939
+ task.returncode = 1
2940
+ except Exception as e:
2941
+ task.output_lines.append(str(e))
2942
+ task.returncode = 1
2943
+ if proc is not None and proc.poll() is None:
2944
+ try:
2945
+ os.killpg(os.getpgid(proc.pid), signal.SIGKILL)
2946
+ except (ProcessLookupError, OSError):
2947
+ proc.kill()
2948
+ proc.wait()
2949
+ task.complete = True
2950
+
2951
+ asyncio.create_task(run_fix())
2952
+
2953
+ return JSONResponse(content={
2954
+ "task_id": task.id,
2955
+ "status": "running",
2956
+ "error_context": error_context[:500],
2957
+ })
2958
+
2959
+
2750
2960
  @app.post("/api/sessions/{session_id}/review")
2751
2961
  async def review_session(session_id: str) -> JSONResponse:
2752
2962
  """Run loki review on a project."""