UNPKG

manifest

Version:

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

2 lines (1 loc) 19.1 kB
import{k as j,i as l,g as u,S as b,m as g,h as k,q as y,F as C,t as c,z as B,s as p,j as J,A as X,d as T,a as U,o as Q,l as V}from"./vendor-C-Y5oNOq.js";import{e as H,a as S,g as D,h as q,j as E,k as A,c as Y,f as Z,l as ee,E as te}from"./index-C4Qw7vZo.js";import{a as I,i as M,c as le,s as F,p as re}from"./routing-utils-CHapjwyd.js";import{g as L,I as ae}from"./model-display-DHwvDtl4.js";import{a as ne,b as O}from"./AuthBadge-Dj2KkXRW.js";import{S as se}from"./SetupStepAddProvider-CSNkQmoC.js";function vt(e={}){return H("/messages",e)}function oe(e){return H(`/messages/${encodeURIComponent(e)}/details`)}var ie=c("<span class=msg-detail__severity-dot>"),de=c("<tr><td class=msg-detail__mono-xs></td><td class=msg-detail__mono-xs></td><td class=msg-detail__mono-xs></td><td class=msg-detail__mono></td><td class=msg-detail__mono></td><td class=msg-detail__mono-xs></td><td class=msg-detail__mono-xs>"),ue=c("<tr><td class=msg-detail__mono-xs></td><td class=msg-detail__mono-xs></td><td><span></span></td><td class=msg-detail__mono-xs style=max-width:300px;overflow:hidden;text-overflow:ellipsis>"),ce=c('<tr><td class=msg-detail__mono-xs style=white-space:nowrap></td><td><span class=msg-detail__mono-xs style=margin-left:6px></span></td><td class="msg-detail__mono-xs msg-detail__log-body">'),_e=c("<span class=msg-detail__meta-item><span class=msg-detail__meta-label>"),ge=c("<div class=msg-detail__loader><div class=msg-detail__spinner></div><span>Loading details..."),me=c("<div class=msg-detail__error>Failed to load details"),he=c("<div class=msg-detail>"),ve=c("<div class=msg-detail__section><div class=msg-detail__section-title>Error</div><div class=msg-detail__error-box>"),$e=c("<div class=msg-detail__fallback-banner>Fallback from <strong>"),fe=c("<div class=msg-detail__section><div class=msg-detail__section-title>Message</div><div class=msg-detail__meta><span class=msg-detail__meta-item><span class=msg-detail__meta-label>Status</span><span>"),be=c('<div class=msg-detail__section><div class=msg-detail__section-title>LLM Calls<span class=msg-detail__count></span></div><div class=data-table-scroll><table class="data-table msg-detail__table"><thead><tr><th>#</th><th>Request Model</th><th>Response Model</th><th>Input</th><th>Output</th><th>Duration</th><th>TTFT</th></tr></thead><tbody>'),pe=c('<div class=msg-detail__section><div class=msg-detail__section-title>Tool Executions<span class=msg-detail__count></span></div><div class=data-table-scroll><table class="data-table msg-detail__table"><thead><tr><th>Tool</th><th>Duration</th><th>Status</th><th>Error</th></tr></thead><tbody>'),ke=c('<div class=msg-detail__section><div class=msg-detail__section-title>Agent Logs<span class=msg-detail__count></span></div><div class=data-table-scroll><table class="data-table msg-detail__table"><thead><tr><th>Time</th><th>Severity</th><th>Message</th></tr></thead><tbody>');function xe(e){const t=()=>{switch(e.severity){case"error":return"hsl(var(--destructive))";case"warn":return"hsl(var(--chart-5))";default:return"hsl(var(--muted-foreground))"}};return(()=>{var s=ie();return k(o=>{var n=t(),r=e.severity;return n!==o.e&&B(s,"background",o.e=n),r!==o.t&&p(s,"title",o.t=r),o},{e:void 0,t:void 0}),s})()}function Ce(e){const t=e.call;return(()=>{var s=de(),o=s.firstChild,n=o.nextSibling,r=n.nextSibling,i=r.nextSibling,d=i.nextSibling,a=d.nextSibling,m=a.nextSibling;return l(o,()=>t.call_index??"—"),l(n,()=>t.request_model??"—"),l(r,()=>t.response_model??"—"),l(i,()=>S(t.input_tokens)),l(d,()=>S(t.output_tokens)),l(a,(()=>{var v=g(()=>t.duration_ms!=null);return()=>v()?D(t.duration_ms):"—"})()),l(m,(()=>{var v=g(()=>t.ttft_ms!=null);return()=>v()?`${t.ttft_ms}ms`:"—"})()),s})()}function we(e){const t=e.tool;return(()=>{var s=ue(),o=s.firstChild,n=o.nextSibling,r=n.nextSibling,i=r.firstChild,d=r.nextSibling;return l(o,()=>t.tool_name),l(n,(()=>{var a=g(()=>t.duration_ms!=null);return()=>a()?D(t.duration_ms):"—"})()),l(i,()=>t.status),l(d,()=>t.error_message??"—"),k(()=>y(i,`status-badge status-badge--${t.status}`)),s})()}function ye(e){const t=e.log;return(()=>{var s=ce(),o=s.firstChild,n=o.nextSibling,r=n.firstChild,i=n.nextSibling;return l(o,()=>q(t.timestamp)),l(n,u(xe,{get severity(){return t.severity}}),r),l(r,()=>t.severity),l(i,()=>t.body??"—"),s})()}function x(e){return u(b,{get when(){return e.value},get children(){var t=_e(),s=t.firstChild;return l(s,()=>e.label),l(t,()=>e.value,null),t}})}function Se(e){const[t]=j(()=>e.messageId,oe);return(()=>{var s=he();return l(s,u(b,{get when(){return g(()=>!!t.loading)()&&!t.error},get children(){return ge()}}),null),l(s,u(b,{get when(){return t.error},get children(){return me()}}),null),l(s,u(b,{get when(){return g(()=>!!(!t.error&&t()))()&&!t.loading},get children(){return(()=>{const o=t(),n=o.message,r=n.model?I(n.model):null;return[u(b,{get when(){return n.error_message},get children(){var i=ve(),d=i.firstChild,a=d.nextSibling;return l(a,()=>n.error_message),i}}),u(b,{get when(){return n.fallback_from_model},get children(){var i=$e(),d=i.firstChild,a=d.nextSibling;return l(a,()=>n.fallback_from_model),l(i,u(b,{get when(){return n.fallback_index!=null},get children(){return[" ","(attempt #",g(()=>(n.fallback_index??0)+1),")"]}}),null),i}}),(()=>{var i=fe(),d=i.firstChild,a=d.nextSibling,m=a.firstChild,v=m.firstChild,_=v.nextSibling;return l(_,()=>n.status),l(a,u(x,{label:"ID",get value(){return n.id}}),null),l(a,u(x,{label:"Model",get value(){return g(()=>!!n.model)()?L(n.model):null}}),null),l(a,u(x,{label:"Model ID",get value(){return n.model}}),null),l(a,u(x,{label:"Provider",value:r}),null),l(a,u(x,{label:"Trace",get value(){return n.trace_id?.slice(0,16)}}),null),l(a,u(x,{label:"Routing",get value(){return n.routing_tier}}),null),l(a,u(x,{label:"Reason",get value(){return n.routing_reason}}),null),l(a,u(x,{label:"Auth",get value(){return n.auth_type}}),null),l(a,u(x,{label:"Service",get value(){return n.service_type}}),null),l(a,u(x,{label:"Session",get value(){return n.session_key}}),null),l(a,u(x,{label:"Description",get value(){return n.description}}),null),l(a,u(x,{label:"Skill",get value(){return n.skill_name}}),null),k(()=>y(_,`status-badge status-badge--${n.status}`)),i})(),u(b,{get when(){return o.llm_calls.length>0},get children(){var i=be(),d=i.firstChild,a=d.firstChild,m=a.nextSibling,v=d.nextSibling,_=v.firstChild,f=_.firstChild,h=f.nextSibling;return l(m,()=>o.llm_calls.length),l(h,u(C,{get each(){return o.llm_calls},children:$=>u(Ce,{call:$})})),i}}),u(b,{get when(){return o.tool_executions.length>0},get children(){var i=pe(),d=i.firstChild,a=d.firstChild,m=a.nextSibling,v=d.nextSibling,_=v.firstChild,f=_.firstChild,h=f.nextSibling;return l(m,()=>o.tool_executions.length),l(h,u(C,{get each(){return o.tool_executions},children:$=>u(we,{tool:$})})),i}}),u(b,{get when(){return o.agent_logs.length>0},get children(){var i=ke(),d=i.firstChild,a=d.firstChild,m=a.nextSibling,v=d.nextSibling,_=v.firstChild,f=_.firstChild,h=f.nextSibling;return l(m,()=>o.agent_logs.length),l(h,u(C,{get each(){return o.agent_logs},children:$=>u(ye,{log:$})})),i}})]})()}}),null),s})()}var Te=c('<svg xmlns=http://www.w3.org/2000/svg width=12 height=12 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round aria-hidden=true><polyline points="22 12 18 12 15 21 9 3 6 12 2 12">'),Pe=c('<svg xmlns=http://www.w3.org/2000/svg width=11 height=11 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2.5 stroke-linecap=round stroke-linejoin=round aria-hidden=true style=margin-right:3px;flex-shrink:0><polyline points="15 17 20 12 15 7"></polyline><path d="M4 18v-2a4 4 0 0 1 4-4h12">'),Ee=c("<td style=white-space:nowrap;font-family:var(--font-mono);font-size:var(--font-size-xs);color:hsl(var(--muted-foreground))>"),P=c("<td style=font-family:var(--font-mono);font-size:var(--font-size-xs);color:hsl(var(--muted-foreground))>"),Me=c("<span title=Heartbeat style=display:inline-flex;align-items:center;margin-left:4px;color:hsl(var(--muted-foreground));opacity:0.7>"),Ie=c('<span title="Included in subscription"style=color:hsl(var(--muted-foreground))>$0.00'),G=c("<td style=font-family:var(--font-mono)>"),N=c("<span>"),Le=c("<td style=font-family:var(--font-mono);font-size:var(--font-size-xs);color:hsl(var(--muted-foreground))><span style=display:inline-flex;align-items:center;gap:4px>"),De=c("<span class=provider-card__logo-letter style=width:16px;height:16px;font-size:9px;flex-shrink:0;border-radius:50%>"),Ne=c("<span role=img style=display:inline-flex;flex-shrink:0;position:relative>"),Re=c('<span class="tier-badge tier-badge--fallback">fallback'),Ae=c("<span class=status-badge-tooltip tabindex=0 role=note><span></span><span class=status-badge-tooltip__bubble>"),Fe=c("<td>");function Oe(){return Te()}function z(){return Pe()}const ze={date:"Date",message:"Message",cost:"Cost",totalTokens:"Tokens",input:"Input",output:"Output",model:"Model",cache:"Cache",duration:"Duration",status:"Status"},Ke={totalTokens:"Tokens are units of text that AI models process. More tokens = higher cost.",input:"Tokens sent to the model (your prompt). Also called 'input tokens'.",output:"Tokens returned by the model (its response). Also called 'output tokens'."};function je(e,t){const s=e==="totalTokens"&&t?"Total Tokens":ze[e],o=Ke[e];return o&&(t||e!=="totalTokens")?[s,u(ae,{text:o})]:s}function Be(e){return(()=>{var t=Ee();return l(t,()=>q(e.timestamp)),t})()}function Ue(e){return(()=>{var t=P();return l(t,()=>e.id.slice(0,8),null),l(t,(()=>{var s=g(()=>e.routing_reason==="heartbeat");return()=>s()&&(()=>{var o=Me();return l(o,u(Oe,{})),o})()})(),null),t})()}function He(e){return(()=>{var t=G();return l(t,u(b,{get when(){return e.auth_type==="subscription"},get fallback(){return(()=>{var s=N();return l(s,(()=>{var o=g(()=>e.cost!=null);return()=>o()?Z(e.cost)??"—":"—"})()),k(()=>p(s,"title",e.cost!=null&&e.cost>0&&e.cost<.01?`$${e.cost.toFixed(6)}`:void 0)),s})()},get children(){return Ie()}})),t})()}function qe(e,t){return(()=>{var s=Le(),o=s.firstChild;return l(o,(()=>{var n=g(()=>!!(e.model&&M(e.model)==="custom"));return()=>n()?(()=>{const r=t(e.model),i=le(r??"",16,void 0,e.model??void 0);if(i)return i;const d=(r??F(e.model)).charAt(0).toUpperCase();return(()=>{var a=De();return p(a,"title",r),l(a,d),k(m=>B(a,"background",Y(r??""))),a})()})():g(()=>!!(e.model&&M(e.model)))()?(()=>{var r=Ne();return l(r,()=>re(M(e.model),14),null),l(r,()=>ne(e.auth_type,8),null),k(i=>{var d=`${I(e.model)} (${O(e.auth_type)})`,a=`${I(e.model)} (${O(e.auth_type)})`;return d!==i.e&&p(r,"aria-label",i.e=d),a!==i.t&&p(r,"title",i.t=a),i},{e:void 0,t:void 0}),r})():null})(),null),l(o,(()=>{var n=g(()=>!!e.model);return()=>n()?g(()=>!!e.model.startsWith("custom:"))()?`custom:${t(e.model)??"Custom"}/${F(e.model)}`:L(e.model):"—"})(),null),l(o,(()=>{var n=g(()=>!!e.routing_tier);return()=>n()&&(()=>{var r=N();return l(r,()=>e.routing_tier),k(()=>y(r,`tier-badge tier-badge--${e.routing_tier}`)),r})()})(),null),l(o,(()=>{var n=g(()=>!!e.fallback_from_model);return()=>n()&&(()=>{var r=Re();return k(()=>p(r,"title",`Fallback from ${L(e.fallback_from_model)}`)),r})()})(),null),s})()}function Ge(e){return(()=>{var t=G();return l(t,()=>e!=null?S(e):"—"),t})()}function K(e){return(()=>{var t=P();return l(t,()=>e!=null?S(e):"—"),t})()}function We(e){const t=(e.cache_read_tokens??0)>0||(e.cache_creation_tokens??0)>0;return(()=>{var s=P();return l(s,()=>t?`Read: ${S(e.cache_read_tokens??0)} / Write: ${S(e.cache_creation_tokens??0)}`:"—"),s})()}function Je(e){return(()=>{var t=P();return l(t,(()=>{var s=g(()=>e.duration_ms!=null);return()=>s()?D(e.duration_ms):"—"})()),t})()}function Xe(e,t,s){return(()=>{var o=Fe();return l(o,u(b,{get when(){return e.error_message},get fallback(){return(()=>{var n=N();return l(n,(()=>{var r=g(()=>e.status==="fallback_error");return()=>r()&&u(z,{})})(),null),l(n,(()=>{var r=g(()=>e.status==="rate_limited");return()=>r()?u(X,{get href(){return`/agents/${encodeURIComponent(t)}/limits`},get children(){return E(e.status)}}):E(e.status)})(),null),k(()=>y(n,`status-badge status-badge--${e.status}`)),n})()},get children(){var n=Ae(),r=n.firstChild,i=r.nextSibling;return J(r,"click",e.status==="fallback_error"&&e.model&&s?()=>s(e.model):void 0,!0),l(r,(()=>{var d=g(()=>e.status==="fallback_error");return()=>d()&&u(z,{})})(),null),l(r,()=>E(e.status),null),l(i,()=>A(e.error_message)),k(d=>{var a=A(e.error_message),m=`status-badge status-badge--${e.status}`;return a!==d.e&&p(n,"aria-label",d.e=a),m!==d.t&&y(r,d.t=m),d},{e:void 0,t:void 0}),n}})),o})()}function W(e,t,s){switch(e){case"date":return Be(t);case"message":return Ue(t);case"cost":return He(t);case"totalTokens":return Ge(t.total_tokens);case"input":return K(t.input_tokens);case"output":return K(t.output_tokens);case"model":return qe(t,s.customProviderName);case"cache":return We(t);case"duration":return Je(t);case"status":return Xe(t,s.agentName,s.onFallbackErrorClick)}}T(["click"]);var Qe=c('<svg xmlns=http://www.w3.org/2000/svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round aria-hidden=true><polyline points="6 9 12 15 18 9">'),Ve=c("<tr><td class=msg-detail__chevron-cell><button>"),Ye=c("<tr class=msg-detail__row><td class=msg-detail__cell>"),Ze=c("<tr>"),et=c("<th class=msg-detail__chevron-th>"),tt=c("<table class=data-table><thead><tr></tr></thead><tbody>"),lt=c("<th>");function rt(){return Qe()}function at(e){const[t,s]=U(!1),o=()=>e.columns.length+1,n={agentName:e.tableProps.agentName,customProviderName:e.tableProps.customProviderName,onFallbackErrorClick:e.tableProps.onFallbackErrorClick};return[(()=>{var r=Ve(),i=r.firstChild,d=i.firstChild;return l(r,u(C,{get each(){return e.columns},children:a=>W(a,e.item,n)}),i),d.$$click=()=>s(!t()),l(d,u(rt,{})),k(a=>{var m=e.rowId,v=t()?"msg-row--expanded":void 0,_=`msg-detail__chevron-btn${t()?" msg-detail__chevron-btn--open":""}`,f=t(),h=t()?"Collapse details":"Expand details",$=t()?"Collapse details":"Expand details";return m!==a.e&&p(r,"id",a.e=m),v!==a.t&&y(r,a.t=v),_!==a.a&&y(d,a.a=_),f!==a.o&&p(d,"aria-expanded",a.o=f),h!==a.i&&p(d,"aria-label",a.i=h),$!==a.n&&p(d,"title",a.n=$),a},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),r})(),u(b,{get when(){return t()},get children(){var r=Ye(),i=r.firstChild;return l(i,u(Se,{get messageId(){return e.item.id}})),k(()=>p(i,"colspan",o())),r}})]}function nt(e){const t={agentName:e.tableProps.agentName,customProviderName:e.tableProps.customProviderName,onFallbackErrorClick:e.tableProps.onFallbackErrorClick};return(()=>{var s=Ze();return l(s,u(C,{get each(){return e.columns},children:o=>W(o,e.item,t)})),k(()=>p(s,"id",e.rowId)),s})()}function $t(e){return(()=>{var t=tt(),s=t.firstChild,o=s.firstChild,n=s.nextSibling;return l(o,u(C,{get each(){return e.columns},children:r=>(()=>{var i=lt();return l(i,()=>je(r,e.showHeaderTooltips)),i})()}),null),l(o,u(b,{get when(){return e.expandable},get children(){return et()}}),null),l(n,u(C,{get each(){return e.items},children:r=>e.expandable?u(at,{item:r,get columns(){return e.columns},tableProps:e,get rowId(){return g(()=>!!e.rowIdPrefix)()?`${e.rowIdPrefix}${r.id}`:void 0}}):u(nt,{item:r,get columns(){return e.columns},tableProps:e,get rowId(){return g(()=>!!e.rowIdPrefix)()?`${e.rowIdPrefix}${r.id}`:void 0}})})),t})()}T(["click"]);var st=c("<div class=custom-select__dropdown role=listbox>"),ot=c('<div class=custom-select><button class=custom-select__trigger type=button aria-haspopup=listbox><span class=custom-select__value></span><svg class=custom-select__chevron width=12 height=12 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round aria-hidden=true><path d="m6 9 6 6 6-6">'),it=c("<button class=custom-select__option type=button role=option>");const ft=e=>{const[t,s]=U(!1);let o;const n=()=>e.options.find(a=>a.value===e.value)?.label??e.placeholder??"Select...",r=d=>{o&&!o.contains(d.target)&&s(!1)},i=d=>{d.key==="Escape"&&s(!1)};return typeof document<"u"&&(document.addEventListener("click",r),document.addEventListener("keydown",i),Q(()=>{document.removeEventListener("click",r),document.removeEventListener("keydown",i)})),(()=>{var d=ot(),a=d.firstChild,m=a.firstChild,v=o;return typeof v=="function"?V(v,d):o=d,a.$$click=()=>s(!t()),l(m,n),l(d,u(b,{get when(){return t()},get children(){var _=st();return l(_,u(C,{get each(){return e.options},children:f=>(()=>{var h=it();return h.$$click=()=>{e.onChange(f.value),s(!1)},l(h,()=>f.label),k($=>{var w=e.value===f.value,R=e.value===f.value;return w!==$.e&&h.classList.toggle("custom-select__option--selected",$.e=w),R!==$.t&&p(h,"aria-selected",$.t=R),$},{e:void 0,t:void 0}),h})()})),_}}),null),k(_=>{var f=!!t(),h=t(),$=e.label??n();return f!==_.e&&a.classList.toggle("custom-select__trigger--open",_.e=f),h!==_.t&&p(a,"aria-expanded",_.t=h),$!==_.a&&p(a,"aria-label",_.a=$),_},{e:void 0,t:void 0,a:void 0}),d})()};T(["click"]);var dt=c('<div class="modal-overlay setup-modal__overlay"><div class=modal-card role=dialog aria-modal=true aria-labelledby=setup-modal-title style=max-width:600px><div class=setup-modal__header><div class=modal-card__title id=setup-modal-title>Set up agent: <em></em></div><button class=modal__close aria-label=Close><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 class=modal-card__desc>Add Manifest as a model provider, then connect at least one LLM so routing works.</p><div class=setup-modal__nav><button class=setup-modal__next>Done');const bt=e=>{const[t,{refetch:s}]=j(()=>e.open?e.agentName:null,r=>r?ee(r):null),o=()=>{const r=t()?.pluginEndpoint;return r||(window.location.hostname==="app.manifest.build"?"https://app.manifest.build/v1":`${window.location.origin}/v1`)},n=()=>{e.onDone?.(),e.onClose(),e.onGoToRouting?.()};return u(b,{get when(){return e.open},get children(){var r=dt(),i=r.firstChild,d=i.firstChild,a=d.firstChild,m=a.firstChild,v=m.nextSibling,_=a.nextSibling,f=d.nextSibling,h=f.nextSibling,$=h.firstChild;return r.$$keydown=w=>{w.key==="Escape"&&e.onClose()},r.$$click=w=>{w.target===w.currentTarget&&e.onClose()},l(v,()=>e.agentName),_.$$click=()=>e.onClose(),l(i,u(b,{get when(){return!t.error||!!e.apiKey},get fallback(){return u(te,{get error(){return t.error},title:"Could not load API key",message:"Failed to fetch your agent's API key. Please try again.",onRetry:s})},get children(){return u(se,{get apiKey(){return e.apiKey??t()?.apiKey??null},get keyPrefix(){return t()?.keyPrefix??null},get baseUrl(){return o()}})}}),h),$.$$click=n,r}})};T(["click","keydown"]);const pt=["date","message","cost","model","totalTokens","status"],kt=["date","message","cost","totalTokens","input","output","model","cache","duration","status"];export{pt as C,kt as D,$t as M,ft as S,bt as a,vt as g};