@lovelybunch/api 1.0.71-alpha.1 → 1.0.71-alpha.3

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 (92) hide show
  1. package/dist/lib/file-validation.d.ts +65 -0
  2. package/dist/lib/file-validation.js +125 -0
  3. package/dist/middleware/auth.d.ts +1 -0
  4. package/dist/middleware/auth.js +13 -3
  5. package/dist/routes/api/v1/events/status/route.d.ts +1 -1
  6. package/dist/routes/api/v1/jobs/[id]/run/route.d.ts +2 -2
  7. package/dist/routes/api/v1/jobs/status/route.d.ts +1 -1
  8. package/dist/routes/api/v1/proposals/[id]/route.d.ts +8 -8
  9. package/dist/routes/api/v1/resources/route.js +10 -7
  10. package/package.json +5 -4
  11. package/static/assets/AgentDetailPage-DVDnvYcy.js +1 -0
  12. package/static/assets/AgentEditPage-DRLTkdIZ.js +1 -0
  13. package/static/assets/AgentsPage-CVoYisFq.js +3 -0
  14. package/static/assets/AgentsSettingsPage-D9FDJHpC.js +6 -0
  15. package/static/assets/ApiKeysSettingsPage-DGcz0E10.js +7 -0
  16. package/static/assets/ArchitectureEditPage-PXH0HtcY.js +21 -0
  17. package/static/assets/ArchitecturePage-BiybPTif.js +1 -0
  18. package/static/assets/AuthSettingsPage-6TaOiZV7.js +11 -0
  19. package/static/assets/CallbackPage-BdZglBBj.js +1 -0
  20. package/static/assets/CodePage-B239DtM2.js +2 -0
  21. package/static/assets/CollapsibleSection-DaqBpCe-.js +1 -0
  22. package/static/assets/DashboardPage-B2FJcHVR.js +11 -0
  23. package/static/assets/GitPage-DaWE2Q-b.js +16 -0
  24. package/static/assets/GitSettingsPage-bTqUr0fn.js +6 -0
  25. package/static/assets/IdentityPage-eXzMXYy2.js +11 -0
  26. package/static/assets/ImplementationStepsEditor-CuDeossU.js +6 -0
  27. package/static/assets/IntegrationsSettingsPage-wAf_7nar.js +1 -0
  28. package/static/assets/KnowledgeDetailPage-B5ieYIze.js +1 -0
  29. package/static/assets/KnowledgeEditPage-OMUREl1n.js +1 -0
  30. package/static/assets/KnowledgePage-CKtcok1N.js +8 -0
  31. package/static/assets/LoginPage-B70_aCBv.js +1 -0
  32. package/static/assets/McpSettingsPage-DcJIlHEi.js +1 -0
  33. package/static/assets/NewAgentPage-DITLLDez.js +1 -0
  34. package/static/assets/NewKnowledgePage-C7vEg4PR.js +9 -0
  35. package/static/assets/NewProposalPage-z8wqyXIj.js +90 -0
  36. package/static/assets/ProjectEditPage-BDj8GlD_.js +11 -0
  37. package/static/assets/ProjectPage-CtoKV0l9.js +1 -0
  38. package/static/assets/PromptsSettingsPage-CI-pWQVw.js +1 -0
  39. package/static/assets/ProposalDetailPage-D6rhO9vm.js +1 -0
  40. package/static/assets/ProposalEditPage-DCy3_sbg.js +1 -0
  41. package/static/assets/ProposalsPage-DQLqm83b.js +17 -0
  42. package/static/assets/ResourcesPage-Bq9t872V.js +66 -0
  43. package/static/assets/RulesSettingsPage-MgsP5qaA.js +16 -0
  44. package/static/assets/SchedulePage-C1vDSjyh.js +4 -0
  45. package/static/assets/TagInput-Cdfvhozb.js +1 -0
  46. package/static/assets/TerminalPage-NQzi2rzj.js +1 -0
  47. package/static/assets/TerminalSessionPage-DQgbm-LP.js +13 -0
  48. package/static/assets/UserPreferencesPage-CCYsj_XY.js +1 -0
  49. package/static/assets/UserSettingsPage-DdCnaoY_.js +1 -0
  50. package/static/assets/UtilitiesPage-DGcmJSz6.js +1 -0
  51. package/static/assets/alert-BAeRxZ1d.js +1 -0
  52. package/static/assets/arrow-down-5CQhXptz.js +6 -0
  53. package/static/assets/arrow-left-DSqUNUH-.js +6 -0
  54. package/static/assets/arrow-up-CYoJSbWn.js +6 -0
  55. package/static/assets/badge-NJasrAx_.js +1 -0
  56. package/static/assets/browser-modal-x3ise3M1.js +6 -0
  57. package/static/assets/calendar-wiZSxCBM.js +6 -0
  58. package/static/assets/card-CvaBJsG6.js +1 -0
  59. package/static/assets/chevron-left-CaZHWPr-.js +6 -0
  60. package/static/assets/circle-alert-61156jM6.js +6 -0
  61. package/static/assets/circle-check-big-K_QMED_K.js +6 -0
  62. package/static/assets/circle-check-z0By2KN8.js +6 -0
  63. package/static/assets/circle-play-88lMuMRZ.js +6 -0
  64. package/static/assets/circle-x-DdTsJYO7.js +6 -0
  65. package/static/assets/clipboard-B9ndUJKl.js +1 -0
  66. package/static/assets/clipboard-BNXOfcye.js +11 -0
  67. package/static/assets/clock-BTCBJF7v.js +6 -0
  68. package/static/assets/download-BaYIFjpj.js +6 -0
  69. package/static/assets/droid-CmYuCN_q.js +4 -0
  70. package/static/assets/eye-CuSCp49Y.js +6 -0
  71. package/static/assets/folder-git-2-CiVM8o0Y.js +6 -0
  72. package/static/assets/index-B8vejVRZ.js +458 -0
  73. package/static/assets/{index-Bo1l13x2.css → index-CKwmN6yL.css} +2 -33
  74. package/static/assets/label-DtNTh--4.js +1 -0
  75. package/static/assets/markdown-editor-DUEthZ0y.css +1 -0
  76. package/static/assets/markdown-editor-DvlGlqU9.js +62 -0
  77. package/static/assets/pause-COIsHZIp.js +6 -0
  78. package/static/assets/play-a8BsF4gF.js +6 -0
  79. package/static/assets/plus-Bon5P_OK.js +6 -0
  80. package/static/assets/radio-group-DpJuX02X.js +1 -0
  81. package/static/assets/refresh-cw-CnHMzcH3.js +6 -0
  82. package/static/assets/search-BR37JgJ3.js +6 -0
  83. package/static/assets/switch-D86f4WeD.js +1 -0
  84. package/static/assets/tabs-BYrDWPwx.js +1 -0
  85. package/static/assets/tag--U3Nuedb.js +6 -0
  86. package/static/assets/terminal-preview-Be68j_3t.js +11 -0
  87. package/static/assets/use-terminal-2DGl8X5T.js +1 -0
  88. package/static/assets/xterm-DTxiCjtJ.js +9 -0
  89. package/static/assets/xterm-qxJ8_QYu.css +32 -0
  90. package/static/assets/zap-C0eIGEl_.js +6 -0
  91. package/static/index.html +2 -2
  92. package/static/assets/index-DgZp291y.js +0 -973
