junhost 0.1.0 → 0.1.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.
Files changed (93) hide show
  1. package/README.md +43 -1
  2. package/bin/jun.js +17 -0
  3. package/dist/index.js +51 -51
  4. package/dist/mcp-server.js +12 -12
  5. package/package.json +1 -1
  6. package/ui-dist/assets/{BrowserPage-CLwJOnA1.js → BrowserPage-Bw1kBIM_.js} +1 -1
  7. package/ui-dist/assets/{DashboardPage-DNlY12tH.js → DashboardPage-BvNlgB4B.js} +1 -1
  8. package/ui-dist/assets/{FilesPage-CfFJjtlo.js → FilesPage-C1IqnxpR.js} +1 -1
  9. package/ui-dist/assets/{McpPage-Ckmbp2T3.js → McpPage-BgXcKazm.js} +1 -1
  10. package/ui-dist/assets/{MemoriesPage-BgBe2rb6.js → MemoriesPage-DYOob4W0.js} +1 -1
  11. package/ui-dist/assets/{RunsPage-9w7iFG8N.js → RunsPage-BpBj82Ux.js} +4 -4
  12. package/ui-dist/assets/{SchedulesPage-B5FVZB0F.js → SchedulesPage-mIWaXymg.js} +1 -1
  13. package/ui-dist/assets/{SettingsPage-lNZmrgQF.js → SettingsPage-C5vG-RLn.js} +1 -1
  14. package/ui-dist/assets/{SkillsPage-BXcSp6ls.js → SkillsPage-DuFQfdSR.js} +1 -1
  15. package/ui-dist/assets/architecture-7EHR7CIX-BMNBOS2i.js +1 -0
  16. package/ui-dist/assets/{architectureDiagram-3BPJPVTR-CZU-I50b.js → architectureDiagram-3BPJPVTR-CQ1UyWn-.js} +1 -1
  17. package/ui-dist/assets/{blockDiagram-GPEHLZMM-CyBud8P5.js → blockDiagram-GPEHLZMM-DO2WH3yT.js} +1 -1
  18. package/ui-dist/assets/{c4Diagram-AAUBKEIU--J4ICgL4.js → c4Diagram-AAUBKEIU-CDcDkAFN.js} +1 -1
  19. package/ui-dist/assets/channel-BMSobhoT.js +1 -0
  20. package/ui-dist/assets/{checkbox-Dl42vHZu.js → checkbox-BO9cBKlP.js} +1 -1
  21. package/ui-dist/assets/{chunk-2J33WTMH-BDb1cFmy.js → chunk-2J33WTMH-CxE9IMxF.js} +1 -1
  22. package/ui-dist/assets/{chunk-3OPIFGDE-BlluxIcQ.js → chunk-3OPIFGDE-CWe0ghtO.js} +1 -1
  23. package/ui-dist/assets/{chunk-5ZQYHXKU-CKTcuPiD.js → chunk-5ZQYHXKU-D9lXR7-a.js} +1 -1
  24. package/ui-dist/assets/{chunk-727SXJPM-MZn2xvWx.js → chunk-727SXJPM-1INZms_u.js} +1 -1
  25. package/ui-dist/assets/{chunk-AQP2D5EJ-BJaTZvWO.js → chunk-AQP2D5EJ-Bo5P94jR.js} +1 -1
  26. package/ui-dist/assets/{chunk-BO2N2NFS-BnH2G-m5.js → chunk-BO2N2NFS-Bb9QKS7r.js} +4 -4
  27. package/ui-dist/assets/{chunk-CSCIHK7Q-CXkHF5UK.js → chunk-CSCIHK7Q-BXW0kTPy.js} +3 -3
  28. package/ui-dist/assets/{chunk-KSCS5N6A-BahjoFv5.js → chunk-KSCS5N6A-su0hRnFY.js} +1 -1
  29. package/ui-dist/assets/{chunk-L5ZTLDWV-Bx4WHt-z.js → chunk-L5ZTLDWV-CLjULdtO.js} +1 -1
  30. package/ui-dist/assets/{chunk-LZXEDZCA-CkFznL5l.js → chunk-LZXEDZCA-DSupe1kd.js} +2 -2
  31. package/ui-dist/assets/{chunk-ND2GUHAM-B8gmrqM9.js → chunk-ND2GUHAM-DVaKW6-I.js} +1 -1
  32. package/ui-dist/assets/{chunk-NZK2D7GU-C18DTyig.js → chunk-NZK2D7GU-DP_luiUT.js} +1 -1
  33. package/ui-dist/assets/{chunk-O5CBEL6O-DhXgjXO_.js → chunk-O5CBEL6O-DJ6oobwT.js} +1 -1
  34. package/ui-dist/assets/{chunk-WU5MYG2G-DakMffny.js → chunk-WU5MYG2G-BJCNi6Df.js} +1 -1
  35. package/ui-dist/assets/classDiagram-4FO5ZUOK-C8buBHXm.js +1 -0
  36. package/ui-dist/assets/classDiagram-v2-Q7XG4LA2-C8buBHXm.js +1 -0
  37. package/ui-dist/assets/{collapsible-BdLJt-lG.js → collapsible-0tqcZUWD.js} +1 -1
  38. package/ui-dist/assets/{dagre-BM42HDAG-CRPnH9-w.js → dagre-BM42HDAG-CRyL8hRI.js} +1 -1
  39. package/ui-dist/assets/{diagram-2AECGRRQ-BHmnvDJu.js → diagram-2AECGRRQ-DyjpW-BD.js} +1 -1
  40. package/ui-dist/assets/{diagram-5GNKFQAL-CnuSOf5i.js → diagram-5GNKFQAL-CBTUCxgf.js} +1 -1
  41. package/ui-dist/assets/{diagram-KO2AKTUF-DkD3Oyzq.js → diagram-KO2AKTUF-C7inOR0g.js} +1 -1
  42. package/ui-dist/assets/{diagram-LMA3HP47-qngr_ayi.js → diagram-LMA3HP47-CfCMRg_H.js} +1 -1
  43. package/ui-dist/assets/{diagram-OG6HWLK6-BUXAAFlB.js → diagram-OG6HWLK6-DLl3GKVl.js} +1 -1
  44. package/ui-dist/assets/{dialog-Bl8-9u35.js → dialog-gLEpdaG1.js} +1 -1
  45. package/ui-dist/assets/{erDiagram-TEJ5UH35-B7fmkd3a.js → erDiagram-TEJ5UH35-D3SsdlGo.js} +1 -1
  46. package/ui-dist/assets/eventmodeling-FCH6USID-Dl7jZkr1.js +1 -0
  47. package/ui-dist/assets/{flowDiagram-I6XJVG4X-D3K28Pdy.js → flowDiagram-I6XJVG4X-BIZoa3Ff.js} +1 -1
  48. package/ui-dist/assets/{ganttDiagram-6RSMTGT7-CXzmskXJ.js → ganttDiagram-6RSMTGT7-DoIzzrgl.js} +1 -1
  49. package/ui-dist/assets/{gitGraph-WXDBUCRP-CROsiysY.js → gitGraph-WXDBUCRP-tT7WczwY.js} +1 -1
  50. package/ui-dist/assets/{gitGraphDiagram-PVQCEYII-BBhICl9b.js → gitGraphDiagram-PVQCEYII-CwoMoyS1.js} +1 -1
  51. package/ui-dist/assets/{highlighted-body-OFNGDK62-woHDdMrg.js → highlighted-body-OFNGDK62-X8dg_vaO.js} +1 -1
  52. package/ui-dist/assets/{index-DmmH6oax.css → index-C_NJsn6Z.css} +1 -1
  53. package/ui-dist/assets/{index-j386AZTn.js → index-DXYsuK0q.js} +2 -2
  54. package/ui-dist/assets/{info-J43DQDTF-DHht6dOt.js → info-J43DQDTF-Da0djCPL.js} +1 -1
  55. package/ui-dist/assets/{infoDiagram-5YYISTIA-Df4LhnuE.js → infoDiagram-5YYISTIA-D-OHDMDH.js} +1 -1
  56. package/ui-dist/assets/{input-D4O22yGt.js → input-BPTmfk5i.js} +1 -1
  57. package/ui-dist/assets/{ishikawaDiagram-YF4QCWOH-B8KMc0In.js → ishikawaDiagram-YF4QCWOH-Bzg0E0Z1.js} +1 -1
  58. package/ui-dist/assets/{journeyDiagram-JHISSGLW-Bpr7eOEv.js → journeyDiagram-JHISSGLW-rmeE-f4I.js} +1 -1
  59. package/ui-dist/assets/{kanban-definition-UN3LZRKU-R8MXwX2D.js → kanban-definition-UN3LZRKU-DSy_xosI.js} +1 -1
  60. package/ui-dist/assets/katex-BNbsei-7.js +1 -0
  61. package/ui-dist/assets/{line-EyXPCaOi.js → line-6Sq5fd7W.js} +1 -1
  62. package/ui-dist/assets/mermaid-GHXKKRXX-eP_ygZe4.js +1 -0
  63. package/ui-dist/assets/{mermaid-parser.core-Bd2TX3li.js → mermaid-parser.core-C6nlL4jI.js} +2 -2
  64. package/ui-dist/assets/{mindmap-definition-RKZ34NQL-CCrZYYSm.js → mindmap-definition-RKZ34NQL-CSJ0pwqG.js} +1 -1
  65. package/ui-dist/assets/{packet-YPE3B663-BsRm1dxS.js → packet-YPE3B663-CJYSZVBB.js} +1 -1
  66. package/ui-dist/assets/{pie-LRSECV5Y-2jRO4jrF.js → pie-LRSECV5Y-B7FDQxHq.js} +1 -1
  67. package/ui-dist/assets/{pieDiagram-4H26LBE5-O21uLYd7.js → pieDiagram-4H26LBE5-BYco3Xpn.js} +1 -1
  68. package/ui-dist/assets/{quadrantDiagram-W4KKPZXB-PFuRo2tu.js → quadrantDiagram-W4KKPZXB-BSzj1BbK.js} +1 -1
  69. package/ui-dist/assets/{radar-GUYGQ44K-DrLd9hhi.js → radar-GUYGQ44K-CIqNKREz.js} +1 -1
  70. package/ui-dist/assets/{requirementDiagram-4Y6WPE33-CsP61d0X.js → requirementDiagram-4Y6WPE33-DTMmHobs.js} +1 -1
  71. package/ui-dist/assets/{sankeyDiagram-5OEKKPKP-OXRKlXwh.js → sankeyDiagram-5OEKKPKP-v48Pd1Sj.js} +1 -1
  72. package/ui-dist/assets/{select-CYgMxtlk.js → select-jBmyVjXL.js} +1 -1
  73. package/ui-dist/assets/{sequenceDiagram-3UESZ5HK-CGKNazDP.js → sequenceDiagram-3UESZ5HK-Cutc-QJ-.js} +1 -1
  74. package/ui-dist/assets/{stateDiagram-AJRCARHV-BBiaMVYA.js → stateDiagram-AJRCARHV-C9wjw5vE.js} +1 -1
  75. package/ui-dist/assets/stateDiagram-v2-BHNVJYJU-0qv-iPvr.js +1 -0
  76. package/ui-dist/assets/{tabs-DS9zR4V0.js → tabs-BUCI-mwA.js} +1 -1
  77. package/ui-dist/assets/{timeline-definition-PNZ67QCA-DCONMP8y.js → timeline-definition-PNZ67QCA-Be0sJR3F.js} +1 -1
  78. package/ui-dist/assets/{treeView-BLDUP644-DLNyeiHu.js → treeView-BLDUP644-BuO1c41a.js} +1 -1
  79. package/ui-dist/assets/{treemap-LRROVOQU-Cdld0366.js → treemap-LRROVOQU-DnqRpBrL.js} +1 -1
  80. package/ui-dist/assets/{useCompositeListItem-BQ4RLkNZ.js → useCompositeListItem-BMeUcGkY.js} +1 -1
  81. package/ui-dist/assets/{vennDiagram-CIIHVFJN-C21GUpuw.js → vennDiagram-CIIHVFJN-BU-tyhcP.js} +1 -1
  82. package/ui-dist/assets/{wardley-L42UT6IY-PuTi7B-8.js → wardley-L42UT6IY-C4lBe1D1.js} +1 -1
  83. package/ui-dist/assets/{wardleyDiagram-YWT4CUSO-BwV-yZO0.js → wardleyDiagram-YWT4CUSO-Ba4GgkxA.js} +1 -1
  84. package/ui-dist/assets/{xychartDiagram-2RQKCTM6-D-bOqUpK.js → xychartDiagram-2RQKCTM6-BZYGoMGR.js} +1 -1
  85. package/ui-dist/index.html +2 -2
  86. package/ui-dist/assets/architecture-7EHR7CIX-D8QwdCM4.js +0 -1
  87. package/ui-dist/assets/channel-CXOCC3Ms.js +0 -1
  88. package/ui-dist/assets/classDiagram-4FO5ZUOK-DMdoabn-.js +0 -1
  89. package/ui-dist/assets/classDiagram-v2-Q7XG4LA2-DMdoabn-.js +0 -1
  90. package/ui-dist/assets/eventmodeling-FCH6USID-DUPVuqbK.js +0 -1
  91. package/ui-dist/assets/katex-U6Climy7.js +0 -1
  92. package/ui-dist/assets/mermaid-GHXKKRXX-CDSYqrX3.js +0 -1
  93. package/ui-dist/assets/stateDiagram-v2-BHNVJYJU-C_bLdSQ9.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "junhost",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Jun — a self-hosted dashboard that runs and supervises Codex as a 24/7 local/VPS agent: chat runs, workspace files, remote browser, skills, MCP, schedules.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +1 @@
