UNPKG

manifest

Version:

Self-hosted Manifest LLM router with embedded server, SQLite database, and dashboard

2 lines (1 loc) 8.88 kB
import{a as b,p as L,n as Z,b as ee,k as U,o as te,f as A,C as j,i as d,g as a,m as O,T as se,M as ae,h as B,S as p,F as re,t as g,d as ne}from"./vendor-C-Y5oNOq.js";import{d as le,p as ie,b as V,E as oe}from"./index-C4Qw7vZo.js";import{g as ce,S as de,M as ge,D as ue,a as me}from"./overview-DKLGwfLs.js";import{P as pe}from"./Pagination-D8BOkffh.js";import{g as ve,a as he}from"./routing-CLLAl6kl.js";import{p as fe}from"./model-display-DHwvDtl4.js";import{P as _e}from"./routing-utils-CHapjwyd.js";import"./auth-CU91cd7V.js";import"./AuthBadge-Dj2KkXRW.js";import"./SetupStepAddProvider-CSNkQmoC.js";import"./CopyButton-BWMVlK2w.js";function be(i=50){const[I,x]=b([void 0]),[y,v]=b(0),[M,h]=b(!1),N=L(()=>y()+1),E=L(()=>I()[y()]),k=L(()=>M());function P(f){f?(h(!0),x(o=>{const S=y()+1,$=[...o];return $[S]=f,$})):h(!1)}function R(){M()&&v(f=>f+1)}function F(){y()<=0||v(f=>f-1)}function C(){x([void 0]),v(0),h(!1)}return{currentPage:N,currentCursor:E,hasNextPage:k,previousPage:F,nextPage:R,recordResponse:P,resetPage:C,pageSize:i}}var xe=g('<div class=cost-range-filter><input type=number class=cost-range-filter__input placeholder="Min $"aria-label="Minimum cost filter"min=0 step=0.01><span class=cost-range-filter__sep>&ndash;</span><input type=number class=cost-range-filter__input placeholder="Max $"aria-label="Maximum cost filter"min=0 step=0.01>'),ye=g('<button class="btn btn--primary btn--sm">Set up agent'),$e=g('<div class=empty-state><div class=empty-state__title>No messages yet</div><p>Connect a provider to start routing LLM calls.</p><button class="btn btn--primary btn--sm"style=margin-top:var(--gap-md)>Enable routing</button><div class=empty-state__img-wrapper><img src=/example-messages.svg alt="Example message log showing LLM call history"class=empty-state__img loading=lazy>',!0,!1,!1),Me=g('<div class=panel><div style=display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--gap-lg)><div class=panel__title style=margin-bottom:0>Messages</div><span style=font-size:var(--font-size-xs);color:hsl(var(--muted-foreground))>0 results</span></div><div class=model-filter__empty><p class=model-filter__empty-title>No messages match your filters</p><p class=model-filter__empty-hint>Try adjusting your provider or cost filters to see more results.</p><button class="btn btn--outline btn--sm"type=button>Clear filters'),ke=g('<div class=waiting-banner><i class="bxd bx-florist"></i><p>No messages yet. They appear seconds after your first LLM call.'),Ce=g("<div class=panel><div style=display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--gap-lg)><div class=panel__title style=margin-bottom:0>Messages</div><span style=font-size:var(--font-size-xs);color:hsl(var(--muted-foreground))> total</span></div><div class=data-table-scroll>"),Se=g("<div class=container--full><div class=page-header><div><h1>Messages</h1><span class=breadcrumb>Full log of every LLM call. Filter by provider or cost.</span></div><div class=header-controls>"),we=g('<div class=panel><div style=display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--gap-lg)><div class="skeleton skeleton--text"style=width:80px;height:16px></div><div class="skeleton skeleton--text"style=width:60px;height:14px></div></div><div class=data-table-scroll><table class=data-table><thead><tr><th>Date</th><th>Message</th><th>Cost</th><th>Total Tokens</th><th>Input</th><th>Output</th><th>Model</th><th>Cache</th><th>Duration</th><th>Status</th></tr></thead><tbody>'),Ne=g('<tr><td><div class="skeleton skeleton--text"style=width:90px></div></td><td><div class="skeleton skeleton--text"style=width:55px></div></td><td><div class="skeleton skeleton--text"style=width:40px></div></td><td><div class="skeleton skeleton--text"style=width:40px></div></td><td><div class="skeleton skeleton--text"style=width:35px></div></td><td><div class="skeleton skeleton--text"style=width:35px></div></td><td><div class="skeleton skeleton--text"style=width:110px></div></td><td><div class="skeleton skeleton--text"style=width:90px></div></td><td><div class="skeleton skeleton--text"style=width:35px></div></td><td><div class="skeleton skeleton--text"style=width:50px>'),Pe=g('<div class=empty-state><div class=empty-state__title>No messages yet</div><p>Set up your agent and send a message. Every LLM call shows up here.</p><button class="btn btn--primary btn--sm"style=margin-top:var(--gap-md)>Set up agent</button><div class=empty-state__img-wrapper><img src=/example-messages.svg alt="Example message log showing LLM call history"class=empty-state__img loading=lazy>',!0,!1,!1);const je=()=>{const i=Z(),I=ee();fe();const[x,y]=b(""),[v,M]=b(""),[h,N]=b(""),[E,k]=b(!1),[P]=b(!!localStorage.getItem(`setup_completed_${i.agentName}`)||le()===!0),[R]=U(()=>i.agentName,e=>ve(decodeURIComponent(e))),[F]=U(()=>i.agentName,e=>he(decodeURIComponent(e))),C=()=>F()?.enabled===!0,f=e=>{const s=e.match(/^custom:([^/]+)\//);if(!s)return;const _=s[1];return R()?.find(u=>u.id===_)?.name},o=be(50);let S,$;te(()=>{clearTimeout(S),clearTimeout($)});const q=e=>{clearTimeout(S),S=setTimeout(()=>M(e),400)},H=e=>{clearTimeout($),$=setTimeout(()=>N(e),400)};A(j([x,v,h],()=>o.resetPage(),{defer:!0}));const[l,{refetch:G}]=U(()=>({provider:x(),costMin:v(),costMax:h(),agentName:i.agentName,_ping:ie(),cursor:o.currentCursor(),limit:o.pageSize}),e=>{const s={};return e.provider&&(s.provider=e.provider),e.costMin&&(s.cost_min=e.costMin),e.costMax&&(s.cost_max=e.costMax),e.agentName&&(s.agent_name=e.agentName),e.cursor&&(s.cursor=e.cursor),s.limit=String(e.limit),ce(s)});A(j(()=>l(),e=>{e&&o.recordResponse(e.next_cursor)}));const D=()=>x()!==""||v()!==""||h()!=="",T=()=>{const e=l();return e&&e.total_count===0},z=()=>T()&&!D()&&!C(),J=()=>T()&&D(),K=()=>!T()||C()&&!D(),Q=()=>{y(""),M(""),N("")},W=e=>_e.find(_=>_.id===e)?.name??e,X=L(()=>[{label:"All providers",value:""},...(l()?.providers??[]).map(e=>({label:W(e),value:e}))]),Y=e=>{const s=l()?.items;if(!s)return;const _=s.find(t=>t.fallback_from_model===e&&t.status==="ok");if(!_)return;const u=document.getElementById(`msg-${_.id}`);u&&(u.scrollIntoView({behavior:"smooth",block:"center"}),u.classList.add("msg-highlight"),setTimeout(()=>u.classList.remove("msg-highlight"),2e3))};return(()=>{var e=Se(),s=e.firstChild,_=s.firstChild,u=_.nextSibling;return d(e,a(se,{get children(){return[O(()=>V()??decodeURIComponent(i.agentName))," Messages - Manifest"]}}),s),d(e,a(ae,{name:"description",get content(){return`Browse all messages sent and received by ${V()??decodeURIComponent(i.agentName)}. Filter by provider or cost.`}}),s),d(u,a(p,{get when(){return!z()},get children(){return[a(de,{get value(){return x()},onChange:y,get options(){return X()}}),(()=>{var t=xe(),r=t.firstChild,c=r.nextSibling,n=c.nextSibling;return r.$$input=m=>q(m.currentTarget.value),n.$$input=m=>H(m.currentTarget.value),B(()=>r.value=v()),B(()=>n.value=h()),t})()]}}),null),d(u,a(p,{get when(){return O(()=>!!z())()&&!P()},get children(){var t=ye();return t.$$click=()=>k(!0),t}}),null),d(e,a(p,{get when(){return l()!==void 0||!l.loading},get fallback(){return(()=>{var t=we(),r=t.firstChild,c=r.nextSibling,n=c.firstChild,m=n.firstChild,w=m.nextSibling;return d(w,a(re,{each:[1,2,3,4,5,6,7,8,9,10],children:()=>Ne()})),t})()},get children(){return a(p,{get when(){return!l.error},get fallback(){return a(oe,{get error(){return l.error},onRetry:G})},get children(){return[a(p,{get when(){return z()},get children(){return a(p,{get when(){return P()},get fallback(){return(()=>{var t=Pe(),r=t.firstChild,c=r.nextSibling,n=c.nextSibling;return n.$$click=()=>k(!0),t})()},get children(){var t=$e(),r=t.firstChild,c=r.nextSibling,n=c.nextSibling;return n.$$click=()=>I(`/agents/${encodeURIComponent(i.agentName)}/routing`,{state:{openProviders:!0}}),t}})}}),a(p,{get when(){return J()},get children(){var t=Me(),r=t.firstChild,c=r.nextSibling,n=c.firstChild,m=n.nextSibling,w=m.nextSibling;return w.$$click=Q,t}}),a(p,{get when(){return K()},get children(){return[a(p,{get when(){return O(()=>!!T())()&&C()},get children(){return ke()}}),(()=>{var t=Ce(),r=t.firstChild,c=r.firstChild,n=c.nextSibling,m=n.firstChild,w=r.nextSibling;return d(n,()=>l()?.total_count??0,m),d(w,a(ge,{get items(){return l()?.items??[]},columns:ue,get agentName(){return i.agentName},customProviderName:f,onFallbackErrorClick:Y,rowIdPrefix:"msg-",showHeaderTooltips:!0,expandable:!0})),d(t,a(pe,{get currentPage(){return o.currentPage},totalItems:()=>l()?.total_count??0,get pageSize(){return o.pageSize},get hasNextPage(){return o.hasNextPage},isLoading:()=>l.loading,get onPrevious(){return o.previousPage},get onNext(){return o.nextPage}}),null),t})()]}})]}})}}),null),d(e,a(me,{get open(){return E()},get agentName(){return decodeURIComponent(i.agentName)},onClose:()=>k(!1)}),null),e})()};ne(["input","click"]);export{je as default};