@@ -0,0 +1,6 @@
1
+ import{c as e}from"./index-B8vejVRZ.js";/**
2
+ * @license lucide-react v0.542.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const t=[["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"}]],o=e("pause",t);export{o as P};
@@ -0,0 +1,6 @@
1
+ import{c as a}from"./index-B8vejVRZ.js";/**
2
+ * @license lucide-react v0.542.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const o=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],e=a("play",o);export{e as P};
@@ -0,0 +1,6 @@
1
+ import{c as e}from"./index-B8vejVRZ.js";/**
2
+ * @license lucide-react v0.542.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const o=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],c=e("plus",o);export{c as P};
@@ -0,0 +1 @@
1
+ import{r as n,a_ as E,a$ as K,b0 as T,j as a,b1 as N,b2 as U,b3 as x,b4 as w,b5 as V,b6 as g,b7 as $,b8 as z,b9 as H,f as I,ba as W}from"./index-B8vejVRZ.js";var C="Radio",[X,_]=N(C),[Y,J]=X(C),j=n.forwardRef((r,t)=>{const{__scopeRadio:e,name:d,checked:o=!1,required:s,disabled:i,value:p="on",onCheck:f,form:R,...v}=r,[l,m]=n.useState(null),c=w(t,y=>m(y)),u=n.useRef(!1),b=l?R||!!l.closest("form"):!0;return a.jsxs(Y,{scope:e,checked:o,disabled:i,children:[a.jsx(x.button,{type:"button",role:"radio","aria-checked":o,"data-state":S(o),"data-disabled":i?"":void 0,disabled:i,value:p,...v,ref:c,onClick:g(r.onClick,y=>{o||f?.(),b&&(u.current=y.isPropagationStopped(),u.current||y.stopPropagation())})}),b&&a.jsx(P,{control:l,bubbles:!u.current,name:d,value:p,checked:o,required:s,disabled:i,form:R,style:{transform:"translateX(-100%)"}})]})});j.displayName=C;var k="RadioIndicator",G=n.forwardRef((r,t)=>{const{__scopeRadio:e,forceMount:d,...o}=r,s=J(k,e);return a.jsx($,{present:d||s.checked,children:a.jsx(x.span,{"data-state":S(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:t})})});G.displayName=k;var Q="RadioBubbleInput",P=n.forwardRef(({__scopeRadio:r,control:t,checked:e,bubbles:d=!0,...o},s)=>{const i=n.useRef(null),p=w(i,s),f=z(e),R=H(t);return n.useEffect(()=>{const v=i.current;if(!v)return;const l=window.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(l,"checked").set;if(f!==e&&c){const u=new Event("click",{bubbles:d});c.call(v,e),v.dispatchEvent(u)}},[f,e,d]),a.jsx(x.input,{type:"radio","aria-hidden":!0,defaultChecked:e,...o,tabIndex:-1,ref:p,style:{...o.style,...R,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});P.displayName=Q;function S(r){return r?"checked":"unchecked"}var Z=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],h="RadioGroup",[ee,de]=N(h,[E,_]),A=E(),D=_(),[oe,re]=ee(h),M=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,name:d,defaultValue:o,value:s,required:i=!1,disabled:p=!1,orientation:f,dir:R,loop:v=!0,onValueChange:l,...m}=r,c=A(e),u=K(R),[b,y]=T({prop:s,defaultProp:o??null,onChange:l,caller:h});return a.jsx(oe,{scope:e,name:d,required:i,disabled:p,value:b,onValueChange:y,children:a.jsx(U,{asChild:!0,...c,orientation:f,dir:u,loop:v,children:a.jsx(x.div,{role:"radiogroup","aria-required":i,"aria-orientation":f,"data-disabled":p?"":void 0,dir:u,...m,ref:t})})})});M.displayName=h;var O="RadioGroupItem",F=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,disabled:d,...o}=r,s=re(O,e),i=s.disabled||d,p=A(e),f=D(e),R=n.useRef(null),v=w(t,R),l=s.value===o.value,m=n.useRef(!1);return n.useEffect(()=>{const c=b=>{Z.includes(b.key)&&(m.current=!0)},u=()=>m.current=!1;return document.addEventListener("keydown",c),document.addEventListener("keyup",u),()=>{document.removeEventListener("keydown",c),document.removeEventListener("keyup",u)}},[]),a.jsx(V,{asChild:!0,...p,focusable:!i,active:l,children:a.jsx(j,{disabled:i,required:s.required,checked:l,...f,...o,name:s.name,ref:v,onCheck:()=>s.onValueChange(o.value),onKeyDown:g(c=>{c.key==="Enter"&&c.preventDefault()}),onFocus:g(o.onFocus,()=>{m.current&&R.current?.click()})})})});F.displayName=O;var ae="RadioGroupIndicator",L=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,...d}=r,o=D(e);return a.jsx(G,{...o,...d,ref:t})});L.displayName=ae;var q=M,B=F,te=L;const se=n.forwardRef(({className:r,...t},e)=>a.jsx(q,{className:I("grid gap-2",r),...t,ref:e}));se.displayName=q.displayName;const ne=n.forwardRef(({className:r,...t},e)=>a.jsx(B,{ref:e,className:I("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),...t,children:a.jsx(te,{className:"flex items-center justify-center",children:a.jsx(W,{className:"h-2.5 w-2.5 fill-current text-current"})})}));ne.displayName=B.displayName;export{se as R,ne as a};
@@ -0,0 +1,6 @@
1
+ import{c as e}from"./index-B8vejVRZ.js";/**
2
+ * @license lucide-react v0.542.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const c=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],a=e("refresh-cw",c);export{a as R};
@@ -0,0 +1,6 @@
1
+ import{c}from"./index-B8vejVRZ.js";/**
2
+ * @license lucide-react v0.542.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const e=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],o=c("search",e);export{o as S};
@@ -0,0 +1 @@
1
+ import{r as c,j as e,f as i}from"./index-B8vejVRZ.js";const d=c.forwardRef(({className:s,onCheckedChange:r,onChange:t,...o},n)=>{const l=a=>{t?.(a),r?.(a.target.checked)};return e.jsxs("label",{className:i("relative inline-flex cursor-pointer",s),children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",onChange:l,ref:n,...o}),e.jsx("div",{className:"block bg-gray-300 w-9 h-5 rounded-full transition-colors duration-200 ease-in-out peer-checked:bg-blue-600"}),e.jsx("div",{className:"absolute left-0 top-0 bg-white w-4 h-4 rounded-full mt-0.5 ml-0.5 transition-transform duration-200 ease-in-out transform peer-checked:translate-x-4 shadow"})]})});d.displayName="Switch";export{d as S};
@@ -0,0 +1 @@
1
+ import{r as l,a$ as F,b0 as $,j as c,b1 as D,bc as V,b3 as g,a_ as y,b2 as k,b5 as G,b6 as m,b7 as L,f as T}from"./index-B8vejVRZ.js";var p="Tabs",[K,Q]=D(p,[y]),h=y(),[B,x]=K(p),N=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,onValueChange:r,defaultValue:d,orientation:n="horizontal",dir:u,activationMode:f="automatic",...v}=e,i=F(u),[s,b]=$({prop:o,onChange:r,defaultProp:d??"",caller:p});return c.jsx(B,{scope:t,baseId:V(),value:s,onValueChange:b,orientation:n,dir:i,activationMode:f,children:c.jsx(g.div,{dir:i,"data-orientation":n,...v,ref:a})})});N.displayName=p;var C="TabsList",I=l.forwardRef((e,a)=>{const{__scopeTabs:t,loop:o=!0,...r}=e,d=x(C,t),n=h(t);return c.jsx(k,{asChild:!0,...n,orientation:d.orientation,dir:d.dir,loop:o,children:c.jsx(g.div,{role:"tablist","aria-orientation":d.orientation,...r,ref:a})})});I.displayName=C;var R="TabsTrigger",j=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,disabled:r=!1,...d}=e,n=x(R,t),u=h(t),f=A(n.baseId,o),v=E(n.baseId,o),i=o===n.value;return c.jsx(G,{asChild:!0,...u,focusable:!r,active:i,children:c.jsx(g.button,{type:"button",role:"tab","aria-selected":i,"aria-controls":v,"data-state":i?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:f,...d,ref:a,onMouseDown:m(e.onMouseDown,s=>{!r&&s.button===0&&s.ctrlKey===!1?n.onValueChange(o):s.preventDefault()}),onKeyDown:m(e.onKeyDown,s=>{[" ","Enter"].includes(s.key)&&n.onValueChange(o)}),onFocus:m(e.onFocus,()=>{const s=n.activationMode!=="manual";!i&&!r&&s&&n.onValueChange(o)})})})});j.displayName=R;var w="TabsContent",_=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,forceMount:r,children:d,...n}=e,u=x(w,t),f=A(u.baseId,o),v=E(u.baseId,o),i=o===u.value,s=l.useRef(i);return l.useEffect(()=>{const b=requestAnimationFrame(()=>s.current=!1);return()=>cancelAnimationFrame(b)},[]),c.jsx(L,{present:r||i,children:({present:b})=>c.jsx(g.div,{"data-state":i?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":f,hidden:!b,id:v,tabIndex:0,...n,ref:a,style:{...e.style,animationDuration:s.current?"0s":void 0},children:b&&d})})});_.displayName=w;function A(e,a){return`${e}-trigger-${a}`}function E(e,a){return`${e}-content-${a}`}var q=N,S=I,M=j,P=_;const U=q,z=l.forwardRef(({className:e,...a},t)=>c.jsx(S,{ref:t,className:T("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...a}));z.displayName=S.displayName;const H=l.forwardRef(({className:e,...a},t)=>c.jsx(M,{ref:t,className:T("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...a}));H.displayName=M.displayName;const O=l.forwardRef(({className:e,...a},t)=>c.jsx(P,{ref:t,className:T("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...a}));O.displayName=P.displayName;export{U as T,z as a,H as b,O as c};
@@ -0,0 +1,6 @@
1
+ import{c}from"./index-B8vejVRZ.js";/**
2
+ * @license lucide-react v0.542.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const a=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],e=c("tag",a);export{e as T};
@@ -0,0 +1,11 @@
1
+ import{c as p,r as e,ab as S,j as u}from"./index-B8vejVRZ.js";import{x as F,a as N}from"./xterm-DTxiCjtJ.js";/**
2
+ * @license lucide-react v0.542.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const C=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],B=p("chevrons-down",C);/**
7
+ * @license lucide-react v0.542.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const M=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],L=p("chevrons-up",M);function $({sessionId:l,className:v,heightPx:f=160,maxScrollback:h=200}){const m=e.useRef(null),y=e.useRef(null),w=e.useRef(null),x=e.useRef(null),[R,k]=e.useState(!0),o=e.useRef([]),c=e.useRef(null);return e.useEffect(()=>{const i=m.current;if(!i||!l)return;const t=new F.Terminal({disableStdin:!0,cursorBlink:!1,convertEol:!0,scrollback:Math.max(50,Math.min(h,1e3)),fontSize:12,fontFamily:'Monaco, Menlo, "Ubuntu Mono", monospace',theme:{background:"#1e1e1e",foreground:"#d4d4d4",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#e5e5e5"}}),d=new N.FitAddon;t.loadAddon(d),t.open(i),i.style.height=`${f}px`,y.current=t,w.current=d;const a=()=>{try{const n=i.getBoundingClientRect();n.width>8&&n.height>8&&d.fit()}catch{}};a();const b=new ResizeObserver(()=>a());b.observe(i);const g=()=>{document.visibilityState==="visible"&&setTimeout(a,50)};document.addEventListener("visibilitychange",g);const s=new WebSocket(`${S}/ws/terminal-preview/${l}`);x.current=s,s.onopen=()=>k(!1);const E=()=>{c.current=null;const n=o.current;if(n.length){o.current=[];try{t.write(n.join(""))}catch{}}},j=()=>{c.current===null&&(c.current=requestAnimationFrame(E))};return s.onmessage=n=>{let r;try{r=JSON.parse(n.data)}catch{return}if(r?.type==="snapshot"){if(t.reset(),o.current=[],r.data)try{t.write(r.data)}catch{}a()}else r?.type==="data"&&r.data&&(o.current.push(String(r.data)),j())},s.onclose=()=>{},s.onerror=()=>{},()=>{b.disconnect(),document.removeEventListener("visibilitychange",g);try{s.close()}catch{}c.current!==null&&cancelAnimationFrame(c.current),c.current=null,o.current=[],t.dispose()}},[l,f,h]),u.jsxs("div",{className:`relative w-full ${v||""}`.trim(),children:[R&&u.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-50/60 z-10",children:u.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading preview…"})}),u.jsx("div",{ref:m,className:"border border-muted rounded overflow-hidden"})]})}export{L as C,$ as T,B as a};
@@ -0,0 +1 @@
1
+ import{r as i,ag as b,A as f}from"./index-B8vejVRZ.js";function j(){const[y,u]=i.useState([]),[g,c]=i.useState(!1),[m,o]=i.useState(null),{refresh:p}=b(),d=i.useCallback(async(s,n,r)=>{try{c(!0),o(null);const e=await fetch(`${f}/api/v1/terminal/${s}/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enableLogging:n||!1,startupCommand:r})});if(!e.ok){const a=await e.json();throw new Error(a.error||"Failed to create terminal session")}const t=await e.json();return await p(),t.sessionId}catch(e){const t=e instanceof Error?e.message:"Unknown error";return o(t),null}finally{c(!1)}},[p]),S=i.useCallback(async s=>{try{c(!0),o(null);let n;if(s.startsWith("session-")){const e=s.split("-");n=`${e[0]}-${e[1]}`}else{const e=s.split("-");n=`${e[0]}-${e[1]}`}const r=await fetch(`${f}/api/v1/terminal/${n}/destroy`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s})});if(!r.ok){const e=await r.json();throw new Error(e.error||"Failed to destroy terminal session")}return u(e=>e.filter(t=>t.id!==s)),await p(),!0}catch(n){const r=n instanceof Error?n.message:"Unknown error";return o(r),!1}finally{c(!1)}},[p]),$=i.useCallback(async(s,n,r)=>{try{o(null);let e;if(s.startsWith("session-")){const a=s.split("-");e=`${a[0]}-${a[1]}`}else{const a=s.split("-");e=`${a[0]}-${a[1]}`}const t=await fetch(`${f}/api/v1/terminal/${e}/resize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s,cols:n,rows:r})});if(!t.ok){const a=await t.json();throw new Error(a.error||"Failed to resize terminal session")}return!0}catch(e){const t=e instanceof Error?e.message:"Unknown error";return o(t),!1}},[]),k=i.useCallback(async(s,n,r)=>{try{c(!0),o(null);const e=new URLSearchParams;s&&e.set("proposalId",s),n&&(e.set("withPreview","true"),r&&Number.isFinite(r)&&e.set("lines",String(r)));const t=`${f}/api/v1/terminal/sessions${e.toString()?`?${e.toString()}`:""}`,a=await fetch(t);if(!a.ok){const l=await a.json();throw new Error(l.error||"Failed to fetch terminal sessions")}const w=await a.json();u(w.sessions)}catch(e){const t=e instanceof Error?e.message:"Unknown error";o(t)}finally{c(!1)}},[]),E=i.useCallback(async(s,n=8)=>{try{o(null);const r=new URLSearchParams;r.set("sessionId",s),r.set("withPreview","true"),r.set("lines",String(n)),r.set("colorize","true");const e=`${f}/api/v1/terminal/sessions?${r.toString()}`,t=await fetch(e);if(!t.ok){const l=await t.json().catch(()=>({}));throw new Error(l.error||"Failed to fetch preview")}const a=await t.json(),w=Array.isArray(a?.sessions)&&a.sessions[0]?.preview?a.sessions[0].preview:[];return u(l=>l.map(h=>h.id===s?{...h,preview:w}:h)),w}catch(r){const e=r instanceof Error?r.message:"Unknown error";return o(e),[]}},[]);return{sessions:y,loading:g,error:m,createSession:d,destroySession:S,resizeSession:$,refreshSessions:k,fetchPreview:E}}export{j as u};