This repository has been archived on 2026-04-03. You can view files and clone it, but cannot push or open issues or pull requests.
nyx/dist/assets/DevView-lskM9Phs.js
Nico e2667f8e12 Initial nyx project — fork of hermes-frontend
Forked from hermes-frontend, stripped openclaw/bun specifics:
- Auth tokens: openclaw_session -> nyx_session
- Vite proxy: localhost:3003 -> localhost:8000 (assay)
- Prod WS: wss://assay.loop42.de/ws
- Workspace paths: removed openclaw-specific paths
- Added missing deps: @heroicons/vue, overlayscrollbars-vue
- Branding: title -> nyx

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 20:23:27 +02:00

2 lines
14 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{o,c as i,a as t,h as ge,w as ke,Y as g,G as _e,n as we,g as M,b as le,f as Ce,p as n,q as xe,A,s as W,J as Te,P as Ie,l as f,v as c,r,O as Me,i as N,B as K,Z as Y,H as Q,$ as X,x as a,j as k,F as ee,y as te,K as $e,a0 as Se,z as Ae,a1 as Ne,a2 as Oe,e as Be,Q as De,_ as Pe}from"./index-BcBhCcW4.js";import{b as Re,r as Ee,a as Le}from"./LockClosedIcon-BaCuRZ_8.js";function qe(O,$){return o(),i("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[t("path",{"fill-rule":"evenodd",d:"M1 8a2 2 0 0 1 2-2h.93a2 2 0 0 0 1.664-.89l.812-1.22A2 2 0 0 1 8.07 3h3.86a2 2 0 0 1 1.664.89l.812 1.22A2 2 0 0 0 16.07 6H17a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8Zm13.5 3a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0ZM10 14a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z","clip-rule":"evenodd"})])}function Ve(O,$){return o(),i("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[t("path",{"fill-rule":"evenodd",d:"M9.293 2.293a1 1 0 0 1 1.414 0l7 7A1 1 0 0 1 17 11h-1v6a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-6H3a1 1 0 0 1-.707-1.707l7-7Z","clip-rule":"evenodd"})])}function He(O,$){return o(),i("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[t("path",{d:"M2.22 2.22a.75.75 0 0 1 1.06 0l6.783 6.782a1 1 0 0 1 .935.935l6.782 6.783a.75.75 0 1 1-1.06 1.06l-6.783-6.782a1 1 0 0 1-.935-.935L2.22 3.28a.75.75 0 0 1 0-1.06ZM3.636 16.364a9.004 9.004 0 0 1-1.39-10.936L3.349 6.53a7.503 7.503 0 0 0 1.348 8.773.75.75 0 0 1-1.061 1.061ZM6.464 13.536a5 5 0 0 1-1.213-5.103l1.262 1.262a3.493 3.493 0 0 0 1.012 2.78.75.75 0 0 1-1.06 1.06ZM16.364 3.636a9.004 9.004 0 0 1 1.39 10.937l-1.103-1.104a7.503 7.503 0 0 0-1.348-8.772.75.75 0 1 1 1.061-1.061ZM13.536 6.464a5 5 0 0 1 1.213 5.103l-1.262-1.262a3.493 3.493 0 0 0-1.012-2.78.75.75 0 0 1 1.06-1.06Z"})])}function Ze(O,$){return o(),i("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[t("path",{d:"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"})])}const Fe={class:"page"},ze={class:"dev-header"},je={class:"dev-actions"},Ge=["disabled"],Je=["disabled"],Ue={class:"content"},We={class:"dev-section"},Ke={class:"dev-actions"},Ye={class:"dev-section"},Qe={class:"dev-flags"},Xe={class:"dev-flag"},et={class:"dev-flag"},tt={class:"dev-flag"},st={class:"dev-section"},nt={key:0,class:"dev-actions"},ot={key:1,class:"dev-actions",style:{gap:"var(--space-page)","align-items":"center","flex-wrap":"wrap"}},lt={class:"takeover-token"},it={key:0,class:"dev-section"},at={key:0,class:"dev-system-granted"},dt={class:"dev-system-code"},rt={class:"dev-system-desc"},ut={class:"dev-system-expiry"},ct={class:"dev-actions",style:{"margin-top":"8px"}},vt=["onClick"],pt=["onClick"],ft={class:"dev-section"},ht={class:"counter-controls"},mt=["disabled"],yt={class:"counter-value",id:"mcp-counter-value"},bt=["disabled"],gt={key:0,class:"counter-challenge"},kt={class:"counter-message"},_t={key:0,class:"counter-timer"},wt={key:1,class:"counter-hint"},Ct={key:1,class:"dev-section"},xt={class:"action-picker"},Tt=["disabled","onClick"],It={class:"dev-section"},Mt={key:0,class:"dev-loading"},$t={key:1,class:"dev-error"},St={key:2,class:"credits-widget"},At={class:"credits-bar-track"},Nt={class:"credits-row"},Ot={class:"credits-stat"},Bt={class:"credits-amount credits-used"},Dt={class:"credits-stat"},Pt={class:"credits-amount credits-remaining"},Rt={class:"credits-stat"},Et={class:"credits-amount"},Lt={key:2,class:"dev-section"},qt={class:"dev-table-wrap"},Vt={class:"dev-table"},Ht={class:"agent-id"},Zt={class:"breakout-modal"},Ft={class:"breakout-nonce"},zt={key:1,class:"not-logged-in"},jt="nyx_session",Gt=ge({name:"DevView",__name:"DevView",setup(O){const $=De(),{isLoggedIn:ie}=xe,{connected:_,send:E,onMessage:ae}=ke,{theme:L,setTheme:q}=Ne(),w=Oe(),se=g.token,V=g.capture.isActive,C=g.breakout.pendingRequest;function de(){g.init()}function re(){g.revoke()}function ue(){C.value?.resolve(!0)}function ne(){C.value?.resolve(!1)}async function ce(){V.value?g.capture.disable():await g.capture.enable()}const x=()=>localStorage.getItem(jt)??"",p=r([]),H=r(null);async function ve(){try{const l=await fetch(`${M()}/api/system/pending`,{headers:{Authorization:`Bearer ${x()}`}});if(l.ok){const{pending:e}=await l.json();p.value=e??[]}}catch{}}async function pe(l){(await fetch(`${M()}/api/system/approve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionToken:x(),requestId:l})})).ok&&(p.value=p.value.filter(d=>d.requestId!==l))}async function fe(l){await fetch(`${M()}/api/system/deny`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionToken:x(),requestId:l})}),p.value=p.value.filter(e=>e.requestId!==l)}const Z=r(Math.floor(Math.random()*11)),B=r(!1),m=r(!0),T=r(""),y=r(0);let u=null,F=0;const S=r({title:"",options:[]}),D=r(!1);async function he(l){D.value=!0,S.value={title:"",options:[]};try{await fetch(`${M()}/api/dev/counter`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${x()}`},body:JSON.stringify({action:"pick",pick:l})})}catch{}D.value=!1}async function oe(l){m.value=!0,F++,u&&(clearInterval(u),u=null),T.value="",y.value=0,B.value=!0;try{await fetch(`${M()}/api/dev/counter`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${x()}`},body:JSON.stringify({action:l})})}catch{}B.value=!1}const z=r(!1),P=r(""),v=r(null);function j(l){return l==null?"—":l.toFixed(2)}const me=Be(()=>{const l=v.value?.credits?.total,e=v.value?.credits?.used;return l?Math.min(100,e/l*100):0});function R(){_.value&&(z.value=!0,P.value="",E({type:"stats_request"}))}const G=r(!1),J=r(!1);function ye(){_.value&&(G.value=!0,E({type:"disco_request"}),setTimeout(()=>{G.value=!1},2e3))}function be(){_.value&&(J.value=!0,E({type:"disco_chat_request"}),setTimeout(()=>{J.value=!1},3e3))}let U=null,h;return _e(()=>{ve(),U=ae(e=>{if(e.type==="system_access_request"){p.value.find(d=>d.requestId===e.requestId)||p.value.push(e);return}if(e.type==="counter_update"){Z.value=e.value??Z.value;return}if(e.type==="counter_challenge"){T.value=e.message||"DECIDE NOW!",y.value=e.timeout||30,m.value=!1,we(()=>{const s=document.querySelector(".counter-widget");s&&(s.classList.remove("flash"),s.offsetWidth,s.classList.add("flash"),s.scrollIntoView({behavior:"smooth",block:"center"}))}),u&&clearInterval(u);const d=++F;u=setInterval(()=>{if(d!==F){clearInterval(u);return}y.value--,y.value<=0&&(u&&(clearInterval(u),u=null),m.value=!0,T.value="",fetch(`${M()}/api/dev/counter`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${x()}`},body:JSON.stringify({action:"timeout"})}))},1e3);return}if(e.type==="confetti"){const d=document.createElement("div");d.className="confetti-container";const s=["#ff6b6b","#ffd93d","#6bcb77","#4d96ff","#ff922b","#cc5de8"];for(let I=0;I<60;I++){const b=document.createElement("div");b.className="confetti-piece",b.style.left=Math.random()*100+"%",b.style.background=s[Math.floor(Math.random()*s.length)],b.style.animationDelay=Math.random()*2+"s",b.style.borderRadius=Math.random()>.5?"50%":"0",d.appendChild(b)}document.body.appendChild(d),setTimeout(()=>d.remove(),5e3);return}if(e.type==="action_picker"){S.value={title:e.title||"Next?",options:e.options||[]},D.value=!1;return}if(e.type==="counter_mute"){m.value=!0,T.value=e.message||"",u&&(clearInterval(u),u=null),y.value=0;return}e.type==="stats"&&(z.value=!1,e.error?P.value=e.error:v.value=e)});const l=()=>{R(),h=setInterval(R,15e3)};if(_.value)l();else{const e=le(_,d=>{d&&(e(),l())})}}),le(()=>$.name,(l,e)=>{l==="dev"&&!h&&_.value?(R(),h=setInterval(R,15e3)):e==="dev"&&l!=="dev"&&h&&(clearInterval(h),h=void 0)}),Ce(()=>{U&&U(),h&&clearInterval(h)}),(l,e)=>{const d=Me("RouterLink");return n(ie)?(o(),A(n(Ie),{key:0,class:"dev-view",options:n(Te),element:"div"},{default:W(()=>[t("div",Fe,[t("div",ze,[e[11]||(e[11]=t("h2",null,"/dev",-1)),t("div",je,[f(d,{to:"/agents",class:"dev-disco-btn"},{default:W(()=>[f(n(Ve),{class:"w-4 h-4 inline"}),e[8]||(e[8]=c(" Home",-1))]),_:1}),t("button",{class:"dev-disco-btn",onClick:ye,disabled:G.value},[f(n(Ee),{class:"w-4 h-4 inline"}),e[9]||(e[9]=c(" Disconnect Gateway",-1))],8,Ge),t("button",{class:"dev-disco-btn",onClick:be,disabled:J.value},[f(n(He),{class:"w-4 h-4 inline"}),e[10]||(e[10]=c(" Disconnect Chat",-1))],8,Je)])]),t("div",Ue,[t("div",We,[e[15]||(e[15]=t("h3",null,"Theme",-1)),t("div",Ke,[t("button",{class:N(["dev-theme-btn",{active:n(L)==="loop42"}]),onClick:e[0]||(e[0]=s=>n(q)("loop42"))},[(o(),A(K(n(Y).loop42),{class:"w-4 h-4 inline"})),e[12]||(e[12]=c(" loop42",-1))],2),t("button",{class:N(["dev-theme-btn",{active:n(L)==="titan"}]),onClick:e[1]||(e[1]=s=>n(q)("titan"))},[(o(),A(K(n(Y).titan),{class:"w-4 h-4 inline"})),e[13]||(e[13]=c(" Titan",-1))],2),t("button",{class:N(["dev-theme-btn",{active:n(L)==="eras"}]),onClick:e[2]||(e[2]=s=>n(q)("eras"))},[(o(),A(K(n(Y).eras),{class:"w-4 h-4 inline"})),e[14]||(e[14]=c(" ERAS",-1))],2)])]),t("div",Ye,[e[19]||(e[19]=t("h3",null,"Dev Flags",-1)),t("div",Qe,[t("label",Xe,[Q(t("input",{type:"checkbox","onUpdate:modelValue":e[3]||(e[3]=s=>n(w).showGrid=s)},null,512),[[X,n(w).showGrid]]),e[16]||(e[16]=t("span",null,"showGrid",-1))]),t("label",et,[Q(t("input",{type:"checkbox","onUpdate:modelValue":e[4]||(e[4]=s=>n(w).showDebugInfo=s)},null,512),[[X,n(w).showDebugInfo]]),e[17]||(e[17]=t("span",null,"showDebugInfo",-1))]),t("label",tt,[Q(t("input",{type:"checkbox","onUpdate:modelValue":e[5]||(e[5]=s=>n(w).showHud=s)},null,512),[[X,n(w).showHud]]),e[18]||(e[18]=t("span",null,"showHud",-1))])])]),t("div",st,[e[22]||(e[22]=t("h3",null,"Takeover",-1)),n(se)?(o(),i("div",ot,[t("code",lt,a(n(se)),1),t("button",{class:"dev-theme-btn active",onClick:re},[f(n(Ze),{class:"w-4 h-4 inline"}),e[21]||(e[21]=c(" Revoke",-1))]),t("button",{class:N(["dev-theme-btn",{active:n(V)}]),onClick:ce},[f(n(qe),{class:"w-4 h-4 inline"}),c(" "+a(n(V)?"Capture ON":"Enable Capture"),1)],2)])):(o(),i("div",nt,[t("button",{class:"dev-theme-btn",onClick:de},[f(n(Le),{class:"w-4 h-4 inline"}),e[20]||(e[20]=c(" Enable Takeover",-1))])]))]),p.value.length>0||H.value?(o(),i("div",it,[e[23]||(e[23]=t("h3",null,"System Access",-1)),H.value?(o(),i("div",at," Access granted to "+a(H.value.user)+" — active until session end. ",1)):k("",!0),(o(!0),i(ee,null,te(p.value,s=>(o(),i("div",{key:s.requestId,class:"dev-system-request"},[t("div",dt,a(s.userCode),1),t("div",rt,a(s.description),1),t("div",ut,"expires in "+a(Math.max(0,Math.ceil((s.expiresAt-Date.now())/1e3)))+"s",1),t("div",ct,[t("button",{class:"dev-theme-btn",onClick:I=>fe(s.requestId)},"Deny",8,vt),t("button",{class:"dev-theme-btn active",onClick:I=>pe(s.requestId)},"Approve",8,pt)])]))),128))])):k("",!0),t("div",ft,[e[24]||(e[24]=t("h3",null,"MCP Counter",-1)),t("div",{class:N(["counter-widget",{muted:m.value}])},[t("div",ht,[t("button",{class:"counter-btn",onClick:e[6]||(e[6]=s=>oe("decrement")),disabled:m.value||B.value},"",8,mt),t("span",yt,a(Z.value),1),t("button",{class:"counter-btn",onClick:e[7]||(e[7]=s=>oe("increment")),disabled:m.value||B.value},"+",8,bt)]),T.value?(o(),i("div",gt,[t("span",kt,a(T.value),1),y.value>0?(o(),i("span",_t,a(y.value)+"s",1)):k("",!0)])):(o(),i("div",wt,"Waiting for Claude..."))],2)]),S.value.title?(o(),i("div",Ct,[t("h3",null,a(S.value.title),1),t("div",xt,[(o(!0),i(ee,null,te(S.value.options,(s,I)=>(o(),i("button",{key:I,class:"action-pick-btn",disabled:D.value,onClick:b=>he(s.id)},a(s.label),9,Tt))),128))])])):k("",!0),t("div",It,[e[28]||(e[28]=t("h3",null,"OpenRouter Credits",-1)),z.value&&!v.value?(o(),i("div",Mt,"Loading…")):P.value?(o(),i("div",$t,a(P.value),1)):v.value?(o(),i("div",St,[t("div",At,[t("div",{class:"credits-bar-fill",style:$e({width:me.value+"%"})},null,4)]),t("div",Nt,[t("div",Ot,[e[25]||(e[25]=t("span",{class:"credits-label"},"Used",-1)),t("span",Bt,"$"+a(j(v.value.credits.used)),1)]),t("div",Dt,[e[26]||(e[26]=t("span",{class:"credits-label"},"Remaining",-1)),t("span",Pt,"$"+a(j(v.value.credits.remaining)),1)]),t("div",Rt,[e[27]||(e[27]=t("span",{class:"credits-label"},"Total",-1)),t("span",Et,"$"+a(j(v.value.credits.total)),1)])])])):k("",!0)]),v.value?(o(),i("div",Lt,[e[30]||(e[30]=t("h3",null,"Agents",-1)),t("div",qt,[t("table",Vt,[e[29]||(e[29]=t("thead",null,[t("tr",null,[t("th",null,"Agent"),t("th",null,"Model"),t("th",null,"Context"),t("th",null,"Prompt / 1M"),t("th",null,"Completion / 1M")])],-1)),t("tbody",null,[(o(!0),i(ee,null,te(v.value.agents,s=>(o(),i("tr",{key:s.id},[t("td",Ht,a(s.id),1),t("td",null,[t("code",null,a(s.modelId||s.model),1)]),t("td",null,a(s.contextLength?(s.contextLength/1e3).toFixed(0)+"k":"—"),1),t("td",null,a(s.promptPrice!==null?"$"+s.promptPrice.toFixed(3):"—"),1),t("td",null,a(s.completionPrice!==null?"$"+s.completionPrice.toFixed(3):"—"),1)]))),128))])])])])):k("",!0)])]),(o(),A(Se,{to:"body"},[n(C)?(o(),i("div",{key:0,class:"breakout-modal-overlay",onClick:Ae(ne,["self"])},[t("div",Zt,[e[33]||(e[33]=t("h3",null,"Open Breakout",-1)),t("p",null,[e[31]||(e[31]=c("Name: ",-1)),t("strong",null,a(n(C).name),1)]),t("p",null,[e[32]||(e[32]=c("Size: ",-1)),t("strong",null,a(n(C).preset),1)]),t("p",Ft,a(n(C).nonce),1),t("div",{class:"breakout-modal-actions"},[t("button",{class:"dev-theme-btn",onClick:ne},"Cancel"),t("button",{class:"dev-theme-btn active",onClick:ue},"Confirm")])])])):k("",!0)]))]),_:1},8,["options"])):(o(),i("div",zt,[t("p",null,[f(n(Re),{class:"w-5 h-5 inline"}),e[34]||(e[34]=c(" Not logged in",-1))]),f(d,{to:"/login"},{default:W(()=>[...e[35]||(e[35]=[c("Sign in →",-1)])]),_:1})]))}}}),Wt=Pe(Gt,[["__scopeId","data-v-6fcff79f"]]);export{Wt as default};