manifest
Version:
Self-hosted Manifest LLM router with embedded server, SQLite database, and dashboard
2 lines (1 loc) • 10 kB
JavaScript
import{n as _e,b as ve,u as fe,a as u,k as Z,i as n,g as l,m as $,T as be,M as $e,F as ye,h as f,S as p,E as ke,s as z,t as s,d as we}from"./vendor-C-Y5oNOq.js";import{C as xe}from"./CopyButton-BWMVlK2w.js";import{l as Se,b as I,d as Ce,E as Ae,m as Re,t as ee,r as Ke,n as Pe,o as Me}from"./index-C4Qw7vZo.js";import{S as De}from"./SetupStepAddProvider-CSNkQmoC.js";import{a as Te}from"./routing-CLLAl6kl.js";import"./auth-CU91cd7V.js";var ze=s("<div class=panel__tabs style=margin-bottom:var(--gap-xl)>"),Ie=s('<div class=settings-card><div class=settings-card__row><div class=settings-card__label><span class=settings-card__label-title>Agent name</span><span class=settings-card__label-desc>The display name for this agent across the dashboard.</span></div><div class=settings-card__control><input class=settings-card__input type=text aria-label="Agent name"></div></div><div class=settings-card__footer><button class="btn btn--primary btn--sm"><span aria-live=polite>'),Ee=s('<h3 class="settings-section__title settings-section__title--danger">Danger zone'),Ne=s('<div class="settings-card settings-card--danger"><div class=settings-card__row><div class=settings-card__label><span class=settings-card__label-title>Delete this agent</span><span class=settings-card__label-desc>Permanently delete this agent, its API key, and all recorded messages and analytics. This action cannot be undone.</span></div><div class=settings-card__control><button class="btn btn--danger btn--sm">Delete agent'),Be=s("<h3 class=settings-section__title>API Key"),Ue=s('<button class="btn btn--ghost btn--sm">'),je=s(`<div class=settings-card><div class=settings-card__body><span class=settings-card__label-title>Agent API key</span><span class=settings-card__label-desc style=font-size:14px>This key authenticates your agent's requests to Manifest. Rotating it generates a new key and immediately invalidates the current one.</span><div class=settings-card__key-row><code class=settings-card__key-value></code><div class=settings-card__key-actions></div></div></div><div class=settings-card__footer><button class="btn btn--outline btn--sm">`),Le=s("<h3 class=settings-section__title>Setup"),Ge=s('<div style="background:hsl(var(--chart-5) / 0.1);border:1px solid hsl(var(--chart-5) / 0.3);border-radius:var(--radius);padding:10px 14px;margin-bottom:var(--gap-md);font-size:var(--font-size-sm);color:hsl(var(--foreground))">Could not load your API key. Use <strong>Rotate key</strong> above to generate a new one, or follow the setup instructions below with a placeholder key.'),qe=s('<div style=margin-top:0;padding-top:var(--gap-lg);display:flex;align-items:center;justify-content:space-between><p style=margin:0;font-size:var(--font-size-sm);color:hsl(var(--muted-foreground));line-height:1.5>Add at least one LLM provider so Manifest knows where to route requests.</p><button class="btn btn--primary btn--sm"style=flex-shrink:0;margin-left:16px>Go to routing'),Fe=s("<div class=settings-card style=padding:var(--gap-lg)>"),He=s('<div class=modal-overlay><div class=modal-card role=dialog aria-modal=true aria-labelledby=delete-agent-modal-title style=max-width:440px><div style=display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--gap-lg)><h3 id=delete-agent-modal-title style=margin:0;font-size:var(--font-size-lg)>Delete </h3><button aria-label=Close style=background:none;border:none;cursor:pointer;color:hsl(var(--muted-foreground));padding:4px><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round aria-hidden=true><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg></button></div><p style=font-size:var(--font-size-sm);color:hsl(var(--muted-foreground));margin-bottom:var(--gap-md)>This will permanently delete the <strong style=color:hsl(var(--foreground))></strong> agent and all its data. This action cannot be undone.</p><label for=delete-confirm-input style=display:block;font-size:var(--font-size-sm);color:hsl(var(--foreground));margin-bottom:var(--gap-sm)>To confirm, type <strong>"<!>"</strong> in the box below</label><input id=delete-confirm-input class=auth-form__input type=text style=width:100%;margin-bottom:var(--gap-lg)><button class="btn btn--danger btn--sm"style=width:100%>'),Je=s("<div class=container--sm><div class=page-header><div><h1>Settings</h1><span class=breadcrumb> › Rename your agent, manage API keys, and view setup instructions"),Oe=s("<button class=panel__tab>"),E=s("<span class=spinner>"),Qe=s("<span class=sr-only>Saving…"),Ve=s('<svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round aria-hidden=true><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"></path><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"></path><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"></path><path d="m2 2 20 20">'),We=s('<svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round aria-hidden=true><path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"></path><circle cx=12 cy=12 r=3>'),Xe=s("<span class=sr-only>Rotating…"),Ye=s('<div class=setup-steps><div class="skeleton skeleton--rect"style=width:100%;height:200px>'),Ze=s("<span class=sr-only>Deleting…");const it=()=>{const te=_e(),N=ve(),ne=fe(),a=()=>decodeURIComponent(te.agentName),[M,B]=u(a()),[U,j]=u(!1),[se,et]=u(!1),[ae,S]=u(!1),[L,G]=u(""),[q,F]=u(!1),[H,J]=u(!1),[O,re]=u(ne.state?.newApiKey??null),[C,{refetch:le}]=Z(()=>a(),e=>Se(e)),[ie]=Z(()=>a(),Te),oe=()=>ie()?.enabled??!1,[y,Q]=u(!1),b=()=>C.error?void 0:C(),A=()=>O()??b()?.apiKey??null,de=()=>{const e=A();return e?y()?e:`${b()?.keyPrefix??"..."}...`:`${b()?.keyPrefix??"..."}...`},ce=()=>{const e=b()?.pluginEndpoint;return e||(window.location.hostname==="app.manifest.build"?"https://app.manifest.build/v1":`${window.location.origin}/v1`)},ge=async()=>{const e=M().trim();if(!(!e||e===a())){j(!0);try{const R=(await Ke(a(),e))?.name??e;Pe(R),window.location.replace(`/agents/${encodeURIComponent(R)}/settings`)}catch{B(a()),j(!1)}}},ue=async()=>{J(!0);try{const e=await Me(a());re(e.apiKey),Q(!0),ee.success("API key rotated successfully"),le()}catch{}finally{J(!1)}},V=()=>["General","Agent setup"],[D,pe]=u("General");return(()=>{var e=Je(),k=e.firstChild,R=k.firstChild,he=R.firstChild,W=he.nextSibling,me=W.firstChild;return n(e,l(be,{get children(){return[$(()=>I()??a())," Settings - Manifest"]}}),k),n(e,l($e,{name:"description",get content(){return`Configure settings for ${I()??a()}.`}}),k),n(W,()=>I()??a(),me),n(e,l(p,{get when(){return V().length>0},get children(){var t=ze();return n(t,l(ye,{get each(){return V()},children:r=>(()=>{var i=Oe();return i.$$click=()=>pe(r),n(i,r),f(()=>i.classList.toggle("panel__tab--active",D()===r)),i})()})),t}}),null),n(e,l(p,{get when(){return D()==="General"},get children(){return[(()=>{var t=Ie(),r=t.firstChild,i=r.firstChild,d=i.nextSibling,m=d.firstChild,v=r.nextSibling,_=v.firstChild,w=_.firstChild;return m.$$input=c=>B(c.currentTarget.value),_.$$click=ge,n(w,(()=>{var c=$(()=>!!se());return()=>c()?"Saved":$(()=>!!U())()?[E(),Qe()]:"Save"})()),f(()=>_.disabled=U()||M().trim()===a()),f(()=>m.value=M()),t})(),l(p,{get when(){return!Ce()||a()!=="local-agent"},get children(){return[Ee(),(()=>{var t=Ne(),r=t.firstChild,i=r.firstChild,d=i.nextSibling,m=d.firstChild;return m.$$click=()=>{S(!0),G("")},t})()]}})]}}),null),n(e,l(p,{get when(){return D()==="Agent setup"},get children(){return l(ke,{fallback:(t,r)=>l(Ae,{error:t,title:"Something went wrong",message:"An error occurred while rendering setup instructions.",onRetry:r}),get children(){return[Be(),(()=>{var t=je(),r=t.firstChild,i=r.firstChild,d=i.nextSibling,m=d.nextSibling,v=m.firstChild,_=v.nextSibling,w=r.nextSibling,c=w.firstChild;return n(v,de),n(_,l(p,{get when(){return A()},get children(){var h=Ue();return h.$$click=()=>Q(!y()),n(h,(()=>{var g=$(()=>!!y());return()=>g()?Ve():We()})()),f(g=>{var K=y()?"Hide API key":"Reveal API key",x=y()?"Hide":"Reveal";return K!==g.e&&z(h,"aria-label",g.e=K),x!==g.t&&z(h,"title",g.t=x),g},{e:void 0,t:void 0}),h}}),null),n(_,l(p,{get when(){return A()},get children(){return l(xe,{get text(){return A()}})}}),null),c.$$click=ue,n(c,(()=>{var h=$(()=>!!H());return()=>h()?[E(),Xe()]:"Rotate key"})()),f(()=>c.disabled=H()),t})(),Le(),l(p,{get when(){return!C.loading},get fallback(){return Ye()},get children(){return[l(p,{get when(){return C.error},get children(){return Ge()}}),(()=>{var t=Fe();return n(t,l(De,{get apiKey(){return O()??b()?.apiKey??null},get keyPrefix(){return b()?.keyPrefix??null},get baseUrl(){return ce()},hideFullKey:!0}),null),n(t,l(p,{get when(){return!oe()},get children(){var r=qe(),i=r.firstChild,d=i.nextSibling;return d.$$click=()=>N(`/agents/${encodeURIComponent(a())}/routing`,{state:{openProviders:!0}}),r}}),null),t})()]}})]}})}}),null),n(e,l(p,{get when(){return ae()},get children(){var t=He(),r=t.firstChild,i=r.firstChild,d=i.firstChild;d.firstChild;var m=d.nextSibling,v=i.nextSibling,_=v.firstChild,w=_.nextSibling,c=v.nextSibling,h=c.firstChild,g=h.nextSibling,K=g.firstChild,x=K.nextSibling;x.nextSibling;var P=c.nextSibling,T=P.nextSibling;return t.$$keydown=o=>{o.key==="Escape"&&S(!1)},t.$$click=o=>{o.target===o.currentTarget&&S(!1)},n(d,a,null),m.$$click=()=>S(!1),n(w,a),n(g,a,x),P.$$input=o=>G(o.currentTarget.value),T.$$click=async()=>{F(!0);try{await Re(a()),ee.success(`Agent "${a()}" deleted`),N("/",{replace:!0})}catch{F(!1)}},n(T,(()=>{var o=$(()=>!!q());return()=>o()?[E(),Ze()]:"Delete this agent"})()),f(o=>{var X=a(),Y=L()!==a()||q();return X!==o.e&&z(P,"placeholder",o.e=X),Y!==o.t&&(T.disabled=o.t=Y),o},{e:void 0,t:void 0}),f(()=>P.value=L()),t}}),null),e})()};we(["input","click","keydown"]);export{it as default};