@m64/nats-agent-dashboard 0.1.0 → 0.1.2

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.
package/README.md CHANGED
@@ -9,8 +9,6 @@ Supported runtimes (auto-detected from `$SRV.PING` + metadata):
9
9
  - **`claude-channel`** — Claude Code MCP bridge (`agents.ccc.{owner}.{session}`)
10
10
  - **`nats-channel` / OpenClaw** — OpenClaw plugin agents (`agents.oc.[{org}.]{name}`)
11
11
 
12
- The visual design language and architectural patterns are copied from the **REMEMBRA** web UI to keep this dashboard consistent with the rest of the product family.
13
-
14
12
  ## Features
15
13
 
16
14
  - **Live agent grid** — periodic `$SRV.PING` discovery, grouped by runtime, color-coded badges, status dots, automatic removal when agents disappear from the bus.
@@ -27,36 +25,34 @@ The visual design language and architectural patterns are copied from the **REME
27
25
  - [`@nats-io/services`](https://www.npmjs.com/package/@nats-io/services) v3 — `Svcm` discovery client
28
26
  - [marked](https://www.npmjs.com/package/marked) + [DOMPurify](https://www.npmjs.com/package/dompurify) + [highlight.js](https://www.npmjs.com/package/highlight.js) — markdown rendering for streaming responses
29
27
 
30
- No router, no Pinia, no backend, no REST, no SSE. State is plain `reactive()` modules — same pattern REMEMBRA uses.
28
+ No router, no Pinia, no backend, no REST, no SSE. State is plain `reactive()` modules.
31
29
 
32
30
  ## Distribution
33
31
 
34
- The dashboard ships in three forms. All three are built from the same source and show the same UI:
32
+ The dashboard ships in three forms. All three are built from the same source and show the same UI.
35
33
 
36
- ### 1. Single HTML file — the demo-killer
34
+ ### 1. Single HTML file
37
35
 
38
- `npm run build` produces exactly one file: `dist/index.html` (~450 KB, ~140 KB gzipped). Everything — Vue, the stores, the markdown renderer, the NATS client, the CSS — is inlined. You can:
36
+ `npm run build` produces exactly one file: `dist/index.html` (~450 KB, ~140 KB gzipped). Everything — Vue, the stores, the markdown renderer, the NATS client, the CSS — is inlined. No external resources. You can:
39
37
 
40
- - double-click it from any file manager (loads via `file://`)
41
- - email it / drop it on a USB stick
42
- - host it on any static web server (GitHub Pages, S3, Netlify, nginx, a goddamn FTP drop)
38
+ - open it directly from the filesystem (`file://`)
39
+ - host it on any static web server (GitHub Pages, S3, Netlify, nginx, plain object storage)
40
+ - distribute it as a single file attachment
43
41
 
44
- Out of the box it connects to **`wss://demo.nats.io:8443`**Synadia's public demo server — so double-clicking the HTML file Just Works with zero local setup. Change the URL via the Settings cog (persists to localStorage), or pre-seed it via the query string:
42
+ Out of the box it connects to `wss://demo.nats.io:8443`the public Synadia demo server — so opening the HTML file requires zero local setup. Change the URL via the Settings cog (the value is persisted in `localStorage`), or pre-seed it via the query string:
45
43
 
46
44
  ```
47
- file:///tmp/index.html?nats=ws://localhost:8080
48
- https://my-host/dashboard.html?nats=wss://nats.example.com:443
45
+ file:///path/to/index.html?nats=ws://localhost:8080
46
+ https://your-host.example.com/dashboard.html?nats=wss://nats.example.com:443
49
47
  ```
50
48
 
51
- No install, no Node, no npm, no setup. **For a demo, this is the one to share.**
52
-
53
49
  ### 2. `npx` launcher
54
50
 
55
51
  ```bash
56
52
  npx @m64/nats-agent-dashboard
57
53
  ```
58
54
 
59
- Downloads the package (~150 KB, no runtime deps besides Node built-ins), spawns a tiny HTTP server on `http://localhost:5173` that serves the same single HTML file, and opens your default browser. Good for daily use where you want a consistent URL and a real `http://` origin. Connects to `wss://demo.nats.io:8443` by default, same as the single HTML file.
55
+ Downloads the package (~160 KB, no runtime dependencies besides Node built-ins), spawns a small HTTP server on `http://localhost:5173` that serves the bundled single HTML file, and opens your default browser. Connects to `wss://demo.nats.io:8443` by default, same as the single HTML file.
60
56
 
61
57
  Flags:
62
58
 
@@ -67,12 +63,13 @@ npx @m64/nats-agent-dashboard --no-open # don't open bro
67
63
  npx @m64/nats-agent-dashboard --help
68
64
  ```
69
65
 
70
- ### 3. Local dev
66
+ ### 3. Local development
71
67
 
72
- For contributing to the dashboard itself, with hot reload and source maps:
68
+ To work on the dashboard itself, with Vite's dev server, HMR and source maps:
73
69
 
74
70
  ```bash
75
- git clone
71
+ git clone https://github.com/M64GitHub/nats-agent-dashboard.git
72
+ cd nats-agent-dashboard
76
73
  npm install
77
74
  npm run dev # Vite dev server at http://localhost:5173
78
75
  ```
@@ -158,9 +155,7 @@ State is split into plain `reactive()` modules in `src/stores/`:
158
155
  | `fanoutState.js` | Fan-out form + parallel run state |
159
156
  | `appState.js` | Selected agent + UI flags |
160
157
 
161
- The `useNatsRequest.js` composable wraps the streaming reply pattern: create an inbox, subscribe, publish with `reply: inbox`, accumulate chunks, treat empty payload as end-of-stream sentinel. This pattern is verified verbatim against all four sibling channel servers see `DESIGN.md` for the protocol details and source references.
162
-
163
- The visual design tokens, base CSS, markdown styles and `useMarkdown` composable are copied verbatim from `/home/m64/space/ai/remembra/web/src/` so the dashboard looks like it belongs in the same product family.
158
+ The `useNatsRequest.js` composable wraps the streaming reply pattern: create an inbox, subscribe, publish with `reply: inbox`, accumulate chunks, and treat an empty payload as the end-of-stream sentinel. This pattern matches every sibling channel server (`nats-channel`, `nats-pi-channel`, `nats-pi-bridge`, `nats-claude-channel`).
164
159
 
165
160
  ## Build from source
166
161
 
@@ -182,7 +177,6 @@ Every third-party package bundled into `dist/index.html` has its copyright notic
182
177
  - Session export viewer (the pi-bridge doesn't auto-export yet — revisit when it does)
183
178
  - Multi-user awareness, theming, mobile layout, A2A protocol UI
184
179
 
185
-
186
180
  ## License
187
181
 
188
- Same license as the rest of the family.
182
+ Apache-2.0. See [`LICENSE`](./LICENSE) for the full text and `dist/THIRD-PARTY-LICENSES.txt` for the copyright notices of all bundled dependencies.
package/dist/index.html CHANGED
@@ -26,7 +26,7 @@ ${this.ctx.stack}`),this.cancel(c)):(this.callback(null,l),this.opts.strategy===
26
26
 
27
27
  ${D}`),I(Ie);return}A(null,mt),y.strategy==="count"&&(v--,v===0&&I()),y.strategy==="stall"&&(it(),Ye=setTimeout(()=>{I()},300)),y.strategy==="sentinel"&&mt&&mt.data.length===0&&I()}});N.requestSubject=b,N.closed.then(()=>{L()}).catch(Ie=>{T.stop(Ie)});const I=Ie=>{Ie&&T.push(()=>{throw Ie}),it(),N.drain().then(()=>{L()}).catch(mt=>{L()})};T.iterClosed.then(()=>{it(),N?.unsubscribe()}).catch(Ie=>{it(),N?.unsubscribe()});const{headers:z,traceDestination:ae,traceOnly:ke}=y;try{this.publish(b,w,{reply:N.getSubject(),headers:z,traceDestination:ae,traceOnly:ke})}catch(Ie){I(Ie)}let Ye=setTimeout(()=>{I()},y.maxWait);const it=()=>{Ye&&clearTimeout(Ye)}}else{const D=y;D.callback=A,T.iterClosed.then(()=>{v.cancel()}).catch(ae=>{v.cancel(ae)});const v=new c.RequestMany(this.protocol.muxSubscriptions,b,D);this.protocol.request(v);const{headers:N,traceDestination:I,traceOnly:z}=y;try{this.publish(b,w,{reply:`${this.protocol.muxSubscriptions.baseInbox}${v.token}`,headers:N,traceDestination:I,traceOnly:z})}catch(ae){v.cancel(ae)}}return Promise.resolve(T)}request(b,w,y={timeout:1e3,noMux:!1}){try{this._check(b,!0,!0)}catch(T){return Promise.reject(T)}const x=!this.protocol.options.noAsyncTraces;if(y.timeout=y.timeout||1e3,y.timeout<1)return Promise.reject(d.InvalidArgumentError.format("timeout","must be greater than 0"));if(!y.noMux&&y.reply)return Promise.reject(d.InvalidArgumentError.format(["reply","noMux"],"are mutually exclusive"));if(y.noMux){const T=y.reply?y.reply:(0,l.createInbox)(this.options.inboxPrefix),L=(0,e.deferred)(),A=x?new d.errors.RequestError(""):null,D=this.subscribe(T,{max:1,timeout:y.timeout,callback:(v,N)=>{N&&N.data?.length===0&&N.headers?.code===503&&(v=new d.errors.NoRespondersError(b)),v?(v instanceof d.TimeoutError||(A?(A.message=v.message,A.cause=v,v=A):v=new d.errors.RequestError(v.message,{cause:v})),L.reject(v),D.unsubscribe()):L.resolve(N)}});return D.requestSubject=b,this.protocol.publish(b,w,{reply:T,headers:y.headers}),L}else{const T=new c.RequestOne(this.protocol.muxSubscriptions,b,y,x);this.protocol.request(T);const{headers:L,traceDestination:A,traceOnly:D}=y;try{this.publish(b,w,{reply:`${this.protocol.muxSubscriptions.baseInbox}${T.token}`,headers:L,traceDestination:A,traceOnly:D})}catch(N){T.cancel(N)}const v=Promise.race([T.timer,T.deferred]);return v.catch(()=>{T.cancel()}),v}}flush(){return this.isClosed()?Promise.reject(new d.errors.ClosedConnectionError):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(new d.errors.ClosedConnectionError):this.isDraining()?Promise.reject(new d.errors.DrainingConnectionError):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const b=this.protocol.getServer();return b?b.listen:""}status(){const b=new o.QueuedIteratorImpl;return b.iterClosed.then(()=>{const w=this.protocol.listeners.indexOf(b);w>-1&&this.protocol.listeners.splice(w,1)}),this.protocol.listeners.push(b),b}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((w,y)=>w==="time"?new Date(Date.parse(y)):y)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}getServerVersion(){const b=this.info;return b?(0,r.parseSemVer)(b.version):void 0}async rtt(){if(this.isClosed())throw new d.errors.ClosedConnectionError;if(!this.protocol.connected)throw new d.errors.RequestError("connection disconnected");const b=Date.now();return await this.flush(),Date.now()-b}get features(){return this.protocol.features}reconnect(){return this.isClosed()?Promise.reject(new d.errors.ClosedConnectionError):this.isDraining()?Promise.reject(new d.errors.DrainingConnectionError):this.protocol.reconnect()}addCloseListener(b){this.closeListeners===void 0&&(this.closeListeners=new f(this.closed())),this.closeListeners.add(b)}removeCloseListener(b){this.closeListeners&&this.closeListeners.remove(b)}}ps.NatsConnectionImpl=h;class f{listeners;constructor(b){this.listeners=[],b.then(w=>{this.notify(w)})}add(b){this.listeners.push(b)}remove(b){this.listeners=this.listeners.filter(w=>w!==b)}notify(b){this.listeners.forEach(w=>{if(typeof w.connectionClosedCallback=="function")try{w.connectionClosedCallback(b)}catch{}}),this.listeners=[]}}return ps}var $n={},xo={},Vc;function Fu(){return Vc||(Vc=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Empty=void 0;var t=Ln();Object.defineProperty(e,"Empty",{enumerable:!0,get:function(){return t.Empty}})})(xo)),xo}var Yc;function yp(){if(Yc)return $n;Yc=1,Object.defineProperty($n,"__esModule",{value:!0}),$n.Bench=$n.Metric=void 0,$n.throughput=i,$n.msgThroughput=o,$n.humanizeBytes=c;const e=Fu(),t=Xi(),n=cr();class s{name;duration;date;payload;msgs;lang;version;bytes;asyncRequests;min;max;constructor(u,h){this.name=u,this.duration=h,this.date=Date.now(),this.payload=0,this.msgs=0,this.bytes=0}toString(){const u=this.duration/1e3,h=Math.round(this.msgs/u),f=this.asyncRequests?"asyncRequests":"";let g="";return this.max&&(g=`${this.min}/${this.max}`),`${this.name}${f?" [asyncRequests]":""} ${l(h)} msgs/sec - [${u.toFixed(2)} secs] ~ ${i(this.bytes,u)} ${g}`}toCsv(){return`"${this.name}",${new Date(this.date).toISOString()},${this.lang},${this.version},${this.msgs},${this.payload},${this.bytes},${this.duration},${this.asyncRequests?this.asyncRequests:!1}
28
28
  `}static header(){return`Test,Date,Lang,Version,Count,MsgPayload,Bytes,Millis,Async
29
- `}}$n.Metric=s;class r{nc;callbacks;msgs;size;subject;asyncRequests;pub;sub;req;rep;perf;payload;constructor(u,h={msgs:1e5,size:128,subject:"",asyncRequests:!1,pub:!1,sub:!1,req:!1,rep:!1}){if(this.nc=u,this.callbacks=h.callbacks||!1,this.msgs=h.msgs||0,this.size=h.size||0,this.subject=h.subject||t.nuid.next(),this.asyncRequests=h.asyncRequests||!1,this.pub=h.pub||!1,this.sub=h.sub||!1,this.req=h.req||!1,this.rep=h.rep||!1,this.perf=new n.Perf,this.payload=this.size?new Uint8Array(this.size):e.Empty,!this.pub&&!this.sub&&!this.req&&!this.rep)throw new Error("no options selected")}async run(){return this.nc.closed().then(u=>{if(u)throw u}),this.callbacks?await this.runCallbacks():await this.runAsync(),this.processMetrics()}processMetrics(){const u=this.nc,{lang:h,version:f}=u.protocol.transport;this.pub&&this.sub&&this.perf.measure("pubsub","pubStart","subStop"),this.req&&this.rep&&this.perf.measure("reqrep","reqStart","reqStop");const g=this.perf.getEntries(),b=g.find(v=>v.name==="pubsub"),w=g.find(v=>v.name==="reqrep"),y=g.find(v=>v.name==="req"),x=g.find(v=>v.name==="rep"),T=g.find(v=>v.name==="pub"),L=g.find(v=>v.name==="sub"),A=this.nc.stats(),D=[];if(b){const{name:v,duration:N}=b,I=new s(v,N);I.msgs=this.msgs*2,I.bytes=A.inBytes+A.outBytes,I.lang=h,I.version=f,I.payload=this.payload.length,D.push(I)}if(w){const{name:v,duration:N}=w,I=new s(v,N);I.msgs=this.msgs*2,I.bytes=A.inBytes+A.outBytes,I.lang=h,I.version=f,I.payload=this.payload.length,D.push(I)}if(T){const{name:v,duration:N}=T,I=new s(v,N);I.msgs=this.msgs,I.bytes=A.outBytes,I.lang=h,I.version=f,I.payload=this.payload.length,D.push(I)}if(L){const{name:v,duration:N}=L,I=new s(v,N);I.msgs=this.msgs,I.bytes=A.inBytes,I.lang=h,I.version=f,I.payload=this.payload.length,D.push(I)}if(x){const{name:v,duration:N}=x,I=new s(v,N);I.msgs=this.msgs,I.bytes=A.inBytes+A.outBytes,I.lang=h,I.version=f,I.payload=this.payload.length,D.push(I)}if(y){const{name:v,duration:N}=y,I=new s(v,N);I.msgs=this.msgs,I.bytes=A.inBytes+A.outBytes,I.lang=h,I.version=f,I.payload=this.payload.length,D.push(I)}return D}async runCallbacks(){const u=[];if(this.sub){const h=(0,n.deferred)();u.push(h);let f=0;this.nc.subscribe(this.subject,{max:this.msgs,callback:()=>{f++,f===1&&this.perf.mark("subStart"),f===this.msgs&&(this.perf.mark("subStop"),this.perf.measure("sub","subStart","subStop"),h.resolve())}})}if(this.rep){const h=(0,n.deferred)();u.push(h);let f=0;this.nc.subscribe(this.subject,{max:this.msgs,callback:(g,b)=>{b.respond(this.payload),f++,f===1&&this.perf.mark("repStart"),f===this.msgs&&(this.perf.mark("repStop"),this.perf.measure("rep","repStart","repStop"),h.resolve())}})}if(this.pub){const h=(async()=>{this.perf.mark("pubStart");for(let f=0;f<this.msgs;f++)this.nc.publish(this.subject,this.payload);await this.nc.flush(),this.perf.mark("pubStop"),this.perf.measure("pub","pubStart","pubStop")})();u.push(h)}if(this.req){const h=(async()=>{if(this.asyncRequests){this.perf.mark("reqStart");const f=[];for(let g=0;g<this.msgs;g++)f.push(this.nc.request(this.subject,this.payload,{timeout:2e4}));await Promise.all(f),this.perf.mark("reqStop"),this.perf.measure("req","reqStart","reqStop")}else{this.perf.mark("reqStart");for(let f=0;f<this.msgs;f++)await this.nc.request(this.subject);this.perf.mark("reqStop"),this.perf.measure("req","reqStart","reqStop")}})();u.push(h)}await Promise.all(u)}async runAsync(){const u=[];if(this.rep){let h=!1;const f=this.nc.subscribe(this.subject,{max:this.msgs}),g=(async()=>{for await(const b of f)h||(this.perf.mark("repStart"),h=!0),b.respond(this.payload);await this.nc.flush(),this.perf.mark("repStop"),this.perf.measure("rep","repStart","repStop")})();u.push(g)}if(this.sub){let h=!1;const f=this.nc.subscribe(this.subject,{max:this.msgs}),g=(async()=>{for await(const b of f)h||(this.perf.mark("subStart"),h=!0);this.perf.mark("subStop"),this.perf.measure("sub","subStart","subStop")})();u.push(g)}if(this.pub){const h=(async()=>{this.perf.mark("pubStart");for(let f=0;f<this.msgs;f++)this.nc.publish(this.subject,this.payload);await this.nc.flush(),this.perf.mark("pubStop"),this.perf.measure("pub","pubStart","pubStop")})();u.push(h)}if(this.req){const h=(async()=>{if(this.asyncRequests){this.perf.mark("reqStart");const f=[];for(let g=0;g<this.msgs;g++)f.push(this.nc.request(this.subject,this.payload,{timeout:2e4}));await Promise.all(f),this.perf.mark("reqStop"),this.perf.measure("req","reqStart","reqStop")}else{this.perf.mark("reqStart");for(let f=0;f<this.msgs;f++)await this.nc.request(this.subject);this.perf.mark("reqStop"),this.perf.measure("req","reqStart","reqStop")}})();u.push(h)}await Promise.all(u)}}$n.Bench=r;function i(d,u){return`${c(d/u)}/sec`}function o(d,u){return`${Math.floor(d/u)} msgs/sec`}function c(d,u=!1){const h=u?1e3:1024,f=u?["k","M","G","T","P","E"]:["K","M","G","T","P","E"],g=u?"iB":"B";if(d<h)return`${d.toFixed(2)} ${g}`;const b=parseInt(Math.log(d)/Math.log(h)+""),w=parseInt(b-1+"");return`${(d/Math.pow(h,b)).toFixed(2)} ${f[w]}${g}`}function l(d){return d.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}return $n}var As={},Xc;function vp(){if(Xc)return As;Xc=1,Object.defineProperty(As,"__esModule",{value:!0}),As.IdleHeartbeatMonitor=void 0;class e{interval;maxOut;cancelAfter;timer;autoCancelTimer;last;missed;count;callback;constructor(n,s,r={maxOut:2}){this.interval=n,this.maxOut=r?.maxOut||2,this.cancelAfter=r?.cancelAfter||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,s=0,r=2){this.interval=n,this.maxOut=r,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}return As.IdleHeartbeatMonitor=e,As}var Lr={},Ts={},Zc;function Ep(){return Zc||(Zc=1,Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.version=void 0,Ts.version="3.3.1"),Ts}var Jc;function wp(){if(Jc)return Lr;Jc=1,Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.WsTransport=void 0,Lr.wsUrlParseFn=h,Lr.wsconnect=f;const e=cr(),t=os(),n=Qi(),s=Zi(),r=Oi(),i=ju(),o=Ep(),c=Yn(),l=o.version,d="nats.ws";class u{version;lang;closeError;connected;done;socket;options;socketClosed;encrypted;peeked;yields;signal;closedNotification;constructor(){this.version=l,this.lang=d,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=(0,e.deferred)(),this.closedNotification=(0,e.deferred)()}async connect(b,w){const y=(0,e.deferred)();this.options=w;const x=b.src;if(w.wsFactory){const{socket:T,encrypted:L}=await w.wsFactory(b.src,w);this.socket=T,this.encrypted=L}else this.encrypted=x.indexOf("wss://")===0,this.socket=new WebSocket(x);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.done&&this._closed(new Error("aborted"))},this.socket.onmessage=T=>{if(this.done)return;if(this.yields.push(new Uint8Array(T.data)),this.peeked){this.signal.resolve();return}const L=s.DataBuffer.concat(...this.yields),A=(0,t.extractProtocolMessage)(L);if(A!==""){const D=r.INFO.exec(A);if(!D){w.debug&&console.error("!!!",(0,e.render)(L)),y.reject(new Error("unexpected response from server"));return}try{const v=JSON.parse(D[1]);(0,n.checkOptions)(v,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),y.resolve()}catch(v){y.reject(v);return}}},this.socket.onclose=T=>{let L;!T.wasClean&&T.reason!==""&&(L=new Error(T.reason)),this._closed(L),this._cleanup()},this.socket.onerror=T=>{if(this.done)return;const L=T,A=new c.errors.ConnectionError(L.message);y.reject(A),this._cleanup()},y}_cleanup(){this.socketClosed===!1&&(this.socketClosed=!0,this.socket.onopen=null,this.socket.onmessage=null,this.socket.onerror=null,this.socket.onclose=null,this.closedNotification.resolve(this.closeError))}disconnect(){this._closed(void 0,!0)}async _closed(b,w=!0){if(this.done){try{this.socket.close()}catch{}return}if(this.closeError=b,!b)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await(0,e.delay)(100);this.done=!0;try{this.socket.close()}catch{}return this.closedNotification}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.done)return;this.yields.length===0&&await this.signal;const b=this.yields;this.yields=[];for(let w=0;w<b.length;w++)this.options.debug&&console.info(`> ${(0,e.render)(b[w])}`),yield b[w];if(this.done)break;this.yields.length===0&&(b.length=0,this.yields=b,this.signal=(0,e.deferred)())}}isEncrypted(){return this.connected&&this.encrypted}send(b){if(!this.done)try{this.socket.send(b.buffer),this.options.debug&&console.info(`< ${(0,e.render)(b)}`);return}catch(w){this.options.debug&&console.error(`!!! ${(0,e.render)(b)}: ${w}`)}}close(b){return this._closed(b,!1)}closed(){return this.closedNotification}discard(){this.socket?.close()}}Lr.WsTransport=u;function h(g,b){/^(.*:\/\/)(.*)/.test(g)||(typeof b=="boolean"?g=`${b===!0?"https":"http"}://${g}`:g=`https://${g}`);let y=new URL(g);const x=y.protocol.toLowerCase();x==="ws:"&&(b=!1),x==="wss:"&&(b=!0),x!=="https:"&&x!=="http"&&(g=g.replace(/^(.*:\/\/)(.*)/gm,"$2"),y=new URL(`http://${g}`));let T,L;const A=y.hostname,D=y.pathname,v=y.search||"";switch(x){case"http:":case"ws:":case"nats:":L=y.port||"80",T="ws:";break;case"https:":case"wss:":case"tls:":L=y.port||"443",T="wss:";break;default:L=y.port||b===!0?"443":"80",T=b===!0?"wss:":"ws:";break}return`${T}//${A}:${L}${D}${v}`}function f(g={}){return(0,t.setTransportFactory)({defaultPort:443,urlParseFn:h,factory:()=>{if(g.tls)throw c.InvalidArgumentError.format("tls","is not configurable on w3c websocket connections");return new u}}),i.NatsConnectionImpl.connect(g)}return Lr}var $c;function ba(){return $c||($c=1,(function(e){var t=Pr&&Pr.__createBinding||(Object.create?(function(mt,We,je,me){me===void 0&&(me=je);var rt=Object.getOwnPropertyDescriptor(We,je);(!rt||("get"in rt?!We.__esModule:rt.writable||rt.configurable))&&(rt={enumerable:!0,get:function(){return We[je]}}),Object.defineProperty(mt,me,rt)}):(function(mt,We,je,me){me===void 0&&(me=je),mt[me]=We[je]})),n=Pr&&Pr.__exportStar||function(mt,We){for(var je in mt)je!=="default"&&!Object.prototype.hasOwnProperty.call(We,je)&&t(We,mt,je)};Object.defineProperty(e,"__esModule",{value:!0}),e.Metric=e.Bench=e.writeAll=e.readAll=e.MAX_SIZE=e.DenoBuffer=e.State=e.Parser=e.Kind=e.describe=e.QueuedIteratorImpl=e.usernamePasswordAuthenticator=e.tokenAuthenticator=e.nkeyAuthenticator=e.jwtAuthenticator=e.credsAuthenticator=e.RequestOne=e.parseOptions=e.hasWsProtocol=e.defaultOptions=e.DEFAULT_MAX_RECONNECT_ATTEMPTS=e.checkUnsupportedOption=e.checkOptions=e.buildAuthenticator=e.DataBuffer=e.MuxSubscription=e.Heartbeat=e.MsgHdrsImpl=e.headers=e.canonicalMIMEHeaderKey=e.timeout=e.SimpleMutex=e.render=e.nanos=e.millis=e.extend=e.delay=e.deferred=e.deadline=e.collect=e.backoff=e.ProtocolHandler=e.INFO=e.Connect=e.setTransportFactory=e.getResolveFn=e.MsgImpl=e.nuid=e.Nuid=e.NatsConnectionImpl=void 0,e.UserAuthenticationExpiredError=e.TimeoutError=e.RequestError=e.ProtocolError=e.PermissionViolationError=e.NoRespondersError=e.InvalidSubjectError=e.InvalidOperationError=e.InvalidArgumentError=e.errors=e.DrainingConnectionError=e.ConnectionError=e.ClosedConnectionError=e.AuthorizationError=e.wsUrlParseFn=e.wsconnect=e.Servers=e.isIPV4OrHostname=e.IdleHeartbeatMonitor=e.Subscriptions=e.SubscriptionImpl=e.syncIterator=e.Match=e.createInbox=e.protoLen=e.extractProtocolMessage=e.Empty=e.parseSemVer=e.Features=e.Feature=e.compare=e.parseIP=e.isIP=e.ipV4=e.TE=e.TD=void 0;var s=ju();Object.defineProperty(e,"NatsConnectionImpl",{enumerable:!0,get:function(){return s.NatsConnectionImpl}});var r=Xi();Object.defineProperty(e,"Nuid",{enumerable:!0,get:function(){return r.Nuid}}),Object.defineProperty(e,"nuid",{enumerable:!0,get:function(){return r.nuid}});var i=Ru();Object.defineProperty(e,"MsgImpl",{enumerable:!0,get:function(){return i.MsgImpl}});var o=os();Object.defineProperty(e,"getResolveFn",{enumerable:!0,get:function(){return o.getResolveFn}}),Object.defineProperty(e,"setTransportFactory",{enumerable:!0,get:function(){return o.setTransportFactory}});var c=Oi();Object.defineProperty(e,"Connect",{enumerable:!0,get:function(){return c.Connect}}),Object.defineProperty(e,"INFO",{enumerable:!0,get:function(){return c.INFO}}),Object.defineProperty(e,"ProtocolHandler",{enumerable:!0,get:function(){return c.ProtocolHandler}});var l=cr();Object.defineProperty(e,"backoff",{enumerable:!0,get:function(){return l.backoff}}),Object.defineProperty(e,"collect",{enumerable:!0,get:function(){return l.collect}}),Object.defineProperty(e,"deadline",{enumerable:!0,get:function(){return l.deadline}}),Object.defineProperty(e,"deferred",{enumerable:!0,get:function(){return l.deferred}}),Object.defineProperty(e,"delay",{enumerable:!0,get:function(){return l.delay}}),Object.defineProperty(e,"extend",{enumerable:!0,get:function(){return l.extend}}),Object.defineProperty(e,"millis",{enumerable:!0,get:function(){return l.millis}}),Object.defineProperty(e,"nanos",{enumerable:!0,get:function(){return l.nanos}}),Object.defineProperty(e,"render",{enumerable:!0,get:function(){return l.render}}),Object.defineProperty(e,"SimpleMutex",{enumerable:!0,get:function(){return l.SimpleMutex}}),Object.defineProperty(e,"timeout",{enumerable:!0,get:function(){return l.timeout}});var d=pa();Object.defineProperty(e,"canonicalMIMEHeaderKey",{enumerable:!0,get:function(){return d.canonicalMIMEHeaderKey}}),Object.defineProperty(e,"headers",{enumerable:!0,get:function(){return d.headers}}),Object.defineProperty(e,"MsgHdrsImpl",{enumerable:!0,get:function(){return d.MsgHdrsImpl}});var u=Cu();Object.defineProperty(e,"Heartbeat",{enumerable:!0,get:function(){return u.Heartbeat}});var h=Ou();Object.defineProperty(e,"MuxSubscription",{enumerable:!0,get:function(){return h.MuxSubscription}});var f=Zi();Object.defineProperty(e,"DataBuffer",{enumerable:!0,get:function(){return f.DataBuffer}});var g=Qi();Object.defineProperty(e,"buildAuthenticator",{enumerable:!0,get:function(){return g.buildAuthenticator}}),Object.defineProperty(e,"checkOptions",{enumerable:!0,get:function(){return g.checkOptions}}),Object.defineProperty(e,"checkUnsupportedOption",{enumerable:!0,get:function(){return g.checkUnsupportedOption}}),Object.defineProperty(e,"DEFAULT_MAX_RECONNECT_ATTEMPTS",{enumerable:!0,get:function(){return g.DEFAULT_MAX_RECONNECT_ATTEMPTS}}),Object.defineProperty(e,"defaultOptions",{enumerable:!0,get:function(){return g.defaultOptions}}),Object.defineProperty(e,"hasWsProtocol",{enumerable:!0,get:function(){return g.hasWsProtocol}}),Object.defineProperty(e,"parseOptions",{enumerable:!0,get:function(){return g.parseOptions}});var b=Bu();Object.defineProperty(e,"RequestOne",{enumerable:!0,get:function(){return b.RequestOne}});var w=Uu();Object.defineProperty(e,"credsAuthenticator",{enumerable:!0,get:function(){return w.credsAuthenticator}}),Object.defineProperty(e,"jwtAuthenticator",{enumerable:!0,get:function(){return w.jwtAuthenticator}}),Object.defineProperty(e,"nkeyAuthenticator",{enumerable:!0,get:function(){return w.nkeyAuthenticator}}),Object.defineProperty(e,"tokenAuthenticator",{enumerable:!0,get:function(){return w.tokenAuthenticator}}),Object.defineProperty(e,"usernamePasswordAuthenticator",{enumerable:!0,get:function(){return w.usernamePasswordAuthenticator}}),n(Du(),e);var y=ha();Object.defineProperty(e,"QueuedIteratorImpl",{enumerable:!0,get:function(){return y.QueuedIteratorImpl}});var x=Iu();Object.defineProperty(e,"describe",{enumerable:!0,get:function(){return x.describe}}),Object.defineProperty(e,"Kind",{enumerable:!0,get:function(){return x.Kind}}),Object.defineProperty(e,"Parser",{enumerable:!0,get:function(){return x.Parser}}),Object.defineProperty(e,"State",{enumerable:!0,get:function(){return x.State}});var T=Pu();Object.defineProperty(e,"DenoBuffer",{enumerable:!0,get:function(){return T.DenoBuffer}}),Object.defineProperty(e,"MAX_SIZE",{enumerable:!0,get:function(){return T.MAX_SIZE}}),Object.defineProperty(e,"readAll",{enumerable:!0,get:function(){return T.readAll}}),Object.defineProperty(e,"writeAll",{enumerable:!0,get:function(){return T.writeAll}});var L=yp();Object.defineProperty(e,"Bench",{enumerable:!0,get:function(){return L.Bench}}),Object.defineProperty(e,"Metric",{enumerable:!0,get:function(){return L.Metric}});var A=Ln();Object.defineProperty(e,"TD",{enumerable:!0,get:function(){return A.TD}}),Object.defineProperty(e,"TE",{enumerable:!0,get:function(){return A.TE}});var D=Tu();Object.defineProperty(e,"ipV4",{enumerable:!0,get:function(){return D.ipV4}}),Object.defineProperty(e,"isIP",{enumerable:!0,get:function(){return D.isIP}}),Object.defineProperty(e,"parseIP",{enumerable:!0,get:function(){return D.parseIP}});var v=ga();Object.defineProperty(e,"compare",{enumerable:!0,get:function(){return v.compare}}),Object.defineProperty(e,"Feature",{enumerable:!0,get:function(){return v.Feature}}),Object.defineProperty(e,"Features",{enumerable:!0,get:function(){return v.Features}}),Object.defineProperty(e,"parseSemVer",{enumerable:!0,get:function(){return v.parseSemVer}});var N=Fu();Object.defineProperty(e,"Empty",{enumerable:!0,get:function(){return N.Empty}});var I=os();Object.defineProperty(e,"extractProtocolMessage",{enumerable:!0,get:function(){return I.extractProtocolMessage}}),Object.defineProperty(e,"protoLen",{enumerable:!0,get:function(){return I.protoLen}});var z=Kr();Object.defineProperty(e,"createInbox",{enumerable:!0,get:function(){return z.createInbox}}),Object.defineProperty(e,"Match",{enumerable:!0,get:function(){return z.Match}}),Object.defineProperty(e,"syncIterator",{enumerable:!0,get:function(){return z.syncIterator}});var ae=Oi();Object.defineProperty(e,"SubscriptionImpl",{enumerable:!0,get:function(){return ae.SubscriptionImpl}}),Object.defineProperty(e,"Subscriptions",{enumerable:!0,get:function(){return ae.Subscriptions}});var ke=vp();Object.defineProperty(e,"IdleHeartbeatMonitor",{enumerable:!0,get:function(){return ke.IdleHeartbeatMonitor}});var Ye=ku();Object.defineProperty(e,"isIPV4OrHostname",{enumerable:!0,get:function(){return Ye.isIPV4OrHostname}}),Object.defineProperty(e,"Servers",{enumerable:!0,get:function(){return Ye.Servers}});var it=wp();Object.defineProperty(e,"wsconnect",{enumerable:!0,get:function(){return it.wsconnect}}),Object.defineProperty(e,"wsUrlParseFn",{enumerable:!0,get:function(){return it.wsUrlParseFn}});var Ie=Yn();Object.defineProperty(e,"AuthorizationError",{enumerable:!0,get:function(){return Ie.AuthorizationError}}),Object.defineProperty(e,"ClosedConnectionError",{enumerable:!0,get:function(){return Ie.ClosedConnectionError}}),Object.defineProperty(e,"ConnectionError",{enumerable:!0,get:function(){return Ie.ConnectionError}}),Object.defineProperty(e,"DrainingConnectionError",{enumerable:!0,get:function(){return Ie.DrainingConnectionError}}),Object.defineProperty(e,"errors",{enumerable:!0,get:function(){return Ie.errors}}),Object.defineProperty(e,"InvalidArgumentError",{enumerable:!0,get:function(){return Ie.InvalidArgumentError}}),Object.defineProperty(e,"InvalidOperationError",{enumerable:!0,get:function(){return Ie.InvalidOperationError}}),Object.defineProperty(e,"InvalidSubjectError",{enumerable:!0,get:function(){return Ie.InvalidSubjectError}}),Object.defineProperty(e,"NoRespondersError",{enumerable:!0,get:function(){return Ie.NoRespondersError}}),Object.defineProperty(e,"PermissionViolationError",{enumerable:!0,get:function(){return Ie.PermissionViolationError}}),Object.defineProperty(e,"ProtocolError",{enumerable:!0,get:function(){return Ie.ProtocolError}}),Object.defineProperty(e,"RequestError",{enumerable:!0,get:function(){return Ie.RequestError}}),Object.defineProperty(e,"TimeoutError",{enumerable:!0,get:function(){return Ie.TimeoutError}}),Object.defineProperty(e,"UserAuthenticationExpiredError",{enumerable:!0,get:function(){return Ie.UserAuthenticationExpiredError}})})(Pr)),Pr}var Qc;function xp(){return Qc||(Qc=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.wsconnect=e.usernamePasswordAuthenticator=e.UserAuthenticationExpiredError=e.tokenAuthenticator=e.TimeoutError=e.syncIterator=e.RequestError=e.ProtocolError=e.PermissionViolationError=e.nuid=e.Nuid=e.NoRespondersError=e.nkeys=e.nkeyAuthenticator=e.nanos=e.MsgHdrsImpl=e.millis=e.Metric=e.Match=e.jwtAuthenticator=e.InvalidSubjectError=e.InvalidOperationError=e.InvalidArgumentError=e.headers=e.hasWsProtocol=e.errors=e.Empty=e.DrainingConnectionError=e.delay=e.deferred=e.deadline=e.credsAuthenticator=e.createInbox=e.ConnectionError=e.ClosedConnectionError=e.canonicalMIMEHeaderKey=e.buildAuthenticator=e.Bench=e.backoff=e.AuthorizationError=void 0;var t=ba();Object.defineProperty(e,"AuthorizationError",{enumerable:!0,get:function(){return t.AuthorizationError}}),Object.defineProperty(e,"backoff",{enumerable:!0,get:function(){return t.backoff}}),Object.defineProperty(e,"Bench",{enumerable:!0,get:function(){return t.Bench}}),Object.defineProperty(e,"buildAuthenticator",{enumerable:!0,get:function(){return t.buildAuthenticator}}),Object.defineProperty(e,"canonicalMIMEHeaderKey",{enumerable:!0,get:function(){return t.canonicalMIMEHeaderKey}}),Object.defineProperty(e,"ClosedConnectionError",{enumerable:!0,get:function(){return t.ClosedConnectionError}}),Object.defineProperty(e,"ConnectionError",{enumerable:!0,get:function(){return t.ConnectionError}}),Object.defineProperty(e,"createInbox",{enumerable:!0,get:function(){return t.createInbox}}),Object.defineProperty(e,"credsAuthenticator",{enumerable:!0,get:function(){return t.credsAuthenticator}}),Object.defineProperty(e,"deadline",{enumerable:!0,get:function(){return t.deadline}}),Object.defineProperty(e,"deferred",{enumerable:!0,get:function(){return t.deferred}}),Object.defineProperty(e,"delay",{enumerable:!0,get:function(){return t.delay}}),Object.defineProperty(e,"DrainingConnectionError",{enumerable:!0,get:function(){return t.DrainingConnectionError}}),Object.defineProperty(e,"Empty",{enumerable:!0,get:function(){return t.Empty}}),Object.defineProperty(e,"errors",{enumerable:!0,get:function(){return t.errors}}),Object.defineProperty(e,"hasWsProtocol",{enumerable:!0,get:function(){return t.hasWsProtocol}}),Object.defineProperty(e,"headers",{enumerable:!0,get:function(){return t.headers}}),Object.defineProperty(e,"InvalidArgumentError",{enumerable:!0,get:function(){return t.InvalidArgumentError}}),Object.defineProperty(e,"InvalidOperationError",{enumerable:!0,get:function(){return t.InvalidOperationError}}),Object.defineProperty(e,"InvalidSubjectError",{enumerable:!0,get:function(){return t.InvalidSubjectError}}),Object.defineProperty(e,"jwtAuthenticator",{enumerable:!0,get:function(){return t.jwtAuthenticator}}),Object.defineProperty(e,"Match",{enumerable:!0,get:function(){return t.Match}}),Object.defineProperty(e,"Metric",{enumerable:!0,get:function(){return t.Metric}}),Object.defineProperty(e,"millis",{enumerable:!0,get:function(){return t.millis}}),Object.defineProperty(e,"MsgHdrsImpl",{enumerable:!0,get:function(){return t.MsgHdrsImpl}}),Object.defineProperty(e,"nanos",{enumerable:!0,get:function(){return t.nanos}}),Object.defineProperty(e,"nkeyAuthenticator",{enumerable:!0,get:function(){return t.nkeyAuthenticator}}),Object.defineProperty(e,"nkeys",{enumerable:!0,get:function(){return t.nkeys}}),Object.defineProperty(e,"NoRespondersError",{enumerable:!0,get:function(){return t.NoRespondersError}}),Object.defineProperty(e,"Nuid",{enumerable:!0,get:function(){return t.Nuid}}),Object.defineProperty(e,"nuid",{enumerable:!0,get:function(){return t.nuid}}),Object.defineProperty(e,"PermissionViolationError",{enumerable:!0,get:function(){return t.PermissionViolationError}}),Object.defineProperty(e,"ProtocolError",{enumerable:!0,get:function(){return t.ProtocolError}}),Object.defineProperty(e,"RequestError",{enumerable:!0,get:function(){return t.RequestError}}),Object.defineProperty(e,"syncIterator",{enumerable:!0,get:function(){return t.syncIterator}}),Object.defineProperty(e,"TimeoutError",{enumerable:!0,get:function(){return t.TimeoutError}}),Object.defineProperty(e,"tokenAuthenticator",{enumerable:!0,get:function(){return t.tokenAuthenticator}}),Object.defineProperty(e,"UserAuthenticationExpiredError",{enumerable:!0,get:function(){return t.UserAuthenticationExpiredError}}),Object.defineProperty(e,"usernamePasswordAuthenticator",{enumerable:!0,get:function(){return t.usernamePasswordAuthenticator}}),Object.defineProperty(e,"wsconnect",{enumerable:!0,get:function(){return t.wsconnect}})})(ho)),ho}var qu=xp();const Hu="nats-dashboard-config";function Sp(){let e={};try{const t=localStorage.getItem(Hu);e=t?JSON.parse(t):{}}catch{}try{const t=new URLSearchParams(window.location.search),n=t.get("nats");n&&(e.natsUrl=n);const s=t.get("owner");s&&(e.owner=s,e.ownerLocked=!0)}catch{}return e}const Vt=nn({natsUrl:"wss://demo.nats.io:8443",discoveryInterval:5e3,owner:"",ownerLocked:!1,...Sp()});function Ap(){try{localStorage.setItem(Hu,JSON.stringify({natsUrl:Vt.natsUrl,discoveryInterval:Vt.discoveryInterval,owner:Vt.owner,ownerLocked:Vt.ownerLocked}))}catch(e){console.warn("[natsConnection] failed to persist config:",e)}}yr(Vt,Ap,{deep:!0});const tt=nn({nc:null,status:"idle",error:null,serverInfo:null,connectedAt:null});let Ci=!1;function Tp(e){return/^wss?:\/\//.test(e)}async function Ku(){if(!Tp(Vt.natsUrl))throw tt.status="error",tt.error=`Invalid URL: must start with ws:// or wss:// (got "${Vt.natsUrl}")`,new Error(tt.error);tt.nc&&await ma(),tt.status="connecting",tt.error=null;try{const e=await qu.wsconnect({servers:Vt.natsUrl,name:"nats-agent-dashboard",reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:1e3});tt.nc=e,tt.status="connected",tt.error=null,tt.serverInfo=e.info??null,tt.connectedAt=Date.now(),Ci=!1,kp(e),e.closed().then(t=>{Ci||(t&&(tt.error=t.message),tt.status="disconnected",tt.nc=null)}).catch(()=>{})}catch(e){throw tt.status="error",tt.error=e?.message??String(e),tt.nc=null,e}}async function kp(e){try{for await(const t of e.status()){if(Ci)break;switch(t.type){case"disconnect":case"staleConnection":tt.status="reconnecting";break;case"reconnecting":tt.status="reconnecting";break;case"reconnect":tt.status="connected",tt.error=null;break;case"error":case"serverError":tt.error=t.error?.message??String(t.error??t);break;case"update":break;case"close":tt.status="disconnected";break;default:break}}}catch{}}async function ma(){Ci=!0;const e=tt.nc;if(tt.nc=null,tt.status="idle",tt.error=null,tt.serverInfo=null,tt.connectedAt=null,e)try{await e.close()}catch{}}async function Op(){await ma(),await Ku()}const Yt=(e,t)=>{const n=e.__vccOpts||e;for(const[s,r]of t)n[s]=r;return n},Cp=["title"],Pp={class:"status-label"},Ip={__name:"ConnectionStatus",setup(e){const t=ct(()=>{switch(tt.status){case"connected":return"online";case"connecting":case"reconnecting":return"checking";case"error":case"disconnected":return"offline";default:return"idle"}}),n=ct(()=>{switch(tt.status){case"connected":return`Connected to ${Vt.natsUrl}`;case"connecting":return"Connecting…";case"reconnecting":return"Reconnecting…";case"disconnected":return"Disconnected";case"error":return tt.error||"Connection error";default:return"Not connected"}});return(s,r)=>(ie(),be("div",{class:Nn(["status-indicator",t.value]),title:Kt(tt).error||""},[r[0]||(r[0]=F("span",{class:"status-dot"},null,-1)),F("span",Pp,nt(n.value),1)],10,Cp))}},Rp=Yt(Ip,[["__scopeId","data-v-a1e6c04d"]]);var So={},Ao={},To={},ko={},el;function _a(){return el||(el=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ServiceVerb=e.ServiceError=e.ServiceErrorCodeHeader=e.ServiceErrorHeader=e.ServiceResponseType=void 0,e.ServiceResponseType={STATS:"io.nats.micro.v1.stats_response",INFO:"io.nats.micro.v1.info_response",PING:"io.nats.micro.v1.ping_response"},e.ServiceErrorHeader="Nats-Service-Error",e.ServiceErrorCodeHeader="Nats-Service-Error-Code";class t extends Error{code;constructor(s,r){super(r),this.code=s}static isServiceError(s){return t.toServiceError(s)!==null}static toServiceError(s){const r=s?.headers?.get(e.ServiceErrorCodeHeader)||"";if(r!==""){const i=parseInt(r)||400,o=s?.headers?.get(e.ServiceErrorHeader)||"";return new t(i,o.length?o:r)}return null}}e.ServiceError=t,e.ServiceVerb={PING:"PING",STATS:"STATS",INFO:"INFO"}})(ko)),ko}var tl;function zu(){return tl||(tl=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ServiceImpl=e.ServiceGroupImpl=e.ServiceMsgImpl=e.ServiceApiPrefix=void 0;const t=ba(),n=_a();function s(h,f=""){if(f==="")throw Error(`${h} name required`);const g=r(f);if(g.length)throw new Error(`invalid ${h} name - ${h} name ${g}`)}function r(h=""){if(!h)throw Error("name required");const f=/^[-\w]+$/g;if(h.match(f)===null){for(const b of h.split(""))if(b.match(f)===null)return`cannot contain '${b}'`}return""}e.ServiceApiPrefix="$SRV";class i{msg;constructor(f){this.msg=f}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(f,g){return this.msg.respond(f,g)}respondError(f,g,b,w){return w=w||{},w.headers=w.headers||(0,t.headers)(),w.headers?.set(n.ServiceErrorCodeHeader,`${f}`),w.headers?.set(n.ServiceErrorHeader,g),this.msg.respond(b,w)}json(f){return this.msg.json(f)}string(){return this.msg.string()}}e.ServiceMsgImpl=i;class o{subject;queue;srv;constructor(f,g="",b=""){g!==""&&l("service group",g);let w="";if(f instanceof d)this.srv=f,w="";else if(f instanceof o){const y=f;this.srv=y.srv,b===void 0&&(b=y.queue),w=y.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(w,g),this.queue=b}calcSubject(f,g=""){return g===""?f:f!==""?`${f}.${g}`:g}addEndpoint(f="",g){g=g||{subject:f};const b=typeof g=="function"?{handler:g,subject:f}:g;s("endpoint",f);let{subject:w,handler:y,metadata:x,queue:T}=b;w=w||f,T=T||this.queue,c("endpoint subject",w),w=this.calcSubject(this.subject,w);const L={name:f,subject:w,queue:T,handler:y,metadata:x};return this.srv._addEndpoint(L)}addGroup(f="",g){return g===void 0&&(g=this.queue),new o(this,f,g)}}e.ServiceGroupImpl=o;function c(h,f){if(f==="")throw new Error(`${h} cannot be empty`);if(f.indexOf(" ")!==-1)throw new Error(`${h} cannot contain spaces: '${f}'`);const g=f.split(".");g.forEach((b,w)=>{if(b===">"&&w!==g.length-1)throw new Error(`${h} cannot have internal '>': '${f}'`)})}function l(h,f){if(f.indexOf(" ")!==-1)throw new Error(`${h} cannot contain spaces: '${f}'`);f.split(".").forEach(b=>{if(b===">")throw new Error(`${h} name cannot contain internal '>': '${f}'`)})}class d{nc;_id;config;handlers;internal;_stopped;_done;started;closeListener;static controlSubject(f,g="",b="",w){const y=w??e.ServiceApiPrefix;return g===""&&b===""?`${y}.${f}`:(s("control subject name",g),b!==""?(s("control subject id",b),`${y}.${f}.${g}.${b}`):`${y}.${f}.${g}`)}constructor(f,g={name:"",version:""}){this.nc=f,this.config=Object.assign({},g),this.config.queue===void 0&&(this.config.queue="q"),g.metadata=Object.freeze(g.metadata||{}),s("name",this.config.name),this.config.queue&&s("queue",this.config.queue),(0,t.parseSemVer)(this.config.version),this._id=t.nuid.next(),this.internal=[],this._done=(0,t.deferred)(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.closeListener={connectionClosedCallback:b=>{this.close(b).catch()}},this.nc.addCloseListener(this.closeListener)}get subjects(){return this.handlers.filter(f=>f.internal===!1).map(f=>f.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(f){const g=(0,t.headers)();if(f instanceof n.ServiceError){const b=f;g.set(n.ServiceErrorHeader,b.message),g.set(n.ServiceErrorCodeHeader,`${b.code}`)}else g.set(n.ServiceErrorHeader,f.message),g.set(n.ServiceErrorCodeHeader,"500");return g}setupHandler(f,g=!1){const b=g?"":f.queue?f.queue:this.config.queue,{name:w,subject:y,handler:x}=f,T=f;T.internal=g,g&&this.internal.push(T),T.stats=new u(w,y,b),T.queue=b;const L=x?(A,D)=>{if(A){this.close(A);return}const v=Date.now();try{x(A,new i(D))}catch(N){T.stats.countError(N),D?.respond(t.Empty,{headers:this.errorToHeader(N)})}finally{T.stats.countLatency(v)}}:void 0;return T.sub=this.nc.subscribe(y,{callback:L,queue:b}),T.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${f.subject} stopped`)).catch()}).catch(A=>{if(!this._stopped){const D=new Error(`required subscription ${f.subject} errored: ${A.message}`);D.stack=A.stack,this.close(D).catch()}}),T}info(){return{type:n.ServiceResponseType.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(f=>{const{subject:g,metadata:b,name:w,queue:y}=f;return{subject:g,metadata:b,name:w,queue_group:y}})}async stats(){const f=[];for(const g of this.handlers){if(typeof this.config.statsHandler=="function")try{g.stats.data=await this.config.statsHandler(g)}catch(b){g.stats.countError(b)}f.push(g.stats.stats(g.qi))}return{type:n.ServiceResponseType.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:f}}addInternalHandler(f,g){const b=`${f}`.toUpperCase();this._doAddInternalHandler(`${b}-all`,f,g),this._doAddInternalHandler(`${b}-kind`,f,g,this.name),this._doAddInternalHandler(`${b}`,f,g,this.name,this.id)}_doAddInternalHandler(f,g,b,w="",y=""){const x={};x.name=f,x.subject=d.controlSubject(g,w,y),x.handler=b,this.setupHandler(x,!0)}start(){const f=(y,x)=>y?(this.close(y),Promise.reject(y)):this.stats().then(T=>(x?.respond(JSON.stringify(T)),Promise.resolve())),g=(y,x)=>y?(this.close(y),Promise.reject(y)):(x?.respond(JSON.stringify(this.info())),Promise.resolve()),b=JSON.stringify(this.ping()),w=(y,x)=>y?(this.close(y).then().catch(),Promise.reject(y)):(x.respond(b),Promise.resolve());return this.addInternalHandler(n.ServiceVerb.PING,w),this.addInternalHandler(n.ServiceVerb.STATS,f),this.addInternalHandler(n.ServiceVerb.INFO,g),this.handlers.forEach(y=>{const{subject:x}=y;typeof x=="string"&&y.handler!==null&&this.setupHandler(y)}),Promise.resolve(this)}close(f){if(this._stopped)return this._done;this._stopped=!0,this.nc.removeCloseListener(this.closeListener);let g=[];return this.nc.isClosed()||(g=this.handlers.concat(this.internal).map(b=>b.sub.drain())),Promise.allSettled(g).then(()=>{this._done.resolve(f||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(f){return this.close(f)}ping(){return{type:n.ServiceResponseType.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const f of this.handlers)f.stats.reset(f.qi)}addGroup(f,g){return new o(this,f,g)}addEndpoint(f,g){return new o(this).addEndpoint(f,g)}_addEndpoint(f){const g=new t.QueuedIteratorImpl;g.profile=!0,g.noIterator=typeof f.handler=="function",g.noIterator||(f.handler=(w,y)=>{w?this.stop(w).catch():g.push(new i(y))},g.iterClosed.then(()=>{this.close().catch()}));const b=this.setupHandler(f,!1);return b.sub.closed.then(w=>{w?this.stop(w):g.stop()}),b.qi=g,this.handlers.push(b),g}}e.ServiceImpl=d;class u{name;subject;average_processing_time;num_requests;processing_time;num_errors;last_error;data;metadata;queue;constructor(f,g,b=""){this.name=f,this.subject=g,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=b}reset(f){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const g=f;g&&(g.time=0,g.processed=0)}countLatency(f){this.num_requests++,this.processing_time+=(0,t.nanos)(Date.now()-f),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(f){this.num_errors++,this.last_error=f.message}_stats(){const{name:f,subject:g,average_processing_time:b,num_errors:w,num_requests:y,processing_time:x,last_error:T,data:L,queue:A}=this;return{name:f,subject:g,average_processing_time:b,num_errors:w,num_requests:y,processing_time:x,last_error:T,data:L,queue_group:A}}stats(f){const g=f;return g?.noIterator===!1&&(this.processing_time=(0,t.nanos)(g.time),this.num_requests=g.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}})(To)),To}var ks={},nl;function Np(){if(nl)return ks;nl=1,Object.defineProperty(ks,"__esModule",{value:!0}),ks.ServiceClientImpl=void 0;const e=ba(),t=zu(),n=_a();class s{nc;prefix;opts;constructor(i,o={strategy:"stall",maxWait:2e3},c){this.nc=i,this.prefix=c,this.opts=o}ping(i="",o=""){return this.q(n.ServiceVerb.PING,i,o)}stats(i="",o=""){return this.q(n.ServiceVerb.STATS,i,o)}info(i="",o=""){return this.q(n.ServiceVerb.INFO,i,o)}async q(i,o="",c=""){const l=new e.QueuedIteratorImpl,d=t.ServiceImpl.controlSubject(i,o,c,this.prefix),u=await this.nc.requestMany(d,e.Empty,this.opts);return(async()=>{for await(const h of u)try{const f=h.json();l.push(f)}catch(f){l.push(()=>{l.stop(f)})}l.push(()=>{l.stop()})})().catch(h=>{l.stop(h)}),l}}return ks.ServiceClientImpl=s,ks}var rl;function Mp(){return rl||(rl=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Svcm=e.ServiceVerb=e.ServiceResponseType=e.ServiceErrorHeader=e.ServiceErrorCodeHeader=e.ServiceError=void 0;const t=zu(),n=Np();var s=_a();Object.defineProperty(e,"ServiceError",{enumerable:!0,get:function(){return s.ServiceError}}),Object.defineProperty(e,"ServiceErrorCodeHeader",{enumerable:!0,get:function(){return s.ServiceErrorCodeHeader}}),Object.defineProperty(e,"ServiceErrorHeader",{enumerable:!0,get:function(){return s.ServiceErrorHeader}}),Object.defineProperty(e,"ServiceResponseType",{enumerable:!0,get:function(){return s.ServiceResponseType}}),Object.defineProperty(e,"ServiceVerb",{enumerable:!0,get:function(){return s.ServiceVerb}});class r{nc;constructor(o){this.nc=o}add(o){try{return new t.ServiceImpl(this.nc,o).start()}catch(c){return Promise.reject(c)}}client(o,c){return new n.ServiceClientImpl(this.nc,o,c)}}e.Svcm=r})(Ao)),Ao}var sl;function Lp(){return sl||(sl=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Svcm=e.ServiceVerb=e.ServiceResponseType=e.ServiceErrorHeader=e.ServiceErrorCodeHeader=e.ServiceError=void 0;var t=Mp();Object.defineProperty(e,"ServiceError",{enumerable:!0,get:function(){return t.ServiceError}}),Object.defineProperty(e,"ServiceErrorCodeHeader",{enumerable:!0,get:function(){return t.ServiceErrorCodeHeader}}),Object.defineProperty(e,"ServiceErrorHeader",{enumerable:!0,get:function(){return t.ServiceErrorHeader}}),Object.defineProperty(e,"ServiceResponseType",{enumerable:!0,get:function(){return t.ServiceResponseType}}),Object.defineProperty(e,"ServiceVerb",{enumerable:!0,get:function(){return t.ServiceVerb}}),Object.defineProperty(e,"Svcm",{enumerable:!0,get:function(){return t.Svcm}})})(So)),So}var Dp=Lp();const kn=nn(new Map),_r=nn({running:!1,lastError:null,lastDiscoveryAt:null,lastDiscoveryDurationMs:null,cycleCount:0}),at={PI_CHANNEL:"pi-channel",PI_EXEC_INTAKE:"pi-exec-intake",PI_EXEC_SESSION:"pi-exec-session",CLAUDE_CHANNEL:"claude-channel",OPENCLAW:"openclaw",OTHER:"other"},Gu=[at.PI_CHANNEL,at.PI_EXEC_SESSION,at.PI_EXEC_INTAKE,at.CLAUDE_CHANNEL,at.OPENCLAW,at.OTHER],Up={[at.PI_CHANNEL]:"PI Interactive",[at.PI_EXEC_SESSION]:"PI Exec Sessions",[at.PI_EXEC_INTAKE]:"PI Exec Control",[at.CLAUDE_CHANNEL]:"Claude Code",[at.OPENCLAW]:"OpenClaw",[at.OTHER]:"Other"};function Bp(e){const t=e.metadata??{},s=e.endpoints?.[0]?.subject??null;let r=at.OTHER,i=e.name,o=e.description??"",c=t.owner??"",l=t.org??"",d=t.cwd??"",u="";if(e.name==="pi-channel"&&t.platform==="pi")r=at.PI_CHANNEL,i=t.session||e.description||e.name,o=d||"";else if(e.name==="pi-exec"&&t.type==="intake")r=at.PI_EXEC_INTAKE,i=`control (${c||"?"})`,o=s||"";else if(e.name==="pi-exec"&&t.type==="session")r=at.PI_EXEC_SESSION,u=t.sessionId??"",i=u||e.description||e.name,o=d||"";else if(e.name==="claude-channel")r=at.CLAUDE_CHANNEL,i=t.session||e.description||e.name,o=s||"";else if(s?.startsWith("agents.oc."))r=at.OPENCLAW,i=e.name,o=e.description||s;else if(s?.startsWith("agents."))r=at.OTHER,i=e.name,o=s||e.description;else return null;return{id:e.id,serviceName:e.name,version:e.version,bucket:r,displayName:i,secondaryLine:o,description:e.description??"",owner:c,org:l,cwd:d,sessionId:u,subject:s,inspectSubject:s?`${s}.inspect`:null,metadata:{...t},endpoints:e.endpoints??[],lastSeen:Date.now(),missCount:0,model:void 0,thinkingLevel:void 0,remainingLifetime:void 0,activeRequest:void 0,queuedRequests:void 0,maxLifetime:void 0,createdAt:void 0,lastActivity:void 0}}async function Xs(){if(!tt.nc)return;const e=Date.now();try{const n=new Dp.Svcm(tt.nc).client({maxWait:2e3,strategy:"timer"}),s=new Set,r=await n.info();for await(const i of r){const o=Bp(i);if(!o)continue;const c=kn.get(i.id);c?(c.serviceName=o.serviceName,c.version=o.version,c.bucket=o.bucket,c.displayName=o.displayName,c.secondaryLine=o.secondaryLine,c.description=o.description,c.owner=o.owner,c.org=o.org,c.cwd=o.cwd,c.sessionId=o.sessionId,c.subject=o.subject,c.inspectSubject=o.inspectSubject,c.metadata=o.metadata,c.endpoints=o.endpoints,c.lastSeen=o.lastSeen,c.missCount=0):kn.set(i.id,nn(o)),s.add(i.id),!Vt.ownerLocked&&!Vt.owner&&o.owner&&(Vt.owner=o.owner)}for(const[i,o]of kn)s.has(i)||(o.missCount=(o.missCount??0)+1,o.missCount>=2&&kn.delete(i));_r.lastError=null,_r.lastDiscoveryAt=Date.now(),_r.lastDiscoveryDurationMs=Date.now()-e,_r.cycleCount++}catch(t){_r.lastError=t?.message??String(t)}}let gi=null;function jp(){Wu(),_r.running=!0,Xs(),gi=setInterval(Xs,Vt.discoveryInterval)}function Wu(){gi&&clearInterval(gi),gi=null,_r.running=!1}function Fp(){kn.clear()}function qp(){const e=new Map;for(const t of Gu)e.set(t,[]);for(const t of kn.values())(e.get(t.bucket)??e.get(at.OTHER)).push(t);for(const t of e.values())t.sort((n,s)=>{const r=(n.displayName??"").localeCompare(s.displayName??"");return r!==0?r:(n.id??"").localeCompare(s.id??"")});return e}function ti(e){return e?kn.get(e):null}function Hp(e){for(const t of kn.values())if(t.bucket===at.PI_EXEC_INTAKE&&t.owner===e)return t;for(const t of kn.values())if(t.bucket===at.PI_EXEC_INTAKE)return t;return null}function ya(){return Array.from(kn.values()).filter(e=>e.bucket===at.PI_EXEC_INTAKE)}const Gt=nn({selectedAgentId:null,rightPanel:"prompt",showSettings:!1,showCreateSession:!1,leftSidebarOpen:!0,rightSidebarOpen:!0});function Kp(e){if(Gt.selectedAgentId=e,!e)return;const t=ti(e);t&&(t.bucket===at.PI_EXEC_INTAKE?Gt.rightPanel!=="createSession"&&Gt.rightPanel!=="fanout"&&(Gt.rightPanel="createSession"):Gt.rightPanel="prompt")}function zp(){Gt.selectedAgentId=null}const Gp={class:"topbar"},Wp={class:"topbar-left"},Vp={class:"brand"},Yp={class:"brand-text"},Xp={class:"brand-sub"},Zp={class:"topbar-center"},Jp={__name:"TopBar",setup(e){const t=ct(()=>kn.size);function n(){Gt.showSettings=!0}return(s,r)=>(ie(),be("header",Gp,[F("div",Wp,[F("div",Vp,[r[1]||(r[1]=yh('<div class="brand-mark" data-v-65b4156b><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-65b4156b><circle cx="12" cy="12" r="3" data-v-65b4156b></circle><circle cx="4" cy="4" r="2" data-v-65b4156b></circle><circle cx="20" cy="4" r="2" data-v-65b4156b></circle><circle cx="4" cy="20" r="2" data-v-65b4156b></circle><circle cx="20" cy="20" r="2" data-v-65b4156b></circle><line x1="6" y1="5.5" x2="10.5" y2="10.5" data-v-65b4156b></line><line x1="18" y1="5.5" x2="13.5" y2="10.5" data-v-65b4156b></line><line x1="6" y1="18.5" x2="10.5" y2="13.5" data-v-65b4156b></line><line x1="18" y1="18.5" x2="13.5" y2="13.5" data-v-65b4156b></line></svg></div>',1)),F("div",Yp,[r[0]||(r[0]=F("span",{class:"brand-name"},"NATS Agent Dashboard",-1)),F("span",Xp,nt(t.value)+" agents discovered",1)])])]),F("div",Zp,[kt(Rp)]),F("div",{class:"topbar-right"},[F("button",{class:"icon-btn",onClick:n,title:"Settings","aria-label":"Settings"},[...r[2]||(r[2]=[F("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"},[F("circle",{cx:"12",cy:"12",r:"3"}),F("path",{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83
29
+ `}}$n.Metric=s;class r{nc;callbacks;msgs;size;subject;asyncRequests;pub;sub;req;rep;perf;payload;constructor(u,h={msgs:1e5,size:128,subject:"",asyncRequests:!1,pub:!1,sub:!1,req:!1,rep:!1}){if(this.nc=u,this.callbacks=h.callbacks||!1,this.msgs=h.msgs||0,this.size=h.size||0,this.subject=h.subject||t.nuid.next(),this.asyncRequests=h.asyncRequests||!1,this.pub=h.pub||!1,this.sub=h.sub||!1,this.req=h.req||!1,this.rep=h.rep||!1,this.perf=new n.Perf,this.payload=this.size?new Uint8Array(this.size):e.Empty,!this.pub&&!this.sub&&!this.req&&!this.rep)throw new Error("no options selected")}async run(){return this.nc.closed().then(u=>{if(u)throw u}),this.callbacks?await this.runCallbacks():await this.runAsync(),this.processMetrics()}processMetrics(){const u=this.nc,{lang:h,version:f}=u.protocol.transport;this.pub&&this.sub&&this.perf.measure("pubsub","pubStart","subStop"),this.req&&this.rep&&this.perf.measure("reqrep","reqStart","reqStop");const g=this.perf.getEntries(),b=g.find(v=>v.name==="pubsub"),w=g.find(v=>v.name==="reqrep"),y=g.find(v=>v.name==="req"),x=g.find(v=>v.name==="rep"),T=g.find(v=>v.name==="pub"),L=g.find(v=>v.name==="sub"),A=this.nc.stats(),D=[];if(b){const{name:v,duration:N}=b,I=new s(v,N);I.msgs=this.msgs*2,I.bytes=A.inBytes+A.outBytes,I.lang=h,I.version=f,I.payload=this.payload.length,D.push(I)}if(w){const{name:v,duration:N}=w,I=new s(v,N);I.msgs=this.msgs*2,I.bytes=A.inBytes+A.outBytes,I.lang=h,I.version=f,I.payload=this.payload.length,D.push(I)}if(T){const{name:v,duration:N}=T,I=new s(v,N);I.msgs=this.msgs,I.bytes=A.outBytes,I.lang=h,I.version=f,I.payload=this.payload.length,D.push(I)}if(L){const{name:v,duration:N}=L,I=new s(v,N);I.msgs=this.msgs,I.bytes=A.inBytes,I.lang=h,I.version=f,I.payload=this.payload.length,D.push(I)}if(x){const{name:v,duration:N}=x,I=new s(v,N);I.msgs=this.msgs,I.bytes=A.inBytes+A.outBytes,I.lang=h,I.version=f,I.payload=this.payload.length,D.push(I)}if(y){const{name:v,duration:N}=y,I=new s(v,N);I.msgs=this.msgs,I.bytes=A.inBytes+A.outBytes,I.lang=h,I.version=f,I.payload=this.payload.length,D.push(I)}return D}async runCallbacks(){const u=[];if(this.sub){const h=(0,n.deferred)();u.push(h);let f=0;this.nc.subscribe(this.subject,{max:this.msgs,callback:()=>{f++,f===1&&this.perf.mark("subStart"),f===this.msgs&&(this.perf.mark("subStop"),this.perf.measure("sub","subStart","subStop"),h.resolve())}})}if(this.rep){const h=(0,n.deferred)();u.push(h);let f=0;this.nc.subscribe(this.subject,{max:this.msgs,callback:(g,b)=>{b.respond(this.payload),f++,f===1&&this.perf.mark("repStart"),f===this.msgs&&(this.perf.mark("repStop"),this.perf.measure("rep","repStart","repStop"),h.resolve())}})}if(this.pub){const h=(async()=>{this.perf.mark("pubStart");for(let f=0;f<this.msgs;f++)this.nc.publish(this.subject,this.payload);await this.nc.flush(),this.perf.mark("pubStop"),this.perf.measure("pub","pubStart","pubStop")})();u.push(h)}if(this.req){const h=(async()=>{if(this.asyncRequests){this.perf.mark("reqStart");const f=[];for(let g=0;g<this.msgs;g++)f.push(this.nc.request(this.subject,this.payload,{timeout:2e4}));await Promise.all(f),this.perf.mark("reqStop"),this.perf.measure("req","reqStart","reqStop")}else{this.perf.mark("reqStart");for(let f=0;f<this.msgs;f++)await this.nc.request(this.subject);this.perf.mark("reqStop"),this.perf.measure("req","reqStart","reqStop")}})();u.push(h)}await Promise.all(u)}async runAsync(){const u=[];if(this.rep){let h=!1;const f=this.nc.subscribe(this.subject,{max:this.msgs}),g=(async()=>{for await(const b of f)h||(this.perf.mark("repStart"),h=!0),b.respond(this.payload);await this.nc.flush(),this.perf.mark("repStop"),this.perf.measure("rep","repStart","repStop")})();u.push(g)}if(this.sub){let h=!1;const f=this.nc.subscribe(this.subject,{max:this.msgs}),g=(async()=>{for await(const b of f)h||(this.perf.mark("subStart"),h=!0);this.perf.mark("subStop"),this.perf.measure("sub","subStart","subStop")})();u.push(g)}if(this.pub){const h=(async()=>{this.perf.mark("pubStart");for(let f=0;f<this.msgs;f++)this.nc.publish(this.subject,this.payload);await this.nc.flush(),this.perf.mark("pubStop"),this.perf.measure("pub","pubStart","pubStop")})();u.push(h)}if(this.req){const h=(async()=>{if(this.asyncRequests){this.perf.mark("reqStart");const f=[];for(let g=0;g<this.msgs;g++)f.push(this.nc.request(this.subject,this.payload,{timeout:2e4}));await Promise.all(f),this.perf.mark("reqStop"),this.perf.measure("req","reqStart","reqStop")}else{this.perf.mark("reqStart");for(let f=0;f<this.msgs;f++)await this.nc.request(this.subject);this.perf.mark("reqStop"),this.perf.measure("req","reqStart","reqStop")}})();u.push(h)}await Promise.all(u)}}$n.Bench=r;function i(d,u){return`${c(d/u)}/sec`}function o(d,u){return`${Math.floor(d/u)} msgs/sec`}function c(d,u=!1){const h=u?1e3:1024,f=u?["k","M","G","T","P","E"]:["K","M","G","T","P","E"],g=u?"iB":"B";if(d<h)return`${d.toFixed(2)} ${g}`;const b=parseInt(Math.log(d)/Math.log(h)+""),w=parseInt(b-1+"");return`${(d/Math.pow(h,b)).toFixed(2)} ${f[w]}${g}`}function l(d){return d.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}return $n}var As={},Xc;function vp(){if(Xc)return As;Xc=1,Object.defineProperty(As,"__esModule",{value:!0}),As.IdleHeartbeatMonitor=void 0;class e{interval;maxOut;cancelAfter;timer;autoCancelTimer;last;missed;count;callback;constructor(n,s,r={maxOut:2}){this.interval=n,this.maxOut=r?.maxOut||2,this.cancelAfter=r?.cancelAfter||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=s,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,s=0,r=2){this.interval=n,this.maxOut=r,this.cancelAfter=s,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}return As.IdleHeartbeatMonitor=e,As}var Lr={},Ts={},Zc;function Ep(){return Zc||(Zc=1,Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.version=void 0,Ts.version="3.3.1"),Ts}var Jc;function wp(){if(Jc)return Lr;Jc=1,Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.WsTransport=void 0,Lr.wsUrlParseFn=h,Lr.wsconnect=f;const e=cr(),t=os(),n=Qi(),s=Zi(),r=Oi(),i=ju(),o=Ep(),c=Yn(),l=o.version,d="nats.ws";class u{version;lang;closeError;connected;done;socket;options;socketClosed;encrypted;peeked;yields;signal;closedNotification;constructor(){this.version=l,this.lang=d,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=(0,e.deferred)(),this.closedNotification=(0,e.deferred)()}async connect(b,w){const y=(0,e.deferred)();this.options=w;const x=b.src;if(w.wsFactory){const{socket:T,encrypted:L}=await w.wsFactory(b.src,w);this.socket=T,this.encrypted=L}else this.encrypted=x.indexOf("wss://")===0,this.socket=new WebSocket(x);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.done&&this._closed(new Error("aborted"))},this.socket.onmessage=T=>{if(this.done)return;if(this.yields.push(new Uint8Array(T.data)),this.peeked){this.signal.resolve();return}const L=s.DataBuffer.concat(...this.yields),A=(0,t.extractProtocolMessage)(L);if(A!==""){const D=r.INFO.exec(A);if(!D){w.debug&&console.error("!!!",(0,e.render)(L)),y.reject(new Error("unexpected response from server"));return}try{const v=JSON.parse(D[1]);(0,n.checkOptions)(v,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),y.resolve()}catch(v){y.reject(v);return}}},this.socket.onclose=T=>{let L;!T.wasClean&&T.reason!==""&&(L=new Error(T.reason)),this._closed(L),this._cleanup()},this.socket.onerror=T=>{if(this.done)return;const L=T,A=new c.errors.ConnectionError(L.message);y.reject(A),this._cleanup()},y}_cleanup(){this.socketClosed===!1&&(this.socketClosed=!0,this.socket.onopen=null,this.socket.onmessage=null,this.socket.onerror=null,this.socket.onclose=null,this.closedNotification.resolve(this.closeError))}disconnect(){this._closed(void 0,!0)}async _closed(b,w=!0){if(this.done){try{this.socket.close()}catch{}return}if(this.closeError=b,!b)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await(0,e.delay)(100);this.done=!0;try{this.socket.close()}catch{}return this.closedNotification}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.done)return;this.yields.length===0&&await this.signal;const b=this.yields;this.yields=[];for(let w=0;w<b.length;w++)this.options.debug&&console.info(`> ${(0,e.render)(b[w])}`),yield b[w];if(this.done)break;this.yields.length===0&&(b.length=0,this.yields=b,this.signal=(0,e.deferred)())}}isEncrypted(){return this.connected&&this.encrypted}send(b){if(!this.done)try{this.socket.send(b.buffer),this.options.debug&&console.info(`< ${(0,e.render)(b)}`);return}catch(w){this.options.debug&&console.error(`!!! ${(0,e.render)(b)}: ${w}`)}}close(b){return this._closed(b,!1)}closed(){return this.closedNotification}discard(){this.socket?.close()}}Lr.WsTransport=u;function h(g,b){/^(.*:\/\/)(.*)/.test(g)||(typeof b=="boolean"?g=`${b===!0?"https":"http"}://${g}`:g=`https://${g}`);let y=new URL(g);const x=y.protocol.toLowerCase();x==="ws:"&&(b=!1),x==="wss:"&&(b=!0),x!=="https:"&&x!=="http"&&(g=g.replace(/^(.*:\/\/)(.*)/gm,"$2"),y=new URL(`http://${g}`));let T,L;const A=y.hostname,D=y.pathname,v=y.search||"";switch(x){case"http:":case"ws:":case"nats:":L=y.port||"80",T="ws:";break;case"https:":case"wss:":case"tls:":L=y.port||"443",T="wss:";break;default:L=y.port||b===!0?"443":"80",T=b===!0?"wss:":"ws:";break}return`${T}//${A}:${L}${D}${v}`}function f(g={}){return(0,t.setTransportFactory)({defaultPort:443,urlParseFn:h,factory:()=>{if(g.tls)throw c.InvalidArgumentError.format("tls","is not configurable on w3c websocket connections");return new u}}),i.NatsConnectionImpl.connect(g)}return Lr}var $c;function ba(){return $c||($c=1,(function(e){var t=Pr&&Pr.__createBinding||(Object.create?(function(mt,We,je,me){me===void 0&&(me=je);var rt=Object.getOwnPropertyDescriptor(We,je);(!rt||("get"in rt?!We.__esModule:rt.writable||rt.configurable))&&(rt={enumerable:!0,get:function(){return We[je]}}),Object.defineProperty(mt,me,rt)}):(function(mt,We,je,me){me===void 0&&(me=je),mt[me]=We[je]})),n=Pr&&Pr.__exportStar||function(mt,We){for(var je in mt)je!=="default"&&!Object.prototype.hasOwnProperty.call(We,je)&&t(We,mt,je)};Object.defineProperty(e,"__esModule",{value:!0}),e.Metric=e.Bench=e.writeAll=e.readAll=e.MAX_SIZE=e.DenoBuffer=e.State=e.Parser=e.Kind=e.describe=e.QueuedIteratorImpl=e.usernamePasswordAuthenticator=e.tokenAuthenticator=e.nkeyAuthenticator=e.jwtAuthenticator=e.credsAuthenticator=e.RequestOne=e.parseOptions=e.hasWsProtocol=e.defaultOptions=e.DEFAULT_MAX_RECONNECT_ATTEMPTS=e.checkUnsupportedOption=e.checkOptions=e.buildAuthenticator=e.DataBuffer=e.MuxSubscription=e.Heartbeat=e.MsgHdrsImpl=e.headers=e.canonicalMIMEHeaderKey=e.timeout=e.SimpleMutex=e.render=e.nanos=e.millis=e.extend=e.delay=e.deferred=e.deadline=e.collect=e.backoff=e.ProtocolHandler=e.INFO=e.Connect=e.setTransportFactory=e.getResolveFn=e.MsgImpl=e.nuid=e.Nuid=e.NatsConnectionImpl=void 0,e.UserAuthenticationExpiredError=e.TimeoutError=e.RequestError=e.ProtocolError=e.PermissionViolationError=e.NoRespondersError=e.InvalidSubjectError=e.InvalidOperationError=e.InvalidArgumentError=e.errors=e.DrainingConnectionError=e.ConnectionError=e.ClosedConnectionError=e.AuthorizationError=e.wsUrlParseFn=e.wsconnect=e.Servers=e.isIPV4OrHostname=e.IdleHeartbeatMonitor=e.Subscriptions=e.SubscriptionImpl=e.syncIterator=e.Match=e.createInbox=e.protoLen=e.extractProtocolMessage=e.Empty=e.parseSemVer=e.Features=e.Feature=e.compare=e.parseIP=e.isIP=e.ipV4=e.TE=e.TD=void 0;var s=ju();Object.defineProperty(e,"NatsConnectionImpl",{enumerable:!0,get:function(){return s.NatsConnectionImpl}});var r=Xi();Object.defineProperty(e,"Nuid",{enumerable:!0,get:function(){return r.Nuid}}),Object.defineProperty(e,"nuid",{enumerable:!0,get:function(){return r.nuid}});var i=Ru();Object.defineProperty(e,"MsgImpl",{enumerable:!0,get:function(){return i.MsgImpl}});var o=os();Object.defineProperty(e,"getResolveFn",{enumerable:!0,get:function(){return o.getResolveFn}}),Object.defineProperty(e,"setTransportFactory",{enumerable:!0,get:function(){return o.setTransportFactory}});var c=Oi();Object.defineProperty(e,"Connect",{enumerable:!0,get:function(){return c.Connect}}),Object.defineProperty(e,"INFO",{enumerable:!0,get:function(){return c.INFO}}),Object.defineProperty(e,"ProtocolHandler",{enumerable:!0,get:function(){return c.ProtocolHandler}});var l=cr();Object.defineProperty(e,"backoff",{enumerable:!0,get:function(){return l.backoff}}),Object.defineProperty(e,"collect",{enumerable:!0,get:function(){return l.collect}}),Object.defineProperty(e,"deadline",{enumerable:!0,get:function(){return l.deadline}}),Object.defineProperty(e,"deferred",{enumerable:!0,get:function(){return l.deferred}}),Object.defineProperty(e,"delay",{enumerable:!0,get:function(){return l.delay}}),Object.defineProperty(e,"extend",{enumerable:!0,get:function(){return l.extend}}),Object.defineProperty(e,"millis",{enumerable:!0,get:function(){return l.millis}}),Object.defineProperty(e,"nanos",{enumerable:!0,get:function(){return l.nanos}}),Object.defineProperty(e,"render",{enumerable:!0,get:function(){return l.render}}),Object.defineProperty(e,"SimpleMutex",{enumerable:!0,get:function(){return l.SimpleMutex}}),Object.defineProperty(e,"timeout",{enumerable:!0,get:function(){return l.timeout}});var d=pa();Object.defineProperty(e,"canonicalMIMEHeaderKey",{enumerable:!0,get:function(){return d.canonicalMIMEHeaderKey}}),Object.defineProperty(e,"headers",{enumerable:!0,get:function(){return d.headers}}),Object.defineProperty(e,"MsgHdrsImpl",{enumerable:!0,get:function(){return d.MsgHdrsImpl}});var u=Cu();Object.defineProperty(e,"Heartbeat",{enumerable:!0,get:function(){return u.Heartbeat}});var h=Ou();Object.defineProperty(e,"MuxSubscription",{enumerable:!0,get:function(){return h.MuxSubscription}});var f=Zi();Object.defineProperty(e,"DataBuffer",{enumerable:!0,get:function(){return f.DataBuffer}});var g=Qi();Object.defineProperty(e,"buildAuthenticator",{enumerable:!0,get:function(){return g.buildAuthenticator}}),Object.defineProperty(e,"checkOptions",{enumerable:!0,get:function(){return g.checkOptions}}),Object.defineProperty(e,"checkUnsupportedOption",{enumerable:!0,get:function(){return g.checkUnsupportedOption}}),Object.defineProperty(e,"DEFAULT_MAX_RECONNECT_ATTEMPTS",{enumerable:!0,get:function(){return g.DEFAULT_MAX_RECONNECT_ATTEMPTS}}),Object.defineProperty(e,"defaultOptions",{enumerable:!0,get:function(){return g.defaultOptions}}),Object.defineProperty(e,"hasWsProtocol",{enumerable:!0,get:function(){return g.hasWsProtocol}}),Object.defineProperty(e,"parseOptions",{enumerable:!0,get:function(){return g.parseOptions}});var b=Bu();Object.defineProperty(e,"RequestOne",{enumerable:!0,get:function(){return b.RequestOne}});var w=Uu();Object.defineProperty(e,"credsAuthenticator",{enumerable:!0,get:function(){return w.credsAuthenticator}}),Object.defineProperty(e,"jwtAuthenticator",{enumerable:!0,get:function(){return w.jwtAuthenticator}}),Object.defineProperty(e,"nkeyAuthenticator",{enumerable:!0,get:function(){return w.nkeyAuthenticator}}),Object.defineProperty(e,"tokenAuthenticator",{enumerable:!0,get:function(){return w.tokenAuthenticator}}),Object.defineProperty(e,"usernamePasswordAuthenticator",{enumerable:!0,get:function(){return w.usernamePasswordAuthenticator}}),n(Du(),e);var y=ha();Object.defineProperty(e,"QueuedIteratorImpl",{enumerable:!0,get:function(){return y.QueuedIteratorImpl}});var x=Iu();Object.defineProperty(e,"describe",{enumerable:!0,get:function(){return x.describe}}),Object.defineProperty(e,"Kind",{enumerable:!0,get:function(){return x.Kind}}),Object.defineProperty(e,"Parser",{enumerable:!0,get:function(){return x.Parser}}),Object.defineProperty(e,"State",{enumerable:!0,get:function(){return x.State}});var T=Pu();Object.defineProperty(e,"DenoBuffer",{enumerable:!0,get:function(){return T.DenoBuffer}}),Object.defineProperty(e,"MAX_SIZE",{enumerable:!0,get:function(){return T.MAX_SIZE}}),Object.defineProperty(e,"readAll",{enumerable:!0,get:function(){return T.readAll}}),Object.defineProperty(e,"writeAll",{enumerable:!0,get:function(){return T.writeAll}});var L=yp();Object.defineProperty(e,"Bench",{enumerable:!0,get:function(){return L.Bench}}),Object.defineProperty(e,"Metric",{enumerable:!0,get:function(){return L.Metric}});var A=Ln();Object.defineProperty(e,"TD",{enumerable:!0,get:function(){return A.TD}}),Object.defineProperty(e,"TE",{enumerable:!0,get:function(){return A.TE}});var D=Tu();Object.defineProperty(e,"ipV4",{enumerable:!0,get:function(){return D.ipV4}}),Object.defineProperty(e,"isIP",{enumerable:!0,get:function(){return D.isIP}}),Object.defineProperty(e,"parseIP",{enumerable:!0,get:function(){return D.parseIP}});var v=ga();Object.defineProperty(e,"compare",{enumerable:!0,get:function(){return v.compare}}),Object.defineProperty(e,"Feature",{enumerable:!0,get:function(){return v.Feature}}),Object.defineProperty(e,"Features",{enumerable:!0,get:function(){return v.Features}}),Object.defineProperty(e,"parseSemVer",{enumerable:!0,get:function(){return v.parseSemVer}});var N=Fu();Object.defineProperty(e,"Empty",{enumerable:!0,get:function(){return N.Empty}});var I=os();Object.defineProperty(e,"extractProtocolMessage",{enumerable:!0,get:function(){return I.extractProtocolMessage}}),Object.defineProperty(e,"protoLen",{enumerable:!0,get:function(){return I.protoLen}});var z=Kr();Object.defineProperty(e,"createInbox",{enumerable:!0,get:function(){return z.createInbox}}),Object.defineProperty(e,"Match",{enumerable:!0,get:function(){return z.Match}}),Object.defineProperty(e,"syncIterator",{enumerable:!0,get:function(){return z.syncIterator}});var ae=Oi();Object.defineProperty(e,"SubscriptionImpl",{enumerable:!0,get:function(){return ae.SubscriptionImpl}}),Object.defineProperty(e,"Subscriptions",{enumerable:!0,get:function(){return ae.Subscriptions}});var ke=vp();Object.defineProperty(e,"IdleHeartbeatMonitor",{enumerable:!0,get:function(){return ke.IdleHeartbeatMonitor}});var Ye=ku();Object.defineProperty(e,"isIPV4OrHostname",{enumerable:!0,get:function(){return Ye.isIPV4OrHostname}}),Object.defineProperty(e,"Servers",{enumerable:!0,get:function(){return Ye.Servers}});var it=wp();Object.defineProperty(e,"wsconnect",{enumerable:!0,get:function(){return it.wsconnect}}),Object.defineProperty(e,"wsUrlParseFn",{enumerable:!0,get:function(){return it.wsUrlParseFn}});var Ie=Yn();Object.defineProperty(e,"AuthorizationError",{enumerable:!0,get:function(){return Ie.AuthorizationError}}),Object.defineProperty(e,"ClosedConnectionError",{enumerable:!0,get:function(){return Ie.ClosedConnectionError}}),Object.defineProperty(e,"ConnectionError",{enumerable:!0,get:function(){return Ie.ConnectionError}}),Object.defineProperty(e,"DrainingConnectionError",{enumerable:!0,get:function(){return Ie.DrainingConnectionError}}),Object.defineProperty(e,"errors",{enumerable:!0,get:function(){return Ie.errors}}),Object.defineProperty(e,"InvalidArgumentError",{enumerable:!0,get:function(){return Ie.InvalidArgumentError}}),Object.defineProperty(e,"InvalidOperationError",{enumerable:!0,get:function(){return Ie.InvalidOperationError}}),Object.defineProperty(e,"InvalidSubjectError",{enumerable:!0,get:function(){return Ie.InvalidSubjectError}}),Object.defineProperty(e,"NoRespondersError",{enumerable:!0,get:function(){return Ie.NoRespondersError}}),Object.defineProperty(e,"PermissionViolationError",{enumerable:!0,get:function(){return Ie.PermissionViolationError}}),Object.defineProperty(e,"ProtocolError",{enumerable:!0,get:function(){return Ie.ProtocolError}}),Object.defineProperty(e,"RequestError",{enumerable:!0,get:function(){return Ie.RequestError}}),Object.defineProperty(e,"TimeoutError",{enumerable:!0,get:function(){return Ie.TimeoutError}}),Object.defineProperty(e,"UserAuthenticationExpiredError",{enumerable:!0,get:function(){return Ie.UserAuthenticationExpiredError}})})(Pr)),Pr}var Qc;function xp(){return Qc||(Qc=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.wsconnect=e.usernamePasswordAuthenticator=e.UserAuthenticationExpiredError=e.tokenAuthenticator=e.TimeoutError=e.syncIterator=e.RequestError=e.ProtocolError=e.PermissionViolationError=e.nuid=e.Nuid=e.NoRespondersError=e.nkeys=e.nkeyAuthenticator=e.nanos=e.MsgHdrsImpl=e.millis=e.Metric=e.Match=e.jwtAuthenticator=e.InvalidSubjectError=e.InvalidOperationError=e.InvalidArgumentError=e.headers=e.hasWsProtocol=e.errors=e.Empty=e.DrainingConnectionError=e.delay=e.deferred=e.deadline=e.credsAuthenticator=e.createInbox=e.ConnectionError=e.ClosedConnectionError=e.canonicalMIMEHeaderKey=e.buildAuthenticator=e.Bench=e.backoff=e.AuthorizationError=void 0;var t=ba();Object.defineProperty(e,"AuthorizationError",{enumerable:!0,get:function(){return t.AuthorizationError}}),Object.defineProperty(e,"backoff",{enumerable:!0,get:function(){return t.backoff}}),Object.defineProperty(e,"Bench",{enumerable:!0,get:function(){return t.Bench}}),Object.defineProperty(e,"buildAuthenticator",{enumerable:!0,get:function(){return t.buildAuthenticator}}),Object.defineProperty(e,"canonicalMIMEHeaderKey",{enumerable:!0,get:function(){return t.canonicalMIMEHeaderKey}}),Object.defineProperty(e,"ClosedConnectionError",{enumerable:!0,get:function(){return t.ClosedConnectionError}}),Object.defineProperty(e,"ConnectionError",{enumerable:!0,get:function(){return t.ConnectionError}}),Object.defineProperty(e,"createInbox",{enumerable:!0,get:function(){return t.createInbox}}),Object.defineProperty(e,"credsAuthenticator",{enumerable:!0,get:function(){return t.credsAuthenticator}}),Object.defineProperty(e,"deadline",{enumerable:!0,get:function(){return t.deadline}}),Object.defineProperty(e,"deferred",{enumerable:!0,get:function(){return t.deferred}}),Object.defineProperty(e,"delay",{enumerable:!0,get:function(){return t.delay}}),Object.defineProperty(e,"DrainingConnectionError",{enumerable:!0,get:function(){return t.DrainingConnectionError}}),Object.defineProperty(e,"Empty",{enumerable:!0,get:function(){return t.Empty}}),Object.defineProperty(e,"errors",{enumerable:!0,get:function(){return t.errors}}),Object.defineProperty(e,"hasWsProtocol",{enumerable:!0,get:function(){return t.hasWsProtocol}}),Object.defineProperty(e,"headers",{enumerable:!0,get:function(){return t.headers}}),Object.defineProperty(e,"InvalidArgumentError",{enumerable:!0,get:function(){return t.InvalidArgumentError}}),Object.defineProperty(e,"InvalidOperationError",{enumerable:!0,get:function(){return t.InvalidOperationError}}),Object.defineProperty(e,"InvalidSubjectError",{enumerable:!0,get:function(){return t.InvalidSubjectError}}),Object.defineProperty(e,"jwtAuthenticator",{enumerable:!0,get:function(){return t.jwtAuthenticator}}),Object.defineProperty(e,"Match",{enumerable:!0,get:function(){return t.Match}}),Object.defineProperty(e,"Metric",{enumerable:!0,get:function(){return t.Metric}}),Object.defineProperty(e,"millis",{enumerable:!0,get:function(){return t.millis}}),Object.defineProperty(e,"MsgHdrsImpl",{enumerable:!0,get:function(){return t.MsgHdrsImpl}}),Object.defineProperty(e,"nanos",{enumerable:!0,get:function(){return t.nanos}}),Object.defineProperty(e,"nkeyAuthenticator",{enumerable:!0,get:function(){return t.nkeyAuthenticator}}),Object.defineProperty(e,"nkeys",{enumerable:!0,get:function(){return t.nkeys}}),Object.defineProperty(e,"NoRespondersError",{enumerable:!0,get:function(){return t.NoRespondersError}}),Object.defineProperty(e,"Nuid",{enumerable:!0,get:function(){return t.Nuid}}),Object.defineProperty(e,"nuid",{enumerable:!0,get:function(){return t.nuid}}),Object.defineProperty(e,"PermissionViolationError",{enumerable:!0,get:function(){return t.PermissionViolationError}}),Object.defineProperty(e,"ProtocolError",{enumerable:!0,get:function(){return t.ProtocolError}}),Object.defineProperty(e,"RequestError",{enumerable:!0,get:function(){return t.RequestError}}),Object.defineProperty(e,"syncIterator",{enumerable:!0,get:function(){return t.syncIterator}}),Object.defineProperty(e,"TimeoutError",{enumerable:!0,get:function(){return t.TimeoutError}}),Object.defineProperty(e,"tokenAuthenticator",{enumerable:!0,get:function(){return t.tokenAuthenticator}}),Object.defineProperty(e,"UserAuthenticationExpiredError",{enumerable:!0,get:function(){return t.UserAuthenticationExpiredError}}),Object.defineProperty(e,"usernamePasswordAuthenticator",{enumerable:!0,get:function(){return t.usernamePasswordAuthenticator}}),Object.defineProperty(e,"wsconnect",{enumerable:!0,get:function(){return t.wsconnect}})})(ho)),ho}var qu=xp();const Hu="nats-dashboard-config";function Sp(){let e={};try{const t=localStorage.getItem(Hu);e=t?JSON.parse(t):{}}catch{}try{const t=new URLSearchParams(window.location.search),n=t.get("nats");n&&(e.natsUrl=n);const s=t.get("owner");s&&(e.owner=s,e.ownerLocked=!0)}catch{}return e}const Vt=nn({natsUrl:"wss://demo.nats.io:8443",discoveryInterval:5e3,owner:"",ownerLocked:!1,...Sp()});function Ap(){try{localStorage.setItem(Hu,JSON.stringify({natsUrl:Vt.natsUrl,discoveryInterval:Vt.discoveryInterval,owner:Vt.owner,ownerLocked:Vt.ownerLocked}))}catch(e){console.warn("[natsConnection] failed to persist config:",e)}}yr(Vt,Ap,{deep:!0});const tt=nn({nc:null,status:"idle",error:null,serverInfo:null,connectedAt:null});let Ci=!1;function Tp(e){return/^wss?:\/\//.test(e)}async function Ku(){if(!Tp(Vt.natsUrl))throw tt.status="error",tt.error=`Invalid URL: must start with ws:// or wss:// (got "${Vt.natsUrl}")`,new Error(tt.error);tt.nc&&await ma(),tt.status="connecting",tt.error=null;try{const e=await qu.wsconnect({servers:Vt.natsUrl,name:"nats-agent-dashboard",reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:1e3});tt.nc=e,tt.status="connected",tt.error=null,tt.serverInfo=e.info??null,tt.connectedAt=Date.now(),Ci=!1,kp(e),e.closed().then(t=>{Ci||(t&&(tt.error=t.message),tt.status="disconnected",tt.nc=null)}).catch(()=>{})}catch(e){throw tt.status="error",tt.error=e?.message??String(e),tt.nc=null,e}}async function kp(e){try{for await(const t of e.status()){if(Ci)break;switch(t.type){case"disconnect":case"staleConnection":tt.status="reconnecting";break;case"reconnecting":tt.status="reconnecting";break;case"reconnect":tt.status="connected",tt.error=null;break;case"error":case"serverError":tt.error=t.error?.message??String(t.error??t);break;case"update":break;case"close":tt.status="disconnected";break;default:break}}}catch{}}async function ma(){Ci=!0;const e=tt.nc;if(tt.nc=null,tt.status="idle",tt.error=null,tt.serverInfo=null,tt.connectedAt=null,e)try{await e.close()}catch{}}async function Op(){await ma(),await Ku()}const Yt=(e,t)=>{const n=e.__vccOpts||e;for(const[s,r]of t)n[s]=r;return n},Cp=["title"],Pp={class:"status-label"},Ip={__name:"ConnectionStatus",setup(e){const t=ct(()=>{switch(tt.status){case"connected":return"online";case"connecting":case"reconnecting":return"checking";case"error":case"disconnected":return"offline";default:return"idle"}}),n=ct(()=>{switch(tt.status){case"connected":return`Connected to ${Vt.natsUrl}`;case"connecting":return"Connecting…";case"reconnecting":return"Reconnecting…";case"disconnected":return"Disconnected";case"error":return tt.error||"Connection error";default:return"Not connected"}});return(s,r)=>(ie(),be("div",{class:Nn(["status-indicator",t.value]),title:Kt(tt).error||""},[r[0]||(r[0]=F("span",{class:"status-dot"},null,-1)),F("span",Pp,nt(n.value),1)],10,Cp))}},Rp=Yt(Ip,[["__scopeId","data-v-a1e6c04d"]]);var So={},Ao={},To={},ko={},el;function _a(){return el||(el=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ServiceVerb=e.ServiceError=e.ServiceErrorCodeHeader=e.ServiceErrorHeader=e.ServiceResponseType=void 0,e.ServiceResponseType={STATS:"io.nats.micro.v1.stats_response",INFO:"io.nats.micro.v1.info_response",PING:"io.nats.micro.v1.ping_response"},e.ServiceErrorHeader="Nats-Service-Error",e.ServiceErrorCodeHeader="Nats-Service-Error-Code";class t extends Error{code;constructor(s,r){super(r),this.code=s}static isServiceError(s){return t.toServiceError(s)!==null}static toServiceError(s){const r=s?.headers?.get(e.ServiceErrorCodeHeader)||"";if(r!==""){const i=parseInt(r)||400,o=s?.headers?.get(e.ServiceErrorHeader)||"";return new t(i,o.length?o:r)}return null}}e.ServiceError=t,e.ServiceVerb={PING:"PING",STATS:"STATS",INFO:"INFO"}})(ko)),ko}var tl;function zu(){return tl||(tl=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ServiceImpl=e.ServiceGroupImpl=e.ServiceMsgImpl=e.ServiceApiPrefix=void 0;const t=ba(),n=_a();function s(h,f=""){if(f==="")throw Error(`${h} name required`);const g=r(f);if(g.length)throw new Error(`invalid ${h} name - ${h} name ${g}`)}function r(h=""){if(!h)throw Error("name required");const f=/^[-\w]+$/g;if(h.match(f)===null){for(const b of h.split(""))if(b.match(f)===null)return`cannot contain '${b}'`}return""}e.ServiceApiPrefix="$SRV";class i{msg;constructor(f){this.msg=f}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(f,g){return this.msg.respond(f,g)}respondError(f,g,b,w){return w=w||{},w.headers=w.headers||(0,t.headers)(),w.headers?.set(n.ServiceErrorCodeHeader,`${f}`),w.headers?.set(n.ServiceErrorHeader,g),this.msg.respond(b,w)}json(f){return this.msg.json(f)}string(){return this.msg.string()}}e.ServiceMsgImpl=i;class o{subject;queue;srv;constructor(f,g="",b=""){g!==""&&l("service group",g);let w="";if(f instanceof d)this.srv=f,w="";else if(f instanceof o){const y=f;this.srv=y.srv,b===void 0&&(b=y.queue),w=y.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(w,g),this.queue=b}calcSubject(f,g=""){return g===""?f:f!==""?`${f}.${g}`:g}addEndpoint(f="",g){g=g||{subject:f};const b=typeof g=="function"?{handler:g,subject:f}:g;s("endpoint",f);let{subject:w,handler:y,metadata:x,queue:T}=b;w=w||f,T=T||this.queue,c("endpoint subject",w),w=this.calcSubject(this.subject,w);const L={name:f,subject:w,queue:T,handler:y,metadata:x};return this.srv._addEndpoint(L)}addGroup(f="",g){return g===void 0&&(g=this.queue),new o(this,f,g)}}e.ServiceGroupImpl=o;function c(h,f){if(f==="")throw new Error(`${h} cannot be empty`);if(f.indexOf(" ")!==-1)throw new Error(`${h} cannot contain spaces: '${f}'`);const g=f.split(".");g.forEach((b,w)=>{if(b===">"&&w!==g.length-1)throw new Error(`${h} cannot have internal '>': '${f}'`)})}function l(h,f){if(f.indexOf(" ")!==-1)throw new Error(`${h} cannot contain spaces: '${f}'`);f.split(".").forEach(b=>{if(b===">")throw new Error(`${h} name cannot contain internal '>': '${f}'`)})}class d{nc;_id;config;handlers;internal;_stopped;_done;started;closeListener;static controlSubject(f,g="",b="",w){const y=w??e.ServiceApiPrefix;return g===""&&b===""?`${y}.${f}`:(s("control subject name",g),b!==""?(s("control subject id",b),`${y}.${f}.${g}.${b}`):`${y}.${f}.${g}`)}constructor(f,g={name:"",version:""}){this.nc=f,this.config=Object.assign({},g),this.config.queue===void 0&&(this.config.queue="q"),g.metadata=Object.freeze(g.metadata||{}),s("name",this.config.name),this.config.queue&&s("queue",this.config.queue),(0,t.parseSemVer)(this.config.version),this._id=t.nuid.next(),this.internal=[],this._done=(0,t.deferred)(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.closeListener={connectionClosedCallback:b=>{this.close(b).catch()}},this.nc.addCloseListener(this.closeListener)}get subjects(){return this.handlers.filter(f=>f.internal===!1).map(f=>f.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(f){const g=(0,t.headers)();if(f instanceof n.ServiceError){const b=f;g.set(n.ServiceErrorHeader,b.message),g.set(n.ServiceErrorCodeHeader,`${b.code}`)}else g.set(n.ServiceErrorHeader,f.message),g.set(n.ServiceErrorCodeHeader,"500");return g}setupHandler(f,g=!1){const b=g?"":f.queue?f.queue:this.config.queue,{name:w,subject:y,handler:x}=f,T=f;T.internal=g,g&&this.internal.push(T),T.stats=new u(w,y,b),T.queue=b;const L=x?(A,D)=>{if(A){this.close(A);return}const v=Date.now();try{x(A,new i(D))}catch(N){T.stats.countError(N),D?.respond(t.Empty,{headers:this.errorToHeader(N)})}finally{T.stats.countLatency(v)}}:void 0;return T.sub=this.nc.subscribe(y,{callback:L,queue:b}),T.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${f.subject} stopped`)).catch()}).catch(A=>{if(!this._stopped){const D=new Error(`required subscription ${f.subject} errored: ${A.message}`);D.stack=A.stack,this.close(D).catch()}}),T}info(){return{type:n.ServiceResponseType.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(f=>{const{subject:g,metadata:b,name:w,queue:y}=f;return{subject:g,metadata:b,name:w,queue_group:y}})}async stats(){const f=[];for(const g of this.handlers){if(typeof this.config.statsHandler=="function")try{g.stats.data=await this.config.statsHandler(g)}catch(b){g.stats.countError(b)}f.push(g.stats.stats(g.qi))}return{type:n.ServiceResponseType.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:f}}addInternalHandler(f,g){const b=`${f}`.toUpperCase();this._doAddInternalHandler(`${b}-all`,f,g),this._doAddInternalHandler(`${b}-kind`,f,g,this.name),this._doAddInternalHandler(`${b}`,f,g,this.name,this.id)}_doAddInternalHandler(f,g,b,w="",y=""){const x={};x.name=f,x.subject=d.controlSubject(g,w,y),x.handler=b,this.setupHandler(x,!0)}start(){const f=(y,x)=>y?(this.close(y),Promise.reject(y)):this.stats().then(T=>(x?.respond(JSON.stringify(T)),Promise.resolve())),g=(y,x)=>y?(this.close(y),Promise.reject(y)):(x?.respond(JSON.stringify(this.info())),Promise.resolve()),b=JSON.stringify(this.ping()),w=(y,x)=>y?(this.close(y).then().catch(),Promise.reject(y)):(x.respond(b),Promise.resolve());return this.addInternalHandler(n.ServiceVerb.PING,w),this.addInternalHandler(n.ServiceVerb.STATS,f),this.addInternalHandler(n.ServiceVerb.INFO,g),this.handlers.forEach(y=>{const{subject:x}=y;typeof x=="string"&&y.handler!==null&&this.setupHandler(y)}),Promise.resolve(this)}close(f){if(this._stopped)return this._done;this._stopped=!0,this.nc.removeCloseListener(this.closeListener);let g=[];return this.nc.isClosed()||(g=this.handlers.concat(this.internal).map(b=>b.sub.drain())),Promise.allSettled(g).then(()=>{this._done.resolve(f||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(f){return this.close(f)}ping(){return{type:n.ServiceResponseType.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const f of this.handlers)f.stats.reset(f.qi)}addGroup(f,g){return new o(this,f,g)}addEndpoint(f,g){return new o(this).addEndpoint(f,g)}_addEndpoint(f){const g=new t.QueuedIteratorImpl;g.profile=!0,g.noIterator=typeof f.handler=="function",g.noIterator||(f.handler=(w,y)=>{w?this.stop(w).catch():g.push(new i(y))},g.iterClosed.then(()=>{this.close().catch()}));const b=this.setupHandler(f,!1);return b.sub.closed.then(w=>{w?this.stop(w):g.stop()}),b.qi=g,this.handlers.push(b),g}}e.ServiceImpl=d;class u{name;subject;average_processing_time;num_requests;processing_time;num_errors;last_error;data;metadata;queue;constructor(f,g,b=""){this.name=f,this.subject=g,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=b}reset(f){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const g=f;g&&(g.time=0,g.processed=0)}countLatency(f){this.num_requests++,this.processing_time+=(0,t.nanos)(Date.now()-f),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(f){this.num_errors++,this.last_error=f.message}_stats(){const{name:f,subject:g,average_processing_time:b,num_errors:w,num_requests:y,processing_time:x,last_error:T,data:L,queue:A}=this;return{name:f,subject:g,average_processing_time:b,num_errors:w,num_requests:y,processing_time:x,last_error:T,data:L,queue_group:A}}stats(f){const g=f;return g?.noIterator===!1&&(this.processing_time=(0,t.nanos)(g.time),this.num_requests=g.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}})(To)),To}var ks={},nl;function Np(){if(nl)return ks;nl=1,Object.defineProperty(ks,"__esModule",{value:!0}),ks.ServiceClientImpl=void 0;const e=ba(),t=zu(),n=_a();class s{nc;prefix;opts;constructor(i,o={strategy:"stall",maxWait:2e3},c){this.nc=i,this.prefix=c,this.opts=o}ping(i="",o=""){return this.q(n.ServiceVerb.PING,i,o)}stats(i="",o=""){return this.q(n.ServiceVerb.STATS,i,o)}info(i="",o=""){return this.q(n.ServiceVerb.INFO,i,o)}async q(i,o="",c=""){const l=new e.QueuedIteratorImpl,d=t.ServiceImpl.controlSubject(i,o,c,this.prefix),u=await this.nc.requestMany(d,e.Empty,this.opts);return(async()=>{for await(const h of u)try{const f=h.json();l.push(f)}catch(f){l.push(()=>{l.stop(f)})}l.push(()=>{l.stop()})})().catch(h=>{l.stop(h)}),l}}return ks.ServiceClientImpl=s,ks}var rl;function Mp(){return rl||(rl=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Svcm=e.ServiceVerb=e.ServiceResponseType=e.ServiceErrorHeader=e.ServiceErrorCodeHeader=e.ServiceError=void 0;const t=zu(),n=Np();var s=_a();Object.defineProperty(e,"ServiceError",{enumerable:!0,get:function(){return s.ServiceError}}),Object.defineProperty(e,"ServiceErrorCodeHeader",{enumerable:!0,get:function(){return s.ServiceErrorCodeHeader}}),Object.defineProperty(e,"ServiceErrorHeader",{enumerable:!0,get:function(){return s.ServiceErrorHeader}}),Object.defineProperty(e,"ServiceResponseType",{enumerable:!0,get:function(){return s.ServiceResponseType}}),Object.defineProperty(e,"ServiceVerb",{enumerable:!0,get:function(){return s.ServiceVerb}});class r{nc;constructor(o){this.nc=o}add(o){try{return new t.ServiceImpl(this.nc,o).start()}catch(c){return Promise.reject(c)}}client(o,c){return new n.ServiceClientImpl(this.nc,o,c)}}e.Svcm=r})(Ao)),Ao}var sl;function Lp(){return sl||(sl=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Svcm=e.ServiceVerb=e.ServiceResponseType=e.ServiceErrorHeader=e.ServiceErrorCodeHeader=e.ServiceError=void 0;var t=Mp();Object.defineProperty(e,"ServiceError",{enumerable:!0,get:function(){return t.ServiceError}}),Object.defineProperty(e,"ServiceErrorCodeHeader",{enumerable:!0,get:function(){return t.ServiceErrorCodeHeader}}),Object.defineProperty(e,"ServiceErrorHeader",{enumerable:!0,get:function(){return t.ServiceErrorHeader}}),Object.defineProperty(e,"ServiceResponseType",{enumerable:!0,get:function(){return t.ServiceResponseType}}),Object.defineProperty(e,"ServiceVerb",{enumerable:!0,get:function(){return t.ServiceVerb}}),Object.defineProperty(e,"Svcm",{enumerable:!0,get:function(){return t.Svcm}})})(So)),So}var Dp=Lp();const kn=nn(new Map),_r=nn({running:!1,lastError:null,lastDiscoveryAt:null,lastDiscoveryDurationMs:null,cycleCount:0}),at={PI_CHANNEL:"pi-channel",PI_EXEC_INTAKE:"pi-exec-intake",PI_EXEC_SESSION:"pi-exec-session",CLAUDE_CHANNEL:"claude-channel",OPENCLAW:"openclaw",OTHER:"other"},Gu=[at.PI_CHANNEL,at.PI_EXEC_SESSION,at.PI_EXEC_INTAKE,at.CLAUDE_CHANNEL,at.OPENCLAW,at.OTHER],Up={[at.PI_CHANNEL]:"PI Interactive",[at.PI_EXEC_SESSION]:"PI Exec Sessions",[at.PI_EXEC_INTAKE]:"PI Exec Control",[at.CLAUDE_CHANNEL]:"Claude Code",[at.OPENCLAW]:"OpenClaw",[at.OTHER]:"Other"};function Bp(e){const t=e.metadata??{},s=e.endpoints?.[0]?.subject??null;let r=at.OTHER,i=e.name,o=e.description??"",c=t.owner??"",l=t.org??"",d=t.cwd??"",u="";if(e.name==="pi-channel"&&t.platform==="pi")r=at.PI_CHANNEL,i=t.session||e.description||e.name,o=d||"";else if(e.name==="pi-exec"&&(t.type==="control"||t.type==="intake"))r=at.PI_EXEC_INTAKE,i=`control (${c||"?"})`,o=s||"";else if(e.name==="pi-exec"&&t.type==="session")r=at.PI_EXEC_SESSION,u=t.sessionId??"",i=u||e.description||e.name,o=d||"";else if(e.name==="claude-channel")r=at.CLAUDE_CHANNEL,i=t.session||e.description||e.name,o=s||"";else if(s?.startsWith("agents.oc."))r=at.OPENCLAW,i=e.name,o=e.description||s;else if(s?.startsWith("agents."))r=at.OTHER,i=e.name,o=s||e.description;else return null;return{id:e.id,serviceName:e.name,version:e.version,bucket:r,displayName:i,secondaryLine:o,description:e.description??"",owner:c,org:l,cwd:d,sessionId:u,subject:s,inspectSubject:s?`${s}.inspect`:null,metadata:{...t},endpoints:e.endpoints??[],lastSeen:Date.now(),missCount:0,model:void 0,thinkingLevel:void 0,remainingLifetime:void 0,activeRequest:void 0,queuedRequests:void 0,maxLifetime:void 0,createdAt:void 0,lastActivity:void 0}}async function Xs(){if(!tt.nc)return;const e=Date.now();try{const n=new Dp.Svcm(tt.nc).client({maxWait:2e3,strategy:"timer"}),s=new Set,r=await n.info();for await(const i of r){const o=Bp(i);if(!o)continue;const c=kn.get(i.id);c?(c.serviceName=o.serviceName,c.version=o.version,c.bucket=o.bucket,c.displayName=o.displayName,c.secondaryLine=o.secondaryLine,c.description=o.description,c.owner=o.owner,c.org=o.org,c.cwd=o.cwd,c.sessionId=o.sessionId,c.subject=o.subject,c.inspectSubject=o.inspectSubject,c.metadata=o.metadata,c.endpoints=o.endpoints,c.lastSeen=o.lastSeen,c.missCount=0):kn.set(i.id,nn(o)),s.add(i.id),!Vt.ownerLocked&&!Vt.owner&&o.owner&&(Vt.owner=o.owner)}for(const[i,o]of kn)s.has(i)||(o.missCount=(o.missCount??0)+1,o.missCount>=2&&kn.delete(i));_r.lastError=null,_r.lastDiscoveryAt=Date.now(),_r.lastDiscoveryDurationMs=Date.now()-e,_r.cycleCount++}catch(t){_r.lastError=t?.message??String(t)}}let gi=null;function jp(){Wu(),_r.running=!0,Xs(),gi=setInterval(Xs,Vt.discoveryInterval)}function Wu(){gi&&clearInterval(gi),gi=null,_r.running=!1}function Fp(){kn.clear()}function qp(){const e=new Map;for(const t of Gu)e.set(t,[]);for(const t of kn.values())(e.get(t.bucket)??e.get(at.OTHER)).push(t);for(const t of e.values())t.sort((n,s)=>{const r=(n.displayName??"").localeCompare(s.displayName??"");return r!==0?r:(n.id??"").localeCompare(s.id??"")});return e}function ti(e){return e?kn.get(e):null}function Hp(e){for(const t of kn.values())if(t.bucket===at.PI_EXEC_INTAKE&&t.owner===e)return t;for(const t of kn.values())if(t.bucket===at.PI_EXEC_INTAKE)return t;return null}function ya(){return Array.from(kn.values()).filter(e=>e.bucket===at.PI_EXEC_INTAKE)}const Gt=nn({selectedAgentId:null,rightPanel:"prompt",showSettings:!1,showCreateSession:!1,leftSidebarOpen:!0,rightSidebarOpen:!0});function Kp(e){if(Gt.selectedAgentId=e,!e)return;const t=ti(e);t&&(t.bucket===at.PI_EXEC_INTAKE?Gt.rightPanel!=="createSession"&&Gt.rightPanel!=="fanout"&&(Gt.rightPanel="createSession"):Gt.rightPanel="prompt")}function zp(){Gt.selectedAgentId=null}const Gp={class:"topbar"},Wp={class:"topbar-left"},Vp={class:"brand"},Yp={class:"brand-text"},Xp={class:"brand-sub"},Zp={class:"topbar-center"},Jp={__name:"TopBar",setup(e){const t=ct(()=>kn.size);function n(){Gt.showSettings=!0}return(s,r)=>(ie(),be("header",Gp,[F("div",Wp,[F("div",Vp,[r[1]||(r[1]=yh('<div class="brand-mark" data-v-65b4156b><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-65b4156b><circle cx="12" cy="12" r="3" data-v-65b4156b></circle><circle cx="4" cy="4" r="2" data-v-65b4156b></circle><circle cx="20" cy="4" r="2" data-v-65b4156b></circle><circle cx="4" cy="20" r="2" data-v-65b4156b></circle><circle cx="20" cy="20" r="2" data-v-65b4156b></circle><line x1="6" y1="5.5" x2="10.5" y2="10.5" data-v-65b4156b></line><line x1="18" y1="5.5" x2="13.5" y2="10.5" data-v-65b4156b></line><line x1="6" y1="18.5" x2="10.5" y2="13.5" data-v-65b4156b></line><line x1="18" y1="18.5" x2="13.5" y2="13.5" data-v-65b4156b></line></svg></div>',1)),F("div",Yp,[r[0]||(r[0]=F("span",{class:"brand-name"},"NATS Agent Dashboard",-1)),F("span",Xp,nt(t.value)+" agents discovered",1)])])]),F("div",Zp,[kt(Rp)]),F("div",{class:"topbar-right"},[F("button",{class:"icon-btn",onClick:n,title:"Settings","aria-label":"Settings"},[...r[2]||(r[2]=[F("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"},[F("circle",{cx:"12",cy:"12",r:"3"}),F("path",{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83
30
30
  2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65
31
31
  1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65
32
32
  1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m64/nats-agent-dashboard",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "Static Vue 3 dashboard for the NATS AI agent network — discover, prompt and manage agents across pi-channel, pi-exec, claude-channel and OpenClaw runtimes from a single screen, with no backend. Ships as a single HTML file or via npx.",
6
6
  "license": "Apache-2.0",