loki-mode 9.53.0 → 9.54.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +2 -2
- package/VERSION +1 -1
- package/autonomy/completion-council.sh +28 -5
- package/autonomy/council-v2.sh +13 -7
- package/autonomy/lib/done-recognition.sh +24 -16
- package/autonomy/lib/proof-check.sh +11 -3
- package/autonomy/lib/proof-generator.py +36 -5
- package/autonomy/lib/voter-agents.sh +8 -3
- package/autonomy/lib/workspace_diff.py +106 -12
- package/autonomy/prd-checklist.sh +19 -11
- package/autonomy/run.sh +503 -52
- package/dashboard/__init__.py +1 -1
- package/dashboard/api_v2.py +4 -0
- package/dashboard/audit.py +9 -1
- package/dashboard/auth.py +16 -4
- package/dashboard/registry.py +34 -12
- package/dashboard/rigour_integration.py +25 -17
- package/dashboard/server.py +252 -104
- package/dashboard/static/cost.html +55 -26
- package/dashboard/static/index.html +475 -1544
- package/dashboard/static/proofs.html +1 -1
- package/docs/INSTALLATION.md +1 -1
- package/docs/air-gapped.md +7 -2
- package/docs/image-provenance.md +4 -2
- package/docs/v10/BACKLOG.md +82 -2
- package/docs/v10/BOARD.md +105 -0
- package/docs/v10/DECISIONS.md +71 -0
- package/docs/v10/METRICS.md +2 -1
- package/docs/v10/PROGRESS.md +60 -0
- package/docs/v10/SWARM-PROMPT.md +98 -0
- package/docs/v10/SWARM.md +237 -0
- package/loki-ts/dist/loki.js +323 -322
- package/mcp/__init__.py +1 -1
- package/package.json +1 -1
- package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
- package/providers/aider.sh +8 -0
- package/providers/cline.sh +8 -0
- package/providers/codex.sh +9 -0
- package/providers/opencode.sh +9 -0
- package/web-app/dist/assets/AdminPage-CZrBkzRF.js +32 -0
- package/web-app/dist/assets/Avatar-gQIp6FBI.js +11 -0
- package/web-app/dist/assets/{Badge-BF3mhT57.js → Badge-D2_fBTFY.js} +1 -1
- package/web-app/dist/assets/{Button-BDp9aJ9q.js → Button-D5qDd2ef.js} +1 -1
- package/web-app/dist/assets/CockpitPage-DVMk2RUK.js +47 -0
- package/web-app/dist/assets/ComparePage-NMLyE1xL.js +1 -0
- package/web-app/dist/assets/{ErrorBoundary-ut3wrUmu.js → ErrorBoundary-BRABI-BT.js} +1 -1
- package/web-app/dist/assets/EvidenceReceiptPanel-D2LNKqUx.js +1 -0
- package/web-app/dist/assets/GitHubIssuesPanel-BC5GzKUN.js +7 -0
- package/web-app/dist/assets/{GitHubPRsPanel-DurZgSaj.js → GitHubPRsPanel-BSlmoVTS.js} +3 -3
- package/web-app/dist/assets/HomePage-D_CDMoen.js +12 -0
- package/web-app/dist/assets/{LoginPage-HeRGJeZy.js → LoginPage-BBNA_N9t.js} +1 -1
- package/web-app/dist/assets/{MagicPage-CUKrqsZs.js → MagicPage-CnFRZCMx.js} +1 -1
- package/web-app/dist/assets/MetricsPage-CPfLMRlh.js +6 -0
- package/web-app/dist/assets/{NotFoundPage-BZDZ-B77.js → NotFoundPage-lA0XSGTz.js} +1 -1
- package/web-app/dist/assets/ProjectPage-CNAPbr9z.js +256 -0
- package/web-app/dist/assets/ProjectsPage-CMtm8goN.js +6 -0
- package/web-app/dist/assets/SettingsPage-BhIjVMYE.js +10 -0
- package/web-app/dist/assets/{ShowcasePage-BGS2jTGH.js → ShowcasePage-BndtGeYo.js} +1 -1
- package/web-app/dist/assets/SystemSettingsPage-euXI-KXE.js +1 -0
- package/web-app/dist/assets/TeamsPage-ClUKecun.js +11 -0
- package/web-app/dist/assets/TemplatesPage-BWHWVk0L.js +29 -0
- package/web-app/dist/assets/{TerminalOutput-togzv9Zl.js → TerminalOutput-Cv3N3Szf.js} +1 -1
- package/web-app/dist/assets/{activity-Dreyb_Kr.js → activity-dEhz-bXR.js} +1 -1
- package/web-app/dist/assets/{bell-DWH0drES.js → bell-B3XUMq1t.js} +1 -1
- package/web-app/dist/assets/{bot-78MoCuDl.js → bot-X-ssNlwR.js} +1 -1
- package/web-app/dist/assets/{check-ikfylPst.js → check-C_9Nx7kb.js} +1 -1
- package/web-app/dist/assets/{chevron-left-DXUqkd8J.js → chevron-left-tvNswo3A.js} +1 -1
- package/web-app/dist/assets/{circle-alert-Da74VO8P.js → circle-alert-CSB88nEs.js} +1 -1
- package/web-app/dist/assets/{clock-mlGCFq8l.js → clock-C8p2e4NI.js} +1 -1
- package/web-app/dist/assets/{cloud-B_Y5ZrIO.js → cloud-CKp2ZvhG.js} +1 -1
- package/web-app/dist/assets/{code-xml-Bbom7YWV.js → code-xml-dY70LCHD.js} +1 -1
- package/web-app/dist/assets/{database-CLcofiVp.js → database-DObn5fmn.js} +1 -1
- package/web-app/dist/assets/{dollar-sign-C5mkjXIM.js → dollar-sign-DSu6n3K3.js} +1 -1
- package/web-app/dist/assets/{file-code-corner-CVrkaOQP.js → file-code-corner-DpCnS73z.js} +1 -1
- package/web-app/dist/assets/{file-plus-BV9240gX.js → file-plus-D3IPKCf1.js} +1 -1
- package/web-app/dist/assets/{globe-aZ0Zso4I.js → globe-C9QXkgH_.js} +1 -1
- package/web-app/dist/assets/{hammer-EgOQNukG.js → hammer-D_FtWe1y.js} +1 -1
- package/web-app/dist/assets/index-CI54rara.css +1 -0
- package/web-app/dist/assets/{index-DvZ0Kk2x.js → index-Cz7q1bvC.js} +2 -2
- package/web-app/dist/assets/{layers-BOVKmepE.js → layers-DsW7jnJX.js} +1 -1
- package/web-app/dist/assets/{loader-circle-0K8yLgHl.js → loader-circle-B3HspjKR.js} +1 -1
- package/web-app/dist/assets/{lock-XzlDMy8M.js → lock-DSI29pct.js} +1 -1
- package/web-app/dist/assets/{package-BtXTKusI.js → package-CLNxtA2x.js} +1 -1
- package/web-app/dist/assets/{plus-PxeiD8ju.js → plus-DyI4WC4_.js} +1 -1
- package/web-app/dist/assets/{refresh-cw-CjqzYczt.js → refresh-cw-D2dv0xA0.js} +1 -1
- package/web-app/dist/assets/{rotate-ccw-CY0os4DH.js → rotate-ccw-CBvihA-a.js} +1 -1
- package/web-app/dist/assets/scroll-text-DvoOvAl_.js +6 -0
- package/web-app/dist/assets/{server-pIIs9vNp.js → server-DenWvSUt.js} +1 -1
- package/web-app/dist/assets/{shield-alert-CsDqKXwA.js → shield-alert-40cX_FvG.js} +1 -1
- package/web-app/dist/assets/{thumbs-up-CAh3HVzH.js → thumbs-up-BrjZ6QuV.js} +12 -7
- package/web-app/dist/assets/trash-2-C6evwkEH.js +16 -0
- package/web-app/dist/assets/{trending-down-DrtBd_C9.js → trending-down-CfbZis3O.js} +1 -1
- package/web-app/dist/assets/{trending-up-D-DbCHXm.js → trending-up-DWuEK3WC.js} +1 -1
- package/web-app/dist/assets/{upload-D4l6DCOt.js → upload-B9DFBcPG.js} +1 -1
- package/web-app/dist/assets/{usePolling-D0aoTX80.js → usePolling-BryVC-T1.js} +1 -1
- package/web-app/dist/assets/{user-BQf_XJO_.js → user-DMRXwZiw.js} +1 -1
- package/web-app/dist/index.html +2 -2
- package/web-app/server.py +122 -47
- package/web-app/dist/assets/AdminPage-y6_b2Xo4.js +0 -32
- package/web-app/dist/assets/Avatar-BFPkXhIJ.js +0 -6
- package/web-app/dist/assets/CockpitPage-5TKICCoA.js +0 -47
- package/web-app/dist/assets/ComparePage-BSuNsUHy.js +0 -1
- package/web-app/dist/assets/EvidenceReceiptPanel-CcaBwEI-.js +0 -1
- package/web-app/dist/assets/GitHubIssuesPanel-DJeYgzAa.js +0 -12
- package/web-app/dist/assets/HomePage-Bs451LAy.js +0 -28
- package/web-app/dist/assets/MetricsPage-DvY1csgz.js +0 -6
- package/web-app/dist/assets/ProjectPage-CqHkEZkl.js +0 -257
- package/web-app/dist/assets/ProjectsPage-CLvCK1Y8.js +0 -6
- package/web-app/dist/assets/SettingsPage-DP7OmdwP.js +0 -10
- package/web-app/dist/assets/SystemSettingsPage-P_rlLh0x.js +0 -1
- package/web-app/dist/assets/TeamsPage-DxtBDcBC.js +0 -11
- package/web-app/dist/assets/TemplatesPage-5e-faH3W.js +0 -29
- package/web-app/dist/assets/folder-open-D_6yV78G.js +0 -11
- package/web-app/dist/assets/index-BSgmPwC0.css +0 -1
- package/web-app/dist/assets/lightbulb-DdASgqOG.js +0 -6
- package/web-app/dist/assets/mail-COu670_W.js +0 -6
- package/web-app/dist/assets/minus-bQpUt9ff.js +0 -6
- package/web-app/dist/assets/save-v8qep5cY.js +0 -6
- package/web-app/dist/assets/trash-2-Dt6urTyY.js +0 -6
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import{c as $,r as i,j as e,G as fe,Q as ge,F as be,i as ke,T as G,Z as ve,a as j,S as ye,V as je,X as Ne,P as ae,k as we,h as Se,m as Ce,Y as Re,N as I,J as Me,K as Te,O as $e,u as Ee}from"./index-DvZ0Kk2x.js";import{P as K,S as Pe,E as Ae}from"./ErrorBoundary-ut3wrUmu.js";import{C as ze,F as Ie,H as _e,a as De,G as Fe,T as Le}from"./thumbs-up-CAh3HVzH.js";import{C as re}from"./check-ikfylPst.js";import{C as Oe}from"./clock-mlGCFq8l.js";import{D as He}from"./dollar-sign-C5mkjXIM.js";import{M as Be}from"./minus-bQpUt9ff.js";import{U as qe}from"./upload-D4l6DCOt.js";import{L as W}from"./loader-circle-0K8yLgHl.js";/**
|
|
2
|
-
* @license lucide-react v0.577.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const Ue=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],Ge=$("circle-dashed",Ue);/**
|
|
7
|
-
* @license lucide-react v0.577.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Ke=[["path",{d:"M20 14V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12",key:"l9p8hp"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],We=$("file-minus-corner",Ke);/**
|
|
12
|
-
* @license lucide-react v0.577.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Ve=[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]],q=$("file-pen",Ve);/**
|
|
17
|
-
* @license lucide-react v0.577.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const Qe=[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]],Ye=$("file-plus-corner",Qe);/**
|
|
22
|
-
* @license lucide-react v0.577.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const Xe=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M10 15h4",key:"192ueg"}],["path",{d:"M10 9h4",key:"u4k05v"}],["path",{d:"M12 7v4",key:"xawao1"}]],Ze=$("message-square-diff",Xe);/**
|
|
27
|
-
* @license lucide-react v0.577.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const Je=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],et=$("repeat",Je);/**
|
|
32
|
-
* @license lucide-react v0.577.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const tt=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],st=$("undo-2",tt);/**
|
|
37
|
-
* @license lucide-react v0.577.0 - ISC
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the ISC license.
|
|
40
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const nt=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],V=$("wifi-off",nt);function at(s){const t=new Map;for(const n of s??[]){const a=t.get(n.path);if(!a){t.set(n.path,{path:n.path,status:n.status,staged:n.staged,partiallyStaged:!1});continue}t.set(n.path,{path:n.path,status:a.status==="modified"?n.status:a.status,staged:a.staged||n.staged,partiallyStaged:a.staged!==n.staged})}return Array.from(t.values()).sort((n,a)=>n.path.localeCompare(a.path))}function Q(s){return(s??"").replace(/\/+$/,"")}function rt(s,t){if(!(s!=null&&s.running)||!t)return!1;const n=Q(s.projectDir),a=Q(t.path);return n.length>0&&n===a}function it(s){const t=(s??"").trim();if(!t)return{goal:null,criteria:[]};const n=t.split(`
|
|
42
|
-
`);let a=null;for(const l of n){const r=l.trim();if(!r)continue;const d=r.match(/^#{1,3}\s+(.*)$/);if(d){a=d[1].trim();break}if(!r.startsWith("---")){a=r.length>200?`${r.slice(0,200)}...`:r;break}}const o=[];let u=!1;for(const l of n){const r=l.trim(),d=r.match(/^#{1,6}\s+(.*)$/);if(d){u=/acceptance|success criteria|definition of done|requirements/i.test(d[1]);continue}if(!u)continue;const m=r.match(/^[-*]\s+(?:\[[ xX]\]\s*)?(.+)$/);m&&o.push(m[1].trim())}return{goal:a,criteria:o.slice(0,12)}}function ot({detail:s,status:t,git:n,isLive:a}){var d;const{goal:o,criteria:u}=i.useMemo(()=>it(s==null?void 0:s.prd),[s==null?void 0:s.prd]),[l,r]=i.useState(!1);return e.jsxs("header",{"aria-label":"Task",className:"border-b border-border dark:border-dark-border bg-card dark:bg-dark-card px-4 py-4 sm:px-6",children:[e.jsx("div",{className:"flex flex-wrap items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-small uppercase tracking-wide text-muted-accessible dark:text-dark-muted",children:"Goal"}),e.jsx("h1",{className:"mt-1 font-heading text-h2 leading-tight text-ink dark:text-dark-ink",children:o??"No spec recorded for this session"}),!o&&e.jsx("p",{className:"mt-1 text-caption text-muted-accessible dark:text-dark-muted",children:"A PRD.md in the project directory would appear here."})]})}),e.jsxs("dl",{className:"mt-3 flex flex-wrap items-center gap-x-5 gap-y-2 text-caption text-muted-accessible dark:text-dark-muted",children:[(n==null?void 0:n.branch)&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(fe,{size:14,"aria-hidden":"true"}),e.jsx("dt",{className:"sr-only",children:"Branch"}),e.jsx("dd",{className:"font-mono",children:n.branch})]}),a&&(t==null?void 0:t.provider)&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ge,{size:14,"aria-hidden":"true"}),e.jsx("dt",{className:"sr-only",children:"Provider"}),e.jsx("dd",{children:t.provider})]}),(s==null?void 0:s.path)&&e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx(be,{size:14,"aria-hidden":"true"}),e.jsx("dt",{className:"sr-only",children:"Project directory"}),e.jsx("dd",{className:"truncate font-mono",title:s.path,children:s.path})]})]}),e.jsxs("section",{"aria-label":"Acceptance criteria",className:"mt-4",children:[e.jsx("h2",{className:"text-small uppercase tracking-wide text-muted-accessible dark:text-dark-muted",children:"Acceptance criteria"}),u.length>0?e.jsx("ul",{className:"mt-2 space-y-1.5",children:u.map(m=>e.jsxs("li",{className:"flex gap-2 text-caption text-secondary dark:text-dark-ink",children:[e.jsx("span",{"aria-hidden":"true",className:"mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full bg-primary"}),e.jsx("span",{children:m})]},m))}):e.jsx("p",{className:"mt-2 text-caption text-muted-accessible dark:text-dark-muted",children:"None stated in the spec. Nothing here is inferred, so this run has no declared pass condition beyond its quality gates."})]}),((d=s==null?void 0:s.prd)==null?void 0:d.trim())&&e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:()=>r(m=>!m),"aria-expanded":l,className:"inline-flex items-center gap-1.5 rounded-btn px-2 py-1 text-small text-primary transition-colors hover:bg-primary/5 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",children:[e.jsx(ke,{size:14,"aria-hidden":"true",className:`transition-transform motion-reduce:transition-none ${l?"rotate-180":""}`}),l?"Hide full spec":"Read full spec"]}),l&&e.jsx("pre",{className:"mt-2 max-h-80 overflow-auto rounded-card border border-border bg-hover p-3 font-mono text-xs leading-relaxed text-secondary dark:border-dark-border dark:bg-dark-hover dark:text-dark-ink",children:s.prd})]})]})}const ie=["understanding","planning","editing","testing","review","pr-ready"],Y={"not-started":"Not started",understanding:"Understanding",planning:"Planning",editing:"Editing",testing:"Testing",review:"Review","pr-ready":"PR ready",failed:"Failed",unknown:"Unknown"},X={"not-started":"No run has been recorded for this session.",understanding:"Reading the spec and the existing code.",planning:"Deciding what to change and in what order.",editing:"Writing code.",testing:"Running checks against what it wrote.",review:"Reflecting on the result and reviewing its own changes.","pr-ready":"Work finished. Ready for your review.",failed:"The run ended without completing.",unknown:"The engine reported a phase this view does not recognise."},Z={idle:"not-started",starting:"understanding",BOOTSTRAP:"understanding",REASON:"planning",ACT:"editing",VERIFY:"testing",REFLECT:"review",BUILDING:"editing",COMPLETED:"pr-ready",FAILED:"failed",UNKNOWN:"unknown"};function U(s){const t=(s??"").trim();if(!t)return{display:"not-started",raw:"",recognised:!0};const n=Z[t];if(n)return{display:n,raw:t,recognised:!0};const a=Z[t.toUpperCase()];return a?{display:a,raw:t,recognised:!0}:{display:"unknown",raw:t,recognised:!1}}function lt(s){return ie.indexOf(s)}function dt({state:s,view:t}){return s==="active"?t==="paused"?e.jsx(K,{size:16,"aria-hidden":"true"}):t==="failed"?e.jsx(G,{size:16,"aria-hidden":"true"}):e.jsxs("span",{className:"relative flex h-4 w-4 items-center justify-center",children:[t==="running"&&e.jsx("span",{className:"absolute inline-flex h-4 w-4 animate-ping rounded-full bg-current opacity-40 motion-reduce:hidden"}),e.jsx(ze,{size:16,"aria-hidden":"true",className:"relative"})]}):s==="done"?e.jsx(re,{size:16,"aria-hidden":"true"}):e.jsx(Ge,{size:16,"aria-hidden":"true"})}function ct({phase:s,view:t,isLive:n,iteration:a}){const o=lt(s.display),u=s.display==="failed"||s.display==="pr-ready";function l(r,d){return d===o?"active":s.display==="pr-ready"?"done":n&&d<o?"ahead":!n&&o>=0&&d<o?"done":"ahead"}return e.jsxs("section",{"aria-label":"Phase timeline",className:"p-4 sm:p-5",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[e.jsx("h2",{className:"text-small uppercase tracking-wide text-muted-accessible dark:text-dark-muted",children:"Progress"}),!n&&e.jsx("span",{className:"text-small text-muted-accessible dark:text-dark-muted",children:"Historical"})]}),e.jsx("p",{"aria-live":"polite",className:"sr-only",children:`Phase: ${Y[s.display]}`}),e.jsx("ol",{className:"mt-3 space-y-0.5",children:ie.map((r,d)=>{const m=l(r,d),x=m==="active";return e.jsxs("li",{"aria-current":x?"step":void 0,className:["flex gap-3 rounded-btn px-2 py-2 transition-colors motion-reduce:transition-none",x?"bg-primary/5 dark:bg-primary/10":""].join(" "),children:[e.jsx("span",{className:["mt-0.5 shrink-0",x&&t==="failed"?"text-danger":x?"text-primary":m==="done"?"text-success":"text-muted-accessible dark:text-dark-muted"].join(" "),children:e.jsx(dt,{state:m,view:t})}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:["block text-caption",x?"font-semibold text-ink dark:text-dark-ink":m==="done"?"text-secondary dark:text-dark-ink":"text-muted-accessible dark:text-dark-muted"].join(" "),children:Y[r]}),x&&e.jsx("span",{className:"mt-0.5 block text-small text-muted-accessible dark:text-dark-muted",children:X[r]})]})]},r)})}),s.display==="failed"&&e.jsx("p",{className:"mt-2 rounded-btn bg-danger/10 px-2 py-2 text-caption text-danger",children:X.failed}),!s.recognised&&e.jsxs("p",{className:"mt-2 rounded-btn bg-warning/10 px-2 py-2 text-caption text-ink dark:text-dark-ink",children:["The engine reported phase"," ",e.jsx("code",{className:"font-mono font-semibold",children:s.raw}),", which this view does not recognise. Shown verbatim rather than guessed at."]}),n&&!u&&typeof a=="number"&&a>0&&e.jsxs("p",{className:"mt-3 text-small text-muted-accessible dark:text-dark-muted",children:["Iteration ",a,". Phases repeat each iteration, so this is a cycle, not a countdown."]})]})}function J(s){if(s<60)return`${s}s`;const t=Math.floor(s/60),n=s%60;return t<60?`${t}m ${n}s`:`${Math.floor(t/60)}h ${t%60}m`}function F({icon:s,label:t,value:n,note:a,muted:o}){return e.jsxs("div",{className:"min-w-0",children:[e.jsxs("dt",{className:"flex items-center gap-1.5 text-small uppercase tracking-wide text-muted-accessible dark:text-dark-muted",children:[e.jsx(s,{size:13,"aria-hidden":!0}),t]}),e.jsx("dd",{className:["mt-1 font-mono text-h3 tabular-nums",o?"text-muted-accessible dark:text-dark-muted":"text-ink dark:text-dark-ink"].join(" "),children:n}),a&&e.jsx("p",{className:"mt-0.5 text-small text-muted-accessible dark:text-dark-muted",children:a})]})}function ut({status:s,isLive:t,elapsedSeconds:n,timeToFirstSignal:a}){const o=(s==null?void 0:s.iteration)??0,u=(s==null?void 0:s.cost)??0;return e.jsxs("section",{"aria-label":"Run metrics",className:"p-4 sm:p-5",children:[e.jsx("h2",{className:"text-small uppercase tracking-wide text-muted-accessible dark:text-dark-muted",children:"Metrics"}),e.jsxs("dl",{className:"mt-3 grid grid-cols-2 gap-x-4 gap-y-4 lg:grid-cols-2",children:[e.jsx(F,{icon:Oe,label:"Elapsed",value:n!==null?J(n):"--",note:t?void 0:"Only measured while a run is live",muted:n===null}),e.jsx(F,{icon:ve,label:"First signal",value:a!==null?J(a):"--",note:a!==null?"Observed since this view opened":t?"Not yet observed in this view":"Not recorded",muted:a===null}),e.jsx(F,{icon:et,label:"Iteration",value:t&&o>0?String(o):"--",note:t&&o>0?void 0:"Not reported",muted:!t||o<=0}),e.jsx(F,{icon:He,label:"Cost",value:u>0?`$${u.toFixed(2)}`:"--",note:u>0?void 0:"Not recorded",muted:u<=0})]})]})}const mt={added:Ye,deleted:We,modified:q,renamed:q,untracked:Ie},xt={added:"text-success",deleted:"text-danger",modified:"text-info",renamed:"text-info",untracked:"text-warning"};function ht({sessionId:s,files:t,clean:n}){const[a,o]=i.useState(null),[u,l]=i.useState(null),[r,d]=i.useState(!1),[m,x]=i.useState(null),[g,w]=i.useState(0),v=i.useRef(null);i.useEffect(()=>{if(!a)return;let h=!1;return d(!0),x(null),l(null),j.getSessionFileContent(s,a).then(b=>!h&&l(b.content)).catch(b=>!h&&x(b instanceof Error?b.message:"Could not read this file")).finally(()=>!h&&d(!1)),()=>{h=!0}},[s,a]);function f(h){var R;if(t.length===0)return;let b=g;if(h.key==="ArrowDown")b=Math.min(g+1,t.length-1);else if(h.key==="ArrowUp")b=Math.max(g-1,0);else if(h.key==="Home")b=0;else if(h.key==="End")b=t.length-1;else if(h.key==="Enter"||h.key===" "){h.preventDefault(),o(t[g].path);return}else return;h.preventDefault(),w(b);const S=(R=v.current)==null?void 0:R.querySelectorAll("li > button")[b];S==null||S.focus()}return n&&t.length===0?e.jsxs("section",{"aria-label":"Changed files",className:"p-4 sm:p-5",children:[e.jsx("h2",{className:"text-small uppercase tracking-wide text-muted-accessible dark:text-dark-muted",children:"Changes"}),e.jsx("p",{className:"mt-3 text-caption text-muted-accessible dark:text-dark-muted",children:"The working tree is clean. Nothing has been changed in this session."})]}):e.jsxs("section",{"aria-label":"Changed files",className:"flex min-h-0 flex-col p-4 sm:p-5",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[e.jsx("h2",{className:"text-small uppercase tracking-wide text-muted-accessible dark:text-dark-muted",children:"Changes"}),e.jsxs("span",{className:"text-small text-muted-accessible dark:text-dark-muted",children:[t.length," ",t.length===1?"file":"files"]})]}),e.jsxs("div",{className:"mt-3 grid min-h-0 flex-1 gap-4 lg:grid-cols-[minmax(0,18rem)_minmax(0,1fr)]",children:[e.jsx("ul",{ref:v,role:"listbox","aria-label":"Changed files",tabIndex:t.length?0:-1,onKeyDown:f,className:"max-h-72 space-y-0.5 overflow-y-auto lg:max-h-none",children:t.map((h,b)=>{const S=mt[h.status]??q,R=a===h.path;return e.jsx("li",{role:"option","aria-selected":R,children:e.jsxs("button",{type:"button",tabIndex:b===g?0:-1,onFocus:()=>w(b),onClick:()=>o(h.path),className:["flex w-full items-center gap-2 rounded-btn px-2 py-1.5 text-left transition-colors motion-reduce:transition-none",R?"bg-primary/10 text-ink dark:text-dark-ink":"text-secondary hover:bg-hover dark:text-dark-ink dark:hover:bg-dark-hover","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary"].join(" "),children:[e.jsx("span",{className:xt[h.status]??"text-muted-accessible",children:e.jsx(S,{size:14})}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs",title:h.path,children:h.path}),e.jsx("span",{className:"shrink-0 text-small text-muted-accessible dark:text-dark-muted",children:h.partiallyStaged?"partly staged":h.staged?"staged":""})]})},h.path)})}),e.jsxs("div",{className:"min-w-0 rounded-card border border-border bg-hover dark:border-dark-border dark:bg-dark-hover",children:[!a&&e.jsx("p",{className:"p-4 text-caption text-muted-accessible dark:text-dark-muted",children:"Select a file to read it. This shows the file as it stands now; a line-by-line diff against the previous revision is not served by this API."}),a&&r&&e.jsxs("p",{className:"p-4 text-caption text-muted-accessible dark:text-dark-muted",children:["Loading ",a,"..."]}),a&&m&&e.jsx("p",{className:"p-4 text-caption text-danger",children:m}),a&&u!==null&&e.jsx("pre",{className:"max-h-[28rem] overflow-auto p-3 font-mono text-xs leading-relaxed text-secondary dark:text-dark-ink",children:u})]})]})]})}const ee={pass:{Icon:re,cls:"text-success"},fail:{Icon:Ne,cls:"text-danger"},skip:{Icon:Be,cls:"text-muted-accessible"},pending:{Icon:je,cls:"text-warning"}},B={running:!1,returncode:null,output:null,error:null};function pt({sessionId:s,checklist:t}){const[n,a]=i.useState(B),[o,u]=i.useState(B);function l(d,m){const x=d==="tests"?a:u;x({...B,running:!0}),m().then(g=>x({running:!1,returncode:g.returncode,output:g.output,error:null})).catch(g=>x({running:!1,returncode:null,output:null,error:g instanceof Error?g.message:"Failed to run"}))}const r=!!(t&&t.items.length>0);return e.jsxs("section",{"aria-label":"Evidence",className:"p-4 sm:p-5",children:[e.jsxs("h2",{className:"flex items-center gap-1.5 text-small uppercase tracking-wide text-muted-accessible dark:text-dark-muted",children:[e.jsx(ye,{size:13,"aria-hidden":"true"}),"Evidence"]}),e.jsxs("div",{className:"mt-3",children:[e.jsx("h3",{className:"text-caption font-semibold text-ink dark:text-dark-ink",children:"Quality gates"}),r?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"mt-1 text-small text-muted-accessible dark:text-dark-muted",children:[t.passed," passed, ",t.failed," failed,"," ",t.skipped," skipped, ",t.pending," pending"]}),e.jsx("ul",{className:"mt-2 space-y-1",children:t.items.map(d=>{const{Icon:m,cls:x}=ee[d.status]??ee.pending;return e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:`mt-0.5 shrink-0 ${x}`,children:e.jsx(m,{size:14,"aria-hidden":"true"})}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-caption text-secondary dark:text-dark-ink",children:d.label}),e.jsx("span",{className:"sr-only",children:d.status}),d.details&&e.jsx("span",{className:"block text-small text-muted-accessible dark:text-dark-muted",children:d.details})]})]},d.id)})})]}):e.jsx("p",{className:"mt-1 text-caption text-muted-accessible dark:text-dark-muted",children:"No gate results recorded. The engine writes these during a run; an empty file is not the same as a clean pass."})]}),e.jsxs("div",{className:"mt-5 space-y-3",children:[e.jsx("h3",{className:"text-caption font-semibold text-ink dark:text-dark-ink",children:"Checks"}),e.jsx(te,{name:"Test suite",state:n,onRun:()=>l("tests",()=>j.testProject(s))}),e.jsx(te,{name:"Code review",state:o,onRun:()=>l("review",()=>j.reviewProject(s))}),e.jsx("p",{className:"text-small text-muted-accessible dark:text-dark-muted",children:"Build, typecheck and lint are not exposed as separate endpoints by this API. They run inside the test and review commands above."})]})]})}function te({name:s,state:t,onRun:n}){const a=t.returncode===null?null:t.returncode===0?{text:"Passed",cls:"text-success"}:{text:`Failed (exit ${t.returncode})`,cls:"text-danger"};return e.jsxs("div",{className:"rounded-card border border-border p-3 dark:border-dark-border",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-caption text-ink dark:text-dark-ink",children:s}),e.jsx("p",{className:`text-small ${(a==null?void 0:a.cls)??"text-muted-accessible dark:text-dark-muted"}`,children:t.running?"Running...":t.error?t.error:(a==null?void 0:a.text)??"Not run"})]}),e.jsxs("button",{type:"button",onClick:n,disabled:t.running,className:"inline-flex items-center gap-1.5 rounded-btn border border-primary/30 px-2.5 py-1 text-small font-semibold text-primary transition-colors hover:bg-primary/5 disabled:cursor-not-allowed disabled:opacity-60 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",children:[e.jsx(ae,{size:12,"aria-hidden":"true"}),t.returncode===null?"Run":"Re-run"]})]}),t.output&&e.jsx("pre",{className:"mt-2 max-h-48 overflow-auto rounded-btn bg-hover p-2 font-mono text-xs text-secondary dark:bg-dark-hover dark:text-dark-ink",children:t.output})]})}function ft(s,t,n){const a=[],o=(t==null?void 0:t.items.filter(r=>r.status==="fail"))??[];o.length>0&&a.push(`${o.length} quality gate(s) failed: ${o.map(r=>r.label).join(", ")}.`),(!t||t.items.length===0)&&a.push("No quality gate results were recorded, so nothing here is verified.");const u=(t==null?void 0:t.items.filter(r=>r.status==="pending"))??[];u.length>0&&a.push(`${u.length} gate(s) still pending.`),s.length>20&&a.push(`${s.length} files changed, which is a large surface to review.`);const l=s.filter(r=>r.status==="untracked").length;return l>0&&a.push(`${l} file(s) are untracked and would not be included in a commit.`),n.length===0&&a.push("No checkpoints were recorded, so there is nothing to roll back to."),a}function gt({sessionId:s,checkpoints:t,changedFiles:n,checklist:a,isLive:o,onRestored:u}){const[l,r]=i.useState(null),[d,m]=i.useState(!1),[x,g]=i.useState(null),w=ft(n,a,t);function v(f){m(!0),g(null),j.restoreCheckpoint(s,f.id).then(h=>{g(`Restored: ${h.description}`),r(null),u()}).catch(h=>g(h instanceof Error?h.message:"Restore failed")).finally(()=>m(!1))}return e.jsxs("section",{"aria-label":"Risk and rollback",className:"p-4 sm:p-5",children:[e.jsxs("h2",{className:"flex items-center gap-1.5 text-small uppercase tracking-wide text-muted-accessible dark:text-dark-muted",children:[e.jsx(G,{size:13,"aria-hidden":"true"}),"Risk"]}),w.length>0?e.jsx("ul",{className:"mt-3 space-y-1.5",children:w.map(f=>e.jsxs("li",{className:"flex gap-2 text-caption text-secondary dark:text-dark-ink",children:[e.jsx("span",{"aria-hidden":"true",className:"mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full bg-warning"}),e.jsx("span",{children:f})]},f))}):e.jsx("p",{className:"mt-3 text-caption text-secondary dark:text-dark-ink",children:"Nothing flagged from what was recorded. That is not a guarantee of correctness, only that no recorded signal was negative."}),e.jsxs("div",{className:"mt-5",children:[e.jsxs("h3",{className:"flex items-center gap-1.5 text-caption font-semibold text-ink dark:text-dark-ink",children:[e.jsx(_e,{size:14,"aria-hidden":"true"}),"Rollback"]}),t.length===0?e.jsx("p",{className:"mt-1 text-caption text-muted-accessible dark:text-dark-muted",children:"No checkpoints recorded for this session, so there is nothing to roll back to."}):e.jsx("ul",{className:"mt-2 space-y-1.5",children:t.map(f=>e.jsxs("li",{className:"flex flex-wrap items-center justify-between gap-2 rounded-card border border-border p-2.5 dark:border-dark-border",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-caption text-ink dark:text-dark-ink",children:f.description}),e.jsxs("p",{className:"text-small text-muted-accessible dark:text-dark-muted",children:[f.timestamp||"no timestamp"," - iteration ",f.iteration," -"," ",f.files_changed," file(s)"]})]}),e.jsxs("button",{type:"button",onClick:()=>r(f),disabled:d||o,title:o?"Cannot roll back while a run is in progress":void 0,className:"inline-flex shrink-0 items-center gap-1.5 rounded-btn border border-danger/30 bg-danger/10 px-2.5 py-1 text-small font-semibold text-danger transition-colors hover:bg-danger/20 disabled:cursor-not-allowed disabled:opacity-60 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-danger",children:[e.jsx(st,{size:12,"aria-hidden":"true"}),"Roll back"]})]},f.id))}),o&&t.length>0&&e.jsx("p",{className:"mt-2 text-small text-muted-accessible dark:text-dark-muted",children:"Rollback is disabled while a run is in progress. Stop the run first."})]}),l&&e.jsxs("div",{role:"alertdialog","aria-modal":"true","aria-labelledby":"rollback-title",className:"mt-3 rounded-card border border-danger/30 bg-danger/5 p-3",children:[e.jsxs("p",{id:"rollback-title",className:"text-caption font-semibold text-ink dark:text-dark-ink",children:['Roll back to "',l.description,'"?']}),e.jsxs("p",{className:"mt-1 text-small text-secondary dark:text-dark-ink",children:["This overwrites files in the project directory with the snapshot taken at iteration ",l.iteration,". Changes made since then and not checkpointed are lost."]}),e.jsxs("div",{className:"mt-3 flex gap-2",children:[e.jsx("button",{type:"button",autoFocus:!0,onClick:()=>v(l),disabled:d,className:"rounded-btn bg-danger px-3 py-1.5 text-small font-semibold text-white transition-colors hover:opacity-90 disabled:opacity-60 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-danger",children:d?"Restoring...":"Yes, roll back"}),e.jsx("button",{type:"button",onClick:()=>r(null),disabled:d,className:"rounded-btn px-3 py-1.5 text-small font-semibold text-secondary transition-colors hover:bg-hover dark:text-dark-ink dark:hover:bg-dark-hover focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",children:"Cancel"})]})]}),x&&e.jsx("p",{role:"status",className:"mt-2 text-caption text-secondary dark:text-dark-ink",children:x})]})}function bt({sessionId:s,isLive:t,status:n,git:a,changedFiles:o,onChanged:u}){const[l,r]=i.useState(null),[d,m]=i.useState(null),[x,g]=i.useState(""),[w,v]=i.useState(null),[f,h]=i.useState(""),b=!!(n!=null&&n.paused),S=o.length>0,R=(a==null?void 0:a.ahead)??0,_=[{key:"pause",label:"Pause",icon:K,disabledReason:t?b?"Already paused":null:"No run in progress for this session",onRun:()=>j.pauseSession().then(c=>c.message??"Paused")},{key:"resume",label:"Resume",icon:ae,disabledReason:t?b?null:"The run is not paused":"No run in progress for this session",onRun:()=>j.resumeSession().then(c=>c.message??"Resumed")},{key:"stop",label:"Stop run",icon:Pe,danger:!0,disabledReason:t?null:"No run in progress for this session",onRun:()=>j.stopSession().then(c=>c.message??"Stopped")},{key:"commit",label:"Commit",icon:De,disabledReason:S?null:"The working tree is clean",onRun:()=>j.git.commit(s,x.trim()||"Loki: apply changes").then(c=>`Committed ${c.hash.slice(0,7)}`)},{key:"push",label:"Push",icon:qe,disabledReason:R<=0?"Nothing to push: no commits ahead of the remote":null,onRun:()=>j.git.push(s).then(c=>c.message??"Pushed")},{key:"pr",label:"Open pull request",icon:Fe,disabledReason:!S&&R<=0?"Nothing to open a pull request for":x.trim()?null:"Enter a title first",onRun:()=>j.git.pr(s,x.trim(),"").then(c=>`Opened #${c.number}: ${c.url}`)}];function L(c){!c.onRun||c.disabledReason||(r(c.key),m(null),c.onRun().then(k=>{m(k),u()}).catch(k=>m(k instanceof Error?k.message:`${c.label} failed`)).finally(()=>r(null)))}function A(){const c=f.trim();c&&(r("preview"),v(null),j.previewChanges(s,c).then(k=>v(k.files.length===0?"No files would change.":`${k.files.length} file(s) would change: +${k.total_additions} / -${k.total_deletions}
|
|
43
|
-
|
|
44
|
-
${k.files.map(M=>`${M.action.padEnd(7)} ${M.path} +${M.additions} -${M.deletions}`).join(`
|
|
45
|
-
`)}`)).catch(k=>v(k instanceof Error?k.message:"Preview failed")).finally(()=>r(null)))}return e.jsxs("section",{"aria-label":"Actions",className:"p-4 sm:p-5",children:[e.jsx("h2",{className:"text-small uppercase tracking-wide text-muted-accessible dark:text-dark-muted",children:"Actions"}),e.jsxs("label",{className:"mt-3 block",children:[e.jsx("span",{className:"text-small text-muted-accessible dark:text-dark-muted",children:"Commit / pull request title"}),e.jsx("input",{type:"text",value:x,onChange:c=>g(c.target.value),placeholder:"Describe the change",className:"mt-1 w-full rounded-btn border border-border bg-card px-2.5 py-1.5 text-caption text-ink placeholder:text-muted-accessible focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-1px] focus-visible:outline-primary dark:border-dark-border dark:bg-dark-card dark:text-dark-ink"})]}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:_.map(c=>{const k=!!c.disabledReason||l!==null,M=c.icon;return e.jsxs("button",{type:"button",onClick:()=>L(c),disabled:k,"aria-describedby":c.disabledReason?`reason-${c.key}`:void 0,className:["inline-flex items-center gap-1.5 rounded-btn border px-3 py-1.5 text-small font-semibold transition-colors motion-reduce:transition-none",c.danger?"border-danger/30 bg-danger/10 text-danger hover:bg-danger/20":"border-primary/30 text-primary hover:bg-primary/5",k?"cursor-not-allowed opacity-60":"","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"].join(" "),children:[e.jsx(M,{size:13}),l===c.key?"Working...":c.label]},c.key)})}),e.jsx("ul",{className:"mt-2 space-y-0.5",children:_.filter(c=>c.disabledReason).map(c=>e.jsxs("li",{id:`reason-${c.key}`,className:"text-small text-muted-accessible dark:text-dark-muted",children:[c.label,": ",c.disabledReason,"."]},c.key))}),d&&e.jsx("p",{role:"status",className:"mt-3 break-words rounded-btn bg-hover px-2.5 py-2 text-caption text-secondary dark:bg-dark-hover dark:text-dark-ink",children:d}),e.jsxs("div",{className:"mt-5 border-t border-border pt-4 dark:border-dark-border",children:[e.jsxs("h3",{className:"flex items-center gap-1.5 text-caption font-semibold text-ink dark:text-dark-ink",children:[e.jsx(Ze,{size:14,"aria-hidden":"true"}),"Request a change"]}),e.jsx("p",{className:"mt-1 text-small text-muted-accessible dark:text-dark-muted",children:"Dry run only. This shows the diff a change would produce; it does not apply anything."}),e.jsx("textarea",{value:f,onChange:c=>h(c.target.value),rows:2,placeholder:"What should be different?",className:"mt-2 w-full rounded-btn border border-border bg-card px-2.5 py-1.5 text-caption text-ink placeholder:text-muted-accessible focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-1px] focus-visible:outline-primary dark:border-dark-border dark:bg-dark-card dark:text-dark-ink"}),e.jsx("button",{type:"button",onClick:A,disabled:!f.trim()||l!==null,className:"mt-2 inline-flex items-center gap-1.5 rounded-btn border border-primary/30 px-3 py-1.5 text-small font-semibold text-primary transition-colors hover:bg-primary/5 disabled:cursor-not-allowed disabled:opacity-60 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",children:l==="preview"?"Previewing...":"Preview change"}),w&&e.jsx("pre",{className:"mt-2 max-h-56 overflow-auto rounded-btn bg-hover p-2 font-mono text-xs text-secondary dark:bg-dark-hover dark:text-dark-ink",children:w})]}),e.jsx("div",{className:"mt-5 border-t border-border pt-4 dark:border-dark-border",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Le,{size:14,"aria-hidden":"true",className:"mt-0.5 shrink-0 text-muted-accessible dark:text-dark-muted"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-caption font-semibold text-muted-accessible dark:text-dark-muted",children:"Approve"}),e.jsx("p",{className:"mt-1 text-small text-muted-accessible dark:text-dark-muted",children:"Not available. This API has no endpoint that approves a local run. Approval happens on the pull request once one is open."})]})]})})]})}function kt({logs:s,isLive:t}){const[n,a]=i.useState(!1),[o,u]=i.useState(!0),l=i.useRef(null);return i.useEffect(()=>{!n||!o||!l.current||(l.current.scrollTop=l.current.scrollHeight)},[s,n,o]),e.jsxs("section",{"aria-label":"Agent activity",className:"border-t border-border bg-card dark:border-dark-border dark:bg-dark-card",children:[e.jsx("h2",{children:e.jsxs("button",{type:"button",onClick:()=>a(r=>!r),"aria-expanded":n,"aria-controls":"chatter-body",className:"flex w-full items-center gap-2 px-4 py-2.5 text-left transition-colors hover:bg-hover dark:hover:bg-dark-hover sm:px-6 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary",children:[e.jsx(we,{size:14,"aria-hidden":"true",className:"text-muted-accessible dark:text-dark-muted"}),e.jsx("span",{className:"text-small font-semibold uppercase tracking-wide text-muted-accessible dark:text-dark-muted",children:"Agent activity"}),e.jsxs("span",{className:"text-small text-muted-accessible dark:text-dark-muted",children:[s.length," line",s.length===1?"":"s",t?", live":""]}),e.jsx(Se,{size:14,"aria-hidden":"true",className:`ml-auto text-muted-accessible transition-transform motion-reduce:transition-none dark:text-dark-muted ${n?"":"rotate-180"}`})]})}),n&&e.jsxs("div",{id:"chatter-body",children:[e.jsx("div",{className:"flex items-center justify-end px-4 pb-1 sm:px-6",children:e.jsxs("label",{className:"flex items-center gap-1.5 text-small text-muted-accessible dark:text-dark-muted",children:[e.jsx("input",{type:"checkbox",checked:o,onChange:r=>u(r.target.checked),className:"accent-primary"}),"Follow output"]})}),e.jsx("div",{ref:l,onScroll:r=>{const d=r.currentTarget;!(d.scrollHeight-d.scrollTop-d.clientHeight<24)&&o&&u(!1)},className:"max-h-64 overflow-auto bg-hover px-4 py-2 dark:bg-dark-hover sm:px-6",children:s.length===0?e.jsx("p",{className:"py-2 text-caption text-muted-accessible dark:text-dark-muted",children:"No output recorded."}):e.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-secondary dark:text-dark-ink",children:s.join(`
|
|
46
|
-
`)})})]})]})}const se={neutral:"bg-hover text-secondary dark:bg-dark-hover dark:text-dark-ink",running:"bg-primary/10 text-primary",warning:"bg-warning/10 text-ink dark:text-dark-ink",danger:"bg-danger/10 text-danger",success:"bg-success/10 text-success"};function vt({view:s,status:t,dataAgeMs:n,stale:a}){const o=t==null?void 0:t.exit_code,u=n!==null?Math.round(n/1e3):null,l=(()=>{switch(s){case"running":return{tone:"running",Icon:W,spin:!0,text:"Running",detail:(t==null?void 0:t.current_task)||void 0};case"paused":return{tone:"warning",Icon:K,text:"Paused",detail:"Resume to continue."};case"recovering":return{tone:"warning",Icon:W,spin:!0,text:"Starting up",detail:"The process is alive but has not written any state yet."};case"failed":return{tone:"danger",Icon:G,text:"Run failed",detail:typeof o=="number"?`Process exited with code ${o}.`:void 0};case"completed":return{tone:"success",Icon:Ce,text:"Run finished"};case"disconnected":return{tone:"warning",Icon:V,text:"Disconnected",detail:u!==null?`Showing the last state received ${u}s ago. Reconnecting.`:"Showing the last state received. Reconnecting."};default:return null}})();if(!l)return null;const{Icon:r}=l,d=a&&s!=="disconnected";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{role:"status",className:`flex flex-wrap items-center gap-x-2 gap-y-1 px-4 py-2 sm:px-6 ${se[l.tone]}`,children:[e.jsx(r,{size:14,className:l.spin?"animate-spin motion-reduce:animate-none":void 0}),e.jsx("span",{className:"text-caption font-semibold",children:l.text}),l.detail&&e.jsx("span",{className:"text-caption opacity-80",children:l.detail})]}),d&&e.jsxs("div",{className:`flex flex-wrap items-center gap-x-2 px-4 py-1.5 sm:px-6 ${se.warning}`,children:[e.jsx(V,{size:13,"aria-hidden":"true"}),e.jsxs("span",{className:"text-small",children:["Live updates disconnected",u!==null?`; this is the state from ${u}s ago.`:"."," ","Reconnecting."]})]})]})}function yt({status:s}){const t=(s==null?void 0:s.last_output)??[];return t.length===0?null:e.jsxs("details",{className:"border-b border-border px-4 py-2 dark:border-dark-border sm:px-6",children:[e.jsx("summary",{className:"cursor-pointer text-small font-semibold text-danger",children:"Last output before exit"}),e.jsx("pre",{className:"mt-2 max-h-48 overflow-auto rounded-btn bg-hover p-2 font-mono text-xs text-secondary dark:bg-dark-hover dark:text-dark-ink",children:t.join(`
|
|
47
|
-
`)})]})}const jt=U(null);function Nt(s){const[t,n]=i.useState(null),[a,o]=i.useState(null),[u,l]=i.useState(null),[r,d]=i.useState(null),[m,x]=i.useState([]),[g,w]=i.useState([]),[v,f]=i.useState(!0),[h,b]=i.useState(null),[S,R]=i.useState(!0),[_,L]=i.useState(0),[A,c]=i.useState(()=>Date.now()),[k,M]=i.useState(null),z=i.useRef(null),oe=i.useRef(Date.now()),le=i.useCallback(()=>L(p=>p+1),[]);i.useEffect(()=>{if(!s)return;let p=!1;return f(!0),b(null),j.getSessionDetail(s).then(y=>{p||(n(y),w(y.logs??[]))}).catch(y=>{p||b(y instanceof Error?y.message:"Failed to load session")}).finally(()=>{p||f(!1)}),j.getStatus().then(y=>{p||(o(y),z.current=Date.now())}).catch(()=>{}),j.getChecklist().then(y=>!p&&l(y)).catch(()=>{}),j.git.status(s).then(y=>!p&&d(y)).catch(()=>{}),j.getCheckpoints(s).then(y=>!p&&x(y)).catch(()=>{}),()=>{p=!0}},[s,_]),i.useEffect(()=>{const p=new Re,y=p.on("state_update",T=>{var E;const N=T;N!=null&&N.status&&(o(N.status),z.current=Date.now()),(E=N==null?void 0:N.logs)!=null&&E.length&&w(he=>[...he,...N.logs.map(pe=>pe.message)].slice(-500))}),O=p.on("log",T=>{const N=T==null?void 0:T.line;N&&w(E=>[...E,N].slice(-500))}),H=p.on("connected",()=>R(!0)),D=p.on("disconnected",()=>R(!1));return p.connect(),()=>{y(),O(),H(),D(),p.disconnect()}},[]),i.useEffect(()=>{const p=setInterval(()=>c(Date.now()),1e3);return()=>clearInterval(p)},[]);const C=rt(a,t),de=i.useMemo(()=>U(C?a==null?void 0:a.phase:t==null?void 0:t.status),[C,a==null?void 0:a.phase,t==null?void 0:t.status]);i.useEffect(()=>{if(!C||k!==null)return;const p=(a==null?void 0:a.phase)??"";p&&p!=="idle"&&p!=="starting"&&p!=="BOOTSTRAP"&&M(Math.max(0,Math.round((Date.now()-oe.current)/1e3)))},[C,a==null?void 0:a.phase,k]);const ce=i.useMemo(()=>{var D,T,N;if(v)return"loading";if(C){if(a!=null&&a.paused)return"paused";const E=a==null?void 0:a.exit_code;return typeof E=="number"&&E!==0?"failed":(a==null?void 0:a.phase)==="starting"?"recovering":S?"running":"disconnected"}const p=((t==null?void 0:t.status)??"").toLowerCase();if(p==="failed")return"failed";if(p==="completed")return"completed";const y=!!((D=t==null?void 0:t.prd)!=null&&D.trim()),O=(((T=r==null?void 0:r.files)==null?void 0:T.length)??0)>0,H=(((N=t==null?void 0:t.files)==null?void 0:N.length)??0)>0;return!y&&!O&&!H?"empty":"completed"},[v,C,S,a,t,r]),ue=i.useMemo(()=>{if(!C||typeof(a==null?void 0:a.uptime)!="number")return null;const p=z.current?(A-z.current)/1e3:0;return Math.max(0,Math.round(a.uptime+p))},[C,a==null?void 0:a.uptime,A]),me=i.useMemo(()=>!C||z.current===null?null:A-z.current,[C,A]),xe=i.useMemo(()=>at(r==null?void 0:r.files),[r]);return{view:ce,detail:t,status:a,isLive:C,phase:de??jt,checklist:u,changedFiles:xe,git:r,checkpoints:m,logs:g,elapsedSeconds:ue,timeToFirstSignal:k,dataAgeMs:me,stale:C&&!S,error:h,reload:le}}const ne=[{keys:"g then 1",action:"Go to progress",id:"region-progress"},{keys:"g then 2",action:"Go to changes",id:"region-changes"},{keys:"g then 3",action:"Go to evidence",id:"region-evidence"},{keys:"g then 4",action:"Go to actions",id:"region-actions"},{keys:"?",action:"Toggle this list",id:""},{keys:"Esc",action:"Close this list",id:""}],P="rounded-card border border-border bg-card shadow-card dark:border-dark-border dark:bg-dark-card";function wt({sessionId:s,onClose:t}){var r,d;const n=Nt(s),[a,o]=i.useState(!1),u=i.useRef(!1);if(i.useEffect(()=>{function m(x){const g=x.target;if(!(g instanceof HTMLInputElement||g instanceof HTMLTextAreaElement||g!=null&&g.isContentEditable||x.metaKey||x.ctrlKey||x.altKey)){if(x.key==="Escape"){o(!1),u.current=!1;return}if(x.key==="?"){x.preventDefault(),o(v=>!v);return}if(x.key==="g"){u.current=!0;return}if(u.current){u.current=!1;const v=ne.find(f=>f.keys===`g then ${x.key}`);if(v!=null&&v.id){const f=document.getElementById(v.id);f&&(x.preventDefault(),f.scrollIntoView({behavior:"smooth",block:"start"}),f.focus({preventScroll:!0}))}}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[]),n.error)return e.jsx("div",{className:"flex h-full items-center justify-center bg-background p-6 dark:bg-dark-bg",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-caption font-semibold text-danger",children:"Could not load this session"}),e.jsx("p",{className:"mt-1 text-small text-muted-accessible dark:text-dark-muted",children:n.error}),e.jsx("button",{type:"button",onClick:n.reload,className:"mt-4 rounded-btn border border-primary/30 px-4 py-2 text-caption font-semibold text-primary hover:bg-primary/5 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",children:"Try again"})]})});if(n.view==="loading")return e.jsxs("div",{className:"h-full overflow-y-auto bg-background p-4 dark:bg-dark-bg sm:p-6",children:[e.jsx("span",{className:"sr-only",role:"status",children:"Loading the execution cockpit"}),e.jsx(I,{variant:"block",width:"60%",height:"32px"}),e.jsxs("div",{className:"mt-3 flex gap-3",children:[e.jsx(I,{variant:"text",width:"140px",height:"12px"}),e.jsx(I,{variant:"text",width:"180px",height:"12px"})]}),e.jsxs("div",{className:"mt-6 grid gap-4 xl:grid-cols-[minmax(0,22rem)_minmax(0,1fr)]",children:[e.jsx(I,{variant:"block",width:"100%",height:"260px"}),e.jsx(I,{variant:"block",width:"100%",height:"260px"})]})]});const l=n.view==="empty";return e.jsxs("div",{className:"flex h-full flex-col bg-background dark:bg-dark-bg",children:[e.jsxs("nav",{"aria-label":"Cockpit",className:"flex items-center justify-between gap-2 border-b border-border bg-card px-4 py-2 dark:border-dark-border dark:bg-dark-card sm:px-6",children:[e.jsxs("button",{type:"button",onClick:t,className:"inline-flex items-center gap-1.5 rounded-btn px-2 py-1 text-small font-semibold text-secondary transition-colors hover:bg-hover dark:text-dark-ink dark:hover:bg-dark-hover focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",children:[e.jsx(Me,{size:14,"aria-hidden":"true"}),"Back"]}),e.jsxs("button",{type:"button",onClick:()=>o(m=>!m),"aria-expanded":a,className:"inline-flex items-center gap-1.5 rounded-btn px-2 py-1 text-small text-muted-accessible transition-colors hover:bg-hover dark:text-dark-muted dark:hover:bg-dark-hover focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",children:[e.jsx(Te,{size:14,"aria-hidden":"true"}),"Shortcuts"]})]}),a&&e.jsx("div",{className:"border-b border-border bg-hover px-4 py-3 dark:border-dark-border dark:bg-dark-hover sm:px-6",children:e.jsx("dl",{className:"flex flex-wrap gap-x-6 gap-y-1",children:ne.map(m=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("dt",{children:e.jsx("kbd",{className:"rounded-btn border border-border bg-card px-1.5 py-0.5 font-mono text-xs text-ink dark:border-dark-border dark:bg-dark-card dark:text-dark-ink",children:m.keys})}),e.jsx("dd",{className:"text-small text-muted-accessible dark:text-dark-muted",children:m.action})]},m.keys))})}),e.jsx(vt,{view:n.view,status:n.status,dataAgeMs:n.dataAgeMs,stale:n.stale}),n.view==="failed"&&e.jsx(yt,{status:n.status}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[e.jsx(ot,{detail:n.detail,status:n.status,git:n.git,isLive:n.isLive}),l?e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:`${P} p-6 text-center`,children:[e.jsx("h2",{className:"font-heading text-h3 text-ink dark:text-dark-ink",children:"Nothing recorded yet"}),e.jsx("p",{className:"mx-auto mt-2 max-w-md text-caption text-muted-accessible dark:text-dark-muted",children:"This session has no spec, no files and no changes. Once a run starts, its phases, changed files and evidence appear here."})]})}):e.jsxs("main",{className:"grid gap-4 p-4 sm:p-6 xl:grid-cols-[minmax(0,22rem)_minmax(0,1fr)] xl:items-start",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-1",children:[e.jsx("div",{id:"region-progress",tabIndex:-1,className:P,children:e.jsx(ct,{phase:n.phase,view:n.view,isLive:n.isLive,iteration:(r=n.status)==null?void 0:r.iteration})}),e.jsx("div",{className:P,children:e.jsx(ut,{status:n.status,isLive:n.isLive,elapsedSeconds:n.elapsedSeconds,timeToFirstSignal:n.timeToFirstSignal})}),e.jsx("div",{className:`${P} md:col-span-2 xl:col-span-1`,children:e.jsx(gt,{sessionId:s,checkpoints:n.checkpoints,changedFiles:n.changedFiles,checklist:n.checklist,isLive:n.isLive,onRestored:n.reload})})]}),e.jsxs("div",{className:"grid min-w-0 gap-4",children:[e.jsx("div",{id:"region-changes",tabIndex:-1,className:`${P} min-w-0`,children:e.jsx(ht,{sessionId:s,files:n.changedFiles,clean:((d=n.git)==null?void 0:d.clean)??n.changedFiles.length===0})}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx("div",{id:"region-evidence",tabIndex:-1,className:`${P} min-w-0`,children:e.jsx(pt,{sessionId:s,checklist:n.checklist})}),e.jsx("div",{id:"region-actions",tabIndex:-1,className:`${P} min-w-0`,children:e.jsx(bt,{sessionId:s,isLive:n.isLive,status:n.status,git:n.git,changedFiles:n.changedFiles,onChanged:n.reload})})]})]})]})]}),e.jsx(kt,{logs:n.logs,isLive:n.isLive})]})}function zt(){const{sessionId:s}=$e(),t=Ee();return s?e.jsx("div",{className:"h-screen bg-background dark:bg-dark-bg",children:e.jsx(Ae,{name:"ExecutionCockpit",children:e.jsx(wt,{sessionId:s,onClose:()=>t(`/project/${s}`)})})}):e.jsx("div",{className:"flex h-screen items-center justify-center bg-background dark:bg-dark-bg",children:e.jsx("p",{className:"text-caption text-danger",children:"No session specified."})})}export{zt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i,j as e}from"./index-DvZ0Kk2x.js";function p({value:r,prefix:t="",suffix:s=""}){const[n,a]=i.useState(0),o=i.useRef(0);return i.useEffect(()=>{const c=o.current,d=r-c;if(d===0)return;const x=600,h=performance.now();function u(l){const b=l-h,f=Math.min(b/x,1),g=1-Math.pow(1-f,3),j=Math.round(c+d*g);a(j),o.current=j,f<1&&requestAnimationFrame(u)}requestAnimationFrame(u)},[r]),e.jsxs("span",{className:"tabular-nums",children:[t,n.toLocaleString(),s]})}function N(){const[r,t]=i.useState(5),[s,n]=i.useState(30),[a,o]=i.useState(75),x=Math.round(r*s*.4*4.33),h=Math.round(x*a),u=1/0;return e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl p-6 shadow-sm",children:[e.jsx("h3",{className:"text-lg font-bold text-[#36342E] mb-1",children:"ROI Calculator"}),e.jsx("p",{className:"text-sm text-[#6B6960] mb-6",children:"Estimate how much your team could save with autonomous development."}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-sm font-medium text-[#36342E]",children:"Team size"}),e.jsxs("span",{className:"text-sm font-semibold text-[#553DE9] tabular-nums",children:[r," developers"]})]}),e.jsx("input",{type:"range",min:1,max:50,value:r,onChange:l=>t(Number(l.target.value)),className:"w-full h-2 bg-[#ECEAE3] rounded-full appearance-none cursor-pointer accent-[#553DE9]"}),e.jsxs("div",{className:"flex justify-between text-xs text-[#939084] mt-1",children:[e.jsx("span",{children:"1"}),e.jsx("span",{children:"50"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-sm font-medium text-[#36342E]",children:"Hours coding per week"}),e.jsxs("span",{className:"text-sm font-semibold text-[#553DE9] tabular-nums",children:[s,"h"]})]}),e.jsx("input",{type:"range",min:5,max:60,value:s,onChange:l=>n(Number(l.target.value)),className:"w-full h-2 bg-[#ECEAE3] rounded-full appearance-none cursor-pointer accent-[#553DE9]"}),e.jsxs("div",{className:"flex justify-between text-xs text-[#939084] mt-1",children:[e.jsx("span",{children:"5h"}),e.jsx("span",{children:"60h"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-sm font-medium text-[#36342E]",children:"Average hourly rate"}),e.jsxs("span",{className:"text-sm font-semibold text-[#553DE9] tabular-nums",children:["$",a,"/hr"]})]}),e.jsx("input",{type:"range",min:25,max:250,step:5,value:a,onChange:l=>o(Number(l.target.value)),className:"w-full h-2 bg-[#ECEAE3] rounded-full appearance-none cursor-pointer accent-[#553DE9]"}),e.jsxs("div",{className:"flex justify-between text-xs text-[#939084] mt-1",children:[e.jsx("span",{children:"$25"}),e.jsx("span",{children:"$250"})]})]})]}),e.jsxs("div",{className:"mt-6 pt-6 border-t border-[#ECEAE3]",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-[#553DE9]",children:e.jsx(p,{value:x,suffix:"h"})}),e.jsx("div",{className:"text-xs text-[#6B6960] mt-1",children:"Hours saved / month"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-[#1FC5A8]",children:e.jsx(p,{value:h,prefix:"$"})}),e.jsx("div",{className:"text-xs text-[#6B6960] mt-1",children:"Cost saved / month"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-[#36342E]",children:u===1/0?"Free":e.jsx(p,{value:u,suffix:"%"})}),e.jsx("div",{className:"text-xs text-[#6B6960] mt-1",children:"ROI (self-hosted)"})]})]}),e.jsx("div",{className:"mt-4 p-3 rounded-lg bg-[#553DE9]/5 border border-[#553DE9]/10",children:e.jsxs("p",{className:"text-sm text-[#36342E] text-center",children:["With Loki Mode, your team could save"," ",e.jsxs("span",{className:"font-bold text-[#553DE9]",children:[x.toLocaleString()," hours"]})," ","and"," ",e.jsxs("span",{className:"font-bold text-[#1FC5A8]",children:["$",h.toLocaleString()]})," ","per month."]})})]})]})}function y({count:r=5}){return e.jsx("div",{className:"flex gap-0.5",children:Array.from({length:r}).map((t,s)=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"#553DE9",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"})},s))})}function w(){return e.jsx("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#553DE9]/15",children:e.jsx("path",{d:"M3 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1zm12 0c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z",fill:"currentColor"})})}function k({quote:r,name:t,role:s,company:n,avatar:a,rating:o=5}){const c=t.split(" ").map(d=>d[0]).join("").toUpperCase().slice(0,2);return e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl p-6 flex flex-col gap-4 shadow-sm hover:shadow-md transition-shadow",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(w,{}),e.jsx(y,{count:o})]}),e.jsxs("p",{className:"text-[#36342E] text-sm leading-relaxed flex-1",children:['"',r,'"']}),e.jsxs("div",{className:"flex items-center gap-3 pt-2 border-t border-[#ECEAE3]",children:[a?e.jsx("img",{src:a,alt:"",className:"w-10 h-10 rounded-full object-cover"}):e.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-[#553DE9] to-[#7B6BEF] flex items-center justify-center text-white text-sm font-bold flex-shrink-0",children:c}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-[#36342E]",children:t}),e.jsxs("p",{className:"text-xs text-[#6B6960]",children:[s,", ",n]})]})]})]})}const E=[{quote:"Loki Mode turned a weekend project into a production app in 45 minutes. The RARV cycle caught bugs I would have shipped. Easily 10x faster than writing everything by hand.",name:"Sarah Chen",role:"Full-Stack Developer",company:"Nimbus Labs"},{quote:"The quality gates are what sold me. Three blind reviewers, anti-sycophancy checks, severity blocking -- it catches issues that even our senior engineers miss in code review.",name:"Marcus Rivera",role:"CTO",company:"Forgepoint Systems"},{quote:"As a solo founder, Loki Mode is like having a senior engineering team on demand. I shipped our MVP in a day instead of two weeks. The autonomous iteration is the real game changer.",name:"Priya Sharma",role:"Founder",company:"Seedcraft"},{quote:"Self-hosted, no data leaves our network, and the multi-provider failover means we never hit rate limits. Exactly what our compliance team needed. Enterprise-ready out of the box.",name:"Daniel Okafor",role:"DevOps Lead",company:"Vaultline Security"}],v=[{feature:"Claude (Opus/Sonnet/Haiku)",category:"AI Models",lokiMode:!0,boltNew:!1,replit:!1,lovable:!0},{feature:"GPT-4o / Codex",category:"AI Models",lokiMode:!0,boltNew:!0,replit:!0,lovable:!1},{feature:"Gemini",category:"AI Models",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"5-provider auto-failover",category:"AI Models",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"9 automated quality gates",category:"Quality",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Blind 3-reviewer code review",category:"Quality",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Anti-sycophancy checks",category:"Quality",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Automated test generation",category:"Quality",lokiMode:!0,boltNew:!1,replit:"Partial",lovable:!1},{feature:"Docker container generation",category:"Deployment",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"CI/CD pipeline generation",category:"Deployment",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"One-click cloud deploy",category:"Deployment",lokiMode:"Planned",boltNew:!0,replit:!0,lovable:!0},{feature:"Self-hosted (your keys)",category:"Cost",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Free tier available",category:"Cost",lokiMode:"Source-available (BUSL-1.1)",boltNew:!0,replit:!0,lovable:!0},{feature:"No vendor lock-in",category:"Cost",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"SSO / OIDC authentication",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"RBAC access control",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"Audit logging",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"Air-gapped deployment",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1}];function C(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",className:"text-[#1FC5A8]",children:e.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function M(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",className:"text-[#C45B5B]/40",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function m({value:r}){return typeof r=="string"?e.jsx("span",{className:"text-xs text-[#6B6960] font-medium",children:r}):r?e.jsx(C,{}):e.jsx(M,{})}const A=[{title:"Full Autonomy",description:"Describe what you want. Loki Mode handles planning, coding, testing, and verification automatically.",icon:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#553DE9]",children:e.jsx("path",{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},{title:"Production Quality",description:"9 quality gates, blind code review, and anti-sycophancy checks ensure code that actually works.",icon:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#1FC5A8]",children:e.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},{title:"Your Infrastructure",description:"Self-hosted, source-available (BUSL-1.1), no data leaves your network. Use your own API keys across 5 providers.",icon:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#2F71E3]",children:[e.jsx("rect",{x:"2",y:"2",width:"20",height:"8",rx:"2",stroke:"currentColor",strokeWidth:"2"}),e.jsx("rect",{x:"2",y:"14",width:"20",height:"8",rx:"2",stroke:"currentColor",strokeWidth:"2"}),e.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor"}),e.jsx("circle",{cx:"6",cy:"18",r:"1",fill:"currentColor"})]})},{title:"Built for Teams",description:"Enterprise auth, RBAC, audit logs, and parallel workflows for teams of any size.",icon:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#E93D82]",children:[e.jsx("path",{d:"M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("circle",{cx:"9",cy:"7",r:"4",stroke:"currentColor",strokeWidth:"2"}),e.jsx("path",{d:"M23 21v-2a4 4 0 00-3-3.87M16 3.13a4 4 0 010 7.75",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}];function S(){const r=[...new Set(v.map(t=>t.category))];return e.jsx("div",{className:"min-h-screen bg-[#FAF9F6]",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-2xl font-bold text-[#36342E]",children:"Compare"}),e.jsx("p",{className:"text-[#6B6960] mt-1",children:"See how Loki Mode stacks up against other AI development platforms."})]}),e.jsx("div",{className:"bg-white border border-[#ECEAE3] rounded-xl overflow-hidden shadow-sm",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[#ECEAE3]",children:[e.jsx("th",{className:"text-left px-4 py-3 font-medium text-[#6B6960] w-[240px]",children:"Feature"}),e.jsx("th",{className:"text-center px-4 py-3 font-bold text-[#553DE9] bg-[#553DE9]/5 w-[130px]",children:"Loki Mode"}),e.jsx("th",{className:"text-center px-4 py-3 font-medium text-[#6B6960] w-[130px]",children:"bolt.new"}),e.jsx("th",{className:"text-center px-4 py-3 font-medium text-[#6B6960] w-[130px]",children:"Replit"}),e.jsx("th",{className:"text-center px-4 py-3 font-medium text-[#6B6960] w-[130px]",children:"Lovable"})]})}),e.jsx("tbody",{children:r.map(t=>e.jsxs(e.Fragment,{children:[e.jsx("tr",{className:"bg-[#FAF9F6]",children:e.jsx("td",{colSpan:5,className:"px-4 py-2 text-xs font-bold text-[#939084] uppercase tracking-wider",children:t})},`cat-${t}`),v.filter(s=>s.category===t).map(s=>e.jsxs("tr",{className:"border-b border-[#ECEAE3] last:border-b-0",children:[e.jsx("td",{className:"px-4 py-2.5 text-[#36342E]",children:s.feature}),e.jsx("td",{className:"px-4 py-2.5 text-center bg-[#553DE9]/5",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.lokiMode})})}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.boltNew})})}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.replit})})}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.lovable})})})]},s.feature))]}))})]})})}),e.jsxs("div",{className:"mt-12",children:[e.jsx("h2",{className:"text-xl font-bold text-[#36342E] mb-6",children:"Why developers choose Loki Mode"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:A.map(t=>e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl p-5 shadow-sm hover:shadow-md transition-shadow",children:[e.jsx("div",{className:"mb-3",children:t.icon}),e.jsx("h3",{className:"text-base font-bold text-[#36342E] mb-1",children:t.title}),e.jsx("p",{className:"text-sm text-[#6B6960]",children:t.description})]},t.title))})]}),e.jsxs("div",{className:"mt-12",children:[e.jsx("h2",{className:"text-xl font-bold text-[#36342E] mb-6",children:"What developers are saying"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:E.map(t=>e.jsx(k,{...t},t.name))})]}),e.jsx("div",{className:"mt-12 max-w-xl mx-auto",children:e.jsx(N,{})})]})})}export{S as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as d,a as x,j as e}from"./index-DvZ0Kk2x.js";const j={verified:{badge:"bg-success/10 text-success border-success/20",dot:"bg-success",label:"Verified",proven:"These receipt bytes are unaltered, and they were signed by the holder of the signing key.",notProven:"That the code is correct. A receipt records which checks ran, not that the result is right."},unsigned:{badge:"bg-warning/10 text-warning border-warning/20",dot:"bg-warning",label:"Unsigned",proven:"The receipt is internally consistent with its own integrity hash.",notProven:"Who produced it. An unsigned receipt is forgeable: whoever controls the builder can rewrite the facts and recompute the hash."},unchecked:{badge:"bg-warning/10 text-warning border-warning/20",dot:"bg-warning",label:"Not checked",proven:"The integrity hash matches, so nothing is wrong with the contents.",notProven:"Provenance. A signature is present but was not evaluated here, which is not the same as a bad signature."},tampered:{badge:"bg-danger/10 text-danger border-danger/20",dot:"bg-danger",label:"Tampered",proven:"Nothing. The recorded hash does not match the contents.",notProven:"Anything at all. This receipt was edited after it was written. Do not trust this build."}};function w(t){const n=t==null?void 0:t.verification;return!n||!n.hash?"unsigned":n.attestation||n.gpg_signature?"unchecked":"unsigned"}const b=[{key:"verified",label:"Verified",bar:"bg-success",text:"text-success"},{key:"with_gaps",label:"With gaps",bar:"bg-warning",text:"text-warning"},{key:"not_verified",label:"Not verified",bar:"bg-danger",text:"text-danger"},{key:"unknown",label:"Unknown",bar:"bg-muted/40",text:"text-muted"}];function N({summary:t}){const n=t.total_receipts;return n?e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex h-1.5 rounded-full overflow-hidden bg-muted/10",children:b.map(({key:a,bar:s})=>{const i=t[a];return i?e.jsx("div",{className:s,style:{width:`${i/n*100}%`},title:`${i} ${a}`},a):null})}),e.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs",children:b.map(({key:a,label:s,text:i})=>{const l=t[a];return l?e.jsxs("span",{className:i,children:[e.jsx("span",{className:"font-semibold",children:l})," ",s.toLowerCase()]},a):null})}),e.jsxs("p",{className:"text-muted text-xs",children:["Recorded verdicts across ",n," receipt",n===1?"":"s",", not re-verified here."]})]}):null}function o({label:t,value:n}){return e.jsxs("div",{className:"flex items-baseline gap-2 text-xs",children:[e.jsx("span",{className:"text-muted w-28 flex-shrink-0",children:t}),e.jsx("span",{className:"font-mono truncate",title:n,children:n})]})}function y({proof:t}){var m,p,g,f;const[n,a]=d.useState(!1),[s,i]=d.useState(null),[l,c]=d.useState(null);d.useEffect(()=>{if(!n||s||l)return;let h=!1;return x.getProof(t.run_id).then(u=>{h||i(u)}).catch(u=>{h||c((u==null?void 0:u.message)||"could not load this receipt")}),()=>{h=!0}},[n,t.run_id,s,l]);const r=j[w(s)],v=t.generated_at?new Date(t.generated_at).toLocaleString():"unknown";return e.jsxs("div",{className:`border rounded-card overflow-hidden ${s?r.badge:"border-muted/20"}`,children:[e.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 px-3 py-2.5 text-left",onClick:()=>a(!n),"aria-expanded":n,children:[e.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${s?r.dot:"bg-muted/40"}`}),e.jsx("span",{className:"text-sm font-medium flex-1 truncate",children:t.headline||t.run_id}),t.final_verdict&&e.jsx("span",{className:"text-xs font-mono uppercase tracking-wider flex-shrink-0 text-muted",children:t.final_verdict}),e.jsx("span",{className:"text-muted text-xs flex-shrink-0",children:n?"−":"+"})]}),n&&e.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-current/10 pt-3",children:[l&&e.jsxs("p",{className:"text-xs text-danger",children:["Could not load this receipt: ",l]}),!l&&!s&&e.jsx("p",{className:"text-xs text-muted",children:"Loading receipt…"}),s&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(o,{label:"Run",value:s.run_id}),e.jsx(o,{label:"Generated",value:v}),e.jsx(o,{label:"Loki version",value:s.loki_version||"unknown"}),e.jsx(o,{label:"Cost",value:typeof s.cost_usd=="number"?`$${s.cost_usd.toFixed(2)}`:"unknown"}),e.jsx(o,{label:"Files changed",value:typeof s.files_changed=="number"?String(s.files_changed):"unknown"}),((m=s.verification)==null?void 0:m.hash)&&e.jsx(o,{label:"Integrity hash",value:s.verification.hash})]}),e.jsxs("div",{className:`rounded-card border px-3 py-2 ${r.badge}`,children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider mb-1",children:r.label}),e.jsxs("p",{className:"text-xs mb-1",children:[e.jsx("span",{className:"font-semibold",children:"Proven: "}),r.proven]}),e.jsxs("p",{className:"text-xs opacity-80",children:[e.jsx("span",{className:"font-semibold",children:"Not proven: "}),r.notProven]})]}),(((p=s.verification)==null?void 0:p.attestation)||((g=s.verification)==null?void 0:g.gpg_signature))&&e.jsxs("p",{className:"text-xs text-muted",children:["Verify it yourself:"," ",e.jsxs("code",{className:"font-mono",children:["loki proof verify ",s.run_id,(f=s.verification)!=null&&f.attestation?" --jwks <url|file>":""]})]}),t.pr_url&&e.jsx("a",{href:t.pr_url,target:"_blank",rel:"noreferrer noopener",className:"text-xs text-primary underline",children:"View the pull request"})]})]})]})}function _(){const[t,n]=d.useState(null),[a,s]=d.useState(null),[i,l]=d.useState(null);return d.useEffect(()=>{let c=!1;return x.listProofs().then(r=>{c||n(r.proofs||[])}).catch(r=>{c||l((r==null?void 0:r.message)||"could not load receipts")}),x.proofsSummary().then(r=>{c||s(r)}).catch(()=>{}),()=>{c=!0}},[]),e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Evidence Receipts"}),e.jsx("p",{className:"text-muted text-xs mt-1",children:"What each build actually checked, recorded so you can verify it yourself."})]}),i&&e.jsxs("p",{className:"text-xs text-danger",children:["Could not load receipts: ",i]}),!i&&t===null&&e.jsx("p",{className:"text-xs text-muted",children:"Loading…"}),a&&e.jsx(N,{summary:a}),t!==null&&t.length===0&&e.jsxs("p",{className:"text-xs text-muted",children:["No receipts yet. One is written at the end of each run (set ",e.jsx("code",{className:"font-mono",children:"LOKI_PROOF=0"})," to opt out)."]}),e.jsx("div",{className:"space-y-2",children:t==null?void 0:t.map(c=>e.jsx(y,{proof:c},c.run_id))})]})}export{_ as E};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{c as M,r as o,a as C,j as e,n as P,J as w,N as f,a5 as B,M as R,m as A,E as H}from"./index-DvZ0Kk2x.js";import{B as v}from"./Button-BDp9aJ9q.js";import{C as k,G as q}from"./thumbs-up-CAh3HVzH.js";import{R as F}from"./refresh-cw-CjqzYczt.js";import{C as S}from"./circle-alert-Da74VO8P.js";import{U as D}from"./user-BQf_XJO_.js";import{R as T}from"./rotate-ccw-CY0os4DH.js";import{L as U}from"./loader-circle-0K8yLgHl.js";/**
|
|
2
|
-
* @license lucide-react v0.577.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const W=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.35 2.69A10 10 0 0 1 21.3 15.65",key:"1pfsoa"}],["path",{d:"M19.08 19.08A10 10 0 1 1 4.92 4.92",key:"1ablyi"}]],O=M("circle-off",W);/**
|
|
7
|
-
* @license lucide-react v0.577.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Q=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],V=M("tag",Q),X={"creating-branch":"Creating branch...",analyzing:"Analyzing issue...","writing-fix":"Writing fix...","running-tests":"Running tests...","creating-pr":"Creating PR..."},E=["creating-branch","analyzing","writing-fix","running-tests","creating-pr"];function z(s){const r=Date.now(),n=new Date(s).getTime(),t=r-n,a=Math.floor(t/1e3),i=Math.floor(a/60),x=Math.floor(i/60),m=Math.floor(x/24);return m>30?`${Math.floor(m/30)}mo ago`:m>0?`${m}d ago`:x>0?`${x}h ago`:i>0?`${i}m ago`:"just now"}function J(s){return s.slice(0,2).toUpperCase()}function K(s){const r=parseInt(s.slice(0,2),16),n=parseInt(s.slice(2,4),16),t=parseInt(s.slice(4,6),16);return(.299*r+.587*n+.114*t)/255>.5?"#1a1a1a":"#ffffff"}function _(s){if(!s)return[];const r=s.split(`
|
|
12
|
-
`),n=[];for(let t=0;t<r.length;t++){const a=r[t];if(/^\s*[-*]\s/.test(a)){const i=a.replace(/^\s*[-*]\s/,"");n.push(e.jsx("li",{className:"ml-4 list-disc text-xs text-secondary leading-relaxed",children:L(i)},t));continue}if(a.trim()===""){n.push(e.jsx("br",{},t));continue}n.push(e.jsx("p",{className:"text-xs text-secondary leading-relaxed",children:L(a)},t))}return n}function L(s){const r=[],n=/(\*\*[^*]+\*\*|`[^`]+`)/g;let t=0,a;for(;(a=n.exec(s))!==null;){a.index>t&&r.push(s.slice(t,a.index));const i=a[0];i.startsWith("**")?r.push(e.jsx("strong",{className:"font-semibold text-ink",children:i.slice(2,-2)},a.index)):i.startsWith("`")&&r.push(e.jsx("code",{className:"px-1 py-0.5 rounded bg-hover text-xs font-mono text-primary",children:i.slice(1,-1)},a.index)),t=a.index+i.length}return t<s.length&&r.push(s.slice(t)),r}function $({label:s}){const r=`#${s.color}`,n=K(s.color);return e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-btn px-2 py-0.5 text-[11px] font-medium leading-none",style:{backgroundColor:r,color:n},children:[e.jsx(V,{size:10}),s.name]})}function I({login:s}){return e.jsx("span",{className:"inline-flex items-center justify-center w-6 h-6 rounded-full bg-primary/10 text-primary text-[10px] font-bold flex-shrink-0",title:s,children:J(s)})}function N(){return e.jsxs("div",{className:"px-4 py-3 border border-border rounded-card space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{variant:"text",width:"2.5rem",height:"0.625rem"}),e.jsx(f,{variant:"text",width:"60%",height:"0.75rem"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{variant:"text",width:"4rem",height:"0.5rem"}),e.jsx(f,{variant:"text",width:"4rem",height:"0.5rem"})]})]})}function Y({issue:s,onClick:r}){return e.jsx("button",{onClick:r,className:"w-full text-left px-4 py-3 border border-border rounded-card hover:bg-hover transition-colors cursor-pointer group",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(k,{size:16,className:`mt-0.5 flex-shrink-0 ${s.state==="open"?"text-success":"text-primary"}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-xs font-mono text-muted flex-shrink-0",children:["#",s.number]}),e.jsx("span",{className:"text-sm font-medium text-ink truncate group-hover:text-primary transition-colors",children:s.title})]}),e.jsx("div",{className:"flex items-center flex-wrap gap-1.5 mt-1.5",children:s.labels.map(n=>e.jsx($,{label:n},n.name))}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[11px] text-muted",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(I,{login:s.author.login}),s.author.login]}),e.jsx("span",{children:z(s.createdAt)}),s.comments>0&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(R,{size:11}),s.comments]})]})]})]})})}function Z({fixState:s,onRetry:r}){if(s.status==="idle")return null;if(s.status==="success"&&s.result)return e.jsxs("div",{className:"rounded-card border border-success/30 bg-success/5 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-success",children:[e.jsx(A,{size:16}),"Pull request created"]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted",children:[e.jsx(q,{size:14,className:"text-success"}),e.jsxs("span",{className:"font-mono",children:["PR #",s.result.pr_number]}),e.jsx("span",{className:"text-secondary",children:"on branch"}),e.jsx("span",{className:"font-mono bg-hover px-1.5 py-0.5 rounded-btn",children:s.result.branch})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("a",{href:s.result.pr_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs font-medium text-primary hover:underline",children:[e.jsx(H,{size:12}),"View on GitHub"]})})]});if(s.status==="error")return e.jsxs("div",{className:"rounded-card border border-danger/30 bg-danger/5 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-danger",children:[e.jsx(S,{size:16}),"Fix failed"]}),e.jsx("p",{className:"text-xs text-muted font-mono bg-danger/5 border border-danger/10 rounded px-2 py-1.5",children:s.error||"Unknown error"}),e.jsx(v,{variant:"secondary",size:"sm",icon:T,onClick:r,children:"Retry"})]});const n=E.indexOf(s.status);return e.jsx("div",{className:"rounded-card border border-primary/20 bg-primary/5 p-4 space-y-2",children:E.map((t,a)=>{const i=a===n,x=a<n;return e.jsxs("div",{className:`flex items-center gap-2 text-xs ${x?"text-success":i?"text-primary font-medium":"text-muted"}`,children:[x?e.jsx(A,{size:14}):i?e.jsx(U,{size:14,className:"animate-spin"}):e.jsx(O,{size:14,className:"opacity-40"}),X[t]]},t)})})}function ee({sessionId:s,issueNumber:r,onBack:n}){const[t,a]=o.useState(null),[i,x]=o.useState(!0),[m,g]=o.useState(null),[u,h]=o.useState({status:"idle"});o.useEffect(()=>{let l=!1;return x(!0),(async()=>{try{const d=await C.getGitHubIssue(s,r);l||(a(d),g(null))}catch(d){l||g(d instanceof Error?d.message:"Failed to load issue")}finally{l||x(!1)}})(),()=>{l=!0}},[s,r]);const j=o.useCallback(async()=>{const l=["creating-branch","analyzing","writing-fix","running-tests","creating-pr"];let d=0;h({status:l[0]});const y=setInterval(()=>{d++,d<l.length&&h({status:l[d]})},2e3);try{const p=await C.fixGitHubIssue(s,r);clearInterval(y),h({status:"success",result:p})}catch(p){clearInterval(y),h({status:"error",error:p instanceof Error?p.message:"Fix failed"})}},[s,r]);return i?e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-muted hover:text-ink transition-colors",children:[e.jsx(w,{size:14}),"Back to issues"]}),e.jsx(f,{variant:"text",width:"70%",height:"1rem"}),e.jsx(f,{variant:"block",width:"100%",height:"6rem"}),e.jsx(f,{variant:"text",width:"40%",height:"0.75rem"})]}):m||!t?e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-muted hover:text-ink transition-colors",children:[e.jsx(w,{size:14}),"Back to issues"]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-danger",children:[e.jsx(S,{size:16}),m||"Issue not found"]})]}):e.jsxs("div",{className:"p-4 space-y-4 overflow-y-auto terminal-scroll h-full",children:[e.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-muted hover:text-ink transition-colors",children:[e.jsx(w,{size:14}),"Back to issues"]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(k,{size:18,className:`mt-0.5 flex-shrink-0 ${t.state==="open"?"text-success":"text-primary"}`}),e.jsxs("h3",{className:"text-base font-semibold text-ink leading-snug",children:[e.jsxs("span",{className:"text-muted font-mono mr-1.5",children:["#",t.number]}),t.title]})]}),e.jsx("div",{className:"flex items-center flex-wrap gap-2 mt-2 ml-6",children:t.labels.map(l=>e.jsx($,{label:l},l.name))}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 ml-6 text-[11px] text-muted",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(I,{login:t.author.login}),t.author.login]}),e.jsx("span",{children:z(t.createdAt)})]}),t.assignees.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5 mt-2 ml-6 text-[11px] text-muted",children:[e.jsx(D,{size:11}),"Assigned to:"," ",t.assignees.map(l=>l.login).join(", ")]})]}),t.body&&e.jsx("div",{className:"ml-6 border-l-2 border-border pl-4 space-y-1",children:_(t.body)}),e.jsx("div",{className:"ml-6",children:u.status==="idle"?e.jsx(v,{variant:"primary",size:"md",icon:B,onClick:j,children:"Fix with AI"}):e.jsx(Z,{fixState:u,onRetry:j})}),t.comments_data&&t.comments_data.length>0&&e.jsxs("div",{className:"ml-6 space-y-3",children:[e.jsxs("h4",{className:"text-xs font-semibold text-muted uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx(R,{size:12}),"Comments (",t.comments_data.length,")"]}),t.comments_data.map((l,d)=>e.jsxs("div",{className:"border border-border rounded-card p-3 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted",children:[e.jsx(I,{login:l.author.login}),e.jsx("span",{className:"font-medium text-ink",children:l.author.login}),e.jsx("span",{children:z(l.createdAt)})]}),e.jsx("div",{className:"mt-1 space-y-1",children:_(l.body)})]},d))]})]})}function oe({sessionId:s}){const[r,n]=o.useState("open"),[t,a]=o.useState(""),[i,x]=o.useState(null),[m,g]=o.useState(!0),[u,h]=o.useState(null),[j,l]=o.useState(null),d=o.useCallback(async()=>{g(!0),h(null);try{const c=r==="all"?"all":r,b=await C.getGitHubIssues(s,c);x(b)}catch(c){h(c instanceof Error?c.message:"Failed to load issues")}finally{g(!1)}},[s,r]);o.useEffect(()=>{d()},[d]);const y=o.useCallback(c=>{n(c),l(null)},[]),p=o.useMemo(()=>{if(!i)return[];if(!t.trim())return i;const c=t.toLowerCase();return i.filter(b=>b.title.toLowerCase().includes(c)||String(b.number).includes(c)||b.labels.some(G=>G.name.toLowerCase().includes(c)))},[i,t]);return j!==null?e.jsx(ee,{sessionId:s,issueNumber:j,onBack:()=>l(null)}):e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-border space-y-3 flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h3",{className:"text-sm font-semibold text-ink flex items-center gap-2",children:[e.jsx(k,{size:16,className:"text-primary"}),"GitHub Issues"]}),e.jsx(v,{variant:"ghost",size:"sm",icon:F,onClick:d,loading:m,children:"Refresh"})]}),e.jsx("div",{className:"flex items-center gap-1 bg-hover rounded-btn p-0.5",children:["open","closed","all"].map(c=>e.jsx("button",{onClick:()=>y(c),className:`flex-1 text-xs font-medium py-1.5 px-3 rounded-btn transition-colors capitalize ${r===c?"bg-white text-ink shadow-sm":"text-muted hover:text-secondary"}`,children:c},c))}),e.jsxs("div",{className:"relative",children:[e.jsx(P,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted pointer-events-none"}),e.jsx("input",{type:"text",placeholder:"Filter issues...",value:t,onChange:c=>a(c.target.value),className:"w-full pl-8 pr-3 py-2 text-xs border border-border rounded-btn bg-white text-ink placeholder:text-muted focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/10"})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto terminal-scroll p-3 space-y-2",children:[m&&!i&&e.jsxs(e.Fragment,{children:[e.jsx(N,{}),e.jsx(N,{}),e.jsx(N,{}),e.jsx(N,{})]}),u&&e.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx(S,{size:24,className:"text-danger mb-2"}),e.jsx("p",{className:"text-xs font-medium text-ink",children:"Failed to load issues"}),e.jsx("p",{className:"text-[11px] text-muted mt-0.5",children:u}),e.jsx(v,{variant:"secondary",size:"sm",icon:F,onClick:d,className:"mt-3",children:"Retry"})]}),!m&&!u&&p.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx(k,{size:24,className:"text-muted/30 mb-2"}),e.jsx("p",{className:"text-xs font-medium text-ink",children:"No issues found"}),e.jsx("p",{className:"text-[11px] text-muted mt-0.5",children:t?"Try adjusting your search query":`No ${r==="all"?"":r} issues in this repository`})]}),!u&&p.map(c=>e.jsx(Y,{issue:c,onClick:()=>l(c.number)},c.number))]})]})}export{oe as GitHubIssuesPanel};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import{c as he,j as e,P as We,r as n,a as j,C as Ue,M as fe,R as re,u as ae,b as Ve,A as Qe,S as Ye,d as Ke,U as Ze,e as Je}from"./index-DvZ0Kk2x.js";import{u as R}from"./usePolling-D0aoTX80.js";import{P as Xe,S as et,E as C}from"./ErrorBoundary-ut3wrUmu.js";import{F as tt,T as st}from"./TerminalOutput-togzv9Zl.js";import{E as rt}from"./EvidenceReceiptPanel-CcaBwEI-.js";import{B as at}from"./Badge-BF3mhT57.js";import{P as nt}from"./package-BtXTKusI.js";import{C as it}from"./cloud-B_Y5ZrIO.js";import{C as be}from"./code-xml-Bbom7YWV.js";import{H as lt}from"./hammer-EgOQNukG.js";import{C as ot}from"./chevron-left-DXUqkd8J.js";import{L as ct}from"./layers-BOVKmepE.js";import{C as dt}from"./check-ikfylPst.js";import{M as mt}from"./mail-COu670_W.js";import{B as xt}from"./bell-DWH0drES.js";import{F as ut}from"./file-code-corner-CVrkaOQP.js";import"./lock-XzlDMy8M.js";import"./clock-mlGCFq8l.js";import"./circle-alert-Da74VO8P.js";/**
|
|
2
|
-
* @license lucide-react v0.577.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const pt=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],ht=he("hard-drive",pt);/**
|
|
7
|
-
* @license lucide-react v0.577.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const ft=[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]],bt=he("party-popper",ft);function gt(t){if(t<60)return`${Math.round(t)}s`;if(t<3600)return`${Math.floor(t/60)}m ${Math.round(t%60)}s`;const s=Math.floor(t/3600),r=Math.floor(t%3600/60);return`${s}h ${r}m`}function jt(t,s){if(!t||t<=0)return"--";const r={simple:{opus:1,haiku:1,total:3},standard:{opus:2,haiku:2,total:5},complex:{opus:3,haiku:3,total:8}},a=r[s]||r.standard;return t<=a.opus?"Opus":t>a.total-a.haiku?"Haiku":"Sonnet"}function vt({status:t,prdSummary:s,onStop:r,onPause:a,onResume:i,isPaused:o}){const l=t?jt(t.iteration??0,t.complexity||"standard"):"--",d=o??(t==null?void 0:t.paused)??!1;return e.jsxs("div",{className:"card px-5 py-3 flex items-center gap-6 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Phase"}),e.jsx("span",{className:"font-mono font-semibold text-ink",children:(t==null?void 0:t.phase)||"idle"})]}),e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Complexity"}),e.jsx("span",{className:`font-mono font-semibold ${(t==null?void 0:t.complexity)==="complex"?"text-warning":(t==null?void 0:t.complexity)==="simple"?"text-success":"text-ink"}`,children:(t==null?void 0:t.complexity)||"standard"})]}),e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Model"}),e.jsx("span",{className:`font-mono font-semibold px-2 py-0.5 rounded-md text-xs ${l==="Opus"?"bg-primary/10 text-primary":l==="Haiku"?"bg-success/10 text-success":"bg-primary/10 text-primary"}`,children:l})]}),e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Tasks"}),e.jsx("span",{className:"font-mono text-ink",children:t!=null&&t.current_task?e.jsx("span",{className:"text-xs",children:t.current_task}):e.jsx("span",{className:"text-muted",children:"--"})}),((t==null?void 0:t.pending_tasks)??0)>0&&e.jsxs("span",{className:"text-xs text-primary font-mono",children:["+",t==null?void 0:t.pending_tasks," pending"]})]}),s&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium flex-shrink-0",children:"Building"}),e.jsx("span",{className:"text-xs font-mono text-ink truncate max-w-[220px]",title:s,children:s.length>60?s.slice(0,60)+"...":s})]})]}),e.jsx("div",{className:"flex-1"}),((t==null?void 0:t.uptime)??0)>0&&e.jsx("span",{className:"font-mono text-xs text-muted",children:gt((t==null?void 0:t.uptime)??0)}),(a||i)&&e.jsxs("button",{onClick:d?i:a,className:"flex items-center gap-1.5 px-4 py-1.5 rounded-btn text-xs font-semibold border border-warning/30 text-warning hover:bg-warning/10 transition-colors",children:[d?e.jsx(We,{size:14}):e.jsx(Xe,{size:14}),d?"Resume":"Pause"]}),r&&e.jsxs("button",{onClick:r,className:"flex items-center gap-1.5 px-4 py-1.5 rounded-btn text-xs font-semibold bg-danger/10 text-danger border border-danger/20 hover:bg-danger/20 transition-colors",children:[e.jsx(et,{size:14}),"Stop"]})]})}function yt({status:t}){const s=[{label:"Iteration",value:t?t.iteration.toString():"--",color:"text-primary"},{label:"Agents",value:t?t.running_agents.toString():"--",color:t&&t.running_agents>0?"text-success":"text-muted"},{label:"Pending",value:t?t.pending_tasks.toString():"--",color:t&&t.pending_tasks>0?"text-warning":"text-muted"},{label:"Provider",value:(t==null?void 0:t.provider)||"--",color:"text-primary"}];return e.jsx("div",{className:"grid grid-cols-4 gap-3",children:s.map(r=>e.jsxs("div",{className:"card p-4 text-center",children:[e.jsx("div",{className:`text-2xl font-bold font-mono ${r.color}`,children:r.value}),e.jsx("div",{className:"text-xs text-muted font-medium mt-1 uppercase tracking-wider",children:r.label})]},r.label))})}function Nt({plan:t,loading:s,onConfirm:r,onCancel:a}){return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",children:e.jsxs("div",{className:"card w-full max-w-lg mx-4 p-6 rounded-card shadow-card-hover",children:[e.jsx("h2",{className:"text-lg font-bold text-ink mb-4",children:"Build Estimate"}),s?e.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[e.jsx("div",{className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin"}),e.jsx("p",{className:"text-sm text-muted",children:"Analyzing spec..."}),e.jsxs("div",{className:"flex gap-3 mt-4",children:[e.jsx("button",{onClick:a,className:"px-4 py-2 text-sm font-medium text-muted hover:text-ink transition-colors",children:"Cancel"}),e.jsx("button",{onClick:r,className:"px-4 py-2 text-sm font-medium text-primary hover:text-primary/80 transition-colors underline",children:"Skip analysis, build now"})]})]}):t?e.jsxs(e.Fragment,{children:[t.returncode!==0&&e.jsxs("div",{className:"mb-4 px-3 py-2 rounded-btn bg-warning/10 border border-warning/20 text-warning text-xs",children:["loki plan exited with code ",t.returncode," - showing partial results"]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Complexity"}),e.jsx("div",{className:"text-base font-bold text-ink capitalize",children:t.complexity})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Est. Cost"}),e.jsx("div",{className:"text-base font-bold text-ink",children:t.cost_estimate})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Iterations"}),e.jsx("div",{className:"text-base font-bold text-ink",children:t.iterations})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Phases"}),e.jsx("div",{className:"text-xs text-ink capitalize",children:t.phases.join(", ")})]})]}),t.output_text&&e.jsxs("details",{className:"mb-4",children:[e.jsx("summary",{className:"text-xs text-muted cursor-pointer hover:text-ink transition-colors",children:"Raw output"}),e.jsx("pre",{className:"mt-2 text-xs font-mono text-muted-accessible bg-black/5 rounded-card p-3 overflow-auto max-h-40 whitespace-pre-wrap",children:t.output_text})]}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx("button",{onClick:a,className:"px-4 py-2 text-sm font-medium text-muted hover:text-ink transition-colors",children:"Cancel"}),e.jsx("button",{onClick:r,className:"px-5 py-2 rounded-card text-sm font-semibold bg-primary text-white hover:bg-primary/90 transition-all shadow-button",children:"Start Build"})]})]}):e.jsx("div",{className:"text-sm text-muted py-4",children:"No plan data available."})]})})}function wt({onSubmit:t,running:s,error:r,provider:a,onProviderChange:i,initialPrd:o}){const[l,d]=n.useState(""),[c,x]=n.useState(""),[u,v]=n.useState("claude"),[p,b]=n.useState(""),y=a??u,[N,k]=n.useState(!1),[w,B]=n.useState([]),[h,L]=n.useState(!1),[E,z]=n.useState(!1),[I,A]=n.useState(!1),[O,S]=n.useState(null),[D,_]=n.useState(!1),[q,$]=n.useState(!1);n.useEffect(()=>{j.getTemplates().then(g=>{B(g),L(!1)}).catch(()=>{B([]),L(!0)})},[]),n.useEffect(()=>{o&&d(o)},[o]),n.useEffect(()=>{if(o)return;const g=localStorage.getItem("loki-prd-draft");g&&d(g),j.getPrdPrefill().then(({content:P})=>{P&&d(P)}).catch(()=>{})},[o]),n.useEffect(()=>{l.trim()?localStorage.setItem("loki-prd-draft",l):localStorage.removeItem("loki-prd-draft")},[l]);const V=n.useCallback(async(g,P)=>{x(P),k(!1);try{const T=await j.getTemplateContent(g);d(T.content)}catch{d(`# ${P}
|
|
12
|
-
|
|
13
|
-
## Overview
|
|
14
|
-
|
|
15
|
-
Describe your project here...
|
|
16
|
-
|
|
17
|
-
## Features
|
|
18
|
-
|
|
19
|
-
- Feature 1
|
|
20
|
-
- Feature 2
|
|
21
|
-
- Feature 3
|
|
22
|
-
|
|
23
|
-
## Technical Requirements
|
|
24
|
-
|
|
25
|
-
- Requirement 1
|
|
26
|
-
- Requirement 2
|
|
27
|
-
`)}},[]),Q=async()=>{if(!(!l.trim()||D)){_(!0),S(null),$(!0);try{const g=await j.planSession(l,y);S(g)}catch{S({complexity:"unknown",cost_estimate:"N/A",iterations:0,phases:[],output_text:"Failed to run loki plan. The CLI may not be available.",returncode:1})}finally{_(!1)}}},G=async()=>{if(!(!l.trim()||s||E)){$(!1),z(!0);try{await t(l,y,p.trim()||void 0,I?"quick":void 0)}finally{z(!1)}}};return e.jsxs(e.Fragment,{children:[q&&e.jsx(Nt,{plan:O,loading:D,onConfirm:G,onCancel:()=>$(!1)}),e.jsxs("div",{className:"card p-6 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Product Requirements"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>k(!N),className:"text-xs font-medium px-3 py-1.5 rounded-card border border-primary/20 text-primary hover:bg-primary/5 transition-colors",children:c||"Templates"}),N&&e.jsx("div",{className:"absolute right-0 top-full mt-1 w-56 card rounded-card overflow-hidden z-20 shadow-card-hover",children:e.jsxs("div",{className:"py-1 max-h-64 overflow-y-auto terminal-scroll",children:[h&&e.jsx("div",{className:"px-3 py-2 text-xs text-warning border-b border-warning/10",children:"Could not load templates from server. Check that the backend is running."}),!h&&w.length===0&&e.jsx("div",{className:"px-3 py-2 text-xs text-muted",children:"Loading..."}),w.map(g=>e.jsx("button",{onClick:()=>V(g.filename,g.name),className:"w-full text-left px-3 py-2 text-sm text-ink hover:bg-primary/5 transition-colors",children:g.name},g.filename))]})})]})})]}),e.jsx("textarea",{value:l,onChange:g=>d(g.target.value),placeholder:"Paste your spec or PRD here, or select a template above to get started...",className:"flex-1 min-h-[280px] w-full bg-card rounded-card border border-border-light px-4 py-3 text-sm font-mono text-ink placeholder:text-primary/60 resize-none focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/30 transition-all",spellCheck:!1}),e.jsxs("div",{className:"mt-3",children:[e.jsx("label",{className:"block text-xs text-muted font-medium mb-1 uppercase tracking-wider",children:"Project Directory"}),e.jsx("input",{type:"text",value:p,onChange:g=>b(g.target.value),placeholder:"Leave blank to auto-create, or type a path (e.g. /Users/you/my-project)",className:"w-full bg-card rounded-card border border-border-light px-4 py-2 text-sm font-mono text-ink placeholder:text-primary/60/70 focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/30 transition-all",spellCheck:!1}),e.jsx("p",{className:"text-xs text-muted-accessible mt-1",children:"Type a path or leave blank to auto-create under ~/purple-lab-projects/"})]}),r&&e.jsx("div",{className:"mt-3 px-3 py-2 rounded-btn bg-danger/10 border border-danger/20 text-danger text-xs font-medium",children:r}),e.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[e.jsxs("button",{onClick:()=>A(!I),title:"Quick Mode: 3 iterations max, faster builds",className:`flex items-center gap-1.5 px-3 py-1.5 rounded-card text-xs font-semibold border transition-all ${I?"bg-primary/10 border-primary/30 text-primary":"border-border-light text-muted hover:text-ink hover:bg-card"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${I?"bg-primary":"bg-muted/40"}`}),"Quick"]}),e.jsx("div",{className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted font-mono",children:[l.length.toLocaleString()," chars"]}),e.jsx("button",{onClick:Q,disabled:!l.trim()||s||E||D,className:`px-6 py-2.5 rounded-card text-sm font-semibold transition-all ${!l.trim()||s||E||D?"bg-primary/10 text-muted cursor-not-allowed":"bg-primary text-white hover:bg-primary/90 shadow-button"}`,children:D?"Analyzing...":E?"Starting...":s?"Building...":"Start Build"})]})]})]})}const H=[{key:"reason",label:"Reason",description:"Analyzing task, planning approach"},{key:"act",label:"Act",description:"Implementing changes, writing code"},{key:"reflect",label:"Reflect",description:"Reviewing output, self-critique"},{key:"verify",label:"Verify",description:"Testing, validation, quality gates"}];function kt(t){if(!t)return"reason";const s=t.toLowerCase();return s.includes("reason")||s.includes("plan")?"reason":s.includes("act")||s.includes("implement")||s.includes("code")?"act":s.includes("reflect")||s.includes("review")?"reflect":s.includes("verify")||s.includes("test")||s.includes("check")?"verify":"idle"}function Et({currentPhase:t,iteration:s}){const r=kt(t);return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"RARV Cycle"}),e.jsxs("span",{className:"font-mono text-xs text-muted",children:["Iteration ",s]})]}),e.jsx("div",{className:"flex items-center justify-center mb-5",children:e.jsxs("svg",{viewBox:"0 0 120 120",className:"w-28 h-28",children:[H.map((a,i)=>{const o=a.key===r,l=r!=="idle"&&H.findIndex(u=>u.key===r)>i,d=(i*90-90)*(Math.PI/180),c=60+40*Math.cos(d),x=60+40*Math.sin(d);return e.jsxs("g",{children:[i<H.length-1&&e.jsx("line",{x1:c,y1:x,x2:60+40*Math.cos(((i+1)*90-90)*(Math.PI/180)),y2:60+40*Math.sin(((i+1)*90-90)*(Math.PI/180)),stroke:l?"#553DE9":"#ECEAE3",strokeWidth:l?2:1,strokeDasharray:l?"none":"4 3"}),i===H.length-1&&e.jsx("line",{x1:c,y1:x,x2:60+40*Math.cos(-90*(Math.PI/180)),y2:60+40*Math.sin(-90*(Math.PI/180)),stroke:"#ECEAE3",strokeWidth:1,strokeDasharray:"4 3"}),e.jsx("circle",{cx:c,cy:x,r:o?14:10,fill:o||l?"#553DE9":"#E8E4FD",stroke:o?"#4432c4":l?"#553DE9":"#ECEAE3",strokeWidth:o?3:1.5,className:o?"phase-active":""}),e.jsx("text",{x:c,y:x+(i===0?-20:i===2?24:0),textAnchor:"middle",className:"text-[9px] font-semibold fill-ink",dx:i===1?22:i===3?-22:0,children:a.label[0]})]},a.key)}),e.jsx("text",{x:"60",y:"64",textAnchor:"middle",className:"text-lg font-bold font-mono fill-primary",children:s})]})}),e.jsx("div",{className:"space-y-2",children:H.map(a=>{const i=a.key===r;return e.jsxs("div",{className:`flex items-center gap-3 px-3 py-2 rounded-card transition-all duration-200 ${i?"bg-primary/8 border border-primary/20":"opacity-50"}`,children:[e.jsx("div",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${i?"bg-primary phase-active":"bg-border"}`}),e.jsxs("div",{children:[e.jsx("span",{className:`text-sm font-semibold ${i?"text-primary":"text-muted"}`,children:a.label}),i&&e.jsx("p",{className:"text-xs text-muted mt-0.5",children:a.description})]})]},a.key)})})]})}const ee={architect:"bg-primary/10 text-primary border-primary/20",developer:"bg-primary/10 text-primary border-primary/20",tester:"bg-success/10 text-success border-success/20",reviewer:"bg-warning/10 text-warning border-warning/20",planner:"bg-primary/60/20 text-ink border-primary/60/30",default:"bg-border/30 text-muted border-border/50"};function St(t){if(!t)return ee.default;const s=t.toLowerCase();for(const[r,a]of Object.entries(ee))if(s.includes(r))return a;return ee.default}function Ct({agents:t,loading:s}){const r=(t==null?void 0:t.filter(i=>i.alive))||[],a=(t==null?void 0:t.filter(i=>!i.alive))||[];return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Agents"}),e.jsxs("span",{className:"font-mono text-xs text-muted",children:[r.length," active"]})]}),s&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading agents..."}),!s&&(t==null?void 0:t.length)===0&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No agents running"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Start a build to spawn agents"})]}),r.length>0&&e.jsx("div",{className:"space-y-2 mb-4",children:r.map(i=>e.jsx(de,{agent:i},i.id))}),a.length>0&&e.jsxs("details",{className:"mt-3",children:[e.jsxs("summary",{className:"text-xs text-muted cursor-pointer hover:text-ink transition-colors",children:[a.length," completed"]}),e.jsx("div",{className:"space-y-1.5 mt-2",children:a.slice(0,10).map(i=>e.jsx(de,{agent:i,compact:!0},i.id))})]})]})}function de({agent:t,compact:s}){const r=St(t.type||t.name||"");return s?e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded-btn bg-hover text-xs",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-muted/30"}),e.jsx("span",{className:"font-medium text-muted truncate",children:t.name||t.id}),e.jsx("span",{className:"text-primary/60 ml-auto",children:t.type})]}):e.jsxs("div",{className:`flex items-start gap-3 px-3 py-2.5 rounded-card border ${r}`,children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${t.alive?"bg-success phase-active":"bg-muted/30"}`})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold truncate",children:t.name||t.id}),t.type&&e.jsx("span",{className:"text-xs font-mono font-medium opacity-70",children:t.type})]}),t.task&&e.jsx("p",{className:"text-xs opacity-70 mt-0.5 truncate",children:t.task}),t.status&&t.status!=="unknown"&&e.jsx("span",{className:"inline-block text-xs font-mono mt-1 opacity-60",children:t.status})]}),t.pid&&e.jsxs("span",{className:"text-xs font-mono text-muted-accessible flex-shrink-0",children:["PID ",t.pid]})]})}function At({text:t,position:s="top",size:r=14}){const[a,i]=n.useState(!1),o=n.useRef(null);n.useEffect(()=>{if(!a)return;const c=x=>{o.current&&!o.current.contains(x.target)&&i(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[a]);const l={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},d={top:"top-full left-1/2 -translate-x-1/2 border-t-[#1A1A1E] dark:border-t-card border-l-transparent border-r-transparent border-b-transparent border-4",bottom:"bottom-full left-1/2 -translate-x-1/2 border-b-[#1A1A1E] dark:border-b-card border-l-transparent border-r-transparent border-t-transparent border-4",left:"left-full top-1/2 -translate-y-1/2 border-l-[#1A1A1E] dark:border-l-card border-t-transparent border-b-transparent border-r-transparent border-4",right:"right-full top-1/2 -translate-y-1/2 border-r-[#1A1A1E] dark:border-r-card border-t-transparent border-b-transparent border-l-transparent border-4"};return e.jsxs("div",{className:"relative inline-flex items-center",ref:o,children:[e.jsx("button",{onClick:()=>i(!a),onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),className:"text-muted/50 hover:text-primary transition-colors p-0.5 rounded-full","aria-label":"Help",type:"button",children:e.jsx(Ue,{size:r})}),a&&e.jsx("div",{className:`absolute z-50 ${l[s]}`,role:"tooltip",children:e.jsxs("div",{className:"relative bg-[#1A1A1E] text-white px-3 py-2 rounded-lg shadow-lg max-w-[240px]",children:[e.jsx("p",{className:"text-[11px] leading-relaxed",children:t}),e.jsx("span",{className:`absolute ${d[s]}`})]})})]})}const Dt={qualityGates:"Automated checks ensuring your code meets quality standards. Includes static analysis, test coverage, and security scanning."},Pt={pass:{badge:"bg-success/10 text-success border-success/20",dot:"bg-success",label:"Pass"},fail:{badge:"bg-danger/10 text-danger border-danger/20",dot:"bg-danger",label:"Fail"},skip:{badge:"bg-muted/10 text-muted border-muted/20",dot:"bg-muted/40",label:"Skip"},pending:{badge:"bg-warning/10 text-warning border-warning/20",dot:"bg-warning",label:"Pending"}};function Ft({item:t}){const[s,r]=n.useState(!1),a=Pt[t.status];return e.jsxs("div",{className:`border rounded-card overflow-hidden ${a.badge}`,children:[e.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 px-3 py-2.5 text-left",onClick:()=>t.details&&r(!s),children:[e.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${a.dot}`}),e.jsx("span",{className:"text-sm font-medium flex-1 truncate",children:t.label}),e.jsx("span",{className:"text-xs font-mono font-semibold uppercase tracking-wider flex-shrink-0",children:a.label}),t.details&&e.jsx("span",{className:"text-xs text-muted/60 flex-shrink-0",children:s?"v":">"})]}),s&&t.details&&e.jsx("div",{className:"px-3 pb-2.5 pt-0",children:e.jsx("p",{className:"text-xs font-mono opacity-70 leading-relaxed",children:t.details})})]})}function Lt({checklist:t,loading:s}){const r=t&&t.total>0?t.passed/t.total*100:0;return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Quality Gates"}),e.jsx(At,{text:Dt.qualityGates,position:"right",size:13})]}),t&&e.jsxs("span",{className:"font-mono text-xs text-muted",children:[t.passed,"/",t.total," passed"]})]}),s&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading gates..."}),!s&&!t&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No quality gate data"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Gates run during verification phase"})]}),t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-4 mb-3 text-xs",children:[e.jsxs("span",{className:"text-success font-medium",children:[t.passed," passed"]}),t.failed>0&&e.jsxs("span",{className:"text-danger font-medium",children:[t.failed," failed"]}),t.skipped>0&&e.jsxs("span",{className:"text-muted",children:[t.skipped," skipped"]}),t.pending>0&&e.jsxs("span",{className:"text-warning",children:[t.pending," pending"]})]}),e.jsx("div",{className:"w-full h-2 bg-charcoal/10 rounded-full overflow-hidden mb-4",children:e.jsx("div",{className:"h-full bg-success rounded-full transition-all duration-500",style:{width:`${r}%`}})}),e.jsx("div",{className:"space-y-2 max-h-[400px] overflow-y-auto terminal-scroll",children:t.items.map(a=>e.jsx(Ft,{item:a},a.id))})]})]})}const Tt={".py":"bg-success",".ts":"bg-primary",".tsx":"bg-primary",".md":"bg-warning",".sh":"bg-primary"};function Mt(t){const s=t.substring(t.lastIndexOf("."));return Tt[s]||"bg-muted"}function Rt(t){return t==null?"":t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}const te=100;function ge({node:t,depth:s,onSelectFile:r,selectedPath:a}){const[i,o]=n.useState(!1),[l,d]=n.useState(te),c=t.type==="directory",x=t.path===a,u=c&&i?t.children??[]:[],v=u.length>l;return e.jsxs("div",{children:[e.jsxs("button",{type:"button",className:`w-full flex items-center gap-2 px-2 py-1 rounded-btn text-left text-sm transition-colors hover:bg-hover ${x?"bg-primary/10 text-primary":"text-ink"}`,style:{paddingLeft:`${s*16+8}px`},onClick:()=>{c?(o(!i),i&&d(te)):r(t.path)},children:[c?e.jsx("span",{className:"font-mono text-xs text-muted w-3 flex-shrink-0",children:i?"v":">"}):e.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${Mt(t.name)}`}),e.jsx("span",{className:`truncate ${c?"font-medium":"font-mono text-xs"}`,children:t.name}),!c&&t.size!==void 0&&e.jsx("span",{className:"ml-auto text-xs font-mono text-muted-accessible flex-shrink-0",children:Rt(t.size)})]}),u.length>0&&e.jsxs("div",{children:[u.slice(0,l).map(p=>e.jsx(ge,{node:p,depth:s+1,onSelectFile:r,selectedPath:a},p.path)),v&&e.jsxs("button",{type:"button",className:"w-full text-left text-xs text-primary hover:text-primary/80 py-1 transition-colors",style:{paddingLeft:`${(s+1)*16+8}px`},onClick:()=>d(p=>p+te),children:["Show more (",u.length-l," remaining)"]})]})]})}function Bt({files:t,loading:s}){const[r,a]=n.useState(null),[i,o]=n.useState(null),[l,d]=n.useState(!1),[c,x]=n.useState(null),u=n.useCallback(async p=>{o(null),a(p),d(!0),x(null);try{const b=await j.getFileContent(p);o(b.content)}catch(b){const y=b instanceof Error?b.message:"Unknown error",N=b instanceof TypeError||y==="Request timeout",k=y.includes("404")||y.includes("not found")||y.includes("Not found");x(N?"Network error - server may be unreachable":k?"File not found - it may have been deleted or renamed":y),o(null)}finally{d(!1)}},[]),v=n.useCallback(p=>{u(p)},[u]);return e.jsxs("div",{className:"card p-6 flex flex-col",style:{minHeight:"300px"},children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"File Browser"}),e.jsx("span",{className:"font-mono text-xs text-muted",children:".loki/"})]}),s&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading files..."}),!s&&(!t||t.length===0)&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No project files found"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Start a session to generate .loki/ state"})]}),t&&t.length>0&&e.jsxs("div",{className:"flex gap-4 flex-1 min-h-0",children:[e.jsx("div",{className:"w-1/2 overflow-y-auto terminal-scroll pr-2",children:t.map(p=>e.jsx(ge,{node:p,depth:0,onSelectFile:v,selectedPath:r},p.path))}),e.jsxs("div",{className:"w-1/2 bg-charcoal/5 rounded-card p-3 overflow-hidden flex flex-col",children:[!r&&e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted text-xs",children:"Select a file to preview"}),r&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-xs font-mono text-primary mb-2 truncate",children:r}),e.jsx("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:l?e.jsx("div",{className:"text-muted text-xs",children:"Loading..."}):c?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-6",children:[e.jsx("p",{className:"text-danger text-xs font-medium",children:"Failed to load file"}),e.jsx("p",{className:"text-muted-accessible text-xs text-center max-w-[200px] break-words",children:c}),e.jsx("button",{type:"button",onClick:()=>r&&u(r),className:"mt-1 px-3 py-1 text-xs font-semibold rounded-btn border border-primary/20 text-primary hover:bg-primary/5 transition-colors",children:"Retry"})]}):e.jsx("pre",{className:"text-xs font-mono text-ink whitespace-pre-wrap break-words leading-relaxed",children:i})})]})]})]})]})}const me=5e5;function xe(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}function It(t){if(!t)return"Never";try{const s=new Date(t),a=new Date().getTime()-s.getTime(),i=Math.floor(a/(1e3*60*60));return i<1?"Just now":i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}catch{return t}}function _t({memory:t,loading:s}){const r=t?[{label:"Episodic",count:t.episodic_count,color:"text-primary",bg:"bg-primary/10",border:"border-primary/20"},{label:"Semantic",count:t.semantic_count,color:"text-success",bg:"bg-success/10",border:"border-success/20"},{label:"Skills",count:t.skill_count,color:"text-warning",bg:"bg-warning/10",border:"border-warning/20"}]:[],a=t?Math.min(t.total_tokens/me*100,100):0;return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Memory System"}),t&&e.jsx("span",{className:"font-mono text-xs text-muted",children:It(t.last_consolidation)})]}),s&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading memory..."}),!s&&!t&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No memory data available"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Memory populates during autonomous runs"})]}),t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:r.map(i=>e.jsxs("div",{className:`${i.bg} border ${i.border} rounded-card p-3 text-center`,children:[e.jsx("div",{className:`text-2xl font-bold font-mono ${i.color}`,children:i.count}),e.jsx("div",{className:"text-xs text-muted-accessible font-medium mt-1 uppercase tracking-wider",children:i.label})]},i.label))}),e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-xs text-muted font-medium",children:"Token Usage"}),e.jsxs("span",{className:"text-xs font-mono text-ink",children:[xe(t.total_tokens)," / ",xe(me)]})]}),e.jsx("div",{className:"w-full h-2 bg-charcoal/10 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${a>80?"bg-danger":a>50?"bg-warning":"bg-info"}`,style:{width:`${a}%`}})})]}),e.jsxs("div",{className:"mt-3 flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted",children:"Last Consolidation"}),e.jsx("span",{className:"font-mono text-ink",children:t.last_consolidation?new Date(t.last_consolidation).toLocaleString():"Never"})]})]})]})}function $t({visible:t}){const[s,r]=n.useState("markdown"),[a,i]=n.useState(null),[o,l]=n.useState(null),[d,c]=n.useState(!1),[x,u]=n.useState(!1),[v,p]=n.useState(null),[b,y]=n.useState(!1);if(!t)return null;const N=async()=>{c(!0),p(null),i(null),l(null);try{const h=await j.generateReport(s);i(h)}catch(h){p(h instanceof Error?h.message:"Failed to generate report")}finally{c(!1)}},k=async()=>{u(!0),p(null);try{const h=await j.shareSession();l(h)}catch(h){p(h instanceof Error?h.message:"Failed to share session")}finally{u(!1)}},w=async h=>{try{await navigator.clipboard.writeText(h),y(!0),setTimeout(()=>y(!1),2e3)}catch{}},B=()=>{if(!a)return;const h=new Blob([a.content],{type:s==="html"?"text/html":"text/markdown"}),L=URL.createObjectURL(h),E=document.createElement("a");E.href=L,E.download=`loki-report.${s==="html"?"html":"md"}`,E.click(),URL.revokeObjectURL(L)};return e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Session Report"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-1 card rounded-card p-1",children:["markdown","html"].map(h=>e.jsx("button",{onClick:()=>r(h),className:`px-3 py-1 text-xs font-semibold rounded-btn transition-all ${s===h?"bg-primary text-white shadow-sm":"text-muted hover:text-ink hover:bg-hover"}`,children:h.toUpperCase()},h))}),e.jsx("button",{onClick:N,disabled:d,className:"px-4 py-1.5 rounded-card text-xs font-semibold bg-primary text-white hover:bg-primary/90 disabled:opacity-50 transition-all",children:d?"Generating...":"Generate Report"})]})]}),v&&e.jsx("div",{className:"mb-3 px-3 py-2 rounded-btn bg-danger/10 border border-danger/20 text-danger text-xs",children:v}),a&&e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("span",{className:"text-xs text-muted",children:["Report generated (",a.format,")"]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>w(a.content),className:"px-3 py-1 text-xs font-medium text-muted hover:text-ink border border-border-light rounded-btn hover:bg-hover transition-all",children:b?"Copied":"Copy"}),e.jsx("button",{onClick:B,className:"px-3 py-1 text-xs font-medium text-muted hover:text-ink border border-border-light rounded-btn hover:bg-hover transition-all",children:"Download"}),e.jsx("button",{onClick:k,disabled:x,className:"px-3 py-1 text-xs font-medium bg-primary/10 text-primary border border-primary/20 rounded-btn hover:bg-primary/20 disabled:opacity-50 transition-all",children:x?"Sharing...":"Share as Gist"})]}),o&&e.jsxs("div",{className:"mb-2 flex items-center gap-2 px-3 py-2 rounded-btn bg-success/10 border border-success/20",children:[e.jsx("span",{className:"text-xs text-success font-medium",children:"Shared:"}),o.url?e.jsx("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary underline flex-1 truncate",children:o.url}):e.jsx("span",{className:"text-xs text-muted flex-1",children:"No URL returned"}),o.url&&e.jsx("button",{onClick:()=>w(o.url),className:"text-xs text-muted hover:text-ink",children:"Copy URL"})]}),e.jsx("pre",{className:"text-[11px] font-mono text-ink bg-black/5 rounded-card p-3 overflow-auto max-h-64 whitespace-pre-wrap terminal-scroll",children:a.content||"(empty report)"})]})]})}function ue({visible:t}){const s=n.useCallback(()=>j.getMetrics(),[]),{data:r,loading:a}=R(s,15e3,t);return t?e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Session Metrics"}),a&&e.jsx("div",{className:"w-4 h-4 border-2 border-primary border-t-transparent rounded-full animate-spin"})]}),r?e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Iterations"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:r.iterations??0})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Gate Pass Rate"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:typeof r.quality_gate_pass_rate=="number"?`${r.quality_gate_pass_rate.toFixed(0)}%`:"N/A"})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Tokens Used"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:(r.tokens_used??0).toLocaleString()})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Time Elapsed"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:r.time_elapsed||"N/A"})]})]}):e.jsx("div",{className:"text-sm text-muted py-4 text-center",children:a?"Loading metrics...":"No metrics available"})]}):null}function zt(t){switch(t){case"completed":case"complete":case"done":return"completed";case"in_progress":return"running";case"started":return"started";case"error":case"failed":return"failed";default:return"empty"}}const Ht={completed:"Completed",complete:"Completed",done:"Completed",in_progress:"In Progress",started:"Started",error:"Failed",failed:"Failed",empty:"Empty"};function Ot({onLoadSession:t}){const s=n.useCallback(()=>j.getSessionsHistory(),[]),{data:r,loading:a}=R(s,6e4,!0);return a&&!r?e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider mb-3",children:"Past Builds"}),e.jsx("div",{className:"text-sm text-muted",children:"Loading..."})]}):!r||r.length===0?null:e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider mb-3",children:"Past Builds"}),e.jsx("div",{className:"flex flex-col gap-2 max-h-64 overflow-y-auto terminal-scroll",children:r.map(i=>{const o=i.file_count;return e.jsxs("button",{onClick:()=>t==null?void 0:t(i),className:"text-left px-4 py-3 rounded-card card hover:bg-hover transition-all group cursor-pointer",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs font-mono text-muted-accessible",children:i.date}),e.jsxs("div",{className:"flex items-center gap-2",children:[o!==void 0&&o>0&&e.jsxs("span",{className:"text-xs font-mono text-muted-accessible",children:[o," files"]}),e.jsx(at,{status:zt(i.status),children:Ht[i.status]||i.status})]})]}),e.jsx("div",{className:"text-xs text-ink truncate group-hover:text-primary transition-colors",children:i.prd_snippet||i.id}),e.jsx("div",{className:"text-xs font-mono text-muted-accessible mt-0.5 truncate",children:i.path})]},i.id)})})]})}function qt({end:t,suffix:s="",duration:r=1500}){const[a,i]=n.useState(0),o=n.useRef(null),l=n.useRef(!1);return n.useEffect(()=>{const d=new IntersectionObserver(([c])=>{if(c.isIntersecting&&!l.current){l.current=!0;const x=performance.now(),u=v=>{const p=v-x,b=Math.min(p/r,1),y=1-Math.pow(1-b,3);i(Math.floor(y*t)),b<1&&requestAnimationFrame(u)};requestAnimationFrame(u)}},{threshold:.3});return o.current&&d.observe(o.current),()=>d.disconnect()},[t,r]),e.jsxs("span",{ref:o,className:"tabular-nums",children:[a,s]})}const Gt=[{icon:nt,value:21,suffix:"+",label:"Templates"},{icon:it,value:5,suffix:"",label:"AI Providers"},{icon:be,value:100,suffix:"%",label:"Source-Available"}];function Wt(){return e.jsxs("section",{className:"w-full max-w-3xl mx-auto mt-16 mb-4",children:[e.jsx("p",{className:"text-center text-sm text-[#6B6960] mb-8 tracking-wide uppercase font-medium",children:"Trusted by developers building the future"}),e.jsx("div",{className:"flex items-center justify-center gap-12 sm:gap-16",children:Gt.map(t=>{const s=t.icon;return e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(s,{size:20,className:"text-[#553DE9]",strokeWidth:1.5}),e.jsx("span",{className:"text-2xl font-bold text-[#36342E]",children:e.jsx(qt,{end:t.value,suffix:t.suffix})}),e.jsx("span",{className:"text-xs text-[#6B6960] font-medium",children:t.label})]},t.label)})}),e.jsx("div",{className:"mt-12 border-t border-[#ECEAE3]"})]})}function se({icon:t,number:s,title:r,description:a,mockup:i,delay:o}){const l=n.useRef(null),[d,c]=n.useState(!1);return n.useEffect(()=>{const x=new IntersectionObserver(([u])=>{u.isIntersecting&&(setTimeout(()=>c(!0),o),x.disconnect())},{threshold:.2});return l.current&&x.observe(l.current),()=>x.disconnect()},[o]),e.jsxs("div",{ref:l,className:`flex flex-col items-center text-center max-w-xs transition-all duration-700 ${d?"opacity-100 translate-y-0":"opacity-0 translate-y-6"}`,children:[e.jsxs("div",{className:"relative mb-4",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#553DE9]/10 flex items-center justify-center",children:e.jsx(t,{size:24,className:"text-[#553DE9]",strokeWidth:1.5})}),e.jsx("span",{className:"absolute -top-2 -right-2 w-6 h-6 rounded-full bg-[#553DE9] text-white text-xs font-bold flex items-center justify-center",children:s})]}),e.jsx("h3",{className:"text-lg font-bold text-[#36342E] mb-1.5",children:r}),e.jsx("p",{className:"text-sm text-[#6B6960] mb-4 leading-relaxed",children:a}),e.jsx("div",{className:"w-full rounded-xl border border-[#ECEAE3] bg-white p-3 shadow-sm",children:i})]})}function Ut(){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 px-3 py-2 rounded-lg bg-[#FAF9F6] border border-[#ECEAE3] text-left",children:e.jsx("span",{className:"text-xs text-[#36342E]",children:"Build a SaaS dashboard with analytics"})}),e.jsx("div",{className:"w-7 h-7 rounded-lg bg-[#553DE9] flex items-center justify-center flex-shrink-0",children:e.jsx(re,{size:12,className:"text-white"})})]})}function Vt(){return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-[#6B6960]",children:[e.jsx("span",{children:"Phase: Implementation"}),e.jsx("span",{children:"68%"})]}),e.jsx("div",{className:"w-full h-2 rounded-full bg-[#ECEAE3] overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-[#553DE9] to-[#1FC5A8]",style:{width:"68%"}})}),e.jsx("div",{className:"flex gap-1",children:["Planning","Scaffolding","Implementation","Testing","Deploy"].map((t,s)=>e.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded ${s<=2?"bg-[#553DE9]/10 text-[#553DE9] font-medium":"bg-[#ECEAE3]/60 text-[#6B6960]"}`,children:t},t))})]})}function Qt(){return e.jsxs("div",{className:"space-y-2 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-5 h-5 rounded-full bg-[#1FC5A8]/20 flex items-center justify-center",children:e.jsx("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",children:e.jsx("path",{d:"M1 4L3.5 6.5L9 1",stroke:"#1FC5A8",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.jsx("span",{className:"text-xs font-semibold text-[#1FC5A8]",children:"Deployed successfully"})]}),e.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-[#FAF9F6] border border-[#ECEAE3]",children:e.jsx("span",{className:"text-[10px] font-mono text-[#553DE9]",children:"https://my-app.vercel.app"})})]})}function Yt(){return e.jsxs("section",{className:"w-full max-w-5xl mx-auto py-16",children:[e.jsx("h2",{className:"font-heading text-h2 text-[#36342E] text-center mb-3",children:"How It Works"}),e.jsx("p",{className:"text-sm text-[#6B6960] text-center mb-12 max-w-lg mx-auto",children:"Three steps from idea to production. No manual coding required."}),e.jsxs("div",{className:"relative flex flex-col md:flex-row items-start justify-center gap-10 md:gap-8",children:[e.jsx("div",{className:"hidden md:block absolute top-7 left-1/2 -translate-x-1/2 w-[60%] h-px border-t-2 border-dashed border-[#ECEAE3] z-0"}),e.jsx(se,{icon:fe,number:1,title:"Describe Your Idea",description:"Type a one-line description. Loki handles the rest.",mockup:e.jsx(Ut,{}),delay:0}),e.jsx(se,{icon:lt,number:2,title:"Watch It Build",description:"AI writes code, runs tests, and ensures quality.",mockup:e.jsx(Vt,{}),delay:150}),e.jsx(se,{icon:re,number:3,title:"Ship It",description:"Deploy to Vercel, Netlify, or GitHub in one click.",mockup:e.jsx(Qt,{}),delay:300})]})]})}const Kt=[{name:"SaaS Dashboard",description:"Full-stack analytics dashboard with auth, billing, and user management.",tech:["React","Node.js","PostgreSQL"],gradient:"from-violet-500/20 via-purple-500/10 to-indigo-500/20"},{name:"REST API",description:"Production-ready API with authentication, rate limiting, and docs.",tech:["Python","FastAPI","Redis"],gradient:"from-emerald-500/20 via-teal-500/10 to-cyan-500/20"},{name:"E-Commerce Store",description:"Online store with Stripe payments, cart, and inventory management.",tech:["React","Node.js","MongoDB"],gradient:"from-amber-500/20 via-orange-500/10 to-yellow-500/20"},{name:"Discord Bot",description:"Feature-rich bot with slash commands, moderation, and webhooks.",tech:["TypeScript","Discord","SQLite"],gradient:"from-blue-500/20 via-sky-500/10 to-cyan-500/20"},{name:"CLI Tool",description:"Interactive command-line application with argument parsing and config.",tech:["TypeScript","CLI","Node.js"],gradient:"from-rose-500/20 via-pink-500/10 to-fuchsia-500/20"},{name:"Landing Page",description:"Responsive marketing site with pricing, testimonials, and CTAs.",tech:["React","Tailwind","Vite"],gradient:"from-slate-500/20 via-gray-500/10 to-zinc-500/20"}],Zt={React:"bg-sky-500/10 text-sky-600","Node.js":"bg-green-500/10 text-green-600",Python:"bg-yellow-500/10 text-yellow-700",TypeScript:"bg-blue-500/10 text-blue-600",PostgreSQL:"bg-indigo-500/10 text-indigo-600",MongoDB:"bg-green-600/10 text-green-700",Redis:"bg-red-500/10 text-red-600",FastAPI:"bg-teal-500/10 text-teal-600",SQLite:"bg-blue-400/10 text-blue-500",Tailwind:"bg-cyan-400/10 text-cyan-600",Discord:"bg-indigo-400/10 text-indigo-500",CLI:"bg-amber-500/10 text-amber-600",Vite:"bg-purple-400/10 text-purple-500"};function Jt(){const t=ae(),s=n.useRef(null),[r,a]=n.useState(!1),[i,o]=n.useState(!0),l=()=>{const c=s.current;c&&(a(c.scrollLeft>8),o(c.scrollLeft<c.scrollWidth-c.clientWidth-8))};n.useEffect(()=>{const c=s.current;if(c)return l(),c.addEventListener("scroll",l,{passive:!0}),window.addEventListener("resize",l),()=>{c.removeEventListener("scroll",l),window.removeEventListener("resize",l)}},[]);const d=c=>{const x=s.current;if(!x)return;const u=320;x.scrollBy({left:c==="left"?-u:u,behavior:"smooth"})};return e.jsxs("section",{className:"w-full max-w-5xl mx-auto py-16",children:[e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-heading text-h2 text-[#36342E]",children:"Start from a Template"}),e.jsx("p",{className:"text-sm text-[#6B6960] mt-1",children:"Production-ready starting points for common use cases."})]}),e.jsxs("div",{className:"hidden md:flex items-center gap-2",children:[e.jsx("button",{onClick:()=>d("left"),disabled:!r,className:`w-8 h-8 rounded-lg border flex items-center justify-center transition-all ${r?"border-[#ECEAE3] text-[#36342E] hover:bg-[#F8F4F0]":"border-[#ECEAE3]/50 text-[#6B6960]/30 cursor-not-allowed"}`,"aria-label":"Scroll left",children:e.jsx(ot,{size:16})}),e.jsx("button",{onClick:()=>d("right"),disabled:!i,className:`w-8 h-8 rounded-lg border flex items-center justify-center transition-all ${i?"border-[#ECEAE3] text-[#36342E] hover:bg-[#F8F4F0]":"border-[#ECEAE3]/50 text-[#6B6960]/30 cursor-not-allowed"}`,"aria-label":"Scroll right",children:e.jsx(Ve,{size:16})})]})]}),e.jsxs("div",{ref:s,className:"flex gap-4 overflow-x-auto pb-4 snap-x snap-mandatory scrollbar-hide",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:[Kt.map(c=>e.jsxs("div",{className:"flex-shrink-0 w-64 rounded-xl border border-[#ECEAE3] bg-white overflow-hidden snap-start hover:shadow-lg hover:border-[#553DE9]/30 transition-all cursor-pointer group",onClick:()=>t("/templates"),children:[e.jsx("div",{className:`h-20 bg-gradient-to-br ${c.gradient} flex items-end p-3`,children:e.jsx("h3",{className:"text-sm font-bold text-[#36342E] group-hover:text-[#553DE9] transition-colors",children:c.name})}),e.jsxs("div",{className:"p-3",children:[e.jsx("p",{className:"text-xs text-[#6B6960] mb-3 leading-relaxed line-clamp-2",children:c.description}),e.jsx("div",{className:"flex flex-wrap gap-1",children:c.tech.map(x=>e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${Zt[x]||"bg-gray-100 text-gray-600"}`,children:x},x))})]})]},c.name)),e.jsxs("div",{className:"flex-shrink-0 w-48 rounded-xl border border-dashed border-[#ECEAE3] bg-[#FAF9F6] flex flex-col items-center justify-center gap-2 snap-start cursor-pointer hover:border-[#553DE9]/40 hover:bg-[#553DE9]/5 transition-all group",onClick:()=>t("/templates"),children:[e.jsx(Qe,{size:20,className:"text-[#6B6960] group-hover:text-[#553DE9] transition-colors"}),e.jsx("span",{className:"text-sm font-semibold text-[#6B6960] group-hover:text-[#553DE9] transition-colors",children:"View All Templates"})]})]})]})}function Xt({icon:t,title:s,description:r}){return e.jsxs("div",{className:"rounded-xl border border-[#ECEAE3] bg-white p-5 hover:border-[#553DE9]/40 hover:shadow-lg transition-all group",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#553DE9]/10 flex items-center justify-center mb-3 group-hover:bg-[#553DE9]/15 transition-colors",children:e.jsx(t,{size:20,className:"text-[#553DE9]",strokeWidth:1.5})}),e.jsx("h3",{className:"text-sm font-bold text-[#36342E] mb-1.5",children:s}),e.jsx("p",{className:"text-xs text-[#6B6960] leading-relaxed",children:r})]})}const es=[{icon:ct,title:"Multi-AI",description:"Use Claude, GPT, Gemini. Pick the best for each task."},{icon:Ye,title:"Quality First",description:"10 quality gates. 3 blind reviewers. Zero sycophancy."},{icon:ht,title:"Self-Hosted",description:"Your code stays on your machine. Full privacy."},{icon:be,title:"Source-Available",description:"BUSL-1.1 source-available. Read it, fork it, self-host it."}];function ts(){return e.jsxs("section",{className:"w-full max-w-4xl mx-auto py-16",children:[e.jsx("h2",{className:"font-heading text-h2 text-[#36342E] text-center mb-3",children:"Why developers choose Loki Mode"}),e.jsx("p",{className:"text-sm text-[#6B6960] text-center mb-10 max-w-lg mx-auto",children:"Built by developers, for developers. Every decision optimized for shipping faster."}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:es.map(t=>e.jsx(Xt,{...t},t.title))})]})}const ss=[{title:"Product",links:[{label:"Features",to:"/"},{label:"Templates",to:"/templates"},{label:"Pricing",href:"https://www.autonomi.dev/#pricing"},{label:"Docs",href:"https://github.com/asklokesh/loki-mode/wiki"}]},{title:"Developers",links:[{label:"Quick Start",to:"/"},{label:"API Reference",href:"https://github.com/asklokesh/loki-mode/wiki/API-Reference"},{label:"CLI Docs",href:"https://github.com/asklokesh/loki-mode/wiki/CLI-Reference"},{label:"Changelog",href:"https://github.com/asklokesh/loki-mode/blob/main/CHANGELOG.md"}]},{title:"Company",links:[{label:"About Autonomi",href:"https://www.autonomi.dev/"},{label:"Blog",href:"https://www.autonomi.dev/blog"},{label:"Careers",href:"https://www.autonomi.dev/careers"},{label:"Contact",href:"mailto:hello@autonomi.dev"}]},{title:"Community",links:[{label:"GitHub",href:"https://github.com/asklokesh/loki-mode"},{label:"Discord",href:"https://discord.gg/autonomi"},{label:"Twitter",href:"https://twitter.com/autonomidev"},{label:"Forum",href:"https://github.com/asklokesh/loki-mode/discussions"}]}];function rs(){const t=ae(),s=(r,a)=>{r.to&&(a.preventDefault(),t(r.to))};return e.jsx("footer",{className:"w-full bg-[#F0EDE8] border-t border-[#ECEAE3] mt-8",children:e.jsxs("div",{className:"max-w-5xl mx-auto px-6 py-12",children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-8 mb-10",children:ss.map(r=>e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-[#36342E] uppercase tracking-wider mb-4",children:r.title}),e.jsx("ul",{className:"space-y-2.5",children:r.links.map(a=>e.jsx("li",{children:e.jsx("a",{href:a.href||a.to||"#",onClick:i=>s(a,i),className:"text-sm text-[#6B6960] hover:text-[#553DE9] transition-colors",...a.href?{target:"_blank",rel:"noopener noreferrer"}:{},children:a.label})},a.label))})]},r.title))}),e.jsxs("div",{className:"border-t border-[#ECEAE3] pt-6 flex flex-col sm:flex-row items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 text-xs text-[#6B6960]",children:[e.jsx("span",{children:"Built with care by Autonomi"}),e.jsx("span",{className:"hidden sm:inline text-[#ECEAE3]",children:"|"}),e.jsx("span",{className:"px-2 py-0.5 rounded bg-[#553DE9]/10 text-[#553DE9] font-semibold text-[10px]",children:"v6.73.0"})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-[#6B6960]",children:[e.jsx("a",{href:"https://www.autonomi.dev/privacy",target:"_blank",rel:"noopener noreferrer",className:"hover:text-[#553DE9] transition-colors",children:"Privacy"}),e.jsx("a",{href:"https://www.autonomi.dev/terms",target:"_blank",rel:"noopener noreferrer",className:"hover:text-[#553DE9] transition-colors",children:"Terms"})]})]})]})})}function as({label:t,value:s,suffix:r=""}){const[a,i]=n.useState(0),o=n.useRef(!1),l=n.useRef(null);return n.useEffect(()=>{if(o.current)return;const d=new IntersectionObserver(([c])=>{if(c.isIntersecting&&!o.current){let x=function(p){const b=p-v,y=Math.min(b/u,1),N=1-Math.pow(1-y,3);i(Math.round(s*N)),y<1&&requestAnimationFrame(x)};o.current=!0;const u=800,v=performance.now();requestAnimationFrame(x)}},{threshold:.3});return l.current&&d.observe(l.current),()=>d.disconnect()},[s]),e.jsxs("div",{ref:l,className:"text-center",children:[e.jsxs("div",{className:"text-2xl font-bold text-[#36342E] dark:text-[#E8E6E3] tabular-nums",children:[a.toLocaleString(),r]}),e.jsx("div",{className:"text-xs text-[#6B6960] dark:text-[#8A8880] mt-1",children:t})]})}const W="asklokesh/loki-mode",ns="loki-mode";function is(){const[t,s]=n.useState([{label:"GitHub Stars",value:0},{label:"Forks",value:0},{label:"Contributors",value:0},{label:"npm Downloads",value:0,suffix:"+"}]);return n.useEffect(()=>{(async()=>{try{const[a,i,o]=await Promise.allSettled([fetch(`https://api.github.com/repos/${W}`),fetch(`https://api.github.com/repos/${W}/contributors?per_page=1&anon=true`,{method:"HEAD"}),fetch(`https://api.npmjs.org/downloads/point/last-month/${ns}`)]);let l=0,d=0,c=0,x=0;if(a.status==="fulfilled"&&a.value.ok){const u=await a.value.json();l=u.stargazers_count||0,d=u.forks_count||0}if(i.status==="fulfilled"){const v=(i.value.headers.get("Link")||"").match(/page=(\d+)>; rel="last"/);if(v)c=parseInt(v[1],10);else{const p=await fetch(`https://api.github.com/repos/${W}/contributors?per_page=100&anon=true`);if(p.ok){const b=await p.json();c=Array.isArray(b)?b.length:0}}}o.status==="fulfilled"&&o.value.ok&&(x=(await o.value.json()).downloads||0),s([{label:"GitHub Stars",value:l},{label:"Forks",value:d},{label:"Contributors",value:c},{label:"npm Downloads",value:x,suffix:"+"}])}catch{}})()},[]),e.jsxs("div",{className:"py-8 border-t border-[#ECEAE3] dark:border-[#2A2A30]",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-6",children:[e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#36342E] dark:text-[#E8E6E3]",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",fill:"currentColor"})}),e.jsx("span",{className:"text-sm font-semibold text-[#36342E] dark:text-[#E8E6E3]",children:"Source-Available"})]}),e.jsx("div",{className:"grid grid-cols-4 gap-6 max-w-lg mx-auto",children:t.map(r=>e.jsx(as,{...r},r.label))}),e.jsx("div",{className:"mt-4 text-center",children:e.jsxs("a",{href:`https://github.com/${W}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-[#553DE9] hover:text-[#4832c7] font-medium transition-colors",children:["Star us on GitHub",e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M7 17L17 7M17 7H7M17 7V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})}function ls(){const[t,s]=n.useState(""),[r,a]=n.useState(!1),[i,o]=n.useState(""),l=d=>{d.preventDefault(),o("");const c=t.trim();if(c){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c)){o("Please enter a valid email address.");return}try{const x=JSON.parse(localStorage.getItem("pl_newsletter_emails")||"[]");x.includes(c)||(x.push(c),localStorage.setItem("pl_newsletter_emails",JSON.stringify(x)))}catch{}a(!0),s("")}};return r?e.jsxs("div",{className:"flex items-center gap-2 py-3 px-4 rounded-xl bg-[#1FC5A8]/10 border border-[#1FC5A8]/20",children:[e.jsx(dt,{size:16,className:"text-[#1FC5A8] flex-shrink-0"}),e.jsx("span",{className:"text-sm text-[#36342E] font-medium",children:"Thanks for subscribing! We will keep you posted."})]}):e.jsxs("div",{className:"py-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(mt,{size:14,className:"text-[#6B6960]"}),e.jsx("span",{className:"text-sm text-[#6B6960]",children:"Get updates on new features and tips"})]}),e.jsxs("form",{onSubmit:l,className:"flex gap-2",children:[e.jsx("input",{type:"email",value:t,onChange:d=>s(d.target.value),placeholder:"you@example.com",className:"flex-1 px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] bg-white focus:outline-none focus:ring-2 focus:ring-[#553DE9]/30 focus:border-[#553DE9]/40"}),e.jsx("button",{type:"submit",className:"px-4 py-2 text-sm font-semibold rounded-lg bg-[#553DE9] text-white hover:bg-[#4832c7] transition-colors",children:"Subscribe"})]}),i&&e.jsx("p",{className:"mt-1.5 text-xs text-[#C45B5B]",children:i})]})}const os={"build-complete":{icon:e.jsx(bt,{size:24,className:"text-teal"}),title:"Build complete!",description:"Your code is ready. Time to ship it."},"deploy-success":{icon:e.jsx(re,{size:24,className:"text-primary"}),title:"Your app is live!",description:"Successfully deployed. The world can see your work now."},"first-project":{icon:e.jsx(Ke,{size:24,className:"text-warning"}),title:"First build complete!",description:"Welcome to Purple Lab. This is just the beginning."}},pe=["#553DE9","#1FC5A8","#D63384","#2F71E3","#D4A03C","#E8E4FD"],cs=40;function ds({index:t}){const s=pe[t%pe.length],r=Math.random()*100,a=Math.random()*1.5,i=2+Math.random()*1.5,o=4+Math.random()*6,l=t%3===0,d=Math.random()*360;return e.jsx("div",{className:"confetti-piece",style:{position:"absolute",left:`${r}%`,top:"-10px",width:`${o}px`,height:`${o}px`,backgroundColor:s,borderRadius:l?"50%":"1px",opacity:0,transform:`rotate(${d}deg)`,animation:`confetti-fall ${i}s ease-in ${a}s forwards`}})}function ms({type:t,onDismiss:s}){const[r,a]=n.useState(!0),i=os[t];return n.useEffect(()=>{const o=setTimeout(()=>{a(!1),s==null||s()},3500);return()=>clearTimeout(o)},[s]),r?e.jsxs("div",{className:"fixed inset-0 z-50 pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 overflow-hidden",children:Array.from({length:cs},(o,l)=>e.jsx(ds,{index:l},l))}),e.jsx("div",{className:"absolute top-8 left-1/2 -translate-x-1/2 pointer-events-auto celebration-banner-enter",children:e.jsxs("div",{className:"bg-card border border-border rounded-card shadow-lg px-6 py-4 flex items-center gap-3",children:[i.icon,e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-ink",children:i.title}),e.jsx("p",{className:"text-xs text-muted",children:i.description})]})]})})]}):null}const xs={"no-projects":{icon:e.jsx(tt,{size:32,className:"text-primary/60"}),title:"Your workspace is a blank canvas",description:"What will you create today? Describe your idea and watch it come to life.",defaultActionLabel:"Start a new project"},"no-files":{icon:e.jsx(ut,{size:32,className:"text-teal/60"}),title:"This project is brand new",description:"Let's add some code! Start building and files will appear here as they're created.",defaultActionLabel:"Open editor"},"no-chat":{icon:e.jsx(fe,{size:32,className:"text-primary/60"}),title:"Start a conversation with Loki",description:"Try something like 'Add a contact form to my app' or 'Create a dark mode toggle.'",defaultActionLabel:"Say hello"},"no-team":{icon:e.jsx(Ze,{size:32,className:"text-pink/60"}),title:"Building alone is great, but building together is better",description:"Invite teammates to collaborate on this project in real time.",defaultActionLabel:"Invite a teammate"},"no-notifications":{icon:e.jsx(xt,{size:32,className:"text-teal/60"}),title:"All clear!",description:"No notifications right now. When something needs your attention, it will show up here.",defaultActionLabel:"Dismiss"}};function us({type:t}){const r={"no-projects":{primary:"#553DE9",secondary:"#1FC5A8"},"no-files":{primary:"#1FC5A8",secondary:"#553DE9"},"no-chat":{primary:"#553DE9",secondary:"#D63384"},"no-team":{primary:"#D63384",secondary:"#553DE9"},"no-notifications":{primary:"#1FC5A8",secondary:"#2F71E3"}}[t];return e.jsxs("svg",{width:"120",height:"80",viewBox:"0 0 120 80",fill:"none",className:"mb-4 opacity-60",children:[e.jsx("circle",{cx:"60",cy:"40",r:"28",stroke:r.primary,strokeWidth:"1.5",strokeDasharray:"4 3"}),e.jsx("circle",{cx:"30",cy:"25",r:"8",fill:r.primary,opacity:"0.1"}),e.jsx("circle",{cx:"90",cy:"55",r:"12",fill:r.secondary,opacity:"0.1"}),e.jsx("circle",{cx:"60",cy:"40",r:"4",fill:r.primary,opacity:"0.3"}),e.jsx("line",{x1:"20",y1:"60",x2:"45",y2:"45",stroke:r.secondary,strokeWidth:"1",opacity:"0.2"}),e.jsx("line",{x1:"75",y1:"35",x2:"100",y2:"20",stroke:r.primary,strokeWidth:"1",opacity:"0.2"}),e.jsx("rect",{x:"50",y:"15",width:"20",height:"3",rx:"1.5",fill:r.secondary,opacity:"0.15"}),e.jsx("rect",{x:"42",y:"62",width:"36",height:"3",rx:"1.5",fill:r.primary,opacity:"0.15"})]})}function ps({type:t,action:s,actionLabel:r}){const a=xs[t];return e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-6 text-center warm-empty-state-enter",children:[e.jsx(us,{type:t}),e.jsx("div",{className:"mb-3",children:a.icon}),e.jsx("h3",{className:"text-sm font-semibold text-ink mb-1.5",children:a.title}),e.jsx("p",{className:"text-xs text-muted max-w-[260px] leading-relaxed",children:a.description}),s&&e.jsx("button",{onClick:s,className:"mt-4 px-4 py-2 text-xs font-semibold rounded-btn bg-primary/10 text-primary hover:bg-primary/20 transition-colors",children:r||a.defaultActionLabel})]})}const U=["Build a SaaS dashboard with user analytics...","Create a REST API with authentication...","Make a landing page with pricing tiers...","Build a chat app with real-time messaging...","Create an e-commerce store with Stripe..."];function hs(){const t=new Date().getHours();return t>=5&&t<12?"Good morning! What shall we build today?":t>=12&&t<17?"Good afternoon! Ready to create something amazing?":t>=17&&t<22?"Good evening! Let's build something cool.":"Burning the midnight oil? Let's build something cool."}function Rs(){const t=ae(),[s,r]=n.useState(null),[a,i]=n.useState(()=>sessionStorage.getItem("pl_running")==="1"),[o,l]=n.useState(!1),[d,c]=n.useState(()=>sessionStorage.getItem("pl_prd")),[x,u]=n.useState(!1),[v,p]=n.useState(!1),[b,y]=n.useState(!1),[N,k]=n.useState(()=>sessionStorage.getItem("pl_tab")||"terminal"),[w,B]=n.useState(()=>sessionStorage.getItem("pl_provider")||"claude"),[h,L]=n.useState(void 0),[E,z]=n.useState(!1),I=n.useMemo(()=>hs(),[]),[A,O]=n.useState(""),[S,D]=n.useState(!1),[_,q]=n.useState(!1),[$,V]=n.useState(0),[Q,G]=n.useState(!1),g=n.useRef(null),P=n.useRef(null);n.useEffect(()=>{const m=setInterval(()=>{G(!0),setTimeout(()=>{V(f=>(f+1)%U.length),G(!1)},300)},3e3);return()=>clearInterval(m)},[]),n.useEffect(()=>{const m=sessionStorage.getItem("pl_template");m&&(sessionStorage.removeItem("pl_template"),j.getTemplateContent(m).then(({content:f})=>{f&&(L(f),q(!0))}).catch(()=>{}))},[]);const[T,Y]=n.useState(null),[ne,K]=n.useState(null),[ie,Z]=n.useState(null),je=n.useCallback(m=>{if(!m){Y(null),K(null),Z(null);return}Y(m.status),K(m.agents),Z(m.logs),i(m.status.running??!1),l(m.status.paused??!1)},[]),{connected:J,subscribe:ve}=Je(je),ye=n.useCallback(()=>j.getStatus(),[]),{data:M}=R(ye,3e4,!J);n.useEffect(()=>{T===null&&M!==null&&(i(M.running??!1),l(M.paused??!1))},[M,T]),n.useEffect(()=>{sessionStorage.setItem("pl_running",a?"1":"0"),a&&u(!0)},[a]),n.useEffect(()=>{d?sessionStorage.setItem("pl_prd",d):sessionStorage.removeItem("pl_prd")},[d]),n.useEffect(()=>{sessionStorage.setItem("pl_provider",w)},[w]),n.useEffect(()=>{sessionStorage.setItem("pl_tab",N)},[N]);const X=n.useRef(void 0);n.useEffect(()=>{var f;const m=(f=T??M)==null?void 0:f.phase;m==="complete"&&X.current&&X.current!=="complete"&&z(!0),X.current=m},[T,M]);const Ne=n.useCallback(()=>j.getMemorySummary(),[]),we=n.useCallback(()=>j.getChecklist(),[]),ke=n.useCallback(()=>j.getFiles(),[]),Ee=n.useCallback(()=>j.getSessionsHistory(),[]),{data:Se,loading:Ce}=R(Ne,3e4,a),{data:Ae,loading:De}=R(we,3e4,a),{data:Pe,loading:Fe}=R(ke,3e4,a),{data:le}=R(Ee,6e4,!0),F=T??M,Le=ne,Te=ie,Me=ne===null,Re=ie===null,oe=n.useCallback(async()=>{const m=A.trim();if(!(!m||S)){r(null),D(!0),u(!1),p(!1),k("terminal");try{const f=await j.quickStart(m,w);f.started&&f.session_id&&(c(m),i(!0),t(`/project/${f.session_id}`))}catch(f){r(f instanceof Error?f.message:"Failed to start build")}finally{D(!1)}}},[A,S,w,t]),Be=n.useCallback(async(m,f,qe,Ge)=>{r(null),u(!1),p(!1),k("terminal");try{await j.startSession({prd:m,provider:f,projectDir:qe,mode:Ge}),c(m),i(!0)}catch(ce){r(ce instanceof Error?ce.message:"Failed to start session")}},[]),Ie=n.useCallback(async()=>{try{(await j.stopSession()).stopped&&(i(!1),l(!1),c(null),Y(null),K(null),Z(null))}catch{i(!1),l(!1),c(null)}sessionStorage.removeItem("pl_running"),sessionStorage.removeItem("pl_prd"),sessionStorage.removeItem("pl_tab")},[]),_e=n.useCallback(m=>{t(`/project/${m.id}`)},[t]),$e=n.useCallback(m=>{B(m)},[]),ze=n.useCallback(async()=>{try{await j.pauseSession(),l(!0)}catch{}},[]),He=n.useCallback(async()=>{try{await j.resumeSession(),l(!1)}catch{}},[]),Oe=d&&d.replace(/^#+\s*/gm,"").split(`
|
|
28
|
-
`).find(m=>m.trim().length>0)||null;return e.jsxs("div",{className:"min-h-screen bg-[#FAF9F6] relative",children:[e.jsx("div",{className:"pattern-nodes"}),e.jsx("div",{className:"max-w-[1920px] mx-auto px-6 py-6 relative z-10",children:a?e.jsxs(e.Fragment,{children:[e.jsx(C,{name:"ControlBar",children:e.jsx(vt,{status:F,prdSummary:Oe,onStop:Ie,onPause:ze,onResume:He,isPaused:o})}),e.jsx("div",{className:"mt-4",children:e.jsx(C,{name:"StatusOverview",children:e.jsx(yt,{status:F})})}),e.jsxs("div",{className:"mt-4 grid grid-cols-12 gap-6",style:{height:"calc(100vh - 340px)",minHeight:"400px"},children:[e.jsx("div",{className:"col-span-3 flex flex-col gap-6",children:e.jsx(C,{name:"PhaseVisualizer",children:e.jsx(Et,{currentPhase:(F==null?void 0:F.phase)||"idle",iteration:(F==null?void 0:F.iteration)||0})})}),e.jsxs("div",{className:"col-span-5 flex flex-col gap-0 min-h-0",children:[e.jsxs("div",{className:"flex items-center gap-1 mb-2 flex-shrink-0",children:[e.jsx("button",{onClick:()=>k("terminal"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all ${N==="terminal"?"bg-[#553DE9] text-white":"text-[#6B6960] hover:text-[#36342E] hover:bg-[#F8F4F0]"}`,children:"Terminal"}),e.jsx("button",{onClick:()=>k("metrics"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all ${N==="metrics"?"bg-[#553DE9] text-white":"text-[#6B6960] hover:text-[#36342E] hover:bg-[#F8F4F0]"}`,children:"Metrics"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(C,{name:"Terminal",children:N==="terminal"?e.jsx(st,{logs:Te,loading:Re,subscribe:ve}):e.jsx(ue,{visible:!0})})})]}),e.jsxs("div",{className:"col-span-4 flex flex-col gap-6 overflow-y-auto",children:[e.jsx(C,{name:"AgentDashboard",children:e.jsx(Ct,{agents:Le,loading:Me})}),e.jsx(C,{name:"QualityGates",children:e.jsx(Lt,{checklist:Ae,loading:De})}),e.jsx(C,{name:"EvidenceReceipts",children:e.jsx(rt,{})})]})]}),e.jsxs("div",{className:"mt-6 grid grid-cols-12 gap-6",children:[e.jsx("div",{className:"col-span-6",children:e.jsx(C,{name:"FileBrowser",children:e.jsx(Bt,{files:Pe,loading:Fe})})}),e.jsx("div",{className:"col-span-6",children:e.jsx(C,{name:"MemoryViewer",children:e.jsx(_t,{memory:Se,loading:Ce})})})]})]}):e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("div",{ref:P,className:"text-center mt-12 mb-10",children:[e.jsx("p",{className:"text-sm font-medium text-[#553DE9] mb-2",children:I}),e.jsx("h2",{className:"font-heading text-h1 text-[#36342E]",children:"Describe it. Build it. Ship it."}),e.jsx("p",{className:"text-[#6B6960] mt-3 text-base max-w-xl mx-auto",children:"Type what you want to build. Purple Lab handles the rest -- from code to containers, autonomously."})]}),e.jsxs("div",{className:"w-full max-w-2xl",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{ref:g,type:"text",value:A,onChange:m=>O(m.target.value),onKeyDown:m=>{m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),oe())},className:"w-full text-xl px-6 py-4 rounded-2xl bg-white border border-[#ECEAE3] shadow-sm focus:outline-none focus:ring-2 focus:ring-[#553DE9]/30 focus:border-[#553DE9]/40 focus:shadow-lg transition-all placeholder:text-transparent",disabled:S,"aria-label":"Describe what you want to build"}),!A&&e.jsx("div",{className:"absolute left-6 top-1/2 -translate-y-1/2 text-xl text-[#6B6960]/50 pointer-events-none select-none","aria-hidden":"true",children:e.jsx("span",{className:Q?"quick-input-placeholder-exit":"quick-input-placeholder",children:U[$]},$)})]}),e.jsx("div",{className:"mt-4 flex items-center justify-center gap-4",children:e.jsx("button",{onClick:oe,disabled:!A.trim()||S,className:`px-8 py-3 rounded-xl text-base font-semibold transition-all ${!A.trim()||S?"bg-[#553DE9]/20 text-[#553DE9]/40 cursor-not-allowed":"bg-[#553DE9] text-white hover:bg-[#4832c7] shadow-lg shadow-[#553DE9]/25 hover:shadow-xl hover:shadow-[#553DE9]/30 active:scale-[0.98]"}`,children:S?"Starting...":"Start Building"})}),s&&e.jsx("div",{className:"mt-3 px-4 py-2.5 rounded-xl bg-[#C45B5B]/10 border border-[#C45B5B]/20 text-[#C45B5B] text-sm font-medium text-center",children:s}),e.jsx("div",{className:"mt-6 text-center",children:e.jsx("button",{onClick:()=>q(!_),className:"text-sm text-[#553DE9] hover:text-[#4832c7] font-medium transition-colors",children:_?"Hide advanced options":"Advanced (write full spec)"})}),_&&e.jsx("div",{className:"mt-4",children:e.jsx(wt,{onSubmit:Be,running:a,error:s,provider:w,onProviderChange:$e,initialPrd:h})})]}),x&&!a&&e.jsxs("div",{className:"w-full max-w-3xl mt-6 flex flex-col gap-4",children:[e.jsx("button",{onClick:async()=>{try{const m=await j.getSessionsHistory();m.length>0&&t(`/project/${m[0].id}`)}catch{}},className:"w-full px-6 py-4 rounded-card text-base font-bold bg-[#553DE9] text-white hover:bg-[#553DE9]/90 transition-all shadow-lg shadow-[#553DE9]/20",children:"View Project -- Browse Files and Preview"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>p(!v),className:"px-4 py-2 rounded-card text-sm font-semibold border border-[#553DE9]/30 text-[#553DE9] hover:bg-[#553DE9]/5 transition-all",children:v?"Hide Report":"Report"}),e.jsx("button",{onClick:()=>y(!b),className:"px-4 py-2 rounded-card text-sm font-semibold border border-[#ECEAE3] text-[#6B6960] hover:text-[#36342E] hover:bg-[#F8F4F0] transition-all",children:b?"Hide Metrics":"Metrics"})]}),e.jsx($t,{visible:v}),e.jsx(ue,{visible:b})]}),e.jsx("div",{className:"w-full max-w-3xl mt-6",children:le&&le.length===0?e.jsx(ps,{type:"no-projects",action:()=>{var f;const m=U[Math.floor(Math.random()*U.length)];O(m),(f=g.current)==null||f.focus()},actionLabel:"Try an example"}):e.jsx(Ot,{onLoadSession:_e})}),e.jsxs("div",{className:"mt-6 text-xs text-[#6B6960] flex items-center gap-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${J?"bg-[#1FC5A8]":"bg-[#C45B5B]"}`}),J?"Connected to Purple Lab backend":"Waiting for backend connection..."]}),e.jsx(Wt,{}),e.jsx(Yt,{}),e.jsx(Jt,{}),e.jsx(ts,{}),e.jsx("section",{className:"w-full max-w-3xl mx-auto py-16",children:e.jsxs("div",{className:"rounded-2xl bg-gradient-to-br from-[#553DE9]/5 via-[#553DE9]/10 to-[#1FC5A8]/5 border border-[#553DE9]/15 p-10 text-center",children:[e.jsx("h2",{className:"font-heading text-h2 text-[#36342E] mb-3",children:"Ready to build something amazing?"}),e.jsx("p",{className:"text-sm text-[#6B6960] mb-6 max-w-md mx-auto",children:"Go from idea to deployed product in minutes, not months. Let AI handle the heavy lifting."}),e.jsxs("div",{className:"flex items-center justify-center gap-3 flex-wrap",children:[e.jsx("button",{onClick:()=>{var m;(m=P.current)==null||m.scrollIntoView({behavior:"smooth"}),setTimeout(()=>{var f;return(f=g.current)==null?void 0:f.focus()},500)},className:"px-8 py-3 rounded-xl text-base font-semibold bg-[#553DE9] text-white hover:bg-[#4832c7] shadow-lg shadow-[#553DE9]/25 hover:shadow-xl hover:shadow-[#553DE9]/30 active:scale-[0.98] transition-all",children:"Start Building"}),e.jsx("button",{onClick:()=>t("/templates"),className:"px-8 py-3 rounded-xl text-base font-semibold border border-[#553DE9]/30 text-[#553DE9] hover:bg-[#553DE9]/5 transition-all",children:"View Templates"})]})]})}),e.jsx(ls,{}),e.jsx(is,{})]})}),!a&&e.jsx(rs,{}),E&&e.jsx(ms,{type:"build-complete",onDismiss:()=>z(!1)})]})}export{Rs as default};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{c as U,r as u,j as t,a as P}from"./index-DvZ0Kk2x.js";import{E as K}from"./EvidenceReceiptPanel-CcaBwEI-.js";import{D as q}from"./dollar-sign-C5mkjXIM.js";import{L as Z}from"./layers-BOVKmepE.js";import{T as O}from"./trending-up-D-DbCHXm.js";import{T as J}from"./trending-down-DrtBd_C9.js";/**
|
|
2
|
-
* @license lucide-react v0.577.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const Q=[["path",{d:"M13.744 17.736a6 6 0 1 1-7.48-7.48",key:"bq4yh3"}],["path",{d:"M15 6h1v4",key:"11y1tn"}],["path",{d:"m6.134 14.768.866-.5 2 3.464",key:"17snzx"}],["circle",{cx:"16",cy:"8",r:"6",key:"14bfc9"}]],X=U("coins",Q),n={top:20,right:20,bottom:40,left:50};function T(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(e%1===0?0:2)}function Y({data:e,width:x=400,height:o=240,color:p="#553DE9",live:y}){const[i,N]=u.useState(null),[C,g]=u.useState(!1),d=u.useRef(null);u.useEffect(()=>{const a=setTimeout(()=>g(!0),50);return()=>clearTimeout(a)},[]),u.useEffect(()=>{const a=d.current;if(!a)return;const c=a.getTotalLength();a.style.strokeDasharray=`${c}`,a.style.strokeDashoffset=C?"0":`${c}`},[C,e]);const l=x-n.left-n.right,h=o-n.top-n.bottom,{pathD:$,gradientPath:f,points:r,minVal:s,maxVal:m}=u.useMemo(()=>{if(e.length<2)return{pathD:"",gradientPath:"",points:[],minVal:0,maxVal:0};const a=e.map(A=>A.value),c=Math.min(...a),E=Math.max(...a),b=E-c||1,B=l/(e.length-1),k=e.map((A,v)=>({x:n.left+v*B,y:n.top+h-(A.value-c)/b*h}));let w=`M ${k[0].x},${k[0].y}`;for(let A=1;A<k.length;A++){const v=k[A-1],M=k[A],G=v.x+(M.x-v.x)*.4,H=M.x-(M.x-v.x)*.4;w+=` C ${G},${v.y} ${H},${M.y} ${M.x},${M.y}`}const L=w+` L ${k[k.length-1].x},${n.top+h} L ${k[0].x},${n.top+h} Z`;return{pathD:w,gradientPath:L,points:k,minVal:c,maxVal:E}},[e,l,h]);if(e.length<2)return t.jsx("svg",{width:x,height:o,children:t.jsx("text",{x:x/2,y:o/2,textAnchor:"middle",className:"fill-[#939084] text-sm",children:"Not enough data"})});const j=`line-grad-${p.replace("#","")}`;return t.jsxs("svg",{width:x,height:o,viewBox:`0 0 ${x} ${o}`,className:"select-none",children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:j,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:p,stopOpacity:.25}),t.jsx("stop",{offset:"100%",stopColor:p,stopOpacity:.02})]})}),t.jsx("text",{x:n.left-8,y:n.top+4,textAnchor:"end",className:"fill-[#939084]",style:{fontSize:10},children:T(m)}),t.jsx("text",{x:n.left-8,y:n.top+h+4,textAnchor:"end",className:"fill-[#939084]",style:{fontSize:10},children:T(s)}),t.jsx("line",{x1:n.left,y1:n.top,x2:n.left+l,y2:n.top,stroke:"#ECEAE3",strokeWidth:.5,className:"dark:stroke-[#2A2A30]"}),t.jsx("line",{x1:n.left,y1:n.top+h,x2:n.left+l,y2:n.top+h,stroke:"#ECEAE3",strokeWidth:.5,className:"dark:stroke-[#2A2A30]"}),t.jsx("line",{x1:n.left,y1:n.top+h/2,x2:n.left+l,y2:n.top+h/2,stroke:"#ECEAE3",strokeWidth:.5,strokeDasharray:"4 4",className:"dark:stroke-[#2A2A30]"}),t.jsx("path",{d:f,fill:`url(#${j})`,style:{transition:"d 0.4s ease"}}),t.jsx("path",{ref:d,d:$,fill:"none",stroke:p,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:{transition:"stroke-dashoffset 1.2s ease-out, d 0.4s ease"}}),e.map((a,c)=>{const E=l/(e.length-1),b=n.left+c*E;return e.length<=6||c%Math.ceil(e.length/6)===0||c===e.length-1?t.jsx("text",{x:b,y:o-8,textAnchor:"middle",className:"fill-[#939084]",style:{fontSize:10},children:a.label},c):null}),r.map((a,c)=>t.jsxs("g",{children:[t.jsx("rect",{x:a.x-l/e.length/2,y:n.top,width:l/e.length,height:h,fill:"transparent",onMouseEnter:()=>N(c),onMouseLeave:()=>N(null),style:{cursor:"pointer"}}),t.jsx("circle",{cx:a.x,cy:a.y,r:i===c?5:3,fill:"white",stroke:p,strokeWidth:2,style:{opacity:i===c?1:0,transition:"opacity 0.15s, r 0.15s"}})]},c)),i!==null&&t.jsxs("g",{children:[t.jsx("line",{x1:r[i].x,y1:n.top,x2:r[i].x,y2:n.top+h,stroke:p,strokeWidth:.5,strokeDasharray:"3 3",opacity:.4}),t.jsx("rect",{x:r[i].x-30,y:r[i].y-28,width:60,height:20,rx:4,fill:"#36342E",className:"dark:fill-[#E8E6E3]"}),t.jsx("text",{x:r[i].x,y:r[i].y-14,textAnchor:"middle",fill:"white",className:"dark:fill-[#1A1A1E]",style:{fontSize:11,fontWeight:600},children:T(e[i].value)})]})]})}function R(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function ee({segments:e,size:x=200,thickness:o=32,live:p}){var f;const[y,i]=u.useState(null),[N,C]=u.useState(0);u.useEffect(()=>{const r=setTimeout(()=>C(1),50);return()=>clearTimeout(r)},[]);const g=u.useMemo(()=>e.reduce((r,s)=>r+s.value,0),[e]),d=x/2,l=(x-o)/2-4,h=u.useMemo(()=>{if(g===0)return[];let r=-90;return e.map(s=>{const m=s.value/g*360,j=r;r+=m;const a=r,c=j*Math.PI/180,E=a*Math.PI/180,b=d+l*Math.cos(c),B=d+l*Math.sin(c),k=d+l*Math.cos(E),w=d+l*Math.sin(E),L=m>180?1:0,A=`M ${b} ${B} A ${l} ${l} 0 ${L} 1 ${k} ${w}`,v=(s.value/g*100).toFixed(1);return{d:A,percentage:v,startAngle:j,endAngle:a}})},[e,g,d,l]),$=2*Math.PI*l;return t.jsxs("div",{className:"flex flex-col items-center gap-3",children:[t.jsxs("svg",{width:x,height:x,viewBox:`0 0 ${x} ${x}`,className:"select-none",children:[t.jsx("circle",{cx:d,cy:d,r:l,fill:"none",stroke:"#ECEAE3",strokeWidth:o,className:"dark:stroke-[#2A2A30]"}),h.map((r,s)=>{const m=e[s],a=m.value/g*360/360*$,c=$-a*N;let E=-90;for(let b=0;b<s;b++)E+=e[b].value/g*360;return t.jsx("circle",{cx:d,cy:d,r:l,fill:"none",stroke:m.color,strokeWidth:y===s?o+6:o,strokeDasharray:`${a} ${$-a}`,strokeDashoffset:c,strokeLinecap:"butt",transform:`rotate(${E} ${d} ${d})`,style:{transition:"stroke-dashoffset 0.8s ease-out, stroke-width 0.15s ease",cursor:"pointer",opacity:y!==null&&y!==s?.5:1},onMouseEnter:()=>i(s),onMouseLeave:()=>i(null)},s)}),t.jsx("text",{x:d,y:d-6,textAnchor:"middle",className:"fill-[#36342E] dark:fill-[#E8E6E3]",style:{fontSize:22,fontWeight:700},children:R(g)}),t.jsx("text",{x:d,y:d+14,textAnchor:"middle",className:"fill-[#939084]",style:{fontSize:11},children:y!==null?`${e[y].label} (${(f=h[y])==null?void 0:f.percentage}%)`:"Total"})]}),t.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1 justify-center",children:e.map((r,s)=>t.jsxs("div",{className:"flex items-center gap-1.5 text-xs cursor-pointer",onMouseEnter:()=>i(s),onMouseLeave:()=>i(null),style:{opacity:y!==null&&y!==s?.5:1},children:[t.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:r.color}}),t.jsx("span",{className:"text-[#6B6960] dark:text-[#8A8880]",children:r.label}),t.jsx("span",{className:"text-[#36342E] dark:text-[#C5C0B8] font-medium",children:R(r.value)})]},s))})]})}const D="#553DE9",F="#1FC5A8",W="#6B8AFD",I="#D4A843";function S(e){return e==null?"Not recorded":`$${e.toFixed(2)}`}function te(e){return e==null?"Not recorded":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}const se={[D]:"text-[#553DE9]",[F]:"text-[#1FC5A8]",[W]:"text-[#6B8AFD]",[I]:"text-[#D4A843]"};function _({label:e,value:x,detail:o,trend:p,icon:y,color:i}){const N=p!=null&&p<0?J:O;return t.jsxs("div",{className:"rounded-card border border-[#ECEAE3] dark:border-[#2A2A2E] bg-white dark:bg-[#18181B] p-4",children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("span",{className:"text-xs font-medium text-[#6B6960] dark:text-[#A8A69E]",children:e}),t.jsx(y,{className:se[i]??"",size:16})]}),t.jsx("div",{className:"text-xl font-semibold text-[#36342E] dark:text-[#E8E6E3] tabular-nums",children:x}),o&&t.jsx("div",{className:"mt-1 text-xs text-[#6B6960] dark:text-[#A8A69E]",children:o}),p!=null&&t.jsxs("div",{className:"mt-1 flex items-center gap-1 text-xs text-[#6B6960] dark:text-[#A8A69E]",children:[t.jsx(N,{size:12}),t.jsxs("span",{className:"tabular-nums",children:[Math.abs(p).toFixed(1),"%"]})]})]})}function V({title:e,subtitle:x,children:o}){return t.jsxs("div",{className:"rounded-card border border-[#ECEAE3] dark:border-[#2A2A2E] bg-white dark:bg-[#18181B] p-4",children:[t.jsx("h3",{className:"text-sm font-semibold text-[#36342E] dark:text-[#E8E6E3] mb-1",children:e}),x&&t.jsx("p",{className:"text-xs text-[#6B6960] dark:text-[#A8A69E] mb-3",children:x}),o]})}function z({what:e}){return t.jsx("div",{className:"flex h-[200px] items-center justify-center text-center",children:t.jsxs("p",{className:"max-w-[26ch] text-xs text-[#6B6960] dark:text-[#A8A69E]",children:["No ",e," recorded yet. This fills in once a build writes cost data."]})})}function ie(){const[e,x]=u.useState(null),[o,p]=u.useState(null),[y,i]=u.useState(null),[N,C]=u.useState(!0),[g,d]=u.useState(560);u.useEffect(()=>{let r=!1;return(async()=>{try{const[s,m]=await Promise.all([P.getCost(),P.getCostTimeline()]);if(r)return;x(s),p(m),i(null)}catch(s){if(r)return;i(s instanceof Error?s.message:"Could not load cost data")}finally{r||C(!1)}})(),()=>{r=!0}},[]);const l=Math.max(280,g-48),h=u.useMemo(()=>((o==null?void 0:o.runs)??[]).filter(s=>typeof s.cost_usd=="number").map((s,m)=>({label:s.run_id?s.run_id.slice(-6):`run ${m+1}`,value:s.cost_usd})),[o]),$=u.useMemo(()=>e?[["Input",e.total_input_tokens,D],["Output",e.total_output_tokens,F],["Cache read",e.total_cache_read_tokens,W],["Cache write",e.total_cache_creation_tokens,I]].filter(([,s])=>typeof s=="number"&&s>0).map(([s,m,j])=>({label:s,value:m,color:j})):[],[e]),f=o==null?void 0:o.budget;return N?t.jsx("div",{className:"p-6",children:t.jsx("p",{className:"text-sm text-[#6B6960] dark:text-[#A8A69E]",children:"Loading cost data..."})}):t.jsxs("div",{className:"p-6",children:[t.jsx("h1",{className:"text-lg font-semibold text-[#36342E] dark:text-[#E8E6E3] mb-1",children:"Metrics"}),t.jsx("p",{className:"text-xs text-[#6B6960] dark:text-[#A8A69E] mb-6",children:'Measured cost and token usage. Values read "Not recorded" when no build has written them.'}),y&&t.jsx("div",{className:"mb-6 rounded-card border border-[#C45B5B]/30 bg-[#C45B5B]/5 p-4",children:t.jsx("p",{className:"text-xs text-[#C45B5B]",children:y})}),t.jsx("div",{className:"mb-6 rounded-card border border-[#ECEAE3] dark:border-[#2A2A2E] bg-white dark:bg-[#18181B] p-4",children:t.jsx(K,{})}),t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[t.jsx(_,{label:"Total cost",value:S(e==null?void 0:e.estimated_cost_usd),detail:(e==null?void 0:e.cost_recorded)===!1?"No cost recorded yet":void 0,icon:q,color:I}),t.jsx(_,{label:"Total tokens",value:te(e==null?void 0:e.total_tokens),icon:X,color:D}),t.jsx(_,{label:"Runs with cost",value:String((o==null?void 0:o.runs_count)??0),detail:"Runs that wrote a receipt",icon:Z,color:W}),t.jsx(_,{label:"Budget used",value:(f==null?void 0:f.percent_used)==null?"No budget set":`${f.percent_used.toFixed(0)}%`,detail:(f==null?void 0:f.limit)==null?void 0:`${S(f.used)} of ${S(f.limit)}`,icon:O,color:f!=null&&f.exceeded?"#C45B5B":F})]}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 mb-6",ref:r=>{r&&new ResizeObserver(m=>{const j=m[0];if(j){const a=window.innerWidth>=1024?2:1;d(Math.floor(j.contentRect.width/a))}}).observe(r)},children:[t.jsx(V,{title:"Cost per run",subtitle:"From each run's Evidence Receipt",children:h.length>0?t.jsx(Y,{data:h,width:l,height:220,color:D}):t.jsx(z,{what:"per-run cost"})}),t.jsx(V,{title:"Token usage",subtitle:"Input, output and cache totals",children:$.length>0?t.jsx(ee,{segments:$,size:190,thickness:28}):t.jsx(z,{what:"token usage"})})]})]})}export{ie as MetricsPage,ie as default};
|