1
- import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{I as r,L as i,V as a,t as o}from"./utils-BX1Diber.js";import{x as s}from"./useBaseUiId-dSIElxm7.js";import{t as c}from"./play-B4R5rXMZ.js";import{t as l}from"./rotate-cw-B1ZRM7VI.js";import{t as u}from"./square-_9cV5Fet.js";import{Yt as d,t as f}from"./index-j386AZTn.js";import{t as p}from"./button-Cg-0y2B2.js";import{t as m}from"./input-D4O22yGt.js";var h=s(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),ee=s(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),g=s(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),_=s(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),v=s(`mouse-pointer`,[[`path`,{d:`M12.586 12.586 19 19`,key:`ea5xo7`}],[`path`,{d:`M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z`,key:`277e5u`}]]),y=s(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),b=e(t(),1),x=n(),S={width:1280,height:720},C=[{value:`agent`,label:`Agent`,icon:g},{value:`user`,label:`You`,icon:v},{value:`paused`,label:`Paused`,icon:y}];function w(e){return!!e.altKey|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0)}var T=[`left`,`middle`,`right`];function E(){let[e,t]=(0,b.useState)(null),[n,s]=(0,b.useState)([]),[g,y]=(0,b.useState)(``),[E,D]=(0,b.useState)(null),[O,te]=(0,b.useState)(null),[k,A]=(0,b.useState)(!1),[j,M]=(0,b.useState)(null),N=(0,b.useRef)(null),P=(0,b.useRef)(null),F=(0,b.useRef)(null),I=(0,b.useRef)(null),L=(0,b.useCallback)(()=>{let e=I.current;if(!e)return;let t=S.width/S.height,n=e.clientWidth,r=e.clientHeight;if(n===0||r===0)return;let i=n,a=n/t;a>r&&(a=r,i=r*t);let o={w:Math.floor(i),h:Math.floor(a)};te(e=>e?.w===o.w&&e?.h===o.h?e:o)},[]);(0,b.useEffect)(()=>{L();let e=new ResizeObserver(L);return I.current&&e.observe(I.current),()=>e.disconnect()},[L]);let R=(0,b.useRef)(!1),z=(0,b.useRef)(0),B=e?.streaming??!1,V=e?.running??!1,H=e?.controller??`agent`,U=H===`user`,W=(0,b.useCallback)(async()=>{try{let[{status:e},{actions:n}]=await Promise.all([r(`/api/browser/status`),r(`/api/browser/actions`)]);t(e),s(n),!R.current&&e.url&&e.url!==`about:blank`&&y(e.url),M(null)}catch(e){M(e instanceof Error?e.message:String(e))}},[]);f(W,5e3),(0,b.useEffect)(()=>{U&&F.current?.focus()},[U]),(0,b.useEffect)(()=>{if(!B){D(null);return}let e=!1,t=null,n=0,r=()=>{let i=a(`/api/browser/stream`);N.current=i,i.onmessage=e=>{try{let t=JSON.parse(String(e.data));t.type===`frame`&&t.data&&(n=0,D(`data:image/jpeg;base64,${t.data}`))}catch{}},i.onclose=()=>{if(N.current===i&&(N.current=null),e)return;let a=Math.min(1e3*2**n,1e4);n+=1,t=setTimeout(r,a)}};return r(),()=>{e=!0,t&&clearTimeout(t),N.current?.close(),N.current=null}},[B]);let G=(0,b.useCallback)(async e=>{A(!0),M(null);try{await e(),await W()}catch(e){M(e instanceof Error?e.message:String(e))}finally{A(!1)}},[W]),K=()=>G(()=>i(`/api/browser/start`,{url:g.trim()||void 0})),q=()=>G(()=>i(`/api/browser/stop`)),J=()=>{let e=g.trim();if(!e)return;let t=/^[a-z]+:\/\//i.test(e)?e:`https://${e}`;return G(()=>i(`/api/browser/navigate`,{url:t}))},Y=e=>G(()=>i(`/api/browser/${e}`)),ne=()=>G(()=>i(`/api/browser/screenshot`)),X=e=>G(()=>i(`/api/browser/control`,{controller:e})),Z=e=>{let t=N.current;t&&t.readyState===WebSocket.OPEN&&t.send(JSON.stringify(e))},re=e=>{let t=P.current;if(!t)return null;let n=t.getBoundingClientRect();return n.width===0||n.height===0?null:{x:Math.round((e.clientX-n.left)/n.width*S.width),y:Math.round((e.clientY-n.top)/n.height*S.height)}},Q=(e,t,n={})=>{if(!U)return;let r=re(e);r&&(e.preventDefault(),Z({type:`input_mouse`,eventType:t,...r,button:T[e.button]??`left`,clickCount:e.detail||1,modifiers:w(e),...n}))},ie=e=>{let t=performance.now();t-z.current<33||(z.current=t,Q(e,`mouseMoved`))},ae=e=>{let t=e.ctrlKey||e.metaKey||e.altKey;if(e.key.length===1&&!t)return null;let n=[];return e.ctrlKey&&n.push(`Control`),e.shiftKey&&n.push(`Shift`),e.altKey&&n.push(`Alt`),e.metaKey&&n.push(`Meta`),n.push(e.key===` `?`Space`:e.key),n.join(`+`)},$=(e,t)=>{if(!U)return;e.preventDefault();let n=ae(e);if(n){t===`keyDown`&&i(`/api/browser/key`,{key:n}).catch(()=>{});return}Z({type:`input_keyboard`,eventType:t,key:e.key,code:e.code,text:t===`keyDown`?e.key:void 0,modifiers:w(e)})};return(0,x.jsxs)(`div`,{className:`flex h-full min-h-0`,children:[(0,x.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 p-4`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(p,{size:`icon-sm`,variant:`outline`,disabled:!V||k,onClick:()=>Y(`back`),children:(0,x.jsx)(h,{})}),(0,x.jsx)(p,{size:`icon-sm`,variant:`outline`,disabled:!V||k,onClick:()=>Y(`forward`),children:(0,x.jsx)(ee,{})}),(0,x.jsx)(p,{size:`icon-sm`,variant:`outline`,disabled:!V||k,onClick:()=>Y(`reload`),children:(0,x.jsx)(l,{})})]}),(0,x.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,x.jsx)(m,{placeholder:`https://example.com`,value:g,onChange:e=>y(e.target.value),onFocus:()=>R.current=!0,onBlur:()=>R.current=!1,onKeyDown:e=>{e.key===`Enter`&&(V?J:K)()}}),(0,x.jsx)(p,{size:`sm`,variant:`outline`,disabled:k||g.trim().length===0,onClick:()=>V?J():K(),children:`Go`})]}),(0,x.jsx)(p,{size:`icon-sm`,variant:`outline`,disabled:!V||k,onClick:ne,title:`Screenshot → workspace/screenshots`,children:(0,x.jsx)(_,{})}),(0,x.jsx)(`div`,{className:`flex items-center rounded-md border p-0.5`,children:C.map(({value:e,label:t,icon:n})=>(0,x.jsxs)(p,{size:`sm`,variant:H===e?`secondary`:`ghost`,className:`h-7 gap-1.5 px-2`,disabled:k,onClick:()=>X(e),children:[(0,x.jsx)(n,{className:`size-3.5`}),t]},e))}),V?(0,x.jsxs)(p,{size:`sm`,variant:`outline`,className:`text-destructive hover:text-destructive`,disabled:k,onClick:q,children:[(0,x.jsx)(u,{className:`size-3.5`}),` Stop`]}):(0,x.jsxs)(p,{size:`sm`,disabled:k,onClick:K,children:[(0,x.jsx)(c,{className:`size-3.5`}),` Start`]})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,x.jsx)(`span`,{className:o(`inline-block size-2 rounded-full`,V?`bg-emerald-500`:`bg-neutral-300`)}),V?e?.title||e?.url||`Browser running`:`Browser stopped`,U&&V&&(0,x.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 font-medium text-primary`,children:`You have control — click the page and type`})]}),j&&(0,x.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:j}),(0,x.jsx)(`div`,{ref:I,className:`flex min-h-0 flex-1 items-center justify-center`,children:(0,x.jsxs)(`div`,{ref:F,style:O?{width:O.w,height:O.h}:void 0,className:o(`group relative flex items-center justify-center overflow-hidden rounded-lg border bg-neutral-950/95 outline-none`,U&&`ring-2 ring-primary/60`),tabIndex:0,onMouseDown:()=>{U&&F.current?.focus()},onKeyDown:e=>$(e,`keyDown`),onKeyUp:e=>$(e,`keyUp`),children:[E?(0,x.jsx)(`img`,{ref:P,src:E,alt:`Browser viewport`,draggable:!1,className:o(`h-full w-full select-none object-contain`,U?`cursor-crosshair`:`cursor-default`),onMouseDown:e=>Q(e,`mousePressed`),onMouseUp:e=>Q(e,`mouseReleased`),onMouseMove:ie,onContextMenu:e=>U&&e.preventDefault(),onWheel:e=>Q(e,`mouseWheel`,{deltaX:e.deltaX,deltaY:e.deltaY})}):(0,x.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-sm text-neutral-400`,children:[(0,x.jsx)(d,{className:`size-8`}),V?`Waiting for viewport frames…`:`Start the browser to see the live viewport.`]}),!U&&E&&(0,x.jsx)(`div`,{className:`absolute inset-0 flex items-end justify-center pb-4 opacity-0 transition-opacity group-hover:opacity-100`,children:(0,x.jsxs)(p,{size:`sm`,className:`shadow-lg`,onClick:()=>X(`user`),children:[(0,x.jsx)(v,{className:`size-3.5`}),` Take control`]})})]})})]}),(0,x.jsxs)(`aside`,{className:`flex w-72 shrink-0 flex-col border-l`,children:[(0,x.jsx)(`div`,{className:`border-b px-3 py-2 text-sm font-semibold`,children:`Action log`}),(0,x.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-1 overflow-auto p-2`,children:[n.map(e=>(0,x.jsxs)(`div`,{className:`rounded-md px-2 py-1.5 text-xs hover:bg-muted/60`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,x.jsx)(`span`,{className:`font-medium`,children:e.kind}),(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString()})]}),e.detail&&(0,x.jsx)(`div`,{className:`truncate text-muted-foreground`,title:e.detail,children:e.detail})]},e.id)),n.length===0&&(0,x.jsx)(`p`,{className:`px-2 py-4 text-xs text-muted-foreground`,children:`No actions yet. Start the browser or navigate somewhere.`})]})]})]})}export{E as BrowserPage};
1
+ import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{I as r,L as i,V as a,t as o}from"./utils-BX1Diber.js";import{x as s}from"./useBaseUiId-dSIElxm7.js";import{t as c}from"./play-B4R5rXMZ.js";import{t as l}from"./rotate-cw-B1ZRM7VI.js";import{t as u}from"./square-_9cV5Fet.js";import{Yt as d,t as f}from"./index-DXYsuK0q.js";import{t as p}from"./button-Cg-0y2B2.js";import{t as m}from"./input-BPTmfk5i.js";var h=s(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),ee=s(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),g=s(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),_=s(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),v=s(`mouse-pointer`,[[`path`,{d:`M12.586 12.586 19 19`,key:`ea5xo7`}],[`path`,{d:`M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z`,key:`277e5u`}]]),y=s(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),b=e(t(),1),x=n(),S={width:1280,height:720},C=[{value:`agent`,label:`Agent`,icon:g},{value:`user`,label:`You`,icon:v},{value:`paused`,label:`Paused`,icon:y}];function w(e){return!!e.altKey|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0)}var T=[`left`,`middle`,`right`];function E(){let[e,t]=(0,b.useState)(null),[n,s]=(0,b.useState)([]),[g,y]=(0,b.useState)(``),[E,D]=(0,b.useState)(null),[O,te]=(0,b.useState)(null),[k,A]=(0,b.useState)(!1),[j,M]=(0,b.useState)(null),N=(0,b.useRef)(null),P=(0,b.useRef)(null),F=(0,b.useRef)(null),I=(0,b.useRef)(null),L=(0,b.useCallback)(()=>{let e=I.current;if(!e)return;let t=S.width/S.height,n=e.clientWidth,r=e.clientHeight;if(n===0||r===0)return;let i=n,a=n/t;a>r&&(a=r,i=r*t);let o={w:Math.floor(i),h:Math.floor(a)};te(e=>e?.w===o.w&&e?.h===o.h?e:o)},[]);(0,b.useEffect)(()=>{L();let e=new ResizeObserver(L);return I.current&&e.observe(I.current),()=>e.disconnect()},[L]);let R=(0,b.useRef)(!1),z=(0,b.useRef)(0),B=e?.streaming??!1,V=e?.running??!1,H=e?.controller??`agent`,U=H===`user`,W=(0,b.useCallback)(async()=>{try{let[{status:e},{actions:n}]=await Promise.all([r(`/api/browser/status`),r(`/api/browser/actions`)]);t(e),s(n),!R.current&&e.url&&e.url!==`about:blank`&&y(e.url),M(null)}catch(e){M(e instanceof Error?e.message:String(e))}},[]);f(W,5e3),(0,b.useEffect)(()=>{U&&F.current?.focus()},[U]),(0,b.useEffect)(()=>{if(!B){D(null);return}let e=!1,t=null,n=0,r=()=>{let i=a(`/api/browser/stream`);N.current=i,i.onmessage=e=>{try{let t=JSON.parse(String(e.data));t.type===`frame`&&t.data&&(n=0,D(`data:image/jpeg;base64,${t.data}`))}catch{}},i.onclose=()=>{if(N.current===i&&(N.current=null),e)return;let a=Math.min(1e3*2**n,1e4);n+=1,t=setTimeout(r,a)}};return r(),()=>{e=!0,t&&clearTimeout(t),N.current?.close(),N.current=null}},[B]);let G=(0,b.useCallback)(async e=>{A(!0),M(null);try{await e(),await W()}catch(e){M(e instanceof Error?e.message:String(e))}finally{A(!1)}},[W]),K=()=>G(()=>i(`/api/browser/start`,{url:g.trim()||void 0})),q=()=>G(()=>i(`/api/browser/stop`)),J=()=>{let e=g.trim();if(!e)return;let t=/^[a-z]+:\/\//i.test(e)?e:`https://${e}`;return G(()=>i(`/api/browser/navigate`,{url:t}))},Y=e=>G(()=>i(`/api/browser/${e}`)),ne=()=>G(()=>i(`/api/browser/screenshot`)),X=e=>G(()=>i(`/api/browser/control`,{controller:e})),Z=e=>{let t=N.current;t&&t.readyState===WebSocket.OPEN&&t.send(JSON.stringify(e))},re=e=>{let t=P.current;if(!t)return null;let n=t.getBoundingClientRect();return n.width===0||n.height===0?null:{x:Math.round((e.clientX-n.left)/n.width*S.width),y:Math.round((e.clientY-n.top)/n.height*S.height)}},Q=(e,t,n={})=>{if(!U)return;let r=re(e);r&&(e.preventDefault(),Z({type:`input_mouse`,eventType:t,...r,button:T[e.button]??`left`,clickCount:e.detail||1,modifiers:w(e),...n}))},ie=e=>{let t=performance.now();t-z.current<33||(z.current=t,Q(e,`mouseMoved`))},ae=e=>{let t=e.ctrlKey||e.metaKey||e.altKey;if(e.key.length===1&&!t)return null;let n=[];return e.ctrlKey&&n.push(`Control`),e.shiftKey&&n.push(`Shift`),e.altKey&&n.push(`Alt`),e.metaKey&&n.push(`Meta`),n.push(e.key===` `?`Space`:e.key),n.join(`+`)},$=(e,t)=>{if(!U)return;e.preventDefault();let n=ae(e);if(n){t===`keyDown`&&i(`/api/browser/key`,{key:n}).catch(()=>{});return}Z({type:`input_keyboard`,eventType:t,key:e.key,code:e.code,text:t===`keyDown`?e.key:void 0,modifiers:w(e)})};return(0,x.jsxs)(`div`,{className:`flex h-full min-h-0`,children:[(0,x.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 p-4`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(p,{size:`icon-sm`,variant:`outline`,disabled:!V||k,onClick:()=>Y(`back`),children:(0,x.jsx)(h,{})}),(0,x.jsx)(p,{size:`icon-sm`,variant:`outline`,disabled:!V||k,onClick:()=>Y(`forward`),children:(0,x.jsx)(ee,{})}),(0,x.jsx)(p,{size:`icon-sm`,variant:`outline`,disabled:!V||k,onClick:()=>Y(`reload`),children:(0,x.jsx)(l,{})})]}),(0,x.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,x.jsx)(m,{placeholder:`https://example.com`,value:g,onChange:e=>y(e.target.value),onFocus:()=>R.current=!0,onBlur:()=>R.current=!1,onKeyDown:e=>{e.key===`Enter`&&(V?J:K)()}}),(0,x.jsx)(p,{size:`sm`,variant:`outline`,disabled:k||g.trim().length===0,onClick:()=>V?J():K(),children:`Go`})]}),(0,x.jsx)(p,{size:`icon-sm`,variant:`outline`,disabled:!V||k,onClick:ne,title:`Screenshot → workspace/screenshots`,children:(0,x.jsx)(_,{})}),(0,x.jsx)(`div`,{className:`flex items-center rounded-md border p-0.5`,children:C.map(({value:e,label:t,icon:n})=>(0,x.jsxs)(p,{size:`sm`,variant:H===e?`secondary`:`ghost`,className:`h-7 gap-1.5 px-2`,disabled:k,onClick:()=>X(e),children:[(0,x.jsx)(n,{className:`size-3.5`}),t]},e))}),V?(0,x.jsxs)(p,{size:`sm`,variant:`outline`,className:`text-destructive hover:text-destructive`,disabled:k,onClick:q,children:[(0,x.jsx)(u,{className:`size-3.5`}),` Stop`]}):(0,x.jsxs)(p,{size:`sm`,disabled:k,onClick:K,children:[(0,x.jsx)(c,{className:`size-3.5`}),` Start`]})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,x.jsx)(`span`,{className:o(`inline-block size-2 rounded-full`,V?`bg-emerald-500`:`bg-neutral-300`)}),V?e?.title||e?.url||`Browser running`:`Browser stopped`,U&&V&&(0,x.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 font-medium text-primary`,children:`You have control — click the page and type`})]}),j&&(0,x.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:j}),(0,x.jsx)(`div`,{ref:I,className:`flex min-h-0 flex-1 items-center justify-center`,children:(0,x.jsxs)(`div`,{ref:F,style:O?{width:O.w,height:O.h}:void 0,className:o(`group relative flex items-center justify-center overflow-hidden rounded-lg border bg-neutral-950/95 outline-none`,U&&`ring-2 ring-primary/60`),tabIndex:0,onMouseDown:()=>{U&&F.current?.focus()},onKeyDown:e=>$(e,`keyDown`),onKeyUp:e=>$(e,`keyUp`),children:[E?(0,x.jsx)(`img`,{ref:P,src:E,alt:`Browser viewport`,draggable:!1,className:o(`h-full w-full select-none object-contain`,U?`cursor-crosshair`:`cursor-default`),onMouseDown:e=>Q(e,`mousePressed`),onMouseUp:e=>Q(e,`mouseReleased`),onMouseMove:ie,onContextMenu:e=>U&&e.preventDefault(),onWheel:e=>Q(e,`mouseWheel`,{deltaX:e.deltaX,deltaY:e.deltaY})}):(0,x.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-sm text-neutral-400`,children:[(0,x.jsx)(d,{className:`size-8`}),V?`Waiting for viewport frames…`:`Start the browser to see the live viewport.`]}),!U&&E&&(0,x.jsx)(`div`,{className:`absolute inset-0 flex items-end justify-center pb-4 opacity-0 transition-opacity group-hover:opacity-100`,children:(0,x.jsxs)(p,{size:`sm`,className:`shadow-lg`,onClick:()=>X(`user`),children:[(0,x.jsx)(v,{className:`size-3.5`}),` Take control`]})})]})})]}),(0,x.jsxs)(`aside`,{className:`flex w-72 shrink-0 flex-col border-l`,children:[(0,x.jsx)(`div`,{className:`border-b px-3 py-2 text-sm font-semibold`,children:`Action log`}),(0,x.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-1 overflow-auto p-2`,children:[n.map(e=>(0,x.jsxs)(`div`,{className:`rounded-md px-2 py-1.5 text-xs hover:bg-muted/60`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,x.jsx)(`span`,{className:`font-medium`,children:e.kind}),(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString()})]}),e.detail&&(0,x.jsx)(`div`,{className:`truncate text-muted-foreground`,title:e.detail,children:e.detail})]},e.id)),n.length===0&&(0,x.jsx)(`p`,{className:`px-2 py-4 text-xs text-muted-foreground`,children:`No actions yet. Start the browser or navigate somewhere.`})]})]})]})}export{E as BrowserPage};
@@ -1 +1 @@
1
- import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{I as r,t as i}from"./utils-BX1Diber.js";import{tn as a}from"./index-j386AZTn.js";import{t as o}from"./button-Cg-0y2B2.js";import{t as s}from"./badge-DjyNiZCE.js";var c=e(t(),1),l=n();function u({className:e,size:t=`default`,...n}){return(0,l.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:i(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function d({className:e,...t}){return(0,l.jsx)(`div`,{"data-slot":`card-header`,className:i(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3`,e),...t})}function f({className:e,...t}){return(0,l.jsx)(`div`,{"data-slot":`card-title`,className:i(`text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...t})}function p({className:e,...t}){return(0,l.jsx)(`div`,{"data-slot":`card-description`,className:i(`text-sm text-muted-foreground`,e),...t})}function m({className:e,...t}){return(0,l.jsx)(`div`,{"data-slot":`card-content`,className:i(`px-4 group-data-[size=sm]/card:px-3`,e),...t})}function h(){let[e,t]=(0,c.useState)(null),[n,i]=(0,c.useState)(null);return(0,c.useEffect)(()=>{r(`/api/status`).then(t).catch(()=>{}),r(`/api/runs`).then(({runs:e})=>i(e.filter(e=>[`queued`,`starting`,`running`,`waiting_approval`].includes(e.status)).length)).catch(()=>{})},[]),(0,l.jsxs)(`div`,{className:`page`,children:[(0,l.jsx)(`h1`,{children:`Dashboard`}),(0,l.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:[(0,l.jsxs)(u,{children:[(0,l.jsxs)(d,{children:[(0,l.jsxs)(f,{className:`flex items-center justify-between`,children:[`Daemon`,(0,l.jsx)(s,{variant:e?`default`:`destructive`,children:e?`online`:`offline`})]}),(0,l.jsx)(p,{children:`Local Jun control plane`})]}),(0,l.jsx)(m,{className:`text-sm text-muted-foreground`,children:e?(0,l.jsxs)(`p`,{className:`truncate`,title:e.workspaceRoot,children:[`project `,(0,l.jsx)(`span`,{className:`text-foreground`,children:e.projectId}),` · up `,e.uptimeSeconds,`s`]}):(0,l.jsx)(`p`,{children:`Waiting for daemon…`})})]}),(0,l.jsxs)(u,{children:[(0,l.jsxs)(d,{children:[(0,l.jsxs)(f,{className:`flex items-center justify-between`,children:[`Codex runs`,n!==null&&(0,l.jsxs)(s,{variant:n>0?`default`:`secondary`,children:[n,` active`]})]}),(0,l.jsx)(p,{children:`Agent activity in this workspace`})]}),(0,l.jsx)(m,{children:(0,l.jsx)(o,{size:`sm`,render:(0,l.jsx)(a,{to:`/runs`}),children:`Open Runs`})})]}),(0,l.jsxs)(u,{children:[(0,l.jsxs)(d,{children:[(0,l.jsx)(f,{children:`Dynamic widgets`}),(0,l.jsx)(p,{children:`JSON Render widgets arrive in Phase 7 — this grid is their home.`})]}),(0,l.jsx)(m,{children:(0,l.jsx)(o,{variant:`secondary`,size:`sm`,render:(0,l.jsx)(a,{to:`/files`}),children:`Browse workspace`})})]})]})]})}export{h as DashboardPage};
1
+ import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{I as r,t as i}from"./utils-BX1Diber.js";import{tn as a}from"./index-DXYsuK0q.js";import{t as o}from"./button-Cg-0y2B2.js";import{t as s}from"./badge-DjyNiZCE.js";var c=e(t(),1),l=n();function u({className:e,size:t=`default`,...n}){return(0,l.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:i(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function d({className:e,...t}){return(0,l.jsx)(`div`,{"data-slot":`card-header`,className:i(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3`,e),...t})}function f({className:e,...t}){return(0,l.jsx)(`div`,{"data-slot":`card-title`,className:i(`text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...t})}function p({className:e,...t}){return(0,l.jsx)(`div`,{"data-slot":`card-description`,className:i(`text-sm text-muted-foreground`,e),...t})}function m({className:e,...t}){return(0,l.jsx)(`div`,{"data-slot":`card-content`,className:i(`px-4 group-data-[size=sm]/card:px-3`,e),...t})}function h(){let[e,t]=(0,c.useState)(null),[n,i]=(0,c.useState)(null);return(0,c.useEffect)(()=>{r(`/api/status`).then(t).catch(()=>{}),r(`/api/runs`).then(({runs:e})=>i(e.filter(e=>[`queued`,`starting`,`running`,`waiting_approval`].includes(e.status)).length)).catch(()=>{})},[]),(0,l.jsxs)(`div`,{className:`page`,children:[(0,l.jsx)(`h1`,{children:`Dashboard`}),(0,l.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:[(0,l.jsxs)(u,{children:[(0,l.jsxs)(d,{children:[(0,l.jsxs)(f,{className:`flex items-center justify-between`,children:[`Daemon`,(0,l.jsx)(s,{variant:e?`default`:`destructive`,children:e?`online`:`offline`})]}),(0,l.jsx)(p,{children:`Local Jun control plane`})]}),(0,l.jsx)(m,{className:`text-sm text-muted-foreground`,children:e?(0,l.jsxs)(`p`,{className:`truncate`,title:e.workspaceRoot,children:[`project `,(0,l.jsx)(`span`,{className:`text-foreground`,children:e.projectId}),` · up `,e.uptimeSeconds,`s`]}):(0,l.jsx)(`p`,{children:`Waiting for daemon…`})})]}),(0,l.jsxs)(u,{children:[(0,l.jsxs)(d,{children:[(0,l.jsxs)(f,{className:`flex items-center justify-between`,children:[`Codex runs`,n!==null&&(0,l.jsxs)(s,{variant:n>0?`default`:`secondary`,children:[n,` active`]})]}),(0,l.jsx)(p,{children:`Agent activity in this workspace`})]}),(0,l.jsx)(m,{children:(0,l.jsx)(o,{size:`sm`,render:(0,l.jsx)(a,{to:`/runs`}),children:`Open Runs`})})]}),(0,l.jsxs)(u,{children:[(0,l.jsxs)(d,{children:[(0,l.jsx)(f,{children:`Dynamic widgets`}),(0,l.jsx)(p,{children:`JSON Render widgets arrive in Phase 7 — this grid is their home.`})]}),(0,l.jsx)(m,{children:(0,l.jsx)(o,{variant:`secondary`,size:`sm`,render:(0,l.jsx)(a,{to:`/files`}),children:`Browse workspace`})})]})]})]})}export{h as DashboardPage};
@@ -1,4 +1,4 @@
1
- import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{B as r,H as i,I as a,L as o,V as s,t as c,z as l}from"./utils-BX1Diber.js";import{x as u}from"./useBaseUiId-dSIElxm7.js";import{i as d,n as f,r as p,t as m}from"./collapsible-BdLJt-lG.js";import{Xt as h,en as ee}from"./index-j386AZTn.js";var g=u(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),_=u(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),v=e(t(),1),y=n(),b=(0,v.createContext)({expandedPaths:new Set,togglePath:()=>{}}),x=({expanded:e,defaultExpanded:t=new Set,selectedPath:n,onSelect:r,onExpandedChange:i,className:a,children:o,...s})=>{let[l,u]=(0,v.useState)(t),d=e??l,f=(0,v.useCallback)(e=>{let t=new Set(d);t.has(e)?t.delete(e):t.add(e),u(t),i?.(t)},[d,i]),p=(0,v.useMemo)(()=>({expandedPaths:d,onSelect:r,selectedPath:n,togglePath:f}),[d,r,n,f]);return(0,y.jsx)(b.Provider,{value:p,children:(0,y.jsx)(`div`,{className:c(`rounded-lg border bg-background font-mono text-sm`,a),role:`tree`,...s,children:(0,y.jsx)(`div`,{className:`p-2`,children:o})})})},S=({className:e,children:t,...n})=>(0,y.jsx)(`span`,{className:c(`shrink-0`,e),...n,children:t}),C=({className:e,children:t,...n})=>(0,y.jsx)(`span`,{className:c(`truncate`,e),...n,children:t}),w=(0,v.createContext)({isExpanded:!1,name:``,path:``}),T=({path:e,name:t,className:n,children:r,...i})=>{let{expandedPaths:a,togglePath:o,selectedPath:s,onSelect:l}=(0,v.useContext)(b),u=a.has(e),ee=s===e,g=(0,v.useCallback)(()=>{o(e)},[o,e]),x=(0,v.useCallback)(()=>{l?.(e)},[l,e]),T=(0,v.useMemo)(()=>({isExpanded:u,name:t,path:e}),[u,t,e]);return(0,y.jsx)(w.Provider,{value:T,children:(0,y.jsx)(m,{onOpenChange:g,open:u,children:(0,y.jsxs)(`div`,{className:c(``,n),role:`treeitem`,tabIndex:0,...i,children:[(0,y.jsxs)(`div`,{className:c(`flex w-full items-center gap-1 rounded px-2 py-1 text-left transition-colors hover:bg-muted/50`,ee&&`bg-muted`),children:[(0,y.jsx)(p,{className:`flex shrink-0 cursor-pointer items-center border-none bg-transparent p-0`,children:(0,y.jsx)(d,{className:c(`size-4 shrink-0 text-muted-foreground transition-transform`,u&&`rotate-90`)})}),(0,y.jsxs)(`button`,{className:`flex min-w-0 flex-1 cursor-pointer items-center gap-1 border-none bg-transparent p-0 text-left`,onClick:x,type:`button`,children:[(0,y.jsx)(S,{children:u?(0,y.jsx)(h,{className:`size-4`}):(0,y.jsx)(_,{className:`size-4`})}),(0,y.jsx)(C,{children:t})]})]}),(0,y.jsx)(f,{children:(0,y.jsx)(`div`,{className:`ml-4 border-l pl-2`,children:r})})]})})})},E=(0,v.createContext)({name:``,path:``}),D=({path:e,name:t,icon:n,className:r,children:i,...a})=>{let{selectedPath:o,onSelect:s}=(0,v.useContext)(b),l=o===e,u=(0,v.useCallback)(()=>{s?.(e)},[s,e]),d=(0,v.useCallback)(t=>{(t.key===`Enter`||t.key===` `)&&s?.(e)},[s,e]),f=(0,v.useMemo)(()=>({name:t,path:e}),[t,e]);return(0,y.jsx)(E.Provider,{value:f,children:(0,y.jsx)(`div`,{className:c(`flex cursor-pointer items-center gap-1 rounded px-2 py-1 transition-colors hover:bg-muted/50`,l&&`bg-muted`,r),onClick:u,onKeyDown:d,role:`treeitem`,tabIndex:0,...a,children:i??(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`size-4 shrink-0`}),(0,y.jsx)(S,{children:n??(0,y.jsx)(g,{className:`size-4 text-muted-foreground`})}),(0,y.jsx)(C,{children:t})]})})})};function te({root:e,selectedPath:t,expanded:n,onSelect:r,onToggle:i}){let a=new Map;return ne(e,a),(0,y.jsx)(x,{className:`ai-file-tree`,expanded:n,selectedPath:t??void 0,onExpandedChange:e=>{let t=re(n,e);t&&i(t)},onSelect:e=>{let t=a.get(e);t&&r(t)},children:(e.children??[]).map(e=>(0,y.jsx)(O,{node:e},e.path))})}function O({node:e}){return e.type===`dir`?(0,y.jsx)(T,{name:e.name,path:e.path,children:(e.children??[]).map(e=>(0,y.jsx)(O,{node:e},e.path))}):(0,y.jsx)(D,{name:e.name,path:e.path})}function ne(e,t){t.set(e.path,e);for(let n of e.children??[])ne(n,t)}function re(e,t){for(let n of t)if(!e.has(n))return n;for(let n of e)if(!t.has(n))return n;return null}function k(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var A=k();function ie(e){A=e}var j={exec:()=>null};function M(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function N(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(P.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var ae=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),P={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:M(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:M(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:M(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:M(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:M(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:M(e=>RegExp(`^ {0,${e}}>`))},oe=/^(?:[ \t]*(?:\n|$))+/,se=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ce=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,F=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,le=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ue=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,de=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,fe=N(de).replace(/bull/g,ue).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),pe=N(de).replace(/bull/g,ue).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),me=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,he=/^[^\n]+/,I=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ge=N(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,I).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),_e=N(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ue).getRegex(),L=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,R=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ve=N(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,R).replace(`tag`,L).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ye=N(me).replace(`hr`,F).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,L).getRegex(),z={blockquote:N(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,ye).getRegex(),code:se,def:ge,fences:ce,heading:le,hr:F,html:ve,lheading:fe,list:_e,newline:oe,paragraph:ye,table:j,text:he},be=N(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,F).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,L).getRegex(),xe={...z,lheading:pe,table:be,paragraph:N(me).replace(`hr`,F).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,be).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,L).getRegex()},Se={...z,html:N(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,R).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:j,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:N(me).replace(`hr`,F).replace(`heading`,` *#{1,6} *[^
1
+ import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{B as r,H as i,I as a,L as o,V as s,t as c,z as l}from"./utils-BX1Diber.js";import{x as u}from"./useBaseUiId-dSIElxm7.js";import{i as d,n as f,r as p,t as m}from"./collapsible-0tqcZUWD.js";import{Xt as h,en as ee}from"./index-DXYsuK0q.js";var g=u(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),_=u(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),v=e(t(),1),y=n(),b=(0,v.createContext)({expandedPaths:new Set,togglePath:()=>{}}),x=({expanded:e,defaultExpanded:t=new Set,selectedPath:n,onSelect:r,onExpandedChange:i,className:a,children:o,...s})=>{let[l,u]=(0,v.useState)(t),d=e??l,f=(0,v.useCallback)(e=>{let t=new Set(d);t.has(e)?t.delete(e):t.add(e),u(t),i?.(t)},[d,i]),p=(0,v.useMemo)(()=>({expandedPaths:d,onSelect:r,selectedPath:n,togglePath:f}),[d,r,n,f]);return(0,y.jsx)(b.Provider,{value:p,children:(0,y.jsx)(`div`,{className:c(`rounded-lg border bg-background font-mono text-sm`,a),role:`tree`,...s,children:(0,y.jsx)(`div`,{className:`p-2`,children:o})})})},S=({className:e,children:t,...n})=>(0,y.jsx)(`span`,{className:c(`shrink-0`,e),...n,children:t}),C=({className:e,children:t,...n})=>(0,y.jsx)(`span`,{className:c(`truncate`,e),...n,children:t}),w=(0,v.createContext)({isExpanded:!1,name:``,path:``}),T=({path:e,name:t,className:n,children:r,...i})=>{let{expandedPaths:a,togglePath:o,selectedPath:s,onSelect:l}=(0,v.useContext)(b),u=a.has(e),ee=s===e,g=(0,v.useCallback)(()=>{o(e)},[o,e]),x=(0,v.useCallback)(()=>{l?.(e)},[l,e]),T=(0,v.useMemo)(()=>({isExpanded:u,name:t,path:e}),[u,t,e]);return(0,y.jsx)(w.Provider,{value:T,children:(0,y.jsx)(m,{onOpenChange:g,open:u,children:(0,y.jsxs)(`div`,{className:c(``,n),role:`treeitem`,tabIndex:0,...i,children:[(0,y.jsxs)(`div`,{className:c(`flex w-full items-center gap-1 rounded px-2 py-1 text-left transition-colors hover:bg-muted/50`,ee&&`bg-muted`),children:[(0,y.jsx)(p,{className:`flex shrink-0 cursor-pointer items-center border-none bg-transparent p-0`,children:(0,y.jsx)(d,{className:c(`size-4 shrink-0 text-muted-foreground transition-transform`,u&&`rotate-90`)})}),(0,y.jsxs)(`button`,{className:`flex min-w-0 flex-1 cursor-pointer items-center gap-1 border-none bg-transparent p-0 text-left`,onClick:x,type:`button`,children:[(0,y.jsx)(S,{children:u?(0,y.jsx)(h,{className:`size-4`}):(0,y.jsx)(_,{className:`size-4`})}),(0,y.jsx)(C,{children:t})]})]}),(0,y.jsx)(f,{children:(0,y.jsx)(`div`,{className:`ml-4 border-l pl-2`,children:r})})]})})})},E=(0,v.createContext)({name:``,path:``}),D=({path:e,name:t,icon:n,className:r,children:i,...a})=>{let{selectedPath:o,onSelect:s}=(0,v.useContext)(b),l=o===e,u=(0,v.useCallback)(()=>{s?.(e)},[s,e]),d=(0,v.useCallback)(t=>{(t.key===`Enter`||t.key===` `)&&s?.(e)},[s,e]),f=(0,v.useMemo)(()=>({name:t,path:e}),[t,e]);return(0,y.jsx)(E.Provider,{value:f,children:(0,y.jsx)(`div`,{className:c(`flex cursor-pointer items-center gap-1 rounded px-2 py-1 transition-colors hover:bg-muted/50`,l&&`bg-muted`,r),onClick:u,onKeyDown:d,role:`treeitem`,tabIndex:0,...a,children:i??(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`size-4 shrink-0`}),(0,y.jsx)(S,{children:n??(0,y.jsx)(g,{className:`size-4 text-muted-foreground`})}),(0,y.jsx)(C,{children:t})]})})})};function te({root:e,selectedPath:t,expanded:n,onSelect:r,onToggle:i}){let a=new Map;return ne(e,a),(0,y.jsx)(x,{className:`ai-file-tree`,expanded:n,selectedPath:t??void 0,onExpandedChange:e=>{let t=re(n,e);t&&i(t)},onSelect:e=>{let t=a.get(e);t&&r(t)},children:(e.children??[]).map(e=>(0,y.jsx)(O,{node:e},e.path))})}function O({node:e}){return e.type===`dir`?(0,y.jsx)(T,{name:e.name,path:e.path,children:(e.children??[]).map(e=>(0,y.jsx)(O,{node:e},e.path))}):(0,y.jsx)(D,{name:e.name,path:e.path})}function ne(e,t){t.set(e.path,e);for(let n of e.children??[])ne(n,t)}function re(e,t){for(let n of t)if(!e.has(n))return n;for(let n of e)if(!t.has(n))return n;return null}function k(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var A=k();function ie(e){A=e}var j={exec:()=>null};function M(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function N(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(P.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var ae=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),P={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:M(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:M(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:M(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:M(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:M(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:M(e=>RegExp(`^ {0,${e}}>`))},oe=/^(?:[ \t]*(?:\n|$))+/,se=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ce=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,F=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,le=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ue=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,de=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,fe=N(de).replace(/bull/g,ue).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),pe=N(de).replace(/bull/g,ue).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),me=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,he=/^[^\n]+/,I=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ge=N(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,I).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),_e=N(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ue).getRegex(),L=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,R=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ve=N(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,R).replace(`tag`,L).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ye=N(me).replace(`hr`,F).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,L).getRegex(),z={blockquote:N(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,ye).getRegex(),code:se,def:ge,fences:ce,heading:le,hr:F,html:ve,lheading:fe,list:_e,newline:oe,paragraph:ye,table:j,text:he},be=N(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,F).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,L).getRegex(),xe={...z,lheading:pe,table:be,paragraph:N(me).replace(`hr`,F).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,be).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,L).getRegex()},Se={...z,html:N(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,R).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:j,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:N(me).replace(`hr`,F).replace(`heading`,` *#{1,6} *[^
2
2
  ]`).replace(`lheading`,fe).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Ce=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,we=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Te=/^( {2,}|\\)\n(?!\s*$)/,Ee=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,B=/[\p{P}\p{S}]/u,V=/[\s\p{P}\p{S}]/u,De=/[^\s\p{P}\p{S}]/u,Oe=N(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,V).getRegex(),ke=/(?!~)[\p{P}\p{S}]/u,Ae=/(?!~)[\s\p{P}\p{S}]/u,je=/(?:[^\s\p{P}\p{S}]|~)/u,Me=N(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,ae?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Ne=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Pe=N(Ne,`u`).replace(/punct/g,B).getRegex(),Fe=N(Ne,`u`).replace(/punct/g,ke).getRegex(),Ie=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Le=N(Ie,`gu`).replace(/notPunctSpace/g,De).replace(/punctSpace/g,V).replace(/punct/g,B).getRegex(),Re=N(Ie,`gu`).replace(/notPunctSpace/g,je).replace(/punctSpace/g,Ae).replace(/punct/g,ke).getRegex(),ze=N(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,De).replace(/punctSpace/g,V).replace(/punct/g,B).getRegex(),Be=N(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,B).getRegex(),Ve=N(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,De).replace(/punctSpace/g,V).replace(/punct/g,B).getRegex(),He=N(/\\(punct)/,`gu`).replace(/punct/g,B).getRegex(),Ue=N(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),We=N(R).replace(`(?:-->|$)`,`-->`).getRegex(),Ge=N(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,We).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),H=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ke=N(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,H).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),qe=N(/^!?\[(label)\]\[(ref)\]/).replace(`label`,H).replace(`ref`,I).getRegex(),Je=N(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,I).getRegex(),Ye=N(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,qe).replace(`nolink`,Je).getRegex(),Xe=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ze={_backpedal:j,anyPunctuation:He,autolink:Ue,blockSkip:Me,br:Te,code:we,del:j,delLDelim:j,delRDelim:j,emStrongLDelim:Pe,emStrongRDelimAst:Le,emStrongRDelimUnd:ze,escape:Ce,link:Ke,nolink:Je,punctuation:Oe,reflink:qe,reflinkSearch:Ye,tag:Ge,text:Ee,url:j},Qe={...Ze,link:N(/^!?\[(label)\]\((.*?)\)/).replace(`label`,H).getRegex(),reflink:N(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,H).getRegex()},$e={...Ze,emStrongRDelimAst:Re,emStrongLDelim:Fe,delLDelim:Be,delRDelim:Ve,url:N(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Xe).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:N(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Xe).getRegex()},et={...$e,br:N(Te).replace(`{2,}`,`*`).getRegex(),text:N($e.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},U={normal:z,gfm:xe,pedantic:Se},W={normal:Ze,gfm:$e,breaks:et,pedantic:Qe},tt={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},nt=e=>tt[e];function G(e,t){if(t){if(P.escapeTest.test(e))return e.replace(P.escapeReplace,nt)}else if(P.escapeTestNoEncode.test(e))return e.replace(P.escapeReplaceNoEncode,nt);return e}function rt(e){try{e=encodeURI(e).replace(P.percentDecode,`%`)}catch{return null}return e}function it(e,t){let n=e.replace(P.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(P.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(P.slashPipe,`|`);return n}function K(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function at(e){let t=e.split(`
3
3
  `),n=t.length-1;for(;n>=0&&P.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
4
4
  `)}function ot(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function st(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function ct(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function lt(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
@@ -1 +1 @@
1
- import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{F as r,I as i,L as a,R as o,t as s}from"./utils-BX1Diber.js";import{x as c}from"./useBaseUiId-dSIElxm7.js";import{i as l,n as u,r as d,t as f}from"./collapsible-BdLJt-lG.js";import{t as p}from"./circle-x-BSTd_gmE.js";import{t as m}from"./key-round-D965pLEl.js";import{a as h,i as g,n as _,r as v,t as y}from"./tabs-DS9zR4V0.js";import{E as b}from"./useCompositeListItem-BQ4RLkNZ.js";import{t as x}from"./rotate-cw-B1ZRM7VI.js";import{n as S,t as C}from"./textarea-BkUbRqKD.js";import{a as w,i as T,o as E,r as D,s as O,t as k}from"./dialog-Bl8-9u35.js";import{qt as A}from"./index-j386AZTn.js";import{t as j}from"./button-Cg-0y2B2.js";import{t as M}from"./input-D4O22yGt.js";import{t as N}from"./badge-DjyNiZCE.js";import{t as P}from"./label-CxX4-RmK.js";var F=c(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),I=c(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),L=e(t(),1),R=n();function z({server:e}){if(!e.enabled)return(0,R.jsx)(N,{variant:`outline`,children:`disabled`});switch(e.startupState){case`ready`:return(0,R.jsxs)(N,{variant:`secondary`,className:`gap-1`,children:[(0,R.jsx)(F,{className:`size-3 text-emerald-600`}),` ready`]});case`starting`:return(0,R.jsxs)(N,{variant:`secondary`,className:`gap-1`,children:[(0,R.jsx)(h,{className:`size-3 animate-spin`}),` starting`]});case`failed`:case`cancelled`:return(0,R.jsxs)(N,{variant:`outline`,className:`gap-1 text-destructive`,children:[(0,R.jsx)(p,{className:`size-3`}),` `,e.startupState]});default:return(0,R.jsxs)(N,{variant:`outline`,className:`gap-1`,children:[(0,R.jsx)(I,{className:`size-3`}),` not connected`]})}}function B(){let[e,t]=(0,L.useState)([]),[n,c]=(0,L.useState)(``),[p,h]=(0,L.useState)(!1),[w,T]=(0,L.useState)(null),[E,D]=(0,L.useState)(!1),[O,k]=(0,L.useState)(null),[M,P]=(0,L.useState)(!1),F=(0,L.useCallback)(async()=>{try{let[{servers:e},{toml:n}]=await Promise.all([i(`/api/mcp`),i(`/api/mcp/config`)]);t(e),p||c(n),T(null)}catch(e){T(e instanceof Error?e.message:String(e))}},[p]);(0,L.useEffect)(()=>{F()},[F]);let I=(0,L.useCallback)(async e=>{D(!0),T(null);try{await e(),await F()}catch(e){T(e instanceof Error?e.message:String(e))}finally{D(!1)}},[F]),B=()=>I(()=>a(`/api/mcp/reload`)),H=()=>I(async()=>{await o(`/api/mcp/config`,{toml:n}),h(!1),await a(`/api/mcp/reload`)}),U=e=>I(async()=>{await a(`/api/mcp/servers/${e.name}/enable`,{enabled:!e.enabled}),await a(`/api/mcp/reload`)}),W=e=>I(async()=>{window.confirm(`Remove MCP server "${e}"?`)&&(await r(`/api/mcp/servers/${e}`),await a(`/api/mcp/reload`))});return(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 p-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`h1`,{className:`text-base font-semibold`,children:`MCP servers`}),(0,R.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,R.jsxs)(j,{size:`sm`,variant:`outline`,onClick:B,disabled:E,children:[(0,R.jsx)(x,{className:`size-3.5`}),` Reload`]}),(0,R.jsxs)(j,{size:`sm`,onClick:()=>P(!0),disabled:E,children:[(0,R.jsx)(b,{className:`size-3.5`}),` Add server`]})]})]}),w&&(0,R.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:w}),(0,R.jsxs)(y,{defaultValue:`servers`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(v,{children:[(0,R.jsx)(g,{value:`servers`,children:`Servers`}),(0,R.jsx)(g,{value:`toml`,children:`config.toml`})]}),(0,R.jsx)(_,{value:`servers`,className:`min-h-0 flex-1 overflow-auto pt-2`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.map(e=>(0,R.jsx)(`div`,{className:`rounded-lg border bg-card`,children:(0,R.jsxs)(f,{open:O===e.name,onOpenChange:t=>k(t?e.name:null),children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,R.jsx)(A,{className:`size-4 shrink-0 text-muted-foreground`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,R.jsx)(z,{server:e}),e.tools.length>0&&(0,R.jsxs)(N,{variant:`outline`,children:[e.tools.length,` tools`]}),e.authStatus===`notLoggedIn`&&(0,R.jsxs)(N,{variant:`outline`,className:`gap-1`,children:[(0,R.jsx)(m,{className:`size-3`}),` login required`]})]}),(0,R.jsx)(`code`,{className:`block truncate text-xs text-muted-foreground`,children:e.url??[e.command,...e.args??[]].join(` `)}),e.envKeys&&e.envKeys.length>0&&(0,R.jsxs)(`div`,{className:`text-xs text-muted-foreground/70`,children:[`env: `,e.envKeys.map(e=>`${e}=••••`).join(` `)]})]}),(0,R.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>U(e),disabled:E,children:e.enabled?`Disable`:`Enable`}),(0,R.jsx)(j,{size:`icon-sm`,variant:`ghost`,className:`text-destructive hover:text-destructive`,onClick:()=>W(e.name),disabled:E,children:(0,R.jsx)(S,{})}),e.tools.length>0&&(0,R.jsx)(d,{className:`flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted`,children:(0,R.jsx)(l,{className:s(`size-4 transition-transform`,O===e.name&&`rotate-90`)})})]}),(0,R.jsx)(u,{children:(0,R.jsx)(`div`,{className:`grid gap-1 border-t p-3 sm:grid-cols-2`,children:e.tools.map(e=>(0,R.jsxs)(`div`,{className:`rounded-md bg-muted/40 px-2 py-1.5`,children:[(0,R.jsx)(`code`,{className:`text-xs font-medium`,children:e.name}),e.description&&(0,R.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,title:e.description,children:e.description})]},e.name))})})]})},e.name)),e.length===0&&(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-12 text-center text-sm text-muted-foreground`,children:[(0,R.jsx)(A,{className:`size-8`}),`No MCP servers configured. Add one to give Codex extra tools.`]})]})}),(0,R.jsxs)(_,{value:`toml`,className:`flex min-h-0 flex-1 flex-col gap-2 pt-2`,children:[(0,R.jsx)(C,{value:n,spellCheck:!1,className:`min-h-0 flex-1 resize-none font-mono text-sm`,onChange:e=>{c(e.target.value),h(!0)}}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(j,{size:`sm`,onClick:H,disabled:!p||E,children:E?`Saving…`:`Save & reload`}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Editing here preserves your comments; structured edits reformat the file.`})]})]})]}),(0,R.jsx)(V,{open:M,onOpenChange:P,onAdded:()=>I(()=>a(`/api/mcp/reload`))})]})}function V({open:e,onOpenChange:t,onAdded:n}){let[r,i]=(0,L.useState)(``),[o,s]=(0,L.useState)(``),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(null),[m,h]=(0,L.useState)(!1);return(0,R.jsx)(k,{open:e,onOpenChange:t,children:(0,R.jsxs)(D,{children:[(0,R.jsxs)(E,{children:[(0,R.jsx)(O,{children:`Add MCP server`}),(0,R.jsxs)(T,{children:[`A stdio command server (e.g. `,(0,R.jsx)(`code`,{children:`npx -y @scope/pkg`}),`). For URL or advanced transports, use the config.toml tab.`]})]}),f&&(0,R.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:f}),(0,R.jsxs)(`div`,{className:`grid gap-3`,children:[(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(P,{htmlFor:`mcp-name`,children:`Name`}),(0,R.jsx)(M,{id:`mcp-name`,value:r,placeholder:`context7`,onChange:e=>i(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(P,{htmlFor:`mcp-command`,children:`Command`}),(0,R.jsx)(M,{id:`mcp-command`,value:o,placeholder:`npx`,onChange:e=>s(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(P,{htmlFor:`mcp-args`,children:`Args (space-separated)`}),(0,R.jsx)(M,{id:`mcp-args`,value:c,placeholder:`-y @upstash/context7-mcp`,onChange:e=>l(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(P,{htmlFor:`mcp-env`,children:`Env (KEY=value per line)`}),(0,R.jsx)(C,{id:`mcp-env`,value:u,rows:3,placeholder:`API_KEY=sk-…`,onChange:e=>d(e.target.value)})]})]}),(0,R.jsxs)(w,{children:[(0,R.jsx)(j,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,R.jsx)(j,{onClick:async()=>{h(!0),p(null);try{let e={};for(let t of u.split(/\r?\n/)){let n=t.indexOf(`=`);n>0&&(e[t.slice(0,n).trim()]=t.slice(n+1).trim())}await a(`/api/mcp/servers`,{name:r.trim(),command:o.trim()||void 0,args:c.trim()?c.trim().split(/\s+/):void 0,env:Object.keys(e).length>0?e:void 0}),t(!1),i(``),s(``),l(``),d(``),n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}},disabled:m||r.trim().length===0||o.trim().length===0,children:m?`Adding…`:`Add & reload`})]})]})})}export{B as McpPage};
1
+ import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{F as r,I as i,L as a,R as o,t as s}from"./utils-BX1Diber.js";import{x as c}from"./useBaseUiId-dSIElxm7.js";import{i as l,n as u,r as d,t as f}from"./collapsible-0tqcZUWD.js";import{t as p}from"./circle-x-BSTd_gmE.js";import{t as m}from"./key-round-D965pLEl.js";import{a as h,i as g,n as _,r as v,t as y}from"./tabs-BUCI-mwA.js";import{E as b}from"./useCompositeListItem-BMeUcGkY.js";import{t as x}from"./rotate-cw-B1ZRM7VI.js";import{n as S,t as C}from"./textarea-BkUbRqKD.js";import{a as w,i as T,o as E,r as D,s as O,t as k}from"./dialog-gLEpdaG1.js";import{qt as A}from"./index-DXYsuK0q.js";import{t as j}from"./button-Cg-0y2B2.js";import{t as M}from"./input-BPTmfk5i.js";import{t as N}from"./badge-DjyNiZCE.js";import{t as P}from"./label-CxX4-RmK.js";var F=c(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),I=c(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),L=e(t(),1),R=n();function z({server:e}){if(!e.enabled)return(0,R.jsx)(N,{variant:`outline`,children:`disabled`});switch(e.startupState){case`ready`:return(0,R.jsxs)(N,{variant:`secondary`,className:`gap-1`,children:[(0,R.jsx)(F,{className:`size-3 text-emerald-600`}),` ready`]});case`starting`:return(0,R.jsxs)(N,{variant:`secondary`,className:`gap-1`,children:[(0,R.jsx)(h,{className:`size-3 animate-spin`}),` starting`]});case`failed`:case`cancelled`:return(0,R.jsxs)(N,{variant:`outline`,className:`gap-1 text-destructive`,children:[(0,R.jsx)(p,{className:`size-3`}),` `,e.startupState]});default:return(0,R.jsxs)(N,{variant:`outline`,className:`gap-1`,children:[(0,R.jsx)(I,{className:`size-3`}),` not connected`]})}}function B(){let[e,t]=(0,L.useState)([]),[n,c]=(0,L.useState)(``),[p,h]=(0,L.useState)(!1),[w,T]=(0,L.useState)(null),[E,D]=(0,L.useState)(!1),[O,k]=(0,L.useState)(null),[M,P]=(0,L.useState)(!1),F=(0,L.useCallback)(async()=>{try{let[{servers:e},{toml:n}]=await Promise.all([i(`/api/mcp`),i(`/api/mcp/config`)]);t(e),p||c(n),T(null)}catch(e){T(e instanceof Error?e.message:String(e))}},[p]);(0,L.useEffect)(()=>{F()},[F]);let I=(0,L.useCallback)(async e=>{D(!0),T(null);try{await e(),await F()}catch(e){T(e instanceof Error?e.message:String(e))}finally{D(!1)}},[F]),B=()=>I(()=>a(`/api/mcp/reload`)),H=()=>I(async()=>{await o(`/api/mcp/config`,{toml:n}),h(!1),await a(`/api/mcp/reload`)}),U=e=>I(async()=>{await a(`/api/mcp/servers/${e.name}/enable`,{enabled:!e.enabled}),await a(`/api/mcp/reload`)}),W=e=>I(async()=>{window.confirm(`Remove MCP server "${e}"?`)&&(await r(`/api/mcp/servers/${e}`),await a(`/api/mcp/reload`))});return(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 p-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`h1`,{className:`text-base font-semibold`,children:`MCP servers`}),(0,R.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,R.jsxs)(j,{size:`sm`,variant:`outline`,onClick:B,disabled:E,children:[(0,R.jsx)(x,{className:`size-3.5`}),` Reload`]}),(0,R.jsxs)(j,{size:`sm`,onClick:()=>P(!0),disabled:E,children:[(0,R.jsx)(b,{className:`size-3.5`}),` Add server`]})]})]}),w&&(0,R.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:w}),(0,R.jsxs)(y,{defaultValue:`servers`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(v,{children:[(0,R.jsx)(g,{value:`servers`,children:`Servers`}),(0,R.jsx)(g,{value:`toml`,children:`config.toml`})]}),(0,R.jsx)(_,{value:`servers`,className:`min-h-0 flex-1 overflow-auto pt-2`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.map(e=>(0,R.jsx)(`div`,{className:`rounded-lg border bg-card`,children:(0,R.jsxs)(f,{open:O===e.name,onOpenChange:t=>k(t?e.name:null),children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,R.jsx)(A,{className:`size-4 shrink-0 text-muted-foreground`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,R.jsx)(z,{server:e}),e.tools.length>0&&(0,R.jsxs)(N,{variant:`outline`,children:[e.tools.length,` tools`]}),e.authStatus===`notLoggedIn`&&(0,R.jsxs)(N,{variant:`outline`,className:`gap-1`,children:[(0,R.jsx)(m,{className:`size-3`}),` login required`]})]}),(0,R.jsx)(`code`,{className:`block truncate text-xs text-muted-foreground`,children:e.url??[e.command,...e.args??[]].join(` `)}),e.envKeys&&e.envKeys.length>0&&(0,R.jsxs)(`div`,{className:`text-xs text-muted-foreground/70`,children:[`env: `,e.envKeys.map(e=>`${e}=••••`).join(` `)]})]}),(0,R.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>U(e),disabled:E,children:e.enabled?`Disable`:`Enable`}),(0,R.jsx)(j,{size:`icon-sm`,variant:`ghost`,className:`text-destructive hover:text-destructive`,onClick:()=>W(e.name),disabled:E,children:(0,R.jsx)(S,{})}),e.tools.length>0&&(0,R.jsx)(d,{className:`flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted`,children:(0,R.jsx)(l,{className:s(`size-4 transition-transform`,O===e.name&&`rotate-90`)})})]}),(0,R.jsx)(u,{children:(0,R.jsx)(`div`,{className:`grid gap-1 border-t p-3 sm:grid-cols-2`,children:e.tools.map(e=>(0,R.jsxs)(`div`,{className:`rounded-md bg-muted/40 px-2 py-1.5`,children:[(0,R.jsx)(`code`,{className:`text-xs font-medium`,children:e.name}),e.description&&(0,R.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,title:e.description,children:e.description})]},e.name))})})]})},e.name)),e.length===0&&(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-12 text-center text-sm text-muted-foreground`,children:[(0,R.jsx)(A,{className:`size-8`}),`No MCP servers configured. Add one to give Codex extra tools.`]})]})}),(0,R.jsxs)(_,{value:`toml`,className:`flex min-h-0 flex-1 flex-col gap-2 pt-2`,children:[(0,R.jsx)(C,{value:n,spellCheck:!1,className:`min-h-0 flex-1 resize-none font-mono text-sm`,onChange:e=>{c(e.target.value),h(!0)}}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(j,{size:`sm`,onClick:H,disabled:!p||E,children:E?`Saving…`:`Save & reload`}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Editing here preserves your comments; structured edits reformat the file.`})]})]})]}),(0,R.jsx)(V,{open:M,onOpenChange:P,onAdded:()=>I(()=>a(`/api/mcp/reload`))})]})}function V({open:e,onOpenChange:t,onAdded:n}){let[r,i]=(0,L.useState)(``),[o,s]=(0,L.useState)(``),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(null),[m,h]=(0,L.useState)(!1);return(0,R.jsx)(k,{open:e,onOpenChange:t,children:(0,R.jsxs)(D,{children:[(0,R.jsxs)(E,{children:[(0,R.jsx)(O,{children:`Add MCP server`}),(0,R.jsxs)(T,{children:[`A stdio command server (e.g. `,(0,R.jsx)(`code`,{children:`npx -y @scope/pkg`}),`). For URL or advanced transports, use the config.toml tab.`]})]}),f&&(0,R.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:f}),(0,R.jsxs)(`div`,{className:`grid gap-3`,children:[(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(P,{htmlFor:`mcp-name`,children:`Name`}),(0,R.jsx)(M,{id:`mcp-name`,value:r,placeholder:`context7`,onChange:e=>i(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(P,{htmlFor:`mcp-command`,children:`Command`}),(0,R.jsx)(M,{id:`mcp-command`,value:o,placeholder:`npx`,onChange:e=>s(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(P,{htmlFor:`mcp-args`,children:`Args (space-separated)`}),(0,R.jsx)(M,{id:`mcp-args`,value:c,placeholder:`-y @upstash/context7-mcp`,onChange:e=>l(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(P,{htmlFor:`mcp-env`,children:`Env (KEY=value per line)`}),(0,R.jsx)(C,{id:`mcp-env`,value:u,rows:3,placeholder:`API_KEY=sk-…`,onChange:e=>d(e.target.value)})]})]}),(0,R.jsxs)(w,{children:[(0,R.jsx)(j,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,R.jsx)(j,{onClick:async()=>{h(!0),p(null);try{let e={};for(let t of u.split(/\r?\n/)){let n=t.indexOf(`=`);n>0&&(e[t.slice(0,n).trim()]=t.slice(n+1).trim())}await a(`/api/mcp/servers`,{name:r.trim(),command:o.trim()||void 0,args:c.trim()?c.trim().split(/\s+/):void 0,env:Object.keys(e).length>0?e:void 0}),t(!1),i(``),s(``),l(``),d(``),n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}},disabled:m||r.trim().length===0||o.trim().length===0,children:m?`Adding…`:`Add & reload`})]})]})})}export{B as McpPage};
@@ -1 +1 @@
1
- import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{F as r,I as i,R as a,t as o}from"./utils-BX1Diber.js";import{t as s}from"./checkbox-Dl42vHZu.js";import{t as c}from"./rotate-cw-B1ZRM7VI.js";import{n as l,t as u}from"./textarea-BkUbRqKD.js";import{Qt as d}from"./index-j386AZTn.js";import{t as f}from"./button-Cg-0y2B2.js";import{t as p}from"./input-D4O22yGt.js";import{t as m}from"./badge-DjyNiZCE.js";import{t as h}from"./label-CxX4-RmK.js";var g=e(t(),1),_=n();function v(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function y(){let[e,t]=(0,g.useState)(null),[n,y]=(0,g.useState)(null),[b,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)(null),[w,T]=(0,g.useState)(``),[E,D]=(0,g.useState)(!1),[O,k]=(0,g.useState)(``),A=(0,g.useCallback)(async()=>{try{let e=await i(`/api/memories`);t(e),k(e.settings.minRateLimitRemainingPercent===void 0?``:String(e.settings.minRateLimitRemainingPercent)),y(null)}catch(e){y(e instanceof Error?e.message:String(e))}},[]);(0,g.useEffect)(()=>{A()},[A]);let j=(0,g.useCallback)(async e=>{x(!0),y(null);try{await e(),await A()}catch(e){y(e instanceof Error?e.message:String(e))}finally{x(!1)}},[A]),M=()=>j(()=>a(`/api/memories/config`,{enabled:!e?.enabled})),N=e=>j(()=>a(`/api/memories/config`,{settings:e})),P=()=>{let e=Number(O);if(!Number.isFinite(e)||e<0||e>100){y(`Rate-limit threshold must be a number between 0 and 100`);return}N({minRateLimitRemainingPercent:e})},F=e=>j(async()=>{let t=await i(`/api/memories/file?path=${encodeURIComponent(e.path)}`);C(t.path),T(t.content),D(!1)}),I=()=>j(async()=>{S&&(await a(`/api/memories/file`,{path:S,content:w}),D(!1))}),L=e=>j(async()=>{window.confirm(`Delete memory file "${e}"?`)&&(await r(`/api/memories/file?path=${encodeURIComponent(e)}`),S===e&&(C(null),T(``),D(!1)))}),R=e?.enabled??!1,z=e?.settings??{},B=e?.files??[];return(0,_.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 p-4`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`h1`,{className:`text-base font-semibold`,children:`Memories`}),(0,_.jsx)(m,{variant:`outline`,children:`beta`}),e&&e.liveEnabled!==null&&e.liveEnabled!==R&&(0,_.jsx)(m,{variant:`outline`,className:`text-amber-600`,children:`engine state differs — restart pending`}),(0,_.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,_.jsxs)(f,{size:`sm`,variant:`outline`,onClick:()=>A(),disabled:b,children:[(0,_.jsx)(c,{className:`size-3.5`}),` Refresh`]}),(0,_.jsx)(f,{size:`sm`,onClick:M,disabled:b||!e,children:R?`Disable`:`Enable`})]})]}),(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Codex turns useful context from past sessions into local memory files and brings them into new conversations. Memories are global across workspaces (they live in the shared Codex home) and are generated in the background — new files can take a while to appear.`}),n&&(0,_.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:n}),(0,_.jsxs)(`div`,{className:o(`flex flex-col gap-3`,!R&&`opacity-60`),children:[(0,_.jsxs)(`div`,{className:`rounded-lg border bg-card p-3`,children:[(0,_.jsx)(`div`,{className:`mb-2 text-sm font-medium`,children:`Behavior`}),(0,_.jsxs)(`div`,{className:`grid gap-2`,children:[(0,_.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(s,{checked:z.generateMemories!==!1,disabled:b||!R,onCheckedChange:e=>N({generateMemories:e===!0})}),`Generate memories from new sessions`]}),(0,_.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(s,{checked:z.useMemories!==!1,disabled:b||!R,onCheckedChange:e=>N({useMemories:e===!0})}),`Use existing memories in new sessions`]}),(0,_.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(s,{checked:z.disableOnExternalContext===!0,disabled:b||!R,onCheckedChange:e=>N({disableOnExternalContext:e===!0})}),`Skip sessions that used external context (MCP tools, web search)`]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(h,{htmlFor:`mem-rate`,className:`font-normal`,children:`Pause generation below`}),(0,_.jsx)(p,{id:`mem-rate`,type:`number`,min:0,max:100,placeholder:`25`,className:`h-7 w-20`,value:O,disabled:b||!R,onChange:e=>k(e.target.value),onBlur:()=>{O!==``&&P()},onKeyDown:e=>{e.key===`Enter`&&O!==``&&P()}}),(0,_.jsx)(`span`,{className:`text-muted-foreground`,children:`% rate limit remaining`})]})]}),(0,_.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:`Behavior settings are read by the engine at startup; the on/off toggle applies immediately.`})]}),(0,_.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-3`,children:[(0,_.jsxs)(`div`,{className:`flex w-72 shrink-0 flex-col gap-1 overflow-auto`,children:[(0,_.jsxs)(`div`,{className:`text-sm font-medium`,children:[`Memory files`,B.length>0&&` (${B.length})`]}),B.map(e=>(0,_.jsxs)(`div`,{className:o(`group flex cursor-pointer items-center gap-2 rounded-md border px-2 py-1.5`,S===e.path?`border-foreground/30 bg-muted/60`:`bg-card hover:bg-muted/40`),onClick:()=>F(e),children:[(0,_.jsx)(d,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`div`,{className:`truncate text-sm`,title:e.path,children:e.path}),(0,_.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[v(e.size),` · `,new Date(e.modifiedAt).toLocaleString()]})]}),(0,_.jsx)(f,{size:`icon-sm`,variant:`ghost`,className:`invisible text-destructive hover:text-destructive group-hover:visible`,disabled:b,onClick:t=>{t.stopPropagation(),L(e.path)},children:(0,_.jsx)(l,{})})]},e.path)),B.length===0&&(0,_.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-10 text-center text-sm text-muted-foreground`,children:[(0,_.jsx)(d,{className:`size-8`}),R?`No memories yet. Codex builds them in the background from finished sessions.`:`Enable memories to let Codex remember context across sessions.`]})]}),(0,_.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2`,children:S?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`code`,{className:`truncate text-xs text-muted-foreground`,children:S}),(0,_.jsx)(f,{size:`sm`,className:`ml-auto`,onClick:I,disabled:!E||b,children:b?`Saving…`:`Save`})]}),(0,_.jsx)(u,{value:w,spellCheck:!1,className:`min-h-0 flex-1 resize-none font-mono text-sm`,onChange:e=>{T(e.target.value),D(!0)}})]}):(0,_.jsx)(`div`,{className:`flex flex-1 items-center justify-center rounded-lg border border-dashed text-sm text-muted-foreground`,children:`Select a memory file to inspect or edit it`})})]})]})]})}export{y as MemoriesPage};
1
+ import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{F as r,I as i,R as a,t as o}from"./utils-BX1Diber.js";import{t as s}from"./checkbox-BO9cBKlP.js";import{t as c}from"./rotate-cw-B1ZRM7VI.js";import{n as l,t as u}from"./textarea-BkUbRqKD.js";import{Qt as d}from"./index-DXYsuK0q.js";import{t as f}from"./button-Cg-0y2B2.js";import{t as p}from"./input-BPTmfk5i.js";import{t as m}from"./badge-DjyNiZCE.js";import{t as h}from"./label-CxX4-RmK.js";var g=e(t(),1),_=n();function v(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function y(){let[e,t]=(0,g.useState)(null),[n,y]=(0,g.useState)(null),[b,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)(null),[w,T]=(0,g.useState)(``),[E,D]=(0,g.useState)(!1),[O,k]=(0,g.useState)(``),A=(0,g.useCallback)(async()=>{try{let e=await i(`/api/memories`);t(e),k(e.settings.minRateLimitRemainingPercent===void 0?``:String(e.settings.minRateLimitRemainingPercent)),y(null)}catch(e){y(e instanceof Error?e.message:String(e))}},[]);(0,g.useEffect)(()=>{A()},[A]);let j=(0,g.useCallback)(async e=>{x(!0),y(null);try{await e(),await A()}catch(e){y(e instanceof Error?e.message:String(e))}finally{x(!1)}},[A]),M=()=>j(()=>a(`/api/memories/config`,{enabled:!e?.enabled})),N=e=>j(()=>a(`/api/memories/config`,{settings:e})),P=()=>{let e=Number(O);if(!Number.isFinite(e)||e<0||e>100){y(`Rate-limit threshold must be a number between 0 and 100`);return}N({minRateLimitRemainingPercent:e})},F=e=>j(async()=>{let t=await i(`/api/memories/file?path=${encodeURIComponent(e.path)}`);C(t.path),T(t.content),D(!1)}),I=()=>j(async()=>{S&&(await a(`/api/memories/file`,{path:S,content:w}),D(!1))}),L=e=>j(async()=>{window.confirm(`Delete memory file "${e}"?`)&&(await r(`/api/memories/file?path=${encodeURIComponent(e)}`),S===e&&(C(null),T(``),D(!1)))}),R=e?.enabled??!1,z=e?.settings??{},B=e?.files??[];return(0,_.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 p-4`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`h1`,{className:`text-base font-semibold`,children:`Memories`}),(0,_.jsx)(m,{variant:`outline`,children:`beta`}),e&&e.liveEnabled!==null&&e.liveEnabled!==R&&(0,_.jsx)(m,{variant:`outline`,className:`text-amber-600`,children:`engine state differs — restart pending`}),(0,_.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,_.jsxs)(f,{size:`sm`,variant:`outline`,onClick:()=>A(),disabled:b,children:[(0,_.jsx)(c,{className:`size-3.5`}),` Refresh`]}),(0,_.jsx)(f,{size:`sm`,onClick:M,disabled:b||!e,children:R?`Disable`:`Enable`})]})]}),(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Codex turns useful context from past sessions into local memory files and brings them into new conversations. Memories are global across workspaces (they live in the shared Codex home) and are generated in the background — new files can take a while to appear.`}),n&&(0,_.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:n}),(0,_.jsxs)(`div`,{className:o(`flex flex-col gap-3`,!R&&`opacity-60`),children:[(0,_.jsxs)(`div`,{className:`rounded-lg border bg-card p-3`,children:[(0,_.jsx)(`div`,{className:`mb-2 text-sm font-medium`,children:`Behavior`}),(0,_.jsxs)(`div`,{className:`grid gap-2`,children:[(0,_.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(s,{checked:z.generateMemories!==!1,disabled:b||!R,onCheckedChange:e=>N({generateMemories:e===!0})}),`Generate memories from new sessions`]}),(0,_.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(s,{checked:z.useMemories!==!1,disabled:b||!R,onCheckedChange:e=>N({useMemories:e===!0})}),`Use existing memories in new sessions`]}),(0,_.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(s,{checked:z.disableOnExternalContext===!0,disabled:b||!R,onCheckedChange:e=>N({disableOnExternalContext:e===!0})}),`Skip sessions that used external context (MCP tools, web search)`]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(h,{htmlFor:`mem-rate`,className:`font-normal`,children:`Pause generation below`}),(0,_.jsx)(p,{id:`mem-rate`,type:`number`,min:0,max:100,placeholder:`25`,className:`h-7 w-20`,value:O,disabled:b||!R,onChange:e=>k(e.target.value),onBlur:()=>{O!==``&&P()},onKeyDown:e=>{e.key===`Enter`&&O!==``&&P()}}),(0,_.jsx)(`span`,{className:`text-muted-foreground`,children:`% rate limit remaining`})]})]}),(0,_.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:`Behavior settings are read by the engine at startup; the on/off toggle applies immediately.`})]}),(0,_.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-3`,children:[(0,_.jsxs)(`div`,{className:`flex w-72 shrink-0 flex-col gap-1 overflow-auto`,children:[(0,_.jsxs)(`div`,{className:`text-sm font-medium`,children:[`Memory files`,B.length>0&&` (${B.length})`]}),B.map(e=>(0,_.jsxs)(`div`,{className:o(`group flex cursor-pointer items-center gap-2 rounded-md border px-2 py-1.5`,S===e.path?`border-foreground/30 bg-muted/60`:`bg-card hover:bg-muted/40`),onClick:()=>F(e),children:[(0,_.jsx)(d,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`div`,{className:`truncate text-sm`,title:e.path,children:e.path}),(0,_.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[v(e.size),` · `,new Date(e.modifiedAt).toLocaleString()]})]}),(0,_.jsx)(f,{size:`icon-sm`,variant:`ghost`,className:`invisible text-destructive hover:text-destructive group-hover:visible`,disabled:b,onClick:t=>{t.stopPropagation(),L(e.path)},children:(0,_.jsx)(l,{})})]},e.path)),B.length===0&&(0,_.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-10 text-center text-sm text-muted-foreground`,children:[(0,_.jsx)(d,{className:`size-8`}),R?`No memories yet. Codex builds them in the background from finished sessions.`:`Enable memories to let Codex remember context across sessions.`]})]}),(0,_.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2`,children:S?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`code`,{className:`truncate text-xs text-muted-foreground`,children:S}),(0,_.jsx)(f,{size:`sm`,className:`ml-auto`,onClick:I,disabled:!E||b,children:b?`Saving…`:`Save`})]}),(0,_.jsx)(u,{value:w,spellCheck:!1,className:`min-h-0 flex-1 resize-none font-mono text-sm`,onChange:e=>{T(e.target.value),D(!0)}})]}):(0,_.jsx)(`div`,{className:`flex flex-1 items-center justify-center rounded-lg border border-dashed text-sm text-muted-foreground`,children:`Select a memory file to inspect or edit it`})})]})]})]})}export{y as MemoriesPage};