import{s as e}from"./chunk-Bj-mKKzh.js";import{na as t,sa as n}from"./src-BOCweS1p.js";import{Yo as r}from"./app-server-manager-signals-Yn0WSnoY.js";import{n as i}from"./jsx-runtime-CiQ1k8xo.js";import{W as a,at as o,h as s}from"./vscode-api-DjORcpSo.js";import{t as c}from"./persisted-atom-D9Fx3rWR.js";var l=o(!1),u=c(`has-seen-knowledge-work-announcement`,!1),d=c(`has-seen-codex-mobile-announcement`,!1),f=c(`has-seen-fast-mode-announcement`,!1),p=c(`has-seen-work-plugins-announcement`,!1),m=c(`has-seen-appgen-announcement`,!1),h=e(i(),1),g=100,_=typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`product-event-debug-log`,v=new Set,y=[],b=0;function x(){return(0,h.useSyncExternalStore)(T,S)}function S(){return y}function C({event:e,status:t,reason:n}){let r=E({event:e,status:t,reason:n});return y=[...y,r].slice(-g),D(),r.id}function w({id:e,status:t,reason:n}){let r=y.find(t=>t.id===e);if(r==null)return;let i={...r,status:t,updatedTimestampMs:Date.now(),...n==null?{}:{reason:n}};y=[...y.filter(t=>t.id!==e),i],D()}function T(e){return v.add(e),()=>{v.delete(e)}}function E(e){let t=`${_}:${String(b).padStart(10,`0`)}`;b+=1;let n=Date.now();return{id:t,timestampMs:n,updatedTimestampMs:n,...e}}function D(){v.forEach(e=>{e()})}var O=t({threadId:n().optional()});function k({hostId:e,id:t,method:n,params:i,receivedAtMs:a}){let o=r(i),s=M(n);return{hostId:e,id:t,isNoisy:s,method:n,paramsPreview:o,receivedAtMs:a,severity:j(n,s),threadId:A(i)}}function A(e){let t=O.safeParse(e);return t.success?t.data.threadId??null:null}function j(e,t){return e===`error`||e.includes(`/error`)||e.includes(`failed`)?`error`:t?`noisy`:`default`}function M(e){return e.includes(`/delta`)||e.includes(`Delta`)||e.endsWith(`/output`)}var N=300,P=a(s,!1),F=a(s,()=>[],{onMount:(e,t)=>(t.set(P,!0),()=>{t.set(P,!1)})}),I=a(s,0);function L(e,{hostId:t,method:n,params:r}){if(!e.get(P))return;let i=Date.now(),a=e.get(I),o=k({hostId:t,id:`${i}:${a}`,method:n,params:r,receivedAtMs:i});e.set(I,a+1),e.set(F,e=>[o,...e].slice(0,N))}function R(e,t){e.set(F,e=>e.filter(e=>e.hostId!==t))}export{w as a,d as c,p as d,l as f,C as i,f as l,R as n,x as o,L as r,m as s,F as t,u};
//# sourceMappingURL=app-server-notification-debug-signals-DjE3HCSs.js.map